@inkeep/open-knowledge 0.30.0-beta.3 → 0.30.0-beta.5
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 +54 -54
- package/dist/config-schema.json +24 -0
- package/dist/config.project-local.schema.json +24 -0
- package/dist/constants-CvXLVbm6.mjs +2 -0
- package/dist/{dist-DAVo_TRx.mjs → dist-Cz2oOaYb.mjs} +17 -15
- package/dist/dist-DArAF-Z8.mjs +1 -0
- package/dist/{gh-detect-BxDh8M_E.mjs → gh-detect-OjM7QxYB.mjs} +2 -2
- package/dist/index.mjs +1 -1
- package/dist/init-BRSDpXwQ.mjs +1 -0
- package/dist/{init-Cj3rYYNW.mjs → init-iHmXas-2.mjs} +5 -5
- package/dist/{launch-json-removal-Bsd2If9V.mjs → launch-json-removal-yifel8HM.mjs} +2 -2
- package/dist/loader-b4IAzAz6.mjs +1 -0
- package/dist/{loader-DBQRSW23.mjs → loader-hl0o6W6h.mjs} +3 -3
- package/dist/{open-browser-6ztGUs93.mjs → open-browser-BE9TwPRU.mjs} +2 -2
- package/dist/{preview-4_TQ2eLW.mjs → preview-CPvGhej6.mjs} +2 -2
- package/dist/preview-DTCU2jNI.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-gJPRToqC.js → ActivityModeContent-D2vlnwuv.js} +1 -1
- package/dist/public/assets/CodeMirrorPropInput-DIQ7Kf5H.js +3 -0
- package/dist/public/assets/DocumentContext-D3J8u-yJ.js +35 -0
- package/dist/public/assets/{EnableSyncConfirmDialog-Ds9VzFz7.js → EnableSyncConfirmDialog-BARabdkd.js} +1 -1
- package/dist/public/assets/{GraphPanel-DticGDW4.js → GraphPanel-fXnpaAgY.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-BG7ax3pN.js → ManagedArtifactProperties-BLeL9TCx.js} +1 -1
- package/dist/public/assets/{McpConsentDialogBody-jKfEiUIH.js → McpConsentDialogBody-x2AhHc7a.js} +1 -1
- package/dist/public/assets/{MermaidDocEditor-B_WSq6De.js → MermaidDocEditor-sSBTLHZ8.js} +1 -1
- package/dist/public/assets/{PropertyPanel-JSTiSMvX.js → PropertyPanel-DGyVDpJX.js} +1 -1
- package/dist/public/assets/{SettingsDialogBody-C4mvHDJH.js → SettingsDialogBody-UFh0-nb1.js} +2 -2
- package/dist/public/assets/{ShareBranchSwitchDialog-2z9NWmqe.js → ShareBranchSwitchDialog-CHkvSij0.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-CGSDsgBh.js → ShareReceiveDialog-DJb80ZUd.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-D7zjXalK.js → ShareReceiveMissDialog-CtSEaJGF.js} +1 -1
- package/dist/public/assets/{SkillEditorActions-CxGse8tc.js → SkillEditorActions-Dd3W2TJ2.js} +1 -1
- package/dist/public/assets/SourceEditor-DpFI9KX7.js +1 -0
- package/dist/public/assets/{TerminalPanel-B3CcTB8S.js → TerminalPanel-D1ztFh-8.js} +1 -1
- package/dist/public/assets/{agent-presence-DJQje6SV.js → agent-presence-DYvXM7da.js} +1 -1
- package/dist/public/assets/{auth-state-cache-DyKWS3xm.js → auth-state-cache-DCGhumiU.js} +1 -1
- package/dist/public/assets/{config-provider-D0CfBIwU.js → config-provider-Bkj9YufI.js} +1 -1
- package/dist/public/assets/{dist-DoFKRM_F.js → dist-B27DnPFz.js} +2 -2
- package/dist/public/assets/{dist-CJc7OX7s.js → dist-W-hKJCWn.js} +12 -6
- package/dist/public/assets/{doc-hash-B7rSgZqz.js → doc-hash-CCfJH4d9.js} +1 -1
- package/dist/public/assets/{documents-events-Bit0pJeY.js → documents-events-C2yqFJPg.js} +1 -1
- package/dist/public/assets/file-tree-adapter-8cV2wqcm.js +1 -0
- package/dist/public/assets/index-BJaSDWbA.js +2003 -0
- package/dist/public/assets/{keyboard-shortcuts-CvYXgqK4.js → keyboard-shortcuts-BrZDq1VP.js} +1 -1
- package/dist/public/assets/navigation-targets-D5Vr3b-e.js +1 -0
- package/dist/public/assets/{open-managed-artifact-tab-Da7L5wL4.js → open-managed-artifact-tab-7RGWt7Lr.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-CAm5nHeI.js → pending-receive-nav-store-DRc7Xpt6.js} +1 -1
- package/dist/public/assets/{prop-types-BwJNmxtq.js → prop-types-Zdll0W8u.js} +1 -1
- package/dist/public/assets/{receive-store-C72xSCDE.js → receive-store-Brkf98BO.js} +1 -1
- package/dist/public/assets/{selection-context-JPA-xW1g.js → selection-context-DArc3SI0.js} +1 -1
- package/dist/public/assets/{skill-actions-CMd77Yt2.js → skill-actions-BfvtIGj9.js} +1 -1
- package/dist/public/assets/{skills-api-UoasHTUi.js → skills-api-DQp0sBix.js} +1 -1
- package/dist/public/assets/{src-CXdmKAqZ.js → src-BGo7Caak.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-C_Y-i35d.js → target-navigation-intent-BH9odHdJ.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-DLup_S3P.js → typing-burst-detector-DiAheTFV.js} +2 -2
- package/dist/public/assets/{workspace-paths-CYa5l8eZ.js → workspace-paths-DDVHpOi-.js} +1 -1
- package/dist/public/index.html +25 -25
- package/dist/{repair-launch-json-CtA3dzno.mjs → repair-launch-json-Ci58ZFOB.mjs} +2 -2
- package/dist/{repair-mcp-configs-DP4ZjS6O.mjs → repair-mcp-configs-BZ3WjjMF.mjs} +2 -2
- package/dist/{repair-skills-zutt1is6.mjs → repair-skills-DEr0n_7M.mjs} +2 -2
- package/dist/repair-skills-Do4RqKu3.mjs +1 -0
- package/dist/schemas/v0/config.project-local.schema.json +24 -0
- package/dist/server-lock-GuuouVft-BiYh08SN.mjs +1 -0
- package/dist/{server-lock-iLcBw_q0-RDMfTH6b.mjs → server-lock-iLcBw_q0-7VqZoW4r.mjs} +25 -18
- package/dist/{src-Z7vZvOn3.mjs → src-DhuiHwcZ.mjs} +3 -3
- package/dist/{start-B1VS-wwf.mjs → start-CmL4qv8P.mjs} +2 -2
- package/dist/start-D06sB6Pa.mjs +1 -0
- package/dist/{write-project-skill-BzVHToYO.mjs → write-project-skill-DNrA5OdY.mjs} +2 -2
- package/package.json +1 -1
- package/dist/constants-CgHcIqh6.mjs +0 -2
- package/dist/dist-DJ0wJimx.mjs +0 -1
- package/dist/init-CNK7GfhY.mjs +0 -1
- package/dist/loader-BkadQueQ.mjs +0 -1
- package/dist/preview-4uaPC3tK.mjs +0 -1
- package/dist/public/assets/CodeMirrorPropInput-A-b7Ox39.js +0 -3
- package/dist/public/assets/DocumentContext-Cf3xyIUc.js +0 -35
- package/dist/public/assets/SourceEditor-B4hGDoTR.js +0 -1
- package/dist/public/assets/file-tree-adapter--v55j77z.js +0 -1
- package/dist/public/assets/index--kgVY3Zd.js +0 -2003
- package/dist/public/assets/navigation-targets-D-taKoGj.js +0 -1
- package/dist/repair-skills-B0TdudPZ.mjs +0 -1
- package/dist/server-lock-GuuouVft-CCnjEa8y.mjs +0 -1
- package/dist/start-DGO0EIO_.mjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{n as i,r as a}from"./dist-CQw2y-s3.js";import{t as o}from"./button-cneJOVxD.js";import{t as ee}from"./git-branch-q0qWPEwd.js";import{t as s}from"./loader-circle-B7Gv_Djz.js";import{n as c,t as te}from"./miss-dialog-store-PJQ_kr0I.js";import{n as l}from"./dist-CoyydoqN.js";import{a as ne,c as re,i as ie,n as ae,o as u,s as oe,t as se}from"./dialog-DdHaoAGK.js";import{t as d}from"./desktop-bridge-types-NXCK8Pd7.js";import{a as f,n as ce}from"./receive-store-C72xSCDE.js";import{t as le}from"./share-metadata-rows-BttnPmuW.js";var p=e(t(),1),m=r();function ue(e){let t=e.shareTargetExists,n=e.dirtyConflicts.conflicts,r=e.dirtyConflicts.files;return t&&!n?{kind:`A`,openCurrentEnabled:!0,switchEnabled:!0,conflictingFiles:r}:!t&&!n?{kind:`B`,openCurrentEnabled:!1,switchEnabled:!0,conflictingFiles:r}:t&&n?{kind:`C`,openCurrentEnabled:!0,switchEnabled:!1,conflictingFiles:r}:{kind:`D`,openCurrentEnabled:!1,switchEnabled:!1,conflictingFiles:r}}function de(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function h(e){if(e.ok)return{action:`await-cc1`};switch(e.reason){case`dirty-conflict`:return{action:`rerender-conflict`,files:e.files??[]};case`branch-not-found`:return{action:`dismiss-with-toast`,reason:`branch-not-found`};case`fetch-failed`:case`checkout-failed`:return{action:`stay-with-toast`,reason:e.reason};case`branch-in-other-worktree`:{let t=e.otherWorktreePath;return t===void 0||t.length===0?{action:`stay-with-toast`,reason:`checkout-failed`}:{action:`pivot-to-other-worktree`,otherWorktreePath:t}}case`ff-diverged`:return{action:`branch-diverged`};default:{let t=e.reason;throw Error(`Unhandled CheckoutFailureReason: ${String(t)}`)}}}var fe={phase:`loading`};function pe(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function me(e,t){return e.phase!==`ready`&&e.phase!==`verdict`?e:{phase:`switching`,info:e.info,pendingDoc:t}}function he(e){return ue(e).kind===`B`&&e.shareTargetOnOriginBranch===!1}function ge(e){return e.phase===`ready`?{phase:`verdict-pending`,info:e.info}:e}function _e(e,t){if(e.phase!==`verdict-pending`)return e;if(t===null||t.verdict===`unknown`||t.verdict===`changed-locally`)return{phase:`ready`,info:e.info};let n=t.verdict===`renamed`?{kind:`renamed`,renamedTo:t.renamedTo}:{kind:t.verdict};return{phase:`verdict`,info:e.info,resolution:n}}function ve(e,t){if(e.phase!==`switching`)return{state:e};if(t===null)return{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}};let n=h(t);return n.action===`await-cc1`?{state:{phase:`awaiting-cc1-recycle`,pendingDoc:e.pendingDoc}}:n.action===`rerender-conflict`?{state:{phase:`ready`,info:{...e.info,dirtyConflicts:{conflicts:!0,files:n.files.slice()}}}}:n.action===`pivot-to-other-worktree`?{state:{phase:`branch-in-other-worktree`,info:e.info,otherWorktreePath:n.otherWorktreePath,pendingDoc:e.pendingDoc}}:n.action===`dismiss-with-toast`?{state:{phase:`dismissed`,reason:n.reason},sideEffect:{kind:`toast`,reason:n.reason}}:n.action===`branch-diverged`?{state:{phase:`verdict`,info:e.info,resolution:{kind:`diverged`}}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:n.reason}}}var g=n();function ye(e){return e!==null&&e.kind===`project-branch-switch`}function _(e){let t=(0,m.c)(184),{bridge:n,store:r}=e,h=r===void 0?ce:r,{_}=a(),v=(0,p.useSyncExternalStore)(h.subscribe,h.getSnapshot,Ee),[y,b]=(0,p.useState)(fe),De=(0,p.useRef)(!1),Oe=(0,p.useRef)(!1),ke=(0,p.useRef)(!1),Ae=(0,p.useRef)(null),je;t[0]===v?je=t[1]:(je=ye(v)?v:null,t[0]=v,t[1]=je);let x=je,Me;t[2]!==_||t[3]!==x?.share.target.kind?(Me=x?.share.target.kind===`folder`?_({id:`ugoTXs`}):_({id:`XH30C4`}),t[2]=_,t[3]=x?.share.target.kind,t[4]=Me):Me=t[4];let S=Me,C;t[5]===x?C=t[6]:(C=()=>{b(fe),De.current=!1,Oe.current=!1,ke.current=!1,Ae.current=x},t[5]=x,t[6]=C);let Ne;t[7]===v?Ne=t[8]:(Ne=[v],t[7]=v,t[8]=Ne),(0,p.useEffect)(C,Ne);let Pe;t[9]!==x||t[10]!==n?(Pe=()=>{if(!x||De.current)return;De.current=!0;let e=!1;return n.project.fetchBranchInfo({projectPath:x.projectPath,branch:x.share.branch,kind:x.share.target.kind,path:d(x.share.target)}).then(t=>{e||b(e=>pe(e,t))}).catch(t=>{e||(console.warn(`[receive] branch-info-fetch-failed`,t instanceof Error?t.message:t),b(Te))}),()=>{e=!0}},t[9]=x,t[10]=n,t[11]=Pe):Pe=t[11];let Fe;t[12]===x?Fe=t[13]:(Fe=[x],t[12]=x,t[13]=Fe),(0,p.useEffect)(Pe,Fe);let Ie;t[14]!==x||t[15]!==y.info||t[16]!==y.phase||t[17]!==n?(Ie=()=>{if(!x||y.phase!==`ready`||ke.current||!he(y.info))return;ke.current=!0,b(ge);let e=x;n.project.fetchTargetStatus({projectPath:x.projectPath,branch:x.share.branch,kind:x.share.target.kind,path:d(x.share.target)}).then(t=>{Ae.current===e&&b(e=>_e(e,t))}).catch(t=>{Ae.current===e&&(console.warn(`[receive] target-status-fetch-failed`,t instanceof Error?t.message:t),b(we))})},t[14]=x,t[15]=y.info,t[16]=y.phase,t[17]=n,t[18]=Ie):Ie=t[18];let Le;t[19]!==x||t[20]!==y.phase?(Le=[y.phase,x],t[19]=x,t[20]=y.phase,t[21]=Le):Le=t[21],(0,p.useEffect)(Ie,Le);let Re;t[22]!==x||t[23]!==y.phase||t[24]!==y.resolution||t[25]!==h?(Re=()=>{if(y.phase!==`verdict`)return;let{kind:e}=y.resolution;e!==`deleted`&&e!==`never-on-branch`||x&&(te.arm({kind:x.share.target.kind,path:d(x.share.target),branch:x.share.branch}),h.dismiss())},t[22]=x,t[23]=y.phase,t[24]=y.resolution,t[25]=h,t[26]=Re):Re=t[26];let ze;t[27]!==x||t[28]!==y||t[29]!==h?(ze=[y,x,h],t[27]=x,t[28]=y,t[29]=h,t[30]=ze):ze=t[30],(0,p.useEffect)(Re,ze);let Be;t[31]!==_||t[32]!==x||t[33]!==y.pendingDoc||t[34]!==y.phase||t[35]!==n||t[36]!==h||t[37]!==S?(Be=()=>{if(y.phase!==`awaiting-cc1-recycle`||!x)return;let e=x.share.branch,t=y.pendingDoc;if(!e){h.dismiss();return}if(Oe.current)return;Oe.current=!0;let r=!1;return n.project.awaitBranchSwitched({projectPath:x.projectPath,branch:e,timeoutMs:3e4}).then(i=>{if(!r){if(i.ok){console.log(f({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:x.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:x.share.target.kind,path:t},pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),l.error(_({id:`gQV-9w`,values:{targetNoun:S}}))}),h.dismiss();return}console.log(f({branch_dialog_action:`branch-switch-timeout`,branch:e})),l.error(_({id:`LBwUR6`,values:{targetNoun:S}})),h.dismiss()}}).catch(e=>{r||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),l.error(_({id:`Jw6EC4`,values:{targetNoun:S}})),h.dismiss())}),()=>{r=!0}},t[31]=_,t[32]=x,t[33]=y.pendingDoc,t[34]=y.phase,t[35]=n,t[36]=h,t[37]=S,t[38]=Be):Be=t[38];let Ve;if(t[39]!==x||t[40]!==y.phase?(Ve=[y.phase,x],t[39]=x,t[40]=y.phase,t[41]=Ve):Ve=t[41],(0,p.useEffect)(Be,Ve),!x)return null;let{share:w,projectPath:T,currentBranch:E}=x,D=w.branch,O;t[42]!==_||t[43]!==n.project||t[44]!==T||t[45]!==D||t[46]!==h?(O=function(e,t){console.log(f({branch_dialog_action:`switch`,branch_action:`switch`,branch:D})),b(t=>me(t,e)),n.project.runCheckout(t?{projectPath:T,branch:D,fastForward:!0}:{projectPath:T,branch:D}).then(e=>{let t=null,n=!1;b(r=>{let{state:i,sideEffect:a}=ve(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?l.error(_({id:`NJyQi_`,values:{shareBranch:D}})):t===`fetch-failed`?l.error(_({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&l.error(_({id:`c863eW`,values:{shareBranch:D}})),n&&h.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),b(Ce),l.error(_({id:`c863eW`,values:{shareBranch:D}}))})},t[42]=_,t[43]=n.project,t[44]=T,t[45]=D,t[46]=h,t[47]=O):O=t[47];let k=O,He;t[48]!==y.info||t[49]!==y.phase||t[50]!==k||t[51]!==w.target?(He=function(){y.phase===`ready`&&ue(y.info).switchEnabled&&k(d(w.target),!1)},t[48]=y.info,t[49]=y.phase,t[50]=k,t[51]=w.target,t[52]=He):He=t[52];let Ue=He,We;t[53]!==y.phase||t[54]!==k||t[55]!==w.target?(We=function(){y.phase===`verdict`&&k(d(w.target),!0)},t[53]=y.phase,t[54]=k,t[55]=w.target,t[56]=We):We=t[56];let Ge=We,Ke;t[57]!==y.phase||t[58]!==y.resolution||t[59]!==k?(Ke=function(){y.phase===`verdict`&&y.resolution.kind===`renamed`&&k(y.resolution.renamedTo,!0)},t[57]=y.phase,t[58]=y.resolution,t[59]=k,t[60]=Ke):Ke=t[60];let qe=Ke,Je;t[61]!==y.phase||t[62]!==k||t[63]!==w.target?(Je=function(){y.phase===`verdict`&&k(d(w.target),!1)},t[61]=y.phase,t[62]=k,t[63]=w.target,t[64]=Je):Je=t[64];let Ye=Je,Xe;t[65]!==_||t[66]!==n.project||t[67]!==T||t[68]!==w.target||t[69]!==D||t[70]!==h||t[71]!==S?(Xe=function(){console.log(f({branch_dialog_action:`open-current`,branch:D})),n.project.open({path:T,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:w.target.kind,path:d(w.target)}}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),l.error(_({id:`b5aNbi`,values:{targetNoun:S}}))}),h.dismiss()},t[65]=_,t[66]=n.project,t[67]=T,t[68]=w.target,t[69]=D,t[70]=h,t[71]=S,t[72]=Xe):Xe=t[72];let Ze=Xe,Qe;t[73]!==_||t[74]!==y.otherWorktreePath||t[75]!==y.phase||t[76]!==n.project||t[77]!==w.target||t[78]!==D||t[79]!==h?(Qe=function(){if(y.phase!==`branch-in-other-worktree`)return;let e=y.otherWorktreePath;console.log(f({branch_dialog_action:`pivot-to-other-worktree`,branch:D})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:w.target.kind,path:d(w.target)},pendingBranch:D}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),l.error(_({id:`LdABLa`,values:{target:e}}))}),h.dismiss()},t[73]=_,t[74]=y.otherWorktreePath,t[75]=y.phase,t[76]=n.project,t[77]=w.target,t[78]=D,t[79]=h,t[80]=Qe):Qe=t[80];let $e=Qe,et;t[81]===h?et=t[82]:(et=function(){console.log(f({branch_dialog_action:`cancel`})),h.dismiss()},t[81]=h,t[82]=et);let A=et,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K,q;if(t[83]!==_||t[84]!==y.info||t[85]!==y.otherWorktreePath||t[86]!==y.phase||t[87]!==y.resolution||t[88]!==A||t[89]!==E||t[90]!==w.branch||t[91]!==w.owner||t[92]!==w.repo||t[93]!==w.target||t[94]!==D||t[95]!==S){q=y.phase===`ready`||y.phase===`switching`?ue(y.info):null;let e;t[113]!==y.info||t[114]!==y.phase||t[115]!==E?(e=y.phase===`ready`||y.phase===`switching`?de(y.info):E??`HEAD`,t[113]=y.info,t[114]=y.phase,t[115]=E,t[116]=e):e=t[116];let n=e;I=y.phase===`switching`||y.phase===`awaiting-cc1-recycle`;let r;t[117]===_?r=t[118]:(r=_({id:`OuY8t9`}),t[117]=_,t[118]=r),P=r;let a;t[119]!==_||t[120]!==D?(a=_({id:`_BthEY`,values:{shareBranch:D}}),t[119]=_,t[120]=D,t[121]=a):a=t[121],F=a;let o=y.phase===`loading`,ee=y.phase===`error`;N=se,G=!0,t[122]===A?K=t[123]:(K=e=>{e||A()},t[122]=A,t[123]=K),M=ie,B=`sm:max-w-xl`,V=`share-branch-switch-dialog`,H=Se,U=xe;let c;t[124]===S?c=t[125]:(c=(0,g.jsx)(re,{children:(0,g.jsx)(i,{id:`RY6Bq1`,values:{targetNoun:S}})}),t[124]=S,t[125]=c);let te=w.owner,l=w.repo,u;t[126]===w.target?u=t[127]:(u=d(w.target),t[126]=w.target,t[127]=u);let f;t[128]!==w.owner||t[129]!==w.repo||t[130]!==u?(f=(0,g.jsx)(ne,{className:`sr-only`,children:(0,g.jsx)(i,{id:`f8jU-L`,values:{0:te,1:l,2:u}})}),t[128]=w.owner,t[129]=w.repo,t[130]=u,t[131]=f):f=t[131],t[132]!==c||t[133]!==f?(W=(0,g.jsxs)(oe,{children:[c,f]}),t[132]=c,t[133]=f,t[134]=W):W=t[134],j=ae;let ce=w.owner,p=w.repo,m;t[135]===w.target?m=t[136]:(m=d(w.target),t[135]=w.target,t[136]=m),t[137]!==w.branch||t[138]!==w.owner||t[139]!==w.repo||t[140]!==w.target.kind||t[141]!==m?(L=(0,g.jsx)(`div`,{className:`mb-4`,children:(0,g.jsx)(le,{owner:ce,repo:p,path:m,kind:w.target.kind,branch:w.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[137]=w.branch,t[138]=w.owner,t[139]=w.repo,t[140]=w.target.kind,t[141]=m,t[142]=L):L=t[142],R=y.phase===`branch-in-other-worktree`?(0,g.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,g.jsx)(`p`,{className:`leading-6`,children:(0,g.jsx)(i,{id:`yjExfe`,values:{shareBranch:D},components:{0:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,g.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:y.otherWorktreePath})]}):y.phase===`verdict-pending`?(0,g.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-pending`,role:`status`,"aria-live":`polite`,children:[(0,g.jsx)(s,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,g.jsx)(i,{id:`c8jBgX`})]}):y.phase===`verdict`?y.resolution.kind===`on-origin`?(0,g.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-on-origin`,children:(0,g.jsx)(i,{id:`Uay5NL`,values:{targetNoun:S,shareBranch:D},components:{0:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):y.resolution.kind===`renamed`?(0,g.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-renamed`,children:(0,g.jsx)(i,{id:`P0HC30`,values:{0:y.resolution.renamedTo,targetNoun:S},components:{0:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):y.resolution.kind===`diverged`?(0,g.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-diverged`,children:(0,g.jsx)(i,{id:`kLv8d3`,values:{shareBranch:D,targetNoun:S},components:{0:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,g.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-handoff`,role:`status`,"aria-live":`polite`,children:[(0,g.jsx)(s,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,g.jsx)(i,{id:`c8jBgX`})]}):o?(0,g.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-loading`,role:`status`,"aria-live":`polite`,children:[(0,g.jsx)(s,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,g.jsx)(i,{id:`jerqF0`})]}):ee?(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,g.jsx)(i,{id:`w4hMYl`})}):q?.kind===`D`?(0,g.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,g.jsx)(i,{id:`XnoA1k`,values:{targetNoun:S,shareBranch:D},components:{0:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):q?.kind===`B`?(0,g.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,g.jsx)(i,{id:`sZ2IOu`,values:{targetNoun:S,shareBranch:D,currentLabel:n},components:{0:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,g.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,g.jsx)(i,{id:`_902BE`,values:{targetNoun:S,shareBranch:D,currentLabel:n},components:{0:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),z=q&&!q.switchEnabled&&q.conflictingFiles.length>0?(0,g.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm`,"data-testid":`share-branch-switch-conflict`,children:[(0,g.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,g.jsx)(i,{id:`n2lRue`})}),(0,g.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:q.conflictingFiles.map(be)})]}):null,t[83]=_,t[84]=y.info,t[85]=y.otherWorktreePath,t[86]=y.phase,t[87]=y.resolution,t[88]=A,t[89]=E,t[90]=w.branch,t[91]=w.owner,t[92]=w.repo,t[93]=w.target,t[94]=D,t[95]=S,t[96]=j,t[97]=M,t[98]=N,t[99]=P,t[100]=F,t[101]=I,t[102]=L,t[103]=R,t[104]=z,t[105]=B,t[106]=V,t[107]=H,t[108]=U,t[109]=W,t[110]=G,t[111]=K,t[112]=q}else j=t[96],M=t[97],N=t[98],P=t[99],F=t[100],I=t[101],L=t[102],R=t[103],z=t[104],B=t[105],V=t[106],H=t[107],U=t[108],W=t[109],G=t[110],K=t[111],q=t[112];let J;t[143]===I?J=t[144]:(J=I?(0,g.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-switching`,role:`status`,"aria-live":`polite`,children:[(0,g.jsx)(s,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,g.jsx)(i,{id:`CU3AiE`})]}):null,t[143]=I,t[144]=J);let Y;t[145]!==j||t[146]!==L||t[147]!==R||t[148]!==z||t[149]!==J?(Y=(0,g.jsxs)(j,{children:[L,R,z,J]}),t[145]=j,t[146]=L,t[147]=R,t[148]=z,t[149]=J,t[150]=Y):Y=t[150];let tt;t[151]===Symbol.for(`react.memo_cache_sentinel`)?(tt=(0,g.jsx)(i,{id:`dEgA5A`}),t[151]=tt):tt=t[151];let X;t[152]===A?X=t[153]:(X=(0,g.jsx)(o,{variant:`ghost`,className:`font-mono uppercase`,onClick:A,"data-testid":`share-branch-switch-cancel`,children:tt}),t[152]=A,t[153]=X);let Z;t[154]!==y.phase||t[155]!==y.resolution||t[156]!==Ze||t[157]!==qe||t[158]!==$e||t[159]!==Ye||t[160]!==Ue||t[161]!==Ge||t[162]!==P||t[163]!==F||t[164]!==I||t[165]!==q?(Z=y.phase===`branch-in-other-worktree`?(0,g.jsx)(o,{onClick:$e,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,g.jsx)(i,{id:`hyCxJY`})}):y.phase===`verdict`?y.resolution.kind===`on-origin`?(0,g.jsxs)(o,{onClick:Ge,"data-testid":`share-branch-switch-verdict-switch-update`,children:[(0,g.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),(0,g.jsx)(i,{id:`uA_jXp`})]}):y.resolution.kind===`renamed`?(0,g.jsxs)(o,{onClick:qe,"data-testid":`share-branch-switch-verdict-open-renamed`,children:[(0,g.jsx)(c,{className:`size-3.5`,"aria-hidden":!0}),(0,g.jsx)(i,{id:`AItsE5`})]}):y.resolution.kind===`diverged`?(0,g.jsxs)(o,{onClick:Ye,"data-testid":`share-branch-switch-verdict-plain-switch`,children:[(0,g.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),F]}):null:(0,g.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:gap-2`,children:[q?.openCurrentEnabled?(0,g.jsxs)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:Ze,disabled:I,"data-testid":`share-branch-switch-open-current`,children:[(0,g.jsx)(c,{className:`size-3.5`,"aria-hidden":!0}),P]}):null,(0,g.jsx)(o,{onClick:Ue,disabled:!q?.switchEnabled||I,"aria-disabled":!q?.switchEnabled||I,"aria-describedby":q&&!q.switchEnabled&&q.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:I?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(s,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),F]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),F]})})]}),t[154]=y.phase,t[155]=y.resolution,t[156]=Ze,t[157]=qe,t[158]=$e,t[159]=Ye,t[160]=Ue,t[161]=Ge,t[162]=P,t[163]=F,t[164]=I,t[165]=q,t[166]=Z):Z=t[166];let Q;t[167]!==X||t[168]!==Z?(Q=(0,g.jsxs)(u,{className:`sm:justify-between`,children:[X,Z]}),t[167]=X,t[168]=Z,t[169]=Q):Q=t[169];let $;t[170]!==M||t[171]!==B||t[172]!==V||t[173]!==H||t[174]!==U||t[175]!==W||t[176]!==Y||t[177]!==Q?($=(0,g.jsxs)(M,{className:B,"data-testid":V,onInteractOutside:H,onPointerDownOutside:U,children:[W,Y,Q]}),t[170]=M,t[171]=B,t[172]=V,t[173]=H,t[174]=U,t[175]=W,t[176]=Y,t[177]=Q,t[178]=$):$=t[178];let nt;return t[179]!==N||t[180]!==G||t[181]!==K||t[182]!==$?(nt=(0,g.jsx)(N,{open:G,onOpenChange:K,children:$}),t[179]=N,t[180]=G,t[181]=K,t[182]=$,t[183]=nt):nt=t[183],nt}function be(e){return(0,g.jsx)(`li`,{children:(0,g.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function xe(e){e.preventDefault()}function Se(e){e.preventDefault()}function Ce(e){return ve(e,null).state}function we(e){return _e(e,null)}function Te(e){return pe(e,null)}function Ee(){return null}export{_ as ShareBranchSwitchDialog};
|
|
1
|
+
import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{n as i,r as a}from"./dist-CQw2y-s3.js";import{t as o}from"./button-cneJOVxD.js";import{t as ee}from"./git-branch-q0qWPEwd.js";import{t as s}from"./loader-circle-B7Gv_Djz.js";import{n as c,t as te}from"./miss-dialog-store-PJQ_kr0I.js";import{n as l}from"./dist-CoyydoqN.js";import{a as ne,c as re,i as ie,n as ae,o as u,s as oe,t as se}from"./dialog-DdHaoAGK.js";import{t as d}from"./desktop-bridge-types-NXCK8Pd7.js";import{a as f,n as ce}from"./receive-store-Brkf98BO.js";import{t as le}from"./share-metadata-rows-BttnPmuW.js";var p=e(t(),1),m=r();function ue(e){let t=e.shareTargetExists,n=e.dirtyConflicts.conflicts,r=e.dirtyConflicts.files;return t&&!n?{kind:`A`,openCurrentEnabled:!0,switchEnabled:!0,conflictingFiles:r}:!t&&!n?{kind:`B`,openCurrentEnabled:!1,switchEnabled:!0,conflictingFiles:r}:t&&n?{kind:`C`,openCurrentEnabled:!0,switchEnabled:!1,conflictingFiles:r}:{kind:`D`,openCurrentEnabled:!1,switchEnabled:!1,conflictingFiles:r}}function de(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function h(e){if(e.ok)return{action:`await-cc1`};switch(e.reason){case`dirty-conflict`:return{action:`rerender-conflict`,files:e.files??[]};case`branch-not-found`:return{action:`dismiss-with-toast`,reason:`branch-not-found`};case`fetch-failed`:case`checkout-failed`:return{action:`stay-with-toast`,reason:e.reason};case`branch-in-other-worktree`:{let t=e.otherWorktreePath;return t===void 0||t.length===0?{action:`stay-with-toast`,reason:`checkout-failed`}:{action:`pivot-to-other-worktree`,otherWorktreePath:t}}case`ff-diverged`:return{action:`branch-diverged`};default:{let t=e.reason;throw Error(`Unhandled CheckoutFailureReason: ${String(t)}`)}}}var fe={phase:`loading`};function pe(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function me(e,t){return e.phase!==`ready`&&e.phase!==`verdict`?e:{phase:`switching`,info:e.info,pendingDoc:t}}function he(e){return ue(e).kind===`B`&&e.shareTargetOnOriginBranch===!1}function ge(e){return e.phase===`ready`?{phase:`verdict-pending`,info:e.info}:e}function _e(e,t){if(e.phase!==`verdict-pending`)return e;if(t===null||t.verdict===`unknown`||t.verdict===`changed-locally`)return{phase:`ready`,info:e.info};let n=t.verdict===`renamed`?{kind:`renamed`,renamedTo:t.renamedTo}:{kind:t.verdict};return{phase:`verdict`,info:e.info,resolution:n}}function ve(e,t){if(e.phase!==`switching`)return{state:e};if(t===null)return{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}};let n=h(t);return n.action===`await-cc1`?{state:{phase:`awaiting-cc1-recycle`,pendingDoc:e.pendingDoc}}:n.action===`rerender-conflict`?{state:{phase:`ready`,info:{...e.info,dirtyConflicts:{conflicts:!0,files:n.files.slice()}}}}:n.action===`pivot-to-other-worktree`?{state:{phase:`branch-in-other-worktree`,info:e.info,otherWorktreePath:n.otherWorktreePath,pendingDoc:e.pendingDoc}}:n.action===`dismiss-with-toast`?{state:{phase:`dismissed`,reason:n.reason},sideEffect:{kind:`toast`,reason:n.reason}}:n.action===`branch-diverged`?{state:{phase:`verdict`,info:e.info,resolution:{kind:`diverged`}}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:n.reason}}}var g=n();function ye(e){return e!==null&&e.kind===`project-branch-switch`}function _(e){let t=(0,m.c)(184),{bridge:n,store:r}=e,h=r===void 0?ce:r,{_}=a(),v=(0,p.useSyncExternalStore)(h.subscribe,h.getSnapshot,Ee),[y,b]=(0,p.useState)(fe),De=(0,p.useRef)(!1),Oe=(0,p.useRef)(!1),ke=(0,p.useRef)(!1),Ae=(0,p.useRef)(null),je;t[0]===v?je=t[1]:(je=ye(v)?v:null,t[0]=v,t[1]=je);let x=je,Me;t[2]!==_||t[3]!==x?.share.target.kind?(Me=x?.share.target.kind===`folder`?_({id:`ugoTXs`}):_({id:`XH30C4`}),t[2]=_,t[3]=x?.share.target.kind,t[4]=Me):Me=t[4];let S=Me,C;t[5]===x?C=t[6]:(C=()=>{b(fe),De.current=!1,Oe.current=!1,ke.current=!1,Ae.current=x},t[5]=x,t[6]=C);let Ne;t[7]===v?Ne=t[8]:(Ne=[v],t[7]=v,t[8]=Ne),(0,p.useEffect)(C,Ne);let Pe;t[9]!==x||t[10]!==n?(Pe=()=>{if(!x||De.current)return;De.current=!0;let e=!1;return n.project.fetchBranchInfo({projectPath:x.projectPath,branch:x.share.branch,kind:x.share.target.kind,path:d(x.share.target)}).then(t=>{e||b(e=>pe(e,t))}).catch(t=>{e||(console.warn(`[receive] branch-info-fetch-failed`,t instanceof Error?t.message:t),b(Te))}),()=>{e=!0}},t[9]=x,t[10]=n,t[11]=Pe):Pe=t[11];let Fe;t[12]===x?Fe=t[13]:(Fe=[x],t[12]=x,t[13]=Fe),(0,p.useEffect)(Pe,Fe);let Ie;t[14]!==x||t[15]!==y.info||t[16]!==y.phase||t[17]!==n?(Ie=()=>{if(!x||y.phase!==`ready`||ke.current||!he(y.info))return;ke.current=!0,b(ge);let e=x;n.project.fetchTargetStatus({projectPath:x.projectPath,branch:x.share.branch,kind:x.share.target.kind,path:d(x.share.target)}).then(t=>{Ae.current===e&&b(e=>_e(e,t))}).catch(t=>{Ae.current===e&&(console.warn(`[receive] target-status-fetch-failed`,t instanceof Error?t.message:t),b(we))})},t[14]=x,t[15]=y.info,t[16]=y.phase,t[17]=n,t[18]=Ie):Ie=t[18];let Le;t[19]!==x||t[20]!==y.phase?(Le=[y.phase,x],t[19]=x,t[20]=y.phase,t[21]=Le):Le=t[21],(0,p.useEffect)(Ie,Le);let Re;t[22]!==x||t[23]!==y.phase||t[24]!==y.resolution||t[25]!==h?(Re=()=>{if(y.phase!==`verdict`)return;let{kind:e}=y.resolution;e!==`deleted`&&e!==`never-on-branch`||x&&(te.arm({kind:x.share.target.kind,path:d(x.share.target),branch:x.share.branch}),h.dismiss())},t[22]=x,t[23]=y.phase,t[24]=y.resolution,t[25]=h,t[26]=Re):Re=t[26];let ze;t[27]!==x||t[28]!==y||t[29]!==h?(ze=[y,x,h],t[27]=x,t[28]=y,t[29]=h,t[30]=ze):ze=t[30],(0,p.useEffect)(Re,ze);let Be;t[31]!==_||t[32]!==x||t[33]!==y.pendingDoc||t[34]!==y.phase||t[35]!==n||t[36]!==h||t[37]!==S?(Be=()=>{if(y.phase!==`awaiting-cc1-recycle`||!x)return;let e=x.share.branch,t=y.pendingDoc;if(!e){h.dismiss();return}if(Oe.current)return;Oe.current=!0;let r=!1;return n.project.awaitBranchSwitched({projectPath:x.projectPath,branch:e,timeoutMs:3e4}).then(i=>{if(!r){if(i.ok){console.log(f({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:x.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:x.share.target.kind,path:t},pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),l.error(_({id:`gQV-9w`,values:{targetNoun:S}}))}),h.dismiss();return}console.log(f({branch_dialog_action:`branch-switch-timeout`,branch:e})),l.error(_({id:`LBwUR6`,values:{targetNoun:S}})),h.dismiss()}}).catch(e=>{r||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),l.error(_({id:`Jw6EC4`,values:{targetNoun:S}})),h.dismiss())}),()=>{r=!0}},t[31]=_,t[32]=x,t[33]=y.pendingDoc,t[34]=y.phase,t[35]=n,t[36]=h,t[37]=S,t[38]=Be):Be=t[38];let Ve;if(t[39]!==x||t[40]!==y.phase?(Ve=[y.phase,x],t[39]=x,t[40]=y.phase,t[41]=Ve):Ve=t[41],(0,p.useEffect)(Be,Ve),!x)return null;let{share:w,projectPath:T,currentBranch:E}=x,D=w.branch,O;t[42]!==_||t[43]!==n.project||t[44]!==T||t[45]!==D||t[46]!==h?(O=function(e,t){console.log(f({branch_dialog_action:`switch`,branch_action:`switch`,branch:D})),b(t=>me(t,e)),n.project.runCheckout(t?{projectPath:T,branch:D,fastForward:!0}:{projectPath:T,branch:D}).then(e=>{let t=null,n=!1;b(r=>{let{state:i,sideEffect:a}=ve(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?l.error(_({id:`NJyQi_`,values:{shareBranch:D}})):t===`fetch-failed`?l.error(_({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&l.error(_({id:`c863eW`,values:{shareBranch:D}})),n&&h.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),b(Ce),l.error(_({id:`c863eW`,values:{shareBranch:D}}))})},t[42]=_,t[43]=n.project,t[44]=T,t[45]=D,t[46]=h,t[47]=O):O=t[47];let k=O,He;t[48]!==y.info||t[49]!==y.phase||t[50]!==k||t[51]!==w.target?(He=function(){y.phase===`ready`&&ue(y.info).switchEnabled&&k(d(w.target),!1)},t[48]=y.info,t[49]=y.phase,t[50]=k,t[51]=w.target,t[52]=He):He=t[52];let Ue=He,We;t[53]!==y.phase||t[54]!==k||t[55]!==w.target?(We=function(){y.phase===`verdict`&&k(d(w.target),!0)},t[53]=y.phase,t[54]=k,t[55]=w.target,t[56]=We):We=t[56];let Ge=We,Ke;t[57]!==y.phase||t[58]!==y.resolution||t[59]!==k?(Ke=function(){y.phase===`verdict`&&y.resolution.kind===`renamed`&&k(y.resolution.renamedTo,!0)},t[57]=y.phase,t[58]=y.resolution,t[59]=k,t[60]=Ke):Ke=t[60];let qe=Ke,Je;t[61]!==y.phase||t[62]!==k||t[63]!==w.target?(Je=function(){y.phase===`verdict`&&k(d(w.target),!1)},t[61]=y.phase,t[62]=k,t[63]=w.target,t[64]=Je):Je=t[64];let Ye=Je,Xe;t[65]!==_||t[66]!==n.project||t[67]!==T||t[68]!==w.target||t[69]!==D||t[70]!==h||t[71]!==S?(Xe=function(){console.log(f({branch_dialog_action:`open-current`,branch:D})),n.project.open({path:T,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:w.target.kind,path:d(w.target)}}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),l.error(_({id:`b5aNbi`,values:{targetNoun:S}}))}),h.dismiss()},t[65]=_,t[66]=n.project,t[67]=T,t[68]=w.target,t[69]=D,t[70]=h,t[71]=S,t[72]=Xe):Xe=t[72];let Ze=Xe,Qe;t[73]!==_||t[74]!==y.otherWorktreePath||t[75]!==y.phase||t[76]!==n.project||t[77]!==w.target||t[78]!==D||t[79]!==h?(Qe=function(){if(y.phase!==`branch-in-other-worktree`)return;let e=y.otherWorktreePath;console.log(f({branch_dialog_action:`pivot-to-other-worktree`,branch:D})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:w.target.kind,path:d(w.target)},pendingBranch:D}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),l.error(_({id:`LdABLa`,values:{target:e}}))}),h.dismiss()},t[73]=_,t[74]=y.otherWorktreePath,t[75]=y.phase,t[76]=n.project,t[77]=w.target,t[78]=D,t[79]=h,t[80]=Qe):Qe=t[80];let $e=Qe,et;t[81]===h?et=t[82]:(et=function(){console.log(f({branch_dialog_action:`cancel`})),h.dismiss()},t[81]=h,t[82]=et);let A=et,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K,q;if(t[83]!==_||t[84]!==y.info||t[85]!==y.otherWorktreePath||t[86]!==y.phase||t[87]!==y.resolution||t[88]!==A||t[89]!==E||t[90]!==w.branch||t[91]!==w.owner||t[92]!==w.repo||t[93]!==w.target||t[94]!==D||t[95]!==S){q=y.phase===`ready`||y.phase===`switching`?ue(y.info):null;let e;t[113]!==y.info||t[114]!==y.phase||t[115]!==E?(e=y.phase===`ready`||y.phase===`switching`?de(y.info):E??`HEAD`,t[113]=y.info,t[114]=y.phase,t[115]=E,t[116]=e):e=t[116];let n=e;I=y.phase===`switching`||y.phase===`awaiting-cc1-recycle`;let r;t[117]===_?r=t[118]:(r=_({id:`OuY8t9`}),t[117]=_,t[118]=r),P=r;let a;t[119]!==_||t[120]!==D?(a=_({id:`_BthEY`,values:{shareBranch:D}}),t[119]=_,t[120]=D,t[121]=a):a=t[121],F=a;let o=y.phase===`loading`,ee=y.phase===`error`;N=se,G=!0,t[122]===A?K=t[123]:(K=e=>{e||A()},t[122]=A,t[123]=K),M=ie,B=`sm:max-w-xl`,V=`share-branch-switch-dialog`,H=Se,U=xe;let c;t[124]===S?c=t[125]:(c=(0,g.jsx)(re,{children:(0,g.jsx)(i,{id:`RY6Bq1`,values:{targetNoun:S}})}),t[124]=S,t[125]=c);let te=w.owner,l=w.repo,u;t[126]===w.target?u=t[127]:(u=d(w.target),t[126]=w.target,t[127]=u);let f;t[128]!==w.owner||t[129]!==w.repo||t[130]!==u?(f=(0,g.jsx)(ne,{className:`sr-only`,children:(0,g.jsx)(i,{id:`f8jU-L`,values:{0:te,1:l,2:u}})}),t[128]=w.owner,t[129]=w.repo,t[130]=u,t[131]=f):f=t[131],t[132]!==c||t[133]!==f?(W=(0,g.jsxs)(oe,{children:[c,f]}),t[132]=c,t[133]=f,t[134]=W):W=t[134],j=ae;let ce=w.owner,p=w.repo,m;t[135]===w.target?m=t[136]:(m=d(w.target),t[135]=w.target,t[136]=m),t[137]!==w.branch||t[138]!==w.owner||t[139]!==w.repo||t[140]!==w.target.kind||t[141]!==m?(L=(0,g.jsx)(`div`,{className:`mb-4`,children:(0,g.jsx)(le,{owner:ce,repo:p,path:m,kind:w.target.kind,branch:w.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[137]=w.branch,t[138]=w.owner,t[139]=w.repo,t[140]=w.target.kind,t[141]=m,t[142]=L):L=t[142],R=y.phase===`branch-in-other-worktree`?(0,g.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,g.jsx)(`p`,{className:`leading-6`,children:(0,g.jsx)(i,{id:`yjExfe`,values:{shareBranch:D},components:{0:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,g.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:y.otherWorktreePath})]}):y.phase===`verdict-pending`?(0,g.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-pending`,role:`status`,"aria-live":`polite`,children:[(0,g.jsx)(s,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,g.jsx)(i,{id:`c8jBgX`})]}):y.phase===`verdict`?y.resolution.kind===`on-origin`?(0,g.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-on-origin`,children:(0,g.jsx)(i,{id:`Uay5NL`,values:{targetNoun:S,shareBranch:D},components:{0:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):y.resolution.kind===`renamed`?(0,g.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-renamed`,children:(0,g.jsx)(i,{id:`P0HC30`,values:{0:y.resolution.renamedTo,targetNoun:S},components:{0:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):y.resolution.kind===`diverged`?(0,g.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-diverged`,children:(0,g.jsx)(i,{id:`kLv8d3`,values:{shareBranch:D,targetNoun:S},components:{0:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,g.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-handoff`,role:`status`,"aria-live":`polite`,children:[(0,g.jsx)(s,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,g.jsx)(i,{id:`c8jBgX`})]}):o?(0,g.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-loading`,role:`status`,"aria-live":`polite`,children:[(0,g.jsx)(s,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,g.jsx)(i,{id:`jerqF0`})]}):ee?(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,g.jsx)(i,{id:`w4hMYl`})}):q?.kind===`D`?(0,g.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,g.jsx)(i,{id:`XnoA1k`,values:{targetNoun:S,shareBranch:D},components:{0:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):q?.kind===`B`?(0,g.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,g.jsx)(i,{id:`sZ2IOu`,values:{targetNoun:S,shareBranch:D,currentLabel:n},components:{0:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,g.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,g.jsx)(i,{id:`_902BE`,values:{targetNoun:S,shareBranch:D,currentLabel:n},components:{0:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,g.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),z=q&&!q.switchEnabled&&q.conflictingFiles.length>0?(0,g.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm`,"data-testid":`share-branch-switch-conflict`,children:[(0,g.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,g.jsx)(i,{id:`n2lRue`})}),(0,g.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:q.conflictingFiles.map(be)})]}):null,t[83]=_,t[84]=y.info,t[85]=y.otherWorktreePath,t[86]=y.phase,t[87]=y.resolution,t[88]=A,t[89]=E,t[90]=w.branch,t[91]=w.owner,t[92]=w.repo,t[93]=w.target,t[94]=D,t[95]=S,t[96]=j,t[97]=M,t[98]=N,t[99]=P,t[100]=F,t[101]=I,t[102]=L,t[103]=R,t[104]=z,t[105]=B,t[106]=V,t[107]=H,t[108]=U,t[109]=W,t[110]=G,t[111]=K,t[112]=q}else j=t[96],M=t[97],N=t[98],P=t[99],F=t[100],I=t[101],L=t[102],R=t[103],z=t[104],B=t[105],V=t[106],H=t[107],U=t[108],W=t[109],G=t[110],K=t[111],q=t[112];let J;t[143]===I?J=t[144]:(J=I?(0,g.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-switching`,role:`status`,"aria-live":`polite`,children:[(0,g.jsx)(s,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,g.jsx)(i,{id:`CU3AiE`})]}):null,t[143]=I,t[144]=J);let Y;t[145]!==j||t[146]!==L||t[147]!==R||t[148]!==z||t[149]!==J?(Y=(0,g.jsxs)(j,{children:[L,R,z,J]}),t[145]=j,t[146]=L,t[147]=R,t[148]=z,t[149]=J,t[150]=Y):Y=t[150];let tt;t[151]===Symbol.for(`react.memo_cache_sentinel`)?(tt=(0,g.jsx)(i,{id:`dEgA5A`}),t[151]=tt):tt=t[151];let X;t[152]===A?X=t[153]:(X=(0,g.jsx)(o,{variant:`ghost`,className:`font-mono uppercase`,onClick:A,"data-testid":`share-branch-switch-cancel`,children:tt}),t[152]=A,t[153]=X);let Z;t[154]!==y.phase||t[155]!==y.resolution||t[156]!==Ze||t[157]!==qe||t[158]!==$e||t[159]!==Ye||t[160]!==Ue||t[161]!==Ge||t[162]!==P||t[163]!==F||t[164]!==I||t[165]!==q?(Z=y.phase===`branch-in-other-worktree`?(0,g.jsx)(o,{onClick:$e,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,g.jsx)(i,{id:`hyCxJY`})}):y.phase===`verdict`?y.resolution.kind===`on-origin`?(0,g.jsxs)(o,{onClick:Ge,"data-testid":`share-branch-switch-verdict-switch-update`,children:[(0,g.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),(0,g.jsx)(i,{id:`uA_jXp`})]}):y.resolution.kind===`renamed`?(0,g.jsxs)(o,{onClick:qe,"data-testid":`share-branch-switch-verdict-open-renamed`,children:[(0,g.jsx)(c,{className:`size-3.5`,"aria-hidden":!0}),(0,g.jsx)(i,{id:`AItsE5`})]}):y.resolution.kind===`diverged`?(0,g.jsxs)(o,{onClick:Ye,"data-testid":`share-branch-switch-verdict-plain-switch`,children:[(0,g.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),F]}):null:(0,g.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:gap-2`,children:[q?.openCurrentEnabled?(0,g.jsxs)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:Ze,disabled:I,"data-testid":`share-branch-switch-open-current`,children:[(0,g.jsx)(c,{className:`size-3.5`,"aria-hidden":!0}),P]}):null,(0,g.jsx)(o,{onClick:Ue,disabled:!q?.switchEnabled||I,"aria-disabled":!q?.switchEnabled||I,"aria-describedby":q&&!q.switchEnabled&&q.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:I?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(s,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),F]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),F]})})]}),t[154]=y.phase,t[155]=y.resolution,t[156]=Ze,t[157]=qe,t[158]=$e,t[159]=Ye,t[160]=Ue,t[161]=Ge,t[162]=P,t[163]=F,t[164]=I,t[165]=q,t[166]=Z):Z=t[166];let Q;t[167]!==X||t[168]!==Z?(Q=(0,g.jsxs)(u,{className:`sm:justify-between`,children:[X,Z]}),t[167]=X,t[168]=Z,t[169]=Q):Q=t[169];let $;t[170]!==M||t[171]!==B||t[172]!==V||t[173]!==H||t[174]!==U||t[175]!==W||t[176]!==Y||t[177]!==Q?($=(0,g.jsxs)(M,{className:B,"data-testid":V,onInteractOutside:H,onPointerDownOutside:U,children:[W,Y,Q]}),t[170]=M,t[171]=B,t[172]=V,t[173]=H,t[174]=U,t[175]=W,t[176]=Y,t[177]=Q,t[178]=$):$=t[178];let nt;return t[179]!==N||t[180]!==G||t[181]!==K||t[182]!==$?(nt=(0,g.jsx)(N,{open:G,onOpenChange:K,children:$}),t[179]=N,t[180]=G,t[181]=K,t[182]=$,t[183]=nt):nt=t[183],nt}function be(e){return(0,g.jsx)(`li`,{children:(0,g.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function xe(e){e.preventDefault()}function Se(e){e.preventDefault()}function Ce(e){return ve(e,null).state}function we(e){return _e(e,null)}function Te(e){return pe(e,null)}function Ee(){return null}export{_ as ShareBranchSwitchDialog};
|
package/dist/public/assets/{ShareReceiveDialog-CGSDsgBh.js → ShareReceiveDialog-DJb80ZUd.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-CJc7OX7s.js";import{t as c}from"./button-cneJOVxD.js";import{t as ee}from"./loader-circle-B7Gv_Djz.js";import{n as l}from"./dist-CoyydoqN.js";import{a as te,c as u,i as d,n as f,o as ne,s as p,t as m}from"./dialog-DdHaoAGK.js";import{t as h}from"./desktop-bridge-types-NXCK8Pd7.js";import{a as re,i as g,n as _,o as v,r as ie,s as y}from"./receive-store-C72xSCDE.js";import{t as ae}from"./share-metadata-rows-BttnPmuW.js";var b=e(t(),1),x=r(),S=e=>({phase:`ready`,seed:e});function C(e){return e.phase===`ready`?{phase:`initializing`,seed:e.seed}:e}function w(e,t){return e.phase===`initializing`?t.ok?{phase:`opening`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:t.reason,message:t.message}:e}function T(e,t){return e.phase===`opening`?t.ok?{phase:`done`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:`network-error`,message:t.message}:e}function E(e){return e.phase===`done`||e.phase===`cancelled`||e.phase===`error`?e:{phase:`cancelled`,seed:e.seed}}var D=n();function O(e){return e!==null&&e.kind===`launcher-consent`}function k(e){return e!==null&&e.kind===`launcher-miss`}function A(e){let t=(0,x.c)(14),{bridge:n,cloneController:r,store:i}=e,a=i===void 0?_:i,o=(0,b.useSyncExternalStore)(a.subscribe,a.getSnapshot,M),[s,c]=(0,b.useState)(0),[ee,te]=(0,b.useState)(o);o!==ee&&(te(o),c(j));let u,d;t[0]!==o||t[1]!==a?(u=()=>{if(!o)return;let e=y(o);e&&(l.error(e.message),a.dismiss())},d=[o,a],t[0]=o,t[1]=a,t[2]=u,t[3]=d):(u=t[2],d=t[3]),(0,b.useEffect)(u,d);let f;t[4]===o?f=t[5]:(f=k(o)?o:null,t[4]=o,t[5]=f);let ne=f,p;t[6]===o?p=t[7]:(p=O(o)?o:null,t[6]=o,t[7]=p);let m=p??ne;if(!m)return null;let h;return t[8]!==m||t[9]!==n||t[10]!==r||t[11]!==s||t[12]!==a?(h=(0,D.jsx)(N,{payload:m,bridge:n,cloneController:r,store:a},s),t[8]=m,t[9]=n,t[10]=r,t[11]=s,t[12]=a,t[13]=h):h=t[13],h}function j(e){return e+1}function M(){return null}function N(e){let t=(0,x.c)(165),{payload:n,bridge:r,cloneController:_,store:y}=e,{_:C}=a(),[E,A]=(0,b.useState)(!1),[j,M]=(0,b.useState)(null),[N,ue]=(0,b.useState)(!1),[F,de]=(0,b.useState)(!1),[I,fe]=(0,b.useState)(null),[L,R]=(0,b.useState)(null),pe=(0,b.useRef)(!1),me=(0,b.useRef)(null),he,ge;t[0]===I?(he=t[1],ge=t[2]):(he=()=>{I&&me.current?.focus()},ge=[I],t[0]=I,t[1]=he,t[2]=ge),(0,b.useEffect)(he,ge);let _e;t[3]!==L||t[4]!==n?(_e=()=>{O(n)&&L===null&&(console.warn(`[receive] q1_hit=true selection=branch_match_non_ok candidate=${n.candidatePath}`),R(S({candidatePath:n.candidatePath,branch:n.share.branch,targetPath:h(n.share.target),targetKind:n.share.target.kind,parentProjectName:n.parentProjectName})))},t[3]=L,t[4]=n,t[5]=_e):_e=t[5];let ve;t[6]===n?ve=t[7]:(ve=[n],t[6]=n,t[7]=ve),(0,b.useEffect)(_e,ve);let ye;t[8]!==j||t[9]!==_||t[10]!==n?(ye=()=>{_&&k(n)&&j===null&&(pe.current||(pe.current=!0,ue(!0),_.getAuthStatus().then(e=>{M(e)}).catch(e=>{console.warn(`[receive] auth pre-flight probe failed`,e instanceof Error?e.message:e),M({authenticated:!1,host:`github.com`})}).finally(()=>{ue(!1)})))},t[8]=j,t[9]=_,t[10]=n,t[11]=ye):ye=t[11];let be;t[12]!==j||t[13]!==n?(be=[n,j],t[12]=j,t[13]=n,t[14]=be):be=t[14],(0,b.useEffect)(ye,be);let z=k(n)?n:null,xe=O(n)?n:null,B=z?.share??xe?.share??null,V,H,U,W,G,Se,K,q;if(t[15]!==C||t[16]!==N||t[17]!==r||t[18]!==_||t[19]!==F||t[20]!==L||t[21]!==z||t[22]!==E||t[23]!==B||t[24]!==y){K=Symbol.for(`react.early_return_sentinel`);bb0:{let e=B?{owner:B.owner,repo:B.repo}:null,n;t[33]!==C||t[34]!==B?.target.kind?(n=B?.target.kind===`folder`?C({id:`ugoTXs`}):C({id:`XH30C4`}),t[33]=C,t[34]=B?.target.kind,t[35]=n):n=t[35],q=n,U=async function(){if(!z||!e)return;if(console.log(re({q2_path:`clone`})),!_){l.info(C({id:`27XW26`}),{action:{label:C({id:`B3NAZC`}),onClick:()=>{r.navigator.open()}},duration:8e3});return}if(F)return;fe(null),de(!0);let t=ie(e),n;try{n=await _.runClone({url:t,branch:z.share.branch})}catch(e){let t=e;console.warn(`[receive] runClone threw unexpectedly`,t),de(!1),fe({detail:t instanceof Error?t.message:String(t)});return}if(de(!1),n.kind===`error`){fe({detail:n.detail??null});return}if(n.kind===`ok`){try{await r.project.open({path:n.dir,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:z.share.target.kind,path:h(z.share.target)}}),y.dismiss()}catch(e){let t=e;console.warn(`[receive] project open after clone failed`,t instanceof Error?t.message:t),l.error(C({id:`438Fca`}))}return}};let a;t[36]!==C||t[37]!==N||t[38]!==_?(a=async function(){if(!(!_||N)){ue(!0);try{let e=await _.startSignIn();ue(!1),e!==null&&M(e)}catch(e){let t=e;ue(!1),console.warn(`[receive] startSignIn failed`,t instanceof Error?t.message:t),l.error(C({id:`lzwo7p`}))}}},t[36]=C,t[37]=N,t[38]=_,t[39]=a):a=t[39],G=a,W=async function(){if(!(!z||!e||E)){fe(null),A(!0),console.log(re({q2_path:`local`}));try{for(;;){let t=await r.dialog.openFolder();if(!t)break;let n=await r.share.validateLocalFolder({folderPath:t,owner:e.owner,repo:e.repo});if(console.log(re({folder_validate:n.kind})),n.kind===`ok`){let e=z.share.branch,n={currentBranch:null,headSha:null,detached:!1};try{n=await r.project.readHeadBranch(t)}catch(e){let t=e;console.warn(`[receive] local-folder readHeadBranch failed`,t instanceof Error?t.message:t)}let i=o(e,n)!==`true`;try{await r.project.open({path:t,target:`new-window`,entryPoint:`share-receive`,...i?{pendingShareBranchSwitch:{share:z.share,projectPath:t,currentBranch:n.currentBranch}}:{pendingDeepLinkTarget:{kind:z.share.target.kind,path:h(z.share.target)}}}),y.dismiss()}catch(e){let t=e;console.warn(`[receive] local-folder-open failed`,t instanceof Error?t.message:t),l.error(C({id:`phM8Kh`}))}break}let i=v(n,e);i&&l.error(i)}}catch(e){let t=e;console.warn(`[receive] local-folder-validate failed`,t instanceof Error?t.message:t),l.error(C({id:`rlUzXK`}))}A(!1)}};let g;t[40]!==C||t[41]!==r||t[42]!==L||t[43]!==y?(g=function(){if(L===null||L.phase!==`ready`)return;let e=L.seed;console.warn(`[receive] consent_dialog action=initialize worktree=${e.candidatePath}`),R(le),r.project.okInit({projectPath:e.candidatePath}).then(async t=>{if(t.ok===!0){R(e=>e===null?e:w(e,{ok:!0,projectPath:t.projectPath}));try{await r.project.open({path:t.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:e.targetKind,path:e.targetPath},pendingBranch:e.branch}),R(ce),y.dismiss()}catch(t){let n=t,r=n instanceof Error?n.message:String(n);R(e=>e===null?e:T(e,{ok:!1,message:r})),l.error(C({id:`nDT8qt`,values:{0:e.candidatePath}}))}return}let n=t.reason,i=t.message||`Initialization failed.`;R(e=>e===null?e:w(e,{ok:!1,reason:n,message:i})),l.error(i)}).catch(t=>{let n=t instanceof Error?t.message:String(t);R(e=>e===null?e:w(e,{ok:!1,reason:`network-error`,message:n})),l.error(C({id:`3Mwaly`,values:{0:e.candidatePath}}))})},t[40]=C,t[41]=r,t[42]=L,t[43]=y,t[44]=g):g=t[44];let b=g,x;t[45]!==L||t[46]!==y?(x=function(){L!==null&&console.warn(`[receive] consent_dialog action=cancel worktree=${L.seed.candidatePath}`),R(P),y.dismiss()},t[45]=L,t[46]=y,t[47]=x):x=t[47];let S=x;if(L!==null&&L.phase!==`cancelled`&&L.phase!==`done`&&B!==null){let e=L.seed,n=L.phase===`initializing`||L.phase===`opening`,r;t[48]===S?r=t[49]:(r=e=>{e||S()},t[48]=S,t[49]=r);let a;t[50]===q?a=t[51]:(a=(0,D.jsx)(u,{children:(0,D.jsx)(i,{id:`RY6Bq1`,values:{targetNoun:q}})}),t[50]=q,t[51]=a);let o;t[52]===B.target?o=t[53]:(o=h(B.target)?`— ${h(B.target)}`:``,t[52]=B.target,t[53]=o);let s;t[54]!==B.owner||t[55]!==B.repo||t[56]!==o?(s=(0,D.jsx)(te,{className:`sr-only`,children:(0,D.jsx)(i,{id:`pgq_xf`,values:{0:B.owner,1:B.repo,2:o}})}),t[54]=B.owner,t[55]=B.repo,t[56]=o,t[57]=s):s=t[57];let l=B.owner,re=B.repo,g;t[58]===B.target?g=t[59]:(g=h(B.target),t[58]=B.target,t[59]=g);let _;t[60]!==B.branch||t[61]!==B.owner||t[62]!==B.repo||t[63]!==B.target.kind||t[64]!==g?(_=(0,D.jsx)(ae,{owner:l,repo:re,path:g,kind:B.target.kind,branch:B.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[60]=B.branch,t[61]=B.owner,t[62]=B.repo,t[63]=B.target.kind,t[64]=g,t[65]=_):_=t[65];let v;t[66]!==a||t[67]!==s||t[68]!==_?(v=(0,D.jsxs)(p,{children:[a,s,_]}),t[66]=a,t[67]=s,t[68]=_,t[69]=v):v=t[69];let ie;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,D.jsx)(i,{id:`KsAPaB`})}),t[70]=ie):ie=t[70];let y;t[71]===e.candidatePath?y=t[72]:(y=(0,D.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-receive-consent-path`,children:e.candidatePath}),t[71]=e.candidatePath,t[72]=y);let x;t[73]===e.parentProjectName?x=t[74]:(x=e.parentProjectName===null?null:(0,D.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,"data-testid":`share-receive-consent-parent`,children:(0,D.jsx)(i,{id:`JmfgFc`,values:{0:e.parentProjectName}})}),t[73]=e.parentProjectName,t[74]=x);let C;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,D.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,D.jsx)(i,{id:`w7SsvI`})}),t[75]=C):C=t[75];let w;t[76]!==L.message||t[77]!==L.phase?(w=L.phase===`error`?(0,D.jsx)(`p`,{className:`mt-3 text-sm text-destructive`,"data-testid":`share-receive-consent-error`,role:`alert`,children:L.message}):null,t[76]=L.message,t[77]=L.phase,t[78]=w):w=t[78];let T;t[79]!==y||t[80]!==x||t[81]!==w?(T=(0,D.jsxs)(f,{children:[ie,y,x,C,w]}),t[79]=y,t[80]=x,t[81]=w,t[82]=T):T=t[82];let E;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,D.jsx)(i,{id:`dEgA5A`}),t[83]=E):E=t[83];let O;t[84]===S?O=t[85]:(O=(0,D.jsx)(c,{variant:`ghost`,onClick:S,"data-testid":`share-receive-consent-cancel`,children:E}),t[84]=S,t[85]=O);let k=n||L.phase===`error`,A=n||L.phase===`error`,j;t[86]===n?j=t[87]:(j=n?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(ee,{className:`mr-2 h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,D.jsx)(i,{id:`NKkZXl`})]}):(0,D.jsx)(i,{id:`NKkZXl`}),t[86]=n,t[87]=j);let M;t[88]!==b||t[89]!==k||t[90]!==A||t[91]!==j?(M=(0,D.jsx)(c,{onClick:b,disabled:k,"aria-disabled":A,"data-testid":`share-receive-consent-initialize`,children:j}),t[88]=b,t[89]=k,t[90]=A,t[91]=j,t[92]=M):M=t[92];let N;t[93]!==O||t[94]!==M?(N=(0,D.jsxs)(ne,{children:[O,M]}),t[93]=O,t[94]=M,t[95]=N):N=t[95];let P;t[96]!==v||t[97]!==T||t[98]!==N?(P=(0,D.jsxs)(d,{className:`sm:max-w-xl`,"data-testid":`share-receive-consent-dialog`,onInteractOutside:se,onPointerDownOutside:oe,children:[v,T,N]}),t[96]=v,t[97]=T,t[98]=N,t[99]=P):P=t[99];let ce;t[100]!==r||t[101]!==P?(ce=(0,D.jsx)(m,{open:!0,onOpenChange:r,children:P}),t[100]=r,t[101]=P,t[102]=ce):ce=t[102],K=ce;break bb0}if(!z||!B||!e){K=null;break bb0}V=_!==void 0&&!F;let O;t[103]!==C||t[104]!==F?(O=C(F?{id:`YjhKI5`}:{id:`LE7t79`}),t[103]=C,t[104]=F,t[105]=O):O=t[105],H=O,Se=s(e)}t[15]=C,t[16]=N,t[17]=r,t[18]=_,t[19]=F,t[20]=L,t[21]=z,t[22]=E,t[23]=B,t[24]=y,t[25]=V,t[26]=H,t[27]=U,t[28]=W,t[29]=G,t[30]=Se,t[31]=K,t[32]=q}else V=t[25],H=t[26],U=t[27],W=t[28],G=t[29],Se=t[30],K=t[31],q=t[32];if(K!==Symbol.for(`react.early_return_sentinel`))return K;let Ce=Se,we=j?.authenticated?j.login:void 0,Te;t[106]===I?Te=t[107]:(Te=I?.detail?g(I.detail):``,t[106]=I,t[107]=Te);let Ee=Te,J;t[108]===y?J=t[109]:(J=e=>{e||y.dismiss()},t[108]=y,t[109]=J);let Y;t[110]===q?Y=t[111]:(Y=(0,D.jsx)(u,{children:(0,D.jsx)(i,{id:`RY6Bq1`,values:{targetNoun:q}})}),t[110]=q,t[111]=Y);let X;t[112]===B.target?X=t[113]:(X=h(B.target)?` — ${h(B.target)}`:null,t[112]=B.target,t[113]=X);let Z;t[114]!==B.owner||t[115]!==B.repo||t[116]!==X?(Z=(0,D.jsxs)(te,{className:`sr-only`,children:[B.owner,`/`,B.repo,X]}),t[114]=B.owner,t[115]=B.repo,t[116]=X,t[117]=Z):Z=t[117];let De=B.owner,Oe=B.repo,Q;t[118]===B.target?Q=t[119]:(Q=h(B.target),t[118]=B.target,t[119]=Q);let ke;t[120]!==B.branch||t[121]!==B.owner||t[122]!==B.repo||t[123]!==B.target.kind||t[124]!==Q?(ke=(0,D.jsx)(ae,{owner:De,repo:Oe,path:Q,kind:B.target.kind,branch:B.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[120]=B.branch,t[121]=B.owner,t[122]=B.repo,t[123]=B.target.kind,t[124]=Q,t[125]=ke):ke=t[125];let Ae;t[126]!==Y||t[127]!==Z||t[128]!==ke?(Ae=(0,D.jsxs)(p,{children:[Y,Z,ke]}),t[126]=Y,t[127]=Z,t[128]=ke,t[129]=Ae):Ae=t[129];let $;t[130]!==_||t[131]!==V||t[132]!==I||t[133]!==Ee||t[134]!==H||t[135]!==F||t[136]!==U||t[137]!==W||t[138]!==E?($=I?(0,D.jsxs)(`div`,{ref:me,tabIndex:-1,className:`rounded-lg border border-destructive/40 bg-destructive/5 p-4 outline-none`,"data-testid":`share-receive-clone-error`,children:[(0,D.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,role:`alert`,children:(0,D.jsx)(i,{id:`aiArms`})}),Ee?(0,D.jsxs)(`p`,{className:`mt-2 break-words text-xs text-destructive`,"data-testid":`share-receive-clone-error-message`,children:[(0,D.jsx)(i,{id:`4BITzH`}),` `,(0,D.jsxs)(`span`,{className:`font-mono text-foreground/80`,children:[`"`,Ee,`"`]})]}):null,(0,D.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,D.jsx)(i,{id:`Llyqvo`})}),(0,D.jsxs)(`ul`,{className:`mt-1 list-disc space-y-1 pl-5 text-sm text-muted-foreground`,"data-testid":`share-receive-clone-error-reasons`,children:[(0,D.jsx)(`li`,{children:(0,D.jsx)(i,{id:`6LbUG7`})}),(0,D.jsx)(`li`,{children:(0,D.jsx)(i,{id:`_pY_Vq`})}),(0,D.jsx)(`li`,{children:(0,D.jsx)(i,{id:`J6mxC1`})})]}),(0,D.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,D.jsx)(c,{onClick:()=>{U()},"data-testid":`share-receive-clone-retry`,children:(0,D.jsx)(i,{id:`KDw4GX`})}),(0,D.jsx)(c,{variant:`outline`,onClick:()=>{W()},disabled:E||F,"data-testid":`share-receive-error-local`,children:(0,D.jsx)(i,{id:`xFQRu4`})})]})]}):(0,D.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,D.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-clone`,className:`flex flex-col items-start gap-2 rounded-lg border border-primary/50 bg-primary/5 p-4 text-left transition hover:border-primary hover:bg-primary/10 focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-primary/50 disabled:hover:bg-primary/5`,onClick:()=>{U()},disabled:_!==void 0&&!V,"aria-disabled":_!==void 0&&!V,children:[(0,D.jsx)(`span`,{className:`text-sm font-semibold`,children:H}),(0,D.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,D.jsx)(i,{id:`fj5YiP`})})]}),(0,D.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-local`,className:`flex flex-col items-start gap-2 rounded-lg border border-border bg-card p-4 text-left transition hover:border-foreground/50 hover:bg-accent focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,onClick:()=>{W()},disabled:E||F,children:[(0,D.jsx)(`span`,{className:`text-sm font-semibold`,children:(0,D.jsx)(i,{id:`HfI1dR`})}),(0,D.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,D.jsx)(i,{id:`_qD6mn`})})]})]}),t[130]=_,t[131]=V,t[132]=I,t[133]=Ee,t[134]=H,t[135]=F,t[136]=U,t[137]=W,t[138]=E,t[139]=$):$=t[139];let je;t[140]!==N||t[141]!==j||t[142]!==_||t[143]!==G||t[144]!==we?(je=_?(0,D.jsx)(`div`,{className:`mt-3 flex items-center justify-between rounded-md border border-border bg-muted/30 px-3 py-2 text-xs`,"data-testid":`share-receive-auth-banner`,role:`status`,"aria-live":`polite`,children:j===null?(0,D.jsx)(`span`,{className:`text-muted-foreground`,children:(0,D.jsx)(i,{id:`UDFrWm`})}):j.authenticated?(0,D.jsx)(`span`,{className:`text-muted-foreground`,children:(0,D.jsx)(i,{id:`VAHWL_`,values:{signedInLogin:we},components:{0:(0,D.jsx)(`span`,{className:`font-medium text-foreground/90`})}})}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{className:`text-muted-foreground`,children:(0,D.jsx)(i,{id:`SgKLfA`})}),(0,D.jsx)(`button`,{type:`button`,"data-testid":`share-receive-signin`,className:`font-medium text-primary underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded`,onClick:()=>{G()},disabled:N,children:N?(0,D.jsx)(i,{id:`PKLY-1`}):(0,D.jsx)(i,{id:`3jod3l`})})]})}):null,t[140]=N,t[141]=j,t[142]=_,t[143]=G,t[144]=we,t[145]=je):je=t[145];let Me;t[146]!==I||t[147]!==Ce?(Me=I?null:(0,D.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,D.jsx)(i,{id:`RJ3a8Z`,values:{lookingForUrl:Ce},components:{0:(0,D.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),t[146]=I,t[147]=Ce,t[148]=Me):Me=t[148];let Ne;t[149]!==$||t[150]!==je||t[151]!==Me?(Ne=(0,D.jsxs)(f,{children:[$,je,Me]}),t[149]=$,t[150]=je,t[151]=Me,t[152]=Ne):Ne=t[152];let Pe;t[153]===y?Pe=t[154]:(Pe=()=>y.dismiss(),t[153]=y,t[154]=Pe);let Fe;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,D.jsx)(i,{id:`dEgA5A`}),t[155]=Fe):Fe=t[155];let Ie;t[156]===Pe?Ie=t[157]:(Ie=(0,D.jsx)(ne,{children:(0,D.jsx)(c,{variant:`outline`,className:`font-mono uppercase`,onClick:Pe,children:Fe})}),t[156]=Pe,t[157]=Ie);let Le;t[158]!==Ae||t[159]!==Ne||t[160]!==Ie?(Le=(0,D.jsxs)(d,{className:`sm:max-w-xl`,"data-testid":`share-receive-dialog`,children:[Ae,Ne,Ie]}),t[158]=Ae,t[159]=Ne,t[160]=Ie,t[161]=Le):Le=t[161];let Re;return t[162]!==J||t[163]!==Le?(Re=(0,D.jsx)(m,{open:!0,onOpenChange:J,children:Le}),t[162]=J,t[163]=Le,t[164]=Re):Re=t[164],Re}function oe(e){return e.preventDefault()}function se(e){return e.preventDefault()}function P(e){return e===null?e:E(e)}function ce(e){return e===null?e:T(e,{ok:!0})}function le(e){return e===null?e:C(e)}export{A as ShareReceiveDialog};
|
|
1
|
+
import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{n as i,r as a}from"./dist-CQw2y-s3.js";import{Gt as o,Ut as s}from"./dist-W-hKJCWn.js";import{t as c}from"./button-cneJOVxD.js";import{t as ee}from"./loader-circle-B7Gv_Djz.js";import{n as l}from"./dist-CoyydoqN.js";import{a as te,c as u,i as d,n as f,o as ne,s as p,t as m}from"./dialog-DdHaoAGK.js";import{t as h}from"./desktop-bridge-types-NXCK8Pd7.js";import{a as re,i as g,n as _,o as v,r as ie,s as y}from"./receive-store-Brkf98BO.js";import{t as ae}from"./share-metadata-rows-BttnPmuW.js";var b=e(t(),1),x=r(),S=e=>({phase:`ready`,seed:e});function C(e){return e.phase===`ready`?{phase:`initializing`,seed:e.seed}:e}function w(e,t){return e.phase===`initializing`?t.ok?{phase:`opening`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:t.reason,message:t.message}:e}function T(e,t){return e.phase===`opening`?t.ok?{phase:`done`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:`network-error`,message:t.message}:e}function E(e){return e.phase===`done`||e.phase===`cancelled`||e.phase===`error`?e:{phase:`cancelled`,seed:e.seed}}var D=n();function O(e){return e!==null&&e.kind===`launcher-consent`}function k(e){return e!==null&&e.kind===`launcher-miss`}function A(e){let t=(0,x.c)(14),{bridge:n,cloneController:r,store:i}=e,a=i===void 0?_:i,o=(0,b.useSyncExternalStore)(a.subscribe,a.getSnapshot,M),[s,c]=(0,b.useState)(0),[ee,te]=(0,b.useState)(o);o!==ee&&(te(o),c(j));let u,d;t[0]!==o||t[1]!==a?(u=()=>{if(!o)return;let e=y(o);e&&(l.error(e.message),a.dismiss())},d=[o,a],t[0]=o,t[1]=a,t[2]=u,t[3]=d):(u=t[2],d=t[3]),(0,b.useEffect)(u,d);let f;t[4]===o?f=t[5]:(f=k(o)?o:null,t[4]=o,t[5]=f);let ne=f,p;t[6]===o?p=t[7]:(p=O(o)?o:null,t[6]=o,t[7]=p);let m=p??ne;if(!m)return null;let h;return t[8]!==m||t[9]!==n||t[10]!==r||t[11]!==s||t[12]!==a?(h=(0,D.jsx)(N,{payload:m,bridge:n,cloneController:r,store:a},s),t[8]=m,t[9]=n,t[10]=r,t[11]=s,t[12]=a,t[13]=h):h=t[13],h}function j(e){return e+1}function M(){return null}function N(e){let t=(0,x.c)(165),{payload:n,bridge:r,cloneController:_,store:y}=e,{_:C}=a(),[E,A]=(0,b.useState)(!1),[j,M]=(0,b.useState)(null),[N,ue]=(0,b.useState)(!1),[F,de]=(0,b.useState)(!1),[I,fe]=(0,b.useState)(null),[L,R]=(0,b.useState)(null),pe=(0,b.useRef)(!1),me=(0,b.useRef)(null),he,ge;t[0]===I?(he=t[1],ge=t[2]):(he=()=>{I&&me.current?.focus()},ge=[I],t[0]=I,t[1]=he,t[2]=ge),(0,b.useEffect)(he,ge);let _e;t[3]!==L||t[4]!==n?(_e=()=>{O(n)&&L===null&&(console.warn(`[receive] q1_hit=true selection=branch_match_non_ok candidate=${n.candidatePath}`),R(S({candidatePath:n.candidatePath,branch:n.share.branch,targetPath:h(n.share.target),targetKind:n.share.target.kind,parentProjectName:n.parentProjectName})))},t[3]=L,t[4]=n,t[5]=_e):_e=t[5];let ve;t[6]===n?ve=t[7]:(ve=[n],t[6]=n,t[7]=ve),(0,b.useEffect)(_e,ve);let ye;t[8]!==j||t[9]!==_||t[10]!==n?(ye=()=>{_&&k(n)&&j===null&&(pe.current||(pe.current=!0,ue(!0),_.getAuthStatus().then(e=>{M(e)}).catch(e=>{console.warn(`[receive] auth pre-flight probe failed`,e instanceof Error?e.message:e),M({authenticated:!1,host:`github.com`})}).finally(()=>{ue(!1)})))},t[8]=j,t[9]=_,t[10]=n,t[11]=ye):ye=t[11];let be;t[12]!==j||t[13]!==n?(be=[n,j],t[12]=j,t[13]=n,t[14]=be):be=t[14],(0,b.useEffect)(ye,be);let z=k(n)?n:null,xe=O(n)?n:null,B=z?.share??xe?.share??null,V,H,U,W,G,Se,K,q;if(t[15]!==C||t[16]!==N||t[17]!==r||t[18]!==_||t[19]!==F||t[20]!==L||t[21]!==z||t[22]!==E||t[23]!==B||t[24]!==y){K=Symbol.for(`react.early_return_sentinel`);bb0:{let e=B?{owner:B.owner,repo:B.repo}:null,n;t[33]!==C||t[34]!==B?.target.kind?(n=B?.target.kind===`folder`?C({id:`ugoTXs`}):C({id:`XH30C4`}),t[33]=C,t[34]=B?.target.kind,t[35]=n):n=t[35],q=n,U=async function(){if(!z||!e)return;if(console.log(re({q2_path:`clone`})),!_){l.info(C({id:`27XW26`}),{action:{label:C({id:`B3NAZC`}),onClick:()=>{r.navigator.open()}},duration:8e3});return}if(F)return;fe(null),de(!0);let t=ie(e),n;try{n=await _.runClone({url:t,branch:z.share.branch})}catch(e){let t=e;console.warn(`[receive] runClone threw unexpectedly`,t),de(!1),fe({detail:t instanceof Error?t.message:String(t)});return}if(de(!1),n.kind===`error`){fe({detail:n.detail??null});return}if(n.kind===`ok`){try{await r.project.open({path:n.dir,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:z.share.target.kind,path:h(z.share.target)}}),y.dismiss()}catch(e){let t=e;console.warn(`[receive] project open after clone failed`,t instanceof Error?t.message:t),l.error(C({id:`438Fca`}))}return}};let a;t[36]!==C||t[37]!==N||t[38]!==_?(a=async function(){if(!(!_||N)){ue(!0);try{let e=await _.startSignIn();ue(!1),e!==null&&M(e)}catch(e){let t=e;ue(!1),console.warn(`[receive] startSignIn failed`,t instanceof Error?t.message:t),l.error(C({id:`lzwo7p`}))}}},t[36]=C,t[37]=N,t[38]=_,t[39]=a):a=t[39],G=a,W=async function(){if(!(!z||!e||E)){fe(null),A(!0),console.log(re({q2_path:`local`}));try{for(;;){let t=await r.dialog.openFolder();if(!t)break;let n=await r.share.validateLocalFolder({folderPath:t,owner:e.owner,repo:e.repo});if(console.log(re({folder_validate:n.kind})),n.kind===`ok`){let e=z.share.branch,n={currentBranch:null,headSha:null,detached:!1};try{n=await r.project.readHeadBranch(t)}catch(e){let t=e;console.warn(`[receive] local-folder readHeadBranch failed`,t instanceof Error?t.message:t)}let i=o(e,n)!==`true`;try{await r.project.open({path:t,target:`new-window`,entryPoint:`share-receive`,...i?{pendingShareBranchSwitch:{share:z.share,projectPath:t,currentBranch:n.currentBranch}}:{pendingDeepLinkTarget:{kind:z.share.target.kind,path:h(z.share.target)}}}),y.dismiss()}catch(e){let t=e;console.warn(`[receive] local-folder-open failed`,t instanceof Error?t.message:t),l.error(C({id:`phM8Kh`}))}break}let i=v(n,e);i&&l.error(i)}}catch(e){let t=e;console.warn(`[receive] local-folder-validate failed`,t instanceof Error?t.message:t),l.error(C({id:`rlUzXK`}))}A(!1)}};let g;t[40]!==C||t[41]!==r||t[42]!==L||t[43]!==y?(g=function(){if(L===null||L.phase!==`ready`)return;let e=L.seed;console.warn(`[receive] consent_dialog action=initialize worktree=${e.candidatePath}`),R(le),r.project.okInit({projectPath:e.candidatePath}).then(async t=>{if(t.ok===!0){R(e=>e===null?e:w(e,{ok:!0,projectPath:t.projectPath}));try{await r.project.open({path:t.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:e.targetKind,path:e.targetPath},pendingBranch:e.branch}),R(ce),y.dismiss()}catch(t){let n=t,r=n instanceof Error?n.message:String(n);R(e=>e===null?e:T(e,{ok:!1,message:r})),l.error(C({id:`nDT8qt`,values:{0:e.candidatePath}}))}return}let n=t.reason,i=t.message||`Initialization failed.`;R(e=>e===null?e:w(e,{ok:!1,reason:n,message:i})),l.error(i)}).catch(t=>{let n=t instanceof Error?t.message:String(t);R(e=>e===null?e:w(e,{ok:!1,reason:`network-error`,message:n})),l.error(C({id:`3Mwaly`,values:{0:e.candidatePath}}))})},t[40]=C,t[41]=r,t[42]=L,t[43]=y,t[44]=g):g=t[44];let b=g,x;t[45]!==L||t[46]!==y?(x=function(){L!==null&&console.warn(`[receive] consent_dialog action=cancel worktree=${L.seed.candidatePath}`),R(P),y.dismiss()},t[45]=L,t[46]=y,t[47]=x):x=t[47];let S=x;if(L!==null&&L.phase!==`cancelled`&&L.phase!==`done`&&B!==null){let e=L.seed,n=L.phase===`initializing`||L.phase===`opening`,r;t[48]===S?r=t[49]:(r=e=>{e||S()},t[48]=S,t[49]=r);let a;t[50]===q?a=t[51]:(a=(0,D.jsx)(u,{children:(0,D.jsx)(i,{id:`RY6Bq1`,values:{targetNoun:q}})}),t[50]=q,t[51]=a);let o;t[52]===B.target?o=t[53]:(o=h(B.target)?`— ${h(B.target)}`:``,t[52]=B.target,t[53]=o);let s;t[54]!==B.owner||t[55]!==B.repo||t[56]!==o?(s=(0,D.jsx)(te,{className:`sr-only`,children:(0,D.jsx)(i,{id:`pgq_xf`,values:{0:B.owner,1:B.repo,2:o}})}),t[54]=B.owner,t[55]=B.repo,t[56]=o,t[57]=s):s=t[57];let l=B.owner,re=B.repo,g;t[58]===B.target?g=t[59]:(g=h(B.target),t[58]=B.target,t[59]=g);let _;t[60]!==B.branch||t[61]!==B.owner||t[62]!==B.repo||t[63]!==B.target.kind||t[64]!==g?(_=(0,D.jsx)(ae,{owner:l,repo:re,path:g,kind:B.target.kind,branch:B.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[60]=B.branch,t[61]=B.owner,t[62]=B.repo,t[63]=B.target.kind,t[64]=g,t[65]=_):_=t[65];let v;t[66]!==a||t[67]!==s||t[68]!==_?(v=(0,D.jsxs)(p,{children:[a,s,_]}),t[66]=a,t[67]=s,t[68]=_,t[69]=v):v=t[69];let ie;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,D.jsx)(i,{id:`KsAPaB`})}),t[70]=ie):ie=t[70];let y;t[71]===e.candidatePath?y=t[72]:(y=(0,D.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-receive-consent-path`,children:e.candidatePath}),t[71]=e.candidatePath,t[72]=y);let x;t[73]===e.parentProjectName?x=t[74]:(x=e.parentProjectName===null?null:(0,D.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,"data-testid":`share-receive-consent-parent`,children:(0,D.jsx)(i,{id:`JmfgFc`,values:{0:e.parentProjectName}})}),t[73]=e.parentProjectName,t[74]=x);let C;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,D.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,D.jsx)(i,{id:`w7SsvI`})}),t[75]=C):C=t[75];let w;t[76]!==L.message||t[77]!==L.phase?(w=L.phase===`error`?(0,D.jsx)(`p`,{className:`mt-3 text-sm text-destructive`,"data-testid":`share-receive-consent-error`,role:`alert`,children:L.message}):null,t[76]=L.message,t[77]=L.phase,t[78]=w):w=t[78];let T;t[79]!==y||t[80]!==x||t[81]!==w?(T=(0,D.jsxs)(f,{children:[ie,y,x,C,w]}),t[79]=y,t[80]=x,t[81]=w,t[82]=T):T=t[82];let E;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,D.jsx)(i,{id:`dEgA5A`}),t[83]=E):E=t[83];let O;t[84]===S?O=t[85]:(O=(0,D.jsx)(c,{variant:`ghost`,onClick:S,"data-testid":`share-receive-consent-cancel`,children:E}),t[84]=S,t[85]=O);let k=n||L.phase===`error`,A=n||L.phase===`error`,j;t[86]===n?j=t[87]:(j=n?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(ee,{className:`mr-2 h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,D.jsx)(i,{id:`NKkZXl`})]}):(0,D.jsx)(i,{id:`NKkZXl`}),t[86]=n,t[87]=j);let M;t[88]!==b||t[89]!==k||t[90]!==A||t[91]!==j?(M=(0,D.jsx)(c,{onClick:b,disabled:k,"aria-disabled":A,"data-testid":`share-receive-consent-initialize`,children:j}),t[88]=b,t[89]=k,t[90]=A,t[91]=j,t[92]=M):M=t[92];let N;t[93]!==O||t[94]!==M?(N=(0,D.jsxs)(ne,{children:[O,M]}),t[93]=O,t[94]=M,t[95]=N):N=t[95];let P;t[96]!==v||t[97]!==T||t[98]!==N?(P=(0,D.jsxs)(d,{className:`sm:max-w-xl`,"data-testid":`share-receive-consent-dialog`,onInteractOutside:se,onPointerDownOutside:oe,children:[v,T,N]}),t[96]=v,t[97]=T,t[98]=N,t[99]=P):P=t[99];let ce;t[100]!==r||t[101]!==P?(ce=(0,D.jsx)(m,{open:!0,onOpenChange:r,children:P}),t[100]=r,t[101]=P,t[102]=ce):ce=t[102],K=ce;break bb0}if(!z||!B||!e){K=null;break bb0}V=_!==void 0&&!F;let O;t[103]!==C||t[104]!==F?(O=C(F?{id:`YjhKI5`}:{id:`LE7t79`}),t[103]=C,t[104]=F,t[105]=O):O=t[105],H=O,Se=s(e)}t[15]=C,t[16]=N,t[17]=r,t[18]=_,t[19]=F,t[20]=L,t[21]=z,t[22]=E,t[23]=B,t[24]=y,t[25]=V,t[26]=H,t[27]=U,t[28]=W,t[29]=G,t[30]=Se,t[31]=K,t[32]=q}else V=t[25],H=t[26],U=t[27],W=t[28],G=t[29],Se=t[30],K=t[31],q=t[32];if(K!==Symbol.for(`react.early_return_sentinel`))return K;let Ce=Se,we=j?.authenticated?j.login:void 0,Te;t[106]===I?Te=t[107]:(Te=I?.detail?g(I.detail):``,t[106]=I,t[107]=Te);let Ee=Te,J;t[108]===y?J=t[109]:(J=e=>{e||y.dismiss()},t[108]=y,t[109]=J);let Y;t[110]===q?Y=t[111]:(Y=(0,D.jsx)(u,{children:(0,D.jsx)(i,{id:`RY6Bq1`,values:{targetNoun:q}})}),t[110]=q,t[111]=Y);let X;t[112]===B.target?X=t[113]:(X=h(B.target)?` — ${h(B.target)}`:null,t[112]=B.target,t[113]=X);let Z;t[114]!==B.owner||t[115]!==B.repo||t[116]!==X?(Z=(0,D.jsxs)(te,{className:`sr-only`,children:[B.owner,`/`,B.repo,X]}),t[114]=B.owner,t[115]=B.repo,t[116]=X,t[117]=Z):Z=t[117];let De=B.owner,Oe=B.repo,Q;t[118]===B.target?Q=t[119]:(Q=h(B.target),t[118]=B.target,t[119]=Q);let ke;t[120]!==B.branch||t[121]!==B.owner||t[122]!==B.repo||t[123]!==B.target.kind||t[124]!==Q?(ke=(0,D.jsx)(ae,{owner:De,repo:Oe,path:Q,kind:B.target.kind,branch:B.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[120]=B.branch,t[121]=B.owner,t[122]=B.repo,t[123]=B.target.kind,t[124]=Q,t[125]=ke):ke=t[125];let Ae;t[126]!==Y||t[127]!==Z||t[128]!==ke?(Ae=(0,D.jsxs)(p,{children:[Y,Z,ke]}),t[126]=Y,t[127]=Z,t[128]=ke,t[129]=Ae):Ae=t[129];let $;t[130]!==_||t[131]!==V||t[132]!==I||t[133]!==Ee||t[134]!==H||t[135]!==F||t[136]!==U||t[137]!==W||t[138]!==E?($=I?(0,D.jsxs)(`div`,{ref:me,tabIndex:-1,className:`rounded-lg border border-destructive/40 bg-destructive/5 p-4 outline-none`,"data-testid":`share-receive-clone-error`,children:[(0,D.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,role:`alert`,children:(0,D.jsx)(i,{id:`aiArms`})}),Ee?(0,D.jsxs)(`p`,{className:`mt-2 break-words text-xs text-destructive`,"data-testid":`share-receive-clone-error-message`,children:[(0,D.jsx)(i,{id:`4BITzH`}),` `,(0,D.jsxs)(`span`,{className:`font-mono text-foreground/80`,children:[`"`,Ee,`"`]})]}):null,(0,D.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,D.jsx)(i,{id:`Llyqvo`})}),(0,D.jsxs)(`ul`,{className:`mt-1 list-disc space-y-1 pl-5 text-sm text-muted-foreground`,"data-testid":`share-receive-clone-error-reasons`,children:[(0,D.jsx)(`li`,{children:(0,D.jsx)(i,{id:`6LbUG7`})}),(0,D.jsx)(`li`,{children:(0,D.jsx)(i,{id:`_pY_Vq`})}),(0,D.jsx)(`li`,{children:(0,D.jsx)(i,{id:`J6mxC1`})})]}),(0,D.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,D.jsx)(c,{onClick:()=>{U()},"data-testid":`share-receive-clone-retry`,children:(0,D.jsx)(i,{id:`KDw4GX`})}),(0,D.jsx)(c,{variant:`outline`,onClick:()=>{W()},disabled:E||F,"data-testid":`share-receive-error-local`,children:(0,D.jsx)(i,{id:`xFQRu4`})})]})]}):(0,D.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,D.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-clone`,className:`flex flex-col items-start gap-2 rounded-lg border border-primary/50 bg-primary/5 p-4 text-left transition hover:border-primary hover:bg-primary/10 focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-primary/50 disabled:hover:bg-primary/5`,onClick:()=>{U()},disabled:_!==void 0&&!V,"aria-disabled":_!==void 0&&!V,children:[(0,D.jsx)(`span`,{className:`text-sm font-semibold`,children:H}),(0,D.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,D.jsx)(i,{id:`fj5YiP`})})]}),(0,D.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-local`,className:`flex flex-col items-start gap-2 rounded-lg border border-border bg-card p-4 text-left transition hover:border-foreground/50 hover:bg-accent focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,onClick:()=>{W()},disabled:E||F,children:[(0,D.jsx)(`span`,{className:`text-sm font-semibold`,children:(0,D.jsx)(i,{id:`HfI1dR`})}),(0,D.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,D.jsx)(i,{id:`_qD6mn`})})]})]}),t[130]=_,t[131]=V,t[132]=I,t[133]=Ee,t[134]=H,t[135]=F,t[136]=U,t[137]=W,t[138]=E,t[139]=$):$=t[139];let je;t[140]!==N||t[141]!==j||t[142]!==_||t[143]!==G||t[144]!==we?(je=_?(0,D.jsx)(`div`,{className:`mt-3 flex items-center justify-between rounded-md border border-border bg-muted/30 px-3 py-2 text-xs`,"data-testid":`share-receive-auth-banner`,role:`status`,"aria-live":`polite`,children:j===null?(0,D.jsx)(`span`,{className:`text-muted-foreground`,children:(0,D.jsx)(i,{id:`UDFrWm`})}):j.authenticated?(0,D.jsx)(`span`,{className:`text-muted-foreground`,children:(0,D.jsx)(i,{id:`VAHWL_`,values:{signedInLogin:we},components:{0:(0,D.jsx)(`span`,{className:`font-medium text-foreground/90`})}})}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{className:`text-muted-foreground`,children:(0,D.jsx)(i,{id:`SgKLfA`})}),(0,D.jsx)(`button`,{type:`button`,"data-testid":`share-receive-signin`,className:`font-medium text-primary underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded`,onClick:()=>{G()},disabled:N,children:N?(0,D.jsx)(i,{id:`PKLY-1`}):(0,D.jsx)(i,{id:`3jod3l`})})]})}):null,t[140]=N,t[141]=j,t[142]=_,t[143]=G,t[144]=we,t[145]=je):je=t[145];let Me;t[146]!==I||t[147]!==Ce?(Me=I?null:(0,D.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,D.jsx)(i,{id:`RJ3a8Z`,values:{lookingForUrl:Ce},components:{0:(0,D.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),t[146]=I,t[147]=Ce,t[148]=Me):Me=t[148];let Ne;t[149]!==$||t[150]!==je||t[151]!==Me?(Ne=(0,D.jsxs)(f,{children:[$,je,Me]}),t[149]=$,t[150]=je,t[151]=Me,t[152]=Ne):Ne=t[152];let Pe;t[153]===y?Pe=t[154]:(Pe=()=>y.dismiss(),t[153]=y,t[154]=Pe);let Fe;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,D.jsx)(i,{id:`dEgA5A`}),t[155]=Fe):Fe=t[155];let Ie;t[156]===Pe?Ie=t[157]:(Ie=(0,D.jsx)(ne,{children:(0,D.jsx)(c,{variant:`outline`,className:`font-mono uppercase`,onClick:Pe,children:Fe})}),t[156]=Pe,t[157]=Ie);let Le;t[158]!==Ae||t[159]!==Ne||t[160]!==Ie?(Le=(0,D.jsxs)(d,{className:`sm:max-w-xl`,"data-testid":`share-receive-dialog`,children:[Ae,Ne,Ie]}),t[158]=Ae,t[159]=Ne,t[160]=Ie,t[161]=Le):Le=t[161];let Re;return t[162]!==J||t[163]!==Le?(Re=(0,D.jsx)(m,{open:!0,onOpenChange:J,children:Le}),t[162]=J,t[163]=Le,t[164]=Re):Re=t[164],Re}function oe(e){return e.preventDefault()}function se(e){return e.preventDefault()}function P(e){return e===null?e:E(e)}function ce(e){return e===null?e:T(e,{ok:!0})}function le(e){return e===null?e:C(e)}export{A as ShareReceiveDialog};
|
package/dist/public/assets/{ShareReceiveMissDialog-D7zjXalK.js → ShareReceiveMissDialog-CtSEaJGF.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-DRc7Xpt6.js";import{t as c}from"./miss-dialog-store-PJQ_kr0I.js";import{c as l,i as u,n as d,s as f,t as p}from"./dialog-DdHaoAGK.js";import{c as m,s as h}from"./doc-hash-CCfJH4d9.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-CxGse8tc.js → SkillEditorActions-Dd3W2TJ2.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-W-hKJCWn.js";import{i as te,t as ne}from"./button-cneJOVxD.js";import{t as o}from"./chevron-down-BvNcCN1f.js";import{i as s,r as c}from"./skill-actions-BfvtIGj9.js";import{E as re,S as ie,_ as l,h as ae,m as oe,p as se,v as u}from"./skills-api-DQp0sBix.js";var d=r(),f=e(t(),1),p=n(),m=a.options;function h(e){let t=(0,d.c)(74),{scope:n,name:r}=e,a=s(),h=c(),g;t[0]!==r||t[1]!==n||t[2]!==a.data||t[3]!==a.status?(g=a.status===`ready`?a.data.find(e=>e.scope===n&&e.name===r):void 0,t[0]=r,t[1]=n,t[2]=a.data,t[3]=a.status,t[4]=g):g=t[4];let _=g,v;t[5]!==_||t[6]!==r||t[7]!==n?(v=_??{scope:n,name:r,path:r,description:``,installed:!1,hosts:[]},t[5]=_,t[6]=r,t[7]=n,t[8]=v):v=t[8];let y=v,b=h.installingName===r,[x,S]=(0,f.useState)(null),C=x??y.hosts,w;t[9]===C?w=t[10]:(w=new Set(C),t[9]=C,t[10]=w);let T=w,E=x?x.length>0:y.installed,D=(0,f.useRef)(y.hosts),O,k;t[11]!==x||t[12]!==y.hosts?(O=()=>{x===null&&(D.current=y.hosts)},k=[x,y.hosts],t[11]=x,t[12]=y.hosts,t[13]=O,t[14]=k):(O=t[13],k=t[14]),(0,f.useEffect)(O,k);let A;t[15]===y.hosts?A=t[16]:(A=[...y.hosts].sort().join(`,`),t[15]=y.hosts,t[16]=A);let j=A,M,N;t[17]===j?(M=t[18],N=t[19]):(M=()=>{S(e=>e&&[...e].sort().join(`,`)===j?null:e)},N=[j],t[17]=j,t[18]=M,t[19]=N),(0,f.useEffect)(M,N);let P=(0,f.useRef)(null),F,I;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{P.current&&clearTimeout(P.current)},F=[],t[20]=F,t[21]=I):(F=t[20],I=t[21]),(0,f.useEffect)(I,F);let L,R,z,B,V,H,U,W,G;if(t[22]!==h||t[23]!==T||t[24]!==E||t[25]!==b||t[26]!==y){z=function(e,t){D.current=e,S(e),P.current&&clearTimeout(P.current);let n=async()=>{(await h.install(y,e)).ok||S(null)};t?P.current=setTimeout(()=>void n(),350):n()};let e=function(e,t){let n=new Set(D.current);t?n.add(e):n.delete(e),z([...n],!0)};G=`flex items-center gap-1.5`,R=se;let n=E?`installed`:`draft`,r=E?`border-primary/50 bg-primary/5 text-primary hover:bg-primary/10 hover:text-primary`:`border-yellow-500/40 bg-yellow-500/10 text-yellow-600 hover:bg-yellow-500/20 hover:text-yellow-600`,a;t[36]===r?a=t[37]:(a=te(`h-6 gap-1 rounded-sm border px-1.5 font-mono text-xs uppercase shadow-none`,r),t[36]=r,t[37]=a);let s;t[38]!==E||t[39]!==b?(s=b?(0,p.jsx)(i,{id:`b4itZn`}):E?(0,p.jsx)(i,{id:`eQkgKV`}):(0,p.jsx)(i,{id:`eneWvv`}),t[38]=E,t[39]=b,t[40]=s):s=t[40];let c;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,p.jsx)(o,{"aria-hidden":!0}),t[41]=c):c=t[41],t[42]!==b||t[43]!==n||t[44]!==a||t[45]!==s?(W=(0,p.jsx)(re,{asChild:!0,children:(0,p.jsxs)(ne,{variant:`outline`,size:`sm`,disabled:b,"data-testid":`skill-install-menu-trigger`,"data-state":n,className:a,children:[s,c]})}),t[42]=b,t[43]=n,t[44]=a,t[45]=s,t[46]=W):W=t[46],L=ae,B=`end`,V=`min-w-52`,t[47]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,p.jsx)(u,{children:(0,p.jsx)(i,{id:`npcziF`})}),t[47]=H):H=t[47],U=m.map(t=>(0,p.jsx)(oe,{checked:T.has(t),onCheckedChange:n=>e(t,n===!0),"data-testid":`skill-install-editor-${t}`,children:ee[t]},t)),t[22]=h,t[23]=T,t[24]=E,t[25]=b,t[26]=y,t[27]=L,t[28]=R,t[29]=z,t[30]=B,t[31]=V,t[32]=H,t[33]=U,t[34]=W,t[35]=G}else L=t[27],R=t[28],z=t[29],B=t[30],V=t[31],H=t[32],U=t[33],W=t[34],G=t[35];let K;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,p.jsx)(ie,{}),t[48]=K):K=t[48];let q;t[49]===z?q=t[50]:(q=()=>z([...m],!1),t[49]=z,t[50]=q);let J;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,p.jsx)(i,{id:`x-5mJ1`}),t[51]=J):J=t[51];let Y;t[52]===q?Y=t[53]:(Y=(0,p.jsx)(l,{"data-testid":`skill-install-all`,onSelect:q,children:J}),t[52]=q,t[53]=Y);let X;t[54]!==h||t[55]!==E||t[56]!==y?(X=E?(0,p.jsx)(l,{"data-testid":`skill-uninstall`,onSelect:()=>{P.current&&clearTimeout(P.current),D.current=[],S([]),(async()=>{(await h.uninstall(y)).ok||S(null)})()},children:(0,p.jsx)(i,{id:`t422_7`})}):null,t[54]=h,t[55]=E,t[56]=y,t[57]=X):X=t[57];let Z;t[58]!==L||t[59]!==B||t[60]!==V||t[61]!==H||t[62]!==U||t[63]!==Y||t[64]!==X?(Z=(0,p.jsxs)(L,{align:B,className:V,children:[H,U,K,Y,X]}),t[58]=L,t[59]=B,t[60]=V,t[61]=H,t[62]=U,t[63]=Y,t[64]=X,t[65]=Z):Z=t[65];let Q;t[66]!==R||t[67]!==W||t[68]!==Z?(Q=(0,p.jsxs)(R,{children:[W,Z]}),t[66]=R,t[67]=W,t[68]=Z,t[69]=Q):Q=t[69];let $;return t[70]!==h.dialogs||t[71]!==G||t[72]!==Q?($=(0,p.jsxs)(`div`,{className:G,children:[Q,h.dialogs]}),t[70]=h.dialogs,t[71]=G,t[72]=Q,t[73]=$):$=t[73],$}export{h as SkillEditorActions};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{H as i,N as a,mt as o,pt as s}from"./DocumentContext-D3J8u-yJ.js";import{n as c}from"./dist-BVOt51sU.js";import{M as l,si as ee,sn as u}from"./dist-W-hKJCWn.js";import{F as te,a as d,i as f,k as p,o as m}from"./CodeMirrorPropInput-DIQ7Kf5H.js";import{l as h}from"./keyboard-shortcuts-BrZDq1VP.js";import"./config-provider-Bkj9YufI.js";import{Dt as g,Et as _,Ft as v,J as y,P as b,Q as x,Tt as S,X as C,pt as w,ut as T}from"./dist-Dot7Y1W_.js";import{n as ne}from"./config-context-CE3SCVYc.js";import{o as E,r as D}from"./selection-context-DArc3SI0.js";import{c as O,d as re,n as k,r as A,u as ie}from"./typing-burst-detector-DiAheTFV.js";import{n as ae,t as oe}from"./dist-B27DnPFz.js";import{t as se}from"./src-BGo7Caak.js";var j=e(t(),1),ce=r(),M=y.mark({class:`cm-link-ref-broken`}),N=/^\s{0,3}\[([^\]]+)\]:\s/,P=/\[([^\]]*)\]\[([^\]]*)\]/g,F=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function I(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 L(e){let t=[];return b(e).iterate({enter(e){if(F.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function R(e){let t=new Set,n=[],r=e.doc,i=L(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(I(n.from,i))continue;let a=N.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!I(t.from,i)&&!N.test(t.text))for(P.lastIndex=0;;){let e=P.exec(t.text);if(!e)break;let r=t.from+e.index;if(I(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(M.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),y.set(a)}var z=v.define({create(e){return R(e)},update(e,t){return t.docChanged?R(t.state):e},provide:e=>C.decorations.from(e)}),B=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,V=y.mark({class:`cm-del`}),H=y.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),U=y.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function W(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function G(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!l.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(l.test(r.text))return{from:t.from,to:r.to}}return null}function K(e,t){let n=[],r=b(e),i=G(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(V.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=B.exec(r.text),a=i?i[1].length:2,o=y.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=W(r.text),a=y.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(H.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(U.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(U.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),y.set(n)}var q=class{decorations;constructor(e){this.decorations=K(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||b(e.startState)!==b(e.state))&&(this.decorations=K(e.view.state,e.view.visibleRanges))}},J=x.fromClass(q,{decorations:e=>e.decorations});function le(){return[J,z]}var ue=n(),Y=56;function X(e,t){let n=e.state.doc,r=1;if(n.lines>=1&&l.test(n.line(1).text)){for(let e=2;e<=n.lines;e++)if(l.test(n.line(e).text)){r=e+1;break}}let i=u(),a=0;for(let o=r;o<=n.lines;o++){let r=n.line(o);if(!i(r.text)&&/^#{1,6}\s/.test(r.text)){if(a===t.index){e.dispatch({selection:_.cursor(r.from),effects:C.scrollIntoView(r.from,{y:`start`})}),e.focus();return}a++}}}function de(e,t){requestAnimationFrame(()=>{let n=e.state.doc,r=Math.min(t.offset,n.length);e.dispatch({selection:_.cursor(r),effects:C.scrollIntoView(r,{y:`center`})}),e.focus()})}function Z(e){let t=(0,ce.c)(33),{docName:n,ytext:r,provider:l,placeholder:u,isSourceModeActive:p}=e,_=(0,j.useRef)(null),v=(0,j.useRef)(null),[y,b]=(0,j.useState)(null);if(y)throw y;let{resolvedTheme:x}=c(),{merged:M}=ne(),N=(0,j.useRef)(p),P=M?.editor?.wordWrap??!0,F,I;t[0]===p?(F=t[1],I=t[2]):(F=()=>{N.current=p},I=[p],t[0]=p,t[1]=F,t[2]=I),(0,j.useEffect)(F,I);let L=(0,j.useRef)(null),R;t[3]!==u||t[4]!==l||t[5]!==x||t[6]!==P||t[7]!==r?(R=()=>{let e=_.current;if(!e)return;let t=l.configuration.name??``,n,c=me;try{n=s({docName:t,container:e,sizeStats:{viewCount:0,bytes:r.length},factory:e=>{let n=null,o=a({ydoc:l.document,ytext:r}),s=new S,d=new S,p=new S,m=new C({state:g.create({doc:r.toString(),extensions:[oe,ae({scrollToMatch:pe}),T.of([te]),se(r,l.awareness),...f({themeCompartment:s,resolvedTheme:x,ydoc:l.document,wordWrapCompartment:d,wordWrap:P,currentDocName:t}),le(),o,C.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(n!==null&&clearTimeout(n),n=setTimeout(()=>{n=null,k(t,`source`,A(e.view)),D(t,`source`,E(e.view,t))},120))}),C.domEventHandlers({keydown:(e,t)=>!N.current||!ee()||!h(e,`edit-with-ai`)?!1:(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),i(),!0)}),p.of(w(u??``)),C.theme({"&":{height:`100%`}}),C.scrollMargins.of(fe)]}),parent:e});k(t,`source`,A(m)),D(t,`source`,E(m,t));let _=m.contentDOM;return _.addEventListener(`keydown`,c),_.addEventListener(`paste`,c),_.addEventListener(`drop`,c),_.addEventListener(`cut`,c),{view:m,ydoc:l.document,ytext:r,provider:l,themeCompartment:s,wordWrapCompartment:d,placeholderCompartment:p}}}),L.current=n,v.current=n.view}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),L.current=null,v.current=null,b(t instanceof Error?t:Error(String(t)))}return()=>{let e=L.current;e&&o(e),L.current=null,v.current=null}},t[3]=u,t[4]=l,t[5]=x,t[6]=P,t[7]=r,t[8]=R):R=t[8];let z;t[9]!==l||t[10]!==r?(z=[r,l],t[9]=l,t[10]=r,t[11]=z):z=t[11],(0,j.useEffect)(R,z);let B,V;t[12]===n?(B=t[13],V=t[14]):(B=()=>{},V=[n],t[12]=n,t[13]=B,t[14]=V),(0,j.useEffect)(B,V);let H,U;t[15]===x?(H=t[16],U=t[17]):(H=()=>{let e=L.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(x===`dark`?d:m)})},U=[x],t[15]=x,t[16]=H,t[17]=U),(0,j.useEffect)(H,U);let W,G;t[18]===P?(W=t[19],G=t[20]):(G=()=>{let e=L.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(P?C.lineWrapping:[])})},W=[P],t[18]=P,t[19]=W,t[20]=G),(0,j.useEffect)(G,W);let K,q;t[21]===u?(K=t[22],q=t[23]):(K=()=>{let e=L.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(w(u??``))})},q=[u],t[21]=u,t[22]=K,t[23]=q),(0,j.useEffect)(K,q);let J,Y;t[24]!==n||t[25]!==p?(J=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`source`||!p)return;let r=v.current;r&&(X(r,t),ie(n))};return window.addEventListener(O,e),()=>window.removeEventListener(O,e)},Y=[n,p],t[24]=n,t[25]=p,t[26]=J,t[27]=Y):(J=t[26],Y=t[27]),(0,j.useEffect)(J,Y);let Z,Q;t[28]!==n||t[29]!==p?(Z=()=>{if(!p)return;let e=v.current;if(!e)return;let t=re(n);if(t){if(t.kind===`outline`){X(e,t.detail);return}de(e,t.detail)}},Q=[n,p],t[28]=n,t[29]=p,t[30]=Z,t[31]=Q):(Z=t[30],Q=t[31]),(0,j.useEffect)(Z,Q);let $;return t[32]===Symbol.for(`react.memo_cache_sentinel`)?($=(0,ue.jsx)(`div`,{ref:_,className:`source-editor h-full pb-3`}),t[32]=$):$=t[32],$}function fe(){return{top:Y}}function pe(e){return C.scrollIntoView(e,{y:`start`})}function me(){return p()}export{Z as SourceEditor};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{r as i}from"./dist-CQw2y-s3.js";import{n as a}from"./dist-BVOt51sU.js";import{wt as o,xr as s,zt as c}from"./dist-
|
|
1
|
+
import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{r as i}from"./dist-CQw2y-s3.js";import{n as a}from"./dist-BVOt51sU.js";import{wt as o,xr as s,zt as c}from"./dist-W-hKJCWn.js";import{i as l,t as u}from"./button-cneJOVxD.js";import{n as d,r as f}from"./dist-CoyydoqN.js";import{d as p}from"./navigation-targets-D5Vr3b-e.js";import{a as m,c as h,s as g}from"./doc-hash-CCfJH4d9.js";import{t as _}from"./config-context-CE3SCVYc.js";import{E as v,f as y,m as b}from"./file-tree-adapter-8cV2wqcm.js";var x=r(),S=2,C=1,w=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(S,Math.floor(u/e.css.cell.width)),rows:Math.max(C,Math.floor(l/e.css.cell.height))}}},T=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],ee=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],E;function te(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var D=class{constructor(){if(this.version=`6`,!E){E=new Uint8Array(65536),E.fill(1),E[0]=0,E.fill(0,1,32),E.fill(0,127,160),E.fill(2,4352,4448),E[9001]=2,E[9002]=2,E.fill(2,11904,42192),E[12351]=1,E.fill(2,44032,55204),E.fill(2,63744,64256),E.fill(2,65040,65050),E.fill(2,65072,65136),E.fill(2,65280,65377),E.fill(2,65504,65511);for(let e=0;e<T.length;++e)E.fill(0,T[e][0],T[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?E[e]:te(e,ee)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=Xe.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return Xe.createPropertyValue(0,n,r)}},ne=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?j.isErrorNoTelemetry(e)?new j(e.message+`
|
|
2
2
|
|
|
3
3
|
`+e.stack):Error(e.message+`
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,t}from"./compiler-runtime-CVnuRdak.js";import{u as n}from"./button-cneJOVxD.js";import{l as r}from"./workspace-paths-
|
|
1
|
+
import{r as e,t}from"./compiler-runtime-CVnuRdak.js";import{u as n}from"./button-cneJOVxD.js";import{l as r}from"./workspace-paths-DDVHpOi-.js";import{i,r as a,t as o}from"./cursor-CjNH7VrK.js";var s=n(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),c=t(),l=e();function u(e){let t=(0,c.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,l.jsx)(`title`,{children:`Cline icon`}),r=(0,l.jsx)(`path`,{fill:`currentColor`,d:`M463.6,275.08l-29.26-58.75v-33.83c0-56.08-45.01-101.5-100.53-101.5h-50.01c3.62-7.43,5.61-15.79,5.61-24.61,0-31.17-25.08-56.39-56.07-56.39s-56.07,25.22-56.07,56.39c0,8.82,1.99,17.17,5.61,24.61h-50.01c-55.51,0-100.52,45.42-100.52,101.5v33.83l-29.87,58.59c-3.01,5.9-3.01,12.92,0,18.81l29.87,57.93v33.83c0,56.08,45.01,101.5,100.52,101.5h200.95c55.51,0,100.53-45.42,100.53-101.5v-33.83l29.21-58.13c2.9-5.79,2.9-12.61.05-18.46ZM202.75,322.96c0,25.48-20.54,46.14-45.88,46.14s-45.88-20.66-45.88-46.14v-82.02c0-25.48,20.54-46.14,45.88-46.14s45.88,20.66,45.88,46.14v82.02ZM350.58,322.96c0,25.48-20.54,46.14-45.88,46.14s-45.88-20.66-45.88-46.14v-82.02c0-25.48,20.54-46.14,45.88-46.14s45.88,20.66,45.88,46.14v82.02Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,l.jsxs)(`svg`,{role:`img`,"aria-label":`Cline icon`,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 466.73 487.04`,fill:`none`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function d(e){let t=(0,c.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,l.jsx)(`title`,{children:`GitHub Copilot icon`}),r=(0,l.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,fill:`currentColor`,d:`M9.6225 2.682C10.2835 3.362 10.561 4.29 10.6775 5.5905C10.9885 5.5905 11.2775 5.658 11.4735 5.9175L11.8385 6.3995C11.9435 6.5385 12 6.7045 12 6.877V8.187C12 8.3565 11.9135 8.5215 11.7735 8.621C10.1195 9.801 8.0785 10.75 6 10.75C3.7 10.75 1.3975 9.4585 0.2265 8.621C0.0865 8.521 0.0005 8.356 0 8.187V6.877C0 6.7045 0.0565 6.5375 0.1605 6.399L0.5255 5.9175C0.7215 5.659 1.0125 5.5905 1.322 5.5905L1.3365 5.442C1.4615 4.219 1.7415 3.3355 2.3775 2.682C3.608 1.412 5.2325 1.2565 5.9505 1.25H6.0495C6.7675 1.2565 8.392 1.4115 9.6225 2.682ZM6.0005 4.846C5.8585 4.846 5.694 4.854 5.5195 4.871C5.458 5.0945 5.367 5.296 5.2345 5.425C4.7095 5.9365 4.0765 6.015 3.7375 6.015C3.4185 6.015 3.0845 5.95 2.812 5.783C2.554 5.8655 2.306 5.9845 2.29 6.281C2.26898 6.76138 2.25847 7.24216 2.2585 7.723L2.2575 7.963C2.2565 8.2445 2.255 8.526 2.251 8.808C2.252 8.971 2.353 9.123 2.506 9.1905C3.747 9.7415 4.921 10.019 6.001 10.019C7.079 10.019 8.253 9.7415 9.4935 9.1905C9.56814 9.15767 9.63181 9.10416 9.677 9.03628C9.72219 8.96841 9.747 8.88902 9.7485 8.8075C9.7635 7.9665 9.7515 7.1215 9.7105 6.281C9.695 5.983 9.4465 5.866 9.1875 5.783C8.9145 5.9495 8.5815 6.015 8.2625 6.015C7.924 6.015 7.2915 5.9365 6.766 5.425C6.633 5.296 6.5425 5.0945 6.481 4.871C6.321 4.855 6.1605 4.8465 6.0005 4.846ZM4.738 6.8525C5.0075 6.8525 5.226 7.0655 5.226 7.3275V8.204C5.226 8.4665 5.0075 8.679 4.738 8.679C4.61033 8.6806 4.48725 8.63149 4.39576 8.54243C4.30426 8.45338 4.25184 8.33166 4.25 8.204V7.328C4.25 7.0655 4.4685 6.8525 4.738 6.8525ZM7.238 6.8525C7.5075 6.8525 7.726 7.0655 7.726 7.3275V8.204C7.726 8.4665 7.5075 8.679 7.238 8.679C7.11033 8.6806 6.98725 8.63149 6.89576 8.54243C6.80426 8.45338 6.75184 8.33166 6.75 8.204V7.328C6.75 7.0655 6.9685 6.8525 7.238 6.8525ZM3.8175 2.5435C3.2925 2.5945 2.85 2.7625 2.625 2.9965C2.1375 3.515 2.2425 4.8305 2.52 5.1085C2.7225 5.3055 3.105 5.437 3.5175 5.437H3.5625C3.887 5.4305 4.455 5.349 4.9275 4.882C5.145 4.677 5.28 4.1655 5.265 3.647C5.25 3.23 5.13 2.887 4.95 2.7405C4.755 2.5725 4.3125 2.4995 3.8175 2.5435ZM7.05 2.7405C6.87 2.8865 6.75 3.2305 6.735 3.647C6.72 4.1655 6.855 4.677 7.0725 4.882C7.5565 5.3605 8.1405 5.434 8.4605 5.437H8.4825C8.895 5.437 9.2775 5.3055 9.48 5.1085C9.7575 4.8305 9.8625 3.515 9.375 2.9965C9.15 2.7625 8.7075 2.5945 8.1825 2.5435C7.6875 2.4995 7.245 2.5725 7.05 2.7405ZM6 3.8075C5.88 3.8075 5.7375 3.815 5.58 3.8295C5.595 3.9095 5.6025 3.9975 5.61 4.0925L5.6095 4.172C5.60894 4.21375 5.60661 4.25545 5.6025 4.297C5.715 4.286 5.815 4.2835 5.9085 4.283H6.0915C6.185 4.283 6.285 4.286 6.3975 4.297C6.39 4.224 6.39 4.1585 6.39 4.0925C6.3975 3.9975 6.405 3.91 6.42 3.8295C6.2804 3.81583 6.14026 3.80849 6 3.8075Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,l.jsxs)(`svg`,{role:`img`,"aria-label":`GitHub Copilot icon`,xmlns:`http://www.w3.org/2000/svg`,width:12,height:12,viewBox:`0 0 12 12`,fill:`none`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function f(e){let t=(0,c.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,l.jsx)(`title`,{children:`Windsurf icon`}),r=(0,l.jsx)(`path`,{fill:`currentColor`,d:`M21.3192 4.9697H21.1203C20.0734 4.96806 19.2238 5.81589 19.2238 6.86264V11.0961C19.2238 11.9415 18.525 12.6263 17.6934 12.6263C17.1993 12.6263 16.706 12.3777 16.4133 11.9603L12.0896 5.78492C11.7308 5.27214 11.1471 4.96643 10.5152 4.96643C9.52943 4.96643 8.64234 5.80448 8.64234 6.83902V11.0969C8.64234 11.9423 7.94932 12.6271 7.11197 12.6271C6.61625 12.6271 6.12376 12.3785 5.83105 11.9611L0.992853 5.0504C0.883594 4.89387 0.638184 4.97133 0.638184 5.1621V8.85424C0.638184 9.04094 0.695264 9.22193 0.802059 9.37517L5.56362 16.175C5.84492 16.5769 6.25994 16.8753 6.73852 16.9837C7.93627 17.256 9.03861 16.334 9.03861 15.1592V10.9037C9.03861 10.0583 9.7235 9.37354 10.569 9.37354H10.5714C11.081 9.37354 11.5588 9.62219 11.8515 10.0396L16.1761 16.2141C16.5356 16.7277 17.0892 17.0326 17.7497 17.0326C18.7574 17.0326 19.6209 16.1937 19.6209 15.16V10.9029C19.6209 10.0575 20.3058 9.37273 21.1512 9.37273H21.32C21.426 9.37273 21.5116 9.28713 21.5116 9.18116V5.16127C21.5116 5.05531 21.426 4.9697 21.32 4.9697H21.3192Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,l.jsxs)(`svg`,{role:`img`,"aria-label":`Windsurf icon`,xmlns:`http://www.w3.org/2000/svg`,width:22,height:22,viewBox:`0 0 22 22`,fill:`none`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}var p=class{map=new Map;constructor(e){if(this.limit=e,e<=0)throw Error(`LruStringCache: limit must be > 0 (got ${e})`)}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}set(e,t){for(this.map.has(e)&&this.map.delete(e),this.map.set(e,t);this.map.size>this.limit;){let e=this.map.keys().next().value;if(e===void 0)break;this.map.delete(e)}}clear(){this.map.clear()}get size(){return this.map.size}};function m(e){let t=(0,c.c)(17),n,s;if(t[0]===e?(n=t[1],s=t[2]):({icon:n,...s}=e,t[0]=e,t[1]=n,t[2]=s),n===`claude`){let e;return t[3]===s?e=t[4]:(e=(0,l.jsx)(i,{...s}),t[3]=s,t[4]=e),e}if(n===`cursor`){let e;return t[5]===s?e=t[6]:(e=(0,l.jsx)(o,{...s}),t[5]=s,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===s?e=t[8]:(e=(0,l.jsx)(f,{...s}),t[7]=s,t[8]=e),e}if(n===`openai`){let e;return t[9]===s?e=t[10]:(e=(0,l.jsx)(a,{...s}),t[9]=s,t[10]=e),e}if(n===`cline`){let e;return t[11]===s?e=t[12]:(e=(0,l.jsx)(u,{...s}),t[11]=s,t[12]=e),e}if(n===`github`){let e;return t[13]===s?e=t[14]:(e=(0,l.jsx)(d,{...s}),t[13]=s,t[14]=e),e}let p=s,m;return t[15]===p?m=t[16]:(m=(0,l.jsx)(r,{strokeWidth:1.5,...p}),t[15]=p,t[16]=m),m}function h(e){return typeof e==`object`&&!!e&&typeof e.getStates==`function`}function g(e,t,n){let r=[],i=[];for(let a of e.getStates().values()){let e=a.agentPresence;if(e)for(let[a,o]of Object.entries(e))o.currentDoc&&(n-o.ts>=5e3||(o.currentDoc===t?r.push({agentId:a,entry:o}):i.push({agentId:a,entry:o})))}return{current:r,crossDoc:i}}export{f as a,s as c,p as i,g as n,d as o,m as r,u as s,h as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{$t as i,C as a,Dn as o,E as s,S as c,T as l,Ut as u,Vt as d,Wt as f,kn as p,n as m,w as h,x as g}from"./DocumentContext-Cf3xyIUc.js";import{n as _,r as v}from"./dist-CQw2y-s3.js";import{Cr as y,Dt as b,Or as x,Vi as S,_t as C,gt as w,it as T,pt as E,vt as D,yt as O}from"./dist-CJc7OX7s.js";import{t as k}from"./trace-api-D6fqC5Nw.js";import{i as A,r as j,t as M,u as N}from"./button-cneJOVxD.js";import{_t as P}from"./CodeMirrorPropInput-A-b7Ox39.js";import{a as F,l as I,n as L,r as R,t as z}from"./EnableSyncConfirmDialog-Ds9VzFz7.js";import{t as B}from"./arrow-up-right-Crm0Btez.js";import{t as V}from"./check-DRRCCRSs.js";import{o as H}from"./prop-types-BwJNmxtq.js";import{T as U,f as ee,i as te,o as W,p as ne}from"./skill-actions-CMd77Yt2.js";import{d as G,i as re,o as ie,s as ae,u as K}from"./workspace-paths-CYa5l8eZ.js";import{a as oe,n as se,r as ce}from"./open-managed-artifact-tab-Da7L5wL4.js";import{t as le}from"./loader-circle-B7Gv_Djz.js";import{t as ue}from"./refresh-cw-CluaccKu.js";import{t as de}from"./trash-2-Dcpo0Di-.js";import{t as fe}from"./triangle-alert-c3yCucJv.js";import{n as pe,r as me}from"./dist-CoyydoqN.js";import{d as he}from"./dist-BSkHa6UR.js";import{i as ge,n as _e,t as ve}from"./tooltip-FFg0kVkD.js";import{a as ye,c as be,i as xe,n as Se,o as Ce,s as we,t as Te}from"./dialog-DdHaoAGK.js";import{E as Ee,_ as De,h as Oe,l as ke,p as Ae}from"./skills-api-UoasHTUi.js";import{t as je}from"./label-DPn_C7ZD.js";import{n as Me,t as Ne}from"./radio-group-B0RG5um-.js";import{t as Pe}from"./input-tW78aNaR.js";import{t as Fe}from"./parse-api-error-CqtA8BcL.js";import{t as q}from"./dist-BvBijIC5.js";import{c as Ie,o as Le}from"./documents-events-Bit0pJeY.js";import{a as Re,m as ze,s as Be}from"./doc-hash-B7rSgZqz.js";import{c as Ve,l as He}from"./keyboard-shortcuts-CvYXgqK4.js";import"./config-provider-D0CfBIwU.js";import{n as Ue}from"./config-context-CE3SCVYc.js";import{t as We}from"./external-link-BjECE2gH.js";import{t as Ge}from"./textarea-DtAQz2_P.js";var Ke=N(`cloud-off`,[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),qe=N(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),Je=N(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),Ye=N(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),Xe=N(`file-plus`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]),Ze=N(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),Qe=N(`move-up-right`,[[`path`,{d:`M13 5H19V11`,key:`1n1gyv`}],[`path`,{d:`M19 5L5 19`,key:`72u4yj`}]]),$e=N(`user-cog`,[[`path`,{d:`M10 15H6a4 4 0 0 0-4 4v2`,key:`1nfge6`}],[`path`,{d:`m14.305 16.53.923-.382`,key:`1itpsq`}],[`path`,{d:`m15.228 13.852-.923-.383`,key:`eplpkm`}],[`path`,{d:`m16.852 12.228-.383-.923`,key:`13v3q0`}],[`path`,{d:`m16.852 17.772-.383.924`,key:`1i8mnm`}],[`path`,{d:`m19.148 12.228.383-.923`,key:`1q8j1v`}],[`path`,{d:`m19.53 18.696-.382-.924`,key:`vk1qj3`}],[`path`,{d:`m20.772 13.852.924-.383`,key:`n880s0`}],[`path`,{d:`m20.772 16.148.924.383`,key:`1g6xey`}],[`circle`,{cx:`18`,cy:`15`,r:`3`,key:`gjjjvw`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),J=e(t(),1),Y=n(),et=`Separator`,tt=`horizontal`,nt=[`horizontal`,`vertical`],rt=J.forwardRef((e,t)=>{let{decorative:n,orientation:r=tt,...i}=e,a=it(r)?r:tt,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,Y.jsx)(he.div,{"data-orientation":a,...o,...i,ref:t})});rt.displayName=et;function it(e){return nt.includes(e)}var at=rt,X=r();function ot(e){let t=(0,X.c)(12),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={status:`idle`},t[0]=n):n=t[0];let[r,i]=(0,J.useState)(n),[a,o]=(0,J.useState)(0),s,c;t[1]===e?(s=t[2],c=t[3]):(s=()=>{if(e!==null)return Ie(()=>{o(ut)})},c=[e],t[1]=e,t[2]=s,t[3]=c),(0,J.useEffect)(s,c);let l;t[4]===e?l=t[5]:(l=()=>{if(e===null){i({status:`idle`});return}let t=!1;i({status:`loading`});let n=e?`?path=${encodeURIComponent(e)}`:``;return fetch(`/api/folder-config${n}`).then(ct).then(e=>{if(!t){if(!e||typeof e!=`object`||!e.folder){i({status:`error`,message:`Server returned an incomplete folder response.`});return}i({status:`ready`,data:{folder:e.folder,frontmatterLocal:e.frontmatter_local??null}})}}).catch(e=>{t||i({status:`error`,message:e instanceof Error?e.message:String(e)})}),()=>{t=!0}},t[4]=e,t[5]=l);let u;t[6]!==e||t[7]!==a?(u=[e,a],t[6]=e,t[7]=a,t[8]=u):u=t[8],(0,J.useEffect)(l,u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>o(st),t[9]=d):d=t[9];let f;return t[10]===r?f=t[11]:(f={state:r,refresh:d},t[10]=r,t[11]=f),f}function st(e){return e+1}async function ct(e){if(!e.ok){let t=await e.json().catch(lt);throw Error(Fe(t)??`HTTP ${e.status}`)}return e.json()}function lt(){return null}function ut(e){return e+1}function dt(){let e=(0,X.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={status:`idle`},e[0]=t):t=e[0];let[n,r]=(0,J.useState)(t),[i,a]=(0,J.useState)(0),o,s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>Ie(()=>{a(mt)}),s=[],e[1]=o,e[2]=s):(o=e[1],s=e[2]),(0,J.useEffect)(o,s);let c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=!1;return r({status:`loading`}),fetch(`/api/templates`).then(ft).then(t=>{if(e)return;let n=b.safeParse(t);if(!n.success){console.error(`[ok-templates] /api/templates response failed schema validation:`,n.error.issues),r({status:`error`,message:`Server returned an incomplete templates response.`});return}r({status:`ready`,data:n.data.templates})}).catch(t=>{e||r({status:`error`,message:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},e[3]=c):c=e[3];let l;return e[4]===i?l=e[5]:(l=[i],e[4]=i,e[5]=l),(0,J.useEffect)(c,l),n}async function ft(e){if(!e.ok){let t=await e.json().catch(pt);throw Error(Fe(t)??`HTTP ${e.status}`)}return e.json()}function pt(){return null}function mt(e){return e+1}function ht(e){let t=(0,X.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,orientation:i,decorative:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`horizontal`:i,s=a===void 0?!0:a,c;t[5]===n?c=t[6]:(c=A(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,n),t[5]=n,t[6]=c);let l;return t[7]!==s||t[8]!==o||t[9]!==r||t[10]!==c?(l=(0,Y.jsx)(at,{"data-slot":`separator`,decorative:s,orientation:o,className:c,...r}),t[7]=s,t[8]=o,t[9]=r,t[10]=c,t[11]=l):l=t[11],l}function gt(e){let t=(0,X.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=A(`group/field-group @container/field-group flex w-full flex-col gap-6 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(`div`,{"data-slot":`field-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var _t=j(`group/field flex w-full gap-2 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function vt(e){let t=(0,X.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`vertical`:i,o;t[4]!==n||t[5]!==a?(o=A(_t({orientation:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==a||t[8]!==r||t[9]!==o?(s=(0,Y.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":a,className:o,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function yt(e){let t=(0,X.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=A(`group/field-content flex flex-1 flex-col gap-0.5 leading-snug`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(`div`,{"data-slot":`field-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function bt(e){let t=(0,X.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=A(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(je,{"data-slot":`field-label`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function xt(e){let t=(0,X.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=A(`flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(`div`,{"data-slot":`field-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function St(e){let t=(0,X.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=A(`text-left text-1sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5`,`last:mt-0 nth-last-2:-mt-1`,`[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(`p`,{"data-slot":`field-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ct(e){let t=(0,X.c)(15),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,errors:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;bb0:{if(n){o=n;break bb0}if(!i?.length){o=null;break bb0}let e;t[5]===i?e=t[6]:(e=[...new Map(i.map(Tt)).values()],t[5]=i,t[6]=e);let r=e;if(r?.length===1){o=r[0]?.message;break bb0}let a;t[7]===r?a=t[8]:(a=(0,Y.jsx)(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:r.map(wt)}),t[7]=r,t[8]=a),o=a}let s=o;if(!s)return null;let c;t[9]===r?c=t[10]:(c=A(`text-sm font-normal text-destructive`,r),t[9]=r,t[10]=c);let l;return t[11]!==s||t[12]!==a||t[13]!==c?(l=(0,Y.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:c,...a,children:s}),t[11]=s,t[12]=a,t[13]=c,t[14]=l):l=t[14],l}function wt(e){return e?.message&&(0,Y.jsx)(`li`,{children:e.message},e.message)}function Tt(e){return[e?.message,e]}async function Et(){try{let e=await fetch(`/api/semantic-status`);return e.ok?await e.json():(console.debug(`[semantic-status] probe returned`,e.status),null)}catch(e){return console.debug(`[semantic-status] probe failed`,e),null}}function Dt(e){let t=(0,X.c)(16),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let r=n.enabled??!0,[i,a]=(0,J.useState)(null),o;t[2]===r?o=t[3]:(o=function(){r&&Et().then(e=>{e&&a(e)})},t[2]=r,t[3]=o);let s=o,c;t[4]===s?c=t[5]:(c=()=>{s()},t[4]=s,t[5]=c);let l;t[6]===r?l=t[7]:(l=[r],t[6]=r,t[7]=l),(0,J.useEffect)(c,l);let u;t[8]!==r||t[9]!==s?(u=()=>{if(r)return Le(e=>{e.includes(`files`)&&s()})},t[8]=r,t[9]=s,t[10]=u):u=t[10];let d;t[11]===r?d=t[12]:(d=[r],t[11]=r,t[12]=d),(0,J.useEffect)(u,d);let f;return t[13]!==s||t[14]!==i?(f={status:i,refresh:s},t[13]=s,t[14]=i,t[15]=f):f=t[15],f}var Ot=`#settings`;function kt(e){return Ve(e.target)?!1:He(e,`settings`)}function At(e){return e.replace(/^#/,``)===`settings`}function jt(){return typeof window>`u`?``:window.location.hash}function Mt(){let e=(0,X.c)(4),[t,n]=(0,J.useState)(Pt),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=()=>{(0,J.startTransition)(()=>{n(At(jt()))})};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,J.useEffect)(r,i);let a=Nt,o;return e[2]===t?o=e[3]:(o={open:t,close:a},e[2]=t,e[3]=o),o}function Nt(){typeof window>`u`||At(jt())&&window.history.back()}function Pt(){return At(jt())}var Ft=`open-knowledge-app`;function It(e){try{k.getTracer(Ft).startSpan(e).end()}catch(e){console.warn(`[terminal-telemetry] span emit failed:`,e instanceof Error?e:String(e))}}function Lt(){It(`ok.desktop.terminalOpened`)}function Rt(){It(`ok.desktop.shellConsentGranted`)}var zt=`github.com`,Bt=new Map;async function Vt(e){try{let t=await e.json(),n=T.safeParse(t);if(n.success)return n.data.title}catch{}}async function Ht(e,t){return fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t??{})})}async function Ut(e){let t=e?.host??zt,n=await Ht(`/api/local-op/auth/status`,e);if(!n.ok)return{authenticated:!1,host:t,error:await Vt(n)};let r=await n.json(),i=typeof r.host==`string`?r.host:t;if(r.authenticated===!0&&typeof r.login==`string`){let e=r.tier===`A`||r.tier===`B`||r.tier===`C`?r.tier:void 0;return{authenticated:!0,host:i,login:r.login,tier:e,name:typeof r.name==`string`?r.name:void 0,email:typeof r.email==`string`?r.email:void 0}}return{authenticated:!1,host:i,error:typeof r.error==`string`?r.error:void 0}}function Wt(e){let t=e?.host??zt,n=Bt.get(t);if(n)return n;let r=Ut(e).finally(()=>{Bt.delete(t)});return Bt.set(t,r),r}function Gt(e){let t=e.split(`
|
|
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{$t as i,C as a,Dn as o,E as s,S as c,T as l,Ut as u,Vt as d,Wt as f,kn as p,n as m,w as h,x as g}from"./DocumentContext-D3J8u-yJ.js";import{n as _,r as v}from"./dist-CQw2y-s3.js";import{Cr as y,Dt as b,Or as x,Ui as S,_t as C,gt as w,it as T,pt as E,vt as D,yt as O}from"./dist-W-hKJCWn.js";import{t as k}from"./trace-api-D6fqC5Nw.js";import{i as A,r as j,t as M,u as N}from"./button-cneJOVxD.js";import{vt as P}from"./CodeMirrorPropInput-DIQ7Kf5H.js";import{a as F,l as I,n as L,r as R,t as z}from"./EnableSyncConfirmDialog-BARabdkd.js";import{t as B}from"./arrow-up-right-Crm0Btez.js";import{t as V}from"./check-DRRCCRSs.js";import{o as H}from"./prop-types-Zdll0W8u.js";import{T as U,f as ee,i as te,o as W,p as ne}from"./skill-actions-BfvtIGj9.js";import{d as G,i as re,o as ie,s as ae,u as K}from"./workspace-paths-DDVHpOi-.js";import{a as oe,n as se,r as ce}from"./open-managed-artifact-tab-7RGWt7Lr.js";import{t as le}from"./loader-circle-B7Gv_Djz.js";import{t as ue}from"./refresh-cw-CluaccKu.js";import{t as de}from"./trash-2-Dcpo0Di-.js";import{t as fe}from"./triangle-alert-c3yCucJv.js";import{n as pe,r as me}from"./dist-CoyydoqN.js";import{d as he}from"./dist-BSkHa6UR.js";import{i as ge,n as _e,t as ve}from"./tooltip-FFg0kVkD.js";import{a as ye,c as be,i as xe,n as Se,o as Ce,s as we,t as Te}from"./dialog-DdHaoAGK.js";import{E as Ee,_ as De,h as Oe,l as ke,p as Ae}from"./skills-api-DQp0sBix.js";import{t as je}from"./label-DPn_C7ZD.js";import{n as Me,t as Ne}from"./radio-group-B0RG5um-.js";import{t as Pe}from"./input-tW78aNaR.js";import{t as Fe}from"./parse-api-error-CqtA8BcL.js";import{t as q}from"./dist-BvBijIC5.js";import{c as Ie,o as Le}from"./documents-events-C2yqFJPg.js";import{a as Re,m as ze,s as Be}from"./doc-hash-CCfJH4d9.js";import{c as Ve,l as He}from"./keyboard-shortcuts-BrZDq1VP.js";import"./config-provider-Bkj9YufI.js";import{n as Ue}from"./config-context-CE3SCVYc.js";import{t as We}from"./external-link-BjECE2gH.js";import{t as Ge}from"./textarea-DtAQz2_P.js";var Ke=N(`cloud-off`,[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),qe=N(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),Je=N(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),Ye=N(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),Xe=N(`file-plus`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]),Ze=N(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),Qe=N(`move-up-right`,[[`path`,{d:`M13 5H19V11`,key:`1n1gyv`}],[`path`,{d:`M19 5L5 19`,key:`72u4yj`}]]),$e=N(`user-cog`,[[`path`,{d:`M10 15H6a4 4 0 0 0-4 4v2`,key:`1nfge6`}],[`path`,{d:`m14.305 16.53.923-.382`,key:`1itpsq`}],[`path`,{d:`m15.228 13.852-.923-.383`,key:`eplpkm`}],[`path`,{d:`m16.852 12.228-.383-.923`,key:`13v3q0`}],[`path`,{d:`m16.852 17.772-.383.924`,key:`1i8mnm`}],[`path`,{d:`m19.148 12.228.383-.923`,key:`1q8j1v`}],[`path`,{d:`m19.53 18.696-.382-.924`,key:`vk1qj3`}],[`path`,{d:`m20.772 13.852.924-.383`,key:`n880s0`}],[`path`,{d:`m20.772 16.148.924.383`,key:`1g6xey`}],[`circle`,{cx:`18`,cy:`15`,r:`3`,key:`gjjjvw`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),J=e(t(),1),Y=n(),et=`Separator`,tt=`horizontal`,nt=[`horizontal`,`vertical`],rt=J.forwardRef((e,t)=>{let{decorative:n,orientation:r=tt,...i}=e,a=it(r)?r:tt,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,Y.jsx)(he.div,{"data-orientation":a,...o,...i,ref:t})});rt.displayName=et;function it(e){return nt.includes(e)}var at=rt,X=r();function ot(e){let t=(0,X.c)(12),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={status:`idle`},t[0]=n):n=t[0];let[r,i]=(0,J.useState)(n),[a,o]=(0,J.useState)(0),s,c;t[1]===e?(s=t[2],c=t[3]):(s=()=>{if(e!==null)return Ie(()=>{o(ut)})},c=[e],t[1]=e,t[2]=s,t[3]=c),(0,J.useEffect)(s,c);let l;t[4]===e?l=t[5]:(l=()=>{if(e===null){i({status:`idle`});return}let t=!1;i({status:`loading`});let n=e?`?path=${encodeURIComponent(e)}`:``;return fetch(`/api/folder-config${n}`).then(ct).then(e=>{if(!t){if(!e||typeof e!=`object`||!e.folder){i({status:`error`,message:`Server returned an incomplete folder response.`});return}i({status:`ready`,data:{folder:e.folder,frontmatterLocal:e.frontmatter_local??null}})}}).catch(e=>{t||i({status:`error`,message:e instanceof Error?e.message:String(e)})}),()=>{t=!0}},t[4]=e,t[5]=l);let u;t[6]!==e||t[7]!==a?(u=[e,a],t[6]=e,t[7]=a,t[8]=u):u=t[8],(0,J.useEffect)(l,u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>o(st),t[9]=d):d=t[9];let f;return t[10]===r?f=t[11]:(f={state:r,refresh:d},t[10]=r,t[11]=f),f}function st(e){return e+1}async function ct(e){if(!e.ok){let t=await e.json().catch(lt);throw Error(Fe(t)??`HTTP ${e.status}`)}return e.json()}function lt(){return null}function ut(e){return e+1}function dt(){let e=(0,X.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={status:`idle`},e[0]=t):t=e[0];let[n,r]=(0,J.useState)(t),[i,a]=(0,J.useState)(0),o,s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>Ie(()=>{a(mt)}),s=[],e[1]=o,e[2]=s):(o=e[1],s=e[2]),(0,J.useEffect)(o,s);let c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=!1;return r({status:`loading`}),fetch(`/api/templates`).then(ft).then(t=>{if(e)return;let n=b.safeParse(t);if(!n.success){console.error(`[ok-templates] /api/templates response failed schema validation:`,n.error.issues),r({status:`error`,message:`Server returned an incomplete templates response.`});return}r({status:`ready`,data:n.data.templates})}).catch(t=>{e||r({status:`error`,message:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},e[3]=c):c=e[3];let l;return e[4]===i?l=e[5]:(l=[i],e[4]=i,e[5]=l),(0,J.useEffect)(c,l),n}async function ft(e){if(!e.ok){let t=await e.json().catch(pt);throw Error(Fe(t)??`HTTP ${e.status}`)}return e.json()}function pt(){return null}function mt(e){return e+1}function ht(e){let t=(0,X.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,orientation:i,decorative:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`horizontal`:i,s=a===void 0?!0:a,c;t[5]===n?c=t[6]:(c=A(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,n),t[5]=n,t[6]=c);let l;return t[7]!==s||t[8]!==o||t[9]!==r||t[10]!==c?(l=(0,Y.jsx)(at,{"data-slot":`separator`,decorative:s,orientation:o,className:c,...r}),t[7]=s,t[8]=o,t[9]=r,t[10]=c,t[11]=l):l=t[11],l}function gt(e){let t=(0,X.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=A(`group/field-group @container/field-group flex w-full flex-col gap-6 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(`div`,{"data-slot":`field-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var _t=j(`group/field flex w-full gap-2 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function vt(e){let t=(0,X.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`vertical`:i,o;t[4]!==n||t[5]!==a?(o=A(_t({orientation:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==a||t[8]!==r||t[9]!==o?(s=(0,Y.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":a,className:o,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function yt(e){let t=(0,X.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=A(`group/field-content flex flex-1 flex-col gap-0.5 leading-snug`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(`div`,{"data-slot":`field-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function bt(e){let t=(0,X.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=A(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(je,{"data-slot":`field-label`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function xt(e){let t=(0,X.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=A(`flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(`div`,{"data-slot":`field-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function St(e){let t=(0,X.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=A(`text-left text-1sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5`,`last:mt-0 nth-last-2:-mt-1`,`[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(`p`,{"data-slot":`field-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ct(e){let t=(0,X.c)(15),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,errors:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;bb0:{if(n){o=n;break bb0}if(!i?.length){o=null;break bb0}let e;t[5]===i?e=t[6]:(e=[...new Map(i.map(Tt)).values()],t[5]=i,t[6]=e);let r=e;if(r?.length===1){o=r[0]?.message;break bb0}let a;t[7]===r?a=t[8]:(a=(0,Y.jsx)(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:r.map(wt)}),t[7]=r,t[8]=a),o=a}let s=o;if(!s)return null;let c;t[9]===r?c=t[10]:(c=A(`text-sm font-normal text-destructive`,r),t[9]=r,t[10]=c);let l;return t[11]!==s||t[12]!==a||t[13]!==c?(l=(0,Y.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:c,...a,children:s}),t[11]=s,t[12]=a,t[13]=c,t[14]=l):l=t[14],l}function wt(e){return e?.message&&(0,Y.jsx)(`li`,{children:e.message},e.message)}function Tt(e){return[e?.message,e]}async function Et(){try{let e=await fetch(`/api/semantic-status`);return e.ok?await e.json():(console.debug(`[semantic-status] probe returned`,e.status),null)}catch(e){return console.debug(`[semantic-status] probe failed`,e),null}}function Dt(e){let t=(0,X.c)(16),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let r=n.enabled??!0,[i,a]=(0,J.useState)(null),o;t[2]===r?o=t[3]:(o=function(){r&&Et().then(e=>{e&&a(e)})},t[2]=r,t[3]=o);let s=o,c;t[4]===s?c=t[5]:(c=()=>{s()},t[4]=s,t[5]=c);let l;t[6]===r?l=t[7]:(l=[r],t[6]=r,t[7]=l),(0,J.useEffect)(c,l);let u;t[8]!==r||t[9]!==s?(u=()=>{if(r)return Le(e=>{e.includes(`files`)&&s()})},t[8]=r,t[9]=s,t[10]=u):u=t[10];let d;t[11]===r?d=t[12]:(d=[r],t[11]=r,t[12]=d),(0,J.useEffect)(u,d);let f;return t[13]!==s||t[14]!==i?(f={status:i,refresh:s},t[13]=s,t[14]=i,t[15]=f):f=t[15],f}var Ot=`#settings`;function kt(e){return Ve(e.target)?!1:He(e,`settings`)}function At(e){return e.replace(/^#/,``)===`settings`}function jt(){return typeof window>`u`?``:window.location.hash}function Mt(){let e=(0,X.c)(4),[t,n]=(0,J.useState)(Pt),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=()=>{(0,J.startTransition)(()=>{n(At(jt()))})};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,J.useEffect)(r,i);let a=Nt,o;return e[2]===t?o=e[3]:(o={open:t,close:a},e[2]=t,e[3]=o),o}function Nt(){typeof window>`u`||At(jt())&&window.history.back()}function Pt(){return At(jt())}var Ft=`open-knowledge-app`;function It(e){try{k.getTracer(Ft).startSpan(e).end()}catch(e){console.warn(`[terminal-telemetry] span emit failed:`,e instanceof Error?e:String(e))}}function Lt(){It(`ok.desktop.terminalOpened`)}function Rt(){It(`ok.desktop.shellConsentGranted`)}var zt=`github.com`,Bt=new Map;async function Vt(e){try{let t=await e.json(),n=T.safeParse(t);if(n.success)return n.data.title}catch{}}async function Ht(e,t){return fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t??{})})}async function Ut(e){let t=e?.host??zt,n=await Ht(`/api/local-op/auth/status`,e);if(!n.ok)return{authenticated:!1,host:t,error:await Vt(n)};let r=await n.json(),i=typeof r.host==`string`?r.host:t;if(r.authenticated===!0&&typeof r.login==`string`){let e=r.tier===`A`||r.tier===`B`||r.tier===`C`?r.tier:void 0;return{authenticated:!0,host:i,login:r.login,tier:e,name:typeof r.name==`string`?r.name:void 0,email:typeof r.email==`string`?r.email:void 0}}return{authenticated:!1,host:i,error:typeof r.error==`string`?r.error:void 0}}function Wt(e){let t=e?.host??zt,n=Bt.get(t);if(n)return n;let r=Ut(e).finally(()=>{Bt.delete(t)});return Bt.set(t,r),r}function Gt(e){let t=e.split(`
|
|
2
2
|
`);for(let e=t.length-1;e>=0;e--){let n=t[e]?.trim();if(n)try{let e=JSON.parse(n);if(e&&typeof e==`object`)return e}catch{}}return null}function Kt(){return{status:Wt,async repos(e){let t=e?.host??`github.com`,n=await Ht(`/api/local-op/auth/repos`,e);if(!n.ok)return{ok:!1,error:await Vt(n)??`Failed to fetch repositories`};let r=Gt(await n.text());if(r&&r.type===`error`&&r.problem&&typeof r.problem==`object`){let e=r.problem;return{ok:!1,error:e.detail||e.title||`Failed to fetch repositories`}}if(!r||!Array.isArray(r.repos))return{ok:!1,error:`Failed to fetch repositories`};let i=[];for(let e of r.repos){let t=e;typeof t?.full_name==`string`&&typeof t.clone_url==`string`&&i.push({full_name:t.full_name,clone_url:t.clone_url,private:t.private===!0})}return{ok:!0,host:typeof r.host==`string`?r.host:t,repos:i}},async signout(e){let t=await Ht(`/api/local-op/auth/signout`,e);return t.ok?{ok:!0}:{ok:!1,error:await Vt(t)}}}}function qt(e){return{status:t=>e.localOp.authStatus(t),repos:t=>e.localOp.authRepos(t)}}async function Jt(e,t){let n=e.getReader(),r=new TextDecoder,i=``;for(;;){let{done:e,value:a}=await n.read();if(e)return i+=r.decode(),!!(i.trim()&&t(i)===`terminal`);i+=r.decode(a,{stream:!0});let o=i.split(`
|
|
3
3
|
`);i=o.pop()??``;for(let e of o)if(e.trim()&&t(e)===`terminal`)return!0}}function Yt(e){let t=[],n=[],r=new AbortController,i=!1,a=()=>{for(let e of n.splice(0))e(null)};return e(e=>{i||(n.length>0?n.shift()?.(e):t.push(e),(e.type===`complete`||e.type===`error`)&&(i=!0,r.abort(),a()))},r.signal),{events:{[Symbol.asyncIterator](){return{async next(){if(t.length>0){let e=t.shift();return e===void 0?{value:void 0,done:!0}:{value:e,done:!1}}return i?{value:void 0,done:!0}:new Promise(e=>{n.push(t=>{e(t===null?{value:void 0,done:!0}:{value:t,done:!1})})})}}}},cancel:()=>{i||(i=!0,r.abort(),a())}}}function Xt(){return{start(){return Yt((e,t)=>{(async()=>{try{let n=await fetch(`/api/local-op/auth/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({json:!0}),signal:t});if(!n.ok){let t=`Failed to start sign-in — try again`;try{let e=await n.json(),r=T.safeParse(e);r.success&&(t=r.data.title)}catch{}e({type:`error`,message:t});return}if(!n.body){e({type:`error`,message:`Failed to start sign-in — try again`});return}!await Jt(n.body,t=>{let n;try{n=JSON.parse(t)}catch{return console.warn(`[auth-transport] Dropped unparseable NDJSON line:`,t.slice(0,100)),`continue`}if(n&&typeof n==`object`&&n.type===`error`&&`problem`in n){let t=n.problem;return e({type:`error`,message:t?.detail||t?.title||`Unknown error`}),`terminal`}let r=n;return e(r),r.type===`complete`||r.type===`error`?`terminal`:`continue`})&&!t.aborted&&e({type:`error`,message:`Sign-in stream ended without confirmation — please try again`})}catch(t){if(t instanceof Error&&t.name===`AbortError`)return;e({type:`error`,message:`Connection error — try again`})}})()})}}}function Zt(e){return{start(){return e.localOp.auth.start()}}}async function Qt(e){try{await navigator.clipboard.writeText(e)}catch{}}var $t=120*1e3;function en(e){let t=(0,X.c)(25),{onSuccess:n,transport:r}=e,{_:i}=v(),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(`https://github.com/login/device`),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(null),[p,m]=(0,J.useState)($t),h=(0,J.useRef)(null),g=(0,J.useRef)(null),y;t[0]!==i||t[1]!==n||t[2]!==r?(y=async function(){f(null);try{let e=r.start();h.current=e.cancel;let t=e.events[Symbol.asyncIterator](),a=!1,s=await t.next();for(;!s.done;){let e=s.value;if(e.type===`verification`)o(e.user_code),c(e.verification_uri),m(e.expires_in*1e3),Qt(e.user_code).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)});else if(e.type===`complete`){a=!0,n({login:e.login,name:e.name,email:e.email,avatarUrl:e.avatarUrl});break}else if(e.type===`error`){a=!0,f(e.message);break}s=await t.next()}a||f(i({id:`DskIkK`}))}catch(e){let t=e;t instanceof Error&&t.name!==`AbortError`&&f(i({id:`Q5fqMz`}))}},t[0]=i,t[1]=n,t[2]=r,t[3]=y):y=t[3];let b=y,x;t[4]===b?x=t[5]:(x=()=>{let e=!1;return queueMicrotask(()=>{e||b()}),()=>{e=!0,h.current?.(),h.current=null,g.current&&clearInterval(g.current)}},t[4]=b,t[5]=x);let S;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[6]=S):S=t[6],(0,J.useEffect)(x,S);let C,w;t[7]!==i||t[8]!==a?(C=()=>{if(!a)return;let e=Date.now();return g.current=setInterval(()=>{let t=$t-(Date.now()-e);t<=0?(m(0),g.current&&clearInterval(g.current),f(i({id:`ve8vEM`}))):m(t)},1e3),()=>{g.current&&clearInterval(g.current)}},w=[a,i],t[7]=i,t[8]=a,t[9]=C,t[10]=w):(C=t[9],w=t[10]),(0,J.useEffect)(C,w);let T=Math.floor(p/6e4),E=Math.floor(p%6e4/1e3),D;t[11]===E?D=t[12]:(D=E.toString().padStart(2,`0`),t[11]=E,t[12]=D);let O=`${T}:${D}`,k;t[13]!==i||t[14]!==l||t[15]!==d||t[16]!==O||t[17]!==a||t[18]!==s?(k=a?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Y.jsx)(_,{id:`eVPynQ`,values:{verificationUri:s},components:{0:(0,Y.jsx)(`a`,{href:s,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>We(e,s),onAuxClick:e=>We(e,s),className:`inline-flex items-center gap-0.5 text-foreground hover:text-primary hover:underline`}),1:(0,Y.jsx)(`span`,{}),2:(0,Y.jsx)(B,{className:`inline size-3.5`,"aria-hidden":!0})}})}),(0,Y.jsxs)(M,{type:`button`,variant:`outline`,"aria-label":i({id:`nCzR-G`,values:{userCode:a}}),onClick:()=>void Qt(a).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)}),className:`relative h-auto w-full justify-center rounded-md bg-muted px-12 py-3 hover:bg-muted/80`,children:[(0,Y.jsx)(`code`,{className:`font-mono text-2xl font-bold tracking-widest`,children:a}),(0,Y.jsx)(`span`,{className:`absolute right-3 text-muted-foreground`,"aria-hidden":`true`,children:l?(0,Y.jsx)(V,{className:`size-4`}):(0,Y.jsx)(G,{className:`size-4`})})]}),(0,Y.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`sr-only`,children:l?(0,Y.jsx)(_,{id:`80c4-P`}):null}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500 animate-pulse`}),(0,Y.jsx)(_,{id:`5y_9lO`})]}),(0,Y.jsx)(`span`,{children:(0,Y.jsx)(_,{id:`gYz2ep`,values:{timeLabel:O}})})]})]}):(0,Y.jsx)(`div`,{className:`flex items-center justify-center py-6 text-sm text-muted-foreground`,children:d?null:(0,Y.jsx)(_,{id:`aWlJai`})}),t[13]=i,t[14]=l,t[15]=d,t[16]=O,t[17]=a,t[18]=s,t[19]=k):k=t[19];let A;t[20]===d?A=t[21]:(A=d&&(0,Y.jsx)(`p`,{className:`text-1sm text-destructive`,children:d}),t[20]=d,t[21]=A);let j;return t[22]!==k||t[23]!==A?(j=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[k,A]}),t[22]=k,t[23]=A,t[24]=j):j=t[24],j}function tn(e){let t=(0,X.c)(30),{login:n,name:r,onNameChange:i,email:a,onEmailChange:o}=e,{_:s}=v(),c;t[0]===n?c=t[1]:(c=(0,Y.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Y.jsx)(_,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=c);let l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,Y.jsx)(_,{id:`gp3I7-`})}),t[2]=l):l=t[2];let u;t[3]===s?u=t[4]:(u=s({id:`6YtxFj`}),t[3]=s,t[4]=u);let d;t[5]!==s||t[6]!==n?(d=s({id:`J2Mv98`,values:{login:n}}),t[5]=s,t[6]=n,t[7]=d):d=t[7];let f;t[8]===i?f=t[9]:(f=e=>i(e.target.value),t[8]=i,t[9]=f);let p;t[10]!==r||t[11]!==u||t[12]!==d||t[13]!==f?(p=(0,Y.jsx)(Pe,{"aria-label":u,placeholder:d,value:r,onChange:f}),t[10]=r,t[11]=u,t[12]=d,t[13]=f,t[14]=p):p=t[14];let m;t[15]===s?m=t[16]:(m=s({id:`O3oNi5`}),t[15]=s,t[16]=m);let h;t[17]===s?h=t[18]:(h=s({id:`O3oNi5`}),t[17]=s,t[18]=h);let g;t[19]===o?g=t[20]:(g=e=>o(e.target.value),t[19]=o,t[20]=g);let y;t[21]!==a||t[22]!==m||t[23]!==h||t[24]!==g?(y=(0,Y.jsx)(Pe,{type:`email`,"aria-label":m,placeholder:h,value:a,onChange:g}),t[21]=a,t[22]=m,t[23]=h,t[24]=g,t[25]=y):y=t[25];let b;return t[26]!==c||t[27]!==y||t[28]!==p?(b=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[c,l,p,y]}),t[26]=c,t[27]=y,t[28]=p,t[29]=b):b=t[29],b}var nn=1e4;function rn(e){let t=(0,X.c)(59),{open:n,onOpenChange:r,onSuccess:i,identityPrompt:a,reauth:o,transport:s,queryTransport:c}=e,{_:l}=v(),u;t[0]===s?u=t[1]:(u=s??Xt(),t[0]=s,t[1]=u);let d=u,f;t[2]===c?f=t[3]:(f=c??Kt(),t[2]=c,t[3]=f);let p=f,[m,h]=(0,J.useState)(`auth`),[g,y]=(0,J.useState)(null),[b,x]=(0,J.useState)(``),[S,C]=(0,J.useState)(``),w,T;t[4]!==a||t[5]!==n?(w=()=>{n&&(y(null),x(``),C(``),h(a?`checking`:`auth`))},T=[n,a],t[4]=a,t[5]=n,t[6]=w,t[7]=T):(w=t[6],T=t[7]),(0,J.useLayoutEffect)(w,T);let E;t[8]!==a||t[9]!==n||t[10]!==p?(E=()=>{if(!n||!a)return;let e=!1,t=t=>{e||(e=!0,h(t))},r=setTimeout(()=>t(`auth`),nn);return p.status().then(n=>{e||(n.authenticated?(y({login:n.login,name:n.name,email:n.email}),x(n.name??``),C(n.email??``),t(`identity`)):t(`auth`))}).catch(()=>{t(`auth`)}),()=>{e=!0,clearTimeout(r)}},t[8]=a,t[9]=n,t[10]=p,t[11]=E):E=t[11];let D;t[12]!==a||t[13]!==n?(D=[n,a],t[12]=a,t[13]=n,t[14]=D):D=t[14],(0,J.useEffect)(E,D);let O;t[15]!==l||t[16]!==a||t[17]!==r||t[18]!==i?(O=function(e){if(y(e),a)x(e.name??``),C(e.email??``),h(`identity`);else{h(`done`),i?.(e),r(!1);let t=e.login;pe.success(l({id:`E_tNGD`,values:{login:t}}))}},t[15]=l,t[16]=a,t[17]=r,t[18]=i,t[19]=O):O=t[19];let k=O,A;t[20]!==l||t[21]!==g||t[22]!==r||t[23]!==i?(A=function(e,t){fetch(`/api/local-op/auth/set-identity`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:e,email:t})}).catch(an);let n={...g??{login:``},name:e,email:t};h(`done`),i?.(n),r(!1);let a=n.login;pe.success(l({id:`E_tNGD`,values:{login:a}}))},t[20]=l,t[21]=g,t[22]=r,t[23]=i,t[24]=A):A=t[24];let j=A,N;t[25]!==l||t[26]!==g||t[27]!==r||t[28]!==i?(N=function(){if(!g)return;h(`done`),i?.(g),r(!1);let e=g.login;pe.success(l({id:`E_tNGD`,values:{login:e}}))},t[25]=l,t[26]=g,t[27]=r,t[28]=i,t[29]=N):N=t[29];let P=N,F;t[30]===r?F=t[31]:(F=function(){r(!1)},t[30]=r,t[31]=F);let I=F,L;t[32]!==a||t[33]!==o||t[34]!==m?(L=(0,Y.jsx)(we,{children:(0,Y.jsx)(be,{children:o?(0,Y.jsx)(_,{id:`X8kjQX`}):a&&m!==`auth`?(0,Y.jsx)(_,{id:`29XZXN`}):(0,Y.jsx)(_,{id:`3jod3l`})})}),t[32]=a,t[33]=o,t[34]=m,t[35]=L):L=t[35];let R;t[36]===m?R=t[37]:(R=m===`checking`&&(0,Y.jsx)(Se,{children:(0,Y.jsx)(`div`,{className:`flex items-center justify-center py-6 text-sm text-muted-foreground`,children:(0,Y.jsx)(_,{id:`gBbxn_`})})}),t[36]=m,t[37]=R);let z;t[38]!==k||t[39]!==I||t[40]!==d||t[41]!==m?(z=m===`auth`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Se,{children:(0,Y.jsx)(en,{onSuccess:k,transport:d})}),(0,Y.jsx)(Ce,{children:(0,Y.jsx)(M,{variant:`outline`,className:`font-mono uppercase`,onClick:I,children:(0,Y.jsx)(_,{id:`dEgA5A`})})})]}),t[38]=k,t[39]=I,t[40]=d,t[41]=m,t[42]=z):z=t[42];let B;t[43]!==g||t[44]!==j||t[45]!==P||t[46]!==S||t[47]!==b||t[48]!==m?(B=m===`identity`&&g&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Se,{children:(0,Y.jsx)(tn,{login:g.login,name:b,onNameChange:x,email:S,onEmailChange:C})}),(0,Y.jsxs)(Ce,{children:[(0,Y.jsx)(M,{variant:`ghost`,onClick:P,children:(0,Y.jsx)(_,{id:`6Uau97`})}),(0,Y.jsx)(M,{onClick:()=>j(b.trim(),S.trim()),disabled:!b.trim()||!S.trim(),children:(0,Y.jsx)(_,{id:`tfDRzk`})})]})]}),t[43]=g,t[44]=j,t[45]=P,t[46]=S,t[47]=b,t[48]=m,t[49]=B):B=t[49];let V;t[50]!==L||t[51]!==R||t[52]!==z||t[53]!==B?(V=(0,Y.jsxs)(xe,{className:`sm:max-w-md`,children:[L,R,z,B]}),t[50]=L,t[51]=R,t[52]=z,t[53]=B,t[54]=V):V=t[54];let H;return t[55]!==r||t[56]!==n||t[57]!==V?(H=(0,Y.jsx)(Te,{open:n,onOpenChange:r,children:V}),t[55]=r,t[56]=n,t[57]=V,t[58]=H):H=t[58],H}function an(){}function on(e){let t=(0,X.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=A(`animate-pulse rounded-md bg-muted`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(`div`,{"data-slot":`skeleton`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function sn(e){let t=(0,X.c)(16),{value:n,onChange:r,disabled:i,placeholder:a,rows:o}=e,s=i===void 0?!1:i,c=o===void 0?12:o,l=(0,J.useId)(),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Y.jsx)(_,{id:`3o3tur`}),t[0]=u):u=t[0];let d;t[1]===l?d=t[2]:(d=(0,Y.jsx)(bt,{htmlFor:l,children:u}),t[1]=l,t[2]=d);let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Y.jsx)(St,{children:(0,Y.jsx)(_,{id:`5gr_ev`,values:{dateToken:`{{date}}`,userToken:`{{user}}`},components:{0:(0,Y.jsx)(`code`,{className:`font-mono`}),1:(0,Y.jsx)(`code`,{className:`font-mono`})}})}),t[3]=f):f=t[3];let p;t[4]===r?p=t[5]:(p=e=>r(e.target.value),t[4]=r,t[5]=p);let m;t[6]!==s||t[7]!==l||t[8]!==a||t[9]!==c||t[10]!==p||t[11]!==n?(m=(0,Y.jsx)(Ge,{id:l,value:n,onChange:p,disabled:s,rows:c,spellCheck:!1,placeholder:a,className:`font-mono text-xs leading-relaxed min-h-72`}),t[6]=s,t[7]=l,t[8]=a,t[9]=c,t[10]=p,t[11]=n,t[12]=m):m=t[12];let h;return t[13]!==d||t[14]!==m?(h=(0,Y.jsxs)(vt,{children:[d,f,m]}),t[13]=d,t[14]=m,t[15]=h):h=t[15],h}var cn=/^[A-Za-z0-9_-]+$/;function ln(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function un(e){let t={},n=e.title.trim();n&&(t.title=n);let r=e.description.trim();return r&&(t.description=r),t}var dn=0;function fn(){return dn+=1,`prop-${dn}`}function pn(e){let{frontmatter:t,body:n}=y(e);if(t===``)return{type:``,properties:[],markdown:e};let r=[];for(let e of x(t).split(`
|
|
4
4
|
`)){if(e.trim()===``)continue;let t=e.indexOf(`:`);if((/^\s/.test(e)||t===-1)&&r.length>0){let t=r[r.length-1];t&&(t.value+=`\n${e}`);continue}t!==-1&&r.push({key:e.slice(0,t).trim(),value:e.slice(t+1).replace(/^ /,``)})}let i=``,a=[];for(let e of r){if(e.key===`type`&&i===``){i=e.value.trim();continue}a.push({id:fn(),key:e.key,value:e.value})}return{type:i,properties:a,markdown:n}}function mn(e){let t=[],n=e.type.trim();n&&t.push(`type: ${n}`);for(let n of e.properties){let e=n.key.trim();e===``||e===`type`||t.push(n.value===``?`${e}:`:`${e}: ${n.value}`)}if(t.length===0)return e.markdown.replace(/^\n+/,``);let r=e.markdown.startsWith(`
|