@inkeep/open-knowledge 0.58.0-beta.7 → 0.58.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/dist/{acp-harness-probe-Dc4QtyQO.mjs → acp-harness-probe-dZsvbgrC.mjs} +2 -2
  2. package/dist/cli.mjs +6 -6
  3. package/dist/config-schema.json +1 -1
  4. package/dist/config.project.schema.json +1 -1
  5. package/dist/constants-CzhGjsFo.mjs +2 -0
  6. package/dist/fs-traced-corg4Obj.mjs +1 -0
  7. package/dist/{fs-traced-xJfl5Rxd.mjs → fs-traced-oq2wG9J_.mjs} +2 -2
  8. package/dist/{git-handle-3stJTucC.mjs → git-handle-2o4Vxedu.mjs} +2 -2
  9. package/dist/git-handle-DEjt_7O0.mjs +1 -0
  10. package/dist/index.mjs +2 -2
  11. package/dist/init-Ct7mqKVm.mjs +1 -0
  12. package/dist/{init-CpcterGz.mjs → init-DasMrTCg.mjs} +3 -3
  13. package/dist/{launch-json-removal-Ci74hesJ.mjs → launch-json-removal-BCc3Wt5o.mjs} +2 -2
  14. package/dist/loader-C6UUw0ZZ.mjs +1 -0
  15. package/dist/{loader-D0BmknIi.mjs → loader-CFnKYZR2.mjs} +2 -2
  16. package/dist/md-manager-FXuCv5zc.mjs +2 -0
  17. package/dist/{open-browser-Cqyn_9Z_.mjs → open-browser-CMs-r6aL.mjs} +2 -2
  18. package/dist/parse-worker.mjs +1 -1
  19. package/dist/preview-D9SZkYr5.mjs +1 -0
  20. package/dist/{preview-BrV2S7Xj.mjs → preview-Dv9l315C.mjs} +2 -2
  21. package/dist/public/assets/{ActivityModeContent-B0Fp59Qv.js → ActivityModeContent-DB3zhNIv.js} +1 -1
  22. package/dist/public/assets/{AgentDiffPane-BbIuRvv1.js → AgentDiffPane-BuZT0CFj.js} +1 -1
  23. package/dist/public/assets/{AgentIconCluster-B26uigRz.js → AgentIconCluster-D_inolLQ.js} +1 -1
  24. package/dist/public/assets/{AgentThreadClientBinder-M_2EBFIT.js → AgentThreadClientBinder-Db3J-HNk.js} +1 -1
  25. package/dist/public/assets/{CodeMirrorPropInput-BIdbAIO5.js → CodeMirrorPropInput-B3PfIk_d.js} +1 -1
  26. package/dist/public/assets/{DocumentContext-DC_8e-cY.js → DocumentContext-BNs9Wc7G.js} +1 -1
  27. package/dist/public/assets/{EditorModeToggle-CAig-JLx.js → EditorModeToggle-SBfl-yYh.js} +1 -1
  28. package/dist/public/assets/{EnableSyncConfirmDialog-CfR-i3bq.js → EnableSyncConfirmDialog-BoBmQwEy.js} +1 -1
  29. package/dist/public/assets/FeedbackForm-Bwghznhy.js +1 -0
  30. package/dist/public/assets/{GraphPanel-DejDnC1E.js → GraphPanel-CEcqZRWw.js} +1 -1
  31. package/dist/public/assets/{ImportSkillDialog-CsbbMAso.js → ImportSkillDialog-C7EVNmz7.js} +1 -1
  32. package/dist/public/assets/{LintConfigEditor-CMwVctJo.js → LintConfigEditor-Bcr2QKP1.js} +1 -1
  33. package/dist/public/assets/ManagedArtifactProperties-B3ZJ9FFR.js +1 -0
  34. package/dist/public/assets/{ManagedArtifactProperties-BW4zT-vN.js → ManagedArtifactProperties-CZwQTU72.js} +1 -1
  35. package/dist/public/assets/{McpConsentDialogBody-GUHma1LV.js → McpConsentDialogBody-CRg_BChy.js} +1 -1
  36. package/dist/public/assets/{MermaidDocEditor-DmX2UpSP.js → MermaidDocEditor-Co4QYa48.js} +1 -1
  37. package/dist/public/assets/{OpenInAgentMenuItem-8Fp3GsHg.js → OpenInAgentMenuItem-C_aRPIjj.js} +1 -1
  38. package/dist/public/assets/{PropertyDisplayRow-WuuztauZ.js → PropertyDisplayRow-CrYGlgp7.js} +1 -1
  39. package/dist/public/assets/{ReportBugDialogBody-Ci98J5Bw.js → ReportBugDialogBody-CN1i_Y7g.js} +1 -1
  40. package/dist/public/assets/{SchemaConfigEditor-DuCTZiY-.js → SchemaConfigEditor-CntIIKsB.js} +1 -1
  41. package/dist/public/assets/{SessionsHost-BTd7O7Aa.js → SessionsHost-CdJc0MSK.js} +2 -2
  42. package/dist/public/assets/{SettingsDialogBody-CkI0KfUL.js → SettingsDialogBody-8GHLppL4.js} +1 -1
  43. package/dist/public/assets/{ShareBranchSwitchDialog-CpToxQMt.js → ShareBranchSwitchDialog-K6rF_BB-.js} +1 -1
  44. package/dist/public/assets/{ShareReceiveDialog-LOwGCI-g.js → ShareReceiveDialog-D2tJPvcw.js} +1 -1
  45. package/dist/public/assets/{ShareReceiveMissDialog-CiPRwQlY.js → ShareReceiveMissDialog-PifhU4tt.js} +1 -1
  46. package/dist/public/assets/{SkillCostValue-D_6C2Gog.js → SkillCostValue-C0tQ5Ey6.js} +1 -1
  47. package/dist/public/assets/{SkillDestinationList-DpCf7aFO.js → SkillDestinationList-DYjzv8JN.js} +1 -1
  48. package/dist/public/assets/{SkillEditBanner-COUIEuU_.js → SkillEditBanner-DUbh82i0.js} +1 -1
  49. package/dist/public/assets/{SkillInstallMenu-y2A7W0zZ.js → SkillInstallMenu-aKaOX_rG.js} +1 -1
  50. package/dist/public/assets/{SkillOriginInline-Dy9lf16Q.js → SkillOriginInline-Dcw5U9Gu.js} +1 -1
  51. package/dist/public/assets/{SkillToolbarControls-BsmREi0B.js → SkillToolbarControls-CZNGVa1t.js} +1 -1
  52. package/dist/public/assets/{SlidesToolbarControls-DNkQ5Ng_.js → SlidesToolbarControls-Cf1lF5oY.js} +1 -1
  53. package/dist/public/assets/{SourceEditor-CVACSHpy.js → SourceEditor-DrIQgn17.js} +1 -1
  54. package/dist/public/assets/{TerminalPanel-BW1Psxow.js → TerminalPanel-C61cGKq0.js} +1 -1
  55. package/dist/public/assets/{TerminalWindowApp-DX6H7O5q.js → TerminalWindowApp-Zyc8LXKG.js} +1 -1
  56. package/dist/public/assets/{TextDocEditor-ywHStFmo.js → TextDocEditor-Dhfis_S6.js} +1 -1
  57. package/dist/public/assets/{ThreadView-CoW0wzMZ.js → ThreadView-BZYcGOYJ.js} +1 -1
  58. package/dist/public/assets/{TimelineDiffPane-3beAKThM.js → TimelineDiffPane-BBmd35R9.js} +1 -1
  59. package/dist/public/assets/{auth-state-cache-BBp_stem.js → auth-state-cache-CWPxRafc.js} +1 -1
  60. package/dist/public/assets/{client-version-DvabycW5.js → client-version-BsMRrwFS.js} +1 -1
  61. package/dist/public/assets/{comment-chips-Bfc8H6sv.js → comment-chips-DdMmWihZ.js} +1 -1
  62. package/dist/public/assets/{config-provider-Wm9R6Y25.js → config-provider-DkOV03RH.js} +1 -1
  63. package/dist/public/assets/{dist-Dih2A8fV.js → dist-CP7w45uR.js} +1 -1
  64. package/dist/public/assets/{doc-paths-DqJ_A_s7.js → doc-paths-CX0c2GkE.js} +1 -1
  65. package/dist/public/assets/{documents-events-Ck8o2CoI.js → documents-events-DGovPb4Q.js} +1 -1
  66. package/dist/public/assets/{file-tree-adapter-BiHRDCv3.js → file-tree-adapter-CNrTrjb9.js} +1 -1
  67. package/dist/public/assets/{file-tree-utils-CEFaTYgx.js → file-tree-utils-Ceep4GK6.js} +1 -1
  68. package/dist/public/assets/{folder-config-api-CRLsP3aa.js → folder-config-api-BavUQIxi.js} +1 -1
  69. package/dist/public/assets/{follow-file-BpuglSLQ.js → follow-file-BDoShwy7.js} +1 -1
  70. package/dist/public/assets/i18n-fvzGnIHb.js +1 -0
  71. package/dist/public/assets/{index-B1a_Nq9z.js → index-Br-j853R.js} +7 -7
  72. package/dist/public/assets/{lint-config-client-Bpxmt15J.js → lint-config-client-BXCLXBm0.js} +1 -1
  73. package/dist/public/assets/{markdownlint-rule-browser-B9wBZNA_.js → markdownlint-rule-browser-CjQ1_sCE.js} +1 -1
  74. package/dist/public/assets/{navigation-targets-Qu3klKbE.js → navigation-targets-B9ZSMArq.js} +1 -1
  75. package/dist/public/assets/{open-managed-artifact-tab-KzE_hPhn.js → open-managed-artifact-tab-FyNAk92K.js} +1 -1
  76. package/dist/public/assets/{pending-receive-nav-store-BaSwjYK0.js → pending-receive-nav-store-DR3ooVas.js} +1 -1
  77. package/dist/public/assets/{prop-types-C0jlhgSv.js → prop-types-BWoV6rdx.js} +1 -1
  78. package/dist/public/assets/{receive-store-CcixohWp.js → receive-store-sP45Lmaj.js} +1 -1
  79. package/dist/public/assets/{selection-context-DaLbLtKV.js → selection-context-jZhBCQUz.js} +1 -1
  80. package/dist/public/assets/{skill-actions-BG-1EQmx.js → skill-actions-BAWcLPFa.js} +1 -1
  81. package/dist/public/assets/{skill-scope-BmcRzXKj.js → skill-scope-C3ZLyDFU.js} +1 -1
  82. package/dist/public/assets/{skills-api-DYLAW1HV.js → skills-api-DkJBCb26.js} +1 -1
  83. package/dist/public/assets/{src-_CcgHCm_.js → src-DXY6B71v.js} +1 -1
  84. package/dist/public/assets/{tag-pill-input-BjL8aMcQ.js → tag-pill-input-obzr2Bmc.js} +1 -1
  85. package/dist/public/assets/{target-navigation-intent-1FaM1MO8.js → target-navigation-intent-IjRnfQQ9.js} +1 -1
  86. package/dist/public/assets/{terminal-cli-display-CyCGNg1t.js → terminal-cli-display-fzswbBoR.js} +1 -1
  87. package/dist/public/assets/{terminal-launch-events-B92DmpSo.js → terminal-launch-events-BZw6Kevo.js} +1 -1
  88. package/dist/public/assets/{terminal-telemetry-CPOwGHJS.js → terminal-telemetry-BTfW00Ir.js} +1 -1
  89. package/dist/public/assets/{typing-burst-detector-BySvqCzC.js → typing-burst-detector-adEL1lyg.js} +1 -1
  90. package/dist/public/assets/{uninstall-DgUSAKgm.js → uninstall-DJb5IlCU.js} +1 -1
  91. package/dist/public/assets/{use-activity-panel-o4JQhNM3.js → use-activity-panel-bJnzXq1_.js} +1 -1
  92. package/dist/public/assets/{use-apply-config-color-theme-DonBpBNY.js → use-apply-config-color-theme-hdarUMLl.js} +1 -1
  93. package/dist/public/assets/{use-collab-url-D_1xfAyN.js → use-collab-url-BSs7OT15.js} +1 -1
  94. package/dist/public/assets/{use-live-xterm-theme-Bq43Ad6a.js → use-live-xterm-theme-BQNkHYLe.js} +1 -1
  95. package/dist/public/assets/{use-open-skill-CR8e9H_i.js → use-open-skill-B2CpqHwW.js} +1 -1
  96. package/dist/public/assets/{use-popular-skills-BySTLo8O.js → use-popular-skills-DSYrjkIc.js} +1 -1
  97. package/dist/public/assets/{use-settings-route-QaV_yXgj.js → use-settings-route-CAQ6W9p6.js} +1 -1
  98. package/dist/public/assets/{use-skill-origin-BwJcy3-O.js → use-skill-origin-DbGsYAIW.js} +1 -1
  99. package/dist/public/assets/{use-skills-2obCzXwU.js → use-skills-BrC3Upu3.js} +1 -1
  100. package/dist/public/assets/{use-terminal-enabled-CfeUtq4N.js → use-terminal-enabled-B-_ScHv6.js} +1 -1
  101. package/dist/public/assets/{use-timeline-entry-diff-W_B-6UDh.js → use-timeline-entry-diff-EyIHz_x3.js} +1 -1
  102. package/dist/public/assets/{use-workspace-D9PQP2Ka.js → use-workspace-CFSG46RY.js} +1 -1
  103. package/dist/public/index.html +47 -47
  104. package/dist/public/uninstall.html +3 -3
  105. package/dist/{repair-launch-json-PUVNVFKs.mjs → repair-launch-json-BU_wTHU6.mjs} +2 -2
  106. package/dist/{repair-mcp-configs-BOQLD8vy.mjs → repair-mcp-configs-DLGnB9SW.mjs} +2 -2
  107. package/dist/repair-skills-6kXbAVAI.mjs +1 -0
  108. package/dist/{repair-skills-D2MDLtIb.mjs → repair-skills-B2XZB3Rs.mjs} +2 -2
  109. package/dist/schemas/v0/config.project.schema.json +1 -1
  110. package/dist/{server-lock-DyY8nPTr.mjs → server-lock-CucURT_N.mjs} +2 -2
  111. package/dist/server-lock-Tb9AMsy7.mjs +1 -0
  112. package/dist/{skill-teardown-u_V1IN7V.mjs → skill-teardown-C2iNSWvT.mjs} +2 -2
  113. package/dist/{sleep-D_nNc7T_.mjs → sleep-BU8QtSQy.mjs} +2 -2
  114. package/dist/src-Bf5oIrhA.mjs +1 -0
  115. package/dist/{src-ubDzLrbn.mjs → src-BjPajWAS.mjs} +2 -2
  116. package/dist/{src-oJpaRu7w.mjs → src-C1pxKPYT.mjs} +2 -2
  117. package/dist/{src-D88J_dwf.mjs → src-CXbUZB_b.mjs} +1 -1
  118. package/dist/{src-CyDF8_Em.mjs → src-pjKDNsjY.mjs} +435 -435
  119. package/dist/start-C62GgsB9.mjs +1 -0
  120. package/dist/{start-Dcjq6fwo.mjs → start-rya2hbae.mjs} +4 -4
  121. package/dist/{ui-CTuTY_Ny.mjs → ui-UQBOE6mj.mjs} +3 -3
  122. package/dist/{write-project-skill-CqrttBia.mjs → write-project-skill-7xCQZ9iq.mjs} +2 -2
  123. package/package.json +4 -4
  124. package/dist/constants-c1VuifcA.mjs +0 -2
  125. package/dist/fs-traced-BEuPZxxL.mjs +0 -1
  126. package/dist/git-handle-B0ZVs8y7.mjs +0 -1
  127. package/dist/init-DV09g6ez.mjs +0 -1
  128. package/dist/loader-Cl4ixwGJ.mjs +0 -1
  129. package/dist/md-manager-Dz3nKJbO.mjs +0 -2
  130. package/dist/preview-CbWq8-zC.mjs +0 -1
  131. package/dist/public/assets/FeedbackForm-CxomQJwt.js +0 -1
  132. package/dist/public/assets/ManagedArtifactProperties-Bph9HlOT.js +0 -1
  133. package/dist/public/assets/i18n-BbGgvVoN.js +0 -1
  134. package/dist/repair-skills-BUtcN0G7.mjs +0 -1
  135. package/dist/server-lock-Bii6_-R-.mjs +0 -1
  136. package/dist/src-CClot_u_.mjs +0 -1
  137. package/dist/start-C0IEJ4Mw.mjs +0 -1
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-CA0dewJJ.js";import{a as ee,c as te,i as ne,n as re,o as ie,s as ae,t as oe}from"./dialog-nnyEatfT.js";import{n as s}from"./dist-CMZSEMCN2.js";import{t as c}from"./desktop-bridge-types-BeY3wQCX.js";import{n as l,t as se}from"./git-branch-B39aVIqr.js";import{t as u}from"./spinner-CbcfYaH_.js";import{n as ce,t as d}from"./miss-dialog-store-Bg_8lUxq.js";import{r as f,t as p}from"./auth-prompt-store-BVCOOr4Z.js";import{a as m,n as h}from"./receive-store-CcixohWp.js";import{t as le}from"./share-metadata-rows-DgBPt0dQ.js";var g=e(n(),1),ue=a();function de(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 fe(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function _(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 pe={phase:`loading`};function me(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function he(e,t){return e.phase!==`ready`&&e.phase!==`verdict`?e:{phase:`switching`,info:e.info,pendingDoc:t}}function ge(e){return e.phase===`ready`?{phase:`creating-worktree`,info:e.info}:e}function _e(e){return de(e).kind===`B`&&e.shareTargetOnOriginBranch===!1}function ve(e){return e.phase===`ready`?{phase:`verdict-pending`,info:e.info}:e}function ye(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 be(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=_(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}}}function xe(e,t){return e.phase===`creating-worktree`?t===null?{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}}:t.ok?{state:{phase:`opening-worktree`,path:t.path}}:t.reason===`branch-not-found`?{state:{phase:`dismissed`,reason:`branch-not-found`},sideEffect:{kind:`toast`,reason:`branch-not-found`}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:t.reason,helper:t.helper,authFailed:t.reason===`fetch-failed`?t.authFailed:void 0}}:{state:e}}var v=t();function Se(e){return c(e.repositoryTarget)}function Ce(e,t=c(e.target)){let n=e.contentRootDepth===null?t:[...Se(e).split(`/`).slice(0,e.contentRootDepth),...t===``?[]:t.split(`/`)].join(`/`);return{kind:e.target.kind,path:t,repositoryPath:n,...e.contentRootDepth===null?{}:{contentRootDepth:e.contentRootDepth}}}function we(e){return e!==null&&e.kind===`project-branch-switch`}function y(e){let t=(0,ue.c)(217),{bridge:n,store:a}=e,p=a===void 0?h:a,{_}=i(),y=(0,g.useSyncExternalStore)(p.subscribe,p.getSnapshot,Me),[b,x]=(0,g.useState)(pe),Ne=(0,g.useRef)(!1),Pe=(0,g.useRef)(!1),Fe=(0,g.useRef)(!1),Ie=(0,g.useRef)(null),Le;t[0]===y?Le=t[1]:(Le=we(y)?y:null,t[0]=y,t[1]=Le);let S=Le,Re;t[2]!==_||t[3]!==S?.share.target.kind?(Re=S?.share.target.kind===`folder`?_({id:`ugoTXs`}):_({id:`XH30C4`}),t[2]=_,t[3]=S?.share.target.kind,t[4]=Re):Re=t[4];let C=Re,ze;t[5]===S?ze=t[6]:(ze=()=>{x(pe),Ne.current=!1,Pe.current=!1,Fe.current=!1,Ie.current=S},t[5]=S,t[6]=ze);let Be;t[7]===y?Be=t[8]:(Be=[y],t[7]=y,t[8]=Be),(0,g.useEffect)(ze,Be);let Ve;t[9]!==S||t[10]!==n?(Ve=()=>{if(!S||Ne.current)return;Ne.current=!0;let e=!1;return n.project.fetchBranchInfo({projectPath:S.projectPath,branch:S.share.branch,kind:S.share.repositoryTarget.kind,path:Se(S.share)}).then(t=>{e||x(e=>me(e,t))}).catch(t=>{e||(console.warn(`[receive] branch-info-fetch-failed`,t instanceof Error?t.message:t),x(je))}),()=>{e=!0}},t[9]=S,t[10]=n,t[11]=Ve):Ve=t[11];let He;t[12]===S?He=t[13]:(He=[S],t[12]=S,t[13]=He),(0,g.useEffect)(Ve,He);let Ue;t[14]!==S||t[15]!==b.info||t[16]!==b.phase||t[17]!==n?(Ue=()=>{if(!S||b.phase!==`ready`||Fe.current||!_e(b.info))return;Fe.current=!0,x(ve);let e=S;n.project.fetchTargetStatus({projectPath:S.projectPath,branch:S.share.branch,kind:S.share.target.kind,path:Se(S.share),...S.share.contentRootDepth===null?{}:{contentRootDepth:S.share.contentRootDepth}}).then(t=>{Ie.current===e&&x(e=>ye(e,t))}).catch(t=>{Ie.current===e&&(console.warn(`[receive] target-status-fetch-failed`,t instanceof Error?t.message:t),x(Ae))})},t[14]=S,t[15]=b.info,t[16]=b.phase,t[17]=n,t[18]=Ue):Ue=t[18];let We;t[19]!==S||t[20]!==b.phase?(We=[b.phase,S],t[19]=S,t[20]=b.phase,t[21]=We):We=t[21],(0,g.useEffect)(Ue,We);let Ge;t[22]!==S||t[23]!==b.phase||t[24]!==b.resolution||t[25]!==p?(Ge=()=>{if(b.phase!==`verdict`)return;let{kind:e}=b.resolution;e!==`deleted`&&e!==`never-on-branch`||S&&(d.arm({kind:S.share.target.kind,path:c(S.share.target),repositoryPath:Se(S.share),...S.share.contentRootDepth===null?{}:{contentRootDepth:S.share.contentRootDepth},branch:S.share.branch}),p.dismiss())},t[22]=S,t[23]=b.phase,t[24]=b.resolution,t[25]=p,t[26]=Ge):Ge=t[26];let Ke;t[27]!==S||t[28]!==b||t[29]!==p?(Ke=[b,S,p],t[27]=S,t[28]=b,t[29]=p,t[30]=Ke):Ke=t[30],(0,g.useEffect)(Ge,Ke);let qe;t[31]!==b.phase||t[32]!==b.resolution?(qe=()=>{b.phase===`verdict`&&console.log(m({verdict_cell:b.resolution.kind}))},t[31]=b.phase,t[32]=b.resolution,t[33]=qe):qe=t[33];let Je;t[34]===b?Je=t[35]:(Je=[b],t[34]=b,t[35]=Je),(0,g.useEffect)(qe,Je);let Ye;t[36]!==_||t[37]!==S||t[38]!==b.pendingDoc||t[39]!==b.phase||t[40]!==n||t[41]!==p||t[42]!==C?(Ye=()=>{if(b.phase!==`awaiting-cc1-recycle`||!S)return;let e=S.share.branch,t=b.pendingDoc;if(!e){p.dismiss();return}if(Pe.current)return;Pe.current=!0;let r=!1;return n.project.awaitBranchSwitched({projectPath:S.projectPath,branch:e,timeoutMs:3e4}).then(i=>{if(!r){if(i.ok){console.log(m({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:S.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Ce(S.share,t),pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),s.error(_({id:`gQV-9w`,values:{targetNoun:C}}))}),p.dismiss();return}console.log(m({branch_dialog_action:`branch-switch-timeout`,branch:e})),s.error(_({id:`LBwUR6`,values:{targetNoun:C}})),p.dismiss()}}).catch(e=>{r||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),s.error(_({id:`Jw6EC4`,values:{targetNoun:C}})),p.dismiss())}),()=>{r=!0}},t[36]=_,t[37]=S,t[38]=b.pendingDoc,t[39]=b.phase,t[40]=n,t[41]=p,t[42]=C,t[43]=Ye):Ye=t[43];let Xe;if(t[44]!==S||t[45]!==b.phase?(Xe=[b.phase,S],t[44]=S,t[45]=b.phase,t[46]=Xe):Xe=t[46],(0,g.useEffect)(Ye,Xe),!S)return null;let{share:w,projectPath:T,currentBranch:Ze}=S,E=w.branch,Qe;t[47]!==_||t[48]!==n.project||t[49]!==T||t[50]!==E||t[51]!==p?(Qe=function(e,t,r){console.log(m({branch_dialog_action:`switch`,branch_action:`switch`,branch:E,verdict_cell:r})),x(t=>he(t,e)),n.project.runCheckout(t?{projectPath:T,branch:E,fastForward:!0}:{projectPath:T,branch:E}).then(e=>{let t=null,n=!1;x(r=>{let{state:i,sideEffect:a}=be(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?s.error(_({id:`NJyQi_`,values:{shareBranch:E}})):t===`fetch-failed`?s.error(_({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&s.error(_({id:`c863eW`,values:{shareBranch:E}})),n&&p.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),x(ke),s.error(_({id:`c863eW`,values:{shareBranch:E}}))})},t[47]=_,t[48]=n.project,t[49]=T,t[50]=E,t[51]=p,t[52]=Qe):Qe=t[52];let D=Qe,$e;t[53]!==b.info||t[54]!==b.phase||t[55]!==D||t[56]!==w.target?($e=function(){b.phase===`ready`&&de(b.info).switchEnabled&&D(c(w.target),!1)},t[53]=b.info,t[54]=b.phase,t[55]=D,t[56]=w.target,t[57]=$e):$e=t[57];let et=$e,tt;t[58]!==b.phase||t[59]!==b.resolution||t[60]!==D||t[61]!==w.target?(tt=function(){b.phase===`verdict`&&D(c(w.target),!0,b.resolution.kind)},t[58]=b.phase,t[59]=b.resolution,t[60]=D,t[61]=w.target,t[62]=tt):tt=t[62];let nt=tt,rt;t[63]!==b.phase||t[64]!==b.resolution||t[65]!==D?(rt=function(){b.phase===`verdict`&&b.resolution.kind===`renamed`&&D(b.resolution.renamedTo,!0,b.resolution.kind)},t[63]=b.phase,t[64]=b.resolution,t[65]=D,t[66]=rt):rt=t[66];let it=rt,at;t[67]!==b.phase||t[68]!==b.resolution||t[69]!==D||t[70]!==w.target?(at=function(){b.phase===`verdict`&&D(c(w.target),!1,b.resolution.kind)},t[67]=b.phase,t[68]=b.resolution,t[69]=D,t[70]=w.target,t[71]=at):at=t[71];let ot=at,st;t[72]!==_||t[73]!==n.project||t[74]!==T||t[75]!==w||t[76]!==E||t[77]!==p||t[78]!==C?(st=function(){console.log(m({branch_dialog_action:`open-current`,branch:E})),n.project.open({path:T,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Ce(w)}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),s.error(_({id:`b5aNbi`,values:{targetNoun:C}}))}),p.dismiss()},t[72]=_,t[73]=n.project,t[74]=T,t[75]=w,t[76]=E,t[77]=p,t[78]=C,t[79]=st):st=t[79];let ct=st,lt;t[80]!==_||t[81]!==E?(lt=function(e,t,n){if(e===`fetch-failed`&&n){s.error(_({id:`gfb-CM`}),{action:{label:_({id:`5lWFkC`}),onClick:Oe}});return}switch(e){case`helper-not-found`:{let e=t??_({id:`cHhH3i`});s.error(_({id:`Z7x_Zh`,values:{tool:e}}));return}case`branch-not-found`:s.error(_({id:`NJyQi_`,values:{shareBranch:E}}));return;case`fetch-failed`:s.error(_({id:`bWLmRK`}));return;case`already-checked-out`:s.error(_({id:`ljHjfg`}));return;case`branch-exists`:s.error(_({id:`h3QZcB`,values:{shareBranch:E}}));return;case`path-exists`:s.error(_({id:`cN1Gcp`,values:{shareBranch:E}}));return;case`no-git`:s.error(_({id:`CFnavk`}));return;case`empty-repo`:s.error(_({id:`5IgYAM`}));return;case`invalid-branch`:s.error(_({id:`JfPuv7`,values:{shareBranch:E}}));return;case`proxy-null`:case`error`:s.error(_({id:`e8zYa8`,values:{shareBranch:E}}));return;default:throw Error(`Unhandled worktree failure reason: ${String(e)}`)}},t[80]=_,t[81]=E,t[82]=lt):lt=t[82];let ut=lt,dt;t[83]!==_||t[84]!==n.project||t[85]!==w||t[86]!==E||t[87]!==ut||t[88]!==p?(dt=function(e){let t=null,r,i,a=!1,o=null;if(x(n=>{let{state:ee,sideEffect:te}=xe(n,e);return te&&(t=te.reason,r=te.helper,i=te.authFailed,a=ee.phase===`dismissed`),ee.phase===`opening-worktree`&&(o=ee.path),ee}),t!==null&&(console.log(m({branch_dialog_action:`open-worktree-failed:${t}`,branch:E})),ut(t,r,i)),o!==null){f();let e=o;n.project.open({path:e,target:`new-window`,entryPoint:`worktree`,pendingDeepLinkTarget:Ce(w),pendingBranch:E}).catch(t=>{console.warn(`[receive] worktree-open-failed branch_dialog_action=open-worktree`,t instanceof Error?t.message:t),s.error(_({id:`LdABLa`,values:{target:e}}))}),p.dismiss()}a&&p.dismiss()},t[83]=_,t[84]=n.project,t[85]=w,t[86]=E,t[87]=ut,t[88]=p,t[89]=dt):dt=t[89];let ft=dt,pt;t[90]!==ft||t[91]!==b.phase||t[92]!==n.worktree||t[93]!==E?(pt=function(){b.phase===`ready`&&(console.log(m({branch_dialog_action:`open-worktree`,branch:E})),x(ge),n.worktree.checkout({branch:E}).then(e=>{ft(e)}).catch(e=>{console.warn(`[receive] worktree-checkout rejected branch_dialog_action=open-worktree`,e instanceof Error?e.message:e),ft(null)}))},t[90]=ft,t[91]=b.phase,t[92]=n.worktree,t[93]=E,t[94]=pt):pt=t[94];let mt=pt,ht;t[95]!==_||t[96]!==b.otherWorktreePath||t[97]!==b.phase||t[98]!==n.project||t[99]!==w||t[100]!==E||t[101]!==p?(ht=function(){if(b.phase!==`branch-in-other-worktree`)return;let e=b.otherWorktreePath;console.log(m({branch_dialog_action:`pivot-to-other-worktree`,branch:E})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Ce(w),pendingBranch:E}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),s.error(_({id:`LdABLa`,values:{target:e}}))}),p.dismiss()},t[95]=_,t[96]=b.otherWorktreePath,t[97]=b.phase,t[98]=n.project,t[99]=w,t[100]=E,t[101]=p,t[102]=ht):ht=t[102];let gt=ht,_t;t[103]!==b.phase||t[104]!==b.resolution||t[105]!==p?(_t=function(){console.log(m({branch_dialog_action:`cancel`,verdict_cell:b.phase===`verdict`?b.resolution.kind:void 0})),p.dismiss()},t[103]=b.phase,t[104]=b.resolution,t[105]=p,t[106]=_t):_t=t[106];let O=_t,k,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K,q;if(t[107]!==_||t[108]!==b.info||t[109]!==b.otherWorktreePath||t[110]!==b.phase||t[111]!==b.resolution||t[112]!==O||t[113]!==Ze||t[114]!==w.branch||t[115]!==w.owner||t[116]!==w.repo||t[117]!==w.target||t[118]!==E||t[119]!==C){K=b.phase===`ready`||b.phase===`switching`||b.phase===`creating-worktree`?de(b.info):null;let e;t[139]!==b.info||t[140]!==b.phase||t[141]!==Ze?(e=b.phase===`ready`||b.phase===`switching`||b.phase===`creating-worktree`?fe(b.info):Ze??`HEAD`,t[139]=b.info,t[140]=b.phase,t[141]=Ze,t[142]=e):e=t[142];let n=e;F=b.phase===`switching`||b.phase===`awaiting-cc1-recycle`,M=b.phase===`creating-worktree`;let i;t[143]===_?i=t[144]:(i=_({id:`OuY8t9`}),t[143]=_,t[144]=i),N=i;let a;t[145]===_?a=t[146]:(a=_({id:`XZkdtg`}),t[145]=_,t[146]=a),P=a;let o;t[147]===_?o=t[148]:(o=_({id:`VTulZj`}),t[147]=_,t[148]=o),q=o;let ie=b.phase===`loading`,s=b.phase===`error`;j=oe,W=!0,t[149]===O?G=t[150]:(G=e=>{e||O()},t[149]=O,t[150]=G),A=ne,z=`sm:max-w-xl`,B=`share-branch-switch-dialog`,V=De,H=Ee;let l;t[151]===C?l=t[152]:(l=(0,v.jsx)(te,{children:(0,v.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:C}})}),t[151]=C,t[152]=l);let se=w.owner,ce=w.repo,d;t[153]===w.target?d=t[154]:(d=c(w.target),t[153]=w.target,t[154]=d);let f;t[155]!==w.owner||t[156]!==w.repo||t[157]!==d?(f=(0,v.jsx)(ee,{className:`sr-only`,children:(0,v.jsx)(r,{id:`f8jU-L`,values:{0:se,1:ce,2:d}})}),t[155]=w.owner,t[156]=w.repo,t[157]=d,t[158]=f):f=t[158],t[159]!==l||t[160]!==f?(U=(0,v.jsxs)(ae,{children:[l,f]}),t[159]=l,t[160]=f,t[161]=U):U=t[161],k=re;let p=w.owner,m=w.repo,h;t[162]===w.target?h=t[163]:(h=c(w.target),t[162]=w.target,t[163]=h),t[164]!==w.branch||t[165]!==w.owner||t[166]!==w.repo||t[167]!==w.target.kind||t[168]!==h?(I=(0,v.jsx)(`div`,{className:`mb-4`,children:(0,v.jsx)(le,{owner:p,repo:m,path:h,kind:w.target.kind,branch:w.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[164]=w.branch,t[165]=w.owner,t[166]=w.repo,t[167]=w.target.kind,t[168]=h,t[169]=I):I=t[169],L=b.phase===`branch-in-other-worktree`?(0,v.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,v.jsx)(`p`,{className:`leading-6`,children:(0,v.jsx)(r,{id:`yjExfe`,values:{shareBranch:E},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,v.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:b.otherWorktreePath})]}):b.phase===`verdict-pending`?(0,v.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,v.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`c8jBgX`})]}):b.phase===`verdict`?b.resolution.kind===`on-origin`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-on-origin`,children:(0,v.jsx)(r,{id:`Uay5NL`,values:{targetNoun:C,shareBranch:E},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):b.resolution.kind===`renamed`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-renamed`,children:(0,v.jsx)(r,{id:`P0HC30`,values:{0:b.resolution.renamedTo,targetNoun:C},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):b.resolution.kind===`diverged`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-diverged`,children:(0,v.jsx)(r,{id:`kLv8d3`,values:{shareBranch:E,targetNoun:C},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,v.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,v.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`c8jBgX`})]}):ie?(0,v.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,v.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`jerqF0`})]}):s?(0,v.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,v.jsx)(r,{id:`w4hMYl`})}):K?.kind===`D`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,v.jsx)(r,{id:`DTI-fp`,values:{targetNoun:C,shareBranch:E},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):K?.kind===`B`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,v.jsx)(r,{id:`sZ2IOu`,values:{targetNoun:C,shareBranch:E,currentLabel:n},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,v.jsx)(r,{id:`_902BE`,values:{targetNoun:C,shareBranch:E,currentLabel:n},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),R=K&&!K.switchEnabled&&K.conflictingFiles.length>0?(0,v.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,v.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,v.jsx)(r,{id:`n2lRue`})}),(0,v.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:K.conflictingFiles.map(Te)})]}):null,t[107]=_,t[108]=b.info,t[109]=b.otherWorktreePath,t[110]=b.phase,t[111]=b.resolution,t[112]=O,t[113]=Ze,t[114]=w.branch,t[115]=w.owner,t[116]=w.repo,t[117]=w.target,t[118]=E,t[119]=C,t[120]=k,t[121]=A,t[122]=j,t[123]=M,t[124]=N,t[125]=P,t[126]=F,t[127]=I,t[128]=L,t[129]=R,t[130]=z,t[131]=B,t[132]=V,t[133]=H,t[134]=U,t[135]=W,t[136]=G,t[137]=K,t[138]=q}else k=t[120],A=t[121],j=t[122],M=t[123],N=t[124],P=t[125],F=t[126],I=t[127],L=t[128],R=t[129],z=t[130],B=t[131],V=t[132],H=t[133],U=t[134],W=t[135],G=t[136],K=t[137],q=t[138];let J;t[170]===F?J=t[171]:(J=F?(0,v.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,v.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`CU3AiE`})]}):null,t[170]=F,t[171]=J);let Y;t[172]===M?Y=t[173]:(Y=M?(0,v.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-creating-worktree`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`PZtgO0`})]}):null,t[172]=M,t[173]=Y);let X;t[174]!==k||t[175]!==I||t[176]!==L||t[177]!==R||t[178]!==J||t[179]!==Y?(X=(0,v.jsxs)(k,{children:[I,L,R,J,Y]}),t[174]=k,t[175]=I,t[176]=L,t[177]=R,t[178]=J,t[179]=Y,t[180]=X):X=t[180];let vt;t[181]===Symbol.for(`react.memo_cache_sentinel`)?(vt=(0,v.jsx)(r,{id:`dEgA5A`}),t[181]=vt):vt=t[181];let Z;t[182]===O?Z=t[183]:(Z=(0,v.jsx)(o,{variant:`ghost`,className:`font-mono uppercase`,onClick:O,"data-testid":`share-branch-switch-cancel`,children:vt}),t[182]=O,t[183]=Z);let Q;t[184]!==b.phase||t[185]!==b.resolution||t[186]!==M||t[187]!==ct||t[188]!==it||t[189]!==mt||t[190]!==gt||t[191]!==ot||t[192]!==et||t[193]!==nt||t[194]!==N||t[195]!==P||t[196]!==F||t[197]!==K||t[198]!==q?(Q=b.phase===`branch-in-other-worktree`?(0,v.jsx)(o,{onClick:gt,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,v.jsx)(r,{id:`hyCxJY`})}):b.phase===`verdict`?b.resolution.kind===`on-origin`?(0,v.jsxs)(o,{onClick:nt,"data-testid":`share-branch-switch-verdict-switch-update`,children:[(0,v.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),(0,v.jsx)(r,{id:`uA_jXp`})]}):b.resolution.kind===`renamed`?(0,v.jsxs)(o,{onClick:it,"data-testid":`share-branch-switch-verdict-open-renamed`,children:[(0,v.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),(0,v.jsx)(r,{id:`AItsE5`})]}):b.resolution.kind===`diverged`?(0,v.jsxs)(o,{onClick:ot,"data-testid":`share-branch-switch-verdict-plain-switch`,children:[(0,v.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),P]}):null:(0,v.jsxs)(`div`,{className:`flex min-w-0 flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:justify-end sm:gap-2`,children:[K?.openCurrentEnabled?(0,v.jsxs)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:ct,disabled:F||M,"data-testid":`share-branch-switch-open-current`,children:[(0,v.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),N]}):null,(0,v.jsx)(o,{variant:`outline`,onClick:et,disabled:!K?.switchEnabled||F||M,"aria-disabled":!K?.switchEnabled||F||M,"aria-describedby":K&&!K.switchEnabled&&K.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:F?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(u,{className:`size-3.5`,"aria-hidden":`true`}),P]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),P]})}),(0,v.jsx)(o,{onClick:mt,disabled:!K||F||M,"data-testid":`share-branch-switch-worktree`,children:M?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(u,{className:`size-3.5`,"aria-hidden":`true`}),q]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),q]})})]}),t[184]=b.phase,t[185]=b.resolution,t[186]=M,t[187]=ct,t[188]=it,t[189]=mt,t[190]=gt,t[191]=ot,t[192]=et,t[193]=nt,t[194]=N,t[195]=P,t[196]=F,t[197]=K,t[198]=q,t[199]=Q):Q=t[199];let yt;t[200]!==Z||t[201]!==Q?(yt=(0,v.jsxs)(ie,{className:`sm:justify-between`,children:[Z,Q]}),t[200]=Z,t[201]=Q,t[202]=yt):yt=t[202];let $;t[203]!==A||t[204]!==z||t[205]!==B||t[206]!==V||t[207]!==H||t[208]!==U||t[209]!==X||t[210]!==yt?($=(0,v.jsxs)(A,{className:z,"data-testid":B,onInteractOutside:V,onPointerDownOutside:H,children:[U,X,yt]}),t[203]=A,t[204]=z,t[205]=B,t[206]=V,t[207]=H,t[208]=U,t[209]=X,t[210]=yt,t[211]=$):$=t[211];let bt;return t[212]!==j||t[213]!==W||t[214]!==G||t[215]!==$?(bt=(0,v.jsx)(j,{open:W,onOpenChange:G,children:$}),t[212]=j,t[213]=W,t[214]=G,t[215]=$,t[216]=bt):bt=t[216],bt}function Te(e){return(0,v.jsx)(`li`,{children:(0,v.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function Ee(e){e.preventDefault()}function De(e){e.preventDefault()}function Oe(){return p.request()}function ke(e){return be(e,null).state}function Ae(e){return ye(e,null)}function je(e){return me(e,null)}function Me(){return null}export{y as ShareBranchSwitchDialog};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-CA0dewJJ.js";import{a as ee,c as te,i as ne,n as re,o as ie,s as ae,t as oe}from"./dialog-nnyEatfT.js";import{n as s}from"./dist-CMZSEMCN2.js";import{t as c}from"./desktop-bridge-types-BeY3wQCX.js";import{n as l,t as se}from"./git-branch-B39aVIqr.js";import{t as u}from"./spinner-CbcfYaH_.js";import{n as ce,t as d}from"./miss-dialog-store-Bg_8lUxq.js";import{r as f,t as p}from"./auth-prompt-store-BVCOOr4Z.js";import{a as m,n as h}from"./receive-store-sP45Lmaj.js";import{t as le}from"./share-metadata-rows-DgBPt0dQ.js";var g=e(n(),1),ue=a();function de(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 fe(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function _(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 pe={phase:`loading`};function me(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function he(e,t){return e.phase!==`ready`&&e.phase!==`verdict`?e:{phase:`switching`,info:e.info,pendingDoc:t}}function ge(e){return e.phase===`ready`?{phase:`creating-worktree`,info:e.info}:e}function _e(e){return de(e).kind===`B`&&e.shareTargetOnOriginBranch===!1}function ve(e){return e.phase===`ready`?{phase:`verdict-pending`,info:e.info}:e}function ye(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 be(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=_(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}}}function xe(e,t){return e.phase===`creating-worktree`?t===null?{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}}:t.ok?{state:{phase:`opening-worktree`,path:t.path}}:t.reason===`branch-not-found`?{state:{phase:`dismissed`,reason:`branch-not-found`},sideEffect:{kind:`toast`,reason:`branch-not-found`}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:t.reason,helper:t.helper,authFailed:t.reason===`fetch-failed`?t.authFailed:void 0}}:{state:e}}var v=t();function Se(e){return c(e.repositoryTarget)}function Ce(e,t=c(e.target)){let n=e.contentRootDepth===null?t:[...Se(e).split(`/`).slice(0,e.contentRootDepth),...t===``?[]:t.split(`/`)].join(`/`);return{kind:e.target.kind,path:t,repositoryPath:n,...e.contentRootDepth===null?{}:{contentRootDepth:e.contentRootDepth}}}function we(e){return e!==null&&e.kind===`project-branch-switch`}function y(e){let t=(0,ue.c)(217),{bridge:n,store:a}=e,p=a===void 0?h:a,{_}=i(),y=(0,g.useSyncExternalStore)(p.subscribe,p.getSnapshot,Me),[b,x]=(0,g.useState)(pe),Ne=(0,g.useRef)(!1),Pe=(0,g.useRef)(!1),Fe=(0,g.useRef)(!1),Ie=(0,g.useRef)(null),Le;t[0]===y?Le=t[1]:(Le=we(y)?y:null,t[0]=y,t[1]=Le);let S=Le,Re;t[2]!==_||t[3]!==S?.share.target.kind?(Re=S?.share.target.kind===`folder`?_({id:`ugoTXs`}):_({id:`XH30C4`}),t[2]=_,t[3]=S?.share.target.kind,t[4]=Re):Re=t[4];let C=Re,ze;t[5]===S?ze=t[6]:(ze=()=>{x(pe),Ne.current=!1,Pe.current=!1,Fe.current=!1,Ie.current=S},t[5]=S,t[6]=ze);let Be;t[7]===y?Be=t[8]:(Be=[y],t[7]=y,t[8]=Be),(0,g.useEffect)(ze,Be);let Ve;t[9]!==S||t[10]!==n?(Ve=()=>{if(!S||Ne.current)return;Ne.current=!0;let e=!1;return n.project.fetchBranchInfo({projectPath:S.projectPath,branch:S.share.branch,kind:S.share.repositoryTarget.kind,path:Se(S.share)}).then(t=>{e||x(e=>me(e,t))}).catch(t=>{e||(console.warn(`[receive] branch-info-fetch-failed`,t instanceof Error?t.message:t),x(je))}),()=>{e=!0}},t[9]=S,t[10]=n,t[11]=Ve):Ve=t[11];let He;t[12]===S?He=t[13]:(He=[S],t[12]=S,t[13]=He),(0,g.useEffect)(Ve,He);let Ue;t[14]!==S||t[15]!==b.info||t[16]!==b.phase||t[17]!==n?(Ue=()=>{if(!S||b.phase!==`ready`||Fe.current||!_e(b.info))return;Fe.current=!0,x(ve);let e=S;n.project.fetchTargetStatus({projectPath:S.projectPath,branch:S.share.branch,kind:S.share.target.kind,path:Se(S.share),...S.share.contentRootDepth===null?{}:{contentRootDepth:S.share.contentRootDepth}}).then(t=>{Ie.current===e&&x(e=>ye(e,t))}).catch(t=>{Ie.current===e&&(console.warn(`[receive] target-status-fetch-failed`,t instanceof Error?t.message:t),x(Ae))})},t[14]=S,t[15]=b.info,t[16]=b.phase,t[17]=n,t[18]=Ue):Ue=t[18];let We;t[19]!==S||t[20]!==b.phase?(We=[b.phase,S],t[19]=S,t[20]=b.phase,t[21]=We):We=t[21],(0,g.useEffect)(Ue,We);let Ge;t[22]!==S||t[23]!==b.phase||t[24]!==b.resolution||t[25]!==p?(Ge=()=>{if(b.phase!==`verdict`)return;let{kind:e}=b.resolution;e!==`deleted`&&e!==`never-on-branch`||S&&(d.arm({kind:S.share.target.kind,path:c(S.share.target),repositoryPath:Se(S.share),...S.share.contentRootDepth===null?{}:{contentRootDepth:S.share.contentRootDepth},branch:S.share.branch}),p.dismiss())},t[22]=S,t[23]=b.phase,t[24]=b.resolution,t[25]=p,t[26]=Ge):Ge=t[26];let Ke;t[27]!==S||t[28]!==b||t[29]!==p?(Ke=[b,S,p],t[27]=S,t[28]=b,t[29]=p,t[30]=Ke):Ke=t[30],(0,g.useEffect)(Ge,Ke);let qe;t[31]!==b.phase||t[32]!==b.resolution?(qe=()=>{b.phase===`verdict`&&console.log(m({verdict_cell:b.resolution.kind}))},t[31]=b.phase,t[32]=b.resolution,t[33]=qe):qe=t[33];let Je;t[34]===b?Je=t[35]:(Je=[b],t[34]=b,t[35]=Je),(0,g.useEffect)(qe,Je);let Ye;t[36]!==_||t[37]!==S||t[38]!==b.pendingDoc||t[39]!==b.phase||t[40]!==n||t[41]!==p||t[42]!==C?(Ye=()=>{if(b.phase!==`awaiting-cc1-recycle`||!S)return;let e=S.share.branch,t=b.pendingDoc;if(!e){p.dismiss();return}if(Pe.current)return;Pe.current=!0;let r=!1;return n.project.awaitBranchSwitched({projectPath:S.projectPath,branch:e,timeoutMs:3e4}).then(i=>{if(!r){if(i.ok){console.log(m({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:S.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Ce(S.share,t),pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),s.error(_({id:`gQV-9w`,values:{targetNoun:C}}))}),p.dismiss();return}console.log(m({branch_dialog_action:`branch-switch-timeout`,branch:e})),s.error(_({id:`LBwUR6`,values:{targetNoun:C}})),p.dismiss()}}).catch(e=>{r||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),s.error(_({id:`Jw6EC4`,values:{targetNoun:C}})),p.dismiss())}),()=>{r=!0}},t[36]=_,t[37]=S,t[38]=b.pendingDoc,t[39]=b.phase,t[40]=n,t[41]=p,t[42]=C,t[43]=Ye):Ye=t[43];let Xe;if(t[44]!==S||t[45]!==b.phase?(Xe=[b.phase,S],t[44]=S,t[45]=b.phase,t[46]=Xe):Xe=t[46],(0,g.useEffect)(Ye,Xe),!S)return null;let{share:w,projectPath:T,currentBranch:Ze}=S,E=w.branch,Qe;t[47]!==_||t[48]!==n.project||t[49]!==T||t[50]!==E||t[51]!==p?(Qe=function(e,t,r){console.log(m({branch_dialog_action:`switch`,branch_action:`switch`,branch:E,verdict_cell:r})),x(t=>he(t,e)),n.project.runCheckout(t?{projectPath:T,branch:E,fastForward:!0}:{projectPath:T,branch:E}).then(e=>{let t=null,n=!1;x(r=>{let{state:i,sideEffect:a}=be(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?s.error(_({id:`NJyQi_`,values:{shareBranch:E}})):t===`fetch-failed`?s.error(_({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&s.error(_({id:`c863eW`,values:{shareBranch:E}})),n&&p.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),x(ke),s.error(_({id:`c863eW`,values:{shareBranch:E}}))})},t[47]=_,t[48]=n.project,t[49]=T,t[50]=E,t[51]=p,t[52]=Qe):Qe=t[52];let D=Qe,$e;t[53]!==b.info||t[54]!==b.phase||t[55]!==D||t[56]!==w.target?($e=function(){b.phase===`ready`&&de(b.info).switchEnabled&&D(c(w.target),!1)},t[53]=b.info,t[54]=b.phase,t[55]=D,t[56]=w.target,t[57]=$e):$e=t[57];let et=$e,tt;t[58]!==b.phase||t[59]!==b.resolution||t[60]!==D||t[61]!==w.target?(tt=function(){b.phase===`verdict`&&D(c(w.target),!0,b.resolution.kind)},t[58]=b.phase,t[59]=b.resolution,t[60]=D,t[61]=w.target,t[62]=tt):tt=t[62];let nt=tt,rt;t[63]!==b.phase||t[64]!==b.resolution||t[65]!==D?(rt=function(){b.phase===`verdict`&&b.resolution.kind===`renamed`&&D(b.resolution.renamedTo,!0,b.resolution.kind)},t[63]=b.phase,t[64]=b.resolution,t[65]=D,t[66]=rt):rt=t[66];let it=rt,at;t[67]!==b.phase||t[68]!==b.resolution||t[69]!==D||t[70]!==w.target?(at=function(){b.phase===`verdict`&&D(c(w.target),!1,b.resolution.kind)},t[67]=b.phase,t[68]=b.resolution,t[69]=D,t[70]=w.target,t[71]=at):at=t[71];let ot=at,st;t[72]!==_||t[73]!==n.project||t[74]!==T||t[75]!==w||t[76]!==E||t[77]!==p||t[78]!==C?(st=function(){console.log(m({branch_dialog_action:`open-current`,branch:E})),n.project.open({path:T,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Ce(w)}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),s.error(_({id:`b5aNbi`,values:{targetNoun:C}}))}),p.dismiss()},t[72]=_,t[73]=n.project,t[74]=T,t[75]=w,t[76]=E,t[77]=p,t[78]=C,t[79]=st):st=t[79];let ct=st,lt;t[80]!==_||t[81]!==E?(lt=function(e,t,n){if(e===`fetch-failed`&&n){s.error(_({id:`gfb-CM`}),{action:{label:_({id:`5lWFkC`}),onClick:Oe}});return}switch(e){case`helper-not-found`:{let e=t??_({id:`cHhH3i`});s.error(_({id:`Z7x_Zh`,values:{tool:e}}));return}case`branch-not-found`:s.error(_({id:`NJyQi_`,values:{shareBranch:E}}));return;case`fetch-failed`:s.error(_({id:`bWLmRK`}));return;case`already-checked-out`:s.error(_({id:`ljHjfg`}));return;case`branch-exists`:s.error(_({id:`h3QZcB`,values:{shareBranch:E}}));return;case`path-exists`:s.error(_({id:`cN1Gcp`,values:{shareBranch:E}}));return;case`no-git`:s.error(_({id:`CFnavk`}));return;case`empty-repo`:s.error(_({id:`5IgYAM`}));return;case`invalid-branch`:s.error(_({id:`JfPuv7`,values:{shareBranch:E}}));return;case`proxy-null`:case`error`:s.error(_({id:`e8zYa8`,values:{shareBranch:E}}));return;default:throw Error(`Unhandled worktree failure reason: ${String(e)}`)}},t[80]=_,t[81]=E,t[82]=lt):lt=t[82];let ut=lt,dt;t[83]!==_||t[84]!==n.project||t[85]!==w||t[86]!==E||t[87]!==ut||t[88]!==p?(dt=function(e){let t=null,r,i,a=!1,o=null;if(x(n=>{let{state:ee,sideEffect:te}=xe(n,e);return te&&(t=te.reason,r=te.helper,i=te.authFailed,a=ee.phase===`dismissed`),ee.phase===`opening-worktree`&&(o=ee.path),ee}),t!==null&&(console.log(m({branch_dialog_action:`open-worktree-failed:${t}`,branch:E})),ut(t,r,i)),o!==null){f();let e=o;n.project.open({path:e,target:`new-window`,entryPoint:`worktree`,pendingDeepLinkTarget:Ce(w),pendingBranch:E}).catch(t=>{console.warn(`[receive] worktree-open-failed branch_dialog_action=open-worktree`,t instanceof Error?t.message:t),s.error(_({id:`LdABLa`,values:{target:e}}))}),p.dismiss()}a&&p.dismiss()},t[83]=_,t[84]=n.project,t[85]=w,t[86]=E,t[87]=ut,t[88]=p,t[89]=dt):dt=t[89];let ft=dt,pt;t[90]!==ft||t[91]!==b.phase||t[92]!==n.worktree||t[93]!==E?(pt=function(){b.phase===`ready`&&(console.log(m({branch_dialog_action:`open-worktree`,branch:E})),x(ge),n.worktree.checkout({branch:E}).then(e=>{ft(e)}).catch(e=>{console.warn(`[receive] worktree-checkout rejected branch_dialog_action=open-worktree`,e instanceof Error?e.message:e),ft(null)}))},t[90]=ft,t[91]=b.phase,t[92]=n.worktree,t[93]=E,t[94]=pt):pt=t[94];let mt=pt,ht;t[95]!==_||t[96]!==b.otherWorktreePath||t[97]!==b.phase||t[98]!==n.project||t[99]!==w||t[100]!==E||t[101]!==p?(ht=function(){if(b.phase!==`branch-in-other-worktree`)return;let e=b.otherWorktreePath;console.log(m({branch_dialog_action:`pivot-to-other-worktree`,branch:E})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Ce(w),pendingBranch:E}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),s.error(_({id:`LdABLa`,values:{target:e}}))}),p.dismiss()},t[95]=_,t[96]=b.otherWorktreePath,t[97]=b.phase,t[98]=n.project,t[99]=w,t[100]=E,t[101]=p,t[102]=ht):ht=t[102];let gt=ht,_t;t[103]!==b.phase||t[104]!==b.resolution||t[105]!==p?(_t=function(){console.log(m({branch_dialog_action:`cancel`,verdict_cell:b.phase===`verdict`?b.resolution.kind:void 0})),p.dismiss()},t[103]=b.phase,t[104]=b.resolution,t[105]=p,t[106]=_t):_t=t[106];let O=_t,k,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K,q;if(t[107]!==_||t[108]!==b.info||t[109]!==b.otherWorktreePath||t[110]!==b.phase||t[111]!==b.resolution||t[112]!==O||t[113]!==Ze||t[114]!==w.branch||t[115]!==w.owner||t[116]!==w.repo||t[117]!==w.target||t[118]!==E||t[119]!==C){K=b.phase===`ready`||b.phase===`switching`||b.phase===`creating-worktree`?de(b.info):null;let e;t[139]!==b.info||t[140]!==b.phase||t[141]!==Ze?(e=b.phase===`ready`||b.phase===`switching`||b.phase===`creating-worktree`?fe(b.info):Ze??`HEAD`,t[139]=b.info,t[140]=b.phase,t[141]=Ze,t[142]=e):e=t[142];let n=e;F=b.phase===`switching`||b.phase===`awaiting-cc1-recycle`,M=b.phase===`creating-worktree`;let i;t[143]===_?i=t[144]:(i=_({id:`OuY8t9`}),t[143]=_,t[144]=i),N=i;let a;t[145]===_?a=t[146]:(a=_({id:`XZkdtg`}),t[145]=_,t[146]=a),P=a;let o;t[147]===_?o=t[148]:(o=_({id:`VTulZj`}),t[147]=_,t[148]=o),q=o;let ie=b.phase===`loading`,s=b.phase===`error`;j=oe,W=!0,t[149]===O?G=t[150]:(G=e=>{e||O()},t[149]=O,t[150]=G),A=ne,z=`sm:max-w-xl`,B=`share-branch-switch-dialog`,V=De,H=Ee;let l;t[151]===C?l=t[152]:(l=(0,v.jsx)(te,{children:(0,v.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:C}})}),t[151]=C,t[152]=l);let se=w.owner,ce=w.repo,d;t[153]===w.target?d=t[154]:(d=c(w.target),t[153]=w.target,t[154]=d);let f;t[155]!==w.owner||t[156]!==w.repo||t[157]!==d?(f=(0,v.jsx)(ee,{className:`sr-only`,children:(0,v.jsx)(r,{id:`f8jU-L`,values:{0:se,1:ce,2:d}})}),t[155]=w.owner,t[156]=w.repo,t[157]=d,t[158]=f):f=t[158],t[159]!==l||t[160]!==f?(U=(0,v.jsxs)(ae,{children:[l,f]}),t[159]=l,t[160]=f,t[161]=U):U=t[161],k=re;let p=w.owner,m=w.repo,h;t[162]===w.target?h=t[163]:(h=c(w.target),t[162]=w.target,t[163]=h),t[164]!==w.branch||t[165]!==w.owner||t[166]!==w.repo||t[167]!==w.target.kind||t[168]!==h?(I=(0,v.jsx)(`div`,{className:`mb-4`,children:(0,v.jsx)(le,{owner:p,repo:m,path:h,kind:w.target.kind,branch:w.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[164]=w.branch,t[165]=w.owner,t[166]=w.repo,t[167]=w.target.kind,t[168]=h,t[169]=I):I=t[169],L=b.phase===`branch-in-other-worktree`?(0,v.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,v.jsx)(`p`,{className:`leading-6`,children:(0,v.jsx)(r,{id:`yjExfe`,values:{shareBranch:E},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,v.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:b.otherWorktreePath})]}):b.phase===`verdict-pending`?(0,v.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,v.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`c8jBgX`})]}):b.phase===`verdict`?b.resolution.kind===`on-origin`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-on-origin`,children:(0,v.jsx)(r,{id:`Uay5NL`,values:{targetNoun:C,shareBranch:E},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):b.resolution.kind===`renamed`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-renamed`,children:(0,v.jsx)(r,{id:`P0HC30`,values:{0:b.resolution.renamedTo,targetNoun:C},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):b.resolution.kind===`diverged`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-diverged`,children:(0,v.jsx)(r,{id:`kLv8d3`,values:{shareBranch:E,targetNoun:C},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,v.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,v.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`c8jBgX`})]}):ie?(0,v.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,v.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`jerqF0`})]}):s?(0,v.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,v.jsx)(r,{id:`w4hMYl`})}):K?.kind===`D`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,v.jsx)(r,{id:`DTI-fp`,values:{targetNoun:C,shareBranch:E},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):K?.kind===`B`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,v.jsx)(r,{id:`sZ2IOu`,values:{targetNoun:C,shareBranch:E,currentLabel:n},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,v.jsx)(r,{id:`_902BE`,values:{targetNoun:C,shareBranch:E,currentLabel:n},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),R=K&&!K.switchEnabled&&K.conflictingFiles.length>0?(0,v.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,v.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,v.jsx)(r,{id:`n2lRue`})}),(0,v.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:K.conflictingFiles.map(Te)})]}):null,t[107]=_,t[108]=b.info,t[109]=b.otherWorktreePath,t[110]=b.phase,t[111]=b.resolution,t[112]=O,t[113]=Ze,t[114]=w.branch,t[115]=w.owner,t[116]=w.repo,t[117]=w.target,t[118]=E,t[119]=C,t[120]=k,t[121]=A,t[122]=j,t[123]=M,t[124]=N,t[125]=P,t[126]=F,t[127]=I,t[128]=L,t[129]=R,t[130]=z,t[131]=B,t[132]=V,t[133]=H,t[134]=U,t[135]=W,t[136]=G,t[137]=K,t[138]=q}else k=t[120],A=t[121],j=t[122],M=t[123],N=t[124],P=t[125],F=t[126],I=t[127],L=t[128],R=t[129],z=t[130],B=t[131],V=t[132],H=t[133],U=t[134],W=t[135],G=t[136],K=t[137],q=t[138];let J;t[170]===F?J=t[171]:(J=F?(0,v.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,v.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`CU3AiE`})]}):null,t[170]=F,t[171]=J);let Y;t[172]===M?Y=t[173]:(Y=M?(0,v.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-creating-worktree`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`PZtgO0`})]}):null,t[172]=M,t[173]=Y);let X;t[174]!==k||t[175]!==I||t[176]!==L||t[177]!==R||t[178]!==J||t[179]!==Y?(X=(0,v.jsxs)(k,{children:[I,L,R,J,Y]}),t[174]=k,t[175]=I,t[176]=L,t[177]=R,t[178]=J,t[179]=Y,t[180]=X):X=t[180];let vt;t[181]===Symbol.for(`react.memo_cache_sentinel`)?(vt=(0,v.jsx)(r,{id:`dEgA5A`}),t[181]=vt):vt=t[181];let Z;t[182]===O?Z=t[183]:(Z=(0,v.jsx)(o,{variant:`ghost`,className:`font-mono uppercase`,onClick:O,"data-testid":`share-branch-switch-cancel`,children:vt}),t[182]=O,t[183]=Z);let Q;t[184]!==b.phase||t[185]!==b.resolution||t[186]!==M||t[187]!==ct||t[188]!==it||t[189]!==mt||t[190]!==gt||t[191]!==ot||t[192]!==et||t[193]!==nt||t[194]!==N||t[195]!==P||t[196]!==F||t[197]!==K||t[198]!==q?(Q=b.phase===`branch-in-other-worktree`?(0,v.jsx)(o,{onClick:gt,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,v.jsx)(r,{id:`hyCxJY`})}):b.phase===`verdict`?b.resolution.kind===`on-origin`?(0,v.jsxs)(o,{onClick:nt,"data-testid":`share-branch-switch-verdict-switch-update`,children:[(0,v.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),(0,v.jsx)(r,{id:`uA_jXp`})]}):b.resolution.kind===`renamed`?(0,v.jsxs)(o,{onClick:it,"data-testid":`share-branch-switch-verdict-open-renamed`,children:[(0,v.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),(0,v.jsx)(r,{id:`AItsE5`})]}):b.resolution.kind===`diverged`?(0,v.jsxs)(o,{onClick:ot,"data-testid":`share-branch-switch-verdict-plain-switch`,children:[(0,v.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),P]}):null:(0,v.jsxs)(`div`,{className:`flex min-w-0 flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:justify-end sm:gap-2`,children:[K?.openCurrentEnabled?(0,v.jsxs)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:ct,disabled:F||M,"data-testid":`share-branch-switch-open-current`,children:[(0,v.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),N]}):null,(0,v.jsx)(o,{variant:`outline`,onClick:et,disabled:!K?.switchEnabled||F||M,"aria-disabled":!K?.switchEnabled||F||M,"aria-describedby":K&&!K.switchEnabled&&K.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:F?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(u,{className:`size-3.5`,"aria-hidden":`true`}),P]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),P]})}),(0,v.jsx)(o,{onClick:mt,disabled:!K||F||M,"data-testid":`share-branch-switch-worktree`,children:M?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(u,{className:`size-3.5`,"aria-hidden":`true`}),q]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),q]})})]}),t[184]=b.phase,t[185]=b.resolution,t[186]=M,t[187]=ct,t[188]=it,t[189]=mt,t[190]=gt,t[191]=ot,t[192]=et,t[193]=nt,t[194]=N,t[195]=P,t[196]=F,t[197]=K,t[198]=q,t[199]=Q):Q=t[199];let yt;t[200]!==Z||t[201]!==Q?(yt=(0,v.jsxs)(ie,{className:`sm:justify-between`,children:[Z,Q]}),t[200]=Z,t[201]=Q,t[202]=yt):yt=t[202];let $;t[203]!==A||t[204]!==z||t[205]!==B||t[206]!==V||t[207]!==H||t[208]!==U||t[209]!==X||t[210]!==yt?($=(0,v.jsxs)(A,{className:z,"data-testid":B,onInteractOutside:V,onPointerDownOutside:H,children:[U,X,yt]}),t[203]=A,t[204]=z,t[205]=B,t[206]=V,t[207]=H,t[208]=U,t[209]=X,t[210]=yt,t[211]=$):$=t[211];let bt;return t[212]!==j||t[213]!==W||t[214]!==G||t[215]!==$?(bt=(0,v.jsx)(j,{open:W,onOpenChange:G,children:$}),t[212]=j,t[213]=W,t[214]=G,t[215]=$,t[216]=bt):bt=t[216],bt}function Te(e){return(0,v.jsx)(`li`,{children:(0,v.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function Ee(e){e.preventDefault()}function De(e){e.preventDefault()}function Oe(){return p.request()}function ke(e){return be(e,null).state}function Ae(e){return ye(e,null)}function je(e){return me(e,null)}function Me(){return null}export{y as ShareBranchSwitchDialog};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-CA0dewJJ.js";import{a as ee,c as te,i as ne,n as re,o as s,s as c,t as l}from"./dialog-nnyEatfT.js";import{Dn as u,Tn as d}from"./dist-Dih2A8fV.js";import{n as f}from"./dist-CMZSEMCN2.js";import{t as p}from"./desktop-bridge-types-BeY3wQCX.js";import{t as ie}from"./spinner-CbcfYaH_.js";import{a as ae,i as m,n as h,o as g,r as oe,s as _}from"./receive-store-CcixohWp.js";import{t as se}from"./share-metadata-rows-DgBPt0dQ.js";var v=e(n(),1),y=a(),b=e=>({phase:`ready`,seed:e});function x(e){return e.phase===`ready`?{phase:`initializing`,seed:e.seed}:e}function S(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 C(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 w(e){return e.phase===`done`||e.phase===`cancelled`||e.phase===`error`?e:{phase:`cancelled`,seed:e.seed}}var T=t();function E(e){return{kind:e.target.kind,path:p(e.target),repositoryPath:p(e.repositoryTarget),...e.contentRootDepth===null?{}:{contentRootDepth:e.contentRootDepth}}}function D(e){return e!==null&&e.kind===`launcher-consent`}function O(e){return e!==null&&e.kind===`launcher-miss`}function k(e){let t=(0,y.c)(14),{bridge:n,cloneController:r,store:i}=e,a=i===void 0?h:i,o=(0,v.useSyncExternalStore)(a.subscribe,a.getSnapshot,j),[ee,te]=(0,v.useState)(0),[ne,re]=(0,v.useState)(o);o!==ne&&(re(o),te(A));let s,c;t[0]!==o||t[1]!==a?(s=()=>{if(!o)return;let e=_(o);e&&(f.error(e.message),a.dismiss())},c=[o,a],t[0]=o,t[1]=a,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,v.useEffect)(s,c);let l;t[4]===o?l=t[5]:(l=O(o)?o:null,t[4]=o,t[5]=l);let u=l,d;t[6]===o?d=t[7]:(d=D(o)?o:null,t[6]=o,t[7]=d);let p=d??u;if(!p)return null;let ie;return t[8]!==p||t[9]!==n||t[10]!==r||t[11]!==ee||t[12]!==a?(ie=(0,T.jsx)(M,{payload:p,bridge:n,cloneController:r,store:a},ee),t[8]=p,t[9]=n,t[10]=r,t[11]=ee,t[12]=a,t[13]=ie):ie=t[13],ie}function A(e){return e+1}function j(){return null}function M(e){let t=(0,y.c)(165),{payload:n,bridge:a,cloneController:h,store:_}=e,{_:x}=i(),[w,k]=(0,v.useState)(!1),[A,j]=(0,v.useState)(null),[M,pe]=(0,v.useState)(!1),[N,me]=(0,v.useState)(!1),[P,he]=(0,v.useState)(null),[F,I]=(0,v.useState)(null),ge=(0,v.useRef)(!1),_e=(0,v.useRef)(null),ve,ye;t[0]===P?(ve=t[1],ye=t[2]):(ve=()=>{P&&_e.current?.focus()},ye=[P],t[0]=P,t[1]=ve,t[2]=ye),(0,v.useEffect)(ve,ye);let be;t[3]!==F||t[4]!==n?(be=()=>{D(n)&&F===null&&(console.warn(`[receive] q1_hit=true selection=branch_match_non_ok candidate=${n.candidatePath}`),I(b({candidatePath:n.candidatePath,branch:n.share.branch,targetPath:p(n.share.target),targetKind:n.share.target.kind,repositoryPath:p(n.share.repositoryTarget),...n.share.contentRootDepth===null?{}:{contentRootDepth:n.share.contentRootDepth},parentProjectName:n.parentProjectName})))},t[3]=F,t[4]=n,t[5]=be):be=t[5];let xe;t[6]===n?xe=t[7]:(xe=[n],t[6]=n,t[7]=xe),(0,v.useEffect)(be,xe);let Se;t[8]!==A||t[9]!==h||t[10]!==n?(Se=()=>{if(!h||!O(n)||A!==null||ge.current)return;ge.current=!0,pe(!0);let e=n.share.host;h.getAuthStatus(e).then(e=>{j(e)}).catch(t=>{console.warn(`[receive] auth pre-flight probe failed`,t instanceof Error?t.message:t),j({authenticated:!1,host:e})}).finally(()=>{pe(!1)})},t[8]=A,t[9]=h,t[10]=n,t[11]=Se):Se=t[11];let Ce;t[12]!==A||t[13]!==n?(Ce=[n,A],t[12]=A,t[13]=n,t[14]=Ce):Ce=t[14],(0,v.useEffect)(Se,Ce);let L=O(n)?n:null,we=D(n)?n:null,R=L?.share??we?.share??null,z,Te,B,V,H,Ee,U,W;if(t[15]!==x||t[16]!==M||t[17]!==a||t[18]!==h||t[19]!==N||t[20]!==F||t[21]!==L||t[22]!==w||t[23]!==R||t[24]!==_){U=Symbol.for(`react.early_return_sentinel`);bb0:{let e=R?{host:R.host,owner:R.owner,repo:R.repo}:null,n;t[33]!==x||t[34]!==R?.target.kind?(n=R?.target.kind===`folder`?x({id:`ugoTXs`}):x({id:`XH30C4`}),t[33]=x,t[34]=R?.target.kind,t[35]=n):n=t[35],W=n,B=async function(){if(!L||!e)return;if(console.log(ae({q2_path:`clone`})),!h){f.info(x({id:`27XW26`}),{action:{label:x({id:`B3NAZC`}),onClick:()=>{a.navigator.open()}},duration:8e3});return}if(N)return;he(null),me(!0);let t=oe(e),n;try{n=await h.runClone({url:t,branch:L.share.branch})}catch(e){let t=e;console.warn(`[receive] runClone threw unexpectedly`,t),me(!1),he({detail:t instanceof Error?t.message:String(t)});return}if(me(!1),n.kind===`error`){he({detail:n.detail??null});return}if(n.kind===`ok`){try{await a.project.open({path:n.dir,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:E(L.share)}),_.dismiss()}catch(e){let t=e;console.warn(`[receive] project open after clone failed`,t instanceof Error?t.message:t),f.error(x({id:`438Fca`}))}return}};let i;t[36]!==x||t[37]!==M||t[38]!==h?(i=async function(){if(!(!h||M)){pe(!0);try{let e=await h.startSignIn();pe(!1),e!==null&&j(e)}catch(e){let t=e;pe(!1),console.warn(`[receive] startSignIn failed`,t instanceof Error?t.message:t),f.error(x({id:`lzwo7p`}))}}},t[36]=x,t[37]=M,t[38]=h,t[39]=i):i=t[39],H=i,V=async function(){if(!(!L||!e||w)){he(null),k(!0),console.log(ae({q2_path:`local`}));try{for(;;){let t=await a.dialog.openFolder();if(!t)break;let n=await a.share.validateLocalFolder({folderPath:t,host:e.host,owner:e.owner,repo:e.repo});if(console.log(ae({folder_validate:n.kind})),n.kind===`ok`){let e=L.share.branch,n={currentBranch:null,headSha:null,detached:!1};try{n=await a.project.readHeadBranch(t)}catch(e){let t=e;console.warn(`[receive] local-folder readHeadBranch failed`,t instanceof Error?t.message:t)}let r=u(e,n)!==`true`;try{await a.project.open({path:t,target:`new-window`,entryPoint:`share-receive`,...r?{pendingShareBranchSwitch:{share:L.share,projectPath:t,currentBranch:n.currentBranch}}:{pendingDeepLinkTarget:E(L.share)}}),_.dismiss()}catch(e){let t=e;console.warn(`[receive] local-folder-open failed`,t instanceof Error?t.message:t),f.error(x({id:`phM8Kh`}))}break}let r=g(n,e);r&&f.error(r)}}catch(e){let t=e;console.warn(`[receive] local-folder-validate failed`,t instanceof Error?t.message:t),f.error(x({id:`rlUzXK`}))}k(!1)}};let m;t[40]!==x||t[41]!==a||t[42]!==F||t[43]!==_?(m=function(){if(F===null||F.phase!==`ready`)return;let e=F.seed;console.warn(`[receive] consent_dialog action=initialize worktree=${e.candidatePath}`),I(fe),a.project.okInit({projectPath:e.candidatePath}).then(async t=>{if(t.ok===!0){I(e=>e===null?e:S(e,{ok:!0,projectPath:t.projectPath}));try{await a.project.open({path:t.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:e.targetKind,path:e.targetPath,repositoryPath:e.repositoryPath??e.targetPath,...e.contentRootDepth===void 0?{}:{contentRootDepth:e.contentRootDepth}},pendingBranch:e.branch}),I(de),_.dismiss()}catch(t){let n=t,r=n instanceof Error?n.message:String(n);I(e=>e===null?e:C(e,{ok:!1,message:r})),f.error(x({id:`nDT8qt`,values:{0:e.candidatePath}}))}return}let n=t.reason,r=t.message||`Initialization failed.`;I(e=>e===null?e:S(e,{ok:!1,reason:n,message:r})),f.error(r)}).catch(t=>{let n=t instanceof Error?t.message:String(t);I(e=>e===null?e:S(e,{ok:!1,reason:`network-error`,message:n})),f.error(x({id:`3Mwaly`,values:{0:e.candidatePath}}))})},t[40]=x,t[41]=a,t[42]=F,t[43]=_,t[44]=m):m=t[44];let v=m,y;t[45]!==F||t[46]!==_?(y=function(){F!==null&&console.warn(`[receive] consent_dialog action=cancel worktree=${F.seed.candidatePath}`),I(ue),_.dismiss()},t[45]=F,t[46]=_,t[47]=y):y=t[47];let b=y;if(F!==null&&F.phase!==`cancelled`&&F.phase!==`done`&&R!==null){let e=F.seed,n=F.phase===`initializing`||F.phase===`opening`,i;t[48]===b?i=t[49]:(i=e=>{e||b()},t[48]=b,t[49]=i);let a;t[50]===W?a=t[51]:(a=(0,T.jsx)(te,{children:(0,T.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:W}})}),t[50]=W,t[51]=a);let u;t[52]===R.target?u=t[53]:(u=p(R.target)?`— ${p(R.target)}`:``,t[52]=R.target,t[53]=u);let d;t[54]!==R.owner||t[55]!==R.repo||t[56]!==u?(d=(0,T.jsx)(ee,{className:`sr-only`,children:(0,T.jsx)(r,{id:`pgq_xf`,values:{0:R.owner,1:R.repo,2:u}})}),t[54]=R.owner,t[55]=R.repo,t[56]=u,t[57]=d):d=t[57];let f=R.owner,ae=R.repo,m;t[58]===R.target?m=t[59]:(m=p(R.target),t[58]=R.target,t[59]=m);let h;t[60]!==R.branch||t[61]!==R.owner||t[62]!==R.repo||t[63]!==R.target.kind||t[64]!==m?(h=(0,T.jsx)(se,{owner:f,repo:ae,path:m,kind:R.target.kind,branch:R.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[60]=R.branch,t[61]=R.owner,t[62]=R.repo,t[63]=R.target.kind,t[64]=m,t[65]=h):h=t[65];let g;t[66]!==a||t[67]!==d||t[68]!==h?(g=(0,T.jsxs)(c,{children:[a,d,h]}),t[66]=a,t[67]=d,t[68]=h,t[69]=g):g=t[69];let oe;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`KsAPaB`})}),t[70]=oe):oe=t[70];let _;t[71]===e.candidatePath?_=t[72]:(_=(0,T.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]=_);let y;t[73]===e.parentProjectName?y=t[74]:(y=e.parentProjectName===null?null:(0,T.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,"data-testid":`share-receive-consent-parent`,children:(0,T.jsx)(r,{id:`JmfgFc`,values:{0:e.parentProjectName}})}),t[73]=e.parentProjectName,t[74]=y);let x;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,T.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`w7SsvI`})}),t[75]=x):x=t[75];let S;t[76]!==F.message||t[77]!==F.phase?(S=F.phase===`error`?(0,T.jsx)(`p`,{className:`mt-3 text-sm text-destructive`,"data-testid":`share-receive-consent-error`,role:`alert`,children:F.message}):null,t[76]=F.message,t[77]=F.phase,t[78]=S):S=t[78];let C;t[79]!==_||t[80]!==y||t[81]!==S?(C=(0,T.jsxs)(re,{children:[oe,_,y,x,S]}),t[79]=_,t[80]=y,t[81]=S,t[82]=C):C=t[82];let w;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,T.jsx)(r,{id:`dEgA5A`}),t[83]=w):w=t[83];let E;t[84]===b?E=t[85]:(E=(0,T.jsx)(o,{variant:`ghost`,onClick:b,"data-testid":`share-receive-consent-cancel`,children:w}),t[84]=b,t[85]=E);let D=n||F.phase===`error`,O=n||F.phase===`error`,k;t[86]===n?k=t[87]:(k=n?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(ie,{className:`mr-2 h-4 w-4`,"aria-hidden":`true`}),(0,T.jsx)(r,{id:`NKkZXl`})]}):(0,T.jsx)(r,{id:`NKkZXl`}),t[86]=n,t[87]=k);let A;t[88]!==v||t[89]!==D||t[90]!==O||t[91]!==k?(A=(0,T.jsx)(o,{onClick:v,disabled:D,"aria-disabled":O,"data-testid":`share-receive-consent-initialize`,children:k}),t[88]=v,t[89]=D,t[90]=O,t[91]=k,t[92]=A):A=t[92];let j;t[93]!==E||t[94]!==A?(j=(0,T.jsxs)(s,{children:[E,A]}),t[93]=E,t[94]=A,t[95]=j):j=t[95];let M;t[96]!==g||t[97]!==C||t[98]!==j?(M=(0,T.jsxs)(ne,{className:`sm:max-w-xl`,"data-testid":`share-receive-consent-dialog`,onInteractOutside:le,onPointerDownOutside:ce,children:[g,C,j]}),t[96]=g,t[97]=C,t[98]=j,t[99]=M):M=t[99];let ue;t[100]!==i||t[101]!==M?(ue=(0,T.jsx)(l,{open:!0,onOpenChange:i,children:M}),t[100]=i,t[101]=M,t[102]=ue):ue=t[102],U=ue;break bb0}if(!L||!R||!e){U=null;break bb0}z=h!==void 0&&!N;let D;t[103]!==x||t[104]!==N?(D=x(N?{id:`YjhKI5`}:{id:`LE7t79`}),t[103]=x,t[104]=N,t[105]=D):D=t[105],Te=D,Ee=d(e)}t[15]=x,t[16]=M,t[17]=a,t[18]=h,t[19]=N,t[20]=F,t[21]=L,t[22]=w,t[23]=R,t[24]=_,t[25]=z,t[26]=Te,t[27]=B,t[28]=V,t[29]=H,t[30]=Ee,t[31]=U,t[32]=W}else z=t[25],Te=t[26],B=t[27],V=t[28],H=t[29],Ee=t[30],U=t[31],W=t[32];if(U!==Symbol.for(`react.early_return_sentinel`))return U;let De=Ee,Oe=A?.authenticated?A.login:void 0,ke;t[106]===P?ke=t[107]:(ke=P?.detail?m(P.detail):``,t[106]=P,t[107]=ke);let Ae=ke,G;t[108]===_?G=t[109]:(G=e=>{e||_.dismiss()},t[108]=_,t[109]=G);let K;t[110]===W?K=t[111]:(K=(0,T.jsx)(te,{children:(0,T.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:W}})}),t[110]=W,t[111]=K);let q;t[112]===R.target?q=t[113]:(q=p(R.target)?` — ${p(R.target)}`:null,t[112]=R.target,t[113]=q);let J;t[114]!==R.owner||t[115]!==R.repo||t[116]!==q?(J=(0,T.jsxs)(ee,{className:`sr-only`,children:[R.owner,`/`,R.repo,q]}),t[114]=R.owner,t[115]=R.repo,t[116]=q,t[117]=J):J=t[117];let je=R.owner,Me=R.repo,Y;t[118]===R.target?Y=t[119]:(Y=p(R.target),t[118]=R.target,t[119]=Y);let X;t[120]!==R.branch||t[121]!==R.owner||t[122]!==R.repo||t[123]!==R.target.kind||t[124]!==Y?(X=(0,T.jsx)(se,{owner:je,repo:Me,path:Y,kind:R.target.kind,branch:R.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[120]=R.branch,t[121]=R.owner,t[122]=R.repo,t[123]=R.target.kind,t[124]=Y,t[125]=X):X=t[125];let Z;t[126]!==K||t[127]!==J||t[128]!==X?(Z=(0,T.jsxs)(c,{children:[K,J,X]}),t[126]=K,t[127]=J,t[128]=X,t[129]=Z):Z=t[129];let Q;t[130]!==h||t[131]!==z||t[132]!==P||t[133]!==Ae||t[134]!==Te||t[135]!==N||t[136]!==B||t[137]!==V||t[138]!==w?(Q=P?(0,T.jsxs)(`div`,{ref:_e,tabIndex:-1,className:`rounded-lg border border-destructive/40 bg-destructive/5 p-4 outline-none`,"data-testid":`share-receive-clone-error`,children:[(0,T.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,role:`alert`,children:(0,T.jsx)(r,{id:`aiArms`})}),Ae?(0,T.jsxs)(`p`,{className:`mt-2 break-words text-xs text-destructive`,"data-testid":`share-receive-clone-error-message`,children:[(0,T.jsx)(r,{id:`4BITzH`}),` `,(0,T.jsxs)(`span`,{className:`font-mono text-foreground/80`,children:[`"`,Ae,`"`]})]}):null,(0,T.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`Llyqvo`})}),(0,T.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,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`6LbUG7`})}),(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`_pY_Vq`})}),(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`J6mxC1`})})]}),(0,T.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,T.jsx)(o,{onClick:()=>{B()},"data-testid":`share-receive-clone-retry`,children:(0,T.jsx)(r,{id:`KDw4GX`})}),(0,T.jsx)(o,{variant:`outline`,onClick:()=>{V()},disabled:w||N,"data-testid":`share-receive-error-local`,children:(0,T.jsx)(r,{id:`xFQRu4`})})]})]}):(0,T.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,T.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:()=>{B()},disabled:h!==void 0&&!z,"aria-disabled":h!==void 0&&!z,children:[(0,T.jsx)(`span`,{className:`text-sm font-semibold`,children:Te}),(0,T.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`fj5YiP`})})]}),(0,T.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:()=>{V()},disabled:w||N,children:[(0,T.jsx)(`span`,{className:`text-sm font-semibold`,children:(0,T.jsx)(r,{id:`HfI1dR`})}),(0,T.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`_qD6mn`})})]})]}),t[130]=h,t[131]=z,t[132]=P,t[133]=Ae,t[134]=Te,t[135]=N,t[136]=B,t[137]=V,t[138]=w,t[139]=Q):Q=t[139];let Ne;t[140]!==M||t[141]!==A||t[142]!==h||t[143]!==H||t[144]!==Oe?(Ne=h?(0,T.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:A===null?(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{id:`UDFrWm`})}):A.authenticated?(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{id:`VAHWL_`,values:{signedInLogin:Oe},components:{0:(0,T.jsx)(`span`,{className:`font-medium text-foreground/90`})}})}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{id:`SgKLfA`})}),(0,T.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:()=>{H()},disabled:M,children:M?(0,T.jsx)(r,{id:`PKLY-1`}):(0,T.jsx)(r,{id:`3jod3l`})})]})}):null,t[140]=M,t[141]=A,t[142]=h,t[143]=H,t[144]=Oe,t[145]=Ne):Ne=t[145];let Pe;t[146]!==P||t[147]!==De?(Pe=P?null:(0,T.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`RJ3a8Z`,values:{lookingForUrl:De},components:{0:(0,T.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),t[146]=P,t[147]=De,t[148]=Pe):Pe=t[148];let Fe;t[149]!==Q||t[150]!==Ne||t[151]!==Pe?(Fe=(0,T.jsxs)(re,{children:[Q,Ne,Pe]}),t[149]=Q,t[150]=Ne,t[151]=Pe,t[152]=Fe):Fe=t[152];let Ie;t[153]===_?Ie=t[154]:(Ie=()=>_.dismiss(),t[153]=_,t[154]=Ie);let Le;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,T.jsx)(r,{id:`dEgA5A`}),t[155]=Le):Le=t[155];let Re;t[156]===Ie?Re=t[157]:(Re=(0,T.jsx)(s,{children:(0,T.jsx)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:Ie,children:Le})}),t[156]=Ie,t[157]=Re);let $;t[158]!==Z||t[159]!==Fe||t[160]!==Re?($=(0,T.jsxs)(ne,{className:`sm:max-w-xl`,"data-testid":`share-receive-dialog`,children:[Z,Fe,Re]}),t[158]=Z,t[159]=Fe,t[160]=Re,t[161]=$):$=t[161];let ze;return t[162]!==G||t[163]!==$?(ze=(0,T.jsx)(l,{open:!0,onOpenChange:G,children:$}),t[162]=G,t[163]=$,t[164]=ze):ze=t[164],ze}function ce(e){return e.preventDefault()}function le(e){return e.preventDefault()}function ue(e){return e===null?e:w(e)}function de(e){return e===null?e:C(e,{ok:!0})}function fe(e){return e===null?e:x(e)}export{k as ShareReceiveDialog};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-CA0dewJJ.js";import{a as ee,c as te,i as ne,n as re,o as s,s as c,t as l}from"./dialog-nnyEatfT.js";import{Dn as u,Tn as d}from"./dist-CP7w45uR.js";import{n as f}from"./dist-CMZSEMCN2.js";import{t as p}from"./desktop-bridge-types-BeY3wQCX.js";import{t as ie}from"./spinner-CbcfYaH_.js";import{a as ae,i as m,n as h,o as g,r as oe,s as _}from"./receive-store-sP45Lmaj.js";import{t as se}from"./share-metadata-rows-DgBPt0dQ.js";var v=e(n(),1),y=a(),b=e=>({phase:`ready`,seed:e});function x(e){return e.phase===`ready`?{phase:`initializing`,seed:e.seed}:e}function S(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 C(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 w(e){return e.phase===`done`||e.phase===`cancelled`||e.phase===`error`?e:{phase:`cancelled`,seed:e.seed}}var T=t();function E(e){return{kind:e.target.kind,path:p(e.target),repositoryPath:p(e.repositoryTarget),...e.contentRootDepth===null?{}:{contentRootDepth:e.contentRootDepth}}}function D(e){return e!==null&&e.kind===`launcher-consent`}function O(e){return e!==null&&e.kind===`launcher-miss`}function k(e){let t=(0,y.c)(14),{bridge:n,cloneController:r,store:i}=e,a=i===void 0?h:i,o=(0,v.useSyncExternalStore)(a.subscribe,a.getSnapshot,j),[ee,te]=(0,v.useState)(0),[ne,re]=(0,v.useState)(o);o!==ne&&(re(o),te(A));let s,c;t[0]!==o||t[1]!==a?(s=()=>{if(!o)return;let e=_(o);e&&(f.error(e.message),a.dismiss())},c=[o,a],t[0]=o,t[1]=a,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,v.useEffect)(s,c);let l;t[4]===o?l=t[5]:(l=O(o)?o:null,t[4]=o,t[5]=l);let u=l,d;t[6]===o?d=t[7]:(d=D(o)?o:null,t[6]=o,t[7]=d);let p=d??u;if(!p)return null;let ie;return t[8]!==p||t[9]!==n||t[10]!==r||t[11]!==ee||t[12]!==a?(ie=(0,T.jsx)(M,{payload:p,bridge:n,cloneController:r,store:a},ee),t[8]=p,t[9]=n,t[10]=r,t[11]=ee,t[12]=a,t[13]=ie):ie=t[13],ie}function A(e){return e+1}function j(){return null}function M(e){let t=(0,y.c)(165),{payload:n,bridge:a,cloneController:h,store:_}=e,{_:x}=i(),[w,k]=(0,v.useState)(!1),[A,j]=(0,v.useState)(null),[M,pe]=(0,v.useState)(!1),[N,me]=(0,v.useState)(!1),[P,he]=(0,v.useState)(null),[F,I]=(0,v.useState)(null),ge=(0,v.useRef)(!1),_e=(0,v.useRef)(null),ve,ye;t[0]===P?(ve=t[1],ye=t[2]):(ve=()=>{P&&_e.current?.focus()},ye=[P],t[0]=P,t[1]=ve,t[2]=ye),(0,v.useEffect)(ve,ye);let be;t[3]!==F||t[4]!==n?(be=()=>{D(n)&&F===null&&(console.warn(`[receive] q1_hit=true selection=branch_match_non_ok candidate=${n.candidatePath}`),I(b({candidatePath:n.candidatePath,branch:n.share.branch,targetPath:p(n.share.target),targetKind:n.share.target.kind,repositoryPath:p(n.share.repositoryTarget),...n.share.contentRootDepth===null?{}:{contentRootDepth:n.share.contentRootDepth},parentProjectName:n.parentProjectName})))},t[3]=F,t[4]=n,t[5]=be):be=t[5];let xe;t[6]===n?xe=t[7]:(xe=[n],t[6]=n,t[7]=xe),(0,v.useEffect)(be,xe);let Se;t[8]!==A||t[9]!==h||t[10]!==n?(Se=()=>{if(!h||!O(n)||A!==null||ge.current)return;ge.current=!0,pe(!0);let e=n.share.host;h.getAuthStatus(e).then(e=>{j(e)}).catch(t=>{console.warn(`[receive] auth pre-flight probe failed`,t instanceof Error?t.message:t),j({authenticated:!1,host:e})}).finally(()=>{pe(!1)})},t[8]=A,t[9]=h,t[10]=n,t[11]=Se):Se=t[11];let Ce;t[12]!==A||t[13]!==n?(Ce=[n,A],t[12]=A,t[13]=n,t[14]=Ce):Ce=t[14],(0,v.useEffect)(Se,Ce);let L=O(n)?n:null,we=D(n)?n:null,R=L?.share??we?.share??null,z,Te,B,V,H,Ee,U,W;if(t[15]!==x||t[16]!==M||t[17]!==a||t[18]!==h||t[19]!==N||t[20]!==F||t[21]!==L||t[22]!==w||t[23]!==R||t[24]!==_){U=Symbol.for(`react.early_return_sentinel`);bb0:{let e=R?{host:R.host,owner:R.owner,repo:R.repo}:null,n;t[33]!==x||t[34]!==R?.target.kind?(n=R?.target.kind===`folder`?x({id:`ugoTXs`}):x({id:`XH30C4`}),t[33]=x,t[34]=R?.target.kind,t[35]=n):n=t[35],W=n,B=async function(){if(!L||!e)return;if(console.log(ae({q2_path:`clone`})),!h){f.info(x({id:`27XW26`}),{action:{label:x({id:`B3NAZC`}),onClick:()=>{a.navigator.open()}},duration:8e3});return}if(N)return;he(null),me(!0);let t=oe(e),n;try{n=await h.runClone({url:t,branch:L.share.branch})}catch(e){let t=e;console.warn(`[receive] runClone threw unexpectedly`,t),me(!1),he({detail:t instanceof Error?t.message:String(t)});return}if(me(!1),n.kind===`error`){he({detail:n.detail??null});return}if(n.kind===`ok`){try{await a.project.open({path:n.dir,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:E(L.share)}),_.dismiss()}catch(e){let t=e;console.warn(`[receive] project open after clone failed`,t instanceof Error?t.message:t),f.error(x({id:`438Fca`}))}return}};let i;t[36]!==x||t[37]!==M||t[38]!==h?(i=async function(){if(!(!h||M)){pe(!0);try{let e=await h.startSignIn();pe(!1),e!==null&&j(e)}catch(e){let t=e;pe(!1),console.warn(`[receive] startSignIn failed`,t instanceof Error?t.message:t),f.error(x({id:`lzwo7p`}))}}},t[36]=x,t[37]=M,t[38]=h,t[39]=i):i=t[39],H=i,V=async function(){if(!(!L||!e||w)){he(null),k(!0),console.log(ae({q2_path:`local`}));try{for(;;){let t=await a.dialog.openFolder();if(!t)break;let n=await a.share.validateLocalFolder({folderPath:t,host:e.host,owner:e.owner,repo:e.repo});if(console.log(ae({folder_validate:n.kind})),n.kind===`ok`){let e=L.share.branch,n={currentBranch:null,headSha:null,detached:!1};try{n=await a.project.readHeadBranch(t)}catch(e){let t=e;console.warn(`[receive] local-folder readHeadBranch failed`,t instanceof Error?t.message:t)}let r=u(e,n)!==`true`;try{await a.project.open({path:t,target:`new-window`,entryPoint:`share-receive`,...r?{pendingShareBranchSwitch:{share:L.share,projectPath:t,currentBranch:n.currentBranch}}:{pendingDeepLinkTarget:E(L.share)}}),_.dismiss()}catch(e){let t=e;console.warn(`[receive] local-folder-open failed`,t instanceof Error?t.message:t),f.error(x({id:`phM8Kh`}))}break}let r=g(n,e);r&&f.error(r)}}catch(e){let t=e;console.warn(`[receive] local-folder-validate failed`,t instanceof Error?t.message:t),f.error(x({id:`rlUzXK`}))}k(!1)}};let m;t[40]!==x||t[41]!==a||t[42]!==F||t[43]!==_?(m=function(){if(F===null||F.phase!==`ready`)return;let e=F.seed;console.warn(`[receive] consent_dialog action=initialize worktree=${e.candidatePath}`),I(fe),a.project.okInit({projectPath:e.candidatePath}).then(async t=>{if(t.ok===!0){I(e=>e===null?e:S(e,{ok:!0,projectPath:t.projectPath}));try{await a.project.open({path:t.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:e.targetKind,path:e.targetPath,repositoryPath:e.repositoryPath??e.targetPath,...e.contentRootDepth===void 0?{}:{contentRootDepth:e.contentRootDepth}},pendingBranch:e.branch}),I(de),_.dismiss()}catch(t){let n=t,r=n instanceof Error?n.message:String(n);I(e=>e===null?e:C(e,{ok:!1,message:r})),f.error(x({id:`nDT8qt`,values:{0:e.candidatePath}}))}return}let n=t.reason,r=t.message||`Initialization failed.`;I(e=>e===null?e:S(e,{ok:!1,reason:n,message:r})),f.error(r)}).catch(t=>{let n=t instanceof Error?t.message:String(t);I(e=>e===null?e:S(e,{ok:!1,reason:`network-error`,message:n})),f.error(x({id:`3Mwaly`,values:{0:e.candidatePath}}))})},t[40]=x,t[41]=a,t[42]=F,t[43]=_,t[44]=m):m=t[44];let v=m,y;t[45]!==F||t[46]!==_?(y=function(){F!==null&&console.warn(`[receive] consent_dialog action=cancel worktree=${F.seed.candidatePath}`),I(ue),_.dismiss()},t[45]=F,t[46]=_,t[47]=y):y=t[47];let b=y;if(F!==null&&F.phase!==`cancelled`&&F.phase!==`done`&&R!==null){let e=F.seed,n=F.phase===`initializing`||F.phase===`opening`,i;t[48]===b?i=t[49]:(i=e=>{e||b()},t[48]=b,t[49]=i);let a;t[50]===W?a=t[51]:(a=(0,T.jsx)(te,{children:(0,T.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:W}})}),t[50]=W,t[51]=a);let u;t[52]===R.target?u=t[53]:(u=p(R.target)?`— ${p(R.target)}`:``,t[52]=R.target,t[53]=u);let d;t[54]!==R.owner||t[55]!==R.repo||t[56]!==u?(d=(0,T.jsx)(ee,{className:`sr-only`,children:(0,T.jsx)(r,{id:`pgq_xf`,values:{0:R.owner,1:R.repo,2:u}})}),t[54]=R.owner,t[55]=R.repo,t[56]=u,t[57]=d):d=t[57];let f=R.owner,ae=R.repo,m;t[58]===R.target?m=t[59]:(m=p(R.target),t[58]=R.target,t[59]=m);let h;t[60]!==R.branch||t[61]!==R.owner||t[62]!==R.repo||t[63]!==R.target.kind||t[64]!==m?(h=(0,T.jsx)(se,{owner:f,repo:ae,path:m,kind:R.target.kind,branch:R.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[60]=R.branch,t[61]=R.owner,t[62]=R.repo,t[63]=R.target.kind,t[64]=m,t[65]=h):h=t[65];let g;t[66]!==a||t[67]!==d||t[68]!==h?(g=(0,T.jsxs)(c,{children:[a,d,h]}),t[66]=a,t[67]=d,t[68]=h,t[69]=g):g=t[69];let oe;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`KsAPaB`})}),t[70]=oe):oe=t[70];let _;t[71]===e.candidatePath?_=t[72]:(_=(0,T.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]=_);let y;t[73]===e.parentProjectName?y=t[74]:(y=e.parentProjectName===null?null:(0,T.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,"data-testid":`share-receive-consent-parent`,children:(0,T.jsx)(r,{id:`JmfgFc`,values:{0:e.parentProjectName}})}),t[73]=e.parentProjectName,t[74]=y);let x;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,T.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`w7SsvI`})}),t[75]=x):x=t[75];let S;t[76]!==F.message||t[77]!==F.phase?(S=F.phase===`error`?(0,T.jsx)(`p`,{className:`mt-3 text-sm text-destructive`,"data-testid":`share-receive-consent-error`,role:`alert`,children:F.message}):null,t[76]=F.message,t[77]=F.phase,t[78]=S):S=t[78];let C;t[79]!==_||t[80]!==y||t[81]!==S?(C=(0,T.jsxs)(re,{children:[oe,_,y,x,S]}),t[79]=_,t[80]=y,t[81]=S,t[82]=C):C=t[82];let w;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,T.jsx)(r,{id:`dEgA5A`}),t[83]=w):w=t[83];let E;t[84]===b?E=t[85]:(E=(0,T.jsx)(o,{variant:`ghost`,onClick:b,"data-testid":`share-receive-consent-cancel`,children:w}),t[84]=b,t[85]=E);let D=n||F.phase===`error`,O=n||F.phase===`error`,k;t[86]===n?k=t[87]:(k=n?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(ie,{className:`mr-2 h-4 w-4`,"aria-hidden":`true`}),(0,T.jsx)(r,{id:`NKkZXl`})]}):(0,T.jsx)(r,{id:`NKkZXl`}),t[86]=n,t[87]=k);let A;t[88]!==v||t[89]!==D||t[90]!==O||t[91]!==k?(A=(0,T.jsx)(o,{onClick:v,disabled:D,"aria-disabled":O,"data-testid":`share-receive-consent-initialize`,children:k}),t[88]=v,t[89]=D,t[90]=O,t[91]=k,t[92]=A):A=t[92];let j;t[93]!==E||t[94]!==A?(j=(0,T.jsxs)(s,{children:[E,A]}),t[93]=E,t[94]=A,t[95]=j):j=t[95];let M;t[96]!==g||t[97]!==C||t[98]!==j?(M=(0,T.jsxs)(ne,{className:`sm:max-w-xl`,"data-testid":`share-receive-consent-dialog`,onInteractOutside:le,onPointerDownOutside:ce,children:[g,C,j]}),t[96]=g,t[97]=C,t[98]=j,t[99]=M):M=t[99];let ue;t[100]!==i||t[101]!==M?(ue=(0,T.jsx)(l,{open:!0,onOpenChange:i,children:M}),t[100]=i,t[101]=M,t[102]=ue):ue=t[102],U=ue;break bb0}if(!L||!R||!e){U=null;break bb0}z=h!==void 0&&!N;let D;t[103]!==x||t[104]!==N?(D=x(N?{id:`YjhKI5`}:{id:`LE7t79`}),t[103]=x,t[104]=N,t[105]=D):D=t[105],Te=D,Ee=d(e)}t[15]=x,t[16]=M,t[17]=a,t[18]=h,t[19]=N,t[20]=F,t[21]=L,t[22]=w,t[23]=R,t[24]=_,t[25]=z,t[26]=Te,t[27]=B,t[28]=V,t[29]=H,t[30]=Ee,t[31]=U,t[32]=W}else z=t[25],Te=t[26],B=t[27],V=t[28],H=t[29],Ee=t[30],U=t[31],W=t[32];if(U!==Symbol.for(`react.early_return_sentinel`))return U;let De=Ee,Oe=A?.authenticated?A.login:void 0,ke;t[106]===P?ke=t[107]:(ke=P?.detail?m(P.detail):``,t[106]=P,t[107]=ke);let Ae=ke,G;t[108]===_?G=t[109]:(G=e=>{e||_.dismiss()},t[108]=_,t[109]=G);let K;t[110]===W?K=t[111]:(K=(0,T.jsx)(te,{children:(0,T.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:W}})}),t[110]=W,t[111]=K);let q;t[112]===R.target?q=t[113]:(q=p(R.target)?` — ${p(R.target)}`:null,t[112]=R.target,t[113]=q);let J;t[114]!==R.owner||t[115]!==R.repo||t[116]!==q?(J=(0,T.jsxs)(ee,{className:`sr-only`,children:[R.owner,`/`,R.repo,q]}),t[114]=R.owner,t[115]=R.repo,t[116]=q,t[117]=J):J=t[117];let je=R.owner,Me=R.repo,Y;t[118]===R.target?Y=t[119]:(Y=p(R.target),t[118]=R.target,t[119]=Y);let X;t[120]!==R.branch||t[121]!==R.owner||t[122]!==R.repo||t[123]!==R.target.kind||t[124]!==Y?(X=(0,T.jsx)(se,{owner:je,repo:Me,path:Y,kind:R.target.kind,branch:R.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[120]=R.branch,t[121]=R.owner,t[122]=R.repo,t[123]=R.target.kind,t[124]=Y,t[125]=X):X=t[125];let Z;t[126]!==K||t[127]!==J||t[128]!==X?(Z=(0,T.jsxs)(c,{children:[K,J,X]}),t[126]=K,t[127]=J,t[128]=X,t[129]=Z):Z=t[129];let Q;t[130]!==h||t[131]!==z||t[132]!==P||t[133]!==Ae||t[134]!==Te||t[135]!==N||t[136]!==B||t[137]!==V||t[138]!==w?(Q=P?(0,T.jsxs)(`div`,{ref:_e,tabIndex:-1,className:`rounded-lg border border-destructive/40 bg-destructive/5 p-4 outline-none`,"data-testid":`share-receive-clone-error`,children:[(0,T.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,role:`alert`,children:(0,T.jsx)(r,{id:`aiArms`})}),Ae?(0,T.jsxs)(`p`,{className:`mt-2 break-words text-xs text-destructive`,"data-testid":`share-receive-clone-error-message`,children:[(0,T.jsx)(r,{id:`4BITzH`}),` `,(0,T.jsxs)(`span`,{className:`font-mono text-foreground/80`,children:[`"`,Ae,`"`]})]}):null,(0,T.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`Llyqvo`})}),(0,T.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,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`6LbUG7`})}),(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`_pY_Vq`})}),(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`J6mxC1`})})]}),(0,T.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,T.jsx)(o,{onClick:()=>{B()},"data-testid":`share-receive-clone-retry`,children:(0,T.jsx)(r,{id:`KDw4GX`})}),(0,T.jsx)(o,{variant:`outline`,onClick:()=>{V()},disabled:w||N,"data-testid":`share-receive-error-local`,children:(0,T.jsx)(r,{id:`xFQRu4`})})]})]}):(0,T.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,T.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:()=>{B()},disabled:h!==void 0&&!z,"aria-disabled":h!==void 0&&!z,children:[(0,T.jsx)(`span`,{className:`text-sm font-semibold`,children:Te}),(0,T.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`fj5YiP`})})]}),(0,T.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:()=>{V()},disabled:w||N,children:[(0,T.jsx)(`span`,{className:`text-sm font-semibold`,children:(0,T.jsx)(r,{id:`HfI1dR`})}),(0,T.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`_qD6mn`})})]})]}),t[130]=h,t[131]=z,t[132]=P,t[133]=Ae,t[134]=Te,t[135]=N,t[136]=B,t[137]=V,t[138]=w,t[139]=Q):Q=t[139];let Ne;t[140]!==M||t[141]!==A||t[142]!==h||t[143]!==H||t[144]!==Oe?(Ne=h?(0,T.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:A===null?(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{id:`UDFrWm`})}):A.authenticated?(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{id:`VAHWL_`,values:{signedInLogin:Oe},components:{0:(0,T.jsx)(`span`,{className:`font-medium text-foreground/90`})}})}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{id:`SgKLfA`})}),(0,T.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:()=>{H()},disabled:M,children:M?(0,T.jsx)(r,{id:`PKLY-1`}):(0,T.jsx)(r,{id:`3jod3l`})})]})}):null,t[140]=M,t[141]=A,t[142]=h,t[143]=H,t[144]=Oe,t[145]=Ne):Ne=t[145];let Pe;t[146]!==P||t[147]!==De?(Pe=P?null:(0,T.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`RJ3a8Z`,values:{lookingForUrl:De},components:{0:(0,T.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),t[146]=P,t[147]=De,t[148]=Pe):Pe=t[148];let Fe;t[149]!==Q||t[150]!==Ne||t[151]!==Pe?(Fe=(0,T.jsxs)(re,{children:[Q,Ne,Pe]}),t[149]=Q,t[150]=Ne,t[151]=Pe,t[152]=Fe):Fe=t[152];let Ie;t[153]===_?Ie=t[154]:(Ie=()=>_.dismiss(),t[153]=_,t[154]=Ie);let Le;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,T.jsx)(r,{id:`dEgA5A`}),t[155]=Le):Le=t[155];let Re;t[156]===Ie?Re=t[157]:(Re=(0,T.jsx)(s,{children:(0,T.jsx)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:Ie,children:Le})}),t[156]=Ie,t[157]=Re);let $;t[158]!==Z||t[159]!==Fe||t[160]!==Re?($=(0,T.jsxs)(ne,{className:`sm:max-w-xl`,"data-testid":`share-receive-dialog`,children:[Z,Fe,Re]}),t[158]=Z,t[159]=Fe,t[160]=Re,t[161]=$):$=t[161];let ze;return t[162]!==G||t[163]!==$?(ze=(0,T.jsx)(l,{open:!0,onOpenChange:G,children:$}),t[162]=G,t[163]=$,t[164]=ze):ze=t[164],ze}function ce(e){return e.preventDefault()}function le(e){return e.preventDefault()}function ue(e){return e===null?e:w(e)}function de(e){return e===null?e:C(e,{ok:!0})}function fe(e){return e===null?e:x(e)}export{k as ShareReceiveDialog};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{c as i,i as a,n as o,s,t as c}from"./dialog-nnyEatfT.js";import{a as l,i as u,n as d,o as f,r as p}from"./pending-receive-nav-store-BaSwjYK0.js";import{t as m}from"./miss-dialog-store-Bg_8lUxq.js";import{f as h,p as g}from"./doc-paths-DqJ_A_s7.js";var _=r(),v=e(n(),1),y=t();function b(e){let t=e.split(`/`).filter(Boolean);return t.length>0?t[t.length-1]:e}function x(){let e=(0,_.c)(2),t=(0,v.useSyncExternalStore)(m.subscribe,m.getSnapshot,S);if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=(0,y.jsx)(C,{nav:t},t.path),e[0]=t,e[1]=n),n}function S(){return null}function C(e){let t=(0,_.c)(28),{nav:n}=e,{state:r,refetch:v}=f(n),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=function(){m.dismiss()},t[0]=x):x=t[0];let S=x,C;t[1]===n.path?C=t[2]:(C=function(){window.location.hash=g(l(n.path)),S()},t[1]=n.path,t[2]=C);let w=C,T;t[3]===n?T=t[4]:(T=function(e){p.arm(d(n,e)),window.location.hash=n.kind===`folder`?g(e):h(e),S()},t[3]=n,t[4]=T);let E=T,D;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>{e||S()},t[5]=D):D=t[5];let O=r.phase,k=r.phase===`resolved`?r.resolution.verdict:void 0,A;t[6]===n.path?A=t[7]:(A=b(n.path),t[6]=n.path,t[7]=A);let j;t[8]===A?j=t[9]:(j=(0,y.jsx)(s,{children:(0,y.jsx)(i,{className:`truncate`,children:A})}),t[8]=A,t[9]=j);let M=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`,N;t[10]!==n.path||t[11]!==E?(N=()=>E(n.path),t[10]=n.path,t[11]=E,t[12]=N):N=t[12];let P;t[13]!==w||t[14]!==n||t[15]!==E||t[16]!==v||t[17]!==r||t[18]!==N?(P=(0,y.jsx)(u,{nav:n,state:r,onBrowseFolder:w,onOpenRenamed:E,onEnableAutoSync:S,onSyncCompleted:v,onPullApplied:N}),t[13]=w,t[14]=n,t[15]=E,t[16]=v,t[17]=r,t[18]=N,t[19]=P):P=t[19];let F;t[20]!==P||t[21]!==M?(F=(0,y.jsx)(o,{className:M,children:P}),t[20]=P,t[21]=M,t[22]=F):F=t[22];let I;return t[23]!==r.phase||t[24]!==F||t[25]!==k||t[26]!==j?(I=(0,y.jsx)(c,{open:!0,onOpenChange:D,children:(0,y.jsxs)(a,{className:`sm:max-w-md`,"data-testid":`share-receive-miss-dialog`,"data-phase":O,"data-verdict":k,children:[j,F]})}),t[23]=r.phase,t[24]=F,t[25]=k,t[26]=j,t[27]=I):I=t[27],I}export{x as ShareReceiveMissDialog};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{c as i,i as a,n as o,s,t as c}from"./dialog-nnyEatfT.js";import{a as l,i as u,n as d,o as f,r as p}from"./pending-receive-nav-store-DR3ooVas.js";import{t as m}from"./miss-dialog-store-Bg_8lUxq.js";import{f as h,p as g}from"./doc-paths-CX0c2GkE.js";var _=r(),v=e(n(),1),y=t();function b(e){let t=e.split(`/`).filter(Boolean);return t.length>0?t[t.length-1]:e}function x(){let e=(0,_.c)(2),t=(0,v.useSyncExternalStore)(m.subscribe,m.getSnapshot,S);if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=(0,y.jsx)(C,{nav:t},t.path),e[0]=t,e[1]=n),n}function S(){return null}function C(e){let t=(0,_.c)(28),{nav:n}=e,{state:r,refetch:v}=f(n),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=function(){m.dismiss()},t[0]=x):x=t[0];let S=x,C;t[1]===n.path?C=t[2]:(C=function(){window.location.hash=g(l(n.path)),S()},t[1]=n.path,t[2]=C);let w=C,T;t[3]===n?T=t[4]:(T=function(e){p.arm(d(n,e)),window.location.hash=n.kind===`folder`?g(e):h(e),S()},t[3]=n,t[4]=T);let E=T,D;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>{e||S()},t[5]=D):D=t[5];let O=r.phase,k=r.phase===`resolved`?r.resolution.verdict:void 0,A;t[6]===n.path?A=t[7]:(A=b(n.path),t[6]=n.path,t[7]=A);let j;t[8]===A?j=t[9]:(j=(0,y.jsx)(s,{children:(0,y.jsx)(i,{className:`truncate`,children:A})}),t[8]=A,t[9]=j);let M=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`,N;t[10]!==n.path||t[11]!==E?(N=()=>E(n.path),t[10]=n.path,t[11]=E,t[12]=N):N=t[12];let P;t[13]!==w||t[14]!==n||t[15]!==E||t[16]!==v||t[17]!==r||t[18]!==N?(P=(0,y.jsx)(u,{nav:n,state:r,onBrowseFolder:w,onOpenRenamed:E,onEnableAutoSync:S,onSyncCompleted:v,onPullApplied:N}),t[13]=w,t[14]=n,t[15]=E,t[16]=v,t[17]=r,t[18]=N,t[19]=P):P=t[19];let F;t[20]!==P||t[21]!==M?(F=(0,y.jsx)(o,{className:M,children:P}),t[20]=P,t[21]=M,t[22]=F):F=t[22];let I;return t[23]!==r.phase||t[24]!==F||t[25]!==k||t[26]!==j?(I=(0,y.jsx)(c,{open:!0,onOpenChange:D,children:(0,y.jsxs)(a,{className:`sm:max-w-md`,"data-testid":`share-receive-miss-dialog`,"data-phase":O,"data-verdict":k,children:[j,F]})}),t[23]=r.phase,t[24]=F,t[25]=k,t[26]=j,t[27]=I):I=t[27],I}export{x as ShareReceiveMissDialog};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-BUgB2tll.js";import{n as t,r as n}from"./dist-Nvb76hAm.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{ut as i}from"./dist-Dih2A8fV.js";import{t as a}from"./triangle-alert-BggXGlON.js";var o=r(),s=e();function c(e){return e<1e3?`~${e}`:`~${Math.round(e/100)/10}k`}function l(e){let t=(0,o.c)(15),{tokens:r,budget:i}=e,{_:l}=n(),u=i!==void 0&&r>i,d,f,p,m;if(t[0]!==l||t[1]!==i||t[2]!==u||t[3]!==r){let e=i===void 0?``:c(i);d=u||void 0,f=u?`text-amber-600 dark:text-amber-500`:void 0,t[8]===r?p=t[9]:(p=c(r),t[8]=r,t[9]=p),m=u?(0,s.jsx)(`span`,{role:`img`,"aria-label":l({id:`nem6R7`,values:{budgetLabel:e}}),children:(0,s.jsx)(a,{className:`ms-0.5 inline size-3 align-[-0.1em]`,"aria-hidden":`true`})}):null,t[0]=l,t[1]=i,t[2]=u,t[3]=r,t[4]=d,t[5]=f,t[6]=p,t[7]=m}else d=t[4],f=t[5],p=t[6],m=t[7];let h;return t[10]!==d||t[11]!==f||t[12]!==p||t[13]!==m?(h=(0,s.jsxs)(`span`,{"data-over-budget":d,className:f,children:[p,m]}),t[10]=d,t[11]=f,t[12]=p,t[13]=m,t[14]=h):h=t[14],h}function u(e){let n=(0,o.c)(13),{size:r,omitOnDemand:a}=e,c;n[0]===r.alwaysOn?c=n[1]:(c=(0,s.jsx)(l,{tokens:r.alwaysOn,budget:100}),n[0]=r.alwaysOn,n[1]=c);let u;n[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,s.jsx)(t,{id:`DBqxw2`}),n[2]=u):u=n[2];let d;n[3]===r.onTrigger?d=n[4]:(d=(0,s.jsx)(l,{tokens:r.onTrigger,budget:i}),n[3]=r.onTrigger,n[4]=d);let f;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,s.jsx)(t,{id:`ac8G0O`}),n[5]=f):f=n[5];let p;n[6]!==a||n[7]!==r.onDemand?(p=a?null:(0,s.jsxs)(s.Fragment,{children:[` · `,(0,s.jsx)(l,{tokens:r.onDemand}),` `,(0,s.jsx)(t,{id:`QnnKlV`})]}),n[6]=a,n[7]=r.onDemand,n[8]=p):p=n[8];let m;return n[9]!==c||n[10]!==d||n[11]!==p?(m=(0,s.jsxs)(`span`,{"data-testid":`skill-cost-value`,className:`font-mono text-[13px] text-muted-foreground`,children:[c,` `,u,` · `,d,` `,f,p]}),n[9]=c,n[10]=d,n[11]=p,n[12]=m):m=n[12],m}export{c as n,u as t};
1
+ import{t as e}from"./jsx-runtime-BUgB2tll.js";import{n as t,r as n}from"./dist-Nvb76hAm.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{ut as i}from"./dist-CP7w45uR.js";import{t as a}from"./triangle-alert-BggXGlON.js";var o=r(),s=e();function c(e){return e<1e3?`~${e}`:`~${Math.round(e/100)/10}k`}function l(e){let t=(0,o.c)(15),{tokens:r,budget:i}=e,{_:l}=n(),u=i!==void 0&&r>i,d,f,p,m;if(t[0]!==l||t[1]!==i||t[2]!==u||t[3]!==r){let e=i===void 0?``:c(i);d=u||void 0,f=u?`text-amber-600 dark:text-amber-500`:void 0,t[8]===r?p=t[9]:(p=c(r),t[8]=r,t[9]=p),m=u?(0,s.jsx)(`span`,{role:`img`,"aria-label":l({id:`nem6R7`,values:{budgetLabel:e}}),children:(0,s.jsx)(a,{className:`ms-0.5 inline size-3 align-[-0.1em]`,"aria-hidden":`true`})}):null,t[0]=l,t[1]=i,t[2]=u,t[3]=r,t[4]=d,t[5]=f,t[6]=p,t[7]=m}else d=t[4],f=t[5],p=t[6],m=t[7];let h;return t[10]!==d||t[11]!==f||t[12]!==p||t[13]!==m?(h=(0,s.jsxs)(`span`,{"data-over-budget":d,className:f,children:[p,m]}),t[10]=d,t[11]=f,t[12]=p,t[13]=m,t[14]=h):h=t[14],h}function u(e){let n=(0,o.c)(13),{size:r,omitOnDemand:a}=e,c;n[0]===r.alwaysOn?c=n[1]:(c=(0,s.jsx)(l,{tokens:r.alwaysOn,budget:100}),n[0]=r.alwaysOn,n[1]=c);let u;n[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,s.jsx)(t,{id:`DBqxw2`}),n[2]=u):u=n[2];let d;n[3]===r.onTrigger?d=n[4]:(d=(0,s.jsx)(l,{tokens:r.onTrigger,budget:i}),n[3]=r.onTrigger,n[4]=d);let f;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,s.jsx)(t,{id:`ac8G0O`}),n[5]=f):f=n[5];let p;n[6]!==a||n[7]!==r.onDemand?(p=a?null:(0,s.jsxs)(s.Fragment,{children:[` · `,(0,s.jsx)(l,{tokens:r.onDemand}),` `,(0,s.jsx)(t,{id:`QnnKlV`})]}),n[6]=a,n[7]=r.onDemand,n[8]=p):p=n[8];let m;return n[9]!==c||n[10]!==d||n[11]!==p?(m=(0,s.jsxs)(`span`,{"data-testid":`skill-cost-value`,className:`font-mono text-[13px] text-muted-foreground`,children:[c,` `,u,` · `,d,` `,f,p]}),n[9]=c,n[10]=d,n[11]=p,n[12]=m):m=n[12],m}export{c as n,u as t};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-BUgB2tll.js";import{n as t}from"./dist-Nvb76hAm.js";import{t as n}from"./compiler-runtime-BfE3aGVn.js";import{n as r}from"./AgentIconCluster-B26uigRz.js";import{t as i}from"./button-CA0dewJJ.js";import{t as a}from"./SkillCostValue-D_6C2Gog.js";var o=n(),s=e();function c(e){let n=(0,o.c)(26),{name:c,description:l,hosts:u,size:d,onActivate:f,ariaExpanded:p,control:m}=e,h;n[0]===c?h=n[1]:(h=(0,s.jsx)(`span`,{className:`text-sm font-medium text-foreground group-hover/button:underline`,children:(0,s.jsx)(`code`,{children:c})}),n[0]=c,n[1]=h);let g;n[2]===l?g=n[3]:(g=(0,s.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:l}),n[2]=l,n[3]=g);let _;n[4]!==h||n[5]!==g?(_=(0,s.jsxs)(s.Fragment,{children:[h,g]}),n[4]=h,n[5]=g,n[6]=_):_=n[6];let v=_,y;n[7]!==p||n[8]!==v||n[9]!==f?(y=f?(0,s.jsx)(i,{variant:`ghost`,onClick:f,"aria-expanded":p,className:`group/button h-auto w-full flex-col items-start justify-start gap-0.5 whitespace-normal p-0 text-left hover:bg-transparent`,"data-testid":`skill-consent-row-preview`,children:v}):(0,s.jsx)(`span`,{className:`flex flex-col gap-0.5`,children:v}),n[7]=p,n[8]=v,n[9]=f,n[10]=y):y=n[10];let b;n[11]===u?b=n[12]:(b=u.length>0?(0,s.jsx)(r,{hosts:u}):(0,s.jsx)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`skill-consent-row-no-hosts`,children:(0,s.jsx)(t,{id:`yOjRUV`})}),n[11]=u,n[12]=b);let x;n[13]===d?x=n[14]:(x=d?(0,s.jsx)(a,{size:d,omitOnDemand:!0}):null,n[13]=d,n[14]=x);let S;n[15]!==b||n[16]!==x?(S=(0,s.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[b,x]}),n[15]=b,n[16]=x,n[17]=S):S=n[17];let C;n[18]!==y||n[19]!==S?(C=(0,s.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[y,S]}),n[18]=y,n[19]=S,n[20]=C):C=n[20];let w;n[21]===m?w=n[22]:(w=m?(0,s.jsx)(`span`,{className:`shrink-0`,children:m}):null,n[21]=m,n[22]=w);let T;return n[23]!==C||n[24]!==w?(T=(0,s.jsxs)(`div`,{className:`flex items-start gap-2.5 px-3 py-2.5`,"data-testid":`skill-consent-row`,children:[C,w]}),n[23]=C,n[24]=w,n[25]=T):T=n[25],T}function l(e){let t=(0,o.c)(4),{paths:n}=e,r;t[0]===n?r=t[1]:(r=n.map(u),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,s.jsx)(`ul`,{className:`flex flex-col gap-0.5`,"data-testid":`skill-destination-list`,children:r}),t[2]=r,t[3]=i),i}function u(e){return(0,s.jsx)(`li`,{children:(0,s.jsx)(`code`,{className:`break-all text-xs text-muted-foreground`,children:e})},e)}export{c as n,l as t};
1
+ import{t as e}from"./jsx-runtime-BUgB2tll.js";import{n as t}from"./dist-Nvb76hAm.js";import{t as n}from"./compiler-runtime-BfE3aGVn.js";import{n as r}from"./AgentIconCluster-D_inolLQ.js";import{t as i}from"./button-CA0dewJJ.js";import{t as a}from"./SkillCostValue-C0tQ5Ey6.js";var o=n(),s=e();function c(e){let n=(0,o.c)(26),{name:c,description:l,hosts:u,size:d,onActivate:f,ariaExpanded:p,control:m}=e,h;n[0]===c?h=n[1]:(h=(0,s.jsx)(`span`,{className:`text-sm font-medium text-foreground group-hover/button:underline`,children:(0,s.jsx)(`code`,{children:c})}),n[0]=c,n[1]=h);let g;n[2]===l?g=n[3]:(g=(0,s.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:l}),n[2]=l,n[3]=g);let _;n[4]!==h||n[5]!==g?(_=(0,s.jsxs)(s.Fragment,{children:[h,g]}),n[4]=h,n[5]=g,n[6]=_):_=n[6];let v=_,y;n[7]!==p||n[8]!==v||n[9]!==f?(y=f?(0,s.jsx)(i,{variant:`ghost`,onClick:f,"aria-expanded":p,className:`group/button h-auto w-full flex-col items-start justify-start gap-0.5 whitespace-normal p-0 text-left hover:bg-transparent`,"data-testid":`skill-consent-row-preview`,children:v}):(0,s.jsx)(`span`,{className:`flex flex-col gap-0.5`,children:v}),n[7]=p,n[8]=v,n[9]=f,n[10]=y):y=n[10];let b;n[11]===u?b=n[12]:(b=u.length>0?(0,s.jsx)(r,{hosts:u}):(0,s.jsx)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`skill-consent-row-no-hosts`,children:(0,s.jsx)(t,{id:`yOjRUV`})}),n[11]=u,n[12]=b);let x;n[13]===d?x=n[14]:(x=d?(0,s.jsx)(a,{size:d,omitOnDemand:!0}):null,n[13]=d,n[14]=x);let S;n[15]!==b||n[16]!==x?(S=(0,s.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[b,x]}),n[15]=b,n[16]=x,n[17]=S):S=n[17];let C;n[18]!==y||n[19]!==S?(C=(0,s.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[y,S]}),n[18]=y,n[19]=S,n[20]=C):C=n[20];let w;n[21]===m?w=n[22]:(w=m?(0,s.jsx)(`span`,{className:`shrink-0`,children:m}):null,n[21]=m,n[22]=w);let T;return n[23]!==C||n[24]!==w?(T=(0,s.jsxs)(`div`,{className:`flex items-start gap-2.5 px-3 py-2.5`,"data-testid":`skill-consent-row`,children:[C,w]}),n[23]=C,n[24]=w,n[25]=T):T=n[25],T}function l(e){let t=(0,o.c)(4),{paths:n}=e,r;t[0]===n?r=t[1]:(r=n.map(u),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,s.jsx)(`ul`,{className:`flex flex-col gap-0.5`,"data-testid":`skill-destination-list`,children:r}),t[2]=r,t[3]=i),i}function u(e){return(0,s.jsx)(`li`,{children:(0,s.jsx)(`code`,{className:`break-all text-xs text-muted-foreground`,children:e})},e)}export{c as n,l as t};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-BUgB2tll.js";import{n as t}from"./dist-Nvb76hAm.js";import{t as n}from"./compiler-runtime-BfE3aGVn.js";import{t as r}from"./square-pen-Bybtom5U.js";import{o as i}from"./skill-scope-BmcRzXKj.js";import{t as a}from"./SkillModeBanner-Bi6kEaMZ.js";var o=n(),s=e();function c(e){let n=(0,o.c)(7),{name:c}=e,l;n[0]===c?l=n[1]:(l=i(c),n[0]=c,n[1]=l);let u;n[2]===l?u=n[3]:(u=(0,s.jsx)(`strong`,{className:`font-medium text-foreground`,children:l}),n[2]=l,n[3]=u);let d=u,f;n[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,s.jsx)(r,{className:`size-4`,"aria-hidden":!0}),n[4]=f):f=n[4];let p;return n[5]===d?p=n[6]:(p=(0,s.jsx)(a,{icon:f,children:(0,s.jsx)(t,{id:`i-wHEp`,values:{boldName:d}})}),n[5]=d,n[6]=p),p}export{c as SkillEditBanner};
1
+ import{t as e}from"./jsx-runtime-BUgB2tll.js";import{n as t}from"./dist-Nvb76hAm.js";import{t as n}from"./compiler-runtime-BfE3aGVn.js";import{t as r}from"./square-pen-Bybtom5U.js";import{o as i}from"./skill-scope-C3ZLyDFU.js";import{t as a}from"./SkillModeBanner-Bi6kEaMZ.js";var o=n(),s=e();function c(e){let n=(0,o.c)(7),{name:c}=e,l;n[0]===c?l=n[1]:(l=i(c),n[0]=c,n[1]=l);let u;n[2]===l?u=n[3]:(u=(0,s.jsx)(`strong`,{className:`font-medium text-foreground`,children:l}),n[2]=l,n[3]=u);let d=u,f;n[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,s.jsx)(r,{className:`size-4`,"aria-hidden":!0}),n[4]=f):f=n[4];let p;return n[5]===d?p=n[6]:(p=(0,s.jsx)(a,{icon:f,children:(0,s.jsx)(t,{id:`i-wHEp`,values:{boldName:d}})}),n[5]=d,n[6]=p),p}export{c as SkillEditBanner};
@@ -1,4 +1,4 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{t as s}from"./AgentIconCluster-B26uigRz.js";import{t as c}from"./button-CA0dewJJ.js";import{a as l,r as u}from"./dist-mv8e6dBX.js";import{c as d,o as f}from"./dist-DsLZcVyZ.js";import{i as p,n as m,t as h}from"./tooltip-DPvMEqsq.js";import{_ as g,d as _,f as v,g as y,h as b,l as x,m as S,p as C,u as w,v as T}from"./dialog-nnyEatfT.js";import{C as E,a as D,c as O,d as k,f as A,l as j,p as M,s as N,u as P}from"./terminal-cli-display-CyCGNg1t.js";import{a as F,d as I,f as L,i as R,n as z,o as B,p as ee,u as te}from"./dropdown-menu-BSBcsSE_.js";import{Gt as ne,Qr as V,oo as re}from"./dist-Dih2A8fV.js";import{n as ie}from"./dist-CMZSEMCN2.js";import{s as ae}from"./documents-events-Ck8o2CoI.js";import{t as H}from"./createLucideIcon-NewzmgDg.js";import{t as oe}from"./folder-RQh89IbX.js";import{t as U}from"./spinner-CbcfYaH_.js";import{c as se,n as ce,r as W}from"./skill-scope-BmcRzXKj.js";import{A as G,M as le,S as ue,x as de}from"./skills-api-DYLAW1HV.js";import{t as fe}from"./use-skills-2obCzXwU.js";var K=e(n(),1),q=t(),pe=`AlertDialog`,[me,he]=d(pe,[T]),J=T(),ge=e=>{let{__scopeAlertDialog:t,...n}=e,r=J(t);return(0,q.jsx)(S,{...r,...n,modal:!0})};ge.displayName=pe;var _e=`AlertDialogTrigger`,ve=K.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,q.jsx)(y,{...i,...r,ref:t})});ve.displayName=_e;var ye=`AlertDialogPortal`,be=e=>{let{__scopeAlertDialog:t,...n}=e,r=J(t);return(0,q.jsx)(C,{...r,...n})};be.displayName=ye;var xe=`AlertDialogOverlay`,Se=K.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,q.jsx)(v,{...i,...r,ref:t})});Se.displayName=xe;var Y=`AlertDialogContent`,[Ce,we]=me(Y),Te=u(`AlertDialogContent`),Ee=K.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=J(n),o=K.useRef(null),s=l(t,o),c=K.useRef(null);return(0,q.jsx)(g,{contentName:Y,titleName:De,docsSlug:`alert-dialog`,children:(0,q.jsx)(Ce,{scope:n,cancelRef:c,children:(0,q.jsxs)(w,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:f(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,q.jsx)(Te,{children:r}),(0,q.jsx)(Fe,{contentRef:o})]})})})});Ee.displayName=Y;var De=`AlertDialogTitle`,Oe=K.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,q.jsx)(b,{...i,...r,ref:t})});Oe.displayName=De;var ke=`AlertDialogDescription`,Ae=K.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,q.jsx)(_,{...i,...r,ref:t})});Ae.displayName=ke;var je=`AlertDialogAction`,Me=K.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,q.jsx)(x,{...i,...r,ref:t})});Me.displayName=je;var Ne=`AlertDialogCancel`,Pe=K.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=we(Ne,n),a=J(n),o=l(t,i);return(0,q.jsx)(x,{...a,...r,ref:o})});Pe.displayName=Ne;var Fe=({contentRef:e})=>{let t=`\`${Y}\` requires a description for the component to be accessible for screen reader users.
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{t as s}from"./AgentIconCluster-D_inolLQ.js";import{t as c}from"./button-CA0dewJJ.js";import{a as l,r as u}from"./dist-mv8e6dBX.js";import{c as d,o as f}from"./dist-DsLZcVyZ.js";import{i as p,n as m,t as h}from"./tooltip-DPvMEqsq.js";import{_ as g,d as _,f as v,g as y,h as b,l as x,m as S,p as C,u as w,v as T}from"./dialog-nnyEatfT.js";import{C as E,a as D,c as O,d as k,f as A,l as j,p as M,s as N,u as P}from"./terminal-cli-display-fzswbBoR.js";import{a as F,d as I,f as L,i as R,n as z,o as B,p as ee,u as te}from"./dropdown-menu-BSBcsSE_.js";import{Gt as ne,Qr as V,oo as re}from"./dist-CP7w45uR.js";import{n as ie}from"./dist-CMZSEMCN2.js";import{s as ae}from"./documents-events-DGovPb4Q.js";import{t as H}from"./createLucideIcon-NewzmgDg.js";import{t as oe}from"./folder-RQh89IbX.js";import{t as U}from"./spinner-CbcfYaH_.js";import{c as se,n as ce,r as W}from"./skill-scope-C3ZLyDFU.js";import{A as G,M as le,S as ue,x as de}from"./skills-api-DkJBCb26.js";import{t as fe}from"./use-skills-BrC3Upu3.js";var K=e(n(),1),q=t(),pe=`AlertDialog`,[me,he]=d(pe,[T]),J=T(),ge=e=>{let{__scopeAlertDialog:t,...n}=e,r=J(t);return(0,q.jsx)(S,{...r,...n,modal:!0})};ge.displayName=pe;var _e=`AlertDialogTrigger`,ve=K.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,q.jsx)(y,{...i,...r,ref:t})});ve.displayName=_e;var ye=`AlertDialogPortal`,be=e=>{let{__scopeAlertDialog:t,...n}=e,r=J(t);return(0,q.jsx)(C,{...r,...n})};be.displayName=ye;var xe=`AlertDialogOverlay`,Se=K.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,q.jsx)(v,{...i,...r,ref:t})});Se.displayName=xe;var Y=`AlertDialogContent`,[Ce,we]=me(Y),Te=u(`AlertDialogContent`),Ee=K.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=J(n),o=K.useRef(null),s=l(t,o),c=K.useRef(null);return(0,q.jsx)(g,{contentName:Y,titleName:De,docsSlug:`alert-dialog`,children:(0,q.jsx)(Ce,{scope:n,cancelRef:c,children:(0,q.jsxs)(w,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:f(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,q.jsx)(Te,{children:r}),(0,q.jsx)(Fe,{contentRef:o})]})})})});Ee.displayName=Y;var De=`AlertDialogTitle`,Oe=K.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,q.jsx)(b,{...i,...r,ref:t})});Oe.displayName=De;var ke=`AlertDialogDescription`,Ae=K.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,q.jsx)(_,{...i,...r,ref:t})});Ae.displayName=ke;var je=`AlertDialogAction`,Me=K.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,q.jsx)(x,{...i,...r,ref:t})});Me.displayName=je;var Ne=`AlertDialogCancel`,Pe=K.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=we(Ne,n),a=J(n),o=l(t,i);return(0,q.jsx)(x,{...a,...r,ref:o})});Pe.displayName=Ne;var Fe=({contentRef:e})=>{let t=`\`${Y}\` requires a description for the component to be accessible for screen reader users.
2
2
 
3
3
  You can add a description to the \`${Y}\` by passing a \`${ke}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
4
4
 
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-CA0dewJJ.js";import{i as s,n as c,t as l}from"./tooltip-DPvMEqsq.js";import{a as u,c as d,i as f,n as p,o as m,s as h,t as g}from"./dialog-nnyEatfT.js";import{t as _}from"./switch-DUVQoPKU.js";import{t as v}from"./arrow-up-right-B6g1TsCZ.js";import{t as y}from"./spinner-CbcfYaH_.js";import{t as b}from"./refresh-cw-Dvx1B3fD.js";import{t as x}from"./undo-2-B1iI1RfY.js";import{t as S}from"./use-skill-origin-BwJcy3-O.js";import{t as C}from"./DiffView-CjTilKZT.js";var w=e(n(),1),T=a(),E=t();function D(e){let t=(0,T.c)(31),{open:n,onOpenChange:i,skillName:a,localBody:s,upstreamBody:c,applying:l,onTakeUpstream:_}=e,v;t[0]===a?v=t[1]:(v=(0,E.jsx)(d,{children:(0,E.jsx)(r,{id:`EPKVES`,values:{skillName:a}})}),t[0]=a,t[1]=v);let y;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,E.jsx)(u,{children:(0,E.jsx)(r,{id:`kKw0H3`})}),t[2]=y):y=t[2];let b;t[3]===v?b=t[4]:(b=(0,E.jsxs)(h,{children:[v,y]}),t[3]=v,t[4]=b);let x;t[5]!==s||t[6]!==c?(x=(0,E.jsx)(p,{className:`min-h-0 flex-1 overflow-auto`,children:(0,E.jsx)(C,{oldContent:s,newContent:c,layout:`unified`})}),t[5]=s,t[6]=c,t[7]=x):x=t[7];let S;t[8]===i?S=t[9]:(S=()=>i(!1),t[8]=i,t[9]=S);let w;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,E.jsx)(r,{id:`Tq3pcs`}),t[10]=w):w=t[10];let D;t[11]!==l||t[12]!==S?(D=(0,E.jsx)(o,{variant:`outline`,onClick:S,disabled:l,children:w}),t[11]=l,t[12]=S,t[13]=D):D=t[13];let O;t[14]===l?O=t[15]:(O=l?(0,E.jsx)(r,{id:`JL3si7`}):(0,E.jsx)(r,{id:`qkqG0b`}),t[14]=l,t[15]=O);let k;t[16]!==l||t[17]!==_||t[18]!==O?(k=(0,E.jsx)(o,{onClick:_,disabled:l,children:O}),t[16]=l,t[17]=_,t[18]=O,t[19]=k):k=t[19];let A;t[20]!==D||t[21]!==k?(A=(0,E.jsxs)(m,{children:[D,k]}),t[20]=D,t[21]=k,t[22]=A):A=t[22];let j;t[23]!==A||t[24]!==b||t[25]!==x?(j=(0,E.jsxs)(f,{className:`flex max-h-[85vh] max-w-3xl flex-col`,children:[b,x,A]}),t[23]=A,t[24]=b,t[25]=x,t[26]=j):j=t[26];let M;return t[27]!==i||t[28]!==n||t[29]!==j?(M=(0,E.jsx)(g,{open:n,onOpenChange:i,children:j}),t[27]=i,t[28]=n,t[29]=j,t[30]=M):M=t[30],M}function O(e){let t=(0,T.c)(48),{scope:n,name:a}=e,{_:u}=i(),d;t[0]!==a||t[1]!==n?(d={scope:n,name:a},t[0]=a,t[1]=n,t[2]=d):d=t[2];let{origin:f,github:p,displaySource:m,importedTitle:h,canReimport:g,updateAvailable:C,modified:O,autoUpdate:k,gitTracked:A,setAutoUpdate:j,revertable:M,reimport:N,reimporting:P,previewUpdate:F,revert:I,reverting:L}=S(d),[R,z]=(0,w.useState)(null),B;t[3]!==O||t[4]!==F||t[5]!==N?(B=async function(){if(O){let e=await F();e&&z(e);return}await N()},t[3]=O,t[4]=F,t[5]=N,t[6]=B):B=t[6];let V=B,H;t[7]===N?H=t[8]:(H=async function(){await N(),z(null)},t[7]=N,t[8]=H);let U=H;if(!f)return null;let W;t[9]!==m||t[10]!==p||t[11]!==h?(W=p?(0,E.jsxs)(`a`,{href:p,target:`_blank`,rel:`noreferrer`,title:h??void 0,className:`hidden min-w-0 max-w-48 items-center gap-1 hover:text-foreground @xl/toolbar:flex`,children:[(0,E.jsx)(`span`,{className:`truncate`,children:m}),(0,E.jsx)(v,{className:`size-3 shrink-0`,"aria-hidden":!0})]}):(0,E.jsx)(`span`,{title:h??void 0,className:`hidden min-w-0 max-w-48 truncate @xl/toolbar:inline`,children:m}),t[9]=m,t[10]=p,t[11]=h,t[12]=W):W=t[12];let G;t[13]!==u||t[14]!==k||t[15]!==g||t[16]!==A||t[17]!==j?(G=g?(0,E.jsxs)(l,{children:[(0,E.jsx)(s,{asChild:!0,children:(0,E.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1`,children:[(0,E.jsx)(`label`,{htmlFor:`skill-auto-update-switch`,className:`hidden cursor-pointer @xl/toolbar:inline`,children:(0,E.jsx)(r,{id:`2M0JF6`})}),(0,E.jsx)(_,{id:`skill-auto-update-switch`,checked:k&&!A,disabled:A,onCheckedChange:e=>void j(e===!0),"aria-label":u({id:`o9fPtM`}),className:`scale-75`})]})}),(0,E.jsx)(c,{side:`bottom`,children:A?(0,E.jsx)(r,{id:`vy_VIN`}):k?(0,E.jsx)(r,{id:`vGQxBT`}):(0,E.jsx)(r,{id:`9p_QBN`})})]}):null,t[13]=u,t[14]=k,t[15]=g,t[16]=A,t[17]=j,t[18]=G):G=t[18];let K;t[19]===O?K=t[20]:(K=O?(0,E.jsxs)(l,{children:[(0,E.jsx)(s,{asChild:!0,children:(0,E.jsx)(`span`,{className:`shrink-0 rounded-sm bg-amber-500/15 px-1.5 py-0.5 font-medium text-[11px] text-amber-700 dark:text-amber-400`,children:(0,E.jsx)(r,{id:`tgWuMB`})})}),(0,E.jsx)(c,{side:`bottom`,children:(0,E.jsx)(r,{id:`s0Iold`})})]}):null,t[19]=O,t[20]=K);let q;t[21]!==u||t[22]!==g||t[23]!==O||t[24]!==P||t[25]!==I||t[26]!==M||t[27]!==L?(q=O&&g&&M?(0,E.jsxs)(l,{children:[(0,E.jsx)(o,{variant:`ghost`,size:`sm`,onClick:()=>void I(),disabled:L||P,"aria-label":u({id:`VxLvKE`}),className:`shrink-0 gap-1 text-muted-foreground px-2 text-xs hover:text-foreground`,asChild:!0,children:(0,E.jsxs)(s,{children:[L?(0,E.jsx)(y,{icon:x,className:`size-3`,"aria-hidden":!0}):(0,E.jsx)(x,{className:`size-3`,"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`hidden @xl/toolbar:inline`,children:L?(0,E.jsx)(r,{id:`fIJtam`}):(0,E.jsx)(r,{id:`jJdwCB`})})]})}),(0,E.jsx)(c,{side:`bottom`,children:(0,E.jsx)(r,{id:`XSb9HS`})})]}):null,t[21]=u,t[22]=g,t[23]=O,t[24]=P,t[25]=I,t[26]=M,t[27]=L,t[28]=q):q=t[28];let J;t[29]!==u||t[30]!==g||t[31]!==V||t[32]!==P||t[33]!==L||t[34]!==C?(J=g&&C?(0,E.jsxs)(l,{children:[(0,E.jsx)(o,{variant:`ghost`,size:`sm`,onClick:()=>void V(),disabled:P||L,"aria-label":u({id:`GidGkh`}),className:`shrink-0 gap-1 text-muted-foreground px-2 text-xs hover:text-foreground`,asChild:!0,children:(0,E.jsxs)(s,{children:[P?(0,E.jsx)(y,{icon:b,className:`size-3`,"aria-hidden":!0}):(0,E.jsx)(b,{className:`size-3`,"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`hidden @xl/toolbar:inline`,children:P?(0,E.jsx)(r,{id:`JL3si7`}):(0,E.jsx)(r,{id:`EkH9pt`})})]})}),(0,E.jsx)(c,{side:`bottom`,children:(0,E.jsx)(r,{id:`GidGkh`})})]}):null,t[29]=u,t[30]=g,t[31]=V,t[32]=P,t[33]=L,t[34]=C,t[35]=J):J=t[35];let Y;t[36]!==R||t[37]!==a||t[38]!==U||t[39]!==P?(Y=R?(0,E.jsx)(D,{open:!0,onOpenChange:e=>{e||z(null)},skillName:a,localBody:R.localBody,upstreamBody:R.upstreamBody,applying:P,onTakeUpstream:()=>void U()}):null,t[36]=R,t[37]=a,t[38]=U,t[39]=P,t[40]=Y):Y=t[40];let X;return t[41]!==W||t[42]!==G||t[43]!==K||t[44]!==q||t[45]!==J||t[46]!==Y?(X=(0,E.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-muted-foreground text-xs`,children:[W,G,K,q,J,Y]}),t[41]=W,t[42]=G,t[43]=K,t[44]=q,t[45]=J,t[46]=Y,t[47]=X):X=t[47],X}export{O as SkillOriginInline};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-CA0dewJJ.js";import{i as s,n as c,t as l}from"./tooltip-DPvMEqsq.js";import{a as u,c as d,i as f,n as p,o as m,s as h,t as g}from"./dialog-nnyEatfT.js";import{t as _}from"./switch-DUVQoPKU.js";import{t as v}from"./arrow-up-right-B6g1TsCZ.js";import{t as y}from"./spinner-CbcfYaH_.js";import{t as b}from"./refresh-cw-Dvx1B3fD.js";import{t as x}from"./undo-2-B1iI1RfY.js";import{t as S}from"./use-skill-origin-DbGsYAIW.js";import{t as C}from"./DiffView-CjTilKZT.js";var w=e(n(),1),T=a(),E=t();function D(e){let t=(0,T.c)(31),{open:n,onOpenChange:i,skillName:a,localBody:s,upstreamBody:c,applying:l,onTakeUpstream:_}=e,v;t[0]===a?v=t[1]:(v=(0,E.jsx)(d,{children:(0,E.jsx)(r,{id:`EPKVES`,values:{skillName:a}})}),t[0]=a,t[1]=v);let y;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,E.jsx)(u,{children:(0,E.jsx)(r,{id:`kKw0H3`})}),t[2]=y):y=t[2];let b;t[3]===v?b=t[4]:(b=(0,E.jsxs)(h,{children:[v,y]}),t[3]=v,t[4]=b);let x;t[5]!==s||t[6]!==c?(x=(0,E.jsx)(p,{className:`min-h-0 flex-1 overflow-auto`,children:(0,E.jsx)(C,{oldContent:s,newContent:c,layout:`unified`})}),t[5]=s,t[6]=c,t[7]=x):x=t[7];let S;t[8]===i?S=t[9]:(S=()=>i(!1),t[8]=i,t[9]=S);let w;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,E.jsx)(r,{id:`Tq3pcs`}),t[10]=w):w=t[10];let D;t[11]!==l||t[12]!==S?(D=(0,E.jsx)(o,{variant:`outline`,onClick:S,disabled:l,children:w}),t[11]=l,t[12]=S,t[13]=D):D=t[13];let O;t[14]===l?O=t[15]:(O=l?(0,E.jsx)(r,{id:`JL3si7`}):(0,E.jsx)(r,{id:`qkqG0b`}),t[14]=l,t[15]=O);let k;t[16]!==l||t[17]!==_||t[18]!==O?(k=(0,E.jsx)(o,{onClick:_,disabled:l,children:O}),t[16]=l,t[17]=_,t[18]=O,t[19]=k):k=t[19];let A;t[20]!==D||t[21]!==k?(A=(0,E.jsxs)(m,{children:[D,k]}),t[20]=D,t[21]=k,t[22]=A):A=t[22];let j;t[23]!==A||t[24]!==b||t[25]!==x?(j=(0,E.jsxs)(f,{className:`flex max-h-[85vh] max-w-3xl flex-col`,children:[b,x,A]}),t[23]=A,t[24]=b,t[25]=x,t[26]=j):j=t[26];let M;return t[27]!==i||t[28]!==n||t[29]!==j?(M=(0,E.jsx)(g,{open:n,onOpenChange:i,children:j}),t[27]=i,t[28]=n,t[29]=j,t[30]=M):M=t[30],M}function O(e){let t=(0,T.c)(48),{scope:n,name:a}=e,{_:u}=i(),d;t[0]!==a||t[1]!==n?(d={scope:n,name:a},t[0]=a,t[1]=n,t[2]=d):d=t[2];let{origin:f,github:p,displaySource:m,importedTitle:h,canReimport:g,updateAvailable:C,modified:O,autoUpdate:k,gitTracked:A,setAutoUpdate:j,revertable:M,reimport:N,reimporting:P,previewUpdate:F,revert:I,reverting:L}=S(d),[R,z]=(0,w.useState)(null),B;t[3]!==O||t[4]!==F||t[5]!==N?(B=async function(){if(O){let e=await F();e&&z(e);return}await N()},t[3]=O,t[4]=F,t[5]=N,t[6]=B):B=t[6];let V=B,H;t[7]===N?H=t[8]:(H=async function(){await N(),z(null)},t[7]=N,t[8]=H);let U=H;if(!f)return null;let W;t[9]!==m||t[10]!==p||t[11]!==h?(W=p?(0,E.jsxs)(`a`,{href:p,target:`_blank`,rel:`noreferrer`,title:h??void 0,className:`hidden min-w-0 max-w-48 items-center gap-1 hover:text-foreground @xl/toolbar:flex`,children:[(0,E.jsx)(`span`,{className:`truncate`,children:m}),(0,E.jsx)(v,{className:`size-3 shrink-0`,"aria-hidden":!0})]}):(0,E.jsx)(`span`,{title:h??void 0,className:`hidden min-w-0 max-w-48 truncate @xl/toolbar:inline`,children:m}),t[9]=m,t[10]=p,t[11]=h,t[12]=W):W=t[12];let G;t[13]!==u||t[14]!==k||t[15]!==g||t[16]!==A||t[17]!==j?(G=g?(0,E.jsxs)(l,{children:[(0,E.jsx)(s,{asChild:!0,children:(0,E.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1`,children:[(0,E.jsx)(`label`,{htmlFor:`skill-auto-update-switch`,className:`hidden cursor-pointer @xl/toolbar:inline`,children:(0,E.jsx)(r,{id:`2M0JF6`})}),(0,E.jsx)(_,{id:`skill-auto-update-switch`,checked:k&&!A,disabled:A,onCheckedChange:e=>void j(e===!0),"aria-label":u({id:`o9fPtM`}),className:`scale-75`})]})}),(0,E.jsx)(c,{side:`bottom`,children:A?(0,E.jsx)(r,{id:`vy_VIN`}):k?(0,E.jsx)(r,{id:`vGQxBT`}):(0,E.jsx)(r,{id:`9p_QBN`})})]}):null,t[13]=u,t[14]=k,t[15]=g,t[16]=A,t[17]=j,t[18]=G):G=t[18];let K;t[19]===O?K=t[20]:(K=O?(0,E.jsxs)(l,{children:[(0,E.jsx)(s,{asChild:!0,children:(0,E.jsx)(`span`,{className:`shrink-0 rounded-sm bg-amber-500/15 px-1.5 py-0.5 font-medium text-[11px] text-amber-700 dark:text-amber-400`,children:(0,E.jsx)(r,{id:`tgWuMB`})})}),(0,E.jsx)(c,{side:`bottom`,children:(0,E.jsx)(r,{id:`s0Iold`})})]}):null,t[19]=O,t[20]=K);let q;t[21]!==u||t[22]!==g||t[23]!==O||t[24]!==P||t[25]!==I||t[26]!==M||t[27]!==L?(q=O&&g&&M?(0,E.jsxs)(l,{children:[(0,E.jsx)(o,{variant:`ghost`,size:`sm`,onClick:()=>void I(),disabled:L||P,"aria-label":u({id:`VxLvKE`}),className:`shrink-0 gap-1 text-muted-foreground px-2 text-xs hover:text-foreground`,asChild:!0,children:(0,E.jsxs)(s,{children:[L?(0,E.jsx)(y,{icon:x,className:`size-3`,"aria-hidden":!0}):(0,E.jsx)(x,{className:`size-3`,"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`hidden @xl/toolbar:inline`,children:L?(0,E.jsx)(r,{id:`fIJtam`}):(0,E.jsx)(r,{id:`jJdwCB`})})]})}),(0,E.jsx)(c,{side:`bottom`,children:(0,E.jsx)(r,{id:`XSb9HS`})})]}):null,t[21]=u,t[22]=g,t[23]=O,t[24]=P,t[25]=I,t[26]=M,t[27]=L,t[28]=q):q=t[28];let J;t[29]!==u||t[30]!==g||t[31]!==V||t[32]!==P||t[33]!==L||t[34]!==C?(J=g&&C?(0,E.jsxs)(l,{children:[(0,E.jsx)(o,{variant:`ghost`,size:`sm`,onClick:()=>void V(),disabled:P||L,"aria-label":u({id:`GidGkh`}),className:`shrink-0 gap-1 text-muted-foreground px-2 text-xs hover:text-foreground`,asChild:!0,children:(0,E.jsxs)(s,{children:[P?(0,E.jsx)(y,{icon:b,className:`size-3`,"aria-hidden":!0}):(0,E.jsx)(b,{className:`size-3`,"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`hidden @xl/toolbar:inline`,children:P?(0,E.jsx)(r,{id:`JL3si7`}):(0,E.jsx)(r,{id:`EkH9pt`})})]})}),(0,E.jsx)(c,{side:`bottom`,children:(0,E.jsx)(r,{id:`GidGkh`})})]}):null,t[29]=u,t[30]=g,t[31]=V,t[32]=P,t[33]=L,t[34]=C,t[35]=J):J=t[35];let Y;t[36]!==R||t[37]!==a||t[38]!==U||t[39]!==P?(Y=R?(0,E.jsx)(D,{open:!0,onOpenChange:e=>{e||z(null)},skillName:a,localBody:R.localBody,upstreamBody:R.upstreamBody,applying:P,onTakeUpstream:()=>void U()}):null,t[36]=R,t[37]=a,t[38]=U,t[39]=P,t[40]=Y):Y=t[40];let X;return t[41]!==W||t[42]!==G||t[43]!==K||t[44]!==q||t[45]!==J||t[46]!==Y?(X=(0,E.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-muted-foreground text-xs`,children:[W,G,K,q,J,Y]}),t[41]=W,t[42]=G,t[43]=K,t[44]=q,t[45]=J,t[46]=Y,t[47]=X):X=t[47],X}export{O as SkillOriginInline};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{n as s}from"./AgentIconCluster-B26uigRz.js";import{t as c}from"./button-CA0dewJJ.js";import{D as l,E as u,n as d,r as f,t as p}from"./SkillInstallMenu-y2A7W0zZ.js";import{a as m,c as h,l as g,m as _,o as v,r as y,t as ee,u as b}from"./dropdown-menu-BSBcsSE_.js";import{a as x,i as S,n as C,o as w,r as T,s as E,t as D}from"./select-D_Rn85CT.js";import{a as O,i as k,u as A}from"./skill-actions-BG-1EQmx.js";import{t as j}from"./chevron-down-B9fP_GyP.js";import{t as M}from"./list-plus-BWxtMT1R.js";import{f as N,i as P,t as F}from"./skill-scope-BmcRzXKj.js";import{t as I}from"./use-skills-2obCzXwU.js";var L=a(),R=e(n(),1),z=t();function B(e){let t=(0,L.c)(52),{scope:n,name:a}=e,{_:l}=i(),m=I(),h=k(),g;t[0]!==a||t[1]!==n||t[2]!==m.data||t[3]!==m.status?(g=m.status===`ready`?m.data.find(e=>e.scope===n&&e.name===a):void 0,t[0]=a,t[1]=n,t[2]=m.data,t[3]=m.status,t[4]=g):g=t[4];let v=g,b;t[5]!==v||t[6]!==a||t[7]!==n?(b=v??{scope:n,name:a,path:a,description:``,installed:!1,hosts:[]},t[5]=v,t[6]=a,t[7]=n,t[8]=b):b=t[8];let x=b,[S,C]=(0,R.useState)(!1),w=f(x,h),{installed:T,installing:E,hostSet:D}=w,O=v===void 0&&!T,A;t[9]!==v||t[10]!==D?(A=v?P(v,[...D]):[],t[9]=v,t[10]=D,t[11]=A):A=t[11];let M=A,N;t[12]!==h||t[13]!==x?(N=()=>h.requestFileCreate(x),t[12]=h,t[13]=x,t[14]=N):N=t[14];let F;t[15]===l?F=t[16]:(F=l({id:`leF0i_`}),t[15]=l,t[16]=F);let B;t[17]===l?B=t[18]:(B=l({id:`leF0i_`}),t[17]=l,t[18]=B);let V;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,z.jsx)(u,{className:`size-4`,"aria-hidden":!0}),t[19]=V):V=t[19];let H;t[20]!==N||t[21]!==F||t[22]!==B?(H=(0,z.jsx)(c,{variant:`outline`,size:`icon-sm`,className:`shrink-0 text-muted-foreground`,onClick:N,title:F,"aria-label":B,"data-testid":`skill-editor-new-file`,children:V}),t[20]=N,t[21]=F,t[22]=B,t[23]=H):H=t[23];let U=O?`resolving`:`installed`,W=O?`border-border bg-muted/50 text-muted-foreground`:`border-primary/50 bg-primary/5 text-primary hover:bg-primary/10 hover:text-primary aria-expanded:bg-primary/10 aria-expanded:text-primary`,G;t[24]===W?G=t[25]:(G=o(`h-7 shrink-0 gap-1 rounded-lg border px-2 font-normal text-xs shadow-xs font-mono uppercase`,W),t[24]=W,t[25]=G);let K;t[26]!==M||t[27]!==E||t[28]!==O?(K=E?(0,z.jsx)(r,{id:`b4itZn`}):O?(0,z.jsx)(r,{id:`iKvAeG`}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(r,{id:`eQkgKV`}),(0,z.jsx)(s,{hosts:M,className:`text-muted-foreground`})]}),t[26]=M,t[27]=E,t[28]=O,t[29]=K):K=t[29];let q;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,z.jsx)(j,{className:`size-4 shrink-0 opacity-50`,"aria-hidden":!0}),t[30]=q):q=t[30];let J;t[31]!==E||t[32]!==G||t[33]!==K||t[34]!==U?(J=(0,z.jsx)(_,{asChild:!0,children:(0,z.jsxs)(c,{variant:`outline`,size:`sm`,disabled:E,"data-testid":`skill-install-menu-trigger`,"data-state":U,className:G,children:[K,q]})}),t[31]=E,t[32]=G,t[33]=K,t[34]=U,t[35]=J):J=t[35];let Y;t[36]!==h||t[37]!==x?(Y=e=>h.requestForkResolve(x,e),t[36]=h,t[37]=x,t[38]=Y):Y=t[38];let X;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(X=()=>C(!1),t[39]=X):X=t[39];let Z;t[40]!==x||t[41]!==Y||t[42]!==w?(Z=(0,z.jsx)(y,{align:`end`,className:p,children:(0,z.jsx)(d,{toggles:w,skill:x,onResolveFork:Y,onRunStart:X})}),t[40]=x,t[41]=Y,t[42]=w,t[43]=Z):Z=t[43];let Q;t[44]!==S||t[45]!==J||t[46]!==Z?(Q=(0,z.jsxs)(ee,{open:S,onOpenChange:C,children:[J,Z]}),t[44]=S,t[45]=J,t[46]=Z,t[47]=Q):Q=t[47];let $;return t[48]!==h.dialogs||t[49]!==Q||t[50]!==H?($=(0,z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[H,Q,h.dialogs]}),t[48]=h.dialogs,t[49]=Q,t[50]=H,t[51]=$):$=t[51],$}function V(e){let t=(0,L.c)(21),{value:n,onRequestMove:a,disabled:s,triggerClassName:c}=e,{_:l}=i(),u=N(),d;t[0]===a?d=t[1]:(d=e=>a(e),t[0]=a,t[1]=d);let f;t[2]===l?f=t[3]:(f=l({id:`oCHfGC`}),t[2]=l,t[3]=f);let p;t[4]===c?p=t[5]:(p=o(`w-auto gap-1 text-xs font-mono uppercase`,c),t[4]=c,t[5]=p);let m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,z.jsx)(E,{}),t[6]=m):m=t[6];let h;t[7]!==f||t[8]!==p?(h=(0,z.jsx)(w,{size:`sm`,"aria-label":f,"data-testid":`skill-level-select`,className:p,children:m}),t[7]=f,t[8]=p,t[9]=h):h=t[9];let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,z.jsx)(x,{children:(0,z.jsx)(r,{id:`oCHfGC`})}),t[10]=g):g=t[10];let _;t[11]===u?_=t[12]:(_=F.map(e=>(0,z.jsx)(S,{value:e,children:u[e]},e)),t[11]=u,t[12]=_);let v;t[13]===_?v=t[14]:(v=(0,z.jsx)(C,{align:`end`,children:(0,z.jsxs)(T,{children:[g,_]})}),t[13]=_,t[14]=v);let y;return t[15]!==s||t[16]!==d||t[17]!==h||t[18]!==v||t[19]!==n?(y=(0,z.jsxs)(D,{value:n,onValueChange:d,disabled:s,children:[h,v]}),t[15]=s,t[16]=d,t[17]=h,t[18]=v,t[19]=n,t[20]=y):y=t[20],y}function H(e){let t=(0,L.c)(12),{scope:n,name:r}=e,[i,a]=(0,R.useState)(null),o;t[0]===n?o=t[1]:(o=e=>{e!==n&&a(e)},t[0]=n,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==n?(s=i?{scope:n,name:r,toScope:i}:null,t[2]=r,t[3]=i,t[4]=n,t[5]=s):s=t[5];let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=e=>!e&&a(null),t[6]=c):c=t[6];let l;t[7]===s?l=t[8]:(l=(0,z.jsx)(O,{target:s,onOpenChange:c}),t[7]=s,t[8]=l);let u;return t[9]!==o||t[10]!==l?(u={requestMove:o,dialog:l},t[9]=o,t[10]=l,t[11]=u):u=t[11],u}function U(e){let t=(0,L.c)(45),{scope:n,name:a,showAddPropertyButton:o,onAddProperty:s,problemCount:u,problemMessages:d}=e,{_:f}=i(),p=N(),x;t[0]!==a||t[1]!==n?(x={scope:n,name:a},t[0]=a,t[1]=n,t[2]=x):x=t[2];let S=H(x),C;t[3]!==S.requestMove||t[4]!==n?(C=(0,z.jsx)(V,{value:n,onRequestMove:S.requestMove,triggerClassName:`hidden @xl/toolbar:flex`}),t[3]=S.requestMove,t[4]=n,t[5]=C):C=t[5];let w;t[6]!==a||t[7]!==n?(w=(0,z.jsx)(B,{scope:n,name:a}),t[6]=a,t[7]=n,t[8]=w):w=t[8];let T;t[9]!==C||t[10]!==w?(T=(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[C,w]}),t[9]=C,t[10]=w,t[11]=T):T=t[11];let E;t[12]!==s||t[13]!==u||t[14]!==d||t[15]!==o?(E=o?(0,z.jsx)(A,{onAddProperty:s,problemCount:u,problemMessages:d,className:`hidden @xl/toolbar:inline-flex`}):null,t[12]=s,t[13]=u,t[14]=d,t[15]=o,t[16]=E):E=t[16];let D;t[17]===f?D=t[18]:(D=f({id:`Yzs3QX`}),t[17]=f,t[18]=D);let O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,z.jsx)(l,{className:`size-4`,"aria-hidden":!0}),t[19]=O):O=t[19];let k;t[20]===D?k=t[21]:(k=(0,z.jsx)(_,{asChild:!0,children:(0,z.jsx)(c,{variant:`ghost`,size:`icon`,"aria-label":D,"data-testid":`skill-toolbar-overflow`,className:`@xl/toolbar:hidden`,children:O})}),t[20]=D,t[21]=k);let j;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,z.jsx)(v,{children:(0,z.jsx)(r,{id:`oCHfGC`})}),t[22]=j):j=t[22];let P;t[23]===S?P=t[24]:(P=e=>S.requestMove(e),t[23]=S,t[24]=P);let I;t[25]===p?I=t[26]:(I=F.map(e=>(0,z.jsx)(g,{value:e,children:p[e]},e)),t[25]=p,t[26]=I);let R;t[27]!==n||t[28]!==P||t[29]!==I?(R=(0,z.jsx)(h,{value:n,onValueChange:P,children:I}),t[27]=n,t[28]=P,t[29]=I,t[30]=R):R=t[30];let U;t[31]!==s||t[32]!==o?(U=o?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(b,{}),(0,z.jsxs)(m,{onSelect:s,children:[(0,z.jsx)(M,{}),(0,z.jsx)(r,{id:`81H_23`})]})]}):null,t[31]=s,t[32]=o,t[33]=U):U=t[33];let W;t[34]!==R||t[35]!==U?(W=(0,z.jsxs)(y,{align:`end`,className:`min-w-44`,children:[j,R,U]}),t[34]=R,t[35]=U,t[36]=W):W=t[36];let G;t[37]!==W||t[38]!==k?(G=(0,z.jsxs)(ee,{children:[k,W]}),t[37]=W,t[38]=k,t[39]=G):G=t[39];let K;return t[40]!==S.dialog||t[41]!==G||t[42]!==T||t[43]!==E?(K=(0,z.jsxs)(z.Fragment,{children:[T,E,G,S.dialog]}),t[40]=S.dialog,t[41]=G,t[42]=T,t[43]=E,t[44]=K):K=t[44],K}export{U as SkillToolbarControls};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{n as s}from"./AgentIconCluster-D_inolLQ.js";import{t as c}from"./button-CA0dewJJ.js";import{D as l,E as u,n as d,r as f,t as p}from"./SkillInstallMenu-aKaOX_rG.js";import{a as m,c as h,l as g,m as _,o as v,r as y,t as ee,u as b}from"./dropdown-menu-BSBcsSE_.js";import{a as x,i as S,n as C,o as w,r as T,s as E,t as D}from"./select-D_Rn85CT.js";import{a as O,i as k,u as A}from"./skill-actions-BAWcLPFa.js";import{t as j}from"./chevron-down-B9fP_GyP.js";import{t as M}from"./list-plus-BWxtMT1R.js";import{f as N,i as P,t as F}from"./skill-scope-C3ZLyDFU.js";import{t as I}from"./use-skills-BrC3Upu3.js";var L=a(),R=e(n(),1),z=t();function B(e){let t=(0,L.c)(52),{scope:n,name:a}=e,{_:l}=i(),m=I(),h=k(),g;t[0]!==a||t[1]!==n||t[2]!==m.data||t[3]!==m.status?(g=m.status===`ready`?m.data.find(e=>e.scope===n&&e.name===a):void 0,t[0]=a,t[1]=n,t[2]=m.data,t[3]=m.status,t[4]=g):g=t[4];let v=g,b;t[5]!==v||t[6]!==a||t[7]!==n?(b=v??{scope:n,name:a,path:a,description:``,installed:!1,hosts:[]},t[5]=v,t[6]=a,t[7]=n,t[8]=b):b=t[8];let x=b,[S,C]=(0,R.useState)(!1),w=f(x,h),{installed:T,installing:E,hostSet:D}=w,O=v===void 0&&!T,A;t[9]!==v||t[10]!==D?(A=v?P(v,[...D]):[],t[9]=v,t[10]=D,t[11]=A):A=t[11];let M=A,N;t[12]!==h||t[13]!==x?(N=()=>h.requestFileCreate(x),t[12]=h,t[13]=x,t[14]=N):N=t[14];let F;t[15]===l?F=t[16]:(F=l({id:`leF0i_`}),t[15]=l,t[16]=F);let B;t[17]===l?B=t[18]:(B=l({id:`leF0i_`}),t[17]=l,t[18]=B);let V;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,z.jsx)(u,{className:`size-4`,"aria-hidden":!0}),t[19]=V):V=t[19];let H;t[20]!==N||t[21]!==F||t[22]!==B?(H=(0,z.jsx)(c,{variant:`outline`,size:`icon-sm`,className:`shrink-0 text-muted-foreground`,onClick:N,title:F,"aria-label":B,"data-testid":`skill-editor-new-file`,children:V}),t[20]=N,t[21]=F,t[22]=B,t[23]=H):H=t[23];let U=O?`resolving`:`installed`,W=O?`border-border bg-muted/50 text-muted-foreground`:`border-primary/50 bg-primary/5 text-primary hover:bg-primary/10 hover:text-primary aria-expanded:bg-primary/10 aria-expanded:text-primary`,G;t[24]===W?G=t[25]:(G=o(`h-7 shrink-0 gap-1 rounded-lg border px-2 font-normal text-xs shadow-xs font-mono uppercase`,W),t[24]=W,t[25]=G);let K;t[26]!==M||t[27]!==E||t[28]!==O?(K=E?(0,z.jsx)(r,{id:`b4itZn`}):O?(0,z.jsx)(r,{id:`iKvAeG`}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(r,{id:`eQkgKV`}),(0,z.jsx)(s,{hosts:M,className:`text-muted-foreground`})]}),t[26]=M,t[27]=E,t[28]=O,t[29]=K):K=t[29];let q;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,z.jsx)(j,{className:`size-4 shrink-0 opacity-50`,"aria-hidden":!0}),t[30]=q):q=t[30];let J;t[31]!==E||t[32]!==G||t[33]!==K||t[34]!==U?(J=(0,z.jsx)(_,{asChild:!0,children:(0,z.jsxs)(c,{variant:`outline`,size:`sm`,disabled:E,"data-testid":`skill-install-menu-trigger`,"data-state":U,className:G,children:[K,q]})}),t[31]=E,t[32]=G,t[33]=K,t[34]=U,t[35]=J):J=t[35];let Y;t[36]!==h||t[37]!==x?(Y=e=>h.requestForkResolve(x,e),t[36]=h,t[37]=x,t[38]=Y):Y=t[38];let X;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(X=()=>C(!1),t[39]=X):X=t[39];let Z;t[40]!==x||t[41]!==Y||t[42]!==w?(Z=(0,z.jsx)(y,{align:`end`,className:p,children:(0,z.jsx)(d,{toggles:w,skill:x,onResolveFork:Y,onRunStart:X})}),t[40]=x,t[41]=Y,t[42]=w,t[43]=Z):Z=t[43];let Q;t[44]!==S||t[45]!==J||t[46]!==Z?(Q=(0,z.jsxs)(ee,{open:S,onOpenChange:C,children:[J,Z]}),t[44]=S,t[45]=J,t[46]=Z,t[47]=Q):Q=t[47];let $;return t[48]!==h.dialogs||t[49]!==Q||t[50]!==H?($=(0,z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[H,Q,h.dialogs]}),t[48]=h.dialogs,t[49]=Q,t[50]=H,t[51]=$):$=t[51],$}function V(e){let t=(0,L.c)(21),{value:n,onRequestMove:a,disabled:s,triggerClassName:c}=e,{_:l}=i(),u=N(),d;t[0]===a?d=t[1]:(d=e=>a(e),t[0]=a,t[1]=d);let f;t[2]===l?f=t[3]:(f=l({id:`oCHfGC`}),t[2]=l,t[3]=f);let p;t[4]===c?p=t[5]:(p=o(`w-auto gap-1 text-xs font-mono uppercase`,c),t[4]=c,t[5]=p);let m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,z.jsx)(E,{}),t[6]=m):m=t[6];let h;t[7]!==f||t[8]!==p?(h=(0,z.jsx)(w,{size:`sm`,"aria-label":f,"data-testid":`skill-level-select`,className:p,children:m}),t[7]=f,t[8]=p,t[9]=h):h=t[9];let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,z.jsx)(x,{children:(0,z.jsx)(r,{id:`oCHfGC`})}),t[10]=g):g=t[10];let _;t[11]===u?_=t[12]:(_=F.map(e=>(0,z.jsx)(S,{value:e,children:u[e]},e)),t[11]=u,t[12]=_);let v;t[13]===_?v=t[14]:(v=(0,z.jsx)(C,{align:`end`,children:(0,z.jsxs)(T,{children:[g,_]})}),t[13]=_,t[14]=v);let y;return t[15]!==s||t[16]!==d||t[17]!==h||t[18]!==v||t[19]!==n?(y=(0,z.jsxs)(D,{value:n,onValueChange:d,disabled:s,children:[h,v]}),t[15]=s,t[16]=d,t[17]=h,t[18]=v,t[19]=n,t[20]=y):y=t[20],y}function H(e){let t=(0,L.c)(12),{scope:n,name:r}=e,[i,a]=(0,R.useState)(null),o;t[0]===n?o=t[1]:(o=e=>{e!==n&&a(e)},t[0]=n,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==n?(s=i?{scope:n,name:r,toScope:i}:null,t[2]=r,t[3]=i,t[4]=n,t[5]=s):s=t[5];let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=e=>!e&&a(null),t[6]=c):c=t[6];let l;t[7]===s?l=t[8]:(l=(0,z.jsx)(O,{target:s,onOpenChange:c}),t[7]=s,t[8]=l);let u;return t[9]!==o||t[10]!==l?(u={requestMove:o,dialog:l},t[9]=o,t[10]=l,t[11]=u):u=t[11],u}function U(e){let t=(0,L.c)(45),{scope:n,name:a,showAddPropertyButton:o,onAddProperty:s,problemCount:u,problemMessages:d}=e,{_:f}=i(),p=N(),x;t[0]!==a||t[1]!==n?(x={scope:n,name:a},t[0]=a,t[1]=n,t[2]=x):x=t[2];let S=H(x),C;t[3]!==S.requestMove||t[4]!==n?(C=(0,z.jsx)(V,{value:n,onRequestMove:S.requestMove,triggerClassName:`hidden @xl/toolbar:flex`}),t[3]=S.requestMove,t[4]=n,t[5]=C):C=t[5];let w;t[6]!==a||t[7]!==n?(w=(0,z.jsx)(B,{scope:n,name:a}),t[6]=a,t[7]=n,t[8]=w):w=t[8];let T;t[9]!==C||t[10]!==w?(T=(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[C,w]}),t[9]=C,t[10]=w,t[11]=T):T=t[11];let E;t[12]!==s||t[13]!==u||t[14]!==d||t[15]!==o?(E=o?(0,z.jsx)(A,{onAddProperty:s,problemCount:u,problemMessages:d,className:`hidden @xl/toolbar:inline-flex`}):null,t[12]=s,t[13]=u,t[14]=d,t[15]=o,t[16]=E):E=t[16];let D;t[17]===f?D=t[18]:(D=f({id:`Yzs3QX`}),t[17]=f,t[18]=D);let O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,z.jsx)(l,{className:`size-4`,"aria-hidden":!0}),t[19]=O):O=t[19];let k;t[20]===D?k=t[21]:(k=(0,z.jsx)(_,{asChild:!0,children:(0,z.jsx)(c,{variant:`ghost`,size:`icon`,"aria-label":D,"data-testid":`skill-toolbar-overflow`,className:`@xl/toolbar:hidden`,children:O})}),t[20]=D,t[21]=k);let j;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,z.jsx)(v,{children:(0,z.jsx)(r,{id:`oCHfGC`})}),t[22]=j):j=t[22];let P;t[23]===S?P=t[24]:(P=e=>S.requestMove(e),t[23]=S,t[24]=P);let I;t[25]===p?I=t[26]:(I=F.map(e=>(0,z.jsx)(g,{value:e,children:p[e]},e)),t[25]=p,t[26]=I);let R;t[27]!==n||t[28]!==P||t[29]!==I?(R=(0,z.jsx)(h,{value:n,onValueChange:P,children:I}),t[27]=n,t[28]=P,t[29]=I,t[30]=R):R=t[30];let U;t[31]!==s||t[32]!==o?(U=o?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(b,{}),(0,z.jsxs)(m,{onSelect:s,children:[(0,z.jsx)(M,{}),(0,z.jsx)(r,{id:`81H_23`})]})]}):null,t[31]=s,t[32]=o,t[33]=U):U=t[33];let W;t[34]!==R||t[35]!==U?(W=(0,z.jsxs)(y,{align:`end`,className:`min-w-44`,children:[j,R,U]}),t[34]=R,t[35]=U,t[36]=W):W=t[36];let G;t[37]!==W||t[38]!==k?(G=(0,z.jsxs)(ee,{children:[k,W]}),t[37]=W,t[38]=k,t[39]=G):G=t[39];let K;return t[40]!==S.dialog||t[41]!==G||t[42]!==T||t[43]!==E?(K=(0,z.jsxs)(z.Fragment,{children:[T,E,G,S.dialog]}),t[40]=S.dialog,t[41]=G,t[42]=T,t[43]=E,t[44]=K):K=t[44],K}export{U as SkillToolbarControls};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-CA0dewJJ.js";import{i as s,n as c,t as l}from"./tooltip-DPvMEqsq.js";import{hn as u}from"./dist-Dih2A8fV.js";import{t as d}from"./trace-api-18gcBe0u.js";import{n as f}from"./dist-CMZSEMCN2.js";import{n as p,t as m}from"./workspace-paths-cI9sw7pJ.js";import{t as h}from"./use-workspace-D9PQP2Ka.js";import{t as g}from"./createLucideIcon-NewzmgDg.js";var _=g(`presentation`,[[`path`,{d:`M2 3h20`,key:`91anmk`}],[`path`,{d:`M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3`,key:`2k9sn8`}],[`path`,{d:`m7 21 5-5 5 5`,key:`bip4we`}]]),v=e(n(),1),y=a(),b=`open-knowledge-app`;function x(e){try{d.getTracer(b).startSpan(e).end()}catch(e){console.warn(`[slides-telemetry] span emit failed:`,e instanceof Error?e:String(e))}}function S(){x(`ok.slides.opened`)}function C(e,t){return e[t]===!0}function w(e,t){let n=(0,y.c)(7),r;n[0]!==t||n[1]!==e?(r=()=>{let n=u(e),r=C(n.current().map,t);return n.dispose(),r},n[0]=t,n[1]=e,n[2]=r):r=n[2];let[i,a]=(0,v.useState)(r),o,s;return n[3]!==t||n[4]!==e?(o=()=>{let n=u(e);a(C(n.current().map,t));let r=n.subscribe(e=>{a(C(e.map,t))});return()=>{r(),n.dispose()}},s=[e,t],n[3]=t,n[4]=e,n[5]=o,n[6]=s):(o=n[5],s=n[6]),(0,v.useEffect)(o,s),i}var T=t();function E(e){let t=(0,y.c)(3),[n,r]=(0,v.useState)(`pending`),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e)return;let t=!0,n=0,i=!1,a=()=>{n=Date.now();let e=window.okDesktop?.slides;if(e==null){r(`unavailable`);return}e.status().then(e=>{t&&(r(e.available?`available`:`unavailable`),e.available&&(i=!0))}).catch(e=>{console.warn(`[slides] availability probe failed:`,e instanceof Error?e:String(e)),t&&r(`unavailable`)})},o=()=>{i||Date.now()-n<1e4||a()};return a(),window.addEventListener(`focus`,o),()=>{t=!1,window.removeEventListener(`focus`,o)}},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,v.useEffect)(i,a),n}function D(e){let t=(0,y.c)(13),{provider:n,docName:a}=e,{_:u}=i(),d=w(n,`slides`),g=E(d),v=h();if(!d||g!==`available`)return null;let b;t[0]!==u||t[1]!==a||t[2]!==v?(b=async function(){let e=window.okDesktop?.slides;if(e==null||v==null)return;S();let t=p(v.contentDir,m(a),v.pathSeparator);try{let n=await e.open(t);if(!n.ok){let e;bb36:switch(n.reason){case`timeout`:e=u({id:`NeY1Np`});break bb36;case`exited-early`:e=u({id:`Lm3r51`});break bb36;case`unsupported-server`:e=u({id:`T_j5G0`});break bb36;case`spawn-error`:e=u({id:`TBfy1C`});break bb36;case`not-available`:case`invalid-path`:e=u({id:`X59Fx2`});break bb36;default:e=u({id:`X59Fx2`})}f.error(e)}}catch(e){let t=e;console.warn(`[slides] open dispatch failed:`,t instanceof Error?t:String(t)),f.error(u({id:`X59Fx2`}))}},t[0]=u,t[1]=a,t[2]=v,t[3]=b):b=t[3];let x=b,C;t[4]===u?C=t[5]:(C=u({id:`w52SKa`}),t[4]=u,t[5]=C);let D;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,T.jsx)(s,{children:(0,T.jsx)(_,{"aria-hidden":!0})}),t[6]=D):D=t[6];let O;t[7]!==x||t[8]!==C?(O=(0,T.jsx)(o,{variant:`ghost`,size:`icon`,onClick:x,"aria-label":C,"data-testid":`slides-toolbar-action`,asChild:!0,children:D}),t[7]=x,t[8]=C,t[9]=O):O=t[9];let k;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,T.jsx)(c,{side:`bottom`,children:(0,T.jsx)(r,{id:`w52SKa`})}),t[10]=k):k=t[10];let A;return t[11]===O?A=t[12]:(A=(0,T.jsxs)(l,{children:[O,k]}),t[11]=O,t[12]=A),A}export{D as SlidesToolbarControls};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-CA0dewJJ.js";import{i as s,n as c,t as l}from"./tooltip-DPvMEqsq.js";import{hn as u}from"./dist-CP7w45uR.js";import{t as d}from"./trace-api-18gcBe0u.js";import{n as f}from"./dist-CMZSEMCN2.js";import{n as p,t as m}from"./workspace-paths-cI9sw7pJ.js";import{t as h}from"./use-workspace-CFSG46RY.js";import{t as g}from"./createLucideIcon-NewzmgDg.js";var _=g(`presentation`,[[`path`,{d:`M2 3h20`,key:`91anmk`}],[`path`,{d:`M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3`,key:`2k9sn8`}],[`path`,{d:`m7 21 5-5 5 5`,key:`bip4we`}]]),v=e(n(),1),y=a(),b=`open-knowledge-app`;function x(e){try{d.getTracer(b).startSpan(e).end()}catch(e){console.warn(`[slides-telemetry] span emit failed:`,e instanceof Error?e:String(e))}}function S(){x(`ok.slides.opened`)}function C(e,t){return e[t]===!0}function w(e,t){let n=(0,y.c)(7),r;n[0]!==t||n[1]!==e?(r=()=>{let n=u(e),r=C(n.current().map,t);return n.dispose(),r},n[0]=t,n[1]=e,n[2]=r):r=n[2];let[i,a]=(0,v.useState)(r),o,s;return n[3]!==t||n[4]!==e?(o=()=>{let n=u(e);a(C(n.current().map,t));let r=n.subscribe(e=>{a(C(e.map,t))});return()=>{r(),n.dispose()}},s=[e,t],n[3]=t,n[4]=e,n[5]=o,n[6]=s):(o=n[5],s=n[6]),(0,v.useEffect)(o,s),i}var T=t();function E(e){let t=(0,y.c)(3),[n,r]=(0,v.useState)(`pending`),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e)return;let t=!0,n=0,i=!1,a=()=>{n=Date.now();let e=window.okDesktop?.slides;if(e==null){r(`unavailable`);return}e.status().then(e=>{t&&(r(e.available?`available`:`unavailable`),e.available&&(i=!0))}).catch(e=>{console.warn(`[slides] availability probe failed:`,e instanceof Error?e:String(e)),t&&r(`unavailable`)})},o=()=>{i||Date.now()-n<1e4||a()};return a(),window.addEventListener(`focus`,o),()=>{t=!1,window.removeEventListener(`focus`,o)}},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,v.useEffect)(i,a),n}function D(e){let t=(0,y.c)(13),{provider:n,docName:a}=e,{_:u}=i(),d=w(n,`slides`),g=E(d),v=h();if(!d||g!==`available`)return null;let b;t[0]!==u||t[1]!==a||t[2]!==v?(b=async function(){let e=window.okDesktop?.slides;if(e==null||v==null)return;S();let t=p(v.contentDir,m(a),v.pathSeparator);try{let n=await e.open(t);if(!n.ok){let e;bb36:switch(n.reason){case`timeout`:e=u({id:`NeY1Np`});break bb36;case`exited-early`:e=u({id:`Lm3r51`});break bb36;case`unsupported-server`:e=u({id:`T_j5G0`});break bb36;case`spawn-error`:e=u({id:`TBfy1C`});break bb36;case`not-available`:case`invalid-path`:e=u({id:`X59Fx2`});break bb36;default:e=u({id:`X59Fx2`})}f.error(e)}}catch(e){let t=e;console.warn(`[slides] open dispatch failed:`,t instanceof Error?t:String(t)),f.error(u({id:`X59Fx2`}))}},t[0]=u,t[1]=a,t[2]=v,t[3]=b):b=t[3];let x=b,C;t[4]===u?C=t[5]:(C=u({id:`w52SKa`}),t[4]=u,t[5]=C);let D;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,T.jsx)(s,{children:(0,T.jsx)(_,{"aria-hidden":!0})}),t[6]=D):D=t[6];let O;t[7]!==x||t[8]!==C?(O=(0,T.jsx)(o,{variant:`ghost`,size:`icon`,onClick:x,"aria-label":C,"data-testid":`slides-toolbar-action`,asChild:!0,children:D}),t[7]=x,t[8]=C,t[9]=O):O=t[9];let k;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,T.jsx)(c,{side:`bottom`,children:(0,T.jsx)(r,{id:`w52SKa`})}),t[10]=k):k=t[10];let A;return t[11]===O?A=t[12]:(A=(0,T.jsxs)(l,{children:[O,k]}),t[11]=O,t[12]=A),A}export{D as SlidesToolbarControls};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{B as n,Dt as r,H as i,U as a,W as o,an as s,ct as c,ft as l,j as u,kt as d,ot as ee,pt as f,un as p}from"./DocumentContext-DC_8e-cY.js";import{t as m}from"./react-f2sANaYj.js";import{n as h}from"./dist-PQ5KMVDh.js";import{t as g}from"./compiler-runtime-BfE3aGVn.js";import{A as _,O as te,S as v,a as ne,i as re,o as ie}from"./CodeMirrorPropInput-BIdbAIO5.js";import{Eo as y,T as ae,Wi as oe,go as b,ti as x,uo as S}from"./dist-Dih2A8fV.js";import{h as se}from"./use-apply-config-color-theme-DonBpBNY.js";import{H as C,L as ce,M as le,O as ue,P as de,S as w,d as T,f as fe,i as pe,j as me,l as he,r as ge,t as _e,w as E}from"./typing-burst-detector-BySvqCzC.js";import{f as D,g as O}from"./doc-paths-DqJ_A_s7.js";import{J as k}from"./navigation-targets-Qu3klKbE.js";import"./config-provider-Wm9R6Y25.js";import{$ as A,D as j,Dt as M,F as N,It as P,Lt as F,Ot as I,Pt as L,Y as R,Z as z,b as B,ct as V,ft as H,g as U,gt as W,ht as ve,it as G,kt as ye,l as K,lt as q,nt as J,pt as Y,rt as X,ut as Z,v as be}from"./dist-CXdEP5f6.js";import{a as xe,n as Se}from"./cm-theme-BrrFA0kJ.js";import{i as Ce,n as we,o as Te,r as Ee}from"./dist-CB8Y80Th.js";import{o as De,r as Oe}from"./selection-context-DaLbLtKV.js";import{l as ke}from"./lint-config-client-Bpxmt15J.js";import{a as Ae,i as je,n as Me,o as Ne,r as Pe,s as Fe,t as Ie}from"./dist-BUJTePn0.js";import{n as Le,t as Re}from"./src-_CcgHCm_.js";var Q=e(m(),1),ze=g();function Be(){let e=o();return e===null?null:new Set(e.keys())}function Ve(e,t,r){let i=[],a=N(e);if(r!=null){let n=[];for(let{from:e,to:r}of t)a.iterate({from:e,to:r,enter(e){if(e.name===`InlineCode`||e.name===`FencedCode`)return n.push({from:e.from,to:e.to}),!1}});let o=(e,t)=>n.some(n=>e>=n.from&&t<=n.to);for(let{from:n,to:a}of t){let t=e.doc.sliceString(n,a);b.lastIndex=0;for(let e=b.exec(t);e!==null;e=b.exec(t)){let t=e[2];if(!y(t))continue;let a=n+(e.index??0)+e[1].length,s=a+t.length+1;o(a,s)||i.push(R.mark({class:r.has(t)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":t}}).range(a,s))}}}for(let{from:o,to:s}of t)a.iterate({from:o,to:s,enter(t){if(t.name!==`InlineCode`)return;let a=e.doc.sliceString(t.from,t.to),o=a.length-a.replace(/^`+/,``).length,s=a.length-a.replace(/`+$/,``).length,c=a.slice(o,a.length-s),l=/^\/([a-z0-9][a-z0-9-]{1,63})$/.exec(c)?.[1];if(l!==void 0&&y(l)&&r!=null)return i.push(R.mark({class:r.has(l)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":l}}).range(t.from+o,t.to-s)),!1;let u=n.exec(c);if(u)return i.push(R.mark({class:`cm-skill-path-link`,attributes:{"data-skill-path":u[1]}}).range(t.from+o,t.to-s)),!1}});return i.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),R.set(i)}function He(e){let t=a(e);return t===null?[]:[A.fromClass(class{decorations;constructor(e){this.decorations=Ve(e.state,e.visibleRanges,Be())}update(e){(e.docChanged||e.viewportChanged||N(e.startState)!==N(e.state))&&(this.decorations=Ve(e.view.state,e.view.visibleRanges,Be()))}},{decorations:e=>e.decorations}),z.domEventHandlers({mousedown(n){let r=n.target?.closest?.(`[data-skill-ref]`),a=r instanceof HTMLElement?r.dataset.skillRef:void 0;if(a!==void 0){n.preventDefault();let e=o()?.get(a);return window.location.hash=e===void 0?O():D(k({scope:e.scope,name:a,path:e.path})),!0}let s=n.target?.closest?.(`.cm-skill-path-link`),c=s instanceof HTMLElement?s.dataset.skillPath:void 0;return c===void 0?!1:(n.preventDefault(),window.location.hash=i(t,e,c),!0)}})]}var Ue=R.line({attributes:{dir:`auto`}});function We(e){let t=new L;for(let n of e.visibleRanges)for(let r=n.from;r<=n.to;){let n=e.state.doc.lineAt(r);t.add(n.from,n.from,Ue),r=n.to+1}return t.finish()}var Ge=A.fromClass(class{decorations;constructor(e){this.decorations=We(e)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=We(e.view))}},{decorations:e=>e.decorations}),Ke=[z.perLineTextDirection.of(!0),Ge],qe=new Set([`Link`,`Image`,`HTMLTag`,`HTMLBlock`]),Je=`cm-lint-local-target`;function Ye(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function Xe(e,t){let n=U(e,t+1,100);if(n){let e=n.resolveInner(t,1);for(;e;){if(qe.has(e.name))return{from:e.from,to:e.to};e=e.parent}}return{from:t,to:t}}function Ze(e){return e===`error`?`error`:e===`info`?`info`:`warning`}function Qe(e,t){let n=e.doc,r=[];for(let i of t){if(i.source!==`links`)continue;let t=Xe(e,Ye(n,i.range.start));r.push({from:t.from,to:Math.max(t.to,t.from),severity:Ze(i.severity),message:E(i),source:`${i.source}/${i.code}`,markClass:Je})}return r}var $e=P.define();function et(e){let t={findings:[]};return[je(e=>te()?Qe(e.state,t.findings):[],{delay:300,needsRefresh:e=>e.transactions.some(e=>e.effects.some(e=>e.is($e)))}),A.define(n=>{let r=e=>{t.findings=e,n.dispatch({effects:$e.of(null)}),Ie(n)},i=w(e,e=>{e.status===`loaded`&&r(e.findings)}),a=_(()=>r(t.findings));return{destroy(){i(),a()}}})]}function tt(e,t){return e.enabled?[Me(),je(async n=>nt(n.state.doc,await x(n.state.doc.toString(),e,t)),{delay:600})]:[]}function $(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function nt(e,t){let n=[];for(let r of t){let t=$(e,r.range.start),i=$(e,r.range.end),a={from:t,to:Math.max(i,t),severity:r.severity,message:r.message,source:`${r.source}/${r.code}`},o=rt(r);o&&(a.actions=[o]),n.push(a)}return n}function rt(e){let t=e.fixes;return!t||t.length===0?null:{name:`Fix`,apply(e){let n=e.state.doc;e.dispatch({changes:t.map(e=>({from:$(n,e.range.start),to:$(n,e.range.end),insert:e.newText})),userEvent:`input.complete`})}}}var it=[Y(),q(),Z(),be(),X(),G(),ye.allowMultipleSelections.of(!0),j(),K(),Ee(),we(),W(),J(),V(),Ae(),H.of([...Ce,...Se,...Fe,...B,...Te,...Pe])],at=R.mark({class:`cm-link-ref-broken`}),ot=/^\s{0,3}\[([^\]]+)\]:\s/,st=/\[([^\]]*)\]\[([^\]]*)\]/g,ct=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function lt(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 ut(e){let t=[];return N(e).iterate({enter(e){if(ct.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function dt(e){let t=new Set,n=[],r=e.doc,i=ut(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(lt(n.from,i))continue;let a=ot.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!lt(t.from,i)&&!ot.test(t.text))for(st.lastIndex=0;;){let e=st.exec(t.text);if(!e)break;let r=t.from+e.index;if(lt(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(at.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),R.set(a)}var ft=F.define({create(e){return dt(e)},update(e,t){return t.docChanged?dt(t.state):e},provide:e=>z.decorations.from(e)}),pt=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,mt=R.mark({class:`cm-del`}),ht=R.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),gt=R.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function _t(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function vt(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!S.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(S.test(r.text))return{from:t.from,to:r.to}}return null}function yt(e,t){let n=[],r=N(e),i=vt(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(mt.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=pt.exec(r.text),a=i?i[1].length:2,o=R.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=_t(r.text),a=R.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(ht.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(gt.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(gt.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),R.set(n)}var bt=class{decorations;constructor(e){this.decorations=yt(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||N(e.startState)!==N(e.state))&&(this.decorations=yt(e.view.state,e.view.visibleRanges))}},xt=A.fromClass(bt,{decorations:e=>e.decorations});function St(){return[xt,ft]}var Ct=t(),wt=P.define();function Tt(e,t,n){let r=T(e.state.doc)[t.index];r&&p(n,()=>{e.dispatch({selection:I.cursor(r.from),effects:z.scrollIntoView(r.from,{y:`start`})}),e.focus()})}function Et(e,t,n,r){requestAnimationFrame(()=>{if(!n())return;let i=e.state.doc,a=Math.min(t.offset,i.length);p(r,()=>{e.dispatch({selection:I.cursor(a),effects:z.scrollIntoView(a,{y:`center`})}),e.focus()})})}function Dt(e,t,n){let r=e.state.doc,i=Math.min(Math.max(t.line,1),r.lines),a=r.line(i),o=Math.min(a.from+Math.max(0,t.column-1),a.to);p(n,()=>{e.dispatch({selection:I.cursor(o),effects:z.scrollIntoView(o,{y:`start`})}),e.focus()})}function Ot(e){let t=(0,ze.c)(50),{docName:n,ytext:i,provider:a,placeholder:o,isSourceModeActive:p}=e,m=(0,Q.useRef)(null),g=(0,Q.useRef)(null),[_,te]=(0,Q.useState)(null);if(_)throw _;let{resolvedTheme:v}=h(),{merged:y}=se(),b=(0,Q.useRef)(p),x=y?.editor?.wordWrap??!0,{data:S}=ke(n),C;t[0]!==S?.effective||t[1]!==y?(C=S?.effective??(y?.contentRules?oe(y.contentRules):ae),t[0]=S?.effective,t[1]=y,t[2]=C):C=t[2];let w=C,T;t[3]===w?T=t[4]:(T=JSON.stringify(w),t[3]=w,t[4]=T);let E=T,D,O;t[5]===p?(D=t[6],O=t[7]):(D=()=>{b.current=p},O=[p],t[5]=p,t[6]=D,t[7]=O),(0,Q.useEffect)(D,O);let k=(0,Q.useRef)(null),A;t[8]!==n||t[9]!==w||t[10]!==o||t[11]!==a||t[12]!==v||t[13]!==x||t[14]!==i?(A=()=>{let e=m.current;if(!e)return;let t=a.configuration.name??``,p,h=At;try{p=l({docName:t,container:e,sizeStats:{viewCount:0,bytes:i.length},factory:e=>{let r=null,l=u({ydoc:a.document,ytext:i,docName:t}),d=new M,f=new M,p=new M,m=new M,g=new z({state:ye.create({doc:i.toString(),extensions:[it,Ke,Ne({scrollToMatch:e=>s(t)?z.scrollIntoView(e,{y:`start`}):wt.of(null)}),H.of([xe]),Re(i,a.awareness),H.of(Le),...re({themeCompartment:d,resolvedTheme:v,ydoc:a.document,wordWrapCompartment:f,wordWrap:x,currentDocName:t}),St(),He(t),ce(),m.of(tt(w,n)),et(n),l,z.updateListener.of(e=>{ee(e)&&c(t)}),z.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(r!==null&&clearTimeout(r),r=setTimeout(()=>{r=null,ge(t,`source`,pe(e.view)),Oe(t,`source`,De(e.view,t))},120))}),p.of(ve(o??``)),z.theme({"&":{height:`100%`}}),z.scrollMargins.of(kt)]}),parent:e});ge(t,`source`,pe(g)),Oe(t,`source`,De(g,t));let _=g.contentDOM;return _.addEventListener(`keydown`,h),_.addEventListener(`paste`,h),_.addEventListener(`drop`,h),_.addEventListener(`cut`,h),{view:g,ydoc:a.document,ytext:i,provider:a,themeCompartment:d,wordWrapCompartment:f,placeholderCompartment:p,lintCompartment:m}}}),k.current=p,g.current=p.view,r(n,p.view),_e()&&p.view.focus()}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),k.current=null,g.current=null,te(t instanceof Error?t:Error(String(t)))}return()=>{let e=k.current;e&&(f(e),d(n,e.view)),k.current=null,g.current=null}},t[8]=n,t[9]=w,t[10]=o,t[11]=a,t[12]=v,t[13]=x,t[14]=i,t[15]=A):A=t[15];let j;t[16]!==a||t[17]!==i?(j=[i,a],t[16]=a,t[17]=i,t[18]=j):j=t[18],(0,Q.useEffect)(A,j);let N,P;t[19]===n?(N=t[20],P=t[21]):(N=()=>{},P=[n],t[19]=n,t[20]=N,t[21]=P),(0,Q.useEffect)(N,P);let F,I;t[22]===v?(F=t[23],I=t[24]):(I=()=>{let e=k.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(v===`dark`?ne:ie)})},F=[v],t[22]=v,t[23]=F,t[24]=I),(0,Q.useEffect)(I,F);let L,R;t[25]===x?(L=t[26],R=t[27]):(L=()=>{let e=k.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(x?z.lineWrapping:[])})},R=[x],t[25]=x,t[26]=L,t[27]=R),(0,Q.useEffect)(L,R);let B,V;t[28]===o?(B=t[29],V=t[30]):(B=()=>{let e=k.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(ve(o??``))})},V=[o],t[28]=o,t[29]=B,t[30]=V),(0,Q.useEffect)(B,V);let U;t[31]!==n||t[32]!==w?(U=()=>{let e=k.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(tt(w,n))})},t[31]=n,t[32]=w,t[33]=U):U=t[33];let W;t[34]===E?W=t[35]:(W=[E],t[34]=E,t[35]=W),(0,Q.useEffect)(U,W);let G,K;t[36]!==n||t[37]!==p?(G=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||t.mode!==`source`||!p)return;let r=g.current;r&&(Tt(r,t,n),me(n))};return window.addEventListener(he,e),()=>window.removeEventListener(he,e)},K=[n,p],t[36]=n,t[37]=p,t[38]=G,t[39]=K):(G=t[38],K=t[39]),(0,Q.useEffect)(G,K);let q,J;t[40]!==n||t[41]!==p?(q=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||!p)return;let r=g.current;r&&(Dt(r,t,n),me(n))};return window.addEventListener(fe,e),()=>window.removeEventListener(fe,e)},J=[n,p],t[40]=n,t[41]=p,t[42]=q,t[43]=J):(q=t[42],J=t[43]),(0,Q.useEffect)(q,J);let Y,X;t[44]!==n||t[45]!==p||t[46]!==a?(Y=()=>{if(!p)return;let e=g.current;if(!e)return;let t=de(n);if(!t)return;if(t.kind!==`selection-offset`){le(n),t.kind===`outline`?Tt(e,t.detail,n):t.kind===`lint`?Dt(e,t.detail,n):t.kind===`raw-mdx`&&Et(e,t.detail,()=>b.current,n);return}let r=!1,i=null;return queueMicrotask(()=>{if(r)return;let t=de(n);t?.kind===`selection-offset`&&(i=ue({view:e,docName:n,navigation:t,ydoc:a.document,transition:{from:`wysiwyg`,to:`source`}}),i&&le(n))}),()=>{r=!0,i?.cancel(`mode-flip`)}},X=[n,p,a],t[44]=n,t[45]=p,t[46]=a,t[47]=Y,t[48]=X):(Y=t[47],X=t[48]),(0,Q.useEffect)(Y,X);let Z;return t[49]===Symbol.for(`react.memo_cache_sentinel`)?(Z=(0,Ct.jsx)(`div`,{ref:m,className:`source-editor h-full pb-3`}),t[49]=Z):Z=t[49],Z}function kt(){return{top:C()}}function At(){return v()}export{Ot as SourceEditor,Et as applyRawMdxNavigation};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{B as n,Dt as r,H as i,U as a,W as o,an as s,ct as c,ft as l,j as u,kt as d,ot as ee,pt as f,un as p}from"./DocumentContext-BNs9Wc7G.js";import{t as m}from"./react-f2sANaYj.js";import{n as h}from"./dist-PQ5KMVDh.js";import{t as g}from"./compiler-runtime-BfE3aGVn.js";import{A as _,O as te,S as v,a as ne,i as re,o as ie}from"./CodeMirrorPropInput-B3PfIk_d.js";import{Eo as y,T as ae,Wi as oe,go as b,ti as x,uo as S}from"./dist-CP7w45uR.js";import{h as se}from"./use-apply-config-color-theme-hdarUMLl.js";import{H as C,L as ce,M as le,O as ue,P as de,S as w,d as T,f as fe,i as pe,j as me,l as he,r as ge,t as _e,w as E}from"./typing-burst-detector-adEL1lyg.js";import{f as D,g as O}from"./doc-paths-CX0c2GkE.js";import{J as k}from"./navigation-targets-B9ZSMArq.js";import"./config-provider-DkOV03RH.js";import{$ as A,D as j,Dt as M,F as N,It as P,Lt as F,Ot as I,Pt as L,Y as R,Z as z,b as B,ct as V,ft as H,g as U,gt as W,ht as ve,it as G,kt as ye,l as K,lt as q,nt as J,pt as Y,rt as X,ut as Z,v as be}from"./dist-CXdEP5f6.js";import{a as xe,n as Se}from"./cm-theme-BrrFA0kJ.js";import{i as Ce,n as we,o as Te,r as Ee}from"./dist-CB8Y80Th.js";import{o as De,r as Oe}from"./selection-context-jZhBCQUz.js";import{l as ke}from"./lint-config-client-BXCLXBm0.js";import{a as Ae,i as je,n as Me,o as Ne,r as Pe,s as Fe,t as Ie}from"./dist-BUJTePn0.js";import{n as Le,t as Re}from"./src-DXY6B71v.js";var Q=e(m(),1),ze=g();function Be(){let e=o();return e===null?null:new Set(e.keys())}function Ve(e,t,r){let i=[],a=N(e);if(r!=null){let n=[];for(let{from:e,to:r}of t)a.iterate({from:e,to:r,enter(e){if(e.name===`InlineCode`||e.name===`FencedCode`)return n.push({from:e.from,to:e.to}),!1}});let o=(e,t)=>n.some(n=>e>=n.from&&t<=n.to);for(let{from:n,to:a}of t){let t=e.doc.sliceString(n,a);b.lastIndex=0;for(let e=b.exec(t);e!==null;e=b.exec(t)){let t=e[2];if(!y(t))continue;let a=n+(e.index??0)+e[1].length,s=a+t.length+1;o(a,s)||i.push(R.mark({class:r.has(t)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":t}}).range(a,s))}}}for(let{from:o,to:s}of t)a.iterate({from:o,to:s,enter(t){if(t.name!==`InlineCode`)return;let a=e.doc.sliceString(t.from,t.to),o=a.length-a.replace(/^`+/,``).length,s=a.length-a.replace(/`+$/,``).length,c=a.slice(o,a.length-s),l=/^\/([a-z0-9][a-z0-9-]{1,63})$/.exec(c)?.[1];if(l!==void 0&&y(l)&&r!=null)return i.push(R.mark({class:r.has(l)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":l}}).range(t.from+o,t.to-s)),!1;let u=n.exec(c);if(u)return i.push(R.mark({class:`cm-skill-path-link`,attributes:{"data-skill-path":u[1]}}).range(t.from+o,t.to-s)),!1}});return i.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),R.set(i)}function He(e){let t=a(e);return t===null?[]:[A.fromClass(class{decorations;constructor(e){this.decorations=Ve(e.state,e.visibleRanges,Be())}update(e){(e.docChanged||e.viewportChanged||N(e.startState)!==N(e.state))&&(this.decorations=Ve(e.view.state,e.view.visibleRanges,Be()))}},{decorations:e=>e.decorations}),z.domEventHandlers({mousedown(n){let r=n.target?.closest?.(`[data-skill-ref]`),a=r instanceof HTMLElement?r.dataset.skillRef:void 0;if(a!==void 0){n.preventDefault();let e=o()?.get(a);return window.location.hash=e===void 0?O():D(k({scope:e.scope,name:a,path:e.path})),!0}let s=n.target?.closest?.(`.cm-skill-path-link`),c=s instanceof HTMLElement?s.dataset.skillPath:void 0;return c===void 0?!1:(n.preventDefault(),window.location.hash=i(t,e,c),!0)}})]}var Ue=R.line({attributes:{dir:`auto`}});function We(e){let t=new L;for(let n of e.visibleRanges)for(let r=n.from;r<=n.to;){let n=e.state.doc.lineAt(r);t.add(n.from,n.from,Ue),r=n.to+1}return t.finish()}var Ge=A.fromClass(class{decorations;constructor(e){this.decorations=We(e)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=We(e.view))}},{decorations:e=>e.decorations}),Ke=[z.perLineTextDirection.of(!0),Ge],qe=new Set([`Link`,`Image`,`HTMLTag`,`HTMLBlock`]),Je=`cm-lint-local-target`;function Ye(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function Xe(e,t){let n=U(e,t+1,100);if(n){let e=n.resolveInner(t,1);for(;e;){if(qe.has(e.name))return{from:e.from,to:e.to};e=e.parent}}return{from:t,to:t}}function Ze(e){return e===`error`?`error`:e===`info`?`info`:`warning`}function Qe(e,t){let n=e.doc,r=[];for(let i of t){if(i.source!==`links`)continue;let t=Xe(e,Ye(n,i.range.start));r.push({from:t.from,to:Math.max(t.to,t.from),severity:Ze(i.severity),message:E(i),source:`${i.source}/${i.code}`,markClass:Je})}return r}var $e=P.define();function et(e){let t={findings:[]};return[je(e=>te()?Qe(e.state,t.findings):[],{delay:300,needsRefresh:e=>e.transactions.some(e=>e.effects.some(e=>e.is($e)))}),A.define(n=>{let r=e=>{t.findings=e,n.dispatch({effects:$e.of(null)}),Ie(n)},i=w(e,e=>{e.status===`loaded`&&r(e.findings)}),a=_(()=>r(t.findings));return{destroy(){i(),a()}}})]}function tt(e,t){return e.enabled?[Me(),je(async n=>nt(n.state.doc,await x(n.state.doc.toString(),e,t)),{delay:600})]:[]}function $(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function nt(e,t){let n=[];for(let r of t){let t=$(e,r.range.start),i=$(e,r.range.end),a={from:t,to:Math.max(i,t),severity:r.severity,message:r.message,source:`${r.source}/${r.code}`},o=rt(r);o&&(a.actions=[o]),n.push(a)}return n}function rt(e){let t=e.fixes;return!t||t.length===0?null:{name:`Fix`,apply(e){let n=e.state.doc;e.dispatch({changes:t.map(e=>({from:$(n,e.range.start),to:$(n,e.range.end),insert:e.newText})),userEvent:`input.complete`})}}}var it=[Y(),q(),Z(),be(),X(),G(),ye.allowMultipleSelections.of(!0),j(),K(),Ee(),we(),W(),J(),V(),Ae(),H.of([...Ce,...Se,...Fe,...B,...Te,...Pe])],at=R.mark({class:`cm-link-ref-broken`}),ot=/^\s{0,3}\[([^\]]+)\]:\s/,st=/\[([^\]]*)\]\[([^\]]*)\]/g,ct=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function lt(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 ut(e){let t=[];return N(e).iterate({enter(e){if(ct.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function dt(e){let t=new Set,n=[],r=e.doc,i=ut(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(lt(n.from,i))continue;let a=ot.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!lt(t.from,i)&&!ot.test(t.text))for(st.lastIndex=0;;){let e=st.exec(t.text);if(!e)break;let r=t.from+e.index;if(lt(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(at.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),R.set(a)}var ft=F.define({create(e){return dt(e)},update(e,t){return t.docChanged?dt(t.state):e},provide:e=>z.decorations.from(e)}),pt=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,mt=R.mark({class:`cm-del`}),ht=R.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),gt=R.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function _t(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function vt(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!S.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(S.test(r.text))return{from:t.from,to:r.to}}return null}function yt(e,t){let n=[],r=N(e),i=vt(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(mt.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=pt.exec(r.text),a=i?i[1].length:2,o=R.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=_t(r.text),a=R.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(ht.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(gt.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(gt.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),R.set(n)}var bt=class{decorations;constructor(e){this.decorations=yt(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||N(e.startState)!==N(e.state))&&(this.decorations=yt(e.view.state,e.view.visibleRanges))}},xt=A.fromClass(bt,{decorations:e=>e.decorations});function St(){return[xt,ft]}var Ct=t(),wt=P.define();function Tt(e,t,n){let r=T(e.state.doc)[t.index];r&&p(n,()=>{e.dispatch({selection:I.cursor(r.from),effects:z.scrollIntoView(r.from,{y:`start`})}),e.focus()})}function Et(e,t,n,r){requestAnimationFrame(()=>{if(!n())return;let i=e.state.doc,a=Math.min(t.offset,i.length);p(r,()=>{e.dispatch({selection:I.cursor(a),effects:z.scrollIntoView(a,{y:`center`})}),e.focus()})})}function Dt(e,t,n){let r=e.state.doc,i=Math.min(Math.max(t.line,1),r.lines),a=r.line(i),o=Math.min(a.from+Math.max(0,t.column-1),a.to);p(n,()=>{e.dispatch({selection:I.cursor(o),effects:z.scrollIntoView(o,{y:`start`})}),e.focus()})}function Ot(e){let t=(0,ze.c)(50),{docName:n,ytext:i,provider:a,placeholder:o,isSourceModeActive:p}=e,m=(0,Q.useRef)(null),g=(0,Q.useRef)(null),[_,te]=(0,Q.useState)(null);if(_)throw _;let{resolvedTheme:v}=h(),{merged:y}=se(),b=(0,Q.useRef)(p),x=y?.editor?.wordWrap??!0,{data:S}=ke(n),C;t[0]!==S?.effective||t[1]!==y?(C=S?.effective??(y?.contentRules?oe(y.contentRules):ae),t[0]=S?.effective,t[1]=y,t[2]=C):C=t[2];let w=C,T;t[3]===w?T=t[4]:(T=JSON.stringify(w),t[3]=w,t[4]=T);let E=T,D,O;t[5]===p?(D=t[6],O=t[7]):(D=()=>{b.current=p},O=[p],t[5]=p,t[6]=D,t[7]=O),(0,Q.useEffect)(D,O);let k=(0,Q.useRef)(null),A;t[8]!==n||t[9]!==w||t[10]!==o||t[11]!==a||t[12]!==v||t[13]!==x||t[14]!==i?(A=()=>{let e=m.current;if(!e)return;let t=a.configuration.name??``,p,h=At;try{p=l({docName:t,container:e,sizeStats:{viewCount:0,bytes:i.length},factory:e=>{let r=null,l=u({ydoc:a.document,ytext:i,docName:t}),d=new M,f=new M,p=new M,m=new M,g=new z({state:ye.create({doc:i.toString(),extensions:[it,Ke,Ne({scrollToMatch:e=>s(t)?z.scrollIntoView(e,{y:`start`}):wt.of(null)}),H.of([xe]),Re(i,a.awareness),H.of(Le),...re({themeCompartment:d,resolvedTheme:v,ydoc:a.document,wordWrapCompartment:f,wordWrap:x,currentDocName:t}),St(),He(t),ce(),m.of(tt(w,n)),et(n),l,z.updateListener.of(e=>{ee(e)&&c(t)}),z.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(r!==null&&clearTimeout(r),r=setTimeout(()=>{r=null,ge(t,`source`,pe(e.view)),Oe(t,`source`,De(e.view,t))},120))}),p.of(ve(o??``)),z.theme({"&":{height:`100%`}}),z.scrollMargins.of(kt)]}),parent:e});ge(t,`source`,pe(g)),Oe(t,`source`,De(g,t));let _=g.contentDOM;return _.addEventListener(`keydown`,h),_.addEventListener(`paste`,h),_.addEventListener(`drop`,h),_.addEventListener(`cut`,h),{view:g,ydoc:a.document,ytext:i,provider:a,themeCompartment:d,wordWrapCompartment:f,placeholderCompartment:p,lintCompartment:m}}}),k.current=p,g.current=p.view,r(n,p.view),_e()&&p.view.focus()}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),k.current=null,g.current=null,te(t instanceof Error?t:Error(String(t)))}return()=>{let e=k.current;e&&(f(e),d(n,e.view)),k.current=null,g.current=null}},t[8]=n,t[9]=w,t[10]=o,t[11]=a,t[12]=v,t[13]=x,t[14]=i,t[15]=A):A=t[15];let j;t[16]!==a||t[17]!==i?(j=[i,a],t[16]=a,t[17]=i,t[18]=j):j=t[18],(0,Q.useEffect)(A,j);let N,P;t[19]===n?(N=t[20],P=t[21]):(N=()=>{},P=[n],t[19]=n,t[20]=N,t[21]=P),(0,Q.useEffect)(N,P);let F,I;t[22]===v?(F=t[23],I=t[24]):(I=()=>{let e=k.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(v===`dark`?ne:ie)})},F=[v],t[22]=v,t[23]=F,t[24]=I),(0,Q.useEffect)(I,F);let L,R;t[25]===x?(L=t[26],R=t[27]):(L=()=>{let e=k.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(x?z.lineWrapping:[])})},R=[x],t[25]=x,t[26]=L,t[27]=R),(0,Q.useEffect)(L,R);let B,V;t[28]===o?(B=t[29],V=t[30]):(B=()=>{let e=k.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(ve(o??``))})},V=[o],t[28]=o,t[29]=B,t[30]=V),(0,Q.useEffect)(B,V);let U;t[31]!==n||t[32]!==w?(U=()=>{let e=k.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(tt(w,n))})},t[31]=n,t[32]=w,t[33]=U):U=t[33];let W;t[34]===E?W=t[35]:(W=[E],t[34]=E,t[35]=W),(0,Q.useEffect)(U,W);let G,K;t[36]!==n||t[37]!==p?(G=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||t.mode!==`source`||!p)return;let r=g.current;r&&(Tt(r,t,n),me(n))};return window.addEventListener(he,e),()=>window.removeEventListener(he,e)},K=[n,p],t[36]=n,t[37]=p,t[38]=G,t[39]=K):(G=t[38],K=t[39]),(0,Q.useEffect)(G,K);let q,J;t[40]!==n||t[41]!==p?(q=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||!p)return;let r=g.current;r&&(Dt(r,t,n),me(n))};return window.addEventListener(fe,e),()=>window.removeEventListener(fe,e)},J=[n,p],t[40]=n,t[41]=p,t[42]=q,t[43]=J):(q=t[42],J=t[43]),(0,Q.useEffect)(q,J);let Y,X;t[44]!==n||t[45]!==p||t[46]!==a?(Y=()=>{if(!p)return;let e=g.current;if(!e)return;let t=de(n);if(!t)return;if(t.kind!==`selection-offset`){le(n),t.kind===`outline`?Tt(e,t.detail,n):t.kind===`lint`?Dt(e,t.detail,n):t.kind===`raw-mdx`&&Et(e,t.detail,()=>b.current,n);return}let r=!1,i=null;return queueMicrotask(()=>{if(r)return;let t=de(n);t?.kind===`selection-offset`&&(i=ue({view:e,docName:n,navigation:t,ydoc:a.document,transition:{from:`wysiwyg`,to:`source`}}),i&&le(n))}),()=>{r=!0,i?.cancel(`mode-flip`)}},X=[n,p,a],t[44]=n,t[45]=p,t[46]=a,t[47]=Y,t[48]=X):(Y=t[47],X=t[48]),(0,Q.useEffect)(Y,X);let Z;return t[49]===Symbol.for(`react.memo_cache_sentinel`)?(Z=(0,Ct.jsx)(`div`,{ref:m,className:`source-editor h-full pb-3`}),t[49]=Z):Z=t[49],Z}function kt(){return{top:C()}}function At(){return v()}export{Ot as SourceEditor,Et as applyRawMdxNavigation};
@@ -1,4 +1,4 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{r}from"./dist-Nvb76hAm.js";import{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{t as s}from"./button-CA0dewJJ.js";import{Bi as c,Yt as l,vn as u,wn as d,zi as f}from"./dist-Dih2A8fV.js";import{n as p}from"./dist-CMZSEMCN2.js";import{m}from"./use-apply-config-color-theme-DonBpBNY.js";import{t as h}from"./x-TZrEJhql.js";import{f as g,p as _,u as v}from"./doc-paths-DqJ_A_s7.js";import{X as y}from"./navigation-targets-Qu3klKbE.js";import{f as b,h as x}from"./file-tree-adapter-BiHRDCv3.js";import{t as ee}from"./use-live-xterm-theme-Bq43Ad6a.js";import{r as te}from"./terminal-command-events-BfmJTjba.js";var S=a(),C=2,w=1,T=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(C,Math.floor(u/e.css.cell.width)),rows:Math.max(w,Math.floor(l/e.css.cell.height))}}},E=[[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]],D=[[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]],O;function ne(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 re=class{constructor(){if(this.version=`6`,!O){O=new Uint8Array(65536),O.fill(1),O[0]=0,O.fill(0,1,32),O.fill(0,127,160),O.fill(2,4352,4448),O[9001]=2,O[9002]=2,O.fill(2,11904,42192),O[12351]=1,O.fill(2,44032,55204),O.fill(2,63744,64256),O.fill(2,65040,65050),O.fill(2,65072,65136),O.fill(2,65280,65377),O.fill(2,65504,65511);for(let e=0;e<E.length;++e)O.fill(0,E[e][0],E[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?O[e]:ne(e,D)?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=Ze.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return Ze.createPropertyValue(0,n,r)}},k=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?M.isErrorNoTelemetry(e)?new M(e.message+`
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{r}from"./dist-Nvb76hAm.js";import{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{t as s}from"./button-CA0dewJJ.js";import{Bi as c,Yt as l,vn as u,wn as d,zi as f}from"./dist-CP7w45uR.js";import{n as p}from"./dist-CMZSEMCN2.js";import{m}from"./use-apply-config-color-theme-hdarUMLl.js";import{t as h}from"./x-TZrEJhql.js";import{f as g,p as _,u as v}from"./doc-paths-CX0c2GkE.js";import{X as y}from"./navigation-targets-B9ZSMArq.js";import{f as b,h as x}from"./file-tree-adapter-CNrTrjb9.js";import{t as ee}from"./use-live-xterm-theme-BQNkHYLe.js";import{r as te}from"./terminal-command-events-BfmJTjba.js";var S=a(),C=2,w=1,T=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(C,Math.floor(u/e.css.cell.width)),rows:Math.max(w,Math.floor(l/e.css.cell.height))}}},E=[[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]],D=[[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]],O;function ne(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 re=class{constructor(){if(this.version=`6`,!O){O=new Uint8Array(65536),O.fill(1),O[0]=0,O.fill(0,1,32),O.fill(0,127,160),O.fill(2,4352,4448),O[9001]=2,O[9002]=2,O.fill(2,11904,42192),O[12351]=1,O.fill(2,44032,55204),O.fill(2,63744,64256),O.fill(2,65040,65050),O.fill(2,65072,65136),O.fill(2,65280,65377),O.fill(2,65504,65511);for(let e=0;e<E.length;++e)O.fill(0,E[e][0],E[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?O[e]:ne(e,D)?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=Ze.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return Ze.createPropertyValue(0,n,r)}},k=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?M.isErrorNoTelemetry(e)?new M(e.message+`
2
2
 
3
3
  `+e.stack):Error(e.message+`
4
4
 
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r}from"./dist-PQ5KMVDh.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{t as a}from"./config-provider-Wm9R6Y25.js";import{t as o}from"./use-installed-clis-Dcwl9RUZ.js";import{t as s}from"./use-live-xterm-theme-Bq43Ad6a.js";import{SessionsHost as c}from"./SessionsHost-BTd7O7Aa.js";var l=i(),u=e(n(),1),d=t();function f(e){let t=(0,l.c)(5),{bridge:n}=e,r=n.config.collabUrl?n.config.collabUrl:null,i;t[0]===n?i=t[1]:(i=(0,d.jsx)(p,{bridge:n}),t[0]=n,t[1]=i);let o;return t[2]!==r||t[3]!==i?(o=(0,d.jsx)(a,{collabUrl:r,children:i}),t[2]=r,t[3]=i,t[4]=o):o=t[4],o}function p(e){let t=(0,l.c)(9),{bridge:n}=e,{resolvedTheme:i}=r(),a=s(i),f=o(),[p,g]=(0,u.useState)(null),_;t[0]===a.background?_=t[1]:(_=(0,d.jsx)(`div`,{ref:g,className:`flex h-screen min-h-0 flex-col`,style:{backgroundColor:a.background}}),t[0]=a.background,t[1]=_);let v;t[2]!==n||t[3]!==p||t[4]!==f?(v=(0,d.jsx)(c,{bridge:n,surface:`terminal-window`,terminalCapable:!0,visible:!0,onVisibleChange:h,installedClis:f,container:p,isShowing:!0,onRequestEditorFocus:m}),t[2]=n,t[3]=p,t[4]=f,t[5]=v):v=t[5];let y;return t[6]!==_||t[7]!==v?(y=(0,d.jsxs)(d.Fragment,{children:[_,v]}),t[6]=_,t[7]=v,t[8]=y):y=t[8],y}function m(){}function h(e){e||window.close()}export{f as TerminalWindowApp};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r}from"./dist-PQ5KMVDh.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{t as a}from"./config-provider-DkOV03RH.js";import{t as o}from"./use-installed-clis-Dcwl9RUZ.js";import{t as s}from"./use-live-xterm-theme-BQNkHYLe.js";import{SessionsHost as c}from"./SessionsHost-CdJc0MSK.js";var l=i(),u=e(n(),1),d=t();function f(e){let t=(0,l.c)(5),{bridge:n}=e,r=n.config.collabUrl?n.config.collabUrl:null,i;t[0]===n?i=t[1]:(i=(0,d.jsx)(p,{bridge:n}),t[0]=n,t[1]=i);let o;return t[2]!==r||t[3]!==i?(o=(0,d.jsx)(a,{collabUrl:r,children:i}),t[2]=r,t[3]=i,t[4]=o):o=t[4],o}function p(e){let t=(0,l.c)(9),{bridge:n}=e,{resolvedTheme:i}=r(),a=s(i),f=o(),[p,g]=(0,u.useState)(null),_;t[0]===a.background?_=t[1]:(_=(0,d.jsx)(`div`,{ref:g,className:`flex h-screen min-h-0 flex-col`,style:{backgroundColor:a.background}}),t[0]=a.background,t[1]=_);let v;t[2]!==n||t[3]!==p||t[4]!==f?(v=(0,d.jsx)(c,{bridge:n,surface:`terminal-window`,terminalCapable:!0,visible:!0,onVisibleChange:h,installedClis:f,container:p,isShowing:!0,onRequestEditorFocus:m}),t[2]=n,t[3]=p,t[4]=f,t[5]=v):v=t[5];let y;return t[6]!==_||t[7]!==v?(y=(0,d.jsxs)(d.Fragment,{children:[_,v]}),t[6]=_,t[7]=v,t[8]=y):y=t[8],y}function m(){}function h(e){e||window.close()}export{f as TerminalWindowApp};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{r}from"./dist-Nvb76hAm.js";import{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{n as o}from"./CodeMirrorPropInput-BIdbAIO5.js";import{ds as s,es as c,lr as l}from"./dist-Dih2A8fV.js";import{g as u}from"./config-provider-Wm9R6Y25.js";import{Dt as d,P as f,Z as p,kt as m}from"./dist-CXdEP5f6.js";import{t as h}from"./cm-theme-BrrFA0kJ.js";import{t as g}from"./dist-H0a1Kjgj.js";import{t as _}from"./text-viewer-languages-BS5OVIGh.js";import{t as v}from"./src-_CcgHCm_.js";var y=a(),b=e(n(),1),x=t(),S=h({dark:!0,background:`var(--background)`,gutterBackground:`var(--muted)`}),C=h({dark:!1,background:`var(--background)`,gutterBackground:`var(--muted)`});function w(e){let t=(0,y.c)(19),{docName:n,provider:a}=e,{_:h}=r(),w=n.slice(n.lastIndexOf(`/`)+1),T=(0,b.useRef)(null),{resolvedTheme:E}=i(),D;t[0]===a.document?D=t[1]:(D=a.document.getText(`source`),t[0]=a.document,t[1]=D);let O=D,k;t[2]===O?k=t[3]:(k=()=>new u(O),t[2]=O,t[3]=k);let[A]=(0,b.useState)(k),j;t[4]!==n||t[5]!==a.awareness||t[6]!==E||t[7]!==A||t[8]!==O?(j=()=>{let e=T.current;if(!e)return;let t=E===`dark`?S:C,r=new d,i=new d,u=(c[l(n)]??s(l(n)))!==null&&l(n)!==``,h=new p({state:m.create({doc:O.toString(),extensions:[g,v(O,a.awareness,{undoManager:A}),r.of([]),f(o),i.of(u?[]:p.lineWrapping),p.theme({"&":{height:`100%`}}),t]}),parent:e}),y=!1,b=l(n)||null;return b&&_(b,c[b]??s(b)).then(e=>{y||!e||h.dispatch({effects:r.reconfigure(e)})}),()=>{y=!0,h.destroy()}},t[4]=n,t[5]=a.awareness,t[6]=E,t[7]=A,t[8]=O,t[9]=j):j=t[9];let M;t[10]!==n||t[11]!==a||t[12]!==E||t[13]!==A||t[14]!==O?(M=[O,a,E,n,A],t[10]=n,t[11]=a,t[12]=E,t[13]=A,t[14]=O,t[15]=M):M=t[15],(0,b.useEffect)(j,M);let N=h({id:`xAlHfe`,values:{basename:w}}),P;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,x.jsx)(`div`,{ref:T,className:`min-h-0 flex-1 overflow-auto`}),t[16]=P):P=t[16];let F;return t[17]===N?F=t[18]:(F=(0,x.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":N,"data-text-doc-editor":``,children:P}),t[17]=N,t[18]=F),F}export{w as TextDocEditor};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{r}from"./dist-Nvb76hAm.js";import{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{n as o}from"./CodeMirrorPropInput-B3PfIk_d.js";import{ds as s,es as c,lr as l}from"./dist-CP7w45uR.js";import{g as u}from"./config-provider-DkOV03RH.js";import{Dt as d,P as f,Z as p,kt as m}from"./dist-CXdEP5f6.js";import{t as h}from"./cm-theme-BrrFA0kJ.js";import{t as g}from"./dist-H0a1Kjgj.js";import{t as _}from"./text-viewer-languages-BS5OVIGh.js";import{t as v}from"./src-DXY6B71v.js";var y=a(),b=e(n(),1),x=t(),S=h({dark:!0,background:`var(--background)`,gutterBackground:`var(--muted)`}),C=h({dark:!1,background:`var(--background)`,gutterBackground:`var(--muted)`});function w(e){let t=(0,y.c)(19),{docName:n,provider:a}=e,{_:h}=r(),w=n.slice(n.lastIndexOf(`/`)+1),T=(0,b.useRef)(null),{resolvedTheme:E}=i(),D;t[0]===a.document?D=t[1]:(D=a.document.getText(`source`),t[0]=a.document,t[1]=D);let O=D,k;t[2]===O?k=t[3]:(k=()=>new u(O),t[2]=O,t[3]=k);let[A]=(0,b.useState)(k),j;t[4]!==n||t[5]!==a.awareness||t[6]!==E||t[7]!==A||t[8]!==O?(j=()=>{let e=T.current;if(!e)return;let t=E===`dark`?S:C,r=new d,i=new d,u=(c[l(n)]??s(l(n)))!==null&&l(n)!==``,h=new p({state:m.create({doc:O.toString(),extensions:[g,v(O,a.awareness,{undoManager:A}),r.of([]),f(o),i.of(u?[]:p.lineWrapping),p.theme({"&":{height:`100%`}}),t]}),parent:e}),y=!1,b=l(n)||null;return b&&_(b,c[b]??s(b)).then(e=>{y||!e||h.dispatch({effects:r.reconfigure(e)})}),()=>{y=!0,h.destroy()}},t[4]=n,t[5]=a.awareness,t[6]=E,t[7]=A,t[8]=O,t[9]=j):j=t[9];let M;t[10]!==n||t[11]!==a||t[12]!==E||t[13]!==A||t[14]!==O?(M=[O,a,E,n,A],t[10]=n,t[11]=a,t[12]=E,t[13]=A,t[14]=O,t[15]=M):M=t[15],(0,b.useEffect)(j,M);let N=h({id:`xAlHfe`,values:{basename:w}}),P;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,x.jsx)(`div`,{ref:T,className:`min-h-0 flex-1 overflow-auto`}),t[16]=P):P=t[16];let F;return t[17]===N?F=t[18]:(F=(0,x.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":N,"data-text-doc-editor":``,children:P}),t[17]=N,t[18]=F),F}export{w as TextDocEditor};