@opentig/cli 0.1.3 → 0.1.4

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 (100) hide show
  1. package/dist/bin.mjs +2 -2
  2. package/dist/chunks/{cli-DaYybBfs.mjs → cli-B3AR8LUd.mjs} +1 -1
  3. package/dist/chunks/{cli-service-CDd3ZvGV.mjs → cli-service-B939lTxw.mjs} +1 -1
  4. package/dist/client/assets/App-BWpP-n84.js +118 -0
  5. package/dist/client/assets/{CreatePullRequestDialog-CGnY6nrw.js → CreatePullRequestDialog-CQKBUxKz.js} +2 -2
  6. package/dist/client/assets/{DiffWorkspace-1ZAh7eFX.js → DiffWorkspace-Dg7YI5fJ.js} +1 -1
  7. package/dist/client/assets/{EditableFileViewer-DOnxE6ty.js → EditableFileViewer-CmxzBnAY.js} +1 -1
  8. package/dist/client/assets/{File-DM0fcPqi.js → File-CYcpdoXz.js} +1 -1
  9. package/dist/client/assets/{FilesView-BuTZiUd4.js → FilesView-BFCwGLC2.js} +1 -1
  10. package/dist/client/assets/{GitHubAvatar-BIZ8KlZ9.js → GitHubAvatar-BcncAgKT.js} +1 -1
  11. package/dist/client/assets/{HistoryView-BTo2h2ee.js → HistoryView-Dev4CVOY.js} +1 -1
  12. package/dist/client/assets/{HtmlFileViewer-tEtrcHdG.js → HtmlFileViewer-jdBVtlNv.js} +1 -1
  13. package/dist/client/assets/{IconEdit-DtVD7NDP.js → IconEdit-DQZu_Rpb.js} +1 -1
  14. package/dist/client/assets/{IconFolderPlus-D5cPTAyD.js → IconFolderPlus-DvEWPQIQ.js} +1 -1
  15. package/dist/client/assets/{ImageFileViewer-C56bQ88S.js → ImageFileViewer-BW1MbklH.js} +1 -1
  16. package/dist/client/assets/{LocalRefsDialog-DwhpiSyu.js → LocalRefsDialog-9ggtgVW_.js} +1 -1
  17. package/dist/client/assets/{MarkdownFileViewer-BxQfoNnS.js → MarkdownFileViewer-Bhrr1l2Q.js} +2 -2
  18. package/dist/client/assets/{PairingPage-Cu1KraeJ.js → PairingPage-CkRMPzli.js} +1 -1
  19. package/dist/client/assets/{PierreDiffViewer-B9IrAdjM.js → PierreDiffViewer-CYdNkBG9.js} +1 -1
  20. package/dist/client/assets/{PierreEditBoundary-DDJlRbaP.js → PierreEditBoundary-Cu19fc5Z.js} +1 -1
  21. package/dist/client/assets/{PierreWorkerPool-BJhmuZSy.js → PierreWorkerPool-B2iHe3DC.js} +1 -1
  22. package/dist/client/assets/{PullRequestDiff-Di1_Wv1o.js → PullRequestDiff-DZRDxOx9.js} +1 -1
  23. package/dist/client/assets/{PullRequestViewer-CuH0Ze12.js → PullRequestViewer-Bsh-F3-d.js} +2 -2
  24. package/dist/client/assets/{PullRequestsView-DRKuy94k.js → PullRequestsView-Brg-sbGb.js} +1 -1
  25. package/dist/client/assets/{QuickOpenDialog-DSdrgS2H.js → QuickOpenDialog-CtJqcFuk.js} +1 -1
  26. package/dist/client/assets/{RepositoryProjectsDialog-CWcakQRC.js → RepositoryProjectsDialog-BIUnKMb-.js} +1 -1
  27. package/dist/client/assets/{SearchView-Btqv-BZZ.js → SearchView-C5_R_0ZU.js} +1 -1
  28. package/dist/client/assets/{SettingsDialog-CV7hRbtK.js → SettingsDialog-CyJA7ajO.js} +1 -1
  29. package/dist/client/assets/{Viewer-bchsRyMu.js → Viewer-xMTNRGDO.js} +2 -2
  30. package/dist/client/assets/{abnfDiagram-N423BO3Z-D6JAOs-X.js → abnfDiagram-N423BO3Z-DYcwdF-j.js} +1 -1
  31. package/dist/client/assets/{arc-YncG-7Bc.js → arc-CZ6a8_6G.js} +1 -1
  32. package/dist/client/assets/{architectureDiagram-T3A2C74G-Ckf8dhax.js → architectureDiagram-T3A2C74G-CViM1eoQ.js} +1 -1
  33. package/dist/client/assets/{blockDiagram-VBNYF7ZC-CGQa9zHO.js → blockDiagram-VBNYF7ZC-BzRc4Zb8.js} +1 -1
  34. package/dist/client/assets/{c4Diagram-5PPSVZJV-Ctgat2YZ.js → c4Diagram-5PPSVZJV-BZsdylz9.js} +1 -1
  35. package/dist/client/assets/channel-DUwjky93.js +1 -0
  36. package/dist/client/assets/{checkbox-D5IGxs1d.js → checkbox-iSOOddl1.js} +1 -1
  37. package/dist/client/assets/{chunk-2GRJ4B5K-CyDC0FQq.js → chunk-2GRJ4B5K-CsL1szop.js} +1 -1
  38. package/dist/client/assets/{chunk-2Q5K7J3B-DqYRVN1X.js → chunk-2Q5K7J3B-Dpm-BZHi.js} +1 -1
  39. package/dist/client/assets/{chunk-5RXB4S5H-BtrE-Jqe.js → chunk-5RXB4S5H-BNNb0lga.js} +1 -1
  40. package/dist/client/assets/{chunk-5VM5RSS4-CEVyxEEH.js → chunk-5VM5RSS4-CcXWQAK-.js} +1 -1
  41. package/dist/client/assets/{chunk-6Q2QTUOP-CR_RRfTb.js → chunk-6Q2QTUOP-BIpZKHoj.js} +1 -1
  42. package/dist/client/assets/{chunk-GF5L2VYU-Uoc_Vpub.js → chunk-GF5L2VYU-CXSHzIYB.js} +1 -1
  43. package/dist/client/assets/{chunk-JWPE2WC7-BAhDzsCx.js → chunk-JWPE2WC7-DxFk0X7_.js} +1 -1
  44. package/dist/client/assets/{chunk-KBJHAD2P-DkGEUlle.js → chunk-KBJHAD2P-WRKVeb4h.js} +1 -1
  45. package/dist/client/assets/{chunk-RYQCIY6F-doFXXAJb.js → chunk-RYQCIY6F-Br5DeHdX.js} +1 -1
  46. package/dist/client/assets/{chunk-XXDRQBXY-B44pCuJx.js → chunk-XXDRQBXY-DFCzSljb.js} +1 -1
  47. package/dist/client/assets/classDiagram-JCYQIIEL-BtqFLKHp.js +1 -0
  48. package/dist/client/assets/classDiagram-v2-OCEON4UE-BtqFLKHp.js +1 -0
  49. package/dist/client/assets/{cose-bilkent-JH36ORCC-CymnJ1xN.js → cose-bilkent-JH36ORCC-CE8E-qIe.js} +1 -1
  50. package/dist/client/assets/{cynefin-VYW2F7L2-BT5dARHp.js → cynefin-VYW2F7L2-CHf3vLku.js} +1 -1
  51. package/dist/client/assets/{cynefinDiagram-MW4NZA55-DVrhZ1A4.js → cynefinDiagram-MW4NZA55-90txNnhw.js} +1 -1
  52. package/dist/client/assets/{dagre-VZM6K2ZE-BET0T1KQ.js → dagre-VZM6K2ZE-6somveWH.js} +1 -1
  53. package/dist/client/assets/{diagram-7IWD3JNH-mIl4bvgD.js → diagram-7IWD3JNH-D4GP5bhO.js} +1 -1
  54. package/dist/client/assets/{diagram-B4RE2ZJO-DKSi3zok.js → diagram-B4RE2ZJO-Cz4bx70D.js} +1 -1
  55. package/dist/client/assets/{diagram-LBJQPF4R-DFzvqR_V.js → diagram-LBJQPF4R-BXjlhC7t.js} +1 -1
  56. package/dist/client/assets/{diagram-Q27KOJAE-C8UUiNSc.js → diagram-Q27KOJAE-B_dDT61b.js} +1 -1
  57. package/dist/client/assets/{diagram-UB23O5K3-CYuQnggB.js → diagram-UB23O5K3-BotmyDTm.js} +1 -1
  58. package/dist/client/assets/{ebnfDiagram-BXEA7PRR-orsOZEt3.js → ebnfDiagram-BXEA7PRR-CBey4stz.js} +1 -1
  59. package/dist/client/assets/{erDiagram-JOGREHBK-BPxNY3Or.js → erDiagram-JOGREHBK-B2g7aHUP.js} +1 -1
  60. package/dist/client/assets/{flowDiagram-UKHOOZJN-Dj_tbpt_.js → flowDiagram-UKHOOZJN-B181B3KJ.js} +1 -1
  61. package/dist/client/assets/{ganttDiagram-PKOTCBZU-BhG_1m3O.js → ganttDiagram-PKOTCBZU-BFslA07w.js} +1 -1
  62. package/dist/client/assets/{gh-utils-CR5JRkW2.js → gh-utils-rGdT2YZN.js} +1 -1
  63. package/dist/client/assets/{gitGraphDiagram-DS77QQ5N-B6i118FC.js → gitGraphDiagram-DS77QQ5N-B_uJt_Hp.js} +1 -1
  64. package/dist/client/assets/{index-CE9Jcx4e.css → index-DXR6FOp1.css} +1 -1
  65. package/dist/client/assets/{index-C_D1kOlX.js → index-DaaX_e8C.js} +2 -2
  66. package/dist/client/assets/{infoDiagram-6WML65LV-DhHBZSVb.js → infoDiagram-6WML65LV-BuajoWMd.js} +1 -1
  67. package/dist/client/assets/{ishikawaDiagram-WSZJBQD7-6Vd6XOG_.js → ishikawaDiagram-WSZJBQD7-CGRAyQ-L.js} +1 -1
  68. package/dist/client/assets/{journeyDiagram-NVQOT4AX-uH71A9mr.js → journeyDiagram-NVQOT4AX-D8bgj_4i.js} +1 -1
  69. package/dist/client/assets/{kanban-definition-27J2QSJJ-DbxRwp0h.js → kanban-definition-27J2QSJJ-QrwKHnlk.js} +1 -1
  70. package/dist/client/assets/{linear-CFzmLtpp.js → linear-BSIPbUpM.js} +1 -1
  71. package/dist/client/assets/{mermaid.core-B_Mv_eHi.js → mermaid.core-D4_R4ZQ7.js} +4 -4
  72. package/dist/client/assets/{mindmap-definition-FAOFIHXS-DQf1s9U3.js → mindmap-definition-FAOFIHXS-DTiuF5JK.js} +1 -1
  73. package/dist/client/assets/{pegDiagram-VL7TDLO6-BxFVTcDJ.js → pegDiagram-VL7TDLO6-yCIq1xSC.js} +1 -1
  74. package/dist/client/assets/{pieDiagram-7S7Q4E2Y-CCNbxGSk.js → pieDiagram-7S7Q4E2Y-B_Vgs3pz.js} +1 -1
  75. package/dist/client/assets/{quadrantDiagram-CIZ2JOQS-BVhzcmm1.js → quadrantDiagram-CIZ2JOQS-5Ne6-Suh.js} +1 -1
  76. package/dist/client/assets/{railroadDiagram-AXF67PYL-D3R2-3Og.js → railroadDiagram-AXF67PYL-CRQ23Ne5.js} +1 -1
  77. package/dist/client/assets/{render-markdown-DcHo7ihS.js → render-markdown-D7BGt-zy.js} +1 -1
  78. package/dist/client/assets/{requirementDiagram-LRYGKXZP-B-NkzvnF.js → requirementDiagram-LRYGKXZP-Ctks1nFE.js} +1 -1
  79. package/dist/client/assets/{sankeyDiagram-W5VNT64P-BRpIzFiP.js → sankeyDiagram-W5VNT64P-D127Ar8U.js} +1 -1
  80. package/dist/client/assets/{sequenceDiagram-SI44F4Z6-B7cBRL6x.js → sequenceDiagram-SI44F4Z6-6hK5AS2n.js} +1 -1
  81. package/dist/client/assets/{sizeCapture-X5ZJPWSS-BZ6DbjJ6.js → sizeCapture-X5ZJPWSS-GhdZlEoa.js} +1 -1
  82. package/dist/client/assets/{stateDiagram-OKZ733FA-x8ChPNdG.js → stateDiagram-OKZ733FA-u3G3OuQX.js} +1 -1
  83. package/dist/client/assets/{stateDiagram-v2-UEYNNEHI-BlYlvm69.js → stateDiagram-v2-UEYNNEHI-BSIBplQO.js} +1 -1
  84. package/dist/client/assets/{swimlanes-SLNWSIFB-DR21moSS.js → swimlanes-SLNWSIFB-BIfNt9T9.js} +2 -2
  85. package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-DGRBYdxa.js +8 -0
  86. package/dist/client/assets/{timeline-definition-Z64GVDOM-UlAkswoH.js → timeline-definition-Z64GVDOM-CXwiFUZq.js} +1 -1
  87. package/dist/client/assets/{vennDiagram-T6HMQDX7-91kBYEFr.js → vennDiagram-T6HMQDX7-D9Rhew2E.js} +1 -1
  88. package/dist/client/assets/{viewer-tabs-BHvOJKLx.js → viewer-tabs-BW5-uV6M.js} +1 -1
  89. package/dist/client/assets/{wardleyDiagram-T6FBY63Y-CqAHibOn.js → wardleyDiagram-T6FBY63Y-CzCcAcBb.js} +1 -1
  90. package/dist/client/assets/{xychartDiagram-ELKLHX3M-BMFs9l78.js → xychartDiagram-ELKLHX3M-BfXVbrBJ.js} +1 -1
  91. package/dist/client/index.html +2 -2
  92. package/dist/dev.mjs +2 -2
  93. package/dist/manifest.json +1 -1
  94. package/dist/service-update.mjs +1 -1
  95. package/package.json +1 -1
  96. package/dist/client/assets/App-C7Yf3r-l.js +0 -118
  97. package/dist/client/assets/channel-B31JCSE_.js +0 -1
  98. package/dist/client/assets/classDiagram-JCYQIIEL-C6tU-sLq.js +0 -1
  99. package/dist/client/assets/classDiagram-v2-OCEON4UE-C6tU-sLq.js +0 -1
  100. package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-DbXYPHRv.js +0 -8
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PullRequestDiff-Di1_Wv1o.js","assets/react-rd22PHbN.js","assets/tanstack-Bsd5UOY4.js","assets/base-ui-D4MeJpa3.js","assets/index-C_D1kOlX.js","assets/index-CE9Jcx4e.css","assets/App-C7Yf3r-l.js","assets/DiffWorkspace-1ZAh7eFX.js","assets/PierreWorkerPool-BJhmuZSy.js","assets/platform-BMNQ8V5r.js","assets/one-light-CoLDteqg.js","assets/index-BgLrS_2D.js","assets/index-CtEztN1P.js","assets/EditContext-CvJWfVl1.js","assets/render-markdown-DcHo7ihS.js"])))=>i.map(i=>d[i]);
2
- import{c as G,B as C,T as H,a as S,b as F,_ as R,o as k,q as T}from"./index-C_D1kOlX.js";import{r as j,j as e}from"./react-rd22PHbN.js";import{u as q}from"./tanstack-Bsd5UOY4.js";import{l as V,k as h,H as p,B as I,h as M,t as $,z as O}from"./App-C7Yf3r-l.js";import{V as B,a as z,b as x}from"./viewer-tabs-BHvOJKLx.js";import{p as K,r as Q,o as U}from"./gh-utils-CR5JRkW2.js";import{G as _,I as X,a as J,b as W}from"./GitHubAvatar-BIZ8KlZ9.js";/* empty css */import"./base-ui-D4MeJpa3.js";const Y=[["path",{d:"M6.5 7.5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M3 6v5.172a2 2 0 0 0 .586 1.414l7.71 7.71a2.41 2.41 0 0 0 3.408 0l5.592 -5.592a2.41 2.41 0 0 0 0 -3.408l-7.71 -7.71a2 2 0 0 0 -1.414 -.586h-5.172a3 3 0 0 0 -3 3",key:"svg-1"}]],Z=G("outline","tag","Tag",Y),ee=j.lazy(()=>R(()=>import("./PullRequestDiff-Di1_Wv1o.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])));function me({repositoryId:r,prNumber:i,diffView:n,themeType:d,wrapLines:l,onDiffViewChange:m,onWrapLinesChange:o,onClose:P}){const[v,E]=j.useState("summary"),t=q({queryKey:T.pullRequest(r,i),queryFn:async()=>{const a=await k.github.getPullRequest(r,i),A=a.body.trim()?await R(async()=>{const{renderMarkdown:u}=await import("./render-markdown-DcHo7ihS.js").then(D=>D.a);return{renderMarkdown:u}},__vite__mapDeps([14,6,4,1,2,3,5,10,11])).then(({renderMarkdown:u})=>u(a.body)).catch(()=>"<p>Could not render the description.</p>"):"";return{details:a,bodyHtml:A}}}),s=t.data?.details??null,f=t.data?.bodyHtml??"",N=t.error instanceof Error?t.error.message:t.error?"Could not load the pull request.":null,c=q({queryKey:T.pullRequestDiff(r,i),queryFn:()=>k.github.getPullRequestDiff(r,i),enabled:v==="diff"&&s!==null}),b=c.data??null,g=c.error instanceof Error?c.error.message:c.error?"Could not load the diff.":null;if(N)return e.jsxs("div",{className:"viewer-message flex-col gap-3",children:[e.jsx("p",{className:"text-destructive",children:N}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>{t.refetch()},children:[e.jsx(V,{})," Try again"]})]});if(!s)return e.jsxs("div",{className:"viewer-message",children:[e.jsx(h,{className:"spinner"})," ",e.jsx(p,{text:`Loading pull request #${i}…`})]});const w=K(s),y=Q(s.reviewDecision);return e.jsxs(B,{value:v,onValueChange:a=>E(a),className:"pr-viewer",children:[e.jsxs("header",{className:"pr-viewer-header",children:[e.jsxs("div",{className:"pr-viewer-overview",children:[e.jsxs("div",{className:"pr-viewer-title",children:[e.jsx(I,{variant:s.state==="OPEN"&&!s.isDraft?"default":"secondary",className:`pr-state-badge ${w.toLowerCase().replace(/\s+/g,"-")}`,children:w}),e.jsxs("h2",{children:[s.title||"(no title)"," ",e.jsxs("span",{className:"pr-number",children:["#",s.number]})]})]}),e.jsxs("div",{className:"pr-viewer-meta",children:[e.jsxs("span",{className:"pr-author-with-avatar",children:[e.jsx(_,{src:s.authorAvatarUrl,className:"pr-author-avatar"},s.authorAvatarUrl),e.jsx("span",{className:"pr-author",children:s.author})]}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsxs("span",{children:["updated ",L(s.updatedAt)]}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsxs("span",{className:"pr-branches",children:[e.jsx(M,{"aria-hidden":"true"})," ",s.headRefName," → ",s.baseRefName]}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsxs("span",{className:"pr-counters",children:[s.changedFiles," ",s.changedFiles===1?"file":"files"," ",e.jsxs("span",{className:"add",children:["+",s.additions]})," ",e.jsxs("span",{className:"del",children:["−",s.deletions]})]}),e.jsx(se,{state:s.checksState}),y&&e.jsx(I,{variant:"outline",className:"pr-review-badge",children:y}),e.jsx("span",{className:"pr-viewer-actions",children:e.jsxs(C,{variant:"outline",size:"xs",onClick:()=>U(s.url),children:[e.jsx($,{})," Open on GitHub"]})})]}),s.labels.length>0&&e.jsxs("div",{className:"pr-labels","aria-label":"Pull request labels",children:[e.jsx(Z,{"aria-hidden":"true"}),s.labels.map(a=>e.jsx("span",{className:"pr-label",style:{borderColor:`#${a.color}`,backgroundColor:`#${a.color}22`},children:a.name},`${a.name}-${a.color}`))]})]}),e.jsx(z,{label:"Pull request view",className:"markdown-viewer-tabs pr-viewer-tabs",items:[{value:"summary",label:"Summary"},{value:"timeline",label:"Timeline"},{value:"diff",label:"Code"}]})]}),e.jsx(x,{value:"summary",className:"markdown-preview-scroll pr-description-scroll",children:e.jsx("section",{className:"pr-summary-section",children:f?e.jsx("div",{className:"markdown-prose",dangerouslySetInnerHTML:{__html:f}}):e.jsx("p",{className:"pr-empty-description",children:"This pull request has no description."})})}),e.jsx(x,{value:"timeline",className:"markdown-preview-scroll pr-description-scroll",children:e.jsxs("section",{className:"pr-timeline standalone","aria-label":"Commit timeline",children:[e.jsxs("h3",{children:[e.jsx(O,{"aria-hidden":"true"})," Commits ",e.jsx("span",{children:s.commits.length})]}),s.commits.length?s.commits.map(a=>e.jsxs("article",{className:"pr-timeline-item",children:[e.jsx("span",{className:"pr-timeline-rail",children:e.jsx("span",{})}),e.jsx(_,{src:a.authorAvatarUrl,className:"pr-commit-avatar"}),e.jsxs("span",{className:"pr-commit-content",children:[e.jsx("strong",{children:a.messageHeadline||"(no commit message)"}),e.jsxs("span",{children:[e.jsx("b",{children:a.author})," committed ",L(a.authoredAt)]})]}),e.jsxs(H,{children:[e.jsx(S,{render:e.jsx("code",{}),children:a.oid.slice(0,7)}),e.jsx(F,{children:a.oid})]})]},a.oid)):e.jsx("p",{className:"pr-empty-description",children:"No commits were returned by GitHub."})]})}),e.jsx(x,{value:"diff",className:"pr-diff-panel",children:g?e.jsx("div",{className:"viewer-message text-destructive",children:g}):b?e.jsx(j.Suspense,{fallback:e.jsxs("div",{className:"viewer-message",children:[e.jsx(h,{className:"spinner"})," ",e.jsx(p,{text:"Loading diff viewer…"})]}),children:e.jsx(ee,{diff:b,prNumber:s.number,repositoryId:r,commits:s.commits,diffView:n,themeType:d,wrapLines:l,onDiffViewChange:m,onWrapLinesChange:o,onClose:P})}):e.jsxs("div",{className:"viewer-message",children:[e.jsx(h,{className:"spinner"})," ",e.jsx(p,{text:"Loading diff…"})]})})]})}function se({state:r}){if(r==="NONE")return null;const i=r==="PASSING"?X:r==="FAILING"?J:W,n=r==="PASSING"?"Checks passing":r==="FAILING"?"Checks failing":"Checks pending";return e.jsxs("span",{className:`pr-checks ${r.toLowerCase()}`,children:[e.jsx(i,{"aria-hidden":"true"})," ",n]})}function L(r){const i=Date.parse(r);if(!Number.isFinite(i))return r;const n=Math.round((i-Date.now())/1e3),d=[["year",31536e3],["month",2592e3],["week",604800],["day",86400],["hour",3600],["minute",60]],l=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});for(const[m,o]of d)if(Math.abs(n)>=o)return l.format(Math.round(n/o),m);return l.format(n,"second")}export{me as PullRequestViewer};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PullRequestDiff-DZRDxOx9.js","assets/react-rd22PHbN.js","assets/tanstack-Bsd5UOY4.js","assets/base-ui-D4MeJpa3.js","assets/index-DaaX_e8C.js","assets/index-DXR6FOp1.css","assets/App-BWpP-n84.js","assets/DiffWorkspace-Dg7YI5fJ.js","assets/PierreWorkerPool-B2iHe3DC.js","assets/platform-BMNQ8V5r.js","assets/one-light-CoLDteqg.js","assets/index-BgLrS_2D.js","assets/index-CtEztN1P.js","assets/EditContext-CvJWfVl1.js","assets/render-markdown-D7BGt-zy.js"])))=>i.map(i=>d[i]);
2
+ import{c as G,B as C,T as H,a as S,b as F,_ as R,o as k,q as T}from"./index-DaaX_e8C.js";import{r as j,j as e}from"./react-rd22PHbN.js";import{u as q}from"./tanstack-Bsd5UOY4.js";import{l as V,k as h,H as p,B as I,h as M,t as $,z as O}from"./App-BWpP-n84.js";import{V as B,a as z,b as x}from"./viewer-tabs-BW5-uV6M.js";import{p as K,r as Q,o as U}from"./gh-utils-rGdT2YZN.js";import{G as _,I as X,a as J,b as W}from"./GitHubAvatar-BcncAgKT.js";/* empty css */import"./base-ui-D4MeJpa3.js";const Y=[["path",{d:"M6.5 7.5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M3 6v5.172a2 2 0 0 0 .586 1.414l7.71 7.71a2.41 2.41 0 0 0 3.408 0l5.592 -5.592a2.41 2.41 0 0 0 0 -3.408l-7.71 -7.71a2 2 0 0 0 -1.414 -.586h-5.172a3 3 0 0 0 -3 3",key:"svg-1"}]],Z=G("outline","tag","Tag",Y),ee=j.lazy(()=>R(()=>import("./PullRequestDiff-DZRDxOx9.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])));function me({repositoryId:r,prNumber:i,diffView:n,themeType:d,wrapLines:l,onDiffViewChange:m,onWrapLinesChange:o,onClose:P}){const[v,E]=j.useState("summary"),t=q({queryKey:T.pullRequest(r,i),queryFn:async()=>{const a=await k.github.getPullRequest(r,i),A=a.body.trim()?await R(async()=>{const{renderMarkdown:u}=await import("./render-markdown-D7BGt-zy.js").then(D=>D.a);return{renderMarkdown:u}},__vite__mapDeps([14,6,4,1,2,3,5,10,11])).then(({renderMarkdown:u})=>u(a.body)).catch(()=>"<p>Could not render the description.</p>"):"";return{details:a,bodyHtml:A}}}),s=t.data?.details??null,f=t.data?.bodyHtml??"",N=t.error instanceof Error?t.error.message:t.error?"Could not load the pull request.":null,c=q({queryKey:T.pullRequestDiff(r,i),queryFn:()=>k.github.getPullRequestDiff(r,i),enabled:v==="diff"&&s!==null}),b=c.data??null,g=c.error instanceof Error?c.error.message:c.error?"Could not load the diff.":null;if(N)return e.jsxs("div",{className:"viewer-message flex-col gap-3",children:[e.jsx("p",{className:"text-destructive",children:N}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>{t.refetch()},children:[e.jsx(V,{})," Try again"]})]});if(!s)return e.jsxs("div",{className:"viewer-message",children:[e.jsx(h,{className:"spinner"})," ",e.jsx(p,{text:`Loading pull request #${i}…`})]});const w=K(s),y=Q(s.reviewDecision);return e.jsxs(B,{value:v,onValueChange:a=>E(a),className:"pr-viewer",children:[e.jsxs("header",{className:"pr-viewer-header",children:[e.jsxs("div",{className:"pr-viewer-overview",children:[e.jsxs("div",{className:"pr-viewer-title",children:[e.jsx(I,{variant:s.state==="OPEN"&&!s.isDraft?"default":"secondary",className:`pr-state-badge ${w.toLowerCase().replace(/\s+/g,"-")}`,children:w}),e.jsxs("h2",{children:[s.title||"(no title)"," ",e.jsxs("span",{className:"pr-number",children:["#",s.number]})]})]}),e.jsxs("div",{className:"pr-viewer-meta",children:[e.jsxs("span",{className:"pr-author-with-avatar",children:[e.jsx(_,{src:s.authorAvatarUrl,className:"pr-author-avatar"},s.authorAvatarUrl),e.jsx("span",{className:"pr-author",children:s.author})]}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsxs("span",{children:["updated ",L(s.updatedAt)]}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsxs("span",{className:"pr-branches",children:[e.jsx(M,{"aria-hidden":"true"})," ",s.headRefName," → ",s.baseRefName]}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsxs("span",{className:"pr-counters",children:[s.changedFiles," ",s.changedFiles===1?"file":"files"," ",e.jsxs("span",{className:"add",children:["+",s.additions]})," ",e.jsxs("span",{className:"del",children:["−",s.deletions]})]}),e.jsx(se,{state:s.checksState}),y&&e.jsx(I,{variant:"outline",className:"pr-review-badge",children:y}),e.jsx("span",{className:"pr-viewer-actions",children:e.jsxs(C,{variant:"outline",size:"xs",onClick:()=>U(s.url),children:[e.jsx($,{})," Open on GitHub"]})})]}),s.labels.length>0&&e.jsxs("div",{className:"pr-labels","aria-label":"Pull request labels",children:[e.jsx(Z,{"aria-hidden":"true"}),s.labels.map(a=>e.jsx("span",{className:"pr-label",style:{borderColor:`#${a.color}`,backgroundColor:`#${a.color}22`},children:a.name},`${a.name}-${a.color}`))]})]}),e.jsx(z,{label:"Pull request view",className:"markdown-viewer-tabs pr-viewer-tabs",items:[{value:"summary",label:"Summary"},{value:"timeline",label:"Timeline"},{value:"diff",label:"Code"}]})]}),e.jsx(x,{value:"summary",className:"markdown-preview-scroll pr-description-scroll",children:e.jsx("section",{className:"pr-summary-section",children:f?e.jsx("div",{className:"markdown-prose",dangerouslySetInnerHTML:{__html:f}}):e.jsx("p",{className:"pr-empty-description",children:"This pull request has no description."})})}),e.jsx(x,{value:"timeline",className:"markdown-preview-scroll pr-description-scroll",children:e.jsxs("section",{className:"pr-timeline standalone","aria-label":"Commit timeline",children:[e.jsxs("h3",{children:[e.jsx(O,{"aria-hidden":"true"})," Commits ",e.jsx("span",{children:s.commits.length})]}),s.commits.length?s.commits.map(a=>e.jsxs("article",{className:"pr-timeline-item",children:[e.jsx("span",{className:"pr-timeline-rail",children:e.jsx("span",{})}),e.jsx(_,{src:a.authorAvatarUrl,className:"pr-commit-avatar"}),e.jsxs("span",{className:"pr-commit-content",children:[e.jsx("strong",{children:a.messageHeadline||"(no commit message)"}),e.jsxs("span",{children:[e.jsx("b",{children:a.author})," committed ",L(a.authoredAt)]})]}),e.jsxs(H,{children:[e.jsx(S,{render:e.jsx("code",{}),children:a.oid.slice(0,7)}),e.jsx(F,{children:a.oid})]})]},a.oid)):e.jsx("p",{className:"pr-empty-description",children:"No commits were returned by GitHub."})]})}),e.jsx(x,{value:"diff",className:"pr-diff-panel",children:g?e.jsx("div",{className:"viewer-message text-destructive",children:g}):b?e.jsx(j.Suspense,{fallback:e.jsxs("div",{className:"viewer-message",children:[e.jsx(h,{className:"spinner"})," ",e.jsx(p,{text:"Loading diff viewer…"})]}),children:e.jsx(ee,{diff:b,prNumber:s.number,repositoryId:r,commits:s.commits,diffView:n,themeType:d,wrapLines:l,onDiffViewChange:m,onWrapLinesChange:o,onClose:P})}):e.jsxs("div",{className:"viewer-message",children:[e.jsx(h,{className:"spinner"})," ",e.jsx(p,{text:"Loading diff…"})]})})]})}function se({state:r}){if(r==="NONE")return null;const i=r==="PASSING"?X:r==="FAILING"?J:W,n=r==="PASSING"?"Checks passing":r==="FAILING"?"Checks failing":"Checks pending";return e.jsxs("span",{className:`pr-checks ${r.toLowerCase()}`,children:[e.jsx(i,{"aria-hidden":"true"})," ",n]})}function L(r){const i=Date.parse(r);if(!Number.isFinite(i))return r;const n=Math.round((i-Date.now())/1e3),d=[["year",31536e3],["month",2592e3],["week",604800],["day",86400],["hour",3600],["minute",60]],l=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});for(const[m,o]of d)if(Math.abs(n)>=o)return l.format(Math.round(n/o),m);return l.format(n,"second")}export{me as PullRequestViewer};
@@ -1 +1 @@
1
- import{j as e,r as b}from"./react-rd22PHbN.js";import{a as p}from"./tanstack-Bsd5UOY4.js";import{c as N,B as t,I as f,T as c,a as o,b as u}from"./index-C_D1kOlX.js";import{C as k}from"./checkbox-D5IGxs1d.js";import{k as h,H as x,l as j,a2 as I,U as y,t as S}from"./App-C7Yf3r-l.js";import{o as w}from"./gh-utils-CR5JRkW2.js";import{G as P,I as R,a as E,b as G}from"./GitHubAvatar-BIZ8KlZ9.js";import{P as L,i as O,j as D,k as T,l as M}from"./base-ui-D4MeJpa3.js";const z=[["path",{d:"M9 19c-4.3 1.4 -4.3 -2.5 -6 -3m12 5v-3.5c0 -1 .1 -1.4 -.5 -2c2.8 -.3 5.5 -1.4 5.5 -6a4.6 4.6 0 0 0 -1.3 -3.2a4.2 4.2 0 0 0 -.1 -3.2s-1.1 -.3 -3.5 1.3a12.3 12.3 0 0 0 -6.2 0c-2.4 -1.6 -3.5 -1.3 -3.5 -1.3a4.2 4.2 0 0 0 -.1 3.2a4.6 4.6 0 0 0 -1.3 3.2c0 4.6 2.7 5.7 5.5 6c-.6 .6 -.6 1.2 -.5 2v3.5",key:"svg-0"}]],d=N("outline","brand-github","BrandGithub",z);const q=[["path",{d:"M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227",key:"svg-0"}]],$=N("outline","filter","Filter",q);const H=[["path",{d:"M5 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-0"}],["path",{d:"M5 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M15 12a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-2"}],["path",{d:"M7 8l0 8",key:"svg-3"}],["path",{d:"M7 8a4 4 0 0 0 4 4h4",key:"svg-4"}]],A=N("outline","git-merge","GitMerge",H);function ae(s){return s.info===null?e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(h,{className:"spinner"})," ",e.jsx(x,{text:"Checking repository…"})]}):s.info.isGitHub?s.ghStatus===null?e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(h,{className:"spinner"})," ",e.jsx(x,{text:"Checking GitHub CLI…"})]}):s.ghStatus.installed?s.ghStatus.authStatus==="unauthenticated"?e.jsxs(m,{icon:e.jsx(d,{}),title:"Sign in to GitHub CLI",children:["Run ",e.jsx("code",{children:"gh auth login"})," in a terminal to authenticate, then check again.",e.jsxs("span",{className:"pulls-notice-actions",children:[e.jsxs(t,{variant:"outline",size:"sm",onClick:()=>s.onCopyCommand("gh auth login"),children:[e.jsx(f,{})," Copy command"]}),e.jsxs(t,{variant:"ghost",size:"sm",onClick:s.onRefresh,children:[e.jsx(j,{})," Check again"]})]})]}):e.jsx(F,{...s,nameWithOwner:s.info.nameWithOwner??""}):e.jsxs(m,{icon:e.jsx(d,{}),title:"GitHub CLI is required",children:["OpenTig uses your local ",e.jsx("code",{children:"gh"})," session to read and create pull requests. It does not copy or store credentials.",e.jsxs("span",{className:"pulls-notice-actions",children:[e.jsxs(t,{variant:"outline",size:"sm",onClick:()=>s.onCopyCommand("winget install GitHub.cli"),children:[e.jsx(f,{})," Copy install command"]}),e.jsxs(t,{variant:"ghost",size:"sm",onClick:s.onRefresh,children:[e.jsx(j,{})," Check again"]})]}),e.jsx("small",{children:"Download from cli.github.com, then check again."})]}):e.jsxs(m,{icon:e.jsx(d,{}),title:"Not a GitHub repository",children:["The ",e.jsx("code",{children:"origin"})," remote does not point to github.com, so pull requests are unavailable here."]})}function F(s){const l=b.useRef(null),n=s.pulls,i=p({count:n?.length??0,getScrollElement:()=>l.current,estimateSize:()=>68,getItemKey:a=>n?.[a]?.number??a,overscan:8});return e.jsxs("div",{className:"pulls-view",children:[e.jsxs("div",{className:"pulls-toolbar",children:[e.jsxs(c,{children:[e.jsxs(o,{render:e.jsx("span",{className:"pulls-repo"}),children:[e.jsx(d,{"aria-hidden":"true"})," ",s.nameWithOwner]}),e.jsx(u,{children:s.nameWithOwner})]}),e.jsxs(c,{children:[e.jsx(o,{render:e.jsx(t,{variant:"ghost",size:"icon-xs",className:"change-action-button",disabled:s.loading,onClick:s.onRefresh,"aria-label":"Refresh pull requests"}),children:s.loading?e.jsx(h,{className:"animate-spin"}):e.jsx(j,{})}),e.jsx(u,{children:"Refresh pull requests"})]}),e.jsxs(L,{children:[e.jsx(O,{render:e.jsx(t,{variant:v(s.states)?"ghost":"secondary",size:"icon-xs",className:"change-action-button","aria-label":"Filter pull requests","aria-pressed":!v(s.states)}),children:e.jsx($,{})}),e.jsx(D,{children:e.jsx(T,{side:"bottom",align:"end",sideOffset:4,className:"isolate z-50 outline-none",children:e.jsxs(M,{className:"pulls-filter-popup",children:[e.jsx("span",{className:"pulls-filter-title",children:"State"}),["OPEN","CLOSED","MERGED"].map(a=>e.jsxs("label",{htmlFor:`pulls-state-${a.toLowerCase()}`,className:"pulls-filter-option",children:[e.jsx(k,{id:`pulls-state-${a.toLowerCase()}`,checked:s.states.includes(a),onCheckedChange:r=>s.onStateChange(a,r===!0)}),e.jsx(C,{state:a,className:a.toLowerCase()}),e.jsx("span",{children:a==="OPEN"?"Open":a==="CLOSED"?"Closed":"Merged"})]},a))]})})})]}),e.jsxs(c,{children:[e.jsxs(o,{render:e.jsx(t,{variant:"outline",size:"xs",disabled:!!s.createDisabledReason||s.loading,onClick:s.onCreate,"aria-label":"Create pull request"}),children:[e.jsx(I,{})," New"]}),e.jsx(u,{children:s.createDisabledReason??"Create a pull request from the current branch"})]})]}),s.error&&e.jsxs("div",{className:"pulls-error",role:"alert",children:[e.jsx("span",{children:s.error}),e.jsx(t,{variant:"ghost",size:"xs",onClick:s.onRefresh,children:"Retry"})]}),e.jsx("div",{ref:l,className:"pulls-scroll",role:"list","aria-label":`${s.states.map(g).join(", ")||"No"} pull requests`,children:n===null&&!s.error?e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(h,{className:"spinner"})," ",e.jsx(x,{text:"Loading pull requests…"})]}):n!==null&&n.length===0?e.jsx("p",{className:"empty-list",children:s.states.length?`No ${s.states.map(a=>g(a).toLowerCase()).join(", ")} pull requests.`:"Select at least one PR state."}):n!==null&&e.jsx("div",{className:"virtual-list",style:{height:i.getTotalSize()},children:i.getVirtualItems().map(a=>{const r=n[a.index];return e.jsx("div",{ref:i.measureElement,"data-index":a.index,className:"virtual-row",style:{transform:`translateY(${a.start}px)`},children:e.jsx(_,{pr:r,active:s.activeNumber===r.number,onSelect:s.onSelect})},a.key)})})})]})}function _({pr:s,active:l,onSelect:n}){const i=s.state.toLowerCase(),a=W(s.updatedAt);return e.jsxs("div",{className:`pull-item ${l?"active":""}`,role:"listitem",children:[e.jsxs("button",{className:"pull-main",onClick:()=>n(s),"aria-label":`View pull request #${s.number}`,children:[e.jsx("span",{className:`pull-state-icon ${i}${s.isDraft?" draft":""}`,"aria-label":s.isDraft?"Draft":g(s.state),children:e.jsx(C,{state:s.state})}),e.jsxs("span",{className:"pull-content",children:[e.jsx("span",{className:"pull-title",children:s.title||"(no title)"}),e.jsxs("span",{className:"pull-meta",children:[e.jsxs("span",{className:"pull-number",children:["#",s.number]}),e.jsx(P,{src:s.authorAvatarUrl,className:"pull-avatar"}),e.jsx("span",{className:"pull-author",children:s.author}),e.jsx(V,{state:s.checksState}),s.isDraft&&e.jsx("span",{className:"pull-draft-label",children:"Draft"})]})]}),e.jsxs("span",{className:"pull-row-aside",children:[a&&e.jsx("span",{children:a}),e.jsxs("span",{className:"pull-line-stats",children:[e.jsxs("span",{className:"add",children:["+",s.additions]})," ",e.jsxs("span",{className:"del",children:["−",s.deletions]})]})]})]}),e.jsxs(c,{children:[e.jsx(o,{render:e.jsx(t,{variant:"ghost",size:"icon-xs",className:"change-action-button pull-open-external",onClick:()=>w(s.url),"aria-label":`Open #${s.number} on GitHub`}),children:e.jsx(S,{})}),e.jsx(u,{children:"Open on GitHub"})]})]})}function C({state:s,className:l}){return s==="MERGED"?e.jsx(A,{"aria-hidden":"true",className:l}):e.jsx(y,{"aria-hidden":"true",className:l})}function V({state:s}){if(s==="NONE")return null;const l=s==="PASSING"?"Checks passing":s==="FAILING"?"Checks failing":"Checks pending",n=s==="PASSING"?R:s==="FAILING"?E:G;return e.jsx("span",{className:`pull-checks ${s.toLowerCase()}`,"aria-label":l,children:e.jsx(n,{"aria-hidden":"true"})})}function g(s){return s==="OPEN"?"Open":s==="CLOSED"?"Closed":"Merged"}function v(s){return s.length===1&&s[0]==="OPEN"}function m({icon:s,title:l,children:n}){return e.jsxs("div",{className:"pulls-notice",children:[e.jsx("span",{className:"pulls-notice-icon","aria-hidden":"true",children:s}),e.jsx("strong",{children:l}),e.jsx("p",{children:n})]})}const B=new Intl.RelativeTimeFormat("en",{numeric:"auto"}),U=[["year",31536e3],["month",2592e3],["week",604800],["day",86400],["hour",3600],["minute",60]];function W(s){const l=new Date(s);if(Number.isNaN(l.getTime()))return null;const n=Math.round((l.getTime()-Date.now())/1e3);for(const[i,a]of U)if(Math.abs(n)>=a)return B.format(Math.trunc(n/a),i);return"right now"}export{ae as PullRequestsView};
1
+ import{j as e,r as b}from"./react-rd22PHbN.js";import{a as p}from"./tanstack-Bsd5UOY4.js";import{c as N,B as t,I as f,T as c,a as o,b as u}from"./index-DaaX_e8C.js";import{C as k}from"./checkbox-iSOOddl1.js";import{k as h,H as x,l as j,a2 as I,U as y,t as S}from"./App-BWpP-n84.js";import{o as w}from"./gh-utils-rGdT2YZN.js";import{G as P,I as R,a as E,b as G}from"./GitHubAvatar-BcncAgKT.js";import{P as L,i as O,j as D,k as T,l as M}from"./base-ui-D4MeJpa3.js";const z=[["path",{d:"M9 19c-4.3 1.4 -4.3 -2.5 -6 -3m12 5v-3.5c0 -1 .1 -1.4 -.5 -2c2.8 -.3 5.5 -1.4 5.5 -6a4.6 4.6 0 0 0 -1.3 -3.2a4.2 4.2 0 0 0 -.1 -3.2s-1.1 -.3 -3.5 1.3a12.3 12.3 0 0 0 -6.2 0c-2.4 -1.6 -3.5 -1.3 -3.5 -1.3a4.2 4.2 0 0 0 -.1 3.2a4.6 4.6 0 0 0 -1.3 3.2c0 4.6 2.7 5.7 5.5 6c-.6 .6 -.6 1.2 -.5 2v3.5",key:"svg-0"}]],d=N("outline","brand-github","BrandGithub",z);const q=[["path",{d:"M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227",key:"svg-0"}]],$=N("outline","filter","Filter",q);const H=[["path",{d:"M5 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-0"}],["path",{d:"M5 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M15 12a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-2"}],["path",{d:"M7 8l0 8",key:"svg-3"}],["path",{d:"M7 8a4 4 0 0 0 4 4h4",key:"svg-4"}]],A=N("outline","git-merge","GitMerge",H);function ae(s){return s.info===null?e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(h,{className:"spinner"})," ",e.jsx(x,{text:"Checking repository…"})]}):s.info.isGitHub?s.ghStatus===null?e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(h,{className:"spinner"})," ",e.jsx(x,{text:"Checking GitHub CLI…"})]}):s.ghStatus.installed?s.ghStatus.authStatus==="unauthenticated"?e.jsxs(m,{icon:e.jsx(d,{}),title:"Sign in to GitHub CLI",children:["Run ",e.jsx("code",{children:"gh auth login"})," in a terminal to authenticate, then check again.",e.jsxs("span",{className:"pulls-notice-actions",children:[e.jsxs(t,{variant:"outline",size:"sm",onClick:()=>s.onCopyCommand("gh auth login"),children:[e.jsx(f,{})," Copy command"]}),e.jsxs(t,{variant:"ghost",size:"sm",onClick:s.onRefresh,children:[e.jsx(j,{})," Check again"]})]})]}):e.jsx(F,{...s,nameWithOwner:s.info.nameWithOwner??""}):e.jsxs(m,{icon:e.jsx(d,{}),title:"GitHub CLI is required",children:["OpenTig uses your local ",e.jsx("code",{children:"gh"})," session to read and create pull requests. It does not copy or store credentials.",e.jsxs("span",{className:"pulls-notice-actions",children:[e.jsxs(t,{variant:"outline",size:"sm",onClick:()=>s.onCopyCommand("winget install GitHub.cli"),children:[e.jsx(f,{})," Copy install command"]}),e.jsxs(t,{variant:"ghost",size:"sm",onClick:s.onRefresh,children:[e.jsx(j,{})," Check again"]})]}),e.jsx("small",{children:"Download from cli.github.com, then check again."})]}):e.jsxs(m,{icon:e.jsx(d,{}),title:"Not a GitHub repository",children:["The ",e.jsx("code",{children:"origin"})," remote does not point to github.com, so pull requests are unavailable here."]})}function F(s){const l=b.useRef(null),n=s.pulls,i=p({count:n?.length??0,getScrollElement:()=>l.current,estimateSize:()=>68,getItemKey:a=>n?.[a]?.number??a,overscan:8});return e.jsxs("div",{className:"pulls-view",children:[e.jsxs("div",{className:"pulls-toolbar",children:[e.jsxs(c,{children:[e.jsxs(o,{render:e.jsx("span",{className:"pulls-repo"}),children:[e.jsx(d,{"aria-hidden":"true"})," ",s.nameWithOwner]}),e.jsx(u,{children:s.nameWithOwner})]}),e.jsxs(c,{children:[e.jsx(o,{render:e.jsx(t,{variant:"ghost",size:"icon-xs",className:"change-action-button",disabled:s.loading,onClick:s.onRefresh,"aria-label":"Refresh pull requests"}),children:s.loading?e.jsx(h,{className:"animate-spin"}):e.jsx(j,{})}),e.jsx(u,{children:"Refresh pull requests"})]}),e.jsxs(L,{children:[e.jsx(O,{render:e.jsx(t,{variant:v(s.states)?"ghost":"secondary",size:"icon-xs",className:"change-action-button","aria-label":"Filter pull requests","aria-pressed":!v(s.states)}),children:e.jsx($,{})}),e.jsx(D,{children:e.jsx(T,{side:"bottom",align:"end",sideOffset:4,className:"isolate z-50 outline-none",children:e.jsxs(M,{className:"pulls-filter-popup",children:[e.jsx("span",{className:"pulls-filter-title",children:"State"}),["OPEN","CLOSED","MERGED"].map(a=>e.jsxs("label",{htmlFor:`pulls-state-${a.toLowerCase()}`,className:"pulls-filter-option",children:[e.jsx(k,{id:`pulls-state-${a.toLowerCase()}`,checked:s.states.includes(a),onCheckedChange:r=>s.onStateChange(a,r===!0)}),e.jsx(C,{state:a,className:a.toLowerCase()}),e.jsx("span",{children:a==="OPEN"?"Open":a==="CLOSED"?"Closed":"Merged"})]},a))]})})})]}),e.jsxs(c,{children:[e.jsxs(o,{render:e.jsx(t,{variant:"outline",size:"xs",disabled:!!s.createDisabledReason||s.loading,onClick:s.onCreate,"aria-label":"Create pull request"}),children:[e.jsx(I,{})," New"]}),e.jsx(u,{children:s.createDisabledReason??"Create a pull request from the current branch"})]})]}),s.error&&e.jsxs("div",{className:"pulls-error",role:"alert",children:[e.jsx("span",{children:s.error}),e.jsx(t,{variant:"ghost",size:"xs",onClick:s.onRefresh,children:"Retry"})]}),e.jsx("div",{ref:l,className:"pulls-scroll",role:"list","aria-label":`${s.states.map(g).join(", ")||"No"} pull requests`,children:n===null&&!s.error?e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(h,{className:"spinner"})," ",e.jsx(x,{text:"Loading pull requests…"})]}):n!==null&&n.length===0?e.jsx("p",{className:"empty-list",children:s.states.length?`No ${s.states.map(a=>g(a).toLowerCase()).join(", ")} pull requests.`:"Select at least one PR state."}):n!==null&&e.jsx("div",{className:"virtual-list",style:{height:i.getTotalSize()},children:i.getVirtualItems().map(a=>{const r=n[a.index];return e.jsx("div",{ref:i.measureElement,"data-index":a.index,className:"virtual-row",style:{transform:`translateY(${a.start}px)`},children:e.jsx(_,{pr:r,active:s.activeNumber===r.number,onSelect:s.onSelect})},a.key)})})})]})}function _({pr:s,active:l,onSelect:n}){const i=s.state.toLowerCase(),a=W(s.updatedAt);return e.jsxs("div",{className:`pull-item ${l?"active":""}`,role:"listitem",children:[e.jsxs("button",{className:"pull-main",onClick:()=>n(s),"aria-label":`View pull request #${s.number}`,children:[e.jsx("span",{className:`pull-state-icon ${i}${s.isDraft?" draft":""}`,"aria-label":s.isDraft?"Draft":g(s.state),children:e.jsx(C,{state:s.state})}),e.jsxs("span",{className:"pull-content",children:[e.jsx("span",{className:"pull-title",children:s.title||"(no title)"}),e.jsxs("span",{className:"pull-meta",children:[e.jsxs("span",{className:"pull-number",children:["#",s.number]}),e.jsx(P,{src:s.authorAvatarUrl,className:"pull-avatar"}),e.jsx("span",{className:"pull-author",children:s.author}),e.jsx(V,{state:s.checksState}),s.isDraft&&e.jsx("span",{className:"pull-draft-label",children:"Draft"})]})]}),e.jsxs("span",{className:"pull-row-aside",children:[a&&e.jsx("span",{children:a}),e.jsxs("span",{className:"pull-line-stats",children:[e.jsxs("span",{className:"add",children:["+",s.additions]})," ",e.jsxs("span",{className:"del",children:["−",s.deletions]})]})]})]}),e.jsxs(c,{children:[e.jsx(o,{render:e.jsx(t,{variant:"ghost",size:"icon-xs",className:"change-action-button pull-open-external",onClick:()=>w(s.url),"aria-label":`Open #${s.number} on GitHub`}),children:e.jsx(S,{})}),e.jsx(u,{children:"Open on GitHub"})]})]})}function C({state:s,className:l}){return s==="MERGED"?e.jsx(A,{"aria-hidden":"true",className:l}):e.jsx(y,{"aria-hidden":"true",className:l})}function V({state:s}){if(s==="NONE")return null;const l=s==="PASSING"?"Checks passing":s==="FAILING"?"Checks failing":"Checks pending",n=s==="PASSING"?R:s==="FAILING"?E:G;return e.jsx("span",{className:`pull-checks ${s.toLowerCase()}`,"aria-label":l,children:e.jsx(n,{"aria-hidden":"true"})})}function g(s){return s==="OPEN"?"Open":s==="CLOSED"?"Closed":"Merged"}function v(s){return s.length===1&&s[0]==="OPEN"}function m({icon:s,title:l,children:n}){return e.jsxs("div",{className:"pulls-notice",children:[e.jsx("span",{className:"pulls-notice-icon","aria-hidden":"true",children:s}),e.jsx("strong",{children:l}),e.jsx("p",{children:n})]})}const B=new Intl.RelativeTimeFormat("en",{numeric:"auto"}),U=[["year",31536e3],["month",2592e3],["week",604800],["day",86400],["hour",3600],["minute",60]];function W(s){const l=new Date(s);if(Number.isNaN(l.getTime()))return null;const n=Math.round((l.getTime()-Date.now())/1e3);for(const[i,a]of U)if(Math.abs(n)>=a)return B.format(Math.trunc(n/a),i);return"right now"}export{ae as PullRequestsView};
@@ -1 +1 @@
1
- import{r as f,j as e}from"./react-rd22PHbN.js";import{Y as y,Z as N,D as v,c as R,d as C,e as D,j as F,k as S,H as b,T as I}from"./App-C7Yf3r-l.js";import{c as M}from"./index-C_D1kOlX.js";import{A as q,f as w,g as z,h as L}from"./base-ui-D4MeJpa3.js";import"./tanstack-Bsd5UOY4.js";const O=[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M12 21h-5a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v4.5",key:"svg-1"}],["path",{d:"M14 17.5a2.5 2.5 0 1 0 5 0a2.5 2.5 0 1 0 -5 0",key:"svg-2"}],["path",{d:"M18.5 19.5l2.5 2.5",key:"svg-3"}]],Q=M("outline","file-search","FileSearch",O);function T(t,s){const n=[],r=c=>{for(const i of c)i.type==="directory"?r(i.children):n.push({path:i.path,name:i.name,parentPath:N(i.path)})};return r(s?t:y(t)),n}function E(t,s,{includeIgnored:n,activePath:r=null,limit:c=100}){const i=T(t,n),h=x(s).trim(),l=Math.max(0,Math.floor(c));if(!h)return i.sort((a,p)=>a.path===r?-1:p.path===r?1:k(a.path,p.path)).slice(0,l);const u=h.replace(/\s+/g,"");return i.map(a=>{const p=x(a.name),m=x(a.path),o=A(p,m,h,u);return o?{...a,rank:o}:null}).filter(a=>a!==null).sort((a,p)=>P(a.rank,p.rank)||j(a.path)-j(p.path)||k(a.path,p.path)).slice(0,l).map(a=>({path:a.path,name:a.name,parentPath:a.parentPath}))}function A(t,s,n,r){if(t===n)return[0,0,0,0];if(t.startsWith(n))return[1,0,t.length-n.length,0];const c=t.indexOf(n);if(c>=0)return[2,c,t.length-n.length,0];const i=s.indexOf(n);if(i>=0)return[3,i,s.length-n.length,0];const h=g(t,r);if(h)return[4,...h];const l=g(s,r);return l?[5,...l]:null}function g(t,s){if(!s)return null;let n=-1,r=-1,c=0,i=0;for(const h of s){const l=t.indexOf(h,n+1);if(l<0)return null;r<0&&(r=l),n>=0&&(c+=l-n-1,l===n+1&&(i+=1)),n=l}return[c,-i,r,t.length-s.length]}function P(t,s){for(let n=0;n<Math.max(t.length,s.length);n+=1){const r=(t[n]??0)-(s[n]??0);if(r!==0)return r}return 0}function x(t){return t.replace(/\\/g,"/").toLocaleLowerCase()}function j(t){return t.split("/").length}function k(t,s){return t.localeCompare(s,void 0,{sensitivity:"base"})||t.localeCompare(s)}function W({open:t,files:s,includeIgnored:n,activePath:r,onOpenChange:c,onOpenFile:i}){const[h,l]=f.useState(""),u=f.useRef(null),a=f.useMemo(()=>s?E(s,h,{includeIgnored:n,activePath:r,limit:100}):[],[r,s,n,h]);f.useEffect(()=>{t&&(l(""),window.requestAnimationFrame(()=>u.current?.focus()))},[t]);const p=o=>{i(o)&&c(!1)},m=h.trim();return e.jsx(v,{open:t,onOpenChange:c,children:e.jsxs(R,{className:"quick-open-dialog top-[max(64px,12vh)] w-[min(640px,calc(100vw-2.5rem))] -translate-y-0",children:[e.jsx(C,{className:"sr-only",children:"Open file"}),e.jsx(D,{className:"sr-only",children:"Search files in the current repository."}),e.jsxs(q,{items:a,value:h,onValueChange:l,itemToStringValue:o=>o.path,mode:"none",inline:!0,open:t,autoHighlight:"always",onOpenChange:(o,d)=>{!o&&d.reason!=="item-press"&&c(!1)},children:[e.jsxs("div",{className:"quick-open-input-shell",children:[e.jsx(F,{"aria-hidden":"true"}),e.jsx(w,{ref:u,"aria-label":"Search files by name or path",autoComplete:"off",spellCheck:!1,placeholder:"Search files by name or path"})]}),e.jsx(z,{"aria-label":"Repository files",className:"quick-open-results",children:s===null?e.jsxs("div",{className:"quick-open-status loading",role:"status",children:[e.jsx(S,{className:"spinner","aria-hidden":"true"})," ",e.jsx(b,{text:"Loading files…"})]}):a.length===0?e.jsxs("div",{className:"quick-open-status",role:"status",children:[e.jsx(Q,{"aria-hidden":"true"}),e.jsx("strong",{children:"No matching files"}),e.jsx("p",{children:m?e.jsxs(e.Fragment,{children:["Nothing matches ",e.jsx("em",{children:m})," in this repository."]}):"This repository has no files to open."})]}):a.map((o,d)=>e.jsxs(L,{value:o,index:d,className:"quick-open-result",onClick:()=>p(o.path),children:[e.jsx("img",{className:"quick-open-icon",src:I(o.path),alt:"","aria-hidden":"true",draggable:!1}),e.jsx("span",{className:"quick-open-name",children:o.name}),e.jsx("span",{className:"quick-open-parent",children:o.parentPath||"Repository root"})]},o.path))})]}),e.jsxs("footer",{className:"quick-open-footer",children:[e.jsxs("span",{className:"quick-open-hints",children:[e.jsxs("span",{children:[e.jsx("kbd",{children:"↑"}),e.jsx("kbd",{children:"↓"})," navigate"]}),e.jsxs("span",{children:[e.jsx("kbd",{children:"↵"})," open"]}),e.jsxs("span",{children:[e.jsx("kbd",{children:"Esc"})," close"]})]}),s!==null&&e.jsx("span",{className:"quick-open-count",children:a.length===100?"Top 100 matches":`${a.length} ${a.length===1?"file":"files"}`})]})]})})}export{W as QuickOpenDialog};
1
+ import{r as f,j as e}from"./react-rd22PHbN.js";import{Y as y,Z as N,D as v,c as R,d as C,e as D,j as F,k as S,H as b,T as I}from"./App-BWpP-n84.js";import{c as M}from"./index-DaaX_e8C.js";import{A as q,f as w,g as z,h as L}from"./base-ui-D4MeJpa3.js";import"./tanstack-Bsd5UOY4.js";const O=[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M12 21h-5a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v4.5",key:"svg-1"}],["path",{d:"M14 17.5a2.5 2.5 0 1 0 5 0a2.5 2.5 0 1 0 -5 0",key:"svg-2"}],["path",{d:"M18.5 19.5l2.5 2.5",key:"svg-3"}]],Q=M("outline","file-search","FileSearch",O);function T(t,s){const n=[],r=c=>{for(const i of c)i.type==="directory"?r(i.children):n.push({path:i.path,name:i.name,parentPath:N(i.path)})};return r(s?t:y(t)),n}function E(t,s,{includeIgnored:n,activePath:r=null,limit:c=100}){const i=T(t,n),h=x(s).trim(),l=Math.max(0,Math.floor(c));if(!h)return i.sort((a,p)=>a.path===r?-1:p.path===r?1:k(a.path,p.path)).slice(0,l);const u=h.replace(/\s+/g,"");return i.map(a=>{const p=x(a.name),m=x(a.path),o=A(p,m,h,u);return o?{...a,rank:o}:null}).filter(a=>a!==null).sort((a,p)=>P(a.rank,p.rank)||j(a.path)-j(p.path)||k(a.path,p.path)).slice(0,l).map(a=>({path:a.path,name:a.name,parentPath:a.parentPath}))}function A(t,s,n,r){if(t===n)return[0,0,0,0];if(t.startsWith(n))return[1,0,t.length-n.length,0];const c=t.indexOf(n);if(c>=0)return[2,c,t.length-n.length,0];const i=s.indexOf(n);if(i>=0)return[3,i,s.length-n.length,0];const h=g(t,r);if(h)return[4,...h];const l=g(s,r);return l?[5,...l]:null}function g(t,s){if(!s)return null;let n=-1,r=-1,c=0,i=0;for(const h of s){const l=t.indexOf(h,n+1);if(l<0)return null;r<0&&(r=l),n>=0&&(c+=l-n-1,l===n+1&&(i+=1)),n=l}return[c,-i,r,t.length-s.length]}function P(t,s){for(let n=0;n<Math.max(t.length,s.length);n+=1){const r=(t[n]??0)-(s[n]??0);if(r!==0)return r}return 0}function x(t){return t.replace(/\\/g,"/").toLocaleLowerCase()}function j(t){return t.split("/").length}function k(t,s){return t.localeCompare(s,void 0,{sensitivity:"base"})||t.localeCompare(s)}function W({open:t,files:s,includeIgnored:n,activePath:r,onOpenChange:c,onOpenFile:i}){const[h,l]=f.useState(""),u=f.useRef(null),a=f.useMemo(()=>s?E(s,h,{includeIgnored:n,activePath:r,limit:100}):[],[r,s,n,h]);f.useEffect(()=>{t&&(l(""),window.requestAnimationFrame(()=>u.current?.focus()))},[t]);const p=o=>{i(o)&&c(!1)},m=h.trim();return e.jsx(v,{open:t,onOpenChange:c,children:e.jsxs(R,{className:"quick-open-dialog top-[max(64px,12vh)] w-[min(640px,calc(100vw-2.5rem))] -translate-y-0",children:[e.jsx(C,{className:"sr-only",children:"Open file"}),e.jsx(D,{className:"sr-only",children:"Search files in the current repository."}),e.jsxs(q,{items:a,value:h,onValueChange:l,itemToStringValue:o=>o.path,mode:"none",inline:!0,open:t,autoHighlight:"always",onOpenChange:(o,d)=>{!o&&d.reason!=="item-press"&&c(!1)},children:[e.jsxs("div",{className:"quick-open-input-shell",children:[e.jsx(F,{"aria-hidden":"true"}),e.jsx(w,{ref:u,"aria-label":"Search files by name or path",autoComplete:"off",spellCheck:!1,placeholder:"Search files by name or path"})]}),e.jsx(z,{"aria-label":"Repository files",className:"quick-open-results",children:s===null?e.jsxs("div",{className:"quick-open-status loading",role:"status",children:[e.jsx(S,{className:"spinner","aria-hidden":"true"})," ",e.jsx(b,{text:"Loading files…"})]}):a.length===0?e.jsxs("div",{className:"quick-open-status",role:"status",children:[e.jsx(Q,{"aria-hidden":"true"}),e.jsx("strong",{children:"No matching files"}),e.jsx("p",{children:m?e.jsxs(e.Fragment,{children:["Nothing matches ",e.jsx("em",{children:m})," in this repository."]}):"This repository has no files to open."})]}):a.map((o,d)=>e.jsxs(L,{value:o,index:d,className:"quick-open-result",onClick:()=>p(o.path),children:[e.jsx("img",{className:"quick-open-icon",src:I(o.path),alt:"","aria-hidden":"true",draggable:!1}),e.jsx("span",{className:"quick-open-name",children:o.name}),e.jsx("span",{className:"quick-open-parent",children:o.parentPath||"Repository root"})]},o.path))})]}),e.jsxs("footer",{className:"quick-open-footer",children:[e.jsxs("span",{className:"quick-open-hints",children:[e.jsxs("span",{children:[e.jsx("kbd",{children:"↑"}),e.jsx("kbd",{children:"↓"})," navigate"]}),e.jsxs("span",{children:[e.jsx("kbd",{children:"↵"})," open"]}),e.jsxs("span",{children:[e.jsx("kbd",{children:"Esc"})," close"]})]}),s!==null&&e.jsx("span",{className:"quick-open-count",children:a.length===100?"Top 100 matches":`${a.length} ${a.length===1?"file":"files"}`})]})]})})}export{W as QuickOpenDialog};
@@ -1 +1 @@
1
- import{r as o,j as e}from"./react-rd22PHbN.js";import{D as q,c as Q,d as Z,e as ee,g as I,I as se,m as k,_ as P,k as z,$ as _,y as E,a0 as ne,S as ae,E as ie,C as re,F as oe,G as O,a1 as te}from"./App-C7Yf3r-l.js";import{c as M,B as r,T as w,a as C,b as R,o as h}from"./index-C_D1kOlX.js";import{I as le}from"./IconFolderPlus-D5cPTAyD.js";import"./tanstack-Bsd5UOY4.js";import"./base-ui-D4MeJpa3.js";const ce=[["path",{d:"M3 21v-4a3 3 0 0 1 3 -3h5",key:"svg-0"}],["path",{d:"M8 17l3 -3l-3 -3",key:"svg-1"}],["path",{d:"M3 11v-5a2 2 0 0 1 2 -2h4l3 3h7a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8",key:"svg-2"}]],de=M("outline","folder-symlink","FolderSymlink",ce);const me=[["path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4",key:"svg-0"}],["path",{d:"M13.5 6.5l4 4",key:"svg-1"}]],he=M("outline","pencil","Pencil",me),B="__opentig_no_project__";function ve({open:l,projects:c,repositories:v,onOpenChange:L,onOrganizationChange:A,onForgetRepository:G,onRelocateRepository:S}){const[J,u]=o.useState(null),[x,f]=o.useState(null),[N,D]=o.useState(""),[g,d]=o.useState(null),[b,T]=o.useState(""),[K,p]=o.useState(null),[n,y]=o.useState(null),[$,m]=o.useState(null),V=o.useMemo(()=>new Map(c.flatMap(s=>s.repositoryKeys.map(a=>[a,s.id]))),[c]);o.useEffect(()=>{l||(u(null),f(null),d(null),p(null),m(null))},[l]);const j=async(s,a)=>{y(s),m(null);try{const t=await a();return A(t),!0}catch(t){return m(F(t)),!1}finally{y(null)}},W=async s=>{s.preventDefault();const a=N.trim();!a||n||await j("create",()=>h.projects.create(a))&&D("")},X=async s=>{s.preventDefault();const a=b.trim();!g||!a||n||await j(`rename:${g}`,()=>h.projects.rename(g,a))&&d(null)},H=async s=>{n||await j(`remove:${s}`,()=>h.projects.remove(s))&&p(null)},U=async(s,a)=>{n||await j(`assign:${s}`,()=>h.projects.assign(s,a))},Y=async s=>{if(!n){if(m(null),!window.opentigDesktop){f(s);return}y(`relocate:${s.key}`);try{const a=await h.repository.select(`Relocate ${s.name}`);a&&await S(s,a)}catch(a){m(F(a))}finally{y(null)}}};return e.jsxs(q,{open:l,onOpenChange:s=>{n||L(s)},children:[e.jsxs(Q,{className:"repository-projects-dialog w-[min(660px,calc(100vw-2.5rem))]",children:[e.jsxs("header",{className:"repository-projects-header",children:[e.jsxs("div",{children:[e.jsx(Z,{children:"Manage projects"}),e.jsx(ee,{children:"Group repositories, update their locations, or remove them from OpenTig. Files stay on disk."})]}),e.jsx(I,{render:e.jsx(r,{variant:"ghost",size:"icon-sm","aria-label":"Close project management",disabled:!!n}),children:e.jsx(se,{})})]}),e.jsxs("div",{className:"repository-projects-body",children:[$&&e.jsxs("div",{className:"repository-projects-error",role:"alert",children:[e.jsx(k,{"aria-hidden":"true"}),e.jsx("span",{children:$})]}),e.jsxs("section",{className:"repository-projects-section","aria-labelledby":"projects-heading",children:[e.jsxs("div",{className:"repository-projects-section-heading",children:[e.jsxs("h3",{id:"projects-heading",children:["Projects ",e.jsx("span",{children:c.length})]}),e.jsxs("form",{className:"repository-project-create",onSubmit:s=>{W(s)},children:[e.jsx("label",{className:"sr-only",htmlFor:"new-project-name",children:"Project name"}),e.jsx("input",{id:"new-project-name",value:N,maxLength:P,onChange:s=>D(s.target.value),placeholder:"New project name",disabled:!!n}),e.jsxs(r,{type:"submit",size:"sm",disabled:!N.trim()||!!n,children:[n==="create"?e.jsx(z,{className:"animate-spin"}):e.jsx(le,{})," Create"]})]})]}),e.jsxs("div",{className:"repository-project-list",children:[c.length===0&&e.jsx("p",{className:"repository-projects-empty",children:"No projects yet. Create one to group related repositories."}),c.map(s=>{const a=s.repositoryKeys.length,t=n===`rename:${s.id}`||n===`remove:${s.id}`;return e.jsx("div",{className:"repository-project-row","aria-busy":t||void 0,children:g===s.id?e.jsxs("form",{className:"repository-inline-form",onSubmit:i=>{X(i)},onKeyDown:i=>{i.key==="Escape"&&d(null)},children:[e.jsxs("label",{className:"sr-only",htmlFor:`rename-project-${s.id}`,children:["Rename ",s.name]}),e.jsx("input",{id:`rename-project-${s.id}`,autoFocus:!0,value:b,maxLength:P,onChange:i=>T(i.target.value),disabled:!!n}),e.jsx(r,{type:"submit",size:"xs",disabled:!b.trim()||!!n,children:"Save"}),e.jsx(r,{type:"button",variant:"ghost",size:"xs",onClick:()=>d(null),disabled:!!n,children:"Cancel"})]}):K===s.id?e.jsxs("div",{className:"repository-project-confirm",role:"alert",children:[e.jsx(k,{"aria-hidden":"true"}),e.jsxs("span",{children:["Delete ",e.jsx("strong",{children:s.name}),"? Its repositories stay available, just ungrouped."]}),e.jsx(r,{variant:"destructive",size:"xs",disabled:!!n,onClick:()=>{H(s.id)},children:"Delete"}),e.jsx(r,{variant:"ghost",size:"xs",disabled:!!n,onClick:()=>p(null),children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"repository-project-icon","aria-hidden":"true",children:e.jsx(_,{})}),e.jsxs("span",{className:"repository-project-copy",children:[e.jsx("strong",{children:s.name}),e.jsxs("small",{children:[a," ",a===1?"repository":"repositories"]})]}),e.jsxs("span",{className:"repository-row-actions",children:[e.jsx(r,{variant:"ghost",size:"icon-sm","aria-label":`Rename ${s.name}`,disabled:!!n,onClick:()=>{d(s.id),T(s.name),p(null)},children:e.jsx(he,{})}),e.jsx(r,{variant:"ghost",size:"icon-sm",className:"repository-row-delete","aria-label":`Delete ${s.name}`,disabled:!!n,onClick:()=>{p(s.id),d(null)},children:e.jsx(E,{})})]})]})},s.id)})]})]}),e.jsxs("section",{className:"repository-projects-section","aria-labelledby":"repository-assignments-heading",children:[e.jsxs("div",{className:"repository-projects-section-heading",children:[e.jsxs("h3",{id:"repository-assignments-heading",children:["Repositories ",e.jsx("span",{children:v.length})]}),e.jsx("p",{children:"One project per repository"})]}),e.jsxs("div",{className:"repository-assignment-list",children:[v.length===0&&e.jsx("p",{className:"repository-projects-empty",children:"No recent repositories to assign yet."}),v.map(s=>{const a=V.get(s.key)??B,t=n?.endsWith(`:${s.key}`);return e.jsx("div",{className:"repository-assignment-row","aria-busy":t||void 0,children:J===s.key?e.jsxs("div",{className:"repository-project-confirm",role:"alert",children:[e.jsx(k,{"aria-hidden":"true"}),e.jsxs("span",{children:["Remove ",e.jsx("strong",{children:s.name})," and its worktrees from OpenTig? Their folders and files stay on disk. You can open them again later."]}),e.jsx(r,{variant:"destructive",size:"xs",disabled:!!n,onClick:()=>{j(`forget:${s.key}`,()=>G(s)).then(i=>{i&&u(null)})},children:"Remove"}),e.jsx(r,{variant:"ghost",size:"xs",disabled:!!n,onClick:()=>u(null),children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsx(_,{"aria-hidden":"true"}),e.jsxs("span",{className:"repository-assignment-copy",children:[e.jsx("strong",{children:s.name}),e.jsxs(w,{children:[e.jsx(C,{render:e.jsx("small",{}),children:ne(s.rootPath,4)}),e.jsx(R,{children:s.rootPath})]})]}),t&&e.jsx(z,{className:"repository-assignment-busy animate-spin","aria-hidden":"true"}),e.jsxs(ae,{value:a,onValueChange:i=>{U(s.key,i===B?null:i)},disabled:!!n,children:[e.jsx(ie,{size:"sm","aria-label":`Project for ${s.name}`,children:e.jsx(re,{children:c.find(i=>i.id===a)?.name??"No project"})}),e.jsxs(oe,{align:"end",alignItemWithTrigger:!1,children:[e.jsx(O,{value:B,children:"No project"}),c.map(i=>e.jsx(O,{value:i.id,children:i.name},i.id))]})]}),e.jsxs("span",{className:"repository-management-actions",children:[e.jsxs(w,{children:[e.jsx(C,{render:e.jsx(r,{variant:"ghost",size:"icon-sm","aria-label":`Relocate ${s.name}`,disabled:!!n,onClick:()=>{Y(s)}}),children:e.jsx(de,{})}),e.jsx(R,{children:"Relocate repository"})]}),e.jsxs(w,{children:[e.jsx(C,{render:e.jsx(r,{variant:"ghost",size:"icon-sm","aria-label":`Remove ${s.name} from OpenTig`,disabled:!!n,onClick:()=>{u(s.key),m(null)}}),children:e.jsx(E,{})}),e.jsx(R,{children:"Remove from OpenTig"})]})]})]})},s.key)})]})]})]}),e.jsx("footer",{className:"repository-projects-footer",children:e.jsx(I,{render:e.jsx(r,{variant:"outline",size:"sm",disabled:!!n}),children:"Done"})})]}),e.jsx(te,{open:x!==null,onOpenChange:s=>{s||f(null)},title:"Relocate repository",description:`Choose the existing server folder for ${x?.name??"this repository"}. This updates its saved location; it does not move files.`,confirmLabel:"Use this folder",onBrowse:h.repository.browseDirectories,onOpen:async s=>{x&&await S(x,s)}})]})}function F(l){return l instanceof Error?l.message:String(l)}export{ve as RepositoryProjectsDialog};
1
+ import{r as o,j as e}from"./react-rd22PHbN.js";import{D as q,c as Q,d as Z,e as ee,g as I,I as se,m as k,_ as P,k as z,$ as _,y as E,a0 as ne,S as ae,E as ie,C as re,F as oe,G as O,a1 as te}from"./App-BWpP-n84.js";import{c as M,B as r,T as w,a as C,b as R,o as h}from"./index-DaaX_e8C.js";import{I as le}from"./IconFolderPlus-DvEWPQIQ.js";import"./tanstack-Bsd5UOY4.js";import"./base-ui-D4MeJpa3.js";const ce=[["path",{d:"M3 21v-4a3 3 0 0 1 3 -3h5",key:"svg-0"}],["path",{d:"M8 17l3 -3l-3 -3",key:"svg-1"}],["path",{d:"M3 11v-5a2 2 0 0 1 2 -2h4l3 3h7a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8",key:"svg-2"}]],de=M("outline","folder-symlink","FolderSymlink",ce);const me=[["path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4",key:"svg-0"}],["path",{d:"M13.5 6.5l4 4",key:"svg-1"}]],he=M("outline","pencil","Pencil",me),B="__opentig_no_project__";function ve({open:l,projects:c,repositories:v,onOpenChange:L,onOrganizationChange:A,onForgetRepository:G,onRelocateRepository:S}){const[J,u]=o.useState(null),[x,f]=o.useState(null),[N,D]=o.useState(""),[g,d]=o.useState(null),[b,T]=o.useState(""),[K,p]=o.useState(null),[n,y]=o.useState(null),[$,m]=o.useState(null),V=o.useMemo(()=>new Map(c.flatMap(s=>s.repositoryKeys.map(a=>[a,s.id]))),[c]);o.useEffect(()=>{l||(u(null),f(null),d(null),p(null),m(null))},[l]);const j=async(s,a)=>{y(s),m(null);try{const t=await a();return A(t),!0}catch(t){return m(F(t)),!1}finally{y(null)}},W=async s=>{s.preventDefault();const a=N.trim();!a||n||await j("create",()=>h.projects.create(a))&&D("")},X=async s=>{s.preventDefault();const a=b.trim();!g||!a||n||await j(`rename:${g}`,()=>h.projects.rename(g,a))&&d(null)},H=async s=>{n||await j(`remove:${s}`,()=>h.projects.remove(s))&&p(null)},U=async(s,a)=>{n||await j(`assign:${s}`,()=>h.projects.assign(s,a))},Y=async s=>{if(!n){if(m(null),!window.opentigDesktop){f(s);return}y(`relocate:${s.key}`);try{const a=await h.repository.select(`Relocate ${s.name}`);a&&await S(s,a)}catch(a){m(F(a))}finally{y(null)}}};return e.jsxs(q,{open:l,onOpenChange:s=>{n||L(s)},children:[e.jsxs(Q,{className:"repository-projects-dialog w-[min(660px,calc(100vw-2.5rem))]",children:[e.jsxs("header",{className:"repository-projects-header",children:[e.jsxs("div",{children:[e.jsx(Z,{children:"Manage projects"}),e.jsx(ee,{children:"Group repositories, update their locations, or remove them from OpenTig. Files stay on disk."})]}),e.jsx(I,{render:e.jsx(r,{variant:"ghost",size:"icon-sm","aria-label":"Close project management",disabled:!!n}),children:e.jsx(se,{})})]}),e.jsxs("div",{className:"repository-projects-body",children:[$&&e.jsxs("div",{className:"repository-projects-error",role:"alert",children:[e.jsx(k,{"aria-hidden":"true"}),e.jsx("span",{children:$})]}),e.jsxs("section",{className:"repository-projects-section","aria-labelledby":"projects-heading",children:[e.jsxs("div",{className:"repository-projects-section-heading",children:[e.jsxs("h3",{id:"projects-heading",children:["Projects ",e.jsx("span",{children:c.length})]}),e.jsxs("form",{className:"repository-project-create",onSubmit:s=>{W(s)},children:[e.jsx("label",{className:"sr-only",htmlFor:"new-project-name",children:"Project name"}),e.jsx("input",{id:"new-project-name",value:N,maxLength:P,onChange:s=>D(s.target.value),placeholder:"New project name",disabled:!!n}),e.jsxs(r,{type:"submit",size:"sm",disabled:!N.trim()||!!n,children:[n==="create"?e.jsx(z,{className:"animate-spin"}):e.jsx(le,{})," Create"]})]})]}),e.jsxs("div",{className:"repository-project-list",children:[c.length===0&&e.jsx("p",{className:"repository-projects-empty",children:"No projects yet. Create one to group related repositories."}),c.map(s=>{const a=s.repositoryKeys.length,t=n===`rename:${s.id}`||n===`remove:${s.id}`;return e.jsx("div",{className:"repository-project-row","aria-busy":t||void 0,children:g===s.id?e.jsxs("form",{className:"repository-inline-form",onSubmit:i=>{X(i)},onKeyDown:i=>{i.key==="Escape"&&d(null)},children:[e.jsxs("label",{className:"sr-only",htmlFor:`rename-project-${s.id}`,children:["Rename ",s.name]}),e.jsx("input",{id:`rename-project-${s.id}`,autoFocus:!0,value:b,maxLength:P,onChange:i=>T(i.target.value),disabled:!!n}),e.jsx(r,{type:"submit",size:"xs",disabled:!b.trim()||!!n,children:"Save"}),e.jsx(r,{type:"button",variant:"ghost",size:"xs",onClick:()=>d(null),disabled:!!n,children:"Cancel"})]}):K===s.id?e.jsxs("div",{className:"repository-project-confirm",role:"alert",children:[e.jsx(k,{"aria-hidden":"true"}),e.jsxs("span",{children:["Delete ",e.jsx("strong",{children:s.name}),"? Its repositories stay available, just ungrouped."]}),e.jsx(r,{variant:"destructive",size:"xs",disabled:!!n,onClick:()=>{H(s.id)},children:"Delete"}),e.jsx(r,{variant:"ghost",size:"xs",disabled:!!n,onClick:()=>p(null),children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"repository-project-icon","aria-hidden":"true",children:e.jsx(_,{})}),e.jsxs("span",{className:"repository-project-copy",children:[e.jsx("strong",{children:s.name}),e.jsxs("small",{children:[a," ",a===1?"repository":"repositories"]})]}),e.jsxs("span",{className:"repository-row-actions",children:[e.jsx(r,{variant:"ghost",size:"icon-sm","aria-label":`Rename ${s.name}`,disabled:!!n,onClick:()=>{d(s.id),T(s.name),p(null)},children:e.jsx(he,{})}),e.jsx(r,{variant:"ghost",size:"icon-sm",className:"repository-row-delete","aria-label":`Delete ${s.name}`,disabled:!!n,onClick:()=>{p(s.id),d(null)},children:e.jsx(E,{})})]})]})},s.id)})]})]}),e.jsxs("section",{className:"repository-projects-section","aria-labelledby":"repository-assignments-heading",children:[e.jsxs("div",{className:"repository-projects-section-heading",children:[e.jsxs("h3",{id:"repository-assignments-heading",children:["Repositories ",e.jsx("span",{children:v.length})]}),e.jsx("p",{children:"One project per repository"})]}),e.jsxs("div",{className:"repository-assignment-list",children:[v.length===0&&e.jsx("p",{className:"repository-projects-empty",children:"No recent repositories to assign yet."}),v.map(s=>{const a=V.get(s.key)??B,t=n?.endsWith(`:${s.key}`);return e.jsx("div",{className:"repository-assignment-row","aria-busy":t||void 0,children:J===s.key?e.jsxs("div",{className:"repository-project-confirm",role:"alert",children:[e.jsx(k,{"aria-hidden":"true"}),e.jsxs("span",{children:["Remove ",e.jsx("strong",{children:s.name})," and its worktrees from OpenTig? Their folders and files stay on disk. You can open them again later."]}),e.jsx(r,{variant:"destructive",size:"xs",disabled:!!n,onClick:()=>{j(`forget:${s.key}`,()=>G(s)).then(i=>{i&&u(null)})},children:"Remove"}),e.jsx(r,{variant:"ghost",size:"xs",disabled:!!n,onClick:()=>u(null),children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsx(_,{"aria-hidden":"true"}),e.jsxs("span",{className:"repository-assignment-copy",children:[e.jsx("strong",{children:s.name}),e.jsxs(w,{children:[e.jsx(C,{render:e.jsx("small",{}),children:ne(s.rootPath,4)}),e.jsx(R,{children:s.rootPath})]})]}),t&&e.jsx(z,{className:"repository-assignment-busy animate-spin","aria-hidden":"true"}),e.jsxs(ae,{value:a,onValueChange:i=>{U(s.key,i===B?null:i)},disabled:!!n,children:[e.jsx(ie,{size:"sm","aria-label":`Project for ${s.name}`,children:e.jsx(re,{children:c.find(i=>i.id===a)?.name??"No project"})}),e.jsxs(oe,{align:"end",alignItemWithTrigger:!1,children:[e.jsx(O,{value:B,children:"No project"}),c.map(i=>e.jsx(O,{value:i.id,children:i.name},i.id))]})]}),e.jsxs("span",{className:"repository-management-actions",children:[e.jsxs(w,{children:[e.jsx(C,{render:e.jsx(r,{variant:"ghost",size:"icon-sm","aria-label":`Relocate ${s.name}`,disabled:!!n,onClick:()=>{Y(s)}}),children:e.jsx(de,{})}),e.jsx(R,{children:"Relocate repository"})]}),e.jsxs(w,{children:[e.jsx(C,{render:e.jsx(r,{variant:"ghost",size:"icon-sm","aria-label":`Remove ${s.name} from OpenTig`,disabled:!!n,onClick:()=>{u(s.key),m(null)}}),children:e.jsx(E,{})}),e.jsx(R,{children:"Remove from OpenTig"})]})]})]})},s.key)})]})]})]}),e.jsx("footer",{className:"repository-projects-footer",children:e.jsx(I,{render:e.jsx(r,{variant:"outline",size:"sm",disabled:!!n}),children:"Done"})})]}),e.jsx(te,{open:x!==null,onOpenChange:s=>{s||f(null)},title:"Relocate repository",description:`Choose the existing server folder for ${x?.name??"this repository"}. This updates its saved location; it does not move files.`,confirmLabel:"Use this folder",onBrowse:h.repository.browseDirectories,onOpen:async s=>{x&&await S(x,s)}})]})}function F(l){return l instanceof Error?l.message:String(l)}export{ve as RepositoryProjectsDialog};
@@ -1 +1 @@
1
- import{r as t,j as e}from"./react-rd22PHbN.js";import{a6 as pe,a7 as A,P,j as fe,H as Y,k as me,A as m}from"./App-C7Yf3r-l.js";import{u as xe,a as ve}from"./tanstack-Bsd5UOY4.js";import{c as x,B as k,T as W,a as D,b as H,o as J,q as je}from"./index-C_D1kOlX.js";import"./base-ui-D4MeJpa3.js";const ye=[["path",{d:"M10.585 10.587a2 2 0 0 0 2.829 2.828",key:"svg-0"}],["path",{d:"M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87",key:"svg-1"}],["path",{d:"M3 3l18 18",key:"svg-2"}]],X=x("outline","eye-off","EyeOff",ye);const ke=[["path",{d:"M14 15.5a3.5 3.5 0 1 0 7 0a3.5 3.5 0 1 0 -7 0",key:"svg-0"}],["path",{d:"M3 19v-10.5a3.5 3.5 0 0 1 7 0v10.5",key:"svg-1"}],["path",{d:"M3 13h7",key:"svg-2"}],["path",{d:"M21 12v7",key:"svg-3"}]],Me=x("outline","letter-case","LetterCase",ke);const Ne=[["path",{d:"M6.5 15a2.5 2.5 0 1 1 0 5a2.5 2.5 0 0 1 0 -5",key:"svg-0"}],["path",{d:"M17 7.875l3 -1.687",key:"svg-1"}],["path",{d:"M17 7.875v3.375",key:"svg-2"}],["path",{d:"M17 7.875l-3 -1.687",key:"svg-3"}],["path",{d:"M17 7.875l3 1.688",key:"svg-4"}],["path",{d:"M17 4.5v3.375",key:"svg-5"}],["path",{d:"M17 7.875l-3 1.688",key:"svg-6"}]],be=x("outline","regex","Regex",Ne);const we=[["path",{d:"M3 4a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",key:"svg-0"}],["path",{d:"M15 16a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",key:"svg-1"}],["path",{d:"M21 11v-3a2 2 0 0 0 -2 -2h-6l3 3m0 -6l-3 3",key:"svg-2"}],["path",{d:"M3 13v3a2 2 0 0 0 2 2h6l-3 -3m0 6l3 -3",key:"svg-3"}]],Z=x("outline","replace","Replace",we);const Se=[["path",{d:"M4 6l10 0",key:"svg-0"}],["path",{d:"M4 18l10 0",key:"svg-1"}],["path",{d:"M4 12h17l-3 -3m0 6l3 -3",key:"svg-2"}]],$e=x("outline","text-wrap-disabled","TextWrapDisabled",Se);const Re=[["path",{d:"M8 2h-4a2 2 0 0 0 -2 2v4a2 2 0 0 0 2 2h4a2 2 0 0 0 2 -2v-4a2 2 0 0 0 -2 -2z",key:"svg-0"}],["path",{d:"M20 14h-4a2 2 0 0 0 -2 2v4a2 2 0 0 0 2 2h4a2 2 0 0 0 2 -2v-4a2 2 0 0 0 -2 -2z",key:"svg-1"}],["path",{d:"M16.707 2.293a1 1 0 0 1 .083 1.32l-.083 .094l-1.293 1.293h3.586a3 3 0 0 1 2.995 2.824l.005 .176v3a1 1 0 0 1 -1.993 .117l-.007 -.117v-3a1 1 0 0 0 -.883 -.993l-.117 -.007h-3.585l1.292 1.293a1 1 0 0 1 -1.32 1.497l-.094 -.083l-3 -3a.98 .98 0 0 1 -.28 -.872l.036 -.146l.04 -.104c.058 -.126 .14 -.24 .245 -.334l2.959 -2.958a1 1 0 0 1 1.414 0z",key:"svg-2"}],["path",{d:"M3 12a1 1 0 0 1 .993 .883l.007 .117v3a1 1 0 0 0 .883 .993l.117 .007h3.585l-1.292 -1.293a1 1 0 0 1 -.083 -1.32l.083 -.094a1 1 0 0 1 1.32 -.083l.094 .083l3 3a.98 .98 0 0 1 .28 .872l-.036 .146l-.04 .104a1.02 1.02 0 0 1 -.245 .334l-2.959 2.958a1 1 0 0 1 -1.497 -1.32l.083 -.094l1.291 -1.293h-3.584a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-3a1 1 0 0 1 1 -1z",key:"svg-3"}]],ee=x("filled","replace-filled","ReplaceFilled",Re);function Ce(l){return l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ie(l){if(!l.query)return null;const c=l.regex?l.query:Ce(l.query),i=l.wholeWord?`\\b(?:${c})\\b`:c;try{return new RegExp(i,l.matchCase?"g":"gi")}catch{return null}}const Te=250,Ee=28,_e=24;function Be({repositoryId:l,active:c,revision:i,onOpenFile:h,unsavedPathsAmong:g,onReplaced:o}){const O=pe(),[f,ae]=t.useState(""),[M,se]=t.useState(!1),[N,te]=t.useState(!1),[b,le]=t.useState(!1),[p,ne]=t.useState(!1),[B,re]=t.useState(""),[w,ce]=t.useState(!1),[S,ie]=t.useState(!1),[$,L]=t.useState(!1),[oe,he]=t.useState(0),[Q,G]=t.useState(()=>new Set),K=t.useRef(null),V=t.useRef(null),R=t.useMemo(()=>({query:f,matchCase:M,wholeWord:N,regex:b,includeIgnored:w}),[f,M,N,b,w]),de=t.useMemo(()=>Ie(R),[R]),v=f.trim(),C=ze(v,Te),d=xe({queryKey:je.search(l,{query:C,matchCase:M,wholeWord:N,regex:b,includeIgnored:w,revision:i,replaceRevision:oe}),queryFn:()=>J.repository.search(l,{...R,query:C}),enabled:c&&C.length>0,placeholderData:(a,s)=>s?.queryKey[1]===l?a:void 0}),n=v?d.data??null:null,z=!!v&&(C!==v||d.isFetching),U=v&&d.error?d.error instanceof Error?d.error.message:"The search failed.":null;t.useEffect(()=>{c&&K.current?.focus()},[c]),t.useEffect(()=>{d.data&&G(new Set(d.data.files.filter(a=>a.ignored).map(a=>a.path)))},[d.data]);const I=t.useMemo(()=>{if(!n)return[];const a=[];for(const s of n.files){const u=!Q.has(s.path);if(a.push({kind:"file",file:s,open:u}),u)for(const E of s.matches)a.push({kind:"match",file:s,match:E})}return a},[Q,n]),T=ve({count:I.length,getScrollElement:()=>V.current,estimateSize:a=>O?44:I[a]?.kind==="file"?Ee:_e,getItemKey:a=>{const s=I[a];return s?s.kind==="file"?`file:${s.file.path}`:`match:${s.file.path}:${s.match.line}:${s.match.column??1}`:a},overscan:12});t.useEffect(()=>{T.measure()},[T,O]);const ue=a=>G(s=>{const u=new Set(s);return u.delete(a)||u.add(a),u}),j=n?.files.filter(a=>a.ignored).length??0,y=n?.files.filter(a=>!!a.revision&&(S||!a.ignored))??[],q=async a=>{if(!n||$)return;const s=a==="all"?{kind:"all",files:y.map(r=>({path:r.path,revision:r.revision}))}:"match"in a?{kind:"match",path:a.file.path,revision:a.file.revision,line:a.match.line,column:a.match.column}:{kind:"file",path:a.path,revision:a.revision};if(s.kind==="all"){if(n.truncated){m.info({title:"Narrow the search before replacing all",description:"The current result set is truncated."});return}const r=y.reduce((F,ge)=>F+ge.matches.length,0);if(!r||!window.confirm(`Replace ${r} ${r===1?"occurrence":"occurrences"} in ${y.length} ${y.length===1?"file":"files"}?`))return}else if(s.kind==="file"&&a!=="all"&&!("match"in a)&&a.truncatedMatches&&!window.confirm(`${a.path} has more matches than the ${a.matches.length} listed. Replace every occurrence in the file?`))return;const u=s.kind==="all"?s.files.map(r=>r.path):[s.path],E=g(u);if(E.length>0){m.error({title:"Save open files before replacing in them",description:E.join(", "),duration:1e4});return}L(!0);try{const r=await J.repository.replaceSearch(l,{options:{...R,query:f.trim()},replacement:B,scope:s});r.status==="stale"?m.error({title:"Files changed before replacement",description:"Search results were refreshed without overwriting anything."}):r.status==="no-match"?m.info({title:"No matching text to replace"}):(m.success({title:`Replaced ${r.replacements} ${r.replacements===1?"occurrence":"occurrences"}`,description:`${r.files.length} ${r.files.length===1?"file":"files"} changed`}),o(r.files)),he(F=>F+1)}catch(r){m.error({title:"Could not replace search results",description:r instanceof Error?r.message:"Unknown error",duration:1e4})}finally{L(!1)}};return e.jsxs("div",{className:"search-view",children:[e.jsxs("div",{className:"search-controls",children:[e.jsxs("div",{className:"search-query-row",children:[e.jsx(k,{variant:"ghost",size:"icon-xs",className:"search-replace-toggle","aria-label":p?"Hide replace":"Show replace","aria-expanded":p,onClick:()=>ne(a=>!a),children:p?e.jsx(A,{}):e.jsx(P,{})}),e.jsxs("div",{className:"search-input",children:[e.jsx(fe,{"aria-hidden":"true"}),e.jsx("input",{ref:K,type:"text",value:f,spellCheck:!1,placeholder:"Search in repository","aria-label":"Search in repository",onChange:a=>ae(a.target.value)}),e.jsxs("span",{className:"search-toggles",children:[e.jsx(_,{label:"Match case",active:M,onToggle:()=>se(a=>!a),children:e.jsx(Me,{})}),e.jsx(_,{label:"Match whole word",active:N,onToggle:()=>te(a=>!a),children:e.jsx($e,{})}),e.jsx(_,{label:"Use regular expression",active:b,onToggle:()=>le(a=>!a),children:e.jsx(be,{})}),e.jsx(_,{label:"Search Git-ignored files",active:w,onToggle:()=>ce(a=>!a),children:e.jsx(X,{})})]})]})]}),p&&e.jsxs("div",{className:"search-replace-row",children:[e.jsx(Z,{"aria-hidden":"true"}),e.jsx("input",{value:B,spellCheck:!1,placeholder:"Replace","aria-label":"Replace with",onChange:a=>re(a.target.value)}),e.jsxs(W,{children:[e.jsx(D,{render:e.jsx(k,{variant:"ghost",size:"icon-xs",disabled:$||y.length===0||!!n?.truncated,"aria-label":"Replace all search results",onClick:()=>{q("all")}}),children:e.jsx(ee,{})}),e.jsx(H,{children:n?.truncated?"Narrow the search to replace all":"Replace all"})]})]}),p&&j>0&&e.jsxs("label",{className:"search-include-ignored",children:[e.jsx("input",{type:"checkbox",checked:S,onChange:a=>ie(a.target.checked)})," Include ignored files when replacing"]}),f.trim()!==""&&(n!==null||!z)&&e.jsx("div",{className:"search-summary",children:z?e.jsx(Y,{text:"Searching…"}):U?e.jsx("span",{className:"search-error",children:U}):n&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:n.totalMatches===0?"No results":`${n.totalMatches-n.ignoredMatches}${n.truncated?"+":""} ${n.totalMatches-n.ignoredMatches===1?"result":"results"} in ${n.files.length-j} ${n.files.length-j===1?"file":"files"}`}),n.ignoredMatches>0&&e.jsxs("span",{className:"search-summary-ignored",children:["· ",n.ignoredMatches," in ",j," ignored ",j===1?"file":"files"]})]})})]}),e.jsxs("div",{ref:V,className:"search-results",children:[z&&!n&&e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(me,{className:"spinner"})," ",e.jsx(Y,{text:"Searching…"})]}),e.jsx("div",{className:"search-rows virtual-list",style:{height:T.getTotalSize()},children:T.getVirtualItems().map(a=>{const s=I[a.index];return s?e.jsx("div",{className:"virtual-row",style:{height:a.size,transform:`translateY(${a.start}px)`},children:s.kind==="file"?e.jsxs("div",{className:`search-file-heading ${s.file.ignored?"ignored":""}`,children:[e.jsxs("button",{className:"search-file-toggle",onClick:()=>ue(s.file.path),"aria-expanded":s.open,children:[s.open?e.jsx(A,{}):e.jsx(P,{}),e.jsx("span",{className:"search-file-name",children:s.file.path}),s.file.ignored&&e.jsxs(W,{children:[e.jsx(D,{render:e.jsx("span",{className:"search-file-ignored-badge"}),children:e.jsx(X,{})}),e.jsx(H,{children:"Ignored by Git"})]}),e.jsx("span",{className:"search-file-count",children:s.file.matches.length})]}),p&&s.file.revision&&(!s.file.ignored||S)&&e.jsx(k,{variant:"ghost",size:"icon-xs",className:"search-replace-action",disabled:$,"aria-label":`Replace all in ${s.file.path}`,onClick:()=>{q(s.file)},children:e.jsx(ee,{})})]}):e.jsxs("div",{className:"search-match",children:[e.jsxs("button",{className:"search-match-open",onClick:()=>h(s.file.path),children:[e.jsxs("span",{className:"search-match-line",children:[s.match.line,":",s.match.column??1]}),e.jsx("span",{className:"search-match-text",children:qe(s.match.text,de)})]}),p&&s.file.revision&&s.match.column&&(!s.file.ignored||S)&&e.jsx(k,{variant:"ghost",size:"icon-xs",className:"search-replace-action",disabled:$,"aria-label":`Replace match on line ${s.match.line}`,onClick:()=>{q({file:s.file,match:s.match})},children:e.jsx(Z,{})})]})},a.key):null})})]})]})}function ze(l,c){const[i,h]=t.useState(l);return t.useEffect(()=>{const g=window.setTimeout(()=>h(l),c);return()=>window.clearTimeout(g)},[c,l]),i}function _({label:l,active:c,onToggle:i,children:h}){return e.jsxs(W,{children:[e.jsx(D,{render:e.jsx(k,{variant:"ghost",size:"icon-xs",className:"search-toggle","aria-label":l,"aria-pressed":c,onClick:i}),children:h}),e.jsx(H,{children:l})]})}function qe(l,c){const i=l.replace(/^\s+/,"");if(!c)return i;c.lastIndex=0;const h=[];let g=0;for(let o=c.exec(i);o!==null;o=c.exec(i)){if(o[0]===""){c.lastIndex+=1;continue}h.push(e.jsx(t.Fragment,{children:i.slice(g,o.index)},`${o.index}-plain`),e.jsx("mark",{children:o[0]},`${o.index}-hit`)),g=o.index+o[0].length}return h.length===0?i:(h.push(e.jsx(t.Fragment,{children:i.slice(g)},"tail")),h)}export{Be as SearchView};
1
+ import{r as t,j as e}from"./react-rd22PHbN.js";import{a6 as pe,a7 as A,P,j as fe,H as Y,k as me,A as m}from"./App-BWpP-n84.js";import{u as xe,a as ve}from"./tanstack-Bsd5UOY4.js";import{c as x,B as k,T as W,a as D,b as H,o as J,q as je}from"./index-DaaX_e8C.js";import"./base-ui-D4MeJpa3.js";const ye=[["path",{d:"M10.585 10.587a2 2 0 0 0 2.829 2.828",key:"svg-0"}],["path",{d:"M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87",key:"svg-1"}],["path",{d:"M3 3l18 18",key:"svg-2"}]],X=x("outline","eye-off","EyeOff",ye);const ke=[["path",{d:"M14 15.5a3.5 3.5 0 1 0 7 0a3.5 3.5 0 1 0 -7 0",key:"svg-0"}],["path",{d:"M3 19v-10.5a3.5 3.5 0 0 1 7 0v10.5",key:"svg-1"}],["path",{d:"M3 13h7",key:"svg-2"}],["path",{d:"M21 12v7",key:"svg-3"}]],Me=x("outline","letter-case","LetterCase",ke);const Ne=[["path",{d:"M6.5 15a2.5 2.5 0 1 1 0 5a2.5 2.5 0 0 1 0 -5",key:"svg-0"}],["path",{d:"M17 7.875l3 -1.687",key:"svg-1"}],["path",{d:"M17 7.875v3.375",key:"svg-2"}],["path",{d:"M17 7.875l-3 -1.687",key:"svg-3"}],["path",{d:"M17 7.875l3 1.688",key:"svg-4"}],["path",{d:"M17 4.5v3.375",key:"svg-5"}],["path",{d:"M17 7.875l-3 1.688",key:"svg-6"}]],be=x("outline","regex","Regex",Ne);const we=[["path",{d:"M3 4a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",key:"svg-0"}],["path",{d:"M15 16a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",key:"svg-1"}],["path",{d:"M21 11v-3a2 2 0 0 0 -2 -2h-6l3 3m0 -6l-3 3",key:"svg-2"}],["path",{d:"M3 13v3a2 2 0 0 0 2 2h6l-3 -3m0 6l3 -3",key:"svg-3"}]],Z=x("outline","replace","Replace",we);const Se=[["path",{d:"M4 6l10 0",key:"svg-0"}],["path",{d:"M4 18l10 0",key:"svg-1"}],["path",{d:"M4 12h17l-3 -3m0 6l3 -3",key:"svg-2"}]],$e=x("outline","text-wrap-disabled","TextWrapDisabled",Se);const Re=[["path",{d:"M8 2h-4a2 2 0 0 0 -2 2v4a2 2 0 0 0 2 2h4a2 2 0 0 0 2 -2v-4a2 2 0 0 0 -2 -2z",key:"svg-0"}],["path",{d:"M20 14h-4a2 2 0 0 0 -2 2v4a2 2 0 0 0 2 2h4a2 2 0 0 0 2 -2v-4a2 2 0 0 0 -2 -2z",key:"svg-1"}],["path",{d:"M16.707 2.293a1 1 0 0 1 .083 1.32l-.083 .094l-1.293 1.293h3.586a3 3 0 0 1 2.995 2.824l.005 .176v3a1 1 0 0 1 -1.993 .117l-.007 -.117v-3a1 1 0 0 0 -.883 -.993l-.117 -.007h-3.585l1.292 1.293a1 1 0 0 1 -1.32 1.497l-.094 -.083l-3 -3a.98 .98 0 0 1 -.28 -.872l.036 -.146l.04 -.104c.058 -.126 .14 -.24 .245 -.334l2.959 -2.958a1 1 0 0 1 1.414 0z",key:"svg-2"}],["path",{d:"M3 12a1 1 0 0 1 .993 .883l.007 .117v3a1 1 0 0 0 .883 .993l.117 .007h3.585l-1.292 -1.293a1 1 0 0 1 -.083 -1.32l.083 -.094a1 1 0 0 1 1.32 -.083l.094 .083l3 3a.98 .98 0 0 1 .28 .872l-.036 .146l-.04 .104a1.02 1.02 0 0 1 -.245 .334l-2.959 2.958a1 1 0 0 1 -1.497 -1.32l.083 -.094l1.291 -1.293h-3.584a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-3a1 1 0 0 1 1 -1z",key:"svg-3"}]],ee=x("filled","replace-filled","ReplaceFilled",Re);function Ce(l){return l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ie(l){if(!l.query)return null;const c=l.regex?l.query:Ce(l.query),i=l.wholeWord?`\\b(?:${c})\\b`:c;try{return new RegExp(i,l.matchCase?"g":"gi")}catch{return null}}const Te=250,Ee=28,_e=24;function Be({repositoryId:l,active:c,revision:i,onOpenFile:h,unsavedPathsAmong:g,onReplaced:o}){const O=pe(),[f,ae]=t.useState(""),[M,se]=t.useState(!1),[N,te]=t.useState(!1),[b,le]=t.useState(!1),[p,ne]=t.useState(!1),[B,re]=t.useState(""),[w,ce]=t.useState(!1),[S,ie]=t.useState(!1),[$,L]=t.useState(!1),[oe,he]=t.useState(0),[Q,G]=t.useState(()=>new Set),K=t.useRef(null),V=t.useRef(null),R=t.useMemo(()=>({query:f,matchCase:M,wholeWord:N,regex:b,includeIgnored:w}),[f,M,N,b,w]),de=t.useMemo(()=>Ie(R),[R]),v=f.trim(),C=ze(v,Te),d=xe({queryKey:je.search(l,{query:C,matchCase:M,wholeWord:N,regex:b,includeIgnored:w,revision:i,replaceRevision:oe}),queryFn:()=>J.repository.search(l,{...R,query:C}),enabled:c&&C.length>0,placeholderData:(a,s)=>s?.queryKey[1]===l?a:void 0}),n=v?d.data??null:null,z=!!v&&(C!==v||d.isFetching),U=v&&d.error?d.error instanceof Error?d.error.message:"The search failed.":null;t.useEffect(()=>{c&&K.current?.focus()},[c]),t.useEffect(()=>{d.data&&G(new Set(d.data.files.filter(a=>a.ignored).map(a=>a.path)))},[d.data]);const I=t.useMemo(()=>{if(!n)return[];const a=[];for(const s of n.files){const u=!Q.has(s.path);if(a.push({kind:"file",file:s,open:u}),u)for(const E of s.matches)a.push({kind:"match",file:s,match:E})}return a},[Q,n]),T=ve({count:I.length,getScrollElement:()=>V.current,estimateSize:a=>O?44:I[a]?.kind==="file"?Ee:_e,getItemKey:a=>{const s=I[a];return s?s.kind==="file"?`file:${s.file.path}`:`match:${s.file.path}:${s.match.line}:${s.match.column??1}`:a},overscan:12});t.useEffect(()=>{T.measure()},[T,O]);const ue=a=>G(s=>{const u=new Set(s);return u.delete(a)||u.add(a),u}),j=n?.files.filter(a=>a.ignored).length??0,y=n?.files.filter(a=>!!a.revision&&(S||!a.ignored))??[],q=async a=>{if(!n||$)return;const s=a==="all"?{kind:"all",files:y.map(r=>({path:r.path,revision:r.revision}))}:"match"in a?{kind:"match",path:a.file.path,revision:a.file.revision,line:a.match.line,column:a.match.column}:{kind:"file",path:a.path,revision:a.revision};if(s.kind==="all"){if(n.truncated){m.info({title:"Narrow the search before replacing all",description:"The current result set is truncated."});return}const r=y.reduce((F,ge)=>F+ge.matches.length,0);if(!r||!window.confirm(`Replace ${r} ${r===1?"occurrence":"occurrences"} in ${y.length} ${y.length===1?"file":"files"}?`))return}else if(s.kind==="file"&&a!=="all"&&!("match"in a)&&a.truncatedMatches&&!window.confirm(`${a.path} has more matches than the ${a.matches.length} listed. Replace every occurrence in the file?`))return;const u=s.kind==="all"?s.files.map(r=>r.path):[s.path],E=g(u);if(E.length>0){m.error({title:"Save open files before replacing in them",description:E.join(", "),duration:1e4});return}L(!0);try{const r=await J.repository.replaceSearch(l,{options:{...R,query:f.trim()},replacement:B,scope:s});r.status==="stale"?m.error({title:"Files changed before replacement",description:"Search results were refreshed without overwriting anything."}):r.status==="no-match"?m.info({title:"No matching text to replace"}):(m.success({title:`Replaced ${r.replacements} ${r.replacements===1?"occurrence":"occurrences"}`,description:`${r.files.length} ${r.files.length===1?"file":"files"} changed`}),o(r.files)),he(F=>F+1)}catch(r){m.error({title:"Could not replace search results",description:r instanceof Error?r.message:"Unknown error",duration:1e4})}finally{L(!1)}};return e.jsxs("div",{className:"search-view",children:[e.jsxs("div",{className:"search-controls",children:[e.jsxs("div",{className:"search-query-row",children:[e.jsx(k,{variant:"ghost",size:"icon-xs",className:"search-replace-toggle","aria-label":p?"Hide replace":"Show replace","aria-expanded":p,onClick:()=>ne(a=>!a),children:p?e.jsx(A,{}):e.jsx(P,{})}),e.jsxs("div",{className:"search-input",children:[e.jsx(fe,{"aria-hidden":"true"}),e.jsx("input",{ref:K,type:"text",value:f,spellCheck:!1,placeholder:"Search in repository","aria-label":"Search in repository",onChange:a=>ae(a.target.value)}),e.jsxs("span",{className:"search-toggles",children:[e.jsx(_,{label:"Match case",active:M,onToggle:()=>se(a=>!a),children:e.jsx(Me,{})}),e.jsx(_,{label:"Match whole word",active:N,onToggle:()=>te(a=>!a),children:e.jsx($e,{})}),e.jsx(_,{label:"Use regular expression",active:b,onToggle:()=>le(a=>!a),children:e.jsx(be,{})}),e.jsx(_,{label:"Search Git-ignored files",active:w,onToggle:()=>ce(a=>!a),children:e.jsx(X,{})})]})]})]}),p&&e.jsxs("div",{className:"search-replace-row",children:[e.jsx(Z,{"aria-hidden":"true"}),e.jsx("input",{value:B,spellCheck:!1,placeholder:"Replace","aria-label":"Replace with",onChange:a=>re(a.target.value)}),e.jsxs(W,{children:[e.jsx(D,{render:e.jsx(k,{variant:"ghost",size:"icon-xs",disabled:$||y.length===0||!!n?.truncated,"aria-label":"Replace all search results",onClick:()=>{q("all")}}),children:e.jsx(ee,{})}),e.jsx(H,{children:n?.truncated?"Narrow the search to replace all":"Replace all"})]})]}),p&&j>0&&e.jsxs("label",{className:"search-include-ignored",children:[e.jsx("input",{type:"checkbox",checked:S,onChange:a=>ie(a.target.checked)})," Include ignored files when replacing"]}),f.trim()!==""&&(n!==null||!z)&&e.jsx("div",{className:"search-summary",children:z?e.jsx(Y,{text:"Searching…"}):U?e.jsx("span",{className:"search-error",children:U}):n&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:n.totalMatches===0?"No results":`${n.totalMatches-n.ignoredMatches}${n.truncated?"+":""} ${n.totalMatches-n.ignoredMatches===1?"result":"results"} in ${n.files.length-j} ${n.files.length-j===1?"file":"files"}`}),n.ignoredMatches>0&&e.jsxs("span",{className:"search-summary-ignored",children:["· ",n.ignoredMatches," in ",j," ignored ",j===1?"file":"files"]})]})})]}),e.jsxs("div",{ref:V,className:"search-results",children:[z&&!n&&e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(me,{className:"spinner"})," ",e.jsx(Y,{text:"Searching…"})]}),e.jsx("div",{className:"search-rows virtual-list",style:{height:T.getTotalSize()},children:T.getVirtualItems().map(a=>{const s=I[a.index];return s?e.jsx("div",{className:"virtual-row",style:{height:a.size,transform:`translateY(${a.start}px)`},children:s.kind==="file"?e.jsxs("div",{className:`search-file-heading ${s.file.ignored?"ignored":""}`,children:[e.jsxs("button",{className:"search-file-toggle",onClick:()=>ue(s.file.path),"aria-expanded":s.open,children:[s.open?e.jsx(A,{}):e.jsx(P,{}),e.jsx("span",{className:"search-file-name",children:s.file.path}),s.file.ignored&&e.jsxs(W,{children:[e.jsx(D,{render:e.jsx("span",{className:"search-file-ignored-badge"}),children:e.jsx(X,{})}),e.jsx(H,{children:"Ignored by Git"})]}),e.jsx("span",{className:"search-file-count",children:s.file.matches.length})]}),p&&s.file.revision&&(!s.file.ignored||S)&&e.jsx(k,{variant:"ghost",size:"icon-xs",className:"search-replace-action",disabled:$,"aria-label":`Replace all in ${s.file.path}`,onClick:()=>{q(s.file)},children:e.jsx(ee,{})})]}):e.jsxs("div",{className:"search-match",children:[e.jsxs("button",{className:"search-match-open",onClick:()=>h(s.file.path),children:[e.jsxs("span",{className:"search-match-line",children:[s.match.line,":",s.match.column??1]}),e.jsx("span",{className:"search-match-text",children:qe(s.match.text,de)})]}),p&&s.file.revision&&s.match.column&&(!s.file.ignored||S)&&e.jsx(k,{variant:"ghost",size:"icon-xs",className:"search-replace-action",disabled:$,"aria-label":`Replace match on line ${s.match.line}`,onClick:()=>{q({file:s.file,match:s.match})},children:e.jsx(Z,{})})]})},a.key):null})})]})]})}function ze(l,c){const[i,h]=t.useState(l);return t.useEffect(()=>{const g=window.setTimeout(()=>h(l),c);return()=>window.clearTimeout(g)},[c,l]),i}function _({label:l,active:c,onToggle:i,children:h}){return e.jsxs(W,{children:[e.jsx(D,{render:e.jsx(k,{variant:"ghost",size:"icon-xs",className:"search-toggle","aria-label":l,"aria-pressed":c,onClick:i}),children:h}),e.jsx(H,{children:l})]})}function qe(l,c){const i=l.replace(/^\s+/,"");if(!c)return i;c.lastIndex=0;const h=[];let g=0;for(let o=c.exec(i);o!==null;o=c.exec(i)){if(o[0]===""){c.lastIndex+=1;continue}h.push(e.jsx(t.Fragment,{children:i.slice(g,o.index)},`${o.index}-plain`),e.jsx("mark",{children:o[0]},`${o.index}-hit`)),g=o.index+o[0].length}return h.length===0?i:(h.push(e.jsx(t.Fragment,{children:i.slice(g)},"tail")),h)}export{Be as SearchView};
@@ -1,4 +1,4 @@
1
- import{r as m,j as e}from"./react-rd22PHbN.js";import{ay as Ns,az as fe,aA as Ke,aB as Xe,aC as Cs,aD as Ss,aE as Ms,aF as Es,aG as Rs,aH as As,A as N,D as H,c as V,d as W,e as Y,k as X,l as ge,y as Ce,g as K,I as Se,H as Me,B as Q,aI as Is,aJ as xe,aK as Oe,Q as qe,aL as Je,aM as Ze,aN as Ts,aO as Le,aP as Os,aQ as Ls,m as Ee,S as re,E as oe,C as le,F as ce,aR as Ps,G as de,aS as $s,aT as Pe,i as Fs,aU as zs,aV as _s,aW as Ds,aX as Bs,X as Us,aY as je,aZ as Gs}from"./App-C7Yf3r-l.js";import{c as O,d as ee,o as te,B as w,T as F,a as z,b as _,I as $e,w as Fe}from"./index-C_D1kOlX.js";import{b as Qe,t as es,c as ss,r as ts,d as ns}from"./tanstack-Bsd5UOY4.js";import{I as Hs}from"./IconEdit-DtVD7NDP.js";import"./base-ui-D4MeJpa3.js";const Vs=[["path",{d:"M3 9l4 -4l4 4m-4 -4v14",key:"svg-0"}],["path",{d:"M21 15l-4 4l-4 -4m4 4v-14",key:"svg-1"}]],as=O("outline","arrows-sort","ArrowsSort",Vs);const Ws=[["path",{d:"M4 8h16",key:"svg-0"}],["path",{d:"M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12",key:"svg-1"}],["path",{d:"M8 4v4",key:"svg-2"}]],Ys=O("outline","browser","Browser",Ws);const Ks=[["path",{d:"M3 5a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v10a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1v-10",key:"svg-0"}],["path",{d:"M7 20h10",key:"svg-1"}],["path",{d:"M9 16v4",key:"svg-2"}],["path",{d:"M15 16v4",key:"svg-3"}]],is=O("outline","device-desktop","DeviceDesktop",Ks);const Xs=[["path",{d:"M2 8a2 2 0 0 1 2 -2h16a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-16a2 2 0 0 1 -2 -2l0 -8",key:"svg-0"}],["path",{d:"M6 10l0 .01",key:"svg-1"}],["path",{d:"M10 10l0 .01",key:"svg-2"}],["path",{d:"M14 10l0 .01",key:"svg-3"}],["path",{d:"M18 10l0 .01",key:"svg-4"}],["path",{d:"M6 14l0 .01",key:"svg-5"}],["path",{d:"M18 14l0 .01",key:"svg-6"}],["path",{d:"M10 14l4 .01",key:"svg-7"}]],qs=O("outline","keyboard","Keyboard",Xs);const Js=[["path",{d:"M9 15l6 -6",key:"svg-0"}],["path",{d:"M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464",key:"svg-1"}],["path",{d:"M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463",key:"svg-2"}]],Zs=O("outline","link","Link",Js);const Qs=[["path",{d:"M9 6l11 0",key:"svg-0"}],["path",{d:"M9 12l11 0",key:"svg-1"}],["path",{d:"M9 18l11 0",key:"svg-2"}],["path",{d:"M5 6l0 .01",key:"svg-3"}],["path",{d:"M5 12l0 .01",key:"svg-4"}],["path",{d:"M5 18l0 .01",key:"svg-5"}]],et=O("outline","list","List",Qs);const st=[["path",{d:"M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454l0 .008",key:"svg-0"}]],tt=O("outline","moon","Moon",st);const nt=[["path",{d:"M6 9a6 6 0 1 0 12 0a6 6 0 0 0 -12 0",key:"svg-0"}],["path",{d:"M12 3c1.333 .333 2 2.333 2 6s-.667 5.667 -2 6",key:"svg-1"}],["path",{d:"M12 3c-1.333 .333 -2 2.333 -2 6s.667 5.667 2 6",key:"svg-2"}],["path",{d:"M6 9h12",key:"svg-3"}],["path",{d:"M3 20h7",key:"svg-4"}],["path",{d:"M14 20h7",key:"svg-5"}],["path",{d:"M10 20a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-6"}],["path",{d:"M12 15v3",key:"svg-7"}]],at=O("outline","network","Network",nt);const it=[["path",{d:"M4 5a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",key:"svg-0"}],["path",{d:"M7 17l0 .01",key:"svg-1"}],["path",{d:"M14 5a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",key:"svg-2"}],["path",{d:"M7 7l0 .01",key:"svg-3"}],["path",{d:"M4 15a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",key:"svg-4"}],["path",{d:"M17 7l0 .01",key:"svg-5"}],["path",{d:"M14 14l3 0",key:"svg-6"}],["path",{d:"M20 14l0 .01",key:"svg-7"}],["path",{d:"M14 14l0 3",key:"svg-8"}],["path",{d:"M14 20l3 0",key:"svg-9"}],["path",{d:"M17 17l3 0",key:"svg-10"}],["path",{d:"M20 17l0 3",key:"svg-11"}]],rt=O("outline","qrcode","Qrcode",it);const ot=[["path",{d:"M12 3a12 12 0 0 0 8.5 3a12 12 0 0 1 -8.5 15a12 12 0 0 1 -8.5 -15a12 12 0 0 0 8.5 -3",key:"svg-0"}],["path",{d:"M11 11a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M12 12l0 2.5",key:"svg-2"}]],ze=O("outline","shield-lock","ShieldLock",ot);const lt=[["path",{d:"M4 6l7 0",key:"svg-0"}],["path",{d:"M4 12l7 0",key:"svg-1"}],["path",{d:"M4 18l9 0",key:"svg-2"}],["path",{d:"M15 9l3 -3l3 3",key:"svg-3"}],["path",{d:"M18 6l0 12",key:"svg-4"}]],rs=O("outline","sort-ascending","SortAscending",lt);const ct=[["path",{d:"M4 6l9 0",key:"svg-0"}],["path",{d:"M4 12l7 0",key:"svg-1"}],["path",{d:"M4 18l7 0",key:"svg-2"}],["path",{d:"M15 15l3 3l3 -3",key:"svg-3"}],["path",{d:"M18 6l0 12",key:"svg-4"}]],os=O("outline","sort-descending","SortDescending",ct);const dt=[["path",{d:"M16 18a2 2 0 0 1 2 2a2 2 0 0 1 2 -2a2 2 0 0 1 -2 -2a2 2 0 0 1 -2 2m0 -12a2 2 0 0 1 2 2a2 2 0 0 1 2 -2a2 2 0 0 1 -2 -2a2 2 0 0 1 -2 2m-7 12a6 6 0 0 1 6 -6a6 6 0 0 1 -6 -6a6 6 0 0 1 -6 6a6 6 0 0 1 6 6",key:"svg-0"}]],ht=O("outline","sparkles","Sparkles",dt);const ut=[["path",{d:"M8 12a4 4 0 1 0 8 0a4 4 0 1 0 -8 0",key:"svg-0"}],["path",{d:"M3 12h1m8 -9v1m8 8h1m-9 8v1m-6.4 -15.4l.7 .7m12.1 -.7l-.7 .7m0 11.4l.7 .7m-12.1 -.7l-.7 .7",key:"svg-1"}]],gt=O("outline","sun","Sun",ut);function _e(s,t){if(typeof s=="function")return s(t);s!=null&&(s.current=t)}function mt(...s){return t=>{let n=!1;const a=s.map(i=>{const r=_e(i,t);return!n&&typeof r=="function"&&(n=!0),r});if(n)return()=>{for(let i=0;i<a.length;i++){const r=a[i];typeof r=="function"?r():_e(s[i],null)}}}}function pt(...s){return m.useCallback(mt(...s),s)}class ft extends m.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(fe(n)&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const a=n.offsetParent,i=fe(a)&&a.offsetWidth||0,r=fe(a)&&a.offsetHeight||0,o=getComputedStyle(n),c=this.props.sizeRef.current;c.height=parseFloat(o.height),c.width=parseFloat(o.width),c.top=n.offsetTop,c.left=n.offsetLeft,c.right=i-c.width-c.left,c.bottom=r-c.height-c.top,c.direction=o.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function xt({children:s,isPresent:t,anchorX:n,anchorY:a,root:i,pop:r}){const o=m.useId(),c=m.useRef(null),h=m.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:f}=m.useContext(Ns),p=r!==!1?s.props?.ref??s?.ref:void 0,u=pt(c,p);return m.useInsertionEffect(()=>{const{width:l,height:x,top:j,left:v,right:y,bottom:S,direction:M}=h.current;if(t||r===!1||!c.current||!l||!x)return;const I=M==="rtl",C=n==="left"?I?`right: ${y}`:`left: ${v}`:I?`left: ${v}`:`right: ${y}`,E=a==="bottom"?`bottom: ${S}`:`top: ${j}`;c.current.dataset.motionPopId=o;const R=document.createElement("style");f&&(R.nonce=f);const L=i??document.head;return L.appendChild(R),R.sheet&&R.sheet.insertRule(`
1
+ import{r as m,j as e}from"./react-rd22PHbN.js";import{ay as Ns,az as fe,aA as Ke,aB as Xe,aC as Cs,aD as Ss,aE as Ms,aF as Es,aG as Rs,aH as As,A as N,D as H,c as V,d as W,e as Y,k as X,l as ge,y as Ce,g as K,I as Se,H as Me,B as Q,aI as Is,aJ as xe,aK as Oe,Q as qe,aL as Je,aM as Ze,aN as Ts,aO as Le,aP as Os,aQ as Ls,m as Ee,S as re,E as oe,C as le,F as ce,aR as Ps,G as de,aS as $s,aT as Pe,i as Fs,aU as zs,aV as _s,aW as Ds,aX as Bs,X as Us,aY as je,aZ as Gs}from"./App-BWpP-n84.js";import{c as O,d as ee,o as te,B as w,T as F,a as z,b as _,I as $e,w as Fe}from"./index-DaaX_e8C.js";import{b as Qe,t as es,c as ss,r as ts,d as ns}from"./tanstack-Bsd5UOY4.js";import{I as Hs}from"./IconEdit-DQZu_Rpb.js";import"./base-ui-D4MeJpa3.js";const Vs=[["path",{d:"M3 9l4 -4l4 4m-4 -4v14",key:"svg-0"}],["path",{d:"M21 15l-4 4l-4 -4m4 4v-14",key:"svg-1"}]],as=O("outline","arrows-sort","ArrowsSort",Vs);const Ws=[["path",{d:"M4 8h16",key:"svg-0"}],["path",{d:"M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12",key:"svg-1"}],["path",{d:"M8 4v4",key:"svg-2"}]],Ys=O("outline","browser","Browser",Ws);const Ks=[["path",{d:"M3 5a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v10a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1v-10",key:"svg-0"}],["path",{d:"M7 20h10",key:"svg-1"}],["path",{d:"M9 16v4",key:"svg-2"}],["path",{d:"M15 16v4",key:"svg-3"}]],is=O("outline","device-desktop","DeviceDesktop",Ks);const Xs=[["path",{d:"M2 8a2 2 0 0 1 2 -2h16a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-16a2 2 0 0 1 -2 -2l0 -8",key:"svg-0"}],["path",{d:"M6 10l0 .01",key:"svg-1"}],["path",{d:"M10 10l0 .01",key:"svg-2"}],["path",{d:"M14 10l0 .01",key:"svg-3"}],["path",{d:"M18 10l0 .01",key:"svg-4"}],["path",{d:"M6 14l0 .01",key:"svg-5"}],["path",{d:"M18 14l0 .01",key:"svg-6"}],["path",{d:"M10 14l4 .01",key:"svg-7"}]],qs=O("outline","keyboard","Keyboard",Xs);const Js=[["path",{d:"M9 15l6 -6",key:"svg-0"}],["path",{d:"M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464",key:"svg-1"}],["path",{d:"M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463",key:"svg-2"}]],Zs=O("outline","link","Link",Js);const Qs=[["path",{d:"M9 6l11 0",key:"svg-0"}],["path",{d:"M9 12l11 0",key:"svg-1"}],["path",{d:"M9 18l11 0",key:"svg-2"}],["path",{d:"M5 6l0 .01",key:"svg-3"}],["path",{d:"M5 12l0 .01",key:"svg-4"}],["path",{d:"M5 18l0 .01",key:"svg-5"}]],et=O("outline","list","List",Qs);const st=[["path",{d:"M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454l0 .008",key:"svg-0"}]],tt=O("outline","moon","Moon",st);const nt=[["path",{d:"M6 9a6 6 0 1 0 12 0a6 6 0 0 0 -12 0",key:"svg-0"}],["path",{d:"M12 3c1.333 .333 2 2.333 2 6s-.667 5.667 -2 6",key:"svg-1"}],["path",{d:"M12 3c-1.333 .333 -2 2.333 -2 6s.667 5.667 2 6",key:"svg-2"}],["path",{d:"M6 9h12",key:"svg-3"}],["path",{d:"M3 20h7",key:"svg-4"}],["path",{d:"M14 20h7",key:"svg-5"}],["path",{d:"M10 20a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-6"}],["path",{d:"M12 15v3",key:"svg-7"}]],at=O("outline","network","Network",nt);const it=[["path",{d:"M4 5a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",key:"svg-0"}],["path",{d:"M7 17l0 .01",key:"svg-1"}],["path",{d:"M14 5a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",key:"svg-2"}],["path",{d:"M7 7l0 .01",key:"svg-3"}],["path",{d:"M4 15a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",key:"svg-4"}],["path",{d:"M17 7l0 .01",key:"svg-5"}],["path",{d:"M14 14l3 0",key:"svg-6"}],["path",{d:"M20 14l0 .01",key:"svg-7"}],["path",{d:"M14 14l0 3",key:"svg-8"}],["path",{d:"M14 20l3 0",key:"svg-9"}],["path",{d:"M17 17l3 0",key:"svg-10"}],["path",{d:"M20 17l0 3",key:"svg-11"}]],rt=O("outline","qrcode","Qrcode",it);const ot=[["path",{d:"M12 3a12 12 0 0 0 8.5 3a12 12 0 0 1 -8.5 15a12 12 0 0 1 -8.5 -15a12 12 0 0 0 8.5 -3",key:"svg-0"}],["path",{d:"M11 11a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M12 12l0 2.5",key:"svg-2"}]],ze=O("outline","shield-lock","ShieldLock",ot);const lt=[["path",{d:"M4 6l7 0",key:"svg-0"}],["path",{d:"M4 12l7 0",key:"svg-1"}],["path",{d:"M4 18l9 0",key:"svg-2"}],["path",{d:"M15 9l3 -3l3 3",key:"svg-3"}],["path",{d:"M18 6l0 12",key:"svg-4"}]],rs=O("outline","sort-ascending","SortAscending",lt);const ct=[["path",{d:"M4 6l9 0",key:"svg-0"}],["path",{d:"M4 12l7 0",key:"svg-1"}],["path",{d:"M4 18l7 0",key:"svg-2"}],["path",{d:"M15 15l3 3l3 -3",key:"svg-3"}],["path",{d:"M18 6l0 12",key:"svg-4"}]],os=O("outline","sort-descending","SortDescending",ct);const dt=[["path",{d:"M16 18a2 2 0 0 1 2 2a2 2 0 0 1 2 -2a2 2 0 0 1 -2 -2a2 2 0 0 1 -2 2m0 -12a2 2 0 0 1 2 2a2 2 0 0 1 2 -2a2 2 0 0 1 -2 -2a2 2 0 0 1 -2 2m-7 12a6 6 0 0 1 6 -6a6 6 0 0 1 -6 -6a6 6 0 0 1 -6 6a6 6 0 0 1 6 6",key:"svg-0"}]],ht=O("outline","sparkles","Sparkles",dt);const ut=[["path",{d:"M8 12a4 4 0 1 0 8 0a4 4 0 1 0 -8 0",key:"svg-0"}],["path",{d:"M3 12h1m8 -9v1m8 8h1m-9 8v1m-6.4 -15.4l.7 .7m12.1 -.7l-.7 .7m0 11.4l.7 .7m-12.1 -.7l-.7 .7",key:"svg-1"}]],gt=O("outline","sun","Sun",ut);function _e(s,t){if(typeof s=="function")return s(t);s!=null&&(s.current=t)}function mt(...s){return t=>{let n=!1;const a=s.map(i=>{const r=_e(i,t);return!n&&typeof r=="function"&&(n=!0),r});if(n)return()=>{for(let i=0;i<a.length;i++){const r=a[i];typeof r=="function"?r():_e(s[i],null)}}}}function pt(...s){return m.useCallback(mt(...s),s)}class ft extends m.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(fe(n)&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const a=n.offsetParent,i=fe(a)&&a.offsetWidth||0,r=fe(a)&&a.offsetHeight||0,o=getComputedStyle(n),c=this.props.sizeRef.current;c.height=parseFloat(o.height),c.width=parseFloat(o.width),c.top=n.offsetTop,c.left=n.offsetLeft,c.right=i-c.width-c.left,c.bottom=r-c.height-c.top,c.direction=o.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function xt({children:s,isPresent:t,anchorX:n,anchorY:a,root:i,pop:r}){const o=m.useId(),c=m.useRef(null),h=m.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:f}=m.useContext(Ns),p=r!==!1?s.props?.ref??s?.ref:void 0,u=pt(c,p);return m.useInsertionEffect(()=>{const{width:l,height:x,top:j,left:v,right:y,bottom:S,direction:M}=h.current;if(t||r===!1||!c.current||!l||!x)return;const I=M==="rtl",C=n==="left"?I?`right: ${y}`:`left: ${v}`:I?`left: ${v}`:`right: ${y}`,E=a==="bottom"?`bottom: ${S}`:`top: ${j}`;c.current.dataset.motionPopId=o;const R=document.createElement("style");f&&(R.nonce=f);const L=i??document.head;return L.appendChild(R),R.sheet&&R.sheet.insertRule(`
2
2
  [data-motion-pop-id="${o}"] {
3
3
  position: absolute !important;
4
4
  width: ${l}px !important;
@@ -1,3 +1,3 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PierreDiffViewer-B9IrAdjM.js","assets/react-rd22PHbN.js","assets/PierreWorkerPool-BJhmuZSy.js","assets/platform-BMNQ8V5r.js","assets/one-light-CoLDteqg.js","assets/index-BgLrS_2D.js","assets/index-C_D1kOlX.js","assets/tanstack-Bsd5UOY4.js","assets/base-ui-D4MeJpa3.js","assets/index-CE9Jcx4e.css","assets/index-CtEztN1P.js","assets/App-C7Yf3r-l.js","assets/File-DM0fcPqi.js","assets/EditContext-CvJWfVl1.js","assets/DiffWorkspace-1ZAh7eFX.js","assets/PierreEditBoundary-DDJlRbaP.js","assets/edit-ready-context-D77R8XU8.js","assets/MarkdownFileViewer-BxQfoNnS.js","assets/viewer-tabs-BHvOJKLx.js","assets/viewer-tabs-D8o-L3pM.css","assets/EditableFileViewer-DOnxE6ty.js","assets/EditableFileViewer-B2G3Xa33.css","assets/render-markdown-DcHo7ihS.js","assets/markdown-BpzjXclZ.css","assets/PullRequestViewer-CuH0Ze12.js","assets/gh-utils-CR5JRkW2.js","assets/GitHubAvatar-BIZ8KlZ9.js","assets/HtmlFileViewer-tEtrcHdG.js","assets/HtmlFileViewer-D6UPnZvW.css","assets/ImageFileViewer-C56bQ88S.js","assets/ImageFileViewer-D8TdwFTO.css"])))=>i.map(i=>d[i]);
2
- import{o as _,B as U,_ as x,T as se,a as ae,b as ne}from"./index-C_D1kOlX.js";import{r as n,j as t}from"./react-rd22PHbN.js";import{J as le,K as re,L as oe,k as R,M as fe,H as Y}from"./App-C7Yf3r-l.js";import"./tanstack-Bsd5UOY4.js";import"./base-ui-D4MeJpa3.js";class de{constructor(e){if(this.options=e,!Number.isInteger(e.maxEntries)||e.maxEntries<1)throw new RangeError("maxEntries must be a positive integer.");if(!Number.isFinite(e.maxBytes)||e.maxBytes<1)throw new RangeError("maxBytes must be a positive number.")}options;entries=new Map;totalBytes=0;get size(){return this.entries.size}get bytes(){return this.totalBytes}get(e){const o=this.entries.get(e);if(o)return this.entries.delete(e),this.entries.set(e,o),o.value}set(e,o){const d=ce(this.options.sizeOf(o)),v=this.entries.get(e);return v&&(this.entries.delete(e),this.totalBytes-=v.bytes),d>this.options.maxBytes?!1:(this.entries.set(e,{value:o,bytes:d}),this.totalBytes+=d,this.evictToBudget(),this.entries.has(e))}delete(e){const o=this.entries.get(e);return o?(this.entries.delete(e),this.totalBytes-=o.bytes,!0):!1}clear(){this.entries.clear(),this.totalBytes=0}evictToBudget(){for(;this.entries.size>this.options.maxEntries||this.totalBytes>this.options.maxBytes;){const e=this.entries.keys().next();if(e.done)break;this.delete(e.value)}}}function ce(i){if(!Number.isFinite(i)||i<0)throw new RangeError("sizeOf must return a finite, non-negative number.");return Math.ceil(i)}const G=n.lazy(()=>x(()=>import("./PierreDiffViewer-B9IrAdjM.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),ue=n.lazy(()=>x(()=>import("./PierreEditBoundary-DDJlRbaP.js"),__vite__mapDeps([15,6,1,7,8,9,13,11,16])).then(i=>({default:i.PierreEditBoundary}))),me=n.lazy(()=>x(()=>import("./MarkdownFileViewer-BxQfoNnS.js"),__vite__mapDeps([17,1,11,6,7,8,9,18,19,20,2,3,4,5,10,12,13,16,21,22,23])).then(i=>({default:i.MarkdownFileViewer}))),he=n.lazy(()=>x(()=>import("./PullRequestViewer-CuH0Ze12.js"),__vite__mapDeps([24,6,1,7,8,9,11,18,19,25,26,23])).then(i=>({default:i.PullRequestViewer}))),pe=n.lazy(()=>x(()=>import("./EditableFileViewer-DOnxE6ty.js").then(i=>i.E),__vite__mapDeps([20,1,2,3,4,5,6,7,8,9,10,11,12,13,16,21])).then(i=>({default:i.EditableFileViewer}))),xe=n.lazy(()=>x(()=>import("./HtmlFileViewer-tEtrcHdG.js"),__vite__mapDeps([27,1,18,6,7,8,9,19,20,2,3,4,5,10,11,12,13,16,21,28])).then(i=>({default:i.HtmlFileViewer}))),ve=n.lazy(()=>x(()=>import("./ImageFileViewer-C56bQ88S.js"),__vite__mapDeps([29,1,6,7,8,9,18,19,20,2,3,4,5,10,11,12,13,16,21,30])).then(i=>({default:i.ImageFileViewer}))),ye=n.lazy(()=>x(()=>import("./ImageFileViewer-C56bQ88S.js"),__vite__mapDeps([29,1,6,7,8,9,18,19,20,2,3,4,5,10,11,12,13,16,21,30])).then(i=>({default:i.SvgFileViewer}))),F=new de({maxEntries:8,maxBytes:16*1024*1024,sizeOf:i=>i.patch.length*2+i.path.length*2+256});let Q=null;function Se({repositoryId:i,selection:e,diffView:o,wrapLines:d,theme:v,revision:y,readOnly:g,commits:T,draftFor:E,onSelect:$,onOpenFile:Z,onDiffViewChange:K,onWrapLinesChange:M,onDraftChange:O,onDraftSaved:A,onUpdateConflict:W,onResolveConflict:I}){const[a,w]=n.useState(null),[ee,L]=n.useState(!1),[D,q]=n.useState(null),[V,H]=n.useState(!1),b=n.useRef(0),C=n.useRef(!1),u=je(i,e);n.useEffect(()=>{H(!1),C.current=!1},[e]),n.useEffect(()=>{Q!==i&&(F.clear(),Q=i);const s=++b.current;if(q(null),!e||e.type==="pull-request"){w(null),L(!1);return}L(!0),(async()=>{try{if(e.type==="file"||e.type==="conflict"){if(e.type==="file"&&fe(e.path)){const l=await _.repository.readImage(i,e.path);if(s!==b.current)return;w({docKey:u,type:"image",value:l});return}const f=await _.repository.readFile(i,e.path,e.type==="conflict"?!0:V);if(s!==b.current)return;if(e.type==="conflict"){w({docKey:u,type:"conflict",value:f});return}w(l=>l&&l.docKey===u&&l.type==="file"&&C.current||l&&l.docKey===u&&l.type==="file"&&l.value.content===f.content&&l.value.size===f.size&&l.value.binary===f.binary&&l.value.tooLarge===f.tooLarge?l:{docKey:u,type:"file",value:f})}else{const f=e.type!=="diff";let l=f?F.get(u):void 0;if(l||(l=e.type==="commit"?await _.diff.getCommit(i,e.oid):e.type==="commit-file"?await _.diff.getCommitFile(i,e.oid,e.path,e.oldPath):await _.diff.get({repositoryId:i,path:e.path,kind:e.kind}),f&&F.set(u,l)),s!==b.current)return;const p=l;w(c=>c&&c.docKey===u&&c.type==="diff"&&c.value.patch===p.patch&&c.value.binary===p.binary?c:{docKey:u,type:"diff",value:p})}}catch(f){s===b.current&&q(f instanceof Error?f.message:"Could not load the viewer.")}finally{s===b.current&&L(!1)}})()},[V,u,i,y,e]);const j=v==="system"?"system":v,te=d?"wrap":"scroll",N=n.useCallback(s=>{C.current=s},[]),S=n.useCallback(async(s,h,f)=>{const l=E(s),p=await _.repository.writeFile(i,s,h,l?.expectedContent??f);return p.status==="saved"&&(C.current=!1,A(s),w(c=>c?.type==="file"&&c.value.path===s?{...c,value:{...c.value,content:h,binary:!1,tooLarge:!1,size:p.size,mtimeMs:p.mtimeMs}}:c)),p},[E,A,i]),B=n.useCallback(s=>s.path,[]),k=n.useCallback(s=>E(s.path)?.content??s.content,[E]),z=n.useCallback(s=>h=>O(s.path,h,s.content,s.mtimeMs),[O]),ie=ee&&a!==null&&!D;let r,P=null;if(!e)r=t.jsx(we,{});else if(e.type==="pull-request")r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(he,{repositoryId:i,prNumber:e.number,diffView:o,themeType:j,wrapLines:d,onDiffViewChange:K,onWrapLinesChange:M,onClose:()=>$(null)},`${i}:${e.number}`)});else if(D)r=t.jsx("div",{className:"viewer-message text-destructive",children:D});else if(!a)r=t.jsxs("div",{className:"viewer-message",children:[t.jsx(R,{className:"spinner"})," ",t.jsx(Y,{text:"Loading…"})]});else if(a.type==="image")r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(ve,{image:a.value},`${a.value.path}:${a.value.mtimeMs}`)});else if(a.type!=="diff"&&a.value.binary)r=t.jsxs("div",{className:"viewer-message",children:["Binary file · ",X(a.value.size)]});else if(a.type==="file"&&a.value.tooLarge&&!V)r=t.jsxs("div",{className:"viewer-message flex-col gap-3",children:[t.jsxs("p",{children:["The file is ",X(a.value.size),". Preview is limited to protect performance."]}),t.jsx(U,{variant:"outline",onClick:()=>H(!0),children:"Load preview"})]});else if(a.type==="file"&&a.value.tooLarge)r=t.jsx("div",{className:"viewer-message text-destructive",children:"The file exceeds the built-in editor's 8 MB safety limit."});else if(a.type==="conflict"&&a.value.tooLarge)r=t.jsx("div",{className:"viewer-message text-destructive",children:"The conflicted file exceeds the viewer's safe limit. Open it in an external editor to resolve it."});else if(a.type==="conflict")r=null,P=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(G,{kind:"conflict",contentKey:a.docKey,file:a.value,themeType:j,overflow:te,onUpdate:W,onResolve:I})});else if(a.type==="file"&&le(a.value.path)){const s=a.value;r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(me,{file:s,initialContent:k(s),revision:y,themeType:j,wrapLines:d,readOnly:g||s.tooLarge,onOpenFile:Z,onDirtyChange:N,onDraftChange:z(s),onSave:S},B(s))})}else if(a.type==="file"&&re(a.value.path)){const s=a.value;r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(ye,{file:s,initialContent:k(s),themeType:j,wrapLines:d,readOnly:g||s.tooLarge,onDirtyChange:N,onDraftChange:z(s),onSave:S},B(s))})}else if(a.type==="file"&&oe(a.value.path)){const s=a.value;r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(xe,{file:s,initialContent:k(s),themeType:j,wrapLines:d,readOnly:g||s.tooLarge,onDirtyChange:N,onDraftChange:z(s),onSave:S},B(s))})}else if(a.type==="file"){const s=a.value;r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(pe,{file:s,initialContent:k(s),themeType:j,wrapLines:d,readOnly:g,onDirtyChange:N,onDraftChange:z(s),onSave:S},B(s))})}else if(a.type==="diff"&&a.value.patch){const s=e.type==="commit"||e.type==="commit-file"?e:null,h=s?T.find(l=>l.oid===s.oid):void 0,f=e.type==="commit-file"?t.jsx(U,{type:"button",variant:"outline",size:"xs",onClick:()=>$({type:"commit",oid:e.oid,subject:h?.subject??e.oid.slice(0,8)}),children:"All files"}):void 0;r=null,P=t.jsxs("div",{className:s?"commit-diff-viewer":"standalone-diff-viewer",children:[s&&t.jsx(ge,{commit:h,fallbackSubject:"subject"in s?s.subject:""},s.oid),t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(G,{kind:"diff",contentKey:a.docKey,value:a.value,diffView:o,themeType:j,wrapLines:d,initiallyCollapsed:e.type==="commit",compact:e.type==="diff",scopeControl:f,onDiffViewChange:K,onWrapLinesChange:M,onClose:()=>$(null)})})]})}else a.type==="diff"?r=t.jsx("div",{className:"viewer-message",children:"No differences to show."}):r=t.jsx("div",{className:"viewer-message",children:"This file cannot be edited."});const J=t.jsxs(t.Fragment,{children:[P??t.jsx("div",{className:"viewer-transition",children:r},a?a.docKey:u),ie&&t.jsx("span",{className:"viewer-reloading","aria-hidden":"true",children:t.jsx(R,{className:"spinner"})})]});return a?.type!=="file"?J:t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(ue,{enabled:!0,children:J})})}function ge({commit:i,fallbackSubject:e}){const o=i?.date?new Date(i.date):null,[d,v]=n.useState(!1),y=i?.body??"",g=y.length>240||y.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PierreDiffViewer-CYdNkBG9.js","assets/react-rd22PHbN.js","assets/PierreWorkerPool-B2iHe3DC.js","assets/platform-BMNQ8V5r.js","assets/one-light-CoLDteqg.js","assets/index-BgLrS_2D.js","assets/index-DaaX_e8C.js","assets/tanstack-Bsd5UOY4.js","assets/base-ui-D4MeJpa3.js","assets/index-DXR6FOp1.css","assets/index-CtEztN1P.js","assets/App-BWpP-n84.js","assets/File-CYcpdoXz.js","assets/EditContext-CvJWfVl1.js","assets/DiffWorkspace-Dg7YI5fJ.js","assets/PierreEditBoundary-Cu19fc5Z.js","assets/edit-ready-context-D77R8XU8.js","assets/MarkdownFileViewer-Bhrr1l2Q.js","assets/viewer-tabs-BW5-uV6M.js","assets/viewer-tabs-D8o-L3pM.css","assets/EditableFileViewer-CmxzBnAY.js","assets/EditableFileViewer-B2G3Xa33.css","assets/render-markdown-D7BGt-zy.js","assets/markdown-BpzjXclZ.css","assets/PullRequestViewer-Bsh-F3-d.js","assets/gh-utils-rGdT2YZN.js","assets/GitHubAvatar-BcncAgKT.js","assets/HtmlFileViewer-jdBVtlNv.js","assets/HtmlFileViewer-D6UPnZvW.css","assets/ImageFileViewer-BW1MbklH.js","assets/ImageFileViewer-D8TdwFTO.css"])))=>i.map(i=>d[i]);
2
+ import{o as _,B as U,_ as x,T as se,a as ae,b as ne}from"./index-DaaX_e8C.js";import{r as n,j as t}from"./react-rd22PHbN.js";import{J as le,K as re,L as oe,k as R,M as fe,H as Y}from"./App-BWpP-n84.js";import"./tanstack-Bsd5UOY4.js";import"./base-ui-D4MeJpa3.js";class de{constructor(e){if(this.options=e,!Number.isInteger(e.maxEntries)||e.maxEntries<1)throw new RangeError("maxEntries must be a positive integer.");if(!Number.isFinite(e.maxBytes)||e.maxBytes<1)throw new RangeError("maxBytes must be a positive number.")}options;entries=new Map;totalBytes=0;get size(){return this.entries.size}get bytes(){return this.totalBytes}get(e){const o=this.entries.get(e);if(o)return this.entries.delete(e),this.entries.set(e,o),o.value}set(e,o){const d=ce(this.options.sizeOf(o)),v=this.entries.get(e);return v&&(this.entries.delete(e),this.totalBytes-=v.bytes),d>this.options.maxBytes?!1:(this.entries.set(e,{value:o,bytes:d}),this.totalBytes+=d,this.evictToBudget(),this.entries.has(e))}delete(e){const o=this.entries.get(e);return o?(this.entries.delete(e),this.totalBytes-=o.bytes,!0):!1}clear(){this.entries.clear(),this.totalBytes=0}evictToBudget(){for(;this.entries.size>this.options.maxEntries||this.totalBytes>this.options.maxBytes;){const e=this.entries.keys().next();if(e.done)break;this.delete(e.value)}}}function ce(i){if(!Number.isFinite(i)||i<0)throw new RangeError("sizeOf must return a finite, non-negative number.");return Math.ceil(i)}const G=n.lazy(()=>x(()=>import("./PierreDiffViewer-CYdNkBG9.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),ue=n.lazy(()=>x(()=>import("./PierreEditBoundary-Cu19fc5Z.js"),__vite__mapDeps([15,6,1,7,8,9,13,11,16])).then(i=>({default:i.PierreEditBoundary}))),me=n.lazy(()=>x(()=>import("./MarkdownFileViewer-Bhrr1l2Q.js"),__vite__mapDeps([17,1,11,6,7,8,9,18,19,20,2,3,4,5,10,12,13,16,21,22,23])).then(i=>({default:i.MarkdownFileViewer}))),he=n.lazy(()=>x(()=>import("./PullRequestViewer-Bsh-F3-d.js"),__vite__mapDeps([24,6,1,7,8,9,11,18,19,25,26,23])).then(i=>({default:i.PullRequestViewer}))),pe=n.lazy(()=>x(()=>import("./EditableFileViewer-CmxzBnAY.js").then(i=>i.E),__vite__mapDeps([20,1,2,3,4,5,6,7,8,9,10,11,12,13,16,21])).then(i=>({default:i.EditableFileViewer}))),xe=n.lazy(()=>x(()=>import("./HtmlFileViewer-jdBVtlNv.js"),__vite__mapDeps([27,1,18,6,7,8,9,19,20,2,3,4,5,10,11,12,13,16,21,28])).then(i=>({default:i.HtmlFileViewer}))),ve=n.lazy(()=>x(()=>import("./ImageFileViewer-BW1MbklH.js"),__vite__mapDeps([29,1,6,7,8,9,18,19,20,2,3,4,5,10,11,12,13,16,21,30])).then(i=>({default:i.ImageFileViewer}))),ye=n.lazy(()=>x(()=>import("./ImageFileViewer-BW1MbklH.js"),__vite__mapDeps([29,1,6,7,8,9,18,19,20,2,3,4,5,10,11,12,13,16,21,30])).then(i=>({default:i.SvgFileViewer}))),F=new de({maxEntries:8,maxBytes:16*1024*1024,sizeOf:i=>i.patch.length*2+i.path.length*2+256});let Q=null;function Se({repositoryId:i,selection:e,diffView:o,wrapLines:d,theme:v,revision:y,readOnly:g,commits:T,draftFor:E,onSelect:$,onOpenFile:Z,onDiffViewChange:K,onWrapLinesChange:M,onDraftChange:O,onDraftSaved:A,onUpdateConflict:W,onResolveConflict:I}){const[a,w]=n.useState(null),[ee,L]=n.useState(!1),[D,q]=n.useState(null),[V,H]=n.useState(!1),b=n.useRef(0),C=n.useRef(!1),u=je(i,e);n.useEffect(()=>{H(!1),C.current=!1},[e]),n.useEffect(()=>{Q!==i&&(F.clear(),Q=i);const s=++b.current;if(q(null),!e||e.type==="pull-request"){w(null),L(!1);return}L(!0),(async()=>{try{if(e.type==="file"||e.type==="conflict"){if(e.type==="file"&&fe(e.path)){const l=await _.repository.readImage(i,e.path);if(s!==b.current)return;w({docKey:u,type:"image",value:l});return}const f=await _.repository.readFile(i,e.path,e.type==="conflict"?!0:V);if(s!==b.current)return;if(e.type==="conflict"){w({docKey:u,type:"conflict",value:f});return}w(l=>l&&l.docKey===u&&l.type==="file"&&C.current||l&&l.docKey===u&&l.type==="file"&&l.value.content===f.content&&l.value.size===f.size&&l.value.binary===f.binary&&l.value.tooLarge===f.tooLarge?l:{docKey:u,type:"file",value:f})}else{const f=e.type!=="diff";let l=f?F.get(u):void 0;if(l||(l=e.type==="commit"?await _.diff.getCommit(i,e.oid):e.type==="commit-file"?await _.diff.getCommitFile(i,e.oid,e.path,e.oldPath):await _.diff.get({repositoryId:i,path:e.path,kind:e.kind}),f&&F.set(u,l)),s!==b.current)return;const p=l;w(c=>c&&c.docKey===u&&c.type==="diff"&&c.value.patch===p.patch&&c.value.binary===p.binary?c:{docKey:u,type:"diff",value:p})}}catch(f){s===b.current&&q(f instanceof Error?f.message:"Could not load the viewer.")}finally{s===b.current&&L(!1)}})()},[V,u,i,y,e]);const j=v==="system"?"system":v,te=d?"wrap":"scroll",N=n.useCallback(s=>{C.current=s},[]),S=n.useCallback(async(s,h,f)=>{const l=E(s),p=await _.repository.writeFile(i,s,h,l?.expectedContent??f);return p.status==="saved"&&(C.current=!1,A(s),w(c=>c?.type==="file"&&c.value.path===s?{...c,value:{...c.value,content:h,binary:!1,tooLarge:!1,size:p.size,mtimeMs:p.mtimeMs}}:c)),p},[E,A,i]),B=n.useCallback(s=>s.path,[]),k=n.useCallback(s=>E(s.path)?.content??s.content,[E]),z=n.useCallback(s=>h=>O(s.path,h,s.content,s.mtimeMs),[O]),ie=ee&&a!==null&&!D;let r,P=null;if(!e)r=t.jsx(we,{});else if(e.type==="pull-request")r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(he,{repositoryId:i,prNumber:e.number,diffView:o,themeType:j,wrapLines:d,onDiffViewChange:K,onWrapLinesChange:M,onClose:()=>$(null)},`${i}:${e.number}`)});else if(D)r=t.jsx("div",{className:"viewer-message text-destructive",children:D});else if(!a)r=t.jsxs("div",{className:"viewer-message",children:[t.jsx(R,{className:"spinner"})," ",t.jsx(Y,{text:"Loading…"})]});else if(a.type==="image")r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(ve,{image:a.value},`${a.value.path}:${a.value.mtimeMs}`)});else if(a.type!=="diff"&&a.value.binary)r=t.jsxs("div",{className:"viewer-message",children:["Binary file · ",X(a.value.size)]});else if(a.type==="file"&&a.value.tooLarge&&!V)r=t.jsxs("div",{className:"viewer-message flex-col gap-3",children:[t.jsxs("p",{children:["The file is ",X(a.value.size),". Preview is limited to protect performance."]}),t.jsx(U,{variant:"outline",onClick:()=>H(!0),children:"Load preview"})]});else if(a.type==="file"&&a.value.tooLarge)r=t.jsx("div",{className:"viewer-message text-destructive",children:"The file exceeds the built-in editor's 8 MB safety limit."});else if(a.type==="conflict"&&a.value.tooLarge)r=t.jsx("div",{className:"viewer-message text-destructive",children:"The conflicted file exceeds the viewer's safe limit. Open it in an external editor to resolve it."});else if(a.type==="conflict")r=null,P=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(G,{kind:"conflict",contentKey:a.docKey,file:a.value,themeType:j,overflow:te,onUpdate:W,onResolve:I})});else if(a.type==="file"&&le(a.value.path)){const s=a.value;r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(me,{file:s,initialContent:k(s),revision:y,themeType:j,wrapLines:d,readOnly:g||s.tooLarge,onOpenFile:Z,onDirtyChange:N,onDraftChange:z(s),onSave:S},B(s))})}else if(a.type==="file"&&re(a.value.path)){const s=a.value;r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(ye,{file:s,initialContent:k(s),themeType:j,wrapLines:d,readOnly:g||s.tooLarge,onDirtyChange:N,onDraftChange:z(s),onSave:S},B(s))})}else if(a.type==="file"&&oe(a.value.path)){const s=a.value;r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(xe,{file:s,initialContent:k(s),themeType:j,wrapLines:d,readOnly:g||s.tooLarge,onDirtyChange:N,onDraftChange:z(s),onSave:S},B(s))})}else if(a.type==="file"){const s=a.value;r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(pe,{file:s,initialContent:k(s),themeType:j,wrapLines:d,readOnly:g,onDirtyChange:N,onDraftChange:z(s),onSave:S},B(s))})}else if(a.type==="diff"&&a.value.patch){const s=e.type==="commit"||e.type==="commit-file"?e:null,h=s?T.find(l=>l.oid===s.oid):void 0,f=e.type==="commit-file"?t.jsx(U,{type:"button",variant:"outline",size:"xs",onClick:()=>$({type:"commit",oid:e.oid,subject:h?.subject??e.oid.slice(0,8)}),children:"All files"}):void 0;r=null,P=t.jsxs("div",{className:s?"commit-diff-viewer":"standalone-diff-viewer",children:[s&&t.jsx(ge,{commit:h,fallbackSubject:"subject"in s?s.subject:""},s.oid),t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(G,{kind:"diff",contentKey:a.docKey,value:a.value,diffView:o,themeType:j,wrapLines:d,initiallyCollapsed:e.type==="commit",compact:e.type==="diff",scopeControl:f,onDiffViewChange:K,onWrapLinesChange:M,onClose:()=>$(null)})})]})}else a.type==="diff"?r=t.jsx("div",{className:"viewer-message",children:"No differences to show."}):r=t.jsx("div",{className:"viewer-message",children:"This file cannot be edited."});const J=t.jsxs(t.Fragment,{children:[P??t.jsx("div",{className:"viewer-transition",children:r},a?a.docKey:u),ie&&t.jsx("span",{className:"viewer-reloading","aria-hidden":"true",children:t.jsx(R,{className:"spinner"})})]});return a?.type!=="file"?J:t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(ue,{enabled:!0,children:J})})}function ge({commit:i,fallbackSubject:e}){const o=i?.date?new Date(i.date):null,[d,v]=n.useState(!1),y=i?.body??"",g=y.length>240||y.split(`
3
3
  `).length>3;return t.jsxs("header",{className:"commit-diff-header",children:[t.jsx("h2",{children:i?.subject||e||"(no subject)"}),y&&t.jsxs("div",{className:"commit-diff-description-wrap",children:[t.jsx("p",{className:`commit-diff-description ${g&&!d?"collapsed":""}`,children:y}),g&&t.jsx("button",{type:"button",className:"commit-description-toggle","aria-expanded":d,onClick:()=>v(T=>!T),children:d?"Show less":"Show full description"})]}),t.jsxs("div",{className:"commit-diff-meta",children:[t.jsx("code",{children:i?.shortOid??"commit"}),i?.author&&t.jsxs("span",{children:[i.author,i.email?` <${i.email}>`:""]}),o&&Number.isFinite(o.getTime())&&t.jsxs(se,{children:[t.jsx(ae,{render:t.jsx("time",{dateTime:i?.date}),children:o.toLocaleString()}),t.jsx(ne,{children:o.toLocaleString()})]}),i?.parentCount&&i.parentCount>1?t.jsx("span",{children:"Merge commit"}):null,i?.upstreamState==="local-only"&&t.jsx("span",{className:"commit-local-label",children:"Local only"})]})]})}function je(i,e){return e?e.type==="pull-request"?`${i}:pull:${e.number}`:e.type==="commit"?`${i}:commit:${e.oid}`:e.type==="commit-file"?`${i}:commit-file:${e.oid}:${e.oldPath??""}:${e.path}`:e.type==="diff"?`${i}:diff:${e.kind}:${e.path}`:`${i}:${e.type}:${e.path}`:`${i}:empty`}function m(){return t.jsxs("div",{className:"viewer-message",children:[t.jsx(R,{className:"spinner"})," ",t.jsx(Y,{text:"Loading viewer…"})]})}function we(){return t.jsxs("div",{className:"viewer-empty",children:[t.jsx("h2",{children:"Nothing selected"}),t.jsx("p",{children:"Select a change, file, commit, or pull request."})]})}function X(i){return i?i<1024?`${i} B`:i<1024*1024?`${(i/1024).toFixed(1)} KB`:`${(i/1024/1024).toFixed(1)} MB`:"unknown size"}export{Se as default};
@@ -1 +1 @@
1
- import{g as p,r as u,d as a}from"./chunk-6Q2QTUOP-CR_RRfTb.js";import{p as f}from"./chunk-JWPE2WC7-BAhDzsCx.js";import{_ as n,l as s}from"./mermaid.core-B_Mv_eHi.js";import{M as c,b as d}from"./cynefin-VYW2F7L2-BT5dARHp.js";import"./index-C_D1kOlX.js";import"./react-rd22PHbN.js";import"./tanstack-Bsd5UOY4.js";import"./base-ui-D4MeJpa3.js";import"./render-markdown-DcHo7ihS.js";import"./App-C7Yf3r-l.js";import"./one-light-CoLDteqg.js";import"./index-BgLrS_2D.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,o]=e.split("*"),m=t?parseInt(t,10):0,l=o?parseInt(o,10):1/0;return{min:m,max:l}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:o}=b(e.repeat);return t===0&&o===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:o}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),s.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;s.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),s.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},$={parser:R,db:a,renderer:u,styles:p};export{$ as diagram};
1
+ import{g as p,r as u,d as a}from"./chunk-6Q2QTUOP-BIpZKHoj.js";import{p as f}from"./chunk-JWPE2WC7-DxFk0X7_.js";import{_ as n,l as s}from"./mermaid.core-D4_R4ZQ7.js";import{M as c,b as d}from"./cynefin-VYW2F7L2-CHf3vLku.js";import"./index-DaaX_e8C.js";import"./react-rd22PHbN.js";import"./tanstack-Bsd5UOY4.js";import"./base-ui-D4MeJpa3.js";import"./render-markdown-D7BGt-zy.js";import"./App-BWpP-n84.js";import"./one-light-CoLDteqg.js";import"./index-BgLrS_2D.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,o]=e.split("*"),m=t?parseInt(t,10):0,l=o?parseInt(o,10):1/0;return{min:m,max:l}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:o}=b(e.repeat);return t===0&&o===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:o}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),s.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;s.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),s.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},$={parser:R,db:a,renderer:u,styles:p};export{$ as diagram};
@@ -1 +1 @@
1
- import{G as ln,H as un,I as N,J as I,K as J,L as an,M as y,N as tn,O as j,P as _,Q as rn,R as o,S as on,T as sn,V as fn}from"./mermaid.core-B_Mv_eHi.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,q,O,v,R,K,u){var D=q-l,i=O-h,n=K-v,d=u-R,a=d*D-n*i;if(!(a*a<y))return a=(n*(h-R)-d*(l-v))/a,[l+a*D,h+a*i]}function W(l,h,q,O,v,R,K){var u=l-q,D=h-O,i=(K?R:-R)/j(u*u+D*D),n=i*D,d=-i*u,a=l+n,s=h+d,f=q+n,c=O+d,L=(a+f)/2,t=(s+c)/2,m=f-a,g=c-s,A=m*m+g*g,T=v-R,P=a*c-f*s,E=(g<0?-1:1)*j(on(0,T*T*A-P*P)),G=(P*g-m*E)/A,H=(-P*m-g*E)/A,w=(P*g+m*E)/A,p=(-P*m+g*E)/A,x=G-L,e=H-t,r=w-L,M=p-t;return x*x+e*e>r*r+M*M&&(G=w,H=p),{cx:G,cy:H,x01:-n,y01:-d,x11:G*(v/T-1),y11:H*(v/T-1)}}function hn(){var l=cn,h=yn,q=J(0),O=null,v=gn,R=dn,K=mn,u=null,D=ln(i);function i(){var n,d,a=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=R.apply(this,arguments)-an,L=rn(c-f),t=c>f;if(u||(u=n=D()),s<a&&(d=s,s=a,a=d),!(s>y))u.moveTo(0,0);else if(L>tn-y)u.moveTo(s*N(f),s*I(f)),u.arc(0,0,s,f,c,!t),a>y&&(u.moveTo(a*N(c),a*I(c)),u.arc(0,0,a,c,f,t));else{var m=f,g=c,A=f,T=c,P=L,E=L,G=K.apply(this,arguments)/2,H=G>y&&(O?+O.apply(this,arguments):j(a*a+s*s)),w=_(rn(s-a)/2,+q.apply(this,arguments)),p=w,x=w,e,r;if(H>y){var M=sn(H/a*I(G)),z=sn(H/s*I(G));(P-=M*2)>y?(M*=t?1:-1,A+=M,T-=M):(P=0,A=T=(f+c)/2),(E-=z*2)>y?(z*=t?1:-1,m+=z,g-=z):(E=0,m=g=(f+c)/2)}var Q=s*N(m),V=s*I(m),B=a*N(T),C=a*I(T);if(w>y){var F=s*N(g),U=s*I(g),X=a*N(A),Y=a*I(A),S;if(L<un)if(S=pn(Q,V,X,Y,F,U,B,C)){var Z=Q-S[0],$=V-S[1],k=F-S[0],b=U-S[1],nn=1/I(fn((Z*k+$*b)/(j(Z*Z+$*$)*j(k*k+b*b)))/2),en=j(S[0]*S[0]+S[1]*S[1]);p=_(w,(a-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}E>y?x>y?(e=W(X,Y,Q,V,s,x,t),r=W(F,U,B,C,s,x,t),u.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?u.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(u.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),u.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),u.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(u.moveTo(Q,V),u.arc(0,0,s,m,g,!t)):u.moveTo(Q,V),!(a>y)||!(P>y)?u.lineTo(B,C):p>y?(e=W(B,C,F,U,a,-p,t),r=W(Q,V,X,Y,a,-p,t),u.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?u.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(u.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),u.arc(0,0,a,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),u.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):u.arc(0,0,a,T,A,t)}if(u.closePath(),n)return u=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +R.apply(this,arguments))/2-un/2;return[N(d)*n,I(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:J(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:J(+n),i):h},i.cornerRadius=function(n){return arguments.length?(q=typeof n=="function"?n:J(+n),i):q},i.padRadius=function(n){return arguments.length?(O=n==null?null:typeof n=="function"?n:J(+n),i):O},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:J(+n),i):v},i.endAngle=function(n){return arguments.length?(R=typeof n=="function"?n:J(+n),i):R},i.padAngle=function(n){return arguments.length?(K=typeof n=="function"?n:J(+n),i):K},i.context=function(n){return arguments.length?(u=n??null,i):u},i}export{hn as d};
1
+ import{G as ln,H as un,I as N,J as I,K as J,L as an,M as y,N as tn,O as j,P as _,Q as rn,R as o,S as on,T as sn,V as fn}from"./mermaid.core-D4_R4ZQ7.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,q,O,v,R,K,u){var D=q-l,i=O-h,n=K-v,d=u-R,a=d*D-n*i;if(!(a*a<y))return a=(n*(h-R)-d*(l-v))/a,[l+a*D,h+a*i]}function W(l,h,q,O,v,R,K){var u=l-q,D=h-O,i=(K?R:-R)/j(u*u+D*D),n=i*D,d=-i*u,a=l+n,s=h+d,f=q+n,c=O+d,L=(a+f)/2,t=(s+c)/2,m=f-a,g=c-s,A=m*m+g*g,T=v-R,P=a*c-f*s,E=(g<0?-1:1)*j(on(0,T*T*A-P*P)),G=(P*g-m*E)/A,H=(-P*m-g*E)/A,w=(P*g+m*E)/A,p=(-P*m+g*E)/A,x=G-L,e=H-t,r=w-L,M=p-t;return x*x+e*e>r*r+M*M&&(G=w,H=p),{cx:G,cy:H,x01:-n,y01:-d,x11:G*(v/T-1),y11:H*(v/T-1)}}function hn(){var l=cn,h=yn,q=J(0),O=null,v=gn,R=dn,K=mn,u=null,D=ln(i);function i(){var n,d,a=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=R.apply(this,arguments)-an,L=rn(c-f),t=c>f;if(u||(u=n=D()),s<a&&(d=s,s=a,a=d),!(s>y))u.moveTo(0,0);else if(L>tn-y)u.moveTo(s*N(f),s*I(f)),u.arc(0,0,s,f,c,!t),a>y&&(u.moveTo(a*N(c),a*I(c)),u.arc(0,0,a,c,f,t));else{var m=f,g=c,A=f,T=c,P=L,E=L,G=K.apply(this,arguments)/2,H=G>y&&(O?+O.apply(this,arguments):j(a*a+s*s)),w=_(rn(s-a)/2,+q.apply(this,arguments)),p=w,x=w,e,r;if(H>y){var M=sn(H/a*I(G)),z=sn(H/s*I(G));(P-=M*2)>y?(M*=t?1:-1,A+=M,T-=M):(P=0,A=T=(f+c)/2),(E-=z*2)>y?(z*=t?1:-1,m+=z,g-=z):(E=0,m=g=(f+c)/2)}var Q=s*N(m),V=s*I(m),B=a*N(T),C=a*I(T);if(w>y){var F=s*N(g),U=s*I(g),X=a*N(A),Y=a*I(A),S;if(L<un)if(S=pn(Q,V,X,Y,F,U,B,C)){var Z=Q-S[0],$=V-S[1],k=F-S[0],b=U-S[1],nn=1/I(fn((Z*k+$*b)/(j(Z*Z+$*$)*j(k*k+b*b)))/2),en=j(S[0]*S[0]+S[1]*S[1]);p=_(w,(a-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}E>y?x>y?(e=W(X,Y,Q,V,s,x,t),r=W(F,U,B,C,s,x,t),u.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?u.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(u.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),u.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),u.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(u.moveTo(Q,V),u.arc(0,0,s,m,g,!t)):u.moveTo(Q,V),!(a>y)||!(P>y)?u.lineTo(B,C):p>y?(e=W(B,C,F,U,a,-p,t),r=W(Q,V,X,Y,a,-p,t),u.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?u.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(u.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),u.arc(0,0,a,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),u.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):u.arc(0,0,a,T,A,t)}if(u.closePath(),n)return u=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +R.apply(this,arguments))/2-un/2;return[N(d)*n,I(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:J(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:J(+n),i):h},i.cornerRadius=function(n){return arguments.length?(q=typeof n=="function"?n:J(+n),i):q},i.padRadius=function(n){return arguments.length?(O=n==null?null:typeof n=="function"?n:J(+n),i):O},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:J(+n),i):v},i.endAngle=function(n){return arguments.length?(R=typeof n=="function"?n:J(+n),i):R},i.padAngle=function(n){return arguments.length?(K=typeof n=="function"?n:J(+n),i):K},i.context=function(n){return arguments.length?(u=n??null,i):u},i}export{hn as d};