@inkeep/open-knowledge 0.30.1 → 0.30.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/assets/skills/discovery/SKILL.md +1 -1
  2. package/dist/assets/skills/project/SKILL.md +1 -1
  3. package/dist/cli.mjs +7 -7
  4. package/dist/constants-KPTyVFV8.mjs +2 -0
  5. package/dist/{dist-BXlA66Rv.mjs → dist-CmLjR_Cj.mjs} +5 -5
  6. package/dist/{dist-MZRC45Vk.mjs → dist-DxYTuPk3.mjs} +1 -1
  7. package/dist/{gh-detect-BAop1ZEi.mjs → gh-detect-Dvi-l8Fu.mjs} +2 -2
  8. package/dist/index.mjs +1 -1
  9. package/dist/{init-D4BfioBb.mjs → init-C3-tMyGu.mjs} +3 -3
  10. package/dist/init-DFr8pToX.mjs +1 -0
  11. package/dist/{launch-json-removal-CUy2T3Uq.mjs → launch-json-removal-BLUsKChe.mjs} +2 -2
  12. package/dist/loader-DwcZjA-t.mjs +1 -0
  13. package/dist/{loader-BxXL_zFb.mjs → loader-f4c1taQz.mjs} +2 -2
  14. package/dist/{open-browser-c8D-FzSc.mjs → open-browser-7LbUetO3.mjs} +2 -2
  15. package/dist/preview-DbnyxVMM.mjs +1 -0
  16. package/dist/{preview-D955wcsg.mjs → preview-DocBavwZ.mjs} +2 -2
  17. package/dist/public/assets/{ActivityModeContent-Ck8qdJCp.js → ActivityModeContent-CvscUOlB.js} +1 -1
  18. package/dist/public/assets/CodeMirrorPropInput-GWGwbu-Z.js +3 -0
  19. package/dist/public/assets/DocumentContext-Dl32cms8.js +35 -0
  20. package/dist/public/assets/{EnableSyncConfirmDialog-CWfJC2tV.js → EnableSyncConfirmDialog-84rkuitb.js} +1 -1
  21. package/dist/public/assets/{GraphPanel-64dKrEeN.js → GraphPanel-CJcaT4ZV.js} +1 -1
  22. package/dist/public/assets/{ManagedArtifactProperties-w28ZuUXh.js → ManagedArtifactProperties-BchMXJov.js} +1 -1
  23. package/dist/public/assets/{McpConsentDialogBody-CBhFj_dO.js → McpConsentDialogBody-CIA51kgu.js} +1 -1
  24. package/dist/public/assets/{MermaidDocEditor-DHYDIKqN.js → MermaidDocEditor-DBwiC1Iv.js} +1 -1
  25. package/dist/public/assets/PropertyPanel-Cm9QPZIM.js +2 -0
  26. package/dist/public/assets/{SettingsDialogBody-BN5WnNHe.js → SettingsDialogBody-CoRSU9Td.js} +2 -2
  27. package/dist/public/assets/{ShareBranchSwitchDialog-BlhZ6hTx.js → ShareBranchSwitchDialog-BenQyIEd.js} +1 -1
  28. package/dist/public/assets/{ShareReceiveDialog-L3wJj8ez.js → ShareReceiveDialog-DWYhHOXw.js} +1 -1
  29. package/dist/public/assets/{ShareReceiveMissDialog-D6rKf26E.js → ShareReceiveMissDialog-CPsNjXmy.js} +1 -1
  30. package/dist/public/assets/{SkillEditorActions-DAfDDMK2.js → SkillEditorActions-CODXEDz3.js} +1 -1
  31. package/dist/public/assets/SourceEditor-vePDOFlu.js +1 -0
  32. package/dist/public/assets/{TerminalPanel-CFfN7G5Q.js → TerminalPanel-CR5UcwIn.js} +1 -1
  33. package/dist/public/assets/{agent-presence-DiQ_l3Q4.js → agent-presence-DKQJl08k.js} +1 -1
  34. package/dist/public/assets/{auth-state-cache-Bbu2EA_L.js → auth-state-cache-BIPktuPk.js} +3 -3
  35. package/dist/public/assets/{config-provider-DON2sTkv.js → config-provider-dZze7ypK.js} +1 -1
  36. package/dist/public/assets/{dist-cAytzZ0r.js → dist-BtuJEC9v.js} +126 -126
  37. package/dist/public/assets/{dist-CUDp0fN-.js → dist-C71V3z3d.js} +2 -2
  38. package/dist/public/assets/{doc-hash-KGQoVCvb.js → doc-hash-Ce3LmfP6.js} +1 -1
  39. package/dist/public/assets/{documents-events-BnMDLvDB.js → documents-events-BzQ1LRmI.js} +1 -1
  40. package/dist/public/assets/external-link-DvDOavYT.js +1 -0
  41. package/dist/public/assets/{file-tree-adapter-uHXxUJ8g.js → file-tree-adapter-BoRujkp5.js} +1 -1
  42. package/dist/public/assets/index-CKB7bl9B.js +2003 -0
  43. package/dist/public/assets/{keyboard-shortcuts-bJc2PBGE.js → keyboard-shortcuts-B5l045PW.js} +1 -1
  44. package/dist/public/assets/{navigation-targets-DdhO6GKu.js → navigation-targets-XC4PBjfz.js} +1 -1
  45. package/dist/public/assets/{open-managed-artifact-tab-qxJ9p8Vi.js → open-managed-artifact-tab-DA0lLz1S.js} +1 -1
  46. package/dist/public/assets/{pending-receive-nav-store-v67LB7tS.js → pending-receive-nav-store-lNMDQCmC.js} +1 -1
  47. package/dist/public/assets/{prop-types-Dkcm5cUg.js → prop-types-CbtJ1iyP.js} +1 -1
  48. package/dist/public/assets/{receive-store-CtqQYghY.js → receive-store-BaQla7GO.js} +1 -1
  49. package/dist/public/assets/selection-context-Q-Ojx168.js +4 -0
  50. package/dist/public/assets/{skill-actions-HpoN1bS5.js → skill-actions-D2II4Qq4.js} +1 -1
  51. package/dist/public/assets/{skills-api-Dg6gQ9CV.js → skills-api-bbofiqW7.js} +1 -1
  52. package/dist/public/assets/{src-BYPkKUxg.js → src-DHOupE17.js} +1 -1
  53. package/dist/public/assets/{target-navigation-intent-DhT4boi_.js → target-navigation-intent-Bs-B8CMa.js} +1 -1
  54. package/dist/public/assets/{typing-burst-detector-DDRKfxpo.js → typing-burst-detector-CBiF5H7t.js} +2 -2
  55. package/dist/public/assets/{workspace-paths-DYS2c17l.js → workspace-paths-BBX7G5gP.js} +1 -1
  56. package/dist/public/index.html +26 -26
  57. package/dist/{repair-launch-json-DhbI-EMz.mjs → repair-launch-json-DFFNAgt4.mjs} +2 -2
  58. package/dist/{repair-mcp-configs-CnzHinK5.mjs → repair-mcp-configs-C_cIyZxQ.mjs} +2 -2
  59. package/dist/repair-skills-C4SUGawj.mjs +1 -0
  60. package/dist/{repair-skills-BwUGllKc.mjs → repair-skills-DRQ6zPpF.mjs} +2 -2
  61. package/dist/server-lock-GuuouVft-xGs0zrNQ.mjs +1 -0
  62. package/dist/{server-lock-iLcBw_q0-WEyo7ukm.mjs → server-lock-iLcBw_q0-6FEAZKHu.mjs} +42 -42
  63. package/dist/{src-Okq2zd7b.mjs → src-DPqsMpTr.mjs} +2 -2
  64. package/dist/start-BA1WmaQA.mjs +1 -0
  65. package/dist/{start-DX2HzLUg.mjs → start-DX3p80qb.mjs} +2 -2
  66. package/dist/{write-project-skill-dxucK8PX.mjs → write-project-skill-fM8HWeYm.mjs} +2 -2
  67. package/package.json +1 -1
  68. package/dist/constants-DqOw6mgQ.mjs +0 -2
  69. package/dist/init-CRAt_4qx.mjs +0 -1
  70. package/dist/loader-DcbDRtIj.mjs +0 -1
  71. package/dist/preview-B12077GC.mjs +0 -1
  72. package/dist/public/assets/CodeMirrorPropInput-Cqy5AMG8.js +0 -3
  73. package/dist/public/assets/DocumentContext-BmXknE_D.js +0 -35
  74. package/dist/public/assets/PropertyPanel-Cd7DFfct.js +0 -2
  75. package/dist/public/assets/SourceEditor-DnBDsIm6.js +0 -1
  76. package/dist/public/assets/external-link-BjECE2gH.js +0 -1
  77. package/dist/public/assets/index-CPErFLv2.js +0 -2003
  78. package/dist/public/assets/selection-context-C3RRsPiK.js +0 -4
  79. package/dist/repair-skills-BAEDb9Ho.mjs +0 -1
  80. package/dist/server-lock-GuuouVft-uqSUkxXo.mjs +0 -1
  81. package/dist/start-DBJrdH80.mjs +0 -1
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{n as i,r as a}from"./dist-CQw2y-s3.js";import{t as o}from"./button-cneJOVxD.js";import{t as ee}from"./git-branch-q0qWPEwd.js";import{t as s}from"./loader-circle-B7Gv_Djz.js";import{n as c,t as te}from"./miss-dialog-store-PJQ_kr0I.js";import{n as l}from"./dist-CoyydoqN.js";import{a as ne,c as re,i as ie,n as ae,o as u,s as oe,t as se}from"./dialog-DdHaoAGK.js";import{t as d}from"./desktop-bridge-types-NXCK8Pd7.js";import{a as f,n as ce}from"./receive-store-CtqQYghY.js";import{t as le}from"./share-metadata-rows-BttnPmuW.js";var p=e(t(),1),m=r();function ue(e){let t=e.shareTargetExists,n=e.dirtyConflicts.conflicts,r=e.dirtyConflicts.files;return t&&!n?{kind:`A`,openCurrentEnabled:!0,switchEnabled:!0,conflictingFiles:r}:!t&&!n?{kind:`B`,openCurrentEnabled:!1,switchEnabled:!0,conflictingFiles:r}:t&&n?{kind:`C`,openCurrentEnabled:!0,switchEnabled:!1,conflictingFiles:r}:{kind:`D`,openCurrentEnabled:!1,switchEnabled:!1,conflictingFiles:r}}function de(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function h(e){if(e.ok)return{action:`await-cc1`};switch(e.reason){case`dirty-conflict`:return{action:`rerender-conflict`,files:e.files??[]};case`branch-not-found`:return{action:`dismiss-with-toast`,reason:`branch-not-found`};case`fetch-failed`:case`checkout-failed`:return{action:`stay-with-toast`,reason:e.reason};case`branch-in-other-worktree`:{let t=e.otherWorktreePath;return t===void 0||t.length===0?{action:`stay-with-toast`,reason:`checkout-failed`}:{action:`pivot-to-other-worktree`,otherWorktreePath:t}}case`ff-diverged`:return{action:`branch-diverged`};default:{let t=e.reason;throw Error(`Unhandled CheckoutFailureReason: ${String(t)}`)}}}var fe={phase:`loading`};function pe(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function me(e,t){return e.phase!==`ready`&&e.phase!==`verdict`?e:{phase:`switching`,info:e.info,pendingDoc:t}}function he(e){return ue(e).kind===`B`&&e.shareTargetOnOriginBranch===!1}function ge(e){return e.phase===`ready`?{phase:`verdict-pending`,info:e.info}:e}function _e(e,t){if(e.phase!==`verdict-pending`)return e;if(t===null||t.verdict===`unknown`||t.verdict===`changed-locally`)return{phase:`ready`,info:e.info};let n=t.verdict===`renamed`?{kind:`renamed`,renamedTo:t.renamedTo}:{kind:t.verdict};return{phase:`verdict`,info:e.info,resolution:n}}function ve(e,t){if(e.phase!==`switching`)return{state:e};if(t===null)return{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}};let n=h(t);return n.action===`await-cc1`?{state:{phase:`awaiting-cc1-recycle`,pendingDoc:e.pendingDoc}}:n.action===`rerender-conflict`?{state:{phase:`ready`,info:{...e.info,dirtyConflicts:{conflicts:!0,files:n.files.slice()}}}}:n.action===`pivot-to-other-worktree`?{state:{phase:`branch-in-other-worktree`,info:e.info,otherWorktreePath:n.otherWorktreePath,pendingDoc:e.pendingDoc}}:n.action===`dismiss-with-toast`?{state:{phase:`dismissed`,reason:n.reason},sideEffect:{kind:`toast`,reason:n.reason}}:n.action===`branch-diverged`?{state:{phase:`verdict`,info:e.info,resolution:{kind:`diverged`}}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:n.reason}}}var g=n();function ye(e){return e!==null&&e.kind===`project-branch-switch`}function _(e){let t=(0,m.c)(184),{bridge:n,store:r}=e,h=r===void 0?ce:r,{_}=a(),v=(0,p.useSyncExternalStore)(h.subscribe,h.getSnapshot,Ee),[y,b]=(0,p.useState)(fe),De=(0,p.useRef)(!1),Oe=(0,p.useRef)(!1),ke=(0,p.useRef)(!1),Ae=(0,p.useRef)(null),je;t[0]===v?je=t[1]:(je=ye(v)?v:null,t[0]=v,t[1]=je);let x=je,Me;t[2]!==_||t[3]!==x?.share.target.kind?(Me=x?.share.target.kind===`folder`?_({id:`ugoTXs`}):_({id:`XH30C4`}),t[2]=_,t[3]=x?.share.target.kind,t[4]=Me):Me=t[4];let S=Me,C;t[5]===x?C=t[6]:(C=()=>{b(fe),De.current=!1,Oe.current=!1,ke.current=!1,Ae.current=x},t[5]=x,t[6]=C);let Ne;t[7]===v?Ne=t[8]:(Ne=[v],t[7]=v,t[8]=Ne),(0,p.useEffect)(C,Ne);let Pe;t[9]!==x||t[10]!==n?(Pe=()=>{if(!x||De.current)return;De.current=!0;let e=!1;return n.project.fetchBranchInfo({projectPath:x.projectPath,branch:x.share.branch,kind:x.share.target.kind,path:d(x.share.target)}).then(t=>{e||b(e=>pe(e,t))}).catch(t=>{e||(console.warn(`[receive] branch-info-fetch-failed`,t instanceof Error?t.message:t),b(Te))}),()=>{e=!0}},t[9]=x,t[10]=n,t[11]=Pe):Pe=t[11];let Fe;t[12]===x?Fe=t[13]:(Fe=[x],t[12]=x,t[13]=Fe),(0,p.useEffect)(Pe,Fe);let Ie;t[14]!==x||t[15]!==y.info||t[16]!==y.phase||t[17]!==n?(Ie=()=>{if(!x||y.phase!==`ready`||ke.current||!he(y.info))return;ke.current=!0,b(ge);let e=x;n.project.fetchTargetStatus({projectPath:x.projectPath,branch:x.share.branch,kind:x.share.target.kind,path:d(x.share.target)}).then(t=>{Ae.current===e&&b(e=>_e(e,t))}).catch(t=>{Ae.current===e&&(console.warn(`[receive] target-status-fetch-failed`,t instanceof Error?t.message:t),b(we))})},t[14]=x,t[15]=y.info,t[16]=y.phase,t[17]=n,t[18]=Ie):Ie=t[18];let Le;t[19]!==x||t[20]!==y.phase?(Le=[y.phase,x],t[19]=x,t[20]=y.phase,t[21]=Le):Le=t[21],(0,p.useEffect)(Ie,Le);let Re;t[22]!==x||t[23]!==y.phase||t[24]!==y.resolution||t[25]!==h?(Re=()=>{if(y.phase!==`verdict`)return;let{kind:e}=y.resolution;e!==`deleted`&&e!==`never-on-branch`||x&&(te.arm({kind:x.share.target.kind,path:d(x.share.target),branch:x.share.branch}),h.dismiss())},t[22]=x,t[23]=y.phase,t[24]=y.resolution,t[25]=h,t[26]=Re):Re=t[26];let ze;t[27]!==x||t[28]!==y||t[29]!==h?(ze=[y,x,h],t[27]=x,t[28]=y,t[29]=h,t[30]=ze):ze=t[30],(0,p.useEffect)(Re,ze);let Be;t[31]!==_||t[32]!==x||t[33]!==y.pendingDoc||t[34]!==y.phase||t[35]!==n||t[36]!==h||t[37]!==S?(Be=()=>{if(y.phase!==`awaiting-cc1-recycle`||!x)return;let e=x.share.branch,t=y.pendingDoc;if(!e){h.dismiss();return}if(Oe.current)return;Oe.current=!0;let r=!1;return n.project.awaitBranchSwitched({projectPath:x.projectPath,branch:e,timeoutMs:3e4}).then(i=>{if(!r){if(i.ok){console.log(f({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:x.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:x.share.target.kind,path:t},pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),l.error(_({id:`gQV-9w`,values:{targetNoun:S}}))}),h.dismiss();return}console.log(f({branch_dialog_action:`branch-switch-timeout`,branch:e})),l.error(_({id:`LBwUR6`,values:{targetNoun:S}})),h.dismiss()}}).catch(e=>{r||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),l.error(_({id:`Jw6EC4`,values:{targetNoun:S}})),h.dismiss())}),()=>{r=!0}},t[31]=_,t[32]=x,t[33]=y.pendingDoc,t[34]=y.phase,t[35]=n,t[36]=h,t[37]=S,t[38]=Be):Be=t[38];let Ve;if(t[39]!==x||t[40]!==y.phase?(Ve=[y.phase,x],t[39]=x,t[40]=y.phase,t[41]=Ve):Ve=t[41],(0,p.useEffect)(Be,Ve),!x)return null;let{share:w,projectPath:T,currentBranch:E}=x,D=w.branch,O;t[42]!==_||t[43]!==n.project||t[44]!==T||t[45]!==D||t[46]!==h?(O=function(e,t){console.log(f({branch_dialog_action:`switch`,branch_action:`switch`,branch:D})),b(t=>me(t,e)),n.project.runCheckout(t?{projectPath:T,branch:D,fastForward:!0}:{projectPath:T,branch:D}).then(e=>{let t=null,n=!1;b(r=>{let{state:i,sideEffect:a}=ve(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?l.error(_({id:`NJyQi_`,values:{shareBranch:D}})):t===`fetch-failed`?l.error(_({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&l.error(_({id:`c863eW`,values:{shareBranch:D}})),n&&h.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),b(Ce),l.error(_({id:`c863eW`,values:{shareBranch:D}}))})},t[42]=_,t[43]=n.project,t[44]=T,t[45]=D,t[46]=h,t[47]=O):O=t[47];let k=O,He;t[48]!==y.info||t[49]!==y.phase||t[50]!==k||t[51]!==w.target?(He=function(){y.phase===`ready`&&ue(y.info).switchEnabled&&k(d(w.target),!1)},t[48]=y.info,t[49]=y.phase,t[50]=k,t[51]=w.target,t[52]=He):He=t[52];let Ue=He,We;t[53]!==y.phase||t[54]!==k||t[55]!==w.target?(We=function(){y.phase===`verdict`&&k(d(w.target),!0)},t[53]=y.phase,t[54]=k,t[55]=w.target,t[56]=We):We=t[56];let Ge=We,Ke;t[57]!==y.phase||t[58]!==y.resolution||t[59]!==k?(Ke=function(){y.phase===`verdict`&&y.resolution.kind===`renamed`&&k(y.resolution.renamedTo,!0)},t[57]=y.phase,t[58]=y.resolution,t[59]=k,t[60]=Ke):Ke=t[60];let qe=Ke,Je;t[61]!==y.phase||t[62]!==k||t[63]!==w.target?(Je=function(){y.phase===`verdict`&&k(d(w.target),!1)},t[61]=y.phase,t[62]=k,t[63]=w.target,t[64]=Je):Je=t[64];let Ye=Je,Xe;t[65]!==_||t[66]!==n.project||t[67]!==T||t[68]!==w.target||t[69]!==D||t[70]!==h||t[71]!==S?(Xe=function(){console.log(f({branch_dialog_action:`open-current`,branch:D})),n.project.open({path:T,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:w.target.kind,path:d(w.target)}}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),l.error(_({id:`b5aNbi`,values:{targetNoun:S}}))}),h.dismiss()},t[65]=_,t[66]=n.project,t[67]=T,t[68]=w.target,t[69]=D,t[70]=h,t[71]=S,t[72]=Xe):Xe=t[72];let Ze=Xe,Qe;t[73]!==_||t[74]!==y.otherWorktreePath||t[75]!==y.phase||t[76]!==n.project||t[77]!==w.target||t[78]!==D||t[79]!==h?(Qe=function(){if(y.phase!==`branch-in-other-worktree`)return;let e=y.otherWorktreePath;console.log(f({branch_dialog_action:`pivot-to-other-worktree`,branch:D})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:w.target.kind,path:d(w.target)},pendingBranch:D}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),l.error(_({id:`LdABLa`,values:{target:e}}))}),h.dismiss()},t[73]=_,t[74]=y.otherWorktreePath,t[75]=y.phase,t[76]=n.project,t[77]=w.target,t[78]=D,t[79]=h,t[80]=Qe):Qe=t[80];let $e=Qe,et;t[81]===h?et=t[82]:(et=function(){console.log(f({branch_dialog_action:`cancel`})),h.dismiss()},t[81]=h,t[82]=et);let A=et,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K,q;if(t[83]!==_||t[84]!==y.info||t[85]!==y.otherWorktreePath||t[86]!==y.phase||t[87]!==y.resolution||t[88]!==A||t[89]!==E||t[90]!==w.branch||t[91]!==w.owner||t[92]!==w.repo||t[93]!==w.target||t[94]!==D||t[95]!==S){q=y.phase===`ready`||y.phase===`switching`?ue(y.info):null;let e;t[113]!==y.info||t[114]!==y.phase||t[115]!==E?(e=y.phase===`ready`||y.phase===`switching`?de(y.info):E??`HEAD`,t[113]=y.info,t[114]=y.phase,t[115]=E,t[116]=e):e=t[116];let n=e;I=y.phase===`switching`||y.phase===`awaiting-cc1-recycle`;let r;t[117]===_?r=t[118]:(r=_({id:`OuY8t9`}),t[117]=_,t[118]=r),P=r;let a;t[119]!==_||t[120]!==D?(a=_({id:`_BthEY`,values:{shareBranch:D}}),t[119]=_,t[120]=D,t[121]=a):a=t[121],F=a;let o=y.phase===`loading`,ee=y.phase===`error`;N=se,G=!0,t[122]===A?K=t[123]:(K=e=>{e||A()},t[122]=A,t[123]=K),M=ie,B=`sm:max-w-xl`,V=`share-branch-switch-dialog`,H=Se,U=xe;let c;t[124]===S?c=t[125]:(c=(0,g.jsx)(re,{children:(0,g.jsx)(i,{id:`RY6Bq1`,values:{targetNoun:S}})}),t[124]=S,t[125]=c);let te=w.owner,l=w.repo,u;t[126]===w.target?u=t[127]:(u=d(w.target),t[126]=w.target,t[127]=u);let f;t[128]!==w.owner||t[129]!==w.repo||t[130]!==u?(f=(0,g.jsx)(ne,{className:`sr-only`,children:(0,g.jsx)(i,{id:`f8jU-L`,values:{0:te,1:l,2:u}})}),t[128]=w.owner,t[129]=w.repo,t[130]=u,t[131]=f):f=t[131],t[132]!==c||t[133]!==f?(W=(0,g.jsxs)(oe,{children:[c,f]}),t[132]=c,t[133]=f,t[134]=W):W=t[134],j=ae;let ce=w.owner,p=w.repo,m;t[135]===w.target?m=t[136]:(m=d(w.target),t[135]=w.target,t[136]=m),t[137]!==w.branch||t[138]!==w.owner||t[139]!==w.repo||t[140]!==w.target.kind||t[141]!==m?(L=(0,g.jsx)(`div`,{className:`mb-4`,children:(0,g.jsx)(le,{owner:ce,repo:p,path:m,kind:w.target.kind,branch:w.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[137]=w.branch,t[138]=w.owner,t[139]=w.repo,t[140]=w.target.kind,t[141]=m,t[142]=L):L=t[142],R=y.phase===`branch-in-other-worktree`?(0,g.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,g.jsx)(`p`,{className:`leading-6`,children:(0,g.jsx)(i,{id:`yjExfe`,values:{shareBranch:D},components:{0:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,g.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:y.otherWorktreePath})]}):y.phase===`verdict-pending`?(0,g.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-pending`,role:`status`,"aria-live":`polite`,children:[(0,g.jsx)(s,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,g.jsx)(i,{id:`c8jBgX`})]}):y.phase===`verdict`?y.resolution.kind===`on-origin`?(0,g.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-on-origin`,children:(0,g.jsx)(i,{id:`Uay5NL`,values:{targetNoun:S,shareBranch:D},components:{0:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):y.resolution.kind===`renamed`?(0,g.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-renamed`,children:(0,g.jsx)(i,{id:`P0HC30`,values:{0:y.resolution.renamedTo,targetNoun:S},components:{0:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):y.resolution.kind===`diverged`?(0,g.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-diverged`,children:(0,g.jsx)(i,{id:`kLv8d3`,values:{shareBranch:D,targetNoun:S},components:{0:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,g.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-handoff`,role:`status`,"aria-live":`polite`,children:[(0,g.jsx)(s,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,g.jsx)(i,{id:`c8jBgX`})]}):o?(0,g.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-loading`,role:`status`,"aria-live":`polite`,children:[(0,g.jsx)(s,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,g.jsx)(i,{id:`jerqF0`})]}):ee?(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,g.jsx)(i,{id:`w4hMYl`})}):q?.kind===`D`?(0,g.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,g.jsx)(i,{id:`XnoA1k`,values:{targetNoun:S,shareBranch:D},components:{0:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):q?.kind===`B`?(0,g.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,g.jsx)(i,{id:`sZ2IOu`,values:{targetNoun:S,shareBranch:D,currentLabel:n},components:{0:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,g.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,g.jsx)(i,{id:`_902BE`,values:{targetNoun:S,shareBranch:D,currentLabel:n},components:{0:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),z=q&&!q.switchEnabled&&q.conflictingFiles.length>0?(0,g.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm`,"data-testid":`share-branch-switch-conflict`,children:[(0,g.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,g.jsx)(i,{id:`n2lRue`})}),(0,g.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:q.conflictingFiles.map(be)})]}):null,t[83]=_,t[84]=y.info,t[85]=y.otherWorktreePath,t[86]=y.phase,t[87]=y.resolution,t[88]=A,t[89]=E,t[90]=w.branch,t[91]=w.owner,t[92]=w.repo,t[93]=w.target,t[94]=D,t[95]=S,t[96]=j,t[97]=M,t[98]=N,t[99]=P,t[100]=F,t[101]=I,t[102]=L,t[103]=R,t[104]=z,t[105]=B,t[106]=V,t[107]=H,t[108]=U,t[109]=W,t[110]=G,t[111]=K,t[112]=q}else j=t[96],M=t[97],N=t[98],P=t[99],F=t[100],I=t[101],L=t[102],R=t[103],z=t[104],B=t[105],V=t[106],H=t[107],U=t[108],W=t[109],G=t[110],K=t[111],q=t[112];let J;t[143]===I?J=t[144]:(J=I?(0,g.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-switching`,role:`status`,"aria-live":`polite`,children:[(0,g.jsx)(s,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,g.jsx)(i,{id:`CU3AiE`})]}):null,t[143]=I,t[144]=J);let Y;t[145]!==j||t[146]!==L||t[147]!==R||t[148]!==z||t[149]!==J?(Y=(0,g.jsxs)(j,{children:[L,R,z,J]}),t[145]=j,t[146]=L,t[147]=R,t[148]=z,t[149]=J,t[150]=Y):Y=t[150];let tt;t[151]===Symbol.for(`react.memo_cache_sentinel`)?(tt=(0,g.jsx)(i,{id:`dEgA5A`}),t[151]=tt):tt=t[151];let X;t[152]===A?X=t[153]:(X=(0,g.jsx)(o,{variant:`ghost`,className:`font-mono uppercase`,onClick:A,"data-testid":`share-branch-switch-cancel`,children:tt}),t[152]=A,t[153]=X);let Z;t[154]!==y.phase||t[155]!==y.resolution||t[156]!==Ze||t[157]!==qe||t[158]!==$e||t[159]!==Ye||t[160]!==Ue||t[161]!==Ge||t[162]!==P||t[163]!==F||t[164]!==I||t[165]!==q?(Z=y.phase===`branch-in-other-worktree`?(0,g.jsx)(o,{onClick:$e,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,g.jsx)(i,{id:`hyCxJY`})}):y.phase===`verdict`?y.resolution.kind===`on-origin`?(0,g.jsxs)(o,{onClick:Ge,"data-testid":`share-branch-switch-verdict-switch-update`,children:[(0,g.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),(0,g.jsx)(i,{id:`uA_jXp`})]}):y.resolution.kind===`renamed`?(0,g.jsxs)(o,{onClick:qe,"data-testid":`share-branch-switch-verdict-open-renamed`,children:[(0,g.jsx)(c,{className:`size-3.5`,"aria-hidden":!0}),(0,g.jsx)(i,{id:`AItsE5`})]}):y.resolution.kind===`diverged`?(0,g.jsxs)(o,{onClick:Ye,"data-testid":`share-branch-switch-verdict-plain-switch`,children:[(0,g.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),F]}):null:(0,g.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:gap-2`,children:[q?.openCurrentEnabled?(0,g.jsxs)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:Ze,disabled:I,"data-testid":`share-branch-switch-open-current`,children:[(0,g.jsx)(c,{className:`size-3.5`,"aria-hidden":!0}),P]}):null,(0,g.jsx)(o,{onClick:Ue,disabled:!q?.switchEnabled||I,"aria-disabled":!q?.switchEnabled||I,"aria-describedby":q&&!q.switchEnabled&&q.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:I?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(s,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),F]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),F]})})]}),t[154]=y.phase,t[155]=y.resolution,t[156]=Ze,t[157]=qe,t[158]=$e,t[159]=Ye,t[160]=Ue,t[161]=Ge,t[162]=P,t[163]=F,t[164]=I,t[165]=q,t[166]=Z):Z=t[166];let Q;t[167]!==X||t[168]!==Z?(Q=(0,g.jsxs)(u,{className:`sm:justify-between`,children:[X,Z]}),t[167]=X,t[168]=Z,t[169]=Q):Q=t[169];let $;t[170]!==M||t[171]!==B||t[172]!==V||t[173]!==H||t[174]!==U||t[175]!==W||t[176]!==Y||t[177]!==Q?($=(0,g.jsxs)(M,{className:B,"data-testid":V,onInteractOutside:H,onPointerDownOutside:U,children:[W,Y,Q]}),t[170]=M,t[171]=B,t[172]=V,t[173]=H,t[174]=U,t[175]=W,t[176]=Y,t[177]=Q,t[178]=$):$=t[178];let nt;return t[179]!==N||t[180]!==G||t[181]!==K||t[182]!==$?(nt=(0,g.jsx)(N,{open:G,onOpenChange:K,children:$}),t[179]=N,t[180]=G,t[181]=K,t[182]=$,t[183]=nt):nt=t[183],nt}function be(e){return(0,g.jsx)(`li`,{children:(0,g.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function xe(e){e.preventDefault()}function Se(e){e.preventDefault()}function Ce(e){return ve(e,null).state}function we(e){return _e(e,null)}function Te(e){return pe(e,null)}function Ee(){return null}export{_ as ShareBranchSwitchDialog};
1
+ import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{n as i,r as a}from"./dist-CQw2y-s3.js";import{t as o}from"./button-cneJOVxD.js";import{t as ee}from"./git-branch-q0qWPEwd.js";import{t as s}from"./loader-circle-B7Gv_Djz.js";import{n as c,t as te}from"./miss-dialog-store-PJQ_kr0I.js";import{n as l}from"./dist-CoyydoqN.js";import{a as ne,c as re,i as ie,n as ae,o as u,s as oe,t as se}from"./dialog-DdHaoAGK.js";import{t as d}from"./desktop-bridge-types-NXCK8Pd7.js";import{a as f,n as ce}from"./receive-store-BaQla7GO.js";import{t as le}from"./share-metadata-rows-BttnPmuW.js";var p=e(t(),1),m=r();function ue(e){let t=e.shareTargetExists,n=e.dirtyConflicts.conflicts,r=e.dirtyConflicts.files;return t&&!n?{kind:`A`,openCurrentEnabled:!0,switchEnabled:!0,conflictingFiles:r}:!t&&!n?{kind:`B`,openCurrentEnabled:!1,switchEnabled:!0,conflictingFiles:r}:t&&n?{kind:`C`,openCurrentEnabled:!0,switchEnabled:!1,conflictingFiles:r}:{kind:`D`,openCurrentEnabled:!1,switchEnabled:!1,conflictingFiles:r}}function de(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function h(e){if(e.ok)return{action:`await-cc1`};switch(e.reason){case`dirty-conflict`:return{action:`rerender-conflict`,files:e.files??[]};case`branch-not-found`:return{action:`dismiss-with-toast`,reason:`branch-not-found`};case`fetch-failed`:case`checkout-failed`:return{action:`stay-with-toast`,reason:e.reason};case`branch-in-other-worktree`:{let t=e.otherWorktreePath;return t===void 0||t.length===0?{action:`stay-with-toast`,reason:`checkout-failed`}:{action:`pivot-to-other-worktree`,otherWorktreePath:t}}case`ff-diverged`:return{action:`branch-diverged`};default:{let t=e.reason;throw Error(`Unhandled CheckoutFailureReason: ${String(t)}`)}}}var fe={phase:`loading`};function pe(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function me(e,t){return e.phase!==`ready`&&e.phase!==`verdict`?e:{phase:`switching`,info:e.info,pendingDoc:t}}function he(e){return ue(e).kind===`B`&&e.shareTargetOnOriginBranch===!1}function ge(e){return e.phase===`ready`?{phase:`verdict-pending`,info:e.info}:e}function _e(e,t){if(e.phase!==`verdict-pending`)return e;if(t===null||t.verdict===`unknown`||t.verdict===`changed-locally`)return{phase:`ready`,info:e.info};let n=t.verdict===`renamed`?{kind:`renamed`,renamedTo:t.renamedTo}:{kind:t.verdict};return{phase:`verdict`,info:e.info,resolution:n}}function ve(e,t){if(e.phase!==`switching`)return{state:e};if(t===null)return{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}};let n=h(t);return n.action===`await-cc1`?{state:{phase:`awaiting-cc1-recycle`,pendingDoc:e.pendingDoc}}:n.action===`rerender-conflict`?{state:{phase:`ready`,info:{...e.info,dirtyConflicts:{conflicts:!0,files:n.files.slice()}}}}:n.action===`pivot-to-other-worktree`?{state:{phase:`branch-in-other-worktree`,info:e.info,otherWorktreePath:n.otherWorktreePath,pendingDoc:e.pendingDoc}}:n.action===`dismiss-with-toast`?{state:{phase:`dismissed`,reason:n.reason},sideEffect:{kind:`toast`,reason:n.reason}}:n.action===`branch-diverged`?{state:{phase:`verdict`,info:e.info,resolution:{kind:`diverged`}}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:n.reason}}}var g=n();function ye(e){return e!==null&&e.kind===`project-branch-switch`}function _(e){let t=(0,m.c)(184),{bridge:n,store:r}=e,h=r===void 0?ce:r,{_}=a(),v=(0,p.useSyncExternalStore)(h.subscribe,h.getSnapshot,Ee),[y,b]=(0,p.useState)(fe),De=(0,p.useRef)(!1),Oe=(0,p.useRef)(!1),ke=(0,p.useRef)(!1),Ae=(0,p.useRef)(null),je;t[0]===v?je=t[1]:(je=ye(v)?v:null,t[0]=v,t[1]=je);let x=je,Me;t[2]!==_||t[3]!==x?.share.target.kind?(Me=x?.share.target.kind===`folder`?_({id:`ugoTXs`}):_({id:`XH30C4`}),t[2]=_,t[3]=x?.share.target.kind,t[4]=Me):Me=t[4];let S=Me,C;t[5]===x?C=t[6]:(C=()=>{b(fe),De.current=!1,Oe.current=!1,ke.current=!1,Ae.current=x},t[5]=x,t[6]=C);let Ne;t[7]===v?Ne=t[8]:(Ne=[v],t[7]=v,t[8]=Ne),(0,p.useEffect)(C,Ne);let Pe;t[9]!==x||t[10]!==n?(Pe=()=>{if(!x||De.current)return;De.current=!0;let e=!1;return n.project.fetchBranchInfo({projectPath:x.projectPath,branch:x.share.branch,kind:x.share.target.kind,path:d(x.share.target)}).then(t=>{e||b(e=>pe(e,t))}).catch(t=>{e||(console.warn(`[receive] branch-info-fetch-failed`,t instanceof Error?t.message:t),b(Te))}),()=>{e=!0}},t[9]=x,t[10]=n,t[11]=Pe):Pe=t[11];let Fe;t[12]===x?Fe=t[13]:(Fe=[x],t[12]=x,t[13]=Fe),(0,p.useEffect)(Pe,Fe);let Ie;t[14]!==x||t[15]!==y.info||t[16]!==y.phase||t[17]!==n?(Ie=()=>{if(!x||y.phase!==`ready`||ke.current||!he(y.info))return;ke.current=!0,b(ge);let e=x;n.project.fetchTargetStatus({projectPath:x.projectPath,branch:x.share.branch,kind:x.share.target.kind,path:d(x.share.target)}).then(t=>{Ae.current===e&&b(e=>_e(e,t))}).catch(t=>{Ae.current===e&&(console.warn(`[receive] target-status-fetch-failed`,t instanceof Error?t.message:t),b(we))})},t[14]=x,t[15]=y.info,t[16]=y.phase,t[17]=n,t[18]=Ie):Ie=t[18];let Le;t[19]!==x||t[20]!==y.phase?(Le=[y.phase,x],t[19]=x,t[20]=y.phase,t[21]=Le):Le=t[21],(0,p.useEffect)(Ie,Le);let Re;t[22]!==x||t[23]!==y.phase||t[24]!==y.resolution||t[25]!==h?(Re=()=>{if(y.phase!==`verdict`)return;let{kind:e}=y.resolution;e!==`deleted`&&e!==`never-on-branch`||x&&(te.arm({kind:x.share.target.kind,path:d(x.share.target),branch:x.share.branch}),h.dismiss())},t[22]=x,t[23]=y.phase,t[24]=y.resolution,t[25]=h,t[26]=Re):Re=t[26];let ze;t[27]!==x||t[28]!==y||t[29]!==h?(ze=[y,x,h],t[27]=x,t[28]=y,t[29]=h,t[30]=ze):ze=t[30],(0,p.useEffect)(Re,ze);let Be;t[31]!==_||t[32]!==x||t[33]!==y.pendingDoc||t[34]!==y.phase||t[35]!==n||t[36]!==h||t[37]!==S?(Be=()=>{if(y.phase!==`awaiting-cc1-recycle`||!x)return;let e=x.share.branch,t=y.pendingDoc;if(!e){h.dismiss();return}if(Oe.current)return;Oe.current=!0;let r=!1;return n.project.awaitBranchSwitched({projectPath:x.projectPath,branch:e,timeoutMs:3e4}).then(i=>{if(!r){if(i.ok){console.log(f({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:x.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:x.share.target.kind,path:t},pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),l.error(_({id:`gQV-9w`,values:{targetNoun:S}}))}),h.dismiss();return}console.log(f({branch_dialog_action:`branch-switch-timeout`,branch:e})),l.error(_({id:`LBwUR6`,values:{targetNoun:S}})),h.dismiss()}}).catch(e=>{r||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),l.error(_({id:`Jw6EC4`,values:{targetNoun:S}})),h.dismiss())}),()=>{r=!0}},t[31]=_,t[32]=x,t[33]=y.pendingDoc,t[34]=y.phase,t[35]=n,t[36]=h,t[37]=S,t[38]=Be):Be=t[38];let Ve;if(t[39]!==x||t[40]!==y.phase?(Ve=[y.phase,x],t[39]=x,t[40]=y.phase,t[41]=Ve):Ve=t[41],(0,p.useEffect)(Be,Ve),!x)return null;let{share:w,projectPath:T,currentBranch:E}=x,D=w.branch,O;t[42]!==_||t[43]!==n.project||t[44]!==T||t[45]!==D||t[46]!==h?(O=function(e,t){console.log(f({branch_dialog_action:`switch`,branch_action:`switch`,branch:D})),b(t=>me(t,e)),n.project.runCheckout(t?{projectPath:T,branch:D,fastForward:!0}:{projectPath:T,branch:D}).then(e=>{let t=null,n=!1;b(r=>{let{state:i,sideEffect:a}=ve(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?l.error(_({id:`NJyQi_`,values:{shareBranch:D}})):t===`fetch-failed`?l.error(_({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&l.error(_({id:`c863eW`,values:{shareBranch:D}})),n&&h.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),b(Ce),l.error(_({id:`c863eW`,values:{shareBranch:D}}))})},t[42]=_,t[43]=n.project,t[44]=T,t[45]=D,t[46]=h,t[47]=O):O=t[47];let k=O,He;t[48]!==y.info||t[49]!==y.phase||t[50]!==k||t[51]!==w.target?(He=function(){y.phase===`ready`&&ue(y.info).switchEnabled&&k(d(w.target),!1)},t[48]=y.info,t[49]=y.phase,t[50]=k,t[51]=w.target,t[52]=He):He=t[52];let Ue=He,We;t[53]!==y.phase||t[54]!==k||t[55]!==w.target?(We=function(){y.phase===`verdict`&&k(d(w.target),!0)},t[53]=y.phase,t[54]=k,t[55]=w.target,t[56]=We):We=t[56];let Ge=We,Ke;t[57]!==y.phase||t[58]!==y.resolution||t[59]!==k?(Ke=function(){y.phase===`verdict`&&y.resolution.kind===`renamed`&&k(y.resolution.renamedTo,!0)},t[57]=y.phase,t[58]=y.resolution,t[59]=k,t[60]=Ke):Ke=t[60];let qe=Ke,Je;t[61]!==y.phase||t[62]!==k||t[63]!==w.target?(Je=function(){y.phase===`verdict`&&k(d(w.target),!1)},t[61]=y.phase,t[62]=k,t[63]=w.target,t[64]=Je):Je=t[64];let Ye=Je,Xe;t[65]!==_||t[66]!==n.project||t[67]!==T||t[68]!==w.target||t[69]!==D||t[70]!==h||t[71]!==S?(Xe=function(){console.log(f({branch_dialog_action:`open-current`,branch:D})),n.project.open({path:T,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:w.target.kind,path:d(w.target)}}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),l.error(_({id:`b5aNbi`,values:{targetNoun:S}}))}),h.dismiss()},t[65]=_,t[66]=n.project,t[67]=T,t[68]=w.target,t[69]=D,t[70]=h,t[71]=S,t[72]=Xe):Xe=t[72];let Ze=Xe,Qe;t[73]!==_||t[74]!==y.otherWorktreePath||t[75]!==y.phase||t[76]!==n.project||t[77]!==w.target||t[78]!==D||t[79]!==h?(Qe=function(){if(y.phase!==`branch-in-other-worktree`)return;let e=y.otherWorktreePath;console.log(f({branch_dialog_action:`pivot-to-other-worktree`,branch:D})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:w.target.kind,path:d(w.target)},pendingBranch:D}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),l.error(_({id:`LdABLa`,values:{target:e}}))}),h.dismiss()},t[73]=_,t[74]=y.otherWorktreePath,t[75]=y.phase,t[76]=n.project,t[77]=w.target,t[78]=D,t[79]=h,t[80]=Qe):Qe=t[80];let $e=Qe,et;t[81]===h?et=t[82]:(et=function(){console.log(f({branch_dialog_action:`cancel`})),h.dismiss()},t[81]=h,t[82]=et);let A=et,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K,q;if(t[83]!==_||t[84]!==y.info||t[85]!==y.otherWorktreePath||t[86]!==y.phase||t[87]!==y.resolution||t[88]!==A||t[89]!==E||t[90]!==w.branch||t[91]!==w.owner||t[92]!==w.repo||t[93]!==w.target||t[94]!==D||t[95]!==S){q=y.phase===`ready`||y.phase===`switching`?ue(y.info):null;let e;t[113]!==y.info||t[114]!==y.phase||t[115]!==E?(e=y.phase===`ready`||y.phase===`switching`?de(y.info):E??`HEAD`,t[113]=y.info,t[114]=y.phase,t[115]=E,t[116]=e):e=t[116];let n=e;I=y.phase===`switching`||y.phase===`awaiting-cc1-recycle`;let r;t[117]===_?r=t[118]:(r=_({id:`OuY8t9`}),t[117]=_,t[118]=r),P=r;let a;t[119]!==_||t[120]!==D?(a=_({id:`_BthEY`,values:{shareBranch:D}}),t[119]=_,t[120]=D,t[121]=a):a=t[121],F=a;let o=y.phase===`loading`,ee=y.phase===`error`;N=se,G=!0,t[122]===A?K=t[123]:(K=e=>{e||A()},t[122]=A,t[123]=K),M=ie,B=`sm:max-w-xl`,V=`share-branch-switch-dialog`,H=Se,U=xe;let c;t[124]===S?c=t[125]:(c=(0,g.jsx)(re,{children:(0,g.jsx)(i,{id:`RY6Bq1`,values:{targetNoun:S}})}),t[124]=S,t[125]=c);let te=w.owner,l=w.repo,u;t[126]===w.target?u=t[127]:(u=d(w.target),t[126]=w.target,t[127]=u);let f;t[128]!==w.owner||t[129]!==w.repo||t[130]!==u?(f=(0,g.jsx)(ne,{className:`sr-only`,children:(0,g.jsx)(i,{id:`f8jU-L`,values:{0:te,1:l,2:u}})}),t[128]=w.owner,t[129]=w.repo,t[130]=u,t[131]=f):f=t[131],t[132]!==c||t[133]!==f?(W=(0,g.jsxs)(oe,{children:[c,f]}),t[132]=c,t[133]=f,t[134]=W):W=t[134],j=ae;let ce=w.owner,p=w.repo,m;t[135]===w.target?m=t[136]:(m=d(w.target),t[135]=w.target,t[136]=m),t[137]!==w.branch||t[138]!==w.owner||t[139]!==w.repo||t[140]!==w.target.kind||t[141]!==m?(L=(0,g.jsx)(`div`,{className:`mb-4`,children:(0,g.jsx)(le,{owner:ce,repo:p,path:m,kind:w.target.kind,branch:w.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[137]=w.branch,t[138]=w.owner,t[139]=w.repo,t[140]=w.target.kind,t[141]=m,t[142]=L):L=t[142],R=y.phase===`branch-in-other-worktree`?(0,g.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,g.jsx)(`p`,{className:`leading-6`,children:(0,g.jsx)(i,{id:`yjExfe`,values:{shareBranch:D},components:{0:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,g.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:y.otherWorktreePath})]}):y.phase===`verdict-pending`?(0,g.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-pending`,role:`status`,"aria-live":`polite`,children:[(0,g.jsx)(s,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,g.jsx)(i,{id:`c8jBgX`})]}):y.phase===`verdict`?y.resolution.kind===`on-origin`?(0,g.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-on-origin`,children:(0,g.jsx)(i,{id:`Uay5NL`,values:{targetNoun:S,shareBranch:D},components:{0:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):y.resolution.kind===`renamed`?(0,g.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-renamed`,children:(0,g.jsx)(i,{id:`P0HC30`,values:{0:y.resolution.renamedTo,targetNoun:S},components:{0:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):y.resolution.kind===`diverged`?(0,g.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-diverged`,children:(0,g.jsx)(i,{id:`kLv8d3`,values:{shareBranch:D,targetNoun:S},components:{0:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,g.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-handoff`,role:`status`,"aria-live":`polite`,children:[(0,g.jsx)(s,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,g.jsx)(i,{id:`c8jBgX`})]}):o?(0,g.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-loading`,role:`status`,"aria-live":`polite`,children:[(0,g.jsx)(s,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,g.jsx)(i,{id:`jerqF0`})]}):ee?(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,g.jsx)(i,{id:`w4hMYl`})}):q?.kind===`D`?(0,g.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,g.jsx)(i,{id:`XnoA1k`,values:{targetNoun:S,shareBranch:D},components:{0:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):q?.kind===`B`?(0,g.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,g.jsx)(i,{id:`sZ2IOu`,values:{targetNoun:S,shareBranch:D,currentLabel:n},components:{0:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,g.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,g.jsx)(i,{id:`_902BE`,values:{targetNoun:S,shareBranch:D,currentLabel:n},components:{0:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),z=q&&!q.switchEnabled&&q.conflictingFiles.length>0?(0,g.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm`,"data-testid":`share-branch-switch-conflict`,children:[(0,g.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,g.jsx)(i,{id:`n2lRue`})}),(0,g.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:q.conflictingFiles.map(be)})]}):null,t[83]=_,t[84]=y.info,t[85]=y.otherWorktreePath,t[86]=y.phase,t[87]=y.resolution,t[88]=A,t[89]=E,t[90]=w.branch,t[91]=w.owner,t[92]=w.repo,t[93]=w.target,t[94]=D,t[95]=S,t[96]=j,t[97]=M,t[98]=N,t[99]=P,t[100]=F,t[101]=I,t[102]=L,t[103]=R,t[104]=z,t[105]=B,t[106]=V,t[107]=H,t[108]=U,t[109]=W,t[110]=G,t[111]=K,t[112]=q}else j=t[96],M=t[97],N=t[98],P=t[99],F=t[100],I=t[101],L=t[102],R=t[103],z=t[104],B=t[105],V=t[106],H=t[107],U=t[108],W=t[109],G=t[110],K=t[111],q=t[112];let J;t[143]===I?J=t[144]:(J=I?(0,g.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-switching`,role:`status`,"aria-live":`polite`,children:[(0,g.jsx)(s,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,g.jsx)(i,{id:`CU3AiE`})]}):null,t[143]=I,t[144]=J);let Y;t[145]!==j||t[146]!==L||t[147]!==R||t[148]!==z||t[149]!==J?(Y=(0,g.jsxs)(j,{children:[L,R,z,J]}),t[145]=j,t[146]=L,t[147]=R,t[148]=z,t[149]=J,t[150]=Y):Y=t[150];let tt;t[151]===Symbol.for(`react.memo_cache_sentinel`)?(tt=(0,g.jsx)(i,{id:`dEgA5A`}),t[151]=tt):tt=t[151];let X;t[152]===A?X=t[153]:(X=(0,g.jsx)(o,{variant:`ghost`,className:`font-mono uppercase`,onClick:A,"data-testid":`share-branch-switch-cancel`,children:tt}),t[152]=A,t[153]=X);let Z;t[154]!==y.phase||t[155]!==y.resolution||t[156]!==Ze||t[157]!==qe||t[158]!==$e||t[159]!==Ye||t[160]!==Ue||t[161]!==Ge||t[162]!==P||t[163]!==F||t[164]!==I||t[165]!==q?(Z=y.phase===`branch-in-other-worktree`?(0,g.jsx)(o,{onClick:$e,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,g.jsx)(i,{id:`hyCxJY`})}):y.phase===`verdict`?y.resolution.kind===`on-origin`?(0,g.jsxs)(o,{onClick:Ge,"data-testid":`share-branch-switch-verdict-switch-update`,children:[(0,g.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),(0,g.jsx)(i,{id:`uA_jXp`})]}):y.resolution.kind===`renamed`?(0,g.jsxs)(o,{onClick:qe,"data-testid":`share-branch-switch-verdict-open-renamed`,children:[(0,g.jsx)(c,{className:`size-3.5`,"aria-hidden":!0}),(0,g.jsx)(i,{id:`AItsE5`})]}):y.resolution.kind===`diverged`?(0,g.jsxs)(o,{onClick:Ye,"data-testid":`share-branch-switch-verdict-plain-switch`,children:[(0,g.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),F]}):null:(0,g.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:gap-2`,children:[q?.openCurrentEnabled?(0,g.jsxs)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:Ze,disabled:I,"data-testid":`share-branch-switch-open-current`,children:[(0,g.jsx)(c,{className:`size-3.5`,"aria-hidden":!0}),P]}):null,(0,g.jsx)(o,{onClick:Ue,disabled:!q?.switchEnabled||I,"aria-disabled":!q?.switchEnabled||I,"aria-describedby":q&&!q.switchEnabled&&q.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:I?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(s,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),F]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),F]})})]}),t[154]=y.phase,t[155]=y.resolution,t[156]=Ze,t[157]=qe,t[158]=$e,t[159]=Ye,t[160]=Ue,t[161]=Ge,t[162]=P,t[163]=F,t[164]=I,t[165]=q,t[166]=Z):Z=t[166];let Q;t[167]!==X||t[168]!==Z?(Q=(0,g.jsxs)(u,{className:`sm:justify-between`,children:[X,Z]}),t[167]=X,t[168]=Z,t[169]=Q):Q=t[169];let $;t[170]!==M||t[171]!==B||t[172]!==V||t[173]!==H||t[174]!==U||t[175]!==W||t[176]!==Y||t[177]!==Q?($=(0,g.jsxs)(M,{className:B,"data-testid":V,onInteractOutside:H,onPointerDownOutside:U,children:[W,Y,Q]}),t[170]=M,t[171]=B,t[172]=V,t[173]=H,t[174]=U,t[175]=W,t[176]=Y,t[177]=Q,t[178]=$):$=t[178];let nt;return t[179]!==N||t[180]!==G||t[181]!==K||t[182]!==$?(nt=(0,g.jsx)(N,{open:G,onOpenChange:K,children:$}),t[179]=N,t[180]=G,t[181]=K,t[182]=$,t[183]=nt):nt=t[183],nt}function be(e){return(0,g.jsx)(`li`,{children:(0,g.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function xe(e){e.preventDefault()}function Se(e){e.preventDefault()}function Ce(e){return ve(e,null).state}function we(e){return _e(e,null)}function Te(e){return pe(e,null)}function Ee(){return null}export{_ as ShareBranchSwitchDialog};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{n as i,r as a}from"./dist-CQw2y-s3.js";import{Gt as o,Ut as s}from"./dist-cAytzZ0r.js";import{t as c}from"./button-cneJOVxD.js";import{t as ee}from"./loader-circle-B7Gv_Djz.js";import{n as l}from"./dist-CoyydoqN.js";import{a as te,c as u,i as d,n as f,o as ne,s as p,t as m}from"./dialog-DdHaoAGK.js";import{t as h}from"./desktop-bridge-types-NXCK8Pd7.js";import{a as re,i as g,n as _,o as v,r as ie,s as y}from"./receive-store-CtqQYghY.js";import{t as ae}from"./share-metadata-rows-BttnPmuW.js";var b=e(t(),1),x=r(),S=e=>({phase:`ready`,seed:e});function C(e){return e.phase===`ready`?{phase:`initializing`,seed:e.seed}:e}function w(e,t){return e.phase===`initializing`?t.ok?{phase:`opening`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:t.reason,message:t.message}:e}function T(e,t){return e.phase===`opening`?t.ok?{phase:`done`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:`network-error`,message:t.message}:e}function E(e){return e.phase===`done`||e.phase===`cancelled`||e.phase===`error`?e:{phase:`cancelled`,seed:e.seed}}var D=n();function O(e){return e!==null&&e.kind===`launcher-consent`}function k(e){return e!==null&&e.kind===`launcher-miss`}function A(e){let t=(0,x.c)(14),{bridge:n,cloneController:r,store:i}=e,a=i===void 0?_:i,o=(0,b.useSyncExternalStore)(a.subscribe,a.getSnapshot,M),[s,c]=(0,b.useState)(0),[ee,te]=(0,b.useState)(o);o!==ee&&(te(o),c(j));let u,d;t[0]!==o||t[1]!==a?(u=()=>{if(!o)return;let e=y(o);e&&(l.error(e.message),a.dismiss())},d=[o,a],t[0]=o,t[1]=a,t[2]=u,t[3]=d):(u=t[2],d=t[3]),(0,b.useEffect)(u,d);let f;t[4]===o?f=t[5]:(f=k(o)?o:null,t[4]=o,t[5]=f);let ne=f,p;t[6]===o?p=t[7]:(p=O(o)?o:null,t[6]=o,t[7]=p);let m=p??ne;if(!m)return null;let h;return t[8]!==m||t[9]!==n||t[10]!==r||t[11]!==s||t[12]!==a?(h=(0,D.jsx)(N,{payload:m,bridge:n,cloneController:r,store:a},s),t[8]=m,t[9]=n,t[10]=r,t[11]=s,t[12]=a,t[13]=h):h=t[13],h}function j(e){return e+1}function M(){return null}function N(e){let t=(0,x.c)(165),{payload:n,bridge:r,cloneController:_,store:y}=e,{_:C}=a(),[E,A]=(0,b.useState)(!1),[j,M]=(0,b.useState)(null),[N,ue]=(0,b.useState)(!1),[F,de]=(0,b.useState)(!1),[I,fe]=(0,b.useState)(null),[L,R]=(0,b.useState)(null),pe=(0,b.useRef)(!1),me=(0,b.useRef)(null),he,ge;t[0]===I?(he=t[1],ge=t[2]):(he=()=>{I&&me.current?.focus()},ge=[I],t[0]=I,t[1]=he,t[2]=ge),(0,b.useEffect)(he,ge);let _e;t[3]!==L||t[4]!==n?(_e=()=>{O(n)&&L===null&&(console.warn(`[receive] q1_hit=true selection=branch_match_non_ok candidate=${n.candidatePath}`),R(S({candidatePath:n.candidatePath,branch:n.share.branch,targetPath:h(n.share.target),targetKind:n.share.target.kind,parentProjectName:n.parentProjectName})))},t[3]=L,t[4]=n,t[5]=_e):_e=t[5];let ve;t[6]===n?ve=t[7]:(ve=[n],t[6]=n,t[7]=ve),(0,b.useEffect)(_e,ve);let ye;t[8]!==j||t[9]!==_||t[10]!==n?(ye=()=>{_&&k(n)&&j===null&&(pe.current||(pe.current=!0,ue(!0),_.getAuthStatus().then(e=>{M(e)}).catch(e=>{console.warn(`[receive] auth pre-flight probe failed`,e instanceof Error?e.message:e),M({authenticated:!1,host:`github.com`})}).finally(()=>{ue(!1)})))},t[8]=j,t[9]=_,t[10]=n,t[11]=ye):ye=t[11];let be;t[12]!==j||t[13]!==n?(be=[n,j],t[12]=j,t[13]=n,t[14]=be):be=t[14],(0,b.useEffect)(ye,be);let z=k(n)?n:null,xe=O(n)?n:null,B=z?.share??xe?.share??null,V,H,U,W,G,Se,K,q;if(t[15]!==C||t[16]!==N||t[17]!==r||t[18]!==_||t[19]!==F||t[20]!==L||t[21]!==z||t[22]!==E||t[23]!==B||t[24]!==y){K=Symbol.for(`react.early_return_sentinel`);bb0:{let e=B?{owner:B.owner,repo:B.repo}:null,n;t[33]!==C||t[34]!==B?.target.kind?(n=B?.target.kind===`folder`?C({id:`ugoTXs`}):C({id:`XH30C4`}),t[33]=C,t[34]=B?.target.kind,t[35]=n):n=t[35],q=n,U=async function(){if(!z||!e)return;if(console.log(re({q2_path:`clone`})),!_){l.info(C({id:`27XW26`}),{action:{label:C({id:`B3NAZC`}),onClick:()=>{r.navigator.open()}},duration:8e3});return}if(F)return;fe(null),de(!0);let t=ie(e),n;try{n=await _.runClone({url:t,branch:z.share.branch})}catch(e){let t=e;console.warn(`[receive] runClone threw unexpectedly`,t),de(!1),fe({detail:t instanceof Error?t.message:String(t)});return}if(de(!1),n.kind===`error`){fe({detail:n.detail??null});return}if(n.kind===`ok`){try{await r.project.open({path:n.dir,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:z.share.target.kind,path:h(z.share.target)}}),y.dismiss()}catch(e){let t=e;console.warn(`[receive] project open after clone failed`,t instanceof Error?t.message:t),l.error(C({id:`438Fca`}))}return}};let a;t[36]!==C||t[37]!==N||t[38]!==_?(a=async function(){if(!(!_||N)){ue(!0);try{let e=await _.startSignIn();ue(!1),e!==null&&M(e)}catch(e){let t=e;ue(!1),console.warn(`[receive] startSignIn failed`,t instanceof Error?t.message:t),l.error(C({id:`lzwo7p`}))}}},t[36]=C,t[37]=N,t[38]=_,t[39]=a):a=t[39],G=a,W=async function(){if(!(!z||!e||E)){fe(null),A(!0),console.log(re({q2_path:`local`}));try{for(;;){let t=await r.dialog.openFolder();if(!t)break;let n=await r.share.validateLocalFolder({folderPath:t,owner:e.owner,repo:e.repo});if(console.log(re({folder_validate:n.kind})),n.kind===`ok`){let e=z.share.branch,n={currentBranch:null,headSha:null,detached:!1};try{n=await r.project.readHeadBranch(t)}catch(e){let t=e;console.warn(`[receive] local-folder readHeadBranch failed`,t instanceof Error?t.message:t)}let i=o(e,n)!==`true`;try{await r.project.open({path:t,target:`new-window`,entryPoint:`share-receive`,...i?{pendingShareBranchSwitch:{share:z.share,projectPath:t,currentBranch:n.currentBranch}}:{pendingDeepLinkTarget:{kind:z.share.target.kind,path:h(z.share.target)}}}),y.dismiss()}catch(e){let t=e;console.warn(`[receive] local-folder-open failed`,t instanceof Error?t.message:t),l.error(C({id:`phM8Kh`}))}break}let i=v(n,e);i&&l.error(i)}}catch(e){let t=e;console.warn(`[receive] local-folder-validate failed`,t instanceof Error?t.message:t),l.error(C({id:`rlUzXK`}))}A(!1)}};let g;t[40]!==C||t[41]!==r||t[42]!==L||t[43]!==y?(g=function(){if(L===null||L.phase!==`ready`)return;let e=L.seed;console.warn(`[receive] consent_dialog action=initialize worktree=${e.candidatePath}`),R(le),r.project.okInit({projectPath:e.candidatePath}).then(async t=>{if(t.ok===!0){R(e=>e===null?e:w(e,{ok:!0,projectPath:t.projectPath}));try{await r.project.open({path:t.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:e.targetKind,path:e.targetPath},pendingBranch:e.branch}),R(ce),y.dismiss()}catch(t){let n=t,r=n instanceof Error?n.message:String(n);R(e=>e===null?e:T(e,{ok:!1,message:r})),l.error(C({id:`nDT8qt`,values:{0:e.candidatePath}}))}return}let n=t.reason,i=t.message||`Initialization failed.`;R(e=>e===null?e:w(e,{ok:!1,reason:n,message:i})),l.error(i)}).catch(t=>{let n=t instanceof Error?t.message:String(t);R(e=>e===null?e:w(e,{ok:!1,reason:`network-error`,message:n})),l.error(C({id:`3Mwaly`,values:{0:e.candidatePath}}))})},t[40]=C,t[41]=r,t[42]=L,t[43]=y,t[44]=g):g=t[44];let b=g,x;t[45]!==L||t[46]!==y?(x=function(){L!==null&&console.warn(`[receive] consent_dialog action=cancel worktree=${L.seed.candidatePath}`),R(P),y.dismiss()},t[45]=L,t[46]=y,t[47]=x):x=t[47];let S=x;if(L!==null&&L.phase!==`cancelled`&&L.phase!==`done`&&B!==null){let e=L.seed,n=L.phase===`initializing`||L.phase===`opening`,r;t[48]===S?r=t[49]:(r=e=>{e||S()},t[48]=S,t[49]=r);let a;t[50]===q?a=t[51]:(a=(0,D.jsx)(u,{children:(0,D.jsx)(i,{id:`RY6Bq1`,values:{targetNoun:q}})}),t[50]=q,t[51]=a);let o;t[52]===B.target?o=t[53]:(o=h(B.target)?`— ${h(B.target)}`:``,t[52]=B.target,t[53]=o);let s;t[54]!==B.owner||t[55]!==B.repo||t[56]!==o?(s=(0,D.jsx)(te,{className:`sr-only`,children:(0,D.jsx)(i,{id:`pgq_xf`,values:{0:B.owner,1:B.repo,2:o}})}),t[54]=B.owner,t[55]=B.repo,t[56]=o,t[57]=s):s=t[57];let l=B.owner,re=B.repo,g;t[58]===B.target?g=t[59]:(g=h(B.target),t[58]=B.target,t[59]=g);let _;t[60]!==B.branch||t[61]!==B.owner||t[62]!==B.repo||t[63]!==B.target.kind||t[64]!==g?(_=(0,D.jsx)(ae,{owner:l,repo:re,path:g,kind:B.target.kind,branch:B.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[60]=B.branch,t[61]=B.owner,t[62]=B.repo,t[63]=B.target.kind,t[64]=g,t[65]=_):_=t[65];let v;t[66]!==a||t[67]!==s||t[68]!==_?(v=(0,D.jsxs)(p,{children:[a,s,_]}),t[66]=a,t[67]=s,t[68]=_,t[69]=v):v=t[69];let ie;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,D.jsx)(i,{id:`KsAPaB`})}),t[70]=ie):ie=t[70];let y;t[71]===e.candidatePath?y=t[72]:(y=(0,D.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-receive-consent-path`,children:e.candidatePath}),t[71]=e.candidatePath,t[72]=y);let x;t[73]===e.parentProjectName?x=t[74]:(x=e.parentProjectName===null?null:(0,D.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,"data-testid":`share-receive-consent-parent`,children:(0,D.jsx)(i,{id:`JmfgFc`,values:{0:e.parentProjectName}})}),t[73]=e.parentProjectName,t[74]=x);let C;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,D.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,D.jsx)(i,{id:`w7SsvI`})}),t[75]=C):C=t[75];let w;t[76]!==L.message||t[77]!==L.phase?(w=L.phase===`error`?(0,D.jsx)(`p`,{className:`mt-3 text-sm text-destructive`,"data-testid":`share-receive-consent-error`,role:`alert`,children:L.message}):null,t[76]=L.message,t[77]=L.phase,t[78]=w):w=t[78];let T;t[79]!==y||t[80]!==x||t[81]!==w?(T=(0,D.jsxs)(f,{children:[ie,y,x,C,w]}),t[79]=y,t[80]=x,t[81]=w,t[82]=T):T=t[82];let E;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,D.jsx)(i,{id:`dEgA5A`}),t[83]=E):E=t[83];let O;t[84]===S?O=t[85]:(O=(0,D.jsx)(c,{variant:`ghost`,onClick:S,"data-testid":`share-receive-consent-cancel`,children:E}),t[84]=S,t[85]=O);let k=n||L.phase===`error`,A=n||L.phase===`error`,j;t[86]===n?j=t[87]:(j=n?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(ee,{className:`mr-2 h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,D.jsx)(i,{id:`NKkZXl`})]}):(0,D.jsx)(i,{id:`NKkZXl`}),t[86]=n,t[87]=j);let M;t[88]!==b||t[89]!==k||t[90]!==A||t[91]!==j?(M=(0,D.jsx)(c,{onClick:b,disabled:k,"aria-disabled":A,"data-testid":`share-receive-consent-initialize`,children:j}),t[88]=b,t[89]=k,t[90]=A,t[91]=j,t[92]=M):M=t[92];let N;t[93]!==O||t[94]!==M?(N=(0,D.jsxs)(ne,{children:[O,M]}),t[93]=O,t[94]=M,t[95]=N):N=t[95];let P;t[96]!==v||t[97]!==T||t[98]!==N?(P=(0,D.jsxs)(d,{className:`sm:max-w-xl`,"data-testid":`share-receive-consent-dialog`,onInteractOutside:se,onPointerDownOutside:oe,children:[v,T,N]}),t[96]=v,t[97]=T,t[98]=N,t[99]=P):P=t[99];let ce;t[100]!==r||t[101]!==P?(ce=(0,D.jsx)(m,{open:!0,onOpenChange:r,children:P}),t[100]=r,t[101]=P,t[102]=ce):ce=t[102],K=ce;break bb0}if(!z||!B||!e){K=null;break bb0}V=_!==void 0&&!F;let O;t[103]!==C||t[104]!==F?(O=C(F?{id:`YjhKI5`}:{id:`LE7t79`}),t[103]=C,t[104]=F,t[105]=O):O=t[105],H=O,Se=s(e)}t[15]=C,t[16]=N,t[17]=r,t[18]=_,t[19]=F,t[20]=L,t[21]=z,t[22]=E,t[23]=B,t[24]=y,t[25]=V,t[26]=H,t[27]=U,t[28]=W,t[29]=G,t[30]=Se,t[31]=K,t[32]=q}else V=t[25],H=t[26],U=t[27],W=t[28],G=t[29],Se=t[30],K=t[31],q=t[32];if(K!==Symbol.for(`react.early_return_sentinel`))return K;let Ce=Se,we=j?.authenticated?j.login:void 0,Te;t[106]===I?Te=t[107]:(Te=I?.detail?g(I.detail):``,t[106]=I,t[107]=Te);let Ee=Te,J;t[108]===y?J=t[109]:(J=e=>{e||y.dismiss()},t[108]=y,t[109]=J);let Y;t[110]===q?Y=t[111]:(Y=(0,D.jsx)(u,{children:(0,D.jsx)(i,{id:`RY6Bq1`,values:{targetNoun:q}})}),t[110]=q,t[111]=Y);let X;t[112]===B.target?X=t[113]:(X=h(B.target)?` — ${h(B.target)}`:null,t[112]=B.target,t[113]=X);let Z;t[114]!==B.owner||t[115]!==B.repo||t[116]!==X?(Z=(0,D.jsxs)(te,{className:`sr-only`,children:[B.owner,`/`,B.repo,X]}),t[114]=B.owner,t[115]=B.repo,t[116]=X,t[117]=Z):Z=t[117];let De=B.owner,Oe=B.repo,Q;t[118]===B.target?Q=t[119]:(Q=h(B.target),t[118]=B.target,t[119]=Q);let ke;t[120]!==B.branch||t[121]!==B.owner||t[122]!==B.repo||t[123]!==B.target.kind||t[124]!==Q?(ke=(0,D.jsx)(ae,{owner:De,repo:Oe,path:Q,kind:B.target.kind,branch:B.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[120]=B.branch,t[121]=B.owner,t[122]=B.repo,t[123]=B.target.kind,t[124]=Q,t[125]=ke):ke=t[125];let Ae;t[126]!==Y||t[127]!==Z||t[128]!==ke?(Ae=(0,D.jsxs)(p,{children:[Y,Z,ke]}),t[126]=Y,t[127]=Z,t[128]=ke,t[129]=Ae):Ae=t[129];let $;t[130]!==_||t[131]!==V||t[132]!==I||t[133]!==Ee||t[134]!==H||t[135]!==F||t[136]!==U||t[137]!==W||t[138]!==E?($=I?(0,D.jsxs)(`div`,{ref:me,tabIndex:-1,className:`rounded-lg border border-destructive/40 bg-destructive/5 p-4 outline-none`,"data-testid":`share-receive-clone-error`,children:[(0,D.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,role:`alert`,children:(0,D.jsx)(i,{id:`aiArms`})}),Ee?(0,D.jsxs)(`p`,{className:`mt-2 break-words text-xs text-destructive`,"data-testid":`share-receive-clone-error-message`,children:[(0,D.jsx)(i,{id:`4BITzH`}),` `,(0,D.jsxs)(`span`,{className:`font-mono text-foreground/80`,children:[`"`,Ee,`"`]})]}):null,(0,D.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,D.jsx)(i,{id:`Llyqvo`})}),(0,D.jsxs)(`ul`,{className:`mt-1 list-disc space-y-1 pl-5 text-sm text-muted-foreground`,"data-testid":`share-receive-clone-error-reasons`,children:[(0,D.jsx)(`li`,{children:(0,D.jsx)(i,{id:`6LbUG7`})}),(0,D.jsx)(`li`,{children:(0,D.jsx)(i,{id:`_pY_Vq`})}),(0,D.jsx)(`li`,{children:(0,D.jsx)(i,{id:`J6mxC1`})})]}),(0,D.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,D.jsx)(c,{onClick:()=>{U()},"data-testid":`share-receive-clone-retry`,children:(0,D.jsx)(i,{id:`KDw4GX`})}),(0,D.jsx)(c,{variant:`outline`,onClick:()=>{W()},disabled:E||F,"data-testid":`share-receive-error-local`,children:(0,D.jsx)(i,{id:`xFQRu4`})})]})]}):(0,D.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,D.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-clone`,className:`flex flex-col items-start gap-2 rounded-lg border border-primary/50 bg-primary/5 p-4 text-left transition hover:border-primary hover:bg-primary/10 focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-primary/50 disabled:hover:bg-primary/5`,onClick:()=>{U()},disabled:_!==void 0&&!V,"aria-disabled":_!==void 0&&!V,children:[(0,D.jsx)(`span`,{className:`text-sm font-semibold`,children:H}),(0,D.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,D.jsx)(i,{id:`fj5YiP`})})]}),(0,D.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-local`,className:`flex flex-col items-start gap-2 rounded-lg border border-border bg-card p-4 text-left transition hover:border-foreground/50 hover:bg-accent focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,onClick:()=>{W()},disabled:E||F,children:[(0,D.jsx)(`span`,{className:`text-sm font-semibold`,children:(0,D.jsx)(i,{id:`HfI1dR`})}),(0,D.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,D.jsx)(i,{id:`_qD6mn`})})]})]}),t[130]=_,t[131]=V,t[132]=I,t[133]=Ee,t[134]=H,t[135]=F,t[136]=U,t[137]=W,t[138]=E,t[139]=$):$=t[139];let je;t[140]!==N||t[141]!==j||t[142]!==_||t[143]!==G||t[144]!==we?(je=_?(0,D.jsx)(`div`,{className:`mt-3 flex items-center justify-between rounded-md border border-border bg-muted/30 px-3 py-2 text-xs`,"data-testid":`share-receive-auth-banner`,role:`status`,"aria-live":`polite`,children:j===null?(0,D.jsx)(`span`,{className:`text-muted-foreground`,children:(0,D.jsx)(i,{id:`UDFrWm`})}):j.authenticated?(0,D.jsx)(`span`,{className:`text-muted-foreground`,children:(0,D.jsx)(i,{id:`VAHWL_`,values:{signedInLogin:we},components:{0:(0,D.jsx)(`span`,{className:`font-medium text-foreground/90`})}})}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{className:`text-muted-foreground`,children:(0,D.jsx)(i,{id:`SgKLfA`})}),(0,D.jsx)(`button`,{type:`button`,"data-testid":`share-receive-signin`,className:`font-medium text-primary underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded`,onClick:()=>{G()},disabled:N,children:N?(0,D.jsx)(i,{id:`PKLY-1`}):(0,D.jsx)(i,{id:`3jod3l`})})]})}):null,t[140]=N,t[141]=j,t[142]=_,t[143]=G,t[144]=we,t[145]=je):je=t[145];let Me;t[146]!==I||t[147]!==Ce?(Me=I?null:(0,D.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,D.jsx)(i,{id:`RJ3a8Z`,values:{lookingForUrl:Ce},components:{0:(0,D.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),t[146]=I,t[147]=Ce,t[148]=Me):Me=t[148];let Ne;t[149]!==$||t[150]!==je||t[151]!==Me?(Ne=(0,D.jsxs)(f,{children:[$,je,Me]}),t[149]=$,t[150]=je,t[151]=Me,t[152]=Ne):Ne=t[152];let Pe;t[153]===y?Pe=t[154]:(Pe=()=>y.dismiss(),t[153]=y,t[154]=Pe);let Fe;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,D.jsx)(i,{id:`dEgA5A`}),t[155]=Fe):Fe=t[155];let Ie;t[156]===Pe?Ie=t[157]:(Ie=(0,D.jsx)(ne,{children:(0,D.jsx)(c,{variant:`outline`,className:`font-mono uppercase`,onClick:Pe,children:Fe})}),t[156]=Pe,t[157]=Ie);let Le;t[158]!==Ae||t[159]!==Ne||t[160]!==Ie?(Le=(0,D.jsxs)(d,{className:`sm:max-w-xl`,"data-testid":`share-receive-dialog`,children:[Ae,Ne,Ie]}),t[158]=Ae,t[159]=Ne,t[160]=Ie,t[161]=Le):Le=t[161];let Re;return t[162]!==J||t[163]!==Le?(Re=(0,D.jsx)(m,{open:!0,onOpenChange:J,children:Le}),t[162]=J,t[163]=Le,t[164]=Re):Re=t[164],Re}function oe(e){return e.preventDefault()}function se(e){return e.preventDefault()}function P(e){return e===null?e:E(e)}function ce(e){return e===null?e:T(e,{ok:!0})}function le(e){return e===null?e:C(e)}export{A as ShareReceiveDialog};
1
+ import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{n as i,r as a}from"./dist-CQw2y-s3.js";import{Gt as o,Ut as s}from"./dist-BtuJEC9v.js";import{t as c}from"./button-cneJOVxD.js";import{t as ee}from"./loader-circle-B7Gv_Djz.js";import{n as l}from"./dist-CoyydoqN.js";import{a as te,c as u,i as d,n as f,o as ne,s as p,t as m}from"./dialog-DdHaoAGK.js";import{t as h}from"./desktop-bridge-types-NXCK8Pd7.js";import{a as re,i as g,n as _,o as v,r as ie,s as y}from"./receive-store-BaQla7GO.js";import{t as ae}from"./share-metadata-rows-BttnPmuW.js";var b=e(t(),1),x=r(),S=e=>({phase:`ready`,seed:e});function C(e){return e.phase===`ready`?{phase:`initializing`,seed:e.seed}:e}function w(e,t){return e.phase===`initializing`?t.ok?{phase:`opening`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:t.reason,message:t.message}:e}function T(e,t){return e.phase===`opening`?t.ok?{phase:`done`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:`network-error`,message:t.message}:e}function E(e){return e.phase===`done`||e.phase===`cancelled`||e.phase===`error`?e:{phase:`cancelled`,seed:e.seed}}var D=n();function O(e){return e!==null&&e.kind===`launcher-consent`}function k(e){return e!==null&&e.kind===`launcher-miss`}function A(e){let t=(0,x.c)(14),{bridge:n,cloneController:r,store:i}=e,a=i===void 0?_:i,o=(0,b.useSyncExternalStore)(a.subscribe,a.getSnapshot,M),[s,c]=(0,b.useState)(0),[ee,te]=(0,b.useState)(o);o!==ee&&(te(o),c(j));let u,d;t[0]!==o||t[1]!==a?(u=()=>{if(!o)return;let e=y(o);e&&(l.error(e.message),a.dismiss())},d=[o,a],t[0]=o,t[1]=a,t[2]=u,t[3]=d):(u=t[2],d=t[3]),(0,b.useEffect)(u,d);let f;t[4]===o?f=t[5]:(f=k(o)?o:null,t[4]=o,t[5]=f);let ne=f,p;t[6]===o?p=t[7]:(p=O(o)?o:null,t[6]=o,t[7]=p);let m=p??ne;if(!m)return null;let h;return t[8]!==m||t[9]!==n||t[10]!==r||t[11]!==s||t[12]!==a?(h=(0,D.jsx)(N,{payload:m,bridge:n,cloneController:r,store:a},s),t[8]=m,t[9]=n,t[10]=r,t[11]=s,t[12]=a,t[13]=h):h=t[13],h}function j(e){return e+1}function M(){return null}function N(e){let t=(0,x.c)(165),{payload:n,bridge:r,cloneController:_,store:y}=e,{_:C}=a(),[E,A]=(0,b.useState)(!1),[j,M]=(0,b.useState)(null),[N,ue]=(0,b.useState)(!1),[F,de]=(0,b.useState)(!1),[I,fe]=(0,b.useState)(null),[L,R]=(0,b.useState)(null),pe=(0,b.useRef)(!1),me=(0,b.useRef)(null),he,ge;t[0]===I?(he=t[1],ge=t[2]):(he=()=>{I&&me.current?.focus()},ge=[I],t[0]=I,t[1]=he,t[2]=ge),(0,b.useEffect)(he,ge);let _e;t[3]!==L||t[4]!==n?(_e=()=>{O(n)&&L===null&&(console.warn(`[receive] q1_hit=true selection=branch_match_non_ok candidate=${n.candidatePath}`),R(S({candidatePath:n.candidatePath,branch:n.share.branch,targetPath:h(n.share.target),targetKind:n.share.target.kind,parentProjectName:n.parentProjectName})))},t[3]=L,t[4]=n,t[5]=_e):_e=t[5];let ve;t[6]===n?ve=t[7]:(ve=[n],t[6]=n,t[7]=ve),(0,b.useEffect)(_e,ve);let ye;t[8]!==j||t[9]!==_||t[10]!==n?(ye=()=>{_&&k(n)&&j===null&&(pe.current||(pe.current=!0,ue(!0),_.getAuthStatus().then(e=>{M(e)}).catch(e=>{console.warn(`[receive] auth pre-flight probe failed`,e instanceof Error?e.message:e),M({authenticated:!1,host:`github.com`})}).finally(()=>{ue(!1)})))},t[8]=j,t[9]=_,t[10]=n,t[11]=ye):ye=t[11];let be;t[12]!==j||t[13]!==n?(be=[n,j],t[12]=j,t[13]=n,t[14]=be):be=t[14],(0,b.useEffect)(ye,be);let z=k(n)?n:null,xe=O(n)?n:null,B=z?.share??xe?.share??null,V,H,U,W,G,Se,K,q;if(t[15]!==C||t[16]!==N||t[17]!==r||t[18]!==_||t[19]!==F||t[20]!==L||t[21]!==z||t[22]!==E||t[23]!==B||t[24]!==y){K=Symbol.for(`react.early_return_sentinel`);bb0:{let e=B?{owner:B.owner,repo:B.repo}:null,n;t[33]!==C||t[34]!==B?.target.kind?(n=B?.target.kind===`folder`?C({id:`ugoTXs`}):C({id:`XH30C4`}),t[33]=C,t[34]=B?.target.kind,t[35]=n):n=t[35],q=n,U=async function(){if(!z||!e)return;if(console.log(re({q2_path:`clone`})),!_){l.info(C({id:`27XW26`}),{action:{label:C({id:`B3NAZC`}),onClick:()=>{r.navigator.open()}},duration:8e3});return}if(F)return;fe(null),de(!0);let t=ie(e),n;try{n=await _.runClone({url:t,branch:z.share.branch})}catch(e){let t=e;console.warn(`[receive] runClone threw unexpectedly`,t),de(!1),fe({detail:t instanceof Error?t.message:String(t)});return}if(de(!1),n.kind===`error`){fe({detail:n.detail??null});return}if(n.kind===`ok`){try{await r.project.open({path:n.dir,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:z.share.target.kind,path:h(z.share.target)}}),y.dismiss()}catch(e){let t=e;console.warn(`[receive] project open after clone failed`,t instanceof Error?t.message:t),l.error(C({id:`438Fca`}))}return}};let a;t[36]!==C||t[37]!==N||t[38]!==_?(a=async function(){if(!(!_||N)){ue(!0);try{let e=await _.startSignIn();ue(!1),e!==null&&M(e)}catch(e){let t=e;ue(!1),console.warn(`[receive] startSignIn failed`,t instanceof Error?t.message:t),l.error(C({id:`lzwo7p`}))}}},t[36]=C,t[37]=N,t[38]=_,t[39]=a):a=t[39],G=a,W=async function(){if(!(!z||!e||E)){fe(null),A(!0),console.log(re({q2_path:`local`}));try{for(;;){let t=await r.dialog.openFolder();if(!t)break;let n=await r.share.validateLocalFolder({folderPath:t,owner:e.owner,repo:e.repo});if(console.log(re({folder_validate:n.kind})),n.kind===`ok`){let e=z.share.branch,n={currentBranch:null,headSha:null,detached:!1};try{n=await r.project.readHeadBranch(t)}catch(e){let t=e;console.warn(`[receive] local-folder readHeadBranch failed`,t instanceof Error?t.message:t)}let i=o(e,n)!==`true`;try{await r.project.open({path:t,target:`new-window`,entryPoint:`share-receive`,...i?{pendingShareBranchSwitch:{share:z.share,projectPath:t,currentBranch:n.currentBranch}}:{pendingDeepLinkTarget:{kind:z.share.target.kind,path:h(z.share.target)}}}),y.dismiss()}catch(e){let t=e;console.warn(`[receive] local-folder-open failed`,t instanceof Error?t.message:t),l.error(C({id:`phM8Kh`}))}break}let i=v(n,e);i&&l.error(i)}}catch(e){let t=e;console.warn(`[receive] local-folder-validate failed`,t instanceof Error?t.message:t),l.error(C({id:`rlUzXK`}))}A(!1)}};let g;t[40]!==C||t[41]!==r||t[42]!==L||t[43]!==y?(g=function(){if(L===null||L.phase!==`ready`)return;let e=L.seed;console.warn(`[receive] consent_dialog action=initialize worktree=${e.candidatePath}`),R(le),r.project.okInit({projectPath:e.candidatePath}).then(async t=>{if(t.ok===!0){R(e=>e===null?e:w(e,{ok:!0,projectPath:t.projectPath}));try{await r.project.open({path:t.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:e.targetKind,path:e.targetPath},pendingBranch:e.branch}),R(ce),y.dismiss()}catch(t){let n=t,r=n instanceof Error?n.message:String(n);R(e=>e===null?e:T(e,{ok:!1,message:r})),l.error(C({id:`nDT8qt`,values:{0:e.candidatePath}}))}return}let n=t.reason,i=t.message||`Initialization failed.`;R(e=>e===null?e:w(e,{ok:!1,reason:n,message:i})),l.error(i)}).catch(t=>{let n=t instanceof Error?t.message:String(t);R(e=>e===null?e:w(e,{ok:!1,reason:`network-error`,message:n})),l.error(C({id:`3Mwaly`,values:{0:e.candidatePath}}))})},t[40]=C,t[41]=r,t[42]=L,t[43]=y,t[44]=g):g=t[44];let b=g,x;t[45]!==L||t[46]!==y?(x=function(){L!==null&&console.warn(`[receive] consent_dialog action=cancel worktree=${L.seed.candidatePath}`),R(P),y.dismiss()},t[45]=L,t[46]=y,t[47]=x):x=t[47];let S=x;if(L!==null&&L.phase!==`cancelled`&&L.phase!==`done`&&B!==null){let e=L.seed,n=L.phase===`initializing`||L.phase===`opening`,r;t[48]===S?r=t[49]:(r=e=>{e||S()},t[48]=S,t[49]=r);let a;t[50]===q?a=t[51]:(a=(0,D.jsx)(u,{children:(0,D.jsx)(i,{id:`RY6Bq1`,values:{targetNoun:q}})}),t[50]=q,t[51]=a);let o;t[52]===B.target?o=t[53]:(o=h(B.target)?`— ${h(B.target)}`:``,t[52]=B.target,t[53]=o);let s;t[54]!==B.owner||t[55]!==B.repo||t[56]!==o?(s=(0,D.jsx)(te,{className:`sr-only`,children:(0,D.jsx)(i,{id:`pgq_xf`,values:{0:B.owner,1:B.repo,2:o}})}),t[54]=B.owner,t[55]=B.repo,t[56]=o,t[57]=s):s=t[57];let l=B.owner,re=B.repo,g;t[58]===B.target?g=t[59]:(g=h(B.target),t[58]=B.target,t[59]=g);let _;t[60]!==B.branch||t[61]!==B.owner||t[62]!==B.repo||t[63]!==B.target.kind||t[64]!==g?(_=(0,D.jsx)(ae,{owner:l,repo:re,path:g,kind:B.target.kind,branch:B.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[60]=B.branch,t[61]=B.owner,t[62]=B.repo,t[63]=B.target.kind,t[64]=g,t[65]=_):_=t[65];let v;t[66]!==a||t[67]!==s||t[68]!==_?(v=(0,D.jsxs)(p,{children:[a,s,_]}),t[66]=a,t[67]=s,t[68]=_,t[69]=v):v=t[69];let ie;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,D.jsx)(i,{id:`KsAPaB`})}),t[70]=ie):ie=t[70];let y;t[71]===e.candidatePath?y=t[72]:(y=(0,D.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-receive-consent-path`,children:e.candidatePath}),t[71]=e.candidatePath,t[72]=y);let x;t[73]===e.parentProjectName?x=t[74]:(x=e.parentProjectName===null?null:(0,D.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,"data-testid":`share-receive-consent-parent`,children:(0,D.jsx)(i,{id:`JmfgFc`,values:{0:e.parentProjectName}})}),t[73]=e.parentProjectName,t[74]=x);let C;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,D.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,D.jsx)(i,{id:`w7SsvI`})}),t[75]=C):C=t[75];let w;t[76]!==L.message||t[77]!==L.phase?(w=L.phase===`error`?(0,D.jsx)(`p`,{className:`mt-3 text-sm text-destructive`,"data-testid":`share-receive-consent-error`,role:`alert`,children:L.message}):null,t[76]=L.message,t[77]=L.phase,t[78]=w):w=t[78];let T;t[79]!==y||t[80]!==x||t[81]!==w?(T=(0,D.jsxs)(f,{children:[ie,y,x,C,w]}),t[79]=y,t[80]=x,t[81]=w,t[82]=T):T=t[82];let E;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,D.jsx)(i,{id:`dEgA5A`}),t[83]=E):E=t[83];let O;t[84]===S?O=t[85]:(O=(0,D.jsx)(c,{variant:`ghost`,onClick:S,"data-testid":`share-receive-consent-cancel`,children:E}),t[84]=S,t[85]=O);let k=n||L.phase===`error`,A=n||L.phase===`error`,j;t[86]===n?j=t[87]:(j=n?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(ee,{className:`mr-2 h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,D.jsx)(i,{id:`NKkZXl`})]}):(0,D.jsx)(i,{id:`NKkZXl`}),t[86]=n,t[87]=j);let M;t[88]!==b||t[89]!==k||t[90]!==A||t[91]!==j?(M=(0,D.jsx)(c,{onClick:b,disabled:k,"aria-disabled":A,"data-testid":`share-receive-consent-initialize`,children:j}),t[88]=b,t[89]=k,t[90]=A,t[91]=j,t[92]=M):M=t[92];let N;t[93]!==O||t[94]!==M?(N=(0,D.jsxs)(ne,{children:[O,M]}),t[93]=O,t[94]=M,t[95]=N):N=t[95];let P;t[96]!==v||t[97]!==T||t[98]!==N?(P=(0,D.jsxs)(d,{className:`sm:max-w-xl`,"data-testid":`share-receive-consent-dialog`,onInteractOutside:se,onPointerDownOutside:oe,children:[v,T,N]}),t[96]=v,t[97]=T,t[98]=N,t[99]=P):P=t[99];let ce;t[100]!==r||t[101]!==P?(ce=(0,D.jsx)(m,{open:!0,onOpenChange:r,children:P}),t[100]=r,t[101]=P,t[102]=ce):ce=t[102],K=ce;break bb0}if(!z||!B||!e){K=null;break bb0}V=_!==void 0&&!F;let O;t[103]!==C||t[104]!==F?(O=C(F?{id:`YjhKI5`}:{id:`LE7t79`}),t[103]=C,t[104]=F,t[105]=O):O=t[105],H=O,Se=s(e)}t[15]=C,t[16]=N,t[17]=r,t[18]=_,t[19]=F,t[20]=L,t[21]=z,t[22]=E,t[23]=B,t[24]=y,t[25]=V,t[26]=H,t[27]=U,t[28]=W,t[29]=G,t[30]=Se,t[31]=K,t[32]=q}else V=t[25],H=t[26],U=t[27],W=t[28],G=t[29],Se=t[30],K=t[31],q=t[32];if(K!==Symbol.for(`react.early_return_sentinel`))return K;let Ce=Se,we=j?.authenticated?j.login:void 0,Te;t[106]===I?Te=t[107]:(Te=I?.detail?g(I.detail):``,t[106]=I,t[107]=Te);let Ee=Te,J;t[108]===y?J=t[109]:(J=e=>{e||y.dismiss()},t[108]=y,t[109]=J);let Y;t[110]===q?Y=t[111]:(Y=(0,D.jsx)(u,{children:(0,D.jsx)(i,{id:`RY6Bq1`,values:{targetNoun:q}})}),t[110]=q,t[111]=Y);let X;t[112]===B.target?X=t[113]:(X=h(B.target)?` — ${h(B.target)}`:null,t[112]=B.target,t[113]=X);let Z;t[114]!==B.owner||t[115]!==B.repo||t[116]!==X?(Z=(0,D.jsxs)(te,{className:`sr-only`,children:[B.owner,`/`,B.repo,X]}),t[114]=B.owner,t[115]=B.repo,t[116]=X,t[117]=Z):Z=t[117];let De=B.owner,Oe=B.repo,Q;t[118]===B.target?Q=t[119]:(Q=h(B.target),t[118]=B.target,t[119]=Q);let ke;t[120]!==B.branch||t[121]!==B.owner||t[122]!==B.repo||t[123]!==B.target.kind||t[124]!==Q?(ke=(0,D.jsx)(ae,{owner:De,repo:Oe,path:Q,kind:B.target.kind,branch:B.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[120]=B.branch,t[121]=B.owner,t[122]=B.repo,t[123]=B.target.kind,t[124]=Q,t[125]=ke):ke=t[125];let Ae;t[126]!==Y||t[127]!==Z||t[128]!==ke?(Ae=(0,D.jsxs)(p,{children:[Y,Z,ke]}),t[126]=Y,t[127]=Z,t[128]=ke,t[129]=Ae):Ae=t[129];let $;t[130]!==_||t[131]!==V||t[132]!==I||t[133]!==Ee||t[134]!==H||t[135]!==F||t[136]!==U||t[137]!==W||t[138]!==E?($=I?(0,D.jsxs)(`div`,{ref:me,tabIndex:-1,className:`rounded-lg border border-destructive/40 bg-destructive/5 p-4 outline-none`,"data-testid":`share-receive-clone-error`,children:[(0,D.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,role:`alert`,children:(0,D.jsx)(i,{id:`aiArms`})}),Ee?(0,D.jsxs)(`p`,{className:`mt-2 break-words text-xs text-destructive`,"data-testid":`share-receive-clone-error-message`,children:[(0,D.jsx)(i,{id:`4BITzH`}),` `,(0,D.jsxs)(`span`,{className:`font-mono text-foreground/80`,children:[`"`,Ee,`"`]})]}):null,(0,D.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,D.jsx)(i,{id:`Llyqvo`})}),(0,D.jsxs)(`ul`,{className:`mt-1 list-disc space-y-1 pl-5 text-sm text-muted-foreground`,"data-testid":`share-receive-clone-error-reasons`,children:[(0,D.jsx)(`li`,{children:(0,D.jsx)(i,{id:`6LbUG7`})}),(0,D.jsx)(`li`,{children:(0,D.jsx)(i,{id:`_pY_Vq`})}),(0,D.jsx)(`li`,{children:(0,D.jsx)(i,{id:`J6mxC1`})})]}),(0,D.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,D.jsx)(c,{onClick:()=>{U()},"data-testid":`share-receive-clone-retry`,children:(0,D.jsx)(i,{id:`KDw4GX`})}),(0,D.jsx)(c,{variant:`outline`,onClick:()=>{W()},disabled:E||F,"data-testid":`share-receive-error-local`,children:(0,D.jsx)(i,{id:`xFQRu4`})})]})]}):(0,D.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,D.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-clone`,className:`flex flex-col items-start gap-2 rounded-lg border border-primary/50 bg-primary/5 p-4 text-left transition hover:border-primary hover:bg-primary/10 focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-primary/50 disabled:hover:bg-primary/5`,onClick:()=>{U()},disabled:_!==void 0&&!V,"aria-disabled":_!==void 0&&!V,children:[(0,D.jsx)(`span`,{className:`text-sm font-semibold`,children:H}),(0,D.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,D.jsx)(i,{id:`fj5YiP`})})]}),(0,D.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-local`,className:`flex flex-col items-start gap-2 rounded-lg border border-border bg-card p-4 text-left transition hover:border-foreground/50 hover:bg-accent focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,onClick:()=>{W()},disabled:E||F,children:[(0,D.jsx)(`span`,{className:`text-sm font-semibold`,children:(0,D.jsx)(i,{id:`HfI1dR`})}),(0,D.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,D.jsx)(i,{id:`_qD6mn`})})]})]}),t[130]=_,t[131]=V,t[132]=I,t[133]=Ee,t[134]=H,t[135]=F,t[136]=U,t[137]=W,t[138]=E,t[139]=$):$=t[139];let je;t[140]!==N||t[141]!==j||t[142]!==_||t[143]!==G||t[144]!==we?(je=_?(0,D.jsx)(`div`,{className:`mt-3 flex items-center justify-between rounded-md border border-border bg-muted/30 px-3 py-2 text-xs`,"data-testid":`share-receive-auth-banner`,role:`status`,"aria-live":`polite`,children:j===null?(0,D.jsx)(`span`,{className:`text-muted-foreground`,children:(0,D.jsx)(i,{id:`UDFrWm`})}):j.authenticated?(0,D.jsx)(`span`,{className:`text-muted-foreground`,children:(0,D.jsx)(i,{id:`VAHWL_`,values:{signedInLogin:we},components:{0:(0,D.jsx)(`span`,{className:`font-medium text-foreground/90`})}})}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{className:`text-muted-foreground`,children:(0,D.jsx)(i,{id:`SgKLfA`})}),(0,D.jsx)(`button`,{type:`button`,"data-testid":`share-receive-signin`,className:`font-medium text-primary underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded`,onClick:()=>{G()},disabled:N,children:N?(0,D.jsx)(i,{id:`PKLY-1`}):(0,D.jsx)(i,{id:`3jod3l`})})]})}):null,t[140]=N,t[141]=j,t[142]=_,t[143]=G,t[144]=we,t[145]=je):je=t[145];let Me;t[146]!==I||t[147]!==Ce?(Me=I?null:(0,D.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,D.jsx)(i,{id:`RJ3a8Z`,values:{lookingForUrl:Ce},components:{0:(0,D.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),t[146]=I,t[147]=Ce,t[148]=Me):Me=t[148];let Ne;t[149]!==$||t[150]!==je||t[151]!==Me?(Ne=(0,D.jsxs)(f,{children:[$,je,Me]}),t[149]=$,t[150]=je,t[151]=Me,t[152]=Ne):Ne=t[152];let Pe;t[153]===y?Pe=t[154]:(Pe=()=>y.dismiss(),t[153]=y,t[154]=Pe);let Fe;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,D.jsx)(i,{id:`dEgA5A`}),t[155]=Fe):Fe=t[155];let Ie;t[156]===Pe?Ie=t[157]:(Ie=(0,D.jsx)(ne,{children:(0,D.jsx)(c,{variant:`outline`,className:`font-mono uppercase`,onClick:Pe,children:Fe})}),t[156]=Pe,t[157]=Ie);let Le;t[158]!==Ae||t[159]!==Ne||t[160]!==Ie?(Le=(0,D.jsxs)(d,{className:`sm:max-w-xl`,"data-testid":`share-receive-dialog`,children:[Ae,Ne,Ie]}),t[158]=Ae,t[159]=Ne,t[160]=Ie,t[161]=Le):Le=t[161];let Re;return t[162]!==J||t[163]!==Le?(Re=(0,D.jsx)(m,{open:!0,onOpenChange:J,children:Le}),t[162]=J,t[163]=Le,t[164]=Re):Re=t[164],Re}function oe(e){return e.preventDefault()}function se(e){return e.preventDefault()}function P(e){return e===null?e:E(e)}function ce(e){return e===null?e:T(e,{ok:!0})}function le(e){return e===null?e:C(e)}export{A as ShareReceiveDialog};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{a as i,i as a,n as o,r as s}from"./pending-receive-nav-store-v67LB7tS.js";import{t as c}from"./miss-dialog-store-PJQ_kr0I.js";import{c as l,i as u,n as d,s as f,t as p}from"./dialog-DdHaoAGK.js";import{c as m,s as h}from"./doc-hash-KGQoVCvb.js";var g=r(),_=e(t(),1),v=n();function y(e){let t=e.split(`/`).filter(Boolean);return t.length>0?t[t.length-1]:e}function b(){let e=(0,g.c)(2),t=(0,_.useSyncExternalStore)(c.subscribe,c.getSnapshot,x);if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=(0,v.jsx)(S,{nav:t},t.path),e[0]=t,e[1]=n),n}function x(){return null}function S(e){let t=(0,g.c)(25),{nav:n}=e,{state:r,refetch:_}=i(n),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(){c.dismiss()},t[0]=b):b=t[0];let x=b,S;t[1]===n.path?S=t[2]:(S=function(){window.location.hash=m(a(n.path)),x()},t[1]=n.path,t[2]=S);let C=S,w;t[3]!==n.branch||t[4]!==n.kind?(w=function(e){o.arm({kind:n.kind,path:e,branch:n.branch}),window.location.hash=n.kind===`folder`?m(e):h(e),x()},t[3]=n.branch,t[4]=n.kind,t[5]=w):w=t[5];let T=w,E;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{e||x()},t[6]=E):E=t[6];let D=r.phase,O=r.phase===`resolved`?r.resolution.verdict:void 0,k;t[7]===n.path?k=t[8]:(k=y(n.path),t[7]=n.path,t[8]=k);let A;t[9]===k?A=t[10]:(A=(0,v.jsx)(f,{children:(0,v.jsx)(l,{className:`truncate`,children:k})}),t[9]=k,t[10]=A);let j=r.phase===`pending`?`flex flex-col items-center justify-center gap-3 py-6 text-center text-sm text-muted-foreground`:`flex flex-col items-center justify-center gap-6 py-2 text-center`,M;t[11]!==C||t[12]!==n||t[13]!==T||t[14]!==_||t[15]!==r?(M=(0,v.jsx)(s,{nav:n,state:r,onBrowseFolder:C,onOpenRenamed:T,onEnableAutoSync:x,onSyncCompleted:_}),t[11]=C,t[12]=n,t[13]=T,t[14]=_,t[15]=r,t[16]=M):M=t[16];let N;t[17]!==M||t[18]!==j?(N=(0,v.jsx)(d,{className:j,children:M}),t[17]=M,t[18]=j,t[19]=N):N=t[19];let P;return t[20]!==r.phase||t[21]!==N||t[22]!==O||t[23]!==A?(P=(0,v.jsx)(p,{open:!0,onOpenChange:E,children:(0,v.jsxs)(u,{className:`sm:max-w-md`,"data-testid":`share-receive-miss-dialog`,"data-phase":D,"data-verdict":O,children:[A,N]})}),t[20]=r.phase,t[21]=N,t[22]=O,t[23]=A,t[24]=P):P=t[24],P}export{b as ShareReceiveMissDialog};
1
+ import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{a as i,i as a,n as o,r as s}from"./pending-receive-nav-store-lNMDQCmC.js";import{t as c}from"./miss-dialog-store-PJQ_kr0I.js";import{c as l,i as u,n as d,s as f,t as p}from"./dialog-DdHaoAGK.js";import{c as m,s as h}from"./doc-hash-Ce3LmfP6.js";var g=r(),_=e(t(),1),v=n();function y(e){let t=e.split(`/`).filter(Boolean);return t.length>0?t[t.length-1]:e}function b(){let e=(0,g.c)(2),t=(0,_.useSyncExternalStore)(c.subscribe,c.getSnapshot,x);if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=(0,v.jsx)(S,{nav:t},t.path),e[0]=t,e[1]=n),n}function x(){return null}function S(e){let t=(0,g.c)(25),{nav:n}=e,{state:r,refetch:_}=i(n),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(){c.dismiss()},t[0]=b):b=t[0];let x=b,S;t[1]===n.path?S=t[2]:(S=function(){window.location.hash=m(a(n.path)),x()},t[1]=n.path,t[2]=S);let C=S,w;t[3]!==n.branch||t[4]!==n.kind?(w=function(e){o.arm({kind:n.kind,path:e,branch:n.branch}),window.location.hash=n.kind===`folder`?m(e):h(e),x()},t[3]=n.branch,t[4]=n.kind,t[5]=w):w=t[5];let T=w,E;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{e||x()},t[6]=E):E=t[6];let D=r.phase,O=r.phase===`resolved`?r.resolution.verdict:void 0,k;t[7]===n.path?k=t[8]:(k=y(n.path),t[7]=n.path,t[8]=k);let A;t[9]===k?A=t[10]:(A=(0,v.jsx)(f,{children:(0,v.jsx)(l,{className:`truncate`,children:k})}),t[9]=k,t[10]=A);let j=r.phase===`pending`?`flex flex-col items-center justify-center gap-3 py-6 text-center text-sm text-muted-foreground`:`flex flex-col items-center justify-center gap-6 py-2 text-center`,M;t[11]!==C||t[12]!==n||t[13]!==T||t[14]!==_||t[15]!==r?(M=(0,v.jsx)(s,{nav:n,state:r,onBrowseFolder:C,onOpenRenamed:T,onEnableAutoSync:x,onSyncCompleted:_}),t[11]=C,t[12]=n,t[13]=T,t[14]=_,t[15]=r,t[16]=M):M=t[16];let N;t[17]!==M||t[18]!==j?(N=(0,v.jsx)(d,{className:j,children:M}),t[17]=M,t[18]=j,t[19]=N):N=t[19];let P;return t[20]!==r.phase||t[21]!==N||t[22]!==O||t[23]!==A?(P=(0,v.jsx)(p,{open:!0,onOpenChange:E,children:(0,v.jsxs)(u,{className:`sm:max-w-md`,"data-testid":`share-receive-miss-dialog`,"data-phase":D,"data-verdict":O,children:[A,N]})}),t[20]=r.phase,t[21]=N,t[22]=O,t[23]=A,t[24]=P):P=t[24],P}export{b as ShareReceiveMissDialog};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{n as i}from"./dist-CQw2y-s3.js";import{bt as a,k as ee}from"./dist-cAytzZ0r.js";import{i as te,t as ne}from"./button-cneJOVxD.js";import{t as o}from"./chevron-down-BvNcCN1f.js";import{i as s,r as c}from"./skill-actions-HpoN1bS5.js";import{E as re,S as ie,_ as l,h as ae,m as oe,p as se,v as u}from"./skills-api-Dg6gQ9CV.js";var d=r(),f=e(t(),1),p=n(),m=a.options;function h(e){let t=(0,d.c)(74),{scope:n,name:r}=e,a=s(),h=c(),g;t[0]!==r||t[1]!==n||t[2]!==a.data||t[3]!==a.status?(g=a.status===`ready`?a.data.find(e=>e.scope===n&&e.name===r):void 0,t[0]=r,t[1]=n,t[2]=a.data,t[3]=a.status,t[4]=g):g=t[4];let _=g,v;t[5]!==_||t[6]!==r||t[7]!==n?(v=_??{scope:n,name:r,path:r,description:``,installed:!1,hosts:[]},t[5]=_,t[6]=r,t[7]=n,t[8]=v):v=t[8];let y=v,b=h.installingName===r,[x,S]=(0,f.useState)(null),C=x??y.hosts,w;t[9]===C?w=t[10]:(w=new Set(C),t[9]=C,t[10]=w);let T=w,E=x?x.length>0:y.installed,D=(0,f.useRef)(y.hosts),O,k;t[11]!==x||t[12]!==y.hosts?(O=()=>{x===null&&(D.current=y.hosts)},k=[x,y.hosts],t[11]=x,t[12]=y.hosts,t[13]=O,t[14]=k):(O=t[13],k=t[14]),(0,f.useEffect)(O,k);let A;t[15]===y.hosts?A=t[16]:(A=[...y.hosts].sort().join(`,`),t[15]=y.hosts,t[16]=A);let j=A,M,N;t[17]===j?(M=t[18],N=t[19]):(M=()=>{S(e=>e&&[...e].sort().join(`,`)===j?null:e)},N=[j],t[17]=j,t[18]=M,t[19]=N),(0,f.useEffect)(M,N);let P=(0,f.useRef)(null),F,I;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{P.current&&clearTimeout(P.current)},F=[],t[20]=F,t[21]=I):(F=t[20],I=t[21]),(0,f.useEffect)(I,F);let L,R,z,B,V,H,U,W,G;if(t[22]!==h||t[23]!==T||t[24]!==E||t[25]!==b||t[26]!==y){z=function(e,t){D.current=e,S(e),P.current&&clearTimeout(P.current);let n=async()=>{(await h.install(y,e)).ok||S(null)};t?P.current=setTimeout(()=>void n(),350):n()};let e=function(e,t){let n=new Set(D.current);t?n.add(e):n.delete(e),z([...n],!0)};G=`flex items-center gap-1.5`,R=se;let n=E?`installed`:`draft`,r=E?`border-primary/50 bg-primary/5 text-primary hover:bg-primary/10 hover:text-primary`:`border-yellow-500/40 bg-yellow-500/10 text-yellow-600 hover:bg-yellow-500/20 hover:text-yellow-600`,a;t[36]===r?a=t[37]:(a=te(`h-6 gap-1 rounded-sm border px-1.5 font-mono text-xs uppercase shadow-none`,r),t[36]=r,t[37]=a);let s;t[38]!==E||t[39]!==b?(s=b?(0,p.jsx)(i,{id:`b4itZn`}):E?(0,p.jsx)(i,{id:`eQkgKV`}):(0,p.jsx)(i,{id:`eneWvv`}),t[38]=E,t[39]=b,t[40]=s):s=t[40];let c;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,p.jsx)(o,{"aria-hidden":!0}),t[41]=c):c=t[41],t[42]!==b||t[43]!==n||t[44]!==a||t[45]!==s?(W=(0,p.jsx)(re,{asChild:!0,children:(0,p.jsxs)(ne,{variant:`outline`,size:`sm`,disabled:b,"data-testid":`skill-install-menu-trigger`,"data-state":n,className:a,children:[s,c]})}),t[42]=b,t[43]=n,t[44]=a,t[45]=s,t[46]=W):W=t[46],L=ae,B=`end`,V=`min-w-52`,t[47]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,p.jsx)(u,{children:(0,p.jsx)(i,{id:`npcziF`})}),t[47]=H):H=t[47],U=m.map(t=>(0,p.jsx)(oe,{checked:T.has(t),onCheckedChange:n=>e(t,n===!0),"data-testid":`skill-install-editor-${t}`,children:ee[t]},t)),t[22]=h,t[23]=T,t[24]=E,t[25]=b,t[26]=y,t[27]=L,t[28]=R,t[29]=z,t[30]=B,t[31]=V,t[32]=H,t[33]=U,t[34]=W,t[35]=G}else L=t[27],R=t[28],z=t[29],B=t[30],V=t[31],H=t[32],U=t[33],W=t[34],G=t[35];let K;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,p.jsx)(ie,{}),t[48]=K):K=t[48];let q;t[49]===z?q=t[50]:(q=()=>z([...m],!1),t[49]=z,t[50]=q);let J;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,p.jsx)(i,{id:`x-5mJ1`}),t[51]=J):J=t[51];let Y;t[52]===q?Y=t[53]:(Y=(0,p.jsx)(l,{"data-testid":`skill-install-all`,onSelect:q,children:J}),t[52]=q,t[53]=Y);let X;t[54]!==h||t[55]!==E||t[56]!==y?(X=E?(0,p.jsx)(l,{"data-testid":`skill-uninstall`,onSelect:()=>{P.current&&clearTimeout(P.current),D.current=[],S([]),(async()=>{(await h.uninstall(y)).ok||S(null)})()},children:(0,p.jsx)(i,{id:`t422_7`})}):null,t[54]=h,t[55]=E,t[56]=y,t[57]=X):X=t[57];let Z;t[58]!==L||t[59]!==B||t[60]!==V||t[61]!==H||t[62]!==U||t[63]!==Y||t[64]!==X?(Z=(0,p.jsxs)(L,{align:B,className:V,children:[H,U,K,Y,X]}),t[58]=L,t[59]=B,t[60]=V,t[61]=H,t[62]=U,t[63]=Y,t[64]=X,t[65]=Z):Z=t[65];let Q;t[66]!==R||t[67]!==W||t[68]!==Z?(Q=(0,p.jsxs)(R,{children:[W,Z]}),t[66]=R,t[67]=W,t[68]=Z,t[69]=Q):Q=t[69];let $;return t[70]!==h.dialogs||t[71]!==G||t[72]!==Q?($=(0,p.jsxs)(`div`,{className:G,children:[Q,h.dialogs]}),t[70]=h.dialogs,t[71]=G,t[72]=Q,t[73]=$):$=t[73],$}export{h as SkillEditorActions};
1
+ import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{n as i}from"./dist-CQw2y-s3.js";import{bt as a,k as ee}from"./dist-BtuJEC9v.js";import{i as te,t as ne}from"./button-cneJOVxD.js";import{t as o}from"./chevron-down-BvNcCN1f.js";import{i as s,r as c}from"./skill-actions-D2II4Qq4.js";import{E as re,S as ie,_ as l,h as ae,m as oe,p as se,v as u}from"./skills-api-bbofiqW7.js";var d=r(),f=e(t(),1),p=n(),m=a.options;function h(e){let t=(0,d.c)(74),{scope:n,name:r}=e,a=s(),h=c(),g;t[0]!==r||t[1]!==n||t[2]!==a.data||t[3]!==a.status?(g=a.status===`ready`?a.data.find(e=>e.scope===n&&e.name===r):void 0,t[0]=r,t[1]=n,t[2]=a.data,t[3]=a.status,t[4]=g):g=t[4];let _=g,v;t[5]!==_||t[6]!==r||t[7]!==n?(v=_??{scope:n,name:r,path:r,description:``,installed:!1,hosts:[]},t[5]=_,t[6]=r,t[7]=n,t[8]=v):v=t[8];let y=v,b=h.installingName===r,[x,S]=(0,f.useState)(null),C=x??y.hosts,w;t[9]===C?w=t[10]:(w=new Set(C),t[9]=C,t[10]=w);let T=w,E=x?x.length>0:y.installed,D=(0,f.useRef)(y.hosts),O,k;t[11]!==x||t[12]!==y.hosts?(O=()=>{x===null&&(D.current=y.hosts)},k=[x,y.hosts],t[11]=x,t[12]=y.hosts,t[13]=O,t[14]=k):(O=t[13],k=t[14]),(0,f.useEffect)(O,k);let A;t[15]===y.hosts?A=t[16]:(A=[...y.hosts].sort().join(`,`),t[15]=y.hosts,t[16]=A);let j=A,M,N;t[17]===j?(M=t[18],N=t[19]):(M=()=>{S(e=>e&&[...e].sort().join(`,`)===j?null:e)},N=[j],t[17]=j,t[18]=M,t[19]=N),(0,f.useEffect)(M,N);let P=(0,f.useRef)(null),F,I;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{P.current&&clearTimeout(P.current)},F=[],t[20]=F,t[21]=I):(F=t[20],I=t[21]),(0,f.useEffect)(I,F);let L,R,z,B,V,H,U,W,G;if(t[22]!==h||t[23]!==T||t[24]!==E||t[25]!==b||t[26]!==y){z=function(e,t){D.current=e,S(e),P.current&&clearTimeout(P.current);let n=async()=>{(await h.install(y,e)).ok||S(null)};t?P.current=setTimeout(()=>void n(),350):n()};let e=function(e,t){let n=new Set(D.current);t?n.add(e):n.delete(e),z([...n],!0)};G=`flex items-center gap-1.5`,R=se;let n=E?`installed`:`draft`,r=E?`border-primary/50 bg-primary/5 text-primary hover:bg-primary/10 hover:text-primary`:`border-yellow-500/40 bg-yellow-500/10 text-yellow-600 hover:bg-yellow-500/20 hover:text-yellow-600`,a;t[36]===r?a=t[37]:(a=te(`h-6 gap-1 rounded-sm border px-1.5 font-mono text-xs uppercase shadow-none`,r),t[36]=r,t[37]=a);let s;t[38]!==E||t[39]!==b?(s=b?(0,p.jsx)(i,{id:`b4itZn`}):E?(0,p.jsx)(i,{id:`eQkgKV`}):(0,p.jsx)(i,{id:`eneWvv`}),t[38]=E,t[39]=b,t[40]=s):s=t[40];let c;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,p.jsx)(o,{"aria-hidden":!0}),t[41]=c):c=t[41],t[42]!==b||t[43]!==n||t[44]!==a||t[45]!==s?(W=(0,p.jsx)(re,{asChild:!0,children:(0,p.jsxs)(ne,{variant:`outline`,size:`sm`,disabled:b,"data-testid":`skill-install-menu-trigger`,"data-state":n,className:a,children:[s,c]})}),t[42]=b,t[43]=n,t[44]=a,t[45]=s,t[46]=W):W=t[46],L=ae,B=`end`,V=`min-w-52`,t[47]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,p.jsx)(u,{children:(0,p.jsx)(i,{id:`npcziF`})}),t[47]=H):H=t[47],U=m.map(t=>(0,p.jsx)(oe,{checked:T.has(t),onCheckedChange:n=>e(t,n===!0),"data-testid":`skill-install-editor-${t}`,children:ee[t]},t)),t[22]=h,t[23]=T,t[24]=E,t[25]=b,t[26]=y,t[27]=L,t[28]=R,t[29]=z,t[30]=B,t[31]=V,t[32]=H,t[33]=U,t[34]=W,t[35]=G}else L=t[27],R=t[28],z=t[29],B=t[30],V=t[31],H=t[32],U=t[33],W=t[34],G=t[35];let K;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,p.jsx)(ie,{}),t[48]=K):K=t[48];let q;t[49]===z?q=t[50]:(q=()=>z([...m],!1),t[49]=z,t[50]=q);let J;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,p.jsx)(i,{id:`x-5mJ1`}),t[51]=J):J=t[51];let Y;t[52]===q?Y=t[53]:(Y=(0,p.jsx)(l,{"data-testid":`skill-install-all`,onSelect:q,children:J}),t[52]=q,t[53]=Y);let X;t[54]!==h||t[55]!==E||t[56]!==y?(X=E?(0,p.jsx)(l,{"data-testid":`skill-uninstall`,onSelect:()=>{P.current&&clearTimeout(P.current),D.current=[],S([]),(async()=>{(await h.uninstall(y)).ok||S(null)})()},children:(0,p.jsx)(i,{id:`t422_7`})}):null,t[54]=h,t[55]=E,t[56]=y,t[57]=X):X=t[57];let Z;t[58]!==L||t[59]!==B||t[60]!==V||t[61]!==H||t[62]!==U||t[63]!==Y||t[64]!==X?(Z=(0,p.jsxs)(L,{align:B,className:V,children:[H,U,K,Y,X]}),t[58]=L,t[59]=B,t[60]=V,t[61]=H,t[62]=U,t[63]=Y,t[64]=X,t[65]=Z):Z=t[65];let Q;t[66]!==R||t[67]!==W||t[68]!==Z?(Q=(0,p.jsxs)(R,{children:[W,Z]}),t[66]=R,t[67]=W,t[68]=Z,t[69]=Q):Q=t[69];let $;return t[70]!==h.dialogs||t[71]!==G||t[72]!==Q?($=(0,p.jsxs)(`div`,{className:G,children:[Q,h.dialogs]}),t[70]=h.dialogs,t[71]=G,t[72]=Q,t[73]=$):$=t[73],$}export{h as SkillEditorActions};
@@ -0,0 +1 @@
1
+ import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{H as i,P as a,mt as o,pt as s}from"./DocumentContext-Dl32cms8.js";import{n as c}from"./dist-BVOt51sU.js";import{M as l,si as ee,sn as u}from"./dist-BtuJEC9v.js";import{O as d,P as te,a as f,i as p,o as m}from"./CodeMirrorPropInput-GWGwbu-Z.js";import{l as ne}from"./keyboard-shortcuts-B5l045PW.js";import"./config-provider-dZze7ypK.js";import{Dt as re,Et as h,Ft as g,J as _,P as v,Q as y,Tt as b,X as x,pt as S,ut as ie}from"./dist-Dot7Y1W_.js";import{n as ae}from"./config-context-CE3SCVYc.js";import{o as C,r as w}from"./selection-context-Q-Ojx168.js";import{c as T,d as E,n as D,r as O,u as oe}from"./typing-burst-detector-CBiF5H7t.js";import{n as se,t as ce}from"./dist-C71V3z3d.js";import{t as le}from"./src-DHOupE17.js";var k=e(t(),1),A=r(),j=_.mark({class:`cm-link-ref-broken`}),M=/^\s{0,3}\[([^\]]+)\]:\s/,N=/\[([^\]]*)\]\[([^\]]*)\]/g,P=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function F(e,t){let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i];if(e<a.from)r=i-1;else if(e>=a.to)n=i+1;else return!0}return!1}function I(e){let t=[];return v(e).iterate({enter(e){if(P.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function L(e){let t=new Set,n=[],r=e.doc,i=I(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(F(n.from,i))continue;let a=M.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!F(t.from,i)&&!M.test(t.text))for(N.lastIndex=0;;){let e=N.exec(t.text);if(!e)break;let r=t.from+e.index;if(F(r,i))continue;let a=e[2]||e[1];n.push({from:r,to:r+e[0].length,label:a.toLowerCase()})}}let a=[];for(let e of n)t.has(e.label)||a.push(j.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),_.set(a)}var R=g.define({create(e){return L(e)},update(e,t){return t.docChanged?L(t.state):e},provide:e=>x.decorations.from(e)}),z=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,B=_.mark({class:`cm-del`}),V=_.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),H=_.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function U(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function W(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!l.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(l.test(r.text))return{from:t.from,to:r.to}}return null}function G(e,t){let n=[],r=v(e),i=W(e),a=e=>i!==null&&e>=i.from&&e<=i.to;for(let{from:i,to:o}of t)r.iterate({from:i,to:o,enter(t){if(!a(t.from)){if(t.name===`Strikethrough`){let e=t.from,r=t.to,i=t.node.cursor();if(i.firstChild())do i.name===`StrikethroughMark`&&(i.from===t.from?e=i.to:r=i.from);while(i.nextSibling());return e<r&&n.push(B.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=z.exec(r.text),a=i?i[1].length:2,o=_.line({class:`cm-list-item`,attributes:{style:`--list-hang: ${a}ch`}});n.push(o.range(r.from));return}if(t.name===`FencedCode`){let r=e.doc.lineAt(t.from),i=e.doc.lineAt(t.to);for(let t=r.number+1;t<i.number;t++){let r=e.doc.line(t),i=U(r.text),a=_.line({class:`cm-fenced-code-line`,attributes:{style:`--line-indent: ${i}`}});n.push(a.range(r.from))}return!1}if(t.name===`TableHeader`){let r=e.doc.lineAt(t.from);return n.push(V.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(H.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(H.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),_.set(n)}var K=class{decorations;constructor(e){this.decorations=G(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||v(e.startState)!==v(e.state))&&(this.decorations=G(e.view.state,e.view.visibleRanges))}},q=y.fromClass(K,{decorations:e=>e.decorations});function J(){return[q,R]}var ue=n(),Y=56;function X(e,t){let n=e.state.doc,r=1;if(n.lines>=1&&l.test(n.line(1).text)){for(let e=2;e<=n.lines;e++)if(l.test(n.line(e).text)){r=e+1;break}}let i=u(),a=0;for(let o=r;o<=n.lines;o++){let r=n.line(o);if(!i(r.text)&&/^#{1,6}\s/.test(r.text)){if(a===t.index){e.dispatch({selection:h.cursor(r.from),effects:x.scrollIntoView(r.from,{y:`start`})}),e.focus();return}a++}}}function de(e,t){requestAnimationFrame(()=>{let n=e.state.doc,r=Math.min(t.offset,n.length);e.dispatch({selection:h.cursor(r),effects:x.scrollIntoView(r,{y:`center`})}),e.focus()})}function Z(e){let t=(0,A.c)(33),{docName:n,ytext:r,provider:l,placeholder:u,isSourceModeActive:d}=e,h=(0,k.useRef)(null),g=(0,k.useRef)(null),[_,v]=(0,k.useState)(null);if(_)throw _;let{resolvedTheme:y}=c(),{merged:j}=ae(),M=(0,k.useRef)(d),N=j?.editor?.wordWrap??!0,P,F;t[0]===d?(P=t[1],F=t[2]):(P=()=>{M.current=d},F=[d],t[0]=d,t[1]=P,t[2]=F),(0,k.useEffect)(P,F);let I=(0,k.useRef)(null),L;t[3]!==u||t[4]!==l||t[5]!==y||t[6]!==N||t[7]!==r?(L=()=>{let e=h.current;if(!e)return;let t=l.configuration.name??``,n,c=me;try{n=s({docName:t,container:e,sizeStats:{viewCount:0,bytes:r.length},factory:e=>{let n=null,o=a({ydoc:l.document,ytext:r}),s=new b,d=new b,f=new b,m=new x({state:re.create({doc:r.toString(),extensions:[ce,se({scrollToMatch:pe}),ie.of([te]),le(r,l.awareness),...p({themeCompartment:s,resolvedTheme:y,ydoc:l.document,wordWrapCompartment:d,wordWrap:N,currentDocName:t}),J(),o,x.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(n!==null&&clearTimeout(n),n=setTimeout(()=>{n=null,D(t,`source`,O(e.view)),w(t,`source`,C(e.view,t))},120))}),x.domEventHandlers({keydown:(e,t)=>!M.current||!ee()||!ne(e,`edit-with-ai`)?!1:(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),i(),!0)}),f.of(S(u??``)),x.theme({"&":{height:`100%`}}),x.scrollMargins.of(fe)]}),parent:e});D(t,`source`,O(m)),w(t,`source`,C(m,t));let h=m.contentDOM;return h.addEventListener(`keydown`,c),h.addEventListener(`paste`,c),h.addEventListener(`drop`,c),h.addEventListener(`cut`,c),{view:m,ydoc:l.document,ytext:r,provider:l,themeCompartment:s,wordWrapCompartment:d,placeholderCompartment:f}}}),I.current=n,g.current=n.view}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),I.current=null,g.current=null,v(t instanceof Error?t:Error(String(t)))}return()=>{let e=I.current;e&&o(e),I.current=null,g.current=null}},t[3]=u,t[4]=l,t[5]=y,t[6]=N,t[7]=r,t[8]=L):L=t[8];let R;t[9]!==l||t[10]!==r?(R=[r,l],t[9]=l,t[10]=r,t[11]=R):R=t[11],(0,k.useEffect)(L,R);let z,B;t[12]===n?(z=t[13],B=t[14]):(z=()=>{},B=[n],t[12]=n,t[13]=z,t[14]=B),(0,k.useEffect)(z,B);let V,H;t[15]===y?(V=t[16],H=t[17]):(V=()=>{let e=I.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(y===`dark`?f:m)})},H=[y],t[15]=y,t[16]=V,t[17]=H),(0,k.useEffect)(V,H);let U,W;t[18]===N?(U=t[19],W=t[20]):(W=()=>{let e=I.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(N?x.lineWrapping:[])})},U=[N],t[18]=N,t[19]=U,t[20]=W),(0,k.useEffect)(W,U);let G,K;t[21]===u?(G=t[22],K=t[23]):(G=()=>{let e=I.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(S(u??``))})},K=[u],t[21]=u,t[22]=G,t[23]=K),(0,k.useEffect)(G,K);let q,Y;t[24]!==n||t[25]!==d?(q=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`source`||!d)return;let r=g.current;r&&(X(r,t),oe(n))};return window.addEventListener(T,e),()=>window.removeEventListener(T,e)},Y=[n,d],t[24]=n,t[25]=d,t[26]=q,t[27]=Y):(q=t[26],Y=t[27]),(0,k.useEffect)(q,Y);let Z,Q;t[28]!==n||t[29]!==d?(Z=()=>{if(!d)return;let e=g.current;if(!e)return;let t=E(n);if(t){if(t.kind===`outline`){X(e,t.detail);return}de(e,t.detail)}},Q=[n,d],t[28]=n,t[29]=d,t[30]=Z,t[31]=Q):(Z=t[30],Q=t[31]),(0,k.useEffect)(Z,Q);let $;return t[32]===Symbol.for(`react.memo_cache_sentinel`)?($=(0,ue.jsx)(`div`,{ref:h,className:`source-editor h-full pb-3`}),t[32]=$):$=t[32],$}function fe(){return{top:Y}}function pe(e){return x.scrollIntoView(e,{y:`start`})}function me(){return d()}export{Z as SourceEditor};
@@ -1,4 +1,4 @@
1
- import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{r as i}from"./dist-CQw2y-s3.js";import{n as a}from"./dist-BVOt51sU.js";import{wt as o,xr as s,zt as c}from"./dist-cAytzZ0r.js";import{i as l,t as u}from"./button-cneJOVxD.js";import{n as d,r as f}from"./dist-CoyydoqN.js";import{d as p}from"./navigation-targets-DdhO6GKu.js";import{a as m,c as h,s as g}from"./doc-hash-KGQoVCvb.js";import{t as _}from"./config-context-CE3SCVYc.js";import{E as v,f as y,m as b}from"./file-tree-adapter-uHXxUJ8g.js";var x=r(),S=2,C=1,w=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(S,Math.floor(u/e.css.cell.width)),rows:Math.max(C,Math.floor(l/e.css.cell.height))}}},T=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],ee=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],E;function te(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var D=class{constructor(){if(this.version=`6`,!E){E=new Uint8Array(65536),E.fill(1),E[0]=0,E.fill(0,1,32),E.fill(0,127,160),E.fill(2,4352,4448),E[9001]=2,E[9002]=2,E.fill(2,11904,42192),E[12351]=1,E.fill(2,44032,55204),E.fill(2,63744,64256),E.fill(2,65040,65050),E.fill(2,65072,65136),E.fill(2,65280,65377),E.fill(2,65504,65511);for(let e=0;e<T.length;++e)E.fill(0,T[e][0],T[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?E[e]:te(e,ee)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=Xe.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return Xe.createPropertyValue(0,n,r)}},ne=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?j.isErrorNoTelemetry(e)?new j(e.message+`
1
+ import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{r as i}from"./dist-CQw2y-s3.js";import{n as a}from"./dist-BVOt51sU.js";import{wt as o,xr as s,zt as c}from"./dist-BtuJEC9v.js";import{i as l,t as u}from"./button-cneJOVxD.js";import{n as d,r as f}from"./dist-CoyydoqN.js";import{d as p}from"./navigation-targets-XC4PBjfz.js";import{a as m,c as h,s as g}from"./doc-hash-Ce3LmfP6.js";import{t as _}from"./config-context-CE3SCVYc.js";import{E as v,f as y,m as b}from"./file-tree-adapter-BoRujkp5.js";var x=r(),S=2,C=1,w=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(S,Math.floor(u/e.css.cell.width)),rows:Math.max(C,Math.floor(l/e.css.cell.height))}}},T=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],ee=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],E;function te(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var D=class{constructor(){if(this.version=`6`,!E){E=new Uint8Array(65536),E.fill(1),E[0]=0,E.fill(0,1,32),E.fill(0,127,160),E.fill(2,4352,4448),E[9001]=2,E[9002]=2,E.fill(2,11904,42192),E[12351]=1,E.fill(2,44032,55204),E.fill(2,63744,64256),E.fill(2,65040,65050),E.fill(2,65072,65136),E.fill(2,65280,65377),E.fill(2,65504,65511);for(let e=0;e<T.length;++e)E.fill(0,T[e][0],T[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?E[e]:te(e,ee)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=Xe.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return Xe.createPropertyValue(0,n,r)}},ne=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?j.isErrorNoTelemetry(e)?new j(e.message+`
2
2
 
3
3
  `+e.stack):Error(e.message+`
4
4
 
@@ -1 +1 @@
1
- import{r as e,t}from"./compiler-runtime-CVnuRdak.js";import{u as n}from"./button-cneJOVxD.js";import{l as r}from"./workspace-paths-DYS2c17l.js";import{i,r as a,t as o}from"./cursor-CjNH7VrK.js";var s=n(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),c=t(),l=e();function u(e){let t=(0,c.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,l.jsx)(`title`,{children:`Cline icon`}),r=(0,l.jsx)(`path`,{fill:`currentColor`,d:`M463.6,275.08l-29.26-58.75v-33.83c0-56.08-45.01-101.5-100.53-101.5h-50.01c3.62-7.43,5.61-15.79,5.61-24.61,0-31.17-25.08-56.39-56.07-56.39s-56.07,25.22-56.07,56.39c0,8.82,1.99,17.17,5.61,24.61h-50.01c-55.51,0-100.52,45.42-100.52,101.5v33.83l-29.87,58.59c-3.01,5.9-3.01,12.92,0,18.81l29.87,57.93v33.83c0,56.08,45.01,101.5,100.52,101.5h200.95c55.51,0,100.53-45.42,100.53-101.5v-33.83l29.21-58.13c2.9-5.79,2.9-12.61.05-18.46ZM202.75,322.96c0,25.48-20.54,46.14-45.88,46.14s-45.88-20.66-45.88-46.14v-82.02c0-25.48,20.54-46.14,45.88-46.14s45.88,20.66,45.88,46.14v82.02ZM350.58,322.96c0,25.48-20.54,46.14-45.88,46.14s-45.88-20.66-45.88-46.14v-82.02c0-25.48,20.54-46.14,45.88-46.14s45.88,20.66,45.88,46.14v82.02Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,l.jsxs)(`svg`,{role:`img`,"aria-label":`Cline icon`,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 466.73 487.04`,fill:`none`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function d(e){let t=(0,c.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,l.jsx)(`title`,{children:`GitHub Copilot icon`}),r=(0,l.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,fill:`currentColor`,d:`M9.6225 2.682C10.2835 3.362 10.561 4.29 10.6775 5.5905C10.9885 5.5905 11.2775 5.658 11.4735 5.9175L11.8385 6.3995C11.9435 6.5385 12 6.7045 12 6.877V8.187C12 8.3565 11.9135 8.5215 11.7735 8.621C10.1195 9.801 8.0785 10.75 6 10.75C3.7 10.75 1.3975 9.4585 0.2265 8.621C0.0865 8.521 0.0005 8.356 0 8.187V6.877C0 6.7045 0.0565 6.5375 0.1605 6.399L0.5255 5.9175C0.7215 5.659 1.0125 5.5905 1.322 5.5905L1.3365 5.442C1.4615 4.219 1.7415 3.3355 2.3775 2.682C3.608 1.412 5.2325 1.2565 5.9505 1.25H6.0495C6.7675 1.2565 8.392 1.4115 9.6225 2.682ZM6.0005 4.846C5.8585 4.846 5.694 4.854 5.5195 4.871C5.458 5.0945 5.367 5.296 5.2345 5.425C4.7095 5.9365 4.0765 6.015 3.7375 6.015C3.4185 6.015 3.0845 5.95 2.812 5.783C2.554 5.8655 2.306 5.9845 2.29 6.281C2.26898 6.76138 2.25847 7.24216 2.2585 7.723L2.2575 7.963C2.2565 8.2445 2.255 8.526 2.251 8.808C2.252 8.971 2.353 9.123 2.506 9.1905C3.747 9.7415 4.921 10.019 6.001 10.019C7.079 10.019 8.253 9.7415 9.4935 9.1905C9.56814 9.15767 9.63181 9.10416 9.677 9.03628C9.72219 8.96841 9.747 8.88902 9.7485 8.8075C9.7635 7.9665 9.7515 7.1215 9.7105 6.281C9.695 5.983 9.4465 5.866 9.1875 5.783C8.9145 5.9495 8.5815 6.015 8.2625 6.015C7.924 6.015 7.2915 5.9365 6.766 5.425C6.633 5.296 6.5425 5.0945 6.481 4.871C6.321 4.855 6.1605 4.8465 6.0005 4.846ZM4.738 6.8525C5.0075 6.8525 5.226 7.0655 5.226 7.3275V8.204C5.226 8.4665 5.0075 8.679 4.738 8.679C4.61033 8.6806 4.48725 8.63149 4.39576 8.54243C4.30426 8.45338 4.25184 8.33166 4.25 8.204V7.328C4.25 7.0655 4.4685 6.8525 4.738 6.8525ZM7.238 6.8525C7.5075 6.8525 7.726 7.0655 7.726 7.3275V8.204C7.726 8.4665 7.5075 8.679 7.238 8.679C7.11033 8.6806 6.98725 8.63149 6.89576 8.54243C6.80426 8.45338 6.75184 8.33166 6.75 8.204V7.328C6.75 7.0655 6.9685 6.8525 7.238 6.8525ZM3.8175 2.5435C3.2925 2.5945 2.85 2.7625 2.625 2.9965C2.1375 3.515 2.2425 4.8305 2.52 5.1085C2.7225 5.3055 3.105 5.437 3.5175 5.437H3.5625C3.887 5.4305 4.455 5.349 4.9275 4.882C5.145 4.677 5.28 4.1655 5.265 3.647C5.25 3.23 5.13 2.887 4.95 2.7405C4.755 2.5725 4.3125 2.4995 3.8175 2.5435ZM7.05 2.7405C6.87 2.8865 6.75 3.2305 6.735 3.647C6.72 4.1655 6.855 4.677 7.0725 4.882C7.5565 5.3605 8.1405 5.434 8.4605 5.437H8.4825C8.895 5.437 9.2775 5.3055 9.48 5.1085C9.7575 4.8305 9.8625 3.515 9.375 2.9965C9.15 2.7625 8.7075 2.5945 8.1825 2.5435C7.6875 2.4995 7.245 2.5725 7.05 2.7405ZM6 3.8075C5.88 3.8075 5.7375 3.815 5.58 3.8295C5.595 3.9095 5.6025 3.9975 5.61 4.0925L5.6095 4.172C5.60894 4.21375 5.60661 4.25545 5.6025 4.297C5.715 4.286 5.815 4.2835 5.9085 4.283H6.0915C6.185 4.283 6.285 4.286 6.3975 4.297C6.39 4.224 6.39 4.1585 6.39 4.0925C6.3975 3.9975 6.405 3.91 6.42 3.8295C6.2804 3.81583 6.14026 3.80849 6 3.8075Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,l.jsxs)(`svg`,{role:`img`,"aria-label":`GitHub Copilot icon`,xmlns:`http://www.w3.org/2000/svg`,width:12,height:12,viewBox:`0 0 12 12`,fill:`none`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function f(e){let t=(0,c.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,l.jsx)(`title`,{children:`Windsurf icon`}),r=(0,l.jsx)(`path`,{fill:`currentColor`,d:`M21.3192 4.9697H21.1203C20.0734 4.96806 19.2238 5.81589 19.2238 6.86264V11.0961C19.2238 11.9415 18.525 12.6263 17.6934 12.6263C17.1993 12.6263 16.706 12.3777 16.4133 11.9603L12.0896 5.78492C11.7308 5.27214 11.1471 4.96643 10.5152 4.96643C9.52943 4.96643 8.64234 5.80448 8.64234 6.83902V11.0969C8.64234 11.9423 7.94932 12.6271 7.11197 12.6271C6.61625 12.6271 6.12376 12.3785 5.83105 11.9611L0.992853 5.0504C0.883594 4.89387 0.638184 4.97133 0.638184 5.1621V8.85424C0.638184 9.04094 0.695264 9.22193 0.802059 9.37517L5.56362 16.175C5.84492 16.5769 6.25994 16.8753 6.73852 16.9837C7.93627 17.256 9.03861 16.334 9.03861 15.1592V10.9037C9.03861 10.0583 9.7235 9.37354 10.569 9.37354H10.5714C11.081 9.37354 11.5588 9.62219 11.8515 10.0396L16.1761 16.2141C16.5356 16.7277 17.0892 17.0326 17.7497 17.0326C18.7574 17.0326 19.6209 16.1937 19.6209 15.16V10.9029C19.6209 10.0575 20.3058 9.37273 21.1512 9.37273H21.32C21.426 9.37273 21.5116 9.28713 21.5116 9.18116V5.16127C21.5116 5.05531 21.426 4.9697 21.32 4.9697H21.3192Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,l.jsxs)(`svg`,{role:`img`,"aria-label":`Windsurf icon`,xmlns:`http://www.w3.org/2000/svg`,width:22,height:22,viewBox:`0 0 22 22`,fill:`none`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}var p=class{map=new Map;constructor(e){if(this.limit=e,e<=0)throw Error(`LruStringCache: limit must be > 0 (got ${e})`)}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}set(e,t){for(this.map.has(e)&&this.map.delete(e),this.map.set(e,t);this.map.size>this.limit;){let e=this.map.keys().next().value;if(e===void 0)break;this.map.delete(e)}}clear(){this.map.clear()}get size(){return this.map.size}};function m(e){let t=(0,c.c)(17),n,s;if(t[0]===e?(n=t[1],s=t[2]):({icon:n,...s}=e,t[0]=e,t[1]=n,t[2]=s),n===`claude`){let e;return t[3]===s?e=t[4]:(e=(0,l.jsx)(i,{...s}),t[3]=s,t[4]=e),e}if(n===`cursor`){let e;return t[5]===s?e=t[6]:(e=(0,l.jsx)(o,{...s}),t[5]=s,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===s?e=t[8]:(e=(0,l.jsx)(f,{...s}),t[7]=s,t[8]=e),e}if(n===`openai`){let e;return t[9]===s?e=t[10]:(e=(0,l.jsx)(a,{...s}),t[9]=s,t[10]=e),e}if(n===`cline`){let e;return t[11]===s?e=t[12]:(e=(0,l.jsx)(u,{...s}),t[11]=s,t[12]=e),e}if(n===`github`){let e;return t[13]===s?e=t[14]:(e=(0,l.jsx)(d,{...s}),t[13]=s,t[14]=e),e}let p=s,m;return t[15]===p?m=t[16]:(m=(0,l.jsx)(r,{strokeWidth:1.5,...p}),t[15]=p,t[16]=m),m}function h(e){return typeof e==`object`&&!!e&&typeof e.getStates==`function`}function g(e,t,n){let r=[],i=[];for(let a of e.getStates().values()){let e=a.agentPresence;if(e)for(let[a,o]of Object.entries(e))o.currentDoc&&(n-o.ts>=5e3||(o.currentDoc===t?r.push({agentId:a,entry:o}):i.push({agentId:a,entry:o})))}return{current:r,crossDoc:i}}export{f as a,s as c,p as i,g as n,d as o,m as r,u as s,h as t};
1
+ import{r as e,t}from"./compiler-runtime-CVnuRdak.js";import{u as n}from"./button-cneJOVxD.js";import{l as r}from"./workspace-paths-BBX7G5gP.js";import{i,r as a,t as o}from"./cursor-CjNH7VrK.js";var s=n(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),c=t(),l=e();function u(e){let t=(0,c.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,l.jsx)(`title`,{children:`Cline icon`}),r=(0,l.jsx)(`path`,{fill:`currentColor`,d:`M463.6,275.08l-29.26-58.75v-33.83c0-56.08-45.01-101.5-100.53-101.5h-50.01c3.62-7.43,5.61-15.79,5.61-24.61,0-31.17-25.08-56.39-56.07-56.39s-56.07,25.22-56.07,56.39c0,8.82,1.99,17.17,5.61,24.61h-50.01c-55.51,0-100.52,45.42-100.52,101.5v33.83l-29.87,58.59c-3.01,5.9-3.01,12.92,0,18.81l29.87,57.93v33.83c0,56.08,45.01,101.5,100.52,101.5h200.95c55.51,0,100.53-45.42,100.53-101.5v-33.83l29.21-58.13c2.9-5.79,2.9-12.61.05-18.46ZM202.75,322.96c0,25.48-20.54,46.14-45.88,46.14s-45.88-20.66-45.88-46.14v-82.02c0-25.48,20.54-46.14,45.88-46.14s45.88,20.66,45.88,46.14v82.02ZM350.58,322.96c0,25.48-20.54,46.14-45.88,46.14s-45.88-20.66-45.88-46.14v-82.02c0-25.48,20.54-46.14,45.88-46.14s45.88,20.66,45.88,46.14v82.02Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,l.jsxs)(`svg`,{role:`img`,"aria-label":`Cline icon`,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 466.73 487.04`,fill:`none`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function d(e){let t=(0,c.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,l.jsx)(`title`,{children:`GitHub Copilot icon`}),r=(0,l.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,fill:`currentColor`,d:`M9.6225 2.682C10.2835 3.362 10.561 4.29 10.6775 5.5905C10.9885 5.5905 11.2775 5.658 11.4735 5.9175L11.8385 6.3995C11.9435 6.5385 12 6.7045 12 6.877V8.187C12 8.3565 11.9135 8.5215 11.7735 8.621C10.1195 9.801 8.0785 10.75 6 10.75C3.7 10.75 1.3975 9.4585 0.2265 8.621C0.0865 8.521 0.0005 8.356 0 8.187V6.877C0 6.7045 0.0565 6.5375 0.1605 6.399L0.5255 5.9175C0.7215 5.659 1.0125 5.5905 1.322 5.5905L1.3365 5.442C1.4615 4.219 1.7415 3.3355 2.3775 2.682C3.608 1.412 5.2325 1.2565 5.9505 1.25H6.0495C6.7675 1.2565 8.392 1.4115 9.6225 2.682ZM6.0005 4.846C5.8585 4.846 5.694 4.854 5.5195 4.871C5.458 5.0945 5.367 5.296 5.2345 5.425C4.7095 5.9365 4.0765 6.015 3.7375 6.015C3.4185 6.015 3.0845 5.95 2.812 5.783C2.554 5.8655 2.306 5.9845 2.29 6.281C2.26898 6.76138 2.25847 7.24216 2.2585 7.723L2.2575 7.963C2.2565 8.2445 2.255 8.526 2.251 8.808C2.252 8.971 2.353 9.123 2.506 9.1905C3.747 9.7415 4.921 10.019 6.001 10.019C7.079 10.019 8.253 9.7415 9.4935 9.1905C9.56814 9.15767 9.63181 9.10416 9.677 9.03628C9.72219 8.96841 9.747 8.88902 9.7485 8.8075C9.7635 7.9665 9.7515 7.1215 9.7105 6.281C9.695 5.983 9.4465 5.866 9.1875 5.783C8.9145 5.9495 8.5815 6.015 8.2625 6.015C7.924 6.015 7.2915 5.9365 6.766 5.425C6.633 5.296 6.5425 5.0945 6.481 4.871C6.321 4.855 6.1605 4.8465 6.0005 4.846ZM4.738 6.8525C5.0075 6.8525 5.226 7.0655 5.226 7.3275V8.204C5.226 8.4665 5.0075 8.679 4.738 8.679C4.61033 8.6806 4.48725 8.63149 4.39576 8.54243C4.30426 8.45338 4.25184 8.33166 4.25 8.204V7.328C4.25 7.0655 4.4685 6.8525 4.738 6.8525ZM7.238 6.8525C7.5075 6.8525 7.726 7.0655 7.726 7.3275V8.204C7.726 8.4665 7.5075 8.679 7.238 8.679C7.11033 8.6806 6.98725 8.63149 6.89576 8.54243C6.80426 8.45338 6.75184 8.33166 6.75 8.204V7.328C6.75 7.0655 6.9685 6.8525 7.238 6.8525ZM3.8175 2.5435C3.2925 2.5945 2.85 2.7625 2.625 2.9965C2.1375 3.515 2.2425 4.8305 2.52 5.1085C2.7225 5.3055 3.105 5.437 3.5175 5.437H3.5625C3.887 5.4305 4.455 5.349 4.9275 4.882C5.145 4.677 5.28 4.1655 5.265 3.647C5.25 3.23 5.13 2.887 4.95 2.7405C4.755 2.5725 4.3125 2.4995 3.8175 2.5435ZM7.05 2.7405C6.87 2.8865 6.75 3.2305 6.735 3.647C6.72 4.1655 6.855 4.677 7.0725 4.882C7.5565 5.3605 8.1405 5.434 8.4605 5.437H8.4825C8.895 5.437 9.2775 5.3055 9.48 5.1085C9.7575 4.8305 9.8625 3.515 9.375 2.9965C9.15 2.7625 8.7075 2.5945 8.1825 2.5435C7.6875 2.4995 7.245 2.5725 7.05 2.7405ZM6 3.8075C5.88 3.8075 5.7375 3.815 5.58 3.8295C5.595 3.9095 5.6025 3.9975 5.61 4.0925L5.6095 4.172C5.60894 4.21375 5.60661 4.25545 5.6025 4.297C5.715 4.286 5.815 4.2835 5.9085 4.283H6.0915C6.185 4.283 6.285 4.286 6.3975 4.297C6.39 4.224 6.39 4.1585 6.39 4.0925C6.3975 3.9975 6.405 3.91 6.42 3.8295C6.2804 3.81583 6.14026 3.80849 6 3.8075Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,l.jsxs)(`svg`,{role:`img`,"aria-label":`GitHub Copilot icon`,xmlns:`http://www.w3.org/2000/svg`,width:12,height:12,viewBox:`0 0 12 12`,fill:`none`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function f(e){let t=(0,c.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,l.jsx)(`title`,{children:`Windsurf icon`}),r=(0,l.jsx)(`path`,{fill:`currentColor`,d:`M21.3192 4.9697H21.1203C20.0734 4.96806 19.2238 5.81589 19.2238 6.86264V11.0961C19.2238 11.9415 18.525 12.6263 17.6934 12.6263C17.1993 12.6263 16.706 12.3777 16.4133 11.9603L12.0896 5.78492C11.7308 5.27214 11.1471 4.96643 10.5152 4.96643C9.52943 4.96643 8.64234 5.80448 8.64234 6.83902V11.0969C8.64234 11.9423 7.94932 12.6271 7.11197 12.6271C6.61625 12.6271 6.12376 12.3785 5.83105 11.9611L0.992853 5.0504C0.883594 4.89387 0.638184 4.97133 0.638184 5.1621V8.85424C0.638184 9.04094 0.695264 9.22193 0.802059 9.37517L5.56362 16.175C5.84492 16.5769 6.25994 16.8753 6.73852 16.9837C7.93627 17.256 9.03861 16.334 9.03861 15.1592V10.9037C9.03861 10.0583 9.7235 9.37354 10.569 9.37354H10.5714C11.081 9.37354 11.5588 9.62219 11.8515 10.0396L16.1761 16.2141C16.5356 16.7277 17.0892 17.0326 17.7497 17.0326C18.7574 17.0326 19.6209 16.1937 19.6209 15.16V10.9029C19.6209 10.0575 20.3058 9.37273 21.1512 9.37273H21.32C21.426 9.37273 21.5116 9.28713 21.5116 9.18116V5.16127C21.5116 5.05531 21.426 4.9697 21.32 4.9697H21.3192Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,l.jsxs)(`svg`,{role:`img`,"aria-label":`Windsurf icon`,xmlns:`http://www.w3.org/2000/svg`,width:22,height:22,viewBox:`0 0 22 22`,fill:`none`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}var p=class{map=new Map;constructor(e){if(this.limit=e,e<=0)throw Error(`LruStringCache: limit must be > 0 (got ${e})`)}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}set(e,t){for(this.map.has(e)&&this.map.delete(e),this.map.set(e,t);this.map.size>this.limit;){let e=this.map.keys().next().value;if(e===void 0)break;this.map.delete(e)}}clear(){this.map.clear()}get size(){return this.map.size}};function m(e){let t=(0,c.c)(17),n,s;if(t[0]===e?(n=t[1],s=t[2]):({icon:n,...s}=e,t[0]=e,t[1]=n,t[2]=s),n===`claude`){let e;return t[3]===s?e=t[4]:(e=(0,l.jsx)(i,{...s}),t[3]=s,t[4]=e),e}if(n===`cursor`){let e;return t[5]===s?e=t[6]:(e=(0,l.jsx)(o,{...s}),t[5]=s,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===s?e=t[8]:(e=(0,l.jsx)(f,{...s}),t[7]=s,t[8]=e),e}if(n===`openai`){let e;return t[9]===s?e=t[10]:(e=(0,l.jsx)(a,{...s}),t[9]=s,t[10]=e),e}if(n===`cline`){let e;return t[11]===s?e=t[12]:(e=(0,l.jsx)(u,{...s}),t[11]=s,t[12]=e),e}if(n===`github`){let e;return t[13]===s?e=t[14]:(e=(0,l.jsx)(d,{...s}),t[13]=s,t[14]=e),e}let p=s,m;return t[15]===p?m=t[16]:(m=(0,l.jsx)(r,{strokeWidth:1.5,...p}),t[15]=p,t[16]=m),m}function h(e){return typeof e==`object`&&!!e&&typeof e.getStates==`function`}function g(e,t,n){let r=[],i=[];for(let a of e.getStates().values()){let e=a.agentPresence;if(e)for(let[a,o]of Object.entries(e))o.currentDoc&&(n-o.ts>=5e3||(o.currentDoc===t?r.push({agentId:a,entry:o}):i.push({agentId:a,entry:o})))}return{current:r,crossDoc:i}}export{f as a,s as c,p as i,g as n,d as o,m as r,u as s,h as t};