@inkeep/open-knowledge 0.72.0-beta.8 → 0.72.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +67 -67
- package/dist/constants-HpJ1Aw2x.mjs +1 -0
- package/dist/{dist-CQFFmkEE.mjs → dist-D-JsLkMj.mjs} +1 -1
- package/dist/dist-DpvmOOux.mjs +2098 -0
- package/dist/index.mjs +32 -32
- package/dist/{init-BicUnFpD.mjs → init-BucVcH05.mjs} +30 -30
- package/dist/init-CMeDFBn6.mjs +1 -0
- package/dist/{launch-json-removal-BmOfc62H.mjs → launch-json-removal-vnHdgMVB.mjs} +1 -1
- package/dist/{loader-Cfka284a.mjs → loader-Dja8X5NF.mjs} +1 -1
- package/dist/loader-h8BHGifL.mjs +1 -0
- package/dist/{md-manager-BGnqyqi1-Bo-Rq5FL.mjs → md-manager-BGnqyqi1-DJAoWykM.mjs} +3 -3
- package/dist/native/index.d.ts +10 -0
- package/dist/native/index.js +1 -0
- package/dist/native/native-config.darwin-arm64.node +0 -0
- package/dist/native/native-config.darwin-x64.node +0 -0
- package/dist/native/native-config.linux-arm64-gnu.node +0 -0
- package/dist/native/native-config.linux-arm64-musl.node +0 -0
- package/dist/native/native-config.linux-x64-gnu.node +0 -0
- package/dist/native/native-config.linux-x64-musl.node +0 -0
- package/dist/native/native-config.win32-arm64-msvc.node +0 -0
- package/dist/native/native-config.win32-x64-msvc.node +0 -0
- package/dist/{open-browser-C5MWfuW0.mjs → open-browser-_C4KuBYR.mjs} +1 -1
- package/dist/parse-worker.mjs +1 -1
- package/dist/preview-BUJ7uuRV.mjs +1 -0
- package/dist/{preview-C4QsfZoY.mjs → preview-DqR9lBGO.mjs} +1 -1
- package/dist/public/assets/{ActivityModeContent-Bh-aOINO.js → ActivityModeContent-D7Y4qrSx.js} +1 -1
- package/dist/public/assets/{AddPropertiesButton-CKvbln-l.js → AddPropertiesButton-BVrBW1en.js} +2 -2
- package/dist/public/assets/{AgentDiffPane-h0k7R2PC.js → AgentDiffPane-D4YR4PAk.js} +1 -1
- package/dist/public/assets/{AgentIconCluster-BfdKE6ui.js → AgentIconCluster-73NlLIdi.js} +1 -1
- package/dist/public/assets/{AgentThreadClientBinder-DjubXLi6.js → AgentThreadClientBinder-DSpPkRQM.js} +1 -1
- package/dist/public/assets/{BugReportHistory-C_ZU9yMs.js → BugReportHistory-BRzTZpQ6.js} +1 -1
- package/dist/public/assets/{BugReportHistoryDialog-DJiu9Guq.js → BugReportHistoryDialog-D4rU-QRv.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-CsU-AE2e.js → CodeMirrorPropInput-D4TkN04Q.js} +1 -1
- package/dist/public/assets/{ConsentDialogBody-Dqev0b07.js → ConsentDialogBody-CW3mkNYT.js} +1 -1
- package/dist/public/assets/DiffViewBoundary-CGfmJJR7.js +29 -0
- package/dist/public/assets/{DocumentContext-CaB8wd1_.js → DocumentContext-BTkb_kA1.js} +1 -1
- package/dist/public/assets/{EditorModeToggle-CmusAWSZ.js → EditorModeToggle-tSCiOg3v.js} +1 -1
- package/dist/public/assets/EnableSyncConfirmDialog-BTTxLhYj.js +1 -0
- package/dist/public/assets/{ExcalidrawDocEditor-CCrqGTpz.js → ExcalidrawDocEditor-BTtX66iv.js} +1 -1
- package/dist/public/assets/FeedbackForm-CDms1KMi.js +1 -0
- package/dist/public/assets/{GraphPanel-Brw8ehEB.js → GraphPanel-DoD6grms.js} +1 -1
- package/dist/public/assets/{ImageAttachments-CC1lPWjh.js → ImageAttachments-CiG8ocmH.js} +1 -1
- package/dist/public/assets/{ImportSkillDialog-DU5H3G2e.js → ImportSkillDialog-B8dfzubU.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-BFpjLGZ_.js → LintConfigEditor-CfbMFz8E.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-DPLTTAuN.js → ManagedArtifactProperties-Bsa7lIfc.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-QPlvN-tK.js +1 -0
- package/dist/public/assets/McpConsentDialogBody-DFMtnXkl.js +1 -0
- package/dist/public/assets/{MermaidDocEditor-DFksLDPw.js → MermaidDocEditor-BGuGune3.js} +1 -1
- package/dist/public/assets/{OpenInAgentMenuItem-pI7QqxQ8.js → OpenInAgentMenuItem-BC0Il98-.js} +1 -1
- package/dist/public/assets/{PropertyDisplayRow-rtfso48w.js → PropertyDisplayRow-mLiEXaap.js} +1 -1
- package/dist/public/assets/{RegisteredAgentIcon-H1tWUX4M.js → RegisteredAgentIcon-Dn4-pkWR.js} +1 -1
- package/dist/public/assets/{ReportBugDialogBody-B0Hz8PSu.js → ReportBugDialogBody-CRj-PDwi.js} +1 -1
- package/dist/public/assets/{ReportBugMenuTrigger-fqTsxaHY.js → ReportBugMenuTrigger-BNmrStkg.js} +2 -2
- package/dist/public/assets/{SchemaConfigEditor-BKnKFgWH.js → SchemaConfigEditor-DmqHZY9m.js} +1 -1
- package/dist/public/assets/SessionsHost-5-w2Ytjq.js +2 -0
- package/dist/public/assets/{SettingsDialogBody-CLyWK9_-.js → SettingsDialogBody-Bzm2pe6Y.js} +1 -1
- package/dist/public/assets/{ShareBranchSwitchDialog-DOFGWcAi.js → ShareBranchSwitchDialog-LjS5AmOP.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-DeXX0A9G.js → ShareReceiveDialog-Dsz-WeY_.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-Dt5uoAmv.js → ShareReceiveMissDialog-BmjXrJfP.js} +1 -1
- package/dist/public/assets/{SkillCostValue-Bz3F4Rhv.js → SkillCostValue-BbhT-Y0c.js} +1 -1
- package/dist/public/assets/{SkillEditBanner-CwcNkco_.js → SkillEditBanner-BH9-roYJ.js} +1 -1
- package/dist/public/assets/{SkillForkDialog-CkG_oW7h.js → SkillForkDialog-BdRVxG_A.js} +1 -1
- package/dist/public/assets/{SkillInstallMenu-B87ijGMQ.js → SkillInstallMenu-Dj58Ddxg.js} +1 -1
- package/dist/public/assets/{SkillOriginInline-Ca3SXbe0.js → SkillOriginInline-BpC80MQ4.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-BdthwmpX.js → SkillToolbarControls-Dg0woooJ.js} +1 -1
- package/dist/public/assets/{SlidesToolbarControls-8RmRXuaP.js → SlidesToolbarControls-GkkbgrDw.js} +1 -1
- package/dist/public/assets/{SourceEditor-BiO9HLmi.js → SourceEditor-AUAtGDDG.js} +1 -1
- package/dist/public/assets/{TerminalPanel-Bxt1nIhY.js → TerminalPanel-LE5B6aOs.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-DEMYVkAB.js → TerminalWindowApp-CIJCZWZt.js} +1 -1
- package/dist/public/assets/{TextDocEditor-B8DepRN7.js → TextDocEditor-CLWng8ng.js} +1 -1
- package/dist/public/assets/{ThemePicker-BB-6lF8V.js → ThemePicker-wGe4WU58.js} +1 -1
- package/dist/public/assets/{ThreadView-BoQYnWvN.js → ThreadView-CdEbcCNG.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-DtoYKVQR.js → TimelineDiffPane-leNQXtOq.js} +1 -1
- package/dist/public/assets/{agent-connection-status-CgdIUJFO.js → agent-connection-status-Dc1KTfMX.js} +1 -1
- package/dist/public/assets/{auth-state-cache-g0tpeNul.js → auth-state-cache-BzfRaEnx.js} +1 -1
- package/dist/public/assets/{bug-report-send-manager-0zuWMSw7.js → bug-report-send-manager-6QpGUFcT.js} +1 -1
- package/dist/public/assets/{client-version-CH6DzlkY.js → client-version-Bsg_JFDb.js} +1 -1
- package/dist/public/assets/{comment-chips-DSoCMI7Q.js → comment-chips-C3HDycEB.js} +1 -1
- package/dist/public/assets/{config-provider-CI1IgVHl.js → config-provider-BRhn8yeM.js} +1 -1
- package/dist/public/assets/{css-color-to-hex-DPzuRcEY.js → css-color-to-hex-CzLdSn2p.js} +1 -1
- package/dist/public/assets/{dist-BBNlIz6B.js → dist-d5Oop5oD.js} +4 -4
- package/dist/public/assets/{doc-hash-BP0Io59r.js → doc-hash-DXRG1RZ3.js} +1 -1
- package/dist/public/assets/{doc-undo-manager-b7w4Wb9M.js → doc-undo-manager-CNZrhHvu.js} +1 -1
- package/dist/public/assets/{documents-events-BhW9c1L3.js → documents-events-Ca7mPpyf.js} +1 -1
- package/dist/public/assets/dropdown-menu-DjQ8GtwR.js +1 -0
- package/dist/public/assets/{file-tree-adapter-CV_ZL37X.js → file-tree-adapter-D3s-bF2O.js} +1 -1
- package/dist/public/assets/{file-tree-utils-Ba9yRKBT.js → file-tree-utils-CcjKQACo.js} +1 -1
- package/dist/public/assets/{folder-config-api-VEvZwzig.js → folder-config-api-Bf2unoa4.js} +1 -1
- package/dist/public/assets/index-D5h1Ue4Z.js +2205 -0
- package/dist/public/assets/{lint-config-client-qZ7mC1Zy.js → lint-config-client-DBhvRtqd.js} +1 -1
- package/dist/public/assets/{markdownlint-rule-browser-BJMH4HJX.js → markdownlint-rule-browser-Ds9wGwmo.js} +1 -1
- package/dist/public/assets/messages-8o9dkJJ8.js +1 -0
- package/dist/public/assets/messages-BApjWZBM.js +1 -0
- package/dist/public/assets/messages-BKwDlgqX.js +1 -0
- package/dist/public/assets/messages-BcN2AMRx.js +1 -0
- package/dist/public/assets/messages-BvWDj_ta.js +1 -0
- package/dist/public/assets/messages-C5r4coom.js +1 -0
- package/dist/public/assets/messages-CDBtIcly.js +1 -0
- package/dist/public/assets/{messages-C0RTwTFq.js → messages-DToR3YWR.js} +1 -1
- package/dist/public/assets/messages-DY_W63qi.js +1 -0
- package/dist/public/assets/messages-DaESnN9t.js +1 -0
- package/dist/public/assets/messages-DnLgXawv.js +1 -0
- package/dist/public/assets/messages-oUlW9lVw.js +1 -0
- package/dist/public/assets/{navigation-targets-DBLYH48Z.js → navigation-targets-BCkyxjfV.js} +1 -1
- package/dist/public/assets/{page-list-cache-ia70Eztn.js → page-list-cache-BaqltRqa.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-C-oPT_Kg.js → pending-receive-nav-store-CR5ocagf.js} +1 -1
- package/dist/public/assets/{progress-CzvNMH_z.js → progress-DxHELNCX.js} +1 -1
- package/dist/public/assets/{project-paths-BWUfIMzR.js → project-paths-Bf_VK3TT.js} +1 -1
- package/dist/public/assets/{prop-types-Cu1KjM7N.js → prop-types-CbT0nV0p.js} +1 -1
- package/dist/public/assets/{receive-store-MWZ6Efgw.js → receive-store-Bl8jvz6S.js} +1 -1
- package/dist/public/assets/{selection-context-BUgPXj5h.js → selection-context-BcS1yCEE.js} +1 -1
- package/dist/public/assets/{skill-scope-nA3yMJC-.js → skill-scope-OEcWk5Gk.js} +1 -1
- package/dist/public/assets/{skills-api-DM_st9cJ.js → skills-api-C-kL1fc6.js} +1 -1
- package/dist/public/assets/{src-79HN8GE9.js → src-D2qJ0Khw.js} +1 -1
- package/dist/public/assets/{startup-marks-DjGilb1Q.js → startup-marks-DiqKsEB2.js} +1 -1
- package/dist/public/assets/{tag-pill-input-I-zmy30v.js → tag-pill-input-DijEvPLM.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-ZRGm8Ebz.js → target-navigation-intent-CV_-Ewrd.js} +1 -1
- package/dist/public/assets/{telemetry-startup-C_vDSOkT.js → telemetry-startup-JKNjOqir.js} +1 -1
- package/dist/public/assets/terminal-cli-display-OimMjIN5.js +1 -0
- package/dist/public/assets/{terminal-command-events-MPQ3tB2h.js → terminal-command-events-B2wE1Idp.js} +1 -1
- package/dist/public/assets/{terminal-launch-events-BBSlYIZk.js → terminal-launch-events-ZB4IT0td.js} +1 -1
- package/dist/public/assets/{terminal-telemetry-pvyydkXE.js → terminal-telemetry-BRNK6epY.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-BQKKqosX.js → typing-burst-detector-0sjmEIGr.js} +1 -1
- package/dist/public/assets/{uninstall-Bb6vCccP.js → uninstall-D6ZU5kIn.js} +1 -1
- package/dist/public/assets/{use-activity-panel-pDb7IY6s.js → use-activity-panel-Cb0O10i_.js} +1 -1
- package/dist/public/assets/{use-apply-config-language-48pLGsax.js → use-apply-config-language-D8_aWFhi.js} +2 -2
- package/dist/public/assets/use-apply-config-theme-B5w38X1P.js +1 -0
- package/dist/public/assets/{use-collab-url-D-Rpmggc.js → use-collab-url-MA1XZwx2.js} +1 -1
- package/dist/public/assets/{use-conflicts-GDmwqh_O.js → use-conflicts-eiphqjAX.js} +1 -1
- package/dist/public/assets/{use-live-xterm-theme-RBRq5pG-.js → use-live-xterm-theme-DSAK9pjc.js} +1 -1
- package/dist/public/assets/{use-open-skill-C4iRLb07.js → use-open-skill-YJS2TNMn.js} +1 -1
- package/dist/public/assets/{use-settings-route-DmYoFPHM.js → use-settings-route-Ce_1eGCj.js} +1 -1
- package/dist/public/assets/{use-skill-origin-DbioIXic.js → use-skill-origin-BzkIEa74.js} +1 -1
- package/dist/public/assets/{use-skills-BagPzj6D.js → use-skills-BGVTmYdi.js} +1 -1
- package/dist/public/assets/use-terminal-enabled-CoT0Hb9k.js +1 -0
- package/dist/public/assets/{use-timeline-entry-diff-Cv356cHC.js → use-timeline-entry-diff-9s4mPAdl.js} +1 -1
- package/dist/public/assets/{use-workspace-BX0piG-D.js → use-workspace-EKJWDbFc.js} +1 -1
- package/dist/public/index.html +57 -57
- package/dist/public/uninstall.html +4 -4
- package/dist/{registry-probes-BRwJ83Iz.mjs → registry-probes-4Z-a3FSl.mjs} +1 -1
- package/dist/{removal-file-path-CWIUAu6V.mjs → removal-file-path-CRtMHluM.mjs} +1 -1
- package/dist/{repair-launch-json-C0N2kiaE.mjs → repair-launch-json-zuby1B4q.mjs} +1 -1
- package/dist/{repair-mcp-configs-DpjJIJj-.mjs → repair-mcp-configs-Bbv_WYIm.mjs} +1 -1
- package/dist/src-0lwy1yBV.mjs +1 -0
- package/dist/{src-CNkv9ytD.mjs → src-DkZsYCy3.mjs} +2 -2
- package/dist/{start-DP2YYXMn.mjs → start-TbT4Rhs-.mjs} +3 -3
- package/dist/start-X39Juipe.mjs +1 -0
- package/package.json +4 -4
- package/dist/constants-B59cFjNd.mjs +0 -1
- package/dist/dist-CVs8BCwZ.mjs +0 -2098
- package/dist/init-BFZIe-ed.mjs +0 -1
- package/dist/loader-BNMImVY9.mjs +0 -1
- package/dist/preview-BUUK_XBl.mjs +0 -1
- package/dist/public/assets/DiffViewBoundary-CFZjF4Xj.js +0 -29
- package/dist/public/assets/EnableSyncConfirmDialog-DmhIDAV-.js +0 -1
- package/dist/public/assets/FeedbackForm-CDCCOd52.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-j9ihkOtM.js +0 -1
- package/dist/public/assets/McpConsentDialogBody-CXF6JRwT.js +0 -1
- package/dist/public/assets/SessionsHost-DuBW7e2j.js +0 -2
- package/dist/public/assets/dropdown-menu-SORDKiaq.js +0 -1
- package/dist/public/assets/index-DWjHCX39.js +0 -2205
- package/dist/public/assets/messages-BOC9mOzO.js +0 -1
- package/dist/public/assets/messages-BhYfldC5.js +0 -1
- package/dist/public/assets/messages-BoCdYQSk.js +0 -1
- package/dist/public/assets/messages-BqTuEu2G.js +0 -1
- package/dist/public/assets/messages-C8BAfoNQ.js +0 -1
- package/dist/public/assets/messages-D3e2EYtP.js +0 -1
- package/dist/public/assets/messages-DIaB-As6.js +0 -1
- package/dist/public/assets/messages-DKzsGETG.js +0 -1
- package/dist/public/assets/messages-DYwug_Cl.js +0 -1
- package/dist/public/assets/messages-DvW7r91G.js +0 -1
- package/dist/public/assets/messages-aNdi0uM6.js +0 -1
- package/dist/public/assets/terminal-cli-display-UR6Dbpk0.js +0 -1
- package/dist/public/assets/use-apply-config-theme-DpLdjUDN.js +0 -1
- package/dist/public/assets/use-terminal-enabled-b0w6NCxQ.js +0 -1
- package/dist/src-B5SItKxt.mjs +0 -1
- package/dist/start-9_1gSweR.mjs +0 -1
package/dist/init-BFZIe-ed.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./dist-CVs8BCwZ.mjs";import{_ as e}from"./init-BicUnFpD.mjs";export{e as runInit};
|
package/dist/loader-BNMImVY9.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./loader-Cfka284a.mjs";export{e as loadConfig};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./preview-C4QsfZoY.mjs";export{t as formatPreviewBlock,e as previewContent};
|
|
@@ -1,29 +0,0 @@
|
|
|
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"./react-dom-DPxgxlDT.js";import{t as o}from"./compiler-runtime-BfE3aGVn.js";import{t as s}from"./button-Cym3gapE.js";import{la as c}from"./dist-BBNlIz6B.js";import{t as l}from"./lib-DmueaA5E.js";import{n as u}from"./dist-CJhtNlOm2.js";import{s as d}from"./doc-hash-BP0Io59r.js";import{n as f,t as p}from"./alert-B26aQ4Lf.js";import{t as m}from"./use-conflicts-GDmwqh_O.js";import{$ as h,A as g,B as _,C as v,Ct as y,D as ee,Dt as te,E as b,Et as x,F as S,L as C,M as w,N as T,O as E,Ot as D,P as O,Q as k,S as A,St as j,T as M,Tt as N,_ as P,_t as F,a as ne,at as I,b as re,bt as L,c as ie,ct as ae,d as oe,dt as se,et as ce,f as le,ft as R,g as ue,gt as z,h as B,ht as V,it as de,j as fe,k as H,l as U,lt as pe,m as me,mt as W,n as G,nt as K,ot as q,p as J,pt as Y,r as he,rt as X,st as Z,t as ge,tt as _e,u as ve,ut as ye,v as be,vt as xe,w as Se,x as Ce,xt as we,y as Te,yt as Ee,z as De}from"./pierre-theme-BfC-orGO.js";function Oe(e){return se.hasResolvedThemes(e)}function ke(e,t){return Y(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}function Ae(e){return(e.lang??Z(e.name))===`text`}var je=10,Me=13,Ne=4,Pe=40;function Fe(e){let t=[0],n=e.indexOf(`\r`),r=e.indexOf(`
|
|
2
|
-
`),i=0,a=0;for(;n!==-1||r!==-1;){let o;if(n!==-1&&(r===-1||n<r)?r===n+1?(o=r+1,n=e.indexOf(`\r`,o),r=e.indexOf(`
|
|
3
|
-
`,o)):(o=n+1,n=e.indexOf(`\r`,o)):(o=r+1,r=e.indexOf(`
|
|
4
|
-
`,o)),t.push(o),++a===Ne){if(o-i<=Pe){for(let n=o;n<e.length;n++){let r=e.charCodeAt(n);(r===je||r===Me)&&(r===Me&&n+1<e.length&&e.charCodeAt(n+1)===je&&n++,t.push(n+1))}return t}i=o,a=0}}return t}function Ie(e){let t=Fe(e);return Array.from({length:t.length},(n,r)=>{let i=t[r],a=t[r+1]??e.length;return e.slice(i,a)})}var Le={forcePlainText:!1};function Re(e,t,{theme:n=y,tokenizeMaxLineLength:r,useTokenTransformer:i},{forcePlainText:a,startingLine:o,totalLines:s,lines:c}=Le){a?(o??=0,s??=1/0):(o=0,s=1/0);let l=o>0||s<1/0,{state:u,transformers:d}=_e(i),f=a?`text`:e.lang??Z(e.name),p=typeof n==`string`?t.getTheme(n).type:void 0,m=h({theme:n,highlighter:t});u.lineInfo=e=>({type:`context`,lineIndex:e-1+o,lineNumber:e+o});let g=typeof n==`string`?{lang:f,theme:n,transformers:d,defaultColor:!1,cssVariablePrefix:ce(`token`),tokenizeMaxLineLength:r,tokenizeTimeLimit:0}:{lang:f,themes:n,transformers:d,defaultColor:!1,cssVariablePrefix:ce(`token`),tokenizeMaxLineLength:r,tokenizeTimeLimit:0},_=k(t.codeToHast(l?ze(c??Ie(e.contents),o,s):e.contents,g)),v=l?Array(o):_;return l&&v.push(..._),{code:v,themeStyles:m,baseThemeType:p}}function ze(e,t,n){if(e.length===0)return``;let r=Math.min(t+n,e.length);return e.slice(t,r).join(``)}function Be(e,t){return t.cacheKey==null?e.file===t&&e.sourceContents===t.contents:e.cacheKey===t.cacheKey}var Ve=-1,He=class{options;onRenderUpdate;workerManager;__id=`file-renderer:${++Ve}`;highlighter;renderCache;computedLang=`text`;lineAnnotations={};lineCache;pendingStructuralRows;textDocumentCache=new WeakMap;editSessionActive=!1;constructor(e={theme:y},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=g(e.theme??y)?pe():void 0)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}setLineAnnotations(e){this.lineAnnotations={};for(let t of e){let e=this.lineAnnotations[t.lineNumber]??[];this.lineAnnotations[t.lineNumber]=e,e.push(t)}}cleanUp(){this.recycle(),this.workerManager=void 0,this.onRenderUpdate=void 0}beginEditSession(){this.editSessionActive=!0}endEditSession(){this.editSessionActive=!1}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}recycle(){this.clearRenderCache(),this.highlighter=void 0,this.workerManager?.cleanUpTasks(this),this.lineCache=void 0,this.endEditSession(),this.textDocumentCache=new WeakMap}syncEditedContentsToFile(){let{renderCache:e,lineCache:t}=this;e?.isDirty!==!0||t==null||!Be(t,e.file)||(e.file.contents=t.lines.join(``))}hasUnkeyedFileContentsChanged(e){let{lineCache:t}=this;return e.cacheKey==null&&t!=null&&t.file===e&&t.sourceContents!==e.contents}invalidateChangedUnkeyedFile(e){this.hasUnkeyedFileContentsChanged(e)&&(this.workerManager?.cleanUpTasks(this),this.clearRenderCache(),this.lineCache=void 0,this.textDocumentCache=new WeakMap)}clearRenderCache(){this.syncEditedContentsToFile(),this.pendingStructuralRows=void 0;let e=this.renderCache;this.renderCache=void 0,e!=null&&e.isDirty===!0&&e.file.cacheKey!=null&&this.workerManager?.evictFileFromCache(e.file.cacheKey)}hydrate(e){let{options:t}=this.getRenderOptions(e),n=Ue(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength()),r=this.workerManager?.getFileResultCache(e);r!=null&&!ke(t,r.options)&&(r=void 0),this.renderCache??={file:e,options:t,highlighted:!n&&!Ae(e),result:n?void 0:r?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightFileAST(this,e):this.highlighter??(this.computedLang=e.lang??Z(e.name),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getFileRenderOptions().theme??this.options.theme??y}getEffectiveCodeOptions(){let e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getFileRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0){let e=this.workerManager.getFileRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{tokenizeMaxLineLength:e=1e3}=this.options;return{theme:this.getLocalHighlightTheme(),useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:e}})(),{renderCache:n}=this;return n?.result==null||!R(e,n.file)||!ke(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getOrCreateLineCache(e){this.invalidateChangedUnkeyedFile(e);let{lineCache:t}=this;return(t==null||!Be(t,e))&&(t={cacheKey:e.cacheKey,file:e,sourceContents:e.contents,lines:Ie(e.contents)}),this.lineCache=t,t.lines}getLineCount(e){let t=this.getOrCreateLineCache(e);return this.textDocumentCache.get(e)?.lineCount??t.length}updateRenderCache(e,t,n=!1){if(this.pendingStructuralRows=void 0,this.renderCache==null)return;let{file:r,result:i}=this.renderCache;if(i==null)return;let a=n?new Map:void 0;this.pendingStructuralRows=a;let o=this.lineCache!=null&&Be(this.lineCache,r)?this.lineCache:void 0;for(let[t,n]of e){if(a===void 0&&o!=null&&t<o.lines.length){let e=n.map(e=>e[2]).join(``);o.lines[t]=H(o.lines[t]??``,e)}let e={type:`element`,tagName:`div`,properties:{"data-line":t+1,"data-line-type":`context`,"data-line-index":t},children:n.map(([e,t,n])=>e===0&&t===``?n===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:n}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`color:${t};`},children:[{type:`text`,value:n}]})};a===void 0?i.code[t]=e:a.set(t,e)}i.baseThemeType=t,this.renderCache.isDirty=!0}applyDocumentChange(e){let t=this.pendingStructuralRows;if(this.pendingStructuralRows=void 0,this.renderCache==null)return;let{file:n,result:r}=this.renderCache;if(r==null)return;let i=this.lineCache!=null&&Be(this.lineCache,n)?this.lineCache.lines:Ie(n.contents),a=Ie(e.getText());if(i.length!==a.length){let n=Math.min(i.length,a.length),o=0;for(;o<n&&i[o]===a[o];)o++;let s=0;for(;s<n-o&&i[i.length-1-s]===a[a.length-1-s];)s++;let c=r.code;r.code=Array(a.length);for(let e=0;e<o;e++)r.code[e]=c[e];for(let e=0;e<s;e++)r.code[a.length-1-e]=c[i.length-1-e];if(t!==void 0)for(let[e,n]of t)e<a.length&&(r.code[e]=n);for(let t=o;t<a.length-s;t++)r.code[t]??={type:`element`,tagName:`div`,properties:{"data-line":t+1,"data-line-type":`context`,"data-line-index":t},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:e.getLineText(t)}]}]};for(let e=0;e<r.code.length;e++){let t=r.code[e];t?.type===`element`&&(t.properties[`data-line`]=e+1,t.properties[`data-line-index`]=e)}this.renderCache.isDirty=!0}this.lineCache={cacheKey:n.cacheKey,file:n,sourceContents:n.contents,lines:a},this.textDocumentCache.set(n,e)}renderFile(e=this.renderCache?.file,t=j){if(e==null)return;this.invalidateChangedUnkeyedFile(e),this.renderCache?.isDirty===!0&&!R(e,this.renderCache.file)&&(this.clearRenderCache(),this.lineCache=void 0,this.textDocumentCache=new WeakMap);let{options:n,forceHighlight:r}=this.getRenderOptions(e);this.renderCache?.isDirty===!0&&!ke(n,this.renderCache.options)&&this.clearRenderCache();let i=this.getMatchingWorkerResultCache(e,n);i!=null&&!this.hasHighlightedRenderCache(e,n)&&(this.renderCache={file:e,highlighted:!0,renderRange:void 0,...i},r=!1),this.renderCache??={file:e,highlighted:!1,options:n,result:void 0,renderRange:void 0};let a=this.getOrCreateLineCache(e),o=e.contents.length>0,s=!o||Ae(e)||Ue(a.length,this.getTokenizeMaxLength()),c=!R(e,this.renderCache.file),l=!w(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0)(s||this.renderCache.result==null||!this.renderCache.highlighted&&(c||l))&&(this.renderCache.file=e,this.renderCache.options=n,this.renderCache.highlighted=!1,(this.renderCache.result==null||c||l||r)&&(this.renderCache.result=this.workerManager.getPlainFileAST(e,t.startingLine,t.totalLines,a)),this.renderCache.renderRange=t),!s&&o&&(!this.renderCache.highlighted||r)&&this.workerManager.highlightFileAST(this,e);else{this.computedLang=e.lang??Z(e.name);let t=this.highlighter!=null&&g(n.theme),i=this.highlighter!=null&&fe(this.computedLang),a=!s&&i;if(this.highlighter!=null&&t&&(r||s||!this.renderCache.highlighted&&a||this.renderCache.result==null)){let{result:t,options:n}=this.renderFileWithHighlighter(e,this.highlighter,s||!i);this.renderCache={file:e,options:n,highlighted:a,result:t,renderRange:void 0}}(!t||!s&&!i)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.renderCache!=null&&(this.renderCache.highlighted=!1),this.applyHighlightResult(e,t,n,!s)})}return this.renderCache.result==null?void 0:this.processFileResult(this.renderCache.file,t,this.renderCache.result)}async asyncRender(e,t=j){let{result:n}=await this.asyncHighlight(e);return this.processFileResult(e,t,n)}async asyncHighlight(e){let t=Ue(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??Z(e.name);let n=this.highlighter!=null&&Oe(ae(this.getLocalHighlightTheme())),r=t||this.highlighter!=null&&fe(this.computedLang);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderFileWithHighlighter(e,this.highlighter,t)}renderFileWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e);return{result:Re(e,t,r,{forcePlainText:n}),options:r}}processFileResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let a=this.getLineCount(e),{disableFileHeader:o=!1}=this.options,s=[],c=de(),l=Math.min(t.startingLine+t.totalLines,a),u=0,d=De(t)?C(this.lineAnnotations):void 0;d!=null&&(c.children.push(K(`context`,`annotation`,1)),s.push(E({type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:d.map(e=>L(e))})),u++);for(let r=t.startingLine;r<l;r++){let t=r+1,i=n[r];if(i==null){let n=`FileRenderer.processFileResult: Line doesnt exist`;throw console.error(n,{name:e.name,lineIndex:r,lineNumber:t}),Error(n)}c.children.push(X(`context`,t,`${r}`)),s.push(i),u++;let a=this.lineAnnotations[t];a!=null&&(c.children.push(K(`context`,`annotation`,1)),s.push(E({type:`annotation`,hunkIndex:0,lineIndex:t,annotations:a.map(e=>L(e))})),u++)}return c.properties.style=`grid-row: span ${u}`,{gutterAST:c.children??[],contentAST:s,preAST:this.createPreElement(a),headerAST:o?void 0:this.renderHeader(e),totalLines:a,rowCount:u,themeStyles:r,baseThemeType:i,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderHeader(e){let{headerRenderMode:t=`default`,stickyHeader:n=!1}=this.options;return b({fileOrDiff:e,mode:t,stickyHeader:n})}renderFullHTML(e){return l(this.renderFullAST(e))}renderFullAST(e,t=[]){return t.push(I({tagName:`code`,children:this.renderCodeAST(e),properties:{"data-code":``}})),{...e.preAST,children:t}}renderCodeAST(e){let t=de();return t.children=e.gutterAST,t.properties.style=`grid-row: span ${e.rowCount}`,[t,ee(e.contentAST,e.rowCount)]}renderPartialHTML(e,t=!1){return l(t?I({tagName:`code`,children:e,properties:{"data-code":``}}):e)}async initializeHighlighter(){return this.highlighter=await ye(Se(this.computedLang,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){if(this.renderCache==null)return;let i=!R(e,this.renderCache.file)||!this.renderCache.highlighted||!ke(n,this.renderCache.options);this.renderCache={file:e,options:n,highlighted:r,result:t,renderRange:void 0},i&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getFileResultCache(e);if(!(n==null||!ke(t,n.options)))return n}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&R(e,n.file)&&ke(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}createPreElement(e){let{disableLineNumbers:t=!1,overflow:n=`scroll`}=this.options;return M({type:`file`,diffIndicators:`none`,disableBackground:!0,disableLineNumbers:t,overflow:n,split:!1,totalLines:e})}};function Ue(e,t){return e>t}function We(e,t){return e.lineNumber===t.lineNumber&&e.metadata===t.metadata}function Ge(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,themeType:e?.themeType,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:me(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,unsafeCSS:e?.unsafeCSS,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}var Ke=[``],qe=-1,Je=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file:${++qe}`;type=`file`;fileContainer;spriteSVG;pre;code;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;errorWrapper;placeHolder;lastRenderedHeaderHTML;cachedHeaderHTML;appliedPreAttributes;lastRowCount;mounted=!1;headerElement;headerCustom;headerPrefix;headerFilenameSuffix;headerMetadata;fileRenderer;resizeManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;file;renderRange;enabled=!0;editor;constructor(e={theme:y},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.fileRenderer=new He(e,this.handleHighlightRender,this.workerManager),this.resizeManager=new T,this.interactionManager=new O(`file`,S(e)),this.workerManager?.subscribeToThemeChanges(this)}handleHighlightRender=()=>{this.rerender()};rerender(){!this.enabled||this.file==null||this.render({file:this.file,forceRender:!0,renderRange:this.renderRange})}__getCurrentFile(){return this.file}onThemeChange(){this.fileRenderer.clearRenderCache(),this.rerender()}setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(S(this.options))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType===t?!1:(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!Y(this.appliedThemeCSS.theme,this.options.theme??y)}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}getCodeScrollLeft(){return this.code?.scrollLeft??0}setCodeScrollLeft(e){this.code!=null&&(this.code.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.fileRenderer.getEffectiveCodeOptions()}}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{overflow:e=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:e===`wrap`,columnVariables:this.shouldApplyColumnVariables(e)?`apply`:`measure`}),this.managersDirty=!1}shouldApplyColumnVariables(e){return e===`scroll`&&this.lineAnnotations.length>0}cleanUp(e=!1){this.emitPostRender(!0),this.editor?.cleanUp(e),this.editor=void 0,this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.pre=void 0,this.code=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,e?this.fileRenderer.recycle():(this.fileRenderer.cleanUp(),this.workerManager=void 0,this.file=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){let{fileContainer:t,prerenderedHTML:n,preventEmit:r=!1,file:i,lineAnnotations:a}=e;if(!this.enabled)throw Error(`File.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`File.hydrate: hydrate can only be called before the instance has rendered or hydrated`);this.hydrateElements(t,n),Ye(this.pre,i,this.options.collapsed)||Xe(this.headerElement,i,this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):this.hydrationSetup({file:i,lineAnnotations:a}),r||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),U(e,t);for(let t of Array.from(e.shadowRoot?.children??[])){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t,this.appliedPreAttributes=void 0;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}if(`diffsHeader`in t.dataset){this.headerElement=t,this.lastRenderedHeaderHTML=void 0;continue}}}this.pre!=null&&(this.syncCodeNodeFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({file:e,lineAnnotations:t}){this.lineAnnotations=t??this.lineAnnotations,this.file=e,this.fileRenderer.setOptions(Ge(this.options)),this.syncInteractionOptions(),this.pre!=null&&(this.fileRenderer.hydrate(e),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}getOrCreateLineCache(e=this.file){return e==null?Ke:this.fileRenderer.getOrCreateLineCache(e)}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}syncRenderViewToEditor(){let e=this.editor,t=this.fileContainer,n=this.file,r=this.lineAnnotations,i=this.renderRange;e!=null&&t!=null&&n!=null&&this.fileRenderer.initializeHighlighter().then(a=>{!this.enabled||this.editor!==e||this.fileContainer!==t||this.file!==n||e.__syncRenderView(a,t,n,r,i)})}attachEditor(e){this.editor?.cleanUp(),this.editor=e,this.fileRenderer.beginEditSession();let t=this.file==null?void 0:e.__prepareFile?.(this.file);return t!==void 0&&t!==this.file?this.renderPreparedFile({file:t,forceRender:!0,preventEmit:!0,renderRange:this.renderRange}):this.fileRenderer.editorRenderReady()?this.syncRenderViewToEditor():this.rerender(),()=>{this.editor=void 0,this.fileRenderer.endEditSession()}}applyDocumentChange(e,t){this.fileRenderer.applyDocumentChange(e),t!=null&&t!==this.lineAnnotations&&this.file!=null&&(this.setLineAnnotations(t),this.fileRenderer.setLineAnnotations(this.lineAnnotations),this.renderAnnotations())}updateRenderCache(e,t,n){this.fileRenderer.updateRenderCache(e,t,n?.lineCountChangeInFlight)}render(e){if(!this.enabled)throw Error(`File.render: attempting to call render after cleaned up`);let t=this.editor?.__prepareFile?.(e.file)??e.file;return this.renderPreparedFile(t===e.file?e:{...e,file:t})}renderPreparedFile({file:e,fileContainer:t,forceRender:n=!1,preventEmit:r=!1,containerWrapper:i,deferManagers:a=!1,lineAnnotations:o,renderRange:s}){this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:c=!1,themeType:l=`system`}=this.options,u=c?void 0:s,d=this.renderRange,f=this.hasThemeChanged(),p=o!=null&&(o.length>0||this.lineAnnotations.length>0)?o!==this.lineAnnotations:!1,m=!R(this.file,e)||this.fileRenderer.hasUnkeyedFileContentsChanged(e);if(!c&&!n&&w(u,this.renderRange)&&!m&&!p&&!f)return this.applyCachedThemeState(l);this.renderRange=u,m&&(this.cachedHeaderHTML=void 0),this.file=e,this.fileRenderer.setOptions(Ge(this.options)),this.syncInteractionOptions(),o!=null&&this.setLineAnnotations(o),this.fileRenderer.setLineAnnotations(this.lineAnnotations);let{disableErrorHandling:h=!1,disableFileHeader:g=!1}=this.options;if(g&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),t=this.getOrCreateFileContainerNode(t,i),this.applyCachedThemeState(l),c){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let n=this.fileRenderer.renderFile(e,N);n!=null&&this.applyThemeState(t,n.themeStyles,l,n.baseThemeType),n?.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t),this.injectUnsafeCSS()}catch(e){if(h)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return r||this.emitPostRender(),!0}try{let r=this.getOrCreatePreNode(t);if(!this.canPartiallyRender(n,p,m||f)||!this.applyPartialRender(d,u)){let n=this.fileRenderer.renderFile(e,u);if(n==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(t,n.themeStyles,l,n.baseThemeType),n.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t),this.applyFullRender(n,r)}this.applyBuffers(r,u),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,a||this.flushManagers(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(h)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return r||this.emitPostRender(),!0}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;n?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}removeRenderedCode(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.code?.remove(),this.code=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}canPartiallyRender(e,t,n){return!(e||t||n)}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty(`height`,`${e}px`),!0}async primeHighlightCache(e=this.file){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||Ae(e))return;let n=this.options.tokenizeMaxLength??1e5;this.fileRenderer.getOrCreateLineCache(e).length>n||await t.primeFileHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.code?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.code=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(t!=null&&this.lineAnnotations.length>0)for(let[n,r]of this.lineAnnotations.entries()){let i=`${n}-${L(r)}`,a=this.annotationCache.get(i);if(a==null||!We(r,a.annotation)){a?.element.remove();let e=t(r);if(e==null)continue;a={element:Ce(L(r)),annotation:r},a.element.appendChild(e),this.fileContainer.appendChild(a.element),this.annotationCache.set(i,a)}e.delete(i)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=re();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}this.unsafeCSSStyle?.parentNode===t&&this.appliedUnsafeCSS===e||(this.unsafeCSSStyle??=Te(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=P(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??y,s=typeof o==`string`?o:{...o},c=be(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=oe({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:ue(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e==null||this.themeCSSStyle==null||(this.themeCSSStyle.textContent=B(this.themeCSSStyle.textContent??``,be(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&ve()}applyFullRender(e,t){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,e);let n=this.code=J({code:this.code}),r=this.fileRenderer.renderCodeAST(e);this.editor?.__captureFocusForDOMReplacement();let i=()=>{if(n.childElementCount>=2)for(let e=0;e<2;e++){let t=n.children[e],i=r[e];t.innerHTML=l(i.children),t.style.cssText=i.properties.style}else n.innerHTML=l(r);t.contains(n)||t.replaceChildren(n)};this.shouldGuardRebuildScroll()?le(t,i):i(),this.lastRowCount=e.rowCount}applyPartialRender(e,t){if(e==null||t==null)return!1;let{file:n,code:r}=this,i=r==null?void 0:this.getColumns(r);if(n==null||r==null||i==null)return!1;let a=e.startingLine,o=t.startingLine,s=e.totalLines===1/0?1/0:a+e.totalLines,c=t.totalLines===1/0?1/0:o+t.totalLines,l=Math.max(a,o),u=Math.min(s,c);if(u<=l)return!1;if(!this.trimDOMToOverlap(i.gutter,l,u)||!this.trimDOMToOverlap(i.content,l,u))throw Error(`File.applyPartialRender: failed to trim to overlap`);let{length:d}=i.content.children,f=(e,t)=>{if(!(t<=0))return this.fileRenderer.renderFile(n,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},p=o<l?f(o,l-o):void 0;if(p===void 0&&o<l)return!1;let m=c===1/0?1/0:Math.max(0,c-u),h=c>u?f(u,m):void 0;return h===void 0&&c>u?!1:(this.cleanupErrorWrapper(),p!=null&&(i.gutter.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.gutterAST)),i.content.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.contentAST)),d+=p.rowCount),h!=null&&(i.gutter.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.gutterAST)),i.content.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.contentAST)),d+=h.rowCount),this.lastRowCount!==d&&(i.gutter.style.setProperty(`grid-row`,`span ${d}`),i.content.style.setProperty(`grid-row`,`span ${d}`),this.lastRowCount=d),!0)}getColumns(e){let t=e.children[0],n=e.children[1];if(!(!(t instanceof HTMLElement)||!(n instanceof HTMLElement)||t.dataset.gutter==null||n.dataset.content==null))return{gutter:t,content:n}}trimDOMToOverlap(e,t,n){let r=this.getDOMBoundaryIndices(e,[t,n]),i=r.get(t)??e.children.length,a=r.get(n)??e.children.length;if(i>a)return!1;for(let t=e.children.length-1;t>=a;--t)e.children[t]?.remove();for(let t=i-1;t>=0;--t)e.children[t]?.remove();return!0}getDOMBoundaryIndices(e,t){let n=[...new Set(t)].sort((e,t)=>e-t),r=new Map;if(n.length===0)return r;let i=0,a=n[i],{children:o}=e;a===0&&(r.set(0,0),i+=1,a=n[i]);for(let e=0;e<o.length;e+=1){let t=o[e];if(!(t instanceof HTMLElement))continue;let s=this.getLineIndexFromDOMNode(t);if(s!=null){for(;a!=null&&s>=a;)r.set(a,e),i+=1,a=n[i];if(i>=n.length)break}}for(let e of n)r.has(e)||r.set(e,o.length);return r}getLineIndexFromDOMNode(e){let t=e.dataset.lineIndex;if(t==null)return;let n=Number(t);return Number.isNaN(n)?void 0:n}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyHeaderToDOM(e,t){let{file:n}=this;if(n==null)return;this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let r=this.cachedHeaderHTML??l(e);if(this.cachedHeaderHTML=r,r!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=r;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.lastRenderedHeaderHTML=r}if(this.isContainerManaged)return;let{renderHeaderPrefix:i,renderHeaderFilenameSuffix:a,renderCustomHeader:o,renderHeaderMetadata:s}=this.options;if(o!=null){let e=o(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,we,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0}else{let e=i?.(n)??void 0,r=a?.(n)??void 0,o=s?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,D,e),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,x,r),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,te,o),this.headerCustom?.remove(),this.headerCustom=void 0}}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}getOrCreateFileContainerNode(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:_(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):_(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=v;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.code=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),e.shadowRoot?.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodeFromPre(e){this.code=void 0;for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.hasAttribute(`data-code`)){this.code=t;return}}applyPreNodeAttributes(e,{totalLines:t}){let{overflow:n=`scroll`,disableLineNumbers:r=!1}=this.options,i={type:`file`,split:!1,overflow:n,disableLineNumbers:r,diffIndicators:`none`,disableBackground:!0,totalLines:t};A(i,this.appliedPreAttributes)||(ie(e,i),this.appliedPreAttributes=i)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function Ye(e,t,n=!1){return!n&&e==null&&t!=null}function Xe(e,t,n=!1){return e==null&&t!=null&&!n}var Ze=class extends he{pendingConflictActions=[];pendingMarkerRows=[];injectedRows=new Map;options;constructor(e={theme:y},t,n){super(void 0,t,n),this.options=e}setConflictState(e,t,n){this.pendingConflictActions=e,this.pendingMarkerRows=t,this.syncInjectedRows(e,t,n)}syncInjectedRows(e,t,n){this.injectedRows.clear();for(let t of e){let e=t==null?void 0:V(t,n);if(t==null||e==null)continue;let r={type:`actions`,hunkIndex:e.hunkIndex,lineIndex:e.lineIndex,conflictIndex:t.conflictIndex};this.addInjectedRow(r)}for(let e of t)this.addInjectedRow(e)}addInjectedRow(e){let t=`${e.hunkIndex}:${e.lineIndex}`,n=this.injectedRows.get(t);n==null?this.injectedRows.set(t,[e]):n.push(e)}renderDiff(e,t=j){return e!=null&&this.syncInjectedRows(this.pendingConflictActions,this.pendingMarkerRows,e),super.renderDiff(e,t)}async asyncRender(e,t=j){return this.syncInjectedRows(this.pendingConflictActions,this.pendingMarkerRows,e),super.asyncRender(e,t)}createPreElement(e,t){return super.createPreElement(e,t,{"data-has-merge-conflict":``})}getUnifiedLineDecoration({type:e,lineType:t}){let n=e===`change`?t===`change-deletion`?`current`:`incoming`:void 0;return{gutterLineType:e===`change`?`context`:t,gutterProperties:Qe(n),contentProperties:$e(e,n)}}getSplitLineDecoration({side:e,type:t}){let n=t===`change`?e===`deletions`?`current`:`incoming`:void 0;return{gutterLineType:t===`change`?`context`:t,gutterProperties:Qe(n),contentProperties:$e(t,n)}}getUnifiedInjectedRowsForLine=e=>{let t=this.injectedRows.get(`${e.hunkIndex}:${e.lineIndex}`);if(t==null||t.length===0)return;let{mergeConflictActionsType:n}=this.getOptionsWithDefaults(),r=[],i=[];for(let e of t){if(e.type===`actions`){r.push({content:tt({row:e,includeDefaultActions:n===`default`,includeSlot:!0}),gutter:et(`action`)});continue}(e.type===`marker-end`?i:r).push({content:nt(e),gutter:et(`marker`,e.type)})}return{before:r.length>0?r:void 0,after:i.length>0?i:void 0}};getOptionsWithDefaults(){let e=super.getOptionsWithDefaults();return e.diffStyle=`unified`,e.lineDiffType=this.options.lineDiffType??`none`,e.mergeConflictActionsType=this.options.mergeConflictActionsType??`default`,e}};function Qe(e){return e==null?void 0:{"data-merge-conflict":e}}function $e(e,t){if(t!=null){if(e===`change`)return t===`current`||t===`incoming`?{"data-line-type":`context`,"data-merge-conflict":t}:void 0;if(t===`marker-start`||t===`marker-base`||t===`marker-separator`||t===`marker-end`)return{"data-merge-conflict":t}}}function et(e,t){let n=K(void 0,`annotation`,1);return n.properties[`data-gutter-buffer`]=e===`action`?`merge-conflict-action`:`merge-conflict-${t??`marker`}`,n}function tt({row:e,includeDefaultActions:t,includeSlot:n}){let r=t?rt(e.conflictIndex):[];return n&&r.push(I({tagName:`slot`,properties:{name:Ee({hunkIndex:e.hunkIndex,lineIndex:e.lineIndex,conflictIndex:e.conflictIndex}),"data-merge-conflict-action-slot":``}})),I({tagName:`div`,properties:{"data-merge-conflict-actions":``},children:[I({tagName:`div`,properties:{"data-merge-conflict-actions-content":``},children:r})]})}function nt(e){return I({tagName:`div`,properties:{"data-merge-conflict":e.type,"data-merge-conflict-marker-row":``},children:[q(e.lineText.replace(/(?:\r\n|\n|\r)$/,``))]})}function rt(e){return[it({resolution:`current`,label:`Accept current change`,conflictIndex:e}),at(),it({resolution:`incoming`,label:`Accept incoming change`,conflictIndex:e}),at(),it({resolution:`both`,label:`Accept both`,conflictIndex:e})]}function it({resolution:e,label:t,conflictIndex:n}){return I({tagName:`button`,properties:{type:`button`,"data-merge-conflict-action":e,"data-merge-conflict-conflict-index":`${n}`},children:[q(t)]})}function at(){return I({tagName:`span`,properties:{"data-merge-conflict-action-separator":``},children:[q(`|`)]})}function ot(e,t){return e.hunkIndex===t.hunkIndex&&e.startContentIndex===t.startContentIndex&&e.endContentIndex===t.endContentIndex&&e.currentContentIndex===t.currentContentIndex&&e.baseContentIndex===t.baseContentIndex&&e.incomingContentIndex===t.incomingContentIndex&&e.endMarkerContentIndex===t.endMarkerContentIndex&&e.conflictIndex===t.conflictIndex&&st(e.conflict,t.conflict)}function st(e,t){return e.conflictIndex===t.conflictIndex&&e.startLineIndex===t.startLineIndex&&e.startLineNumber===t.startLineNumber&&e.separatorLineIndex===t.separatorLineIndex&&e.separatorLineNumber===t.separatorLineNumber&&e.endLineIndex===t.endLineIndex&&e.endLineNumber===t.endLineNumber&&e.baseMarkerLineIndex===t.baseMarkerLineIndex&&e.baseMarkerLineNumber===t.baseMarkerLineNumber}function ct(e){let t=typeof e==`string`?e:e.type;return t===`accept`||t===`incoming`?`additions`:t===`reject`||t===`current`?`deletions`:`both`}function lt(e,t){let{resolution:n,hunkIndex:r,startContentIndex:i,endContentIndex:a,indexesToDelete:o=new Set}=t,s=e.hunks[r];if(s==null)throw console.error({diff:e,hunkIndex:r}),Error(`resolveRegion: Invalid hunk index: ${r}`);if(i<0||a>=s.hunkContent.length||i>a)throw Error(`resolveRegion: Invalid content range, ${i}, ${a}`);let{hunks:c,additionLines:l,deletionLines:u}=e,d={...e,hunks:[],deletionLines:[],additionLines:[],splitLineCount:0,unifiedLineCount:0,cacheKey:e.cacheKey==null?void 0:`${e.cacheKey}:${n[0]}-${r}:${i}-${a}`},f={nextAdditionLineIndex:0,nextDeletionLineIndex:0,nextAdditionStart:1,nextDeletionStart:1,splitLineCount:0,unifiedLineCount:0},p=r===c.length-1&&a===s.hunkContent.length-1,m=!e.isPartial;for(let[t,s]of c.entries()){dt(e,d,f,xe(s.deletionStart,s.deletionCount)-s.collapsedBefore,xe(s.additionStart,s.additionCount)-s.collapsedBefore,s.collapsedBefore,m);let c={...s,hunkContent:[],additionStart:f.nextAdditionStart,deletionStart:f.nextDeletionStart,additionLineIndex:f.nextAdditionLineIndex,deletionLineIndex:f.nextDeletionLineIndex,additionCount:0,deletionCount:0,deletionLines:0,additionLines:0,splitLineStart:f.splitLineCount,unifiedLineStart:f.unifiedLineCount,splitLineCount:0,unifiedLineCount:0};for(let[e,p]of s.hunkContent.entries())if(t!==r||e<i||e>a){ft(p,d,u,l);let e={...p,additionLineIndex:f.nextAdditionLineIndex,deletionLineIndex:f.nextDeletionLineIndex};c.hunkContent.push(e),mt(e,f,c)}else if(o.has(e))c.hunkContent.push({type:`context`,lines:0,deletionLineIndex:f.nextDeletionLineIndex,additionLineIndex:f.nextAdditionLineIndex});else if(p.type===`context`){ft(p,d,u,l);let e={...p,deletionLineIndex:f.nextDeletionLineIndex,additionLineIndex:f.nextAdditionLineIndex};c.hunkContent.push(e),mt(e,f,c)}else{pt(n,p,d,u,l);let e={type:`context`,lines:n===`deletions`?p.deletions:n===`additions`?p.additions:p.deletions+p.additions,deletionLineIndex:f.nextDeletionLineIndex,additionLineIndex:f.nextAdditionLineIndex};c.hunkContent.push(e),mt(e,f,c)}if(t===r&&p){let e=n===`deletions`?s.noEOFCRDeletions:s.noEOFCRAdditions;c.noEOFCRAdditions=e,c.noEOFCRDeletions=e}c.additionCount===0&&(c.additionStart--,e.isPartial||c.additionLineIndex--),c.deletionCount===0&&(c.deletionStart--,e.isPartial||c.deletionLineIndex--),d.hunks.push(c)}let h=c.at(-1);if(h!=null&&!e.isPartial){let e=F(h.deletionStart,h.deletionCount),t=F(h.additionStart,h.additionCount),n=Math.min(u.length-e,l.length-t);ut(d,u,l,e,t,n),f.splitLineCount+=n,f.unifiedLineCount+=n}return d.splitLineCount=f.splitLineCount,d.unifiedLineCount=f.unifiedLineCount,d}function ut(e,t,n,r,i,a){for(let o=0;o<a;o++){let a=t[r+o],s=n[i+o];if(a==null||s==null)throw Error(`pushCollapsedContextLines: missing collapsed context line`);e.deletionLines.push(a),e.additionLines.push(s)}}function dt(e,t,n,r,i,a,o){a<=0||(o&&(ut(t,e.deletionLines,e.additionLines,r,i,a),n.nextAdditionLineIndex+=a,n.nextDeletionLineIndex+=a),n.nextAdditionStart+=a,n.nextDeletionStart+=a,n.splitLineCount+=a,n.unifiedLineCount+=a)}function ft(e,t,n,r){if(e.type===`context`)for(let n=0;n<e.lines;n++){let i=r[e.additionLineIndex+n];if(i==null)throw console.error({additionLines:r,content:e,i:n}),Error(`pushContentLinesToDiff: Context line does not exist`);t.deletionLines.push(i),t.additionLines.push(i)}else{let i=Math.max(e.deletions,e.additions);for(let a=0;a<i;a++){if(a<e.deletions){let r=n[e.deletionLineIndex+a];if(r==null)throw console.error({deletionLines:n,content:e,i:a}),Error(`pushContentLinesToDiff: Deletion line does not exist`);t.deletionLines.push(r)}if(a<e.additions){let n=r[e.additionLineIndex+a];if(n==null)throw console.error({additionLines:r,content:e,i:a}),Error(`pushContentLinesToDiff: Addition line does not exist`);t.additionLines.push(n)}}}}function pt(e,t,n,r,i){if(e===`deletions`||e===`both`)for(let e=0;e<t.deletions;e++){let i=r[t.deletionLineIndex+e];if(i==null)throw console.error({deletionLines:r,content:t,i:e}),Error(`pushResolveLinesToDiff: Deletion line does not exist`);n.deletionLines.push(i),n.additionLines.push(i)}if(e===`additions`||e===`both`)for(let e=0;e<t.additions;e++){let r=i[t.additionLineIndex+e];if(r==null)throw console.error({additionLines:i,content:t,i:e}),Error(`pushResolveLinesToDiff: Addition line does not exist`);n.deletionLines.push(r),n.additionLines.push(r)}}function mt(e,t,n){e.type===`context`?(t.nextAdditionLineIndex+=e.lines,t.nextDeletionLineIndex+=e.lines,t.nextAdditionStart+=e.lines,t.nextDeletionStart+=e.lines,t.splitLineCount+=e.lines,t.unifiedLineCount+=e.lines,n.additionCount+=e.lines,n.deletionCount+=e.lines,n.splitLineCount+=e.lines,n.unifiedLineCount+=e.lines):(t.nextAdditionLineIndex+=e.additions,t.nextDeletionLineIndex+=e.deletions,t.nextAdditionStart+=e.additions,t.nextDeletionStart+=e.deletions,t.splitLineCount+=Math.max(e.deletions,e.additions),t.unifiedLineCount+=e.deletions+e.additions,n.deletionCount+=e.deletions,n.deletionLines+=e.deletions,n.additionCount+=e.additions,n.additionLines+=e.additions,n.splitLineCount+=Math.max(e.deletions,e.additions),n.unifiedLineCount+=e.deletions+e.additions)}function ht(e,t,n){return lt(e,{resolution:ct(n),hunkIndex:t.hunkIndex,startContentIndex:t.startContentIndex,endContentIndex:t.endContentIndex,indexesToDelete:gt(t)})}function gt(e){let t=new Set;return e.baseContentIndex!=null&&t.add(e.baseContentIndex),e.endMarkerContentIndex!==e.endContentIndex&&t.add(e.endMarkerContentIndex),t}var _t=-1,vt=class extends G{options;__id=`unresolved-file:${++_t}`;type=`unresolved-file`;computedCache={file:void 0,fileDiff:void 0,actions:void 0,markerRows:void 0};conflictActions=[];markerRows=[];conflictActionCache=new Map;constructor(e={theme:y},t,n=!1){super(void 0,t,n),this.options=e,this.setOptions(e)}setOptions(e){if(e!=null){if(e.onMergeConflictAction!=null&&e.onMergeConflictResolve!=null)throw Error(`UnresolvedFile: onMergeConflictAction and onMergeConflictResolve are mutually exclusive. Use only one callback.`);this.options=e,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions()}}syncInteractionOptions(){this.interactionManager.setOptions(S(this.options,typeof this.options.hunkSeparators==`function`||(this.options.hunkSeparators??`line-info`)===`line-info`||this.options.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex,this.handleMergeConflictActionClick))}createHunksRenderer(e){return new Ze(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getHunksRendererOptions(e){return Dt(e,this.options)}applyPreNodeAttributes(e,t){super.applyPreNodeAttributes(e,t,{"data-has-merge-conflict":``})}cleanUp(){this.emitPostRender(!0),this.clearMergeConflictActionCache(),this.computedCache={file:void 0,fileDiff:void 0,actions:void 0,markerRows:void 0},this.conflictActions=[],super.cleanUp()}getOrComputeDiff({file:e,fileDiff:t,actions:n,markerRows:r}){let{maxContextLines:i,onMergeConflictAction:a}=this.options;wrapper:if(a!=null){let a=t!=null;if(a!==(n!=null)||a!==(r!=null))throw Error(`UnresolvedFile.getOrComputeDiff: fileDiff, actions, and markerRows must be passed together`);if(t!=null&&n!=null&&r!=null){this.computedCache={file:e??this.computedCache.file,fileDiff:t,actions:n,markerRows:r};break wrapper}else if(e!=null||this.computedCache.file!=null){if(e!=null&&this.computedCache.file!=null&&!R(e,this.computedCache.file)&&this.computedCache.fileDiff!=null&&this.computedCache.actions!=null)throw Error(`UnresolvedFile.getOrComputeDiff: file can only be used to initialize unresolved state once. Pass fileDiff and actions for subsequent updates.`);if(e??=this.computedCache.file,e==null)throw Error(`UnresolvedFile.getOrComputeDiff: file is null, should be impossible`);if(!R(e,this.computedCache.file)||this.computedCache.fileDiff==null||this.computedCache.actions==null){let t=z(e,i);this.computedCache={file:e,fileDiff:t.fileDiff,actions:t.actions,markerRows:t.markerRows}}t=this.computedCache.fileDiff,n=this.computedCache.actions,r=this.computedCache.markerRows;break wrapper}else{t=this.computedCache.fileDiff,n=this.computedCache.actions,r=this.computedCache.markerRows;break wrapper}}else{if(t!=null||n!=null||r!=null)throw Error("UnresolvedFile.getOrComputeDiff: fileDiff, actions, and markerRows are only usable in controlled mode, you must pass in `onMergeConflictAction`");if(e!=null&&this.computedCache.file!=null&&!R(e,this.computedCache.file))throw Error(`UnresolvedFile.getOrComputeDiff: uncontrolled unresolved files parse the file only once. Later updates must come from the cached diff state.`);if(this.computedCache.file??=e,this.computedCache.fileDiff==null&&this.computedCache.file!=null){let e=z(this.computedCache.file,i);this.computedCache.fileDiff=e.fileDiff,this.computedCache.actions=e.actions,this.computedCache.markerRows=e.markerRows}t=this.computedCache.fileDiff,n=this.computedCache.actions,r=this.computedCache.markerRows;break wrapper}if(!(t==null||n==null||r==null))return{fileDiff:t,actions:n,markerRows:r}}hydrate(e){let{file:t,fileDiff:n,actions:r,markerRows:i,lineAnnotations:a,fileContainer:o,prerenderedHTML:s,preventEmit:c=!1}=e,l=this.getOrComputeDiff({file:t,fileDiff:n,actions:r,markerRows:i});l!=null&&(this.hydrateElements(o,s),this.setActiveMergeConflictState(l.actions,l.markerRows),Tt(this.pre,l.fileDiff,this.options.collapsed)||Et(this.headerElement,l.fileDiff,this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):(this.hydrationSetup({fileDiff:l.fileDiff,lineAnnotations:a}),this.pre!=null&&this.renderMergeConflictActionSlots()),c||this.emitPostRender())}rerender(){!this.enabled||this.fileDiff==null||this.render({forceRender:!0,renderRange:this.renderRange})}render(e={}){let{file:t,fileDiff:n,actions:r,markerRows:i,lineAnnotations:a,preventEmit:o=!1,...s}=e,c=this.getOrComputeDiff({file:t,fileDiff:n,actions:r,markerRows:i});if(c==null)return!1;this.setActiveMergeConflictState(c.actions,c.markerRows);let l=super.render({...s,fileDiff:c.fileDiff,lineAnnotations:a,preventEmit:!0});return l&&(this.renderMergeConflictActionSlots(),o||this.emitPostRender()),l}resolveConflict(e,t,n=this.computedCache.fileDiff){let r=this.conflictActions[e];if(n==null||r==null)return;if(r.conflictIndex!==e)throw console.error({conflictIndex:e,action:r}),Error(`UnresolvedFile.resolveConflict: conflictIndex and conflictAction don't match`);let i=ht(n,r,t),a=this.computedCache.file,{file:o,actions:s,markerRows:c}=yt({fileDiff:i,previousActions:this.conflictActions,resolvedConflictIndex:e,previousFile:a,resolution:t});return{file:o,fileDiff:i,actions:s,markerRows:c}}resolveConflictAndRender(e,t){let n=this.conflictActions[e];if(n==null)return;if(n.conflictIndex!==e)throw console.error({conflictIndex:e,action:n}),Error(`UnresolvedFile.resolveConflictAndRender: conflictIndex and conflictAction don't match`);let r={resolution:t,conflict:n.conflict},{file:i,fileDiff:a,actions:o,markerRows:s}=this.resolveConflict(e,t)??{};i==null||a==null||o==null||s==null||(this.computedCache={file:i,fileDiff:a,actions:o,markerRows:s},this.setActiveMergeConflictState(o,s),this.workerManager==null?this.render({forceRender:!0}):this.hunksRenderer.renderDiff(a),this.options.onMergeConflictResolve?.(i,r))}setActiveMergeConflictState(e=this.conflictActions,t=this.markerRows){this.conflictActions=e,this.markerRows=t,this.computedCache.fileDiff!=null&&this.hunksRenderer instanceof Ze&&this.hunksRenderer.setConflictState(this.options.mergeConflictActionsType===`none`?[]:e,t,this.computedCache.fileDiff)}handleMergeConflictActionClick=e=>{let t=this.conflictActions[e.conflictIndex];if(t==null)return;if(t.conflictIndex!==e.conflictIndex)throw console.error({conflictIndex:e.conflictIndex,action:t}),Error(`UnresolvedFile.handleMergeConflictActionClick: conflictIndex and conflictAction don't match`);let n={resolution:e.resolution,conflict:t.conflict};if(this.options.onMergeConflictAction!=null){this.options.onMergeConflictAction(n,this);return}this.resolveConflictAndRender(e.conflictIndex,e.resolution)};renderMergeConflictActionSlots(){let{fileDiff:e}=this.computedCache;if(this.isContainerManaged||this.fileContainer==null||typeof this.options.mergeConflictActionsType!=`function`||this.conflictActions.length===0||e==null){this.clearMergeConflictActionCache();return}let t=new Map(this.conflictActionCache);for(let n=0;n<this.conflictActions.length;n++){let r=this.conflictActions[n];if(r==null)continue;if(r.conflictIndex!==n)throw console.error({conflictIndex:n,action:r}),Error(`UnresolvedFile.renderMergeConflictActionSlots: conflictIndex and conflictAction don't match`);let i=V(r,e);if(i==null)continue;let a=r.conflictIndex,o=Ee({hunkIndex:i.hunkIndex,lineIndex:i.lineIndex,conflictIndex:a}),s=`${n}-${o}`,c=this.conflictActionCache.get(s);if(c==null||!ot(c.action,r)){c?.element.remove();let e=this.renderMergeConflictAction(r);if(e==null)continue;let t=Ce(o);t.appendChild(e),this.fileContainer.appendChild(t),c={element:t,action:r},this.conflictActionCache.set(s,c)}t.delete(s)}for(let[e,{element:n}]of t.entries())this.conflictActionCache.delete(e),n.remove()}renderMergeConflictAction(e){if(typeof this.options.mergeConflictActionsType!=`function`)return;let t=this.options.mergeConflictActionsType(e,this);if(t!=null){if(t instanceof HTMLElement)return t;if(typeof DocumentFragment<`u`&&t instanceof DocumentFragment){let e=document.createElement(`div`);return e.style.display=`contents`,e.appendChild(t),e}}}clearMergeConflictActionCache(){for(let{element:e}of this.conflictActionCache.values())e.remove();this.conflictActionCache.clear()}};function yt({fileDiff:e,previousActions:t,resolvedConflictIndex:n,previousFile:r,resolution:i}){let a=t[n];if(a==null)throw Error(`rebuildFileAndActions: missing resolved action for unresolved file rebuild`);let o=St(t,n,a,i),s=W(e,o);return{file:bt({fileDiff:e,resolvedAction:a,resolvedConflictIndex:n,previousFile:r,resolution:i}),actions:o,markerRows:s}}function bt({resolvedAction:e,resolvedConflictIndex:t,previousFile:n,fileDiff:r,resolution:i}){let a=ne(n?.contents??``),{conflict:o}=e,s=xt(a,o,i),c=[...a.slice(0,o.startLineIndex),...s,...a.slice(o.endLineIndex+1)].join(``);return{name:n?.name??r.name,contents:c,cacheKey:n?.cacheKey==null?void 0:`${n.cacheKey}:mc-${t}-${i}`}}function xt(e,t,n){let r=e.slice(t.startLineIndex+1,t.baseMarkerLineIndex??t.separatorLineIndex),i=e.slice(t.separatorLineIndex+1,t.endLineIndex);return n===`current`?r:n===`incoming`?i:[...r,...i]}function St(e,t,n,r){let i=Ct(n.conflict,r);return e.map((e,r)=>{if(r!==t&&e!=null)return e.conflict.startLineIndex>n.conflict.endLineIndex?{...e,conflict:wt(e.conflict,i)}:e})}function Ct(e,t){let n=(e.baseMarkerLineIndex??e.separatorLineIndex)-e.startLineIndex-1,r=e.endLineIndex-e.separatorLineIndex-1;return(t===`current`?n:t===`incoming`?r:n+r)-(e.endLineIndex-e.startLineIndex+1)}function wt(e,t){return{...e,startLineIndex:e.startLineIndex+t,startLineNumber:e.startLineNumber+t,separatorLineIndex:e.separatorLineIndex+t,separatorLineNumber:e.separatorLineNumber+t,endLineIndex:e.endLineIndex+t,endLineNumber:e.endLineNumber+t,baseMarkerLineIndex:e.baseMarkerLineIndex==null?void 0:e.baseMarkerLineIndex+t,baseMarkerLineNumber:e.baseMarkerLineNumber==null?void 0:e.baseMarkerLineNumber+t}}function Tt(e,t,n=!1){return!n&&e==null&&t!=null}function Et(e,t,n=!1){return e==null&&t!=null&&!n}function Dt(e,t){let n={...t,...e};return{...n,useTokenTransformer:me(n),hunkSeparators:typeof e?.hunkSeparators==`function`?`custom`:e?.hunkSeparators,mergeConflictActionsType:typeof e?.mergeConflictActionsType==`function`?`custom`:e?.mergeConflictActionsType}}var Ot=o(),Q=e(n(),1),kt=null;function At(e){let t=(0,Ot.c)(3),n=(0,Q.useRef)(null),r,i;return t[0]===e?(r=t[1],i=t[2]):(r=()=>{if(!e)return;let t=n.current;if(!t)return;let r={};kt=r;let i=document.documentElement,a=null,o=()=>{if(kt!==r)return;let e=`${t.offsetHeight}px`;e!==a&&(a=e,i.style.setProperty(`--conflict-footer-height`,e))};o();let s=new ResizeObserver(o);return s.observe(t),()=>{s.disconnect(),kt===r&&(kt=null,i.style.removeProperty(`--conflict-footer-height`))}},i=[e],t[0]=e,t[1]=r,t[2]=i),(0,Q.useEffect)(r,i),n}var $=t();function jt(e){let t=(0,Ot.c)(9),{filename:n,content:r}=e,{_:a}=i(),o=(0,Q.useRef)(null),s,c;t[0]!==r||t[1]!==n?(s=()=>{let e=o.current;if(!e)return;let t=new Je({overflow:`wrap`,theme:ge()});return t.render({file:{name:n,contents:r},containerWrapper:e}),()=>{t.cleanUp()}},c=[n,r],t[0]=r,t[1]=n,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,Q.useEffect)(s,c);let l;t[4]!==a||t[5]!==n?(l=a({id:`wXFalZ`,values:{filename:n}}),t[4]=a,t[5]=n,t[6]=l):l=t[6];let u;return t[7]===l?u=t[8]:(u=(0,$.jsx)(`section`,{ref:o,tabIndex:0,"aria-label":l,className:`conflict-view h-full overflow-y-auto subtle-scrollbar`}),t[7]=l,t[8]=u),u}var Mt=e(a(),1),Nt=50,Pt=class{stack;idx;constructor(e){this.stack=[e],this.idx=0}get current(){let e=this.stack[this.idx];if(!e)throw Error(`ConflictHistory: stack is empty — invariant violated`);return e}get canUndo(){return this.idx>0}get canRedo(){return this.idx<this.stack.length-1}push(e){this.stack.splice(this.idx+1),this.stack.push(e),this.idx++,this.stack.length>Nt+1&&(this.stack.splice(1,this.stack.length-Nt-1),this.idx=this.stack.length-1)}reset(e){this.stack[0]=e}undo(){return this.canUndo?(this.idx--,this.stack[this.idx]??null):null}redo(){return this.canRedo?(this.idx++,this.stack[this.idx]??null):null}},Ft=`
|
|
5
|
-
[data-merge-conflict="current"] [data-diff-span] {
|
|
6
|
-
background-color: color-mix(in oklab, var(--diff-added) 32%, transparent);
|
|
7
|
-
}
|
|
8
|
-
[data-merge-conflict="incoming"] [data-diff-span] {
|
|
9
|
-
background-color: color-mix(in oklab, var(--diff-modified) 32%, transparent);
|
|
10
|
-
}
|
|
11
|
-
/* Pierre rounds every span and never joins the final diff item into the one
|
|
12
|
-
before it, so a line whose last word changed renders as two boxes with a
|
|
13
|
-
seam — "Priya | Raman" against a single "Marcus Webb" on the other side.
|
|
14
|
-
The break is positional, not meaningful, so flatten the touching corners and
|
|
15
|
-
let adjacent spans read as one run. Cheaper than patching the span builder,
|
|
16
|
-
which is shared by every diff surface in the app. */
|
|
17
|
-
[data-diff-span]:has(+ [data-diff-span]) {
|
|
18
|
-
border-top-right-radius: 0;
|
|
19
|
-
border-bottom-right-radius: 0;
|
|
20
|
-
}
|
|
21
|
-
[data-diff-span] + [data-diff-span] {
|
|
22
|
-
border-top-left-radius: 0;
|
|
23
|
-
border-bottom-left-radius: 0;
|
|
24
|
-
}
|
|
25
|
-
`,It=0;function Lt(e){return e.split(`
|
|
26
|
-
`).filter(e=>e.startsWith(`<<<<<<< `)).length}function Rt(e,t){let n=e[t.conflictIndex];return n?t.startLineIndex===n.startLineIndex&&t.separatorLineIndex===n.separatorLineIndex&&t.endLineIndex===n.endLineIndex:!1}function zt(e,t,n){return t.endsWith(`
|
|
27
|
-
`)||n.endsWith(`
|
|
28
|
-
`)?e:e.endsWith(`
|
|
29
|
-
`)?e.slice(0,-1):e}function Bt(e){let{fileDiff:t}=e;return t?t.additionLines.join(``)===t.deletionLines.join(``):!1}function Vt(e){let t=(0,Ot.c)(86),{fileName:n,conflictKind:r,ours:a,base:o,theirs:l,onResolve:u}=e,d=r===void 0?`git`:r,{_:m}=i(),h=(0,Q.useRef)(null),g=(0,Q.useRef)(u),_=At(!0),v=(0,Q.useRef)(null),y=(0,Q.useRef)(null),ee=(0,Q.useRef)(null),te=(0,Q.useRef)(null),b=(0,Q.useRef)(null),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=[],t[0]=x):x=t[0];let[S,C]=(0,Q.useState)(x),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(!1),[A,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(null),P=(0,Q.useRef)(!1),[F,ne]=(0,Q.useState)(!1),[I,re]=(0,Q.useState)(!1),L=d===`stale-external-write`&&a===l,ie;t[1]===u?ie=t[2]:(ie=()=>{g.current=u},t[1]=u,t[2]=ie),(0,Q.useEffect)(ie);let ae;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(ae=()=>{C(Ut)},t[3]=ae):ae=t[3],(0,Q.useEffect)(ae);let oe,se;t[4]!==o||t[5]!==d||t[6]!==n||t[7]!==a||t[8]!==I||t[9]!==l?(oe=()=>{let e=h.current;if(!e)return;let{text:t,regions:r}=c(a,d===`stale-external-write`?null:o||null,l,{includeBaseSection:I}),i=new Pt({file:{name:n,contents:t}});T(!1),D(!1),k(!1),j(!1);let s=!0,u=!1,f=function(e){let t=Bt(e)&&(d!==`stale-external-write`||e.selection!==void 0);T(i.canUndo),D(i.canRedo),k(t);let n=d===`stale-external-write`&&!t?1:Lt(i.current.file.contents);N(t?`all-resolved`:n)},p=new vt({theme:ge(),overflow:`wrap`,lineDiffType:I?`none`:`word-alt`,unsafeCSS:Ft,onMergeConflictAction:e=>{v.current?.(e.conflict,e.resolution)},mergeConflictActionsType:e=>{let t=document.createElement(`div`);It+=1;let i=`cc-${It}`;return u?t:s&&!Rt(r,e.conflict)?(u=!0,console.warn(JSON.stringify({event:`conflict-parse-mismatch`,"doc.name":n,conflictIndex:e.conflict.conflictIndex,expected:r[e.conflict.conflictIndex]??null,parsed:{startLineIndex:e.conflict.startLineIndex,separatorLineIndex:e.conflict.separatorLineIndex,endLineIndex:e.conflict.endLineIndex}})),j(!0),C([]),t):(C(n=>[...n,{key:i,host:t,conflict:e.conflict}]),t)}}),m=function(t){if(!e)return;s=!1;let n=e.scrollTop;p.render({file:t.file,fileDiff:t.fileDiff,actions:t.actions,markerRows:t.markerRows,forceRender:!0}),e.scrollTop=n,e.focus()};v.current=(e,t)=>{if(u){console.warn(JSON.stringify({event:`conflict-action-refused-parse-mismatch`,"doc.name":n,conflictIndex:e.conflictIndex,resolution:t})),N(`unavailable`);return}let r=p.resolveConflict(e.conflictIndex,t);if(!r){console.warn(JSON.stringify({event:`conflict-resolve-declined`,"doc.name":n,conflictIndex:e.conflictIndex,resolution:t})),N(`unavailable`);return}let a={...r,selection:t};i.push(a);let o=Bt(a);f(a),o&&C([]),m(a)},y.current=()=>{let e=i.undo();e&&(f(e),m(e))},ee.current=()=>{let e=i.redo();if(!e)return;let t=Bt(e);f(e),t&&C([]),m(e)},te.current=e=>{if(u){console.warn(JSON.stringify({event:`conflict-action-refused-parse-mismatch`,"doc.name":n,resolution:e})),N(`unavailable`);return}let t={...i.current,selection:e};i.push(t),f(t),m(t)},b.current=()=>{let e=zt(i.current.file.contents,a,l);return d===`stale-external-write`?g.current(e,i.current.selection):g.current(e)},p.render({file:{name:n,contents:t},containerWrapper:e});let _=p.computedCache;if(_.fileDiff){let e={file:{name:n,contents:t},fileDiff:_.fileDiff,actions:_.actions,markerRows:_.markerRows};i.reset(e),k(d!==`stale-external-write`&&Bt(e))}return()=>{p.cleanUp(),v.current=null,y.current=null,ee.current=null,te.current=null,b.current=null,C([]),T(!1),D(!1),k(!1),j(!1)}},se=[n,a,o,l,I,d],t[4]=o,t[5]=d,t[6]=n,t[7]=a,t[8]=I,t[9]=l,t[10]=oe,t[11]=se):(oe=t[10],se=t[11]),(0,Q.useEffect)(oe,se);let ce;t[12]!==m||t[13]!==o||t[14]!==d||t[15]!==a||t[16]!==l?(ce=d===`stale-external-write`?null:a?l?o?null:m({id:`gBCeDq`}):m({id:`QVk3SK`}):m({id:`mR3uQg`}),t[12]=m,t[13]=o,t[14]=d,t[15]=a,t[16]=l,t[17]=ce):ce=t[17];let le=ce,R;t[18]!==m||t[19]!==d||t[20]!==L?(R=d===`stale-external-write`&&(0,$.jsx)(`div`,{className:`shrink-0 px-3 py-2`,children:(0,$.jsx)(p,{role:`status`,children:(0,$.jsxs)(f,{children:[m({id:`XwZiq2`}),L?` ${m({id:`AMU00p`})}`:null]})})}),t[18]=m,t[19]=d,t[20]=L,t[21]=R):R=t[21];let ue;t[22]===le?ue=t[23]:(ue=le&&(0,$.jsx)(`p`,{role:`status`,className:`shrink-0 border-b px-3 py-2 text-xs text-muted-foreground`,children:le}),t[22]=le,t[23]=ue);let z;t[24]!==m||t[25]!==M?(z=M===null?``:m(M===`all-resolved`?{id:`4vn1gP`}:M===`unavailable`?{id:`ONUgxB`}:{id:`y6HGwM`,values:{liveRemaining:M}}),t[24]=m,t[25]=M,t[26]=z):z=t[26];let B;t[27]===z?B=t[28]:(B=(0,$.jsx)(`div`,{"aria-live":`polite`,"aria-atomic":`true`,className:`sr-only`,children:z}),t[27]=z,t[28]=B);let V;t[29]!==m||t[30]!==A?(V=A&&(0,$.jsx)(`p`,{role:`status`,className:`shrink-0 border-b px-3 py-2 text-xs text-muted-foreground`,children:m({id:`pZaMLc`})}),t[29]=m,t[30]=A,t[31]=V):V=t[31];let de=A||!w,fe;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(fe=()=>y.current?.(),t[32]=fe):fe=t[32];let H;t[33]===m?H=t[34]:(H=m({id:`9uI_rE`}),t[33]=m,t[34]=H);let U;t[35]!==de||t[36]!==H?(U=(0,$.jsx)(s,{type:`button`,size:`xs`,variant:`ghost`,disabled:de,onClick:fe,children:H}),t[35]=de,t[36]=H,t[37]=U):U=t[37];let pe=A||!E,me;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(me=()=>ee.current?.(),t[38]=me):me=t[38];let W;t[39]===m?W=t[40]:(W=m({id:`H3oH0g`}),t[39]=m,t[40]=W);let G;t[41]!==pe||t[42]!==W?(G=(0,$.jsx)(s,{type:`button`,size:`xs`,variant:`ghost`,disabled:pe,onClick:me,children:W}),t[41]=pe,t[42]=W,t[43]=G):G=t[43];let K;t[44]!==m||t[45]!==o||t[46]!==E||t[47]!==w||t[48]!==d||t[49]!==A||t[50]!==I?(K=o&&d!==`stale-external-write`?(0,$.jsx)(s,{type:`button`,size:`xs`,variant:`ghost`,"aria-pressed":I,"aria-label":m({id:`LkQRL8`}),title:w||E?m({id:`NpRLRj`}):void 0,disabled:A||w||E,onClick:()=>re(Ht),children:m(I?{id:`2Yt22K`}:{id:`LkQRL8`})}):null,t[44]=m,t[45]=o,t[46]=E,t[47]=w,t[48]=d,t[49]=A,t[50]=I,t[51]=K):K=t[51];let q;t[52]!==U||t[53]!==G||t[54]!==K?(q=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 border-b px-3 py-2`,children:[U,G,K]}),t[52]=U,t[53]=G,t[54]=K,t[55]=q):q=t[55];let J;t[56]!==O||t[57]!==L||t[58]!==A?(J=L&&!A&&!O&&(0,$.jsx)(`div`,{className:`shrink-0 px-3 py-2`,children:(0,$.jsx)(Gt,{onSelect:e=>te.current?.(e)})}),t[56]=O,t[57]=L,t[58]=A,t[59]=J):J=t[59];let Y;t[60]!==m||t[61]!==n?(Y=m({id:`YWK2zy`,values:{fileName:n}}),t[60]=m,t[61]=n,t[62]=Y):Y=t[62];let he;t[63]===Y?he=t[64]:(he=(0,$.jsx)(`section`,{ref:h,tabIndex:0,"aria-label":Y,className:`conflict-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[63]=Y,t[64]=he);let X;t[65]!==m||t[66]!==O||t[67]!==F||t[68]!==A?(X=O&&!A&&(0,$.jsx)(s,{type:`button`,size:`sm`,disabled:F,onClick:()=>{P.current||(P.current=!0,ne(!0),Promise.resolve(b.current?.()).finally(()=>{P.current=!1,ne(!1)}))},children:m({id:`PWh9Ii`})}),t[65]=m,t[66]=O,t[67]=F,t[68]=A,t[69]=X):X=t[69];let Z;t[70]!==_||t[71]!==X?(Z=(0,$.jsx)(`div`,{ref:_,className:`flex shrink-0 items-center justify-end gap-2 border-t px-3 py-2`,children:X}),t[70]=_,t[71]=X,t[72]=Z):Z=t[72];let _e;t[73]!==S||t[74]!==A?(_e=!A&&S.map(e=>(0,Mt.createPortal)((0,$.jsx)(Gt,{conflictIndex:e.conflict.conflictIndex,onSelect:t=>v.current?.(e.conflict,t)}),e.host,e.key)),t[73]=S,t[74]=A,t[75]=_e):_e=t[75];let ve;return t[76]!==B||t[77]!==V||t[78]!==q||t[79]!==J||t[80]!==he||t[81]!==Z||t[82]!==_e||t[83]!==R||t[84]!==ue?(ve=(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[R,ue,B,V,q,J,he,Z,_e]}),t[76]=B,t[77]=V,t[78]=q,t[79]=J,t[80]=he,t[81]=Z,t[82]=_e,t[83]=R,t[84]=ue,t[85]=ve):ve=t[85],ve}function Ht(e){return!e}function Ut(e){let t=e.filter(Wt);return t.length===e.length?e:t}function Wt(e){return e.host.isConnected}function Gt(e){let t=(0,Ot.c)(30),{conflictIndex:n,onSelect:r}=e,{_:a}=i(),o;t[0]!==a||t[1]!==n?(o=n===void 0?void 0:a({id:`Al8HPP`,values:{0:n+1}}),t[0]=a,t[1]=n,t[2]=o):o=t[2];let c;t[3]===r?c=t[4]:(c=()=>r(`current`),t[3]=r,t[4]=c);let l;t[5]===a?l=t[6]:(l=a({id:`VL6VsE`}),t[5]=a,t[6]=l);let u;t[7]!==o||t[8]!==c||t[9]!==l?(u=(0,$.jsx)(s,{type:`button`,size:`xs`,variant:`outline`,"aria-label":o,onClick:c,children:l}),t[7]=o,t[8]=c,t[9]=l,t[10]=u):u=t[10];let d;t[11]!==a||t[12]!==n?(d=n===void 0?void 0:a({id:`NjnHNV`,values:{0:n+1}}),t[11]=a,t[12]=n,t[13]=d):d=t[13];let f;t[14]===r?f=t[15]:(f=()=>r(`incoming`),t[14]=r,t[15]=f);let p;t[16]===a?p=t[17]:(p=a({id:`_SkqfM`}),t[16]=a,t[17]=p);let m;t[18]!==d||t[19]!==f||t[20]!==p?(m=(0,$.jsx)(s,{type:`button`,size:`xs`,variant:`outline`,"aria-label":d,onClick:f,children:p}),t[18]=d,t[19]=f,t[20]=p,t[21]=m):m=t[21];let h;t[22]!==a||t[23]!==n||t[24]!==r?(h=n!==void 0&&(0,$.jsx)(s,{type:`button`,size:`xs`,variant:`outline`,"aria-label":a({id:`4_-TKi`,values:{0:n+1}}),onClick:()=>r(`both`),children:a({id:`KhNkCq`})}),t[22]=a,t[23]=n,t[24]=r,t[25]=h):h=t[25];let g;return t[26]!==u||t[27]!==m||t[28]!==h?(g=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[u,m,h]}),t[26]=u,t[27]=m,t[28]=h,t[29]=g):g=t[29],g}async function Kt(e,t,n){try{let r={file:e,strategy:t};n!==void 0&&(r.content=n);let i=await fetch(`/api/sync/resolve-conflict`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)});if(i.ok)return{ok:!0};let a;try{let e=await i.json();typeof e.detail==`string`?a=e.detail:typeof e.title==`string`&&(a=e.title)}catch{}return{ok:!1,detail:a}}catch(n){let r=n instanceof Error?n.message:String(n);return console.warn(JSON.stringify({event:`conflict-resolve-dispatch-failed`,file:e,strategy:t,detail:r})),{ok:!1,detail:r}}}async function qt(e,t){return Kt(e,`content`,t)}async function Jt(e){return Kt(e,`mine`)}async function Yt(e){return Kt(e,`theirs`)}async function Xt(e){return Kt(e,`delete`)}var Zt=2e3;async function Qt(e){try{let t=await fetch(`/api/sync/conflict-content?file=${encodeURIComponent(e)}&source=ytext`);if(!t.ok){let n;try{let e=await t.json();typeof e.detail==`string`?n=e.detail:typeof e.title==`string`&&(n=e.title)}catch{}return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:t.status,detail:n})),null}let n=await t.json(),r=n.kind===`delete-modify`||n.kind===`modify-delete`||n.kind===`both-modified`?n.kind:`both-modified`;return n.kind!==r&&console.warn(JSON.stringify({event:`conflict-kind-missing-fallback`,file:e,receivedKind:n.kind??null})),n.conflictKind!==void 0&&n.conflictKind!==`git`&&n.conflictKind!==`stale-external-write`&&console.warn(JSON.stringify({event:`conflict-discriminator-unrecognized`,file:e,receivedConflictKind:n.conflictKind})),{base:n.base??``,ours:n.ours??``,theirs:n.theirs??``,kind:r,conflictKind:n.conflictKind===`stale-external-write`?`stale-external-write`:`git`}}catch(t){return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:null,detail:t instanceof Error?t.message:String(t)})),null}}function $t(e){let t=(0,Ot.c)(103),{docName:n}=e,{_:a}=i(),{conflicts:o,loading:c,error:l}=m(),f;if(t[0]!==o||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>d(e.file)===n,t[3]=n,t[4]=e),f=o.find(e),t[0]=o,t[1]=n,t[2]=f}else f=t[2];let p=f,h=p?.file??`${n}.md`,[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(!1),[ee,te]=(0,Q.useState)(!1),b,x;t[5]!==p||t[6]!==l||t[7]!==c?(b=()=>{if(p!==void 0||c||l!==null){te(!1);return}let e=setTimeout(()=>te(!0),Zt);return()=>clearTimeout(e)},x=[p,c,l],t[5]=p,t[6]=l,t[7]=c,t[8]=b,t[9]=x):(b=t[8],x=t[9]),(0,Q.useEffect)(b,x);let[S,C]=(0,Q.useState)(!1),w=At(g?.kind===`delete-modify`||g?.kind===`modify-delete`),T,E;t[10]===n?(T=t[11],E=t[12]):(T=()=>(console.warn(JSON.stringify({event:`editor-area-swap-to-diffview`,"doc.name":n})),()=>{console.warn(JSON.stringify({event:`editor-area-swap-from-diffview`,"doc.name":n}))}),E=[n],t[10]=n,t[11]=T,t[12]=E),(0,Q.useEffect)(T,E);let D;t[13]===p?D=t[14]:(D=p===void 0?null:[p.detectedAt,p.conflictKind??`git`,p.baseSha??``,p.oursSha??``,p.theirsSha??``].join(`|`),t[13]=p,t[14]=D);let O=D,k=c||p===void 0,A,j;t[15]!==O||t[16]!==k||t[17]!==h?(A=()=>{if(k||O===null)return;let e=!1;return _(null),y(!1),Qt(h).then(t=>{e||(t===null?y(!0):_(t))}),()=>{e=!0}},j=[h,k,O],t[15]=O,t[16]=k,t[17]=h,t[18]=A,t[19]=j):(A=t[18],j=t[19]),(0,Q.useEffect)(A,j);let M;t[20]!==a||t[21]!==h||t[22]!==g?.conflictKind?(M=async function(e,t){let n=await(g?.conflictKind===`stale-external-write`&&t===`incoming`?Yt(h):qt(h,e));n.ok||u.error(a({id:`K-h9cT`,values:{filePath:h}}),{description:n.detail})},t[20]=a,t[21]=h,t[22]=g?.conflictKind,t[23]=M):M=t[23];let N=M,P;t[24]!==a||t[25]!==h?(P=async function(e){C(!0);let t=await e(h);t.ok||(C(!1),u.error(a({id:`jPUPvG`,values:{filePath:h}}),{description:t.detail}))},t[24]=a,t[25]=h,t[26]=P):P=t[26];let F=P;if(v){let e;return t[27]===h?e=t[28]:(e=(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,$.jsx)(r,{id:`ajz9F8`,values:{filePath:h}})}),t[27]=h,t[28]=e),e}if(l!==null&&p===void 0){let e;return t[29]===h?e=t[30]:(e=(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,$.jsx)(r,{id:`jTdrn1`,values:{filePath:h}})}),t[29]=h,t[30]=e),e}if(ee&&!c&&l===null&&p===void 0){let e;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`p`,{children:(0,$.jsx)(r,{id:`hCghAK`})}),t[31]=e):e=t[31];let n;return t[32]===h?n=t[33]:(n=(0,$.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-1 p-6 text-sm text-muted-foreground`,children:[e,(0,$.jsx)(`p`,{className:`text-xs`,children:(0,$.jsx)(r,{id:`XzL7x7`,values:{filePath:h}})})]}),t[32]=h,t[33]=n),n}if(g===null){let e;return t[34]===h?e=t[35]:(e=(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,$.jsx)(r,{id:`DF1MtZ`,values:{filePath:h}})}),t[34]=h,t[35]=e),e}if(g.kind===`delete-modify`){let e;t[36]!==h||t[37]!==g.theirs?(e=(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(jt,{filename:h,content:g.theirs})}),t[36]=h,t[37]=g.theirs,t[38]=e):e=t[38];let n;t[39]===h?n=t[40]:(n={filePath:h},t[39]=h,t[40]=n);let i;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(i={0:(0,$.jsx)(`span`,{className:`font-medium text-foreground`})},t[41]=i):i=t[41];let a;t[42]===n?a=t[43]:(a=(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(r,{id:`V48OUT`,values:n,components:i})}),t[42]=n,t[43]=a);let o;t[44]===F?o=t[45]:(o=()=>void F(Xt),t[44]=F,t[45]=o);let c;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(r,{id:`Vlc75q`}),t[46]=c):c=t[46];let l;t[47]!==S||t[48]!==o?(l=(0,$.jsx)(s,{type:`button`,variant:`destructive`,disabled:S,onClick:o,children:c}),t[47]=S,t[48]=o,t[49]=l):l=t[49];let u;t[50]===F?u=t[51]:(u=()=>void F(Yt),t[50]=F,t[51]=u);let d;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(r,{id:`3mFsc3`}),t[52]=d):d=t[52];let f;t[53]!==S||t[54]!==u?(f=(0,$.jsx)(s,{type:`button`,variant:`default`,disabled:S,onClick:u,children:d}),t[53]=S,t[54]=u,t[55]=f):f=t[55];let p;t[56]!==l||t[57]!==f?(p=(0,$.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[l,f]}),t[56]=l,t[57]=f,t[58]=p):p=t[58];let m;t[59]!==w||t[60]!==a||t[61]!==p?(m=(0,$.jsxs)(`div`,{ref:w,className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[a,p]}),t[59]=w,t[60]=a,t[61]=p,t[62]=m):m=t[62];let _;return t[63]!==e||t[64]!==m?(_=(0,$.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,m]}),t[63]=e,t[64]=m,t[65]=_):_=t[65],_}if(g.kind===`modify-delete`){let e;t[66]!==h||t[67]!==g.ours?(e=(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(jt,{filename:h,content:g.ours})}),t[66]=h,t[67]=g.ours,t[68]=e):e=t[68];let n;t[69]===h?n=t[70]:(n={filePath:h},t[69]=h,t[70]=n);let i;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(i={0:(0,$.jsx)(`span`,{className:`font-medium text-foreground`})},t[71]=i):i=t[71];let a;t[72]===n?a=t[73]:(a=(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(r,{id:`EhDLBx`,values:n,components:i})}),t[72]=n,t[73]=a);let o;t[74]===F?o=t[75]:(o=()=>void F(Jt),t[74]=F,t[75]=o);let c;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(r,{id:`0NA4b3`}),t[76]=c):c=t[76];let l;t[77]!==S||t[78]!==o?(l=(0,$.jsx)(s,{type:`button`,variant:`default`,disabled:S,onClick:o,children:c}),t[77]=S,t[78]=o,t[79]=l):l=t[79];let u;t[80]===F?u=t[81]:(u=()=>void F(Xt),t[80]=F,t[81]=u);let d;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(r,{id:`qSxaOz`}),t[82]=d):d=t[82];let f;t[83]!==S||t[84]!==u?(f=(0,$.jsx)(s,{type:`button`,variant:`destructive`,disabled:S,onClick:u,children:d}),t[83]=S,t[84]=u,t[85]=f):f=t[85];let p;t[86]!==l||t[87]!==f?(p=(0,$.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[l,f]}),t[86]=l,t[87]=f,t[88]=p):p=t[88];let m;t[89]!==w||t[90]!==a||t[91]!==p?(m=(0,$.jsxs)(`div`,{ref:w,className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[a,p]}),t[89]=w,t[90]=a,t[91]=p,t[92]=m):m=t[92];let _;return t[93]!==e||t[94]!==m?(_=(0,$.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,m]}),t[93]=e,t[94]=m,t[95]=_):_=t[95],_}let ne;return t[96]!==h||t[97]!==N||t[98]!==g.base||t[99]!==g.conflictKind||t[100]!==g.ours||t[101]!==g.theirs?(ne=(0,$.jsx)(Vt,{fileName:h,conflictKind:g.conflictKind,ours:g.ours,base:g.base,theirs:g.theirs,onResolve:N}),t[96]=h,t[97]=N,t[98]=g.base,t[99]=g.conflictKind,t[100]=g.ours,t[101]=g.theirs,t[102]=ne):ne=t[102],ne}export{$t as DiffViewBoundary};
|
|
@@ -1 +0,0 @@
|
|
|
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-Cym3gapE.js";import{a as s,c,i as l,n as u,o as d,r as f,s as p,t as m}from"./dialog-DgIQr9zS.js";import{ts as h,xs as g}from"./dist-BBNlIz6B.js";import{n as _}from"./dist-CJhtNlOm2.js";import{v}from"./documents-events-BhW9c1L3.js";import{i as y}from"./use-apply-config-theme-DpLdjUDN.js";import{t as b}from"./createLucideIcon-B6ULg5PN.js";import{t as x}from"./eye-BtMXolFK.js";import"./config-provider-CI1IgVHl.js";var S=b(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),C=b(`arrow-right-left`,[[`path`,{d:`m16 3 4 4-4 4`,key:`1x1c3m`}],[`path`,{d:`M20 7H4`,key:`zbl0bi`}],[`path`,{d:`m8 21-4-4 4-4`,key:`h9nckh`}],[`path`,{d:`M4 17h16`,key:`g4d7ey`}]]),w=b(`git-commit-vertical`,[[`path`,{d:`M12 3v6`,key:`1holv5`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`M12 15v6`,key:`a9ows0`}]]),T=b(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),E=b(`laptop`,[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]),D=a(),O=e(n(),1);async function k(){try{let e=await fetch(`/api/sync/status`);return e.ok?{status:await e.json()}:{status:null,error:`server`}}catch{return{status:null,error:`network`}}}function A(){return j().status}function j(){let e=(0,D.c)(8),[t,n]=(0,O.useState)(null),[r,i]=(0,O.useState)(null),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=function(){k().then(e=>{let{status:t,error:r}=e;i(r??null),t&&n(t)})},e[0]=a):a=e[0];let o=a,s,c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{o()},c=[],e[1]=s,e[2]=c):(s=e[1],c=e[2]),(0,O.useEffect)(s,c);let l,u;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>v(e=>{e.includes(`sync-status`)&&o()}),u=[],e[3]=l,e[4]=u):(l=e[3],u=e[4]),(0,O.useEffect)(l,u);let d;return e[5]!==r||e[6]!==t?(d={status:t,fetchError:r},e[5]=r,e[6]=t,e[7]=d):d=e[7],d}var M=t();function N(e){let t=(0,D.c)(3),{children:n}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,M.jsxs)(`p`,{className:`flex items-center gap-1.5 font-mono text-xs font-semibold tracking-wider uppercase`,children:[(0,M.jsx)(`span`,{"aria-hidden":`true`,className:`mb-[3px] flex items-center justify-center`,children:`◇`}),(0,M.jsx)(r,{id:`6s7LXO`})]}),t[0]=i):i=t[0];let a;return t[1]===n?a=t[2]:(a=(0,M.jsxs)(`div`,{role:`note`,className:`flex flex-col gap-5 text-sm`,children:[i,(0,M.jsx)(`div`,{className:`flex flex-col gap-5`,children:n})]}),t[1]=n,t[2]=a),a}function P(e){let t=(0,D.c)(10),{icon:n,title:r,body:i}=e,a;t[0]===r?a=t[1]:(a=(0,M.jsx)(`p`,{className:`font-medium`,children:r}),t[0]=r,t[1]=a);let o;t[2]===i?o=t[3]:(o=(0,M.jsx)(`p`,{className:`text-muted-foreground`,children:i}),t[2]=i,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,M.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;return t[7]!==n||t[8]!==s?(c=(0,M.jsxs)(`div`,{className:`flex items-start gap-3`,children:[n,s]}),t[7]=n,t[8]=s,t[9]=c):c=t[9],c}function F(e){let t=(0,D.c)(4),{variant:n}=e;if((n===void 0?`full`:n)===`follow`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,M.jsx)(c,{children:(0,M.jsx)(r,{id:`W7mERj`})}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,M.jsxs)(M.Fragment,{children:[e,(0,M.jsx)(s,{children:(0,M.jsx)(r,{id:`KmVekT`})})]}),t[1]=n):n=t[1],n}let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,M.jsx)(c,{children:(0,M.jsx)(r,{id:`Uo2Rj7`})}),t[2]=i):i=t[2];let a;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,M.jsxs)(M.Fragment,{children:[i,(0,M.jsx)(s,{children:(0,M.jsx)(r,{id:`n6hXUm`})})]}),t[3]=a):a=t[3],a}function I(e){let t=(0,D.c)(2),{variant:n}=e,r=n===void 0?`full`:n,i;return t[0]===r?i=t[1]:(i=(0,M.jsx)(N,{children:r===`follow`?(0,M.jsx)(R,{}):(0,M.jsx)(L,{})}),t[0]=r,t[1]=i),i}function L(){let e=(0,D.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,M.jsx)(P,{icon:(0,M.jsx)(C,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),title:(0,M.jsx)(r,{id:`cdmk8A`}),body:(0,M.jsx)(r,{id:`YaeyFh`})}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,M.jsx)(P,{icon:(0,M.jsx)(w,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),title:(0,M.jsx)(r,{id:`9i21pa`}),body:(0,M.jsx)(r,{id:`KIIamL`})}),e[1]=n):n=e[1];let i;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,M.jsxs)(M.Fragment,{children:[t,n,(0,M.jsx)(P,{icon:(0,M.jsx)(x,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),title:(0,M.jsx)(r,{id:`8cpeU3`}),body:(0,M.jsx)(r,{id:`DELNQk`})})]}),e[2]=i):i=e[2],i}function R(){let e=(0,D.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,M.jsx)(P,{icon:(0,M.jsx)(S,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),title:(0,M.jsx)(r,{id:`0xnQ_X`}),body:(0,M.jsx)(r,{id:`aCoQfY`})}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,M.jsx)(P,{icon:(0,M.jsx)(E,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),title:(0,M.jsx)(r,{id:`5rnB76`}),body:(0,M.jsx)(r,{id:`kXNv8P`})}),e[1]=n):n=e[1];let i;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,M.jsxs)(M.Fragment,{children:[t,n,(0,M.jsx)(P,{icon:(0,M.jsx)(T,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),title:(0,M.jsx)(r,{id:`oBK5fD`}),body:(0,M.jsx)(r,{id:`8Wav8y`})})]}),e[2]=i):i=e[2],i}function z(){let e=(0,D.c)(2),{projectLocalBinding:t}=y();if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=e=>{let n=e?`full`:`off`,r=t.patch({autoSync:{mode:n,enabled:e}});return r.ok?{ok:!0}:{ok:!1,error:h(r.error)}},e[0]=t,e[1]=n),n}function B(){let e=(0,D.c)(2),{projectLocalBinding:t}=y();if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=e=>{let n=t.patch({autoSync:{mode:e,enabled:null}});return n.ok?{ok:!0}:{ok:!1,error:h(n.error)}},e[0]=t,e[1]=n),n}function V(){let e=(0,D.c)(2),{projectBinding:t}=y();if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=e=>{let n=t.patch({autoSync:{default:e}});return n.ok?{ok:!0}:{ok:!1,error:h(n.error)}},e[0]=t,e[1]=n),n}function H(){let e=(0,D.c)(2),{projectLocalBinding:t}=y();if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=e=>{let n=t.patch({autoSync:e});return n.ok?{ok:!0}:{ok:!1,error:h(n.error)}},e[0]=t,e[1]=n),n}function U(e,t){let n=(0,D.c)(12),{_:r}=i(),[a,o]=(0,O.useState)(!1),s;n[0]!==r||n[1]!==e?(s=function(t){if(e===null)return _.error(r({id:`fiMNLl`})),!1;let n=e(t);if(!n.ok){console.error(`[sync] toggle failed:`,n.error);let e=n.error;return _.error(r(t?{id:`04RA0-`,values:{detail:e}}:{id:`qjHMHf`,values:{detail:e}})),!1}return!0},n[0]=r,n[1]=e,n[2]=s):s=n[2];let c=s,l;n[3]===c?l=n[4]:(l=function(e){if(e){o(!0);return}c(!1)},n[3]=c,n[4]=l);let u=l,d;n[5]!==c||n[6]!==t?(d=function(){c(!0)&&(o(!1),t?.onEnabled?.())},n[5]=c,n[6]=t,n[7]=d):d=n[7];let f=d,p;return n[8]!==a||n[9]!==f||n[10]!==u?(p={confirmOpen:a,setConfirmOpen:o,onToggleRequest:u,onConfirm:f},n[8]=a,n[9]=f,n[10]=u,n[11]=p):p=n[11],p}function W(e,t,n){let r=(0,D.c)(15),{_:a}=i(),[o,s]=(0,O.useState)(!1),[c,l]=(0,O.useState)(null),u;r[0]!==a||r[1]!==n||r[2]!==e?(u=function(t){if(e===null)return _.error(a({id:`fiMNLl`})),!1;let r=e(t);if(!r.ok){console.error(`[sync] mode change failed:`,r.error);let e=r.error;return _.error(a({id:`nOEDQs`,values:{detail:e}})),!1}return n?.onApplied?.(t),!0},r[0]=a,r[1]=n,r[2]=e,r[3]=u):u=r[3];let d=u,f;r[4]!==d||r[5]!==t?(f=function(e){if(e!==t){if(e===`off`){d(`off`);return}l(e),s(!0)}},r[4]=d,r[5]=t,r[6]=f):f=r[6];let p=f,m;r[7]!==d||r[8]!==c?(m=function(){c!==null&&d(c)&&s(!1)},r[7]=d,r[8]=c,r[9]=m):m=r[9];let h=m,g;return r[10]!==o||r[11]!==h||r[12]!==p||r[13]!==c?(g={confirmOpen:o,setConfirmOpen:s,pendingMode:c,onModeSelect:p,onConfirm:h},r[10]=o,r[11]=h,r[12]=p,r[13]=c,r[14]=g):g=r[14],g}function G(){let e=(0,D.c)(2),{projectLocalBinding:t}=y();if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=e=>{let n=t.patch({autoSync:e});return n.ok?{ok:!0}:{ok:!1,error:h(n.error)}},e[0]=t,e[1]=n),n}function K(e,t){let n=(0,D.c)(18),{_:r}=i(),a=G(),[o,s]=(0,O.useState)(!1),[c,l]=(0,O.useState)(null),u;n[0]===e?u=n[1]:(u=g(e)??`off`,n[0]=e,n[1]=u);let d=u,f;n[2]!==r||n[3]!==a?(f=function(e){if(a===null)return _.error(r({id:`fiMNLl`})),!1;let t=a(e);if(!t.ok){console.error(`[sync] badge control failed:`,t.error);let e=t.error;return _.error(r({id:`ZVOhXM`,values:{detail:e}})),!1}return!0},n[2]=r,n[3]=a,n[4]=f):f=n[4];let p=f,m;n[5]!==p||n[6]!==d?(m=function(e){if(e!==d){if(e===`off`){p({mode:`off`,enabled:null,resumeMode:null});return}l(e),s(!0)}},n[5]=p,n[6]=d,n[7]=m):m=n[7];let h=m,v;n[8]!==p||n[9]!==c?(v=function(){c!==null&&p({mode:c,enabled:null,resumeMode:null})&&(s(!1),l(null))},n[8]=p,n[9]=c,n[10]=v):v=n[10];let y=v,b=c===`follow`?t:0,x;return n[11]!==o||n[12]!==d||n[13]!==y||n[14]!==h||n[15]!==c||n[16]!==b?(x={mode:d,confirmOpen:o,setConfirmOpen:s,pendingMode:c,strandedCommitCount:b,onModeSelect:h,onConfirm:y},n[11]=o,n[12]=d,n[13]=y,n[14]=h,n[15]=c,n[16]=b,n[17]=x):x=n[17],x}async function q(e){let t=await fetch(`/api/sync/trigger`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({op:e})});if(!t.ok)throw Error(`sync trigger failed: ${t.status}`)}function J(e){let t=(0,D.c)(24),{open:n,onOpenChange:i,onConfirm:a,variant:s,strandedCommitCount:c}=e,h=s===void 0?`full`:s,g=c===void 0?0:c,_=h===`follow`&&g>0,v;t[0]===h?v=t[1]:(v=(0,M.jsx)(p,{children:(0,M.jsx)(F,{variant:h})}),t[0]=h,t[1]=v);let y;t[2]===h?y=t[3]:(y=(0,M.jsx)(I,{variant:h}),t[2]=h,t[3]=y);let b;t[4]!==_||t[5]!==g?(b=_&&(0,M.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:(0,M.jsx)(r,{id:`caw8gO`,values:{strandedCommitCount:g}})}),t[4]=_,t[5]=g,t[6]=b):b=t[6];let x;t[7]!==y||t[8]!==b?(x=(0,M.jsxs)(u,{children:[y,b]}),t[7]=y,t[8]=b,t[9]=x):x=t[9];let S;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,M.jsx)(f,{asChild:!0,children:(0,M.jsx)(o,{variant:`outline`,children:(0,M.jsx)(r,{id:`dEgA5A`})})}),t[10]=S):S=t[10];let C;t[11]===h?C=t[12]:(C=h===`follow`?(0,M.jsx)(r,{id:`jTUxaN`}):(0,M.jsx)(r,{id:`pPiV8s`}),t[11]=h,t[12]=C);let w;t[13]!==a||t[14]!==C?(w=(0,M.jsxs)(d,{children:[S,(0,M.jsx)(o,{onClick:a,children:C})]}),t[13]=a,t[14]=C,t[15]=w):w=t[15];let T;t[16]!==v||t[17]!==x||t[18]!==w?(T=(0,M.jsxs)(l,{className:`sm:max-w-lg`,children:[v,x,w]}),t[16]=v,t[17]=x,t[18]=w,t[19]=T):T=t[19];let E;return t[20]!==i||t[21]!==n||t[22]!==T?(E=(0,M.jsx)(m,{open:n,onOpenChange:i,children:T}),t[20]=i,t[21]=n,t[22]=T,t[23]=E):E=t[23],E}export{S as _,V as a,W as c,I as d,N as f,T as g,j as h,U as i,B as l,A as m,q as n,z as o,P as p,K as r,H as s,J as t,F as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./index-DWjHCX39.js";export{e as FeedbackForm};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./ManagedArtifactProperties-DPLTTAuN.js";export{e as ManagedArtifactProperties};
|
|
@@ -1 +0,0 @@
|
|
|
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 ee}from"./dist-Nvb76hAm.js";import{n as te}from"./dist-PQ5KMVDh.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{t as a}from"./utils-CPqDy6Hr.js";import{t as ne}from"./button-Cym3gapE.js";import{a as o,c as s,i as c,n as l,o as u,s as d,t as f}from"./dialog-DgIQr9zS.js";import{a as re,c as p,i as ie,l as m,o as h,r as ae,s as oe,t as g}from"./alert-dialog-CrZSZ5Zj.js";import{t as se}from"./checkbox-Crs_F_Np.js";import{t as ce}from"./label-D-K3fWtj.js";import{n as le}from"./dist-CJhtNlOm2.js";import{t as ue}from"./dist-Cr4-nBVI.js";import{a as de,t as fe}from"./use-apply-config-theme-DpLdjUDN.js";import{t as pe}from"./ThemePicker-BB-6lF8V.js";import{t as me}from"./RowDisclosure-D03pq8gd.js";import{t as he}from"./tool-list-format-BTKYlTbI.js";import{r as ge,t as _e}from"./ok-Dxgb9iCL.js";var ve=i(),_=e(n(),1),v=t(),y=`text-1sm leading-normal`,b=`${y} ps-6.5 text-muted-foreground`,ye=`${y} ps-6.5 text-amber-700 dark:text-amber-400`,be=`${y} text-muted-foreground`;function xe(e){return e.shellDetected&&!e.alreadyInstalled}function Se(e){return e.filter(e=>e.detected)}var Ce={Root:g,Content:re,Header:p,Title:m,Description:h,Body:ae,Footer:oe},we={Root:f,Content:c,Header:d,Title:s,Description:o,Body:l,Footer:u},x={error:e=>le.error(e),message:e=>le.message(e)};function S(e){let t=(0,ve.c)(7),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{store:r,toast:ee,payload:te}=n,i=r===void 0?ge:r,a=ee===void 0?x:ee,ne=(0,_.useSyncExternalStore)(i.subscribe,i.getSnapshot,w),o=te??ne,[s,c]=(0,_.useState)(o),[l,u]=(0,_.useState)(0);if(o!==s&&(c(o),o!==null&&u(C)),!o)return null;let d;return t[2]!==l||t[3]!==o||t[4]!==i||t[5]!==a?(d=(0,v.jsx)(T,{payload:o,store:i,toast:a},l),t[2]=l,t[3]=o,t[4]=i,t[5]=a,t[6]=d):d=t[6],d}function C(e){return e+1}function w(){return null}function T(e){let t=(0,ve.c)(78),{payload:n,store:i,toast:o}=e,{_:s}=ee(),c=n.pathInstall,l=n.globalSkills,u;t[0]===l?u=t[1]:(u=l.some(Fe),t[0]=l,t[1]=u);let d=u,f=xe(c),re=window.okDesktop?.config.ptyAvailable===!0,p=Se(n.detectedEditors),m=p.length>0,h=p.filter(Pe),ae=h.length>0&&h.length===p.length,oe=he(p.map(Ne),ue.locale),[g,le]=(0,_.useState)(!0),[ge,y]=(0,_.useState)(!0),[x,S]=(0,_.useState)(!0),{theme:C,setTheme:w}=te(),T;t[2]===C?T=t[3]:(T=fe(C),t[2]=C,t[3]=T);let Ie=T,Le=de(),E;t[4]!==s||t[5]!==Le?.userBinding||t[6]!==w||t[7]!==o?(E=function(e){w(e);let t=Le?.userBinding;t&&(t.patch({appearance:{theme:e}}).ok||o.error(s({id:`LJXDjm`})))},t[4]=s,t[5]=Le?.userBinding,t[6]=w,t[7]=o,t[8]=E):E=t[8];let Re=E,[D,O]=(0,_.useState)(!1),k=(0,_.useId)(),ze=g&&h.length>0,Be=async function(){O(!0);let e=g&&m,t=await i.confirm({editorIds:e?p.map(Me):[],pathInstall:f?x:void 0,skills:ge&&d?l.map(je):void 0});if(!t.ok){o.error(t.error),O(!1);return}e||o.message(s({id:`851WA-`}))},A=n.origin===`first-run`,j=A?Ce:we,M;t[9]===i?M=t[10]:(M=function(){i.dismiss()},t[9]=i,t[10]=M);let N=M,P;t[11]!==s||t[12]!==i||t[13]!==o?(P=async function(){O(!0);let e=await i.skip();e.ok?o.message(s({id:`851WA-`})):(o.error(e.error),O(!1))},t[11]=s,t[12]=i,t[13]=o,t[14]=P):P=t[14];let Ve=P,F;t[15]!==D||t[16]!==A||t[17]!==N||t[18]!==Ve?(F=function(e){e||D||(A?Ve():N())},t[15]=D,t[16]=A,t[17]=N,t[18]=Ve,t[19]=F):F=t[19];let He=F,Ue=j.Root,We=j.Content,Ge=D&&`[&_[data-slot=dialog-close]]:pointer-events-none [&_[data-slot=dialog-close]]:opacity-50`,I;t[20]===Ge?I=t[21]:(I=a(`sm:max-w-2xl md:max-w-3xl`,Ge),t[20]=Ge,t[21]=I);let L;t[22]===A?L=t[23]:(L=A?{}:{"aria-describedby":void 0},t[22]=A,t[23]=L);let R;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,v.jsx)(_e,{className:`size-10 shrink-0`,"aria-hidden":!0}),t[24]=R):R=t[24];let z;t[25]===A?z=t[26]:(z=A?(0,v.jsxs)(`span`,{className:`flex flex-col gap-1.5`,children:[(0,v.jsx)(`span`,{className:`uppercase font-mono font-normal text-2xs text-muted-foreground tracking-widest`,children:(0,v.jsx)(r,{id:`cYvRiE`})}),(0,v.jsx)(r,{id:`U6Mdhd`})]}):(0,v.jsx)(`span`,{children:(0,v.jsx)(r,{id:`0DVpoY`})}),t[25]=A,t[26]=z);let B;t[27]!==j.Title||t[28]!==z?(B=(0,v.jsxs)(j.Title,{className:`flex flex-col gap-8 text-2xl tracking-tighter`,children:[R,z]}),t[27]=j.Title,t[28]=z,t[29]=B):B=t[29];let V;t[30]!==j.Description||t[31]!==A?(V=A&&(0,v.jsx)(j.Description,{className:`sr-only`,children:(0,v.jsx)(r,{id:`0DVpoY`})}),t[30]=j.Description,t[31]=A,t[32]=V):V=t[32];let H;t[33]!==j.Header||t[34]!==B||t[35]!==V?(H=(0,v.jsxs)(j.Header,{children:[B,V]}),t[33]=j.Header,t[34]=B,t[35]=V,t[36]=H):H=t[36];let Ke=j.Body,qe=c.shellDetected&&(0,v.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,v.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:(0,v.jsx)(r,{id:`ALhMYW`})}),(0,v.jsxs)(`div`,{className:a(`relative overflow-hidden rounded-lg border border-border bg-card/50 px-4 py-3`,f&&`hover:bg-accent`),children:[(0,v.jsxs)(ce,{htmlFor:`${k}-path`,className:f?`flex min-w-0 cursor-pointer flex-col items-start gap-1 font-normal`:`flex min-w-0 flex-col items-start gap-1 font-normal`,children:[(0,v.jsxs)(`span`,{className:`flex w-full items-center gap-2.5`,children:[(0,v.jsx)(se,{id:`${k}-path`,checked:f?x:!0,disabled:D||!f,onCheckedChange:()=>S(Ae),"data-testid":`mcp-consent-path-checkbox`}),(0,v.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1.5 pe-28 text-sm font-medium text-foreground`,children:(0,v.jsx)(r,{id:`Fsx78O`,components:{0:(0,v.jsx)(`code`,{className:`inline-code text-1sm!`})}})})]}),f&&(0,v.jsx)(`span`,{className:b,children:(0,v.jsx)(r,{id:`LJeFU6`,components:{0:(0,v.jsx)(`code`,{className:`inline-code text-xs!`}),1:(0,v.jsx)(`code`,{className:`inline-code text-xs!`})}})}),!f&&(0,v.jsx)(`span`,{className:b,"data-testid":`mcp-consent-path-status`,children:s({id:`RnrnTe`})}),f&&!x&&(0,v.jsx)(`span`,{className:ye,"data-testid":`mcp-consent-path-warning`,children:re?(0,v.jsx)(r,{id:`7PXYaF`,components:{0:(0,v.jsx)(`code`,{className:`inline-code text-xs!`})}}):(0,v.jsx)(r,{id:`BOsvJ8`,components:{0:(0,v.jsx)(`code`,{className:`inline-code text-xs!`})}})})]}),f&&(0,v.jsx)(me,{title:s({id:`f9lQNJ`}),testId:`mcp-consent-path-info`,children:(0,v.jsx)(`span`,{className:`wrap-break-word`,"data-testid":`mcp-consent-path-status`,children:c.rcFilesToTouch.map(ke)})})]})]}),Je=(m||d)&&(0,v.jsx)(v.Fragment,{children:(0,v.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,v.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:(0,v.jsx)(r,{id:`04JR6L`})}),m?(0,v.jsx)(`p`,{className:a(be,`mb-1`),children:(0,v.jsx)(r,{id:`mlA3HX`})}):null,(0,v.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[m?(0,v.jsxs)(`div`,{className:`relative overflow-hidden rounded-lg border border-border bg-card/50 px-4 py-3 hover:bg-accent`,children:[(0,v.jsxs)(ce,{htmlFor:`${k}-connect`,className:`flex min-w-0 cursor-pointer flex-col items-start gap-1 font-normal`,children:[(0,v.jsxs)(`span`,{className:`flex w-full items-center gap-2.5`,children:[(0,v.jsx)(se,{id:`${k}-connect`,checked:g,disabled:D,onCheckedChange:()=>le(Oe),"data-testid":`mcp-consent-connect-checkbox`}),(0,v.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1.5 pe-28 text-sm font-medium text-foreground`,"data-testid":`mcp-consent-connect-summary`,children:(0,v.jsx)(r,{id:`qBi_YG`})})]}),(0,v.jsx)(`span`,{className:b,children:(0,v.jsx)(r,{id:`RvbTzC`,values:{connectToolList:oe},components:{0:(0,v.jsx)(`span`,{className:`font-medium text-foreground`})}})}),ze&&(0,v.jsx)(`span`,{className:ye,"data-testid":`mcp-consent-connect-replace-warning`,children:s(ae?{id:`nJaz5Q`}:{id:`LAR9ub`,values:{0:he(h.map(De),ue.locale)}})})]}),(0,v.jsx)(me,{title:s({id:`m3ocfn`}),testId:`mcp-consent-connect-info`,children:(0,v.jsx)(`span`,{className:`flex flex-col gap-2`,"data-testid":`mcp-consent-connect-details`,children:p.map(e=>(0,v.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,v.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,v.jsx)(`span`,{className:`wrap-break-word opacity-75`,children:(0,v.jsx)(`code`,{className:`break-all`,children:e.configPath??s({id:`ndwmea`})})})]},e.id))})})]}):null,d&&(0,v.jsxs)(`div`,{className:`relative overflow-hidden rounded-lg border border-border bg-card/50 px-4 py-3 hover:bg-accent`,children:[(0,v.jsxs)(ce,{htmlFor:`${k}-skills`,className:`flex min-w-0 cursor-pointer flex-col items-start gap-1 font-normal`,children:[(0,v.jsxs)(`span`,{className:`flex w-full items-center gap-2.5`,children:[(0,v.jsx)(se,{id:`${k}-skills`,checked:ge,disabled:D,onCheckedChange:()=>y(Ee),"data-testid":`mcp-consent-skill-checkbox`}),(0,v.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1.5 pe-28 text-sm font-medium text-foreground`,children:(0,v.jsx)(r,{id:`vqJXNe`,components:{0:(0,v.jsx)(`code`,{className:`inline-code text-1sm!`})}})})]}),(0,v.jsx)(`span`,{className:b,children:(0,v.jsx)(r,{id:`6ur2Mk`})})]}),(0,v.jsx)(me,{title:s({id:`gcrh1R`}),testId:`mcp-consent-skill-info`,children:(0,v.jsx)(`span`,{className:`flex flex-col gap-2`,"data-testid":`mcp-consent-skill-details`,children:l.map(e=>(0,v.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[l.length>1&&(0,v.jsx)(`span`,{className:`font-medium`,children:e.name}),e.paths.map(Te)]},e.id))})})]}),!m&&(0,v.jsx)(`p`,{className:be,"data-testid":`mcp-consent-no-tools`,children:(0,v.jsx)(r,{id:`tLd2qa`})})]})]})}),U;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,v.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:(0,v.jsx)(r,{id:`37Vsg6`})}),t[37]=U):U=t[37];let W;t[38]===s?W=t[39]:(W=s({id:`37Vsg6`}),t[38]=s,t[39]=W);let G;t[40]!==D||t[41]!==Re||t[42]!==W||t[43]!==Ie?(G=(0,v.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[U,(0,v.jsx)(pe,{value:Ie,onValueChange:Re,disabled:D,"aria-label":W})]}),t[40]=D,t[41]=Re,t[42]=W,t[43]=Ie,t[44]=G):G=t[44];let K;t[45]!==j.Body||t[46]!==qe||t[47]!==Je||t[48]!==G?(K=(0,v.jsxs)(Ke,{className:`flex flex-col gap-6 min-h-0`,children:[qe,Je,G]}),t[45]=j.Body,t[46]=qe,t[47]=Je,t[48]=G,t[49]=K):K=t[49];let q;t[50]!==D||t[51]!==A||t[52]!==N?(q=A?(0,v.jsx)(ie,{variant:`link-muted`,disabled:D,className:`-ms-2.5 tracking-wide`,"data-testid":`mcp-consent-skip`,children:(0,v.jsx)(r,{id:`hnlGzG`})}):(0,v.jsx)(ne,{variant:`link-muted`,disabled:D,className:`-ms-2.5 tracking-wide`,"data-testid":`mcp-consent-skip`,onClick:N,children:(0,v.jsx)(r,{id:`dEgA5A`})}),t[50]=D,t[51]=A,t[52]=N,t[53]=q):q=t[53];let J;t[54]===Be?J=t[55]:(J=()=>void Be(),t[54]=Be,t[55]=J);let Y;t[56]===D?Y=t[57]:(Y=D?(0,v.jsx)(r,{id:`b4itZn`}):(0,v.jsx)(r,{id:`LHH461`}),t[56]=D,t[57]=Y);let X;t[58]!==D||t[59]!==J||t[60]!==Y?(X=(0,v.jsx)(ne,{onClick:J,disabled:D,"data-testid":`mcp-consent-add`,children:Y}),t[58]=D,t[59]=J,t[60]=Y,t[61]=X):X=t[61];let Z;t[62]!==j.Footer||t[63]!==q||t[64]!==X?(Z=(0,v.jsxs)(j.Footer,{className:`sm:justify-between`,children:[q,X]}),t[62]=j.Footer,t[63]=q,t[64]=X,t[65]=Z):Z=t[65];let Q;t[66]!==j.Content||t[67]!==D||t[68]!==L||t[69]!==H||t[70]!==K||t[71]!==Z||t[72]!==I?(Q=(0,v.jsxs)(We,{className:I,"aria-busy":D,...L,children:[H,K,Z]}),t[66]=j.Content,t[67]=D,t[68]=L,t[69]=H,t[70]=K,t[71]=Z,t[72]=I,t[73]=Q):Q=t[73];let $;return t[74]!==j.Root||t[75]!==He||t[76]!==Q?($=(0,v.jsx)(Ue,{open:!0,onOpenChange:He,children:Q}),t[74]=j.Root,t[75]=He,t[76]=Q,t[77]=$):$=t[77],$}function Te(e){return(0,v.jsx)(`span`,{className:`wrap-break-word opacity-75`,children:(0,v.jsx)(`code`,{className:`break-all`,children:e})},e)}function Ee(e){return!e}function De(e){return e.label}function Oe(e){return!e}function ke(e){return(0,v.jsx)(`span`,{className:`block`,children:(0,v.jsx)(`code`,{className:`break-all`,children:e})},e)}function Ae(e){return!e}function je(e){return e.id}function Me(e){return e.id}function Ne(e){return e.label}function Pe(e){return e.willReplace}function Fe(e){return e.paths.length>0}export{S as McpConsentDialogBody,S as default,Se as connectableEditors,xe as isPathRowActionable};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./TerminalPanel-Bxt1nIhY.js","./chunk-CYidjpOJ.js","./dist-BBNlIz6B.js","./preload-helper-Chd9yIcd.js","./trace-api-BP9dN1Hz.js","./lib-vOz_s3tj.js","./html-void-elements-zEl0KGqf.js","./lib-DmueaA5E.js","./markdownit-CugClK-K.js","./w3c-keyname-C7Rznu6R.js","./dist-Nvb76hAm.js","./jsx-runtime-BUgB2tll.js","./react-f2sANaYj.js","./button-Cym3gapE.js","./dist-BHv-mziD.js","./bundle-mjs-SHeFpKGC.js","./compiler-runtime-BfE3aGVn.js","./utils-CPqDy6Hr.js","./triangle-alert-CCeXtPLU.js","./createLucideIcon-B6ULg5PN.js","./x-DIayTyoR.js","./dist-PQ5KMVDh.js","./TerminalStartingNotice-BBIKYNbE.js","./spinner-Bp2_BYkl.js","./file-tree-adapter-CV_ZL37X.js","./file-tree-rename-validation-CaMw2nJs.js","./file-tree-utils-Ba9yRKBT.js","./navigation-targets-DBLYH48Z.js","./doc-paths-CExjBWO9.js","./doc-hash-BP0Io59r.js","./terminal-command-events-MPQ3tB2h.js","./agent-connection-status-CgdIUJFO.js","./dist-Cr4-nBVI.js","./alert-dialog-CrZSZ5Zj.js","./dist-BcvirUWL.js","./react-dom-DPxgxlDT.js","./dialog-DgIQr9zS.js","./dist-DRO03ovd.js","./es2015-B9_uRFGw.js","./checkbox-Crs_F_Np.js","./dist-Bd_yyADX.js","./dist-BDna-dOq.js","./check-BzfGb3KU.js","./minus-cd1ERTPg.js","./label-D-K3fWtj.js","./tooltip-BnyyQDRs.js","./dist-DYso7MCm.js","./floating-ui.dom-CDtYEnEj.js","./folder-C4F4ia-z.js","./info-CilGMBpP.js","./monitor-BZlB-tXl.js","./sparkles-CKoBZZKl.js","./AgentIconCluster-BfdKE6ui.js","./OpenInAgentMenuItem-pI7QqxQ8.js","./dropdown-menu-SORDKiaq.js","./dist-BX7qfUal.js","./dist-tLQ-ULW1.js","./dist-Bn0BEeMP.js","./dist-Dhtu02232.js","./chevron-right-C-g4JuT4.js","./cursor-DnmFJny0.js","./copilot-DHgOuZyE.js","./mascot-outline-CtS592mc.js","./badge-Dk9RrOMI.js","./field-CU8LXLXn.js","./separator-CcvvqzEJ.js","./tool-list-format-BTKYlTbI.js","./use-live-xterm-theme-RBRq5pG-.js","./css-color-to-hex-DPzuRcEY.js","./use-apply-config-theme-DpLdjUDN.js","./page-list-cache-ia70Eztn.js","./TerminalPanel-BrP-ENHg.css","./ThreadView-BoQYnWvN.js","./progress-CzvNMH_z.js","./DocumentContext-CaB8wd1_.js","./dist-DqQhIbz6.js","./dist-AflZtDqw.js","./dist-CrH-06Jf.js","./dist-BcUifdUG.js","./dist-B-aiy_uW.js","./dist-Dwgmw_vl.js","./dist-Cyo49TFZ.js","./dist-Ax8n23QF.js","./dist-DkngBQZE.js","./dist-CvJTfovH.js","./stex-Bg195G9l.js","./config-provider-CI1IgVHl.js","./use-apply-config-language-48pLGsax.js","./dist-CJhtNlOm2.js","./messages-C0RTwTFq.js","./client-version-CH6DzlkY.js","./propagation-api-DC5404fy.js","./context-api-dUnlgSJr.js","./select-ByJwKu6h.js","./chevron-down-Dloks0wp.js","./collapsible-DYySK8La.js","./switch-iwBsEWej.js","./CodeMirrorPropInput-CsU-AE2e.js","./folder-open-dlosmFj2.js","./trash-2-B9Flu-41.js","./with-selector-PRoyWQiu.js","./cm-theme-CFTSfhZu.js","./external-link-C5LIdhIa.js","./documents-fetch-sbhR-qg0.js","./note-window-mode-CsmLTxU_.js","./git-branch-B_QTfwFA.js","./Mermaid-C8EPNkJP.js","./maximize-2-DaY3HCwc.js","./upload-DGQJhdiQ.js","./prop-types-Cu1KjM7N.js","./startup-marks-DjGilb1Q.js","./documents-events-BhW9c1L3.js","./parse-api-error-BtEdpaFC.js","./eye-BtMXolFK.js","./hash-d98LeeWB.js","./paperclip-C8NmE81Z.js","./local-menu-action-bus-4I1Xm40D.js","./react-error-boundary-6ac6QM6R.js","./input-f41fkc3m.js","./popover-CBJqdXoA.js","./dist-zcYT-cpc.js","./use-collab-url-D-Rpmggc.js","./excalidraw-scene-B8IkFuHe.js","./known-skill-dirs-BZ8lUpY6.js","./skill-scope-nA3yMJC-.js","./skills-api-DM_st9cJ.js","./use-workspace-BX0piG-D.js","./DocumentContext-B0sQn39F.css","./workspace-paths-Dczkx4vn.js","./libesm-CFNuVJUm.js","./chunk-BO2N2NFS-Cndqxa-G.js","./RegisteredAgentIcon-H1tWUX4M.js","./terminal-launch-events-BBSlYIZk.js","./list-plus-BmoxCvSM.js","./comment-chips-DSoCMI7Q.js","./rotate-ccw-B05K_aam.js","./square-pen-BhqhPrdL.js","./terminal-DGmaW797.js","./wrench-Cjhn9plF.js","./skeleton-DPvIu5NU.js","./textarea-DYYN2PV4.js","./use-installed-clis-Cr9Uz3fy.js","./launch-agent-thread-ChrizuWp.js","./thread-client-Cqs7BvGE.js","./agent-presence-BZUkfCXD.js","./ok-syntax-theme-Cl5CicS3.js","./overlay-layers-Bj-TVfKw.js","./clipboard-adapter-Tb7FST8m.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./preload-helper-Chd9yIcd.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{t as r}from"./react-f2sANaYj.js";import{n as i,r as a}from"./dist-Nvb76hAm.js";import{t as o}from"./useQuery-ZeEDLtxh.js";import{t as s}from"./react-dom-DPxgxlDT.js";import{t as c}from"./compiler-runtime-BfE3aGVn.js";import{t as l}from"./react-error-boundary-6ac6QM6R.js";import{t as u}from"./utils-CPqDy6Hr.js";import{t as d}from"./overlay-layers-Bj-TVfKw.js";import{t as f}from"./button-Cym3gapE.js";import{i as p,n as m,t as h}from"./tooltip-BnyyQDRs.js";import{a as ee,f as g,g as te,m as _,n as v,t as y,v as ne,y as re}from"./RegisteredAgentIcon-H1tWUX4M.js";import{i as b}from"./terminal-telemetry-pvyydkXE.js";import{gc as x}from"./dist-BBNlIz6B.js";import{n as S}from"./dist-CJhtNlOm2.js";import{a as C,x as w}from"./use-settings-route-DmYoFPHM.js";import{t as T}from"./dist-Cr4-nBVI.js";import{i as E,n as D,r as ie}from"./local-menu-action-bus-4I1Xm40D.js";import{C as ae,T as O,_ as oe,a as k,b as se,g as ce,h as A,n as le,r as j,u as M,v as N,w as P,x as ue}from"./preferred-session-events-Cs4DNke2.js";import{_ as de,d as fe,f as pe,h as F,i as me,m as he,o as ge,p as _e,t as ve,u as ye,y as be}from"./terminal-launch-events-BBSlYIZk.js";import{t as xe}from"./OpenInAgentMenuItem-pI7QqxQ8.js";import{t as I}from"./createLucideIcon-B6ULg5PN.js";import{t as L}from"./check-BzfGb3KU.js";import{t as Se}from"./chevron-down-Dloks0wp.js";import{t as R}from"./chevron-right-C-g4JuT4.js";import{a as Ce,i as we,m as z,o as B,r as Te,t as Ee,u as De}from"./dropdown-menu-SORDKiaq.js";import{t as Oe}from"./spinner-Bp2_BYkl.js";import{t as V}from"./trash-2-B9Flu-41.js";import{t as ke}from"./x-DIayTyoR.js";import{a as H,i as Ae,t as je}from"./popover-CBJqdXoA.js";import{a as U,n as Me,o as Ne,p as Pe,r as Fe,s as W,t as G}from"./terminal-cli-display-UR6Dbpk0.js";import{a as Ie,d as Le,g as Re,h as ze,n as Be,r as Ve,s as He,t as Ue}from"./sortable.esm-BFq01cBQ.js";import{r as We,t as Ge}from"./input-group-Dr2bK474.js";import{i as Ke,n as qe,r as Je,t as Ye}from"./tabs-DYFNdb74.js";import{c as Xe,l as Ze,o as Qe,r as $e,u as et}from"./thread-client-Cqs7BvGE.js";import{n as tt,r as nt,t as rt}from"./launch-agent-thread-ChrizuWp.js";import{n as K,t as it}from"./use-terminal-enabled-b0w6NCxQ.js";import{t as at}from"./TerminalStartingNotice-BBIKYNbE.js";var ot=I(`panel-bottom`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 15h18`,key:`5xshup`}]]),st=e(s(),1),q=c(),J=e(r(),1),Y=n();function ct(e){let t=(0,q.c)(26),{archived:n,openThreadIds:r,onOpenThread:i}=e,{_:o}=a(),s=$e(),[c,l]=(0,J.useState)(!1),[d,ee]=(0,J.useState)(null),[g,te]=(0,J.useState)(0),_=(0,J.useId)(),v;t[0]===o?v=t[1]:(v=o({id:`V0mbgd`}),t[0]=o,t[1]=v);let ne=v,re=je,b;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{l(e),e?te(Date.now()):ee(null)},t[2]=b):b=t[2];let x;t[3]===o?x=t[4]:(x=o({id:`6FCixu`}),t[3]=o,t[4]=x);let S;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Y.jsx)(F,{"aria-hidden":`true`}),t[5]=S):S=t[5];let C;t[6]===x?C=t[7]:(C=(0,Y.jsx)(p,{asChild:!0,children:(0,Y.jsx)(H,{asChild:!0,children:(0,Y.jsx)(f,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,"aria-label":x,"data-testid":`agent-thread-history`,children:S})})}),t[6]=x,t[7]=C);let w;t[8]===o?w=t[9]:(w=o({id:`6FCixu`}),t[8]=o,t[9]=w);let T;t[10]===w?T=t[11]:(T=(0,Y.jsx)(m,{side:`bottom`,sideOffset:8,children:w}),t[10]=w,t[11]=T);let E;t[12]!==C||t[13]!==T?(E=(0,Y.jsxs)(h,{children:[C,T]}),t[12]=C,t[13]=T,t[14]=E):E=t[14];let D=Ae,ie=n.map(e=>{let t=r.has(e.threadId);if(d===e.threadId&&!t)return(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md bg-destructive/5 px-2 py-1`,"data-testid":`agent-thread-history-confirm`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs`,children:o({id:`kVgQUA`})}),(0,Y.jsx)(f,{type:`button`,size:`sm`,variant:`destructive`,className:`h-6 px-2 text-xs`,onClick:()=>{s.deleteThread(e.threadId),ee(null)},"data-testid":`agent-thread-history-confirm-delete`,children:o({id:`cnGeoo`})}),(0,Y.jsx)(f,{type:`button`,size:`sm`,variant:`ghost`,className:`h-6 px-2 text-xs`,onClick:()=>ee(null),children:o({id:`dEgA5A`})})]},e.threadId);let n=`${_}-${e.threadId}`;return(0,Y.jsxs)(`div`,{className:`group flex items-center gap-0.5`,children:[(0,Y.jsxs)(f,{type:`button`,variant:`ghost`,className:`h-auto min-w-0 flex-1 justify-start gap-2 px-2 py-1.5`,onClick:()=>{i(e.threadId),l(!1)},"data-testid":`agent-thread-history-open-${e.threadId}`,children:[(0,Y.jsx)(y,{agentId:e.agent.id,iconUrl:e.agent.iconUrl,className:`size-4 shrink-0`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left text-xs`,children:e.title}),(0,Y.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground`,children:ut(e.lastActivityAt,g)})]}),(0,Y.jsxs)(h,{children:[(0,Y.jsx)(p,{asChild:!0,children:(0,Y.jsxs)(`span`,{className:u(`inline-flex`,t&&`cursor-not-allowed`),children:[(0,Y.jsx)(f,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":o({id:`Y2tU6I`,values:{0:e.title}}),"aria-disabled":t||void 0,"aria-describedby":t?n:void 0,className:u(`opacity-0 transition-opacity focus-visible:opacity-100 group-hover:opacity-100`,t?`cursor-not-allowed text-muted-foreground/50`:`text-muted-foreground hover:text-destructive`),onClick:()=>{t||ee(e.threadId)},"data-testid":`agent-thread-history-delete-${e.threadId}`,children:(0,Y.jsx)(V,{className:`size-3`,"aria-hidden":`true`})}),t?(0,Y.jsx)(`span`,{id:n,className:`sr-only`,children:ne}):null]})}),(0,Y.jsx)(m,{side:`bottom`,sideOffset:8,children:t?ne:o({id:`Y2tU6I`,values:{0:e.title}})})]})]},e.threadId)}),ae;t[15]===ie?ae=t[16]:(ae=(0,Y.jsx)(`div`,{className:`max-h-80 overflow-y-auto`,children:ie}),t[15]=ie,t[16]=ae);let O;t[17]!==D||t[18]!==ae?(O=(0,Y.jsx)(D,{align:`end`,className:`w-72 p-1`,children:ae}),t[17]=D,t[18]=ae,t[19]=O):O=t[19];let oe;return t[20]!==re||t[21]!==c||t[22]!==O||t[23]!==b||t[24]!==E?(oe=(0,Y.jsxs)(re,{open:c,onOpenChange:b,children:[E,O]}),t[20]=re,t[21]=c,t[22]=O,t[23]=b,t[24]=E,t[25]=oe):oe=t[25],oe}function lt(e){let t=(0,q.c)(18),{archived:n,onOpen:r}=e,{_:i}=a(),[o,s]=(0,J.useState)(0),c,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{s(Date.now())},l=[],t[0]=c,t[1]=l):(c=t[0],l=t[1]),(0,J.useEffect)(c,l);let u;t[2]===i?u=t[3]:(u=i({id:`Tq9kNX`}),t[2]=i,t[3]=u);let d;t[4]===u?d=t[5]:(d=(0,Y.jsx)(`p`,{className:`px-1 text-muted-foreground text-xs`,children:u}),t[4]=u,t[5]=d);let p;if(t[6]!==n||t[7]!==o||t[8]!==r){let e;t[10]!==o||t[11]!==r?(e=e=>(0,Y.jsxs)(f,{type:`button`,variant:`ghost`,className:`h-auto w-full min-w-0 justify-start gap-2 px-2 py-1.5`,onClick:()=>r(e.threadId),"data-testid":`agent-thread-empty-open-${e.threadId}`,children:[(0,Y.jsx)(y,{agentId:e.agent.id,iconUrl:e.agent.iconUrl,className:`size-4 shrink-0`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left text-xs`,children:e.title}),(0,Y.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground`,children:ut(e.lastActivityAt,o)})]},e.threadId),t[10]=o,t[11]=r,t[12]=e):e=t[12],p=n.map(e),t[6]=n,t[7]=o,t[8]=r,t[9]=p}else p=t[9];let m;t[13]===p?m=t[14]:(m=(0,Y.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:p}),t[13]=p,t[14]=m);let h;return t[15]!==d||t[16]!==m?(h=(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-3`,"data-testid":`agent-thread-empty-chooser`,children:[d,m]}),t[15]=d,t[16]=m,t[17]=h):h=t[17],h}function ut(e,t){let n=Math.max(0,t-e);if(n<6e4)return T._({id:`xOTzt5`});if(n<36e5){let e=Math.round(n/6e4);return T._({id:`_rP3HI`,values:{minutes:e}})}if(n<864e5){let e=Math.round(n/36e5);return T._({id:`nYeBmY`,values:{hours:e}})}let r=Math.round(n/864e5);return T._({id:`LPAv9E`,values:{days:r}})}var X={terminal:`ok-dock-session-order-v1`,agents:`ok-agent-session-order-v1`};function dt(e){return{order:Array.isArray(e.order)?e.order.filter(e=>typeof e==`string`):[],activeKey:typeof e.activeKey==`string`?e.activeKey:null}}function ft(e){if(typeof window>`u`)return null;try{let t=window.localStorage.getItem(X[e]);return t===null?null:dt(JSON.parse(t))}catch{return null}}function pt(e,t){if(!(typeof window>`u`))try{window.localStorage.setItem(X[e],JSON.stringify(t))}catch{}}async function mt(e,t){if(typeof e?.terminal?.getDockState==`function`)try{let n=await e.terminal.getDockState(),r=n[t];if(r==null)return{sessionOrder:null,terminalSnapshot:n.terminalSnapshot,failed:!1};let{order:i,activeKey:a}=dt(r);return{sessionOrder:i.length===0&&a===null?null:{order:i,activeKey:a},terminalSnapshot:n.terminalSnapshot,failed:!1}}catch(e){return console.warn(`[dock-session-persistence] getDockState failed; cold-starting: ${String(e)}`),{sessionOrder:null,terminalSnapshot:void 0,failed:!0}}return{sessionOrder:e?.terminal==null?ft(t):null,terminalSnapshot:void 0,failed:!1}}function ht(e,t){return mt(e,t).then(e=>e.sessionOrder)}function gt(e,t,n,r={tabs:[],activeOrdinal:null}){if(typeof e?.terminal?.setDockState==`function`){let i={order:[...n.order],activeKey:n.activeKey},a=t===`terminal`?e.terminal.setDockState({surface:`terminal`,...i,terminalSnapshot:r}):e.terminal.setDockState({surface:`agents`,...i});Promise.resolve(a).then(e=>{e?.ok===!1&&(e.reason===`ipc-unavailable`?console.warn(`[dock-session-persistence] setDockState skipped during window teardown`):console.error(`[dock-session-persistence] setDockState failed: ${e.reason}`))}).catch(e=>{console.error(`[dock-session-persistence] setDockState rejected: ${e instanceof Error?e.stack??e.message:String(e)}`)});return}e?.terminal??pt(t,n)}var Z=`ok-terminal-new-tab-bare-v1`;function _t(e){try{return(e??localStorage).getItem(Z)===`1`}catch{return!1}}function vt(e,t){try{let n=t??localStorage;e?n.setItem(Z,`1`):n.removeItem(Z)}catch{}for(let e of Q)e()}var Q=new Set;function yt(){return Ct()}function bt(){for(let e of Q)e()}typeof window<`u`&&typeof window.addEventListener==`function`&&window.addEventListener(`storage`,e=>{(e.key===`ok-terminal-new-tab-bare-v1`||e.key===null)&&bt()});function xt(e){return Q.add(e),()=>Q.delete(e)}function St(){return(0,J.useSyncExternalStore)(xt,yt,yt)}function Ct(){try{return typeof localStorage>`u`?!1:_t()}catch{return!1}}var wt=N(()=>t(()=>import(`./TerminalPanel-Bxt1nIhY.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71]),import.meta.url));function Tt(e){let t=(0,q.c)(23),{bridge:n,onClose:r,onTitleChange:i,launch:o,commandId:s,adoptPtyId:c,onPtyId:u}=e,d=o===void 0?null:o,f=s===void 0?null:s,p=c===void 0?null:c,{enabled:m,synced:h}=it(),ee=K(),{_:g}=a(),te;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(te={enabled:null,hasSynced:!1},t[0]=te):te=t[0];let[_,v]=(0,J.useState)(te),y,ne;t[1]!==m||t[2]!==h?(y=()=>{h&&v(e=>e.hasSynced&&e.enabled===m?e:{enabled:m,hasSynced:!0})},ne=[m,h],t[1]=m,t[2]=h,t[3]=y,t[4]=ne):(y=t[3],ne=t[4]),(0,J.useEffect)(y,ne);let re=h||_.hasSynced,b=h?m:_.enabled,x=re&&b===!1,C,w;t[5]===x?(C=t[6],w=t[7]):(C=()=>{x||wt.preload()},w=[x],t[5]=x,t[6]=C,t[7]=w),(0,J.useEffect)(C,w);let T;t[8]!==g||t[9]!==ee?(T=function(){if(ee===null){S.error(g({id:`V_6bJ4`}));return}let e=ee(!0);e.ok||S.error(g({id:`jKd3AP`,values:{0:e.error}}))},t[8]=g,t[9]=ee,t[10]=T):T=t[10];let E=T;if(re&&!x){let e;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(at,{}),t[11]=e):e=t[11];let a;return t[12]!==p||t[13]!==n||t[14]!==f||t[15]!==d||t[16]!==r||t[17]!==u||t[18]!==i?(a=(0,Y.jsx)(l,{fallbackRender:Dt,onError:Et,children:(0,Y.jsx)(J.Suspense,{fallback:e,children:(0,Y.jsx)(wt,{bridge:n,className:`h-full`,onClose:r,onTitleChange:i,launch:d,commandId:f,adoptPtyId:p,onPtyId:u})})}),t[12]=p,t[13]=n,t[14]=f,t[15]=d,t[16]=r,t[17]=u,t[18]=i,t[19]=a):a=t[19],a}let D;return t[20]!==E||t[21]!==x?(D=x?(0,Y.jsx)(At,{onEnable:E}):(0,Y.jsx)(at,{}),t[20]=E,t[21]=x,t[22]=D):D=t[22],D}function Et(e,t){console.error(`[TerminalGate] rendered fallback for the terminal panel`,e,t.componentStack)}function Dt(e){return(0,Y.jsx)(Ot,{...e})}function Ot(e){let t=(0,q.c)(15),{error:n}=e,{_:r}=a(),i;t[0]!==r||t[1]!==n?(i=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`fbsiBw`}),t[0]=r,t[1]=n,t[2]=i):i=t[2];let o=i,s;t[3]===r?s=t[4]:(s=r({id:`6MnZEC`}),t[3]=r,t[4]=s);let c;t[5]===o?c=t[6]:(c=(0,Y.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:o}),t[5]=o,t[6]=c);let l;t[7]===r?l=t[8]:(l=r({id:`HpK_8d`}),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Y.jsx)(f,{onClick:kt,children:l}),t[9]=l,t[10]=u);let d;return t[11]!==s||t[12]!==c||t[13]!==u?(d=(0,Y.jsxs)(`section`,{"aria-label":s,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,role:`alert`,children:[c,u]}),t[11]=s,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}function kt(){return window.location.reload()}function At(e){let t=(0,q.c)(20),{onEnable:n}=e,{_:r}=a(),i;t[0]===r?i=t[1]:(i=r({id:`_XWY2J`}),t[0]=r,t[1]=i);let o;t[2]===r?o=t[3]:(o=r({id:`oYepHb`}),t[2]=r,t[3]=o);let s;t[4]===o?s=t[5]:(s=(0,Y.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:o}),t[4]=o,t[5]=s);let c;t[6]===r?c=t[7]:(c=r({id:`v2ZW0K`}),t[6]=r,t[7]=c);let l;t[8]!==n||t[9]!==c?(l=(0,Y.jsx)(f,{onClick:n,children:c}),t[8]=n,t[9]=c,t[10]=l):l=t[10];let u;t[11]===r?u=t[12]:(u=r({id:`ICoNYz`}),t[11]=r,t[12]=u);let d;t[13]===u?d=t[14]:(d=(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:u}),t[13]=u,t[14]=d);let p;return t[15]!==i||t[16]!==s||t[17]!==l||t[18]!==d?(p=(0,Y.jsxs)(`section`,{"aria-label":i,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,children:[s,l,d]}),t[15]=i,t[16]=s,t[17]=l,t[18]=d,t[19]=p):p=t[19],p}function jt(e){let t=(0,q.c)(67),{selected:n,onLaunchSelected:r,showAgents:s,registeredAgents:c,onPickAgent:l,onOpenSettings:d,liveThreadCount:ee,showClis:g,onPickCli:te,onPickTerminal:_,visibleClis:v,className:ne}=e,re=v===void 0?G:v,{_:b}=a(),[S,C]=(0,J.useState)(!1),w;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(w=[`acp-catalog`],t[0]=w):w=t[0];let T=S&&s,D;t[1]===T?D=t[2]:(D={queryKey:w,queryFn:Mt,enabled:T,staleTime:3e5},t[1]=T,t[2]=D);let O=ee>=(o(D).data?.maxThreads??8),oe=s||g,k;t[3]!==b||t[4]!==n.agent||t[5]!==n.cli||t[6]!==n.kind?(k=n.kind===`terminal`?b({id:`AB4qw9`}):n.kind===`cli`?b({id:`nP-KFo`,values:{0:x[n.cli].displayName}}):n.agent===null?b({id:`G7bn_N`}):b({id:`nP-KFo`,values:{0:n.agent.name}}),t[3]=b,t[4]=n.agent,t[5]=n.cli,t[6]=n.kind,t[7]=k):k=t[7];let se=k,ce;t[8]===ne?ce=t[9]:(ce=u(`flex shrink-0 items-center`,ne),t[8]=ne,t[9]=ce);let A=oe&&`rounded-r-none`,le;t[10]===A?le=t[11]:(le=u(`cursor-pointer gap-0.5 px-1.5 text-muted-foreground hover:text-foreground`,A),t[10]=A,t[11]=le);let j;t[12]===n?j=t[13]:(j=n.kind===`terminal`?null:(0,Y.jsx)(Nt,{selected:n,className:`size-3.5`}),t[12]=n,t[13]=j);let M;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Y.jsx)(E,{"aria-hidden":`true`,className:`size-3`}),t[14]=M):M=t[14];let N;t[15]!==r||t[16]!==se||t[17]!==le||t[18]!==j?(N=(0,Y.jsx)(p,{asChild:!0,children:(0,Y.jsxs)(f,{type:`button`,variant:`ghost`,size:`xs`,"aria-label":se,"data-testid":`terminal-new-chat`,className:le,onClick:r,children:[j,M]})}),t[15]=r,t[16]=se,t[17]=le,t[18]=j,t[19]=N):N=t[19];let P;t[20]===se?P=t[21]:(P=(0,Y.jsx)(m,{side:`bottom`,sideOffset:8,children:se}),t[20]=se,t[21]=P);let ue;t[22]!==N||t[23]!==P?(ue=(0,Y.jsxs)(h,{children:[N,P]}),t[22]=N,t[23]=P,t[24]=ue):ue=t[24];let de;t[25]!==b||t[26]!==oe?(de=oe?(0,Y.jsx)(z,{asChild:!0,children:(0,Y.jsx)(f,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":b({id:`l87Deg`}),"data-testid":`terminal-new-chat-menu`,className:`cursor-pointer rounded-l-none text-muted-foreground hover:text-foreground`,children:(0,Y.jsx)(Se,{"aria-hidden":`true`,className:`size-3`})})}):null,t[25]=b,t[26]=oe,t[27]=de):de=t[27];let fe;t[28]!==b||t[29]!==O||t[30]!==l||t[31]!==c||t[32]!==n.agent?.id||t[33]!==n.agent?.source||t[34]!==n.kind||t[35]!==s?(fe=s&&c.length>0?(0,Y.jsxs)(we,{"aria-label":b({id:`RXEbZy`}),children:[(0,Y.jsx)(B,{children:(0,Y.jsx)(i,{id:`RXEbZy`})}),c.map(e=>{let t=n.kind===`agent`&&n.agent?.source===e.source&&n.agent?.id===e.id;return(0,Y.jsxs)(Ce,{onSelect:()=>l(e),disabled:O,"data-testid":`terminal-new-chat-agent-${e.id}`,"aria-current":t?`true`:void 0,children:[(0,Y.jsx)(y,{agentId:e.id,iconUrl:e.iconUrl,className:`size-4`}),(0,Y.jsx)(`span`,{className:`flex-1 truncate`,children:e.name}),t?(0,Y.jsx)(L,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},`${e.source}:${e.id}`)}),O?(0,Y.jsx)(B,{className:`py-1 font-normal text-muted-foreground text-xs`,"data-testid":`terminal-new-chat-cap`,children:(0,Y.jsx)(i,{id:`0QVrvp`})}):null]}):null,t[28]=b,t[29]=O,t[30]=l,t[31]=c,t[32]=n.agent?.id,t[33]=n.agent?.source,t[34]=n.kind,t[35]=s,t[36]=fe):fe=t[36];let pe;t[37]!==c||t[38]!==s||t[39]!==g?(pe=s&&c.length>0&&g?(0,Y.jsx)(De,{}):null,t[37]=c,t[38]=s,t[39]=g,t[40]=pe):pe=t[40];let F;t[41]!==b||t[42]!==te||t[43]!==_||t[44]!==n.cli||t[45]!==n.kind||t[46]!==g||t[47]!==re?(F=g?(0,Y.jsxs)(we,{"aria-label":b({id:`ALhMYW`}),children:[(0,Y.jsx)(B,{children:(0,Y.jsx)(i,{id:`ALhMYW`})}),re.map(e=>{let{displayName:t}=x[e],r=n.kind===`cli`&&n.cli===e;return(0,Y.jsxs)(Ce,{onSelect:()=>te(e),"data-testid":`terminal-new-chat-cli-${e}`,"aria-label":b({id:`9mEZeD`,values:{name:t}}),"aria-current":r?`true`:void 0,children:[(0,Y.jsx)(xe,{id:Me(e),className:`size-4`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`flex-1`,children:t}),r?(0,Y.jsx)(L,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e)}),(0,Y.jsxs)(Ce,{onSelect:_,"data-testid":`terminal-new-chat-terminal`,"aria-current":n.kind===`terminal`?`true`:void 0,children:[(0,Y.jsx)(ae,{"aria-hidden":`true`,className:`size-4`}),(0,Y.jsx)(`span`,{className:`flex-1`,children:(0,Y.jsx)(i,{id:`ALhMYW`})}),n.kind===`terminal`?(0,Y.jsx)(L,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]})]}):null,t[41]=b,t[42]=te,t[43]=_,t[44]=n.cli,t[45]=n.kind,t[46]=g,t[47]=re,t[48]=F):F=t[48];let me;t[49]!==d||t[50]!==c||t[51]!==s||t[52]!==g?(me=s?(0,Y.jsxs)(Y.Fragment,{children:[c.length>0||g?(0,Y.jsx)(De,{}):null,(0,Y.jsxs)(Ce,{onSelect:d,"data-testid":`terminal-new-chat-settings`,children:[(0,Y.jsx)(ie,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:`flex-1`,children:(0,Y.jsx)(i,{id:`jRAGrQ`})})]})]}):null,t[49]=d,t[50]=c,t[51]=s,t[52]=g,t[53]=me):me=t[53];let he;t[54]!==fe||t[55]!==pe||t[56]!==F||t[57]!==me?(he=(0,Y.jsxs)(Te,{align:`start`,className:`max-h-80 min-w-[200px]`,children:[fe,pe,F,me]}),t[54]=fe,t[55]=pe,t[56]=F,t[57]=me,t[58]=he):he=t[58];let ge;t[59]!==S||t[60]!==de||t[61]!==he?(ge=(0,Y.jsxs)(Ee,{open:S,onOpenChange:C,children:[de,he]}),t[59]=S,t[60]=de,t[61]=he,t[62]=ge):ge=t[62];let _e;return t[63]!==ue||t[64]!==ge||t[65]!==ce?(_e=(0,Y.jsxs)(`div`,{className:ce,children:[ue,ge]}),t[63]=ue,t[64]=ge,t[65]=ce,t[66]=_e):_e=t[66],_e}function Mt(e){let{signal:t}=e;return b(t)}function Nt(e){let t=(0,q.c)(13),{selected:n,className:r}=e;if(n.kind===`terminal`){let e;return t[0]===r?e=t[1]:(e=(0,Y.jsx)(ae,{"aria-hidden":`true`,className:r}),t[0]=r,t[1]=e),e}if(n.kind===`cli`){let e;t[2]===n.cli?e=t[3]:(e=Me(n.cli),t[2]=n.cli,t[3]=e);let i;return t[4]!==r||t[5]!==e?(i=(0,Y.jsx)(xe,{id:e,className:r,"aria-hidden":`true`}),t[4]=r,t[5]=e,t[6]=i):i=t[6],i}if(n.agent!==null){let e;return t[7]!==r||t[8]!==n.agent.iconUrl||t[9]!==n.agent.id?(e=(0,Y.jsx)(y,{agentId:n.agent.id,iconUrl:n.agent.iconUrl,className:r}),t[7]=r,t[8]=n.agent.iconUrl,t[9]=n.agent.id,t[10]=e):e=t[10],e}let i;return t[11]===r?i=t[12]:(i=(0,Y.jsx)(v,{"aria-hidden":`true`,className:r}),t[11]=r,t[12]=i),i}var Pt=`[data-terminal-tab-sortable]`;function Ft(e){let t=(0,q.c)(11),{id:n,disabled:r,children:i}=e,a;t[0]!==r||t[1]!==n?(a={id:n,disabled:r},t[0]=r,t[1]=n,t[2]=a):a=t[2];let{setNodeRef:o,listeners:s,rect:c,transform:l,transition:u,isDragging:d}=Ie(a),f;return t[3]!==i||t[4]!==d||t[5]!==s||t[6]!==c.current?.width||t[7]!==o||t[8]!==l||t[9]!==u?(f=i({setNodeRef:o,listeners:s,style:M({activeWidth:c.current?.width,isDragging:d,transform:l,transition:u})}),t[3]=i,t[4]=d,t[5]=s,t[6]=c.current?.width,t[7]=o,t[8]=l,t[9]=u,t[10]=f):f=t[10],f}function $(e){let t=(0,q.c)(11),{children:n,onMoveRight:r}=e,a=(0,J.useRef)(null);if(r==null)return n;let o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=e=>{if(!ce(e))return;e.preventDefault(),a.current=document.activeElement instanceof HTMLElement?document.activeElement:null;let t=e.currentTarget.getBoundingClientRect();e.currentTarget.dispatchEvent(new MouseEvent(`contextmenu`,{bubbles:!0,cancelable:!0,clientX:t.left,clientY:t.bottom}))},t[0]=o):o=t[0];let s;t[1]===n?s=t[2]:(s=(0,Y.jsx)(Pe,{asChild:!0,onKeyDown:o,children:n}),t[1]=n,t[2]=s);let c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=e=>{a.current!=null&&(e.preventDefault(),a.current.focus(),a.current=null)},t[3]=c):c=t[3];let l,u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsx)(P,{"aria-hidden":`true`}),u=(0,Y.jsx)(i,{id:`jcEoUi`}),t[4]=l,t[5]=u):(l=t[4],u=t[5]);let d;t[6]===r?d=t[7]:(d=(0,Y.jsx)(U,{onCloseAutoFocus:c,children:(0,Y.jsx)(Ne,{children:(0,Y.jsxs)(W,{onSelect:r,children:[l,u]})})}),t[6]=r,t[7]=d);let f;return t[8]!==s||t[9]!==d?(f=(0,Y.jsxs)(Fe,{children:[s,d]}),t[8]=s,t[9]=d,t[10]=f):f=t[10],f}function It(e){let t=(0,q.c)(111),{sessions:n,sessionKind:r,activeSessionId:o,onSelect:s,onTabActivate:c,newButton:l,trailingControls:d,onClose:ee,onRename:g,onReorder:te,onDragActiveChange:_,edge:v,onPlacementChange:y,reserveRightRevealTabGutter:ne,onCollapse:re,children:b,className:x,draggable:S}=e,{_:C}=a(),w=v===`right`,T=w?`bottom`:`right`,E;t[0]!==C||t[1]!==w?(E=C(w?{id:`Tofsyo`}:{id:`PrWQiT`}),t[0]=C,t[1]=w,t[2]=E):E=t[2];let D=E,ie;t[3]!==v||t[4]!==y||t[5]!==r?(ie=r===`terminal`&&v===`bottom`&&y!=null?()=>y(`right`):void 0,t[3]=v,t[4]=y,t[5]=r,t[6]=ie):ie=t[6];let ae=ie,[O,se]=(0,J.useState)(null),[ce,le]=(0,J.useState)(``),[M,N]=(0,J.useState)(null),ue=(0,J.useRef)(null),de=(0,J.useRef)(!1),fe=g!=null,pe,F;t[7]===O?(pe=t[8],F=t[9]):(pe=()=>{O!=null&&(ue.current?.focus(),ue.current?.select())},F=[O],t[7]=O,t[8]=pe,t[9]=F),(0,J.useEffect)(pe,F);let me,he;t[10]!==O||t[11]!==n?(me=()=>{O!=null&&!n.some(e=>e.id===O)&&(de.current=!1,se(null),le(``))},he=[n,O],t[10]=O,t[11]=n,t[12]=me,t[13]=he):(me=t[12],he=t[13]),(0,J.useEffect)(me,he);let ge=function(e){fe&&(de.current=!1,se(e.id),le(e.label))},_e;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(_e=function(e){let t=typeof CSS<`u`&&CSS.escape?CSS.escape(e):e;queueMicrotask(()=>{document.querySelector(`[role="tab"][data-tab-id="${t}"]`)?.focus()})},t[14]=_e):_e=t[14];let ve=_e,ye=function(e){de.current||g?.(e,ce.trim()),de.current=!1,se(null),le(``),ve(e)},be=(0,J.useRef)(null),xe=(0,J.useRef)(null),[I,L]=(0,J.useState)(null),Ce;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(Ce={activationConstraint:{distance:8}},t[15]=Ce):Ce=t[15];let we=Re(ze(Le,Ce)),z=te!=null,B;t[16]===I?B=t[17]:(B=k(I),t[16]=I,t[17]=B);let Te;t[18]===B?Te=t[19]:(Te=[B],t[18]=B,t[19]=Te);let Ee=Te,De;t[20]!==o||t[21]!==n?(De=o===``?null:`${o}\u0000${n.map(zt).join(`\0`)}`,t[20]=o,t[21]=n,t[22]=De):De=t[22];let Oe=De,V,H;t[23]===Oe?(V=t[24],H=t[25]):(V=()=>{if(Oe===null)return;let[e]=Oe.split(`\0`,1),t=typeof CSS<`u`&&CSS.escape?CSS.escape(e):e;xe.current?.querySelector(`[data-tab-id="${t}"]`)?.scrollIntoView({block:`nearest`,inline:`nearest`})},H=[Oe],t[23]=Oe,t[24]=V,t[25]=H),(0,J.useEffect)(V,H);let Ae;t[26]===_?Ae=t[27]:(Ae=function(){L(A(be.current,Pt)),_?.(!0)},t[26]=_,t[27]=Ae);let je=Ae,U;t[28]!==_||t[29]!==te||t[30]!==n?(U=function(e){L(null),_?.(!1);let t=String(e.active.id),r=e.over?String(e.over.id):null;if(!r||t===r)return;let i=n.map(Rt),a=i.indexOf(t),o=i.indexOf(r);a<0||o<0||a===o||te?.(Be(i,a,o))},t[28]=_,t[29]=te,t[30]=n,t[31]=U):U=t[31];let Me=U,Ne;t[32]===_?Ne=t[33]:(Ne=function(){L(null),_?.(!1)},t[32]=_,t[33]=Ne);let Pe=Ne,Fe=Ye,W;t[34]===x?W=t[35]:(W=u(`flex min-h-0 min-w-0 flex-1 flex-col`,x),t[34]=x,t[35]=W);let G=$,Ie=S?``:void 0,qe=w&&ne&&`pr-9`,Xe=S&&`h-[62px] [-webkit-app-region:drag] pr-[22px] pl-[calc(var(--ok-titlebar-reserve-left,1rem)+0.75rem)]`,Ze;t[36]!==qe||t[37]!==Xe?(Ze=u(`flex shrink-0 flex-row items-center gap-1 px-1.5 py-1`,qe,Xe),t[36]=qe,t[37]=Xe,t[38]=Ze):Ze=t[38];let Qe=He,$e=oe,et;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(et={container:typeof document<`u`?document.body:void 0},t[39]=et):et=t[39];let tt=Ue,nt;t[40]===n?nt=t[41]:(nt=n.map(Lt),t[40]=n,t[41]=nt);let rt=Ve,K=j,it=S&&`[-webkit-app-region:no-drag]`,at;t[42]===it?at=t[43]:(at=u(`grid h-auto w-fit max-w-full min-w-0 grid-flow-col items-center justify-start gap-0.5 overflow-x-auto overflow-y-hidden [grid-auto-columns:max-content] [scrollbar-width:none] scroll-fade-mask-x`,it),t[42]=it,t[43]=at);let st;t[44]!==C||t[45]!==r?(st=C(r===`agent`?{id:`GjsGAu`}:{id:`1MGRQl`}),t[44]=C,t[45]=r,t[46]=st):st=t[46];let ct=n.map((e,t)=>{let n=e.id===o,r=O===e.id;return(0,Y.jsx)(Ft,{id:e.id,disabled:!z||O!=null,children:i=>{let{setNodeRef:a,listeners:o,style:s}=i;return(0,Y.jsxs)(h,{children:[(0,Y.jsx)(p,{asChild:!0,children:(0,Y.jsxs)(Ke,{ref:a,value:e.id,"data-terminal-tab-sortable":``,"data-tab-id":e.id,style:{...s,gridColumn:t+1,gridRow:1},...o,onMouseEnter:()=>N(e.id),onMouseLeave:()=>N(null),onClick:t=>{t.detail>=2||c?.(e.id)},onDoubleClick:()=>ge(e),onKeyDown:t=>{t.key===`F2`&&(t.preventDefault(),ge(e))},className:u(`h-7 flex-none gap-1.5 rounded-md py-0 pr-7 pl-2 text-xs transition-colors motion-reduce:transition-none`,n?`bg-muted`:`hover:bg-muted/50`,r&&`w-40 opacity-0`,S&&`[-webkit-app-region:no-drag]`),children:[e.icon,(0,Y.jsx)(`span`,{className:`max-w-40 truncate`,children:e.label})]})}),(0,Y.jsx)(m,{side:`bottom`,sideOffset:8,children:e.label})]})}},e.id)}),lt;t[47]!==st||t[48]!==ct?(lt=(0,Y.jsx)(Je,{ref:xe,variant:`line`,"aria-label":st,className:`contents`,children:ct}),t[47]=st,t[48]=ct,t[49]=lt):lt=t[49];let ut=n.map((e,t)=>{let n=e.id===o;return O===e.id?(0,Y.jsx)(Ge,{style:{gridColumn:t+1,gridRow:1},className:u(`z-20 h-7 w-40 rounded-md border-0 bg-transparent dark:bg-transparent`,S&&`[-webkit-app-region:no-drag]`),children:(0,Y.jsx)(We,{ref:ue,value:ce,"aria-label":C({id:`0TnCvC`,values:{0:e.label}}),"data-testid":`terminal-tab-rename-input`,className:`h-7 px-2 text-xs`,onChange:e=>le(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),ue.current?.blur()):e.key===`Escape`&&(e.preventDefault(),de.current=!0,ue.current?.blur())},onBlur:()=>ye(e.id)})},e.id):(0,Y.jsx)(f,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":C({id:`nzHlj8`,values:{0:e.label}}),tabIndex:n?0:-1,style:{gridColumn:t+1,gridRow:1},className:u(`z-20 mr-0.5 justify-self-end text-muted-foreground opacity-0 transition-opacity hover:text-foreground hover:opacity-100 focus-visible:opacity-100`,(n||M===e.id)&&`opacity-100`,I!=null&&`pointer-events-none opacity-0`,S&&`[-webkit-app-region:no-drag]`),onMouseEnter:()=>N(e.id),onMouseLeave:()=>N(null),onClick:t=>{t.stopPropagation(),ee(e.id)},children:(0,Y.jsx)(ke,{"aria-hidden":`true`})},e.id)}),X;t[50]===ut?X=t[51]:(X=(0,Y.jsx)(`div`,{className:`contents`,children:ut}),t[50]=ut,t[51]=X);let dt;t[52]!==K||t[53]!==at||t[54]!==lt||t[55]!==X?(dt=(0,Y.jsxs)(`div`,{onWheel:K,className:at,children:[lt,X]}),t[52]=K,t[53]=at,t[54]=lt,t[55]=X,t[56]=dt):dt=t[56];let ft;t[57]!==tt||t[58]!==nt||t[59]!==rt||t[60]!==dt?(ft=(0,Y.jsx)(tt,{items:nt,strategy:rt,children:dt}),t[57]=tt,t[58]=nt,t[59]=rt,t[60]=dt,t[61]=ft):ft=t[61];let pt;t[62]!==Qe||t[63]!==Pe||t[64]!==Me||t[65]!==je||t[66]!==Ee||t[67]!==we||t[68]!==!1||t[69]!==$e||t[70]!==et||t[71]!==ft?(pt=(0,Y.jsx)(Qe,{sensors:we,autoScroll:!1,collisionDetection:$e,modifiers:Ee,onDragStart:je,onDragEnd:Me,onDragCancel:Pe,accessibility:et,children:ft}),t[62]=Qe,t[63]=Pe,t[64]=Me,t[65]=je,t[66]=Ee,t[67]=we,t[68]=!1,t[69]=$e,t[70]=et,t[71]=ft,t[72]=pt):pt=t[72];let mt;t[73]!==S||t[74]!==l?(mt=l==null?null:(0,Y.jsx)(`div`,{className:u(`shrink-0`,S&&`[-webkit-app-region:no-drag]`),children:l}),t[73]=S,t[74]=l,t[75]=mt):mt=t[75];let ht;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(ht=(0,Y.jsx)(`div`,{className:`flex-1`}),t[76]=ht):ht=t[76];let gt;t[77]!==S||t[78]!==d?(gt=d==null?null:(0,Y.jsx)(`div`,{className:u(`shrink-0`,S&&`[-webkit-app-region:no-drag]`),children:d}),t[77]=S,t[78]=d,t[79]=gt):gt=t[79];let Z;t[80]!==v||t[81]!==y||t[82]!==D||t[83]!==T||t[84]!==w||t[85]!==r?(Z=r===`terminal`&&v!=null&&y!=null?(0,Y.jsxs)(h,{children:[(0,Y.jsx)(p,{asChild:!0,children:(0,Y.jsx)(f,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":D,className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,onClick:()=>y(T),children:w?(0,Y.jsx)(ot,{"aria-hidden":`true`}):(0,Y.jsx)(P,{"aria-hidden":`true`})})}),(0,Y.jsx)(m,{side:`bottom`,sideOffset:8,children:D})]}):null,t[80]=v,t[81]=y,t[82]=D,t[83]=T,t[84]=w,t[85]=r,t[86]=Z):Z=t[86];let _t;t[87]!==C||t[88]!==re||t[89]!==w||t[90]!==r?(_t=re==null?null:(0,Y.jsxs)(h,{children:[(0,Y.jsx)(p,{asChild:!0,children:(0,Y.jsx)(f,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":C(r===`terminal`?{id:`MU_NVW`}:{id:`g5V4_P`}),className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,onClick:re,children:w?(0,Y.jsx)(R,{"aria-hidden":`true`}):(0,Y.jsx)(Se,{"aria-hidden":`true`})})}),(0,Y.jsx)(m,{side:`bottom`,sideOffset:8,children:r===`terminal`?(0,Y.jsx)(i,{id:`MU_NVW`}):(0,Y.jsx)(i,{id:`g5V4_P`})})]}),t[87]=C,t[88]=re,t[89]=w,t[90]=r,t[91]=_t):_t=t[91];let vt;t[92]!==Ie||t[93]!==Ze||t[94]!==pt||t[95]!==mt||t[96]!==gt||t[97]!==Z||t[98]!==_t?(vt=(0,Y.jsxs)(`div`,{ref:be,"data-terminal-tab-row":``,"data-electron-drag":Ie,className:Ze,children:[pt,mt,ht,gt,Z,_t]}),t[92]=Ie,t[93]=Ze,t[94]=pt,t[95]=mt,t[96]=gt,t[97]=Z,t[98]=_t,t[99]=vt):vt=t[99];let Q;t[100]!==G||t[101]!==ae||t[102]!==vt?(Q=(0,Y.jsx)(G,{onMoveRight:ae,children:vt}),t[100]=G,t[101]=ae,t[102]=vt,t[103]=Q):Q=t[103];let yt;return t[104]!==Fe||t[105]!==o||t[106]!==b||t[107]!==s||t[108]!==W||t[109]!==Q?(yt=(0,Y.jsxs)(Fe,{value:o,onValueChange:s,className:W,children:[Q,b]}),t[104]=Fe,t[105]=o,t[106]=b,t[107]=s,t[108]=W,t[109]=Q,t[110]=yt):yt=t[110],yt}function Lt(e){return e.id}function Rt(e){return e.id}function zt(e){return e.id}var Bt=(0,J.lazy)(()=>t(()=>import(`./ThreadView-BoQYnWvN.js`).then(e=>({default:e.ThreadView})),__vite__mapDeps([72,1,3,2,4,5,6,7,8,9,32,10,11,12,36,34,14,35,37,38,13,15,16,17,20,19,73,65,45,46,47,41,74,75,76,77,78,79,80,81,82,83,84,85,86,21,87,88,89,90,68,69,91,92,93,57,40,42,94,95,96,97,98,99,100,27,26,28,101,70,102,29,103,104,105,106,107,18,59,108,109,110,111,112,113,114,49,23,43,115,116,51,117,25,63,118,119,120,121,122,123,124,125,126,127,24,128,129,130,131,60,54,55,56,58,132,133,134,135,136,137,138,62,139,140,141,142,143,144,145,146,147]),import.meta.url));function Vt(e){return`terminal-session-${e}`}function Ht(e){return typeof CSS<`u`&&CSS.escape?CSS.escape(e):e}function Ut(e){e!==``&&document.querySelector(`[data-terminal-session="${Ht(e)}"] .xterm-helper-textarea`)?.focus()}function Wt(e){e!==``&&document.querySelector(`[data-session-id="${Ht(e)}"] [data-testid="agent-thread-composer"]`)?.focus()}function Gt(e){e.kind===`terminal`?Ut(e.id):Wt(e.id)}function Kt(e){return e?.contains(document.activeElement)??!1}function qt(e,t){return t||Kt(e)}function Jt(e){switch(e){case`running`:return`bg-amber-500 animate-pulse`;case`installing`:case`spawning`:case`authenticating`:return`bg-sky-500 animate-pulse`;case`auth_required`:case`awaiting_permission`:return`bg-amber-500`;case`ready`:return`bg-emerald-500`;case`error`:return`bg-red-500`;default:return`bg-muted-foreground`}}function Yt(){return(0,Y.jsx)(ae,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`})}var Xt=[`ring-violet-400/60`,`ring-fuchsia-400/60`,`ring-pink-400/60`,`ring-cyan-400/60`,`ring-teal-400/60`,`ring-lime-400/60`,`ring-yellow-400/60`,`ring-stone-400/60`];function Zt(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)>>>0;return Xt[t%Xt.length]??`ring-transparent`}function Qt(e){let t=(0,q.c)(12),{info:n,threadId:r}=e,i=Xe(r),a;t[0]===r?a=t[1]:(a=u(`relative inline-flex shrink-0 rounded-full ring-1`,Zt(r)),t[0]=r,t[1]=a);let o=n?.agent.id??``,s=n?.agent.iconUrl,c;t[2]!==o||t[3]!==s?(c=(0,Y.jsx)(y,{agentId:o,iconUrl:s,className:`size-3.5`}),t[2]=o,t[3]=s,t[4]=c):c=t[4];let l;t[5]!==n||t[6]!==i?(l=n==null?null:(0,Y.jsx)(`span`,{className:u(`-right-0.5 -bottom-0.5 absolute size-1.5 rounded-full ring-1 ring-background`,Jt(n.status),i&&n.status===`ready`&&`animate-pulse`),"aria-hidden":`true`}),t[5]=n,t[6]=i,t[7]=l):l=t[7];let d;return t[8]!==a||t[9]!==c||t[10]!==l?(d=(0,Y.jsxs)(`span`,{className:a,children:[c,l]}),t[8]=a,t[9]=c,t[10]=l,t[11]=d):d=t[11],d}var $t=5e3,en={cli:!0,terminal:!0,desktop:!0};function tn(e){let t=(0,q.c)(146),{bridge:n,terminalCapable:r,surface:i,terminalPlacement:o,onTerminalPlacementChange:s,reserveRightRevealTabGutter:c,terminalRestoreRevealNonce:l,visible:f,onVisibleChange:p,launch:m,commandLaunch:h,threadLaunch:v,installedClis:y,container:b,isShowing:T,onRequestEditorFocus:E}=e,ie=r===void 0?!1:r,ae=o===void 0?`bottom`:o,oe=l===void 0?0:l,k=m===void 0?null:m,ce=h===void 0?null:h,A=v===void 0?null:v,{_:j}=a(),M=i===`terminal-window`,N=i===`agents-panel`,P=!N,F=P&&ie&&n?.terminal!=null,xe=N?`right`:ae,I=N?`agents`:`terminal`,L=!M,Se=n?.platform===`darwin`?`mac`:n?.platform===`linux`||n?.platform===`win32`?`windowsLinux`:void 0,[R]=(0,J.useState)(En),Ce,we;t[0]!==b||t[1]!==R?(Ce=()=>{R==null||b==null||R.parentElement!==b&&b.appendChild(R)},we=[R,b],t[0]=b,t[1]=R,t[2]=Ce,t[3]=we):(Ce=t[2],we=t[3]),(0,J.useLayoutEffect)(Ce,we);let z=P&&typeof n?.terminal?.list==`function`,B=!z&&F&&f,Te;t[4]!==n?.terminal?.getDockState||t[5]!==z||t[6]!==B||t[7]!==I||t[8]!==L?(Te=()=>z||!L||B||typeof n?.terminal?.getDockState==`function`?null:ft(I),t[4]=n?.terminal?.getDockState,t[5]=z,t[6]=B,t[7]=I,t[8]=L,t[9]=Te):Te=t[9];let[Ee]=(0,J.useState)(Te),De;t[10]===Ee?.order?De=t[11]:(De=Ee?.order??[],t[10]=Ee?.order,t[11]=De);let Oe=(0,J.useRef)(De),V=(0,J.useRef)(Ee?.activeKey??null),ke;t[12]!==B||t[13]!==k?(ke=()=>B?[{kind:`terminal`,id:Vt(1),launch:k,commandId:null,title:null,customLabel:null,ordinal:1,adoptPtyId:null}]:[],t[12]=B,t[13]=k,t[14]=ke):ke=t[14];let[H,Ae]=(0,J.useState)(ke),je;t[15]===B?je=t[16]:(je=()=>B?Vt(1):``,t[15]=B,t[16]=je);let[U,Me]=(0,J.useState)(je),[Ne,Pe]=(0,J.useState)(!z),Fe=(0,J.useRef)(!1),W=(0,J.useRef)(U),G=(0,J.useRef)(H),Ie=(0,J.useRef)(+!!B),Le=(0,J.useRef)(B&&k?k.nonce:null),Re=(0,J.useRef)(null),ze=(0,J.useRef)(null),Be=(0,J.useRef)(!1),Ve=(0,J.useRef)(!1),He=(0,J.useRef)(!1),Ue=(0,J.useRef)(!1),We=(0,J.useRef)(Tn),Ge=(0,J.useRef)(null),Ke=(0,J.useRef)(M?!1:f),Je=(0,J.useRef)(oe),Ye=(0,J.useRef)(new Map),Xe=(0,J.useRef)(0),K=et(),it=Ze(),at=Qe(),ot=at===`connecting`||at===`closed`,ut=re(),X=g(),dt;t[17]===X?dt=t[18]:(dt=e=>ee(X,e.source,e.id,!0,e.supported),t[17]=X,t[18]=dt);let pt=ut.filter(dt),Z=_(pt,ne()),_t;t[19]===K?_t=t[20]:(_t=K.filter(wn),t[19]=K,t[20]=_t);let Q=_t.length,yt=new Map(K.map(Cn)),bt=new Set(yt.keys()),xt;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(xt=function(e){$e().openArchivedThread(e)},t[21]=xt):xt=t[21];let Ct=xt,wt=function(){return!L||z&&!Ne?!0:He.current?(Ue.current||(Ue.current=!0,console.warn(`[terminal] dock persistence suppressed for this window: the restore did not complete, so the saved tab set is left untouched`)),!0):!1},Et=function(){if(wt())return;let e=Ye.current,t=G.current.map(t=>An(t,e)).filter(Sn),r=G.current.find(e=>e.id===W.current);gt(n,I,{order:t,activeKey:r==null?null:An(r,e)},jn(G.current,W.current))},Dt=function(e,t){if(t===null){Ye.current.delete(e),Fn(G.current,W.current);return}Ye.current.set(e,t),Fn(G.current,W.current);let r=G.current.find(t=>t.id===e);r!=null&&r.kind===`terminal`&&n?.terminal?.setMeta?.(t,{ordinal:r.ordinal,customLabel:r.customLabel}),Et()},Ot=function(e,t){let n=t===void 0?null:t;V.current=null,Ie.current+=1;let r=Vt(Ie.current);Ae(t=>[...t,{kind:`terminal`,id:r,launch:e,commandId:n,title:null,customLabel:null,ordinal:Ie.current,adoptPtyId:null}]),Me(r)},kt=he(),At=St(),Mt;t[22]===y?Mt=t[23]:(Mt=y??{},t[22]=y,t[23]=Mt);let Nt;t[24]===y?Nt=t[25]:(Nt=y??{},t[24]=y,t[25]=Nt);let Pt=ge({sticky:kt,effectiveThreadAgent:Z,enabledClis:me(X,Mt),enabledDesktopTargets:[],installedClis:Nt,terminalAvailable:F,threadsAvailable:N,desktopSelectable:!1,preferBareTerminal:At,bareTerminalFallback:!0}),Ft=ye(kt),$=Pt.kind===`thread`?{kind:`agent`,agent:Pt.agent}:Pt.kind===`cli`?Pt.cli===Ft?{kind:`cli`,cli:Pt.cli}:{kind:`terminal`}:Pt.kind===`terminal`?{kind:`terminal`}:{kind:`agent`,agent:null},Lt=function(e){Xe.current+=1,Ot({prompt:null,cli:e,nonce:Xe.current})},Rt=function(){$.kind===`terminal`?Ot(null):$.kind===`cli`?Lt($.cli):$.kind===`agent`&&$.agent!=null?tt({source:$.agent.source,id:$.agent.id},null,null,null):C()},zt=function(){return N?$.kind!==`agent`||$.agent==null?!1:(tt({source:$.agent.source,id:$.agent.id},null,null,null),!0):($.kind===`terminal`?Ot(null):$.kind===`cli`&&Lt($.cli),!0)},Bt;t[26]===y?Bt=t[27]:(Bt=y??{},t[26]=y,t[27]=Bt);let Ht;t[28]===y?Ht=t[29]:(Ht=y??{},t[28]=y,t[29]=Ht);let Jt=ge({sticky:kt,effectiveThreadAgent:Z,enabledClis:me(X,Bt),enabledDesktopTargets:[],installedClis:Ht,terminalAvailable:ie,threadsAvailable:!M,desktopSelectable:!1,preferBareTerminal:!1,bareTerminalFallback:!1}),Xt=ge({sticky:kt,effectiveThreadAgent:Z,enabledClis:[],enabledDesktopTargets:[],installedClis:{},terminalAvailable:!1,threadsAvailable:N,desktopSelectable:!1,preferBareTerminal:!1,bareTerminalFallback:!1}),Zt;t[30]===y?Zt=t[31]:(Zt=y??{},t[30]=y,t[31]=Zt);let tn;t[32]===y?tn=t[33]:(tn=y??{},t[32]=y,t[33]=tn);let On=ge({sticky:kt,effectiveThreadAgent:Z,enabledClis:me(X,Zt),enabledDesktopTargets:[],installedClis:tn,terminalAvailable:ie,threadsAvailable:!M,desktopSelectable:!1,preferBareTerminal:At,bareTerminalFallback:!0}),Nn;t[34]!==N||t[35]!==M?(Nn=function(e){return M?!0:N?e===`thread`||e===`none`:e in en},t[34]=N,t[35]=M,t[36]=Nn):Nn=t[36];let Pn=Nn;function Fn(e,t){let r=e.find(e=>e.id===t);if(r==null){O(I,null);return}if(r.kind===`thread`){let e=yt.get(r.threadId);O(I,{id:r.id,kind:`thread`,label:e?.agent.name??j({id:`bcm0pR`}),agentId:e?.agent.id??``,iconUrl:e?.agent.iconUrl});return}let i=Ye.current.get(r.id),a=r.launch?.cli;if(i==null||n?.terminal==null||a==null){O(I,null);return}O(I,{id:r.id,kind:`terminal`,label:x[a].displayName,cli:a})}let In;t[37]!==U||t[38]!==K||t[39]!==H?(In=[U,H,K],t[37]=U,t[38]=K,t[39]=H,t[40]=In):In=t[40],(0,J.useEffect)(()=>{Fn(H,U)},In);let Ln;t[41]!==p||t[42]!==f?(Ln=function(){f||p(!0)},t[41]=p,t[42]=f,t[43]=Ln):Ln=t[43];let Rn=Ln,zn=function(e){let{text:t,newTab:r,submit:i,target:a}=e,o=a===`agents`?Xt:Jt;if(a===`agents`){if(!N)return}else if(!Pn(o.kind))return;f||p(!0);let s=W.current,c=G.current.find(e=>e.id===s);if(!r&&c!=null){if(c.kind===`thread`){nt(c.threadId,t),Rn(),queueMicrotask(()=>Gt(c));return}let e=Ye.current.get(c.id),r=n?.terminal;if(e!=null&&r!=null&&c.launch?.cli!=null){r.input(e,t),Rn(),queueMicrotask(()=>Ut(s));return}}if(o.kind===`thread`){let e={source:o.agent.source,id:o.agent.id};i?tt(e,t,null,null,null):tt(e,null,null,null,t)}else o.kind===`cli`?ve(t,o.cli,{stage:!i}):C()},Bn=function(e){vt(!1),fe(pe(e)),Lt(e)},Vn=function(){vt(!0),Ot(null)},Hn;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(Hn=function(e){te(e),vt(!1),fe(_e(e)),tt({source:e.source,id:e.id},null,null,null)},t[44]=Hn):Hn=t[44];let Un=Hn,Wn;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(Wn=function(e,t){let n=t.trim()===``?null:t.trim();Ae(t=>t.some(t=>t.id===e&&t.kind===`terminal`&&t.title!==n)?t.map(t=>t.id===e&&t.kind===`terminal`?{...t,title:n}:t):t)},t[45]=Wn):Wn=t[45];let Gn=Wn,Kn=function(e,t){let r=G.current.find(t=>t.id===e);if(r==null)return;if(r.kind===`thread`){$e().renameThread(r.threadId,t);return}let i=t.trim()===``?null:t.trim();Ae(t=>t.some(t=>t.id===e&&t.kind===`terminal`&&t.customLabel!==i)?t.map(t=>t.id===e&&t.kind===`terminal`?{...t,customLabel:i}:t):t);let a=Ye.current.get(e);a!=null&&n?.terminal?.setMeta?.(a,{customLabel:i})},qn=function(e){return e.kind===`terminal`?e.customLabel??e.title??j({id:`OVjNeX`,values:{0:e.ordinal}}):yt.get(e.threadId)?.title??j({id:`iEQQyu`})},Jn=(0,J.useRef)(!1),Yn=(0,J.useRef)(null),Xn=(0,J.useRef)(null),Zn=function(e){Ae(t=>{if(e.length!==t.length)return t;let n=new Map(t.map(xn)),r=[];for(let i of e){let e=n.get(i);if(e==null)return t;r.push(e)}return r.every((e,n)=>e===t[n])?t:r});let t=e.map(e=>Ye.current.get(e)).filter(bn);t.length>0&&n?.terminal?.setOrder?.(t)},Qn=function(e){let t=G.current,n=t.findIndex(e=>e.id===W.current);if(n<0)return null;let r=n+e;if(r<0||r>=t.length)return null;let i=t.map(yn),[a]=i.splice(n,1);return i.splice(r,0,a),Zn(i),{label:qn(t[n]),position:r+1,total:t.length}},$n=function(){Pn(On.kind)&&(f||p(!0),Rt())},er=(0,J.useRef)(Qn),tr=(0,J.useRef)(Ot),nr=(0,J.useRef)(zt),rr=(0,J.useRef)(zn),ir=(0,J.useRef)(Rn),ar=(0,J.useRef)($n),or=function(e){let t=G.current,n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t[n],i=t.length===1;if(V.current=null,e===W.current){let e=t[n-1]??t[n+1];Me(e?.id??``),e!=null&&queueMicrotask(()=>Gt(e))}r.kind===`thread`?$e().closeThread(r.threadId):Ae(t.filter(t=>t.id!==e)),i&&(p(!1),E())},sr=(0,J.useRef)(vn);(0,J.useEffect)(()=>{We.current=wt,tr.current=Ot,nr.current=zt,rr.current=zn,ir.current=Rn,ar.current=$n,er.current=Qn,W.current=U,G.current=H,sr.current=()=>{let e=G.current.find(e=>e.id===W.current);if(e?.kind===`terminal`){or(e.id);return}let t=[...G.current].reverse().find(_n);t!=null&&or(t.id)}});let cr;t[46]!==U||t[47]!==n||t[48]!==I||t[49]!==L||t[50]!==Ne||t[51]!==H?(cr=[H,U,L,I,n,Ne],t[46]=U,t[47]=n,t[48]=I,t[49]=L,t[50]=Ne,t[51]=H,t[52]=cr):cr=t[52],(0,J.useEffect)(()=>{if(!L||!Ne||We.current())return;let e=Ye.current,t=H.map(t=>An(t,e)).filter(gn),r=H.find(e=>e.id===U);gt(n,I,{order:t,activeKey:r==null?null:An(r,e)},jn(H,U))},cr);let lr;t[53]!==N||t[54]!==K?(lr=[K,N],t[53]=N,t[54]=K,t[55]=lr):lr=t[55],(0,J.useEffect)(()=>{if(!N)return;let e=new Set(K.map(hn)),t=G.current,n=new Set(t.filter(mn).map(pn)),r=[];for(let e of K)n.has(e.threadId)||(Ie.current+=1,r.push({kind:`thread`,id:e.threadId,threadId:e.threadId,ordinal:Ie.current}));let i=t.some(t=>t.kind===`thread`&&!e.has(t.threadId));r.length===0&&!i||Ae(t=>{let n=t.filter(t=>t.kind!==`thread`||e.has(t.threadId)),i=new Set(n.filter(fn).map(dn)),a=r.filter(e=>!i.has(e.threadId)),o=Ye.current,s=a.length>0?Mn(n,a,Oe.current,e=>An(e,o)):n;return s.length===t.length&&s.every((e,n)=>e===t[n])?t:s})},lr);let ur;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ur=[],t[56]=ur):ur=t[56];let dr=(0,J.useRef)(ur),fr,pr;t[57]!==N||t[58]!==K?(fr=()=>{if(!N)return;let e=K.map(un),t=dr.current;if(dr.current=e,V.current!=null)return;let n=e.filter(e=>!t.includes(e)),r=n[n.length-1];r!=null&&(Me(r),queueMicrotask(()=>Wt(r)))},pr=[K,N],t[57]=N,t[58]=K,t[59]=fr,t[60]=pr):(fr=t[59],pr=t[60]),(0,J.useEffect)(fr,pr);let mr=(0,J.useRef)(Q),hr,gr;t[61]!==N||t[62]!==Q||t[63]!==p||t[64]!==f?(hr=()=>{if(!N)return;let e=mr.current;mr.current=Q,Q>e&&!f&&p(!0)},gr=[Q,f,N,p],t[61]=N,t[62]=Q,t[63]=p,t[64]=f,t[65]=hr,t[66]=gr):(hr=t[65],gr=t[66]),(0,J.useEffect)(hr,gr);let _r;t[67]!==U||t[68]!==H?(_r=[H,U],t[67]=U,t[68]=H,t[69]=_r):_r=t[69],(0,J.useEffect)(()=>{let e=V.current;if(e!=null){let t=Ye.current,n=H.find(n=>An(n,t)===e);if(n!=null){V.current=null,Me(n.id);return}if(H.some(e=>e.id===U))return}if(!(U!==``&&H.some(e=>e.id===U))){if(H.length===0){U!==``&&Me(``);return}Me(H[H.length-1].id)}},_r),(0,J.useEffect)(()=>{if(!Ne)return;let e=Ke.current;if(Ke.current=f,k!=null&&k.nonce!==Le.current){Le.current=k.nonce,tr.current(k);return}if(ce!=null&&ce.nonce!==Ge.current){Ge.current=ce.nonce,tr.current(null,ce.id);return}let t=N&&A!=null&&A.nonce!==Re.current,n=P&&oe!==Je.current;if(n&&(Je.current=oe),f&&!e&&H.length===0&&!t&&!(N&&rt())){if(n&&!Ve.current)return;Be.current=!nr.current();return}if(Be.current){if(!f||H.length>0||t){Be.current=!1;return}N&&Z===null||nr.current()&&(Be.current=!1)}},[f,k,ce,A,H.length,Ne,N,Z,P,oe]);let vr;t[70]!==j||t[71]!==Z||t[72]!==N||t[73]!==A?(vr=[A,N,Z,j],t[70]=j,t[71]=Z,t[72]=N,t[73]=A,t[74]=vr):vr=t[74],(0,J.useEffect)(()=>{if(!N||A==null||A.nonce===Re.current)return;let e=A.agentId===``?null:{source:A.agentSource,id:A.agentId};if(e===null&&Z!==null&&(e={source:Z.source,id:Z.id}),e===null){ze.current!==A.nonce&&(ze.current=A.nonce,C());return}Re.current=A.nonce,tt(e,A.prompt,A.docName,A.titleHint,null,A.attachments??void 0).then(e=>{e===`deduped`&&S.error(j({id:`eCOktA`}))})},vr);let yr;t[75]!==n||t[76]!==P||t[77]!==I?(yr=[n,P,I],t[75]=n,t[76]=P,t[77]=I,t[78]=yr):yr=t[78],(0,J.useEffect)(()=>{if(!P||typeof n?.terminal?.list!=`function`||Fe.current)return;Fe.current=!0;let e=!1,t=!1,r=()=>{e||Pe(!0)},i=window.setTimeout(()=>{t=!0,console.warn(`[terminal] dock restore exceeded its ${$t}ms bound; cold-starting instead of waiting`),Ve.current=!0,He.current=!0,Be.current=!0,r()},$t),a=()=>{window.clearTimeout(i),t||r()};return(async()=>{try{let{sessionOrder:r,terminalSnapshot:i,failed:o}=await mt(n,I);if(e||t)return;o&&(He.current=!0),r!=null&&(Oe.current=r.order,V.current=r.activeKey);let s=null;try{s=await n.terminal.list()??[]}catch(e){let t=e;He.current=!0,console.error(`[terminal] reload session list() failed; the surviving shells are unknown: ${String(t)}`)}if(e)return;if(t){let e=(s??[]).map(ln);e.length>0&&console.warn(`[terminal] dock restore was abandoned before list() resolved; these PTYs stay running unadopted: ${e.join(`, `)}`);return}if(s!=null&&s.length>0){let e=Oe.current,t=t=>{let n=e.indexOf(t);return n===-1?1/0:n},n=s.map(cn).sort((e,n)=>{let r=t(e.adoptPtyId),i=t(n.adoptPtyId);return r===i?0:r-i});Ie.current=Math.max(n.length,...n.map(sn)),Ae(n)}else if(s!=null&&i!=null&&i.tabs.length>0){let e=i.tabs.map(on);Ie.current=Math.max(e.length,...e.map(an)),V.current=null,Ae(e);let t=e.find(e=>e.ordinal===i?.activeOrdinal);t!=null&&Me(t.id)}else s!=null&&(Ve.current=!0,Be.current=!0);window.setTimeout(()=>{e||(V.current=null)},9e3),a()}catch(e){let t=e;He.current=!0,Ve.current=!0,Be.current=!0,console.error(`[terminal] dock rehydration failed; cold-starting: ${t instanceof Error?t.stack??t.message:String(t)}`),a()}})(),()=>{e=!0,t=!0,window.clearTimeout(i),Fe.current=!1,Ve.current=!1,He.current=!1,Be.current=!1,Ue.current=!1}},yr);let br,xr;t[79]!==n||t[80]!==z||t[81]!==I||t[82]!==L?(br=()=>{if(z||!L||typeof n?.terminal?.getDockState!=`function`)return;let e=!1;return ht(n,I).then(t=>{e||t==null||(Oe.current=t.order,V.current===null&&(V.current=t.activeKey))}),()=>{e=!0}},xr=[n,z,L,I],t[79]=n,t[80]=z,t[81]=I,t[82]=L,t[83]=br,t[84]=xr):(br=t[83],xr=t[84]),(0,J.useEffect)(br,xr);let Sr,Cr;t[85]===z?(Sr=t[86],Cr=t[87]):(Sr=()=>{if(z)return;let e=window.setTimeout(()=>{V.current=null},9e3);return()=>window.clearTimeout(e)},Cr=[z],t[85]=z,t[86]=Sr,t[87]=Cr),(0,J.useEffect)(Sr,Cr);let wr;t[88]!==N||t[89]!==F?(wr=[F,N],t[88]=N,t[89]=F,t[90]=wr):wr=t[90],(0,J.useEffect)(()=>{if(!(!F&&!N))return se(e=>rr.current(e))},wr);let Tr;t[91]===N?Tr=t[92]:(Tr=[N],t[91]=N,t[92]=Tr),(0,J.useEffect)(()=>{if(N)return be(e=>{let{threadIds:t}=e,n=W.current,r=G.current.find(e=>e.id===n);r?.kind===`thread`&&(de(r.threadId,t),ir.current(),queueMicrotask(()=>Gt(r)))})},Tr);let Er;t[93]===Symbol.for(`react.memo_cache_sentinel`)?(Er=[],t[93]=Er):Er=t[93],(0,J.useEffect)(()=>le(()=>ar.current()),Er);let Dr;t[94]!==P||t[95]!==M||t[96]!==F?(Dr=[M,P,F],t[94]=P,t[95]=M,t[96]=F,t[97]=Dr):Dr=t[97],(0,J.useEffect)(()=>{if(P)return D(e=>{e===`new-terminal`?F&&tr.current(null):(e===`kill-terminal`||e===`close-active-tab-or-window`&&M)&&sr.current()})},Dr);let Or;t[98]!==R||t[99]!==M||t[100]!==Se?(Or=[R,M,Se],t[98]=R,t[99]=M,t[100]=Se,t[101]=Or):Or=t[101],(0,J.useEffect)(()=>{let e=function(e){if(!w(e,Se)||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key)||!qt(R,M)||d())return;let t=G.current[Number(e.key)-1];t!=null&&(e.preventDefault(),e.stopPropagation(),Me(t.id),queueMicrotask(()=>Gt(t)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},Or);let kr;t[102]!==j||t[103]!==R||t[104]!==M||t[105]!==Se?(kr=[R,M,Se,j],t[102]=j,t[103]=R,t[104]=M,t[105]=Se,t[106]=kr):kr=t[106],(0,J.useEffect)(()=>{let e=function(e){if(!w(e,Se)||!e.shiftKey||e.altKey)return;let t=e.key===`ArrowLeft`?-1:+(e.key===`ArrowRight`);if(t===0||!qt(R,M)||d()||Jn.current)return;let n=e.target;if(n?.tagName===`INPUT`||n?.isContentEditable)return;let r=er.current(t);if(r==null)return;e.preventDefault(),e.stopPropagation();let i=W.current,a=G.current.find(e=>e.id===i);a!=null&&queueMicrotask(()=>Gt(a));let o=j({id:`CoHvYd`,values:{0:r.label,1:r.position,2:r.total}});Xn.current!=null&&window.clearTimeout(Xn.current),Xn.current=window.setTimeout(()=>{Xn.current=null,Yn.current!=null&&(Yn.current.textContent=o)},60)};return window.addEventListener(`keydown`,e,{capture:!0}),()=>{window.removeEventListener(`keydown`,e,{capture:!0}),Xn.current!=null&&(window.clearTimeout(Xn.current),Xn.current=null)}},kr);let Ar;t[107]!==n?.editor||t[108]!==P||t[109]!==H?(Ar=()=>{if(!P)return;let e=H.some(rn);ue({terminalLive:e}),n?.editor.notifyViewMenuStateChanged({terminalLive:e})},t[107]=n?.editor,t[108]=P,t[109]=H,t[110]=Ar):Ar=t[110];let jr;t[111]!==n||t[112]!==P||t[113]!==H?(jr=[n,H,P],t[111]=n,t[112]=P,t[113]=H,t[114]=jr):jr=t[114],(0,J.useEffect)(Ar,jr);let Mr,Nr;t[115]!==R||t[116]!==T||t[117]!==E||t[118]!==f?(Mr=()=>{T||f||Kt(R)&&E()},Nr=[T,f,R,E],t[115]=R,t[116]=T,t[117]=E,t[118]=f,t[119]=Mr,t[120]=Nr):(Mr=t[119],Nr=t[120]),(0,J.useLayoutEffect)(Mr,Nr);let Pr;t[121]===T?Pr=t[122]:(Pr=[T],t[121]=T,t[122]=Pr),(0,J.useEffect)(()=>{if(!T)return;let e=G.current.find(e=>e.id===W.current);e!=null&&Gt(e)},Pr);let Fr;if(t[123]!==U||t[124]!==H){let e;t[126]===U?e=t[127]:(e=e=>e.id===U,t[126]=U,t[127]=e),Fr=H.find(e),t[123]=U,t[124]=H,t[125]=Fr}else Fr=t[125];let Ir=Fr,Lr=Ir?.kind===`thread`?Ir.threadId:null,Rr=Lr===null?void 0:yt.get(Lr),zr=Rr?.lastActivityAt??null,Br=Rr?.status??null,Vr;t[128]!==Lr||t[129]!==T?(Vr=()=>{!T||Lr===null||$e().markThreadViewed(Lr)},t[128]=Lr,t[129]=T,t[130]=Vr):Vr=t[130];let Hr;t[131]!==zr||t[132]!==Lr||t[133]!==Br||t[134]!==T?(Hr=[Lr,zr,Br,T],t[131]=zr,t[132]=Lr,t[133]=Br,t[134]=T,t[135]=Hr):Hr=t[135],(0,J.useEffect)(Vr,Hr);let Ur=H.map(e=>({id:e.id,label:qn(e),icon:e.kind===`terminal`?Yt():(0,Y.jsx)(Qt,{info:yt.get(e.threadId),threadId:e.threadId})})),Wr=[...H].sort(nn),Gr;t[136]===y?Gr=t[137]:(Gr=y??{},t[136]=y,t[137]=Gr);let Kr;t[138]!==X||t[139]!==Gr?(Kr=me(X,Gr),t[138]=X,t[139]=Gr,t[140]=Kr):Kr=t[140];let qr=(0,Y.jsx)(jt,{selected:$,onLaunchSelected:Rt,showAgents:N,registeredAgents:pt,onPickAgent:Un,onOpenSettings:C,liveThreadCount:Q,showClis:F,onPickCli:Bn,onPickTerminal:Vn,visibleClis:Kr}),Jr=N&&it.length>0?(0,Y.jsx)(ct,{archived:it,openThreadIds:bt,onOpenThread:Ct}):null,Yr=H.length>0||f&&!M?(0,Y.jsx)(It,{sessions:Ur,sessionKind:N?`agent`:`terminal`,activeSessionId:U,onSelect:e=>{V.current=null,Me(e)},onTabActivate:e=>{let t=G.current.find(t=>t.id===e);t!=null&&queueMicrotask(()=>Gt(t))},newButton:qr,trailingControls:Jr,onClose:or,onRename:Kn,onReorder:Zn,onDragActiveChange:e=>{Jn.current=e},edge:xe,onPlacementChange:i===`terminal-dock`?s:void 0,reserveRightRevealTabGutter:c,onCollapse:M?void 0:()=>p(!1),draggable:M,className:`h-full`,children:H.length===0?F?null:N&&it.length>0?(0,Y.jsx)(lt,{archived:it,onOpen:Ct}):(0,Y.jsx)(kn,{}):Wr.map(e=>(0,Y.jsx)(qe,{value:e.id,forceMount:!0,"data-session-id":e.id,...e.kind===`terminal`?{"data-terminal-session":e.id}:{},className:u(`m-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,M&&`px-[22px] pb-[22px]`),children:e.kind===`terminal`?n!=null&&F?(0,Y.jsx)(Tt,{bridge:n,launch:e.launch,commandId:e.commandId,adoptPtyId:e.adoptPtyId,onPtyId:t=>Dt(e.id,t),onTitleChange:t=>Gn(e.id,t),onClose:()=>or(e.id)}):null:(0,Y.jsx)(Dn,{threadId:e.threadId,info:yt.get(e.threadId),showConnectionBanner:ot&&e.id===U,active:f&&e.id===U})},e.id))}):null,Xr;t[141]!==R||t[142]!==Yr?(Xr=R==null?null:(0,st.createPortal)((0,Y.jsxs)(Y.Fragment,{children:[Yr,(0,Y.jsx)(`span`,{ref:Yn,"aria-live":`polite`,"aria-atomic":`true`,className:`sr-only`,"data-testid":`terminal-reorder-announcer`})]}),R),t[141]=R,t[142]=Yr,t[143]=Xr):Xr=t[143];let Zr;return t[144]===Xr?Zr=t[145]:(Zr=(0,Y.jsx)(Y.Fragment,{children:Xr}),t[144]=Xr,t[145]=Zr),Zr}function nn(e,t){return e.ordinal-t.ordinal}function rn(e){return e.kind===`terminal`}function an(e){return e.ordinal}function on(e,t){return{kind:`terminal`,commandId:null,id:Vt(t+1),launch:null,title:null,customLabel:e.customLabel,ordinal:e.ordinal,adoptPtyId:null}}function sn(e){return e.ordinal}function cn(e,t){return{kind:`terminal`,commandId:null,id:Vt(t+1),launch:null,title:null,customLabel:e.customLabel??null,ordinal:e.ordinal??t+1,adoptPtyId:e.ptyId}}function ln(e){return e.ptyId}function un(e){return e.threadId}function dn(e){return e.threadId}function fn(e){return e.kind===`thread`}function pn(e){return e.threadId}function mn(e){return e.kind===`thread`}function hn(e){return e.threadId}function gn(e){return e!=null}function _n(e){return e.kind===`terminal`}function vn(){}function yn(e){return e.id}function bn(e){return e!=null}function xn(e){return[e.id,e]}function Sn(e){return e!=null}function Cn(e){return[e.threadId,e]}function wn(e){return e.archived!==!0}function Tn(){return!1}function En(){if(typeof document>`u`)return null;let e=document.createElement(`div`);return e.className=`flex min-h-0 flex-1 flex-col overflow-hidden`,e}function Dn(e){let t=(0,q.c)(10),{threadId:n,info:r,showConnectionBanner:i,active:a}=e;if(r===void 0)return null;let o;t[0]===i?o=t[1]:(o=i?(0,Y.jsx)(On,{}):null,t[0]=i,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Y.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,Y.jsx)(Oe,{className:`size-5`,"aria-hidden":`true`})}),t[2]=s):s=t[2];let c;t[3]!==a||t[4]!==r||t[5]!==n?(c=(0,Y.jsx)(J.Suspense,{fallback:s,children:(0,Y.jsx)(Bt,{info:r,active:a},n)}),t[3]=a,t[4]=r,t[5]=n,t[6]=c):c=t[6];let l;return t[7]!==o||t[8]!==c?(l=(0,Y.jsxs)(Y.Fragment,{children:[o,c]}),t[7]=o,t[8]=c,t[9]=l):l=t[9],l}function On(){let e=(0,q.c)(4),{_:t}=a(),n;e[0]===t?n=e[1]:(n=t({id:`k0dL2I`}),e[0]=t,e[1]=n);let r;return e[2]===n?r=e[3]:(r=(0,Y.jsx)(`div`,{className:`shrink-0 border-amber-500/30 border-b bg-amber-500/5 px-3 py-1 text-amber-700 text-xs dark:text-amber-400`,"data-testid":`agent-thread-reconnecting`,children:n}),e[2]=n,e[3]=r),r}function kn(){let e=(0,q.c)(4),{_:t}=a(),n;e[0]===t?n=e[1]:(n=t({id:`-l6jM7`}),e[0]=t,e[1]=n);let r;return e[2]===n?r=e[3]:(r=(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-muted-foreground text-sm`,"data-testid":`sessions-dock-empty`,children:n}),e[2]=n,e[3]=r),r}function An(e,t){return e.kind===`thread`?e.threadId:e.adoptPtyId??t.get(e.id)??null}function jn(e,t){let n=e.filter(e=>e.kind===`terminal`),r=n.find(e=>e.id===t);return{tabs:n.map(e=>({ordinal:e.ordinal,customLabel:e.customLabel})),activeOrdinal:r?.ordinal??null}}function Mn(e,t,n,r){let i=e=>{let t=r(e);if(t==null)return 1/0;let i=n.indexOf(t);return i===-1?1/0:i},a=[...e];for(let e of t){let t=i(e);if(t===1/0){a.push(e);continue}let n=a.length;for(let e=0;e<a.length;e++)if(i(a[e])>t){n=e;break}a.splice(n,0,e)}return a}export{tn as SessionsHost};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-BUgB2tll.js";import{t}from"./compiler-runtime-BfE3aGVn.js";import{t as n}from"./utils-CPqDy6Hr.js";import{a as r,c as i,d as a,f as o,h as s,i as c,l,m as u,n as d,o as f,p,r as m,s as h,t as g,u as _}from"./dist-BX7qfUal.js";import{t as v}from"./createLucideIcon-B6ULg5PN.js";import{t as y}from"./check-BzfGb3KU.js";import{t as b}from"./chevron-right-C-g4JuT4.js";var x=v(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),S=t(),C=e();function w(e){let t=(0,S.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,C.jsx)(_,{"data-slot":`dropdown-menu`,...n}),t[2]=n,t[3]=r),r}function T(e){let t=(0,S.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,C.jsx)(h,{"data-slot":`dropdown-menu-portal`,...n}),t[2]=n,t[3]=r),r}function E(e){let t=(0,S.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,C.jsx)(s,{"data-slot":`dropdown-menu-trigger`,...n}),t[2]=n,t[3]=r),r}function D(e){let t=(0,S.c)(12),r,i,a,o;t[0]===e?(r=t[1],i=t[2],a=t[3],o=t[4]):({className:r,align:a,sideOffset:o,...i}=e,t[0]=e,t[1]=r,t[2]=i,t[3]=a,t[4]=o);let s=a===void 0?`start`:a,c=o===void 0?4:o,l;t[5]===r?l=t[6]:(l=n(`z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 data-[state=closed]:overflow-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0 subtle-scrollbar`,r),t[5]=r,t[6]=l);let u;return t[7]!==s||t[8]!==i||t[9]!==c||t[10]!==l?(u=(0,C.jsx)(h,{children:(0,C.jsx)(d,{"data-slot":`dropdown-menu-content`,sideOffset:c,align:s,className:l,...i})}),t[7]=s,t[8]=i,t[9]=c,t[10]=l,t[11]=u):u=t[11],u}function O(e){let t=(0,S.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,C.jsx)(m,{"data-slot":`dropdown-menu-group`,...n}),t[2]=n,t[3]=r),r}function k(e){let t=(0,S.c)(12),r,i,a,o;t[0]===e?(r=t[1],i=t[2],a=t[3],o=t[4]):({className:r,inset:i,variant:o,...a}=e,t[0]=e,t[1]=r,t[2]=i,t[3]=a,t[4]=o);let s=o===void 0?`default`:o,l;t[5]===r?l=t[6]:(l=n(`group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,r),t[5]=r,t[6]=l);let u;return t[7]!==i||t[8]!==a||t[9]!==l||t[10]!==s?(u=(0,C.jsx)(c,{"data-slot":`dropdown-menu-item`,"data-inset":i,"data-variant":s,className:l,...a}),t[7]=i,t[8]=a,t[9]=l,t[10]=s,t[11]=u):u=t[11],u}function A(e){let t=(0,S.c)(15),i,a,o,s,c;t[0]===e?(i=t[1],a=t[2],o=t[3],s=t[4],c=t[5]):({className:o,children:a,checked:i,inset:s,...c}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=c);let l;t[6]===o?l=t[7]:(l=n(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,o),t[6]=o,t[7]=l);let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,C.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-checkbox-item-indicator`,children:(0,C.jsx)(r,{children:(0,C.jsx)(y,{})})}),t[8]=u):u=t[8];let d;return t[9]!==i||t[10]!==a||t[11]!==s||t[12]!==c||t[13]!==l?(d=(0,C.jsxs)(g,{"data-slot":`dropdown-menu-checkbox-item`,"data-inset":s,className:l,checked:i,...c,children:[u,a]}),t[9]=i,t[10]=a,t[11]=s,t[12]=c,t[13]=l,t[14]=d):d=t[14],d}function j(e){let t=(0,S.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,C.jsx)(i,{"data-slot":`dropdown-menu-radio-group`,...n}),t[2]=n,t[3]=r),r}function M(e){let t=(0,S.c)(13),i,a,o,s;t[0]===e?(i=t[1],a=t[2],o=t[3],s=t[4]):({className:a,children:i,inset:o,...s}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=s);let c;t[5]===a?c=t[6]:(c=n(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,a),t[5]=a,t[6]=c);let u;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,C.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,C.jsx)(r,{children:(0,C.jsx)(x,{className:`size-2 fill-current`})})}),t[7]=u):u=t[7];let d;return t[8]!==i||t[9]!==o||t[10]!==s||t[11]!==c?(d=(0,C.jsxs)(l,{"data-slot":`dropdown-menu-radio-item`,"data-inset":o,className:c,...s,children:[u,i]}),t[8]=i,t[9]=o,t[10]=s,t[11]=c,t[12]=d):d=t[12],d}function N(e){let t=(0,S.c)(10),r,i,a;t[0]===e?(r=t[1],i=t[2],a=t[3]):({className:r,inset:i,...a}=e,t[0]=e,t[1]=r,t[2]=i,t[3]=a);let o;t[4]===r?o=t[5]:(o=n(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,r),t[4]=r,t[5]=o);let s;return t[6]!==i||t[7]!==a||t[8]!==o?(s=(0,C.jsx)(f,{"data-slot":`dropdown-menu-label`,"data-inset":i,className:o,...a}),t[6]=i,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function P(e){let t=(0,S.c)(8),r,i;t[0]===e?(r=t[1],i=t[2]):({className:r,...i}=e,t[0]=e,t[1]=r,t[2]=i);let o;t[3]===r?o=t[4]:(o=n(`-mx-1 my-1 h-px bg-border`,r),t[3]=r,t[4]=o);let s;return t[5]!==i||t[6]!==o?(s=(0,C.jsx)(a,{"data-slot":`dropdown-menu-separator`,className:o,...i}),t[5]=i,t[6]=o,t[7]=s):s=t[7],s}function F(e){let t=(0,S.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,C.jsx)(o,{"data-slot":`dropdown-menu-sub`,...n}),t[2]=n,t[3]=r),r}function I(e){let t=(0,S.c)(13),r,i,a,o;t[0]===e?(r=t[1],i=t[2],a=t[3],o=t[4]):({className:i,inset:a,children:r,...o}=e,t[0]=e,t[1]=r,t[2]=i,t[3]=a,t[4]=o);let s;t[5]===i?s=t[6]:(s=n(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,i),t[5]=i,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,C.jsx)(b,{className:`ml-auto`}),t[7]=c):c=t[7];let l;return t[8]!==r||t[9]!==a||t[10]!==o||t[11]!==s?(l=(0,C.jsxs)(u,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":a,className:s,...o,children:[r,c]}),t[8]=r,t[9]=a,t[10]=o,t[11]=s,t[12]=l):l=t[12],l}function L(e){let t=(0,S.c)(8),r,i;t[0]===e?(r=t[1],i=t[2]):({className:r,...i}=e,t[0]=e,t[1]=r,t[2]=i);let a;t[3]===r?a=t[4]:(a=n(`z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[96px] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 data-[state=closed]:overflow-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0 subtle-scrollbar`,r),t[3]=r,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,C.jsx)(p,{"data-slot":`dropdown-menu-sub-content`,className:a,...i}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}export{k as a,j as c,F as d,L as f,O as i,M as l,E as m,A as n,N as o,I as p,D as r,T as s,w as t,P as u};
|