@inkeep/open-knowledge 0.80.0-beta.8 → 0.80.0-beta.9

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 (161) hide show
  1. package/dist/cli.mjs +6 -6
  2. package/dist/constants-P2vamw2j.mjs +1 -0
  3. package/dist/{dist-UU05FlF5.mjs → dist-CdLNlhDP.mjs} +1 -1
  4. package/dist/{dist-BGZB40vV.mjs → dist-KMq6NYnE.mjs} +277 -277
  5. package/dist/index.d.mts +9 -3
  6. package/dist/index.mjs +1 -1
  7. package/dist/{init-DixdtQo4.mjs → init-C4sdA-rm.mjs} +2 -2
  8. package/dist/init-DzadeHz0.mjs +1 -0
  9. package/dist/{launch-json-removal-DQSVIMKg.mjs → launch-json-removal-D_dv7emw.mjs} +1 -1
  10. package/dist/loader-BZx8Nqx3.mjs +1 -0
  11. package/dist/{loader-OpRlMshE.mjs → loader-CNcCKhmA.mjs} +1 -1
  12. package/dist/{open-browser-xNlcpMgb.mjs → open-browser-DFD0gAHP.mjs} +1 -1
  13. package/dist/{preview-DDX1gJqb.mjs → preview-CekjZPJH.mjs} +1 -1
  14. package/dist/preview-b0INtwAe.mjs +1 -0
  15. package/dist/public/assets/{ActivityModeContent-BRpsMl1W.js → ActivityModeContent-CXe5iR7y.js} +1 -1
  16. package/dist/public/assets/{AddPropertiesButton-BUNE85Al.js → AddPropertiesButton-iN7hK8hR.js} +2 -2
  17. package/dist/public/assets/{AgentDiffPane-DhX2Q-kq.js → AgentDiffPane-zSVJBxRr.js} +1 -1
  18. package/dist/public/assets/{AgentThreadClientBinder-oQqS9LMn.js → AgentThreadClientBinder-DXR-3EG_.js} +1 -1
  19. package/dist/public/assets/{BugReportHistory-BeT4qc8x.js → BugReportHistory-CHztW1rW.js} +1 -1
  20. package/dist/public/assets/{BugReportHistoryDialog-qOgaU67n.js → BugReportHistoryDialog-Col6mLYe.js} +1 -1
  21. package/dist/public/assets/{CodeMirrorPropInput-BJDU0-70.js → CodeMirrorPropInput-oi-kd9yP.js} +1 -1
  22. package/dist/public/assets/{ConsentDialogBody-CYQDvrod.js → ConsentDialogBody-Dc9mOXSz.js} +1 -1
  23. package/dist/public/assets/{DeleteConfirmationDialog-_4ZcQ_WU.js → DeleteConfirmationDialog-DAssnqR5.js} +1 -1
  24. package/dist/public/assets/{DiffViewBoundary-WTsOr1JB.js → DiffViewBoundary-Sk1wZlu3.js} +1 -1
  25. package/dist/public/assets/{DocumentContext-CjYhWoGU.js → DocumentContext-Dgls-Dla.js} +1 -1
  26. package/dist/public/assets/{EditorModeToggle-BJc88vvp.js → EditorModeToggle-DQ2M_yip.js} +1 -1
  27. package/dist/public/assets/{EnableSyncConfirmDialog-bbbliDE7.js → EnableSyncConfirmDialog-B7QapJXn.js} +1 -1
  28. package/dist/public/assets/{ExcalidrawDocEditor-_5TmYiLc.js → ExcalidrawDocEditor-hW6b9tV4.js} +1 -1
  29. package/dist/public/assets/FeedbackForm-DTGHQGg9.js +1 -0
  30. package/dist/public/assets/{GraphPanel-DPvwBmDW.js → GraphPanel-rSfk9VP1.js} +1 -1
  31. package/dist/public/assets/{ImageAttachments-ChTOkMU5.js → ImageAttachments-nPCL3xb3.js} +1 -1
  32. package/dist/public/assets/{ImportSkillDialog-D2cOhqCs.js → ImportSkillDialog-V9Cw8Kcv.js} +1 -1
  33. package/dist/public/assets/{LintConfigEditor-Bmt7m3WR.js → LintConfigEditor-C4Ibf6V-.js} +1 -1
  34. package/dist/public/assets/{ManagedArtifactProperties-DQZHPU2z.js → ManagedArtifactProperties-BumSHbB1.js} +1 -1
  35. package/dist/public/assets/ManagedArtifactProperties-wX44QIJu.js +1 -0
  36. package/dist/public/assets/{MermaidDocEditor-BeFnyZX6.js → MermaidDocEditor-C1cBaUa0.js} +1 -1
  37. package/dist/public/assets/{OpenInAgentMenuItem-D8NEKdSX.js → OpenInAgentMenuItem-B1g3FKWX.js} +1 -1
  38. package/dist/public/assets/{PropertyDisplayRow-DcTwX5-h.js → PropertyDisplayRow-Bxl5zL5b.js} +1 -1
  39. package/dist/public/assets/{RegisteredAgentIcon-CcvblzpC.js → RegisteredAgentIcon-BQtfPUlI.js} +1 -1
  40. package/dist/public/assets/{ReportBugDialogBody-byNRbXwl.js → ReportBugDialogBody-B9ynljgx.js} +1 -1
  41. package/dist/public/assets/{ReportBugMenuTrigger-Cnn2Kpoj.js → ReportBugMenuTrigger-CFyTLJCO.js} +1 -1
  42. package/dist/public/assets/{SchemaConfigEditor-Ar_uta_g.js → SchemaConfigEditor-OYC8pfcW.js} +1 -1
  43. package/dist/public/assets/{SessionsHost-B8q1kalR.js → SessionsHost-CX2agqio.js} +2 -2
  44. package/dist/public/assets/{SettingsDialogBody-DtqaucZk.js → SettingsDialogBody-BYljzTma.js} +3 -3
  45. package/dist/public/assets/{ShareBranchSwitchDialog-BBaO_tr4.js → ShareBranchSwitchDialog-CpslCZoE.js} +1 -1
  46. package/dist/public/assets/{ShareReceiveDialog-DkvKil4t.js → ShareReceiveDialog-DHZwbmVZ.js} +1 -1
  47. package/dist/public/assets/{ShareReceiveMissDialog-6Vk1ov6n.js → ShareReceiveMissDialog-K-PUdpF6.js} +1 -1
  48. package/dist/public/assets/{SkillCostValue-BKwKtiXH.js → SkillCostValue-BqwDCdyz.js} +1 -1
  49. package/dist/public/assets/{SkillEditBanner-C5uTpSKD.js → SkillEditBanner-DfX0ZMhk.js} +1 -1
  50. package/dist/public/assets/{SkillForkDialog-DnmjSB0n.js → SkillForkDialog-BXZOJx_N.js} +1 -1
  51. package/dist/public/assets/{SkillInstallMenu-sgeehwe1.js → SkillInstallMenu-CN2GrbPw.js} +1 -1
  52. package/dist/public/assets/{SkillOriginInline-BnMdaW-1.js → SkillOriginInline-Ztvs34Rd.js} +1 -1
  53. package/dist/public/assets/{SkillToolbarControls-DSkcPyE7.js → SkillToolbarControls-v9y8_wzg.js} +1 -1
  54. package/dist/public/assets/{SlidesToolbarControls-D6fM1z2O.js → SlidesToolbarControls-DAboS0aq.js} +1 -1
  55. package/dist/public/assets/{SourceEditor-s6oqUBCs.js → SourceEditor-vpfPvLQF.js} +1 -1
  56. package/dist/public/assets/{TerminalPanel-BVWOE3kU.js → TerminalPanel-eBOYC9p7.js} +1 -1
  57. package/dist/public/assets/{TerminalWindowApp-BNJ24WKK.js → TerminalWindowApp-tAZAHgkX.js} +1 -1
  58. package/dist/public/assets/{TextDocEditor-DfldlAp7.js → TextDocEditor-DMDGnGzS.js} +1 -1
  59. package/dist/public/assets/{ThreadView-BJq8AtlR.js → ThreadView-1x3cbf_i.js} +1 -1
  60. package/dist/public/assets/{TimelineDiffPane-CvTyxlJ-.js → TimelineDiffPane-BNbIWBqF.js} +1 -1
  61. package/dist/public/assets/{agent-connections-0X_wM1D5.js → agent-connections-DfnLoQwk.js} +1 -1
  62. package/dist/public/assets/auth-state-cache-DM0DOx_g.js +11 -0
  63. package/dist/public/assets/{bug-report-send-manager-D0ep_Jtf.js → bug-report-send-manager-Ca35GgF_.js} +1 -1
  64. package/dist/public/assets/{client-version-47R1Hqu0.js → client-version-EZdeuX5e.js} +1 -1
  65. package/dist/public/assets/{comment-chips-Dl4tR59k.js → comment-chips-CP10WGEG.js} +1 -1
  66. package/dist/public/assets/{config-provider-D06S8HhQ.js → config-provider-D5T5o8Sw.js} +1 -1
  67. package/dist/public/assets/{css-color-to-hex-X_ubtbg_.js → css-color-to-hex-CuTcApqE.js} +1 -1
  68. package/dist/public/assets/{diagnostic-breadcrumb-rWRd-iGs.js → diagnostic-breadcrumb-CrbcQ6qJ.js} +1 -1
  69. package/dist/public/assets/{dist-DTxb76k4.js → dist-tlq-ZRDM.js} +190 -190
  70. package/dist/public/assets/{doc-paths-VPO39t4f.js → doc-paths-DJfKKip_.js} +1 -1
  71. package/dist/public/assets/{doc-undo-manager-D3cMP3Rz.js → doc-undo-manager-CcKJENfI.js} +1 -1
  72. package/dist/public/assets/{documents-events-DLvhFUkq.js → documents-events-ByIvYg6i.js} +1 -1
  73. package/dist/public/assets/{file-tree-adapter-Sub5h3Aa.js → file-tree-adapter-CBzD7I2P.js} +1 -1
  74. package/dist/public/assets/{file-tree-utils-CIQBSzS9.js → file-tree-utils-1YoLlrRA.js} +1 -1
  75. package/dist/public/assets/{folder-config-api-Cz9BQmTR.js → folder-config-api-CPBcpxVh.js} +1 -1
  76. package/dist/public/assets/{index-BRQoyokT.js → index-Bt9sL0sd.js} +123 -123
  77. package/dist/public/assets/{lint-config-client-ShgapJqD.js → lint-config-client-BitLuJxs.js} +1 -1
  78. package/dist/public/assets/{markdownlint-rule-browser-BiJOQswX.js → markdownlint-rule-browser-DNSikHNb.js} +1 -1
  79. package/dist/public/assets/messages-B9ZVE6H0.js +1 -0
  80. package/dist/public/assets/messages-BQO_oPks.js +1 -0
  81. package/dist/public/assets/messages-CN32Wy_5.js +1 -0
  82. package/dist/public/assets/messages-COVtECdx.js +1 -0
  83. package/dist/public/assets/messages-CS8ziLBG.js +1 -0
  84. package/dist/public/assets/messages-CpJJntJO.js +1 -0
  85. package/dist/public/assets/messages-DVePMc7U.js +1 -0
  86. package/dist/public/assets/messages-DbMX5Lg1.js +1 -0
  87. package/dist/public/assets/messages-DhThrDg_.js +1 -0
  88. package/dist/public/assets/messages-Diu0LMfe.js +1 -0
  89. package/dist/public/assets/messages-DymTVTJ8.js +1 -0
  90. package/dist/public/assets/messages-Gk54TbMa.js +1 -0
  91. package/dist/public/assets/messages-tJQ6z2mj.js +1 -0
  92. package/dist/public/assets/{navigation-targets-Cj3FjSHM.js → navigation-targets-BLiq2J_H.js} +1 -1
  93. package/dist/public/assets/{page-list-cache-Db-cMXXb.js → page-list-cache-B119MHjj.js} +1 -1
  94. package/dist/public/assets/{pending-receive-nav-store-Cvafwk5s.js → pending-receive-nav-store-YPgvt9Pm.js} +1 -1
  95. package/dist/public/assets/{preferred-session-events-D2UgCugO.js → preferred-session-events-CdtNETab.js} +1 -1
  96. package/dist/public/assets/{progress-DIu1GSm2.js → progress-Cz6ZpFF9.js} +1 -1
  97. package/dist/public/assets/{project-paths-C8ucGf4F.js → project-paths-CLLYpvql.js} +1 -1
  98. package/dist/public/assets/{prop-types-BaGWFLYl.js → prop-types-OG9Zvhxq.js} +1 -1
  99. package/dist/public/assets/{receive-store-DE9tB4jY.js → receive-store-KJtLoUh8.js} +1 -1
  100. package/dist/public/assets/{selection-context-BmxK2cQ1.js → selection-context-DZjCYUk3.js} +1 -1
  101. package/dist/public/assets/{sign-in-terminal-events-BUwsboGX.js → sign-in-terminal-events-BgQ8T9U8.js} +1 -1
  102. package/dist/public/assets/{skill-scope-bxDiQshW.js → skill-scope-Hg5bOCB8.js} +1 -1
  103. package/dist/public/assets/{skills-api-BaxUiF2f.js → skills-api-Bl-dNjGU.js} +1 -1
  104. package/dist/public/assets/{src-DpN4tqC_.js → src-C8_EYFjV.js} +1 -1
  105. package/dist/public/assets/{startup-marks-BxUZHKOy.js → startup-marks-BS6f_gKC.js} +1 -1
  106. package/dist/public/assets/{tag-pill-input-dKjZE88k.js → tag-pill-input-ByT0m63u.js} +1 -1
  107. package/dist/public/assets/{target-navigation-intent-CN-DIwXP.js → target-navigation-intent-Diupu5ED.js} +1 -1
  108. package/dist/public/assets/{telemetry-startup-lxSU0usW.js → telemetry-startup-DVOyEMkA.js} +1 -1
  109. package/dist/public/assets/{terminal-command-events-Orubep-S.js → terminal-command-events-BdSpKO4F.js} +1 -1
  110. package/dist/public/assets/{terminal-launch-events-CRAau5xV.js → terminal-launch-events-Be_jxcEB.js} +1 -1
  111. package/dist/public/assets/{terminal-telemetry-C6TBDBsx.js → terminal-telemetry-mHXhijWT.js} +1 -1
  112. package/dist/public/assets/{thread-client-C8EMFbCt.js → thread-client-B9RYw0oe.js} +1 -1
  113. package/dist/public/assets/{typing-burst-detector-DYWkkyFn.js → typing-burst-detector-BxQN-xU9.js} +1 -1
  114. package/dist/public/assets/{uninstall-rTTw6eol.js → uninstall-Bpx7EBEp.js} +1 -1
  115. package/dist/public/assets/{use-activity-panel-CFjSB3Ko.js → use-activity-panel-sXj846dO.js} +1 -1
  116. package/dist/public/assets/{use-apply-config-language-BA8pb8bB.js → use-apply-config-language-D2tfm577.js} +2 -2
  117. package/dist/public/assets/{use-collab-url-i6hEm2eD.js → use-collab-url-tLYmR58g.js} +1 -1
  118. package/dist/public/assets/{use-conflicts-Csl-W9sG.js → use-conflicts-DWk-8lWH.js} +1 -1
  119. package/dist/public/assets/{use-git-sync-status-DrkQ-euc.js → use-git-sync-status-tiwLJnWq.js} +1 -1
  120. package/dist/public/assets/{use-installed-clis-CywDYh_S.js → use-installed-clis-DobvTR6y.js} +2 -2
  121. package/dist/public/assets/{use-live-xterm-theme-D87B7hkL.js → use-live-xterm-theme-DuKvf88u.js} +1 -1
  122. package/dist/public/assets/{use-open-skill-DcSc5W3j.js → use-open-skill-Ct8nlaz6.js} +1 -1
  123. package/dist/public/assets/{use-settings-route-CAshJWbw.js → use-settings-route-ALxxppEp.js} +1 -1
  124. package/dist/public/assets/{use-skill-origin-kW6ZZcES.js → use-skill-origin-CyMtSI6e.js} +1 -1
  125. package/dist/public/assets/{use-skills-DT7KgjWD.js → use-skills-D17NLQFY.js} +1 -1
  126. package/dist/public/assets/{use-terminal-enabled-C1s8vXrb.js → use-terminal-enabled-BTW8Hb1L.js} +1 -1
  127. package/dist/public/assets/{use-timeline-entry-diff-DHQkGLuD.js → use-timeline-entry-diff-DnOD1bsm.js} +1 -1
  128. package/dist/public/assets/{use-workspace-ByLGR16G.js → use-workspace-rz8Pc1_5.js} +1 -1
  129. package/dist/public/index.html +60 -60
  130. package/dist/public/uninstall.html +4 -4
  131. package/dist/{registry-probes-CSVwdlnt.mjs → registry-probes-B9Yonncj.mjs} +1 -1
  132. package/dist/{removal-file-path-wM2_Gnbs.mjs → removal-file-path-ecE_eOa6.mjs} +1 -1
  133. package/dist/{repair-launch-json-Bucu4SKC.mjs → repair-launch-json-DmvvcSge.mjs} +1 -1
  134. package/dist/{repair-mcp-configs-B5eKvhO7.mjs → repair-mcp-configs-B4y6LfFB.mjs} +1 -1
  135. package/dist/src-BtyBmG7G.mjs +1 -0
  136. package/dist/{src-DocALnhn.mjs → src-DaXCEVa1.mjs} +1 -1
  137. package/dist/start-8qjZIwwA.mjs +1 -0
  138. package/dist/{start-CCqXKb5e.mjs → start-BxP9im8a.mjs} +3 -3
  139. package/package.json +4 -4
  140. package/dist/constants-udCWsXgt.mjs +0 -1
  141. package/dist/init-CPmsvtQB.mjs +0 -1
  142. package/dist/loader-BJdt_Inn.mjs +0 -1
  143. package/dist/preview-CPYHmnfi.mjs +0 -1
  144. package/dist/public/assets/FeedbackForm-Y66w6mKZ.js +0 -1
  145. package/dist/public/assets/ManagedArtifactProperties-DXuD-PMR.js +0 -1
  146. package/dist/public/assets/auth-state-cache-BU4ajCHf.js +0 -11
  147. package/dist/public/assets/messages-0wCfOVUP.js +0 -1
  148. package/dist/public/assets/messages-Bca2DYmQ.js +0 -1
  149. package/dist/public/assets/messages-BfrQRlyf.js +0 -1
  150. package/dist/public/assets/messages-Bia_CkTU.js +0 -1
  151. package/dist/public/assets/messages-BkyQO0O-.js +0 -1
  152. package/dist/public/assets/messages-Bnf4ReKQ.js +0 -1
  153. package/dist/public/assets/messages-CEuuj5Sl.js +0 -1
  154. package/dist/public/assets/messages-CH37EG0d.js +0 -1
  155. package/dist/public/assets/messages-CjdjdvIS.js +0 -1
  156. package/dist/public/assets/messages-CrvbDVq6.js +0 -1
  157. package/dist/public/assets/messages-DbWtr8o5.js +0 -1
  158. package/dist/public/assets/messages-PeEEAGdQ.js +0 -1
  159. package/dist/public/assets/messages-w3-ja45Z.js +0 -1
  160. package/dist/src-DfFI0URL.mjs +0 -1
  161. package/dist/start-CgB7z6Zm.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-BeFNZANd.js";import{n as s}from"./dist-CJhtNlOm2.js";import{t as c}from"./desktop-bridge-types-oYPdTDmz.js";import{n as ee,t as l}from"./git-branch-B_QTfwFA.js";import{t as u}from"./spinner-Bp2_BYkl.js";import{n as te,t as ne}from"./miss-dialog-store-CNJRdTPE.js";import{a as re,c as ie,i as ae,n as oe,o as d,s as se,t as ce}from"./dialog-DJkPMmCN.js";import{i as f,n as le,t as p}from"./auth-prompt-store-D3eTM4hj.js";import{a as m,n as ue}from"./receive-store-DE9tB4jY.js";import{t as de}from"./share-metadata-rows-R5Z0YM14.js";var h=e(n(),1),fe=a();function pe(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 me(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function g(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 he={phase:`loading`};function ge(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function _e(e,t){return e.phase!==`ready`&&e.phase!==`verdict`?e:{phase:`switching`,info:e.info,pendingDoc:t}}function ve(e){return e.phase===`ready`?{phase:`creating-worktree`,info:e.info}:e}function ye(e){return pe(e).kind===`B`&&e.shareTargetOnOriginBranch===!1}function be(e){return e.phase===`ready`?{phase:`verdict-pending`,info:e.info}:e}function xe(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 Se(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=g(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 Ce(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`}}:t.reason===`project-scope-unavailable`?{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:t.reason,projectScopeIssue:t.issue}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:t.reason,helper:t.helper,authFailed:t.reason===`fetch-failed`?t.authFailed:void 0,notFoundAsIdentity:t.reason===`fetch-failed`?t.notFoundAsIdentity:void 0}}:{state:e}}var _=t();function we(e){return c(e.repositoryTarget)}function Te(e,t=c(e.target)){let n=e.contentRootDepth===null?t:[...we(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 Ee(e){return e!==null&&e.kind===`project-branch-switch`}function v(e){let t=(0,fe.c)(217),{bridge:n,store:a}=e,p=a===void 0?ue:a,{_:g}=i(),v=(0,h.useSyncExternalStore)(p.subscribe,p.getSnapshot,Pe),[y,b]=(0,h.useState)(he),Fe=(0,h.useRef)(!1),Ie=(0,h.useRef)(!1),Le=(0,h.useRef)(!1),Re=(0,h.useRef)(null),ze;t[0]===v?ze=t[1]:(ze=Ee(v)?v:null,t[0]=v,t[1]=ze);let x=ze,Be;t[2]!==g||t[3]!==x?.share.target.kind?(Be=x?.share.target.kind===`folder`?g({id:`ugoTXs`}):g({id:`XH30C4`}),t[2]=g,t[3]=x?.share.target.kind,t[4]=Be):Be=t[4];let S=Be,Ve;t[5]===x?Ve=t[6]:(Ve=()=>{b(he),Fe.current=!1,Ie.current=!1,Le.current=!1,Re.current=x},t[5]=x,t[6]=Ve);let He;t[7]===v?He=t[8]:(He=[v],t[7]=v,t[8]=He),(0,h.useEffect)(Ve,He);let Ue;t[9]!==x||t[10]!==n?(Ue=()=>{if(!x||Fe.current)return;Fe.current=!0;let e=!1;return n.project.fetchBranchInfo({projectPath:x.projectPath,branch:x.share.branch,kind:x.share.repositoryTarget.kind,path:we(x.share)}).then(t=>{e||b(e=>ge(e,t))}).catch(t=>{e||(console.warn(`[receive] branch-info-fetch-failed`,t instanceof Error?t.message:t),b(Ne))}),()=>{e=!0}},t[9]=x,t[10]=n,t[11]=Ue):Ue=t[11];let We;t[12]===x?We=t[13]:(We=[x],t[12]=x,t[13]=We),(0,h.useEffect)(Ue,We);let Ge;t[14]!==x||t[15]!==y.info||t[16]!==y.phase||t[17]!==n?(Ge=()=>{if(!x||y.phase!==`ready`||Le.current||!ye(y.info))return;Le.current=!0,b(be);let e=x;n.project.fetchTargetStatus({projectPath:x.projectPath,branch:x.share.branch,kind:x.share.target.kind,path:we(x.share),...x.share.contentRootDepth===null?{}:{contentRootDepth:x.share.contentRootDepth}}).then(t=>{Re.current===e&&b(e=>xe(e,t))}).catch(t=>{Re.current===e&&(console.warn(`[receive] target-status-fetch-failed`,t instanceof Error?t.message:t),b(Me))})},t[14]=x,t[15]=y.info,t[16]=y.phase,t[17]=n,t[18]=Ge):Ge=t[18];let Ke;t[19]!==x||t[20]!==y.phase?(Ke=[y.phase,x],t[19]=x,t[20]=y.phase,t[21]=Ke):Ke=t[21],(0,h.useEffect)(Ge,Ke);let qe;t[22]!==x||t[23]!==y.phase||t[24]!==y.resolution||t[25]!==p?(qe=()=>{if(y.phase!==`verdict`)return;let{kind:e}=y.resolution;e!==`deleted`&&e!==`never-on-branch`||x&&(ne.arm({kind:x.share.target.kind,path:c(x.share.target),repositoryPath:we(x.share),...x.share.contentRootDepth===null?{}:{contentRootDepth:x.share.contentRootDepth},branch:x.share.branch}),p.dismiss())},t[22]=x,t[23]=y.phase,t[24]=y.resolution,t[25]=p,t[26]=qe):qe=t[26];let Je;t[27]!==x||t[28]!==y||t[29]!==p?(Je=[y,x,p],t[27]=x,t[28]=y,t[29]=p,t[30]=Je):Je=t[30],(0,h.useEffect)(qe,Je);let Ye;t[31]!==y.phase||t[32]!==y.resolution?(Ye=()=>{y.phase===`verdict`&&console.log(m({verdict_cell:y.resolution.kind}))},t[31]=y.phase,t[32]=y.resolution,t[33]=Ye):Ye=t[33];let Xe;t[34]===y?Xe=t[35]:(Xe=[y],t[34]=y,t[35]=Xe),(0,h.useEffect)(Ye,Xe);let Ze;t[36]!==g||t[37]!==x||t[38]!==y.pendingDoc||t[39]!==y.phase||t[40]!==n||t[41]!==p||t[42]!==S?(Ze=()=>{if(y.phase!==`awaiting-cc1-recycle`||!x)return;let e=x.share.branch,t=y.pendingDoc;if(!e){p.dismiss();return}if(Ie.current)return;Ie.current=!0;let r=!1;return n.project.awaitBranchSwitched({projectPath:x.projectPath,branch:e,timeoutMs:3e4}).then(i=>{if(!r){if(i.ok){console.log(m({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:x.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Te(x.share,t),pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),s.error(g({id:`gQV-9w`,values:{targetNoun:S}}))}),p.dismiss();return}console.log(m({branch_dialog_action:`branch-switch-timeout`,branch:e})),s.error(g({id:`LBwUR6`,values:{targetNoun:S}})),p.dismiss()}}).catch(e=>{r||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),s.error(g({id:`Jw6EC4`,values:{targetNoun:S}})),p.dismiss())}),()=>{r=!0}},t[36]=g,t[37]=x,t[38]=y.pendingDoc,t[39]=y.phase,t[40]=n,t[41]=p,t[42]=S,t[43]=Ze):Ze=t[43];let Qe;if(t[44]!==x||t[45]!==y.phase?(Qe=[y.phase,x],t[44]=x,t[45]=y.phase,t[46]=Qe):Qe=t[46],(0,h.useEffect)(Ze,Qe),!x)return null;let{share:C,projectPath:w,currentBranch:$e}=x,T=C.branch,et;t[47]!==g||t[48]!==n.project||t[49]!==w||t[50]!==T||t[51]!==p?(et=function(e,t,r){console.log(m({branch_dialog_action:`switch`,branch_action:`switch`,branch:T,verdict_cell:r})),b(t=>_e(t,e)),n.project.runCheckout(t?{projectPath:w,branch:T,fastForward:!0}:{projectPath:w,branch:T}).then(e=>{let t=null,n=!1;b(r=>{let{state:i,sideEffect:a}=Se(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?s.error(g({id:`NJyQi_`,values:{shareBranch:T}})):t===`fetch-failed`?s.error(g({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&s.error(g({id:`c863eW`,values:{shareBranch:T}})),n&&p.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),b(je),s.error(g({id:`c863eW`,values:{shareBranch:T}}))})},t[47]=g,t[48]=n.project,t[49]=w,t[50]=T,t[51]=p,t[52]=et):et=t[52];let E=et,tt;t[53]!==y.info||t[54]!==y.phase||t[55]!==E||t[56]!==C.target?(tt=function(){y.phase===`ready`&&pe(y.info).switchEnabled&&E(c(C.target),!1)},t[53]=y.info,t[54]=y.phase,t[55]=E,t[56]=C.target,t[57]=tt):tt=t[57];let nt=tt,rt;t[58]!==y.phase||t[59]!==y.resolution||t[60]!==E||t[61]!==C.target?(rt=function(){y.phase===`verdict`&&E(c(C.target),!0,y.resolution.kind)},t[58]=y.phase,t[59]=y.resolution,t[60]=E,t[61]=C.target,t[62]=rt):rt=t[62];let it=rt,at;t[63]!==y.phase||t[64]!==y.resolution||t[65]!==E?(at=function(){y.phase===`verdict`&&y.resolution.kind===`renamed`&&E(y.resolution.renamedTo,!0,y.resolution.kind)},t[63]=y.phase,t[64]=y.resolution,t[65]=E,t[66]=at):at=t[66];let ot=at,st;t[67]!==y.phase||t[68]!==y.resolution||t[69]!==E||t[70]!==C.target?(st=function(){y.phase===`verdict`&&E(c(C.target),!1,y.resolution.kind)},t[67]=y.phase,t[68]=y.resolution,t[69]=E,t[70]=C.target,t[71]=st):st=t[71];let ct=st,lt;t[72]!==g||t[73]!==n.project||t[74]!==w||t[75]!==C||t[76]!==T||t[77]!==p||t[78]!==S?(lt=function(){console.log(m({branch_dialog_action:`open-current`,branch:T})),n.project.open({path:w,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Te(C)}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),s.error(g({id:`b5aNbi`,values:{targetNoun:S}}))}),p.dismiss()},t[72]=g,t[73]=n.project,t[74]=w,t[75]=C,t[76]=T,t[77]=p,t[78]=S,t[79]=lt):lt=t[79];let ut=lt,dt;t[80]!==g||t[81]!==T?(dt=function(e){let{reason:t}=e,n=`helper`in e?e.helper:void 0,r=`authFailed`in e?e.authFailed:void 0,i=`notFoundAsIdentity`in e?e.notFoundAsIdentity:void 0;if(t===`fetch-failed`&&i){s.error(g({id:`jRsjlF`}));return}if(t===`fetch-failed`&&r){s.error(g({id:`gfb-CM`}),{action:{label:g({id:`5lWFkC`}),onClick:Ae}});return}switch(t){case`helper-not-found`:{let e=n??g({id:`cHhH3i`});s.error(g({id:`Z7x_Zh`,values:{tool:e}}));return}case`branch-not-found`:s.error(g({id:`NJyQi_`,values:{shareBranch:T}}));return;case`fetch-failed`:s.error(g({id:`bWLmRK`}));return;case`already-checked-out`:s.error(g({id:`ljHjfg`}));return;case`branch-exists`:s.error(g({id:`h3QZcB`,values:{shareBranch:T}}));return;case`path-exists`:s.error(g({id:`cN1Gcp`,values:{shareBranch:T}}));return;case`no-git`:s.error(g({id:`CFnavk`}));return;case`empty-repo`:s.error(g({id:`5IgYAM`}));return;case`invalid-branch`:s.error(g({id:`JfPuv7`,values:{shareBranch:T}}));return;case`project-scope-unavailable`:s.error(g(le({reason:t,issue:e.projectScopeIssue})));return;case`proxy-null`:case`error`:s.error(g({id:`e8zYa8`,values:{shareBranch:T}}));return;default:throw Error(`Unhandled worktree failure reason: ${String(t)}`)}},t[80]=g,t[81]=T,t[82]=dt):dt=t[82];let ft=dt,pt;t[83]!==g||t[84]!==n.project||t[85]!==C||t[86]!==T||t[87]!==ft||t[88]!==p?(pt=function(e){e?.ok===!1&&e.reason===`project-scope-unavailable`&&f();let t,r=!1,i=null;if(b(n=>{let{state:a,sideEffect:o}=Ce(n,e);return o&&(t=o,r=a.phase===`dismissed`),a.phase===`opening-worktree`&&(i=a.path),a}),t!==void 0&&(console.log(m({branch_dialog_action:`open-worktree-failed:${t.reason}`,branch:T})),ft(t)),i!==null){f();let e=i;n.project.open({path:e,target:`new-window`,entryPoint:`worktree`,pendingDeepLinkTarget:Te(C),pendingBranch:T}).catch(t=>{console.warn(`[receive] worktree-open-failed branch_dialog_action=open-worktree`,t instanceof Error?t.message:t),s.error(g({id:`LdABLa`,values:{target:e}}))}),p.dismiss()}r&&p.dismiss()},t[83]=g,t[84]=n.project,t[85]=C,t[86]=T,t[87]=ft,t[88]=p,t[89]=pt):pt=t[89];let mt=pt,ht;t[90]!==mt||t[91]!==y.phase||t[92]!==n.worktree||t[93]!==T?(ht=function(){y.phase===`ready`&&(console.log(m({branch_dialog_action:`open-worktree`,branch:T})),b(ve),n.worktree.checkout({branch:T}).then(e=>{mt(e)}).catch(e=>{console.warn(`[receive] worktree-checkout rejected branch_dialog_action=open-worktree`,e instanceof Error?e.message:e),mt(null)}))},t[90]=mt,t[91]=y.phase,t[92]=n.worktree,t[93]=T,t[94]=ht):ht=t[94];let gt=ht,_t;t[95]!==g||t[96]!==y.otherWorktreePath||t[97]!==y.phase||t[98]!==n.project||t[99]!==C||t[100]!==T||t[101]!==p?(_t=function(){if(y.phase!==`branch-in-other-worktree`)return;let e=y.otherWorktreePath;console.log(m({branch_dialog_action:`pivot-to-other-worktree`,branch:T})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Te(C),pendingBranch:T}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),s.error(g({id:`LdABLa`,values:{target:e}}))}),p.dismiss()},t[95]=g,t[96]=y.otherWorktreePath,t[97]=y.phase,t[98]=n.project,t[99]=C,t[100]=T,t[101]=p,t[102]=_t):_t=t[102];let vt=_t,yt;t[103]!==y.phase||t[104]!==y.resolution||t[105]!==p?(yt=function(){console.log(m({branch_dialog_action:`cancel`,verdict_cell:y.phase===`verdict`?y.resolution.kind:void 0})),p.dismiss()},t[103]=y.phase,t[104]=y.resolution,t[105]=p,t[106]=yt):yt=t[106];let D=yt,O,k,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K;if(t[107]!==g||t[108]!==y.info||t[109]!==y.otherWorktreePath||t[110]!==y.phase||t[111]!==y.resolution||t[112]!==D||t[113]!==$e||t[114]!==C.branch||t[115]!==C.owner||t[116]!==C.repo||t[117]!==C.target||t[118]!==T||t[119]!==S){G=y.phase===`ready`||y.phase===`switching`||y.phase===`creating-worktree`?pe(y.info):null;let e;t[139]!==y.info||t[140]!==y.phase||t[141]!==$e?(e=y.phase===`ready`||y.phase===`switching`||y.phase===`creating-worktree`?me(y.info):$e??`HEAD`,t[139]=y.info,t[140]=y.phase,t[141]=$e,t[142]=e):e=t[142];let n=e;P=y.phase===`switching`||y.phase===`awaiting-cc1-recycle`,j=y.phase===`creating-worktree`;let i;t[143]===g?i=t[144]:(i=g({id:`OuY8t9`}),t[143]=g,t[144]=i),M=i;let a;t[145]===g?a=t[146]:(a=g({id:`XZkdtg`}),t[145]=g,t[146]=a),N=a;let o;t[147]===g?o=t[148]:(o=g({id:`VTulZj`}),t[147]=g,t[148]=o),K=o;let s=y.phase===`loading`,ee=y.phase===`error`;A=ce,U=!0,t[149]===D?W=t[150]:(W=e=>{e||D()},t[149]=D,t[150]=W),k=ae,R=`sm:max-w-xl`,z=`share-branch-switch-dialog`,B=ke,V=Oe;let l;t[151]===S?l=t[152]:(l=(0,_.jsx)(ie,{children:(0,_.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:S}})}),t[151]=S,t[152]=l);let te=C.owner,ne=C.repo,d;t[153]===C.target?d=t[154]:(d=c(C.target),t[153]=C.target,t[154]=d);let f;t[155]!==C.owner||t[156]!==C.repo||t[157]!==d?(f=(0,_.jsx)(re,{className:`sr-only`,children:(0,_.jsx)(r,{id:`f8jU-L`,values:{0:te,1:ne,2:d}})}),t[155]=C.owner,t[156]=C.repo,t[157]=d,t[158]=f):f=t[158],t[159]!==l||t[160]!==f?(H=(0,_.jsxs)(se,{children:[l,f]}),t[159]=l,t[160]=f,t[161]=H):H=t[161],O=oe;let le=C.owner,p=C.repo,m;t[162]===C.target?m=t[163]:(m=c(C.target),t[162]=C.target,t[163]=m),t[164]!==C.branch||t[165]!==C.owner||t[166]!==C.repo||t[167]!==C.target.kind||t[168]!==m?(F=(0,_.jsx)(`div`,{className:`mb-4`,children:(0,_.jsx)(de,{owner:le,repo:p,path:m,kind:C.target.kind,branch:C.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[164]=C.branch,t[165]=C.owner,t[166]=C.repo,t[167]=C.target.kind,t[168]=m,t[169]=F):F=t[169],I=y.phase===`branch-in-other-worktree`?(0,_.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,_.jsx)(`p`,{className:`leading-6`,children:(0,_.jsx)(r,{id:`yjExfe`,values:{shareBranch:T},components:{0:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,_.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:y.otherWorktreePath})]}):y.phase===`verdict-pending`?(0,_.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,_.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,_.jsx)(r,{id:`c8jBgX`})]}):y.phase===`verdict`?y.resolution.kind===`on-origin`?(0,_.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-on-origin`,children:(0,_.jsx)(r,{id:`Uay5NL`,values:{targetNoun:S,shareBranch:T},components:{0:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):y.resolution.kind===`renamed`?(0,_.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-renamed`,children:(0,_.jsx)(r,{id:`P0HC30`,values:{0:y.resolution.renamedTo,targetNoun:S},components:{0:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):y.resolution.kind===`diverged`?(0,_.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-diverged`,children:(0,_.jsx)(r,{id:`kLv8d3`,values:{shareBranch:T,targetNoun:S},components:{0:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,_.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,_.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,_.jsx)(r,{id:`c8jBgX`})]}):s?(0,_.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,_.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,_.jsx)(r,{id:`jerqF0`})]}):ee?(0,_.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,_.jsx)(r,{id:`w4hMYl`})}):G?.kind===`D`?(0,_.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,_.jsx)(r,{id:`DTI-fp`,values:{targetNoun:S,shareBranch:T},components:{0:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):G?.kind===`B`?(0,_.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,_.jsx)(r,{id:`sZ2IOu`,values:{targetNoun:S,shareBranch:T,currentLabel:n},components:{0:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,_.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,_.jsx)(r,{id:`_902BE`,values:{targetNoun:S,shareBranch:T,currentLabel:n},components:{0:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),L=G&&!G.switchEnabled&&G.conflictingFiles.length>0?(0,_.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,_.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,_.jsx)(r,{id:`n2lRue`})}),(0,_.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:G.conflictingFiles.map(De)})]}):null,t[107]=g,t[108]=y.info,t[109]=y.otherWorktreePath,t[110]=y.phase,t[111]=y.resolution,t[112]=D,t[113]=$e,t[114]=C.branch,t[115]=C.owner,t[116]=C.repo,t[117]=C.target,t[118]=T,t[119]=S,t[120]=O,t[121]=k,t[122]=A,t[123]=j,t[124]=M,t[125]=N,t[126]=P,t[127]=F,t[128]=I,t[129]=L,t[130]=R,t[131]=z,t[132]=B,t[133]=V,t[134]=H,t[135]=U,t[136]=W,t[137]=G,t[138]=K}else O=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];let q;t[170]===P?q=t[171]:(q=P?(0,_.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,_.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,_.jsx)(r,{id:`CU3AiE`})]}):null,t[170]=P,t[171]=q);let J;t[172]===j?J=t[173]:(J=j?(0,_.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,_.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,_.jsx)(r,{id:`PZtgO0`})]}):null,t[172]=j,t[173]=J);let Y;t[174]!==O||t[175]!==F||t[176]!==I||t[177]!==L||t[178]!==q||t[179]!==J?(Y=(0,_.jsxs)(O,{children:[F,I,L,q,J]}),t[174]=O,t[175]=F,t[176]=I,t[177]=L,t[178]=q,t[179]=J,t[180]=Y):Y=t[180];let bt;t[181]===Symbol.for(`react.memo_cache_sentinel`)?(bt=(0,_.jsx)(r,{id:`dEgA5A`}),t[181]=bt):bt=t[181];let X;t[182]===D?X=t[183]:(X=(0,_.jsx)(o,{variant:`ghost`,onClick:D,"data-testid":`share-branch-switch-cancel`,children:bt}),t[182]=D,t[183]=X);let Z;t[184]!==y.phase||t[185]!==y.resolution||t[186]!==j||t[187]!==ut||t[188]!==ot||t[189]!==gt||t[190]!==vt||t[191]!==ct||t[192]!==nt||t[193]!==it||t[194]!==M||t[195]!==N||t[196]!==P||t[197]!==G||t[198]!==K?(Z=y.phase===`branch-in-other-worktree`?(0,_.jsx)(o,{onClick:vt,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,_.jsx)(r,{id:`hyCxJY`})}):y.phase===`verdict`?y.resolution.kind===`on-origin`?(0,_.jsxs)(o,{onClick:it,"data-testid":`share-branch-switch-verdict-switch-update`,children:[(0,_.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),(0,_.jsx)(r,{id:`uA_jXp`})]}):y.resolution.kind===`renamed`?(0,_.jsxs)(o,{onClick:ot,"data-testid":`share-branch-switch-verdict-open-renamed`,children:[(0,_.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),(0,_.jsx)(r,{id:`AItsE5`})]}):y.resolution.kind===`diverged`?(0,_.jsxs)(o,{onClick:ct,"data-testid":`share-branch-switch-verdict-plain-switch`,children:[(0,_.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),N]}):null:(0,_.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:[G?.openCurrentEnabled?(0,_.jsxs)(o,{variant:`outline`,onClick:ut,disabled:P||j,"data-testid":`share-branch-switch-open-current`,children:[(0,_.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),M]}):null,(0,_.jsx)(o,{variant:`outline`,onClick:nt,disabled:!G?.switchEnabled||P||j,"aria-disabled":!G?.switchEnabled||P||j,"aria-describedby":G&&!G.switchEnabled&&G.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:P?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(u,{className:`size-3.5`,"aria-hidden":`true`}),N]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),N]})}),(0,_.jsx)(o,{onClick:gt,disabled:!G||P||j,"data-testid":`share-branch-switch-worktree`,children:j?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(u,{className:`size-3.5`,"aria-hidden":`true`}),K]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),K]})})]}),t[184]=y.phase,t[185]=y.resolution,t[186]=j,t[187]=ut,t[188]=ot,t[189]=gt,t[190]=vt,t[191]=ct,t[192]=nt,t[193]=it,t[194]=M,t[195]=N,t[196]=P,t[197]=G,t[198]=K,t[199]=Z):Z=t[199];let Q;t[200]!==X||t[201]!==Z?(Q=(0,_.jsxs)(d,{className:`sm:justify-between`,children:[X,Z]}),t[200]=X,t[201]=Z,t[202]=Q):Q=t[202];let $;t[203]!==k||t[204]!==R||t[205]!==z||t[206]!==B||t[207]!==V||t[208]!==H||t[209]!==Y||t[210]!==Q?($=(0,_.jsxs)(k,{className:R,"data-testid":z,onInteractOutside:B,onPointerDownOutside:V,children:[H,Y,Q]}),t[203]=k,t[204]=R,t[205]=z,t[206]=B,t[207]=V,t[208]=H,t[209]=Y,t[210]=Q,t[211]=$):$=t[211];let xt;return t[212]!==A||t[213]!==U||t[214]!==W||t[215]!==$?(xt=(0,_.jsx)(A,{open:U,onOpenChange:W,children:$}),t[212]=A,t[213]=U,t[214]=W,t[215]=$,t[216]=xt):xt=t[216],xt}function De(e){return(0,_.jsx)(`li`,{children:(0,_.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function Oe(e){e.preventDefault()}function ke(e){e.preventDefault()}function Ae(){return p.request()}function je(e){return Se(e,null).state}function Me(e){return xe(e,null)}function Ne(e){return ge(e,null)}function Pe(){return null}export{v 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-BeFNZANd.js";import{n as s}from"./dist-CJhtNlOm2.js";import{t as c}from"./desktop-bridge-types-oYPdTDmz.js";import{n as ee,t as l}from"./git-branch-B_QTfwFA.js";import{t as u}from"./spinner-Bp2_BYkl.js";import{n as te,t as ne}from"./miss-dialog-store-CNJRdTPE.js";import{a as re,c as ie,i as ae,n as oe,o as d,s as se,t as ce}from"./dialog-DJkPMmCN.js";import{i as f,n as le,t as p}from"./auth-prompt-store-D3eTM4hj.js";import{a as m,n as ue}from"./receive-store-KJtLoUh8.js";import{t as de}from"./share-metadata-rows-R5Z0YM14.js";var h=e(n(),1),fe=a();function pe(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 me(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function g(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 he={phase:`loading`};function ge(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function _e(e,t){return e.phase!==`ready`&&e.phase!==`verdict`?e:{phase:`switching`,info:e.info,pendingDoc:t}}function ve(e){return e.phase===`ready`?{phase:`creating-worktree`,info:e.info}:e}function ye(e){return pe(e).kind===`B`&&e.shareTargetOnOriginBranch===!1}function be(e){return e.phase===`ready`?{phase:`verdict-pending`,info:e.info}:e}function xe(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 Se(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=g(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 Ce(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`}}:t.reason===`project-scope-unavailable`?{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:t.reason,projectScopeIssue:t.issue}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:t.reason,helper:t.helper,authFailed:t.reason===`fetch-failed`?t.authFailed:void 0,notFoundAsIdentity:t.reason===`fetch-failed`?t.notFoundAsIdentity:void 0}}:{state:e}}var _=t();function we(e){return c(e.repositoryTarget)}function Te(e,t=c(e.target)){let n=e.contentRootDepth===null?t:[...we(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 Ee(e){return e!==null&&e.kind===`project-branch-switch`}function v(e){let t=(0,fe.c)(217),{bridge:n,store:a}=e,p=a===void 0?ue:a,{_:g}=i(),v=(0,h.useSyncExternalStore)(p.subscribe,p.getSnapshot,Pe),[y,b]=(0,h.useState)(he),Fe=(0,h.useRef)(!1),Ie=(0,h.useRef)(!1),Le=(0,h.useRef)(!1),Re=(0,h.useRef)(null),ze;t[0]===v?ze=t[1]:(ze=Ee(v)?v:null,t[0]=v,t[1]=ze);let x=ze,Be;t[2]!==g||t[3]!==x?.share.target.kind?(Be=x?.share.target.kind===`folder`?g({id:`ugoTXs`}):g({id:`XH30C4`}),t[2]=g,t[3]=x?.share.target.kind,t[4]=Be):Be=t[4];let S=Be,Ve;t[5]===x?Ve=t[6]:(Ve=()=>{b(he),Fe.current=!1,Ie.current=!1,Le.current=!1,Re.current=x},t[5]=x,t[6]=Ve);let He;t[7]===v?He=t[8]:(He=[v],t[7]=v,t[8]=He),(0,h.useEffect)(Ve,He);let Ue;t[9]!==x||t[10]!==n?(Ue=()=>{if(!x||Fe.current)return;Fe.current=!0;let e=!1;return n.project.fetchBranchInfo({projectPath:x.projectPath,branch:x.share.branch,kind:x.share.repositoryTarget.kind,path:we(x.share)}).then(t=>{e||b(e=>ge(e,t))}).catch(t=>{e||(console.warn(`[receive] branch-info-fetch-failed`,t instanceof Error?t.message:t),b(Ne))}),()=>{e=!0}},t[9]=x,t[10]=n,t[11]=Ue):Ue=t[11];let We;t[12]===x?We=t[13]:(We=[x],t[12]=x,t[13]=We),(0,h.useEffect)(Ue,We);let Ge;t[14]!==x||t[15]!==y.info||t[16]!==y.phase||t[17]!==n?(Ge=()=>{if(!x||y.phase!==`ready`||Le.current||!ye(y.info))return;Le.current=!0,b(be);let e=x;n.project.fetchTargetStatus({projectPath:x.projectPath,branch:x.share.branch,kind:x.share.target.kind,path:we(x.share),...x.share.contentRootDepth===null?{}:{contentRootDepth:x.share.contentRootDepth}}).then(t=>{Re.current===e&&b(e=>xe(e,t))}).catch(t=>{Re.current===e&&(console.warn(`[receive] target-status-fetch-failed`,t instanceof Error?t.message:t),b(Me))})},t[14]=x,t[15]=y.info,t[16]=y.phase,t[17]=n,t[18]=Ge):Ge=t[18];let Ke;t[19]!==x||t[20]!==y.phase?(Ke=[y.phase,x],t[19]=x,t[20]=y.phase,t[21]=Ke):Ke=t[21],(0,h.useEffect)(Ge,Ke);let qe;t[22]!==x||t[23]!==y.phase||t[24]!==y.resolution||t[25]!==p?(qe=()=>{if(y.phase!==`verdict`)return;let{kind:e}=y.resolution;e!==`deleted`&&e!==`never-on-branch`||x&&(ne.arm({kind:x.share.target.kind,path:c(x.share.target),repositoryPath:we(x.share),...x.share.contentRootDepth===null?{}:{contentRootDepth:x.share.contentRootDepth},branch:x.share.branch}),p.dismiss())},t[22]=x,t[23]=y.phase,t[24]=y.resolution,t[25]=p,t[26]=qe):qe=t[26];let Je;t[27]!==x||t[28]!==y||t[29]!==p?(Je=[y,x,p],t[27]=x,t[28]=y,t[29]=p,t[30]=Je):Je=t[30],(0,h.useEffect)(qe,Je);let Ye;t[31]!==y.phase||t[32]!==y.resolution?(Ye=()=>{y.phase===`verdict`&&console.log(m({verdict_cell:y.resolution.kind}))},t[31]=y.phase,t[32]=y.resolution,t[33]=Ye):Ye=t[33];let Xe;t[34]===y?Xe=t[35]:(Xe=[y],t[34]=y,t[35]=Xe),(0,h.useEffect)(Ye,Xe);let Ze;t[36]!==g||t[37]!==x||t[38]!==y.pendingDoc||t[39]!==y.phase||t[40]!==n||t[41]!==p||t[42]!==S?(Ze=()=>{if(y.phase!==`awaiting-cc1-recycle`||!x)return;let e=x.share.branch,t=y.pendingDoc;if(!e){p.dismiss();return}if(Ie.current)return;Ie.current=!0;let r=!1;return n.project.awaitBranchSwitched({projectPath:x.projectPath,branch:e,timeoutMs:3e4}).then(i=>{if(!r){if(i.ok){console.log(m({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:x.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Te(x.share,t),pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),s.error(g({id:`gQV-9w`,values:{targetNoun:S}}))}),p.dismiss();return}console.log(m({branch_dialog_action:`branch-switch-timeout`,branch:e})),s.error(g({id:`LBwUR6`,values:{targetNoun:S}})),p.dismiss()}}).catch(e=>{r||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),s.error(g({id:`Jw6EC4`,values:{targetNoun:S}})),p.dismiss())}),()=>{r=!0}},t[36]=g,t[37]=x,t[38]=y.pendingDoc,t[39]=y.phase,t[40]=n,t[41]=p,t[42]=S,t[43]=Ze):Ze=t[43];let Qe;if(t[44]!==x||t[45]!==y.phase?(Qe=[y.phase,x],t[44]=x,t[45]=y.phase,t[46]=Qe):Qe=t[46],(0,h.useEffect)(Ze,Qe),!x)return null;let{share:C,projectPath:w,currentBranch:$e}=x,T=C.branch,et;t[47]!==g||t[48]!==n.project||t[49]!==w||t[50]!==T||t[51]!==p?(et=function(e,t,r){console.log(m({branch_dialog_action:`switch`,branch_action:`switch`,branch:T,verdict_cell:r})),b(t=>_e(t,e)),n.project.runCheckout(t?{projectPath:w,branch:T,fastForward:!0}:{projectPath:w,branch:T}).then(e=>{let t=null,n=!1;b(r=>{let{state:i,sideEffect:a}=Se(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?s.error(g({id:`NJyQi_`,values:{shareBranch:T}})):t===`fetch-failed`?s.error(g({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&s.error(g({id:`c863eW`,values:{shareBranch:T}})),n&&p.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),b(je),s.error(g({id:`c863eW`,values:{shareBranch:T}}))})},t[47]=g,t[48]=n.project,t[49]=w,t[50]=T,t[51]=p,t[52]=et):et=t[52];let E=et,tt;t[53]!==y.info||t[54]!==y.phase||t[55]!==E||t[56]!==C.target?(tt=function(){y.phase===`ready`&&pe(y.info).switchEnabled&&E(c(C.target),!1)},t[53]=y.info,t[54]=y.phase,t[55]=E,t[56]=C.target,t[57]=tt):tt=t[57];let nt=tt,rt;t[58]!==y.phase||t[59]!==y.resolution||t[60]!==E||t[61]!==C.target?(rt=function(){y.phase===`verdict`&&E(c(C.target),!0,y.resolution.kind)},t[58]=y.phase,t[59]=y.resolution,t[60]=E,t[61]=C.target,t[62]=rt):rt=t[62];let it=rt,at;t[63]!==y.phase||t[64]!==y.resolution||t[65]!==E?(at=function(){y.phase===`verdict`&&y.resolution.kind===`renamed`&&E(y.resolution.renamedTo,!0,y.resolution.kind)},t[63]=y.phase,t[64]=y.resolution,t[65]=E,t[66]=at):at=t[66];let ot=at,st;t[67]!==y.phase||t[68]!==y.resolution||t[69]!==E||t[70]!==C.target?(st=function(){y.phase===`verdict`&&E(c(C.target),!1,y.resolution.kind)},t[67]=y.phase,t[68]=y.resolution,t[69]=E,t[70]=C.target,t[71]=st):st=t[71];let ct=st,lt;t[72]!==g||t[73]!==n.project||t[74]!==w||t[75]!==C||t[76]!==T||t[77]!==p||t[78]!==S?(lt=function(){console.log(m({branch_dialog_action:`open-current`,branch:T})),n.project.open({path:w,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Te(C)}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),s.error(g({id:`b5aNbi`,values:{targetNoun:S}}))}),p.dismiss()},t[72]=g,t[73]=n.project,t[74]=w,t[75]=C,t[76]=T,t[77]=p,t[78]=S,t[79]=lt):lt=t[79];let ut=lt,dt;t[80]!==g||t[81]!==T?(dt=function(e){let{reason:t}=e,n=`helper`in e?e.helper:void 0,r=`authFailed`in e?e.authFailed:void 0,i=`notFoundAsIdentity`in e?e.notFoundAsIdentity:void 0;if(t===`fetch-failed`&&i){s.error(g({id:`jRsjlF`}));return}if(t===`fetch-failed`&&r){s.error(g({id:`gfb-CM`}),{action:{label:g({id:`5lWFkC`}),onClick:Ae}});return}switch(t){case`helper-not-found`:{let e=n??g({id:`cHhH3i`});s.error(g({id:`Z7x_Zh`,values:{tool:e}}));return}case`branch-not-found`:s.error(g({id:`NJyQi_`,values:{shareBranch:T}}));return;case`fetch-failed`:s.error(g({id:`bWLmRK`}));return;case`already-checked-out`:s.error(g({id:`ljHjfg`}));return;case`branch-exists`:s.error(g({id:`h3QZcB`,values:{shareBranch:T}}));return;case`path-exists`:s.error(g({id:`cN1Gcp`,values:{shareBranch:T}}));return;case`no-git`:s.error(g({id:`CFnavk`}));return;case`empty-repo`:s.error(g({id:`5IgYAM`}));return;case`invalid-branch`:s.error(g({id:`JfPuv7`,values:{shareBranch:T}}));return;case`project-scope-unavailable`:s.error(g(le({reason:t,issue:e.projectScopeIssue})));return;case`proxy-null`:case`error`:s.error(g({id:`e8zYa8`,values:{shareBranch:T}}));return;default:throw Error(`Unhandled worktree failure reason: ${String(t)}`)}},t[80]=g,t[81]=T,t[82]=dt):dt=t[82];let ft=dt,pt;t[83]!==g||t[84]!==n.project||t[85]!==C||t[86]!==T||t[87]!==ft||t[88]!==p?(pt=function(e){e?.ok===!1&&e.reason===`project-scope-unavailable`&&f();let t,r=!1,i=null;if(b(n=>{let{state:a,sideEffect:o}=Ce(n,e);return o&&(t=o,r=a.phase===`dismissed`),a.phase===`opening-worktree`&&(i=a.path),a}),t!==void 0&&(console.log(m({branch_dialog_action:`open-worktree-failed:${t.reason}`,branch:T})),ft(t)),i!==null){f();let e=i;n.project.open({path:e,target:`new-window`,entryPoint:`worktree`,pendingDeepLinkTarget:Te(C),pendingBranch:T}).catch(t=>{console.warn(`[receive] worktree-open-failed branch_dialog_action=open-worktree`,t instanceof Error?t.message:t),s.error(g({id:`LdABLa`,values:{target:e}}))}),p.dismiss()}r&&p.dismiss()},t[83]=g,t[84]=n.project,t[85]=C,t[86]=T,t[87]=ft,t[88]=p,t[89]=pt):pt=t[89];let mt=pt,ht;t[90]!==mt||t[91]!==y.phase||t[92]!==n.worktree||t[93]!==T?(ht=function(){y.phase===`ready`&&(console.log(m({branch_dialog_action:`open-worktree`,branch:T})),b(ve),n.worktree.checkout({branch:T}).then(e=>{mt(e)}).catch(e=>{console.warn(`[receive] worktree-checkout rejected branch_dialog_action=open-worktree`,e instanceof Error?e.message:e),mt(null)}))},t[90]=mt,t[91]=y.phase,t[92]=n.worktree,t[93]=T,t[94]=ht):ht=t[94];let gt=ht,_t;t[95]!==g||t[96]!==y.otherWorktreePath||t[97]!==y.phase||t[98]!==n.project||t[99]!==C||t[100]!==T||t[101]!==p?(_t=function(){if(y.phase!==`branch-in-other-worktree`)return;let e=y.otherWorktreePath;console.log(m({branch_dialog_action:`pivot-to-other-worktree`,branch:T})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Te(C),pendingBranch:T}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),s.error(g({id:`LdABLa`,values:{target:e}}))}),p.dismiss()},t[95]=g,t[96]=y.otherWorktreePath,t[97]=y.phase,t[98]=n.project,t[99]=C,t[100]=T,t[101]=p,t[102]=_t):_t=t[102];let vt=_t,yt;t[103]!==y.phase||t[104]!==y.resolution||t[105]!==p?(yt=function(){console.log(m({branch_dialog_action:`cancel`,verdict_cell:y.phase===`verdict`?y.resolution.kind:void 0})),p.dismiss()},t[103]=y.phase,t[104]=y.resolution,t[105]=p,t[106]=yt):yt=t[106];let D=yt,O,k,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K;if(t[107]!==g||t[108]!==y.info||t[109]!==y.otherWorktreePath||t[110]!==y.phase||t[111]!==y.resolution||t[112]!==D||t[113]!==$e||t[114]!==C.branch||t[115]!==C.owner||t[116]!==C.repo||t[117]!==C.target||t[118]!==T||t[119]!==S){G=y.phase===`ready`||y.phase===`switching`||y.phase===`creating-worktree`?pe(y.info):null;let e;t[139]!==y.info||t[140]!==y.phase||t[141]!==$e?(e=y.phase===`ready`||y.phase===`switching`||y.phase===`creating-worktree`?me(y.info):$e??`HEAD`,t[139]=y.info,t[140]=y.phase,t[141]=$e,t[142]=e):e=t[142];let n=e;P=y.phase===`switching`||y.phase===`awaiting-cc1-recycle`,j=y.phase===`creating-worktree`;let i;t[143]===g?i=t[144]:(i=g({id:`OuY8t9`}),t[143]=g,t[144]=i),M=i;let a;t[145]===g?a=t[146]:(a=g({id:`XZkdtg`}),t[145]=g,t[146]=a),N=a;let o;t[147]===g?o=t[148]:(o=g({id:`VTulZj`}),t[147]=g,t[148]=o),K=o;let s=y.phase===`loading`,ee=y.phase===`error`;A=ce,U=!0,t[149]===D?W=t[150]:(W=e=>{e||D()},t[149]=D,t[150]=W),k=ae,R=`sm:max-w-xl`,z=`share-branch-switch-dialog`,B=ke,V=Oe;let l;t[151]===S?l=t[152]:(l=(0,_.jsx)(ie,{children:(0,_.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:S}})}),t[151]=S,t[152]=l);let te=C.owner,ne=C.repo,d;t[153]===C.target?d=t[154]:(d=c(C.target),t[153]=C.target,t[154]=d);let f;t[155]!==C.owner||t[156]!==C.repo||t[157]!==d?(f=(0,_.jsx)(re,{className:`sr-only`,children:(0,_.jsx)(r,{id:`f8jU-L`,values:{0:te,1:ne,2:d}})}),t[155]=C.owner,t[156]=C.repo,t[157]=d,t[158]=f):f=t[158],t[159]!==l||t[160]!==f?(H=(0,_.jsxs)(se,{children:[l,f]}),t[159]=l,t[160]=f,t[161]=H):H=t[161],O=oe;let le=C.owner,p=C.repo,m;t[162]===C.target?m=t[163]:(m=c(C.target),t[162]=C.target,t[163]=m),t[164]!==C.branch||t[165]!==C.owner||t[166]!==C.repo||t[167]!==C.target.kind||t[168]!==m?(F=(0,_.jsx)(`div`,{className:`mb-4`,children:(0,_.jsx)(de,{owner:le,repo:p,path:m,kind:C.target.kind,branch:C.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[164]=C.branch,t[165]=C.owner,t[166]=C.repo,t[167]=C.target.kind,t[168]=m,t[169]=F):F=t[169],I=y.phase===`branch-in-other-worktree`?(0,_.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,_.jsx)(`p`,{className:`leading-6`,children:(0,_.jsx)(r,{id:`yjExfe`,values:{shareBranch:T},components:{0:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,_.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:y.otherWorktreePath})]}):y.phase===`verdict-pending`?(0,_.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,_.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,_.jsx)(r,{id:`c8jBgX`})]}):y.phase===`verdict`?y.resolution.kind===`on-origin`?(0,_.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-on-origin`,children:(0,_.jsx)(r,{id:`Uay5NL`,values:{targetNoun:S,shareBranch:T},components:{0:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):y.resolution.kind===`renamed`?(0,_.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-renamed`,children:(0,_.jsx)(r,{id:`P0HC30`,values:{0:y.resolution.renamedTo,targetNoun:S},components:{0:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):y.resolution.kind===`diverged`?(0,_.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-diverged`,children:(0,_.jsx)(r,{id:`kLv8d3`,values:{shareBranch:T,targetNoun:S},components:{0:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,_.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,_.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,_.jsx)(r,{id:`c8jBgX`})]}):s?(0,_.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,_.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,_.jsx)(r,{id:`jerqF0`})]}):ee?(0,_.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,_.jsx)(r,{id:`w4hMYl`})}):G?.kind===`D`?(0,_.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,_.jsx)(r,{id:`DTI-fp`,values:{targetNoun:S,shareBranch:T},components:{0:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):G?.kind===`B`?(0,_.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,_.jsx)(r,{id:`sZ2IOu`,values:{targetNoun:S,shareBranch:T,currentLabel:n},components:{0:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,_.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,_.jsx)(r,{id:`_902BE`,values:{targetNoun:S,shareBranch:T,currentLabel:n},components:{0:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,_.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),L=G&&!G.switchEnabled&&G.conflictingFiles.length>0?(0,_.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,_.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,_.jsx)(r,{id:`n2lRue`})}),(0,_.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:G.conflictingFiles.map(De)})]}):null,t[107]=g,t[108]=y.info,t[109]=y.otherWorktreePath,t[110]=y.phase,t[111]=y.resolution,t[112]=D,t[113]=$e,t[114]=C.branch,t[115]=C.owner,t[116]=C.repo,t[117]=C.target,t[118]=T,t[119]=S,t[120]=O,t[121]=k,t[122]=A,t[123]=j,t[124]=M,t[125]=N,t[126]=P,t[127]=F,t[128]=I,t[129]=L,t[130]=R,t[131]=z,t[132]=B,t[133]=V,t[134]=H,t[135]=U,t[136]=W,t[137]=G,t[138]=K}else O=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];let q;t[170]===P?q=t[171]:(q=P?(0,_.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,_.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,_.jsx)(r,{id:`CU3AiE`})]}):null,t[170]=P,t[171]=q);let J;t[172]===j?J=t[173]:(J=j?(0,_.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,_.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,_.jsx)(r,{id:`PZtgO0`})]}):null,t[172]=j,t[173]=J);let Y;t[174]!==O||t[175]!==F||t[176]!==I||t[177]!==L||t[178]!==q||t[179]!==J?(Y=(0,_.jsxs)(O,{children:[F,I,L,q,J]}),t[174]=O,t[175]=F,t[176]=I,t[177]=L,t[178]=q,t[179]=J,t[180]=Y):Y=t[180];let bt;t[181]===Symbol.for(`react.memo_cache_sentinel`)?(bt=(0,_.jsx)(r,{id:`dEgA5A`}),t[181]=bt):bt=t[181];let X;t[182]===D?X=t[183]:(X=(0,_.jsx)(o,{variant:`ghost`,onClick:D,"data-testid":`share-branch-switch-cancel`,children:bt}),t[182]=D,t[183]=X);let Z;t[184]!==y.phase||t[185]!==y.resolution||t[186]!==j||t[187]!==ut||t[188]!==ot||t[189]!==gt||t[190]!==vt||t[191]!==ct||t[192]!==nt||t[193]!==it||t[194]!==M||t[195]!==N||t[196]!==P||t[197]!==G||t[198]!==K?(Z=y.phase===`branch-in-other-worktree`?(0,_.jsx)(o,{onClick:vt,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,_.jsx)(r,{id:`hyCxJY`})}):y.phase===`verdict`?y.resolution.kind===`on-origin`?(0,_.jsxs)(o,{onClick:it,"data-testid":`share-branch-switch-verdict-switch-update`,children:[(0,_.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),(0,_.jsx)(r,{id:`uA_jXp`})]}):y.resolution.kind===`renamed`?(0,_.jsxs)(o,{onClick:ot,"data-testid":`share-branch-switch-verdict-open-renamed`,children:[(0,_.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),(0,_.jsx)(r,{id:`AItsE5`})]}):y.resolution.kind===`diverged`?(0,_.jsxs)(o,{onClick:ct,"data-testid":`share-branch-switch-verdict-plain-switch`,children:[(0,_.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),N]}):null:(0,_.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:[G?.openCurrentEnabled?(0,_.jsxs)(o,{variant:`outline`,onClick:ut,disabled:P||j,"data-testid":`share-branch-switch-open-current`,children:[(0,_.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),M]}):null,(0,_.jsx)(o,{variant:`outline`,onClick:nt,disabled:!G?.switchEnabled||P||j,"aria-disabled":!G?.switchEnabled||P||j,"aria-describedby":G&&!G.switchEnabled&&G.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:P?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(u,{className:`size-3.5`,"aria-hidden":`true`}),N]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),N]})}),(0,_.jsx)(o,{onClick:gt,disabled:!G||P||j,"data-testid":`share-branch-switch-worktree`,children:j?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(u,{className:`size-3.5`,"aria-hidden":`true`}),K]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),K]})})]}),t[184]=y.phase,t[185]=y.resolution,t[186]=j,t[187]=ut,t[188]=ot,t[189]=gt,t[190]=vt,t[191]=ct,t[192]=nt,t[193]=it,t[194]=M,t[195]=N,t[196]=P,t[197]=G,t[198]=K,t[199]=Z):Z=t[199];let Q;t[200]!==X||t[201]!==Z?(Q=(0,_.jsxs)(d,{className:`sm:justify-between`,children:[X,Z]}),t[200]=X,t[201]=Z,t[202]=Q):Q=t[202];let $;t[203]!==k||t[204]!==R||t[205]!==z||t[206]!==B||t[207]!==V||t[208]!==H||t[209]!==Y||t[210]!==Q?($=(0,_.jsxs)(k,{className:R,"data-testid":z,onInteractOutside:B,onPointerDownOutside:V,children:[H,Y,Q]}),t[203]=k,t[204]=R,t[205]=z,t[206]=B,t[207]=V,t[208]=H,t[209]=Y,t[210]=Q,t[211]=$):$=t[211];let xt;return t[212]!==A||t[213]!==U||t[214]!==W||t[215]!==$?(xt=(0,_.jsx)(A,{open:U,onOpenChange:W,children:$}),t[212]=A,t[213]=U,t[214]=W,t[215]=$,t[216]=xt):xt=t[216],xt}function De(e){return(0,_.jsx)(`li`,{children:(0,_.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function Oe(e){e.preventDefault()}function ke(e){e.preventDefault()}function Ae(){return p.request()}function je(e){return Se(e,null).state}function Me(e){return xe(e,null)}function Ne(e){return ge(e,null)}function Pe(){return null}export{v 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-BeFNZANd.js";import{Rn as s,Vn as c}from"./dist-DTxb76k4.js";import{n as l}from"./dist-CJhtNlOm2.js";import{t as u}from"./desktop-bridge-types-oYPdTDmz.js";import{t as ee}from"./spinner-Bp2_BYkl.js";import{a as d,c as f,i as p,n as te,o as m,s as h,t as g}from"./dialog-DJkPMmCN.js";import{a as ne,i as _,n as v,o as y,r as re,s as b}from"./receive-store-DE9tB4jY.js";import{t as ie}from"./share-metadata-rows-R5Z0YM14.js";var x=e(n(),1),S=a(),C=e=>({phase:`ready`,seed:e});function w(e){return e.phase===`ready`?{phase:`initializing`,seed:e.seed}:e}function T(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 E(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 D(e){return e.phase===`done`||e.phase===`cancelled`||e.phase===`error`?e:{phase:`cancelled`,seed:e.seed}}var O=t();function k(e){return{kind:e.target.kind,path:u(e.target),repositoryPath:u(e.repositoryTarget),...e.contentRootDepth===null?{}:{contentRootDepth:e.contentRootDepth}}}function A(e){return e!==null&&e.kind===`launcher-consent`}function j(e){return e!==null&&e.kind===`launcher-miss`}function M(e){let t=(0,S.c)(14),{bridge:n,cloneController:r,store:i}=e,a=i===void 0?v:i,o=(0,x.useSyncExternalStore)(a.subscribe,a.getSnapshot,P),[s,c]=(0,x.useState)(0),[u,ee]=(0,x.useState)(o);o!==u&&(ee(o),c(N));let d,f;t[0]!==o||t[1]!==a?(d=()=>{if(!o)return;let e=b(o);e&&(l.error(e.message),a.dismiss())},f=[o,a],t[0]=o,t[1]=a,t[2]=d,t[3]=f):(d=t[2],f=t[3]),(0,x.useEffect)(d,f);let p;t[4]===o?p=t[5]:(p=j(o)?o:null,t[4]=o,t[5]=p);let te=p,m;t[6]===o?m=t[7]:(m=A(o)?o:null,t[6]=o,t[7]=m);let h=m??te;if(!h)return null;let g;return t[8]!==h||t[9]!==n||t[10]!==r||t[11]!==s||t[12]!==a?(g=(0,O.jsx)(F,{payload:h,bridge:n,cloneController:r,store:a},s),t[8]=h,t[9]=n,t[10]=r,t[11]=s,t[12]=a,t[13]=g):g=t[13],g}function N(e){return e+1}function P(){return null}function F(e){let t=(0,S.c)(165),{payload:n,bridge:a,cloneController:v,store:b}=e,{_:w}=i(),[D,M]=(0,x.useState)(!1),[N,P]=(0,x.useState)(null),[F,ue]=(0,x.useState)(!1),[I,de]=(0,x.useState)(!1),[L,fe]=(0,x.useState)(null),[R,z]=(0,x.useState)(null),pe=(0,x.useRef)(!1),me=(0,x.useRef)(null),he,ge;t[0]===L?(he=t[1],ge=t[2]):(he=()=>{L&&me.current?.focus()},ge=[L],t[0]=L,t[1]=he,t[2]=ge),(0,x.useEffect)(he,ge);let _e;t[3]!==R||t[4]!==n?(_e=()=>{A(n)&&R===null&&(console.warn(`[receive] q1_hit=true selection=branch_match_non_ok candidate=${n.candidatePath}`),z(C({candidatePath:n.candidatePath,branch:n.share.branch,targetPath:u(n.share.target),targetKind:n.share.target.kind,repositoryPath:u(n.share.repositoryTarget),...n.share.contentRootDepth===null?{}:{contentRootDepth:n.share.contentRootDepth},parentProjectName:n.parentProjectName})))},t[3]=R,t[4]=n,t[5]=_e):_e=t[5];let ve;t[6]===n?ve=t[7]:(ve=[n],t[6]=n,t[7]=ve),(0,x.useEffect)(_e,ve);let ye;t[8]!==N||t[9]!==v||t[10]!==n?(ye=()=>{if(!v||!j(n)||N!==null||pe.current)return;pe.current=!0,ue(!0);let e=n.share.host;v.getAuthStatus(e).then(e=>{P(e)}).catch(t=>{console.warn(`[receive] auth pre-flight probe failed`,t instanceof Error?t.message:t),P({authenticated:!1,host:e})}).finally(()=>{ue(!1)})},t[8]=N,t[9]=v,t[10]=n,t[11]=ye):ye=t[11];let be;t[12]!==N||t[13]!==n?(be=[n,N],t[12]=N,t[13]=n,t[14]=be):be=t[14],(0,x.useEffect)(ye,be);let B=j(n)?n:null,xe=A(n)?n:null,V=B?.share??xe?.share??null,H,Se,U,W,G,Ce,K,q;if(t[15]!==w||t[16]!==F||t[17]!==a||t[18]!==v||t[19]!==I||t[20]!==R||t[21]!==B||t[22]!==D||t[23]!==V||t[24]!==b){K=Symbol.for(`react.early_return_sentinel`);bb0:{let e=V?{host:V.host,owner:V.owner,repo:V.repo}:null,n;t[33]!==w||t[34]!==V?.target.kind?(n=V?.target.kind===`folder`?w({id:`ugoTXs`}):w({id:`XH30C4`}),t[33]=w,t[34]=V?.target.kind,t[35]=n):n=t[35],q=n,U=async function(){if(!B||!e)return;if(console.log(ne({q2_path:`clone`})),!v){l.info(w({id:`27XW26`}),{action:{label:w({id:`B3NAZC`}),onClick:()=>{a.navigator.open()}},duration:8e3});return}if(I)return;fe(null),de(!0);let t=re(e),n;try{n=await v.runClone({url:t,branch:B.share.branch})}catch(e){let t=e;console.warn(`[receive] runClone threw unexpectedly`,t),de(!1),fe({detail:t instanceof Error?t.message:String(t)});return}if(de(!1),n.kind===`error`){fe({detail:n.detail??null});return}if(n.kind===`ok`){try{await a.project.open({path:n.dir,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:k(B.share)}),b.dismiss()}catch(e){let t=e;console.warn(`[receive] project open after clone failed`,t instanceof Error?t.message:t),l.error(w({id:`438Fca`}))}return}};let i;t[36]!==w||t[37]!==F||t[38]!==v?(i=async function(){if(!(!v||F)){ue(!0);try{let e=await v.startSignIn();ue(!1),e!==null&&P(e)}catch(e){let t=e;ue(!1),console.warn(`[receive] startSignIn failed`,t instanceof Error?t.message:t),l.error(w({id:`lzwo7p`}))}}},t[36]=w,t[37]=F,t[38]=v,t[39]=i):i=t[39],G=i,W=async function(){if(!(!B||!e||D)){fe(null),M(!0),console.log(ne({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(ne({folder_validate:n.kind})),n.kind===`ok`){let e=B.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=c(e,n)!==`true`;try{await a.project.open({path:t,target:`new-window`,entryPoint:`share-receive`,...r?{pendingShareBranchSwitch:{share:B.share,projectPath:t,currentBranch:n.currentBranch}}:{pendingDeepLinkTarget:k(B.share)}}),b.dismiss()}catch(e){let t=e;console.warn(`[receive] local-folder-open failed`,t instanceof Error?t.message:t),l.error(w({id:`phM8Kh`}))}break}let r=y(n,e);r&&l.error(r)}}catch(e){let t=e;console.warn(`[receive] local-folder-validate failed`,t instanceof Error?t.message:t),l.error(w({id:`rlUzXK`}))}M(!1)}};let _;t[40]!==w||t[41]!==a||t[42]!==R||t[43]!==b?(_=function(){if(R===null||R.phase!==`ready`)return;let e=R.seed;console.warn(`[receive] consent_dialog action=initialize worktree=${e.candidatePath}`),z(le),a.project.okInit({projectPath:e.candidatePath}).then(async t=>{if(t.ok===!0){z(e=>e===null?e:T(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}),z(ce),b.dismiss()}catch(t){let n=t,r=n instanceof Error?n.message:String(n);z(e=>e===null?e:E(e,{ok:!1,message:r})),l.error(w({id:`nDT8qt`,values:{0:e.candidatePath}}))}return}let n=t.reason,r=t.message||`Initialization failed.`;z(e=>e===null?e:T(e,{ok:!1,reason:n,message:r})),l.error(r)}).catch(t=>{let n=t instanceof Error?t.message:String(t);z(e=>e===null?e:T(e,{ok:!1,reason:`network-error`,message:n})),l.error(w({id:`3Mwaly`,values:{0:e.candidatePath}}))})},t[40]=w,t[41]=a,t[42]=R,t[43]=b,t[44]=_):_=t[44];let x=_,S;t[45]!==R||t[46]!==b?(S=function(){R!==null&&console.warn(`[receive] consent_dialog action=cancel worktree=${R.seed.candidatePath}`),z(se),b.dismiss()},t[45]=R,t[46]=b,t[47]=S):S=t[47];let C=S;if(R!==null&&R.phase!==`cancelled`&&R.phase!==`done`&&V!==null){let e=R.seed,n=R.phase===`initializing`||R.phase===`opening`,i;t[48]===C?i=t[49]:(i=e=>{e||C()},t[48]=C,t[49]=i);let a;t[50]===q?a=t[51]:(a=(0,O.jsx)(f,{children:(0,O.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:q}})}),t[50]=q,t[51]=a);let s;t[52]===V.target?s=t[53]:(s=u(V.target)?`— ${u(V.target)}`:``,t[52]=V.target,t[53]=s);let c;t[54]!==V.owner||t[55]!==V.repo||t[56]!==s?(c=(0,O.jsx)(d,{className:`sr-only`,children:(0,O.jsx)(r,{id:`pgq_xf`,values:{0:V.owner,1:V.repo,2:s}})}),t[54]=V.owner,t[55]=V.repo,t[56]=s,t[57]=c):c=t[57];let l=V.owner,ne=V.repo,_;t[58]===V.target?_=t[59]:(_=u(V.target),t[58]=V.target,t[59]=_);let v;t[60]!==V.branch||t[61]!==V.owner||t[62]!==V.repo||t[63]!==V.target.kind||t[64]!==_?(v=(0,O.jsx)(ie,{owner:l,repo:ne,path:_,kind:V.target.kind,branch:V.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[60]=V.branch,t[61]=V.owner,t[62]=V.repo,t[63]=V.target.kind,t[64]=_,t[65]=v):v=t[65];let y;t[66]!==a||t[67]!==c||t[68]!==v?(y=(0,O.jsxs)(h,{children:[a,c,v]}),t[66]=a,t[67]=c,t[68]=v,t[69]=y):y=t[69];let re;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`KsAPaB`})}),t[70]=re):re=t[70];let b;t[71]===e.candidatePath?b=t[72]:(b=(0,O.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]=b);let S;t[73]===e.parentProjectName?S=t[74]:(S=e.parentProjectName===null?null:(0,O.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,"data-testid":`share-receive-consent-parent`,children:(0,O.jsx)(r,{id:`JmfgFc`,values:{0:e.parentProjectName}})}),t[73]=e.parentProjectName,t[74]=S);let w;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,O.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`w7SsvI`})}),t[75]=w):w=t[75];let T;t[76]!==R.message||t[77]!==R.phase?(T=R.phase===`error`?(0,O.jsx)(`p`,{className:`mt-3 text-sm text-destructive`,"data-testid":`share-receive-consent-error`,role:`alert`,children:R.message}):null,t[76]=R.message,t[77]=R.phase,t[78]=T):T=t[78];let E;t[79]!==b||t[80]!==S||t[81]!==T?(E=(0,O.jsxs)(te,{children:[re,b,S,w,T]}),t[79]=b,t[80]=S,t[81]=T,t[82]=E):E=t[82];let D;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,O.jsx)(r,{id:`dEgA5A`}),t[83]=D):D=t[83];let k;t[84]===C?k=t[85]:(k=(0,O.jsx)(o,{variant:`ghost`,onClick:C,"data-testid":`share-receive-consent-cancel`,children:D}),t[84]=C,t[85]=k);let A=n||R.phase===`error`,j=n||R.phase===`error`,M;t[86]===n?M=t[87]:(M=n?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(ee,{className:`mr-2 h-4 w-4`,"aria-hidden":`true`}),(0,O.jsx)(r,{id:`NKkZXl`})]}):(0,O.jsx)(r,{id:`NKkZXl`}),t[86]=n,t[87]=M);let N;t[88]!==x||t[89]!==A||t[90]!==j||t[91]!==M?(N=(0,O.jsx)(o,{onClick:x,disabled:A,"aria-disabled":j,"data-testid":`share-receive-consent-initialize`,children:M}),t[88]=x,t[89]=A,t[90]=j,t[91]=M,t[92]=N):N=t[92];let P;t[93]!==k||t[94]!==N?(P=(0,O.jsxs)(m,{children:[k,N]}),t[93]=k,t[94]=N,t[95]=P):P=t[95];let F;t[96]!==y||t[97]!==E||t[98]!==P?(F=(0,O.jsxs)(p,{className:`sm:max-w-xl`,"data-testid":`share-receive-consent-dialog`,onInteractOutside:oe,onPointerDownOutside:ae,children:[y,E,P]}),t[96]=y,t[97]=E,t[98]=P,t[99]=F):F=t[99];let se;t[100]!==i||t[101]!==F?(se=(0,O.jsx)(g,{open:!0,onOpenChange:i,children:F}),t[100]=i,t[101]=F,t[102]=se):se=t[102],K=se;break bb0}if(!B||!V||!e){K=null;break bb0}H=v!==void 0&&!I;let A;t[103]!==w||t[104]!==I?(A=w(I?{id:`YjhKI5`}:{id:`LE7t79`}),t[103]=w,t[104]=I,t[105]=A):A=t[105],Se=A,Ce=s(e)}t[15]=w,t[16]=F,t[17]=a,t[18]=v,t[19]=I,t[20]=R,t[21]=B,t[22]=D,t[23]=V,t[24]=b,t[25]=H,t[26]=Se,t[27]=U,t[28]=W,t[29]=G,t[30]=Ce,t[31]=K,t[32]=q}else H=t[25],Se=t[26],U=t[27],W=t[28],G=t[29],Ce=t[30],K=t[31],q=t[32];if(K!==Symbol.for(`react.early_return_sentinel`))return K;let we=Ce,Te=N?.authenticated?N.login:void 0,Ee;t[106]===L?Ee=t[107]:(Ee=L?.detail?_(L.detail):``,t[106]=L,t[107]=Ee);let De=Ee,J;t[108]===b?J=t[109]:(J=e=>{e||b.dismiss()},t[108]=b,t[109]=J);let Y;t[110]===q?Y=t[111]:(Y=(0,O.jsx)(f,{children:(0,O.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:q}})}),t[110]=q,t[111]=Y);let X;t[112]===V.target?X=t[113]:(X=u(V.target)?` — ${u(V.target)}`:null,t[112]=V.target,t[113]=X);let Z;t[114]!==V.owner||t[115]!==V.repo||t[116]!==X?(Z=(0,O.jsxs)(d,{className:`sr-only`,children:[V.owner,`/`,V.repo,X]}),t[114]=V.owner,t[115]=V.repo,t[116]=X,t[117]=Z):Z=t[117];let Oe=V.owner,ke=V.repo,Q;t[118]===V.target?Q=t[119]:(Q=u(V.target),t[118]=V.target,t[119]=Q);let Ae;t[120]!==V.branch||t[121]!==V.owner||t[122]!==V.repo||t[123]!==V.target.kind||t[124]!==Q?(Ae=(0,O.jsx)(ie,{owner:Oe,repo:ke,path:Q,kind:V.target.kind,branch:V.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[120]=V.branch,t[121]=V.owner,t[122]=V.repo,t[123]=V.target.kind,t[124]=Q,t[125]=Ae):Ae=t[125];let je;t[126]!==Y||t[127]!==Z||t[128]!==Ae?(je=(0,O.jsxs)(h,{children:[Y,Z,Ae]}),t[126]=Y,t[127]=Z,t[128]=Ae,t[129]=je):je=t[129];let Me;t[130]!==v||t[131]!==H||t[132]!==L||t[133]!==De||t[134]!==Se||t[135]!==I||t[136]!==U||t[137]!==W||t[138]!==D?(Me=L?(0,O.jsxs)(`div`,{ref:me,tabIndex:-1,className:`rounded-lg border border-destructive/40 bg-destructive/5 p-4 outline-none`,"data-testid":`share-receive-clone-error`,children:[(0,O.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,role:`alert`,children:(0,O.jsx)(r,{id:`aiArms`})}),De?(0,O.jsxs)(`p`,{className:`mt-2 break-words text-xs text-destructive`,"data-testid":`share-receive-clone-error-message`,children:[(0,O.jsx)(r,{id:`4BITzH`}),` `,(0,O.jsxs)(`span`,{className:`font-mono text-foreground/80`,children:[`"`,De,`"`]})]}):null,(0,O.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`Llyqvo`})}),(0,O.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,O.jsx)(`li`,{children:(0,O.jsx)(r,{id:`6LbUG7`})}),(0,O.jsx)(`li`,{children:(0,O.jsx)(r,{id:`_pY_Vq`})}),(0,O.jsx)(`li`,{children:(0,O.jsx)(r,{id:`J6mxC1`})})]}),(0,O.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,O.jsx)(o,{onClick:()=>{U()},"data-testid":`share-receive-clone-retry`,children:(0,O.jsx)(r,{id:`KDw4GX`})}),(0,O.jsx)(o,{variant:`outline`,onClick:()=>{W()},disabled:D||I,"data-testid":`share-receive-error-local`,children:(0,O.jsx)(r,{id:`xFQRu4`})})]})]}):(0,O.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,O.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-clone`,className:`flex flex-col items-start gap-2 rounded-lg border border-primary/50 bg-primary/5 p-4 text-left transition hover:border-primary hover:bg-primary/10 focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-primary/50 disabled:hover:bg-primary/5`,onClick:()=>{U()},disabled:v!==void 0&&!H,"aria-disabled":v!==void 0&&!H,children:[(0,O.jsx)(`span`,{className:`text-sm font-semibold`,children:Se}),(0,O.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`fj5YiP`})})]}),(0,O.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-local`,className:`flex flex-col items-start gap-2 rounded-lg border border-border bg-card p-4 text-left transition hover:border-foreground/50 hover:bg-accent focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,onClick:()=>{W()},disabled:D||I,children:[(0,O.jsx)(`span`,{className:`text-sm font-semibold`,children:(0,O.jsx)(r,{id:`HfI1dR`})}),(0,O.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`_qD6mn`})})]})]}),t[130]=v,t[131]=H,t[132]=L,t[133]=De,t[134]=Se,t[135]=I,t[136]=U,t[137]=W,t[138]=D,t[139]=Me):Me=t[139];let Ne;t[140]!==F||t[141]!==N||t[142]!==v||t[143]!==G||t[144]!==Te?(Ne=v?(0,O.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:N===null?(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:(0,O.jsx)(r,{id:`UDFrWm`})}):N.authenticated?(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:(0,O.jsx)(r,{id:`VAHWL_`,values:{signedInLogin:Te},components:{0:(0,O.jsx)(`span`,{className:`font-medium text-foreground/90`})}})}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:(0,O.jsx)(r,{id:`SgKLfA`})}),(0,O.jsx)(`button`,{type:`button`,"data-testid":`share-receive-signin`,className:`font-medium text-primary underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded`,onClick:()=>{G()},disabled:F,children:F?(0,O.jsx)(r,{id:`PKLY-1`}):(0,O.jsx)(r,{id:`3jod3l`})})]})}):null,t[140]=F,t[141]=N,t[142]=v,t[143]=G,t[144]=Te,t[145]=Ne):Ne=t[145];let Pe;t[146]!==L||t[147]!==we?(Pe=L?null:(0,O.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`RJ3a8Z`,values:{lookingForUrl:we},components:{0:(0,O.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),t[146]=L,t[147]=we,t[148]=Pe):Pe=t[148];let Fe;t[149]!==Me||t[150]!==Ne||t[151]!==Pe?(Fe=(0,O.jsxs)(te,{children:[Me,Ne,Pe]}),t[149]=Me,t[150]=Ne,t[151]=Pe,t[152]=Fe):Fe=t[152];let Ie;t[153]===b?Ie=t[154]:(Ie=()=>b.dismiss(),t[153]=b,t[154]=Ie);let Le;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,O.jsx)(r,{id:`dEgA5A`}),t[155]=Le):Le=t[155];let Re;t[156]===Ie?Re=t[157]:(Re=(0,O.jsx)(m,{children:(0,O.jsx)(o,{variant:`outline`,onClick:Ie,children:Le})}),t[156]=Ie,t[157]=Re);let $;t[158]!==je||t[159]!==Fe||t[160]!==Re?($=(0,O.jsxs)(p,{className:`sm:max-w-xl`,"data-testid":`share-receive-dialog`,children:[je,Fe,Re]}),t[158]=je,t[159]=Fe,t[160]=Re,t[161]=$):$=t[161];let ze;return t[162]!==J||t[163]!==$?(ze=(0,O.jsx)(g,{open:!0,onOpenChange:J,children:$}),t[162]=J,t[163]=$,t[164]=ze):ze=t[164],ze}function ae(e){return e.preventDefault()}function oe(e){return e.preventDefault()}function se(e){return e===null?e:D(e)}function ce(e){return e===null?e:E(e,{ok:!0})}function le(e){return e===null?e:w(e)}export{M 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-BeFNZANd.js";import{Rn as s,Vn as c}from"./dist-tlq-ZRDM.js";import{n as l}from"./dist-CJhtNlOm2.js";import{t as u}from"./desktop-bridge-types-oYPdTDmz.js";import{t as ee}from"./spinner-Bp2_BYkl.js";import{a as d,c as f,i as p,n as te,o as m,s as h,t as g}from"./dialog-DJkPMmCN.js";import{a as ne,i as _,n as v,o as y,r as re,s as b}from"./receive-store-KJtLoUh8.js";import{t as ie}from"./share-metadata-rows-R5Z0YM14.js";var x=e(n(),1),S=a(),C=e=>({phase:`ready`,seed:e});function w(e){return e.phase===`ready`?{phase:`initializing`,seed:e.seed}:e}function T(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 E(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 D(e){return e.phase===`done`||e.phase===`cancelled`||e.phase===`error`?e:{phase:`cancelled`,seed:e.seed}}var O=t();function k(e){return{kind:e.target.kind,path:u(e.target),repositoryPath:u(e.repositoryTarget),...e.contentRootDepth===null?{}:{contentRootDepth:e.contentRootDepth}}}function A(e){return e!==null&&e.kind===`launcher-consent`}function j(e){return e!==null&&e.kind===`launcher-miss`}function M(e){let t=(0,S.c)(14),{bridge:n,cloneController:r,store:i}=e,a=i===void 0?v:i,o=(0,x.useSyncExternalStore)(a.subscribe,a.getSnapshot,P),[s,c]=(0,x.useState)(0),[u,ee]=(0,x.useState)(o);o!==u&&(ee(o),c(N));let d,f;t[0]!==o||t[1]!==a?(d=()=>{if(!o)return;let e=b(o);e&&(l.error(e.message),a.dismiss())},f=[o,a],t[0]=o,t[1]=a,t[2]=d,t[3]=f):(d=t[2],f=t[3]),(0,x.useEffect)(d,f);let p;t[4]===o?p=t[5]:(p=j(o)?o:null,t[4]=o,t[5]=p);let te=p,m;t[6]===o?m=t[7]:(m=A(o)?o:null,t[6]=o,t[7]=m);let h=m??te;if(!h)return null;let g;return t[8]!==h||t[9]!==n||t[10]!==r||t[11]!==s||t[12]!==a?(g=(0,O.jsx)(F,{payload:h,bridge:n,cloneController:r,store:a},s),t[8]=h,t[9]=n,t[10]=r,t[11]=s,t[12]=a,t[13]=g):g=t[13],g}function N(e){return e+1}function P(){return null}function F(e){let t=(0,S.c)(165),{payload:n,bridge:a,cloneController:v,store:b}=e,{_:w}=i(),[D,M]=(0,x.useState)(!1),[N,P]=(0,x.useState)(null),[F,ue]=(0,x.useState)(!1),[I,de]=(0,x.useState)(!1),[L,fe]=(0,x.useState)(null),[R,z]=(0,x.useState)(null),pe=(0,x.useRef)(!1),me=(0,x.useRef)(null),he,ge;t[0]===L?(he=t[1],ge=t[2]):(he=()=>{L&&me.current?.focus()},ge=[L],t[0]=L,t[1]=he,t[2]=ge),(0,x.useEffect)(he,ge);let _e;t[3]!==R||t[4]!==n?(_e=()=>{A(n)&&R===null&&(console.warn(`[receive] q1_hit=true selection=branch_match_non_ok candidate=${n.candidatePath}`),z(C({candidatePath:n.candidatePath,branch:n.share.branch,targetPath:u(n.share.target),targetKind:n.share.target.kind,repositoryPath:u(n.share.repositoryTarget),...n.share.contentRootDepth===null?{}:{contentRootDepth:n.share.contentRootDepth},parentProjectName:n.parentProjectName})))},t[3]=R,t[4]=n,t[5]=_e):_e=t[5];let ve;t[6]===n?ve=t[7]:(ve=[n],t[6]=n,t[7]=ve),(0,x.useEffect)(_e,ve);let ye;t[8]!==N||t[9]!==v||t[10]!==n?(ye=()=>{if(!v||!j(n)||N!==null||pe.current)return;pe.current=!0,ue(!0);let e=n.share.host;v.getAuthStatus(e).then(e=>{P(e)}).catch(t=>{console.warn(`[receive] auth pre-flight probe failed`,t instanceof Error?t.message:t),P({authenticated:!1,host:e})}).finally(()=>{ue(!1)})},t[8]=N,t[9]=v,t[10]=n,t[11]=ye):ye=t[11];let be;t[12]!==N||t[13]!==n?(be=[n,N],t[12]=N,t[13]=n,t[14]=be):be=t[14],(0,x.useEffect)(ye,be);let B=j(n)?n:null,xe=A(n)?n:null,V=B?.share??xe?.share??null,H,Se,U,W,G,Ce,K,q;if(t[15]!==w||t[16]!==F||t[17]!==a||t[18]!==v||t[19]!==I||t[20]!==R||t[21]!==B||t[22]!==D||t[23]!==V||t[24]!==b){K=Symbol.for(`react.early_return_sentinel`);bb0:{let e=V?{host:V.host,owner:V.owner,repo:V.repo}:null,n;t[33]!==w||t[34]!==V?.target.kind?(n=V?.target.kind===`folder`?w({id:`ugoTXs`}):w({id:`XH30C4`}),t[33]=w,t[34]=V?.target.kind,t[35]=n):n=t[35],q=n,U=async function(){if(!B||!e)return;if(console.log(ne({q2_path:`clone`})),!v){l.info(w({id:`27XW26`}),{action:{label:w({id:`B3NAZC`}),onClick:()=>{a.navigator.open()}},duration:8e3});return}if(I)return;fe(null),de(!0);let t=re(e),n;try{n=await v.runClone({url:t,branch:B.share.branch})}catch(e){let t=e;console.warn(`[receive] runClone threw unexpectedly`,t),de(!1),fe({detail:t instanceof Error?t.message:String(t)});return}if(de(!1),n.kind===`error`){fe({detail:n.detail??null});return}if(n.kind===`ok`){try{await a.project.open({path:n.dir,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:k(B.share)}),b.dismiss()}catch(e){let t=e;console.warn(`[receive] project open after clone failed`,t instanceof Error?t.message:t),l.error(w({id:`438Fca`}))}return}};let i;t[36]!==w||t[37]!==F||t[38]!==v?(i=async function(){if(!(!v||F)){ue(!0);try{let e=await v.startSignIn();ue(!1),e!==null&&P(e)}catch(e){let t=e;ue(!1),console.warn(`[receive] startSignIn failed`,t instanceof Error?t.message:t),l.error(w({id:`lzwo7p`}))}}},t[36]=w,t[37]=F,t[38]=v,t[39]=i):i=t[39],G=i,W=async function(){if(!(!B||!e||D)){fe(null),M(!0),console.log(ne({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(ne({folder_validate:n.kind})),n.kind===`ok`){let e=B.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=c(e,n)!==`true`;try{await a.project.open({path:t,target:`new-window`,entryPoint:`share-receive`,...r?{pendingShareBranchSwitch:{share:B.share,projectPath:t,currentBranch:n.currentBranch}}:{pendingDeepLinkTarget:k(B.share)}}),b.dismiss()}catch(e){let t=e;console.warn(`[receive] local-folder-open failed`,t instanceof Error?t.message:t),l.error(w({id:`phM8Kh`}))}break}let r=y(n,e);r&&l.error(r)}}catch(e){let t=e;console.warn(`[receive] local-folder-validate failed`,t instanceof Error?t.message:t),l.error(w({id:`rlUzXK`}))}M(!1)}};let _;t[40]!==w||t[41]!==a||t[42]!==R||t[43]!==b?(_=function(){if(R===null||R.phase!==`ready`)return;let e=R.seed;console.warn(`[receive] consent_dialog action=initialize worktree=${e.candidatePath}`),z(le),a.project.okInit({projectPath:e.candidatePath}).then(async t=>{if(t.ok===!0){z(e=>e===null?e:T(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}),z(ce),b.dismiss()}catch(t){let n=t,r=n instanceof Error?n.message:String(n);z(e=>e===null?e:E(e,{ok:!1,message:r})),l.error(w({id:`nDT8qt`,values:{0:e.candidatePath}}))}return}let n=t.reason,r=t.message||`Initialization failed.`;z(e=>e===null?e:T(e,{ok:!1,reason:n,message:r})),l.error(r)}).catch(t=>{let n=t instanceof Error?t.message:String(t);z(e=>e===null?e:T(e,{ok:!1,reason:`network-error`,message:n})),l.error(w({id:`3Mwaly`,values:{0:e.candidatePath}}))})},t[40]=w,t[41]=a,t[42]=R,t[43]=b,t[44]=_):_=t[44];let x=_,S;t[45]!==R||t[46]!==b?(S=function(){R!==null&&console.warn(`[receive] consent_dialog action=cancel worktree=${R.seed.candidatePath}`),z(se),b.dismiss()},t[45]=R,t[46]=b,t[47]=S):S=t[47];let C=S;if(R!==null&&R.phase!==`cancelled`&&R.phase!==`done`&&V!==null){let e=R.seed,n=R.phase===`initializing`||R.phase===`opening`,i;t[48]===C?i=t[49]:(i=e=>{e||C()},t[48]=C,t[49]=i);let a;t[50]===q?a=t[51]:(a=(0,O.jsx)(f,{children:(0,O.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:q}})}),t[50]=q,t[51]=a);let s;t[52]===V.target?s=t[53]:(s=u(V.target)?`— ${u(V.target)}`:``,t[52]=V.target,t[53]=s);let c;t[54]!==V.owner||t[55]!==V.repo||t[56]!==s?(c=(0,O.jsx)(d,{className:`sr-only`,children:(0,O.jsx)(r,{id:`pgq_xf`,values:{0:V.owner,1:V.repo,2:s}})}),t[54]=V.owner,t[55]=V.repo,t[56]=s,t[57]=c):c=t[57];let l=V.owner,ne=V.repo,_;t[58]===V.target?_=t[59]:(_=u(V.target),t[58]=V.target,t[59]=_);let v;t[60]!==V.branch||t[61]!==V.owner||t[62]!==V.repo||t[63]!==V.target.kind||t[64]!==_?(v=(0,O.jsx)(ie,{owner:l,repo:ne,path:_,kind:V.target.kind,branch:V.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[60]=V.branch,t[61]=V.owner,t[62]=V.repo,t[63]=V.target.kind,t[64]=_,t[65]=v):v=t[65];let y;t[66]!==a||t[67]!==c||t[68]!==v?(y=(0,O.jsxs)(h,{children:[a,c,v]}),t[66]=a,t[67]=c,t[68]=v,t[69]=y):y=t[69];let re;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`KsAPaB`})}),t[70]=re):re=t[70];let b;t[71]===e.candidatePath?b=t[72]:(b=(0,O.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]=b);let S;t[73]===e.parentProjectName?S=t[74]:(S=e.parentProjectName===null?null:(0,O.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,"data-testid":`share-receive-consent-parent`,children:(0,O.jsx)(r,{id:`JmfgFc`,values:{0:e.parentProjectName}})}),t[73]=e.parentProjectName,t[74]=S);let w;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,O.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`w7SsvI`})}),t[75]=w):w=t[75];let T;t[76]!==R.message||t[77]!==R.phase?(T=R.phase===`error`?(0,O.jsx)(`p`,{className:`mt-3 text-sm text-destructive`,"data-testid":`share-receive-consent-error`,role:`alert`,children:R.message}):null,t[76]=R.message,t[77]=R.phase,t[78]=T):T=t[78];let E;t[79]!==b||t[80]!==S||t[81]!==T?(E=(0,O.jsxs)(te,{children:[re,b,S,w,T]}),t[79]=b,t[80]=S,t[81]=T,t[82]=E):E=t[82];let D;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,O.jsx)(r,{id:`dEgA5A`}),t[83]=D):D=t[83];let k;t[84]===C?k=t[85]:(k=(0,O.jsx)(o,{variant:`ghost`,onClick:C,"data-testid":`share-receive-consent-cancel`,children:D}),t[84]=C,t[85]=k);let A=n||R.phase===`error`,j=n||R.phase===`error`,M;t[86]===n?M=t[87]:(M=n?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(ee,{className:`mr-2 h-4 w-4`,"aria-hidden":`true`}),(0,O.jsx)(r,{id:`NKkZXl`})]}):(0,O.jsx)(r,{id:`NKkZXl`}),t[86]=n,t[87]=M);let N;t[88]!==x||t[89]!==A||t[90]!==j||t[91]!==M?(N=(0,O.jsx)(o,{onClick:x,disabled:A,"aria-disabled":j,"data-testid":`share-receive-consent-initialize`,children:M}),t[88]=x,t[89]=A,t[90]=j,t[91]=M,t[92]=N):N=t[92];let P;t[93]!==k||t[94]!==N?(P=(0,O.jsxs)(m,{children:[k,N]}),t[93]=k,t[94]=N,t[95]=P):P=t[95];let F;t[96]!==y||t[97]!==E||t[98]!==P?(F=(0,O.jsxs)(p,{className:`sm:max-w-xl`,"data-testid":`share-receive-consent-dialog`,onInteractOutside:oe,onPointerDownOutside:ae,children:[y,E,P]}),t[96]=y,t[97]=E,t[98]=P,t[99]=F):F=t[99];let se;t[100]!==i||t[101]!==F?(se=(0,O.jsx)(g,{open:!0,onOpenChange:i,children:F}),t[100]=i,t[101]=F,t[102]=se):se=t[102],K=se;break bb0}if(!B||!V||!e){K=null;break bb0}H=v!==void 0&&!I;let A;t[103]!==w||t[104]!==I?(A=w(I?{id:`YjhKI5`}:{id:`LE7t79`}),t[103]=w,t[104]=I,t[105]=A):A=t[105],Se=A,Ce=s(e)}t[15]=w,t[16]=F,t[17]=a,t[18]=v,t[19]=I,t[20]=R,t[21]=B,t[22]=D,t[23]=V,t[24]=b,t[25]=H,t[26]=Se,t[27]=U,t[28]=W,t[29]=G,t[30]=Ce,t[31]=K,t[32]=q}else H=t[25],Se=t[26],U=t[27],W=t[28],G=t[29],Ce=t[30],K=t[31],q=t[32];if(K!==Symbol.for(`react.early_return_sentinel`))return K;let we=Ce,Te=N?.authenticated?N.login:void 0,Ee;t[106]===L?Ee=t[107]:(Ee=L?.detail?_(L.detail):``,t[106]=L,t[107]=Ee);let De=Ee,J;t[108]===b?J=t[109]:(J=e=>{e||b.dismiss()},t[108]=b,t[109]=J);let Y;t[110]===q?Y=t[111]:(Y=(0,O.jsx)(f,{children:(0,O.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:q}})}),t[110]=q,t[111]=Y);let X;t[112]===V.target?X=t[113]:(X=u(V.target)?` — ${u(V.target)}`:null,t[112]=V.target,t[113]=X);let Z;t[114]!==V.owner||t[115]!==V.repo||t[116]!==X?(Z=(0,O.jsxs)(d,{className:`sr-only`,children:[V.owner,`/`,V.repo,X]}),t[114]=V.owner,t[115]=V.repo,t[116]=X,t[117]=Z):Z=t[117];let Oe=V.owner,ke=V.repo,Q;t[118]===V.target?Q=t[119]:(Q=u(V.target),t[118]=V.target,t[119]=Q);let Ae;t[120]!==V.branch||t[121]!==V.owner||t[122]!==V.repo||t[123]!==V.target.kind||t[124]!==Q?(Ae=(0,O.jsx)(ie,{owner:Oe,repo:ke,path:Q,kind:V.target.kind,branch:V.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[120]=V.branch,t[121]=V.owner,t[122]=V.repo,t[123]=V.target.kind,t[124]=Q,t[125]=Ae):Ae=t[125];let je;t[126]!==Y||t[127]!==Z||t[128]!==Ae?(je=(0,O.jsxs)(h,{children:[Y,Z,Ae]}),t[126]=Y,t[127]=Z,t[128]=Ae,t[129]=je):je=t[129];let Me;t[130]!==v||t[131]!==H||t[132]!==L||t[133]!==De||t[134]!==Se||t[135]!==I||t[136]!==U||t[137]!==W||t[138]!==D?(Me=L?(0,O.jsxs)(`div`,{ref:me,tabIndex:-1,className:`rounded-lg border border-destructive/40 bg-destructive/5 p-4 outline-none`,"data-testid":`share-receive-clone-error`,children:[(0,O.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,role:`alert`,children:(0,O.jsx)(r,{id:`aiArms`})}),De?(0,O.jsxs)(`p`,{className:`mt-2 break-words text-xs text-destructive`,"data-testid":`share-receive-clone-error-message`,children:[(0,O.jsx)(r,{id:`4BITzH`}),` `,(0,O.jsxs)(`span`,{className:`font-mono text-foreground/80`,children:[`"`,De,`"`]})]}):null,(0,O.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`Llyqvo`})}),(0,O.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,O.jsx)(`li`,{children:(0,O.jsx)(r,{id:`6LbUG7`})}),(0,O.jsx)(`li`,{children:(0,O.jsx)(r,{id:`_pY_Vq`})}),(0,O.jsx)(`li`,{children:(0,O.jsx)(r,{id:`J6mxC1`})})]}),(0,O.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,O.jsx)(o,{onClick:()=>{U()},"data-testid":`share-receive-clone-retry`,children:(0,O.jsx)(r,{id:`KDw4GX`})}),(0,O.jsx)(o,{variant:`outline`,onClick:()=>{W()},disabled:D||I,"data-testid":`share-receive-error-local`,children:(0,O.jsx)(r,{id:`xFQRu4`})})]})]}):(0,O.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,O.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-clone`,className:`flex flex-col items-start gap-2 rounded-lg border border-primary/50 bg-primary/5 p-4 text-left transition hover:border-primary hover:bg-primary/10 focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-primary/50 disabled:hover:bg-primary/5`,onClick:()=>{U()},disabled:v!==void 0&&!H,"aria-disabled":v!==void 0&&!H,children:[(0,O.jsx)(`span`,{className:`text-sm font-semibold`,children:Se}),(0,O.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`fj5YiP`})})]}),(0,O.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-local`,className:`flex flex-col items-start gap-2 rounded-lg border border-border bg-card p-4 text-left transition hover:border-foreground/50 hover:bg-accent focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,onClick:()=>{W()},disabled:D||I,children:[(0,O.jsx)(`span`,{className:`text-sm font-semibold`,children:(0,O.jsx)(r,{id:`HfI1dR`})}),(0,O.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`_qD6mn`})})]})]}),t[130]=v,t[131]=H,t[132]=L,t[133]=De,t[134]=Se,t[135]=I,t[136]=U,t[137]=W,t[138]=D,t[139]=Me):Me=t[139];let Ne;t[140]!==F||t[141]!==N||t[142]!==v||t[143]!==G||t[144]!==Te?(Ne=v?(0,O.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:N===null?(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:(0,O.jsx)(r,{id:`UDFrWm`})}):N.authenticated?(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:(0,O.jsx)(r,{id:`VAHWL_`,values:{signedInLogin:Te},components:{0:(0,O.jsx)(`span`,{className:`font-medium text-foreground/90`})}})}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:(0,O.jsx)(r,{id:`SgKLfA`})}),(0,O.jsx)(`button`,{type:`button`,"data-testid":`share-receive-signin`,className:`font-medium text-primary underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded`,onClick:()=>{G()},disabled:F,children:F?(0,O.jsx)(r,{id:`PKLY-1`}):(0,O.jsx)(r,{id:`3jod3l`})})]})}):null,t[140]=F,t[141]=N,t[142]=v,t[143]=G,t[144]=Te,t[145]=Ne):Ne=t[145];let Pe;t[146]!==L||t[147]!==we?(Pe=L?null:(0,O.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`RJ3a8Z`,values:{lookingForUrl:we},components:{0:(0,O.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),t[146]=L,t[147]=we,t[148]=Pe):Pe=t[148];let Fe;t[149]!==Me||t[150]!==Ne||t[151]!==Pe?(Fe=(0,O.jsxs)(te,{children:[Me,Ne,Pe]}),t[149]=Me,t[150]=Ne,t[151]=Pe,t[152]=Fe):Fe=t[152];let Ie;t[153]===b?Ie=t[154]:(Ie=()=>b.dismiss(),t[153]=b,t[154]=Ie);let Le;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,O.jsx)(r,{id:`dEgA5A`}),t[155]=Le):Le=t[155];let Re;t[156]===Ie?Re=t[157]:(Re=(0,O.jsx)(m,{children:(0,O.jsx)(o,{variant:`outline`,onClick:Ie,children:Le})}),t[156]=Ie,t[157]=Re);let $;t[158]!==je||t[159]!==Fe||t[160]!==Re?($=(0,O.jsxs)(p,{className:`sm:max-w-xl`,"data-testid":`share-receive-dialog`,children:[je,Fe,Re]}),t[158]=je,t[159]=Fe,t[160]=Re,t[161]=$):$=t[161];let ze;return t[162]!==J||t[163]!==$?(ze=(0,O.jsx)(g,{open:!0,onOpenChange:J,children:$}),t[162]=J,t[163]=$,t[164]=ze):ze=t[164],ze}function ae(e){return e.preventDefault()}function oe(e){return e.preventDefault()}function se(e){return e===null?e:D(e)}function ce(e){return e===null?e:E(e,{ok:!0})}function le(e){return e===null?e:w(e)}export{M 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{a as i,i as a,n as o,o as s,r as c}from"./pending-receive-nav-store-Cvafwk5s.js";import{t as l}from"./miss-dialog-store-CNJRdTPE.js";import{c as u,i as d,n as f,s as p,t as m}from"./dialog-DJkPMmCN.js";import{f as h,p as g}from"./doc-paths-VPO39t4f.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)(l.subscribe,l.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}=s(n),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=function(){l.dismiss()},t[0]=x):x=t[0];let S=x,C;t[1]===n.path?C=t[2]:(C=function(){window.location.hash=g(i(n.path)),S()},t[1]=n.path,t[2]=C);let w=C,T;t[3]===n?T=t[4]:(T=function(e){c.arm(o(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)(p,{children:(0,y.jsx)(u,{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)(a,{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)(f,{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)(m,{open:!0,onOpenChange:D,children:(0,y.jsxs)(d,{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{a as i,i as a,n as o,o as s,r as c}from"./pending-receive-nav-store-YPgvt9Pm.js";import{t as l}from"./miss-dialog-store-CNJRdTPE.js";import{c as u,i as d,n as f,s as p,t as m}from"./dialog-DJkPMmCN.js";import{f as h,p as g}from"./doc-paths-DJfKKip_.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)(l.subscribe,l.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}=s(n),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=function(){l.dismiss()},t[0]=x):x=t[0];let S=x,C;t[1]===n.path?C=t[2]:(C=function(){window.location.hash=g(i(n.path)),S()},t[1]=n.path,t[2]=C);let w=C,T;t[3]===n?T=t[4]:(T=function(e){c.arm(o(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)(p,{children:(0,y.jsx)(u,{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)(a,{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)(f,{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)(m,{open:!0,onOpenChange:D,children:(0,y.jsxs)(d,{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{i,n as a,r as o,t as s}from"./tooltip-DVBVVaAs.js";import{_t as c}from"./dist-DTxb76k4.js";import{t as l}from"./triangle-alert-CCeXtPLU.js";var u=r(),d=e();function f(e){return e<1e3?`${e}`:`${Math.round(e/100)/10}k`}function p(e){let t=(0,u.c)(33),{tokens:r,budget:c}=e,{_:p}=n(),m=c!==void 0&&r>c,h,g,_,v,y,b,x,S;if(t[0]!==p||t[1]!==c||t[2]!==m||t[3]!==r){S=Symbol.for(`react.early_return_sentinel`);bb0:{let e=c===void 0?``:f(c),n=m||void 0,u=m?`text-amber-600 dark:text-amber-500`:void 0,C;t[12]===r?C=t[13]:(C=f(r),t[12]=r,t[13]=C);let w=m?(0,d.jsx)(`span`,{role:`img`,"aria-label":p({id:`nem6R7`,values:{budgetLabel:e}}),children:(0,d.jsx)(l,{className:`ms-0.5 inline size-3 align-[-0.1em]`,"aria-hidden":`true`})}):null,T;t[14]!==n||t[15]!==u||t[16]!==C||t[17]!==w?(T=(0,d.jsxs)(`span`,{"data-over-budget":n,className:u,children:[C,w]}),t[14]=n,t[15]=u,t[16]=C,t[17]=w,t[18]=T):T=t[18];let E=T;if(!m){S=E;break bb0}_=o,g=s,t[19]===E?x=t[20]:(x=(0,d.jsx)(i,{asChild:!0,children:E}),t[19]=E,t[20]=x),h=a,v=`right`,y=`max-w-xs`,b=p({id:`JsHvhz`,values:{budgetLabel:e}})}t[0]=p,t[1]=c,t[2]=m,t[3]=r,t[4]=h,t[5]=g,t[6]=_,t[7]=v,t[8]=y,t[9]=b,t[10]=x,t[11]=S}else h=t[4],g=t[5],_=t[6],v=t[7],y=t[8],b=t[9],x=t[10],S=t[11];if(S!==Symbol.for(`react.early_return_sentinel`))return S;let C;t[21]!==h||t[22]!==v||t[23]!==y||t[24]!==b?(C=(0,d.jsx)(h,{side:v,className:y,children:b}),t[21]=h,t[22]=v,t[23]=y,t[24]=b,t[25]=C):C=t[25];let w;t[26]!==g||t[27]!==x||t[28]!==C?(w=(0,d.jsxs)(g,{children:[x,C]}),t[26]=g,t[27]=x,t[28]=C,t[29]=w):w=t[29];let T;return t[30]!==_||t[31]!==w?(T=(0,d.jsx)(_,{children:w}),t[30]=_,t[31]=w,t[32]=T):T=t[32],T}function m(e){let n=(0,u.c)(22),{size:r}=e,i=r.alwaysOn+r.onTrigger+r.onDemand,a;n[0]===r.alwaysOn?a=n[1]:(a=(0,d.jsx)(p,{tokens:r.alwaysOn,budget:100}),n[0]=r.alwaysOn,n[1]=a);let o;n[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,d.jsx)(t,{id:`eTsJYJ`}),n[2]=o):o=n[2];let s;n[3]===a?s=n[4]:(s=(0,d.jsxs)(`span`,{children:[a,` `,o]}),n[3]=a,n[4]=s);let l;n[5]===r.onTrigger?l=n[6]:(l=(0,d.jsxs)(`span`,{children:[(0,d.jsx)(p,{tokens:r.onTrigger,budget:c}),` SKILL.md`]}),n[5]=r.onTrigger,n[6]=l);let f;n[7]===r.onDemand?f=n[8]:(f=(0,d.jsx)(p,{tokens:r.onDemand}),n[7]=r.onDemand,n[8]=f);let m;n[9]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,d.jsx)(t,{id:`ae9Ozt`}),n[9]=m):m=n[9];let h;n[10]===f?h=n[11]:(h=(0,d.jsxs)(`span`,{children:[f,` `,m]}),n[10]=f,n[11]=h);let g;n[12]===i?g=n[13]:(g=(0,d.jsx)(p,{tokens:i}),n[12]=i,n[13]=g);let _;n[14]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,d.jsx)(t,{id:`ONchxy`}),n[14]=_):_=n[14];let v;n[15]===g?v=n[16]:(v=(0,d.jsxs)(`span`,{className:`text-foreground/80`,children:[g,` `,_]}),n[15]=g,n[16]=v);let y;return n[17]!==v||n[18]!==s||n[19]!==l||n[20]!==h?(y=(0,d.jsxs)(`span`,{"data-testid":`skill-cost-value`,className:`flex flex-col gap-0.5 font-mono text-[13px] text-muted-foreground`,children:[s,l,h,v]}),n[17]=v,n[18]=s,n[19]=l,n[20]=h,n[21]=y):y=n[21],y}export{f as n,m 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{i,n as a,r as o,t as s}from"./tooltip-DVBVVaAs.js";import{_t as c}from"./dist-tlq-ZRDM.js";import{t as l}from"./triangle-alert-CCeXtPLU.js";var u=r(),d=e();function f(e){return e<1e3?`${e}`:`${Math.round(e/100)/10}k`}function p(e){let t=(0,u.c)(33),{tokens:r,budget:c}=e,{_:p}=n(),m=c!==void 0&&r>c,h,g,_,v,y,b,x,S;if(t[0]!==p||t[1]!==c||t[2]!==m||t[3]!==r){S=Symbol.for(`react.early_return_sentinel`);bb0:{let e=c===void 0?``:f(c),n=m||void 0,u=m?`text-amber-600 dark:text-amber-500`:void 0,C;t[12]===r?C=t[13]:(C=f(r),t[12]=r,t[13]=C);let w=m?(0,d.jsx)(`span`,{role:`img`,"aria-label":p({id:`nem6R7`,values:{budgetLabel:e}}),children:(0,d.jsx)(l,{className:`ms-0.5 inline size-3 align-[-0.1em]`,"aria-hidden":`true`})}):null,T;t[14]!==n||t[15]!==u||t[16]!==C||t[17]!==w?(T=(0,d.jsxs)(`span`,{"data-over-budget":n,className:u,children:[C,w]}),t[14]=n,t[15]=u,t[16]=C,t[17]=w,t[18]=T):T=t[18];let E=T;if(!m){S=E;break bb0}_=o,g=s,t[19]===E?x=t[20]:(x=(0,d.jsx)(i,{asChild:!0,children:E}),t[19]=E,t[20]=x),h=a,v=`right`,y=`max-w-xs`,b=p({id:`JsHvhz`,values:{budgetLabel:e}})}t[0]=p,t[1]=c,t[2]=m,t[3]=r,t[4]=h,t[5]=g,t[6]=_,t[7]=v,t[8]=y,t[9]=b,t[10]=x,t[11]=S}else h=t[4],g=t[5],_=t[6],v=t[7],y=t[8],b=t[9],x=t[10],S=t[11];if(S!==Symbol.for(`react.early_return_sentinel`))return S;let C;t[21]!==h||t[22]!==v||t[23]!==y||t[24]!==b?(C=(0,d.jsx)(h,{side:v,className:y,children:b}),t[21]=h,t[22]=v,t[23]=y,t[24]=b,t[25]=C):C=t[25];let w;t[26]!==g||t[27]!==x||t[28]!==C?(w=(0,d.jsxs)(g,{children:[x,C]}),t[26]=g,t[27]=x,t[28]=C,t[29]=w):w=t[29];let T;return t[30]!==_||t[31]!==w?(T=(0,d.jsx)(_,{children:w}),t[30]=_,t[31]=w,t[32]=T):T=t[32],T}function m(e){let n=(0,u.c)(22),{size:r}=e,i=r.alwaysOn+r.onTrigger+r.onDemand,a;n[0]===r.alwaysOn?a=n[1]:(a=(0,d.jsx)(p,{tokens:r.alwaysOn,budget:100}),n[0]=r.alwaysOn,n[1]=a);let o;n[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,d.jsx)(t,{id:`eTsJYJ`}),n[2]=o):o=n[2];let s;n[3]===a?s=n[4]:(s=(0,d.jsxs)(`span`,{children:[a,` `,o]}),n[3]=a,n[4]=s);let l;n[5]===r.onTrigger?l=n[6]:(l=(0,d.jsxs)(`span`,{children:[(0,d.jsx)(p,{tokens:r.onTrigger,budget:c}),` SKILL.md`]}),n[5]=r.onTrigger,n[6]=l);let f;n[7]===r.onDemand?f=n[8]:(f=(0,d.jsx)(p,{tokens:r.onDemand}),n[7]=r.onDemand,n[8]=f);let m;n[9]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,d.jsx)(t,{id:`ae9Ozt`}),n[9]=m):m=n[9];let h;n[10]===f?h=n[11]:(h=(0,d.jsxs)(`span`,{children:[f,` `,m]}),n[10]=f,n[11]=h);let g;n[12]===i?g=n[13]:(g=(0,d.jsx)(p,{tokens:i}),n[12]=i,n[13]=g);let _;n[14]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,d.jsx)(t,{id:`ONchxy`}),n[14]=_):_=n[14];let v;n[15]===g?v=n[16]:(v=(0,d.jsxs)(`span`,{className:`text-foreground/80`,children:[g,` `,_]}),n[15]=g,n[16]=v);let y;return n[17]!==v||n[18]!==s||n[19]!==l||n[20]!==h?(y=(0,d.jsxs)(`span`,{"data-testid":`skill-cost-value`,className:`flex flex-col gap-0.5 font-mono text-[13px] text-muted-foreground`,children:[s,l,h,v]}),n[17]=v,n[18]=s,n[19]=l,n[20]=h,n[21]=y):y=n[21],y}export{f as n,m 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-BhqhPrdL.js";import{s as i}from"./skill-scope-bxDiQshW.js";import{t as a}from"./SkillModeBanner-BVUswsIV.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-BhqhPrdL.js";import{s as i}from"./skill-scope-Hg5bOCB8.js";import{t as a}from"./SkillModeBanner-BVUswsIV.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 +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-BeFNZANd.js";import{t as ee}from"./label-D-K3fWtj.js";import{Lt as te}from"./dist-DTxb76k4.js";import{n as s}from"./dist-CJhtNlOm2.js";import{a as c,c as l,i as u,n as d,o as f,s as p,t as m}from"./dialog-DJkPMmCN.js";import{l as h}from"./skill-scope-bxDiQshW.js";import{E as ne,u as re}from"./skills-api-BaxUiF2f.js";import{t as ie}from"./input-3o4m6NnP.js";import{t as ae}from"./MultiFileDiff-GzM9NSr9.js";import{t as oe}from"./pierre-theme-DODOXO9V.js";var se=a(),g=e(n(),1),_=t();function v(e){let t=(0,se.c)(60),{target:n,onOpenChange:a}=e,{_:v}=i(),y=(0,g.useId)(),[b,x]=(0,g.useState)(null),[S,C]=(0,g.useState)(null),[w,T]=(0,g.useState)(!1),[E,D]=(0,g.useState)(!1),[O,k]=(0,g.useState)(``),[A,j]=(0,g.useState)(!1),M;t[0]===n?M=t[1]:(M=()=>{if(x(null),C(null),T(!1),D(!1),!n)return;let{skill:e,editor:t}=n,r=e.absolutePath?.slice(0,-`/${e.path}`.length)??null;if(r===null){T(!0);return}let i=`${r}/${e.path.replace(/\/SKILL\.mdx?$/i,``)}`,a=`${r}/${h(t,e.scope)}/${e.name}`,o=new AbortController;for(let[t,n]of[[i,C],[a,x]])re({source:t,name:e.name},o.signal).then(e=>{o.signal.aborted||(e.ok?n(e.skillMd):T(!0))}).catch(()=>{o.signal.aborted||T(!0)});return()=>o.abort()},t[0]=n,t[1]=M);let N=n?.skill.scope,P=n?.skill.name,F=n?.editor,I;if(t[2]!==N||t[3]!==P||t[4]!==F?(I=[N,P,F],t[2]=N,t[3]=P,t[4]=F,t[5]=I):I=t[5],(0,g.useEffect)(M,I),!n)return null;let{skill:L,editor:R}=n,z;t[6]!==v||t[7]!==R||t[8]!==a||t[9]!==L.name||t[10]!==L.scope||t[11]!==n||t[12]!==O?(z=async function(e){if(!n)return;j(!0);let t=await ne({scope:L.scope,name:L.name,editor:R,action:e,...e===`rename`?{toName:O.trim()}:{}});if(j(!1),!t.ok){s.error(v({id:`MIF36T`,values:{0:t.error}}));return}s.success(v(e===`align`?{id:`QKgePK`,values:{editor:R}}:e===`make-source`?{id:`It9oAP`,values:{editor:R}}:{id:`b2ezG_`,values:{0:O.trim()}})),a(!1)},t[6]=v,t[7]=R,t[8]=a,t[9]=L.name,t[10]=L.scope,t[11]=n,t[12]=O,t[13]=z):z=t[13];let B=z,V,H;t[14]!==L.name||t[15]!==O?(H=O.trim(),V=H===``||!te.test(H)||H===L.name,t[14]=L.name,t[15]=O,t[16]=V,t[17]=H):(V=t[16],H=t[17]);let U=V,W;t[18]!==A||t[19]!==a?(W=e=>{!e&&!A&&a(!1)},t[18]=A,t[19]=a,t[20]=W):W=t[20];let G;t[21]!==R||t[22]!==L.name?(G=(0,_.jsx)(l,{children:(0,_.jsx)(r,{id:`q8aCbb`,values:{0:L.name,editor:R}})}),t[21]=R,t[22]=L.name,t[23]=G):G=t[23];let K;t[24]===R?K=t[25]:(K=(0,_.jsx)(c,{children:(0,_.jsx)(r,{id:`QASTNu`,values:{editor:R}})}),t[24]=R,t[25]=K);let q;t[26]!==K||t[27]!==G?(q=(0,_.jsxs)(p,{children:[G,K]}),t[26]=K,t[27]=G,t[28]=q):q=t[28];let J;t[29]!==S||t[30]!==b||t[31]!==w||t[32]!==L.name?(J=S!==null&&b!==null?(0,_.jsx)(ae,{className:`pierre-diff`,oldFile:{name:L.name,contents:S},newFile:{name:L.name,contents:b},options:{overflow:`wrap`,diffStyle:`unified`,theme:oe()}}):w?(0,_.jsx)(`div`,{className:`flex min-h-56 items-center justify-center px-6 text-center text-muted-foreground text-sm`,children:(0,_.jsx)(r,{id:`5BlXTD`})}):(0,_.jsx)(`div`,{className:`flex min-h-56 items-center justify-center text-muted-foreground text-sm`,children:(0,_.jsx)(r,{id:`1V17kO`})}),t[29]=S,t[30]=b,t[31]=w,t[32]=L.name,t[33]=J):J=t[33];let Y;t[34]!==B||t[35]!==R||t[36]!==y||t[37]!==U||t[38]!==E||t[39]!==L.name||t[40]!==O||t[41]!==H?(Y=E?(0,_.jsxs)(`div`,{className:`mt-3 space-y-1.5`,children:[(0,_.jsx)(ee,{htmlFor:y,children:(0,_.jsx)(r,{id:`pSimwP`,values:{editor:R}})}),(0,_.jsx)(ie,{id:y,value:O,onChange:e=>k(e.target.value),placeholder:`${L.name}-${R}`,"aria-invalid":U&&H!==``,onKeyDown:e=>{e.key===`Enter`&&!U&&B(`rename`)}})]}):null,t[34]=B,t[35]=R,t[36]=y,t[37]=U,t[38]=E,t[39]=L.name,t[40]=O,t[41]=H,t[42]=Y):Y=t[42];let X;t[43]!==J||t[44]!==Y?(X=(0,_.jsxs)(d,{className:`min-h-0 flex-1 overflow-auto`,children:[J,Y]}),t[43]=J,t[44]=Y,t[45]=X):X=t[45];let Z;t[46]!==B||t[47]!==A||t[48]!==R||t[49]!==U||t[50]!==E||t[51]!==L.name?(Z=(0,_.jsx)(f,{children:E?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(o,{variant:`outline`,onClick:()=>D(!1),disabled:A,children:(0,_.jsx)(r,{id:`iH8pgl`})}),(0,_.jsx)(o,{onClick:()=>void B(`rename`),disabled:A||U,children:(0,_.jsx)(r,{id:`AT0e50`})})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(o,{variant:`outline`,onClick:()=>{k(`${L.name}-${R}`),D(!0)},disabled:A,children:(0,_.jsx)(r,{id:`AT0e50`})}),(0,_.jsx)(o,{variant:`outline`,onClick:()=>void B(`make-source`),disabled:A,children:(0,_.jsx)(r,{id:`xWomUD`,values:{editor:R}})}),(0,_.jsx)(o,{onClick:()=>void B(`align`),disabled:A,children:(0,_.jsx)(r,{id:`PZn2LP`})})]})}),t[46]=B,t[47]=A,t[48]=R,t[49]=U,t[50]=E,t[51]=L.name,t[52]=Z):Z=t[52];let Q;t[53]!==q||t[54]!==X||t[55]!==Z?(Q=(0,_.jsxs)(u,{className:`flex max-h-[85vh] w-full flex-col sm:max-w-5xl`,children:[q,X,Z]}),t[53]=q,t[54]=X,t[55]=Z,t[56]=Q):Q=t[56];let $;return t[57]!==Q||t[58]!==W?($=(0,_.jsx)(m,{open:!0,onOpenChange:W,children:Q}),t[57]=Q,t[58]=W,t[59]=$):$=t[59],$}export{v as SkillForkDialog};
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-BeFNZANd.js";import{t as ee}from"./label-D-K3fWtj.js";import{Lt as te}from"./dist-tlq-ZRDM.js";import{n as s}from"./dist-CJhtNlOm2.js";import{a as c,c as l,i as u,n as d,o as f,s as p,t as m}from"./dialog-DJkPMmCN.js";import{l as h}from"./skill-scope-Hg5bOCB8.js";import{E as ne,u as re}from"./skills-api-Bl-dNjGU.js";import{t as ie}from"./input-3o4m6NnP.js";import{t as ae}from"./MultiFileDiff-GzM9NSr9.js";import{t as oe}from"./pierre-theme-DODOXO9V.js";var se=a(),g=e(n(),1),_=t();function v(e){let t=(0,se.c)(60),{target:n,onOpenChange:a}=e,{_:v}=i(),y=(0,g.useId)(),[b,x]=(0,g.useState)(null),[S,C]=(0,g.useState)(null),[w,T]=(0,g.useState)(!1),[E,D]=(0,g.useState)(!1),[O,k]=(0,g.useState)(``),[A,j]=(0,g.useState)(!1),M;t[0]===n?M=t[1]:(M=()=>{if(x(null),C(null),T(!1),D(!1),!n)return;let{skill:e,editor:t}=n,r=e.absolutePath?.slice(0,-`/${e.path}`.length)??null;if(r===null){T(!0);return}let i=`${r}/${e.path.replace(/\/SKILL\.mdx?$/i,``)}`,a=`${r}/${h(t,e.scope)}/${e.name}`,o=new AbortController;for(let[t,n]of[[i,C],[a,x]])re({source:t,name:e.name},o.signal).then(e=>{o.signal.aborted||(e.ok?n(e.skillMd):T(!0))}).catch(()=>{o.signal.aborted||T(!0)});return()=>o.abort()},t[0]=n,t[1]=M);let N=n?.skill.scope,P=n?.skill.name,F=n?.editor,I;if(t[2]!==N||t[3]!==P||t[4]!==F?(I=[N,P,F],t[2]=N,t[3]=P,t[4]=F,t[5]=I):I=t[5],(0,g.useEffect)(M,I),!n)return null;let{skill:L,editor:R}=n,z;t[6]!==v||t[7]!==R||t[8]!==a||t[9]!==L.name||t[10]!==L.scope||t[11]!==n||t[12]!==O?(z=async function(e){if(!n)return;j(!0);let t=await ne({scope:L.scope,name:L.name,editor:R,action:e,...e===`rename`?{toName:O.trim()}:{}});if(j(!1),!t.ok){s.error(v({id:`MIF36T`,values:{0:t.error}}));return}s.success(v(e===`align`?{id:`QKgePK`,values:{editor:R}}:e===`make-source`?{id:`It9oAP`,values:{editor:R}}:{id:`b2ezG_`,values:{0:O.trim()}})),a(!1)},t[6]=v,t[7]=R,t[8]=a,t[9]=L.name,t[10]=L.scope,t[11]=n,t[12]=O,t[13]=z):z=t[13];let B=z,V,H;t[14]!==L.name||t[15]!==O?(H=O.trim(),V=H===``||!te.test(H)||H===L.name,t[14]=L.name,t[15]=O,t[16]=V,t[17]=H):(V=t[16],H=t[17]);let U=V,W;t[18]!==A||t[19]!==a?(W=e=>{!e&&!A&&a(!1)},t[18]=A,t[19]=a,t[20]=W):W=t[20];let G;t[21]!==R||t[22]!==L.name?(G=(0,_.jsx)(l,{children:(0,_.jsx)(r,{id:`q8aCbb`,values:{0:L.name,editor:R}})}),t[21]=R,t[22]=L.name,t[23]=G):G=t[23];let K;t[24]===R?K=t[25]:(K=(0,_.jsx)(c,{children:(0,_.jsx)(r,{id:`QASTNu`,values:{editor:R}})}),t[24]=R,t[25]=K);let q;t[26]!==K||t[27]!==G?(q=(0,_.jsxs)(p,{children:[G,K]}),t[26]=K,t[27]=G,t[28]=q):q=t[28];let J;t[29]!==S||t[30]!==b||t[31]!==w||t[32]!==L.name?(J=S!==null&&b!==null?(0,_.jsx)(ae,{className:`pierre-diff`,oldFile:{name:L.name,contents:S},newFile:{name:L.name,contents:b},options:{overflow:`wrap`,diffStyle:`unified`,theme:oe()}}):w?(0,_.jsx)(`div`,{className:`flex min-h-56 items-center justify-center px-6 text-center text-muted-foreground text-sm`,children:(0,_.jsx)(r,{id:`5BlXTD`})}):(0,_.jsx)(`div`,{className:`flex min-h-56 items-center justify-center text-muted-foreground text-sm`,children:(0,_.jsx)(r,{id:`1V17kO`})}),t[29]=S,t[30]=b,t[31]=w,t[32]=L.name,t[33]=J):J=t[33];let Y;t[34]!==B||t[35]!==R||t[36]!==y||t[37]!==U||t[38]!==E||t[39]!==L.name||t[40]!==O||t[41]!==H?(Y=E?(0,_.jsxs)(`div`,{className:`mt-3 space-y-1.5`,children:[(0,_.jsx)(ee,{htmlFor:y,children:(0,_.jsx)(r,{id:`pSimwP`,values:{editor:R}})}),(0,_.jsx)(ie,{id:y,value:O,onChange:e=>k(e.target.value),placeholder:`${L.name}-${R}`,"aria-invalid":U&&H!==``,onKeyDown:e=>{e.key===`Enter`&&!U&&B(`rename`)}})]}):null,t[34]=B,t[35]=R,t[36]=y,t[37]=U,t[38]=E,t[39]=L.name,t[40]=O,t[41]=H,t[42]=Y):Y=t[42];let X;t[43]!==J||t[44]!==Y?(X=(0,_.jsxs)(d,{className:`min-h-0 flex-1 overflow-auto`,children:[J,Y]}),t[43]=J,t[44]=Y,t[45]=X):X=t[45];let Z;t[46]!==B||t[47]!==A||t[48]!==R||t[49]!==U||t[50]!==E||t[51]!==L.name?(Z=(0,_.jsx)(f,{children:E?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(o,{variant:`outline`,onClick:()=>D(!1),disabled:A,children:(0,_.jsx)(r,{id:`iH8pgl`})}),(0,_.jsx)(o,{onClick:()=>void B(`rename`),disabled:A||U,children:(0,_.jsx)(r,{id:`AT0e50`})})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(o,{variant:`outline`,onClick:()=>{k(`${L.name}-${R}`),D(!0)},disabled:A,children:(0,_.jsx)(r,{id:`AT0e50`})}),(0,_.jsx)(o,{variant:`outline`,onClick:()=>void B(`make-source`),disabled:A,children:(0,_.jsx)(r,{id:`xWomUD`,values:{editor:R}})}),(0,_.jsx)(o,{onClick:()=>void B(`align`),disabled:A,children:(0,_.jsx)(r,{id:`PZn2LP`})})]})}),t[46]=B,t[47]=A,t[48]=R,t[49]=U,t[50]=E,t[51]=L.name,t[52]=Z):Z=t[52];let Q;t[53]!==q||t[54]!==X||t[55]!==Z?(Q=(0,_.jsxs)(u,{className:`flex max-h-[85vh] w-full flex-col sm:max-w-5xl`,children:[q,X,Z]}),t[53]=q,t[54]=X,t[55]=Z,t[56]=Q):Q=t[56];let $;return t[57]!==Q||t[58]!==W?($=(0,_.jsx)(m,{open:!0,onOpenChange:W,children:Q}),t[57]=Q,t[58]=W,t[59]=$):$=t[59],$}export{v as SkillForkDialog};
@@ -1,2 +1,2 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{er as n}from"./DocumentContext-CjYhWoGU.js";import{t as r}from"./react-f2sANaYj.js";import{n as i,r as a}from"./dist-Nvb76hAm.js";import{t as o}from"./compiler-runtime-BfE3aGVn.js";import{b as s,f as c,g as l,m as u,r as d,s as f,t as p}from"./agent-connections-0X_wM1D5.js";import{t as m}from"./button-BeFNZANd.js";import{i as h,n as g,t as _}from"./tooltip-DVBVVaAs.js";import"./RegisteredAgentIcon-CcvblzpC.js";import{Fc as v,en as y,jc as b,nl as x,nn as S,wi as C}from"./dist-DTxb76k4.js";import{n as w}from"./dist-CJhtNlOm2.js";import{c as T}from"./documents-events-DLvhFUkq.js";import{t as E}from"./createLucideIcon-B6ULg5PN.js";import{a as D,f as O,i as k,m as A,n as j,o as M,p as N,u as P}from"./dropdown-menu-BEhl0wvu.js";import{t as F}from"./folder-BrDDZVzs.js";import{n as I,t as L}from"./bool-pref-SOpULTKU.js";import{i as R,l as z,n as B,r as V}from"./skill-scope-bxDiQshW.js";import{F as H,S as ee,j as U,x as te}from"./skills-api-BaxUiF2f.js";import{t as ne}from"./use-skills-DT7KgjWD.js";import{a as re,c as ie,d as ae,f as oe,l as se,p as W,s as G,u as K}from"./DeleteConfirmationDialog-_4ZcQ_WU.js";var q=e(r(),1),J=o();async function Y(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.recordHandoff)try{await n.shell.recordHandoff(e)}catch(e){(t.warn??(e=>console.warn(e)))(`[handoff] recordHandoff IPC rejected (telemetry skipped): ${e instanceof Error?e.message:String(e)}`)}}var ce=E(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),le=E(`file-plus`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]),ue=E(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),X=t(),de=(0,q.createContext)(null),fe=`ok-external-handoff-setup-dismissed-v1`,pe=250,me=1e4;function he(e){return(e instanceof Error?e.message:typeof e==`string`?e:null)?.replace(/\s+/g,` `).trim().slice(0,240)||void 0}function Z(e,t,n){let r=he(n);console.warn(`[handoff] external readiness check bypassed`,{target:e,cause:t,...r===void 0?{}:{detail:r}})}function ge(e){let{check:t}=e;t.statusTimer!==null&&clearTimeout(t.statusTimer),t.deadlineTimer!==null&&clearTimeout(t.deadlineTimer),t.statusTimer=null,t.deadlineTimer=null,t.controller.abort()}function _e(e,t){ve(e.target,t),e.resolve({ok:!1,reason:t})}function ve(e,t){Y({target:e,host:typeof window<`u`&&window.okDesktop!=null?`electron`:`web`,outcome:`error`,reason:t,ts:new Date().toISOString()})}function ye(e,t){if(t.unavailable===!0)return{kind:`unknown`,cause:`unavailable`,detail:t.error};if(!t.ok)return{kind:`unknown`,cause:`read-failed`,detail:t.error};if(t.snapshot===null)return{kind:`unknown`,cause:`missing-snapshot`};let n=d({agentId:e,mode:`external`,snapshot:t.snapshot,detected:!0});if(n===`connected`)return{kind:`ready`};if(n!==`not-connected`)return{kind:`unknown`,cause:`unknown-status`,detail:n};let r=c(t.snapshot,{forceDetected:[e]}).find(t=>t.id===e);return r===void 0?{kind:`unknown`,cause:`missing-row`}:{kind:`setup`,connection:r}}function be(){if(typeof document>`u`)return null;let e=document.activeElement;for(;e instanceof HTMLElement;){let t=e.shadowRoot?.activeElement;if(!(t instanceof HTMLElement))break;e=t}return e instanceof HTMLElement?e:null}function xe(e,t){return`${n(fe,t)}:${e}`}function Se(e,t){return L(xe(e,t))}function Ce(e,t,n){I(xe(e,t),n)}function we(e){let t=(0,J.c)(31),{children:n,applyConnections:r}=e,i=r===void 0?p:r,{_:o}=a(),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={kind:`idle`},t[0]=s):s=t[0];let[c,d]=(0,q.useState)(s),[m,h]=(0,q.useState)(!1),g=(0,q.useRef)(null),_=(0,q.useRef)(0),y;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(y=function(e){return g.current?.id===e.id},t[1]=y):y=t[1];let x=y,S;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(S=function(e){return x(e)?(g.current=null,ge(e),d({kind:`idle`}),!0):!1},t[2]=S):S=t[2];let C=S,w,T;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>()=>{let e=g.current;e!==null&&(g.current=null,ge(e),_e(e,`superseded`))},T=[],t[3]=w,t[4]=T):(w=t[3],T=t[4]),(0,q.useEffect)(w,T);let E;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(e){C(e)&&_e(e,`setup-canceled`)},t[5]=E):E=t[5];let D=E,O;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(e){C(e)&&Promise.resolve().then(e.rawDispatch).then(e.resolve,e.reject)},t[6]=O):O=t[6];let k=O,A;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){let t=be();if(t===null||t===document.body||!t.isConnected)return e;let n={...e,returnFocus:t};return g.current=n,n},t[7]=A):A=t[7];let j=A,M;if(t[8]!==i){let e=async function(e){let t=v(e.target);if(t===void 0){Z(e.target,`unmapped-target`),k(e);return}let n;try{n=await i([],{webSignal:e.check.controller.signal})}catch(t){let n=t;if(!x(e))return;Z(e.target,`read-threw`,n),k(e);return}if(!x(e))return;let r;try{r=ye(t,n)}catch(t){let n=t;Z(e.target,`derivation-threw`,n),k(e);return}if(r.kind!==`setup`){r.kind===`unknown`&&Z(e.target,r.cause,r.detail),k(e);return}ge(e),h(!1),d({kind:`setup`,pending:j(e),connection:r.connection})};M=function(t,n,r){let i=g.current;i!==null&&C(i)&&_e(i,`superseded`);let a=_.current+=1;return r.installState.installed===!1?(ve(t,`not-installed`),Promise.resolve({ok:!1,reason:`not-installed`})):new Promise((i,o)=>{let s=be(),c={id:a,target:t,projectDir:r.projectDir,rawDispatch:n,returnFocus:s?.tagName===`BODY`?null:s,restoreFocus:r.restoreFocus,resolve:i,reject:o,check:{controller:new AbortController,statusTimer:null,deadlineTimer:null}};if(g.current=c,Se(t,r.projectDir)){k(c);return}d({kind:`checking`,id:a,target:t,visible:!1}),c.check.statusTimer=setTimeout(()=>{x(c)&&d(e=>e.kind===`checking`&&e.id===a?{...e,visible:!0}:e)},pe),c.check.deadlineTimer=setTimeout(()=>{x(c)&&(Z(c.target,`read-timeout`),k(c))},me),e(c).catch(e=>{x(c)&&(Z(c.target,`check-threw`,e),k(c))})})},t[8]=i,t[9]=M}else M=t[9];let N=M,P=c.kind===`setup`?c:null,F=P?.connection.label??``,I;t[10]!==c.kind||t[11]!==c.target?(I=c.kind===`checking`?b.find(e=>e.id===c.target)?.displayName??c.target:``,t[10]=c.kind,t[11]=c.target,t[12]=I):I=t[12];let L=I,R;t[13]===N?R=t[14]:(R={dispatch:N},t[13]=N,t[14]=R);let z;t[15]!==o||t[16]!==L||t[17]!==c.kind||t[18]!==c.visible?(z=c.kind===`checking`&&c.visible?(0,X.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`pointer-events-none fixed left-1/2 top-4 z-50 -translate-x-1/2 rounded-full border border-border bg-background px-4 py-2 text-sm text-foreground shadow-md`,children:o({id:`jDejAI`,values:{checkingLabel:L}})}):null,t[15]=o,t[16]=L,t[17]=c.kind,t[18]=c.visible,t[19]=z):z=t[19];let B;t[20]!==o||t[21]!==i||t[22]!==F||t[23]!==m||t[24]!==P?(B=P===null?null:(0,X.jsx)(f,{connection:P.connection,paired:u(P.connection.id),open:!0,onOpenChange:e=>{e||D(P.pending)},onCloseAutoFocus:e=>{let t=P.pending.returnFocus;t?.isConnected===!0?(e.preventDefault(),t.focus()):P.pending.restoreFocus!==void 0&&(e.preventDefault(),P.pending.restoreFocus())},validateSave:e=>e.projectMcp||e.globalMcp?null:o({id:`Pur9o0`}),alternateAction:{label:o({id:`RcPztQ`,values:{handoffLabel:F}}),onClick:()=>{m&&Ce(P.pending.target,P.pending.projectDir,!0),k(P.pending)},preference:{checked:m,label:o({id:`IDXn2n`}),onCheckedChange:h}},onSave:async(e,t)=>{let n=await i(l(P.connection,e,t));if(!x(P.pending)||!n.ok)return n;let r;try{r=ye(P.connection.id,n)}catch(e){let t=e;return Z(P.pending.target,`derivation-threw`,t),{kind:`saved-not-ready`,message:o({id:`srbby-`,values:{handoffLabel:F}})}}return r.kind===`ready`?(k(P.pending),n):{kind:`saved-not-ready`,message:o({id:`srbby-`,values:{handoffLabel:F}})}}},P.pending.id),t[20]=o,t[21]=i,t[22]=F,t[23]=m,t[24]=P,t[25]=B):B=t[25];let V;return t[26]!==n||t[27]!==R||t[28]!==z||t[29]!==B?(V=(0,X.jsxs)(de,{value:R,children:[n,z,B]}),t[26]=n,t[27]=R,t[28]=z,t[29]=B,t[30]=V):V=t[30],V}function Te(){let e=(0,q.use)(de);if(e===null)throw Error(`useExternalHandoffGate must be used within <ExternalHandoffGateProvider />`);return e}var Ee=[...new Set(b.flatMap(e=>e.schemes))];function De(e,t){let n=t.now?.()??Date.now(),r={};for(let t of b){let i=t.schemes[0],a=i===void 0?void 0:e[i];if(!a){r[t.id]={installed:null};continue}r[t.id]={installed:a.installed,...a.displayName===void 0?{}:{displayName:a.displayName},lastChecked:n}}return r}function Oe(e){return De({},e)}async function ke(e){let t=e.schemes??Ee,n=await Promise.all(t.map(async t=>{let n=t.replace(/:$/,``);try{return[t,await e.detectProtocol(n)]}catch{return[t,{installed:!1}]}}));return Object.fromEntries(n)}var Ae=Object.fromEntries(Ee.map(e=>[e,{installed:!1}]));async function je(e){let t;try{t=await e.fetch(`/api/installed-agents`,{signal:e.signal,headers:{Accept:`application/json`}})}catch(e){if(e.name===`AbortError`)throw e;return Ae}if(!t.ok)return Ae;let n;try{n=await t.json()}catch{return Ae}if(typeof n!=`object`||!n||Array.isArray(n))return Ae;let r=n,i={};for(let e of Ee)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function Me(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(!n||!i||n.installed!==i.installed||n.displayName!==i.displayName)return!1}return!0}function Ne(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=Oe({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=De(a,{isElectronHost:e.isElectronHost(),now:e.now})};return{probe:async()=>{if(n)return;if(i)return i;if(r!==null&&e.now()-r<t)return;let o=(async()=>{try{let t=await e.probe();if(n)return;let i=!Me(a,t);a=t,i&&(l(),c()),r=e.now()}catch{}finally{i=null}})();return i=o,o},getTargetStates:()=>o,subscribe:e=>(s.add(e),()=>{s.delete(e)}),cancel:()=>{n=!0,s.clear()}}}function Pe(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function Fe(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>ke({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>je({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function Ie(){let e=(0,J.c)(5),[t,n]=(0,q.useState)(Le),r=(0,q.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=Ne(Fe());r.current=e;let t=e.subscribe(n);e.probe();let i=()=>{e.probe()};return window.addEventListener(`focus`,i),()=>{window.removeEventListener(`focus`,i),t(),e.cancel(),r.current=null}},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),(0,q.useEffect)(i,a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>r.current?.probe()??Promise.resolve(),e[2]=o):o=e[2];let s;return e[3]===t?s=e[4]:(s={states:t,refresh:o},e[3]=t,e[4]=s),s}function Le(){return Oe({isElectronHost:Pe(),now:Date.now})}var Re=(0,q.createContext)(null);function ze(e){let t=(0,J.c)(3),{value:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,X.jsx)(Re,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function Be(){return(0,q.use)(Re)}function Ve(e){let t=(0,J.c)(6),{testId:n,title:r}=e,a;t[0]===r?a=t[1]:(a=r===void 0?{}:{title:r},t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(i,{id:`YjiZAs`}),t[2]=o):o=t[2];let s;return t[3]!==a||t[4]!==n?(s=(0,X.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-yellow-500/40 bg-yellow-500/10 px-1 text-[10px] text-yellow-600 uppercase tracking-wide`,"data-testid":n,...a,children:o}),t[3]=a,t[4]=n,t[5]=s):s=t[5],s}function He(e){let t=(0,J.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,X.jsx)(G,{...r}):(0,X.jsx)(k,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function Ue(e){let t=(0,J.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,X.jsx)(ie,{...r}):(0,X.jsx)(D,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function We(e){let t=(0,J.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,X.jsx)(re,{...r}):(0,X.jsx)(j,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function Ge(e){let t=(0,J.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,X.jsx)(se,{...r}):(0,X.jsx)(M,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function Ke(e){let t=(0,J.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,X.jsx)(K,{...r}):(0,X.jsx)(P,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function qe(e){let t=(0,J.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,X.jsx)(ae,{...r}):(0,X.jsx)(O,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function Je(e){let t=(0,J.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,X.jsx)(oe,{...r}):(0,X.jsx)(N,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function Ye(e){let t=(0,J.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,X.jsx)(W,{...r}):(0,X.jsx)(A,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}var Xe=Object.freeze({hosts:null,source:null}),Ze=new Map,Qe=new Map;function $e(e,t){return`${e}:${t}`}function et(e){return Ze.get(e)??Xe}function tt(e,t){let n=Qe.get(e)??new Set;return Qe.set(e,n),n.add(t),()=>{n.delete(t),n.size===0&&Qe.delete(e)}}function Q(e,t){let n=et(e),r={...n,...t};if(!(r.hosts===n.hosts&&r.source===n.source)){r.hosts===null&&r.source===null?Ze.delete(e):Ze.set(e,r);for(let t of Qe.get(e)??[])t()}}var nt=y.options,rt=S.options,it=`.agents/`;function at({skill:e,allSkills:t,hostSet:n,sourceHostOverlay:r,linkMode:i}){let a=t=>e?`${z(t,e.scope)}/${e.name}`:null,o=e?.hubOffered??(e&&t!==null?t.find(t=>t.scope===e.scope)?.hubOffered:void 0),s=e!==void 0&&(o===!0||(e.hosts??[]).includes(`agents`)||t?.some(t=>t.scope===e.scope&&(t.hosts.includes(`agents`)||t.path.startsWith(it)))),c=e?.hostAliases??(e&&t!==null?Object.assign({},...t.filter(t=>t.scope===e.scope).map(e=>e.hostAliases??{})):{}),l=e?.installableEditors??(e&&t!==null?t.find(t=>t.scope===e.scope)?.installableEditors:void 0),u=l?new Set(l):null,d=e?.scope===`global`?rt:nt,f=(s?[...d,`agents`]:d).filter(e=>!(e in c)).filter(e=>e===`agents`||u===null||u.has(e)||n.has(e)),p=new Set(f.map(e=>a(e))),m=e?.scope===`global`?`~/`:``,h=e?.path?.includes(`/`)?`${m}${e.path.replace(/\/SKILL\.mdx?$/i,``)}`:null,g=h!==null&&!p.has(h)?h:null,_=g===null?r??e?.hosts?.[0]:void 0,v=new Set(e?.conflictHosts??[]),y=new Set(e?.driftPaths??[]),b=new Set(e?.symlinkedHosts??[]),x=[...[...n].filter(e=>e!==_&&!(e in c)&&!v.has(e)&&!e.includes(`/`)).map(e=>({target:e,display:a(e)??e,mode:b.has(e)?`link`:`copy`})),...(e?.customPlacements??[]).map(e=>({target:V(e),display:`${m}${e.path}`,mode:e.mode}))],S=x.map(e=>e.mode),C=S.filter(e=>e===`link`).length,w=S.length===0?i?`link`:`copy`:C*2>=S.length?`link`:`copy`,T=new Map((e?.customPlacements??[]).map(e=>[V(e),e])),E=new Set(T.keys());if(t!==null&&e){for(let n of t)if(n.scope===e.scope)for(let e of n.customPlacements??[]){let t=V(e);t!==``&&E.add(t)}}return{pathFor:a,aliases:c,rows:f,sourceRow:g,sourceHost:_,conflicted:v,drifted:y,linked:b,expectedMode:w,convertible:x,customRootRows:e===void 0?[]:[...E].sort().map(t=>({root:t,display:`${m}${t}/${e.name}`,placed:T.get(t)??null})).filter(e=>!p.has(e.display)&&e.display!==h&&!(e.root in c))}}var ot=`min-w-[24rem]`;function st(e,t){let n=(0,J.c)(45),r=t.installingName===e.name,i=(0,q.useRef)(e),[a,o]=(0,q.useState)(!1),s=(0,q.useRef)(!1),c,l;n[0]===r?(c=n[1],l=n[2]):(c=()=>{s.current&&!r&&o(!0),s.current=r},l=[r],n[0]=r,n[1]=c,n[2]=l),(0,q.useEffect)(c,l);let u,d;n[3]===e?(u=n[4],d=n[5]):(u=()=>{e!==i.current&&(i.current=e,o(!1))},d=[e],n[3]=e,n[4]=u,n[5]=d),(0,q.useEffect)(u,d);let f=r||a,p;n[6]!==e.name||n[7]!==e.scope?(p=$e(e.scope,e.name),n[6]=e.name,n[7]=e.scope,n[8]=p):p=n[8];let m=p,h,g;n[9]===m?(h=n[10],g=n[11]):(h=e=>tt(m,e),g=()=>et(m),n[9]=m,n[10]=h,n[11]=g);let _=(0,q.useSyncExternalStore)(h,g),v=_.hosts,y=_.source,b,x;n[12]!==y||n[13]!==m||n[14]!==e.hosts?(b=()=>{y!==null&&e.hosts[0]===y&&Q(m,{source:null})},x=[e.hosts,y,m],n[12]=y,n[13]=m,n[14]=e.hosts,n[15]=b,n[16]=x):(b=n[15],x=n[16]),(0,q.useEffect)(b,x);let S=e.linkMode===!0,T=v??e.hosts,E;n[17]===T?E=n[18]:(E=new Set(T),n[17]=T,n[18]=E);let D=E,O=v?v.length>0:e.installed,k=(0,q.useRef)(e.hosts),A,j;n[19]!==v||n[20]!==e.hosts?(A=()=>{v===null&&(k.current=e.hosts)},j=[v,e.hosts],n[19]=v,n[20]=e.hosts,n[21]=A,n[22]=j):(A=n[21],j=n[22]),(0,q.useEffect)(A,j);let M;n[23]===e.hosts?M=n[24]:(M=[...e.hosts].sort().join(`,`),n[23]=e.hosts,n[24]=M);let N=M,P,F;n[25]!==m||n[26]!==N?(P=()=>{let e=et(m).hosts;e&&[...e].sort().join(`,`)===N&&Q(m,{hosts:null})},F=[N,m],n[25]=m,n[26]=N,n[27]=P,n[28]=F):(P=n[27],F=n[28]),(0,q.useEffect)(P,F);let I=(0,q.useRef)(null),L=(0,q.useRef)(null),R,z;n[29]===Symbol.for(`react.memo_cache_sentinel`)?(R=()=>()=>{I.current&&clearTimeout(I.current),L.current?.(),L.current=null},z=[],n[29]=R,n[30]=z):(R=n[29],z=n[30]),(0,q.useEffect)(R,z);let B;n[31]!==t||n[32]!==m||n[33]!==e?(B=function(n,r){k.current=n,Q(m,{hosts:n}),I.current&&clearTimeout(I.current);let i=async()=>{L.current=null,I.current=null;let r=await t.install(e,n.filter(C));if(!r.ok){Q(m,{hosts:null});return}k.current=[...r.hosts],Q(m,{hosts:[...r.hosts]})};r?(L.current=()=>void i(),I.current=setTimeout(()=>void i(),350)):(L.current=null,i())},n[31]=t,n[32]=m,n[33]=e,n[34]=B):B=n[34];let V=B,ee;return n[35]!==t||n[36]!==V||n[37]!==D||n[38]!==O||n[39]!==f||n[40]!==y||n[41]!==m||n[42]!==S||n[43]!==e?(ee={hostSet:D,installed:O,installing:f,toggleEditor(e,t){let n=new Set(k.current);t?n.add(e):n.delete(e),V([...n],!0)},installAll(){let t=e.scope===`global`?rt:nt,n=k.current.filter(e=>!t.includes(e)),r=e.installableEditors??t,i=t.filter(e=>r.includes(e)||k.current.includes(e));V([...n,...i],!1)},linkMode:S,sourceHost:y??e.hosts[0],placeAt(n,r){t.runLocationWrite(e,()=>te({scope:e.scope,name:e.name,dir:n,mode:r})).then(lt)},unplaceAt(n){t.runLocationWrite(e,()=>H({scope:e.scope,name:e.name,path:n})).then(ct)},setSource(n){Q(m,{source:n}),t.runLocationWrite(e,()=>U({scope:e.scope,name:e.name,target:n})).then(e=>{e.ok||(Q(m,{source:null}),w.error(e.error))})},convertLocation(n,r){t.convertLocations(e,[{target:n,mode:r}])},convertLocations(n){t.convertLocations(e,n)}},n[35]=t,n[36]=V,n[37]=D,n[38]=O,n[39]=f,n[40]=y,n[41]=m,n[42]=S,n[43]=e,n[44]=ee):ee=n[44],ee}function ct(e){e.ok||w.error(e.error)}function lt(e){e.ok||w.error(e.error)}function $(e){let t=(0,J.c)(7),{hint:n,children:r}=e,i;t[0]===r?i=t[1]:(i=(0,X.jsx)(h,{asChild:!0,children:r}),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=(0,X.jsx)(g,{side:`right`,className:`max-w-xs`,children:n}),t[2]=n,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,X.jsxs)(_,{children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function ut(e){let t=(0,J.c)(77),{toggles:n,skill:r,onResolveFork:o,onRunStart:c,menuKind:l}=e,u=l===void 0?`dropdown`:l,{_:d}=a(),{hostSet:f,toggleEditor:p,installAll:h}=n,g=ne(),_,v,y,b,S,C,E,D,O,k;if(t[0]!==d||t[1]!==g.data||t[2]!==g.status||t[3]!==f||t[4]!==h||t[5]!==u||t[6]!==o||t[7]!==c||t[8]!==r||t[9]!==p||t[10]!==n){let{pathFor:e,aliases:a,rows:l,sourceRow:A,sourceHost:j,conflicted:M,drifted:N,linked:P,expectedMode:I,convertible:L,customRootRows:V}=at({skill:r,allSkills:g.status===`ready`?g.data:null,hostSet:f,sourceHostOverlay:n.sourceHost,linkMode:n.linkMode});S=l,C=A,b=I,v=L,y=V;let H=e=>B(a,e),U=_t,te=e=>{let t=H(e);return t.length===0?!0:window.confirm(d({id:`Uobeu9`,values:{0:t.map(U).join(`, `),rootRel:e}}))},ne;t[21]!==d||t[22]!==r?(ne=(e,t)=>{let n=e.includes(`/`)?e:z(e,r?.scope??`project`);return(0,X.jsx)($,{hint:d({id:`0dslv8`,values:{0:U(e),1:U(e),2:r?.name??``,poolRootRel:t,subRoot:n}}),children:(0,X.jsx)(m,{variant:`ghost`,size:`sm`,className:`h-4 shrink-0 px-0`,"aria-label":d({id:`G6Lrs_`,values:{0:U(e)}}),onClick:i=>{i.preventDefault(),i.stopPropagation(),window.confirm(d({id:`iiqOKM`,values:{0:U(e),1:r.name,2:U(e),subRoot:n,poolRootRel:t}}))&&ee({scope:r.scope,root:n,action:`unlink`,exclude:[r.name]}).then(e=>{e.ok?T():w.error(d({id:`PRgIJh`,values:{0:e.error,subRoot:n}}))})},"data-testid":`skill-audience-unfollow-${e}`,children:(0,X.jsx)(s,{host:e,"aria-hidden":!0,className:`size-3.5`})})},e)},t[21]=d,t[22]=r,t[23]=ne):ne=t[23];let re=ne;_=n.installing;let ie=R(r),ae=gt,oe;t[24]!==d||t[25]!==c||t[26]!==n?(oe=(e,t,r)=>{let a=r===`link`?`copy`:`link`;return(0,X.jsx)($,{hint:d(r===`link`?{id:`FeXcUS`,values:{display:t}}:{id:`ugQcJX`,values:{display:t}}),children:(0,X.jsx)(m,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-yellow-500/40 bg-yellow-500/10 px-1 font-normal text-[10px] text-yellow-600 uppercase tracking-wide hover:bg-yellow-500/20`,onClick:r=>{r.preventDefault(),r.stopPropagation(),window.confirm(d(a===`link`?{id:`m0eHej`,values:{display:t}}:{id:`HbcQYf`,values:{display:t}}))&&(c?.(),n.convertLocation?.(e,a))},"data-testid":`skill-convert-${e}`,children:r===`link`?(0,X.jsx)(i,{id:`uUCrBv`}):(0,X.jsx)(i,{id:`iaPtht`})})})},t[24]=d,t[25]=c,t[26]=n,t[27]=oe):oe=t[27];let se=oe,W;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,X.jsx)(i,{id:`npcziF`}),t[28]=W):W=t[28];let G;t[29]===d?G=t[30]:(G=d({id:`6f_UX4`}),t[29]=d,t[30]=G);let K;t[31]===h?K=t[32]:(K=()=>h(),t[31]=h,t[32]=K);let q;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,X.jsx)(i,{id:`N40H-G`}),t[33]=q):q=t[33];let J;t[34]!==_||t[35]!==K?(J=(0,X.jsx)(m,{variant:`ghost`,size:`sm`,className:`h-5 px-1.5 font-normal text-[11px] text-muted-foreground hover:text-foreground`,disabled:_,onClick:K,"data-testid":`skill-install-all`,children:q}),t[34]=_,t[35]=K,t[36]=J):J=t[36];let Y;t[37]!==G||t[38]!==J?(Y=(0,X.jsx)($,{hint:G,children:J}),t[37]=G,t[38]=J,t[39]=Y):Y=t[39],t[40]!==u||t[41]!==Y?(E=(0,X.jsxs)(Ge,{menuKind:u,className:`flex items-center justify-between gap-2`,children:[W,Y]}),t[40]=u,t[41]=Y,t[42]=E):E=t[42],D=C===null?null:(0,X.jsx)($,{hint:d({id:`pXB6SL`}),children:(0,X.jsxs)(We,{menuKind:u,disabled:_,checked:!0,onSelect:ht,"data-testid":`skill-source-row`,children:[(0,X.jsx)(F,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:C}),(()=>{let e=ae(C).split(`/`).slice(0,-1).join(`/`),t=H(e);return t.length>0?(0,X.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-source`,children:t.map(t=>re(t,e))}):null})(),(0,X.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:(0,X.jsx)(i,{id:`tiFPjk`})})]})]})}),O=S.map(t=>{let a=e(t),c=t===`agents`?`.agents`:x[t],l=ae(a).split(`/`).slice(0,-1).join(`/`),h=H(l);return(0,X.jsx)($,{hint:M.has(t)?d({id:`8HvJlU`,values:{0:a??c}}):t===j?a?d({id:`ssk6rl`,values:{path:a}}):c:f.has(t)?d(a?{id:`9ieZhu`,values:{path:a}}:{id:`n3T3EE`,values:{label:c}}):ie?.editor===t?d({id:`_3S4Ql`,values:{0:r?.name??``,1:ie.plugin,2:a??c,label:c}}):d(a?j===void 0?{id:`xk133d`,values:{path:a}}:b===`link`?{id:`1LtA5r`,values:{path:a}}:{id:`opPbzN`,values:{path:a}}:{id:`Pp0Vgd`,values:{label:c}}),children:(0,X.jsxs)(We,{menuKind:u,disabled:_,checked:f.has(t),onCheckedChange:e=>{M.has(t)||e===!0&&!te(l)||p(t,e===!0)},onSelect:mt,className:`group`,"data-testid":`skill-install-editor-${t}`,children:[(0,X.jsx)(s,{host:t,"aria-hidden":!0,className:`size-4`}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:a??c}),h.length>0?(0,X.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-${t}`,children:h.map(e=>re(e,l))}):null,ie?.editor===t&&!f.has(t)?(0,X.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,"data-testid":`skill-row-plugin-covered-${t}`,children:(0,X.jsx)(i,{id:`scRzTw`})}):null,M.has(t)?(0,X.jsx)($,{hint:d({id:`_O7dJS`}),children:(0,X.jsx)(m,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-yellow-500/40 bg-yellow-500/10 px-1 text-[10px] text-yellow-600 uppercase tracking-wide hover:bg-yellow-500/20`,onClick:e=>{e.preventDefault(),o?.(t)},"data-testid":`skill-fork-chip-${t}`,children:(0,X.jsx)(i,{id:`jng7Ko`})})}):t===j?(0,X.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:(0,X.jsx)(i,{id:`tiFPjk`})}):f.has(t)&&r?.hosts?(0,X.jsxs)(X.Fragment,{children:[!_&&(P.has(t)?`link`:`copy`)!==b?se(t,a??c,P.has(t)?`link`:`copy`):null,(0,X.jsx)($,{hint:d({id:`nBgzKO`}),children:(0,X.jsx)(m,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] text-muted-foreground uppercase tracking-wide opacity-0 focus-visible:opacity-100 group-hover:opacity-100 hover:border-foreground/40 hover:text-foreground`,onClick:e=>{e.preventDefault(),e.stopPropagation(),n.setSource?.(t)},"data-testid":`skill-set-source-${t}`,children:(0,X.jsx)(i,{id:`VNNRfN`})})})]}):null,!_&&N.has(ae(a))?(0,X.jsx)($,{hint:d({id:`iz1LdD`}),children:(0,X.jsx)(Ve,{testId:`skill-drift-${t}`})}):null]})]})},t)}),k=y.map(e=>{let t=e.display;return(0,X.jsx)($,{hint:e.placed===null?d(j===void 0?{id:`xk133d`,values:{path:t}}:b===`link`?{id:`1LtA5r`,values:{path:t}}:{id:`opPbzN`,values:{path:t}}):d({id:`9ieZhu`,values:{path:t}}),children:(0,X.jsxs)(We,{menuKind:u,disabled:_,checked:e.placed!==null,onCheckedChange:t=>{if(t===!0&&e.placed===null){if(!te(e.root))return;n.placeAt(e.root,b)}else e.placed!==null&&n.unplaceAt?.(e.placed.path)},onSelect:pt,className:`group`,"data-testid":`skill-custom-root-${e.root}`,children:[e.root===`.agents/skills`?(0,X.jsx)(s,{host:`agents`,"aria-hidden":!0,className:`size-4`}):(0,X.jsx)(F,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e.display}),H(e.root).length>0?(0,X.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-custom-${e.root}`,children:H(e.root).map(t=>re(t,e.root))}):null,!_&&e.placed!==null&&N.has(e.placed.path)?(0,X.jsx)($,{hint:d({id:`iz1LdD`}),children:(0,X.jsx)(Ve,{testId:`skill-drift-custom-${e.root}`})}):e.placed===null?null:(0,X.jsxs)(X.Fragment,{children:[!_&&e.placed.mode!==b?se(e.root,e.display,e.placed.mode):null,(0,X.jsx)($,{hint:d({id:`nBgzKO`}),children:(0,X.jsx)(m,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] text-muted-foreground uppercase tracking-wide opacity-0 focus-visible:opacity-100 group-hover:opacity-100 hover:border-foreground/40 hover:text-foreground`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.setSource?.(e.root)},"data-testid":`skill-set-source-custom-${e.root}`,children:(0,X.jsx)(i,{id:`VNNRfN`})})})]})]})]})},e.root)}),t[0]=d,t[1]=g.data,t[2]=g.status,t[3]=f,t[4]=h,t[5]=u,t[6]=o,t[7]=c,t[8]=r,t[9]=p,t[10]=n,t[11]=_,t[12]=v,t[13]=y,t[14]=b,t[15]=S,t[16]=C,t[17]=E,t[18]=D,t[19]=O,t[20]=k}else _=t[11],v=t[12],y=t[13],b=t[14],S=t[15],C=t[16],E=t[17],D=t[18],O=t[19],k=t[20];let A;t[43]!==y||t[44]!==S.length||t[45]!==C?(A=S.length===0&&y.length===0&&C===null?(0,X.jsx)(`div`,{className:`px-2 py-1.5 text-[11px] text-muted-foreground leading-snug`,"data-testid":`skill-install-no-destinations`,children:(0,X.jsx)(i,{id:`MOAoFO`})}):null,t[43]=y,t[44]=S.length,t[45]=C,t[46]=A):A=t[46];let j;t[47]!==d||t[48]!==_||t[49]!==v||t[50]!==b||t[51]!==c||t[52]!==n?(j=v.length>0&&n.convertLocations?(0,X.jsxs)(`div`,{className:`flex items-center gap-1 px-2 pt-1 pb-1.5`,children:[(0,X.jsx)(m,{variant:`ghost`,size:`sm`,className:`h-auto whitespace-normal p-0 text-left font-normal text-[11px] text-muted-foreground leading-snug hover:bg-transparent hover:text-foreground`,onClick:e=>{e.preventDefault();let t=b===`link`?`copy`:`link`,r=v.filter(e=>e.mode!==t);if(r.length===0)return;let i=d(t===`copy`?{id:`iOAsF1`}:{id:`MS8lMS`}),a=d(t===`copy`?{id:`gZiT5e`}:{id:`PhIa-X`}),o=r.map(ft).join(`
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{er as n}from"./DocumentContext-Dgls-Dla.js";import{t as r}from"./react-f2sANaYj.js";import{n as i,r as a}from"./dist-Nvb76hAm.js";import{t as o}from"./compiler-runtime-BfE3aGVn.js";import{b as s,f as c,g as l,m as u,r as d,s as f,t as p}from"./agent-connections-DfnLoQwk.js";import{t as m}from"./button-BeFNZANd.js";import{i as h,n as g,t as _}from"./tooltip-DVBVVaAs.js";import"./RegisteredAgentIcon-BQtfPUlI.js";import{Fc as v,en as y,jc as b,nl as x,nn as S,wi as C}from"./dist-tlq-ZRDM.js";import{n as w}from"./dist-CJhtNlOm2.js";import{c as T}from"./documents-events-ByIvYg6i.js";import{t as E}from"./createLucideIcon-B6ULg5PN.js";import{a as D,f as O,i as k,m as A,n as j,o as M,p as N,u as P}from"./dropdown-menu-BEhl0wvu.js";import{t as F}from"./folder-BrDDZVzs.js";import{n as I,t as L}from"./bool-pref-SOpULTKU.js";import{i as R,l as z,n as B,r as V}from"./skill-scope-Hg5bOCB8.js";import{F as H,S as ee,j as U,x as te}from"./skills-api-Bl-dNjGU.js";import{t as ne}from"./use-skills-D17NLQFY.js";import{a as re,c as ie,d as ae,f as oe,l as se,p as W,s as G,u as K}from"./DeleteConfirmationDialog-DAssnqR5.js";var q=e(r(),1),J=o();async function Y(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.recordHandoff)try{await n.shell.recordHandoff(e)}catch(e){(t.warn??(e=>console.warn(e)))(`[handoff] recordHandoff IPC rejected (telemetry skipped): ${e instanceof Error?e.message:String(e)}`)}}var ce=E(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),le=E(`file-plus`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]),ue=E(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),X=t(),de=(0,q.createContext)(null),fe=`ok-external-handoff-setup-dismissed-v1`,pe=250,me=1e4;function he(e){return(e instanceof Error?e.message:typeof e==`string`?e:null)?.replace(/\s+/g,` `).trim().slice(0,240)||void 0}function Z(e,t,n){let r=he(n);console.warn(`[handoff] external readiness check bypassed`,{target:e,cause:t,...r===void 0?{}:{detail:r}})}function ge(e){let{check:t}=e;t.statusTimer!==null&&clearTimeout(t.statusTimer),t.deadlineTimer!==null&&clearTimeout(t.deadlineTimer),t.statusTimer=null,t.deadlineTimer=null,t.controller.abort()}function _e(e,t){ve(e.target,t),e.resolve({ok:!1,reason:t})}function ve(e,t){Y({target:e,host:typeof window<`u`&&window.okDesktop!=null?`electron`:`web`,outcome:`error`,reason:t,ts:new Date().toISOString()})}function ye(e,t){if(t.unavailable===!0)return{kind:`unknown`,cause:`unavailable`,detail:t.error};if(!t.ok)return{kind:`unknown`,cause:`read-failed`,detail:t.error};if(t.snapshot===null)return{kind:`unknown`,cause:`missing-snapshot`};let n=d({agentId:e,mode:`external`,snapshot:t.snapshot,detected:!0});if(n===`connected`)return{kind:`ready`};if(n!==`not-connected`)return{kind:`unknown`,cause:`unknown-status`,detail:n};let r=c(t.snapshot,{forceDetected:[e]}).find(t=>t.id===e);return r===void 0?{kind:`unknown`,cause:`missing-row`}:{kind:`setup`,connection:r}}function be(){if(typeof document>`u`)return null;let e=document.activeElement;for(;e instanceof HTMLElement;){let t=e.shadowRoot?.activeElement;if(!(t instanceof HTMLElement))break;e=t}return e instanceof HTMLElement?e:null}function xe(e,t){return`${n(fe,t)}:${e}`}function Se(e,t){return L(xe(e,t))}function Ce(e,t,n){I(xe(e,t),n)}function we(e){let t=(0,J.c)(31),{children:n,applyConnections:r}=e,i=r===void 0?p:r,{_:o}=a(),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={kind:`idle`},t[0]=s):s=t[0];let[c,d]=(0,q.useState)(s),[m,h]=(0,q.useState)(!1),g=(0,q.useRef)(null),_=(0,q.useRef)(0),y;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(y=function(e){return g.current?.id===e.id},t[1]=y):y=t[1];let x=y,S;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(S=function(e){return x(e)?(g.current=null,ge(e),d({kind:`idle`}),!0):!1},t[2]=S):S=t[2];let C=S,w,T;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>()=>{let e=g.current;e!==null&&(g.current=null,ge(e),_e(e,`superseded`))},T=[],t[3]=w,t[4]=T):(w=t[3],T=t[4]),(0,q.useEffect)(w,T);let E;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(e){C(e)&&_e(e,`setup-canceled`)},t[5]=E):E=t[5];let D=E,O;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(e){C(e)&&Promise.resolve().then(e.rawDispatch).then(e.resolve,e.reject)},t[6]=O):O=t[6];let k=O,A;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){let t=be();if(t===null||t===document.body||!t.isConnected)return e;let n={...e,returnFocus:t};return g.current=n,n},t[7]=A):A=t[7];let j=A,M;if(t[8]!==i){let e=async function(e){let t=v(e.target);if(t===void 0){Z(e.target,`unmapped-target`),k(e);return}let n;try{n=await i([],{webSignal:e.check.controller.signal})}catch(t){let n=t;if(!x(e))return;Z(e.target,`read-threw`,n),k(e);return}if(!x(e))return;let r;try{r=ye(t,n)}catch(t){let n=t;Z(e.target,`derivation-threw`,n),k(e);return}if(r.kind!==`setup`){r.kind===`unknown`&&Z(e.target,r.cause,r.detail),k(e);return}ge(e),h(!1),d({kind:`setup`,pending:j(e),connection:r.connection})};M=function(t,n,r){let i=g.current;i!==null&&C(i)&&_e(i,`superseded`);let a=_.current+=1;return r.installState.installed===!1?(ve(t,`not-installed`),Promise.resolve({ok:!1,reason:`not-installed`})):new Promise((i,o)=>{let s=be(),c={id:a,target:t,projectDir:r.projectDir,rawDispatch:n,returnFocus:s?.tagName===`BODY`?null:s,restoreFocus:r.restoreFocus,resolve:i,reject:o,check:{controller:new AbortController,statusTimer:null,deadlineTimer:null}};if(g.current=c,Se(t,r.projectDir)){k(c);return}d({kind:`checking`,id:a,target:t,visible:!1}),c.check.statusTimer=setTimeout(()=>{x(c)&&d(e=>e.kind===`checking`&&e.id===a?{...e,visible:!0}:e)},pe),c.check.deadlineTimer=setTimeout(()=>{x(c)&&(Z(c.target,`read-timeout`),k(c))},me),e(c).catch(e=>{x(c)&&(Z(c.target,`check-threw`,e),k(c))})})},t[8]=i,t[9]=M}else M=t[9];let N=M,P=c.kind===`setup`?c:null,F=P?.connection.label??``,I;t[10]!==c.kind||t[11]!==c.target?(I=c.kind===`checking`?b.find(e=>e.id===c.target)?.displayName??c.target:``,t[10]=c.kind,t[11]=c.target,t[12]=I):I=t[12];let L=I,R;t[13]===N?R=t[14]:(R={dispatch:N},t[13]=N,t[14]=R);let z;t[15]!==o||t[16]!==L||t[17]!==c.kind||t[18]!==c.visible?(z=c.kind===`checking`&&c.visible?(0,X.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`pointer-events-none fixed left-1/2 top-4 z-50 -translate-x-1/2 rounded-full border border-border bg-background px-4 py-2 text-sm text-foreground shadow-md`,children:o({id:`jDejAI`,values:{checkingLabel:L}})}):null,t[15]=o,t[16]=L,t[17]=c.kind,t[18]=c.visible,t[19]=z):z=t[19];let B;t[20]!==o||t[21]!==i||t[22]!==F||t[23]!==m||t[24]!==P?(B=P===null?null:(0,X.jsx)(f,{connection:P.connection,paired:u(P.connection.id),open:!0,onOpenChange:e=>{e||D(P.pending)},onCloseAutoFocus:e=>{let t=P.pending.returnFocus;t?.isConnected===!0?(e.preventDefault(),t.focus()):P.pending.restoreFocus!==void 0&&(e.preventDefault(),P.pending.restoreFocus())},validateSave:e=>e.projectMcp||e.globalMcp?null:o({id:`Pur9o0`}),alternateAction:{label:o({id:`RcPztQ`,values:{handoffLabel:F}}),onClick:()=>{m&&Ce(P.pending.target,P.pending.projectDir,!0),k(P.pending)},preference:{checked:m,label:o({id:`IDXn2n`}),onCheckedChange:h}},onSave:async(e,t)=>{let n=await i(l(P.connection,e,t));if(!x(P.pending)||!n.ok)return n;let r;try{r=ye(P.connection.id,n)}catch(e){let t=e;return Z(P.pending.target,`derivation-threw`,t),{kind:`saved-not-ready`,message:o({id:`srbby-`,values:{handoffLabel:F}})}}return r.kind===`ready`?(k(P.pending),n):{kind:`saved-not-ready`,message:o({id:`srbby-`,values:{handoffLabel:F}})}}},P.pending.id),t[20]=o,t[21]=i,t[22]=F,t[23]=m,t[24]=P,t[25]=B):B=t[25];let V;return t[26]!==n||t[27]!==R||t[28]!==z||t[29]!==B?(V=(0,X.jsxs)(de,{value:R,children:[n,z,B]}),t[26]=n,t[27]=R,t[28]=z,t[29]=B,t[30]=V):V=t[30],V}function Te(){let e=(0,q.use)(de);if(e===null)throw Error(`useExternalHandoffGate must be used within <ExternalHandoffGateProvider />`);return e}var Ee=[...new Set(b.flatMap(e=>e.schemes))];function De(e,t){let n=t.now?.()??Date.now(),r={};for(let t of b){let i=t.schemes[0],a=i===void 0?void 0:e[i];if(!a){r[t.id]={installed:null};continue}r[t.id]={installed:a.installed,...a.displayName===void 0?{}:{displayName:a.displayName},lastChecked:n}}return r}function Oe(e){return De({},e)}async function ke(e){let t=e.schemes??Ee,n=await Promise.all(t.map(async t=>{let n=t.replace(/:$/,``);try{return[t,await e.detectProtocol(n)]}catch{return[t,{installed:!1}]}}));return Object.fromEntries(n)}var Ae=Object.fromEntries(Ee.map(e=>[e,{installed:!1}]));async function je(e){let t;try{t=await e.fetch(`/api/installed-agents`,{signal:e.signal,headers:{Accept:`application/json`}})}catch(e){if(e.name===`AbortError`)throw e;return Ae}if(!t.ok)return Ae;let n;try{n=await t.json()}catch{return Ae}if(typeof n!=`object`||!n||Array.isArray(n))return Ae;let r=n,i={};for(let e of Ee)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function Me(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(!n||!i||n.installed!==i.installed||n.displayName!==i.displayName)return!1}return!0}function Ne(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=Oe({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=De(a,{isElectronHost:e.isElectronHost(),now:e.now})};return{probe:async()=>{if(n)return;if(i)return i;if(r!==null&&e.now()-r<t)return;let o=(async()=>{try{let t=await e.probe();if(n)return;let i=!Me(a,t);a=t,i&&(l(),c()),r=e.now()}catch{}finally{i=null}})();return i=o,o},getTargetStates:()=>o,subscribe:e=>(s.add(e),()=>{s.delete(e)}),cancel:()=>{n=!0,s.clear()}}}function Pe(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function Fe(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>ke({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>je({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function Ie(){let e=(0,J.c)(5),[t,n]=(0,q.useState)(Le),r=(0,q.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=Ne(Fe());r.current=e;let t=e.subscribe(n);e.probe();let i=()=>{e.probe()};return window.addEventListener(`focus`,i),()=>{window.removeEventListener(`focus`,i),t(),e.cancel(),r.current=null}},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),(0,q.useEffect)(i,a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>r.current?.probe()??Promise.resolve(),e[2]=o):o=e[2];let s;return e[3]===t?s=e[4]:(s={states:t,refresh:o},e[3]=t,e[4]=s),s}function Le(){return Oe({isElectronHost:Pe(),now:Date.now})}var Re=(0,q.createContext)(null);function ze(e){let t=(0,J.c)(3),{value:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,X.jsx)(Re,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function Be(){return(0,q.use)(Re)}function Ve(e){let t=(0,J.c)(6),{testId:n,title:r}=e,a;t[0]===r?a=t[1]:(a=r===void 0?{}:{title:r},t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(i,{id:`YjiZAs`}),t[2]=o):o=t[2];let s;return t[3]!==a||t[4]!==n?(s=(0,X.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-yellow-500/40 bg-yellow-500/10 px-1 text-[10px] text-yellow-600 uppercase tracking-wide`,"data-testid":n,...a,children:o}),t[3]=a,t[4]=n,t[5]=s):s=t[5],s}function He(e){let t=(0,J.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,X.jsx)(G,{...r}):(0,X.jsx)(k,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function Ue(e){let t=(0,J.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,X.jsx)(ie,{...r}):(0,X.jsx)(D,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function We(e){let t=(0,J.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,X.jsx)(re,{...r}):(0,X.jsx)(j,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function Ge(e){let t=(0,J.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,X.jsx)(se,{...r}):(0,X.jsx)(M,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function Ke(e){let t=(0,J.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,X.jsx)(K,{...r}):(0,X.jsx)(P,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function qe(e){let t=(0,J.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,X.jsx)(ae,{...r}):(0,X.jsx)(O,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function Je(e){let t=(0,J.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,X.jsx)(oe,{...r}):(0,X.jsx)(N,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function Ye(e){let t=(0,J.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,X.jsx)(W,{...r}):(0,X.jsx)(A,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}var Xe=Object.freeze({hosts:null,source:null}),Ze=new Map,Qe=new Map;function $e(e,t){return`${e}:${t}`}function et(e){return Ze.get(e)??Xe}function tt(e,t){let n=Qe.get(e)??new Set;return Qe.set(e,n),n.add(t),()=>{n.delete(t),n.size===0&&Qe.delete(e)}}function Q(e,t){let n=et(e),r={...n,...t};if(!(r.hosts===n.hosts&&r.source===n.source)){r.hosts===null&&r.source===null?Ze.delete(e):Ze.set(e,r);for(let t of Qe.get(e)??[])t()}}var nt=y.options,rt=S.options,it=`.agents/`;function at({skill:e,allSkills:t,hostSet:n,sourceHostOverlay:r,linkMode:i}){let a=t=>e?`${z(t,e.scope)}/${e.name}`:null,o=e?.hubOffered??(e&&t!==null?t.find(t=>t.scope===e.scope)?.hubOffered:void 0),s=e!==void 0&&(o===!0||(e.hosts??[]).includes(`agents`)||t?.some(t=>t.scope===e.scope&&(t.hosts.includes(`agents`)||t.path.startsWith(it)))),c=e?.hostAliases??(e&&t!==null?Object.assign({},...t.filter(t=>t.scope===e.scope).map(e=>e.hostAliases??{})):{}),l=e?.installableEditors??(e&&t!==null?t.find(t=>t.scope===e.scope)?.installableEditors:void 0),u=l?new Set(l):null,d=e?.scope===`global`?rt:nt,f=(s?[...d,`agents`]:d).filter(e=>!(e in c)).filter(e=>e===`agents`||u===null||u.has(e)||n.has(e)),p=new Set(f.map(e=>a(e))),m=e?.scope===`global`?`~/`:``,h=e?.path?.includes(`/`)?`${m}${e.path.replace(/\/SKILL\.mdx?$/i,``)}`:null,g=h!==null&&!p.has(h)?h:null,_=g===null?r??e?.hosts?.[0]:void 0,v=new Set(e?.conflictHosts??[]),y=new Set(e?.driftPaths??[]),b=new Set(e?.symlinkedHosts??[]),x=[...[...n].filter(e=>e!==_&&!(e in c)&&!v.has(e)&&!e.includes(`/`)).map(e=>({target:e,display:a(e)??e,mode:b.has(e)?`link`:`copy`})),...(e?.customPlacements??[]).map(e=>({target:V(e),display:`${m}${e.path}`,mode:e.mode}))],S=x.map(e=>e.mode),C=S.filter(e=>e===`link`).length,w=S.length===0?i?`link`:`copy`:C*2>=S.length?`link`:`copy`,T=new Map((e?.customPlacements??[]).map(e=>[V(e),e])),E=new Set(T.keys());if(t!==null&&e){for(let n of t)if(n.scope===e.scope)for(let e of n.customPlacements??[]){let t=V(e);t!==``&&E.add(t)}}return{pathFor:a,aliases:c,rows:f,sourceRow:g,sourceHost:_,conflicted:v,drifted:y,linked:b,expectedMode:w,convertible:x,customRootRows:e===void 0?[]:[...E].sort().map(t=>({root:t,display:`${m}${t}/${e.name}`,placed:T.get(t)??null})).filter(e=>!p.has(e.display)&&e.display!==h&&!(e.root in c))}}var ot=`min-w-[24rem]`;function st(e,t){let n=(0,J.c)(45),r=t.installingName===e.name,i=(0,q.useRef)(e),[a,o]=(0,q.useState)(!1),s=(0,q.useRef)(!1),c,l;n[0]===r?(c=n[1],l=n[2]):(c=()=>{s.current&&!r&&o(!0),s.current=r},l=[r],n[0]=r,n[1]=c,n[2]=l),(0,q.useEffect)(c,l);let u,d;n[3]===e?(u=n[4],d=n[5]):(u=()=>{e!==i.current&&(i.current=e,o(!1))},d=[e],n[3]=e,n[4]=u,n[5]=d),(0,q.useEffect)(u,d);let f=r||a,p;n[6]!==e.name||n[7]!==e.scope?(p=$e(e.scope,e.name),n[6]=e.name,n[7]=e.scope,n[8]=p):p=n[8];let m=p,h,g;n[9]===m?(h=n[10],g=n[11]):(h=e=>tt(m,e),g=()=>et(m),n[9]=m,n[10]=h,n[11]=g);let _=(0,q.useSyncExternalStore)(h,g),v=_.hosts,y=_.source,b,x;n[12]!==y||n[13]!==m||n[14]!==e.hosts?(b=()=>{y!==null&&e.hosts[0]===y&&Q(m,{source:null})},x=[e.hosts,y,m],n[12]=y,n[13]=m,n[14]=e.hosts,n[15]=b,n[16]=x):(b=n[15],x=n[16]),(0,q.useEffect)(b,x);let S=e.linkMode===!0,T=v??e.hosts,E;n[17]===T?E=n[18]:(E=new Set(T),n[17]=T,n[18]=E);let D=E,O=v?v.length>0:e.installed,k=(0,q.useRef)(e.hosts),A,j;n[19]!==v||n[20]!==e.hosts?(A=()=>{v===null&&(k.current=e.hosts)},j=[v,e.hosts],n[19]=v,n[20]=e.hosts,n[21]=A,n[22]=j):(A=n[21],j=n[22]),(0,q.useEffect)(A,j);let M;n[23]===e.hosts?M=n[24]:(M=[...e.hosts].sort().join(`,`),n[23]=e.hosts,n[24]=M);let N=M,P,F;n[25]!==m||n[26]!==N?(P=()=>{let e=et(m).hosts;e&&[...e].sort().join(`,`)===N&&Q(m,{hosts:null})},F=[N,m],n[25]=m,n[26]=N,n[27]=P,n[28]=F):(P=n[27],F=n[28]),(0,q.useEffect)(P,F);let I=(0,q.useRef)(null),L=(0,q.useRef)(null),R,z;n[29]===Symbol.for(`react.memo_cache_sentinel`)?(R=()=>()=>{I.current&&clearTimeout(I.current),L.current?.(),L.current=null},z=[],n[29]=R,n[30]=z):(R=n[29],z=n[30]),(0,q.useEffect)(R,z);let B;n[31]!==t||n[32]!==m||n[33]!==e?(B=function(n,r){k.current=n,Q(m,{hosts:n}),I.current&&clearTimeout(I.current);let i=async()=>{L.current=null,I.current=null;let r=await t.install(e,n.filter(C));if(!r.ok){Q(m,{hosts:null});return}k.current=[...r.hosts],Q(m,{hosts:[...r.hosts]})};r?(L.current=()=>void i(),I.current=setTimeout(()=>void i(),350)):(L.current=null,i())},n[31]=t,n[32]=m,n[33]=e,n[34]=B):B=n[34];let V=B,ee;return n[35]!==t||n[36]!==V||n[37]!==D||n[38]!==O||n[39]!==f||n[40]!==y||n[41]!==m||n[42]!==S||n[43]!==e?(ee={hostSet:D,installed:O,installing:f,toggleEditor(e,t){let n=new Set(k.current);t?n.add(e):n.delete(e),V([...n],!0)},installAll(){let t=e.scope===`global`?rt:nt,n=k.current.filter(e=>!t.includes(e)),r=e.installableEditors??t,i=t.filter(e=>r.includes(e)||k.current.includes(e));V([...n,...i],!1)},linkMode:S,sourceHost:y??e.hosts[0],placeAt(n,r){t.runLocationWrite(e,()=>te({scope:e.scope,name:e.name,dir:n,mode:r})).then(lt)},unplaceAt(n){t.runLocationWrite(e,()=>H({scope:e.scope,name:e.name,path:n})).then(ct)},setSource(n){Q(m,{source:n}),t.runLocationWrite(e,()=>U({scope:e.scope,name:e.name,target:n})).then(e=>{e.ok||(Q(m,{source:null}),w.error(e.error))})},convertLocation(n,r){t.convertLocations(e,[{target:n,mode:r}])},convertLocations(n){t.convertLocations(e,n)}},n[35]=t,n[36]=V,n[37]=D,n[38]=O,n[39]=f,n[40]=y,n[41]=m,n[42]=S,n[43]=e,n[44]=ee):ee=n[44],ee}function ct(e){e.ok||w.error(e.error)}function lt(e){e.ok||w.error(e.error)}function $(e){let t=(0,J.c)(7),{hint:n,children:r}=e,i;t[0]===r?i=t[1]:(i=(0,X.jsx)(h,{asChild:!0,children:r}),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=(0,X.jsx)(g,{side:`right`,className:`max-w-xs`,children:n}),t[2]=n,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,X.jsxs)(_,{children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function ut(e){let t=(0,J.c)(77),{toggles:n,skill:r,onResolveFork:o,onRunStart:c,menuKind:l}=e,u=l===void 0?`dropdown`:l,{_:d}=a(),{hostSet:f,toggleEditor:p,installAll:h}=n,g=ne(),_,v,y,b,S,C,E,D,O,k;if(t[0]!==d||t[1]!==g.data||t[2]!==g.status||t[3]!==f||t[4]!==h||t[5]!==u||t[6]!==o||t[7]!==c||t[8]!==r||t[9]!==p||t[10]!==n){let{pathFor:e,aliases:a,rows:l,sourceRow:A,sourceHost:j,conflicted:M,drifted:N,linked:P,expectedMode:I,convertible:L,customRootRows:V}=at({skill:r,allSkills:g.status===`ready`?g.data:null,hostSet:f,sourceHostOverlay:n.sourceHost,linkMode:n.linkMode});S=l,C=A,b=I,v=L,y=V;let H=e=>B(a,e),U=_t,te=e=>{let t=H(e);return t.length===0?!0:window.confirm(d({id:`Uobeu9`,values:{0:t.map(U).join(`, `),rootRel:e}}))},ne;t[21]!==d||t[22]!==r?(ne=(e,t)=>{let n=e.includes(`/`)?e:z(e,r?.scope??`project`);return(0,X.jsx)($,{hint:d({id:`0dslv8`,values:{0:U(e),1:U(e),2:r?.name??``,poolRootRel:t,subRoot:n}}),children:(0,X.jsx)(m,{variant:`ghost`,size:`sm`,className:`h-4 shrink-0 px-0`,"aria-label":d({id:`G6Lrs_`,values:{0:U(e)}}),onClick:i=>{i.preventDefault(),i.stopPropagation(),window.confirm(d({id:`iiqOKM`,values:{0:U(e),1:r.name,2:U(e),subRoot:n,poolRootRel:t}}))&&ee({scope:r.scope,root:n,action:`unlink`,exclude:[r.name]}).then(e=>{e.ok?T():w.error(d({id:`PRgIJh`,values:{0:e.error,subRoot:n}}))})},"data-testid":`skill-audience-unfollow-${e}`,children:(0,X.jsx)(s,{host:e,"aria-hidden":!0,className:`size-3.5`})})},e)},t[21]=d,t[22]=r,t[23]=ne):ne=t[23];let re=ne;_=n.installing;let ie=R(r),ae=gt,oe;t[24]!==d||t[25]!==c||t[26]!==n?(oe=(e,t,r)=>{let a=r===`link`?`copy`:`link`;return(0,X.jsx)($,{hint:d(r===`link`?{id:`FeXcUS`,values:{display:t}}:{id:`ugQcJX`,values:{display:t}}),children:(0,X.jsx)(m,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-yellow-500/40 bg-yellow-500/10 px-1 font-normal text-[10px] text-yellow-600 uppercase tracking-wide hover:bg-yellow-500/20`,onClick:r=>{r.preventDefault(),r.stopPropagation(),window.confirm(d(a===`link`?{id:`m0eHej`,values:{display:t}}:{id:`HbcQYf`,values:{display:t}}))&&(c?.(),n.convertLocation?.(e,a))},"data-testid":`skill-convert-${e}`,children:r===`link`?(0,X.jsx)(i,{id:`uUCrBv`}):(0,X.jsx)(i,{id:`iaPtht`})})})},t[24]=d,t[25]=c,t[26]=n,t[27]=oe):oe=t[27];let se=oe,W;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,X.jsx)(i,{id:`npcziF`}),t[28]=W):W=t[28];let G;t[29]===d?G=t[30]:(G=d({id:`6f_UX4`}),t[29]=d,t[30]=G);let K;t[31]===h?K=t[32]:(K=()=>h(),t[31]=h,t[32]=K);let q;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,X.jsx)(i,{id:`N40H-G`}),t[33]=q):q=t[33];let J;t[34]!==_||t[35]!==K?(J=(0,X.jsx)(m,{variant:`ghost`,size:`sm`,className:`h-5 px-1.5 font-normal text-[11px] text-muted-foreground hover:text-foreground`,disabled:_,onClick:K,"data-testid":`skill-install-all`,children:q}),t[34]=_,t[35]=K,t[36]=J):J=t[36];let Y;t[37]!==G||t[38]!==J?(Y=(0,X.jsx)($,{hint:G,children:J}),t[37]=G,t[38]=J,t[39]=Y):Y=t[39],t[40]!==u||t[41]!==Y?(E=(0,X.jsxs)(Ge,{menuKind:u,className:`flex items-center justify-between gap-2`,children:[W,Y]}),t[40]=u,t[41]=Y,t[42]=E):E=t[42],D=C===null?null:(0,X.jsx)($,{hint:d({id:`pXB6SL`}),children:(0,X.jsxs)(We,{menuKind:u,disabled:_,checked:!0,onSelect:ht,"data-testid":`skill-source-row`,children:[(0,X.jsx)(F,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:C}),(()=>{let e=ae(C).split(`/`).slice(0,-1).join(`/`),t=H(e);return t.length>0?(0,X.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-source`,children:t.map(t=>re(t,e))}):null})(),(0,X.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:(0,X.jsx)(i,{id:`tiFPjk`})})]})]})}),O=S.map(t=>{let a=e(t),c=t===`agents`?`.agents`:x[t],l=ae(a).split(`/`).slice(0,-1).join(`/`),h=H(l);return(0,X.jsx)($,{hint:M.has(t)?d({id:`8HvJlU`,values:{0:a??c}}):t===j?a?d({id:`ssk6rl`,values:{path:a}}):c:f.has(t)?d(a?{id:`9ieZhu`,values:{path:a}}:{id:`n3T3EE`,values:{label:c}}):ie?.editor===t?d({id:`_3S4Ql`,values:{0:r?.name??``,1:ie.plugin,2:a??c,label:c}}):d(a?j===void 0?{id:`xk133d`,values:{path:a}}:b===`link`?{id:`1LtA5r`,values:{path:a}}:{id:`opPbzN`,values:{path:a}}:{id:`Pp0Vgd`,values:{label:c}}),children:(0,X.jsxs)(We,{menuKind:u,disabled:_,checked:f.has(t),onCheckedChange:e=>{M.has(t)||e===!0&&!te(l)||p(t,e===!0)},onSelect:mt,className:`group`,"data-testid":`skill-install-editor-${t}`,children:[(0,X.jsx)(s,{host:t,"aria-hidden":!0,className:`size-4`}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:a??c}),h.length>0?(0,X.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-${t}`,children:h.map(e=>re(e,l))}):null,ie?.editor===t&&!f.has(t)?(0,X.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,"data-testid":`skill-row-plugin-covered-${t}`,children:(0,X.jsx)(i,{id:`scRzTw`})}):null,M.has(t)?(0,X.jsx)($,{hint:d({id:`_O7dJS`}),children:(0,X.jsx)(m,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-yellow-500/40 bg-yellow-500/10 px-1 text-[10px] text-yellow-600 uppercase tracking-wide hover:bg-yellow-500/20`,onClick:e=>{e.preventDefault(),o?.(t)},"data-testid":`skill-fork-chip-${t}`,children:(0,X.jsx)(i,{id:`jng7Ko`})})}):t===j?(0,X.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:(0,X.jsx)(i,{id:`tiFPjk`})}):f.has(t)&&r?.hosts?(0,X.jsxs)(X.Fragment,{children:[!_&&(P.has(t)?`link`:`copy`)!==b?se(t,a??c,P.has(t)?`link`:`copy`):null,(0,X.jsx)($,{hint:d({id:`nBgzKO`}),children:(0,X.jsx)(m,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] text-muted-foreground uppercase tracking-wide opacity-0 focus-visible:opacity-100 group-hover:opacity-100 hover:border-foreground/40 hover:text-foreground`,onClick:e=>{e.preventDefault(),e.stopPropagation(),n.setSource?.(t)},"data-testid":`skill-set-source-${t}`,children:(0,X.jsx)(i,{id:`VNNRfN`})})})]}):null,!_&&N.has(ae(a))?(0,X.jsx)($,{hint:d({id:`iz1LdD`}),children:(0,X.jsx)(Ve,{testId:`skill-drift-${t}`})}):null]})]})},t)}),k=y.map(e=>{let t=e.display;return(0,X.jsx)($,{hint:e.placed===null?d(j===void 0?{id:`xk133d`,values:{path:t}}:b===`link`?{id:`1LtA5r`,values:{path:t}}:{id:`opPbzN`,values:{path:t}}):d({id:`9ieZhu`,values:{path:t}}),children:(0,X.jsxs)(We,{menuKind:u,disabled:_,checked:e.placed!==null,onCheckedChange:t=>{if(t===!0&&e.placed===null){if(!te(e.root))return;n.placeAt(e.root,b)}else e.placed!==null&&n.unplaceAt?.(e.placed.path)},onSelect:pt,className:`group`,"data-testid":`skill-custom-root-${e.root}`,children:[e.root===`.agents/skills`?(0,X.jsx)(s,{host:`agents`,"aria-hidden":!0,className:`size-4`}):(0,X.jsx)(F,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e.display}),H(e.root).length>0?(0,X.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-custom-${e.root}`,children:H(e.root).map(t=>re(t,e.root))}):null,!_&&e.placed!==null&&N.has(e.placed.path)?(0,X.jsx)($,{hint:d({id:`iz1LdD`}),children:(0,X.jsx)(Ve,{testId:`skill-drift-custom-${e.root}`})}):e.placed===null?null:(0,X.jsxs)(X.Fragment,{children:[!_&&e.placed.mode!==b?se(e.root,e.display,e.placed.mode):null,(0,X.jsx)($,{hint:d({id:`nBgzKO`}),children:(0,X.jsx)(m,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] text-muted-foreground uppercase tracking-wide opacity-0 focus-visible:opacity-100 group-hover:opacity-100 hover:border-foreground/40 hover:text-foreground`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.setSource?.(e.root)},"data-testid":`skill-set-source-custom-${e.root}`,children:(0,X.jsx)(i,{id:`VNNRfN`})})})]})]})]})},e.root)}),t[0]=d,t[1]=g.data,t[2]=g.status,t[3]=f,t[4]=h,t[5]=u,t[6]=o,t[7]=c,t[8]=r,t[9]=p,t[10]=n,t[11]=_,t[12]=v,t[13]=y,t[14]=b,t[15]=S,t[16]=C,t[17]=E,t[18]=D,t[19]=O,t[20]=k}else _=t[11],v=t[12],y=t[13],b=t[14],S=t[15],C=t[16],E=t[17],D=t[18],O=t[19],k=t[20];let A;t[43]!==y||t[44]!==S.length||t[45]!==C?(A=S.length===0&&y.length===0&&C===null?(0,X.jsx)(`div`,{className:`px-2 py-1.5 text-[11px] text-muted-foreground leading-snug`,"data-testid":`skill-install-no-destinations`,children:(0,X.jsx)(i,{id:`MOAoFO`})}):null,t[43]=y,t[44]=S.length,t[45]=C,t[46]=A):A=t[46];let j;t[47]!==d||t[48]!==_||t[49]!==v||t[50]!==b||t[51]!==c||t[52]!==n?(j=v.length>0&&n.convertLocations?(0,X.jsxs)(`div`,{className:`flex items-center gap-1 px-2 pt-1 pb-1.5`,children:[(0,X.jsx)(m,{variant:`ghost`,size:`sm`,className:`h-auto whitespace-normal p-0 text-left font-normal text-[11px] text-muted-foreground leading-snug hover:bg-transparent hover:text-foreground`,onClick:e=>{e.preventDefault();let t=b===`link`?`copy`:`link`,r=v.filter(e=>e.mode!==t);if(r.length===0)return;let i=d(t===`copy`?{id:`iOAsF1`}:{id:`MS8lMS`}),a=d(t===`copy`?{id:`gZiT5e`}:{id:`PhIa-X`}),o=r.map(ft).join(`
2
2
  `);window.confirm(`${i}\n\n${a}\n\n${o}\n\n${d({id:`Cu6GXQ`})}`)&&(c?.(),n.convertLocations?.(r.map(e=>({target:e.target,mode:t}))))},disabled:_,"data-testid":`skill-convert-all`,children:b===`link`?(0,X.jsx)(i,{id:`rcJmK8`}):(0,X.jsx)(i,{id:`LBv_TR`})}),(0,X.jsx)($,{hint:d({id:`0J6nhG`}),children:(0,X.jsx)(m,{variant:`ghost`,size:`sm`,"aria-label":d({id:`qJSo0_`}),className:`size-4 shrink-0 rounded-full border border-border/60 p-0 font-normal text-[9px] text-muted-foreground hover:border-foreground/40 hover:bg-transparent hover:text-foreground`,onClick:dt,"data-testid":`skill-convert-all-help`,children:`?`})})]}):null,t[47]=d,t[48]=_,t[49]=v,t[50]=b,t[51]=c,t[52]=n,t[53]=j):j=t[53];let M;t[54]===u?M=t[55]:(M=(0,X.jsx)(Ke,{menuKind:u}),t[54]=u,t[55]=M);let N;t[56]===d?N=t[57]:(N=d({id:`5ymuTA`}),t[56]=d,t[57]=N);let P;t[58]===r?.scope?P=t[59]:(P=()=>{window.location.hash=r?.scope===`global`?`#settings/user-skills`:`#settings/skills`},t[58]=r?.scope,t[59]=P);let I,L;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,X.jsx)(ue,{"aria-hidden":!0}),L=(0,X.jsx)(i,{id:`ZBF9fn`}),t[60]=I,t[61]=L):(I=t[60],L=t[61]);let V;t[62]!==u||t[63]!==P?(V=(0,X.jsxs)(Ue,{menuKind:u,onSelect:P,children:[I,L]}),t[62]=u,t[63]=P,t[64]=V):V=t[64];let H;t[65]!==V||t[66]!==N?(H=(0,X.jsx)($,{hint:N,children:V}),t[65]=V,t[66]=N,t[67]=H):H=t[67];let U;return t[68]!==H||t[69]!==E||t[70]!==D||t[71]!==O||t[72]!==k||t[73]!==A||t[74]!==j||t[75]!==M?(U=(0,X.jsxs)(X.Fragment,{children:[E,D,O,k,A,j,M,H]}),t[68]=H,t[69]=E,t[70]=D,t[71]=O,t[72]=k,t[73]=A,t[74]=j,t[75]=M,t[76]=U):U=t[76],U}function dt(e){return e.preventDefault()}function ft(e){return e.display}function pt(e){return e.preventDefault()}function mt(e){return e.preventDefault()}function ht(e){return e.preventDefault()}function gt(e){return(e??``).replace(/^~\//,``)}function _t(e){return e===`agents`?`.agents`:x[e]??e}export{ce as C,le as S,we as _,nt as a,Te as b,Ge as c,Je as d,Ye as f,Ie as g,Be as h,rt as i,Ke as l,ze as m,ut as n,He as o,Ve as p,st as r,Ue as s,ot as t,qe as u,Ce as v,Y as w,ue as x,Se as y};
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SkillUpdateConflictDialog-BqyjvMWm.js","./dist-Nvb76hAm.js","./chunk-CYidjpOJ.js","./jsx-runtime-BUgB2tll.js","./react-f2sANaYj.js","./pierre-theme-DODOXO9V.js","./preload-helper-Chd9yIcd.js","./engine-compile-BbEBvIbb.js","./lib-DmueaA5E.js","./html-void-elements-zEl0KGqf.js","./ok-syntax-theme-Cn8LabLs.js","./MultiFileDiff-GzM9NSr9.js","./button-BeFNZANd.js","./dist-BHv-mziD.js","./bundle-mjs-SHeFpKGC.js","./compiler-runtime-BfE3aGVn.js","./utils-CPqDy6Hr.js","./dialog-DJkPMmCN.js","./electron-drag-strip-BgiQs0O3.js","./dist-BcvirUWL.js","./react-dom-DPxgxlDT.js","./dist-DRO03ovd.js","./es2015-B9_uRFGw.js","./x-DIayTyoR.js","./createLucideIcon-B6ULg5PN.js"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./preload-helper-Chd9yIcd.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{t as r}from"./react-f2sANaYj.js";import{n as i,r as a}from"./dist-Nvb76hAm.js";import{t as o}from"./compiler-runtime-BfE3aGVn.js";import{t as s}from"./button-BeFNZANd.js";import{i as c,n as l,t as u}from"./tooltip-DVBVVaAs.js";import{t as d}from"./switch-iwBsEWej.js";import{t as f}from"./arrow-up-right-B3B9a7te.js";import{t as p}from"./spinner-Bp2_BYkl.js";import{t as m}from"./refresh-cw-DisV0kHO.js";import{t as h}from"./undo-2-BQ-ulCEU.js";import{t as g}from"./use-skill-origin-kW6ZZcES.js";var _=o(),v=e(r(),1),y=n(),b=(0,v.lazy)(async()=>({default:(await t(()=>import(`./SkillUpdateConflictDialog-BqyjvMWm.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]),import.meta.url)).SkillUpdateConflictDialog}));function x(e){let t=(0,_.c)(48),{scope:n,name:r}=e,{_:o}=a(),x;t[0]!==r||t[1]!==n?(x={scope:n,name:r},t[0]=r,t[1]=n,t[2]=x):x=t[2];let{origin:S,github:C,displaySource:w,importedTitle:T,canReimport:E,updateAvailable:D,modified:O,autoUpdate:k,gitTracked:A,setAutoUpdate:j,revertable:M,reimport:N,reimporting:P,previewUpdate:F,revert:I,reverting:L}=g(x),[R,z]=(0,v.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(!S)return null;let W;t[9]!==w||t[10]!==C||t[11]!==T?(W=C?(0,y.jsxs)(`a`,{href:C,target:`_blank`,rel:`noreferrer`,title:T??void 0,className:`hidden min-w-0 max-w-48 items-center gap-1 hover:text-foreground @xl/toolbar:flex`,children:[(0,y.jsx)(`span`,{className:`truncate`,children:w}),(0,y.jsx)(f,{className:`size-3 shrink-0`,"aria-hidden":!0})]}):(0,y.jsx)(`span`,{title:T??void 0,className:`hidden min-w-0 max-w-48 truncate @xl/toolbar:inline`,children:w}),t[9]=w,t[10]=C,t[11]=T,t[12]=W):W=t[12];let G;t[13]!==o||t[14]!==k||t[15]!==E||t[16]!==A||t[17]!==j?(G=E?(0,y.jsxs)(u,{children:[(0,y.jsx)(c,{asChild:!0,children:(0,y.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1`,children:[(0,y.jsx)(`label`,{htmlFor:`skill-auto-update-switch`,className:`hidden cursor-pointer @xl/toolbar:inline`,children:(0,y.jsx)(i,{id:`2M0JF6`})}),(0,y.jsx)(d,{id:`skill-auto-update-switch`,checked:k&&!A,disabled:A,onCheckedChange:e=>void j(e===!0),"aria-label":o({id:`o9fPtM`}),className:`scale-75`})]})}),(0,y.jsx)(l,{side:`bottom`,children:A?(0,y.jsx)(i,{id:`vy_VIN`}):k?(0,y.jsx)(i,{id:`vGQxBT`}):(0,y.jsx)(i,{id:`9p_QBN`})})]}):null,t[13]=o,t[14]=k,t[15]=E,t[16]=A,t[17]=j,t[18]=G):G=t[18];let K;t[19]===O?K=t[20]:(K=O?(0,y.jsxs)(u,{children:[(0,y.jsx)(c,{asChild:!0,children:(0,y.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,y.jsx)(i,{id:`tgWuMB`})})}),(0,y.jsx)(l,{side:`bottom`,children:(0,y.jsx)(i,{id:`s0Iold`})})]}):null,t[19]=O,t[20]=K);let q;t[21]!==o||t[22]!==E||t[23]!==O||t[24]!==P||t[25]!==I||t[26]!==M||t[27]!==L?(q=O&&E&&M?(0,y.jsxs)(u,{children:[(0,y.jsx)(s,{variant:`ghost`,size:`sm`,onClick:()=>void I(),disabled:L||P,"aria-label":o({id:`VxLvKE`}),className:`shrink-0 gap-1 text-muted-foreground px-2 text-xs hover:text-foreground`,asChild:!0,children:(0,y.jsxs)(c,{children:[L?(0,y.jsx)(p,{icon:h,className:`size-3`,"aria-hidden":!0}):(0,y.jsx)(h,{className:`size-3`,"aria-hidden":!0}),(0,y.jsx)(`span`,{className:`hidden @xl/toolbar:inline`,children:L?(0,y.jsx)(i,{id:`fIJtam`}):(0,y.jsx)(i,{id:`jJdwCB`})})]})}),(0,y.jsx)(l,{side:`bottom`,children:(0,y.jsx)(i,{id:`XSb9HS`})})]}):null,t[21]=o,t[22]=E,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]!==o||t[30]!==E||t[31]!==V||t[32]!==P||t[33]!==L||t[34]!==D?(J=E&&D?(0,y.jsxs)(u,{children:[(0,y.jsx)(s,{variant:`ghost`,size:`sm`,onClick:()=>void V(),disabled:P||L,"aria-label":o({id:`GidGkh`}),className:`shrink-0 gap-1 text-muted-foreground px-2 text-xs hover:text-foreground`,asChild:!0,children:(0,y.jsxs)(c,{children:[P?(0,y.jsx)(p,{icon:m,className:`size-3`,"aria-hidden":!0}):(0,y.jsx)(m,{className:`size-3`,"aria-hidden":!0}),(0,y.jsx)(`span`,{className:`hidden @xl/toolbar:inline`,children:P?(0,y.jsx)(i,{id:`JL3si7`}):(0,y.jsx)(i,{id:`EkH9pt`})})]})}),(0,y.jsx)(l,{side:`bottom`,children:(0,y.jsx)(i,{id:`GidGkh`})})]}):null,t[29]=o,t[30]=E,t[31]=V,t[32]=P,t[33]=L,t[34]=D,t[35]=J):J=t[35];let Y;t[36]!==R||t[37]!==r||t[38]!==U||t[39]!==P?(Y=R?(0,y.jsx)(v.Suspense,{fallback:null,children:(0,y.jsx)(b,{open:!0,onOpenChange:e=>{e||z(null)},skillName:r,localBody:R.localBody,upstreamBody:R.upstreamBody,applying:P,onTakeUpstream:()=>void U()})}):null,t[36]=R,t[37]=r,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,y.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{x as SkillOriginInline};
2
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./preload-helper-Chd9yIcd.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{t as r}from"./react-f2sANaYj.js";import{n as i,r as a}from"./dist-Nvb76hAm.js";import{t as o}from"./compiler-runtime-BfE3aGVn.js";import{t as s}from"./button-BeFNZANd.js";import{i as c,n as l,t as u}from"./tooltip-DVBVVaAs.js";import{t as d}from"./switch-iwBsEWej.js";import{t as f}from"./arrow-up-right-B3B9a7te.js";import{t as p}from"./spinner-Bp2_BYkl.js";import{t as m}from"./refresh-cw-DisV0kHO.js";import{t as h}from"./undo-2-BQ-ulCEU.js";import{t as g}from"./use-skill-origin-CyMtSI6e.js";var _=o(),v=e(r(),1),y=n(),b=(0,v.lazy)(async()=>({default:(await t(()=>import(`./SkillUpdateConflictDialog-BqyjvMWm.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]),import.meta.url)).SkillUpdateConflictDialog}));function x(e){let t=(0,_.c)(48),{scope:n,name:r}=e,{_:o}=a(),x;t[0]!==r||t[1]!==n?(x={scope:n,name:r},t[0]=r,t[1]=n,t[2]=x):x=t[2];let{origin:S,github:C,displaySource:w,importedTitle:T,canReimport:E,updateAvailable:D,modified:O,autoUpdate:k,gitTracked:A,setAutoUpdate:j,revertable:M,reimport:N,reimporting:P,previewUpdate:F,revert:I,reverting:L}=g(x),[R,z]=(0,v.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(!S)return null;let W;t[9]!==w||t[10]!==C||t[11]!==T?(W=C?(0,y.jsxs)(`a`,{href:C,target:`_blank`,rel:`noreferrer`,title:T??void 0,className:`hidden min-w-0 max-w-48 items-center gap-1 hover:text-foreground @xl/toolbar:flex`,children:[(0,y.jsx)(`span`,{className:`truncate`,children:w}),(0,y.jsx)(f,{className:`size-3 shrink-0`,"aria-hidden":!0})]}):(0,y.jsx)(`span`,{title:T??void 0,className:`hidden min-w-0 max-w-48 truncate @xl/toolbar:inline`,children:w}),t[9]=w,t[10]=C,t[11]=T,t[12]=W):W=t[12];let G;t[13]!==o||t[14]!==k||t[15]!==E||t[16]!==A||t[17]!==j?(G=E?(0,y.jsxs)(u,{children:[(0,y.jsx)(c,{asChild:!0,children:(0,y.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1`,children:[(0,y.jsx)(`label`,{htmlFor:`skill-auto-update-switch`,className:`hidden cursor-pointer @xl/toolbar:inline`,children:(0,y.jsx)(i,{id:`2M0JF6`})}),(0,y.jsx)(d,{id:`skill-auto-update-switch`,checked:k&&!A,disabled:A,onCheckedChange:e=>void j(e===!0),"aria-label":o({id:`o9fPtM`}),className:`scale-75`})]})}),(0,y.jsx)(l,{side:`bottom`,children:A?(0,y.jsx)(i,{id:`vy_VIN`}):k?(0,y.jsx)(i,{id:`vGQxBT`}):(0,y.jsx)(i,{id:`9p_QBN`})})]}):null,t[13]=o,t[14]=k,t[15]=E,t[16]=A,t[17]=j,t[18]=G):G=t[18];let K;t[19]===O?K=t[20]:(K=O?(0,y.jsxs)(u,{children:[(0,y.jsx)(c,{asChild:!0,children:(0,y.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,y.jsx)(i,{id:`tgWuMB`})})}),(0,y.jsx)(l,{side:`bottom`,children:(0,y.jsx)(i,{id:`s0Iold`})})]}):null,t[19]=O,t[20]=K);let q;t[21]!==o||t[22]!==E||t[23]!==O||t[24]!==P||t[25]!==I||t[26]!==M||t[27]!==L?(q=O&&E&&M?(0,y.jsxs)(u,{children:[(0,y.jsx)(s,{variant:`ghost`,size:`sm`,onClick:()=>void I(),disabled:L||P,"aria-label":o({id:`VxLvKE`}),className:`shrink-0 gap-1 text-muted-foreground px-2 text-xs hover:text-foreground`,asChild:!0,children:(0,y.jsxs)(c,{children:[L?(0,y.jsx)(p,{icon:h,className:`size-3`,"aria-hidden":!0}):(0,y.jsx)(h,{className:`size-3`,"aria-hidden":!0}),(0,y.jsx)(`span`,{className:`hidden @xl/toolbar:inline`,children:L?(0,y.jsx)(i,{id:`fIJtam`}):(0,y.jsx)(i,{id:`jJdwCB`})})]})}),(0,y.jsx)(l,{side:`bottom`,children:(0,y.jsx)(i,{id:`XSb9HS`})})]}):null,t[21]=o,t[22]=E,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]!==o||t[30]!==E||t[31]!==V||t[32]!==P||t[33]!==L||t[34]!==D?(J=E&&D?(0,y.jsxs)(u,{children:[(0,y.jsx)(s,{variant:`ghost`,size:`sm`,onClick:()=>void V(),disabled:P||L,"aria-label":o({id:`GidGkh`}),className:`shrink-0 gap-1 text-muted-foreground px-2 text-xs hover:text-foreground`,asChild:!0,children:(0,y.jsxs)(c,{children:[P?(0,y.jsx)(p,{icon:m,className:`size-3`,"aria-hidden":!0}):(0,y.jsx)(m,{className:`size-3`,"aria-hidden":!0}),(0,y.jsx)(`span`,{className:`hidden @xl/toolbar:inline`,children:P?(0,y.jsx)(i,{id:`JL3si7`}):(0,y.jsx)(i,{id:`EkH9pt`})})]})}),(0,y.jsx)(l,{side:`bottom`,children:(0,y.jsx)(i,{id:`GidGkh`})})]}):null,t[29]=o,t[30]=E,t[31]=V,t[32]=P,t[33]=L,t[34]=D,t[35]=J):J=t[35];let Y;t[36]!==R||t[37]!==r||t[38]!==U||t[39]!==P?(Y=R?(0,y.jsx)(v.Suspense,{fallback:null,children:(0,y.jsx)(b,{open:!0,onOpenChange:e=>{e||z(null)},skillName:r,localBody:R.localBody,upstreamBody:R.upstreamBody,applying:P,onTakeUpstream:()=>void U()})}):null,t[36]=R,t[37]=r,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,y.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{x 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{t as s}from"./button-BeFNZANd.js";import{a as c,i as l,n as u,o as d,r as f,s as p,t as m}from"./select-D_BhUvh8.js";import{l as h,n as g,r as _,t as v}from"./AddPropertiesButton-BUNE85Al.js";import{C as y}from"./SkillInstallMenu-sgeehwe1.js";import{a as b,h as x,r as S,t as C,u as w}from"./dropdown-menu-BEhl0wvu.js";import{t as T}from"./list-plus-BmoxCvSM.js";import{p as E,t as D}from"./skill-scope-bxDiQshW.js";var O=a(),k=t();function A(e){let t=(0,O.c)(21),{value:n,onRequestMove:a,disabled:s,triggerClassName:h}=e,{_:g}=i(),_=E(),v;t[0]===a?v=t[1]:(v=e=>a(e),t[0]=a,t[1]=v);let y;t[2]===g?y=t[3]:(y=g({id:`oCHfGC`}),t[2]=g,t[3]=y);let b;t[4]===h?b=t[5]:(b=o(`w-auto gap-1 text-xs font-mono uppercase`,h),t[4]=h,t[5]=b);let x;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,k.jsx)(p,{}),t[6]=x):x=t[6];let S;t[7]!==y||t[8]!==b?(S=(0,k.jsx)(d,{size:`sm`,"aria-label":y,"data-testid":`skill-level-select`,className:b,children:x}),t[7]=y,t[8]=b,t[9]=S):S=t[9];let C;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,k.jsx)(c,{children:(0,k.jsx)(r,{id:`oCHfGC`})}),t[10]=C):C=t[10];let w;t[11]===_?w=t[12]:(w=D.map(e=>(0,k.jsx)(l,{value:e,children:_[e]},e)),t[11]=_,t[12]=w);let T;t[13]===w?T=t[14]:(T=(0,k.jsx)(u,{align:`end`,children:(0,k.jsxs)(f,{children:[C,w]})}),t[13]=w,t[14]=T);let A;return t[15]!==s||t[16]!==v||t[17]!==S||t[18]!==T||t[19]!==n?(A=(0,k.jsxs)(m,{value:n,onValueChange:v,disabled:s,children:[S,T]}),t[15]=s,t[16]=v,t[17]=S,t[18]=T,t[19]=n,t[20]=A):A=t[20],A}var j=e(n(),1);function M(e){let t=(0,O.c)(12),{scope:n,name:r}=e,[i,a]=(0,j.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,k.jsx)(h,{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 N(e){let t=(0,O.c)(41),{scope:n,name:a,showAddPropertyButton:o,onAddProperty:c,problemCount:l,problemMessages:u}=e,{_:d}=i(),f;t[0]!==a||t[1]!==n?(f={scope:n,name:a},t[0]=a,t[1]=n,t[2]=f):f=t[2];let p=M(f),m;t[3]!==p.requestMove||t[4]!==n?(m=(0,k.jsx)(A,{value:n,onRequestMove:p.requestMove,triggerClassName:`hidden @xl/toolbar:flex`}),t[3]=p.requestMove,t[4]=n,t[5]=m):m=t[5];let h;t[6]!==a||t[7]!==n?(h=(0,k.jsx)(_,{scope:n,name:a}),t[6]=a,t[7]=n,t[8]=h):h=t[8];let E;t[9]!==m||t[10]!==h?(E=(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[m,h]}),t[9]=m,t[10]=h,t[11]=E):E=t[11];let D;t[12]!==c||t[13]!==l||t[14]!==u||t[15]!==o?(D=o?(0,k.jsx)(v,{onAddProperty:c,problemCount:l,problemMessages:u,className:`hidden @xl/toolbar:inline-flex`}):null,t[12]=c,t[13]=l,t[14]=u,t[15]=o,t[16]=D):D=t[16];let j;t[17]===d?j=t[18]:(j=d({id:`Yzs3QX`}),t[17]=d,t[18]=j);let N;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,k.jsx)(y,{className:`size-4`,"aria-hidden":!0}),t[19]=N):N=t[19];let P;t[20]===j?P=t[21]:(P=(0,k.jsx)(x,{asChild:!0,children:(0,k.jsx)(s,{variant:`ghost`,size:`icon`,"aria-label":j,"data-testid":`skill-toolbar-overflow`,className:`@xl/toolbar:hidden`,children:N})}),t[20]=j,t[21]=P);let F;t[22]===p?F=t[23]:(F=e=>p.requestMove(e),t[22]=p,t[23]=F);let I;t[24]!==n||t[25]!==F?(I=(0,k.jsx)(g,{value:n,onSelect:F}),t[24]=n,t[25]=F,t[26]=I):I=t[26];let L;t[27]!==c||t[28]!==o?(L=o?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(w,{}),(0,k.jsxs)(b,{onSelect:c,children:[(0,k.jsx)(T,{}),(0,k.jsx)(r,{id:`81H_23`})]})]}):null,t[27]=c,t[28]=o,t[29]=L):L=t[29];let R;t[30]!==I||t[31]!==L?(R=(0,k.jsxs)(S,{align:`end`,className:`min-w-44`,children:[I,L]}),t[30]=I,t[31]=L,t[32]=R):R=t[32];let z;t[33]!==R||t[34]!==P?(z=(0,k.jsxs)(C,{children:[P,R]}),t[33]=R,t[34]=P,t[35]=z):z=t[35];let B;return t[36]!==p.dialog||t[37]!==z||t[38]!==E||t[39]!==D?(B=(0,k.jsxs)(k.Fragment,{children:[E,D,z,p.dialog]}),t[36]=p.dialog,t[37]=z,t[38]=E,t[39]=D,t[40]=B):B=t[40],B}export{N 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{t as s}from"./button-BeFNZANd.js";import{a as c,i as l,n as u,o as d,r as f,s as p,t as m}from"./select-D_BhUvh8.js";import{l as h,n as g,r as _,t as v}from"./AddPropertiesButton-iN7hK8hR.js";import{C as y}from"./SkillInstallMenu-CN2GrbPw.js";import{a as b,h as x,r as S,t as C,u as w}from"./dropdown-menu-BEhl0wvu.js";import{t as T}from"./list-plus-BmoxCvSM.js";import{p as E,t as D}from"./skill-scope-Hg5bOCB8.js";var O=a(),k=t();function A(e){let t=(0,O.c)(21),{value:n,onRequestMove:a,disabled:s,triggerClassName:h}=e,{_:g}=i(),_=E(),v;t[0]===a?v=t[1]:(v=e=>a(e),t[0]=a,t[1]=v);let y;t[2]===g?y=t[3]:(y=g({id:`oCHfGC`}),t[2]=g,t[3]=y);let b;t[4]===h?b=t[5]:(b=o(`w-auto gap-1 text-xs font-mono uppercase`,h),t[4]=h,t[5]=b);let x;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,k.jsx)(p,{}),t[6]=x):x=t[6];let S;t[7]!==y||t[8]!==b?(S=(0,k.jsx)(d,{size:`sm`,"aria-label":y,"data-testid":`skill-level-select`,className:b,children:x}),t[7]=y,t[8]=b,t[9]=S):S=t[9];let C;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,k.jsx)(c,{children:(0,k.jsx)(r,{id:`oCHfGC`})}),t[10]=C):C=t[10];let w;t[11]===_?w=t[12]:(w=D.map(e=>(0,k.jsx)(l,{value:e,children:_[e]},e)),t[11]=_,t[12]=w);let T;t[13]===w?T=t[14]:(T=(0,k.jsx)(u,{align:`end`,children:(0,k.jsxs)(f,{children:[C,w]})}),t[13]=w,t[14]=T);let A;return t[15]!==s||t[16]!==v||t[17]!==S||t[18]!==T||t[19]!==n?(A=(0,k.jsxs)(m,{value:n,onValueChange:v,disabled:s,children:[S,T]}),t[15]=s,t[16]=v,t[17]=S,t[18]=T,t[19]=n,t[20]=A):A=t[20],A}var j=e(n(),1);function M(e){let t=(0,O.c)(12),{scope:n,name:r}=e,[i,a]=(0,j.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,k.jsx)(h,{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 N(e){let t=(0,O.c)(41),{scope:n,name:a,showAddPropertyButton:o,onAddProperty:c,problemCount:l,problemMessages:u}=e,{_:d}=i(),f;t[0]!==a||t[1]!==n?(f={scope:n,name:a},t[0]=a,t[1]=n,t[2]=f):f=t[2];let p=M(f),m;t[3]!==p.requestMove||t[4]!==n?(m=(0,k.jsx)(A,{value:n,onRequestMove:p.requestMove,triggerClassName:`hidden @xl/toolbar:flex`}),t[3]=p.requestMove,t[4]=n,t[5]=m):m=t[5];let h;t[6]!==a||t[7]!==n?(h=(0,k.jsx)(_,{scope:n,name:a}),t[6]=a,t[7]=n,t[8]=h):h=t[8];let E;t[9]!==m||t[10]!==h?(E=(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[m,h]}),t[9]=m,t[10]=h,t[11]=E):E=t[11];let D;t[12]!==c||t[13]!==l||t[14]!==u||t[15]!==o?(D=o?(0,k.jsx)(v,{onAddProperty:c,problemCount:l,problemMessages:u,className:`hidden @xl/toolbar:inline-flex`}):null,t[12]=c,t[13]=l,t[14]=u,t[15]=o,t[16]=D):D=t[16];let j;t[17]===d?j=t[18]:(j=d({id:`Yzs3QX`}),t[17]=d,t[18]=j);let N;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,k.jsx)(y,{className:`size-4`,"aria-hidden":!0}),t[19]=N):N=t[19];let P;t[20]===j?P=t[21]:(P=(0,k.jsx)(x,{asChild:!0,children:(0,k.jsx)(s,{variant:`ghost`,size:`icon`,"aria-label":j,"data-testid":`skill-toolbar-overflow`,className:`@xl/toolbar:hidden`,children:N})}),t[20]=j,t[21]=P);let F;t[22]===p?F=t[23]:(F=e=>p.requestMove(e),t[22]=p,t[23]=F);let I;t[24]!==n||t[25]!==F?(I=(0,k.jsx)(g,{value:n,onSelect:F}),t[24]=n,t[25]=F,t[26]=I):I=t[26];let L;t[27]!==c||t[28]!==o?(L=o?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(w,{}),(0,k.jsxs)(b,{onSelect:c,children:[(0,k.jsx)(T,{}),(0,k.jsx)(r,{id:`81H_23`})]})]}):null,t[27]=c,t[28]=o,t[29]=L):L=t[29];let R;t[30]!==I||t[31]!==L?(R=(0,k.jsxs)(S,{align:`end`,className:`min-w-44`,children:[I,L]}),t[30]=I,t[31]=L,t[32]=R):R=t[32];let z;t[33]!==R||t[34]!==P?(z=(0,k.jsxs)(C,{children:[P,R]}),t[33]=R,t[34]=P,t[35]=z):z=t[35];let B;return t[36]!==p.dialog||t[37]!==z||t[38]!==E||t[39]!==D?(B=(0,k.jsxs)(k.Fragment,{children:[E,D,z,p.dialog]}),t[36]=p.dialog,t[37]=z,t[38]=E,t[39]=D,t[40]=B):B=t[40],B}export{N 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-BeFNZANd.js";import{i as s,n as c,t as l}from"./tooltip-DVBVVaAs.js";import{On as u}from"./dist-DTxb76k4.js";import{t as d}from"./trace-api-BP9dN1Hz.js";import{n as f}from"./dist-CJhtNlOm2.js";import{n as p,t as m}from"./workspace-paths-B4HZ2xXF.js";import{t as h}from"./createLucideIcon-B6ULg5PN.js";import{n as g}from"./use-workspace-ByLGR16G.js";var _=h(`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();async function E(e,t,n,r){let i=f.loading(n.opening,{duration:1/0});try{let a=await e.open(t);if(a.ok){f.dismiss(i);return}if(a.reason===`cancelled`){f.dismiss(i);return}let o,s=!1;switch(a.reason){case`timeout`:o=n.timeout,s=!0;break;case`exited-early`:case`renderer-failed`:o=n.renderFailed,s=!0;break;case`load-failed`:o=n.openFailed,s=!0;break;case`unsupported-server`:o=n.unsupported;break;case`spawn-error`:case`port-error`:o=n.startFailed,s=!0;break;case`not-available`:case`invalid-path`:o=n.openFailed;break;default:a.reason,o=n.openFailed}f.error(o,{id:i,...s?{action:{label:n.retry,onClick:r}}:{}})}catch(e){console.warn(`[slides] open dispatch failed:`,e instanceof Error?e:String(e)),f.error(n.openFailed,{id:i,action:{label:n.retry,onClick:r}})}}async function D(e,t,n,r,i,a){if(!r.current.has(t)){r.current.add(t);try{i(new Set(r.current)),a&&S(),await E(e,t,n,()=>{D(e,t,n,r,i,!1)})}finally{r.current.delete(t),i(new Set(r.current))}}}function O(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 k(e){let t=(0,y.c)(12),{provider:n,docName:a}=e,{_:u}=i(),d=w(n,`slides`),f=O(d),h=g(),b=(0,v.useRef)(new Set),[x,S]=(0,v.useState)(A);if(!d||f!==`available`)return null;let C=h==null?null:p(h.contentDir,m(a),h.pathSeparator),E=async function(){let e=window.okDesktop?.slides;e==null||C==null||await D(e,C,{opening:u({id:`PKLY-1`}),timeout:u({id:`NeY1Np`}),renderFailed:u({id:`Lm3r51`}),openFailed:u({id:`X59Fx2`}),unsupported:u({id:`T_j5G0`}),startFailed:u({id:`TBfy1C`}),retry:u({id:`KDw4GX`})},b,S,!0)},k=l,j=o,M;t[0]===u?M=t[1]:(M=u({id:`w52SKa`}),t[0]=u,t[1]=M);let N=C!=null&&x.has(C),P;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,T.jsx)(s,{children:(0,T.jsx)(_,{"aria-hidden":!0})}),t[2]=P):P=t[2];let F;t[3]!==j||t[4]!==E||t[5]!==M||t[6]!==N?(F=(0,T.jsx)(j,{variant:`ghost`,size:`icon`,onClick:E,"aria-label":M,"aria-busy":N,"data-testid":`slides-toolbar-action`,asChild:!0,children:P}),t[3]=j,t[4]=E,t[5]=M,t[6]=N,t[7]=F):F=t[7];let I;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,T.jsx)(c,{side:`bottom`,children:(0,T.jsx)(r,{id:`w52SKa`})}),t[8]=I):I=t[8];let L;return t[9]!==k||t[10]!==F?(L=(0,T.jsxs)(k,{children:[F,I]}),t[9]=k,t[10]=F,t[11]=L):L=t[11],L}function A(){return new Set}export{k 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-BeFNZANd.js";import{i as s,n as c,t as l}from"./tooltip-DVBVVaAs.js";import{On as u}from"./dist-tlq-ZRDM.js";import{t as d}from"./trace-api-BP9dN1Hz.js";import{n as f}from"./dist-CJhtNlOm2.js";import{n as p,t as m}from"./workspace-paths-B4HZ2xXF.js";import{t as h}from"./createLucideIcon-B6ULg5PN.js";import{n as g}from"./use-workspace-rz8Pc1_5.js";var _=h(`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();async function E(e,t,n,r){let i=f.loading(n.opening,{duration:1/0});try{let a=await e.open(t);if(a.ok){f.dismiss(i);return}if(a.reason===`cancelled`){f.dismiss(i);return}let o,s=!1;switch(a.reason){case`timeout`:o=n.timeout,s=!0;break;case`exited-early`:case`renderer-failed`:o=n.renderFailed,s=!0;break;case`load-failed`:o=n.openFailed,s=!0;break;case`unsupported-server`:o=n.unsupported;break;case`spawn-error`:case`port-error`:o=n.startFailed,s=!0;break;case`not-available`:case`invalid-path`:o=n.openFailed;break;default:a.reason,o=n.openFailed}f.error(o,{id:i,...s?{action:{label:n.retry,onClick:r}}:{}})}catch(e){console.warn(`[slides] open dispatch failed:`,e instanceof Error?e:String(e)),f.error(n.openFailed,{id:i,action:{label:n.retry,onClick:r}})}}async function D(e,t,n,r,i,a){if(!r.current.has(t)){r.current.add(t);try{i(new Set(r.current)),a&&S(),await E(e,t,n,()=>{D(e,t,n,r,i,!1)})}finally{r.current.delete(t),i(new Set(r.current))}}}function O(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 k(e){let t=(0,y.c)(12),{provider:n,docName:a}=e,{_:u}=i(),d=w(n,`slides`),f=O(d),h=g(),b=(0,v.useRef)(new Set),[x,S]=(0,v.useState)(A);if(!d||f!==`available`)return null;let C=h==null?null:p(h.contentDir,m(a),h.pathSeparator),E=async function(){let e=window.okDesktop?.slides;e==null||C==null||await D(e,C,{opening:u({id:`PKLY-1`}),timeout:u({id:`NeY1Np`}),renderFailed:u({id:`Lm3r51`}),openFailed:u({id:`X59Fx2`}),unsupported:u({id:`T_j5G0`}),startFailed:u({id:`TBfy1C`}),retry:u({id:`KDw4GX`})},b,S,!0)},k=l,j=o,M;t[0]===u?M=t[1]:(M=u({id:`w52SKa`}),t[0]=u,t[1]=M);let N=C!=null&&x.has(C),P;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,T.jsx)(s,{children:(0,T.jsx)(_,{"aria-hidden":!0})}),t[2]=P):P=t[2];let F;t[3]!==j||t[4]!==E||t[5]!==M||t[6]!==N?(F=(0,T.jsx)(j,{variant:`ghost`,size:`icon`,onClick:E,"aria-label":M,"aria-busy":N,"data-testid":`slides-toolbar-action`,asChild:!0,children:P}),t[3]=j,t[4]=E,t[5]=M,t[6]=N,t[7]=F):F=t[7];let I;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,T.jsx)(c,{side:`bottom`,children:(0,T.jsx)(r,{id:`w52SKa`})}),t[8]=I):I=t[8];let L;return t[9]!==k||t[10]!==F?(L=(0,T.jsxs)(k,{children:[F,I]}),t[9]=k,t[10]=F,t[11]=L):L=t[11],L}function A(){return new Set}export{k as SlidesToolbarControls};