@inkeep/open-knowledge 0.50.0-beta.7 → 0.50.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.
- package/dist/{acp-harness-probe-DknlAQmM.mjs → acp-harness-probe-Bl1wO1jG.mjs} +2 -2
- package/dist/cli.mjs +18 -18
- package/dist/config-schema.json +6 -33
- package/dist/config.user.schema.json +6 -33
- package/dist/constants-WesqvVEb.mjs +2 -0
- package/dist/fs-traced-B2GMd7hO.mjs +12 -0
- package/dist/fs-traced-Bkh7Uqka.mjs +1 -0
- package/dist/{git-handle-D48CPnbp.mjs → git-handle-C_J8Il_Y.mjs} +2 -2
- package/dist/git-handle-k-1cd6rA.mjs +1 -0
- package/dist/index.d.mts +20 -47
- package/dist/index.mjs +170 -170
- package/dist/init-B17jtLEt.mjs +1 -0
- package/dist/{init-LDlpt5v5.mjs → init-Cs060ZhU.mjs} +5 -5
- package/dist/{launch-json-removal-BsTgc5gY.mjs → launch-json-removal-D0Z9HiC6.mjs} +2 -2
- package/dist/loader-C2IzfV23.mjs +1 -0
- package/dist/loader-C_U6y8K2.mjs +2 -0
- package/dist/md-manager-CmcPG20v.mjs +2 -0
- package/dist/{open-browser-CzSvhfe-.mjs → open-browser-BVRsx4UD.mjs} +2 -2
- package/dist/parse-worker.mjs +1 -1
- package/dist/{preview-DfsV8cng.mjs → preview-1BHwOzN5.mjs} +2 -2
- package/dist/preview-BOmw4Npa.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-c7Ng5dOt.js → ActivityModeContent-DFgZy7oE.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-CdvdlrTA.js → AgentDiffPane-CWxNDLJy.js} +1 -1
- package/dist/public/assets/{AgentThreadClientBinder-CvHvukLZ.js → AgentThreadClientBinder-BO7zX8GD.js} +1 -1
- package/dist/public/assets/{ChangedOutsideBadge-Bu8uPTJS.js → ChangedOutsideBadge-B4qPknqp.js} +1 -1
- package/dist/public/assets/CodeMirrorPropInput-CQzidEcb.js +3 -0
- package/dist/public/assets/{DocumentContext-sNpqhUlI.js → DocumentContext-CNSuvcIw.js} +18 -18
- package/dist/public/assets/{EditorModeToggle-D4871FSZ.js → EditorModeToggle-DkQghTpa.js} +1 -1
- package/dist/public/assets/{EnableSyncConfirmDialog-cBuI6coM.js → EnableSyncConfirmDialog-Btif19hJ.js} +1 -1
- package/dist/public/assets/FeedbackForm-sQ4Muu3U.js +1 -0
- package/dist/public/assets/{GraphPanel-CAMYjjtr.js → GraphPanel-CNCFVViE.js} +2 -2
- package/dist/public/assets/{ImportSkillDialog-BepHDHz6.js → ImportSkillDialog-CiRpJ3T5.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-DRA7zDJD.js → LintConfigEditor-5XRvqcql.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-CIqNGD9N.js +2 -0
- package/dist/public/assets/ManagedArtifactProperties-D1vyOCad.js +1 -0
- package/dist/public/assets/{McpConsentDialogBody-ONRUf-u9.js → McpConsentDialogBody-C02gJb5g.js} +1 -1
- package/dist/public/assets/{MermaidDocEditor-DC95RR-G.js → MermaidDocEditor-D2cBfG9r.js} +1 -1
- package/dist/public/assets/{ReportBugDialogBody-7VaenClj.js → ReportBugDialogBody-CrlxwAm_.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-B2VRQNhY.js → SchemaConfigEditor-B7a503PZ.js} +1 -1
- package/dist/public/assets/{SessionsHost-CJM2wXx0.js → SessionsHost-CpLvCqvs.js} +2 -2
- package/dist/public/assets/SettingsDialogBody-C7DVY6B-.js +12 -0
- package/dist/public/assets/{ShareBranchSwitchDialog-DD7xybfa.js → ShareBranchSwitchDialog-BUEkE4LA.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-Bz3zpKKF.js → ShareReceiveDialog-XWYS81GX.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-DqXylco3.js → ShareReceiveMissDialog-MPUr0dv1.js} +1 -1
- package/dist/public/assets/{SkillEditBanner-BwzPIxd8.js → SkillEditBanner-SWeBUR9w.js} +1 -1
- package/dist/public/assets/{SkillOriginInline-BFCXo8sI.js → SkillOriginInline-BG4CIOQu.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-DF0m8f6g.js → SkillToolbarControls-CaHitAH1.js} +1 -1
- package/dist/public/assets/{SlidesToolbarControls-DJXDoZdd.js → SlidesToolbarControls-qIPApX9s.js} +1 -1
- package/dist/public/assets/SourceEditor-DKEUL0BH.js +1 -0
- package/dist/public/assets/{TerminalPanel-BlK8X0ar.js → TerminalPanel-BY_O1gj3.js} +2 -2
- package/dist/public/assets/{TerminalWindowApp-Cy9Ov0_z.js → TerminalWindowApp-DLh-TT_A.js} +1 -1
- package/dist/public/assets/{TextDocEditor-D3Hjb2Vu.js → TextDocEditor-0dFDtMs6.js} +1 -1
- package/dist/public/assets/ThreadView-CHmtUGoi.js +10 -0
- package/dist/public/assets/{TimelineDiffPane-CGiWI4cl.js → TimelineDiffPane-Ba7SXNWn.js} +1 -1
- package/dist/public/assets/{agent-diff-store-CEeOURzl.js → agent-diff-store-DbDYdvOw.js} +1 -1
- package/dist/public/assets/auth-state-cache-BF6Z4GtZ.js +11 -0
- package/dist/public/assets/{client-version-B0MkkJjB.js → client-version-BM5nu9rX.js} +1 -1
- package/dist/public/assets/{comment-chips-CmSdX8nJ.js → comment-chips-pQK8zh5P.js} +1 -1
- package/dist/public/assets/config-provider-Dz54I9YH.js +5 -0
- package/dist/public/assets/{dist-Cy5lktAQ2.js → dist-D6d8jhW_2.js} +184 -184
- package/dist/public/assets/{doc-paths-CBKXYveW.js → doc-paths-B610Q5eD.js} +1 -1
- package/dist/public/assets/{documents-events-DNLLVEPR.js → documents-events-DQ-lmKb8.js} +1 -1
- package/dist/public/assets/{file-tree-adapter-BQ9idF-F.js → file-tree-adapter-Bmhiw8ek.js} +1 -1
- package/dist/public/assets/{file-tree-utils-DrTcSGTj.js → file-tree-utils-bTlUKR2h.js} +1 -1
- package/dist/public/assets/{folder-config-api-Cf3ca6iE.js → folder-config-api-BFi_uZNT.js} +1 -1
- package/dist/public/assets/{follow-file-Ctr47jtP.js → follow-file-CjlmJwxJ.js} +1 -1
- package/dist/public/assets/globals-Bq7QmnDv.css +1 -0
- package/dist/public/assets/i18n-DWCqmgsa.js +1 -0
- package/dist/public/assets/index-gC7cHSmk.js +2097 -0
- package/dist/public/assets/{lint-config-client-DzdtSJp-.js → lint-config-client-DTg6epjB.js} +1 -1
- package/dist/public/assets/{markdownlint-rule-browser-DMQXiRek.js → markdownlint-rule-browser-BG8UPutR.js} +1 -1
- package/dist/public/assets/messages-B12ABuMo.js +1 -0
- package/dist/public/assets/messages-BUufFcK8.js +1 -0
- package/dist/public/assets/messages-BV-Jgai1.js +1 -0
- package/dist/public/assets/messages-B_u6thtp.js +1 -0
- package/dist/public/assets/messages-CS-CWF8r.js +1 -0
- package/dist/public/assets/messages-CwQGRPEE.js +1 -0
- package/dist/public/assets/messages-Cwceyxby.js +1 -0
- package/dist/public/assets/messages-DGpodehZ.js +1 -0
- package/dist/public/assets/messages-DHl_AYzv.js +1 -0
- package/dist/public/assets/messages-DbRvxOAn.js +1 -0
- package/dist/public/assets/messages-DdKkPWw3.js +1 -0
- package/dist/public/assets/navigation-targets-Ch69zMGC.js +1 -0
- package/dist/public/assets/{open-managed-artifact-tab-B84Y6EsP.js → open-managed-artifact-tab-CY_LAv2n.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-DosIhFkt.js → pending-receive-nav-store-B4qUnaqd.js} +1 -1
- package/dist/public/assets/{prop-types-BxhIEdp4.js → prop-types-C-BAUUTo.js} +1 -1
- package/dist/public/assets/{receive-store-DO5w93VK.js → receive-store-CbFpknqD.js} +1 -1
- package/dist/public/assets/{selection-context-DAl-Wxy6.js → selection-context-BPfggRPr.js} +1 -1
- package/dist/public/assets/{skill-actions-1VvTttnO.js → skill-actions-BIlEExO7.js} +2 -2
- package/dist/public/assets/{skill-scope-uWACL-4X.js → skill-scope-BpzNeizS.js} +1 -1
- package/dist/public/assets/{skills-api-S9b1zvZ6.js → skills-api-CnFnvcRc.js} +1 -1
- package/dist/public/assets/{src-CVA7Dtfv.js → src-DFsYGwxw.js} +2 -2
- package/dist/public/assets/{tag-pill-input-er0MqvFK.js → tag-pill-input-BMvx5BmV.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-DBvgpA7l.js → target-navigation-intent-C776WObz.js} +1 -1
- package/dist/public/assets/{terminal-cli-display-CBMTYLbQ.js → terminal-cli-display-DOg7CEcR.js} +1 -1
- package/dist/public/assets/{terminal-launch-events-CbqKUJ57.js → terminal-launch-events-BIj1IHuR.js} +1 -1
- package/dist/public/assets/{terminal-telemetry-BRNk9k9Y.js → terminal-telemetry-DRwNgR5W.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-D114TNgO.js → typing-burst-detector-CWZPjxCH.js} +2 -2
- package/dist/public/assets/{uninstall-B7OIrc24.js → uninstall-DhJ_Rklh.js} +1 -1
- package/dist/public/assets/{use-activity-panel-DnpzFXIs.js → use-activity-panel-BkEUKYpF.js} +1 -1
- package/dist/public/assets/use-apply-config-color-theme-DA6djYET.js +1 -0
- package/dist/public/assets/{use-collab-url-CjkHphlr.js → use-collab-url-DCLqu1UG.js} +1 -1
- package/dist/public/assets/{use-live-xterm-theme-CVQrPooY.js → use-live-xterm-theme-Br4z4FVs.js} +1 -1
- package/dist/public/assets/{use-open-skill-DImLrKgY.js → use-open-skill-DqKBpu6s.js} +1 -1
- package/dist/public/assets/{use-popular-skills-Dj_DcxJ4.js → use-popular-skills-DUCqHl15.js} +1 -1
- package/dist/public/assets/{use-settings-route-DEoOHvHf.js → use-settings-route-C0dQSoJu.js} +1 -1
- package/dist/public/assets/{use-skill-origin-Bj3wYKq2.js → use-skill-origin-Dsa-uKgK.js} +1 -1
- package/dist/public/assets/{use-skills-k_NyqOb0.js → use-skills-CFPPlRb6.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-D2ShR7ZJ.js → use-terminal-enabled-B3TJxcey.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-CjhWQfrw.js → use-timeline-entry-diff-BNIl-plH.js} +4 -4
- package/dist/public/assets/{use-workspace-D0EhHpoU.js → use-workspace-ow-NJpFl.js} +1 -1
- package/dist/public/index.html +57 -54
- package/dist/public/uninstall.html +6 -6
- package/dist/{repair-launch-json-B74_k_CB.mjs → repair-launch-json-Cd_Vv1Ki.mjs} +2 -2
- package/dist/{repair-mcp-configs-DLcs5mOV.mjs → repair-mcp-configs-wnLWp4-Q.mjs} +2 -2
- package/dist/repair-skills-6sP48q4r.mjs +1 -0
- package/dist/{repair-skills-DUqnCrnn.mjs → repair-skills-B3DXhSuF.mjs} +2 -2
- package/dist/schemas/v0/config.user.schema.json +6 -33
- package/dist/{server-lock-V3bg8zL0.mjs → server-lock-BOsuOHaz.mjs} +2 -2
- package/dist/server-lock-SvEBQb4s.mjs +1 -0
- package/dist/{skill-teardown-BjKuJDgu.mjs → skill-teardown-DpitP3Vs.mjs} +2 -2
- package/dist/{sleep-DVOInM4H.mjs → sleep-Dj1Ck0gp.mjs} +6 -5
- package/dist/src-3pZWeowR.mjs +2032 -0
- package/dist/src-Bcg8O-xQ.mjs +1 -0
- package/dist/src-CO4cFiT1.mjs +1 -0
- package/dist/{src-IM6msWeV.mjs → src-DS92rBYx.mjs} +131 -131
- package/dist/{src-BtRlmozK.mjs → src-s5E_Y9Xd.mjs} +3 -3
- package/dist/{start-DMyot_xR.mjs → start-C5ud_ElN.mjs} +3 -3
- package/dist/start-gNbMBnlE.mjs +1 -0
- package/dist/{write-project-skill-CM5uu_kY.mjs → write-project-skill-BIyatqdb.mjs} +3 -3
- package/package.json +4 -4
- package/dist/constants-FqYgjf01.mjs +0 -2
- package/dist/fs-traced-DVpoNaQJ.mjs +0 -12
- package/dist/fs-traced-_QGcVmcb.mjs +0 -1
- package/dist/git-handle-B24ZRv9k.mjs +0 -1
- package/dist/init-BX4KzM5O.mjs +0 -1
- package/dist/loader-BJnkY5sq.mjs +0 -2
- package/dist/loader-sVkz35uc.mjs +0 -1
- package/dist/md-manager-DLcJdRDn.mjs +0 -2
- package/dist/preview-AblVr_fw.mjs +0 -1
- package/dist/public/assets/CodeMirrorPropInput-fWbdlCkS.js +0 -3
- package/dist/public/assets/FeedbackForm-BFd0ubqI.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-CLh5T0qS.js +0 -2
- package/dist/public/assets/ManagedArtifactProperties-Ct_XfVJo.js +0 -1
- package/dist/public/assets/SettingsDialogBody-LwuRFjnU.js +0 -12
- package/dist/public/assets/SourceEditor-CBToWgb8.js +0 -1
- package/dist/public/assets/ThreadView-YWeuTsL5.js +0 -10
- package/dist/public/assets/auth-state-cache-kFk2nWdi.js +0 -11
- package/dist/public/assets/config-provider-BkvKKK43.js +0 -5
- package/dist/public/assets/globals-B-lWUzDu.css +0 -1
- package/dist/public/assets/i18n-CC8DkJXO.js +0 -1
- package/dist/public/assets/index-DrqV8949.js +0 -2097
- package/dist/public/assets/messages-BNq0JS1I.js +0 -1
- package/dist/public/assets/messages-C1QZwdEx.js +0 -1
- package/dist/public/assets/messages-CAevTmZQ.js +0 -1
- package/dist/public/assets/messages-CG-GHBB9.js +0 -1
- package/dist/public/assets/messages-CIxg-v3C.js +0 -1
- package/dist/public/assets/messages-CKi8pZ4Q.js +0 -1
- package/dist/public/assets/messages-Cv5HHzZF.js +0 -1
- package/dist/public/assets/messages-DTRz3g9F.js +0 -1
- package/dist/public/assets/messages-DWBpIisU.js +0 -1
- package/dist/public/assets/messages-XzeH2iOB.js +0 -1
- package/dist/public/assets/messages-bBtIkGs7.js +0 -1
- package/dist/public/assets/navigation-targets-Ce74CisT.js +0 -1
- package/dist/public/assets/use-apply-config-color-theme-DLZre1dS.js +0 -1
- package/dist/repair-skills-CiQl2WaL.mjs +0 -1
- package/dist/server-lock-Dy_yO6Nk.mjs +0 -1
- package/dist/src-DJld4DjV.mjs +0 -2032
- package/dist/src-D_WOo8A_.mjs +0 -1
- package/dist/src-KzlEeO27.mjs +0 -1
- package/dist/start-jl_w5kPf.mjs +0 -1
- /package/dist/public/assets/{globals-CZJtsuL5.js → globals-B8Za6o5Q.js} +0 -0
|
@@ -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-RQ5o7P7w.js";import{a as ee,c as te,i as ne,n as re,o as ie,s as ae,t as oe}from"./dialog-Bxcn1sLm.js";import{n as s}from"./dist-Bkx5dDHT2.js";import{t as c}from"./desktop-bridge-types-oYPdTDmz.js";import{n as l,t as se}from"./git-branch-JnfmLuHd.js";import{t as u}from"./loader-circle-BJLNGSB4.js";import{n as ce,t as d}from"./miss-dialog-store-DKfFwAsF.js";import{r as f,t as p}from"./auth-prompt-store-CyiGTt3C.js";import{a as m,n as h}from"./receive-store-DO5w93VK.js";import{t as le}from"./share-metadata-rows-CBd7DuHz.js";var g=e(n(),1),ue=a();function de(e){let t=e.shareTargetExists,n=e.dirtyConflicts.conflicts,r=e.dirtyConflicts.files;return t&&!n?{kind:`A`,openCurrentEnabled:!0,switchEnabled:!0,conflictingFiles:r}:!t&&!n?{kind:`B`,openCurrentEnabled:!1,switchEnabled:!0,conflictingFiles:r}:t&&n?{kind:`C`,openCurrentEnabled:!0,switchEnabled:!1,conflictingFiles:r}:{kind:`D`,openCurrentEnabled:!1,switchEnabled:!1,conflictingFiles:r}}function fe(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function _(e){if(e.ok)return{action:`await-cc1`};switch(e.reason){case`dirty-conflict`:return{action:`rerender-conflict`,files:e.files??[]};case`branch-not-found`:return{action:`dismiss-with-toast`,reason:`branch-not-found`};case`fetch-failed`:case`checkout-failed`:return{action:`stay-with-toast`,reason:e.reason};case`branch-in-other-worktree`:{let t=e.otherWorktreePath;return t===void 0||t.length===0?{action:`stay-with-toast`,reason:`checkout-failed`}:{action:`pivot-to-other-worktree`,otherWorktreePath:t}}case`ff-diverged`:return{action:`branch-diverged`};default:{let t=e.reason;throw Error(`Unhandled CheckoutFailureReason: ${String(t)}`)}}}var pe={phase:`loading`};function me(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function he(e,t){return e.phase!==`ready`&&e.phase!==`verdict`?e:{phase:`switching`,info:e.info,pendingDoc:t}}function ge(e){return e.phase===`ready`?{phase:`creating-worktree`,info:e.info}:e}function _e(e){return de(e).kind===`B`&&e.shareTargetOnOriginBranch===!1}function ve(e){return e.phase===`ready`?{phase:`verdict-pending`,info:e.info}:e}function ye(e,t){if(e.phase!==`verdict-pending`)return e;if(t===null||t.verdict===`unknown`||t.verdict===`changed-locally`)return{phase:`ready`,info:e.info};let n=t.verdict===`renamed`?{kind:`renamed`,renamedTo:t.renamedTo}:{kind:t.verdict};return{phase:`verdict`,info:e.info,resolution:n}}function be(e,t){if(e.phase!==`switching`)return{state:e};if(t===null)return{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}};let n=_(t);return n.action===`await-cc1`?{state:{phase:`awaiting-cc1-recycle`,pendingDoc:e.pendingDoc}}:n.action===`rerender-conflict`?{state:{phase:`ready`,info:{...e.info,dirtyConflicts:{conflicts:!0,files:n.files.slice()}}}}:n.action===`pivot-to-other-worktree`?{state:{phase:`branch-in-other-worktree`,info:e.info,otherWorktreePath:n.otherWorktreePath,pendingDoc:e.pendingDoc}}:n.action===`dismiss-with-toast`?{state:{phase:`dismissed`,reason:n.reason},sideEffect:{kind:`toast`,reason:n.reason}}:n.action===`branch-diverged`?{state:{phase:`verdict`,info:e.info,resolution:{kind:`diverged`}}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:n.reason}}}function xe(e,t){return e.phase===`creating-worktree`?t===null?{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}}:t.ok?{state:{phase:`opening-worktree`,path:t.path}}:t.reason===`branch-not-found`?{state:{phase:`dismissed`,reason:`branch-not-found`},sideEffect:{kind:`toast`,reason:`branch-not-found`}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:t.reason,helper:t.helper,authFailed:t.reason===`fetch-failed`?t.authFailed:void 0}}:{state:e}}var v=t();function Se(e){return e!==null&&e.kind===`project-branch-switch`}function y(e){let t=(0,ue.c)(217),{bridge:n,store:a}=e,p=a===void 0?h:a,{_}=i(),y=(0,g.useSyncExternalStore)(p.subscribe,p.getSnapshot,Ae),[b,x]=(0,g.useState)(pe),je=(0,g.useRef)(!1),Me=(0,g.useRef)(!1),Ne=(0,g.useRef)(!1),Pe=(0,g.useRef)(null),Fe;t[0]===y?Fe=t[1]:(Fe=Se(y)?y:null,t[0]=y,t[1]=Fe);let S=Fe,Ie;t[2]!==_||t[3]!==S?.share.target.kind?(Ie=S?.share.target.kind===`folder`?_({id:`ugoTXs`}):_({id:`XH30C4`}),t[2]=_,t[3]=S?.share.target.kind,t[4]=Ie):Ie=t[4];let C=Ie,Le;t[5]===S?Le=t[6]:(Le=()=>{x(pe),je.current=!1,Me.current=!1,Ne.current=!1,Pe.current=S},t[5]=S,t[6]=Le);let Re;t[7]===y?Re=t[8]:(Re=[y],t[7]=y,t[8]=Re),(0,g.useEffect)(Le,Re);let ze;t[9]!==S||t[10]!==n?(ze=()=>{if(!S||je.current)return;je.current=!0;let e=!1;return n.project.fetchBranchInfo({projectPath:S.projectPath,branch:S.share.branch,kind:S.share.target.kind,path:c(S.share.target)}).then(t=>{e||x(e=>me(e,t))}).catch(t=>{e||(console.warn(`[receive] branch-info-fetch-failed`,t instanceof Error?t.message:t),x(ke))}),()=>{e=!0}},t[9]=S,t[10]=n,t[11]=ze):ze=t[11];let Be;t[12]===S?Be=t[13]:(Be=[S],t[12]=S,t[13]=Be),(0,g.useEffect)(ze,Be);let Ve;t[14]!==S||t[15]!==b.info||t[16]!==b.phase||t[17]!==n?(Ve=()=>{if(!S||b.phase!==`ready`||Ne.current||!_e(b.info))return;Ne.current=!0,x(ve);let e=S;n.project.fetchTargetStatus({projectPath:S.projectPath,branch:S.share.branch,kind:S.share.target.kind,path:c(S.share.target)}).then(t=>{Pe.current===e&&x(e=>ye(e,t))}).catch(t=>{Pe.current===e&&(console.warn(`[receive] target-status-fetch-failed`,t instanceof Error?t.message:t),x(Oe))})},t[14]=S,t[15]=b.info,t[16]=b.phase,t[17]=n,t[18]=Ve):Ve=t[18];let He;t[19]!==S||t[20]!==b.phase?(He=[b.phase,S],t[19]=S,t[20]=b.phase,t[21]=He):He=t[21],(0,g.useEffect)(Ve,He);let Ue;t[22]!==S||t[23]!==b.phase||t[24]!==b.resolution||t[25]!==p?(Ue=()=>{if(b.phase!==`verdict`)return;let{kind:e}=b.resolution;e!==`deleted`&&e!==`never-on-branch`||S&&(d.arm({kind:S.share.target.kind,path:c(S.share.target),branch:S.share.branch}),p.dismiss())},t[22]=S,t[23]=b.phase,t[24]=b.resolution,t[25]=p,t[26]=Ue):Ue=t[26];let We;t[27]!==S||t[28]!==b||t[29]!==p?(We=[b,S,p],t[27]=S,t[28]=b,t[29]=p,t[30]=We):We=t[30],(0,g.useEffect)(Ue,We);let Ge;t[31]!==b.phase||t[32]!==b.resolution?(Ge=()=>{b.phase===`verdict`&&console.log(m({verdict_cell:b.resolution.kind}))},t[31]=b.phase,t[32]=b.resolution,t[33]=Ge):Ge=t[33];let Ke;t[34]===b?Ke=t[35]:(Ke=[b],t[34]=b,t[35]=Ke),(0,g.useEffect)(Ge,Ke);let qe;t[36]!==_||t[37]!==S||t[38]!==b.pendingDoc||t[39]!==b.phase||t[40]!==n||t[41]!==p||t[42]!==C?(qe=()=>{if(b.phase!==`awaiting-cc1-recycle`||!S)return;let e=S.share.branch,t=b.pendingDoc;if(!e){p.dismiss();return}if(Me.current)return;Me.current=!0;let r=!1;return n.project.awaitBranchSwitched({projectPath:S.projectPath,branch:e,timeoutMs:3e4}).then(i=>{if(!r){if(i.ok){console.log(m({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:S.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:S.share.target.kind,path:t},pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),s.error(_({id:`gQV-9w`,values:{targetNoun:C}}))}),p.dismiss();return}console.log(m({branch_dialog_action:`branch-switch-timeout`,branch:e})),s.error(_({id:`LBwUR6`,values:{targetNoun:C}})),p.dismiss()}}).catch(e=>{r||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),s.error(_({id:`Jw6EC4`,values:{targetNoun:C}})),p.dismiss())}),()=>{r=!0}},t[36]=_,t[37]=S,t[38]=b.pendingDoc,t[39]=b.phase,t[40]=n,t[41]=p,t[42]=C,t[43]=qe):qe=t[43];let Je;if(t[44]!==S||t[45]!==b.phase?(Je=[b.phase,S],t[44]=S,t[45]=b.phase,t[46]=Je):Je=t[46],(0,g.useEffect)(qe,Je),!S)return null;let{share:w,projectPath:T,currentBranch:Ye}=S,E=w.branch,Xe;t[47]!==_||t[48]!==n.project||t[49]!==T||t[50]!==E||t[51]!==p?(Xe=function(e,t,r){console.log(m({branch_dialog_action:`switch`,branch_action:`switch`,branch:E,verdict_cell:r})),x(t=>he(t,e)),n.project.runCheckout(t?{projectPath:T,branch:E,fastForward:!0}:{projectPath:T,branch:E}).then(e=>{let t=null,n=!1;x(r=>{let{state:i,sideEffect:a}=be(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?s.error(_({id:`NJyQi_`,values:{shareBranch:E}})):t===`fetch-failed`?s.error(_({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&s.error(_({id:`c863eW`,values:{shareBranch:E}})),n&&p.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),x(De),s.error(_({id:`c863eW`,values:{shareBranch:E}}))})},t[47]=_,t[48]=n.project,t[49]=T,t[50]=E,t[51]=p,t[52]=Xe):Xe=t[52];let D=Xe,Ze;t[53]!==b.info||t[54]!==b.phase||t[55]!==D||t[56]!==w.target?(Ze=function(){b.phase===`ready`&&de(b.info).switchEnabled&&D(c(w.target),!1)},t[53]=b.info,t[54]=b.phase,t[55]=D,t[56]=w.target,t[57]=Ze):Ze=t[57];let Qe=Ze,$e;t[58]!==b.phase||t[59]!==b.resolution||t[60]!==D||t[61]!==w.target?($e=function(){b.phase===`verdict`&&D(c(w.target),!0,b.resolution.kind)},t[58]=b.phase,t[59]=b.resolution,t[60]=D,t[61]=w.target,t[62]=$e):$e=t[62];let et=$e,tt;t[63]!==b.phase||t[64]!==b.resolution||t[65]!==D?(tt=function(){b.phase===`verdict`&&b.resolution.kind===`renamed`&&D(b.resolution.renamedTo,!0,b.resolution.kind)},t[63]=b.phase,t[64]=b.resolution,t[65]=D,t[66]=tt):tt=t[66];let nt=tt,rt;t[67]!==b.phase||t[68]!==b.resolution||t[69]!==D||t[70]!==w.target?(rt=function(){b.phase===`verdict`&&D(c(w.target),!1,b.resolution.kind)},t[67]=b.phase,t[68]=b.resolution,t[69]=D,t[70]=w.target,t[71]=rt):rt=t[71];let it=rt,at;t[72]!==_||t[73]!==n.project||t[74]!==T||t[75]!==w.target||t[76]!==E||t[77]!==p||t[78]!==C?(at=function(){console.log(m({branch_dialog_action:`open-current`,branch:E})),n.project.open({path:T,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:w.target.kind,path:c(w.target)}}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),s.error(_({id:`b5aNbi`,values:{targetNoun:C}}))}),p.dismiss()},t[72]=_,t[73]=n.project,t[74]=T,t[75]=w.target,t[76]=E,t[77]=p,t[78]=C,t[79]=at):at=t[79];let ot=at,st;t[80]!==_||t[81]!==E?(st=function(e,t,n){if(e===`fetch-failed`&&n){s.error(_({id:`gfb-CM`}),{action:{label:_({id:`5lWFkC`}),onClick:Ee}});return}switch(e){case`helper-not-found`:{let e=t??_({id:`cHhH3i`});s.error(_({id:`Z7x_Zh`,values:{tool:e}}));return}case`branch-not-found`:s.error(_({id:`NJyQi_`,values:{shareBranch:E}}));return;case`fetch-failed`:s.error(_({id:`bWLmRK`}));return;case`already-checked-out`:s.error(_({id:`ljHjfg`}));return;case`branch-exists`:s.error(_({id:`h3QZcB`,values:{shareBranch:E}}));return;case`path-exists`:s.error(_({id:`cN1Gcp`,values:{shareBranch:E}}));return;case`no-git`:s.error(_({id:`CFnavk`}));return;case`invalid-branch`:s.error(_({id:`JfPuv7`,values:{shareBranch:E}}));return;case`proxy-null`:case`error`:s.error(_({id:`e8zYa8`,values:{shareBranch:E}}));return;default:throw Error(`Unhandled worktree failure reason: ${String(e)}`)}},t[80]=_,t[81]=E,t[82]=st):st=t[82];let ct=st,lt;t[83]!==_||t[84]!==n.project||t[85]!==w.target||t[86]!==E||t[87]!==ct||t[88]!==p?(lt=function(e){let t=null,r,i,a=!1,o=null;if(x(n=>{let{state:ee,sideEffect:te}=xe(n,e);return te&&(t=te.reason,r=te.helper,i=te.authFailed,a=ee.phase===`dismissed`),ee.phase===`opening-worktree`&&(o=ee.path),ee}),t!==null&&(console.log(m({branch_dialog_action:`open-worktree-failed:${t}`,branch:E})),ct(t,r,i)),o!==null){f();let e=o;n.project.open({path:e,target:`new-window`,entryPoint:`worktree`,pendingDeepLinkTarget:{kind:w.target.kind,path:c(w.target)},pendingBranch:E}).catch(t=>{console.warn(`[receive] worktree-open-failed branch_dialog_action=open-worktree`,t instanceof Error?t.message:t),s.error(_({id:`LdABLa`,values:{target:e}}))}),p.dismiss()}a&&p.dismiss()},t[83]=_,t[84]=n.project,t[85]=w.target,t[86]=E,t[87]=ct,t[88]=p,t[89]=lt):lt=t[89];let ut=lt,dt;t[90]!==ut||t[91]!==b.phase||t[92]!==n.worktree||t[93]!==E?(dt=function(){b.phase===`ready`&&(console.log(m({branch_dialog_action:`open-worktree`,branch:E})),x(ge),n.worktree.checkout({branch:E}).then(e=>{ut(e)}).catch(e=>{console.warn(`[receive] worktree-checkout rejected branch_dialog_action=open-worktree`,e instanceof Error?e.message:e),ut(null)}))},t[90]=ut,t[91]=b.phase,t[92]=n.worktree,t[93]=E,t[94]=dt):dt=t[94];let ft=dt,pt;t[95]!==_||t[96]!==b.otherWorktreePath||t[97]!==b.phase||t[98]!==n.project||t[99]!==w.target||t[100]!==E||t[101]!==p?(pt=function(){if(b.phase!==`branch-in-other-worktree`)return;let e=b.otherWorktreePath;console.log(m({branch_dialog_action:`pivot-to-other-worktree`,branch:E})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:w.target.kind,path:c(w.target)},pendingBranch:E}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),s.error(_({id:`LdABLa`,values:{target:e}}))}),p.dismiss()},t[95]=_,t[96]=b.otherWorktreePath,t[97]=b.phase,t[98]=n.project,t[99]=w.target,t[100]=E,t[101]=p,t[102]=pt):pt=t[102];let mt=pt,ht;t[103]!==b.phase||t[104]!==b.resolution||t[105]!==p?(ht=function(){console.log(m({branch_dialog_action:`cancel`,verdict_cell:b.phase===`verdict`?b.resolution.kind:void 0})),p.dismiss()},t[103]=b.phase,t[104]=b.resolution,t[105]=p,t[106]=ht):ht=t[106];let O=ht,k,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K,q;if(t[107]!==_||t[108]!==b.info||t[109]!==b.otherWorktreePath||t[110]!==b.phase||t[111]!==b.resolution||t[112]!==O||t[113]!==Ye||t[114]!==w.branch||t[115]!==w.owner||t[116]!==w.repo||t[117]!==w.target||t[118]!==E||t[119]!==C){K=b.phase===`ready`||b.phase===`switching`||b.phase===`creating-worktree`?de(b.info):null;let e;t[139]!==b.info||t[140]!==b.phase||t[141]!==Ye?(e=b.phase===`ready`||b.phase===`switching`||b.phase===`creating-worktree`?fe(b.info):Ye??`HEAD`,t[139]=b.info,t[140]=b.phase,t[141]=Ye,t[142]=e):e=t[142];let n=e;F=b.phase===`switching`||b.phase===`awaiting-cc1-recycle`,M=b.phase===`creating-worktree`;let i;t[143]===_?i=t[144]:(i=_({id:`OuY8t9`}),t[143]=_,t[144]=i),N=i;let a;t[145]===_?a=t[146]:(a=_({id:`XZkdtg`}),t[145]=_,t[146]=a),P=a;let o;t[147]===_?o=t[148]:(o=_({id:`VTulZj`}),t[147]=_,t[148]=o),q=o;let ie=b.phase===`loading`,s=b.phase===`error`;j=oe,W=!0,t[149]===O?G=t[150]:(G=e=>{e||O()},t[149]=O,t[150]=G),A=ne,z=`sm:max-w-xl`,B=`share-branch-switch-dialog`,V=Te,H=we;let l;t[151]===C?l=t[152]:(l=(0,v.jsx)(te,{children:(0,v.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:C}})}),t[151]=C,t[152]=l);let se=w.owner,ce=w.repo,d;t[153]===w.target?d=t[154]:(d=c(w.target),t[153]=w.target,t[154]=d);let f;t[155]!==w.owner||t[156]!==w.repo||t[157]!==d?(f=(0,v.jsx)(ee,{className:`sr-only`,children:(0,v.jsx)(r,{id:`f8jU-L`,values:{0:se,1:ce,2:d}})}),t[155]=w.owner,t[156]=w.repo,t[157]=d,t[158]=f):f=t[158],t[159]!==l||t[160]!==f?(U=(0,v.jsxs)(ae,{children:[l,f]}),t[159]=l,t[160]=f,t[161]=U):U=t[161],k=re;let p=w.owner,m=w.repo,h;t[162]===w.target?h=t[163]:(h=c(w.target),t[162]=w.target,t[163]=h),t[164]!==w.branch||t[165]!==w.owner||t[166]!==w.repo||t[167]!==w.target.kind||t[168]!==h?(I=(0,v.jsx)(`div`,{className:`mb-4`,children:(0,v.jsx)(le,{owner:p,repo:m,path:h,kind:w.target.kind,branch:w.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[164]=w.branch,t[165]=w.owner,t[166]=w.repo,t[167]=w.target.kind,t[168]=h,t[169]=I):I=t[169],L=b.phase===`branch-in-other-worktree`?(0,v.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,v.jsx)(`p`,{className:`leading-6`,children:(0,v.jsx)(r,{id:`yjExfe`,values:{shareBranch:E},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,v.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:b.otherWorktreePath})]}):b.phase===`verdict-pending`?(0,v.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-pending`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`c8jBgX`})]}):b.phase===`verdict`?b.resolution.kind===`on-origin`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-on-origin`,children:(0,v.jsx)(r,{id:`Uay5NL`,values:{targetNoun:C,shareBranch:E},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):b.resolution.kind===`renamed`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-renamed`,children:(0,v.jsx)(r,{id:`P0HC30`,values:{0:b.resolution.renamedTo,targetNoun:C},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):b.resolution.kind===`diverged`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-diverged`,children:(0,v.jsx)(r,{id:`kLv8d3`,values:{shareBranch:E,targetNoun:C},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,v.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-handoff`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`c8jBgX`})]}):ie?(0,v.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-loading`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`jerqF0`})]}):s?(0,v.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,v.jsx)(r,{id:`w4hMYl`})}):K?.kind===`D`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,v.jsx)(r,{id:`DTI-fp`,values:{targetNoun:C,shareBranch:E},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):K?.kind===`B`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,v.jsx)(r,{id:`sZ2IOu`,values:{targetNoun:C,shareBranch:E,currentLabel:n},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,v.jsx)(r,{id:`_902BE`,values:{targetNoun:C,shareBranch:E,currentLabel:n},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),R=K&&!K.switchEnabled&&K.conflictingFiles.length>0?(0,v.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm`,"data-testid":`share-branch-switch-conflict`,children:[(0,v.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,v.jsx)(r,{id:`n2lRue`})}),(0,v.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:K.conflictingFiles.map(Ce)})]}):null,t[107]=_,t[108]=b.info,t[109]=b.otherWorktreePath,t[110]=b.phase,t[111]=b.resolution,t[112]=O,t[113]=Ye,t[114]=w.branch,t[115]=w.owner,t[116]=w.repo,t[117]=w.target,t[118]=E,t[119]=C,t[120]=k,t[121]=A,t[122]=j,t[123]=M,t[124]=N,t[125]=P,t[126]=F,t[127]=I,t[128]=L,t[129]=R,t[130]=z,t[131]=B,t[132]=V,t[133]=H,t[134]=U,t[135]=W,t[136]=G,t[137]=K,t[138]=q}else k=t[120],A=t[121],j=t[122],M=t[123],N=t[124],P=t[125],F=t[126],I=t[127],L=t[128],R=t[129],z=t[130],B=t[131],V=t[132],H=t[133],U=t[134],W=t[135],G=t[136],K=t[137],q=t[138];let J;t[170]===F?J=t[171]:(J=F?(0,v.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-switching`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`CU3AiE`})]}):null,t[170]=F,t[171]=J);let Y;t[172]===M?Y=t[173]:(Y=M?(0,v.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-creating-worktree`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`PZtgO0`})]}):null,t[172]=M,t[173]=Y);let X;t[174]!==k||t[175]!==I||t[176]!==L||t[177]!==R||t[178]!==J||t[179]!==Y?(X=(0,v.jsxs)(k,{children:[I,L,R,J,Y]}),t[174]=k,t[175]=I,t[176]=L,t[177]=R,t[178]=J,t[179]=Y,t[180]=X):X=t[180];let gt;t[181]===Symbol.for(`react.memo_cache_sentinel`)?(gt=(0,v.jsx)(r,{id:`dEgA5A`}),t[181]=gt):gt=t[181];let Z;t[182]===O?Z=t[183]:(Z=(0,v.jsx)(o,{variant:`ghost`,className:`font-mono uppercase`,onClick:O,"data-testid":`share-branch-switch-cancel`,children:gt}),t[182]=O,t[183]=Z);let Q;t[184]!==b.phase||t[185]!==b.resolution||t[186]!==M||t[187]!==ot||t[188]!==nt||t[189]!==ft||t[190]!==mt||t[191]!==it||t[192]!==Qe||t[193]!==et||t[194]!==N||t[195]!==P||t[196]!==F||t[197]!==K||t[198]!==q?(Q=b.phase===`branch-in-other-worktree`?(0,v.jsx)(o,{onClick:mt,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,v.jsx)(r,{id:`hyCxJY`})}):b.phase===`verdict`?b.resolution.kind===`on-origin`?(0,v.jsxs)(o,{onClick:et,"data-testid":`share-branch-switch-verdict-switch-update`,children:[(0,v.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),(0,v.jsx)(r,{id:`uA_jXp`})]}):b.resolution.kind===`renamed`?(0,v.jsxs)(o,{onClick:nt,"data-testid":`share-branch-switch-verdict-open-renamed`,children:[(0,v.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),(0,v.jsx)(r,{id:`AItsE5`})]}):b.resolution.kind===`diverged`?(0,v.jsxs)(o,{onClick:it,"data-testid":`share-branch-switch-verdict-plain-switch`,children:[(0,v.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),P]}):null:(0,v.jsxs)(`div`,{className:`flex min-w-0 flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:justify-end sm:gap-2`,children:[K?.openCurrentEnabled?(0,v.jsxs)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:ot,disabled:F||M,"data-testid":`share-branch-switch-open-current`,children:[(0,v.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),N]}):null,(0,v.jsx)(o,{variant:`outline`,onClick:Qe,disabled:!K?.switchEnabled||F||M,"aria-disabled":!K?.switchEnabled||F||M,"aria-describedby":K&&!K.switchEnabled&&K.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:F?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(u,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),P]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),P]})}),(0,v.jsx)(o,{onClick:ft,disabled:!K||F||M,"data-testid":`share-branch-switch-worktree`,children:M?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(u,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),q]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),q]})})]}),t[184]=b.phase,t[185]=b.resolution,t[186]=M,t[187]=ot,t[188]=nt,t[189]=ft,t[190]=mt,t[191]=it,t[192]=Qe,t[193]=et,t[194]=N,t[195]=P,t[196]=F,t[197]=K,t[198]=q,t[199]=Q):Q=t[199];let _t;t[200]!==Z||t[201]!==Q?(_t=(0,v.jsxs)(ie,{className:`sm:justify-between`,children:[Z,Q]}),t[200]=Z,t[201]=Q,t[202]=_t):_t=t[202];let $;t[203]!==A||t[204]!==z||t[205]!==B||t[206]!==V||t[207]!==H||t[208]!==U||t[209]!==X||t[210]!==_t?($=(0,v.jsxs)(A,{className:z,"data-testid":B,onInteractOutside:V,onPointerDownOutside:H,children:[U,X,_t]}),t[203]=A,t[204]=z,t[205]=B,t[206]=V,t[207]=H,t[208]=U,t[209]=X,t[210]=_t,t[211]=$):$=t[211];let vt;return t[212]!==j||t[213]!==W||t[214]!==G||t[215]!==$?(vt=(0,v.jsx)(j,{open:W,onOpenChange:G,children:$}),t[212]=j,t[213]=W,t[214]=G,t[215]=$,t[216]=vt):vt=t[216],vt}function Ce(e){return(0,v.jsx)(`li`,{children:(0,v.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function we(e){e.preventDefault()}function Te(e){e.preventDefault()}function Ee(){return p.request()}function De(e){return be(e,null).state}function Oe(e){return ye(e,null)}function ke(e){return me(e,null)}function Ae(){return null}export{y as ShareBranchSwitchDialog};
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-RQ5o7P7w.js";import{a as ee,c as te,i as ne,n as re,o as ie,s as ae,t as oe}from"./dialog-Bxcn1sLm.js";import{n as s}from"./dist-Bkx5dDHT2.js";import{t as c}from"./desktop-bridge-types-oYPdTDmz.js";import{n as l,t as se}from"./git-branch-JnfmLuHd.js";import{t as u}from"./loader-circle-BJLNGSB4.js";import{n as ce,t as d}from"./miss-dialog-store-DKfFwAsF.js";import{r as f,t as p}from"./auth-prompt-store-CyiGTt3C.js";import{a as m,n as h}from"./receive-store-CbFpknqD.js";import{t as le}from"./share-metadata-rows-CBd7DuHz.js";var g=e(n(),1),ue=a();function de(e){let t=e.shareTargetExists,n=e.dirtyConflicts.conflicts,r=e.dirtyConflicts.files;return t&&!n?{kind:`A`,openCurrentEnabled:!0,switchEnabled:!0,conflictingFiles:r}:!t&&!n?{kind:`B`,openCurrentEnabled:!1,switchEnabled:!0,conflictingFiles:r}:t&&n?{kind:`C`,openCurrentEnabled:!0,switchEnabled:!1,conflictingFiles:r}:{kind:`D`,openCurrentEnabled:!1,switchEnabled:!1,conflictingFiles:r}}function fe(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function _(e){if(e.ok)return{action:`await-cc1`};switch(e.reason){case`dirty-conflict`:return{action:`rerender-conflict`,files:e.files??[]};case`branch-not-found`:return{action:`dismiss-with-toast`,reason:`branch-not-found`};case`fetch-failed`:case`checkout-failed`:return{action:`stay-with-toast`,reason:e.reason};case`branch-in-other-worktree`:{let t=e.otherWorktreePath;return t===void 0||t.length===0?{action:`stay-with-toast`,reason:`checkout-failed`}:{action:`pivot-to-other-worktree`,otherWorktreePath:t}}case`ff-diverged`:return{action:`branch-diverged`};default:{let t=e.reason;throw Error(`Unhandled CheckoutFailureReason: ${String(t)}`)}}}var pe={phase:`loading`};function me(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function he(e,t){return e.phase!==`ready`&&e.phase!==`verdict`?e:{phase:`switching`,info:e.info,pendingDoc:t}}function ge(e){return e.phase===`ready`?{phase:`creating-worktree`,info:e.info}:e}function _e(e){return de(e).kind===`B`&&e.shareTargetOnOriginBranch===!1}function ve(e){return e.phase===`ready`?{phase:`verdict-pending`,info:e.info}:e}function ye(e,t){if(e.phase!==`verdict-pending`)return e;if(t===null||t.verdict===`unknown`||t.verdict===`changed-locally`)return{phase:`ready`,info:e.info};let n=t.verdict===`renamed`?{kind:`renamed`,renamedTo:t.renamedTo}:{kind:t.verdict};return{phase:`verdict`,info:e.info,resolution:n}}function be(e,t){if(e.phase!==`switching`)return{state:e};if(t===null)return{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}};let n=_(t);return n.action===`await-cc1`?{state:{phase:`awaiting-cc1-recycle`,pendingDoc:e.pendingDoc}}:n.action===`rerender-conflict`?{state:{phase:`ready`,info:{...e.info,dirtyConflicts:{conflicts:!0,files:n.files.slice()}}}}:n.action===`pivot-to-other-worktree`?{state:{phase:`branch-in-other-worktree`,info:e.info,otherWorktreePath:n.otherWorktreePath,pendingDoc:e.pendingDoc}}:n.action===`dismiss-with-toast`?{state:{phase:`dismissed`,reason:n.reason},sideEffect:{kind:`toast`,reason:n.reason}}:n.action===`branch-diverged`?{state:{phase:`verdict`,info:e.info,resolution:{kind:`diverged`}}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:n.reason}}}function xe(e,t){return e.phase===`creating-worktree`?t===null?{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}}:t.ok?{state:{phase:`opening-worktree`,path:t.path}}:t.reason===`branch-not-found`?{state:{phase:`dismissed`,reason:`branch-not-found`},sideEffect:{kind:`toast`,reason:`branch-not-found`}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:t.reason,helper:t.helper,authFailed:t.reason===`fetch-failed`?t.authFailed:void 0}}:{state:e}}var v=t();function Se(e){return e!==null&&e.kind===`project-branch-switch`}function y(e){let t=(0,ue.c)(217),{bridge:n,store:a}=e,p=a===void 0?h:a,{_}=i(),y=(0,g.useSyncExternalStore)(p.subscribe,p.getSnapshot,Ae),[b,x]=(0,g.useState)(pe),je=(0,g.useRef)(!1),Me=(0,g.useRef)(!1),Ne=(0,g.useRef)(!1),Pe=(0,g.useRef)(null),Fe;t[0]===y?Fe=t[1]:(Fe=Se(y)?y:null,t[0]=y,t[1]=Fe);let S=Fe,Ie;t[2]!==_||t[3]!==S?.share.target.kind?(Ie=S?.share.target.kind===`folder`?_({id:`ugoTXs`}):_({id:`XH30C4`}),t[2]=_,t[3]=S?.share.target.kind,t[4]=Ie):Ie=t[4];let C=Ie,Le;t[5]===S?Le=t[6]:(Le=()=>{x(pe),je.current=!1,Me.current=!1,Ne.current=!1,Pe.current=S},t[5]=S,t[6]=Le);let Re;t[7]===y?Re=t[8]:(Re=[y],t[7]=y,t[8]=Re),(0,g.useEffect)(Le,Re);let ze;t[9]!==S||t[10]!==n?(ze=()=>{if(!S||je.current)return;je.current=!0;let e=!1;return n.project.fetchBranchInfo({projectPath:S.projectPath,branch:S.share.branch,kind:S.share.target.kind,path:c(S.share.target)}).then(t=>{e||x(e=>me(e,t))}).catch(t=>{e||(console.warn(`[receive] branch-info-fetch-failed`,t instanceof Error?t.message:t),x(ke))}),()=>{e=!0}},t[9]=S,t[10]=n,t[11]=ze):ze=t[11];let Be;t[12]===S?Be=t[13]:(Be=[S],t[12]=S,t[13]=Be),(0,g.useEffect)(ze,Be);let Ve;t[14]!==S||t[15]!==b.info||t[16]!==b.phase||t[17]!==n?(Ve=()=>{if(!S||b.phase!==`ready`||Ne.current||!_e(b.info))return;Ne.current=!0,x(ve);let e=S;n.project.fetchTargetStatus({projectPath:S.projectPath,branch:S.share.branch,kind:S.share.target.kind,path:c(S.share.target)}).then(t=>{Pe.current===e&&x(e=>ye(e,t))}).catch(t=>{Pe.current===e&&(console.warn(`[receive] target-status-fetch-failed`,t instanceof Error?t.message:t),x(Oe))})},t[14]=S,t[15]=b.info,t[16]=b.phase,t[17]=n,t[18]=Ve):Ve=t[18];let He;t[19]!==S||t[20]!==b.phase?(He=[b.phase,S],t[19]=S,t[20]=b.phase,t[21]=He):He=t[21],(0,g.useEffect)(Ve,He);let Ue;t[22]!==S||t[23]!==b.phase||t[24]!==b.resolution||t[25]!==p?(Ue=()=>{if(b.phase!==`verdict`)return;let{kind:e}=b.resolution;e!==`deleted`&&e!==`never-on-branch`||S&&(d.arm({kind:S.share.target.kind,path:c(S.share.target),branch:S.share.branch}),p.dismiss())},t[22]=S,t[23]=b.phase,t[24]=b.resolution,t[25]=p,t[26]=Ue):Ue=t[26];let We;t[27]!==S||t[28]!==b||t[29]!==p?(We=[b,S,p],t[27]=S,t[28]=b,t[29]=p,t[30]=We):We=t[30],(0,g.useEffect)(Ue,We);let Ge;t[31]!==b.phase||t[32]!==b.resolution?(Ge=()=>{b.phase===`verdict`&&console.log(m({verdict_cell:b.resolution.kind}))},t[31]=b.phase,t[32]=b.resolution,t[33]=Ge):Ge=t[33];let Ke;t[34]===b?Ke=t[35]:(Ke=[b],t[34]=b,t[35]=Ke),(0,g.useEffect)(Ge,Ke);let qe;t[36]!==_||t[37]!==S||t[38]!==b.pendingDoc||t[39]!==b.phase||t[40]!==n||t[41]!==p||t[42]!==C?(qe=()=>{if(b.phase!==`awaiting-cc1-recycle`||!S)return;let e=S.share.branch,t=b.pendingDoc;if(!e){p.dismiss();return}if(Me.current)return;Me.current=!0;let r=!1;return n.project.awaitBranchSwitched({projectPath:S.projectPath,branch:e,timeoutMs:3e4}).then(i=>{if(!r){if(i.ok){console.log(m({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:S.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:S.share.target.kind,path:t},pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),s.error(_({id:`gQV-9w`,values:{targetNoun:C}}))}),p.dismiss();return}console.log(m({branch_dialog_action:`branch-switch-timeout`,branch:e})),s.error(_({id:`LBwUR6`,values:{targetNoun:C}})),p.dismiss()}}).catch(e=>{r||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),s.error(_({id:`Jw6EC4`,values:{targetNoun:C}})),p.dismiss())}),()=>{r=!0}},t[36]=_,t[37]=S,t[38]=b.pendingDoc,t[39]=b.phase,t[40]=n,t[41]=p,t[42]=C,t[43]=qe):qe=t[43];let Je;if(t[44]!==S||t[45]!==b.phase?(Je=[b.phase,S],t[44]=S,t[45]=b.phase,t[46]=Je):Je=t[46],(0,g.useEffect)(qe,Je),!S)return null;let{share:w,projectPath:T,currentBranch:Ye}=S,E=w.branch,Xe;t[47]!==_||t[48]!==n.project||t[49]!==T||t[50]!==E||t[51]!==p?(Xe=function(e,t,r){console.log(m({branch_dialog_action:`switch`,branch_action:`switch`,branch:E,verdict_cell:r})),x(t=>he(t,e)),n.project.runCheckout(t?{projectPath:T,branch:E,fastForward:!0}:{projectPath:T,branch:E}).then(e=>{let t=null,n=!1;x(r=>{let{state:i,sideEffect:a}=be(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?s.error(_({id:`NJyQi_`,values:{shareBranch:E}})):t===`fetch-failed`?s.error(_({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&s.error(_({id:`c863eW`,values:{shareBranch:E}})),n&&p.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),x(De),s.error(_({id:`c863eW`,values:{shareBranch:E}}))})},t[47]=_,t[48]=n.project,t[49]=T,t[50]=E,t[51]=p,t[52]=Xe):Xe=t[52];let D=Xe,Ze;t[53]!==b.info||t[54]!==b.phase||t[55]!==D||t[56]!==w.target?(Ze=function(){b.phase===`ready`&&de(b.info).switchEnabled&&D(c(w.target),!1)},t[53]=b.info,t[54]=b.phase,t[55]=D,t[56]=w.target,t[57]=Ze):Ze=t[57];let Qe=Ze,$e;t[58]!==b.phase||t[59]!==b.resolution||t[60]!==D||t[61]!==w.target?($e=function(){b.phase===`verdict`&&D(c(w.target),!0,b.resolution.kind)},t[58]=b.phase,t[59]=b.resolution,t[60]=D,t[61]=w.target,t[62]=$e):$e=t[62];let et=$e,tt;t[63]!==b.phase||t[64]!==b.resolution||t[65]!==D?(tt=function(){b.phase===`verdict`&&b.resolution.kind===`renamed`&&D(b.resolution.renamedTo,!0,b.resolution.kind)},t[63]=b.phase,t[64]=b.resolution,t[65]=D,t[66]=tt):tt=t[66];let nt=tt,rt;t[67]!==b.phase||t[68]!==b.resolution||t[69]!==D||t[70]!==w.target?(rt=function(){b.phase===`verdict`&&D(c(w.target),!1,b.resolution.kind)},t[67]=b.phase,t[68]=b.resolution,t[69]=D,t[70]=w.target,t[71]=rt):rt=t[71];let it=rt,at;t[72]!==_||t[73]!==n.project||t[74]!==T||t[75]!==w.target||t[76]!==E||t[77]!==p||t[78]!==C?(at=function(){console.log(m({branch_dialog_action:`open-current`,branch:E})),n.project.open({path:T,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:w.target.kind,path:c(w.target)}}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),s.error(_({id:`b5aNbi`,values:{targetNoun:C}}))}),p.dismiss()},t[72]=_,t[73]=n.project,t[74]=T,t[75]=w.target,t[76]=E,t[77]=p,t[78]=C,t[79]=at):at=t[79];let ot=at,st;t[80]!==_||t[81]!==E?(st=function(e,t,n){if(e===`fetch-failed`&&n){s.error(_({id:`gfb-CM`}),{action:{label:_({id:`5lWFkC`}),onClick:Ee}});return}switch(e){case`helper-not-found`:{let e=t??_({id:`cHhH3i`});s.error(_({id:`Z7x_Zh`,values:{tool:e}}));return}case`branch-not-found`:s.error(_({id:`NJyQi_`,values:{shareBranch:E}}));return;case`fetch-failed`:s.error(_({id:`bWLmRK`}));return;case`already-checked-out`:s.error(_({id:`ljHjfg`}));return;case`branch-exists`:s.error(_({id:`h3QZcB`,values:{shareBranch:E}}));return;case`path-exists`:s.error(_({id:`cN1Gcp`,values:{shareBranch:E}}));return;case`no-git`:s.error(_({id:`CFnavk`}));return;case`invalid-branch`:s.error(_({id:`JfPuv7`,values:{shareBranch:E}}));return;case`proxy-null`:case`error`:s.error(_({id:`e8zYa8`,values:{shareBranch:E}}));return;default:throw Error(`Unhandled worktree failure reason: ${String(e)}`)}},t[80]=_,t[81]=E,t[82]=st):st=t[82];let ct=st,lt;t[83]!==_||t[84]!==n.project||t[85]!==w.target||t[86]!==E||t[87]!==ct||t[88]!==p?(lt=function(e){let t=null,r,i,a=!1,o=null;if(x(n=>{let{state:ee,sideEffect:te}=xe(n,e);return te&&(t=te.reason,r=te.helper,i=te.authFailed,a=ee.phase===`dismissed`),ee.phase===`opening-worktree`&&(o=ee.path),ee}),t!==null&&(console.log(m({branch_dialog_action:`open-worktree-failed:${t}`,branch:E})),ct(t,r,i)),o!==null){f();let e=o;n.project.open({path:e,target:`new-window`,entryPoint:`worktree`,pendingDeepLinkTarget:{kind:w.target.kind,path:c(w.target)},pendingBranch:E}).catch(t=>{console.warn(`[receive] worktree-open-failed branch_dialog_action=open-worktree`,t instanceof Error?t.message:t),s.error(_({id:`LdABLa`,values:{target:e}}))}),p.dismiss()}a&&p.dismiss()},t[83]=_,t[84]=n.project,t[85]=w.target,t[86]=E,t[87]=ct,t[88]=p,t[89]=lt):lt=t[89];let ut=lt,dt;t[90]!==ut||t[91]!==b.phase||t[92]!==n.worktree||t[93]!==E?(dt=function(){b.phase===`ready`&&(console.log(m({branch_dialog_action:`open-worktree`,branch:E})),x(ge),n.worktree.checkout({branch:E}).then(e=>{ut(e)}).catch(e=>{console.warn(`[receive] worktree-checkout rejected branch_dialog_action=open-worktree`,e instanceof Error?e.message:e),ut(null)}))},t[90]=ut,t[91]=b.phase,t[92]=n.worktree,t[93]=E,t[94]=dt):dt=t[94];let ft=dt,pt;t[95]!==_||t[96]!==b.otherWorktreePath||t[97]!==b.phase||t[98]!==n.project||t[99]!==w.target||t[100]!==E||t[101]!==p?(pt=function(){if(b.phase!==`branch-in-other-worktree`)return;let e=b.otherWorktreePath;console.log(m({branch_dialog_action:`pivot-to-other-worktree`,branch:E})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:w.target.kind,path:c(w.target)},pendingBranch:E}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),s.error(_({id:`LdABLa`,values:{target:e}}))}),p.dismiss()},t[95]=_,t[96]=b.otherWorktreePath,t[97]=b.phase,t[98]=n.project,t[99]=w.target,t[100]=E,t[101]=p,t[102]=pt):pt=t[102];let mt=pt,ht;t[103]!==b.phase||t[104]!==b.resolution||t[105]!==p?(ht=function(){console.log(m({branch_dialog_action:`cancel`,verdict_cell:b.phase===`verdict`?b.resolution.kind:void 0})),p.dismiss()},t[103]=b.phase,t[104]=b.resolution,t[105]=p,t[106]=ht):ht=t[106];let O=ht,k,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K,q;if(t[107]!==_||t[108]!==b.info||t[109]!==b.otherWorktreePath||t[110]!==b.phase||t[111]!==b.resolution||t[112]!==O||t[113]!==Ye||t[114]!==w.branch||t[115]!==w.owner||t[116]!==w.repo||t[117]!==w.target||t[118]!==E||t[119]!==C){K=b.phase===`ready`||b.phase===`switching`||b.phase===`creating-worktree`?de(b.info):null;let e;t[139]!==b.info||t[140]!==b.phase||t[141]!==Ye?(e=b.phase===`ready`||b.phase===`switching`||b.phase===`creating-worktree`?fe(b.info):Ye??`HEAD`,t[139]=b.info,t[140]=b.phase,t[141]=Ye,t[142]=e):e=t[142];let n=e;F=b.phase===`switching`||b.phase===`awaiting-cc1-recycle`,M=b.phase===`creating-worktree`;let i;t[143]===_?i=t[144]:(i=_({id:`OuY8t9`}),t[143]=_,t[144]=i),N=i;let a;t[145]===_?a=t[146]:(a=_({id:`XZkdtg`}),t[145]=_,t[146]=a),P=a;let o;t[147]===_?o=t[148]:(o=_({id:`VTulZj`}),t[147]=_,t[148]=o),q=o;let ie=b.phase===`loading`,s=b.phase===`error`;j=oe,W=!0,t[149]===O?G=t[150]:(G=e=>{e||O()},t[149]=O,t[150]=G),A=ne,z=`sm:max-w-xl`,B=`share-branch-switch-dialog`,V=Te,H=we;let l;t[151]===C?l=t[152]:(l=(0,v.jsx)(te,{children:(0,v.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:C}})}),t[151]=C,t[152]=l);let se=w.owner,ce=w.repo,d;t[153]===w.target?d=t[154]:(d=c(w.target),t[153]=w.target,t[154]=d);let f;t[155]!==w.owner||t[156]!==w.repo||t[157]!==d?(f=(0,v.jsx)(ee,{className:`sr-only`,children:(0,v.jsx)(r,{id:`f8jU-L`,values:{0:se,1:ce,2:d}})}),t[155]=w.owner,t[156]=w.repo,t[157]=d,t[158]=f):f=t[158],t[159]!==l||t[160]!==f?(U=(0,v.jsxs)(ae,{children:[l,f]}),t[159]=l,t[160]=f,t[161]=U):U=t[161],k=re;let p=w.owner,m=w.repo,h;t[162]===w.target?h=t[163]:(h=c(w.target),t[162]=w.target,t[163]=h),t[164]!==w.branch||t[165]!==w.owner||t[166]!==w.repo||t[167]!==w.target.kind||t[168]!==h?(I=(0,v.jsx)(`div`,{className:`mb-4`,children:(0,v.jsx)(le,{owner:p,repo:m,path:h,kind:w.target.kind,branch:w.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[164]=w.branch,t[165]=w.owner,t[166]=w.repo,t[167]=w.target.kind,t[168]=h,t[169]=I):I=t[169],L=b.phase===`branch-in-other-worktree`?(0,v.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,v.jsx)(`p`,{className:`leading-6`,children:(0,v.jsx)(r,{id:`yjExfe`,values:{shareBranch:E},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,v.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:b.otherWorktreePath})]}):b.phase===`verdict-pending`?(0,v.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-pending`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`c8jBgX`})]}):b.phase===`verdict`?b.resolution.kind===`on-origin`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-on-origin`,children:(0,v.jsx)(r,{id:`Uay5NL`,values:{targetNoun:C,shareBranch:E},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):b.resolution.kind===`renamed`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-renamed`,children:(0,v.jsx)(r,{id:`P0HC30`,values:{0:b.resolution.renamedTo,targetNoun:C},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):b.resolution.kind===`diverged`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-diverged`,children:(0,v.jsx)(r,{id:`kLv8d3`,values:{shareBranch:E,targetNoun:C},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,v.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-handoff`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`c8jBgX`})]}):ie?(0,v.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-loading`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`jerqF0`})]}):s?(0,v.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,v.jsx)(r,{id:`w4hMYl`})}):K?.kind===`D`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,v.jsx)(r,{id:`DTI-fp`,values:{targetNoun:C,shareBranch:E},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):K?.kind===`B`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,v.jsx)(r,{id:`sZ2IOu`,values:{targetNoun:C,shareBranch:E,currentLabel:n},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,v.jsx)(r,{id:`_902BE`,values:{targetNoun:C,shareBranch:E,currentLabel:n},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),R=K&&!K.switchEnabled&&K.conflictingFiles.length>0?(0,v.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm`,"data-testid":`share-branch-switch-conflict`,children:[(0,v.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,v.jsx)(r,{id:`n2lRue`})}),(0,v.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:K.conflictingFiles.map(Ce)})]}):null,t[107]=_,t[108]=b.info,t[109]=b.otherWorktreePath,t[110]=b.phase,t[111]=b.resolution,t[112]=O,t[113]=Ye,t[114]=w.branch,t[115]=w.owner,t[116]=w.repo,t[117]=w.target,t[118]=E,t[119]=C,t[120]=k,t[121]=A,t[122]=j,t[123]=M,t[124]=N,t[125]=P,t[126]=F,t[127]=I,t[128]=L,t[129]=R,t[130]=z,t[131]=B,t[132]=V,t[133]=H,t[134]=U,t[135]=W,t[136]=G,t[137]=K,t[138]=q}else k=t[120],A=t[121],j=t[122],M=t[123],N=t[124],P=t[125],F=t[126],I=t[127],L=t[128],R=t[129],z=t[130],B=t[131],V=t[132],H=t[133],U=t[134],W=t[135],G=t[136],K=t[137],q=t[138];let J;t[170]===F?J=t[171]:(J=F?(0,v.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-switching`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`CU3AiE`})]}):null,t[170]=F,t[171]=J);let Y;t[172]===M?Y=t[173]:(Y=M?(0,v.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-creating-worktree`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`PZtgO0`})]}):null,t[172]=M,t[173]=Y);let X;t[174]!==k||t[175]!==I||t[176]!==L||t[177]!==R||t[178]!==J||t[179]!==Y?(X=(0,v.jsxs)(k,{children:[I,L,R,J,Y]}),t[174]=k,t[175]=I,t[176]=L,t[177]=R,t[178]=J,t[179]=Y,t[180]=X):X=t[180];let gt;t[181]===Symbol.for(`react.memo_cache_sentinel`)?(gt=(0,v.jsx)(r,{id:`dEgA5A`}),t[181]=gt):gt=t[181];let Z;t[182]===O?Z=t[183]:(Z=(0,v.jsx)(o,{variant:`ghost`,className:`font-mono uppercase`,onClick:O,"data-testid":`share-branch-switch-cancel`,children:gt}),t[182]=O,t[183]=Z);let Q;t[184]!==b.phase||t[185]!==b.resolution||t[186]!==M||t[187]!==ot||t[188]!==nt||t[189]!==ft||t[190]!==mt||t[191]!==it||t[192]!==Qe||t[193]!==et||t[194]!==N||t[195]!==P||t[196]!==F||t[197]!==K||t[198]!==q?(Q=b.phase===`branch-in-other-worktree`?(0,v.jsx)(o,{onClick:mt,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,v.jsx)(r,{id:`hyCxJY`})}):b.phase===`verdict`?b.resolution.kind===`on-origin`?(0,v.jsxs)(o,{onClick:et,"data-testid":`share-branch-switch-verdict-switch-update`,children:[(0,v.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),(0,v.jsx)(r,{id:`uA_jXp`})]}):b.resolution.kind===`renamed`?(0,v.jsxs)(o,{onClick:nt,"data-testid":`share-branch-switch-verdict-open-renamed`,children:[(0,v.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),(0,v.jsx)(r,{id:`AItsE5`})]}):b.resolution.kind===`diverged`?(0,v.jsxs)(o,{onClick:it,"data-testid":`share-branch-switch-verdict-plain-switch`,children:[(0,v.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),P]}):null:(0,v.jsxs)(`div`,{className:`flex min-w-0 flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:justify-end sm:gap-2`,children:[K?.openCurrentEnabled?(0,v.jsxs)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:ot,disabled:F||M,"data-testid":`share-branch-switch-open-current`,children:[(0,v.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),N]}):null,(0,v.jsx)(o,{variant:`outline`,onClick:Qe,disabled:!K?.switchEnabled||F||M,"aria-disabled":!K?.switchEnabled||F||M,"aria-describedby":K&&!K.switchEnabled&&K.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:F?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(u,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),P]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),P]})}),(0,v.jsx)(o,{onClick:ft,disabled:!K||F||M,"data-testid":`share-branch-switch-worktree`,children:M?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(u,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),q]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),q]})})]}),t[184]=b.phase,t[185]=b.resolution,t[186]=M,t[187]=ot,t[188]=nt,t[189]=ft,t[190]=mt,t[191]=it,t[192]=Qe,t[193]=et,t[194]=N,t[195]=P,t[196]=F,t[197]=K,t[198]=q,t[199]=Q):Q=t[199];let _t;t[200]!==Z||t[201]!==Q?(_t=(0,v.jsxs)(ie,{className:`sm:justify-between`,children:[Z,Q]}),t[200]=Z,t[201]=Q,t[202]=_t):_t=t[202];let $;t[203]!==A||t[204]!==z||t[205]!==B||t[206]!==V||t[207]!==H||t[208]!==U||t[209]!==X||t[210]!==_t?($=(0,v.jsxs)(A,{className:z,"data-testid":B,onInteractOutside:V,onPointerDownOutside:H,children:[U,X,_t]}),t[203]=A,t[204]=z,t[205]=B,t[206]=V,t[207]=H,t[208]=U,t[209]=X,t[210]=_t,t[211]=$):$=t[211];let vt;return t[212]!==j||t[213]!==W||t[214]!==G||t[215]!==$?(vt=(0,v.jsx)(j,{open:W,onOpenChange:G,children:$}),t[212]=j,t[213]=W,t[214]=G,t[215]=$,t[216]=vt):vt=t[216],vt}function Ce(e){return(0,v.jsx)(`li`,{children:(0,v.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function we(e){e.preventDefault()}function Te(e){e.preventDefault()}function Ee(){return p.request()}function De(e){return be(e,null).state}function Oe(e){return ye(e,null)}function ke(e){return me(e,null)}function Ae(){return null}export{y as ShareBranchSwitchDialog};
|
package/dist/public/assets/{ShareReceiveDialog-Bz3zpKKF.js → ShareReceiveDialog-XWYS81GX.js}
RENAMED
|
@@ -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-RQ5o7P7w.js";import{a as ee,c as te,i as ne,n as re,o as s,s as c,t as l}from"./dialog-Bxcn1sLm.js";import{dn as u,ln as d}from"./dist-Cy5lktAQ2.js";import{n as f}from"./dist-Bkx5dDHT2.js";import{t as p}from"./desktop-bridge-types-oYPdTDmz.js";import{t as ie}from"./loader-circle-BJLNGSB4.js";import{a as ae,i as m,n as h,o as g,r as oe,s as _}from"./receive-store-DO5w93VK.js";import{t as se}from"./share-metadata-rows-CBd7DuHz.js";var v=e(n(),1),y=a(),b=e=>({phase:`ready`,seed:e});function x(e){return e.phase===`ready`?{phase:`initializing`,seed:e.seed}:e}function S(e,t){return e.phase===`initializing`?t.ok?{phase:`opening`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:t.reason,message:t.message}:e}function C(e,t){return e.phase===`opening`?t.ok?{phase:`done`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:`network-error`,message:t.message}:e}function w(e){return e.phase===`done`||e.phase===`cancelled`||e.phase===`error`?e:{phase:`cancelled`,seed:e.seed}}var T=t();function E(e){return e!==null&&e.kind===`launcher-consent`}function D(e){return e!==null&&e.kind===`launcher-miss`}function O(e){let t=(0,y.c)(14),{bridge:n,cloneController:r,store:i}=e,a=i===void 0?h:i,o=(0,v.useSyncExternalStore)(a.subscribe,a.getSnapshot,A),[ee,te]=(0,v.useState)(0),[ne,re]=(0,v.useState)(o);o!==ne&&(re(o),te(k));let s,c;t[0]!==o||t[1]!==a?(s=()=>{if(!o)return;let e=_(o);e&&(f.error(e.message),a.dismiss())},c=[o,a],t[0]=o,t[1]=a,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,v.useEffect)(s,c);let l;t[4]===o?l=t[5]:(l=D(o)?o:null,t[4]=o,t[5]=l);let u=l,d;t[6]===o?d=t[7]:(d=E(o)?o:null,t[6]=o,t[7]=d);let p=d??u;if(!p)return null;let ie;return t[8]!==p||t[9]!==n||t[10]!==r||t[11]!==ee||t[12]!==a?(ie=(0,T.jsx)(j,{payload:p,bridge:n,cloneController:r,store:a},ee),t[8]=p,t[9]=n,t[10]=r,t[11]=ee,t[12]=a,t[13]=ie):ie=t[13],ie}function k(e){return e+1}function A(){return null}function j(e){let t=(0,y.c)(165),{payload:n,bridge:a,cloneController:h,store:_}=e,{_:x}=i(),[w,O]=(0,v.useState)(!1),[k,A]=(0,v.useState)(null),[j,fe]=(0,v.useState)(!1),[N,pe]=(0,v.useState)(!1),[P,me]=(0,v.useState)(null),[F,I]=(0,v.useState)(null),he=(0,v.useRef)(!1),ge=(0,v.useRef)(null),_e,ve;t[0]===P?(_e=t[1],ve=t[2]):(_e=()=>{P&&ge.current?.focus()},ve=[P],t[0]=P,t[1]=_e,t[2]=ve),(0,v.useEffect)(_e,ve);let ye;t[3]!==F||t[4]!==n?(ye=()=>{E(n)&&F===null&&(console.warn(`[receive] q1_hit=true selection=branch_match_non_ok candidate=${n.candidatePath}`),I(b({candidatePath:n.candidatePath,branch:n.share.branch,targetPath:p(n.share.target),targetKind:n.share.target.kind,parentProjectName:n.parentProjectName})))},t[3]=F,t[4]=n,t[5]=ye):ye=t[5];let be;t[6]===n?be=t[7]:(be=[n],t[6]=n,t[7]=be),(0,v.useEffect)(ye,be);let xe;t[8]!==k||t[9]!==h||t[10]!==n?(xe=()=>{if(!h||!D(n)||k!==null||he.current)return;he.current=!0,fe(!0);let e=n.share.host;h.getAuthStatus(e).then(e=>{A(e)}).catch(t=>{console.warn(`[receive] auth pre-flight probe failed`,t instanceof Error?t.message:t),A({authenticated:!1,host:e})}).finally(()=>{fe(!1)})},t[8]=k,t[9]=h,t[10]=n,t[11]=xe):xe=t[11];let Se;t[12]!==k||t[13]!==n?(Se=[n,k],t[12]=k,t[13]=n,t[14]=Se):Se=t[14],(0,v.useEffect)(xe,Se);let L=D(n)?n:null,Ce=E(n)?n:null,R=L?.share??Ce?.share??null,z,B,V,H,we,Te,U,W;if(t[15]!==x||t[16]!==j||t[17]!==a||t[18]!==h||t[19]!==N||t[20]!==F||t[21]!==L||t[22]!==w||t[23]!==R||t[24]!==_){U=Symbol.for(`react.early_return_sentinel`);bb0:{let e=R?{host:R.host,owner:R.owner,repo:R.repo}:null,n;t[33]!==x||t[34]!==R?.target.kind?(n=R?.target.kind===`folder`?x({id:`ugoTXs`}):x({id:`XH30C4`}),t[33]=x,t[34]=R?.target.kind,t[35]=n):n=t[35],W=n,V=async function(){if(!L||!e)return;if(console.log(ae({q2_path:`clone`})),!h){f.info(x({id:`27XW26`}),{action:{label:x({id:`B3NAZC`}),onClick:()=>{a.navigator.open()}},duration:8e3});return}if(N)return;me(null),pe(!0);let t=oe(e),n;try{n=await h.runClone({url:t,branch:L.share.branch})}catch(e){let t=e;console.warn(`[receive] runClone threw unexpectedly`,t),pe(!1),me({detail:t instanceof Error?t.message:String(t)});return}if(pe(!1),n.kind===`error`){me({detail:n.detail??null});return}if(n.kind===`ok`){try{await a.project.open({path:n.dir,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:L.share.target.kind,path:p(L.share.target)}}),_.dismiss()}catch(e){let t=e;console.warn(`[receive] project open after clone failed`,t instanceof Error?t.message:t),f.error(x({id:`438Fca`}))}return}};let i;t[36]!==x||t[37]!==j||t[38]!==h?(i=async function(){if(!(!h||j)){fe(!0);try{let e=await h.startSignIn();fe(!1),e!==null&&A(e)}catch(e){let t=e;fe(!1),console.warn(`[receive] startSignIn failed`,t instanceof Error?t.message:t),f.error(x({id:`lzwo7p`}))}}},t[36]=x,t[37]=j,t[38]=h,t[39]=i):i=t[39],we=i,H=async function(){if(!(!L||!e||w)){me(null),O(!0),console.log(ae({q2_path:`local`}));try{for(;;){let t=await a.dialog.openFolder();if(!t)break;let n=await a.share.validateLocalFolder({folderPath:t,host:e.host,owner:e.owner,repo:e.repo});if(console.log(ae({folder_validate:n.kind})),n.kind===`ok`){let e=L.share.branch,n={currentBranch:null,headSha:null,detached:!1};try{n=await a.project.readHeadBranch(t)}catch(e){let t=e;console.warn(`[receive] local-folder readHeadBranch failed`,t instanceof Error?t.message:t)}let r=u(e,n)!==`true`;try{await a.project.open({path:t,target:`new-window`,entryPoint:`share-receive`,...r?{pendingShareBranchSwitch:{share:L.share,projectPath:t,currentBranch:n.currentBranch}}:{pendingDeepLinkTarget:{kind:L.share.target.kind,path:p(L.share.target)}}}),_.dismiss()}catch(e){let t=e;console.warn(`[receive] local-folder-open failed`,t instanceof Error?t.message:t),f.error(x({id:`phM8Kh`}))}break}let r=g(n,e);r&&f.error(r)}}catch(e){let t=e;console.warn(`[receive] local-folder-validate failed`,t instanceof Error?t.message:t),f.error(x({id:`rlUzXK`}))}O(!1)}};let m;t[40]!==x||t[41]!==a||t[42]!==F||t[43]!==_?(m=function(){if(F===null||F.phase!==`ready`)return;let e=F.seed;console.warn(`[receive] consent_dialog action=initialize worktree=${e.candidatePath}`),I(de),a.project.okInit({projectPath:e.candidatePath}).then(async t=>{if(t.ok===!0){I(e=>e===null?e:S(e,{ok:!0,projectPath:t.projectPath}));try{await a.project.open({path:t.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:e.targetKind,path:e.targetPath},pendingBranch:e.branch}),I(ue),_.dismiss()}catch(t){let n=t,r=n instanceof Error?n.message:String(n);I(e=>e===null?e:C(e,{ok:!1,message:r})),f.error(x({id:`nDT8qt`,values:{0:e.candidatePath}}))}return}let n=t.reason,r=t.message||`Initialization failed.`;I(e=>e===null?e:S(e,{ok:!1,reason:n,message:r})),f.error(r)}).catch(t=>{let n=t instanceof Error?t.message:String(t);I(e=>e===null?e:S(e,{ok:!1,reason:`network-error`,message:n})),f.error(x({id:`3Mwaly`,values:{0:e.candidatePath}}))})},t[40]=x,t[41]=a,t[42]=F,t[43]=_,t[44]=m):m=t[44];let v=m,y;t[45]!==F||t[46]!==_?(y=function(){F!==null&&console.warn(`[receive] consent_dialog action=cancel worktree=${F.seed.candidatePath}`),I(M),_.dismiss()},t[45]=F,t[46]=_,t[47]=y):y=t[47];let b=y;if(F!==null&&F.phase!==`cancelled`&&F.phase!==`done`&&R!==null){let e=F.seed,n=F.phase===`initializing`||F.phase===`opening`,i;t[48]===b?i=t[49]:(i=e=>{e||b()},t[48]=b,t[49]=i);let a;t[50]===W?a=t[51]:(a=(0,T.jsx)(te,{children:(0,T.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:W}})}),t[50]=W,t[51]=a);let u;t[52]===R.target?u=t[53]:(u=p(R.target)?`— ${p(R.target)}`:``,t[52]=R.target,t[53]=u);let d;t[54]!==R.owner||t[55]!==R.repo||t[56]!==u?(d=(0,T.jsx)(ee,{className:`sr-only`,children:(0,T.jsx)(r,{id:`pgq_xf`,values:{0:R.owner,1:R.repo,2:u}})}),t[54]=R.owner,t[55]=R.repo,t[56]=u,t[57]=d):d=t[57];let f=R.owner,ae=R.repo,m;t[58]===R.target?m=t[59]:(m=p(R.target),t[58]=R.target,t[59]=m);let h;t[60]!==R.branch||t[61]!==R.owner||t[62]!==R.repo||t[63]!==R.target.kind||t[64]!==m?(h=(0,T.jsx)(se,{owner:f,repo:ae,path:m,kind:R.target.kind,branch:R.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[60]=R.branch,t[61]=R.owner,t[62]=R.repo,t[63]=R.target.kind,t[64]=m,t[65]=h):h=t[65];let g;t[66]!==a||t[67]!==d||t[68]!==h?(g=(0,T.jsxs)(c,{children:[a,d,h]}),t[66]=a,t[67]=d,t[68]=h,t[69]=g):g=t[69];let oe;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`KsAPaB`})}),t[70]=oe):oe=t[70];let _;t[71]===e.candidatePath?_=t[72]:(_=(0,T.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-receive-consent-path`,children:e.candidatePath}),t[71]=e.candidatePath,t[72]=_);let y;t[73]===e.parentProjectName?y=t[74]:(y=e.parentProjectName===null?null:(0,T.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,"data-testid":`share-receive-consent-parent`,children:(0,T.jsx)(r,{id:`JmfgFc`,values:{0:e.parentProjectName}})}),t[73]=e.parentProjectName,t[74]=y);let x;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,T.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`w7SsvI`})}),t[75]=x):x=t[75];let S;t[76]!==F.message||t[77]!==F.phase?(S=F.phase===`error`?(0,T.jsx)(`p`,{className:`mt-3 text-sm text-destructive`,"data-testid":`share-receive-consent-error`,role:`alert`,children:F.message}):null,t[76]=F.message,t[77]=F.phase,t[78]=S):S=t[78];let C;t[79]!==_||t[80]!==y||t[81]!==S?(C=(0,T.jsxs)(re,{children:[oe,_,y,x,S]}),t[79]=_,t[80]=y,t[81]=S,t[82]=C):C=t[82];let w;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,T.jsx)(r,{id:`dEgA5A`}),t[83]=w):w=t[83];let E;t[84]===b?E=t[85]:(E=(0,T.jsx)(o,{variant:`ghost`,onClick:b,"data-testid":`share-receive-consent-cancel`,children:w}),t[84]=b,t[85]=E);let D=n||F.phase===`error`,O=n||F.phase===`error`,k;t[86]===n?k=t[87]:(k=n?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(ie,{className:`mr-2 h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,T.jsx)(r,{id:`NKkZXl`})]}):(0,T.jsx)(r,{id:`NKkZXl`}),t[86]=n,t[87]=k);let A;t[88]!==v||t[89]!==D||t[90]!==O||t[91]!==k?(A=(0,T.jsx)(o,{onClick:v,disabled:D,"aria-disabled":O,"data-testid":`share-receive-consent-initialize`,children:k}),t[88]=v,t[89]=D,t[90]=O,t[91]=k,t[92]=A):A=t[92];let j;t[93]!==E||t[94]!==A?(j=(0,T.jsxs)(s,{children:[E,A]}),t[93]=E,t[94]=A,t[95]=j):j=t[95];let M;t[96]!==g||t[97]!==C||t[98]!==j?(M=(0,T.jsxs)(ne,{className:`sm:max-w-xl`,"data-testid":`share-receive-consent-dialog`,onInteractOutside:le,onPointerDownOutside:ce,children:[g,C,j]}),t[96]=g,t[97]=C,t[98]=j,t[99]=M):M=t[99];let ue;t[100]!==i||t[101]!==M?(ue=(0,T.jsx)(l,{open:!0,onOpenChange:i,children:M}),t[100]=i,t[101]=M,t[102]=ue):ue=t[102],U=ue;break bb0}if(!L||!R||!e){U=null;break bb0}z=h!==void 0&&!N;let E;t[103]!==x||t[104]!==N?(E=x(N?{id:`YjhKI5`}:{id:`LE7t79`}),t[103]=x,t[104]=N,t[105]=E):E=t[105],B=E,Te=d(e)}t[15]=x,t[16]=j,t[17]=a,t[18]=h,t[19]=N,t[20]=F,t[21]=L,t[22]=w,t[23]=R,t[24]=_,t[25]=z,t[26]=B,t[27]=V,t[28]=H,t[29]=we,t[30]=Te,t[31]=U,t[32]=W}else z=t[25],B=t[26],V=t[27],H=t[28],we=t[29],Te=t[30],U=t[31],W=t[32];if(U!==Symbol.for(`react.early_return_sentinel`))return U;let Ee=Te,De=k?.authenticated?k.login:void 0,Oe;t[106]===P?Oe=t[107]:(Oe=P?.detail?m(P.detail):``,t[106]=P,t[107]=Oe);let ke=Oe,G;t[108]===_?G=t[109]:(G=e=>{e||_.dismiss()},t[108]=_,t[109]=G);let K;t[110]===W?K=t[111]:(K=(0,T.jsx)(te,{children:(0,T.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:W}})}),t[110]=W,t[111]=K);let q;t[112]===R.target?q=t[113]:(q=p(R.target)?` — ${p(R.target)}`:null,t[112]=R.target,t[113]=q);let J;t[114]!==R.owner||t[115]!==R.repo||t[116]!==q?(J=(0,T.jsxs)(ee,{className:`sr-only`,children:[R.owner,`/`,R.repo,q]}),t[114]=R.owner,t[115]=R.repo,t[116]=q,t[117]=J):J=t[117];let Ae=R.owner,je=R.repo,Y;t[118]===R.target?Y=t[119]:(Y=p(R.target),t[118]=R.target,t[119]=Y);let X;t[120]!==R.branch||t[121]!==R.owner||t[122]!==R.repo||t[123]!==R.target.kind||t[124]!==Y?(X=(0,T.jsx)(se,{owner:Ae,repo:je,path:Y,kind:R.target.kind,branch:R.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[120]=R.branch,t[121]=R.owner,t[122]=R.repo,t[123]=R.target.kind,t[124]=Y,t[125]=X):X=t[125];let Z;t[126]!==K||t[127]!==J||t[128]!==X?(Z=(0,T.jsxs)(c,{children:[K,J,X]}),t[126]=K,t[127]=J,t[128]=X,t[129]=Z):Z=t[129];let Q;t[130]!==h||t[131]!==z||t[132]!==P||t[133]!==ke||t[134]!==B||t[135]!==N||t[136]!==V||t[137]!==H||t[138]!==w?(Q=P?(0,T.jsxs)(`div`,{ref:ge,tabIndex:-1,className:`rounded-lg border border-destructive/40 bg-destructive/5 p-4 outline-none`,"data-testid":`share-receive-clone-error`,children:[(0,T.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,role:`alert`,children:(0,T.jsx)(r,{id:`aiArms`})}),ke?(0,T.jsxs)(`p`,{className:`mt-2 break-words text-xs text-destructive`,"data-testid":`share-receive-clone-error-message`,children:[(0,T.jsx)(r,{id:`4BITzH`}),` `,(0,T.jsxs)(`span`,{className:`font-mono text-foreground/80`,children:[`"`,ke,`"`]})]}):null,(0,T.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`Llyqvo`})}),(0,T.jsxs)(`ul`,{className:`mt-1 list-disc space-y-1 pl-5 text-sm text-muted-foreground`,"data-testid":`share-receive-clone-error-reasons`,children:[(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`6LbUG7`})}),(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`_pY_Vq`})}),(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`J6mxC1`})})]}),(0,T.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,T.jsx)(o,{onClick:()=>{V()},"data-testid":`share-receive-clone-retry`,children:(0,T.jsx)(r,{id:`KDw4GX`})}),(0,T.jsx)(o,{variant:`outline`,onClick:()=>{H()},disabled:w||N,"data-testid":`share-receive-error-local`,children:(0,T.jsx)(r,{id:`xFQRu4`})})]})]}):(0,T.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,T.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-clone`,className:`flex flex-col items-start gap-2 rounded-lg border border-primary/50 bg-primary/5 p-4 text-left transition hover:border-primary hover:bg-primary/10 focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-primary/50 disabled:hover:bg-primary/5`,onClick:()=>{V()},disabled:h!==void 0&&!z,"aria-disabled":h!==void 0&&!z,children:[(0,T.jsx)(`span`,{className:`text-sm font-semibold`,children:B}),(0,T.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`fj5YiP`})})]}),(0,T.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-local`,className:`flex flex-col items-start gap-2 rounded-lg border border-border bg-card p-4 text-left transition hover:border-foreground/50 hover:bg-accent focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,onClick:()=>{H()},disabled:w||N,children:[(0,T.jsx)(`span`,{className:`text-sm font-semibold`,children:(0,T.jsx)(r,{id:`HfI1dR`})}),(0,T.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`_qD6mn`})})]})]}),t[130]=h,t[131]=z,t[132]=P,t[133]=ke,t[134]=B,t[135]=N,t[136]=V,t[137]=H,t[138]=w,t[139]=Q):Q=t[139];let $;t[140]!==j||t[141]!==k||t[142]!==h||t[143]!==we||t[144]!==De?($=h?(0,T.jsx)(`div`,{className:`mt-3 flex items-center justify-between rounded-md border border-border bg-muted/30 px-3 py-2 text-xs`,"data-testid":`share-receive-auth-banner`,role:`status`,"aria-live":`polite`,children:k===null?(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{id:`UDFrWm`})}):k.authenticated?(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{id:`VAHWL_`,values:{signedInLogin:De},components:{0:(0,T.jsx)(`span`,{className:`font-medium text-foreground/90`})}})}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{id:`SgKLfA`})}),(0,T.jsx)(`button`,{type:`button`,"data-testid":`share-receive-signin`,className:`font-medium text-primary underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded`,onClick:()=>{we()},disabled:j,children:j?(0,T.jsx)(r,{id:`PKLY-1`}):(0,T.jsx)(r,{id:`3jod3l`})})]})}):null,t[140]=j,t[141]=k,t[142]=h,t[143]=we,t[144]=De,t[145]=$):$=t[145];let Me;t[146]!==P||t[147]!==Ee?(Me=P?null:(0,T.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`RJ3a8Z`,values:{lookingForUrl:Ee},components:{0:(0,T.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),t[146]=P,t[147]=Ee,t[148]=Me):Me=t[148];let Ne;t[149]!==Q||t[150]!==$||t[151]!==Me?(Ne=(0,T.jsxs)(re,{children:[Q,$,Me]}),t[149]=Q,t[150]=$,t[151]=Me,t[152]=Ne):Ne=t[152];let Pe;t[153]===_?Pe=t[154]:(Pe=()=>_.dismiss(),t[153]=_,t[154]=Pe);let Fe;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,T.jsx)(r,{id:`dEgA5A`}),t[155]=Fe):Fe=t[155];let Ie;t[156]===Pe?Ie=t[157]:(Ie=(0,T.jsx)(s,{children:(0,T.jsx)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:Pe,children:Fe})}),t[156]=Pe,t[157]=Ie);let Le;t[158]!==Z||t[159]!==Ne||t[160]!==Ie?(Le=(0,T.jsxs)(ne,{className:`sm:max-w-xl`,"data-testid":`share-receive-dialog`,children:[Z,Ne,Ie]}),t[158]=Z,t[159]=Ne,t[160]=Ie,t[161]=Le):Le=t[161];let Re;return t[162]!==G||t[163]!==Le?(Re=(0,T.jsx)(l,{open:!0,onOpenChange:G,children:Le}),t[162]=G,t[163]=Le,t[164]=Re):Re=t[164],Re}function ce(e){return e.preventDefault()}function le(e){return e.preventDefault()}function M(e){return e===null?e:w(e)}function ue(e){return e===null?e:C(e,{ok:!0})}function de(e){return e===null?e:x(e)}export{O 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-RQ5o7P7w.js";import{a as ee,c as te,i as ne,n as re,o as s,s as c,t as l}from"./dialog-Bxcn1sLm.js";import{gn as u,vn as d}from"./dist-D6d8jhW_2.js";import{n as f}from"./dist-Bkx5dDHT2.js";import{t as p}from"./desktop-bridge-types-oYPdTDmz.js";import{t as ie}from"./loader-circle-BJLNGSB4.js";import{a as ae,i as m,n as h,o as g,r as oe,s as _}from"./receive-store-CbFpknqD.js";import{t as se}from"./share-metadata-rows-CBd7DuHz.js";var v=e(n(),1),y=a(),b=e=>({phase:`ready`,seed:e});function x(e){return e.phase===`ready`?{phase:`initializing`,seed:e.seed}:e}function S(e,t){return e.phase===`initializing`?t.ok?{phase:`opening`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:t.reason,message:t.message}:e}function C(e,t){return e.phase===`opening`?t.ok?{phase:`done`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:`network-error`,message:t.message}:e}function w(e){return e.phase===`done`||e.phase===`cancelled`||e.phase===`error`?e:{phase:`cancelled`,seed:e.seed}}var T=t();function E(e){return e!==null&&e.kind===`launcher-consent`}function D(e){return e!==null&&e.kind===`launcher-miss`}function O(e){let t=(0,y.c)(14),{bridge:n,cloneController:r,store:i}=e,a=i===void 0?h:i,o=(0,v.useSyncExternalStore)(a.subscribe,a.getSnapshot,A),[ee,te]=(0,v.useState)(0),[ne,re]=(0,v.useState)(o);o!==ne&&(re(o),te(k));let s,c;t[0]!==o||t[1]!==a?(s=()=>{if(!o)return;let e=_(o);e&&(f.error(e.message),a.dismiss())},c=[o,a],t[0]=o,t[1]=a,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,v.useEffect)(s,c);let l;t[4]===o?l=t[5]:(l=D(o)?o:null,t[4]=o,t[5]=l);let u=l,d;t[6]===o?d=t[7]:(d=E(o)?o:null,t[6]=o,t[7]=d);let p=d??u;if(!p)return null;let ie;return t[8]!==p||t[9]!==n||t[10]!==r||t[11]!==ee||t[12]!==a?(ie=(0,T.jsx)(j,{payload:p,bridge:n,cloneController:r,store:a},ee),t[8]=p,t[9]=n,t[10]=r,t[11]=ee,t[12]=a,t[13]=ie):ie=t[13],ie}function k(e){return e+1}function A(){return null}function j(e){let t=(0,y.c)(165),{payload:n,bridge:a,cloneController:h,store:_}=e,{_:x}=i(),[w,O]=(0,v.useState)(!1),[k,A]=(0,v.useState)(null),[j,fe]=(0,v.useState)(!1),[N,pe]=(0,v.useState)(!1),[P,me]=(0,v.useState)(null),[F,I]=(0,v.useState)(null),he=(0,v.useRef)(!1),ge=(0,v.useRef)(null),_e,ve;t[0]===P?(_e=t[1],ve=t[2]):(_e=()=>{P&&ge.current?.focus()},ve=[P],t[0]=P,t[1]=_e,t[2]=ve),(0,v.useEffect)(_e,ve);let ye;t[3]!==F||t[4]!==n?(ye=()=>{E(n)&&F===null&&(console.warn(`[receive] q1_hit=true selection=branch_match_non_ok candidate=${n.candidatePath}`),I(b({candidatePath:n.candidatePath,branch:n.share.branch,targetPath:p(n.share.target),targetKind:n.share.target.kind,parentProjectName:n.parentProjectName})))},t[3]=F,t[4]=n,t[5]=ye):ye=t[5];let be;t[6]===n?be=t[7]:(be=[n],t[6]=n,t[7]=be),(0,v.useEffect)(ye,be);let xe;t[8]!==k||t[9]!==h||t[10]!==n?(xe=()=>{if(!h||!D(n)||k!==null||he.current)return;he.current=!0,fe(!0);let e=n.share.host;h.getAuthStatus(e).then(e=>{A(e)}).catch(t=>{console.warn(`[receive] auth pre-flight probe failed`,t instanceof Error?t.message:t),A({authenticated:!1,host:e})}).finally(()=>{fe(!1)})},t[8]=k,t[9]=h,t[10]=n,t[11]=xe):xe=t[11];let Se;t[12]!==k||t[13]!==n?(Se=[n,k],t[12]=k,t[13]=n,t[14]=Se):Se=t[14],(0,v.useEffect)(xe,Se);let L=D(n)?n:null,Ce=E(n)?n:null,R=L?.share??Ce?.share??null,z,B,V,H,we,Te,U,W;if(t[15]!==x||t[16]!==j||t[17]!==a||t[18]!==h||t[19]!==N||t[20]!==F||t[21]!==L||t[22]!==w||t[23]!==R||t[24]!==_){U=Symbol.for(`react.early_return_sentinel`);bb0:{let e=R?{host:R.host,owner:R.owner,repo:R.repo}:null,n;t[33]!==x||t[34]!==R?.target.kind?(n=R?.target.kind===`folder`?x({id:`ugoTXs`}):x({id:`XH30C4`}),t[33]=x,t[34]=R?.target.kind,t[35]=n):n=t[35],W=n,V=async function(){if(!L||!e)return;if(console.log(ae({q2_path:`clone`})),!h){f.info(x({id:`27XW26`}),{action:{label:x({id:`B3NAZC`}),onClick:()=>{a.navigator.open()}},duration:8e3});return}if(N)return;me(null),pe(!0);let t=oe(e),n;try{n=await h.runClone({url:t,branch:L.share.branch})}catch(e){let t=e;console.warn(`[receive] runClone threw unexpectedly`,t),pe(!1),me({detail:t instanceof Error?t.message:String(t)});return}if(pe(!1),n.kind===`error`){me({detail:n.detail??null});return}if(n.kind===`ok`){try{await a.project.open({path:n.dir,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:L.share.target.kind,path:p(L.share.target)}}),_.dismiss()}catch(e){let t=e;console.warn(`[receive] project open after clone failed`,t instanceof Error?t.message:t),f.error(x({id:`438Fca`}))}return}};let i;t[36]!==x||t[37]!==j||t[38]!==h?(i=async function(){if(!(!h||j)){fe(!0);try{let e=await h.startSignIn();fe(!1),e!==null&&A(e)}catch(e){let t=e;fe(!1),console.warn(`[receive] startSignIn failed`,t instanceof Error?t.message:t),f.error(x({id:`lzwo7p`}))}}},t[36]=x,t[37]=j,t[38]=h,t[39]=i):i=t[39],we=i,H=async function(){if(!(!L||!e||w)){me(null),O(!0),console.log(ae({q2_path:`local`}));try{for(;;){let t=await a.dialog.openFolder();if(!t)break;let n=await a.share.validateLocalFolder({folderPath:t,host:e.host,owner:e.owner,repo:e.repo});if(console.log(ae({folder_validate:n.kind})),n.kind===`ok`){let e=L.share.branch,n={currentBranch:null,headSha:null,detached:!1};try{n=await a.project.readHeadBranch(t)}catch(e){let t=e;console.warn(`[receive] local-folder readHeadBranch failed`,t instanceof Error?t.message:t)}let r=d(e,n)!==`true`;try{await a.project.open({path:t,target:`new-window`,entryPoint:`share-receive`,...r?{pendingShareBranchSwitch:{share:L.share,projectPath:t,currentBranch:n.currentBranch}}:{pendingDeepLinkTarget:{kind:L.share.target.kind,path:p(L.share.target)}}}),_.dismiss()}catch(e){let t=e;console.warn(`[receive] local-folder-open failed`,t instanceof Error?t.message:t),f.error(x({id:`phM8Kh`}))}break}let r=g(n,e);r&&f.error(r)}}catch(e){let t=e;console.warn(`[receive] local-folder-validate failed`,t instanceof Error?t.message:t),f.error(x({id:`rlUzXK`}))}O(!1)}};let m;t[40]!==x||t[41]!==a||t[42]!==F||t[43]!==_?(m=function(){if(F===null||F.phase!==`ready`)return;let e=F.seed;console.warn(`[receive] consent_dialog action=initialize worktree=${e.candidatePath}`),I(de),a.project.okInit({projectPath:e.candidatePath}).then(async t=>{if(t.ok===!0){I(e=>e===null?e:S(e,{ok:!0,projectPath:t.projectPath}));try{await a.project.open({path:t.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:e.targetKind,path:e.targetPath},pendingBranch:e.branch}),I(ue),_.dismiss()}catch(t){let n=t,r=n instanceof Error?n.message:String(n);I(e=>e===null?e:C(e,{ok:!1,message:r})),f.error(x({id:`nDT8qt`,values:{0:e.candidatePath}}))}return}let n=t.reason,r=t.message||`Initialization failed.`;I(e=>e===null?e:S(e,{ok:!1,reason:n,message:r})),f.error(r)}).catch(t=>{let n=t instanceof Error?t.message:String(t);I(e=>e===null?e:S(e,{ok:!1,reason:`network-error`,message:n})),f.error(x({id:`3Mwaly`,values:{0:e.candidatePath}}))})},t[40]=x,t[41]=a,t[42]=F,t[43]=_,t[44]=m):m=t[44];let v=m,y;t[45]!==F||t[46]!==_?(y=function(){F!==null&&console.warn(`[receive] consent_dialog action=cancel worktree=${F.seed.candidatePath}`),I(M),_.dismiss()},t[45]=F,t[46]=_,t[47]=y):y=t[47];let b=y;if(F!==null&&F.phase!==`cancelled`&&F.phase!==`done`&&R!==null){let e=F.seed,n=F.phase===`initializing`||F.phase===`opening`,i;t[48]===b?i=t[49]:(i=e=>{e||b()},t[48]=b,t[49]=i);let a;t[50]===W?a=t[51]:(a=(0,T.jsx)(te,{children:(0,T.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:W}})}),t[50]=W,t[51]=a);let u;t[52]===R.target?u=t[53]:(u=p(R.target)?`— ${p(R.target)}`:``,t[52]=R.target,t[53]=u);let d;t[54]!==R.owner||t[55]!==R.repo||t[56]!==u?(d=(0,T.jsx)(ee,{className:`sr-only`,children:(0,T.jsx)(r,{id:`pgq_xf`,values:{0:R.owner,1:R.repo,2:u}})}),t[54]=R.owner,t[55]=R.repo,t[56]=u,t[57]=d):d=t[57];let f=R.owner,ae=R.repo,m;t[58]===R.target?m=t[59]:(m=p(R.target),t[58]=R.target,t[59]=m);let h;t[60]!==R.branch||t[61]!==R.owner||t[62]!==R.repo||t[63]!==R.target.kind||t[64]!==m?(h=(0,T.jsx)(se,{owner:f,repo:ae,path:m,kind:R.target.kind,branch:R.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[60]=R.branch,t[61]=R.owner,t[62]=R.repo,t[63]=R.target.kind,t[64]=m,t[65]=h):h=t[65];let g;t[66]!==a||t[67]!==d||t[68]!==h?(g=(0,T.jsxs)(c,{children:[a,d,h]}),t[66]=a,t[67]=d,t[68]=h,t[69]=g):g=t[69];let oe;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`KsAPaB`})}),t[70]=oe):oe=t[70];let _;t[71]===e.candidatePath?_=t[72]:(_=(0,T.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-receive-consent-path`,children:e.candidatePath}),t[71]=e.candidatePath,t[72]=_);let y;t[73]===e.parentProjectName?y=t[74]:(y=e.parentProjectName===null?null:(0,T.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,"data-testid":`share-receive-consent-parent`,children:(0,T.jsx)(r,{id:`JmfgFc`,values:{0:e.parentProjectName}})}),t[73]=e.parentProjectName,t[74]=y);let x;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,T.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`w7SsvI`})}),t[75]=x):x=t[75];let S;t[76]!==F.message||t[77]!==F.phase?(S=F.phase===`error`?(0,T.jsx)(`p`,{className:`mt-3 text-sm text-destructive`,"data-testid":`share-receive-consent-error`,role:`alert`,children:F.message}):null,t[76]=F.message,t[77]=F.phase,t[78]=S):S=t[78];let C;t[79]!==_||t[80]!==y||t[81]!==S?(C=(0,T.jsxs)(re,{children:[oe,_,y,x,S]}),t[79]=_,t[80]=y,t[81]=S,t[82]=C):C=t[82];let w;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,T.jsx)(r,{id:`dEgA5A`}),t[83]=w):w=t[83];let E;t[84]===b?E=t[85]:(E=(0,T.jsx)(o,{variant:`ghost`,onClick:b,"data-testid":`share-receive-consent-cancel`,children:w}),t[84]=b,t[85]=E);let D=n||F.phase===`error`,O=n||F.phase===`error`,k;t[86]===n?k=t[87]:(k=n?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(ie,{className:`mr-2 h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,T.jsx)(r,{id:`NKkZXl`})]}):(0,T.jsx)(r,{id:`NKkZXl`}),t[86]=n,t[87]=k);let A;t[88]!==v||t[89]!==D||t[90]!==O||t[91]!==k?(A=(0,T.jsx)(o,{onClick:v,disabled:D,"aria-disabled":O,"data-testid":`share-receive-consent-initialize`,children:k}),t[88]=v,t[89]=D,t[90]=O,t[91]=k,t[92]=A):A=t[92];let j;t[93]!==E||t[94]!==A?(j=(0,T.jsxs)(s,{children:[E,A]}),t[93]=E,t[94]=A,t[95]=j):j=t[95];let M;t[96]!==g||t[97]!==C||t[98]!==j?(M=(0,T.jsxs)(ne,{className:`sm:max-w-xl`,"data-testid":`share-receive-consent-dialog`,onInteractOutside:le,onPointerDownOutside:ce,children:[g,C,j]}),t[96]=g,t[97]=C,t[98]=j,t[99]=M):M=t[99];let ue;t[100]!==i||t[101]!==M?(ue=(0,T.jsx)(l,{open:!0,onOpenChange:i,children:M}),t[100]=i,t[101]=M,t[102]=ue):ue=t[102],U=ue;break bb0}if(!L||!R||!e){U=null;break bb0}z=h!==void 0&&!N;let E;t[103]!==x||t[104]!==N?(E=x(N?{id:`YjhKI5`}:{id:`LE7t79`}),t[103]=x,t[104]=N,t[105]=E):E=t[105],B=E,Te=u(e)}t[15]=x,t[16]=j,t[17]=a,t[18]=h,t[19]=N,t[20]=F,t[21]=L,t[22]=w,t[23]=R,t[24]=_,t[25]=z,t[26]=B,t[27]=V,t[28]=H,t[29]=we,t[30]=Te,t[31]=U,t[32]=W}else z=t[25],B=t[26],V=t[27],H=t[28],we=t[29],Te=t[30],U=t[31],W=t[32];if(U!==Symbol.for(`react.early_return_sentinel`))return U;let Ee=Te,De=k?.authenticated?k.login:void 0,Oe;t[106]===P?Oe=t[107]:(Oe=P?.detail?m(P.detail):``,t[106]=P,t[107]=Oe);let ke=Oe,G;t[108]===_?G=t[109]:(G=e=>{e||_.dismiss()},t[108]=_,t[109]=G);let K;t[110]===W?K=t[111]:(K=(0,T.jsx)(te,{children:(0,T.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:W}})}),t[110]=W,t[111]=K);let q;t[112]===R.target?q=t[113]:(q=p(R.target)?` — ${p(R.target)}`:null,t[112]=R.target,t[113]=q);let J;t[114]!==R.owner||t[115]!==R.repo||t[116]!==q?(J=(0,T.jsxs)(ee,{className:`sr-only`,children:[R.owner,`/`,R.repo,q]}),t[114]=R.owner,t[115]=R.repo,t[116]=q,t[117]=J):J=t[117];let Ae=R.owner,je=R.repo,Y;t[118]===R.target?Y=t[119]:(Y=p(R.target),t[118]=R.target,t[119]=Y);let X;t[120]!==R.branch||t[121]!==R.owner||t[122]!==R.repo||t[123]!==R.target.kind||t[124]!==Y?(X=(0,T.jsx)(se,{owner:Ae,repo:je,path:Y,kind:R.target.kind,branch:R.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[120]=R.branch,t[121]=R.owner,t[122]=R.repo,t[123]=R.target.kind,t[124]=Y,t[125]=X):X=t[125];let Z;t[126]!==K||t[127]!==J||t[128]!==X?(Z=(0,T.jsxs)(c,{children:[K,J,X]}),t[126]=K,t[127]=J,t[128]=X,t[129]=Z):Z=t[129];let Q;t[130]!==h||t[131]!==z||t[132]!==P||t[133]!==ke||t[134]!==B||t[135]!==N||t[136]!==V||t[137]!==H||t[138]!==w?(Q=P?(0,T.jsxs)(`div`,{ref:ge,tabIndex:-1,className:`rounded-lg border border-destructive/40 bg-destructive/5 p-4 outline-none`,"data-testid":`share-receive-clone-error`,children:[(0,T.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,role:`alert`,children:(0,T.jsx)(r,{id:`aiArms`})}),ke?(0,T.jsxs)(`p`,{className:`mt-2 break-words text-xs text-destructive`,"data-testid":`share-receive-clone-error-message`,children:[(0,T.jsx)(r,{id:`4BITzH`}),` `,(0,T.jsxs)(`span`,{className:`font-mono text-foreground/80`,children:[`"`,ke,`"`]})]}):null,(0,T.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`Llyqvo`})}),(0,T.jsxs)(`ul`,{className:`mt-1 list-disc space-y-1 pl-5 text-sm text-muted-foreground`,"data-testid":`share-receive-clone-error-reasons`,children:[(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`6LbUG7`})}),(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`_pY_Vq`})}),(0,T.jsx)(`li`,{children:(0,T.jsx)(r,{id:`J6mxC1`})})]}),(0,T.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,T.jsx)(o,{onClick:()=>{V()},"data-testid":`share-receive-clone-retry`,children:(0,T.jsx)(r,{id:`KDw4GX`})}),(0,T.jsx)(o,{variant:`outline`,onClick:()=>{H()},disabled:w||N,"data-testid":`share-receive-error-local`,children:(0,T.jsx)(r,{id:`xFQRu4`})})]})]}):(0,T.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,T.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-clone`,className:`flex flex-col items-start gap-2 rounded-lg border border-primary/50 bg-primary/5 p-4 text-left transition hover:border-primary hover:bg-primary/10 focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-primary/50 disabled:hover:bg-primary/5`,onClick:()=>{V()},disabled:h!==void 0&&!z,"aria-disabled":h!==void 0&&!z,children:[(0,T.jsx)(`span`,{className:`text-sm font-semibold`,children:B}),(0,T.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`fj5YiP`})})]}),(0,T.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-local`,className:`flex flex-col items-start gap-2 rounded-lg border border-border bg-card p-4 text-left transition hover:border-foreground/50 hover:bg-accent focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,onClick:()=>{H()},disabled:w||N,children:[(0,T.jsx)(`span`,{className:`text-sm font-semibold`,children:(0,T.jsx)(r,{id:`HfI1dR`})}),(0,T.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`_qD6mn`})})]})]}),t[130]=h,t[131]=z,t[132]=P,t[133]=ke,t[134]=B,t[135]=N,t[136]=V,t[137]=H,t[138]=w,t[139]=Q):Q=t[139];let $;t[140]!==j||t[141]!==k||t[142]!==h||t[143]!==we||t[144]!==De?($=h?(0,T.jsx)(`div`,{className:`mt-3 flex items-center justify-between rounded-md border border-border bg-muted/30 px-3 py-2 text-xs`,"data-testid":`share-receive-auth-banner`,role:`status`,"aria-live":`polite`,children:k===null?(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{id:`UDFrWm`})}):k.authenticated?(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{id:`VAHWL_`,values:{signedInLogin:De},components:{0:(0,T.jsx)(`span`,{className:`font-medium text-foreground/90`})}})}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:(0,T.jsx)(r,{id:`SgKLfA`})}),(0,T.jsx)(`button`,{type:`button`,"data-testid":`share-receive-signin`,className:`font-medium text-primary underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded`,onClick:()=>{we()},disabled:j,children:j?(0,T.jsx)(r,{id:`PKLY-1`}):(0,T.jsx)(r,{id:`3jod3l`})})]})}):null,t[140]=j,t[141]=k,t[142]=h,t[143]=we,t[144]=De,t[145]=$):$=t[145];let Me;t[146]!==P||t[147]!==Ee?(Me=P?null:(0,T.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,T.jsx)(r,{id:`RJ3a8Z`,values:{lookingForUrl:Ee},components:{0:(0,T.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),t[146]=P,t[147]=Ee,t[148]=Me):Me=t[148];let Ne;t[149]!==Q||t[150]!==$||t[151]!==Me?(Ne=(0,T.jsxs)(re,{children:[Q,$,Me]}),t[149]=Q,t[150]=$,t[151]=Me,t[152]=Ne):Ne=t[152];let Pe;t[153]===_?Pe=t[154]:(Pe=()=>_.dismiss(),t[153]=_,t[154]=Pe);let Fe;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,T.jsx)(r,{id:`dEgA5A`}),t[155]=Fe):Fe=t[155];let Ie;t[156]===Pe?Ie=t[157]:(Ie=(0,T.jsx)(s,{children:(0,T.jsx)(o,{variant:`outline`,className:`font-mono uppercase`,onClick:Pe,children:Fe})}),t[156]=Pe,t[157]=Ie);let Le;t[158]!==Z||t[159]!==Ne||t[160]!==Ie?(Le=(0,T.jsxs)(ne,{className:`sm:max-w-xl`,"data-testid":`share-receive-dialog`,children:[Z,Ne,Ie]}),t[158]=Z,t[159]=Ne,t[160]=Ie,t[161]=Le):Le=t[161];let Re;return t[162]!==G||t[163]!==Le?(Re=(0,T.jsx)(l,{open:!0,onOpenChange:G,children:Le}),t[162]=G,t[163]=Le,t[164]=Re):Re=t[164],Re}function ce(e){return e.preventDefault()}function le(e){return e.preventDefault()}function M(e){return e===null?e:w(e)}function ue(e){return e===null?e:C(e,{ok:!0})}function de(e){return e===null?e:x(e)}export{O as ShareReceiveDialog};
|
package/dist/public/assets/{ShareReceiveMissDialog-DqXylco3.js → ShareReceiveMissDialog-MPUr0dv1.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{c as i,i as a,n as o,s,t as c}from"./dialog-Bxcn1sLm.js";import{a as l,i as u,n as d,r as f}from"./pending-receive-nav-store-
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{c as i,i as a,n as o,s,t as c}from"./dialog-Bxcn1sLm.js";import{a as l,i as u,n as d,r as f}from"./pending-receive-nav-store-B4qUnaqd.js";import{t as p}from"./miss-dialog-store-DKfFwAsF.js";import{f as m,p as h}from"./doc-paths-B610Q5eD.js";var g=r(),_=e(n(),1),v=t();function y(e){let t=e.split(`/`).filter(Boolean);return t.length>0?t[t.length-1]:e}function b(){let e=(0,g.c)(2),t=(0,_.useSyncExternalStore)(p.subscribe,p.getSnapshot,x);if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=(0,v.jsx)(S,{nav:t},t.path),e[0]=t,e[1]=n),n}function x(){return null}function S(e){let t=(0,g.c)(29),{nav:n}=e,{state:r,refetch:_}=l(n),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(){p.dismiss()},t[0]=b):b=t[0];let x=b,S;t[1]===n.path?S=t[2]:(S=function(){window.location.hash=h(u(n.path)),x()},t[1]=n.path,t[2]=S);let C=S,w;t[3]!==n.branch||t[4]!==n.kind?(w=function(e){d.arm({kind:n.kind,path:e,branch:n.branch}),window.location.hash=n.kind===`folder`?h(e):m(e),x()},t[3]=n.branch,t[4]=n.kind,t[5]=w):w=t[5];let T=w,E;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{e||x()},t[6]=E):E=t[6];let D=r.phase,O=r.phase===`resolved`?r.resolution.verdict:void 0,k;t[7]===n.path?k=t[8]:(k=y(n.path),t[7]=n.path,t[8]=k);let A;t[9]===k?A=t[10]:(A=(0,v.jsx)(s,{children:(0,v.jsx)(i,{className:`truncate`,children:k})}),t[9]=k,t[10]=A);let j=r.phase===`pending`?`flex flex-col items-center justify-center gap-3 py-6 text-center text-sm text-muted-foreground`:`flex flex-col items-center justify-center gap-6 py-2 text-center`,M;t[11]!==n.path||t[12]!==T?(M=()=>T(n.path),t[11]=n.path,t[12]=T,t[13]=M):M=t[13];let N;t[14]!==C||t[15]!==n||t[16]!==T||t[17]!==_||t[18]!==r||t[19]!==M?(N=(0,v.jsx)(f,{nav:n,state:r,onBrowseFolder:C,onOpenRenamed:T,onEnableAutoSync:x,onSyncCompleted:_,onPullApplied:M}),t[14]=C,t[15]=n,t[16]=T,t[17]=_,t[18]=r,t[19]=M,t[20]=N):N=t[20];let P;t[21]!==N||t[22]!==j?(P=(0,v.jsx)(o,{className:j,children:N}),t[21]=N,t[22]=j,t[23]=P):P=t[23];let F;return t[24]!==r.phase||t[25]!==P||t[26]!==O||t[27]!==A?(F=(0,v.jsx)(c,{open:!0,onOpenChange:E,children:(0,v.jsxs)(a,{className:`sm:max-w-md`,"data-testid":`share-receive-miss-dialog`,"data-phase":D,"data-verdict":O,children:[A,P]})}),t[24]=r.phase,t[25]=P,t[26]=O,t[27]=A,t[28]=F):F=t[28],F}export{b as ShareReceiveMissDialog};
|
|
@@ -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-hwoIfi3M.js";import{o as i}from"./skill-scope-
|
|
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-hwoIfi3M.js";import{o as i}from"./skill-scope-BpzNeizS.js";import{t as a}from"./SkillModeBanner-d0ZDkWTk.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"./utils-CPqDy6Hr.js";import{t as s}from"./button-RQ5o7P7w.js";import{i as c,n as l,t as u}from"./tooltip-x7BNUa3s.js";import{a as d,c as f,i as p,n as m,o as h,s as g,t as _}from"./dialog-Bxcn1sLm.js";import{t as v}from"./switch-0kSGDL9E.js";import{t as y}from"./arrow-up-right-D_WN0VGP.js";import{t as b}from"./refresh-cw-CAV3aG7d.js";import{t as x}from"./undo-2-D5cqFzyJ.js";import{t as S}from"./use-skill-origin-
|
|
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-RQ5o7P7w.js";import{i as c,n as l,t as u}from"./tooltip-x7BNUa3s.js";import{a as d,c as f,i as p,n as m,o as h,s as g,t as _}from"./dialog-Bxcn1sLm.js";import{t as v}from"./switch-0kSGDL9E.js";import{t as y}from"./arrow-up-right-D_WN0VGP.js";import{t as b}from"./refresh-cw-CAV3aG7d.js";import{t as x}from"./undo-2-D5cqFzyJ.js";import{t as S}from"./use-skill-origin-Dsa-uKgK.js";import{t as C}from"./DiffView-BjOsi4GM.js";var w=e(n(),1),T=a(),E=t();function D(e){let t=(0,T.c)(31),{open:n,onOpenChange:i,skillName:a,localBody:o,upstreamBody:c,applying:l,onTakeUpstream:u}=e,v;t[0]===a?v=t[1]:(v=(0,E.jsx)(f,{children:(0,E.jsx)(r,{id:`EPKVES`,values:{skillName:a}})}),t[0]=a,t[1]=v);let y;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,E.jsx)(d,{children:(0,E.jsx)(r,{id:`kKw0H3`})}),t[2]=y):y=t[2];let b;t[3]===v?b=t[4]:(b=(0,E.jsxs)(g,{children:[v,y]}),t[3]=v,t[4]=b);let x;t[5]!==o||t[6]!==c?(x=(0,E.jsx)(m,{className:`min-h-0 flex-1 overflow-auto`,children:(0,E.jsx)(C,{oldContent:o,newContent:c,layout:`unified`})}),t[5]=o,t[6]=c,t[7]=x):x=t[7];let S;t[8]===i?S=t[9]:(S=()=>i(!1),t[8]=i,t[9]=S);let w;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,E.jsx)(r,{id:`Tq3pcs`}),t[10]=w):w=t[10];let D;t[11]!==l||t[12]!==S?(D=(0,E.jsx)(s,{variant:`outline`,onClick:S,disabled:l,children:w}),t[11]=l,t[12]=S,t[13]=D):D=t[13];let O;t[14]===l?O=t[15]:(O=l?(0,E.jsx)(r,{id:`JL3si7`}):(0,E.jsx)(r,{id:`qkqG0b`}),t[14]=l,t[15]=O);let k;t[16]!==l||t[17]!==u||t[18]!==O?(k=(0,E.jsx)(s,{onClick:u,disabled:l,children:O}),t[16]=l,t[17]=u,t[18]=O,t[19]=k):k=t[19];let A;t[20]!==D||t[21]!==k?(A=(0,E.jsxs)(h,{children:[D,k]}),t[20]=D,t[21]=k,t[22]=A):A=t[22];let j;t[23]!==A||t[24]!==b||t[25]!==x?(j=(0,E.jsxs)(p,{className:`flex max-h-[85vh] max-w-3xl flex-col`,children:[b,x,A]}),t[23]=A,t[24]=b,t[25]=x,t[26]=j):j=t[26];let M;return t[27]!==i||t[28]!==n||t[29]!==j?(M=(0,E.jsx)(_,{open:n,onOpenChange:i,children:j}),t[27]=i,t[28]=n,t[29]=j,t[30]=M):M=t[30],M}function O(e){let t=(0,T.c)(48),{scope:n,name:a}=e,{_: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{origin:p,github:m,displaySource:h,importedTitle:g,canReimport:_,updateAvailable:C,modified:O,autoUpdate:k,gitTracked:A,setAutoUpdate:j,revertable:M,reimport:N,reimporting:P,previewUpdate:F,revert:I,reverting:L}=S(f),[R,z]=(0,w.useState)(null),B;t[3]!==O||t[4]!==F||t[5]!==N?(B=async function(){if(O){let e=await F();e&&z(e);return}await N()},t[3]=O,t[4]=F,t[5]=N,t[6]=B):B=t[6];let V=B,H;t[7]===N?H=t[8]:(H=async function(){await N(),z(null)},t[7]=N,t[8]=H);let U=H;if(!p)return null;let W;t[9]!==h||t[10]!==m||t[11]!==g?(W=m?(0,E.jsxs)(`a`,{href:m,target:`_blank`,rel:`noreferrer`,title:g??void 0,className:`hidden min-w-0 max-w-48 items-center gap-1 hover:text-foreground @xl/toolbar:flex`,children:[(0,E.jsx)(`span`,{className:`truncate`,children:h}),(0,E.jsx)(y,{className:`size-3 shrink-0`,"aria-hidden":!0})]}):(0,E.jsx)(`span`,{title:g??void 0,className:`hidden min-w-0 max-w-48 truncate @xl/toolbar:inline`,children:h}),t[9]=h,t[10]=m,t[11]=g,t[12]=W):W=t[12];let G;t[13]!==d||t[14]!==k||t[15]!==_||t[16]!==A||t[17]!==j?(G=_?(0,E.jsxs)(u,{children:[(0,E.jsx)(c,{asChild:!0,children:(0,E.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1`,children:[(0,E.jsx)(`label`,{htmlFor:`skill-auto-update-switch`,className:`hidden cursor-pointer @xl/toolbar:inline`,children:(0,E.jsx)(r,{id:`2M0JF6`})}),(0,E.jsx)(v,{id:`skill-auto-update-switch`,checked:k&&!A,disabled:A,onCheckedChange:e=>void j(e===!0),"aria-label":d({id:`o9fPtM`}),className:`scale-75`})]})}),(0,E.jsx)(l,{side:`bottom`,children:A?(0,E.jsx)(r,{id:`vy_VIN`}):k?(0,E.jsx)(r,{id:`vGQxBT`}):(0,E.jsx)(r,{id:`9p_QBN`})})]}):null,t[13]=d,t[14]=k,t[15]=_,t[16]=A,t[17]=j,t[18]=G):G=t[18];let K;t[19]===O?K=t[20]:(K=O?(0,E.jsxs)(u,{children:[(0,E.jsx)(c,{asChild:!0,children:(0,E.jsx)(`span`,{className:`shrink-0 rounded-sm bg-amber-500/15 px-1.5 py-0.5 font-medium text-[11px] text-amber-700 dark:text-amber-400`,children:(0,E.jsx)(r,{id:`tgWuMB`})})}),(0,E.jsx)(l,{side:`bottom`,children:(0,E.jsx)(r,{id:`s0Iold`})})]}):null,t[19]=O,t[20]=K);let q;t[21]!==d||t[22]!==_||t[23]!==O||t[24]!==P||t[25]!==I||t[26]!==M||t[27]!==L?(q=O&&_&&M?(0,E.jsxs)(u,{children:[(0,E.jsx)(s,{variant:`ghost`,size:`sm`,onClick:()=>void I(),disabled:L||P,"aria-label":d({id:`VxLvKE`}),className:`shrink-0 gap-1 text-muted-foreground px-2 text-xs hover:text-foreground`,asChild:!0,children:(0,E.jsxs)(c,{children:[(0,E.jsx)(x,{className:o(`size-3`,L&&`animate-spin`),"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`hidden @xl/toolbar:inline`,children:L?(0,E.jsx)(r,{id:`fIJtam`}):(0,E.jsx)(r,{id:`jJdwCB`})})]})}),(0,E.jsx)(l,{side:`bottom`,children:(0,E.jsx)(r,{id:`XSb9HS`})})]}):null,t[21]=d,t[22]=_,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]!==d||t[30]!==_||t[31]!==V||t[32]!==P||t[33]!==L||t[34]!==C?(J=_&&C?(0,E.jsxs)(u,{children:[(0,E.jsx)(s,{variant:`ghost`,size:`sm`,onClick:()=>void V(),disabled:P||L,"aria-label":d({id:`GidGkh`}),className:`shrink-0 gap-1 text-muted-foreground px-2 text-xs hover:text-foreground`,asChild:!0,children:(0,E.jsxs)(c,{children:[(0,E.jsx)(b,{className:o(`size-3`,P&&`animate-spin`),"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`hidden @xl/toolbar:inline`,children:P?(0,E.jsx)(r,{id:`JL3si7`}):(0,E.jsx)(r,{id:`EkH9pt`})})]})}),(0,E.jsx)(l,{side:`bottom`,children:(0,E.jsx)(r,{id:`GidGkh`})})]}):null,t[29]=d,t[30]=_,t[31]=V,t[32]=P,t[33]=L,t[34]=C,t[35]=J):J=t[35];let Y;t[36]!==R||t[37]!==a||t[38]!==U||t[39]!==P?(Y=R?(0,E.jsx)(D,{open:!0,onOpenChange:e=>{e||z(null)},skillName:a,localBody:R.localBody,upstreamBody:R.upstreamBody,applying:P,onTakeUpstream:()=>void U()}):null,t[36]=R,t[37]=a,t[38]=U,t[39]=P,t[40]=Y):Y=t[40];let X;return t[41]!==W||t[42]!==G||t[43]!==K||t[44]!==q||t[45]!==J||t[46]!==Y?(X=(0,E.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-muted-foreground text-xs`,children:[W,G,K,q,J,Y]}),t[41]=W,t[42]=G,t[43]=K,t[44]=q,t[45]=J,t[46]=Y,t[47]=X):X=t[47],X}export{O as SkillOriginInline};
|
package/dist/public/assets/{SkillToolbarControls-DF0m8f6g.js → SkillToolbarControls-CaHitAH1.js}
RENAMED
|
@@ -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{c as s,l as c,r as l}from"./ChangedOutsideBadge-
|
|
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{c as s,l as c,r as l}from"./ChangedOutsideBadge-B4qPknqp.js";import{t as u}from"./button-RQ5o7P7w.js";import{a as d,c as f,l as p,m,o as h,r as g,t as _,u as v}from"./dropdown-menu-K4eCFwQy.js";import{a as y,i as b,n as x,o as S,r as C,s as w,t as T}from"./select-BjNoD_FX.js";import{a as E,d as D,h as O,i as k,m as A,p as j}from"./skill-actions-BIlEExO7.js";import{t as M}from"./chevron-down-DmoBYxyq.js";import{t as N}from"./list-plus-ByOuGBSE.js";import{f as P,i as F,t as I}from"./skill-scope-BpzNeizS.js";import{t as L}from"./use-skills-CFPPlRb6.js";var R=a(),z=e(n(),1),B=t();function V(e){let t=(0,R.c)(52),{scope:n,name:a}=e,{_:c}=i(),d=L(),f=k(),p;t[0]!==a||t[1]!==n||t[2]!==d.data||t[3]!==d.status?(p=d.status===`ready`?d.data.find(e=>e.scope===n&&e.name===a):void 0,t[0]=a,t[1]=n,t[2]=d.data,t[3]=d.status,t[4]=p):p=t[4];let h=p,v;t[5]!==h||t[6]!==a||t[7]!==n?(v=h??{scope:n,name:a,path:a,description:``,installed:!1,hosts:[]},t[5]=h,t[6]=a,t[7]=n,t[8]=v):v=t[8];let y=v,[b,x]=(0,z.useState)(!1),S=O(y,f),{installed:C,installing:w,hostSet:T}=S,E=h===void 0&&!C,D;t[9]!==h||t[10]!==T?(D=h?F(h,[...T]):[],t[9]=h,t[10]=T,t[11]=D):D=t[11];let N=D,P;t[12]!==f||t[13]!==y?(P=()=>f.requestFileCreate(y),t[12]=f,t[13]=y,t[14]=P):P=t[14];let I;t[15]===c?I=t[16]:(I=c({id:`leF0i_`}),t[15]=c,t[16]=I);let V;t[17]===c?V=t[18]:(V=c({id:`leF0i_`}),t[17]=c,t[18]=V);let H;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,B.jsx)(s,{className:`size-4`,"aria-hidden":!0}),t[19]=H):H=t[19];let U;t[20]!==P||t[21]!==I||t[22]!==V?(U=(0,B.jsx)(u,{variant:`outline`,size:`icon-sm`,className:`shrink-0 text-muted-foreground`,onClick:P,title:I,"aria-label":V,"data-testid":`skill-editor-new-file`,children:H}),t[20]=P,t[21]=I,t[22]=V,t[23]=U):U=t[23];let W=E?`resolving`:`installed`,G=E?`border-border bg-muted/50 text-muted-foreground`:`border-primary/50 bg-primary/5 text-primary hover:bg-primary/10 hover:text-primary aria-expanded:bg-primary/10 aria-expanded:text-primary`,K;t[24]===G?K=t[25]:(K=o(`h-7 shrink-0 gap-1 rounded-lg border px-2 font-normal text-xs shadow-xs font-mono uppercase`,G),t[24]=G,t[25]=K);let q;t[26]!==N||t[27]!==w||t[28]!==E?(q=w?(0,B.jsx)(r,{id:`b4itZn`}):E?(0,B.jsx)(r,{id:`iKvAeG`}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(r,{id:`eQkgKV`}),(0,B.jsx)(l,{hosts:N,className:`text-muted-foreground`})]}),t[26]=N,t[27]=w,t[28]=E,t[29]=q):q=t[29];let J;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,B.jsx)(M,{className:`size-4 shrink-0 opacity-50`,"aria-hidden":!0}),t[30]=J):J=t[30];let Y;t[31]!==w||t[32]!==K||t[33]!==q||t[34]!==W?(Y=(0,B.jsx)(m,{asChild:!0,children:(0,B.jsxs)(u,{variant:`outline`,size:`sm`,disabled:w,"data-testid":`skill-install-menu-trigger`,"data-state":W,className:K,children:[q,J]})}),t[31]=w,t[32]=K,t[33]=q,t[34]=W,t[35]=Y):Y=t[35];let X;t[36]!==f||t[37]!==y?(X=e=>f.requestForkResolve(y,e),t[36]=f,t[37]=y,t[38]=X):X=t[38];let Z;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(Z=()=>x(!1),t[39]=Z):Z=t[39];let Q;t[40]!==y||t[41]!==X||t[42]!==S?(Q=(0,B.jsx)(g,{align:`end`,className:j,children:(0,B.jsx)(A,{toggles:S,skill:y,onResolveFork:X,onRunStart:Z})}),t[40]=y,t[41]=X,t[42]=S,t[43]=Q):Q=t[43];let $;t[44]!==b||t[45]!==Y||t[46]!==Q?($=(0,B.jsxs)(_,{open:b,onOpenChange:x,children:[Y,Q]}),t[44]=b,t[45]=Y,t[46]=Q,t[47]=$):$=t[47];let ee;return t[48]!==f.dialogs||t[49]!==$||t[50]!==U?(ee=(0,B.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[U,$,f.dialogs]}),t[48]=f.dialogs,t[49]=$,t[50]=U,t[51]=ee):ee=t[51],ee}function H(e){let t=(0,R.c)(21),{value:n,onRequestMove:a,disabled:s,triggerClassName:c}=e,{_:l}=i(),u=P(),d;t[0]===a?d=t[1]:(d=e=>a(e),t[0]=a,t[1]=d);let f;t[2]===l?f=t[3]:(f=l({id:`oCHfGC`}),t[2]=l,t[3]=f);let p;t[4]===c?p=t[5]:(p=o(`w-auto gap-1 text-xs font-mono uppercase`,c),t[4]=c,t[5]=p);let m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,B.jsx)(w,{}),t[6]=m):m=t[6];let h;t[7]!==f||t[8]!==p?(h=(0,B.jsx)(S,{size:`sm`,"aria-label":f,"data-testid":`skill-level-select`,className:p,children:m}),t[7]=f,t[8]=p,t[9]=h):h=t[9];let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,B.jsx)(y,{children:(0,B.jsx)(r,{id:`oCHfGC`})}),t[10]=g):g=t[10];let _;t[11]===u?_=t[12]:(_=I.map(e=>(0,B.jsx)(b,{value:e,children:u[e]},e)),t[11]=u,t[12]=_);let v;t[13]===_?v=t[14]:(v=(0,B.jsx)(x,{align:`end`,children:(0,B.jsxs)(C,{children:[g,_]})}),t[13]=_,t[14]=v);let E;return t[15]!==s||t[16]!==d||t[17]!==h||t[18]!==v||t[19]!==n?(E=(0,B.jsxs)(T,{value:n,onValueChange:d,disabled:s,children:[h,v]}),t[15]=s,t[16]=d,t[17]=h,t[18]=v,t[19]=n,t[20]=E):E=t[20],E}function U(e){let t=(0,R.c)(12),{scope:n,name:r}=e,[i,a]=(0,z.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,B.jsx)(E,{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 W(e){let t=(0,R.c)(45),{scope:n,name:a,showAddPropertyButton:o,onAddProperty:s,problemCount:l,problemMessages:y}=e,{_:b}=i(),x=P(),S;t[0]!==a||t[1]!==n?(S={scope:n,name:a},t[0]=a,t[1]=n,t[2]=S):S=t[2];let C=U(S),w;t[3]!==C.requestMove||t[4]!==n?(w=(0,B.jsx)(H,{value:n,onRequestMove:C.requestMove,triggerClassName:`hidden @xl/toolbar:flex`}),t[3]=C.requestMove,t[4]=n,t[5]=w):w=t[5];let T;t[6]!==a||t[7]!==n?(T=(0,B.jsx)(V,{scope:n,name:a}),t[6]=a,t[7]=n,t[8]=T):T=t[8];let E;t[9]!==w||t[10]!==T?(E=(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[w,T]}),t[9]=w,t[10]=T,t[11]=E):E=t[11];let O;t[12]!==s||t[13]!==l||t[14]!==y||t[15]!==o?(O=o?(0,B.jsx)(D,{onAddProperty:s,problemCount:l,problemMessages:y,className:`hidden @xl/toolbar:inline-flex`}):null,t[12]=s,t[13]=l,t[14]=y,t[15]=o,t[16]=O):O=t[16];let k;t[17]===b?k=t[18]:(k=b({id:`Yzs3QX`}),t[17]=b,t[18]=k);let A;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,B.jsx)(c,{className:`size-4`,"aria-hidden":!0}),t[19]=A):A=t[19];let j;t[20]===k?j=t[21]:(j=(0,B.jsx)(m,{asChild:!0,children:(0,B.jsx)(u,{variant:`ghost`,size:`icon`,"aria-label":k,"data-testid":`skill-toolbar-overflow`,className:`@xl/toolbar:hidden`,children:A})}),t[20]=k,t[21]=j);let M;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,B.jsx)(h,{children:(0,B.jsx)(r,{id:`oCHfGC`})}),t[22]=M):M=t[22];let F;t[23]===C?F=t[24]:(F=e=>C.requestMove(e),t[23]=C,t[24]=F);let L;t[25]===x?L=t[26]:(L=I.map(e=>(0,B.jsx)(p,{value:e,children:x[e]},e)),t[25]=x,t[26]=L);let z;t[27]!==n||t[28]!==F||t[29]!==L?(z=(0,B.jsx)(f,{value:n,onValueChange:F,children:L}),t[27]=n,t[28]=F,t[29]=L,t[30]=z):z=t[30];let W;t[31]!==s||t[32]!==o?(W=o?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(v,{}),(0,B.jsxs)(d,{onSelect:s,children:[(0,B.jsx)(N,{}),(0,B.jsx)(r,{id:`81H_23`})]})]}):null,t[31]=s,t[32]=o,t[33]=W):W=t[33];let G;t[34]!==z||t[35]!==W?(G=(0,B.jsxs)(g,{align:`end`,className:`min-w-44`,children:[M,z,W]}),t[34]=z,t[35]=W,t[36]=G):G=t[36];let K;t[37]!==G||t[38]!==j?(K=(0,B.jsxs)(_,{children:[j,G]}),t[37]=G,t[38]=j,t[39]=K):K=t[39];let q;return t[40]!==C.dialog||t[41]!==K||t[42]!==E||t[43]!==O?(q=(0,B.jsxs)(B.Fragment,{children:[E,O,K,C.dialog]}),t[40]=C.dialog,t[41]=K,t[42]=E,t[43]=O,t[44]=q):q=t[44],q}export{W as SkillToolbarControls};
|
package/dist/public/assets/{SlidesToolbarControls-DJXDoZdd.js → SlidesToolbarControls-qIPApX9s.js}
RENAMED
|
@@ -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-RQ5o7P7w.js";import{i as s,n as c,t as l}from"./tooltip-x7BNUa3s.js";import{
|
|
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-RQ5o7P7w.js";import{i as s,n as c,t as l}from"./tooltip-x7BNUa3s.js";import{cn as u}from"./dist-D6d8jhW_2.js";import{t as d}from"./trace-api-DH580DYm.js";import{n as f}from"./dist-Bkx5dDHT2.js";import{n as p,t as m}from"./workspace-paths-C2pS_Pbn.js";import{t as h}from"./use-workspace-ow-NJpFl.js";import{t as g}from"./createLucideIcon-6iYxif1u.js";var _=g(`presentation`,[[`path`,{d:`M2 3h20`,key:`91anmk`}],[`path`,{d:`M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3`,key:`2k9sn8`}],[`path`,{d:`m7 21 5-5 5 5`,key:`bip4we`}]]),v=e(n(),1),y=a(),b=`open-knowledge-app`;function x(e){try{d.getTracer(b).startSpan(e).end()}catch(e){console.warn(`[slides-telemetry] span emit failed:`,e instanceof Error?e:String(e))}}function S(){x(`ok.slides.opened`)}function C(e,t){return e[t]===!0}function w(e,t){let n=(0,y.c)(7),r;n[0]!==t||n[1]!==e?(r=()=>{let n=u(e),r=C(n.current().map,t);return n.dispose(),r},n[0]=t,n[1]=e,n[2]=r):r=n[2];let[i,a]=(0,v.useState)(r),o,s;return n[3]!==t||n[4]!==e?(o=()=>{let n=u(e);a(C(n.current().map,t));let r=n.subscribe(e=>{a(C(e.map,t))});return()=>{r(),n.dispose()}},s=[e,t],n[3]=t,n[4]=e,n[5]=o,n[6]=s):(o=n[5],s=n[6]),(0,v.useEffect)(o,s),i}var T=t();function E(e){let t=(0,y.c)(3),[n,r]=(0,v.useState)(`pending`),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e)return;let t=!0,n=0,i=!1,a=()=>{n=Date.now();let e=window.okDesktop?.slides;if(e==null){r(`unavailable`);return}e.status().then(e=>{t&&(r(e.available?`available`:`unavailable`),e.available&&(i=!0))}).catch(e=>{console.warn(`[slides] availability probe failed:`,e instanceof Error?e:String(e)),t&&r(`unavailable`)})},o=()=>{i||Date.now()-n<1e4||a()};return a(),window.addEventListener(`focus`,o),()=>{t=!1,window.removeEventListener(`focus`,o)}},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,v.useEffect)(i,a),n}function D(e){let t=(0,y.c)(13),{provider:n,docName:a}=e,{_:u}=i(),d=w(n,`slides`),g=E(d),v=h();if(!d||g!==`available`)return null;let b;t[0]!==u||t[1]!==a||t[2]!==v?(b=async function(){let e=window.okDesktop?.slides;if(e==null||v==null)return;S();let t=p(v.contentDir,m(a),v.pathSeparator);try{let n=await e.open(t);if(!n.ok){let e;bb36:switch(n.reason){case`timeout`:e=u({id:`NeY1Np`});break bb36;case`exited-early`:e=u({id:`Lm3r51`});break bb36;case`unsupported-server`:e=u({id:`T_j5G0`});break bb36;case`spawn-error`:e=u({id:`TBfy1C`});break bb36;case`not-available`:case`invalid-path`:e=u({id:`X59Fx2`});break bb36;default:e=u({id:`X59Fx2`})}f.error(e)}}catch(e){let t=e;console.warn(`[slides] open dispatch failed:`,t instanceof Error?t:String(t)),f.error(u({id:`X59Fx2`}))}},t[0]=u,t[1]=a,t[2]=v,t[3]=b):b=t[3];let x=b,C;t[4]===u?C=t[5]:(C=u({id:`w52SKa`}),t[4]=u,t[5]=C);let D;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,T.jsx)(s,{children:(0,T.jsx)(_,{"aria-hidden":!0})}),t[6]=D):D=t[6];let O;t[7]!==x||t[8]!==C?(O=(0,T.jsx)(o,{variant:`ghost`,size:`icon`,onClick:x,"aria-label":C,"data-testid":`slides-toolbar-action`,asChild:!0,children:D}),t[7]=x,t[8]=C,t[9]=O):O=t[9];let k;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,T.jsx)(c,{side:`bottom`,children:(0,T.jsx)(r,{id:`w52SKa`})}),t[10]=k):k=t[10];let A;return t[11]===O?A=t[12]:(A=(0,T.jsxs)(l,{children:[O,k]}),t[11]=O,t[12]=A),A}export{D as SlidesToolbarControls};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{B as n,Bt as r,H as i,Ht as a,R as o,St as s,V as c,_t as l,at as u,k as ee,lt as d,rt as te,ut as f}from"./DocumentContext-CNSuvcIw.js";import{t as p}from"./react-f2sANaYj.js";import{n as m}from"./dist-PQ5KMVDh.js";import{t as h}from"./compiler-runtime-BfE3aGVn.js";import{T as g,a as ne,i as re,o as ie}from"./CodeMirrorPropInput-CQzidEcb.js";import{Ba as ae,Ka as _,T as oe,no as v,xi as se,zr as y}from"./dist-D6d8jhW_2.js";import{h as ce}from"./use-apply-config-color-theme-DA6djYET.js";import{O as le,P as ue,T as de,c as fe,j as pe,k as me,n as he,r as ge,x as b,y as _e}from"./typing-burst-detector-CWZPjxCH.js";import{f as x,g as S}from"./doc-paths-B610Q5eD.js";import{J as C}from"./navigation-targets-Ch69zMGC.js";import"./config-provider-Dz54I9YH.js";import{Dt as w,E as T,Et as E,Ft as D,It as O,J as k,Nt as A,Ot as ve,P as j,Q as M,X as N,_ as P,ct as F,dt as I,ft as L,ht as R,l as z,lt as B,mt as ye,nt as V,rt as H,st as U,tt as W,y as G}from"./dist-B0Beym3_.js";import{a as be,n as K}from"./cm-theme-ChFGbVCe.js";import{i as q,n as J,o as Y,r as X}from"./dist-Bx9oFJRu.js";import{o as xe,r as Se}from"./selection-context-BPfggRPr.js";import{l as Ce}from"./lint-config-client-DTg6epjB.js";import{a as we,i as Te,n as Ee,o as De,r as Oe,t as ke}from"./dist-BOhFaMG0.js";import{n as Ae,t as je}from"./src-DFsYGwxw.js";var Z=e(p(),1),Me=h();function Ne(){let e=i();return e===null?null:new Set(e.keys())}function Pe(e,t,n){let r=[],i=j(e);if(n!=null){let a=[];for(let{from:e,to:n}of t)i.iterate({from:e,to:n,enter(e){if(e.name===`InlineCode`||e.name===`FencedCode`)return a.push({from:e.from,to:e.to}),!1}});let o=(e,t)=>a.some(n=>e>=n.from&&t<=n.to);for(let{from:i,to:a}of t){let t=e.doc.sliceString(i,a);_.lastIndex=0;for(let e=_.exec(t);e!==null;e=_.exec(t)){let t=e[2];if(!v(t))continue;let a=i+(e.index??0)+e[1].length,s=a+t.length+1;o(a,s)||r.push(k.mark({class:n.has(t)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":t}}).range(a,s))}}}for(let{from:a,to:s}of t)i.iterate({from:a,to:s,enter(t){if(t.name!==`InlineCode`)return;let i=e.doc.sliceString(t.from,t.to),a=i.length-i.replace(/^`+/,``).length,s=i.length-i.replace(/`+$/,``).length,c=i.slice(a,i.length-s),l=/^\/([a-z0-9][a-z0-9-]{1,63})$/.exec(c)?.[1];if(l!==void 0&&v(l)&&n!=null)return r.push(k.mark({class:n.has(l)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":l}}).range(t.from+a,t.to-s)),!1;let u=o.exec(c);if(u)return r.push(k.mark({class:`cm-skill-path-link`,attributes:{"data-skill-path":u[1]}}).range(t.from+a,t.to-s)),!1}});return r.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),k.set(r)}function Fe(e){let t=c(e);return t===null?[]:[M.fromClass(class{decorations;constructor(e){this.decorations=Pe(e.state,e.visibleRanges,Ne())}update(e){(e.docChanged||e.viewportChanged||j(e.startState)!==j(e.state))&&(this.decorations=Pe(e.view.state,e.view.visibleRanges,Ne()))}},{decorations:e=>e.decorations}),N.domEventHandlers({mousedown(r){let a=r.target?.closest?.(`[data-skill-ref]`),o=a instanceof HTMLElement?a.dataset.skillRef:void 0;if(o!==void 0){r.preventDefault();let e=i()?.get(o);return window.location.hash=e===void 0?S():x(C({scope:e.scope,name:o,path:e.path})),!0}let s=r.target?.closest?.(`.cm-skill-path-link`),c=s instanceof HTMLElement?s.dataset.skillPath:void 0;return c===void 0?!1:(r.preventDefault(),window.location.hash=n(t,e,c),!0)}})]}var Ie=k.line({attributes:{dir:`auto`}});function Le(e){let t=new A;for(let n of e.visibleRanges)for(let r=n.from;r<=n.to;){let n=e.state.doc.lineAt(r);t.add(n.from,n.from,Ie),r=n.to+1}return t.finish()}var Re=M.fromClass(class{decorations;constructor(e){this.decorations=Le(e)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=Le(e.view))}},{decorations:e=>e.decorations}),ze=[N.perLineTextDirection.of(!0),Re];function Be(e,t){return e.enabled?[ke(),Oe(async n=>Ve(n.state.doc,await y(n.state.doc.toString(),e,t)),{delay:600})]:[]}function Q(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function Ve(e,t){let n=[];for(let r of t){let t=Q(e,r.range.start),i=Q(e,r.range.end),a={from:t,to:Math.max(i,t),severity:r.severity,message:r.message,source:`${r.source}/${r.code}`},o=He(r);o&&(a.actions=[o]),n.push(a)}return n}function He(e){let t=e.fixes;return!t||t.length===0?null:{name:`Fix`,apply(e){let n=e.state.doc;e.dispatch({changes:t.map(e=>({from:Q(n,e.range.start),to:Q(n,e.range.end),insert:e.newText})),userEvent:`input.complete`})}}}var Ue=[L(),F(),B(),P(),V(),H(),ve.allowMultipleSelections.of(!0),T(),z(),X(),J(),R(),W(),U(),Te(),I.of([...q,...K,...De,...G,...Y,...Ee])],We=k.mark({class:`cm-link-ref-broken`}),Ge=/^\s{0,3}\[([^\]]+)\]:\s/,Ke=/\[([^\]]*)\]\[([^\]]*)\]/g,qe=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function $(e,t){let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i];if(e<a.from)r=i-1;else if(e>=a.to)n=i+1;else return!0}return!1}function Je(e){let t=[];return j(e).iterate({enter(e){if(qe.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function Ye(e){let t=new Set,n=[],r=e.doc,i=Je(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if($(n.from,i))continue;let a=Ge.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!$(t.from,i)&&!Ge.test(t.text))for(Ke.lastIndex=0;;){let e=Ke.exec(t.text);if(!e)break;let r=t.from+e.index;if($(r,i))continue;let a=e[2]||e[1];n.push({from:r,to:r+e[0].length,label:a.toLowerCase()})}}let a=[];for(let e of n)t.has(e.label)||a.push(We.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),k.set(a)}var Xe=O.define({create(e){return Ye(e)},update(e,t){return t.docChanged?Ye(t.state):e},provide:e=>N.decorations.from(e)}),Ze=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,Qe=k.mark({class:`cm-del`}),$e=k.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),et=k.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function tt(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function nt(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!ae.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(ae.test(r.text))return{from:t.from,to:r.to}}return null}function rt(e,t){let n=[],r=j(e),i=nt(e),a=e=>i!==null&&e>=i.from&&e<=i.to;for(let{from:i,to:o}of t)r.iterate({from:i,to:o,enter(t){if(!a(t.from)){if(t.name===`Strikethrough`){let e=t.from,r=t.to,i=t.node.cursor();if(i.firstChild())do i.name===`StrikethroughMark`&&(i.from===t.from?e=i.to:r=i.from);while(i.nextSibling());return e<r&&n.push(Qe.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=Ze.exec(r.text),a=i?i[1].length:2,o=k.line({class:`cm-list-item`,attributes:{style:`--list-hang: ${a}ch`}});n.push(o.range(r.from));return}if(t.name===`FencedCode`){let r=e.doc.lineAt(t.from),i=e.doc.lineAt(t.to);for(let t=r.number+1;t<i.number;t++){let r=e.doc.line(t),i=tt(r.text),a=k.line({class:`cm-fenced-code-line`,attributes:{style:`--line-indent: ${i}`}});n.push(a.range(r.from))}return!1}if(t.name===`TableHeader`){let r=e.doc.lineAt(t.from);return n.push($e.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(et.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(et.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),k.set(n)}var it=class{decorations;constructor(e){this.decorations=rt(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||j(e.startState)!==j(e.state))&&(this.decorations=rt(e.view.state,e.view.visibleRanges))}},at=M.fromClass(it,{decorations:e=>e.decorations});function ot(){return[at,Xe]}var st=t(),ct=56,lt=D.define();function ut(e,t,n){let r=b(e.state.doc)[t.index];r&&s(n,()=>{e.dispatch({selection:w.cursor(r.from),effects:N.scrollIntoView(r.from,{y:`start`})}),e.focus()})}function dt(e,t,n,r){requestAnimationFrame(()=>{if(!n())return;let i=e.state.doc,a=Math.min(t.offset,i.length);s(r,()=>{e.dispatch({selection:w.cursor(a),effects:N.scrollIntoView(a,{y:`center`})}),e.focus()})})}function ft(e,t,n){let r=e.state.doc,i=Math.min(Math.max(t.line,1),r.lines),a=r.line(i),o=Math.min(a.from+Math.max(0,t.column-1),a.to);s(n,()=>{e.dispatch({selection:w.cursor(o),effects:N.scrollIntoView(o,{y:`start`})}),e.focus()})}function pt(e){let t=(0,Me.c)(50),{docName:n,ytext:i,provider:o,placeholder:s,isSourceModeActive:c}=e,p=(0,Z.useRef)(null),h=(0,Z.useRef)(null),[g,ae]=(0,Z.useState)(null);if(g)throw g;let{resolvedTheme:_}=m(),{merged:v}=ce(),y=(0,Z.useRef)(c),b=v?.editor?.wordWrap??!0,{data:x}=Ce(n),S;t[0]!==x?.effective||t[1]!==v?(S=x?.effective??(v?.contentRules?se(v.contentRules):oe),t[0]=x?.effective,t[1]=v,t[2]=S):S=t[2];let C=S,w;t[3]===C?w=t[4]:(w=JSON.stringify(C),t[3]=C,t[4]=w);let T=w,D,O;t[5]===c?(D=t[6],O=t[7]):(D=()=>{y.current=c},O=[c],t[5]=c,t[6]=D,t[7]=O),(0,Z.useEffect)(D,O);let k=(0,Z.useRef)(null),A;t[8]!==n||t[9]!==C||t[10]!==s||t[11]!==o||t[12]!==_||t[13]!==b||t[14]!==i?(A=()=>{let e=p.current;if(!e)return;let t=o.configuration.name??``,c,m=ht;try{c=d({docName:t,container:e,sizeStats:{viewCount:0,bytes:i.length},factory:e=>{let r=null,a=ee({ydoc:o.document,ytext:i,docName:t}),c=new E,d=new E,f=new E,p=new E,h=new N({state:ve.create({doc:i.toString(),extensions:[Ue,ze,we({scrollToMatch:e=>l(t)?N.scrollIntoView(e,{y:`start`}):lt.of(null)}),I.of([be]),je(i,o.awareness),I.of(Ae),...re({themeCompartment:c,resolvedTheme:_,ydoc:o.document,wordWrapCompartment:d,wordWrap:b,currentDocName:t}),ot(),Fe(t),ue(),p.of(Be(C,n)),a,N.updateListener.of(e=>{te(e)&&u(t)}),N.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(r!==null&&clearTimeout(r),r=setTimeout(()=>{r=null,he(t,`source`,ge(e.view)),Se(t,`source`,xe(e.view,t))},120))}),f.of(ye(s??``)),N.theme({"&":{height:`100%`}}),N.scrollMargins.of(mt)]}),parent:e});he(t,`source`,ge(h)),Se(t,`source`,xe(h,t));let g=h.contentDOM;return g.addEventListener(`keydown`,m),g.addEventListener(`paste`,m),g.addEventListener(`drop`,m),g.addEventListener(`cut`,m),{view:h,ydoc:o.document,ytext:i,provider:o,themeCompartment:c,wordWrapCompartment:d,placeholderCompartment:f,lintCompartment:p}}}),k.current=c,h.current=c.view,r(n,c.view)}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),k.current=null,h.current=null,ae(t instanceof Error?t:Error(String(t)))}return()=>{let e=k.current;e&&(f(e),a(n,e.view)),k.current=null,h.current=null}},t[8]=n,t[9]=C,t[10]=s,t[11]=o,t[12]=_,t[13]=b,t[14]=i,t[15]=A):A=t[15];let j;t[16]!==o||t[17]!==i?(j=[i,o],t[16]=o,t[17]=i,t[18]=j):j=t[18],(0,Z.useEffect)(A,j);let M,P;t[19]===n?(M=t[20],P=t[21]):(M=()=>{},P=[n],t[19]=n,t[20]=M,t[21]=P),(0,Z.useEffect)(M,P);let F,L;t[22]===_?(F=t[23],L=t[24]):(L=()=>{let e=k.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(_===`dark`?ne:ie)})},F=[_],t[22]=_,t[23]=F,t[24]=L),(0,Z.useEffect)(L,F);let R,z;t[25]===b?(R=t[26],z=t[27]):(R=()=>{let e=k.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(b?N.lineWrapping:[])})},z=[b],t[25]=b,t[26]=R,t[27]=z),(0,Z.useEffect)(R,z);let B,V;t[28]===s?(B=t[29],V=t[30]):(B=()=>{let e=k.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(ye(s??``))})},V=[s],t[28]=s,t[29]=B,t[30]=V),(0,Z.useEffect)(B,V);let H;t[31]!==n||t[32]!==C?(H=()=>{let e=k.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(Be(C,n))})},t[31]=n,t[32]=C,t[33]=H):H=t[33];let U;t[34]===T?U=t[35]:(U=[T],t[34]=T,t[35]=U),(0,Z.useEffect)(H,U);let W,G;t[36]!==n||t[37]!==c?(W=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||t.mode!==`source`||!c)return;let r=h.current;r&&(ut(r,t,n),le(n))};return window.addEventListener(_e,e),()=>window.removeEventListener(_e,e)},G=[n,c],t[36]=n,t[37]=c,t[38]=W,t[39]=G):(W=t[38],G=t[39]),(0,Z.useEffect)(W,G);let K,q;t[40]!==n||t[41]!==c?(K=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||!c)return;let r=h.current;r&&(ft(r,t,n),le(n))};return window.addEventListener(fe,e),()=>window.removeEventListener(fe,e)},q=[n,c],t[40]=n,t[41]=c,t[42]=K,t[43]=q):(K=t[42],q=t[43]),(0,Z.useEffect)(K,q);let J,Y;t[44]!==n||t[45]!==c||t[46]!==o?(J=()=>{if(!c)return;let e=h.current;if(!e)return;let t=pe(n);if(!t)return;if(t.kind!==`selection-offset`){me(n),t.kind===`outline`?ut(e,t.detail,n):t.kind===`lint`?ft(e,t.detail,n):t.kind===`raw-mdx`&&dt(e,t.detail,()=>y.current,n);return}let r=!1,i=null;return queueMicrotask(()=>{if(r)return;let t=pe(n);t?.kind===`selection-offset`&&(i=de({view:e,docName:n,navigation:t,ydoc:o.document,transition:{from:`wysiwyg`,to:`source`}}),i&&me(n))}),()=>{r=!0,i?.cancel(`mode-flip`)}},Y=[n,c,o],t[44]=n,t[45]=c,t[46]=o,t[47]=J,t[48]=Y):(J=t[47],Y=t[48]),(0,Z.useEffect)(J,Y);let X;return t[49]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,st.jsx)(`div`,{ref:p,className:`source-editor h-full pb-3`}),t[49]=X):X=t[49],X}function mt(){return{top:ct}}function ht(){return g()}export{pt as SourceEditor,dt as applyRawMdxNavigation};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{r}from"./dist-Nvb76hAm.js";import{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{t as s}from"./button-RQ5o7P7w.js";import{
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{r}from"./dist-Nvb76hAm.js";import{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{t as s}from"./button-RQ5o7P7w.js";import{Wt as c,_i as l,dn as u,gi as d,hn as f}from"./dist-D6d8jhW_2.js";import{n as p}from"./dist-Bkx5dDHT2.js";import{m}from"./use-apply-config-color-theme-DA6djYET.js";import{t as h}from"./x-BopM5CF8.js";import{f as g,p as _,u as v}from"./doc-paths-B610Q5eD.js";import{Q as y}from"./navigation-targets-Ch69zMGC.js";import{f as b,h as x}from"./file-tree-adapter-Bmhiw8ek.js";import{t as ee}from"./use-live-xterm-theme-Br4z4FVs.js";import{r as te}from"./terminal-command-events-mSM3ArSl.js";var S=a(),C=2,w=1,T=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(C,Math.floor(u/e.css.cell.width)),rows:Math.max(w,Math.floor(l/e.css.cell.height))}}},E=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],D=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],O;function ne(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var re=class{constructor(){if(this.version=`6`,!O){O=new Uint8Array(65536),O.fill(1),O[0]=0,O.fill(0,1,32),O.fill(0,127,160),O.fill(2,4352,4448),O[9001]=2,O[9002]=2,O.fill(2,11904,42192),O[12351]=1,O.fill(2,44032,55204),O.fill(2,63744,64256),O.fill(2,65040,65050),O.fill(2,65072,65136),O.fill(2,65280,65377),O.fill(2,65504,65511);for(let e=0;e<E.length;++e)O.fill(0,E[e][0],E[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?O[e]:ne(e,D)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=Ze.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return Ze.createPropertyValue(0,n,r)}},k=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?M.isErrorNoTelemetry(e)?new M(e.message+`
|
|
2
2
|
|
|
3
3
|
`+e.stack):Error(e.message+`
|
|
4
4
|
|
|
@@ -143,4 +143,4 @@ ${s.join(`
|
|
|
143
143
|
`))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(G(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(V(()=>{Xp?this._debugRootContainer.remove():this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<Yp+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
144
144
|
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===Yp+1&&(this._liveRegion.textContent+=no.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(!(!a||!o)){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};Zp=z([B(1,Ao),B(2,zo),B(3,Vo)],Zp);var Qp=class extends H{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new W),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new W),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(V(()=>{bs(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(G(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(G(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(G(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(G(this._element,`mouseup`,this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.classList.contains(`xterm-hover`))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,t=>{if(this._isMouseOut)return;let i=t?.map(e=>({link:e}));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)(!this._activeProviderReplies.has(t)||this._activeProviderReplies.get(t))&&(i=!0);if(!i&&r){let e=r.find(e=>this._linkAtPosition(e.link,t));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,t));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&$p(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,bs(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};Qp=z([B(1,Bo),B(2,Vo),B(3,Eo),B(4,Go)],Qp);function $p(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var em=class extends zp{constructor(e={}){super(e),this._linkifier=this._register(new ws),this.browser=pd,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new ws),this._onCursorMove=this._register(new W),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new W),this.onKey=this._onKey.event,this._onRender=this._register(new W),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new W),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new W),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new W),this.onBell=this._onBell.event,this._onFocus=this._register(new W),this._onBlur=this._register(new W),this._onA11yCharEmitter=this._register(new W),this._onA11yTabEmitter=this._register(new W),this._onWillOpen=this._register(new W),this._setup(),this._decorationService=this._instantiationService.createInstance(Gp),this._instantiationService.setService(Fo,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(cd),this._instantiationService.setService(Go,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Io)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(Ns.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Ns.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Ns.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Ns.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(V(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=J.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${K.ESC}]${n};${Cp(r)}${Tu.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=ju.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=ju.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Zp,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(K.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(K.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this._register(G(this.element,`copy`,e=>{this.hasSelection()&&ao(e,this._selectionService)}));let e=e=>oo(e,this.textarea,this.coreService,this.optionsService);this._register(G(this.textarea,`paste`,e)),this._register(G(this.element,`paste`,e)),_d?this._register(G(this.element,`mousedown`,e=>{e.button===2&&lo(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(G(this.element,`contextmenu`,e=>{lo(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Td&&this._register(G(this.element,`auxclick`,e=>{e.button===1&&co(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(G(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(G(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(G(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(G(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register(G(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(G(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(G(this.textarea,`input`,e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this._register(G(this.screenElement,`mousemove`,e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement(`textarea`);this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,eo.get()),Ed||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange(`disableStdin`,()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(od,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(zo,this._coreBrowserService),this._register(G(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(G(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(nd,this._document,this._helperContainer),this._instantiationService.setService(Ro,this._charSizeService),this._themeService=this._instantiationService.createInstance(df),this._instantiationService.setService(Wo,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Lu),this._instantiationService.setService(Uo,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Md,this.rows,this.screenElement)),this._instantiationService.setService(Vo,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(Eu,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(dd),this._instantiationService.setService(Bo,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(Qp,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(_u,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(ef,this.element,this.screenElement,r)),this._instantiationService.setService(Ho,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(Ns.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(vu,this.screenElement)),this._register(G(this.element,`mousedown`,e=>this._selectionService.handleMouseDown(e))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add(`enable-mouse-events`)):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Zp,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Cu,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Cu,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(td,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=t.buttons&1?0:t.buttons&4?1:t.buttons&2?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&e._customWheelEventHandler(t)===!1)return!1;let n=t.deltaY;if(n===0||e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;i=n<0?0:1,r=4;break;default:return!1}return i===void 0||r===void 0||r>4?!1:e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this._register(this.coreMouseService.onProtocolChange(e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),this.element.classList.add(`enable-mouse-events`),this._selectionService.disable()):(this._logService.debug(`Unbinding from mouse events.`),this.element.classList.remove(`enable-mouse-events`),this._selectionService.enable()),e&8?r.mousemove||=(t.addEventListener(`mousemove`,i.mousemove),i.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),e&16?r.wheel||=(t.addEventListener(`wheel`,i.wheel,{passive:!1}),i.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),e&2?r.mouseup||=i.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),e&4?r.mousedrag||=i.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(G(t,`mousedown`,e=>{if(e.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(e)))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)})),this._register(G(t,`wheel`,t=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(t)===!1)return!1;if(!this.buffer.hasScrollback){if(t.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(t,!0);let n=K.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(t.deltaY<0?`A`:`B`);return this.coreService.triggerDataEvent(n,!0),this.cancel(t,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){so(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key===`Dead`||e.key===`AltGraph`)&&(this._unprocessedDeadKey=!0);let n=Vp(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===K.ETX||n.key===K.CR)&&(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(tm(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(yf));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent(K.ESC+`[I`):this.coreService.triggerDataEvent(K.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${K.ESC}[4;${t};${e}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${K.ESC}[6;${r};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function tm(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var nm=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw Error(`Could not dispose an addon that has not been loaded`);e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},rm=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new yo)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},im=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new rm(t)}getNullCell(){return new yo}},am=class extends H{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new W),this.onBufferChange=this._onBufferChange.event,this._normal=new im(this._core.buffers.normal,`normal`),this._alternate=new im(this._core.buffers.alt,`alternate`),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw Error(`Active buffer is neither normal nor alternate`)}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},om=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,n)=>t(e,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},sm=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},cm=[`cols`,`rows`],lm=0,um=class extends H{constructor(e){super(),this._core=this._register(new em(e)),this._addonManager=this._register(new nm),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(cm.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error(`You must set the allowProposedApi option to true to use proposed API`)}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||=new om(this._core),this._parser}get unicode(){return this._checkProposedApi(),new sm(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||=this._register(new am(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`;break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
145
145
|
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return eo.get()},set promptLabel(e){eo.set(e)},get tooMuchOutput(){return no.get()},set tooMuchOutput(e){no.set(e)}}}_verifyIntegers(...e){for(lm of e)if(lm===1/0||isNaN(lm)||lm%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(lm of e)if(lm&&(lm===1/0||isNaN(lm)||lm%1!=0||lm<0))throw Error(`This API only accepts positive integers`)}},dm=e(n(),1),$=t(),fm=`https://docs.claude.com/en/docs/claude-code`;function pm(e){return e.claude===`not-found`?`claude-missing`:e.claude===`present`&&e.mcp===`needs-rewire`?`mcp-needs-rewire`:null}function mm(e){let t=(0,S.c)(29),{readiness:n,bridge:i,onDismiss:a}=e,{_:o}=r(),c;t[0]===n?c=t[1]:(c=pm(n),t[0]=n,t[1]=c);let l=c;if(l===null)return null;let u=l===`claude-missing`,d;t[2]!==o||t[3]!==u?(d=o(u?{id:`dNM58w`}:{id:`_bth6g`}),t[2]=o,t[3]=u,t[4]=d):d=t[4];let f=d,m;t[5]!==o||t[6]!==u?(m=o(u?{id:`E1tG2u`}:{id:`gfohmY`}),t[5]=o,t[6]=u,t[7]=m):m=t[7];let g=m,_;t[8]!==o||t[9]!==i.shell||t[10]!==i.terminal||t[11]!==u||t[12]!==a?(_=function(){if(u){i.shell.openExternal(fm);return}i.terminal.rewireClaudeMcp().then(e=>{if(e.rewireError!=null){p.error(o({id:`cn1sLi`}));return}a()}).catch(e=>{console.warn(`[terminal] rewireClaudeMcp failed:`,e),p.error(o({id:`cn1sLi`}))})},t[8]=o,t[9]=i.shell,t[10]=i.terminal,t[11]=u,t[12]=a,t[13]=_):_=t[13];let v=_,y;t[14]===f?y=t[15]:(y=(0,$.jsx)(`p`,{className:`min-w-0 flex-1`,children:f}),t[14]=f,t[15]=y);let b;t[16]!==g||t[17]!==v?(b=(0,$.jsx)(s,{size:`sm`,variant:`secondary`,className:`shrink-0`,onClick:v,children:g}),t[16]=g,t[17]=v,t[18]=b):b=t[18];let x;t[19]===o?x=t[20]:(x=o({id:`1QfxQT`}),t[19]=o,t[20]=x);let ee;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(h,{"aria-hidden":`true`,className:`size-4`}),t[21]=ee):ee=t[21];let te;t[22]!==a||t[23]!==x?(te=(0,$.jsx)(s,{size:`icon`,variant:`ghost`,"aria-label":x,className:`size-6 shrink-0`,onClick:a,children:ee}),t[22]=a,t[23]=x,t[24]=te):te=t[24];let C;return t[25]!==y||t[26]!==b||t[27]!==te?(C=(0,$.jsxs)(`div`,{role:`status`,"data-testid":`terminal-readiness-banner`,className:`flex shrink-0 items-center gap-3 border-border border-b bg-muted px-3 py-2 text-foreground text-xs`,children:[y,b,te]}),t[25]=y,t[26]=b,t[27]=te,t[28]=C):C=t[28],C}function hm(e){let t=(0,S.c)(25),{cli:n,bridge:i,onDismiss:a}=e,{_:o}=r(),{bin:l,displayName:u,docsUrl:d}=c[n],f;t[0]!==o||t[1]!==l||t[2]!==u?(f=o({id:`rSoi6g`,values:{displayName:u,bin:l}}),t[0]=o,t[1]=l,t[2]=u,t[3]=f):f=t[3];let p;t[4]===f?p=t[5]:(p=(0,$.jsx)(`p`,{className:`min-w-0 flex-1`,children:f}),t[4]=f,t[5]=p);let m;t[6]!==i.shell||t[7]!==d?(m=()=>void i.shell.openExternal(d),t[6]=i.shell,t[7]=d,t[8]=m):m=t[8];let g;t[9]!==o||t[10]!==u?(g=o({id:`F0OA00`,values:{displayName:u}}),t[9]=o,t[10]=u,t[11]=g):g=t[11];let _;t[12]!==m||t[13]!==g?(_=(0,$.jsx)(s,{size:`sm`,variant:`secondary`,className:`shrink-0`,onClick:m,children:g}),t[12]=m,t[13]=g,t[14]=_):_=t[14];let v;t[15]===o?v=t[16]:(v=o({id:`1QfxQT`}),t[15]=o,t[16]=v);let y;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(h,{"aria-hidden":`true`,className:`size-4`}),t[17]=y):y=t[17];let b;t[18]!==a||t[19]!==v?(b=(0,$.jsx)(s,{size:`icon`,variant:`ghost`,"aria-label":v,className:`size-6 shrink-0`,onClick:a,children:y}),t[18]=a,t[19]=v,t[20]=b):b=t[20];let x;return t[21]!==p||t[22]!==_||t[23]!==b?(x=(0,$.jsxs)(`div`,{role:`status`,className:`flex shrink-0 items-center gap-3 border-border border-b bg-muted px-3 py-2 text-foreground text-xs`,children:[p,_,b]}),t[21]=p,t[22]=_,t[23]=b,t[24]=x):x=t[24],x}function gm(e){let t=(0,S.c)(20),{info:n,onRestart:i}=e,{_:a}=r(),o;if(n.error!=null){let e;t[0]===a?e=t[1]:(e=a({id:`uL_Wx8`}),t[0]=a,t[1]=e),o=e}else if(n.signal!=null&&n.signal!==0){let e;t[2]!==a||t[3]!==n.signal?(e=a({id:`ubMwcO`,values:{0:n.signal}}),t[2]=a,t[3]=n.signal,t[4]=e):e=t[4],o=e}else if(n.exitCode!==0){let e;t[5]!==a||t[6]!==n.exitCode?(e=a({id:`q4YJl_`,values:{0:n.exitCode}}),t[5]=a,t[6]=n.exitCode,t[7]=e):e=t[7],o=e}else{let e;t[8]===a?e=t[9]:(e=a({id:`AE7BY3`}),t[8]=a,t[9]=e),o=e}let c;t[10]===o?c=t[11]:(c=(0,$.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:o}),t[10]=o,t[11]=c);let l;t[12]===a?l=t[13]:(l=a({id:`BQKHuL`}),t[12]=a,t[13]=l);let u;t[14]!==i||t[15]!==l?(u=(0,$.jsx)(s,{size:`sm`,variant:`outline`,className:`uppercase font-mono`,onClick:i,children:l}),t[14]=i,t[15]=l,t[16]=u):u=t[16];let d;return t[17]!==c||t[18]!==u?(d=(0,$.jsxs)(`div`,{role:`alert`,className:`absolute inset-0 z-20 flex flex-col items-center justify-center gap-3 bg-background/90 dark:bg-transparent p-6 text-center`,children:[c,u]}),t[17]=c,t[18]=u,t[19]=d):d=t[19],d}function _m(e){let t=(0,S.c)(11),{reason:n,onClose:i}=e,{_:a}=r(),o;t[0]!==a||t[1]!==n?(o=a(n===`not-consented`?{id:`Khxcyu`}:{id:`fBHvBn`}),t[0]=a,t[1]=n,t[2]=o):o=t[2];let c=o,l;t[3]===c?l=t[4]:(l=(0,$.jsx)(`p`,{className:`max-w-sm text-sm`,children:c}),t[3]=c,t[4]=l);let u;t[5]!==a||t[6]!==i?(u=i?(0,$.jsx)(s,{size:`sm`,variant:`secondary`,onClick:i,children:a({id:`Iq8zdU`})}):null,t[5]=a,t[6]=i,t[7]=u):u=t[7];let d;return t[8]!==l||t[9]!==u?(d=(0,$.jsxs)(`div`,{role:`alert`,className:`absolute inset-0 z-20 flex flex-col items-center justify-center gap-3 bg-background/90 p-6 text-center text-foreground`,children:[l,u]}),t[8]=l,t[9]=u,t[10]=d):d=t[10],d}function vm(e,t){let n=km(e,t);return n===null?e.startsWith(`/`)?e===ym(t)?null:{kind:`external`,absPath:e}:null:{kind:`in-project`,relPath:n}}function ym(e){return e.replace(/\/+$/,``)}var bm=2e3,xm=/[^\s<>"'`|(){}[\]\0]+/g,Sm=/:\d+(?::\d+)?$/,Cm=/^[a-z][a-z0-9+.-]*:\/\//i,wm=/\.[A-Za-z0-9]+$/;function Tm(e){return wm.test(e)}function Em(e,t=10){if(e.length===0||e.length>bm)return[];let n=[];for(let r of e.matchAll(xm)){if(n.length>=t)break;let e=r[0],i=r.index;if(Cm.test(e))continue;let a=e.replace(/[.,;:!?]+$/,``),o=a.match(Sm);o&&(a=a.slice(0,o.index));let s=a.endsWith(`/`),c=s?a.slice(0,-1):a;if(!Om(c))continue;let l=i+c.length;n.push({path:c,startIndex:i,endIndex:l,trailingSlash:s})}return n}function Dm(e,t,n,r){let i=r>0?r:2**53-1,a=Math.max(e,t-1),o=e=>({x:e%i+1,y:n+Math.floor(e/i)});return{start:o(e),end:o(a)}}function Om(e){return e.length<2||e.startsWith(`~`)?!1:e.includes(`/`)?!0:wm.test(e)}function km(e,t){if(!e||!t)return null;let n=ym(t),r;if(e.startsWith(`/`)){if(e===n)return null;let t=`${n}/`;if(!e.startsWith(t))return null;r=e.slice(t.length)}else r=e.startsWith(`./`)?e.slice(2):e;let i=[];for(let e of r.split(`/`))if(!(e===``||e===`.`)){if(e===`..`)return null;i.push(e)}return i.length===0?null:i.join(`/`)}function Am(e,t,n){return t||n?.folderPaths.has(e)?`folder`:e.endsWith(`.md`)||e.endsWith(`.mdx`)||n?.pages.has(v(e))?`doc`:`asset`}function jm(e=300){let t=null;return(n,r)=>t!==null&&t.uri===n&&r-t.at<e?!0:(t={uri:n,at:r},!1)}function Mm(e,t,n){return n?t?n.folderPaths.has(e):n.pages.has(v(e))||n.assetPaths?.has(e)||n.filePaths?.has(e)?!0:n.folderPaths.has(e):!1}var Nm=1e3;function Pm(e){let t=e.maxLinksPerLine??10,n=new Map,r=!1,i=!1;async function a(t,i){let a=`${t}:${i}`,o=n.get(a);if(o!==void 0)return o;let s=!1;try{s=await e.checkTargetExists(t,i)===`exists`}catch(e){s=!1,r||(r=!0,console.warn(`[terminal] checkTargetExists probe failed; file-path links suppressed:`,e))}return n.size>=Nm&&n.clear(),n.set(a,s),s}async function o(e,t,n){let r=Am(e,t,n);return Mm(e,t,n)?{kind:r,relPath:e}:r===`folder`?await a(`folder`,e)?{kind:r,relPath:e}:null:await a(`doc`,e)?{kind:r,relPath:e}:!Tm(e)&&await a(`folder`,e)?{kind:`folder`,relPath:e}:null}return{provideLinks(n,r){let a=e.readLogicalLine(n);if(!a||a.text.length===0){r(void 0);return}let{text:s,startLine:c,cols:l}=a,u=Em(s,t);if(u.length===0){r(void 0);return}let d=e.getSnapshot();Promise.all(u.map(async t=>{let n=vm(t.path,e.projectPath);if(n===null)return null;let r;if(n.kind===`external`)r={kind:`external`,absPath:n.absPath};else{let e=await o(n.relPath,t.trailingSlash,d);if(e===null)return null;r=e}return{text:t.path,range:Dm(t.startIndex,t.endIndex,c,l),activate:()=>e.onActivate(r)}})).then(e=>{let t=e.filter(e=>e!==null);r(t.length>0?t:void 0)}).catch(e=>{i||(i=!0,console.warn(`[terminal] link provider failed to compute links:`,e)),r(void 0)})}}}function Fm(e,t=console.warn){let n=!1;return()=>{e.refresh(0,e.rows-1);let r=e._core?._renderService?._renderDebouncer;typeof r?._innerRefresh==`function`?r._innerRefresh():n||(n=!0,t(`[terminal] xterm render-debouncer internal not found; resize repaint deferring to the next frame. An xterm upgrade may have moved _core._renderService._renderDebouncer.`))}}var Im={setTimer:(e,t)=>setTimeout(e,t),clearTimer:e=>clearTimeout(e)};function Lm(e,t,n=Im){let r=null,i=!1;function a(){r=n.setTimer(()=>{r=null,i&&(i=!1,e(),a())},t)}return{request(){if(r!==null){i=!0;return}e(),a()},cancel(){r!==null&&(n.clearTimer(r),r=null),i=!1}}}var Rm=1,zm=2;function Bm(e,t,n,r){let i=n+(t===Rm?e:t===zm?e*r.viewportRows:e/r.cellHeight)*r.sensitivity,a=Math.trunc(i);return a===0?{count:0,button:65,accumulator:i}:{count:Math.min(Math.abs(a),r.maxRowsPerEvent),button:a<0?64:65,accumulator:i-a}}var Vm=9;function Hm(e,t,n){let r=n.cellWidth!==void 0&&n.cellWidth>0?n.cellWidth:void 0,i=(e,t)=>Math.min(Math.max(e,1),t);if(n.pixels){let a=Math.round((r??Vm)*n.cols),o=Math.round(n.cellHeight*n.rows);return{x:Um(e)?i(Math.floor(e)+1,a):Math.ceil(a/2),y:Um(t)?i(Math.floor(t)+1,o):Math.ceil(o/2)}}return{x:Um(e)&&r!==void 0?i(Math.floor(e/r)+1,n.cols):Math.ceil(n.cols/2),y:Um(t)?i(Math.floor(t/n.cellHeight)+1,n.rows):Math.ceil(n.rows/2)}}function Um(e){return e!==void 0&&Number.isFinite(e)}function Wm(e,t){return`\x1b[<${e};${t.x};${t.y}M`}var Gm=100;function Km(e){let t=(0,S.c)(22),{bridge:n,className:a,onClose:s,onExit:c,onTitleChange:l,launch:u,commandId:d,adoptPtyId:f,onPtyId:p}=e,m=u===void 0?null:u,h=d===void 0?null:d,g=f===void 0?null:f,{_}=r(),{resolvedTheme:v}=i(),y=ee(v),[b,x]=(0,dm.useState)(0),te=b===0?g:null,C;t[0]===_?C=t[1]:(C=_({id:`ALhMYW`}),t[0]=_,t[1]=C);let w;t[2]===y.background?w=t[3]:(w={backgroundColor:y.background},t[2]=y.background,t[3]=w);let T;t[4]===a?T=t[5]:(T=o(`relative flex h-full w-full flex-col overflow-hidden`,a),t[4]=a,t[5]=T);let E;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>x(qm),t[6]=E):E=t[6];let D;t[7]!==te||t[8]!==n||t[9]!==h||t[10]!==m||t[11]!==s||t[12]!==c||t[13]!==p||t[14]!==l||t[15]!==b?(D=(0,$.jsx)(`div`,{className:`relative min-h-0 flex-1`,children:(0,$.jsx)(Jm,{bridge:n,onClose:s,onExit:c,onTitleChange:l,onRestart:E,launch:m,commandId:h,adoptPtyId:te,onPtyId:p},b)}),t[7]=te,t[8]=n,t[9]=h,t[10]=m,t[11]=s,t[12]=c,t[13]=p,t[14]=l,t[15]=b,t[16]=D):D=t[16];let O;return t[17]!==C||t[18]!==w||t[19]!==T||t[20]!==D?(O=(0,$.jsx)(`section`,{"aria-label":C,style:w,className:T,children:D}),t[17]=C,t[18]=w,t[19]=T,t[20]=D,t[21]=O):O=t[21],O}function qm(e){return e+1}function Jm(e){let t=(0,S.c)(53),{bridge:n,onClose:r,onExit:a,onTitleChange:o,onRestart:s,launch:c,commandId:p,adoptPtyId:h,onPtyId:C}=e,w=c===void 0?null:c,E=p===void 0?null:p,D=h===void 0?null:h,O=(0,dm.useRef)(null),ne=(0,dm.useRef)(a),re=(0,dm.useRef)(o),k=(0,dm.useRef)(C),{resolvedTheme:A}=i(),j=ee(A),ie=(0,dm.useRef)(null),ae=(0,dm.useRef)(j),[M,oe]=(0,dm.useState)(`starting`),[se,ce]=(0,dm.useState)(null),[le,ue]=(0,dm.useState)(null),de=(0,dm.useRef)(null),[fe,pe]=(0,dm.useState)(null),N=(0,dm.use)(m),me=(0,dm.useRef)(N?.userConfig?.agents?.autoApproveOkTools??!0),he;t[0]!==N?.userConfig?.agents?.autoApproveOkTools||t[1]!==a||t[2]!==C||t[3]!==o?(he=()=>{ne.current=a,re.current=o,k.current=C,me.current=N?.userConfig?.agents?.autoApproveOkTools??!0},t[0]=N?.userConfig?.agents?.autoApproveOkTools,t[1]=a,t[2]=C,t[3]=o,t[4]=he):he=t[4],(0,dm.useEffect)(he);let ge;t[5]!==D||t[6]!==n.accessibility||t[7]!==n.config||t[8]!==n.project||t[9]!==n.shell||t[10]!==n.terminal||t[11]!==E||t[12]!==w?(ge=()=>{let e=O.current;if(!e)return;let t=!1,r=null,i,a,o,s,c,d,p,m,h,b=n.config.e2eSmoke===!0||(n.accessibility?.isScreenReaderActive()??!0),x=jm(),ee=e=>{ie.current?.modes.mouseTrackingMode===`none`&&(x(e,Date.now())||n.shell.openExternal(e))},S=new um({screenReaderMode:b,minimumContrastRatio:4.5,allowProposedApi:!0,cursorBlink:!0,fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, monospace`,fontSize:13,scrollback:1e4,smoothScrollDuration:125,scrollSensitivity:3,linkHandler:{activate:(e,t)=>ee(t)},theme:ae.current});ie.current=S;let C=new T;if(S.loadAddon(C),S.loadAddon(new at),S.unicode.activeVersion=`11`,S.loadAddon(new dt((e,t)=>ee(t))),S.open(e),d=S.registerLinkProvider(Pm({projectPath:n.config.projectPath,readLogicalLine:e=>{let t=S.buffer.active,n=e-1;if(!t.getLine(n))return;let r=n;for(;r>0&&t.getLine(r)?.isWrapped;)r--;let i=n;for(;t.getLine(i+1)?.isWrapped;)i++;let a=``;for(let e=r;e<=i;e++)a+=t.getLine(e)?.translateToString(!1)??``;return{text:a,startLine:r+1,cols:S.cols}},getSnapshot:y,checkTargetExists:(e,t)=>n.project.checkTargetExists({projectPath:n.config.projectPath,kind:e,path:t}),onActivate:e=>{switch(e.kind){case`doc`:window.location.hash=g(v(e.relPath));return;case`folder`:window.location.hash=_(e.relPath);return;case`external`:n.shell.revealExternal(e.absPath).catch(nh);return;case`asset`:n.shell.openAsset(e.relPath).then(t=>{if(!t.ok){if(t.reason===`extension-blocked`){n.shell.revealAsset(e.relPath).catch(th);return}console.warn(`[terminal] openAsset refused:`,t.reason)}}).catch(eh);return;default:return e}}})),n.config.e2eSmoke!==!0)try{let e=new Ya;e.onContextLoss(()=>{console.warn(`[terminal] WebGL context lost, falling back to DOM renderer`),e.dispose()}),S.loadAddon(e)}catch(e){let t=e;(t instanceof Error&&/webgl2?|context/i.test(t.message)?console.warn:console.error)(`[terminal] WebGL addon failed, using DOM renderer:`,t)}C.fit();let A=Fm(S),j=e.querySelector(`.xterm-screen canvas`);if(j!==null){m=new ResizeObserver(()=>A());try{m.observe(j,{box:`device-pixel-content-box`})}catch(e){console.warn(`[terminal] device-pixel canvas observe failed:`,e),m.disconnect(),m=void 0}}c=S.onTitleChange(e=>{t||re.current?.(e)}),S.attachCustomKeyEventHandler(e=>{if(e.type!==`keydown`||!e.shiftKey)return!0;if(e.key===`Tab`)return e.preventDefault(),!0;if(e.key===`Enter`){let t=de.current;return t===null?!0:(e.preventDefault(),n.terminal.input(t,`
|
|
146
|
-
`),!1)}return!0});let M=0,se=!1;S.attachCustomWheelEventHandler(e=>{let t=S._core,r=t?.coreMouseService?.activeEncoding;if(!(S.modes.mouseTrackingMode!==`none`&&(r===`SGR`||r===`SGR_PIXELS`)))return M=0,!0;let i=de.current;if(i===null||e.deltaY===0)return!0;let a=t?._renderService?.dimensions?.css?.cell?.height;a===void 0&&!se&&(se=!0,console.warn(`[terminal] xterm cell-height internal not found; wheel scroll using fallback. An xterm upgrade may have moved _core._renderService.dimensions.css.cell.height.`));let o=a??17,{count:s,button:c,accumulator:l}=Bm(e.deltaY,e.deltaMode,M,{cellHeight:o,sensitivity:1.5,maxRowsPerEvent:20,viewportRows:S.rows});if(M=l,s>0){let a=(S.element?.querySelector(`.xterm-screen`)??S.element)?.getBoundingClientRect(),l=Hm(a===void 0?void 0:e.clientX-a.left,a===void 0?void 0:e.clientY-a.top,{cellWidth:t?._renderService?.dimensions?.css?.cell?.width,cellHeight:o,cols:S.cols,rows:S.rows,pixels:r===`SGR_PIXELS`});n.terminal.input(i,Wm(c,l).repeat(s))}return!1});let le=s=>{r=s,de.current=s,k.current?.(s),oe(`running`),S.onData(e=>{r&&n.terminal.input(r,e)}),i=n.terminal.onData(e=>{e.ptyId===r&&(S.write(e.data,()=>n.terminal.drain(e.ptyId,e.data.length)),o?.(e.data))}),a=n.terminal.onExit(e=>{e.ptyId===r&&(ue({exitCode:e.exitCode,signal:e.signal,error:e.error}),oe(`exited`),ne.current?.({exitCode:e.exitCode,signal:e.signal}))}),h=Lm(()=>{r&&n.terminal.resize(r,S.cols,S.rows)},Gm),p=new ResizeObserver(()=>{let e=S.cols,t=S.rows;C.fit(),(S.cols!==e||S.rows!==t)&&A(),h?.request()}),p.observe(e),S.focus(),w!==null&&D===null||n.terminal.claudePreflight().then(e=>{t||ce(e)}).catch($m)},fe=async e=>{if(e.cli===`claude`){try{let r=await n.terminal.claudePreflight();if(r.claude===`present`)return t||ce(r),u(`claude`,e.prompt,{mcpPreApprove:r.mcpPreApprovable===!0,autoApproveOkTools:me.current&&r.mcpPreApprovable===!0});t||ce(r.claude===`not-found`?r:{claude:`not-found`,mcp:r.mcp,mcpPreApprovable:!1})}catch(e){console.warn(`[terminal] claude launch preflight failed`,e),t||ce({claude:`not-found`,mcp:`needs-rewire`,mcpPreApprovable:!1})}return}try{let r=await n.terminal.cliPreflight(e.cli);if(r.onPath===`unknown`){if(t)return;r=await n.terminal.cliPreflight(e.cli)}if(r.onPath===`present`)return u(e.cli,e.prompt,{autoApproveOkTools:e.cli===`codex`&&r.okServerConfigured===!0&&me.current})}catch(t){let n=t;console.warn(`[terminal] cliPreflight failed`,{cli:e.cli,err:n})}t||pe(e.cli)},N;return(async()=>{if(D!==null){let e;try{e=await n.terminal.adopt(D)}catch(t){console.error(`[terminal] adopt() failed:`,t),e={ok:!1,reason:`unknown-session`}}if(t)return;if(e.ok){e.replay&&S.write(e.replay),le(D),n.terminal.resize(D,S.cols,S.rows);return}}let e;if(w!==null&&D===null){if(e=await fe(w),t)return}else E!==null&&D===null&&(e=te(E));let r;try{r=await n.terminal.create({cols:S.cols,rows:S.rows,launchCommand:e})}catch(e){let n=e;if(console.error(`[terminal] create() failed:`,n),t)return;ue({exitCode:1,signal:null,error:n instanceof Error?n.message:String(n)}),oe(`exited`);return}if(t){r.ok&&n.terminal.kill(r.ptyId).catch(Qm);return}if(!r.ok){oe(r.reason===`not-consented`?`not-consented`:`no-project`);return}le(r.ptyId);let i=w?.stagePaste,a=w!=null&&e!==void 0&&w.prompt!=null?
|
|
146
|
+
`),!1)}return!0});let M=0,se=!1;S.attachCustomWheelEventHandler(e=>{let t=S._core,r=t?.coreMouseService?.activeEncoding;if(!(S.modes.mouseTrackingMode!==`none`&&(r===`SGR`||r===`SGR_PIXELS`)))return M=0,!0;let i=de.current;if(i===null||e.deltaY===0)return!0;let a=t?._renderService?.dimensions?.css?.cell?.height;a===void 0&&!se&&(se=!0,console.warn(`[terminal] xterm cell-height internal not found; wheel scroll using fallback. An xterm upgrade may have moved _core._renderService.dimensions.css.cell.height.`));let o=a??17,{count:s,button:c,accumulator:l}=Bm(e.deltaY,e.deltaMode,M,{cellHeight:o,sensitivity:1.5,maxRowsPerEvent:20,viewportRows:S.rows});if(M=l,s>0){let a=(S.element?.querySelector(`.xterm-screen`)??S.element)?.getBoundingClientRect(),l=Hm(a===void 0?void 0:e.clientX-a.left,a===void 0?void 0:e.clientY-a.top,{cellWidth:t?._renderService?.dimensions?.css?.cell?.width,cellHeight:o,cols:S.cols,rows:S.rows,pixels:r===`SGR_PIXELS`});n.terminal.input(i,Wm(c,l).repeat(s))}return!1});let le=s=>{r=s,de.current=s,k.current?.(s),oe(`running`),S.onData(e=>{r&&n.terminal.input(r,e)}),i=n.terminal.onData(e=>{e.ptyId===r&&(S.write(e.data,()=>n.terminal.drain(e.ptyId,e.data.length)),o?.(e.data))}),a=n.terminal.onExit(e=>{e.ptyId===r&&(ue({exitCode:e.exitCode,signal:e.signal,error:e.error}),oe(`exited`),ne.current?.({exitCode:e.exitCode,signal:e.signal}))}),h=Lm(()=>{r&&n.terminal.resize(r,S.cols,S.rows)},Gm),p=new ResizeObserver(()=>{let e=S.cols,t=S.rows;C.fit(),(S.cols!==e||S.rows!==t)&&A(),h?.request()}),p.observe(e),S.focus(),w!==null&&D===null||n.terminal.claudePreflight().then(e=>{t||ce(e)}).catch($m)},fe=async e=>{if(e.cli===`claude`){try{let r=await n.terminal.claudePreflight();if(r.claude===`present`)return t||ce(r),u(`claude`,e.prompt,{mcpPreApprove:r.mcpPreApprovable===!0,autoApproveOkTools:me.current&&r.mcpPreApprovable===!0});t||ce(r.claude===`not-found`?r:{claude:`not-found`,mcp:r.mcp,mcpPreApprovable:!1})}catch(e){console.warn(`[terminal] claude launch preflight failed`,e),t||ce({claude:`not-found`,mcp:`needs-rewire`,mcpPreApprovable:!1})}return}try{let r=await n.terminal.cliPreflight(e.cli);if(r.onPath===`unknown`){if(t)return;r=await n.terminal.cliPreflight(e.cli)}if(r.onPath===`present`)return u(e.cli,e.prompt,{autoApproveOkTools:e.cli===`codex`&&r.okServerConfigured===!0&&me.current})}catch(t){let n=t;console.warn(`[terminal] cliPreflight failed`,{cli:e.cli,err:n})}t||pe(e.cli)},N;return(async()=>{if(D!==null){let e;try{e=await n.terminal.adopt(D)}catch(t){console.error(`[terminal] adopt() failed:`,t),e={ok:!1,reason:`unknown-session`}}if(t)return;if(e.ok){e.replay&&S.write(e.replay),le(D),n.terminal.resize(D,S.cols,S.rows);return}}let e;if(w!==null&&D===null){if(e=await fe(w),t)return}else E!==null&&D===null&&(e=te(E));let r;try{r=await n.terminal.create({cols:S.cols,rows:S.rows,launchCommand:e})}catch(e){let n=e;if(console.error(`[terminal] create() failed:`,n),t)return;ue({exitCode:1,signal:null,error:n instanceof Error?n.message:String(n)}),oe(`exited`);return}if(t){r.ok&&n.terminal.kill(r.ptyId).catch(Qm);return}if(!r.ok){oe(r.reason===`not-consented`?`not-consented`:`no-project`);return}le(r.ptyId);let i=w?.stagePaste,a=w!=null&&e!==void 0&&w.prompt!=null?f(w.cli,w.prompt):null;if(a!=null&&w!=null){let e=l(w.cli),r=e?.settleMs??500,i=e?.readyMarker,c=a,u=!1,d=()=>{u||(u=!0,o=void 0,N!==void 0&&clearTimeout(N),s!==void 0&&clearTimeout(s),!(t||de.current===null)&&(n.terminal.input(de.current,c),S.focus()))};if(s=setTimeout(d,e?.capMs??r),i!=null){let e=``;o=t=>{if(!(u||N!==void 0)){if(e+=t,e.includes(i)){o=void 0,N=setTimeout(d,r);return}e.length>i.length+256&&(e=e.slice(-(i.length+256)))}}}else N=setTimeout(d,r)}else w!=null&&w.prompt!=null&&i!=null?console.warn(`[terminal] TerminalLaunchIntent carried both prompt and stagePaste; dropping stagePaste`):e!==void 0&&i!=null&&i!==``&&(N=setTimeout(()=>{t||de.current===null||(n.terminal.input(de.current,i),S.focus())},500))})(),()=>{t=!0,N!==void 0&&clearTimeout(N),s!==void 0&&clearTimeout(s),o=void 0,de.current=null,k.current?.(null),ie.current=null,p?.disconnect(),m?.disconnect(),h?.cancel(),i?.(),a?.(),c?.dispose(),d?.dispose(),S.dispose(),r&&n.terminal.kill(r).catch(Zm)}},t[5]=D,t[6]=n.accessibility,t[7]=n.config,t[8]=n.project,t[9]=n.shell,t[10]=n.terminal,t[11]=E,t[12]=w,t[13]=ge):ge=t[13];let _e;t[14]!==D||t[15]!==n||t[16]!==E||t[17]!==w?(_e=[n,D,w,E],t[14]=D,t[15]=n,t[16]=E,t[17]=w,t[18]=_e):_e=t[18],(0,dm.useEffect)(ge,_e);let ve,ye;t[19]===j?(ve=t[20],ye=t[21]):(ve=()=>{let e=ie.current;e!==null&&(e.options.theme=j)},ye=[j],t[19]=j,t[20]=ve,t[21]=ye),(0,dm.useEffect)(ve,ye);let be;t[22]!==n.accessibility||t[23]!==n.config?(be=()=>{let e=n.accessibility;if(!(e==null||n.config.e2eSmoke===!0))return e.onScreenReaderChanged(e=>{let t=ie.current;t!==null&&(t.options.screenReaderMode=e)})},t[22]=n.accessibility,t[23]=n.config,t[24]=be):be=t[24];let xe;t[25]===n?xe=t[26]:(xe=[n],t[25]=n,t[26]=xe),(0,dm.useEffect)(be,xe);let Se,Ce;t[27]===n?(Se=t[28],Ce=t[29]):(Se=()=>{let e=O.current;if(e===null)return;let t=function(e){x(e)&&e.preventDefault()},r=function(e){if(!x(e))return;e.preventDefault();let t=de.current;if(t===null)return;let r=b(e).map(e=>n.getPathForFile(e)).filter(Ym);r.length!==0&&n.terminal.input(t,`${r.map(d).join(` `)} `)};return e.addEventListener(`dragover`,t,{capture:!0}),e.addEventListener(`drop`,r,{capture:!0}),()=>{e.removeEventListener(`dragover`,t,{capture:!0}),e.removeEventListener(`drop`,r,{capture:!0})}},Ce=[n],t[27]=n,t[28]=Se,t[29]=Ce),(0,dm.useEffect)(Se,Ce);let we;t[30]!==n||t[31]!==se||t[32]!==M?(we=M===`running`&&se?(0,$.jsx)(mm,{readiness:se,bridge:n,onDismiss:()=>ce(null)}):null,t[30]=n,t[31]=se,t[32]=M,t[33]=we):we=t[33];let Te;t[34]!==n||t[35]!==fe||t[36]!==M?(Te=M===`running`&&fe?(0,$.jsx)(hm,{cli:fe,bridge:n,onDismiss:()=>pe(null)}):null,t[34]=n,t[35]=fe,t[36]=M,t[37]=Te):Te=t[37];let Ee;t[38]===M?Ee=t[39]:(Ee=(0,$.jsx)(`div`,{ref:O,"data-terminal-status":M,className:`min-h-0 flex-1 px-1.5`}),t[38]=M,t[39]=Ee);let De;t[40]!==le||t[41]!==s||t[42]!==M?(De=M===`exited`&&le?(0,$.jsx)(gm,{info:le,onRestart:s}):null,t[40]=le,t[41]=s,t[42]=M,t[43]=De):De=t[43];let Oe;t[44]!==r||t[45]!==M?(Oe=M===`no-project`||M===`not-consented`?(0,$.jsx)(_m,{reason:M,onClose:r}):null,t[44]=r,t[45]=M,t[46]=Oe):Oe=t[46];let ke;return t[47]!==we||t[48]!==Te||t[49]!==Ee||t[50]!==De||t[51]!==Oe?(ke=(0,$.jsxs)(`div`,{className:`flex h-full w-full flex-col`,children:[we,Te,Ee,De,Oe]}),t[47]=we,t[48]=Te,t[49]=Ee,t[50]=De,t[51]=Oe,t[52]=ke):ke=t[52],ke}function Ym(e){return e!==null&&e!==``&&!Array.from(e).some(Xm)}function Xm(e){return e.charCodeAt(0)<32}function Zm(e){return console.warn(`[terminal] kill on unmount failed:`,e)}function Qm(e){return console.warn(`[terminal] kill after cancelled mount failed:`,e)}function $m(e){console.warn(`[terminal] claude readiness preflight failed`,e)}function eh(e){return console.warn(`[terminal] openAsset failed:`,e)}function th(e){return console.warn(`[terminal] revealAsset failed:`,e)}function nh(e){return console.warn(`[terminal] revealExternal failed:`,e)}export{Km as TerminalPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r}from"./dist-PQ5KMVDh.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{t as a}from"./config-provider-
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r}from"./dist-PQ5KMVDh.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{t as a}from"./config-provider-Dz54I9YH.js";import{t as o}from"./use-installed-clis-CdB0ME5s.js";import{t as s}from"./use-live-xterm-theme-Br4z4FVs.js";import{SessionsHost as c}from"./SessionsHost-CpLvCqvs.js";var l=i(),u=e(n(),1),d=t();function f(e){let t=(0,l.c)(5),{bridge:n}=e,r=n.config.collabUrl?n.config.collabUrl:null,i;t[0]===n?i=t[1]:(i=(0,d.jsx)(p,{bridge:n}),t[0]=n,t[1]=i);let o;return t[2]!==r||t[3]!==i?(o=(0,d.jsx)(a,{collabUrl:r,children:i}),t[2]=r,t[3]=i,t[4]=o):o=t[4],o}function p(e){let t=(0,l.c)(9),{bridge:n}=e,{resolvedTheme:i}=r(),a=s(i),f=o(),[p,g]=(0,u.useState)(null),_;t[0]===a.background?_=t[1]:(_=(0,d.jsx)(`div`,{ref:g,className:`flex h-screen min-h-0 flex-col`,style:{backgroundColor:a.background}}),t[0]=a.background,t[1]=_);let v;t[2]!==n||t[3]!==p||t[4]!==f?(v=(0,d.jsx)(c,{bridge:n,surface:`terminal-window`,terminalCapable:!0,visible:!0,onVisibleChange:h,installedClis:f,container:p,isShowing:!0,onRequestEditorFocus:m}),t[2]=n,t[3]=p,t[4]=f,t[5]=v):v=t[5];let y;return t[6]!==_||t[7]!==v?(y=(0,d.jsxs)(d.Fragment,{children:[_,v]}),t[6]=_,t[7]=v,t[8]=y):y=t[8],y}function m(){}function h(e){e||window.close()}export{f as TerminalWindowApp};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{r}from"./dist-Nvb76hAm.js";import{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{n as o}from"./CodeMirrorPropInput-
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{r}from"./dist-Nvb76hAm.js";import{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{n as o}from"./CodeMirrorPropInput-CQzidEcb.js";import{Bo as s,Zn as c,ko as l}from"./dist-D6d8jhW_2.js";import{g as u}from"./config-provider-Dz54I9YH.js";import{Et as d,N as f,Ot as p,X as m}from"./dist-B0Beym3_.js";import{t as h}from"./cm-theme-ChFGbVCe.js";import{t as g}from"./dist-CFyOS6pn.js";import{t as _}from"./text-viewer-languages-BmEIetCD.js";import{t as v}from"./src-DFsYGwxw.js";var y=a(),b=e(n(),1),x=t(),S=h({dark:!0,background:`var(--background)`,gutterBackground:`var(--muted)`}),C=h({dark:!1,background:`var(--background)`,gutterBackground:`var(--muted)`});function w(e){let t=(0,y.c)(19),{docName:n,provider:a}=e,{_:h}=r(),w=n.slice(n.lastIndexOf(`/`)+1),T=(0,b.useRef)(null),{resolvedTheme:E}=i(),D;t[0]===a.document?D=t[1]:(D=a.document.getText(`source`),t[0]=a.document,t[1]=D);let O=D,k;t[2]===O?k=t[3]:(k=()=>new u(O),t[2]=O,t[3]=k);let[A]=(0,b.useState)(k),j;t[4]!==n||t[5]!==a.awareness||t[6]!==E||t[7]!==A||t[8]!==O?(j=()=>{let e=T.current;if(!e)return;let t=E===`dark`?S:C,r=new d,i=new d,u=(l[c(n)]??s(c(n)))!==null&&c(n)!==``,h=new m({state:p.create({doc:O.toString(),extensions:[g,v(O,a.awareness,{undoManager:A}),r.of([]),f(o),i.of(u?[]:m.lineWrapping),m.theme({"&":{height:`100%`}}),t]}),parent:e}),y=!1,b=c(n)||null;return b&&_(b,l[b]??s(b)).then(e=>{y||!e||h.dispatch({effects:r.reconfigure(e)})}),()=>{y=!0,h.destroy()}},t[4]=n,t[5]=a.awareness,t[6]=E,t[7]=A,t[8]=O,t[9]=j):j=t[9];let M;t[10]!==n||t[11]!==a||t[12]!==E||t[13]!==A||t[14]!==O?(M=[O,a,E,n,A],t[10]=n,t[11]=a,t[12]=E,t[13]=A,t[14]=O,t[15]=M):M=t[15],(0,b.useEffect)(j,M);let N=h({id:`xAlHfe`,values:{basename:w}}),P;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,x.jsx)(`div`,{ref:T,className:`min-h-0 flex-1 overflow-auto`}),t[16]=P):P=t[16];let F;return t[17]===N?F=t[18]:(F=(0,x.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":N,"data-text-doc-editor":``,children:P}),t[17]=N,t[18]=F),F}export{w as TextDocEditor};
|