@opentig/cli 0.1.7 → 0.2.0
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.
- package/THIRD_PARTY_NOTICES.md +3 -1
- package/dist/bin.mjs +2 -5
- package/dist/chunks/{cli-DCPhUVBb.mjs → cli-Bi6ET5UT.mjs} +15 -2
- package/dist/client/assets/App-BXZLGT86.js +74 -0
- package/dist/client/assets/CreatePullRequestDialog-DFonMYEx.js +2 -0
- package/dist/client/assets/DiffWorkspace-RDG_Y70N.js +26 -0
- package/dist/client/assets/EditableFileViewer-CsbifqBO.js +1 -0
- package/dist/client/assets/File-CHjvYpb2.js +1 -0
- package/dist/client/assets/FilesView-Dl8QFbFA.js +1 -0
- package/dist/client/assets/GitHubAvatar-CnBaloV0.js +1 -0
- package/dist/client/assets/HistoryView-BgCZU2JO.js +1 -0
- package/dist/client/assets/{HtmlFileViewer-C3Qylr9B.js → HtmlFileViewer-h8ULU8Gy.js} +1 -1
- package/dist/client/assets/{IconEdit-BHqlqze_.js → IconEdit-Cg8S2wqW.js} +1 -1
- package/dist/client/assets/IconFolderSymlink-BZSLX1ez.js +1 -0
- package/dist/client/assets/{ImageFileViewer-BJy0ptmR.js → ImageFileViewer-Cjw58ckv.js} +1 -1
- package/dist/client/assets/LocalRefsDialog-DNgrd7Qp.js +1 -0
- package/dist/client/assets/MarkdownFileViewer-kLiduag6.js +2 -0
- package/dist/client/assets/{PairingPage-DOPAXy3a.js → PairingPage-C97sv-8s.js} +1 -1
- package/dist/client/assets/PierreDiffViewer-eAcugmoF.js +1 -0
- package/dist/client/assets/{PierreEditBoundary-mxtF7x3F.js → PierreEditBoundary-DlGd1pqO.js} +2 -2
- package/dist/client/assets/{PierreWorkerPool-B_NFnwU-.js → PierreWorkerPool-Col4k7qz.js} +18 -18
- package/dist/client/assets/{PullRequestDiff-Bcu8Gmrf.js → PullRequestDiff-DhKTXyIF.js} +1 -1
- package/dist/client/assets/PullRequestViewer-BgI8HFMe.js +2 -0
- package/dist/client/assets/PullRequestsView-PYWLy8We.js +1 -0
- package/dist/client/assets/QuickOpenDialog-BFDDZVCL.js +1 -0
- package/dist/client/assets/RepositoryProjectsDialog-CvB8KcFp.js +1 -0
- package/dist/client/assets/SearchView-BwF_MsxK.js +1 -0
- package/dist/client/assets/SettingsDialog-DIcLmXSE.js +9 -0
- package/dist/client/assets/Viewer-o1hDU33O.js +3 -0
- package/dist/client/assets/{abnfDiagram-N423BO3Z-BxGW6tGd.js → abnfDiagram-N423BO3Z-BvrnK_R-.js} +1 -1
- package/dist/client/assets/{arc-CphVLv_F.js → arc-DLa3_7ua.js} +1 -1
- package/dist/client/assets/{architectureDiagram-T3A2C74G-D9IDzZ6u.js → architectureDiagram-T3A2C74G-BexwhnyX.js} +1 -1
- package/dist/client/assets/base-ui-CJ8ZIx3d.js +1 -0
- package/dist/client/assets/{blockDiagram-VBNYF7ZC-CzCatff9.js → blockDiagram-VBNYF7ZC-CoOttUUo.js} +1 -1
- package/dist/client/assets/{c4Diagram-5PPSVZJV-jvC7ACDE.js → c4Diagram-5PPSVZJV-Bgp6ppUh.js} +1 -1
- package/dist/client/assets/channel-1k1AYpyV.js +1 -0
- package/dist/client/assets/{checkbox-DDpujnre.js → checkbox-BRH0ZNIC.js} +1 -1
- package/dist/client/assets/{chunk-2GRJ4B5K-CNRn3w2y.js → chunk-2GRJ4B5K-C_kzp38w.js} +1 -1
- package/dist/client/assets/{chunk-2Q5K7J3B-CnTjXDS8.js → chunk-2Q5K7J3B-CysYnRkJ.js} +1 -1
- package/dist/client/assets/{chunk-5RXB4S5H-8QZZSU3J.js → chunk-5RXB4S5H-oMS6x_ag.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-B2MFN1L0.js → chunk-5VM5RSS4-C5-dW5wf.js} +1 -1
- package/dist/client/assets/{chunk-6Q2QTUOP-BRGuFKSr.js → chunk-6Q2QTUOP-DxahInnA.js} +1 -1
- package/dist/client/assets/{chunk-GF5L2VYU-CWTKyD7U.js → chunk-GF5L2VYU-D7V-3eRg.js} +1 -1
- package/dist/client/assets/{chunk-JWPE2WC7-rGurufZY.js → chunk-JWPE2WC7-BrLmjbVP.js} +1 -1
- package/dist/client/assets/{chunk-KBJHAD2P-DOwIHyo0.js → chunk-KBJHAD2P-CyOvijwM.js} +1 -1
- package/dist/client/assets/{chunk-RYQCIY6F-qrVd0AV3.js → chunk-RYQCIY6F-BvEjVjQs.js} +1 -1
- package/dist/client/assets/{chunk-XXDRQBXY-BGvaybJK.js → chunk-XXDRQBXY-C_IY9A64.js} +1 -1
- package/dist/client/assets/classDiagram-JCYQIIEL-ChyNFpay.js +1 -0
- package/dist/client/assets/classDiagram-v2-OCEON4UE-ChyNFpay.js +1 -0
- package/dist/client/assets/{vb-D17OF-Vu.js → cmd-BW5THilD.js} +1 -1
- package/dist/client/assets/{cose-bilkent-JH36ORCC-CHgOt-vq.js → cose-bilkent-JH36ORCC-Cu7qZi7h.js} +1 -1
- package/dist/client/assets/{cynefin-VYW2F7L2-DX7Kb3Ft.js → cynefin-VYW2F7L2-B4M1t9lL.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-MW4NZA55-B4MgYgbV.js → cynefinDiagram-MW4NZA55-CAosOLmT.js} +1 -1
- package/dist/client/assets/{dagre-VZM6K2ZE-xG9l95NU.js → dagre-VZM6K2ZE-q354V538.js} +1 -1
- package/dist/client/assets/{diagram-7IWD3JNH-BQKb8ivh.js → diagram-7IWD3JNH-C_CzkBPt.js} +1 -1
- package/dist/client/assets/{diagram-B4RE2ZJO-CyIMrtDr.js → diagram-B4RE2ZJO-VvvYHE9c.js} +1 -1
- package/dist/client/assets/{diagram-LBJQPF4R-WuCMu4WW.js → diagram-LBJQPF4R-D8vRQwb5.js} +1 -1
- package/dist/client/assets/{diagram-Q27KOJAE--Oi1nRrR.js → diagram-Q27KOJAE-Bul4aDKg.js} +1 -1
- package/dist/client/assets/{diagram-UB23O5K3-CP1DXsa_.js → diagram-UB23O5K3-DNadEE58.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-BXEA7PRR-C-7jJg9C.js → ebnfDiagram-BXEA7PRR-Bf-68MMZ.js} +1 -1
- package/dist/client/assets/{erDiagram-JOGREHBK-FSyqgO_9.js → erDiagram-JOGREHBK-CJ-jHFsf.js} +1 -1
- package/dist/client/assets/{flowDiagram-UKHOOZJN-y2e2HZHu.js → flowDiagram-UKHOOZJN-DMOdinBU.js} +1 -1
- package/dist/client/assets/{ganttDiagram-PKOTCBZU-kZ3m3wwW.js → ganttDiagram-PKOTCBZU-DzezS3Zy.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-DS77QQ5N-3Z9e4WPi.js → gitGraphDiagram-DS77QQ5N-Dftpvns8.js} +1 -1
- package/dist/client/assets/index-BfA4tAc1.css +1 -0
- package/dist/client/assets/{index-DDbUjVD9.js → index-BzmFkR37.js} +1 -1
- package/dist/client/assets/{index-ChKJF4C_.js → index-DAUK3rnz.js} +4 -4
- package/dist/client/assets/{infoDiagram-6WML65LV-TfCo0Rhw.js → infoDiagram-6WML65LV-DmgUBq17.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-WSZJBQD7-DaXI89rw.js → ishikawaDiagram-WSZJBQD7-CL0PQhpQ.js} +1 -1
- package/dist/client/assets/{journeyDiagram-NVQOT4AX-C4jS6BVn.js → journeyDiagram-NVQOT4AX-Ck4pQx_A.js} +1 -1
- package/dist/client/assets/{kanban-definition-27J2QSJJ-bwOtQiC8.js → kanban-definition-27J2QSJJ-DuRZxBql.js} +1 -1
- package/dist/client/assets/{linear-DfZM9J6Z.js → linear-C2JDCaz4.js} +1 -1
- package/dist/client/assets/{mermaid.core-B-iLnCqi.js → mermaid.core-9dt2ugQA.js} +4 -4
- package/dist/client/assets/{mindmap-definition-FAOFIHXS-DAdKdypB.js → mindmap-definition-FAOFIHXS-vy0fdDF0.js} +1 -1
- package/dist/client/assets/{pegDiagram-VL7TDLO6-Bl95_ELH.js → pegDiagram-VL7TDLO6-DjVJy-Gm.js} +1 -1
- package/dist/client/assets/{pieDiagram-7S7Q4E2Y-DXf4GTLI.js → pieDiagram-7S7Q4E2Y-ATbd_8vw.js} +1 -1
- package/dist/client/assets/{platform-BMNQ8V5r.js → platform-Bqt97_Jr.js} +2 -2
- package/dist/client/assets/{quadrantDiagram-CIZ2JOQS-CDiwouFY.js → quadrantDiagram-CIZ2JOQS-C8o6ofcl.js} +1 -1
- package/dist/client/assets/{railroadDiagram-AXF67PYL-CZAR7rja.js → railroadDiagram-AXF67PYL-Qvij9Ubo.js} +1 -1
- package/dist/client/assets/render-markdown-BtCybfvQ.js +280 -0
- package/dist/client/assets/repository-grammars-ixqpb0uW.js +1 -0
- package/dist/client/assets/{requirementDiagram-LRYGKXZP-BklWtcnl.js → requirementDiagram-LRYGKXZP-yLfrba2h.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-W5VNT64P-CpD7cM5j.js → sankeyDiagram-W5VNT64P-BTXRtTyG.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-SI44F4Z6-BnHPNl9l.js → sequenceDiagram-SI44F4Z6-BN1CCZIX.js} +1 -1
- package/dist/client/assets/{sizeCapture-X5ZJPWSS-D1eo0r-2.js → sizeCapture-X5ZJPWSS-BfXjBBYo.js} +1 -1
- package/dist/client/assets/{stateDiagram-OKZ733FA-ClTacl-d.js → stateDiagram-OKZ733FA-DMAWiBsP.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-UEYNNEHI-D_ofZeaa.js +1 -0
- package/dist/client/assets/{swimlanes-SLNWSIFB-_PLbkM5u.js → swimlanes-SLNWSIFB-BD20m5cw.js} +2 -2
- package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-CF9m5JSB.js +8 -0
- package/dist/client/assets/{tanstack-CtfgE41X.js → tanstack-B0Sf7wNU.js} +1 -1
- package/dist/client/assets/{timeline-definition-Z64GVDOM-C9U6VikV.js → timeline-definition-Z64GVDOM-gtc0-AHB.js} +1 -1
- package/dist/client/assets/{vennDiagram-T6HMQDX7-Desj7KFU.js → vennDiagram-T6HMQDX7-Cdr4AXTp.js} +1 -1
- package/dist/client/assets/viewer-tabs-D-T0xQaq.js +1 -0
- package/dist/client/assets/{wardleyDiagram-T6FBY63Y-rlMEd5tV.js → wardleyDiagram-T6FBY63Y-BcU4vxO8.js} +1 -1
- package/dist/client/assets/{xychartDiagram-ELKLHX3M-CzFgA0NM.js → xychartDiagram-ELKLHX3M-B3Zuadj8.js} +1 -1
- package/dist/client/index.html +4 -4
- package/dist/dev.mjs +1 -4
- package/dist/manifest.json +1 -1
- package/dist/server.mjs +779 -2436
- package/dist/utility.mjs +1 -4
- package/package.json +2 -2
- package/dist/client/assets/App-CGiS2z40.js +0 -74
- package/dist/client/assets/CreatePullRequestDialog-dNbTTo9i.js +0 -2
- package/dist/client/assets/DiffWorkspace-XS025gbZ.js +0 -26
- package/dist/client/assets/EditableFileViewer-Cve4V9RS.js +0 -1
- package/dist/client/assets/File-BJuBDans.js +0 -1
- package/dist/client/assets/FilesView-BUAz46Qa.js +0 -1
- package/dist/client/assets/GitHubAvatar-Depnd_JA.js +0 -1
- package/dist/client/assets/HistoryView-Dd4Kr4KN.js +0 -1
- package/dist/client/assets/IconFolderPlus-BJIo1hfe.js +0 -1
- package/dist/client/assets/LocalRefsDialog-C1MWMkv1.js +0 -1
- package/dist/client/assets/MarkdownFileViewer-pagMxv2y.js +0 -2
- package/dist/client/assets/PierreDiffViewer-FmgbHdls.js +0 -1
- package/dist/client/assets/PullRequestViewer-oeDoq-3g.js +0 -2
- package/dist/client/assets/PullRequestsView-DpTtagTX.js +0 -1
- package/dist/client/assets/QuickOpenDialog-rjeV0l_J.js +0 -1
- package/dist/client/assets/RepositoryProjectsDialog-QYXEt7Lg.js +0 -1
- package/dist/client/assets/SearchView-C-c6oCil.js +0 -1
- package/dist/client/assets/SettingsDialog-DHmWkKYV.js +0 -9
- package/dist/client/assets/Viewer-B6qUr83C.js +0 -3
- package/dist/client/assets/base-ui-DT3JsyND.js +0 -1
- package/dist/client/assets/channel-BGbncBYv.js +0 -1
- package/dist/client/assets/classDiagram-JCYQIIEL-BoYriqPM.js +0 -1
- package/dist/client/assets/classDiagram-v2-OCEON4UE-BoYriqPM.js +0 -1
- package/dist/client/assets/gh-utils-DxPHIkD8.js +0 -1
- package/dist/client/assets/index-WwGOu_aM.css +0 -1
- package/dist/client/assets/render-markdown-BiKX2Zdv.js +0 -280
- package/dist/client/assets/stateDiagram-v2-UEYNNEHI-DAo7Tfh9.js +0 -1
- package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-DHeOpgR_.js +0 -8
- package/dist/client/assets/viewer-tabs-BwMhis6Q.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,r as a,a as Ut}from"./react-rd22PHbN.js";import{a as dt}from"./tanstack-B0Sf7wNU.js";import{ae as W,D as Bt,c as Vt,d as Yt,e as qt,al as Me,am as Le,an as ut,ao as Gt,k as nt,ap as He,a9 as ye,aq as st,ar as $e,j as _e,F as at,A as Xt,ac as ht,C as Ae,v as ft,a5 as mt,ag as Qt,as as Wt,at as it,au as Zt,av as Jt,aw as en,ad as tn,ax as nn,ay as sn,az as an,aA as on,aB as q,Q as ln,aC as rn,aD as cn,aE as ot,aF as dn,aG as un,aH as Ue,aI as hn,aJ as fn,aK as mn,aL as xn,aM as pn,aN as gn}from"./App-BXZLGT86.js";import{c as re,d as Be,B as R,I as be}from"./index-DAUK3rnz.js";import{m as jn,n as bn,M as yn,o as vn,p as Cn,q as kn,S as Nn}from"./base-ui-CJ8ZIx3d.js";import{a as lt,I as Ve}from"./IconFolderSymlink-BZSLX1ez.js";import{I as xt}from"./IconEdit-Cg8S2wqW.js";const wn=[["path",{d:"M9 14l-4 -4l4 -4",key:"svg-0"}],["path",{d:"M5 10h11a4 4 0 1 1 0 8h-1",key:"svg-1"}]],pt=re("outline","arrow-back-up","ArrowBackUp",wn);const Dn=[["path",{d:"M15 14l4 -4l-4 -4",key:"svg-0"}],["path",{d:"M19 10h-11a4 4 0 1 0 0 8h1",key:"svg-1"}]],gt=re("outline","arrow-forward-up","ArrowForwardUp",Dn);const Sn=[["path",{d:"M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2",key:"svg-0"}],["path",{d:"M9 5a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2",key:"svg-1"}]],Re=re("outline","clipboard","Clipboard",Sn);const Mn=[["path",{d:"M3 4a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v16a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1v-16",key:"svg-0"}],["path",{d:"M12 3v18",key:"svg-1"}]],jt=re("outline","columns-2","Columns2",Mn);const Rn=[["path",{d:"M4 17a3 3 0 1 0 6 0a3 3 0 1 0 -6 0",key:"svg-0"}],["path",{d:"M14 17a3 3 0 1 0 6 0a3 3 0 1 0 -6 0",key:"svg-1"}],["path",{d:"M9.15 14.85l8.85 -10.85",key:"svg-2"}],["path",{d:"M6 4l8.85 10.85",key:"svg-3"}]],Oe=re("outline","cut","Cut",Rn);const En=[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2",key:"svg-1"}],["path",{d:"M12 11l0 6",key:"svg-2"}],["path",{d:"M9 14l6 0",key:"svg-3"}]],Ee=re("outline","file-plus","FilePlus",En),Fn=jn,In=bn;function zn({className:t,children:i,...f}){return e.jsx(yn,{children:e.jsx(vn,{className:"isolate z-50 outline-none",children:e.jsx(Cn,{"data-slot":"context-menu-content",className:Be("min-w-44 origin-(--transform-origin) rounded-lg border border-border bg-popover p-1 text-popover-foreground shadow-xl outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...f,children:i})})})}function P({className:t,...i}){return e.jsx(kn,{"data-slot":"context-menu-item",className:Be("flex h-8 cursor-default items-center gap-2 rounded-md px-2 text-xs outline-none select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-45 [&_svg]:size-3.5 [&_svg]:shrink-0",t),...i})}function je({className:t,...i}){return e.jsx(Nn,{"data-slot":"context-menu-separator",className:Be("mx-1 my-1 h-px bg-border",t),...i})}function bt({state:t,onClose:i,onRename:f,onCreate:g}){const[p,o]=a.useState("");if(a.useEffect(()=>{t&&o(t.mode==="rename"?t.entry.name:"")},[t]),!t)return null;const h=t.mode==="rename",d=t.mode==="new-folder"?"directory":"file",M=t.entry.type==="directory"?t.entry.path:W(t.entry.path),D=h?"Rename":d==="directory"?"New Folder":"New File",k=p.trim(),T=k.length>0&&!/[\\/]/.test(k)&&!(h&&k===t.entry.name),z=()=>{T&&(h?f(t.entry,k):g(M,k,d),i())};return e.jsx(Bt,{open:!0,onOpenChange:y=>{y||i()},children:e.jsx(Vt,{className:"name-dialog",children:e.jsxs("form",{className:"name-dialog-content",onSubmit:y=>{y.preventDefault(),z()},children:[e.jsx(Yt,{children:D}),e.jsx(qt,{children:h?e.jsxs(e.Fragment,{children:["Enter a new name for ",e.jsx("code",{children:t.entry.name}),"."]}):e.jsxs(e.Fragment,{children:["Create a new ",d==="directory"?"folder":"file"," in ",e.jsx("code",{children:M||"the repository root"}),"."]})}),e.jsx("input",{autoFocus:!0,className:"name-dialog-input",value:p,maxLength:255,placeholder:h?"New name":d==="directory"?"Folder name":"File name",onChange:y=>o(y.target.value),onFocus:y=>{if(!h)return;const w=t.entry.name.lastIndexOf(".");y.target.setSelectionRange(0,w>0?w:t.entry.name.length)}}),e.jsxs("div",{className:"name-dialog-actions",children:[e.jsx(R,{type:"button",variant:"ghost",onClick:i,children:"Cancel"}),e.jsx(R,{type:"submit",disabled:!T,children:h?"Rename":"Create"})]})]})})})}function yt(t,i,f,g=!0){const[p,o]=a.useState(null);a.useEffect(()=>{if(!g)return;let d=!1;return f(t).then(M=>{d||o({path:t,revision:i,entries:M,failed:!1})},()=>{d||o({path:t,revision:i,entries:[],failed:!0})}),()=>{d=!0}},[t,i,f,g]);const h=g&&p?.path===t;return{entries:h?p.entries:null,failed:h&&p.failed,refreshing:!h||p.revision!==i}}function Pn({entries:t,initialDirectory:i,revision:f,readOnly:g,onLoadDirectory:p,onMove:o,onClose:h}){const[d,M]=a.useState(i),[D,k]=a.useState(!1),{entries:T,failed:z,refreshing:y}=yt(d,f,p),w=t.map(j=>j.path),L=T?.filter(j=>j.type==="directory"&&!w.some(te=>Me(te,j.path)))??[],O=!g&&!D&&!y&&T!==null&&!z&&Le(w,d),G=async()=>{if(O){k(!0);try{await o(t,d),h()}finally{k(!1)}}};return e.jsxs(ut,{open:!0,onOpenChange:j=>{!j&&!D&&h()},title:"Move to…",description:`${t.length} selected ${t.length===1?"item":"items"}. Choose a destination folder.`,children:[e.jsxs("div",{className:"mobile-folder-location",children:[d&&e.jsx(R,{variant:"ghost",size:"icon","aria-label":"Parent folder",disabled:D,onClick:()=>M(W(d)),children:e.jsx(Gt,{})}),e.jsx("span",{children:d||"Repository root"})]}),e.jsx("div",{className:"mobile-destination-list",children:T===null?e.jsxs("p",{className:"mobile-list-message",role:"status",children:[e.jsx(nt,{className:"animate-spin"})," Loading folders…"]}):z?e.jsx("p",{className:"mobile-list-message",role:"alert",children:"Could not read this folder."}):L.length===0?e.jsx("p",{className:"mobile-list-message",children:"No subfolders. You can choose this folder below."}):L.map(j=>e.jsxs("button",{className:"mobile-sheet-action",disabled:D,onClick:()=>M(j.path),children:[e.jsx("img",{src:He(j.path,!1),alt:"","aria-hidden":"true",draggable:!1}),e.jsx("span",{children:j.name}),e.jsx(ye,{})]},j.path))}),e.jsxs("div",{className:"mobile-sheet-footer",children:[e.jsx(R,{variant:"ghost",disabled:D,onClick:h,children:"Cancel"}),e.jsxs(R,{disabled:!O,onClick:()=>{G()},children:[D&&e.jsx(nt,{className:"animate-spin"})," Move here"]})]})]})}const Tn=56;function Ln(t){const[i,f]=a.useState(()=>W(t.activePath??"")),[g,p]=a.useState(""),[o,h]=a.useState(!1),[d,M]=a.useState(new Map),[D,k]=a.useState(null),[T,z]=a.useState(null),[y,w]=a.useState(null),L=a.useRef(null),O=a.useRef(new Map),G=a.useRef(t.activePath),{entries:j,failed:te}=yt(i,t.filesSnapshotRevision,t.onLoadDirectory,t.active),K=a.useMemo(()=>(j??[]).filter(u=>(t.showDotEnvFiles||!u.ignored)&&u.name.toLocaleLowerCase().includes(g.toLocaleLowerCase())),[j,t.showDotEnvFiles,g]),ne=dt({count:K.length,enabled:t.active&&j!==null,getScrollElement:()=>L.current,estimateSize:()=>Tn,getItemKey:u=>K[u].path,overscan:8,paddingEnd:12});a.useEffect(()=>{t.activePath!==G.current&&(G.current=t.activePath,t.activePath&&(f(W(t.activePath)),p("")))},[t.activePath]),a.useEffect(()=>{if(!j)return;const u=new Set(j.map(x=>x.path));M(x=>{const b=new Map([...x].filter(([H])=>u.has(H)));return b.size===x.size?x:b})},[j]),a.useEffect(()=>{j&&L.current&&(L.current.scrollTop=O.current.get(i)??0)},[i,j]),a.useEffect(()=>{if(!t.files||!i||st(t.files,i)!=="missing")return;let u=W(i);for(;u&&st(t.files,u)==="missing";)u=W(u);f(u),p(""),M(new Map)},[t.files,i]);const X=u=>{f(u),p(""),M(new Map)},ce=u=>M(x=>{const b=new Map(x);return b.has(u.path)?b.delete(u.path):b.set(u.path,u),b}),se={type:"directory",path:i,name:i.split("/").pop()??"",children:[]},Q=[...d.values()],v=D&&D!=="tools"?D:null,C=u=>{k(null),u()};return e.jsxs("div",{className:"mobile-files-view",children:[e.jsxs("div",{className:"mobile-view-heading",children:[e.jsxs("h2",{children:[o?"Select items":"Files",o&&e.jsx("small",{children:d.size})]}),e.jsxs("div",{children:[e.jsx(R,{variant:"ghost",size:"sm","aria-pressed":o,onClick:()=>{h(!o),M(new Map)},children:o?"Cancel":"Select"}),e.jsx(R,{variant:"ghost",size:"icon","aria-label":"File browser actions",onClick:()=>k("tools"),children:e.jsx($e,{})})]})]}),e.jsxs("label",{className:"mobile-file-filter",children:[e.jsx(_e,{"aria-hidden":"true"}),e.jsx("input",{type:"search",value:g,placeholder:"Filter this folder…","aria-label":"Filter this folder",onChange:u=>{p(u.target.value),O.current.set(i,0),L.current?.scrollTo({top:0})}})]}),e.jsxs("nav",{className:"mobile-file-breadcrumb","aria-label":"Folder location",children:[e.jsxs("button",{onClick:()=>X(""),"aria-current":i===""?"location":void 0,children:[e.jsx(at,{"aria-hidden":"true"})," Root"]}),i.split("/").filter(Boolean).map((u,x,b)=>{const H=b.slice(0,x+1).join("/");return e.jsxs("span",{children:[e.jsx(ye,{"aria-hidden":"true"}),e.jsx("button",{"aria-current":H===i?"location":void 0,onClick:()=>X(H),children:u})]},H)})]}),e.jsx("div",{className:"mobile-files-scroll",ref:L,onScroll:u=>O.current.set(i,u.currentTarget.scrollTop),children:j===null?e.jsx("p",{className:"mobile-list-message",role:"status",children:"Loading files…"}):te?e.jsx("p",{className:"mobile-list-message",role:"alert",children:"Could not read this folder."}):K.length===0?e.jsx("p",{className:"mobile-list-message",children:g?"No matching files in this folder.":"This folder is empty."}):e.jsx("div",{className:"virtual-list",role:"list","aria-label":"Files in this folder",style:{height:ne.getTotalSize()},children:ne.getVirtualItems().map(u=>{const x=K[u.index],b=d.has(x.path);return e.jsxs("div",{role:"listitem",className:`mobile-file-row ${b?"selected":""}`,style:{height:u.size,transform:`translateY(${u.start}px)`},children:[e.jsxs("button",{className:"mobile-file-open","aria-pressed":o?b:void 0,"aria-current":t.activePath===x.path?"true":void 0,onClick:()=>o?ce(x):x.type==="directory"?X(x.path):t.onOpenFile(x.path),children:[o?e.jsx("span",{className:`mobile-file-check ${b?"checked":""}`,children:b&&e.jsx(Xt,{"aria-hidden":"true"})}):e.jsx("img",{src:x.type==="directory"?He(x.path,!1):ht(x.path),alt:"","aria-hidden":"true",draggable:!1}),e.jsxs("span",{className:"mobile-file-copy",children:[e.jsx("strong",{children:x.name}),e.jsx("small",{children:x.type==="directory"?x.ignored?"Ignored folder":"Folder":`${x.ignored?"Ignored · ":""}${Math.max(1,Math.ceil(x.size/1024))} KB`})]}),!o&&x.type==="directory"&&e.jsx(ye,{"aria-hidden":"true"})]}),!o&&e.jsx(R,{variant:"ghost",size:"icon",className:"mobile-file-menu","aria-label":`Actions for ${x.name}`,onClick:()=>k(x),children:e.jsx($e,{})})]},x.path)})})}),o&&e.jsxs("div",{className:"mobile-file-selection-actions",children:[e.jsxs(R,{variant:"ghost",size:"sm",disabled:t.readOnly||d.size===0,onClick:()=>w(Q),children:[e.jsx(lt,{})," Move to…"]}),e.jsxs(R,{variant:"ghost",size:"sm",disabled:d.size===0,onClick:()=>{t.fileClipboardAvailable?t.onCopyEntries(Q):t.onCopyPath(Q)},children:[e.jsx(be,{})," ",t.fileClipboardAvailable?"Copy":"Copy paths"]}),t.fileClipboardAvailable&&e.jsx(R,{variant:"ghost",size:"icon","aria-label":"Cut selected items",disabled:t.readOnly||d.size===0,onClick:()=>{t.onCutEntries(Q)},children:e.jsx(Oe,{})}),e.jsx(R,{variant:"ghost",size:"icon","aria-label":"Delete selected items",disabled:t.readOnly||d.size===0,onClick:()=>{t.onDeleteEntries(Q)},children:e.jsx(Ae,{})})]}),e.jsx(ut,{open:D!==null,onOpenChange:u=>{u||k(null)},title:v?.name??"File browser actions",description:v?.path??"Actions for the current folder.",children:v?e.jsxs(e.Fragment,{children:[v.type==="file"&&e.jsxs("button",{className:"mobile-sheet-action",onClick:()=>C(()=>t.onOpenFile(v.path,"pinned")),children:[e.jsx(Ee,{}),e.jsx("span",{children:"Keep file open"})]}),v.type==="directory"&&e.jsxs("button",{className:"mobile-sheet-action",onClick:()=>C(()=>X(v.path)),children:[e.jsx(at,{}),e.jsx("span",{children:"Open folder"})]}),e.jsxs("button",{className:"mobile-sheet-action",disabled:t.readOnly,onClick:()=>C(()=>w([v])),children:[e.jsx(lt,{}),e.jsx("span",{children:"Move to…"})]}),e.jsxs("button",{className:"mobile-sheet-action",disabled:t.readOnly,onClick:()=>C(()=>z({mode:"rename",entry:v})),children:[e.jsx(xt,{}),e.jsx("span",{children:"Rename"})]}),t.fileClipboardAvailable&&e.jsxs("button",{className:"mobile-sheet-action",onClick:()=>C(()=>{t.onCopyEntries([v])}),children:[e.jsx(be,{}),e.jsx("span",{children:"Copy"})]}),t.fileClipboardAvailable&&e.jsxs("button",{className:"mobile-sheet-action",disabled:t.readOnly,onClick:()=>C(()=>{t.onCutEntries([v])}),children:[e.jsx(Oe,{}),e.jsx("span",{children:"Cut"})]}),e.jsxs("button",{className:"mobile-sheet-action",onClick:()=>C(()=>{t.onCopyPath([v])}),children:[e.jsx(be,{}),e.jsx("span",{children:"Copy path"})]}),v.type==="file"&&e.jsxs("button",{className:"mobile-sheet-action",onClick:()=>C(()=>{t.onCopyContents(v)}),children:[e.jsx(be,{}),e.jsx("span",{children:"Copy contents"})]}),t.revealAvailable&&e.jsxs("button",{className:"mobile-sheet-action",onClick:()=>C(()=>{t.onReveal(v)}),children:[e.jsx(ft,{}),e.jsx("span",{children:"Reveal in file manager"})]}),t.fileClipboardAvailable&&e.jsxs("button",{className:"mobile-sheet-action",disabled:t.readOnly,onClick:()=>C(()=>{t.onPaste(v.type==="directory"?v.path:W(v.path))}),children:[e.jsx(Re,{}),e.jsx("span",{children:"Paste here"})]}),e.jsxs("button",{className:"mobile-sheet-action destructive",disabled:t.readOnly,onClick:()=>C(()=>{t.onDeleteEntries([v])}),children:[e.jsx(Ae,{}),e.jsx("span",{children:"Delete"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"mobile-sheet-action",onClick:()=>C(t.onQuickOpen),children:[e.jsx(_e,{}),e.jsx("span",{children:"Find file in repository"})]}),e.jsxs("button",{className:"mobile-sheet-action",disabled:t.readOnly,onClick:()=>C(()=>z({mode:"new-file",entry:se})),children:[e.jsx(Ee,{}),e.jsx("span",{children:"New file"})]}),e.jsxs("button",{className:"mobile-sheet-action",disabled:t.readOnly,onClick:()=>C(()=>z({mode:"new-folder",entry:se})),children:[e.jsx(Ve,{}),e.jsx("span",{children:"New folder"})]}),t.fileClipboardAvailable&&e.jsxs("button",{className:"mobile-sheet-action",disabled:t.readOnly,onClick:()=>C(()=>{t.onPaste(i)}),children:[e.jsx(Re,{}),e.jsx("span",{children:"Paste here"})]}),e.jsxs("button",{className:"mobile-sheet-action",disabled:t.readOnly||!t.historyState.canUndo,onClick:()=>C(()=>{t.onUndo()}),children:[e.jsx(pt,{}),e.jsx("span",{children:t.historyState.undoLabel?`Undo ${t.historyState.undoLabel}`:"Undo"})]}),e.jsxs("button",{className:"mobile-sheet-action",disabled:t.readOnly||!t.historyState.canRedo,onClick:()=>C(()=>{t.onRedo()}),children:[e.jsx(gt,{}),e.jsx("span",{children:t.historyState.redoLabel?`Redo ${t.historyState.redoLabel}`:"Redo"})]})]})}),e.jsx(bt,{state:T,onClose:()=>z(null),onRename:t.onRename,onCreate:t.onCreate}),y&&e.jsx(Pn,{entries:y,initialDirectory:i,revision:t.filesSnapshotRevision,readOnly:t.readOnly,onLoadDirectory:t.onLoadDirectory,onMove:t.onMoveEntries,onClose:()=>{w(null),M(new Map)}})]})}function es(t){return mt()?e.jsx(Ln,{...t}):e.jsx(Hn,{...t})}const $n=29,Se=6,vt="files-tree-root-drop",_n=550,An={duration:160,easing:"cubic-bezier(0.2, 0, 0, 1)"},rt=6,On=t=>{const i=dn(t),f=i.length>0?i:un(t),g=f.find(p=>p.id!==vt);return g?[g]:f.slice(0,1)};function Ct(t,i,f=0){const g=[];for(const p of t)g.push({entry:p,depth:f}),p.type==="directory"&&i.has(p.path)&&g.push(...Ct(p.children,i,f+1));return g}function Kn(t,i,f){const g=t.findIndex(d=>d.entry.path===i),p=t.findIndex(d=>d.entry.path===f);if(g===-1||p===-1)return[f];const[o,h]=g<=p?[g,p]:[p,g];return t.slice(o,h+1).map(d=>d.entry.path)}function Ke(t){return t.type==="directory"?t.path:W(t.path)}function Hn({active:t,initialExpandedPaths:i,files:f,filesSnapshotRevision:g,showDotEnvFiles:p,activePath:o,readOnly:h,fileClipboardAvailable:d,revealAvailable:M,historyState:D,onQuickOpen:k,onUndo:T,onRedo:z,onOpenFile:y,onLoadDirectory:w,onPersistExpandedPaths:L,onCopyPath:O,onCopyEntries:G,onCutEntries:j,onCopyContents:te,onPaste:K,onMoveEntries:ne,onDeleteEntries:X,onReveal:ce,onRename:se,onCreate:Q}){const v=Qt(),C=mt(),[u,x]=a.useState(!1),b=C?44:$n,H=a.useRef(null),ae=a.useRef(null),[S,U]=a.useState(new Set),[ve,ie]=a.useState(o),[oe,Z]=a.useState(o),[A,de]=a.useState(()=>new Set(i)),[Ce,ue]=a.useState([]),[$,J]=a.useState(null),[he,Fe]=a.useState(null),[qe,kt]=a.useState(null),[Nt,wt]=a.useState(!1),[Dt,ee]=a.useState(null),[ke,St]=a.useState(0),[B,Ne]=a.useState(new Map),Mt=Wt(it(Jt,{activationConstraint:{distance:5}}),it(Zt)),Ge=a.useRef(B),fe=a.useRef(new Set),Xe=a.useRef(0),V=a.useRef(null),me=a.useRef(null),Qe=a.useRef(i.join("\0")),we=a.useMemo(()=>new Set(B.keys()),[B]),Y=a.useMemo(()=>f===null?null:en(f,B),[f,B]),N=a.useMemo(()=>Y===null?null:p?Y:tn(Y),[Y,p]);a.useEffect(()=>{Ge.current=B},[B]),a.useEffect(()=>{kt(document.getElementById(nn))},[o]),a.useEffect(()=>{const n=window.matchMedia("(prefers-reduced-motion: reduce)"),s=()=>wt(n.matches);return s(),n.addEventListener("change",s),()=>n.removeEventListener("change",s)},[]),a.useEffect(()=>()=>{V.current&&clearTimeout(V.current)},[]),a.useEffect(()=>{const n=++Xe.current,s=[...Ge.current.keys()];s.length!==0&&Promise.all(s.map(async l=>({path:l,children:await w(l)}))).then(l=>{if(n!==Xe.current)return;const r=new Map(l.map(({path:m,children:c})=>[m,c]));Ne(m=>sn(m,r))})},[g,w]),a.useEffect(()=>{if(!Y){fe.current.clear(),Ne(n=>n.size===0?n:new Map);return}de(n=>{const s=new Set(an(Y,n,we).retained);return ct(n,s)?n:s})},[we,Y]),a.useEffect(()=>{if(!Y)return;const n=on(Y,A,we),s=n.join("\0");s!==Qe.current&&(Qe.current=s,L(n))},[A,we,Y,L]),a.useEffect(()=>{if(!t||!N)return;let n=Math.max(0,2-fe.current.size);for(const s of A){if(n===0)break;const l=q(N,s);!l||l.type!=="directory"||l.ignored!==!0||l.children.length>0||B.has(s)||fe.current.has(s)||(fe.current.add(s),n-=1,w(s).catch(()=>[]).then(r=>{Ne(m=>new Map(m).set(s,r))}).finally(()=>{fe.current.delete(s)}))}},[t,A,B,w,N]),a.useEffect(()=>{t||(ee(null),ue([]),J(null),Fe(null),V.current&&clearTimeout(V.current),V.current=null,me.current=null)},[t]),a.useEffect(()=>{N&&(U(n=>{if(n.size===0)return n;const s=new Set([...n].filter(l=>q(N,l)));return s.size===n.size?n:s}),ie(n=>n&&q(N,n)?n:null),Z(n=>n&&q(N,n)?n:o&&q(N,o)?o:null))},[o,N]);const E=a.useMemo(()=>N?Ct(N,A):[],[A,N]),le=dt({enabled:t,count:E.length,getScrollElement:()=>H.current,estimateSize:()=>b,getItemKey:n=>E[n]?.entry.path??n,overscan:12,paddingStart:Se,paddingEnd:12});a.useEffect(()=>{le.measure()},[le,b]),a.useEffect(()=>{!t||!o||!N||!q(N,o)||de(n=>{const s=new Set(n);let l=!1;const r=o.split("/");let m="";for(let c=0;c<r.length-1;c+=1)m=m?`${m}/${r[c]}`:r[c],s.has(m)||(s.add(m),l=!0);return l?s:n})},[t,o,N]),a.useEffect(()=>{if(!t)return;if(!o){ae.current=null;return}if(ae.current===o)return;const n=E.findIndex(s=>s.entry.path===o);n>=0&&(le.scrollToIndex(n,{align:"auto"}),ae.current=o)},[t,o,E]);const We=a.useMemo(()=>{const n=new Map;for(const s of E)n.set(s.entry.path,s);return n},[E]),xe=a.useMemo(()=>{const n={headers:[],push:0};if(E.length===0||!o)return n;const s=new Set,l=o.split("/");let r="";for(let I=0;I<l.length-1;I+=1)r=r?`${r}/${l[I]}`:l[I],s.add(r);if(s.size===0)return n;const m=Math.min(E.length-1,Math.max(0,Math.floor((ke-Se)/b))),c=E[m];if(!c)return n;const F=c.entry.path.split("/"),_=[];let ge="";for(let I=0;I<F.length-1;I+=1){if(ge=ge?`${ge}/${F[I]}`:F[I],!s.has(ge))continue;const Te=We.get(ge);Te&&Te.entry.type==="directory"&&_.push(Te)}if(_.length>rt&&_.splice(0,_.length-rt),_.length===0)return n;const Ot=_[_.length-1],et=_.length*b;let tt=1/0;const Kt=Math.ceil((ke+et-Se)/b)+2;for(let I=m;I<E.length&&I<=Kt;I+=1)if(E[I].depth<=Ot.depth){tt=Se+I*b;break}const Ht=Math.max(0,Math.min(b,et-(tt-ke)));return{headers:_,push:Ht}},[E,We,ke,o,b]);if(N===null)return e.jsx("div",{className:"view-loading",role:"status",hidden:!t,children:e.jsx(ln,{text:"Loading files…"})});const Rt=u||S.size>0?S:o?new Set([o]):new Set,Et=S.size>0?[...S]:o?[o]:[],Ie=n=>{const s=[];for(const l of n){const r=q(N,l);r&&s.push(r)}return s},ze=n=>{U(new Set([n])),ie(n),Z(n)},Ft=n=>{const s=E.findIndex(l=>l.entry.path===n.path);s>=0&&le.scrollToIndex(s,{align:"start"})},It=(n,s)=>{if(C&&u){U(l=>{const r=new Set(l);return r.has(n.path)?r.delete(n.path):r.add(n.path),r});return}if(s.shift&&(ve||oe)){const l=Kn(E,ve??oe,n.path);U(new Set(l)),Z(n.path);return}if(s.ctrl){U(l=>{const r=new Set(l.size===0&&o?[o]:l);return r.has(n.path)?r.delete(n.path):r.add(n.path),r}),ie(n.path),Z(n.path),n.type==="file"&&y(n.path,"pinned");return}ze(n.path),n.type==="file"?y(n.path):Ze(n.path)},zt=n=>{!(C&&u)&&n.type==="file"&&y(n.path,"pinned")},Pt=n=>{S.has(n.path)||ze(n.path)},De=n=>S.has(n.path)&&S.size>0?Ie(S):[n],Tt=n=>{if(hn(n.target))return;const s=fn(n.nativeEvent,v);if(s==="undo"&&D.canUndo&&!h){n.preventDefault(),n.repeat||T();return}if(s==="redo"&&D.canRedo&&!h){n.preventDefault(),n.repeat||z();return}const l=(n.ctrlKey||n.metaKey)&&!n.altKey,r=n.key.toLowerCase();if(l&&r==="a"){n.preventDefault(),U(new Set(E.map(F=>F.entry.path)));return}const m=Ie(Et),c=oe?q(N,oe):null;if(l&&r==="c"&&m.length){n.preventDefault(),G(m);return}if(l&&r==="x"&&m.length&&!h){n.preventDefault(),j(m);return}if(l&&r==="v"&&!h&&d){n.preventDefault();const F=c?Ke(c):W(m[0]?.path??"");K(F);return}if(n.key==="F2"&&!n.ctrlKey&&!n.metaKey&&!n.altKey&&!n.shiftKey&&!h){if(S.size===1){const F=q(N,[...S][0]);F&&(n.preventDefault(),ee({mode:"rename",entry:F}))}return}n.key==="Delete"&&!n.ctrlKey&&!n.metaKey&&!n.altKey&&!n.shiftKey&&!h&&m.length&&(n.preventDefault(),X(m))},Lt=async(n,s)=>{const l=Ie(n);l.length&&await ne(l,s)},Ze=(n,s=!1)=>{const l=!s&&A.has(n),r=l&&q(N??[],n)?.ignored===!0;de(m=>{const c=new Set(m);if(s||!c.has(n)){if(c.has(n))return m;c.add(n)}else if(r)for(const F of c)Me(n,F)&&c.delete(F);else c.delete(n);return ct(m,c)?m:c}),l&&Ne(m=>{const c=[...m.keys()].filter(_=>Me(n,_));if(c.length===0)return m;const F=new Map(m);for(const _ of c)F.delete(_);return F})},pe=()=>{V.current&&clearTimeout(V.current),V.current=null,me.current=null},Je=()=>{pe(),ue([]),J(null),Fe(null)},Pe=n=>{const s=n.active.data.current;return s?.entry&&Array.isArray(s.sourcePaths)?{entry:s.entry,sourcePaths:s.sourcePaths}:null},$t=n=>{const s=Pe(n);s&&(S.has(s.entry.path)||ze(s.entry.path),ue(s.sourcePaths),Fe({entry:s.entry,sourcePaths:s.sourcePaths,count:s.sourcePaths.length}))},_t=n=>{const s=Pe(n);if(n.over?.data.current?.openPinned===!0){J(null),pe();return}const l=n.over?.data.current?.targetDirectory;if(!s||typeof l!="string"||!Le(s.sourcePaths,l)){J(null),pe();return}J(l);const r=n.over?.data.current?.expandPath;if(typeof r!="string"||A.has(r)){pe();return}me.current!==r&&(pe(),me.current=r,V.current=setTimeout(()=>{Ze(r,!0),V.current=null,me.current=null},_n))},At=n=>{const s=Pe(n),l=n.over?.data.current?.openPinned===!0,r=n.over?.data.current?.targetDirectory;if(Je(),s&&l&&ot(s.entry,s.sourcePaths)){y(s.entry.path,"pinned");return}s&&typeof r=="string"&&Le(s.sourcePaths,r)&&Lt(s.sourcePaths,r)};return e.jsxs(rn,{sensors:Mt,collisionDetection:On,autoScroll:{enabled:!0,threshold:{x:.1,y:.16},acceleration:12},onDragStart:$t,onDragOver:_t,onDragCancel:Je,onDragEnd:At,children:[e.jsxs("div",{className:"files-mobile-tools",children:[e.jsxs(R,{variant:"ghost",size:"sm",onClick:k,children:[e.jsx(_e,{})," Find file"]}),e.jsx(R,{variant:"ghost",size:"sm","aria-pressed":u,onClick:()=>{x(!u),U(new Set)},children:u?`Done (${S.size})`:"Select"}),e.jsxs(R,{variant:"ghost",size:"sm",disabled:h,onClick:()=>ee({mode:"new-file",entry:{type:"directory",path:"",name:"",children:[]}}),children:[e.jsx(Ee,{})," New file"]}),e.jsxs(R,{variant:"ghost",size:"sm",disabled:h,onClick:()=>ee({mode:"new-folder",entry:{type:"directory",path:"",name:"",children:[]}}),children:[e.jsx(Ve,{})," Folder"]}),d&&e.jsxs(R,{variant:"ghost",size:"sm",disabled:h,onClick:()=>{K("")},children:[e.jsx(Re,{})," Paste"]})]}),e.jsxs("div",{ref:H,className:"files-view virtual-scroll",hidden:!t,onScroll:n=>St(n.currentTarget.scrollTop),children:[xe.headers.length>0&&e.jsx("div",{className:"files-sticky",children:xe.headers.map((n,s)=>{const l=s===xe.headers.length-1;return e.jsxs("button",{type:"button",className:"file-tree-row files-sticky-row","aria-label":`Scroll to ${n.entry.path}`,style:{top:s*b-(l?xe.push:0),paddingLeft:12+n.depth*14,zIndex:xe.headers.length-s},onClick:()=>Ft(n.entry),children:[e.jsx(ye,{className:"folder-chevron open"}),e.jsx(Ye,{path:n.entry.path,type:"directory",expanded:!0}),e.jsx("span",{children:n.entry.name})]},n.entry.path)})}),N.length?e.jsx(Un,{role:"tree","aria-label":"Files",className:`files-tree ${$===""&&Ce.length>0?"root-drop-target":""}`,style:{height:le.getTotalSize()},tabIndex:0,onKeyDown:Tt,onPointerDown:n=>{n.target.closest(".file-tree-row, .file-touch-actions")||(U(new Set),ie(null),Z(null),n.currentTarget.focus())},children:le.getVirtualItems().map(n=>{const{entry:s,depth:l}=E[n.index],r=s.type==="directory"&&A.has(s.path),m=S.has(s.path)&&S.size>1;return e.jsx("div",{className:"virtual-row",style:{height:n.size,transform:`translateY(${n.start}px)`},children:e.jsx(Yn,{entry:s,depth:l,expanded:r,pendingChildren:s.type==="directory"&&s.ignored===!0&&s.children.length===0&&!B.has(s.path),selected:Rt.has(s.path),active:o===s.path,multiSelected:m,readOnly:h,fileClipboardAvailable:d,revealAvailable:M,historyState:D,onUndo:T,onRedo:z,draggedPaths:Ce,dropTargetPath:$,onFocus:Z,onRowClick:It,onRowDoubleClick:zt,onRowContextMenu:Pt,onOpen:c=>y(c.path),onOpenPinned:c=>y(c.path,"pinned"),onCopy:c=>{G(De(c))},onCut:c=>{j(De(c))},onPasteInto:c=>{K(Ke(c))},onCopyPath:c=>{O(De(c))},onCopyContents:te,onRename:c=>ee({mode:"rename",entry:c}),onNewFile:c=>ee({mode:"new-file",entry:c}),onNewFolder:c=>ee({mode:"new-folder",entry:c}),onReveal:ce,onDelete:c=>{X(De(c))},dragPaths:S.has(s.path)&&S.size>0?[...S]:[s.path]})},n.key)})}):e.jsx("p",{className:"empty-list",children:"No files."}),e.jsx(bt,{state:Dt,onClose:()=>ee(null),onRename:se,onCreate:Q})]}),e.jsx(cn,{dropAnimation:Nt?null:An,children:he&&e.jsx(Vn,{preview:he})}),qe&&Ut.createPortal(e.jsx(Bn,{visible:!!(he&&ot(he.entry,he.sourcePaths))}),qe)]})}function Un(t){const{setNodeRef:i}=Ue({id:vt,data:{targetDirectory:"",expandPath:null}});return e.jsx("div",{ref:i,...t})}function Bn({visible:t}){const{isOver:i,setNodeRef:f}=Ue({id:"files-open-pinned-drop",data:{openPinned:!0}});return e.jsxs("div",{ref:f,className:`open-files-drop-target ${t?"visible":""} ${t&&i?"over":""}`,"aria-hidden":"true",children:[e.jsx(jt,{}),e.jsx("span",{children:"Drop to open beside"})]})}function Vn({preview:t}){return e.jsxs("div",{className:"file-drag-overlay",children:[e.jsx(Ye,{path:t.entry.path,type:t.entry.type,expanded:!1}),e.jsx("span",{children:t.entry.name}),t.count>1&&e.jsx("strong",{children:t.count})]})}function ct(t,i){if(t.size!==i.size)return!1;for(const f of t)if(!i.has(f))return!1;return!0}function Yn({entry:t,depth:i,expanded:f,pendingChildren:g,selected:p,active:o,multiSelected:h,readOnly:d,fileClipboardAvailable:M,revealAvailable:D,historyState:k,onUndo:T,onRedo:z,draggedPaths:y,dropTargetPath:w,onFocus:L,onRowClick:O,onRowDoubleClick:G,onRowContextMenu:j,onOpen:te,onOpenPinned:K,onCopy:ne,onCut:X,onPasteInto:ce,onCopyPath:se,onCopyContents:Q,onRename:v,onNewFile:C,onNewFolder:u,onReveal:x,onDelete:b,dragPaths:H}){const ae=a.useRef(null),S=Ke(t),{attributes:U,listeners:ve,setNodeRef:ie,isDragging:oe}=mn({id:`file-drag:${t.path}`,data:{sourcePaths:H,entry:t},disabled:d}),{setNodeRef:Z}=Ue({id:`file-drop:${t.path}`,data:{targetDirectory:S,expandPath:t.type==="directory"?t.path:null}}),A=$=>{ae.current=$,ie($),Z($)},de=y.length>0&&t.type==="directory"&&w===t.path,Ce=y.length>0&&w!==null&&w!==""&&w!==t.path&&Me(w,t.path),ue=e.jsxs("button",{type:"button",ref:A,...U,role:"treeitem","aria-selected":p,"aria-current":o?"true":void 0,"aria-expanded":t.type==="directory"?f:void 0,className:["file-tree-row",t.ignored?"ignored-file":"",y.includes(t.path)||oe?"dragging":"",de?"drop-target":"",Ce?"drop-target-region":""].filter(Boolean).join(" "),style:{paddingLeft:12+i*14},...ve,onClick:$=>O(t,{ctrl:$.ctrlKey||$.metaKey,shift:$.shiftKey}),onDoubleClick:()=>G(t),onFocus:()=>L(t.path),onContextMenu:()=>j(t),children:[t.type==="directory"?e.jsx(ye,{className:`folder-chevron ${f?"open":""} ${t.children.length===0&&!g?"empty":""}`}):e.jsx("span",{className:"tree-spacer"}),e.jsx(Ye,{path:t.path,type:t.type,expanded:f}),e.jsx("span",{children:t.name})]});return e.jsxs(Fn,{children:[e.jsx(In,{render:ue}),e.jsx("button",{type:"button",className:"file-touch-actions","aria-label":`Actions for ${t.name}`,"aria-haspopup":"menu",onClick:$=>{$.stopPropagation();const J=$.currentTarget.getBoundingClientRect();ae.current?.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:J.left,clientY:J.bottom}))},children:e.jsx($e,{})}),e.jsxs(zn,{children:[t.type==="file"&&e.jsxs(e.Fragment,{children:[e.jsxs(P,{onClick:()=>te(t),children:[e.jsx(xn,{"aria-hidden":"true"})," Open"]}),e.jsxs(P,{onClick:()=>K(t),children:[e.jsx(jt,{"aria-hidden":"true"})," Open to the Side ",e.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"Ctrl+Click"})]}),e.jsx(je,{})]}),e.jsxs(P,{disabled:d||!k.canUndo,onClick:()=>{T()},children:[e.jsx(pt,{"aria-hidden":"true"})," ",k.undoLabel?`Undo ${k.undoLabel}`:"Undo"," ",e.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"Ctrl+Z"})]}),e.jsxs(P,{disabled:d||!k.canRedo,onClick:()=>{z()},children:[e.jsx(gt,{"aria-hidden":"true"})," ",k.redoLabel?`Redo ${k.redoLabel}`:"Redo"," ",e.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"Ctrl+Shift+Z"})]}),e.jsx(je,{}),e.jsxs(P,{onClick:()=>ne(t),children:[e.jsx(pn,{"aria-hidden":"true"})," Copy ",e.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"Ctrl+C"})]}),e.jsxs(P,{disabled:d,onClick:()=>X(t),children:[e.jsx(Oe,{"aria-hidden":"true"})," Cut ",e.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"Ctrl+X"})]}),M&&e.jsxs(P,{disabled:d,onClick:()=>ce(t),children:[e.jsx(Re,{"aria-hidden":"true"})," Paste ",e.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"Ctrl+V"})]}),e.jsx(je,{}),e.jsxs(P,{disabled:d||h,onClick:()=>v(t),children:[e.jsx(xt,{"aria-hidden":"true"})," Rename ",e.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"F2"})]}),e.jsxs(P,{disabled:d||h,onClick:()=>C(t),children:[e.jsx(Ee,{"aria-hidden":"true"})," New File…"]}),e.jsxs(P,{disabled:d||h,onClick:()=>u(t),children:[e.jsx(Ve,{"aria-hidden":"true"})," New Folder…"]}),e.jsx(je,{}),e.jsxs(P,{onClick:()=>se(t),children:[e.jsx(gn,{"aria-hidden":"true"})," Copy path"]}),e.jsxs(P,{disabled:t.type!=="file"||h,onClick:()=>{Q(t)},children:[e.jsx(be,{"aria-hidden":"true"})," Copy contents"]}),D&&e.jsxs(P,{disabled:h,onClick:()=>{x(t)},children:[e.jsx(ft,{"aria-hidden":"true"})," Reveal in File Explorer"]}),e.jsx(je,{}),e.jsxs(P,{className:"text-destructive data-highlighted:text-destructive",disabled:d,onClick:()=>b(t),children:[e.jsx(Ae,{"aria-hidden":"true"})," Delete ",e.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"Del"})]})]})]})}function Ye({path:t,type:i,expanded:f=!1}){const g=i==="file"?ht(t):He(t,f);return e.jsx("img",{className:"vscode-tree-icon",src:g,alt:"","aria-hidden":"true"})}export{es as FilesView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as i,T as g,a as x,b as j,B as m,o as M,q as N}from"./index-DAUK3rnz.js";import{r as v,j as e}from"./react-rd22PHbN.js";import{u as C}from"./tanstack-B0Sf7wNU.js";import{Y as b,A as y}from"./App-BXZLGT86.js";import{P,b as R,c as S,d as E,e as _}from"./base-ui-CJ8ZIx3d.js";const q=[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0",key:"svg-0"}],["path",{d:"M9 12l2 2l4 -4",key:"svg-1"}]],K=i("outline","circle-check","CircleCheck",q);const I=[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0",key:"svg-0"}],["path",{d:"M10 10l4 4m0 -4l-4 4",key:"svg-1"}]],U=i("outline","circle-x","CircleX",I);const $=[["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"}]],T=i("outline","git-merge","GitMerge",$);const G=[["path",{d:"M12 4l-8 4l8 4l8 -4l-8 -4",key:"svg-0"}],["path",{d:"M4 12l8 4l8 -4",key:"svg-1"}],["path",{d:"M4 16l8 4l8 -4",key:"svg-2"}]],F=i("outline","stack-2","Stack2",G);const O=[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0",key:"svg-0"}],["path",{d:"M9 10a3 3 0 1 0 6 0a3 3 0 1 0 -6 0",key:"svg-1"}],["path",{d:"M6.168 18.849a4 4 0 0 1 3.832 -2.849h4a4 4 0 0 1 3.834 2.855",key:"svg-2"}]],z=i("outline","user-circle","UserCircle",O);function X({repositoryId:n,number:r,membership:c,onSelect:l}){const[d,k]=v.useState(!1),a=C({queryKey:N.pullRequestStack(n,r),queryFn:()=>M.github.getPullRequestStack(n,r),enabled:d,staleTime:0}),t=a.data,h=t?t.layers.findIndex(s=>s.number===r)+1:c.position,u=t?.layers.length??c.size,o=t?.number??c.number;return a.isSuccess&&t===null&&!d?null:e.jsxs(P,{open:d,onOpenChange:k,children:[e.jsxs(g,{children:[e.jsxs(x,{render:e.jsx(R,{render:e.jsx("button",{className:"pr-stack-trigger","aria-label":`Stack ${o}, layer ${h} of ${u}`})}),children:[e.jsx(F,{"aria-hidden":"true"})," ",h,"/",u]}),e.jsxs(j,{children:["View stack #",o," · layer ",h," of ",u]})]}),e.jsx(S,{children:e.jsx(E,{side:"bottom",align:"start",sideOffset:6,className:"isolate z-50 outline-none",children:e.jsxs(_,{className:"pr-stack-popup","aria-label":`Stack #${o}`,children:[e.jsxs("div",{className:"pr-stack-heading",children:[e.jsxs("strong",{children:["Stack #",o]}),e.jsx(m,{variant:"ghost",size:"xs",disabled:a.isFetching,onClick:()=>{a.refetch()},children:"Refresh"})]}),a.isFetching&&e.jsx("p",{className:"pr-stack-notice",role:"status",children:t?"Refreshing stack…":"Loading stack…"}),a.isError&&e.jsxs("div",{className:"pr-stack-notice",role:"status",children:[e.jsx("p",{children:t?"Could not refresh. Showing saved layers.":"Could not load the stack."}),e.jsx(m,{variant:"outline",size:"xs",onClick:()=>{a.refetch()},children:"Retry"})]}),t===null&&!a.isFetching&&!a.isError&&e.jsx("p",{className:"pr-stack-notice",children:"This PR is no longer in a stack, or stack data is unavailable."}),t&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pr-stack-layers",children:[...t.layers].reverse().map(s=>{const p=s.isDraft&&s.state==="OPEN"?"Draft":s.state==="MERGED"?"Merged":s.state==="CLOSED"?"Closed":"Open",f=s.state==="MERGED"?T:b;return e.jsxs(g,{children:[e.jsxs(x,{render:e.jsx("button",{className:"pr-stack-layer","aria-current":s.number===r?"true":void 0,onClick:()=>{k(!1),l(s.number)}}),children:[e.jsx(f,{className:`pr-stack-state ${p.toLowerCase()}`,"aria-hidden":"true"}),e.jsxs("span",{className:"pr-stack-layer-text",children:[e.jsx("strong",{children:s.title}),e.jsxs("small",{children:["#",s.number," · ",s.headRefName," · ",p]})]}),s.number===r&&e.jsx(y,{"aria-hidden":"true"})]}),e.jsxs(j,{children:[s.title," · ",s.headRefName," · ",p]})]},s.number)})}),e.jsxs("div",{className:"pr-stack-base",children:["↳ ",t.base]})]})]})})})]})}function H({src:n,className:r}){const[c,l]=v.useState(!1);return e.jsx("span",{className:r,"aria-hidden":"true",children:n&&!c?e.jsx("img",{src:n,alt:"",onError:()=>l(!0)}):e.jsx(z,{})})}export{H as G,T as I,X as P,K as a,U as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as w,j as e}from"./react-rd22PHbN.js";import{a5 as ne,k as J,Q as Z,j as ae,a6 as re,a7 as oe,a8 as ie,a9 as le,Y as ce,p as de,u as he,aa as ue,ab as me,ac as pe}from"./App-BXZLGT86.js";import{a as xe}from"./tanstack-B0Sf7wNU.js";import{T as N,a as C,b as v,B as U,o as je,w as fe,s as X}from"./index-DAUK3rnz.js";import"./base-ui-CJ8ZIx3d.js";function ge(s){let n=[],a=s.some(r=>r.color!==void 0)?3:0,t=1;const o=new Map,j=[],i=new Map(s.map(r=>[r.oid,r])),u=new Set;let d=s[0];for(;d&&!u.has(d.oid);)u.add(d.oid),d.color!==void 0&&o.set(d.oid,d.color),d=i.get(d.parentOids[0]??"");for(const r of s){let h=n.indexOf(r.oid);const p=h>=0;h<0&&(h=n.length,n=[...n,r.oid]);const f=n,$=be(o,r.oid,()=>r.color??a++),x=$<3?r.color??$:$;o.set(r.oid,x);const y=f.filter((g,l)=>l!==h);let P=Math.min(h,y.length);r.parentOids.forEach((g,l)=>{o.has(g)||o.set(g,l===0?x:a++),!y.includes(g)&&(y.splice(P,0,g),P+=1)});const E=[];f.forEach((g,l)=>{if(l===h){p&&E.push({fromLane:l,from:"top",toLane:h,to:"node",color:$});return}const I=y.indexOf(g);I>=0&&E.push({fromLane:l,from:"top",toLane:I,to:"bottom",color:o.get(g)??0})}),r.parentOids.forEach(g=>{const l=y.indexOf(g);l>=0&&E.push({fromLane:h,from:"node",toLane:l,to:"bottom",color:o.get(g)??x})}),t=Math.max(t,f.length,y.length),j.push({lane:h,color:x,segments:E,continuations:y.map((g,l)=>({lane:l,color:o.get(g)??0}))}),n=y}return{rows:j,laneCount:t}}function be(s,n,a){const t=s.get(n);if(t!==void 0)return t;const o=a();return s.set(n,o),o}function ye(s){const n=s.parentCount>1&&/^Merge pull request #(\d+)\b/i.exec(s.subject),a=/\(#(\d+)\)\s*$/.exec(s.subject),t=n||a;if(!t)return null;const o=Number(t[1]);return Number.isSafeInteger(o)&&o>0?{number:o,source:n?"merge":"subject"}:null}function Ne(s){if(s.upstreamState==="local-only")return 0;if(s.baseState==="included")return 2;if(s.upstreamState==="published")return 1}function Ce(s,n){if(!n)return s.map(i=>({commit:i,parentOids:i.parentOids,grouped:[]}));const a=new Map(s.map(i=>[i.oid,i])),t=new Map;s.forEach(i=>i.parentOids.forEach(u=>{const d=t.get(u)??new Set;d.add(i.oid),t.set(u,d)}));const o=new Set,j=[];for(const i of s){if(o.has(i.oid))continue;const u={commit:i,parentOids:i.parentOids,grouped:[]};if(j.push(u),i.parentOids.length!==2)continue;const d=new Set;let r=a.get(i.parentOids[0]);for(;r&&!d.has(r.oid);)d.add(r.oid),r=a.get(r.parentOids[0]??"");let h=i.parentOids[1];const p=[],f=new Set;for(;!d.has(h);){const x=a.get(h);if(!x||f.has(h)||o.has(h)||x.isHead||x.parentOids.length!==1)break;f.add(h),p.push(x),h=x.parentOids[0]}if(!d.has(h)||p.length===0)continue;const $=new Set([i.oid,...p.map(x=>x.oid)]);p.some(x=>[...t.get(x.oid)??[]].some(y=>!$.has(y)))||p.some(x=>j.some(y=>y.commit.oid===x.oid))||(u.grouped=p,u.parentOids=[i.parentOids[0]],p.forEach(x=>o.add(x.oid)))}return j}function Q(s,n){const a=n.trim().toLocaleLowerCase();return a.length>0&&[s.subject,s.author,s.oid,...s.decorations].some(t=>t.toLocaleLowerCase().includes(a))}function Fe({repositoryId:s,upstream:n,readOnly:a,operation:t,canPublish:o,pushBusy:j,onPublish:i,commits:u,nextCursor:d,loading:r,undoing:h,baseRef:p,activeOid:f,onSelectReference:$,onSelectCommit:x,onSelectFile:y,onUndo:P,onMore:E}){const g=ne(),l=w.useRef(null),[I,L]=w.useState(new Set),[M,T]=w.useState(!0),[O,G]=w.useState(!1),[S,R]=w.useState(""),[q,z]=w.useState(-1),c=g?52:M?42:56,b=w.useMemo(()=>Ce(u??[],O&&!S.trim()),[u,O,S]),_=w.useMemo(()=>ge(b.map(({commit:m,parentOids:k})=>({oid:m.oid,parentOids:k,color:Ne(m)}))),[b]),F=w.useMemo(()=>b.flatMap(({commit:m},k)=>Q(m,S)?[k]:[]),[b,S]),se=$e(_.laneCount),H=xe({count:b.length,getScrollElement:()=>l.current,estimateSize:()=>c,getItemKey:m=>b[m].commit.oid,overscan:8});w.useEffect(()=>{H.measure()},[H,M,O,S,g]);const K=()=>{if(!F.length)return;const m=(q+1)%F.length;z(m),H.scrollToIndex(F[m],{align:"center"})};if(u===null)return e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(J,{className:"spinner"})," ",e.jsx(Z,{text:"Loading history…"})]});const V=u.filter(m=>m.upstreamState==="local-only").length;return e.jsxs("div",{className:"history-list",style:{"--history-row-height":`${c}px`},children:[e.jsxs("div",{className:"history-toolbar",children:[e.jsxs("label",{className:"history-search",children:[e.jsx(ae,{"aria-hidden":"true"}),e.jsx("input",{type:"search","aria-label":"Search loaded commits",placeholder:"Find commit…",value:S,onChange:m=>{R(m.target.value),z(-1)},onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),K())}})]}),S&&e.jsxs(N,{children:[e.jsx(C,{render:e.jsx("button",{className:"history-next-match",onClick:K,disabled:!F.length,"aria-label":"Next matching commit"}),children:e.jsx(re,{})}),e.jsx(v,{children:"Next match in loaded history (Enter)"})]}),e.jsxs(N,{children:[e.jsx(C,{render:e.jsx("button",{className:"history-option","aria-pressed":O,disabled:!u.some(m=>m.parentCount>1),onClick:()=>G(!O)}),children:"Group merges"}),e.jsx(v,{children:"Collapse complete merge branches. Searching reveals their commits."})]}),!g&&e.jsxs(N,{children:[e.jsx(C,{render:e.jsx("button",{className:"history-option","aria-pressed":M,onClick:()=>T(!M)}),children:M?"Compact":"Comfortable"}),e.jsx(v,{children:"Change row density without moving the diff viewer"})]})]}),!n&&u.length>0&&e.jsxs("div",{className:"history-upstream-notice",role:"status",children:[e.jsx("span",{children:"Publish this branch to configure an upstream and distinguish local from published commits."}),o&&e.jsx(U,{variant:"outline",size:"xs",disabled:j||a||!!t,onClick:i,children:j?"Publishing…":"Publish branch"})]}),n&&V>0&&e.jsxs("div",{className:"history-local-summary",children:["↑ ",V," ",V===1?"local commit":"local commits"," in loaded history"]}),e.jsx("div",{ref:l,className:"history-scroll",role:"list","aria-label":"Commit history",children:b.length===0?e.jsx("p",{className:"empty-list",children:"This repository has no commits yet."}):e.jsxs("div",{className:"virtual-list",style:{height:H.getTotalSize()+(d?52:0)},children:[H.getVirtualItems().map(m=>{const{commit:k,grouped:W}=b[m.index];return e.jsx("div",{ref:H.measureElement,"data-index":m.index,className:"virtual-row",style:{transform:`translateY(${m.start}px)`},children:e.jsx(ve,{repositoryId:s,upstream:n,baseRef:p,commit:k,graphRow:_.rows[m.index],graphWidth:se,rowHeight:c,active:f===k.oid||W.some(Y=>Y.oid===f),match:Q(k,S),groupedCount:W.length,onRevealGroup:()=>G(!1),onSelectReference:$,expanded:I.has(k.oid),onExpandedChange:Y=>L(te=>{const B=new Set(te);return Y?B.add(k.oid):B.delete(k.oid),B}),canUndo:!a&&!t&&!h&&k.upstreamState==="local-only"&&k.isHead&&k.parentCount===1,onSelectCommit:x,onSelectFile:y,onUndo:P})},m.key)}),d&&e.jsx(U,{variant:"ghost",className:"history-more",style:{top:H.getTotalSize()},disabled:r,onClick:E,children:r?"Loading…":"Load more"})]})}),u.length>0&&e.jsxs("div",{className:"history-legend",children:[e.jsxs("span",{children:[e.jsx("i",{"data-color":"local"}),"Local"]}),e.jsxs("span",{children:[e.jsx("i",{"data-color":"published"}),"Published"]}),p&&e.jsxs(N,{children:[e.jsxs(C,{render:e.jsx("span",{className:"history-base-label"}),children:[e.jsx("i",{"data-color":"base"}),p]}),e.jsxs(v,{children:["Primary-line commits reachable from ",p,", using the latest known local refs. Side branches use the published color."]})]}),e.jsx("span",{className:"history-count",role:"status",children:S?`${F.length} matches in ${u.length} loaded`:`${u.length} loaded`})]})]})}function ve({repositoryId:s,upstream:n,baseRef:a,commit:t,graphRow:o,graphWidth:j,rowHeight:i,active:u,match:d,groupedCount:r,onRevealGroup:h,onSelectReference:p,expanded:f,onExpandedChange:$,canUndo:x,onSelectCommit:y,onSelectFile:P,onUndo:E}){const g=`${s}:${t.oid}`,[l,I]=w.useState(()=>oe(g)??null),[L,M]=w.useState(null);w.useEffect(()=>{if(!f||l||L)return;let c=!0;return je.commits.files(s,t.oid).then(b=>{c&&(ie(g,b),I(b))}).catch(b=>{c&&M(Me(b))}),()=>{c=!1}},[g,t.oid,f,l,L,s]);const T=ye(t),O=Ee(t.decorations),G=O.slice(0,3),S=O.slice(3),R=l?.reduce((c,b)=>c+b.additions,0)??0,q=l?.reduce((c,b)=>c+b.deletions,0)??0,z=async()=>{try{await fe(t.oid),X.success({title:"Hash copied",description:t.oid})}catch{X.error({title:"Could not copy hash"})}};return e.jsxs("div",{className:`commit-item${u?" active":""}${d?" search-match":""}`,role:"listitem",children:[e.jsxs("div",{className:"commit-header",children:[e.jsx(Se,{graph:o,width:j,height:i,merge:t.parentCount>1,head:t.isHead}),e.jsx("button",{className:"commit-expand","aria-expanded":f,"aria-label":f?"Collapse commit":"Expand commit",onClick:()=>$(!f),children:e.jsx(le,{className:`folder-chevron ${f?"open":""}`})}),e.jsxs("div",{className:"commit-main",children:[e.jsxs("span",{className:"commit-title-row",children:[e.jsxs(N,{children:[e.jsx(C,{render:e.jsx("button",{className:"commit-subject","aria-pressed":u,onClick:()=>y(t)}),children:t.subject||"(no subject)"}),e.jsxs(v,{side:"right",children:[t.subject||"(no subject)",e.jsx("br",{}),"Open the full commit diff"]})]}),T&&e.jsxs(N,{children:[e.jsxs(C,{render:p?e.jsx("button",{className:"ref-chip commit-pr",onClick:()=>p(T.number),"aria-label":`Open pull request #${T.number}`}):e.jsx("span",{className:"ref-chip commit-pr"}),children:[e.jsx(ce,{"aria-hidden":"true"}),"#",T.number]}),e.jsxs(v,{children:[T.source==="merge"?"Pull request reference from the merge message.":"Reference from the commit subject; it may identify a pull request or issue.",p?" Open as a pull request in the right-hand viewer.":""," No merge method is inferred from the number."]})]}),e.jsxs(N,{children:[e.jsx(C,{render:e.jsx("time",{className:"commit-date",dateTime:t.date}),children:de(t.date)}),e.jsx(v,{children:he(t.date)})]})]}),e.jsxs("span",{className:"commit-meta",children:[(O.length>0||t.parentCount>1||t.upstreamState==="local-only")&&e.jsxs("span",{className:"commit-refs",children:[t.upstreamState==="local-only"&&e.jsxs(N,{children:[e.jsx(C,{render:e.jsx("span",{className:"ref-chip local-only"}),children:"Local"}),e.jsx(v,{children:t.isHead?`Not in ${n??"the upstream"} according to the latest known remote state.`:"Not published. To avoid rewriting multiple commits, only the latest can be undone."})]}),t.parentCount>1&&e.jsx("span",{className:"ref-chip merge",children:"merge"}),G.map(c=>e.jsxs(N,{children:[e.jsx(C,{render:e.jsx("span",{className:`ref-chip ${c.kind}`,"data-base":c.label===a||c.label.endsWith("/HEAD")&&t.baseState==="included"}),children:c.label}),e.jsx(v,{children:c.label})]},`${c.kind}:${c.label}`)),S.length>0&&e.jsxs(N,{children:[e.jsxs(C,{render:e.jsx("span",{className:"ref-chip more"}),children:["+",S.length]}),e.jsx(v,{children:S.map(c=>c.label).join(" · ")})]})]}),e.jsxs(N,{children:[e.jsx(C,{render:e.jsx("button",{className:"commit-oid",onClick:()=>{z()},"aria-label":`Copiar hash ${t.shortOid}`}),children:t.shortOid}),e.jsx(v,{children:"Copy full hash"})]}),e.jsxs(N,{children:[e.jsx(C,{render:e.jsx("span",{className:"commit-author"}),children:t.author}),e.jsx(v,{children:t.author})]}),r>0&&e.jsxs(N,{children:[e.jsxs(C,{render:e.jsx("button",{className:"commit-group-count",onClick:h}),children:[r," grouped"]}),e.jsxs(v,{children:["Show the ",r," commits in this merge branch"]})]})]})]}),x&&e.jsxs(N,{children:[e.jsx(C,{render:e.jsx(U,{variant:"ghost",size:"icon-xs",className:"change-action-button commit-undo",onClick:c=>{c.stopPropagation(),E(t)},"aria-label":`Undo commit ${t.shortOid}`}),children:e.jsx(ue,{})}),e.jsx(v,{children:"Undo commit and keep its changes staged"})]})]}),f&&o.continuations.length>0&&e.jsx(ke,{graph:o,width:j}),f&&e.jsxs("div",{className:"commit-files",style:{paddingLeft:j+31},children:[t.body&&e.jsx("p",{className:"commit-description",children:t.body}),L&&e.jsx("div",{className:"commit-files-message error",children:L}),!l&&!L&&e.jsxs("div",{className:"commit-files-message",children:[e.jsx(J,{className:"spinner"})," ",e.jsx(Z,{text:"Loading files…"})]}),l&&l.length===0&&e.jsx("div",{className:"commit-files-message",children:"This commit does not modify its own files (merge)."}),l&&l.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"commit-files-summary",children:[l.length," ",l.length===1?"file":"files",(R>0||q>0)&&e.jsxs(e.Fragment,{children:[" · ",e.jsxs("span",{className:"add",children:["+",R]})," ",e.jsxs("span",{className:"del",children:["−",q]})]})]}),l.map(c=>e.jsx(Oe,{file:c,onSelect:()=>P(t.oid,c)},c.path))]})]})]})}const ee=14,we=["var(--history-local)","var(--history-published)","var(--history-base)"];function $e(s){return 14+Math.max(0,s-1)*ee}function A(s){return 7+s*ee}function D(s){return we[s]??"var(--history-published)"}function Se({graph:s,width:n,height:a,merge:t,head:o}){const j=a/2;return e.jsxs("svg",{className:"commit-graph",width:n,height:a,viewBox:`0 0 ${n} ${a}`,"aria-hidden":"true",children:[s.segments.map((i,u)=>{const d=A(i.fromLane),r=A(i.toLane),h=i.from==="top"?0:j,p=i.to==="node"?j:a,f=(h+p)/2,$=d===r?`M ${d} ${h} L ${r} ${p}`:`M ${d} ${h} C ${d} ${f}, ${r} ${f}, ${r} ${p}`;return e.jsx("path",{d:$,stroke:D(i.color)},`${u}:${$}`)}),e.jsx("circle",{cx:A(s.lane),cy:j,r:t||o?4.5:3,fill:t||o?"var(--sidebar)":D(s.color),stroke:D(s.color)}),t&&e.jsx("circle",{cx:A(s.lane),cy:j,r:"1.6",fill:D(s.color)})]})}function ke({graph:s,width:n}){return e.jsx("svg",{className:"commit-graph-continuation",width:n,viewBox:`0 0 ${n} 100`,preserveAspectRatio:"none","aria-hidden":"true",children:s.continuations.map(a=>e.jsx("line",{x1:A(a.lane),y1:"0",x2:A(a.lane),y2:"100",stroke:D(a.color)},a.lane))})}function Oe({file:s,onSelect:n}){const a=w.useRef(null),t=s.path.lastIndexOf("/"),o=t<0?s.path:s.path.slice(t+1),j=s.oldPath?.split("/").pop();return e.jsxs("div",{ref:a,className:"commit-file-row",children:[e.jsxs(N,{children:[e.jsxs(C,{render:e.jsx("button",{className:"commit-file-label",onClick:n,"aria-label":`Ver el diff de ${s.path}`}),children:[e.jsx(Le,{path:s.path,type:"file"}),e.jsxs("span",{className:"commit-file-text",children:[e.jsx("span",{children:o}),j&&e.jsxs("small",{className:"commit-file-rename",children:[j," →"]})]})]}),e.jsx(v,{anchor:a,side:"right",sideOffset:10,children:s.oldPath?`${s.oldPath} → ${s.path}`:s.path})]}),e.jsx("span",{className:"commit-file-stats",children:s.binary?e.jsx("span",{className:"binary",children:"bin"}):e.jsxs(e.Fragment,{children:[s.additions>0&&e.jsxs("span",{className:"add",children:["+",s.additions]}),s.deletions>0&&e.jsxs("span",{className:"del",children:["−",s.deletions]})]})}),e.jsx("span",{className:"status-code","data-kind":s.kind,children:me(s.kind)})]})}function Ee(s){return s.map(n=>n.startsWith("tag: ")?{label:n.slice(5),kind:"tag"}:n.startsWith("HEAD -> ")?{label:n.slice(8),kind:"head"}:n==="HEAD"?{label:"HEAD",kind:"head"}:{label:n,kind:n.includes("/")?"remote":"branch"})}function Le({path:s}){return e.jsx("img",{className:"vscode-tree-icon",src:pe(s),alt:"","aria-hidden":"true",draggable:!1})}function Me(s){return s instanceof Error?s.message:"An unexpected error occurred."}export{Fe as HistoryView};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as m,j as e}from"./react-rd22PHbN.js";import{V as f,a as $,b as u}from"./viewer-tabs-
|
|
1
|
+
import{r as m,j as e}from"./react-rd22PHbN.js";import{V as f,a as $,b as u}from"./viewer-tabs-D-T0xQaq.js";import{u as j,F as y,S as E}from"./EditableFileViewer-CsbifqBO.js";import"./index-DAUK3rnz.js";import"./tanstack-B0Sf7wNU.js";import"./base-ui-CJ8ZIx3d.js";import"./PierreWorkerPool-Col4k7qz.js";import"./platform-Bqt97_Jr.js";import"./one-light-CoLDteqg.js";import"./index-BgLrS_2D.js";import"./index-CtEztN1P.js";import"./File-CHjvYpb2.js";import"./EditContext-CvJWfVl1.js";import"./edit-ready-context-D77R8XU8.js";import"./App-BXZLGT86.js";const T="data-opentig-preview-scrollbar";function S(r,i){const t=i?"255 255 255":"0 0 0",c=i?"oklch(0.13 0 0)":"oklch(0.985 0 0)",o=[`<style ${T}>`,"html {",` color-scheme: ${i?"dark":"light"} !important;`,` background-color: ${c} !important;`,"}","html, body, * {"," scrollbar-width: thin !important;",` scrollbar-color: rgb(${t} / 18%) transparent !important;`,"}","html::-webkit-scrollbar, body::-webkit-scrollbar, *::-webkit-scrollbar { width: 10px !important; height: 10px !important; }","html::-webkit-scrollbar-track, body::-webkit-scrollbar-track, *::-webkit-scrollbar-track,","html::-webkit-scrollbar-corner, body::-webkit-scrollbar-corner, *::-webkit-scrollbar-corner { background: transparent !important; }","html::-webkit-scrollbar-thumb, body::-webkit-scrollbar-thumb, *::-webkit-scrollbar-thumb {",` background-color: rgb(${t} / 18%) !important;`," background-clip: content-box !important;"," border: 3px solid transparent !important;"," border-radius: 999px !important;","}",`html::-webkit-scrollbar-thumb:hover, body::-webkit-scrollbar-thumb:hover, *::-webkit-scrollbar-thumb:hover { background-color: rgb(${t} / 28%) !important; }`,"html::-webkit-scrollbar-button, body::-webkit-scrollbar-button, *::-webkit-scrollbar-button { display: none !important; width: 0 !important; height: 0 !important; }","</style>"].join(`
|
|
2
2
|
`),s=r.search(/<\/head\s*>/i);if(s>=0)return`${r.slice(0,s)}${o}
|
|
3
3
|
${r.slice(s)}`;const l=/<head(?:\s[^>]*)?>/i.exec(r);if(l?.index!==void 0){const a=l.index+l[0].length;return`${r.slice(0,a)}
|
|
4
4
|
${o}${r.slice(a)}`}const n=/<html(?:\s[^>]*)?>/i.exec(r);if(n?.index!==void 0){const a=n.index+n[0].length;return`${r.slice(0,a)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as t}from"./index-
|
|
1
|
+
import{c as t}from"./index-DAUK3rnz.js";const a=[["path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1",key:"svg-0"}],["path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415",key:"svg-1"}],["path",{d:"M16 5l3 3",key:"svg-2"}]],o=t("outline","edit","Edit",a);export{o as I};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as o}from"./index-DAUK3rnz.js";const e=[["path",{d:"M12 19h-7a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2h4l3 3h7a2 2 0 0 1 2 2v3.5",key:"svg-0"}],["path",{d:"M16 19h6",key:"svg-1"}],["path",{d:"M19 16v6",key:"svg-2"}]],s=o("outline","folder-plus","FolderPlus",e);const a=[["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"}]],t=o("outline","folder-symlink","FolderSymlink",a);export{s as I,t as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,r}from"./react-rd22PHbN.js";import{c as V,B as x,T as k,a as T,b as O}from"./index-
|
|
1
|
+
import{j as t,r}from"./react-rd22PHbN.js";import{c as V,B as x,T as k,a as T,b as O}from"./index-DAUK3rnz.js";import{V as U,b as C,a as B}from"./viewer-tabs-D-T0xQaq.js";import{u as W,S as P,F as H}from"./EditableFileViewer-CsbifqBO.js";import"./tanstack-B0Sf7wNU.js";import"./base-ui-CJ8ZIx3d.js";import"./PierreWorkerPool-Col4k7qz.js";import"./platform-Bqt97_Jr.js";import"./one-light-CoLDteqg.js";import"./index-BgLrS_2D.js";import"./index-CtEztN1P.js";import"./File-CHjvYpb2.js";import"./EditContext-CvJWfVl1.js";import"./edit-ready-context-D77R8XU8.js";import"./App-BXZLGT86.js";const K=[["path",{d:"M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0",key:"svg-0"}],["path",{d:"M7 10l6 0",key:"svg-1"}],["path",{d:"M10 7l0 6",key:"svg-2"}],["path",{d:"M21 21l-6 -6",key:"svg-3"}]],X=V("outline","zoom-in","ZoomIn",K);const Y=[["path",{d:"M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0",key:"svg-0"}],["path",{d:"M7 10l6 0",key:"svg-1"}],["path",{d:"M21 21l-6 -6",key:"svg-2"}]],q=V("outline","zoom-out","ZoomOut",Y),Z=.25,S=8,D=[.25,.5,.75,1,1.25,1.5,2,3,4,6,8];function $(e){return Number.isFinite(e)?Math.min(S,Math.max(Z,e)):1}function L(e){const s=$(e);return D.find(n=>n>s+Number.EPSILON)??S}function _(e){const s=$(e);return[...D].reverse().find(n=>n<s-Number.EPSILON)??Z}const J={conflictTitle:"SVG was changed outside OpenTig",successTitle:"SVG saved",errorTitle:"Could not save SVG"};function ve({image:e}){return e.status==="unsupported"?t.jsx(y,{title:"Image format is not supported",detail:`${e.path} · ${M(e.size)}`}):e.status==="too-large"?t.jsx(y,{title:"Image is too large to preview",detail:`${e.path} · ${M(e.size)} · limit ${M(e.limit)}`}):t.jsx(Q,{path:e.path,mimeType:e.mimeType,size:e.size,data:e.data})}function Q({path:e,mimeType:s,size:n,data:d}){const c=F(d,s);return t.jsx(R,{objectUrl:c,path:e,size:n})}function fe({file:e,initialContent:s,themeType:n,wrapLines:d,readOnly:c,onDirtyChange:i,onDraftChange:o,onSave:u}){const[m,l]=r.useState("preview"),{draft:g,updateDraft:N,dirty:v,saving:f,save:j}=W({file:e,initialContent:s,readOnly:c,messages:J,onDirtyChange:i,onDraftChange:o,onSave:u}),w=F(g,"image/svg+xml");r.useEffect(()=>{l("preview")},[e.path]);const b=t.jsx(B,{label:"SVG view",className:"file-viewer-tabs image-viewer-tabs",items:[{value:"preview",label:"Preview"},{value:"code",label:t.jsxs(t.Fragment,{children:["Code ",v&&t.jsx("span",{className:"image-unsaved-dot","aria-label":"Unsaved changes"})]})}]}),p=t.jsx(H,{dirty:v,saving:f,readOnly:c,onSave:()=>{j()}});return t.jsxs(U,{value:m,onValueChange:a=>l(a),className:"svg-file-viewer",children:[t.jsx(C,{value:"preview",className:"svg-file-panel",children:t.jsx(R,{objectUrl:w,path:e.path,size:new TextEncoder().encode(g).byteLength,toolbarStart:b,toolbarEnd:p})}),t.jsxs(C,{value:"code",className:"svg-file-panel",children:[t.jsxs("div",{className:"file-viewer-pill svg-file-toolbar",children:[b,p]}),t.jsx("div",{className:"svg-code-view",children:t.jsx(P,{path:e.path,cacheKey:e.path,value:g,themeType:n,wrapLines:d,readOnly:c||f,onChange:N})})]})]})}function R({objectUrl:e,path:s,size:n,toolbarStart:d,toolbarEnd:c}){const[i,o]=r.useState("fit"),[u,m]=r.useState(1),[l,g]=r.useState(null),[N,v]=r.useState(!1),f=r.useRef(null);r.useEffect(()=>{g(null),v(!1)},[e]),r.useEffect(()=>{const a=f.current;if(!a)return;let h=0;const z=E=>{E.preventDefault();const A=E.deltaMode===WheelEvent.DOM_DELTA_LINE?16:E.deltaMode===WheelEvent.DOM_DELTA_PAGE?100:1;if(h+=E.deltaY*A,Math.abs(h)<24)return;const G=h<0;h=0,o("actual"),m(I=>G?L(I):_(I))};return a.addEventListener("wheel",z,{passive:!1}),()=>a.removeEventListener("wheel",z)},[]);const j=l?l.width*u:void 0,w=l?l.height*u:void 0,b=[M(n),l?`${l.width} × ${l.height}`:null].filter(Boolean).join(" · "),p=a=>{o("actual"),m(h=>a==="in"?L(h):_(h))};return t.jsxs("div",{className:"image-preview-workspace",children:[t.jsxs("div",{className:"file-viewer-pill image-preview-toolbar",children:[d,t.jsx("span",{className:"image-file-details",children:b}),t.jsxs("div",{className:"image-sizing-toggle",role:"group","aria-label":"Image size",children:[t.jsx(x,{type:"button",size:"xs",variant:i==="fit"?"secondary":"ghost","aria-pressed":i==="fit",onClick:()=>o("fit"),children:"Fit"}),t.jsx(x,{type:"button",size:"xs",variant:i==="actual"&&u===1?"secondary":"ghost","aria-pressed":i==="actual"&&u===1,onClick:()=>{o("actual"),m(1)},children:"1:1"})]}),t.jsxs("div",{className:"image-zoom-controls",children:[t.jsxs(k,{children:[t.jsx(T,{render:t.jsx(x,{type:"button",variant:"ghost",size:"icon-xs","aria-label":"Zoom out",onClick:()=>p("out")}),children:t.jsx(q,{})}),t.jsx(O,{children:"Zoom out"})]}),t.jsxs(x,{type:"button",variant:"ghost",size:"xs",className:"image-zoom-value","aria-label":"Reset zoom to 100%",onClick:()=>{o("actual"),m(1)},children:[Math.round(u*100),"%"]}),t.jsxs(k,{children:[t.jsx(T,{render:t.jsx(x,{type:"button",variant:"ghost",size:"icon-xs","aria-label":"Zoom in",onClick:()=>p("in")}),children:t.jsx(X,{})}),t.jsx(O,{children:"Zoom in"})]})]}),c]}),t.jsx("div",{ref:f,className:"image-preview-canvas","data-sizing":i,"data-zoom-limit":u>=S?"max":"normal",tabIndex:0,"aria-label":`Image preview for ${s}`,onKeyDown:a=>{if(a.key==="+"||a.key==="=")p("in");else if(a.key==="-")p("out");else if(a.key==="0")o("actual"),m(1);else if(a.key.toLowerCase()==="f")o("fit");else return;a.preventDefault()},children:e?N?t.jsx(y,{title:"Could not decode this image",detail:s}):t.jsx("img",{src:e,alt:ee(s),draggable:!1,style:i==="actual"&&j&&w?{width:j,height:w,maxWidth:"none",maxHeight:"none"}:void 0,onLoad:a=>{v(!1),g({width:a.currentTarget.naturalWidth,height:a.currentTarget.naturalHeight})},onError:()=>v(!0)}):t.jsx("span",{className:"image-preview-loading",children:"Loading image…"})})]})}function y({title:e,detail:s}){return t.jsxs("div",{className:"image-viewer-message",children:[t.jsx("strong",{children:e}),t.jsx("span",{children:s})]})}function F(e,s){const[n,d]=r.useState(null);return r.useEffect(()=>{const c=typeof e=="string"?e:new Uint8Array(e),i=URL.createObjectURL(new Blob([c],{type:s}));return d(i),()=>{URL.revokeObjectURL(i),d(o=>o===i?null:o)}},[s,e]),n}function ee(e){return e.replace(/\\/g,"/").split("/").pop()||e}function M(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}export{ve as ImageFileViewer,fe as SvgFileViewer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as l,j as e}from"./react-rd22PHbN.js";import{f as ve,a as Ne,b as B,w as F,n as ce,D as Ce,c as De,d as Te,e as Be,g as ie,I as he,h as M,i as se,j as Fe,k as H,l as Se,m as O,o as Ee,p as Re,q as U,r as me,B as Ie,s as Ae,t as Ge,u as ue,v as be,x as Pe,y as Oe,z as Le,A as $e,C as de,E as ze}from"./App-BXZLGT86.js";import{u as W}from"./tanstack-B0Sf7wNU.js";import{q as K,B as f,T as X,a as J,b as V,I as qe,w as We,o as S}from"./index-DAUK3rnz.js";import{C as Ke}from"./checkbox-BRH0ZNIC.js";import"./base-ui-CJ8ZIx3d.js";function rr(r){const{open:n,tab:a,repositoryId:t,onMutated:b,onBusyChange:j}=r,[o,p]=l.useState(""),[k,c]=l.useState(!1),[i,g]=l.useState(null),[w,E]=l.useState(null),[v,x]=l.useState(null),[d,R]=l.useState(null),[L,N]=l.useState(null),[fe,$]=l.useState(!1),ae=l.useRef(null);l.useEffect(()=>{c(!1)},[n,t]);const D=W({queryKey:K.localRefs(t),queryFn:()=>S.refs.localRefsSnapshot(t),enabled:n}),m=D.data??null,z=D.isFetching,ne=D.error?Q(D.error):null,Z=l.useMemo(()=>ve(m?.branches??[],o),[m,o]),_=l.useMemo(()=>Ne(m?.worktrees??[],o),[m,o]),I=Z.find(s=>B(s)===i)??null,A=_.find(s=>F(s)===w)??null,le=W({queryKey:K.branchDetails(t,I?.fullName??""),queryFn:()=>S.refs.branchDetails({repositoryId:t,fullName:I.fullName}),enabled:n&&a==="branches"&&I!==null}),y=le.data??null,je=W({queryKey:K.branchPullRequest(t,y?.name??""),queryFn:()=>S.github.findPullRequestForBranch(t,y.name),enabled:n&&a==="branches"&&y!==null&&(y.deletion==="unknown"||y.deletion==="unmerged")}).data??null,te=W({queryKey:K.worktreeDetails(t,A?.path??""),queryFn:()=>S.refs.worktreeDetails({repositoryId:t,path:A.path}),enabled:n&&a==="worktrees"&&A!==null}),C=te.data??null,ee=a==="branches"?le:te,q=ee.isFetching,G=ee.error?Q(ee.error):null,P=l.useCallback(async()=>{await D.refetch()},[D]);l.useEffect(()=>{if(!m)return;const s=ae.current;ae.current=m,g(h=>ce(m.branches.map(B),(s?.branches??[]).map(B),h)),E(h=>ce(m.worktrees.map(F),(s?.worktrees??[]).map(F),h))},[m]),l.useEffect(()=>{n||(p(""),x(null),N(null),$(!1))},[n]),l.useEffect(()=>{x(null),N(null),$(!1)},[a,i,w]);const oe=async(s,h)=>{R(s),j(!0),N(null);try{await h()&&x(null)}catch(T){N(Q(T))}finally{R(null),j(!1)}},pe=(s,h)=>oe("delete-branch",async()=>{const T=await S.refs.deleteBranch({repositoryId:t,fullName:s.fullName,expectedOid:s.oid,force:h});return T.status!=="deleted"?(N(Me(T.status)),await P(),!1):(b(null),await P(),!0)}),ge=(s,h,T)=>oe("remove-worktree",async()=>{const re=await S.refs.removeWorktree({repositoryId:t,path:s.path,expectedOid:s.oid,force:h,deleteBranch:T});return re.status!=="removed"?(N(Ue(re.status)),await P(),!1):(b(re.recentRepositories),await P(),!0)}),we=async s=>{try{await We(s),$(!0),window.setTimeout(()=>$(!1),1600)}catch(h){N(Q(h))}},ke={branches:m?.branches.length??0,worktrees:m?.worktrees.length??0},ye=a==="branches"?Z.length===0:_.length===0;return e.jsx(Ce,{open:n,onOpenChange:r.onOpenChange,children:e.jsxs(De,{className:"local-refs-dialog",children:[e.jsxs("header",{className:"local-refs-header",children:[e.jsxs("div",{children:[e.jsx(Te,{children:"Local branches and worktrees"}),e.jsx(Be,{children:"Inspect what this repository holds locally, and retire what Git can safely remove."})]}),e.jsx(ie,{render:e.jsx(f,{variant:"ghost",size:"icon-sm","aria-label":"Close the local refs manager"}),children:e.jsx(he,{})})]}),e.jsxs("div",{className:"local-refs-toolbar",children:[e.jsx("div",{className:"local-refs-tabs",role:"tablist","aria-label":"Local refs",children:["branches","worktrees"].map(s=>e.jsxs("button",{type:"button",role:"tab",id:`local-refs-tab-${s}`,"aria-selected":a===s,"aria-controls":`local-refs-panel-${s}`,className:"local-refs-tab",onClick:()=>{r.onTabChange(s),c(!1)},children:[s==="branches"?e.jsx(M,{"aria-hidden":"true"}):e.jsx(se,{"aria-hidden":"true"}),e.jsx("span",{children:s==="branches"?"Branches":"Worktrees"}),e.jsx("small",{children:ke[s]})]},s))}),e.jsxs("div",{className:"local-refs-search",children:[e.jsx(Fe,{"aria-hidden":"true"}),e.jsxs("label",{className:"sr-only",htmlFor:"local-refs-search-input",children:["Search ",a]}),e.jsx("input",{id:"local-refs-search-input",value:o,onChange:s=>p(s.target.value),placeholder:a==="branches"?"Search branches…":"Search worktrees…",autoComplete:"off",spellCheck:!1}),o&&e.jsx(f,{variant:"ghost",size:"icon-xs","aria-label":"Clear search",onClick:()=>p(""),children:e.jsx(he,{})})]}),e.jsxs(f,{variant:"outline",size:"sm",onClick:()=>{P()},disabled:z||!!d,children:[z?e.jsx(H,{className:"animate-spin"}):e.jsx(Se,{})," Refresh"]})]}),ne&&e.jsxs("div",{className:"local-refs-error",role:"alert",children:[e.jsx(O,{"aria-hidden":"true"}),e.jsx("span",{children:ne})]}),k&&e.jsxs("button",{type:"button",className:"local-refs-mobile-back",onClick:()=>c(!1),children:["← Back to ",a]}),e.jsxs("div",{className:"local-refs-body","data-mobile-detail":k,role:"tabpanel",id:`local-refs-panel-${a}`,"aria-labelledby":`local-refs-tab-${a}`,children:[e.jsxs("div",{className:"local-refs-list",role:"listbox","aria-label":a==="branches"?"Local branches":"Worktrees",tabIndex:-1,children:[z&&!m&&e.jsxs("p",{className:"local-refs-placeholder",children:[e.jsx(H,{className:"animate-spin","aria-hidden":"true"})," Reading the repository…"]}),!z&&ye&&e.jsx("p",{className:"local-refs-placeholder",children:o?"No matches for this search.":`This repository has no ${a==="branches"?"local branches":"worktrees"}.`}),a==="branches"&&Z.map(s=>e.jsxs(X,{children:[e.jsxs(J,{render:e.jsx("button",{type:"button",role:"option","aria-selected":B(s)===i,className:"local-refs-row",onClick:()=>{g(B(s)),c(!0)}}),children:[e.jsxs("span",{className:"local-refs-row-head",children:[e.jsx(M,{"aria-hidden":"true"}),e.jsx("strong",{children:s.name}),e.jsx(Y,{badges:Ee(s)})]}),e.jsxs("small",{className:"local-refs-row-meta",children:[e.jsx("code",{children:s.shortOid}),s.subject&&e.jsx("span",{children:s.subject}),s.date&&e.jsx("time",{dateTime:s.date,children:Re(s.date)})]})]}),e.jsxs(V,{children:[s.name,s.subject?` — ${s.subject}`:""]})]},B(s))),a==="worktrees"&&_.map(s=>e.jsxs(X,{children:[e.jsxs(J,{render:e.jsx("button",{type:"button",role:"option","aria-selected":F(s)===w,className:"local-refs-row",onClick:()=>{E(F(s)),c(!0)}}),children:[e.jsxs("span",{className:"local-refs-row-head",children:[e.jsx(se,{"aria-hidden":"true"}),e.jsx("strong",{children:U(s.path)}),e.jsx(Y,{badges:me(s)})]}),e.jsxs("small",{className:"local-refs-row-meta",children:[e.jsx("span",{className:"local-refs-row-branch",children:s.branch?`${s.branch}`:"Detached HEAD"}),e.jsx("span",{children:s.path})]})]}),e.jsxs(V,{children:[U(s.path)," — ",s.path]})]},F(s)))]}),e.jsxs("div",{className:"local-refs-detail",children:[G&&e.jsxs("div",{className:"local-refs-error",role:"alert",children:[e.jsx(O,{"aria-hidden":"true"}),e.jsx("span",{children:G})]}),q&&e.jsxs("p",{className:"local-refs-placeholder",children:[e.jsx(H,{className:"animate-spin","aria-hidden":"true"})," Loading details…"]}),!q&&!G&&a==="branches"&&y&&I&&e.jsx(Qe,{details:y,pullRequest:je,busy:d==="delete-branch",anyBusy:!!d,confirming:v==="delete-branch",actionError:L,onConfirm:()=>x("delete-branch"),onCancel:()=>x(null),onDelete:s=>{pe(y,s)}}),!q&&!G&&a==="worktrees"&&C&&A&&e.jsx(He,{details:C,busy:d==="remove-worktree",anyBusy:!!d,confirming:v==="remove-worktree",actionError:L,copied:fe,onConfirm:()=>x("remove-worktree"),onCancel:()=>x(null),onRemove:(s,h)=>{ge(C,s,h)},onCopyPath:()=>{we(C.path)},onOpen:()=>r.onOpenWorktree(C.path),onShowBranch:()=>{C.branch&&(g(`refs/heads/${C.branch}`),r.onTabChange("branches"))}}),!q&&!G&&!I&&!A&&e.jsxs("p",{className:"local-refs-placeholder",children:["Select a ",a==="branches"?"branch":"worktree"," to see its details."]})]})]},a),e.jsxs("footer",{className:"local-refs-footer",children:[e.jsx("small",{children:"Deleting a branch and removing a worktree are separate actions. A worktree removes its branch only when explicitly selected."}),e.jsx(ie,{render:e.jsx(f,{variant:"outline",size:"sm",disabled:!!d}),children:"Done"})]})]})})}function Qe({details:r,pullRequest:n,busy:a,anyBusy:t,confirming:b,actionError:j,onConfirm:o,onCancel:p,onDelete:k}){const c=Ae(r,n),i=c.forceAllowed===!0,g=c.allowed||i;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"local-refs-detail-head",children:[e.jsxs("h3",{children:[e.jsx(M,{"aria-hidden":"true"}),e.jsxs(X,{children:[e.jsx(J,{render:e.jsx("span",{}),children:r.name}),e.jsx(V,{children:r.name})]})]}),e.jsx(Y,{badges:Ge(r)})]}),e.jsxs("dl",{className:"local-refs-facts",children:[e.jsx(u,{label:"Full ref",children:e.jsx("code",{className:"local-refs-selectable",children:r.fullName})}),e.jsxs(u,{label:"Tip",children:[e.jsx("code",{children:r.shortOid})," ",r.subject]}),e.jsx(u,{label:"Author",children:r.author||"—"}),e.jsx(u,{label:"Last commit",children:r.date?ue(r.date):"—"}),e.jsx(u,{label:"Upstream",children:r.upstream?`${r.upstream} · ↑${r.ahead} ↓${r.behind}`:"Not configured"}),e.jsx(u,{label:"Compared with",children:r.comparisonBase??"Not compared"}),n&&e.jsx(u,{label:"GitHub PR",children:e.jsxs("button",{type:"button",className:"local-refs-pr-link",onClick:()=>Pe(n.url),children:["#",n.number," · ",n.state==="MERGED"?`Merged into ${n.baseRefName}`:n.state==="OPEN"?"Open":"Closed"," ",e.jsx(be,{"aria-hidden":"true"})]})})]}),e.jsx(xe,{tone:c.allowed?"ready":"blocked",reason:c.reason,actionError:j,confirming:b,busy:a,anyBusy:t,actionLabel:i?"Force delete branch":"Delete branch",confirmLabel:a?"Deleting…":i?"Permanently delete":"Delete branch",allowed:g,confirmation:i?e.jsxs(e.Fragment,{children:["Force-delete the local branch ",e.jsx("strong",{children:r.name}),"? This keeps any remote branch and pull request, but commits found only on this local branch may become inaccessible. ",n?.state==="MERGED"?e.jsxs(e.Fragment,{children:["GitHub reports PR ",e.jsxs("strong",{children:["#",n.number]})," as merged into ",e.jsx("strong",{children:n.baseRefName}),", although local Git cannot verify the ancestry."]}):null]}):e.jsxs(e.Fragment,{children:["Delete the local branch ",e.jsx("strong",{children:r.name}),"? This removes only the local branch, keeping every worktree and any remote copy. Git confirmed it is fully merged into ",e.jsx("strong",{children:r.comparisonBase}),"."]}),onConfirm:o,onCancel:p,onAct:()=>k(i)})]})}function He({details:r,busy:n,anyBusy:a,confirming:t,actionError:b,copied:j,onConfirm:o,onCancel:p,onRemove:k,onCopyPath:c,onOpen:i,onShowBranch:g}){const[w,E]=l.useState(!1),v=Oe(r),x=Le(r),d=v.forceAllowed===!0,R=v.allowed||d;return l.useEffect(()=>E(!1),[r.path]),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"local-refs-detail-head",children:[e.jsxs("h3",{children:[e.jsx(se,{"aria-hidden":"true"}),e.jsxs(X,{children:[e.jsx(J,{render:e.jsx("span",{}),children:U(r.path)}),e.jsx(V,{children:U(r.path)})]})]}),e.jsx(Y,{badges:me(r)})]}),e.jsxs("dl",{className:"local-refs-facts",children:[e.jsx(u,{label:"Folder",children:e.jsx("span",{className:"local-refs-path local-refs-selectable",children:r.path})}),e.jsx(u,{label:"Branch",children:r.branch??"Detached HEAD"}),e.jsx(u,{label:"HEAD",children:r.lastCommit?e.jsxs(e.Fragment,{children:[e.jsx("code",{children:r.lastCommit.shortOid})," ",r.lastCommit.subject]}):e.jsx("code",{children:r.oid?r.oid.slice(0,7):"—"})}),e.jsx(u,{label:"Committed",children:r.lastCommit?.date?ue(r.lastCommit.date):"—"}),e.jsx(u,{label:"Local changes",children:r.available?x??"None":"Not readable"})]}),e.jsxs("div",{className:"local-refs-detail-actions",children:[e.jsxs(f,{variant:"outline",size:"sm",onClick:c,disabled:a,children:[j?e.jsx($e,{}):e.jsx(qe,{})," ",j?"Copied":"Copy path"]}),!r.current&&r.available&&!r.locked&&e.jsxs(f,{variant:"outline",size:"sm",onClick:i,disabled:a,children:[e.jsx(be,{})," Open worktree"]}),r.branch&&e.jsxs(f,{variant:"ghost",size:"sm",onClick:g,disabled:a,children:[e.jsx(M,{})," Show branch"]})]}),r.branch&&R&&e.jsxs("label",{htmlFor:"remove-worktree-delete-branch",className:"local-refs-delete-branch",children:[e.jsx(Ke,{id:"remove-worktree-delete-branch",checked:w,onCheckedChange:L=>E(L===!0),disabled:a}),e.jsxs("span",{children:["Also delete branch ",e.jsx("strong",{children:r.branch})]})]}),e.jsx(xe,{tone:v.allowed?"ready":"blocked",reason:v.reason,actionError:b,confirming:t,busy:n,anyBusy:a,actionLabel:d?"Force remove worktree":"Remove worktree",confirmLabel:n?"Removing…":d?"Permanently remove":"Remove worktree",allowed:R,confirmation:e.jsxs(e.Fragment,{children:[d?e.jsxs(e.Fragment,{children:["Permanently remove the worktree at ",e.jsx("strong",{className:"local-refs-path",children:r.path}),"? ",e.jsx("strong",{children:x??`The ${r.operation??"current Git operation"}`})," and every uncommitted file will be lost. The folder is deleted from disk and is ",e.jsx("strong",{children:"not"})," moved to system Trash. "]}):e.jsxs(e.Fragment,{children:["Remove the worktree at ",e.jsx("strong",{className:"local-refs-path",children:r.path}),"? The folder is deleted from disk and is ",e.jsx("strong",{children:"not"})," moved to system Trash. "]}),w&&r.branch?e.jsxs(e.Fragment,{children:["The branch ",e.jsx("strong",{children:r.branch})," will also be force-deleted. Commits found only on that branch may become inaccessible."]}):r.branch?e.jsxs(e.Fragment,{children:["The branch ",e.jsx("strong",{children:r.branch})," and its commits stay in the repository."]}):"No branch is deleted."]}),onConfirm:o,onCancel:p,onAct:()=>k(d,w)})]})}function xe({tone:r,reason:n,actionError:a,confirming:t,busy:b,anyBusy:j,allowed:o,actionLabel:p,confirmLabel:k,confirmation:c,onConfirm:i,onCancel:g,onAct:w}){return e.jsxs("div",{className:`local-refs-danger ${r}`,children:[a&&e.jsxs("p",{className:"local-refs-danger-error",role:"alert",children:[e.jsx(O,{"aria-hidden":"true"}),e.jsx("span",{children:a})]}),t&&o?e.jsxs("div",{className:"local-refs-confirm",role:"alert",children:[e.jsx(O,{"aria-hidden":"true"}),e.jsx("p",{children:c}),e.jsxs("span",{className:"local-refs-confirm-actions",children:[e.jsxs(f,{variant:"destructive",size:"sm",onClick:w,disabled:b,children:[b?e.jsx(H,{className:"animate-spin"}):e.jsx(de,{})," ",k]}),e.jsx(f,{variant:"ghost",size:"sm",onClick:g,disabled:b,children:"Cancel"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"local-refs-reason",children:[r==="ready"?e.jsx(ze,{"aria-hidden":"true"}):e.jsx(O,{"aria-hidden":"true"}),e.jsx("span",{children:n})]}),o&&e.jsxs(f,{variant:"destructive",size:"sm",onClick:i,disabled:j,children:[e.jsx(de,{})," ",p]})]})]})}function Y({badges:r}){return r.length===0?null:e.jsx("span",{className:"local-refs-badges",children:r.map(n=>e.jsx(Ie,{variant:n.tone==="current"?"default":n.tone==="warning"?"destructive":"outline",children:n.label},n.label))})}function u({label:r,children:n}){return e.jsxs("div",{className:"local-refs-fact",children:[e.jsx("dt",{children:r}),e.jsx("dd",{children:n})]})}function Me(r){switch(r){case"stale":return"The branch moved since this view loaded. It was refreshed; check the new state before deleting.";case"current":return"This branch is now checked out here, so Git will not delete it.";case"checked-out":return"Another worktree now has this branch checked out.";case"unmerged":return"Git found commits that are not in the comparison base, so the branch was kept.";case"unknown":return"The comparison base is not available locally, so the branch was kept.";default:return"The branch no longer exists."}}function Ue(r){switch(r){case"stale":return"The worktree moved since this view loaded. It was refreshed; check the new state before removing.";case"main":return"Git can never remove the main worktree.";case"current":return"OpenTig has this worktree open. Switch to another one first.";case"dirty":return"The worktree has local changes or an operation in progress, so it was kept.";case"locked":return"The worktree is locked. Unlock it in Git first.";case"prunable":return"Git can no longer find this worktree on disk.";case"bare":return"This entry is a bare repository, not a removable worktree.";default:return"The worktree no longer exists."}}function Q(r){return r instanceof Error?r.message:String(r)}export{rr as LocalRefsDialog};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-9dt2ugQA.js","assets/index-DAUK3rnz.js","assets/react-rd22PHbN.js","assets/tanstack-B0Sf7wNU.js","assets/base-ui-CJ8ZIx3d.js","assets/index-BfA4tAc1.css","assets/render-markdown-BtCybfvQ.js","assets/App-BXZLGT86.js","assets/one-light-CoLDteqg.js","assets/index-BgLrS_2D.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as n,j as r,a as ae}from"./react-rd22PHbN.js";import{c as Q,_ as se,w as ie,s as ce,f as le,T as H,a as $,b as q,o as ue}from"./index-DAUK3rnz.js";import{T as de,Q as me}from"./App-BXZLGT86.js";import{V as pe,a as fe,b as B}from"./viewer-tabs-D-T0xQaq.js";import{u as he,s as we,F as ge,S as ve}from"./EditableFileViewer-CsbifqBO.js";import{r as be}from"./render-markdown-BtCybfvQ.js";/* empty css */import"./tanstack-B0Sf7wNU.js";import"./base-ui-CJ8ZIx3d.js";import"./PierreWorkerPool-Col4k7qz.js";import"./platform-Bqt97_Jr.js";import"./one-light-CoLDteqg.js";import"./index-BgLrS_2D.js";import"./index-CtEztN1P.js";import"./File-CHjvYpb2.js";import"./EditContext-CvJWfVl1.js";import"./edit-ready-context-D77R8XU8.js";const ke=[["path",{d:"M3 12h7l-3 -3",key:"svg-0"}],["path",{d:"M7 15l3 -3",key:"svg-1"}],["path",{d:"M21 12h-7l3 -3",key:"svg-2"}],["path",{d:"M17 15l-3 -3",key:"svg-3"}],["path",{d:"M9 6v-1a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v1",key:"svg-4"}],["path",{d:"M9 18v1a2 2 0 0 0 2 2h2a2 2 0 0 0 2 -2v-1",key:"svg-5"}]],ye=Q("outline","viewport-narrow","ViewportNarrow",ke);const Ce=[["path",{d:"M10 12h-7l3 -3",key:"svg-0"}],["path",{d:"M6 15l-3 -3",key:"svg-1"}],["path",{d:"M14 12h7l-3 -3",key:"svg-2"}],["path",{d:"M18 15l3 -3",key:"svg-3"}],["path",{d:"M3 6v-1a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v1",key:"svg-4"}],["path",{d:"M3 18v1a2 2 0 0 0 2 2h14a2 2 0 0 0 2 -2v-1",key:"svg-5"}]],xe=Q("outline","viewport-wide","ViewportWide",Ce);function F(m,s){const p=s.trim();if(!p||p.startsWith("#")||p.startsWith("//")||/^[a-z][a-z\d+.-]*:/i.test(p))return null;const h=p.split(/[?#]/,1)[0];if(!h)return null;let c;try{c=decodeURIComponent(h).replaceAll("\\","/")}catch{return null}const l=c.startsWith("/")?[]:m.replaceAll("\\","/").split("/").slice(0,-1).filter(Boolean);for(const t of c.split("/"))if(!(!t||t===".")){if(t===".."){if(l.length===0)return null;l.pop();continue}if(Te(t))return null;l.push(t)}return l.length>0?l.join("/"):null}function Te(m){return[...m].some(s=>s.charCodeAt(0)<32||s.charCodeAt(0)===127)}function Me(m,s,p,h,c){const l=document.createElement("template");l.innerHTML=s;const t=new Map;for(const e of l.content.querySelectorAll("img[src]")){if(e.classList.contains("markdown-code-icon"))continue;const i=e.getAttribute("src").trim();if(/^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(i))continue;e.removeAttribute("src"),e.removeAttribute("srcset");const u=F(h,i);if(!u)continue;const v=t.get(u)??[];v.push(e),t.set(u,v)}m.replaceChildren(l.content);let g=!1;const w=[];for(const[e,i]of t)(async()=>{let u;if(de(e)){const f=await c.readFile(p,e);if(f.binary||f.tooLarge)return;u=new Blob([f.content],{type:"image/svg+xml"})}else{const f=await c.readImage(p,e);if(f.status!=="ready")return;u=new Blob([new Uint8Array(f.data)],{type:f.mimeType})}if(g)return;const v=URL.createObjectURL(u);w.push(v);for(const f of i)f.src=v})().catch(()=>{});return()=>{g=!0;for(const e of w)URL.revokeObjectURL(e)}}let Se=0;function K(){return document.documentElement.classList.contains("dark")?"dark":"default"}function Re(m,s,p){const[h,c]=n.useState(K);n.useEffect(()=>{const t=new MutationObserver(()=>c(K()));return t.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>t.disconnect()},[]);const l=n.useCallback(async t=>{if(!m.current)return;const g=Array.from(m.current.querySelectorAll(".mermaid"));if(g.length!==0)try{const{default:w}=await se(async()=>{const{default:e}=await import("./mermaid.core-9dt2ugQA.js").then(i=>i.bo);return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]));if(t()||!m.current)return;w.initialize({startOnLoad:!1,theme:h,securityLevel:"strict"});for(const e of g){const i=e.dataset.mermaidSource;if(i){e.removeAttribute("data-mermaid-error");try{const u=decodeURIComponent(i),v=`mermaid-diagram-${Se++}`,{svg:f,bindFunctions:A}=await w.render(v,u,e);if(t()||!e.isConnected)return;e.innerHTML=f,e.dataset.processed="true",A?.(e)}catch{!t()&&e.isConnected&&(e.textContent=decodeURIComponent(i),e.dataset.mermaidError="Could not render diagram")}}}}catch{for(const w of g)!t()&&w.isConnected&&(w.dataset.mermaidError="Could not load Mermaid")}},[s,m,h]);n.useEffect(()=>{let t=!1;return l(()=>t),()=>{t=!0}},[p,l])}const X="opentig:markdown-content-width",G=/^([a-z][a-z0-9+.-]*:)?\/\//i,je={conflictTitle:"Markdown was changed outside OpenTig",successTitle:"Markdown saved",errorTitle:"Could not save Markdown"};function Ee(){try{return window.localStorage.getItem(X)==="fit"?"fit":"reading"}catch{return"reading"}}function Ae({html:m,repositoryId:s,markdownPath:p,onClick:h,onLinkHover:c}){const l=n.useRef(null),t=n.useRef(null);n.useLayoutEffect(()=>{const e=l.current?Me(l.current,m,s,p,ue.repository):void 0;return t.current=null,c(null),e},[m,s,p,c]),Re(l,!0,m);const g=n.useCallback(e=>{const i=e.target.closest("a[href]");!i||i===t.current||(t.current=i,c(i))},[c]),w=n.useCallback(e=>{const i=t.current;if(!i)return;const u=e.relatedTarget;u&&i.contains(u)||(t.current=null,c(null))},[c]);return r.jsx("div",{ref:l,className:"markdown-prose",onClick:h,onMouseOver:g,onMouseOut:w})}function Ge({repositoryId:m,file:s,initialContent:p,revision:h,themeType:c,wrapLines:l,readOnly:t,onOpenFile:g,onDirtyChange:w,onDraftChange:e,onSave:i}){const[u,v]=n.useState("preview"),[f,A]=n.useState(Ee),[M,O]=n.useState(""),[_,I]=n.useState(!0),[Y,V]=n.useState(!1),[T,k]=n.useState(null),S=n.useRef(0),C=n.useRef(null),N=n.useRef(null),L=n.useRef(null),x=n.useRef(null),R=n.useRef(null),{draft:P,updateDraft:J,dirty:j,saving:U,save:Z}=he({file:s,initialContent:p,readOnly:t,messages:je,onDirtyChange:w,onDraftChange:e,onSave:i});n.useEffect(()=>{R.current?.(),x.current=null,v("preview")},[s.path]);const ee=n.useCallback(a=>{if(a!==u){if(R.current?.(),u==="preview"){const o=N.current,d=o?o.scrollHeight-o.clientHeight:0;x.current=o&&d>0?o.scrollTop/d:0}else x.current=L.current?.getScrollFraction()??0;v(a)}},[u]);n.useLayoutEffect(()=>{const a=x.current;if(a==null)return;if(u==="code"){x.current=null,L.current?.scrollToFraction(a);return}const o=N.current;!o||_&&!M||(x.current=null,R.current=we({getScrollRange:()=>Math.max(0,o.scrollHeight-o.clientHeight),getScrollTop:()=>o.scrollTop,getContentHeight:()=>o.scrollHeight,scrollTo:d=>{o.scrollTop=d}},a))},[M,_,u]),n.useEffect(()=>()=>R.current?.(),[]),n.useEffect(()=>{const a=++S.current;I(!0);const o=window.setTimeout(()=>{const d=window.__opentigPerformanceAutomation?performance.now():null;be(P).then(b=>{a===S.current&&(O(b),d!==null&&(window.__opentigPerformanceResults??=[],window.__opentigPerformanceResults.push({kind:"markdown-render",durationMs:Math.round((performance.now()-d)*100)/100})))}).catch(()=>{a===S.current&&O("<p>Could not render Markdown.</p>")}).finally(()=>{a===S.current&&I(!1)})},j?120:0);return()=>window.clearTimeout(o)},[j,P,s.mtimeMs,s.path,h,c]),n.useEffect(()=>()=>{C.current&&window.clearTimeout(C.current.timer)},[]);const te=n.useCallback(async a=>{const o=a.target,d=o.closest("[data-copy-code]");if(d){const W=d.dataset.copyCode;if(!W)return;try{const ne=decodeURIComponent(W);await ie(ne);const E=C.current;E&&(window.clearTimeout(E.timer),delete E.button.dataset.copyState,E.button.setAttribute("aria-label","Copy code")),d.dataset.copyState="copied",d.setAttribute("aria-label","Copied"),V(!0);const oe=window.setTimeout(()=>{C.current?.button===d&&(delete d.dataset.copyState,d.setAttribute("aria-label","Copy code"),C.current=null,V(!1))},2e3);C.current={button:d,timer:oe}}catch{ce.error({title:"Could not copy code"})}return}const b=o.closest("a[href]"),y=b?.getAttribute("href");if(!b||!y)return;if(a.preventDefault(),y.startsWith("#")){a.currentTarget.querySelector(`#${CSS.escape(y.slice(1))}`)?.scrollIntoView({behavior:"smooth",block:"start"});return}if(G.test(y)||y.startsWith("mailto:")){try{le(y)}catch{}return}const z=F(s.path,y);z&&g(z)},[s.path,g]),re=n.useCallback(a=>{if(!a){k(null);return}const o=a.getAttribute("href");if(!o||o.startsWith("#")){k(null);return}const d=a.getBoundingClientRect(),b={top:d.bottom+6,left:d.left};if(o.startsWith("mailto:")){k({...b,label:"Open in mail app",href:o.replace(/^mailto:/,"")});return}if(G.test(o)){k({...b,label:"Open in browser",href:o});return}if(F(s.path,o)){k({...b,label:"Open file",href:o});return}k(null)},[s.path]),D=a=>{A(a);try{window.localStorage.setItem(X,a)}catch{}};return r.jsxs(pe,{value:u,onValueChange:a=>ee(a),className:"markdown-viewer","data-content-width":f,children:[r.jsxs("div",{className:"file-viewer-pill markdown-viewer-toolbar",children:[r.jsx(fe,{label:"Markdown view",className:"file-viewer-tabs markdown-viewer-tabs",items:[{value:"preview",label:"Preview"},{value:"code",label:r.jsxs(r.Fragment,{children:["Code ",j&&r.jsx("span",{className:"markdown-unsaved-dot","aria-label":"Unsaved changes"})]})}]}),r.jsx(ge,{dirty:j,saving:U,readOnly:t,onSave:()=>{Z()}}),r.jsxs("div",{className:"markdown-width-toggle",role:"group","aria-label":"Markdown content width",children:[r.jsxs(H,{children:[r.jsx($,{render:r.jsx("button",{type:"button","aria-label":"Reading width","aria-pressed":f==="reading",onClick:()=>D("reading")}),children:r.jsx(ye,{"aria-hidden":"true"})}),r.jsx(q,{children:"Reading width"})]}),r.jsxs(H,{children:[r.jsx($,{render:r.jsx("button",{type:"button","aria-label":"Fit to width","aria-pressed":f==="fit",onClick:()=>D("fit")}),children:r.jsx(xe,{"aria-hidden":"true"})}),r.jsx(q,{children:"Fit to width"})]})]})]}),r.jsxs(B,{ref:N,value:"preview",className:"markdown-preview-scroll",onScroll:()=>k(null),children:[_&&!M?r.jsx("div",{className:"viewer-message",children:r.jsx(me,{text:"Rendering Markdown…"})}):r.jsx(Ae,{repositoryId:m,markdownPath:s.path,html:M,onClick:a=>{te(a)},onLinkHover:re},`${m}:${s.path}:${h}`),r.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:Y?"Code copied":""}),T?ae.createPortal(r.jsxs("div",{className:"markdown-link-tooltip",style:{top:T.top,left:T.left},role:"tooltip",children:[r.jsx("span",{className:"markdown-link-tooltip-label",children:T.label}),r.jsx("span",{className:"markdown-link-tooltip-href",children:T.href})]}),document.body):null]}),r.jsx(B,{value:"code",className:"markdown-code-view","data-theme":c,children:r.jsx(ve,{ref:L,path:s.path,cacheKey:s.path,value:P,themeType:c,wrapLines:l,readOnly:t||U,onChange:J})})]})}export{Ge as MarkdownFileViewer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,j as e}from"./react-rd22PHbN.js";import{B as g,
|
|
1
|
+
import{r as o,j as e}from"./react-rd22PHbN.js";import{B as g,e as b,P as w}from"./index-DAUK3rnz.js";import"./tanstack-B0Sf7wNU.js";import"./base-ui-CJ8ZIx3d.js";async function v(a,i=fetch){try{const t=await i("/api/auth/descriptor",{credentials:"include",cache:"no-store",signal:a});if(!t.ok)return"unavailable";const n=await t.json();return!n||typeof n!="object"||!("authenticated"in n)?"unavailable":n.authenticated===!0?"authenticated":n.authenticated===!1?"unpaired":"unavailable"}catch{return"unavailable"}}function y(a,i){const t=a.hash;return i.replaceState(null,"",`${a.pathname}${a.search}`),new URLSearchParams(t.startsWith("#")?t.slice(1):t).get("token")??""}async function j(a,i,t=fetch){try{return(await t("/api/auth/pair",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:a,clientName:i})})).ok?"paired":"rejected"}catch{return"unavailable"}}function k(a){const i=[[/Edg\//,"Edge"],[/Firefox\//,"Firefox"],[/OPR\//,"Opera"],[/Chrome\//,"Chrome"],[/Safari\//,"Safari"]].find(([n])=>n.test(a))?.[1]??"Browser",t=[[/Windows NT/,"Windows"],[/Android/,"Android"],[/(?:iPhone|iPod)/,"iPhone"],[/iPad/,"iPad"],[/CrOS/,"ChromeOS"],[/Macintosh|Mac OS X/,"Mac"],[/Linux/,"Linux"]].find(([n])=>n.test(a))?.[1];return t?`${i} on ${t}`:i}const N={rejected:"This code is invalid, expired, or already used. Create a new one from OpenTig.",unavailable:"OpenTig could not complete pairing. Check the server and try again."};function O(){const[a,i]=o.useState(()=>y(window.location,window.history)),[t,n]=o.useState(()=>k(window.navigator.userAgent)),[c,m]=o.useState("idle"),[u,h]=o.useState("checking"),[p,f]=o.useState(0);o.useEffect(()=>{const r=new AbortController;let s=!0;const d=window.setTimeout(()=>r.abort(),1e4);return v(r.signal).then(l=>{s&&(l==="authenticated"&&window.location.replace("/"),h(l))}).finally(()=>window.clearTimeout(d)),()=>{s=!1,r.abort(),window.clearTimeout(d)}},[p]);const x=async r=>{r.preventDefault();const s=t.trim(),d=a.trim();if(!s||!d||s.length>64)return;m("pairing");const l=await j(d,s);l==="paired"?window.location.replace("/"):m(l)};return u!=="unpaired"?e.jsx("main",{className:"access-page pairing-page flex min-h-dvh items-center justify-center bg-background px-4 py-6 text-foreground",children:e.jsxs("section",{className:"w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-sm",children:[e.jsx("h1",{className:"text-lg font-semibold",children:u==="unavailable"?"Could not check this browser":"Checking this browser…"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",role:"status",children:u==="unavailable"?"Could not verify your saved session. Check your connection and try again.":"Checking your saved session before asking you to pair again."}),u==="unavailable"&&e.jsx(g,{className:"mt-5",onClick:()=>{h("checking"),f(r=>r+1)},children:"Try again"})]})}):e.jsx("main",{className:"access-page pairing-page flex min-h-dvh items-center justify-center bg-background px-4 py-6 text-foreground",children:e.jsxs("section",{className:"w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-sm",children:[e.jsx("h1",{className:"text-lg font-semibold",children:"Pair this browser"}),e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["Enter the one-use code shown by the ",b," desktop app or generated with the command below on the server. It expires after five minutes."]}),e.jsx(w,{}),e.jsxs("form",{className:"mt-5 grid gap-4",onSubmit:r=>{x(r)},children:[e.jsxs("label",{className:"grid gap-1.5 text-sm",htmlFor:"pairing-code",children:[e.jsx("span",{className:"font-medium",children:"Pairing code"}),e.jsx("input",{id:"pairing-code",className:"h-10 w-full min-w-0 rounded-md border border-input bg-background px-3 font-mono text-base outline-none focus:border-ring focus:ring-2 focus:ring-ring/20",value:a,onChange:r=>i(r.target.value),autoComplete:"off",spellCheck:!1,required:!0})]}),e.jsxs("label",{className:"grid gap-1.5 text-sm",htmlFor:"device-name",children:[e.jsx("span",{className:"font-medium",children:"Device name"}),e.jsx("input",{id:"device-name",className:"h-10 w-full min-w-0 rounded-md border border-input bg-background px-3 text-base outline-none focus:border-ring focus:ring-2 focus:ring-ring/20",value:t,onChange:r=>n(r.target.value),maxLength:64,autoComplete:"off",required:!0})]}),e.jsx(g,{type:"submit",disabled:c==="pairing"||!a.trim()||!t.trim(),children:c==="pairing"?"Pairing…":"Pair browser"})]}),(c==="rejected"||c==="unavailable")&&e.jsx("p",{className:"mt-4 text-sm text-destructive",role:"alert",children:N[c]}),e.jsx("p",{className:"mt-4 text-xs text-muted-foreground",children:"The code is removed from the address bar immediately and is never stored by the browser."}),e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"This browser remembers its access and renews it automatically while you use OpenTig. Pair again after 30 days without renewal, clearing cookies, or revoking access."})]})})}export{O as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as k,j as g}from"./react-rd22PHbN.js";import{t as w,a6 as E,n as Y,a7 as j,a8 as O,B as Z,d as M,E as ee,A as ne,a3 as te,_ as ie,a4 as R,a5 as oe,P as re,a as se,V as T,O as U,r as $}from"./PierreWorkerPool-Col4k7qz.js";import{F as le}from"./File-CHjvYpb2.js";import{D as V,b as P,f as ce}from"./platform-Bqt97_Jr.js";import{a as de,g as J,b as Q,F as ae,p as b,c as ue,s as fe,r as he,D as pe}from"./DiffWorkspace-RDG_Y70N.js";import{a as H}from"./EditContext-CvJWfVl1.js";import{B as D}from"./index-DAUK3rnz.js";import"./one-light-CoLDteqg.js";import"./index-BgLrS_2D.js";import"./index-CtEztN1P.js";import"./App-BXZLGT86.js";import"./tanstack-B0Sf7wNU.js";import"./base-ui-CJ8ZIx3d.js";var _=class extends de{pendingConflictActions=[];pendingMarkerRows=[];injectedRows=new Map;options;constructor(e={theme:V},n,t){super(void 0,n,t),this.options=e}setConflictState(e,n,t){this.pendingConflictActions=e,this.pendingMarkerRows=n,this.syncInjectedRows(e,n,t)}syncInjectedRows(e,n,t){this.injectedRows.clear();for(const i of e){const r=i!=null?J(i,t):void 0;if(i==null||r==null)continue;const o={type:"actions",hunkIndex:r.hunkIndex,lineIndex:r.lineIndex,conflictIndex:i.conflictIndex};this.addInjectedRow(o)}for(const i of n)this.addInjectedRow(i)}addInjectedRow(e){const n=`${e.hunkIndex}:${e.lineIndex}`,t=this.injectedRows.get(n);t==null?this.injectedRows.set(n,[e]):t.push(e)}renderDiff(e,n=P){return e!=null&&this.syncInjectedRows(this.pendingConflictActions,this.pendingMarkerRows,e),super.renderDiff(e,n)}async asyncRender(e,n=P){return this.syncInjectedRows(this.pendingConflictActions,this.pendingMarkerRows,e),super.asyncRender(e,n)}createPreElement(e,n){return super.createPreElement(e,n,{"data-has-merge-conflict":""})}getUnifiedLineDecoration({type:e,lineType:n}){const t=e==="change"?n==="change-deletion"?"current":"incoming":void 0;return{gutterLineType:e==="change"?"context":n,gutterProperties:B(t),contentProperties:W(e,t)}}getSplitLineDecoration({side:e,type:n}){const t=n==="change"?e==="deletions"?"current":"incoming":void 0;return{gutterLineType:n==="change"?"context":n,gutterProperties:B(t),contentProperties:W(n,t)}}getUnifiedInjectedRowsForLine=e=>{const n=this.injectedRows.get(`${e.hunkIndex}:${e.lineIndex}`);if(n==null||n.length===0)return;const{mergeConflictActionsType:t}=this.getOptionsWithDefaults(),i=[],r=[];for(const o of n){if(o.type==="actions"){i.push({content:Ce({row:o,includeDefaultActions:t==="default",includeSlot:!0}),gutter:G("action")});continue}(o.type==="marker-end"?r:i).push({content:me(o),gutter:G("marker",o.type)})}return{before:i.length>0?i:void 0,after:r.length>0?r:void 0}};getOptionsWithDefaults(){const e=super.getOptionsWithDefaults();return e.diffStyle="unified",e.lineDiffType="none",e.mergeConflictActionsType=this.options.mergeConflictActionsType??"default",e}};function B(e){return e!=null?{"data-merge-conflict":e}:void 0}function W(e,n){if(n!=null){if(e==="change")return n==="current"||n==="incoming"?{"data-line-type":"context","data-merge-conflict":n}:void 0;if(n==="marker-start"||n==="marker-base"||n==="marker-separator"||n==="marker-end")return{"data-merge-conflict":n}}}function G(e,n){const t=Y(void 0,"annotation",1);return t.properties["data-gutter-buffer"]=e==="action"?"merge-conflict-action":`merge-conflict-${n??"marker"}`,t}function Ce({row:e,includeDefaultActions:n,includeSlot:t}){const i=n?xe(e.conflictIndex):[];return i.push(w({tagName:"slot",properties:{name:Q({hunkIndex:e.hunkIndex,lineIndex:e.lineIndex,conflictIndex:e.conflictIndex}),"data-merge-conflict-action-slot":""}})),w({tagName:"div",properties:{"data-merge-conflict-actions":""},children:[w({tagName:"div",properties:{"data-merge-conflict-actions-content":""},children:i})]})}function me(e){return w({tagName:"div",properties:{"data-merge-conflict":e.type,"data-merge-conflict-marker-row":""},children:[E(e.lineText.replace(/(?:\r\n|\n|\r)$/,""))]})}function xe(e){return[y({resolution:"current",label:"Accept current change",conflictIndex:e}),K(),y({resolution:"incoming",label:"Accept incoming change",conflictIndex:e}),K(),y({resolution:"both",label:"Accept both",conflictIndex:e})]}function y({resolution:e,label:n,conflictIndex:t}){return w({tagName:"button",properties:{type:"button","data-merge-conflict-action":e,"data-merge-conflict-conflict-index":`${t}`},children:[E(n)]})}function K(){return w({tagName:"span",properties:{"data-merge-conflict-action-separator":""},children:[E("|")]})}function ge(e,n){return e.hunkIndex===n.hunkIndex&&e.startContentIndex===n.startContentIndex&&e.endContentIndex===n.endContentIndex&&e.currentContentIndex===n.currentContentIndex&&e.baseContentIndex===n.baseContentIndex&&e.incomingContentIndex===n.incomingContentIndex&&e.endMarkerContentIndex===n.endMarkerContentIndex&&e.conflictIndex===n.conflictIndex&&Le(e.conflict,n.conflict)}function Le(e,n){return e.conflictIndex===n.conflictIndex&&e.startLineIndex===n.startLineIndex&&e.startLineNumber===n.startLineNumber&&e.separatorLineIndex===n.separatorLineIndex&&e.separatorLineNumber===n.separatorLineNumber&&e.endLineIndex===n.endLineIndex&&e.endLineNumber===n.endLineNumber&&e.baseMarkerLineIndex===n.baseMarkerLineIndex&&e.baseMarkerLineNumber===n.baseMarkerLineNumber}function Ie(e){const n=typeof e=="string"?e:e.type;return n==="accept"||n==="incoming"?"additions":n==="reject"||n==="current"?"deletions":"both"}function ve(e,n){const{resolution:t,hunkIndex:i,startContentIndex:r,endContentIndex:o,indexesToDelete:s=new Set}=n,l=e.hunks[i];if(l==null)throw console.error({diff:e,hunkIndex:i}),new Error(`resolveRegion: Invalid hunk index: ${i}`);if(r<0||o>=l.hunkContent.length||r>o)throw new Error(`resolveRegion: Invalid content range, ${r}, ${o}`);const{hunks:d,additionLines:a,deletionLines:f}=e,h={...e,hunks:[],deletionLines:[],additionLines:[],splitLineCount:0,unifiedLineCount:0,cacheKey:e.cacheKey!=null?`${e.cacheKey}:${t[0]}-${i}:${r}-${o}`:void 0},u={nextAdditionLineIndex:0,nextDeletionLineIndex:0,nextAdditionStart:1,nextDeletionStart:1,splitLineCount:0,unifiedLineCount:0},L=i===d.length-1&&o===l.hunkContent.length-1,A=!e.isPartial;for(const[p,x]of d.entries()){ke(e,h,u,j(x.deletionStart,x.deletionCount)-x.collapsedBefore,j(x.additionStart,x.additionCount)-x.collapsedBefore,x.collapsedBefore,A);const c={...x,hunkContent:[],additionStart:u.nextAdditionStart,deletionStart:u.nextDeletionStart,additionLineIndex:u.nextAdditionLineIndex,deletionLineIndex:u.nextDeletionLineIndex,additionCount:0,deletionCount:0,deletionLines:0,additionLines:0,splitLineStart:u.splitLineCount,unifiedLineStart:u.unifiedLineCount,splitLineCount:0,unifiedLineCount:0};for(const[m,C]of x.hunkContent.entries())if(p!==i||m<r||m>o){z(C,h,f,a);const v={...C,additionLineIndex:u.nextAdditionLineIndex,deletionLineIndex:u.nextDeletionLineIndex};c.hunkContent.push(v),S(v,u,c)}else if(s.has(m))c.hunkContent.push({type:"context",lines:0,deletionLineIndex:u.nextDeletionLineIndex,additionLineIndex:u.nextAdditionLineIndex});else if(C.type==="context"){z(C,h,f,a);const v={...C,deletionLineIndex:u.nextDeletionLineIndex,additionLineIndex:u.nextAdditionLineIndex};c.hunkContent.push(v),S(v,u,c)}else{Ae(t,C,h,f,a);const v={type:"context",lines:t==="deletions"?C.deletions:t==="additions"?C.additions:C.deletions+C.additions,deletionLineIndex:u.nextDeletionLineIndex,additionLineIndex:u.nextAdditionLineIndex};c.hunkContent.push(v),S(v,u,c)}if(p===i&&L){const m=t==="deletions"?x.noEOFCRDeletions:x.noEOFCRAdditions;c.noEOFCRAdditions=m,c.noEOFCRDeletions=m}c.additionCount===0&&(c.additionStart--,e.isPartial||c.additionLineIndex--),c.deletionCount===0&&(c.deletionStart--,e.isPartial||c.deletionLineIndex--),h.hunks.push(c)}const I=d.at(-1);if(I!=null&&!e.isPartial){const p=O(I.deletionStart,I.deletionCount),x=O(I.additionStart,I.additionCount),c=Math.min(f.length-p,a.length-x);X(h,f,a,p,x,c),u.splitLineCount+=c,u.unifiedLineCount+=c}return h.splitLineCount=u.splitLineCount,h.unifiedLineCount=u.unifiedLineCount,h}function X(e,n,t,i,r,o){for(let s=0;s<o;s++){const l=n[i+s],d=t[r+s];if(l==null||d==null)throw new Error("pushCollapsedContextLines: missing collapsed context line");e.deletionLines.push(l),e.additionLines.push(d)}}function ke(e,n,t,i,r,o,s){o<=0||(s&&(X(n,e.deletionLines,e.additionLines,i,r,o),t.nextAdditionLineIndex+=o,t.nextDeletionLineIndex+=o),t.nextAdditionStart+=o,t.nextDeletionStart+=o,t.splitLineCount+=o,t.unifiedLineCount+=o)}function z(e,n,t,i){if(e.type==="context")for(let r=0;r<e.lines;r++){const o=i[e.additionLineIndex+r];if(o==null)throw console.error({additionLines:i,content:e,i:r}),new Error("pushContentLinesToDiff: Context line does not exist");n.deletionLines.push(o),n.additionLines.push(o)}else{const r=Math.max(e.deletions,e.additions);for(let o=0;o<r;o++){if(o<e.deletions){const s=t[e.deletionLineIndex+o];if(s==null)throw console.error({deletionLines:t,content:e,i:o}),new Error("pushContentLinesToDiff: Deletion line does not exist");n.deletionLines.push(s)}if(o<e.additions){const s=i[e.additionLineIndex+o];if(s==null)throw console.error({additionLines:i,content:e,i:o}),new Error("pushContentLinesToDiff: Addition line does not exist");n.additionLines.push(s)}}}}function Ae(e,n,t,i,r){if(e==="deletions"||e==="both")for(let o=0;o<n.deletions;o++){const s=i[n.deletionLineIndex+o];if(s==null)throw console.error({deletionLines:i,content:n,i:o}),new Error("pushResolveLinesToDiff: Deletion line does not exist");t.deletionLines.push(s),t.additionLines.push(s)}if(e==="additions"||e==="both")for(let o=0;o<n.additions;o++){const s=r[n.additionLineIndex+o];if(s==null)throw console.error({additionLines:r,content:n,i:o}),new Error("pushResolveLinesToDiff: Addition line does not exist");t.deletionLines.push(s),t.additionLines.push(s)}}function S(e,n,t){e.type==="context"?(n.nextAdditionLineIndex+=e.lines,n.nextDeletionLineIndex+=e.lines,n.nextAdditionStart+=e.lines,n.nextDeletionStart+=e.lines,n.splitLineCount+=e.lines,n.unifiedLineCount+=e.lines,t.additionCount+=e.lines,t.deletionCount+=e.lines,t.splitLineCount+=e.lines,t.unifiedLineCount+=e.lines):(n.nextAdditionLineIndex+=e.additions,n.nextDeletionLineIndex+=e.deletions,n.nextAdditionStart+=e.additions,n.nextDeletionStart+=e.deletions,n.splitLineCount+=Math.max(e.deletions,e.additions),n.unifiedLineCount+=e.deletions+e.additions,t.deletionCount+=e.deletions,t.deletionLines+=e.deletions,t.additionCount+=e.additions,t.additionLines+=e.additions,t.splitLineCount+=Math.max(e.deletions,e.additions),t.unifiedLineCount+=e.deletions+e.additions)}function we(e,n,t){return ve(e,{resolution:Ie(t),hunkIndex:n.hunkIndex,startContentIndex:n.startContentIndex,endContentIndex:n.endContentIndex,indexesToDelete:Re(n)})}function Re(e){const n=new Set;return e.baseContentIndex!=null&&n.add(e.baseContentIndex),e.endMarkerContentIndex!==e.endContentIndex&&n.add(e.endMarkerContentIndex),n}let De=-1;var Me=class extends ae{options;__id=`unresolved-file:${++De}`;type="unresolved-file";computedCache={file:void 0,fileDiff:void 0,actions:void 0,markerRows:void 0};conflictActions=[];markerRows=[];conflictActionCache=new Map;constructor(n={theme:V},t,i=!1){super(void 0,t,i),this.options=n,this.setOptions(n)}setOptions(n){if(n!=null){if(n.onMergeConflictAction!=null&&n.onMergeConflictResolve!=null)throw new Error("UnresolvedFile: onMergeConflictAction and onMergeConflictResolve are mutually exclusive. Use only one callback.");this.options=n,this.hunksRenderer.setOptions(this.getHunksRendererOptions(n)),this.syncInteractionOptions()}}syncInteractionOptions(){this.interactionManager.setOptions(Z(this.options,typeof this.options.hunkSeparators=="function"||(this.options.hunkSeparators??"line-info")==="line-info"||this.options.hunkSeparators==="line-info-basic"?this.handleExpandHunk:void 0,this.getLineIndex,this.handleMergeConflictActionClick))}createHunksRenderer(n){return new _(this.getHunksRendererOptions(n),this.handleHighlightRender,this.workerManager)}getHunksRendererOptions(n){return Te(n,this.options)}applyPreNodeAttributes(n,t){super.applyPreNodeAttributes(n,t,{"data-has-merge-conflict":""})}cleanUp(){this.emitPostRender(!0),this.clearMergeConflictActionCache(),this.computedCache={file:void 0,fileDiff:void 0,actions:void 0,markerRows:void 0},this.conflictActions=[],super.cleanUp()}getOrComputeDiff({file:n,fileDiff:t,actions:i,markerRows:r}){const{maxContextLines:o,onMergeConflictAction:s}=this.options;e:if(s!=null){const l=t!=null;if(l!==(i!=null)||l!==(r!=null))throw new Error("UnresolvedFile.getOrComputeDiff: fileDiff, actions, and markerRows must be passed together");if(t!=null&&i!=null&&r!=null){this.computedCache={file:n??this.computedCache.file,fileDiff:t,actions:i,markerRows:r};break e}else if(n!=null||this.computedCache.file!=null){if(n!=null&&this.computedCache.file!=null&&!M(n,this.computedCache.file)&&this.computedCache.fileDiff!=null&&this.computedCache.actions!=null)throw new Error("UnresolvedFile.getOrComputeDiff: file can only be used to initialize unresolved state once. Pass fileDiff and actions for subsequent updates.");if(n??=this.computedCache.file,n==null)throw new Error("UnresolvedFile.getOrComputeDiff: file is null, should be impossible");if(!M(n,this.computedCache.file)||this.computedCache.fileDiff==null||this.computedCache.actions==null){const d=b(n,o);this.computedCache={file:n,fileDiff:d.fileDiff,actions:d.actions,markerRows:d.markerRows}}t=this.computedCache.fileDiff,i=this.computedCache.actions,r=this.computedCache.markerRows;break e}else{t=this.computedCache.fileDiff,i=this.computedCache.actions,r=this.computedCache.markerRows;break e}}else{if(t!=null||i!=null||r!=null)throw new Error("UnresolvedFile.getOrComputeDiff: fileDiff, actions, and markerRows are only usable in controlled mode, you must pass in `onMergeConflictAction`");if(n!=null&&this.computedCache.file!=null&&!M(n,this.computedCache.file))throw new Error("UnresolvedFile.getOrComputeDiff: uncontrolled unresolved files parse the file only once. Later updates must come from the cached diff state.");if(this.computedCache.file??=n,this.computedCache.fileDiff==null&&this.computedCache.file!=null){const l=b(this.computedCache.file,o);this.computedCache.fileDiff=l.fileDiff,this.computedCache.actions=l.actions,this.computedCache.markerRows=l.markerRows}t=this.computedCache.fileDiff,i=this.computedCache.actions,r=this.computedCache.markerRows;break e}if(!(t==null||i==null||r==null))return{fileDiff:t,actions:i,markerRows:r}}hydrate(n){const{file:t,fileDiff:i,actions:r,markerRows:o,lineAnnotations:s,fileContainer:l,prerenderedHTML:d,preventEmit:a=!1}=n,f=this.getOrComputeDiff({file:t,fileDiff:i,actions:r,markerRows:o});f!=null&&(this.hydrateElements(l,d),this.setActiveMergeConflictState(f.actions,f.markerRows),je(this.pre,f.fileDiff,this.options.collapsed)||Oe(this.headerElement,f.fileDiff,this.options.disableFileHeader)?this.render({...n,preventEmit:!0}):(this.hydrationSetup({fileDiff:f.fileDiff,lineAnnotations:s}),this.pre!=null&&this.renderMergeConflictActionSlots()),a||this.emitPostRender())}rerender(){!this.enabled||this.fileDiff==null||this.render({forceRender:!0,renderRange:this.renderRange})}render(n={}){const{file:t,fileDiff:i,actions:r,markerRows:o,lineAnnotations:s,preventEmit:l=!1,...d}=n,a=this.getOrComputeDiff({file:t,fileDiff:i,actions:r,markerRows:o});if(a==null)return!1;this.setActiveMergeConflictState(a.actions,a.markerRows);const f=super.render({...d,fileDiff:a.fileDiff,lineAnnotations:s,preventEmit:!0});return f&&(this.renderMergeConflictActionSlots(),l||this.emitPostRender()),f}resolveConflict(n,t,i=this.computedCache.fileDiff){const r=this.conflictActions[n];if(i==null||r==null)return;if(r.conflictIndex!==n)throw console.error({conflictIndex:n,action:r}),new Error("UnresolvedFile.resolveConflict: conflictIndex and conflictAction don't match");const o=we(i,r,t),s=this.computedCache.file,{file:l,actions:d,markerRows:a}=ye({fileDiff:o,previousActions:this.conflictActions,resolvedConflictIndex:n,previousFile:s,resolution:t});return{file:l,fileDiff:o,actions:d,markerRows:a}}resolveConflictAndRender(n,t){const i=this.conflictActions[n];if(i==null)return;if(i.conflictIndex!==n)throw console.error({conflictIndex:n,action:i}),new Error("UnresolvedFile.resolveConflictAndRender: conflictIndex and conflictAction don't match");const r={resolution:t,conflict:i.conflict},{file:o,fileDiff:s,actions:l,markerRows:d}=this.resolveConflict(n,t)??{};o==null||s==null||l==null||d==null||(this.computedCache={file:o,fileDiff:s,actions:l,markerRows:d},this.setActiveMergeConflictState(l,d),this.workerManager!=null?this.hunksRenderer.renderDiff(s):this.render({forceRender:!0}),this.options.onMergeConflictResolve?.(o,r))}setActiveMergeConflictState(n=this.conflictActions,t=this.markerRows){this.conflictActions=n,this.markerRows=t,this.computedCache.fileDiff!=null&&this.hunksRenderer instanceof _&&this.hunksRenderer.setConflictState(this.options.mergeConflictActionsType==="none"?[]:n,t,this.computedCache.fileDiff)}handleMergeConflictActionClick=n=>{const t=this.conflictActions[n.conflictIndex];if(t==null)return;if(t.conflictIndex!==n.conflictIndex)throw console.error({conflictIndex:n.conflictIndex,action:t}),new Error("UnresolvedFile.handleMergeConflictActionClick: conflictIndex and conflictAction don't match");const i={resolution:n.resolution,conflict:t.conflict};if(this.options.onMergeConflictAction!=null){this.options.onMergeConflictAction(i,this);return}this.resolveConflictAndRender(n.conflictIndex,n.resolution)};renderMergeConflictActionSlots(){const{fileDiff:n}=this.computedCache;if(this.isContainerManaged||this.fileContainer==null||typeof this.options.mergeConflictActionsType!="function"||this.conflictActions.length===0||n==null){this.clearMergeConflictActionCache();return}const t=new Map(this.conflictActionCache);for(let i=0;i<this.conflictActions.length;i++){const r=this.conflictActions[i];if(r==null)continue;if(r.conflictIndex!==i)throw console.error({conflictIndex:i,action:r}),new Error("UnresolvedFile.renderMergeConflictActionSlots: conflictIndex and conflictAction don't match");const o=J(r,n);if(o==null)continue;const s=r.conflictIndex,l=Q({hunkIndex:o.hunkIndex,lineIndex:o.lineIndex,conflictIndex:s}),d=`${i}-${l}`;let a=this.conflictActionCache.get(d);if(a==null||!ge(a.action,r)){a?.element.remove();const f=this.renderMergeConflictAction(r);if(f==null)continue;const h=ee(l);h.appendChild(f),this.fileContainer.appendChild(h),a={element:h,action:r},this.conflictActionCache.set(d,a)}t.delete(d)}for(const[i,{element:r}]of t.entries())this.conflictActionCache.delete(i),r.remove()}renderMergeConflictAction(n){if(typeof this.options.mergeConflictActionsType!="function")return;const t=this.options.mergeConflictActionsType(n,this);if(t!=null){if(t instanceof HTMLElement)return t;if(typeof DocumentFragment<"u"&&t instanceof DocumentFragment){const i=document.createElement("div");return i.style.display="contents",i.appendChild(t),i}}}clearMergeConflictActionCache(){for(const{element:n}of this.conflictActionCache.values())n.remove();this.conflictActionCache.clear()}};function ye({fileDiff:e,previousActions:n,resolvedConflictIndex:t,previousFile:i,resolution:r}){const o=n[t];if(o==null)throw new Error("rebuildFileAndActions: missing resolved action for unresolved file rebuild");const s=Ee(n,t,o,r),l=ue(e,s);return{file:Se({fileDiff:e,resolvedAction:o,resolvedConflictIndex:t,previousFile:i,resolution:r}),actions:s,markerRows:l}}function Se({resolvedAction:e,resolvedConflictIndex:n,previousFile:t,fileDiff:i,resolution:r}){const o=fe(t?.contents??""),{conflict:s}=e,l=be(o,s,r),d=[...o.slice(0,s.startLineIndex),...l,...o.slice(s.endLineIndex+1)].join("");return{name:t?.name??i.name,contents:d,cacheKey:t?.cacheKey!=null?`${t.cacheKey}:mc-${n}-${r}`:void 0}}function be(e,n,t){const i=e.slice(n.startLineIndex+1,n.baseMarkerLineIndex??n.separatorLineIndex),r=e.slice(n.separatorLineIndex+1,n.endLineIndex);return t==="current"?i:t==="incoming"?r:[...i,...r]}function Ee(e,n,t,i){const r=Fe(t.conflict,i);return e.map((o,s)=>{if(s!==n&&o!=null)return o.conflict.startLineIndex>t.conflict.endLineIndex?{...o,conflict:Ne(o.conflict,r)}:o})}function Fe(e,n){const t=(e.baseMarkerLineIndex??e.separatorLineIndex)-e.startLineIndex-1,i=e.endLineIndex-e.separatorLineIndex-1;return(n==="current"?t:n==="incoming"?i:t+i)-(e.endLineIndex-e.startLineIndex+1)}function Ne(e,n){return{...e,startLineIndex:e.startLineIndex+n,startLineNumber:e.startLineNumber+n,separatorLineIndex:e.separatorLineIndex+n,separatorLineNumber:e.separatorLineNumber+n,endLineIndex:e.endLineIndex+n,endLineNumber:e.endLineNumber+n,baseMarkerLineIndex:e.baseMarkerLineIndex!=null?e.baseMarkerLineIndex+n:void 0,baseMarkerLineNumber:e.baseMarkerLineNumber!=null?e.baseMarkerLineNumber+n:void 0}}function je(e,n,t=!1){return!t&&e==null&&n!=null}function Oe(e,n,t=!1){return e==null&&n!=null&&!t}function Te(e,n){const t={...n,...e};return{...t,useTokenTransformer:ne(t),hunkSeparators:typeof e?.hunkSeparators=="function"?"custom":e?.hunkSeparators,mergeConflictActionsType:typeof e?.mergeConflictActionsType=="function"?"custom":e?.mergeConflictActionsType}}const Ue=typeof window>"u"?k.useEffect:k.useLayoutEffect;function $e({file:e,options:n,lineAnnotations:t,selectedLines:i,prerenderedHTML:r,hasConflictUtility:o,hasGutterRenderUtility:s,hasCustomHeader:l,disableWorkerPool:d}){const[{fileDiff:a,actions:f,markerRows:h},u]=k.useState(()=>{const{fileDiff:c,actions:m,markerRows:C}=b(e,n?.maxContextLines);return{fileDiff:c,actions:m,markerRows:C}}),L=H((c,m)=>{u(C=>{const{fileDiff:v,actions:F,markerRows:N}=m.resolveConflict(c.conflict.conflictIndex,c.resolution,C.fileDiff)??{};return v==null||F==null||N==null?C:{fileDiff:v,actions:F,markerRows:N}})}),A=i!==void 0,I=k.useContext(te),p=k.useRef(null),x=H(c=>{if(c!=null){if(p.current!=null)throw new Error("useUnresolvedFileInstance: An instance should not already exist when a node is created");p.current=new Me(q({controlledSelection:A,hasConflictUtility:o,hasCustomHeader:l,hasGutterRenderUtility:s,onMergeConflictAction:L,options:n}),d?void 0:I,!0),p.current.hydrate({fileDiff:a,actions:f,markerRows:h,fileContainer:c,lineAnnotations:t,prerenderedHTML:r})}else{if(p.current==null)throw new Error("useUnresolvedFileInstance: A UnresolvedFile instance should exist when unmounting");p.current.cleanUp(),p.current=null}});return Ue(()=>{if(p.current==null)return;const c=p.current,m=q({controlledSelection:A,hasConflictUtility:o,hasCustomHeader:l,hasGutterRenderUtility:s,onMergeConflictAction:L,options:n}),C=m!==void 0&&!ie(c.options,m);c.setOptions(m),c.render({fileDiff:a,actions:f,markerRows:h,lineAnnotations:t,forceRender:C}),i!==void 0&&c.setSelectedLines(i)}),{ref:x,getHoveredLine:k.useCallback(()=>p.current?.getHoveredLine(),[]),fileDiff:a,actions:f,markerRows:h,getInstance:k.useCallback(()=>p.current??void 0,[])}}function q({options:e,controlledSelection:n,onMergeConflictAction:t,hasConflictUtility:i,hasCustomHeader:r,hasGutterRenderUtility:o}){return{...e,controlledSelection:n,onMergeConflictAction:t,hunkSeparators:e?.hunkSeparators==="custom"?R:e?.hunkSeparators,mergeConflictActionsType:i||e?.mergeConflictActionsType==="custom"?R:e?.mergeConflictActionsType,renderCustomHeader:r?R:void 0,renderGutterUtility:o?R:void 0}}function Pe({file:e,options:n,lineAnnotations:t,selectedLines:i,className:r,style:o,prerenderedHTML:s,renderAnnotation:l,renderCustomHeader:d,renderHeaderPrefix:a,renderHeaderFilenameSuffix:f,renderHeaderMetadata:h,renderGutterUtility:u,renderMergeConflictUtility:L,disableWorkerPool:A=!1}){const{ref:I,getHoveredLine:p,fileDiff:x,actions:c,getInstance:m}=$e({file:e,options:n,lineAnnotations:t,selectedLines:i,prerenderedHTML:s,hasConflictUtility:L!=null,hasGutterRenderUtility:u!=null,hasCustomHeader:d!=null,disableWorkerPool:A});return g.jsx(ce,{ref:I,className:r,style:o,children:oe(he({fileDiff:x,renderCustomHeader:d,renderHeaderPrefix:a,renderHeaderFilenameSuffix:f,renderHeaderMetadata:h,renderAnnotation:l,renderGutterUtility:u,lineAnnotations:t,getHoveredLine:p,actions:c,renderMergeConflictUtility:L,getInstance:m}),s)})}function He(e){return{draft:e,persistedContent:e,revision:0}}function _e(e,n){return n===e.draft?e:{...e,draft:n,revision:e.revision+1}}function Be(e,n){return e.persistedContent===n?e:{...e,persistedContent:n}}function We(e,n){return n===e.persistedContent?e:{draft:n,persistedContent:n,revision:e.revision+1}}function dn(e){return g.jsx(re,{children:g.jsx("div",{className:"viewer-transition",children:e.kind==="diff"?g.jsx(Ge,{...e}):g.jsx(Ke,{file:e.file,themeType:e.themeType,overflow:e.overflow,onUpdate:e.onUpdate,onResolve:e.onResolve},e.file.path)},e.contentKey)})}function Ge({contentKey:e,value:n,diffView:t,themeType:i,wrapLines:r,initiallyCollapsed:o,compact:s,scopeControl:l,onDiffViewChange:d,onWrapLinesChange:a,onClose:f}){return g.jsx(pe,{contentKey:e,diff:n,diffView:t,themeType:i,wrapLines:r,initiallyCollapsed:o,compact:s,scopeControl:l,onDiffViewChange:d,onWrapLinesChange:a,onClose:f},e)}function Ke({file:e,themeType:n,overflow:t,onUpdate:i,onResolve:r}){const[o,s]=k.useState(()=>He(e.content)),[l,d]=k.useState(!1),[a,f]=k.useState(!1),h=o.draft,u=o.revision,L=ze(h);k.useEffect(()=>{s(p=>We(p,e.content))},[e.content]);const A=async(p,x)=>{if(l)return;d(!0);const c=o,m=qe(h,p,x);s(C=>_e(C,m));try{await i(e.path,m)?s(C=>Be(C,m)):s(C=>C.draft===m?c:C)}finally{d(!1)}},I=async()=>{if(!(L>0||a)){f(!0);try{await r(e.path,h)}finally{f(!1)}}};return g.jsxs("div",{className:"conflict-viewer",children:[g.jsxs("div",{className:"conflict-viewer-toolbar",children:[g.jsxs("div",{children:[g.jsx("strong",{children:"Conflict resolution"}),g.jsx("span",{children:L>0?`${L} ${L===1?"pending block":"pending blocks"}`:"All blocks are resolved"})]}),g.jsx(D,{size:"sm",disabled:L>0||a,onClick:()=>{I()},children:a?"Saving…":"Mark as resolved"})]}),g.jsx(se,{className:"viewer-scroll",contentClassName:"viewer-content",children:L>0?g.jsx(Pe,{file:{name:e.path,lang:$(e.path),contents:h,cacheKey:`${e.path}:conflict:${u}`},disableWorkerPool:h.length>5e5,options:{themeType:n,theme:U,diffIndicators:"classic",overflow:t,mergeConflictActionsType:"none",unsafeCSS:T},renderMergeConflictUtility:p=>g.jsxs("div",{className:"conflict-actions",children:[g.jsx(D,{size:"xs",variant:"outline",disabled:l,onClick:()=>{A(p.conflict,"current")},children:"Accept current"}),g.jsx(D,{size:"xs",variant:"outline",disabled:l,onClick:()=>{A(p.conflict,"incoming")},children:"Accept incoming"}),g.jsx(D,{size:"xs",variant:"outline",disabled:l,onClick:()=>{A(p.conflict,"both")},children:"Accept both"})]})},`${e.path}:${u}`):g.jsx(le,{file:{name:e.path,lang:$(e.path),contents:h,cacheKey:`${e.path}:resolved:${u}`},options:{themeType:n,theme:U,overflow:t,unsafeCSS:T}})})]})}function ze(e){return e.split(/\r?\n/).filter(n=>/^<{7}(?: |$)/.test(n)).length}function qe(e,n,t){const i=e.match(/[^\n]*\n|[^\n]+$/g)??[],r=i.slice(n.startLineIndex+1,n.baseMarkerLineIndex??n.separatorLineIndex),o=i.slice(n.separatorLineIndex+1,n.endLineIndex),s=t==="current"?r:t==="incoming"?o:[...r,...o];return[...i.slice(0,n.startLineIndex),...s,...i.slice(n.endLineIndex+1)].join("")}export{dn as default};
|
package/dist/client/assets/{PierreEditBoundary-mxtF7x3F.js → PierreEditBoundary-DlGd1pqO.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{_ as l,s as E,r as f}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BzmFkR37.js","assets/platform-Bqt97_Jr.js","assets/index-BgLrS_2D.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as l,s as E,r as f}from"./index-DAUK3rnz.js";import{r as o,j as i}from"./react-rd22PHbN.js";import{E as c}from"./EditContext-CvJWfVl1.js";import{E as d}from"./edit-ready-context-D77R8XU8.js";import"./tanstack-B0Sf7wNU.js";import"./base-ui-CJ8ZIx3d.js";function C({enabled:s,children:a}){const[r,n]=o.useState(null);o.useEffect(()=>{if(!s||r)return;let e=!0;return l(()=>import("./index-BzmFkR37.js"),__vite__mapDeps([0,1,2])).then(t=>{e&&n(()=>t.Editor)}).catch(t=>{e&&E.error({title:"Could not load the code editor",description:t instanceof Error?t.message:"Unknown error"})}),()=>{e=!1}},[r,s]);const u=o.useCallback(e=>{if(!r)throw new Error("Pierre edit mode has not loaded.");return new r({clipboard:{readText:()=>f()},...e})},[r]);return r?i.jsx(c,{createEditor:u,children:i.jsx(d.Provider,{value:!0,children:a})}):i.jsx(d.Provider,{value:!1,children:a})}export{C as PierreEditBoundary};
|