@inkeep/open-knowledge 0.27.1-beta.1 → 0.28.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/skills/discovery/SKILL.md +1 -1
- package/dist/assets/skills/project/SKILL.md +1 -1
- package/dist/cli.mjs +6 -6
- package/dist/constants-CrfIfZxB.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/dist/init-D4mCPnC2.mjs +1 -0
- package/dist/{init-JVcJVxEY.mjs → init-ivEBwK7y.mjs} +3 -3
- package/dist/loader-ByJ07pxk.mjs +1 -0
- package/dist/{loader-ixEy1_13.mjs → loader-u0w9n8j8.mjs} +2 -2
- package/dist/preview-BSeDAUIf.mjs +1 -0
- package/dist/{preview-Cv6PfUmC.mjs → preview-DuGdXEFZ.mjs} +2 -2
- package/dist/public/assets/{ActivityModeContent-C5aUKw04.js → ActivityModeContent-FXULq3P6.js} +1 -1
- package/dist/public/assets/DocumentContext-AziEfQFy.js +36 -0
- package/dist/public/assets/{EnableSyncConfirmDialog-CM7n_hoC.js → EnableSyncConfirmDialog-D8UuFHxQ.js} +1 -1
- package/dist/public/assets/{GraphPanel-CTza81SW.js → GraphPanel-CHb0qJOI.js} +2 -2
- package/dist/public/assets/{ManagedArtifactProperties-CWVjllTE.js → ManagedArtifactProperties-70ooWd7O.js} +1 -1
- package/dist/public/assets/{McpConsentDialogBody-DEYxioBK.js → McpConsentDialogBody-BKvKmtg_.js} +1 -1
- package/dist/public/assets/PropertyPanel-Cq1sqsH4.js +2 -0
- package/dist/public/assets/{SettingsDialogBody-Bdcmgui3.js → SettingsDialogBody-BGLGfDpN.js} +2 -2
- package/dist/public/assets/{ShareBranchSwitchDialog-CiPv0nQI.js → ShareBranchSwitchDialog-Clk_4Io5.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-Cqyj-wkq.js → ShareReceiveDialog-BDmjkthD.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-FpCznbtQ.js → ShareReceiveMissDialog-Ds4kHbjr.js} +1 -1
- package/dist/public/assets/{SkillEditorActions-Ccafet7G.js → SkillEditorActions-pVw4b49f.js} +1 -1
- package/dist/public/assets/SourceEditor-DXcSGXCG.js +2 -0
- package/dist/public/assets/{TerminalPanel-EQQLq46y.js → TerminalPanel-Cfp4xEGm.js} +3 -3
- package/dist/public/assets/{auth-state-cache-Bc_I9bTu.js → auth-state-cache-De8QvFee.js} +3 -3
- package/dist/public/assets/{config-provider-CEZVcaXZ.js → config-provider-DY1ejnq-.js} +1 -1
- package/dist/public/assets/{dist-CNSnGZ9C.js → dist-BQeT9ICH.js} +41 -41
- package/dist/public/assets/{doc-hash-DgyRTkQv.js → doc-hash-eLdowlcO.js} +1 -1
- package/dist/public/assets/{documents-events-DnqtZXe7.js → documents-events-DftWTO_p.js} +1 -1
- package/dist/public/assets/{file-tree-adapter-CRZV1_Rs.js → file-tree-adapter-BHXYt6U1.js} +1 -1
- package/dist/public/assets/index-BY2yEG8q.js +2003 -0
- package/dist/public/assets/keyboard-shortcuts-C5JAtPtb.js +1 -0
- package/dist/public/assets/{navigation-targets-DYgvWZ49.js → navigation-targets-fzjpgS0d.js} +1 -1
- package/dist/public/assets/{open-managed-artifact-tab-CIoFOyAR.js → open-managed-artifact-tab-BiLs1dgV.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-BDS56-vQ.js → pending-receive-nav-store-eEQMXb1T.js} +1 -1
- package/dist/public/assets/{prop-types-s-LFwB3O.js → prop-types-DVWxeasv.js} +1 -1
- package/dist/public/assets/{receive-store-C29GivX_.js → receive-store-Ckz3u5Dv.js} +1 -1
- package/dist/public/assets/{selection-context-BCk-SXA9.js → selection-context-DaymKQhd.js} +1 -1
- package/dist/public/assets/{skill-actions-jPAfbBub.js → skill-actions-CBRvSwTx.js} +1 -1
- package/dist/public/assets/{skills-api-DuXrVXK8.js → skills-api-c0dJMBt0.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-D1jqbtay.js → target-navigation-intent-DJtJaVBl.js} +1 -1
- package/dist/public/assets/{typing-burst-detector--cTSnkpJ.js → typing-burst-detector-fx0Rb57X.js} +3 -3
- package/dist/public/index.html +21 -21
- package/dist/{repair-launch-json-DjycVQkK.mjs → repair-launch-json-GbJKeEYH.mjs} +2 -2
- package/dist/{repair-mcp-configs-y4y4K-24.mjs → repair-mcp-configs-DLSIsucG.mjs} +2 -2
- package/dist/{src-BF8Wntv3.mjs → src-Cc1qY4l3.mjs} +2 -2
- package/dist/start-B-djBhNq.mjs +1 -0
- package/dist/{start-C7JWIgQb.mjs → start-FRD4_VQ8.mjs} +2 -2
- package/package.json +1 -1
- package/dist/constants-KS-9Bzpo.mjs +0 -2
- package/dist/init-rHPP9Y_Z.mjs +0 -1
- package/dist/loader-DdezjzEN.mjs +0 -1
- package/dist/preview-CygJcmSs.mjs +0 -1
- package/dist/public/assets/DocumentContext-cOp7rOof.js +0 -36
- package/dist/public/assets/PropertyPanel-CUfe4JDc.js +0 -2
- package/dist/public/assets/SourceEditor-BjxKq1og.js +0 -2
- package/dist/public/assets/index-CVsw5c62.js +0 -2003
- package/dist/public/assets/keyboard-shortcuts-DWlSJLXo.js +0 -1
- package/dist/start-KHoZRBpK.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-DtntyZcb.js";import{t as s}from"./loader-circle-CiIO3Fk-.js";import{n as c,t as te}from"./miss-dialog-store-Ay7SdCdU.js";import{n as l}from"./dist-IEs1iCqd.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-BiB39Lhy.js";import{t as d}from"./desktop-bridge-types-BeY3wQCX.js";import{a as f,n as ce}from"./receive-store-C29GivX_.js";import{t as le}from"./share-metadata-rows-Bd_ant37.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-DtntyZcb.js";import{t as s}from"./loader-circle-CiIO3Fk-.js";import{n as c,t as te}from"./miss-dialog-store-Ay7SdCdU.js";import{n as l}from"./dist-IEs1iCqd.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-BiB39Lhy.js";import{t as d}from"./desktop-bridge-types-BeY3wQCX.js";import{a as f,n as ce}from"./receive-store-Ckz3u5Dv.js";import{t as le}from"./share-metadata-rows-Bd_ant37.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};
|
package/dist/public/assets/{ShareReceiveDialog-Cqyj-wkq.js → ShareReceiveDialog-BDmjkthD.js}
RENAMED
|
@@ -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-CNSnGZ9C.js";import{t as c}from"./button-cneJOVxD.js";import{t as ee}from"./loader-circle-CiIO3Fk-.js";import{n as l}from"./dist-IEs1iCqd.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-BiB39Lhy.js";import{t as h}from"./desktop-bridge-types-BeY3wQCX.js";import{a as re,i as g,n as _,o as v,r as ie,s as y}from"./receive-store-C29GivX_.js";import{t as ae}from"./share-metadata-rows-Bd_ant37.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-2 border-primary/40 bg-card p-4 text-left transition hover:border-primary hover:bg-accent focus:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-primary/40 disabled:hover:bg-card`,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:outline-none focus-visible:ring-2 focus-visible:ring-ring`,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-BQeT9ICH.js";import{t as c}from"./button-cneJOVxD.js";import{t as ee}from"./loader-circle-CiIO3Fk-.js";import{n as l}from"./dist-IEs1iCqd.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-BiB39Lhy.js";import{t as h}from"./desktop-bridge-types-BeY3wQCX.js";import{a as re,i as g,n as _,o as v,r as ie,s as y}from"./receive-store-Ckz3u5Dv.js";import{t as ae}from"./share-metadata-rows-Bd_ant37.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-2 border-primary/40 bg-card p-4 text-left transition hover:border-primary hover:bg-accent focus:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-primary/40 disabled:hover:bg-card`,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:outline-none focus-visible:ring-2 focus-visible:ring-ring`,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};
|
package/dist/public/assets/{ShareReceiveMissDialog-FpCznbtQ.js → ShareReceiveMissDialog-Ds4kHbjr.js}
RENAMED
|
@@ -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-
|
|
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-eEQMXb1T.js";import{t as c}from"./miss-dialog-store-Ay7SdCdU.js";import{c as l,i as u,n as d,s as f,t as p}from"./dialog-BiB39Lhy.js";import{c as m,s as h}from"./doc-hash-eLdowlcO.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};
|
package/dist/public/assets/{SkillEditorActions-Ccafet7G.js → SkillEditorActions-pVw4b49f.js}
RENAMED
|
@@ -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-
|
|
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-BQeT9ICH.js";import{i as te,t as ne}from"./button-cneJOVxD.js";import{t as o}from"./chevron-down-D3nis7uo.js";import{i as s,r as c}from"./skill-actions-CBRvSwTx.js";import{T as re,_ as l,h as u,m as ie,p as ae,v as oe,x as d}from"./skills-api-c0dJMBt0.js";var se=r(),f=e(t(),1),p=n(),m=a.options;function h(e){let t=(0,se.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=ae;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=u,B=`end`,V=`min-w-52`,t[47]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,p.jsx)(oe,{children:(0,p.jsx)(i,{id:`npcziF`})}),t[47]=H):H=t[47],U=m.map(t=>(0,p.jsx)(ie,{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)(d,{}),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,2 @@
|
|
|
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{G as i,M as a,N as o,Nt as s,P as c,Pt as l,Q as u,X as d,Xt as f}from"./DocumentContext-AziEfQFy.js";import{n as p}from"./dist-BVOt51sU.js";import{M as m,si as h,sn as g}from"./dist-BQeT9ICH.js";import{B as _,C as v,H as y,P as b,V as x,b as S,et as C,p as w,tt as T,w as E,y as D}from"./config-provider-DY1ejnq-.js";import{n as ee}from"./config-context-CVpOcWSZ.js";import{l as te}from"./keyboard-shortcuts-C5JAtPtb.js";import{$ as O,Dt as ne,Et as k,Ft as A,J as j,Ot as M,P as N,Q as P,Tt as F,X as I,jt as L,pt as R,ut as re,xt as z}from"./dist-DLLyJf3c.js";import{a as B,d as ie,f as ae,h as oe,i as V,m as se,t as ce,u as le}from"./typing-burst-detector-fx0Rb57X.js";import{o as H,r as U}from"./selection-context-DaymKQhd.js";var W=e(t(),1),ue=r(),G=class e{constructor(e,t){this.yanchor=e,this.yhead=t}toJSON(){return{yanchor:b(this.yanchor),yhead:b(this.yhead)}}static fromJSON(t){return new e(v(t.yanchor),v(t.yhead))}},K=class{constructor(e,t){this.ytext=e,this.awareness=t,this.undoManager=new w(e)}toYPos(e,t=0){return E(this.ytext,e,t)}fromYPos(e){let t=S(v(e),this.ytext.doc);if(t==null||t.type!==this.ytext)throw Error(`[y-codemirror] The position you want to retrieve was created by a different document`);return{pos:t.index,assoc:t.assoc}}toYRange(e){let t=e.assoc;return new G(this.toYPos(e.anchor,t),this.toYPos(e.head,t))}fromYRange(e){let t=this.fromYPos(e.yanchor),n=this.fromYPos(e.yhead);return t.pos===n.pos?k.cursor(n.pos,n.assoc):k.range(t.pos,n.pos)}},q=M.define({combine(e){return e[e.length-1]}}),J=z.define(),Y=class{constructor(e){this.view=e,this.conf=e.state.facet(q),this._observer=(t,n)=>{if(n.origin!==this.conf){let n=t.delta,r=[],i=0;for(let e=0;e<n.length;e++){let t=n[e];t.insert==null?t.delete==null?i+=t.retain:(r.push({from:i,to:i+t.delete,insert:``}),i+=t.delete):r.push({from:i,to:i,insert:t.insert})}e.dispatch({changes:r,annotations:[J.of(this.conf)]})}},this._ytext=this.conf.ytext,this._ytext.observe(this._observer)}update(e){if(!e.docChanged||e.transactions.length>0&&e.transactions[0].annotation(J)===this.conf)return;let t=this.conf.ytext;t.doc.transact(()=>{let n=0;e.changes.iterChanges((e,r,i,a,o)=>{let s=o.sliceString(0,o.length,`
|
|
2
|
+
`);e!==r&&t.delete(e+n,r-e),s.length>0&&t.insert(e+n,s),n+=s.length-(r-e)})},this.conf)}destroy(){this._ytext.unobserve(this._observer)}},de=P.fromClass(Y),fe=I.baseTheme({".cm-ySelection":{},".cm-yLineSelection":{padding:0,margin:`0px 2px 0px 4px`},".cm-ySelectionCaret":{position:`relative`,borderLeft:`1px solid black`,borderRight:`1px solid black`,marginLeft:`-1px`,marginRight:`-1px`,boxSizing:`border-box`,display:`inline`},".cm-ySelectionCaretDot":{borderRadius:`50%`,position:`absolute`,width:`.4em`,height:`.4em`,top:`-.2em`,left:`-.2em`,backgroundColor:`inherit`,transition:`transform .3s ease-in-out`,boxSizing:`border-box`},".cm-ySelectionCaret:hover > .cm-ySelectionCaretDot":{transformOrigin:`bottom center`,transform:`scale(0)`},".cm-ySelectionInfo":{position:`absolute`,top:`-1.05em`,left:`-1px`,fontSize:`.75em`,fontFamily:`serif`,fontStyle:`normal`,fontWeight:`normal`,lineHeight:`normal`,userSelect:`none`,color:`white`,paddingLeft:`2px`,paddingRight:`2px`,zIndex:101,transition:`opacity .3s ease-in-out`,backgroundColor:`inherit`,opacity:0,transitionDelay:`0s`,whiteSpace:`nowrap`},".cm-ySelectionCaret:hover > .cm-ySelectionInfo":{opacity:1,transitionDelay:`0s`}}),pe=z.define(),me=class extends O{constructor(e,t){super(),this.color=e,this.name=t}toDOM(){return _(`span`,[y(`class`,`cm-ySelectionCaret`),y(`style`,`background-color: ${this.color}; border-color: ${this.color}`)],[x(``),_(`div`,[y(`class`,`cm-ySelectionCaretDot`)]),x(``),_(`div`,[y(`class`,`cm-ySelectionInfo`)],[x(this.name)]),x(``)])}eq(e){return e.color===this.color}compare(e){return e.color===this.color}updateDOM(){return!1}get estimatedHeight(){return-1}ignoreEvent(){return!0}},he=class{constructor(e){this.conf=e.state.facet(q),this._listener=({added:t,updated:n,removed:r},i,a)=>{t.concat(n).concat(r).findIndex(e=>e!==this.conf.awareness.doc.clientID)>=0&&e.dispatch({annotations:[pe.of([])]})},this._awareness=this.conf.awareness,this._awareness.on(`change`,this._listener),this.decorations=L.of([])}destroy(){this._awareness.off(`change`,this._listener)}update(e){let t=this.conf.ytext,n=t.doc,r=this.conf.awareness,i=[],a=this.conf.awareness.getLocalState();if(a!=null){let n=e.view.hasFocus&&e.view.dom.ownerDocument.hasFocus(),i=n?e.state.selection.main:null,o=a.cursor==null?null:v(a.cursor.anchor),s=a.cursor==null?null:v(a.cursor.head);if(i!=null){let e=E(t,i.anchor),n=E(t,i.head);(a.cursor==null||!D(o,e)||!D(s,n))&&r.setLocalStateField(`cursor`,{anchor:e,head:n})}else a.cursor!=null&&n&&r.setLocalStateField(`cursor`,null)}r.getStates().forEach((a,o)=>{if(o===r.doc.clientID)return;let s=a.cursor;if(s==null||s.anchor==null||s.head==null)return;let c=S(s.anchor,n),l=S(s.head,n);if(c==null||l==null||c.type!==t||l.type!==t)return;let{color:u=`#30bced`,name:d=`Anonymous`}=a.user||{},f=a.user&&a.user.colorLight||u+`33`,p=T(c.index,l.index),m=C(c.index,l.index),h=e.view.state.doc.lineAt(p),g=e.view.state.doc.lineAt(m);if(h.number===g.number)i.push({from:p,to:m,value:j.mark({attributes:{style:`background-color: ${f}`},class:`cm-ySelection`})});else{i.push({from:p,to:h.from+h.length,value:j.mark({attributes:{style:`background-color: ${f}`},class:`cm-ySelection`})}),i.push({from:g.from,to:m,value:j.mark({attributes:{style:`background-color: ${f}`},class:`cm-ySelection`})});for(let t=h.number+1;t<g.number;t++){let n=e.view.state.doc.line(t).from;i.push({from:n,to:n,value:j.line({attributes:{style:`background-color: ${f}`,class:`cm-yLineSelection`}})})}}i.push({from:l.index,to:l.index,value:j.widget({side:l.index-c.index>0?-1:1,block:!1,widget:new me(u,d)})})}),this.decorations=j.set(i,!0)}},ge=P.fromClass(he,{decorations:e=>e.decorations}),_e=class{constructor(e){this.undoManager=e}addTrackedOrigin(e){this.undoManager.addTrackedOrigin(e)}removeTrackedOrigin(e){this.undoManager.removeTrackedOrigin(e)}undo(){return this.undoManager.undo()!=null}redo(){return this.undoManager.redo()!=null}},X=M.define({combine(e){return e[e.length-1]}});z.define();var ve=class{constructor(e){this.view=e,this.conf=e.state.facet(X),this._undoManager=this.conf.undoManager,this.syncConf=e.state.facet(q),this._beforeChangeSelection=null,this._mux=f(),this._onStackItemAdded=({stackItem:e,changedParentTypes:t})=>{t.has(this.syncConf.ytext)&&this._beforeChangeSelection&&!e.meta.has(this)&&e.meta.set(this,this._beforeChangeSelection)},this._onStackItemPopped=({stackItem:t})=>{let n=t.meta.get(this);if(n){let t=this.syncConf.fromYRange(n);e.dispatch(e.state.update({selection:t,effects:[I.scrollIntoView(t)]})),this._storeSelection()}},this._storeSelection=()=>{this._beforeChangeSelection=this.syncConf.toYRange(this.view.state.selection.main)},this._undoManager.on(`stack-item-added`,this._onStackItemAdded),this._undoManager.on(`stack-item-popped`,this._onStackItemPopped),this._undoManager.addTrackedOrigin(this.syncConf)}update(e){e.selectionSet&&(e.transactions.length===0||e.transactions[0].annotation(J)!==this.syncConf)&&this._storeSelection()}destroy(){this._undoManager.off(`stack-item-added`,this._onStackItemAdded),this._undoManager.off(`stack-item-popped`,this._onStackItemPopped),this._undoManager.removeTrackedOrigin(this.syncConf)}},ye=P.fromClass(ve),be=({state:e,dispatch:t})=>e.facet(X).undo()||!0,xe=({state:e,dispatch:t})=>e.facet(X).redo()||!0,Se=(e,t,{undoManager:n=new w(e)}={})=>{let r=new K(e,t),i=[q.of(r),de];return t&&i.push(fe,ge),n!==!1&&i.push(X.of(new _e(n)),ye,I.domEventHandlers({beforeinput(e,t){return e.inputType===`historyUndo`?be(t):e.inputType===`historyRedo`?xe(t):!1}})),i},Ce=j.mark({class:`cm-link-ref-broken`}),Z=/^\s{0,3}\[([^\]]+)\]:\s/,Q=/\[([^\]]*)\]\[([^\]]*)\]/g,we=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function $(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 Te(e){let t=[];return N(e).iterate({enter(e){if(we.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function Ee(e){let t=new Set,n=[],r=e.doc,i=Te(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if($(n.from,i))continue;let a=Z.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!$(t.from,i)&&!Z.test(t.text))for(Q.lastIndex=0;;){let e=Q.exec(t.text);if(!e)break;let r=t.from+e.index;if($(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(Ce.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),j.set(a)}var De=A.define({create(e){return Ee(e)},update(e,t){return t.docChanged?Ee(t.state):e},provide:e=>I.decorations.from(e)}),Oe=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,ke=j.mark({class:`cm-del`}),Ae=j.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),je=j.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function Me(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function Ne(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!m.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(m.test(r.text))return{from:t.from,to:r.to}}return null}function Pe(e,t){let n=[],r=N(e),i=Ne(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(ke.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=Oe.exec(r.text),a=i?i[1].length:2,o=j.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=Me(r.text),a=j.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(Ae.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(je.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(je.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),j.set(n)}var Fe=class{decorations;constructor(e){this.decorations=Pe(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||N(e.startState)!==N(e.state))&&(this.decorations=Pe(e.view.state,e.view.visibleRanges))}},Ie=P.fromClass(Fe,{decorations:e=>e.decorations});function Le(){return[Ie,De]}var Re=n(),ze=56;function Be(e,t){let n=e.state.doc,r=1;if(n.lines>=1&&m.test(n.line(1).text)){for(let e=2;e<=n.lines;e++)if(m.test(n.line(e).text)){r=e+1;break}}let i=g(),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:k.cursor(r.from),effects:I.scrollIntoView(r.from,{y:`start`})}),e.focus();return}a++}}}function Ve(e,t){requestAnimationFrame(()=>{let n=e.state.doc,r=Math.min(t.offset,n.length);e.dispatch({selection:k.cursor(r),effects:I.scrollIntoView(r,{y:`center`})}),e.focus()})}function He(e){let t=(0,ue.c)(33),{docName:n,ytext:r,provider:i,placeholder:f,isSourceModeActive:m}=e,g=(0,W.useRef)(null),_=(0,W.useRef)(null),[v,y]=(0,W.useState)(null);if(v)throw v;let{resolvedTheme:b}=p(),{merged:x}=ee(),S=(0,W.useRef)(m),C=x?.editor?.wordWrap??!0,w,T;t[0]===m?(w=t[1],T=t[2]):(w=()=>{S.current=m},T=[m],t[0]=m,t[1]=w,t[2]=T),(0,W.useEffect)(w,T);let E=(0,W.useRef)(null),D;t[3]!==f||t[4]!==i||t[5]!==b||t[6]!==C||t[7]!==r?(D=()=>{let e=g.current;if(!e)return;let t=i.configuration.name??``,n,o=Ge;try{n=s({docName:t,container:e,sizeStats:{viewCount:0,bytes:r.length},factory:e=>{let n=null,s=u({ydoc:i.document,ytext:r}),c=new F,l=new F,p=new F,m=new I({state:ne.create({doc:r.toString(),extensions:[le,ie({scrollToMatch:We}),re.of([d]),Se(r,i.awareness),...a({themeCompartment:c,resolvedTheme:b,ydoc:i.document,wordWrapCompartment:l,wordWrap:C,currentDocName:t}),Le(),s,I.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(n!==null&&clearTimeout(n),n=setTimeout(()=>{n=null,V(t,`source`,B(e.view)),U(t,`source`,H(e.view,t))},120))}),I.domEventHandlers({keydown:(e,t)=>!S.current||!h()||!te(e,`edit-with-ai`)?!1:(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),ce(),!0)}),p.of(R(f??``)),I.theme({"&":{height:`100%`}}),I.scrollMargins.of(Ue)]}),parent:e});V(t,`source`,B(m)),U(t,`source`,H(m,t));let g=m.contentDOM;return g.addEventListener(`keydown`,o),g.addEventListener(`paste`,o),g.addEventListener(`drop`,o),g.addEventListener(`cut`,o),{view:m,ydoc:i.document,ytext:r,provider:i,themeCompartment:c,wordWrapCompartment:l,placeholderCompartment:p}}}),E.current=n,_.current=n.view}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),E.current=null,_.current=null,y(t instanceof Error?t:Error(String(t)))}return()=>{let e=E.current;e&&l(e),E.current=null,_.current=null}},t[3]=f,t[4]=i,t[5]=b,t[6]=C,t[7]=r,t[8]=D):D=t[8];let O;t[9]!==i||t[10]!==r?(O=[r,i],t[9]=i,t[10]=r,t[11]=O):O=t[11],(0,W.useEffect)(D,O);let k,A;t[12]===n?(k=t[13],A=t[14]):(k=()=>{},A=[n],t[12]=n,t[13]=k,t[14]=A),(0,W.useEffect)(k,A);let j,M;t[15]===b?(j=t[16],M=t[17]):(j=()=>{let e=E.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(b===`dark`?o:c)})},M=[b],t[15]=b,t[16]=j,t[17]=M),(0,W.useEffect)(j,M);let N,P;t[18]===C?(N=t[19],P=t[20]):(P=()=>{let e=E.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(C?I.lineWrapping:[])})},N=[C],t[18]=C,t[19]=N,t[20]=P),(0,W.useEffect)(P,N);let L,z;t[21]===f?(L=t[22],z=t[23]):(L=()=>{let e=E.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(R(f??``))})},z=[f],t[21]=f,t[22]=L,t[23]=z),(0,W.useEffect)(L,z);let G,K;t[24]!==n||t[25]!==m?(G=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`source`||!m)return;let r=_.current;r&&(Be(r,t),se(n))};return window.addEventListener(ae,e),()=>window.removeEventListener(ae,e)},K=[n,m],t[24]=n,t[25]=m,t[26]=G,t[27]=K):(G=t[26],K=t[27]),(0,W.useEffect)(G,K);let q,J;t[28]!==n||t[29]!==m?(q=()=>{if(!m)return;let e=_.current;if(!e)return;let t=oe(n);if(t){if(t.kind===`outline`){Be(e,t.detail);return}Ve(e,t.detail)}},J=[n,m],t[28]=n,t[29]=m,t[30]=q,t[31]=J):(q=t[30],J=t[31]),(0,W.useEffect)(q,J);let Y;return t[32]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Re.jsx)(`div`,{ref:g,className:`source-editor h-full pb-3`}),t[32]=Y):Y=t[32],Y}function Ue(){return{top:ze}}function We(e){return I.scrollIntoView(e,{y:`start`})}function Ge(){return i()}export{He as SourceEditor};
|