@inkeep/open-knowledge 0.82.0-beta.4 → 0.82.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/dist/cli.mjs +6 -6
  2. package/dist/constants-ChfpQjIj.mjs +1 -0
  3. package/dist/{dist-DdoZ294B.mjs → dist-BKMK4uhh.mjs} +224 -224
  4. package/dist/{dist-C1WwDYOU.mjs → dist-DX-OB6FC.mjs} +1 -1
  5. package/dist/index.mjs +4 -4
  6. package/dist/{init-vgeY_wHD.mjs → init-Bvmrrn6M.mjs} +2 -2
  7. package/dist/init-kMgqplOQ.mjs +1 -0
  8. package/dist/{launch-json-removal-D4FuJ2Te.mjs → launch-json-removal-DGgpI_Jz.mjs} +1 -1
  9. package/dist/loader-DgBlR4_N.mjs +1 -0
  10. package/dist/{loader-DYbtvtxH.mjs → loader-DyhgFxyu.mjs} +1 -1
  11. package/dist/{md-manager-BGnqyqi1-D77IwxHB.mjs → md-manager-BGnqyqi1-CnT_8Ivp.mjs} +2 -2
  12. package/dist/{open-browser-Dg3gcrHM.mjs → open-browser-CuuJWVs1.mjs} +1 -1
  13. package/dist/parse-worker.mjs +1 -1
  14. package/dist/preview-3fHrsz6g.mjs +1 -0
  15. package/dist/{preview-1EGVW00C.mjs → preview-CS-ZP7yP.mjs} +1 -1
  16. package/dist/public/assets/{ActivityModeContent-qim4zFx-.js → ActivityModeContent-CVkgwfSl.js} +1 -1
  17. package/dist/public/assets/{AddPropertiesButton-DKXiB5hC.js → AddPropertiesButton-D16oCS_N.js} +2 -2
  18. package/dist/public/assets/{AgentDiffPane-BD8yOgrS.js → AgentDiffPane-HH8jeegf.js} +1 -1
  19. package/dist/public/assets/{AgentThreadClientBinder-18BD6ihn.js → AgentThreadClientBinder-BeRtMFJl.js} +1 -1
  20. package/dist/public/assets/{BugReportHistory-C2kxTgHh.js → BugReportHistory-B-6LLHxx.js} +1 -1
  21. package/dist/public/assets/{BugReportHistoryDialog-DgtiL-NP.js → BugReportHistoryDialog-CNK92-ge.js} +1 -1
  22. package/dist/public/assets/{CodeMirrorPropInput-D7ODqRwE.js → CodeMirrorPropInput-DF3sY_TW.js} +1 -1
  23. package/dist/public/assets/{ConsentDialogBody-CD7KM28d.js → ConsentDialogBody-c59kzsDd.js} +1 -1
  24. package/dist/public/assets/{DeleteConfirmationDialog-C1zIx9Bd.js → DeleteConfirmationDialog-CW-EDwBk.js} +1 -1
  25. package/dist/public/assets/{DiffViewBoundary-DGNf5H84.js → DiffViewBoundary-BCeCuRF4.js} +1 -1
  26. package/dist/public/assets/{DocumentContext-BHjfklWj.js → DocumentContext-Be48_bAF.js} +1 -1
  27. package/dist/public/assets/{EditorModeToggle-XKuoOdJs.js → EditorModeToggle-DtMDf2MQ.js} +1 -1
  28. package/dist/public/assets/{ExcalidrawDocEditor-I2eQXX7E.js → ExcalidrawDocEditor-BJ2A3QGa.js} +1 -1
  29. package/dist/public/assets/FeedbackForm-Ap-gvcmO.js +1 -0
  30. package/dist/public/assets/{GraphPanel-nDzxbZwr.js → GraphPanel-BCNpJurX.js} +1 -1
  31. package/dist/public/assets/{ImageAttachments-Dob2zdX6.js → ImageAttachments-DaSjleMs.js} +1 -1
  32. package/dist/public/assets/{ImportSkillDialog-CU7KSDgH.js → ImportSkillDialog-BldGupBv.js} +1 -1
  33. package/dist/public/assets/{LintConfigEditor-81_fDdG_.js → LintConfigEditor-DnD5pFzI.js} +1 -1
  34. package/dist/public/assets/ManagedArtifactProperties-BsdnBIW1.js +1 -0
  35. package/dist/public/assets/{ManagedArtifactProperties-DTfJaeLZ.js → ManagedArtifactProperties-BtTz8dwV.js} +1 -1
  36. package/dist/public/assets/{MermaidDocEditor-Dw5SypSn.js → MermaidDocEditor-CkwkPZvu.js} +1 -1
  37. package/dist/public/assets/{OpenInAgentMenuItem-BMo7aLCS.js → OpenInAgentMenuItem-tMDoc20x.js} +1 -1
  38. package/dist/public/assets/{PropertyDisplayRow-Bn0kgK3p.js → PropertyDisplayRow-FgvNazvo.js} +1 -1
  39. package/dist/public/assets/{RegisteredAgentIcon-DbL9sShX.js → RegisteredAgentIcon-XDCjRE4q.js} +1 -1
  40. package/dist/public/assets/{ReportBugDialogBody-DEETk9Jo.js → ReportBugDialogBody-bsGBQfHH.js} +1 -1
  41. package/dist/public/assets/{ReportBugMenuTrigger-B1WREGjA.js → ReportBugMenuTrigger-BAbnNfBU.js} +1 -1
  42. package/dist/public/assets/{SchemaConfigEditor-BLXTxBGL.js → SchemaConfigEditor-BU8wFtDN.js} +1 -1
  43. package/dist/public/assets/{SessionsHost-DquHUp9T.js → SessionsHost-BdpjIit2.js} +2 -2
  44. package/dist/public/assets/{SettingsDialogBody-DKEUH63t.js → SettingsDialogBody-DmPhthSq.js} +1 -1
  45. package/dist/public/assets/{ShareBranchSwitchDialog-BUS2my96.js → ShareBranchSwitchDialog-CPn3XsGL.js} +1 -1
  46. package/dist/public/assets/{ShareReceiveDialog-BKgD7Duc.js → ShareReceiveDialog-CavmNNtc.js} +1 -1
  47. package/dist/public/assets/{ShareReceiveMissDialog-_8dejDWk.js → ShareReceiveMissDialog-C6Yv1L_L.js} +1 -1
  48. package/dist/public/assets/{SkillCostValue-CmCcSYjJ.js → SkillCostValue-CxnOdbgc.js} +1 -1
  49. package/dist/public/assets/{SkillEditBanner-DFdS9BhL.js → SkillEditBanner-DFTQUggR.js} +1 -1
  50. package/dist/public/assets/{SkillForkDialog-D5Aha7ke.js → SkillForkDialog-Bl0Maun5.js} +1 -1
  51. package/dist/public/assets/{SkillInstallMenu-Cju9gFSt.js → SkillInstallMenu-BW2fj8iT.js} +1 -1
  52. package/dist/public/assets/{SkillOriginInline-DPQ0UfdG.js → SkillOriginInline-Bo9-sZlU.js} +1 -1
  53. package/dist/public/assets/{SkillToolbarControls-SRsQowBm.js → SkillToolbarControls-xd9ybWt3.js} +1 -1
  54. package/dist/public/assets/{SlidesToolbarControls-8Tu4pV-S.js → SlidesToolbarControls-CDqPA4DN.js} +1 -1
  55. package/dist/public/assets/{SourceEditor-DUhZs5yo.js → SourceEditor-xUkiBN-x.js} +1 -1
  56. package/dist/public/assets/{SyncStatusBadge-B9wP5KjD.js → SyncStatusBadge-CMEBaJDA.js} +1 -1
  57. package/dist/public/assets/{TerminalPanel-Db-Lo-iL.js → TerminalPanel-BAdFCbjj.js} +1 -1
  58. package/dist/public/assets/{TerminalWindowApp-CAjzSiBI.js → TerminalWindowApp-D8Gswz-L.js} +1 -1
  59. package/dist/public/assets/{TextDocEditor-C7dpFdVd.js → TextDocEditor-CjRA_0cY.js} +1 -1
  60. package/dist/public/assets/{ThreadView-CsZKSzs5.js → ThreadView-CKZltO5Y.js} +1 -1
  61. package/dist/public/assets/{TimelineDiffPane-DcChEu2J.js → TimelineDiffPane-BxiAJgWC.js} +1 -1
  62. package/dist/public/assets/{agent-connections-iuaYc-Gk.js → agent-connections-B2xlqiAt.js} +1 -1
  63. package/dist/public/assets/{auth-state-cache-Dz-Yvu70.js → auth-state-cache-DkvW2mTJ.js} +1 -1
  64. package/dist/public/assets/{bug-report-send-manager-0DIkaLj0.js → bug-report-send-manager-Ep6NupAy.js} +1 -1
  65. package/dist/public/assets/{client-version-DJFCNOKL.js → client-version-aG92qoP2.js} +1 -1
  66. package/dist/public/assets/{comment-chips-jwrddJ4n.js → comment-chips-C8z94Yh3.js} +1 -1
  67. package/dist/public/assets/{config-provider-B4cgjuAt.js → config-provider-myFxAeZJ.js} +1 -1
  68. package/dist/public/assets/{css-color-to-hex-oO6GoCcb.js → css-color-to-hex-B1w0Vq2i.js} +1 -1
  69. package/dist/public/assets/{diagnostic-breadcrumb-DK-Cqae0.js → diagnostic-breadcrumb-YcMRmDMq.js} +1 -1
  70. package/dist/public/assets/{dist-CUgbgEDy.js → dist-DmvVdMAc.js} +2 -2
  71. package/dist/public/assets/{doc-paths-DaHerw67.js → doc-paths-CU5xFEmw.js} +1 -1
  72. package/dist/public/assets/{doc-undo-manager-ZAJ7EhHf.js → doc-undo-manager-Bb2wXN7B.js} +1 -1
  73. package/dist/public/assets/{documents-events-AGLgPGQa.js → documents-events-DChefUoE.js} +1 -1
  74. package/dist/public/assets/{file-tree-adapter--GNP_kR2.js → file-tree-adapter-CrwKZd5V.js} +1 -1
  75. package/dist/public/assets/{file-tree-utils-lPpxK5Yq.js → file-tree-utils-B-KHAA0w.js} +1 -1
  76. package/dist/public/assets/{folder-config-api-DDOXhGdo.js → folder-config-api-y_2lDcJg.js} +1 -1
  77. package/dist/public/assets/{index-BdhkBLck.js → index-Xs-rHCdv.js} +8 -8
  78. package/dist/public/assets/{lint-config-client-B_xNfTBy.js → lint-config-client-kGMpwF3X.js} +1 -1
  79. package/dist/public/assets/{markdownlint-rule-browser-DzjG_qoM.js → markdownlint-rule-browser-BZlDsCDj.js} +1 -1
  80. package/dist/public/assets/{navigation-targets-DV1dMVAb.js → navigation-targets-BX0D_UPk.js} +1 -1
  81. package/dist/public/assets/{page-list-cache-BaKlIcC-.js → page-list-cache-DRXLxcuB.js} +1 -1
  82. package/dist/public/assets/{pending-receive-nav-store-4xt56kJR.js → pending-receive-nav-store-C6LJ2Kzv.js} +1 -1
  83. package/dist/public/assets/{preferred-session-events-CeCXvWmc.js → preferred-session-events-B7RLIJvY.js} +1 -1
  84. package/dist/public/assets/{progress-D6YLD7xV.js → progress-Dutcigeg.js} +1 -1
  85. package/dist/public/assets/{project-paths-Cs2SPmYR.js → project-paths-Rt7fORWq.js} +1 -1
  86. package/dist/public/assets/{prop-types-Dv_cZRA5.js → prop-types-B2w_fFJW.js} +1 -1
  87. package/dist/public/assets/{receive-store-CvglCO2B.js → receive-store-VACJKx3F.js} +1 -1
  88. package/dist/public/assets/{selection-context-CDv7YpZ_.js → selection-context-Cq2VCQBg.js} +1 -1
  89. package/dist/public/assets/{sign-in-terminal-events-BigKQgqQ.js → sign-in-terminal-events-DXTC0inU.js} +1 -1
  90. package/dist/public/assets/{skill-scope-BGcfBWlz.js → skill-scope-DX2Q9lzh.js} +1 -1
  91. package/dist/public/assets/{skills-api-mYKB0zDh.js → skills-api-Cpwwq_FO.js} +1 -1
  92. package/dist/public/assets/{src-xGMvMbEd.js → src-CGPFfpcu.js} +1 -1
  93. package/dist/public/assets/{startup-marks-yQqTMBm5.js → startup-marks-CJJqLRKP.js} +1 -1
  94. package/dist/public/assets/{tag-pill-input-BQLv6DZ1.js → tag-pill-input-DLQqKzbN.js} +1 -1
  95. package/dist/public/assets/{target-navigation-intent-BIFEl4OT.js → target-navigation-intent-BwAGdOsi.js} +1 -1
  96. package/dist/public/assets/{telemetry-startup-DyEWsvUO.js → telemetry-startup-CMJw54MN.js} +1 -1
  97. package/dist/public/assets/{terminal-command-events-CoTkNESn.js → terminal-command-events-CoI7bIgQ.js} +1 -1
  98. package/dist/public/assets/{terminal-launch-events-BBjjknBw.js → terminal-launch-events-BMFqKHQ8.js} +1 -1
  99. package/dist/public/assets/{terminal-telemetry-CGR3Wr8L.js → terminal-telemetry-C0nwSvRH.js} +1 -1
  100. package/dist/public/assets/{thread-client-V2_Sw10t.js → thread-client-2zOGI06i.js} +1 -1
  101. package/dist/public/assets/{typing-burst-detector-Bwb8vXQS.js → typing-burst-detector-SGbZpXed.js} +1 -1
  102. package/dist/public/assets/{uninstall-BcI5d3jC.js → uninstall-Bqv6A4OL.js} +1 -1
  103. package/dist/public/assets/{use-activity-panel-Bm-_7omz.js → use-activity-panel-D3mCupUz.js} +1 -1
  104. package/dist/public/assets/{use-apply-config-language-Bzn7Rbw_.js → use-apply-config-language--jTlcFWU.js} +1 -1
  105. package/dist/public/assets/{use-collab-url-D3j3svaH.js → use-collab-url-Bs4wUHQ8.js} +1 -1
  106. package/dist/public/assets/{use-conflicts-8sSRJ_Uy.js → use-conflicts-Due_s21R.js} +1 -1
  107. package/dist/public/assets/{use-git-sync-status-CBlTkWfK.js → use-git-sync-status-CLv7EZOq.js} +1 -1
  108. package/dist/public/assets/{use-installed-clis-ClKL7RtP.js → use-installed-clis-L2RDjEtc.js} +2 -2
  109. package/dist/public/assets/{use-live-xterm-theme-bJiLIpxd.js → use-live-xterm-theme-XZgq5LKh.js} +1 -1
  110. package/dist/public/assets/{use-open-skill-BpW3ZhuK.js → use-open-skill-DV5hhMVO.js} +1 -1
  111. package/dist/public/assets/{use-settings-route-DL25HSeL.js → use-settings-route-DI6YfB7r.js} +1 -1
  112. package/dist/public/assets/{use-skill-origin-Cts8svd2.js → use-skill-origin-ChIkNH5y.js} +1 -1
  113. package/dist/public/assets/{use-skills-DXlhkRBq.js → use-skills-B1b-aZeu.js} +1 -1
  114. package/dist/public/assets/{use-terminal-enabled-Br80VTvl.js → use-terminal-enabled-Djcq-lbC.js} +1 -1
  115. package/dist/public/assets/{use-timeline-entry-diff-l604pHZz.js → use-timeline-entry-diff-BGpMCJkj.js} +1 -1
  116. package/dist/public/assets/{use-workspace-DtyUPSZ4.js → use-workspace-Byr5yIN5.js} +1 -1
  117. package/dist/public/index.html +59 -59
  118. package/dist/public/uninstall.html +3 -3
  119. package/dist/{registry-probes-BXgdIidc.mjs → registry-probes-BqQhP0ax.mjs} +1 -1
  120. package/dist/{removal-file-path-Ce-oxAGQ.mjs → removal-file-path-BeRPeEws.mjs} +1 -1
  121. package/dist/{repair-launch-json-CtsInz2s.mjs → repair-launch-json-CzMEUN6E.mjs} +1 -1
  122. package/dist/{repair-mcp-configs-BESnoIPY.mjs → repair-mcp-configs-DiEzfN1-.mjs} +1 -1
  123. package/dist/src-C_P2wuNq.mjs +1 -0
  124. package/dist/{src-KNAqsxPK.mjs → src-DwoFHSWS.mjs} +1 -1
  125. package/dist/start-Ct8veQKD.mjs +1 -0
  126. package/dist/{start-B8iic9V_.mjs → start-jgWvvxuy.mjs} +3 -3
  127. package/package.json +4 -4
  128. package/dist/constants-W9G4vRvJ.mjs +0 -1
  129. package/dist/init-DaBUbh8G.mjs +0 -1
  130. package/dist/loader-YyyVC5zh.mjs +0 -1
  131. package/dist/preview-BQhr7b8a.mjs +0 -1
  132. package/dist/public/assets/FeedbackForm-BQ8aBBom.js +0 -1
  133. package/dist/public/assets/ManagedArtifactProperties-yEjDaTS8.js +0 -1
  134. package/dist/src-BPwbNxCr.mjs +0 -1
  135. package/dist/start-BXE7aaH4.mjs +0 -1
@@ -1,4 +1,4 @@
1
- import{o as e,t}from"./chunk-CYidjpOJ.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{B as r,O as i,at as a,dt as o,hi as s,lt as c,st as l,ut as u,xr as d,z as f}from"./DocumentContext-BHjfklWj.js";import{t as p}from"./react-f2sANaYj.js";import{n as m,r as h}from"./dist-Nvb76hAm.js";import{t as g}from"./useQuery-ZeEDLtxh.js";import{n as _}from"./dist-PQ5KMVDh.js";import{t as v}from"./react-dom-DPxgxlDT.js";import{t as y}from"./compiler-runtime-BfE3aGVn.js";import{t as b}from"./utils-CPqDy6Hr.js";import{S as x,_ as S,a as C,b as w,c as T,d as E,f as D,g as O,h as k,i as A,l as j,m as M,o as N,p as P,r as F,s as I,t as L,u as R,v as z,x as B,y as V}from"./agent-connections-iuaYc-Gk.js";import{t as H}from"./button-BeFNZANd.js";import{i as U,n as W,r as G,t as K}from"./tooltip-DVBVVaAs.js";import{n as ee,r as te,t as q}from"./collapsible-DYySK8La.js";import{a as J,c as ne,i as re,l as ie,n as ae,o as oe,r as se,s as ce,t as le}from"./alert-dialog-CqqfqWNT.js";import{n as ue,t as de}from"./with-selector-PRoyWQiu.js";import{t as fe}from"./checkbox-dUuNlQM9.js";import{A as pe,C as me,D as he,E as ge,O as _e,S as ve,T as ye,_ as be,b as xe,f as Se,g as Ce,h as we,j as Te,k as Ee,m as De,p as Oe,r as ke,v as Ae,w as je,x as Me,y as Ne}from"./floating-ui.dom-CDtYEnEj.js";import{c as Pe,d as Fe,l as Ie,o as Le,s as Re,u as ze}from"./dist-DYso7MCm.js";import{t as Be}from"./label-D-K3fWtj.js";import{i as Ve,n as He,o as Ue,s as We,t as Ge}from"./select-CsHr_Rz5.js";import{n as Ke,t as qe}from"./radio-group-npdxiS6E.js";import{t as Je}from"./switch-iwBsEWej.js";import{n as Ye,r as Xe,t as Ze}from"./toggle-group-BxIyZnUJ.js";import{a as Qe,c as $e,g as et,h as tt,l as nt,n as rt,o as it,r as at,s as Y,t as ot,u as st,y as ct}from"./RegisteredAgentIcon-DbL9sShX.js";import{a as lt,i as ut,o as dt}from"./terminal-telemetry-CGR3Wr8L.js";import{$o as ft,Ac as pt,As as mt,Bs as ht,Ci as gt,Cn as _t,Cs as vt,Ec as yt,Es as bt,Fc as xt,Go as St,Ic as Ct,Is as wt,Jo as Tt,Kc as Et,Lc as Dt,Ls as Ot,Mr as kt,Ms as At,Nc as jt,Ns as Mt,Ot as Nt,Pc as Pt,Qc as Ft,Qs as It,Rs as Lt,Un as Rt,Uo as zt,Wo as Bt,Xn as Vt,Xo as Ht,Yc as Ut,Yo as Wt,Ys as Gt,_s as Kt,as as qt,ba as Jt,cs as Yt,fi as Xt,fs as Zt,gi as Qt,gs as $t,is as en,jc as tn,js as nn,ks as rn,ls as an,ms as on,mt as sn,os as cn,ot as ln,ps as un,pt as dn,qo as fn,qs as pn,rl as mn,rs as hn,ss as gn,vs as _n,wn as vn,zs as yn}from"./dist-CUgbgEDy.js";import{t as bn}from"./trace-api-BP9dN1Hz.js";import{n as X}from"./dist-CJhtNlOm2.js";import{d as xn,f as Sn,h as Cn,n as wn,o as Tn,p as En,r as Dn,u as On,v as kn}from"./use-settings-route-DL25HSeL.js";import{t as An}from"./dist-Cr4-nBVI.js";import{c as jn}from"./documents-events-AGLgPGQa.js";import{a as Mn,i as Nn,o as Pn}from"./local-menu-action-bus-DaoT7_kL.js";import{a as Fn,i as In,t as Ln}from"./use-apply-config-theme-B5w38X1P.js";import{t as Rn}from"./OpenInAgentMenuItem-BMo7aLCS.js";import{g as zn,h as Bn,p as Vn,v as Hn,y as Un}from"./SkillInstallMenu-Cju9gFSt.js";import{t as Wn}from"./createLucideIcon-B6ULg5PN.js";import{C as Gn,S as Kn,_ as qn,a as Jn,c as Yn,d as Xn,f as Zn,h as Qn,n as $n,o as er,s as tr,t as nr,u as rr,v as ir,y as ar}from"./SyncStatusBadge-B9wP5KjD.js";import{f as or}from"./Mermaid-bW_7Lznj.js";import{t as sr}from"./arrow-up-right-BSqX8NAd.js";import{t as cr}from"./check-Q5jd3Hs-.js";import{t as lr}from"./chevron-right-By2JkAgT.js";import{n as ur,t as dr}from"./lint-plugin-meta-DmtRmLsN.js";import{t as fr}from"./circle-alert-_EpKBna4.js";import{i as pr,r as mr}from"./prop-types-Dv_cZRA5.js";import{a as hr,h as gr,r as _r,t as vr}from"./dropdown-menu-57MhAniC.js";import{It as yr}from"./CodeMirrorPropInput-D7ODqRwE.js";import{i as br,r as xr,t as Sr}from"./use-git-sync-status-CBlTkWfK.js";import{o as Cr}from"./folder-config-api-DDOXhGdo.js";import{t as wr}from"./info-Bem3FDH_.js";import{t as Tr}from"./spinner-D7ppCG-D.js";import{n as Er,r as Dr,t as Or}from"./ThemePicker-BULIP0sp.js";import{B as kr,C as Ar,E as jr,F as Mr,G as Nr,I as Pr,L as Fr,M as Ir,N as Lr,O as Rr,P as zr,R as Br,S as Vr,T as Hr,U as Ur,Z as Wr,b as Gr,c as Kr,d as qr,f as Jr,h as Yr,i as Xr,j as Zr,k as Qr,l as $r,m as ei,n as ti,o as ni,p as ri,q as ii,w as ai,x as oi,y as si,z as ci}from"./auth-state-cache-Dz-Yvu70.js";import{t as li}from"./rotate-ccw-B_k-Metp.js";import{t as ui}from"./square-pen-BTtb6SXV.js";import{t as di}from"./trash-2-CYyUeKpx.js";import{t as fi}from"./triangle-alert--Fl5KoVX.js";import{t as pi}from"./x-BcfoD9-8.js";import{t as mi}from"./badge-NLcybMIN.js";import{a as hi,c as gi,i as _i,n as vi,o as yi,r as bi,s as xi,t as Si}from"./dialog-BTFtzetj.js";import{i as Ci,o as wi,r as Ti,t as Ei}from"./field-Bp-wqfBg.js";import{t as Di}from"./tool-list-format-BBT_vsDw.js";import{n as Oi}from"./use-workspace-DtyUPSZ4.js";import{d as ki}from"./doc-paths-DaHerw67.js";import{a as Ai}from"./startup-marks-yQqTMBm5.js";import{n as ji}from"./config-provider-B4cgjuAt.js";import{a as Mi}from"./skill-scope-BGcfBWlz.js";import{m as Ni}from"./skills-api-mYKB0zDh.js";import{t as Pi}from"./input-FC65XODQ.js";import{a as Fi,i as Ii,t as Li}from"./popover-D9P6t6oT.js";import{_ as Ri,a as zi,d as Bi,f as Vi,g as Hi,h as Ui,m as Wi,p as Gi,u as Ki,v as qi,y as Ji}from"./css-color-to-hex-oO6GoCcb.js";import{n as Yi}from"./use-apply-config-language-Bzn7Rbw_.js";import{t as Xi}from"./external-link-C41LkPrP.js";import{t as Zi}from"./ConfigSharingInfoTooltip-BTe9yAD7.js";import{t as Qi}from"./use-skills-DXlhkRBq.js";import{o as $i,s as ea,t as ta}from"./use-open-skill-BpW3ZhuK.js";import{r as na,t as ra}from"./DeleteConfirmationDialog-C1zIx9Bd.js";import{t as ia}from"./skeleton-8MBf7Lwj.js";import{d as aa,n as oa,r as sa,t as ca,u as la}from"./lint-config-client-B_xNfTBy.js";import{_ as ua,a as da,d as fa,f as pa,g as ma,h as ha,i as ga,o as _a,s as va,t as ya,u as ba}from"./sortable.esm-CGLSbuEH.js";import{t as xa}from"./textarea-3qB7PlP7.js";import{r as Sa,t as Ca}from"./terminal-command-events-CoTkNESn.js";import{i as wa,n as Ta,t as Ea}from"./input-group-BOzKjVFi.js";import{a as Da,f as Oa,i as ka,n as Aa,o as ja,p as Ma,r as Na,s as Pa,t as Fa}from"./form-C_vp_Cww.js";import{t as Ia}from"./tag-pill-input-BQLv6DZ1.js";import{t as La}from"./markdownlint-rule-browser-DzjG_qoM.js";import{n as Ra}from"./schema-fields-view-intent-DYg7KWFO.js";import{n as za,t as Ba}from"./use-terminal-enabled-Br80VTvl.js";var Va=Wn(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),Ha=Wn(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Ua=Wn(`unlink`,[[`path`,{d:`m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71`,key:`yqzxt4`}],[`path`,{d:`m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71`,key:`4qinb0`}],[`line`,{x1:`8`,x2:`8`,y1:`2`,y2:`5`,key:`1041cp`}],[`line`,{x1:`2`,x2:`5`,y1:`8`,y2:`8`,key:`14m1p5`}],[`line`,{x1:`16`,x2:`16`,y1:`19`,y2:`22`,key:`rzdirn`}],[`line`,{x1:`19`,x2:`22`,y1:`16`,y2:`16`,key:`ox905f`}]]),Wa=Wn(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Z=e(p(),1),Q=y(),$=n();function Ga(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(mi,{variant:`gray`,children:(0,$.jsx)(m,{id:`YBt9YP`})}),e[0]=t):t=e[0],t}function Ka(e){let t=(0,Q.c)(10),{scope:n}=e,r=`settings-scope-badge-${n}`,i;t[0]===n?i=t[1]:(i=n===`user`?(0,$.jsx)(m,{id:`7PzzBU`}):n===`project-local`?(0,$.jsx)(m,{id:`ImTzPZ`}):(0,$.jsx)(m,{id:`e0NrBM`}),t[0]=n,t[1]=i);let a;t[2]!==r||t[3]!==i?(a=(0,$.jsx)(U,{asChild:!0,children:(0,$.jsx)(mi,{variant:`gray`,tabIndex:0,className:`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,"data-testid":r,children:i})}),t[2]=r,t[3]=i,t[4]=a):a=t[4];let o;t[5]===n?o=t[6]:(o=(0,$.jsx)(W,{children:n===`user`?(0,$.jsx)(m,{id:`cFSbbh`}):n===`project-local`?(0,$.jsx)(m,{id:`YlwI5F`}):(0,$.jsx)(m,{id:`ebqMh6`})}),t[5]=n,t[6]=o);let s;return t[7]!==a||t[8]!==o?(s=(0,$.jsx)(G,{children:(0,$.jsxs)(K,{children:[a,o]})}),t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function qa(e){let t=(0,Q.c)(27),{titleId:n,title:r,scope:i,level:a,beta:o,adornment:s,docUrl:c,children:l}=e,u=a===void 0?`page`:a,{_:d}=h(),f=u===`page`?`h3`:`h4`,p=u===`page`?`text-lg`:`text-base`,g;t[0]===p?g=t[1]:(g=b(`font-semibold`,p),t[0]=p,t[1]=g);let _;t[2]!==f||t[3]!==g||t[4]!==r||t[5]!==n?(_=(0,$.jsx)(f,{id:n,className:g,children:r}),t[2]=f,t[3]=g,t[4]=r,t[5]=n,t[6]=_):_=t[6];let v;t[7]===o?v=t[8]:(v=o?(0,$.jsx)(Ga,{}):null,t[7]=o,t[8]=v);let y;t[9]===i?y=t[10]:(y=i?(0,$.jsx)(Ka,{scope:i}):null,t[9]=i,t[10]=y);let x;t[11]!==s||t[12]!==_||t[13]!==v||t[14]!==y?(x=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[_,s,v,y]}),t[11]=s,t[12]=_,t[13]=v,t[14]=y,t[15]=x):x=t[15];let S;t[16]===l?S=t[17]:(S=l?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:l}):null,t[16]=l,t[17]=S);let C;t[18]!==d||t[19]!==c||t[20]!==r||t[21]!==n?(C=c===void 0?null:(0,$.jsxs)(`a`,{href:c,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>Xi(e,c),onAuxClick:e=>Xi(e,c),"aria-label":d(typeof r==`string`?{id:`Li4U-T`,values:{title:r}}:{id:`zwWKhA`}),className:`inline-flex items-center gap-0.5 text-sm text-muted-foreground underline-offset-2 hover:text-foreground hover:underline`,"data-testid":`${n}-docs-link`,children:[(0,$.jsx)(m,{id:`zwWKhA`}),(0,$.jsx)(sr,{"aria-hidden":!0,className:`size-3`})]}),t[18]=d,t[19]=c,t[20]=r,t[21]=n,t[22]=C):C=t[22];let w;return t[23]!==x||t[24]!==S||t[25]!==C?(w=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[x,S,C]}),t[23]=x,t[24]=S,t[25]=C,t[26]=w):w=t[26],w}var Ja=`settings-sharing-title`;function Ya(){let e=(0,Q.c)(1),t=(typeof window<`u`?window.okDesktop:void 0)?.sharing,n;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=t===void 0?(0,$.jsx)(Xa,{}):(0,$.jsx)(Za,{}),e[0]=n):n=e[0],n}function Xa(){let e=(0,Q.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(m,{id:`cs4mps`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`section`,{"aria-labelledby":Ja,className:`space-y-3`,"data-field":`section:sharing`,children:(0,$.jsx)(qa,{titleId:Ja,title:t,scope:`project`,level:`block`,children:(0,$.jsx)(m,{id:`7YRrJ9`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{}),2:(0,$.jsx)(`code`,{})}})})}),e[1]=n):n=e[1],n}function Za(){let e=(0,Q.c)(29),{_:t}=h(),[n,r]=(0,Z.useState)(null),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(null),c;e[0]===t?c=e[1]:(c=async function(){let e=window.okDesktop?.sharing;if(e)try{r(await e.status())}catch(e){let n=e;X.error(n instanceof Error?n.message:t({id:`K0N7zS`})),r($a)}},e[0]=t,e[1]=c);let l=c,u;e[2]===l?u=e[3]:(u=()=>{l()},e[2]=l,e[3]=u);let d;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=[],e[4]=d):d=e[4],(0,Z.useEffect)(u,d);let f;e[5]!==t||e[6]!==i||e[7]!==l||e[8]!==n?(f=async function(e){let r=window.okDesktop?.sharing;if(!r||n===null||i||n.mode===e)return;a(!0),s(null);let o=null,c=null;try{o=await r.setMode(e)}catch(e){c=e}if(a(!1),c!==null){X.error(c instanceof Error?c.message:t({id:`qZv5ZR`}));return}o!==null&&(o.kind===`refused-tracked`?(s({tracked:o.tracked,remediation:o.remediation}),X.error(t({id:`z2JdQ-`}),{duration:5e3})):o.kind===`no-exclude`?X.warning(o.reason===`no-git`?t({id:`YSFv5w`}):t({id:`8cS0nH`,values:{0:o.reason}})):X.success(t(e===`local-only`?{id:`wdzBgi`}:{id:`k_pade`})),await l())},e[5]=t,e[6]=i,e[7]=l,e[8]=n,e[9]=f):f=e[9];let p=f;if(n===null){let t;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(qa,{titleId:Ja,title:(0,$.jsx)(m,{id:`cs4mps`}),scope:`project`,level:`block`}),e[10]=t):t=e[10];let n;return e[11]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`section`,{"aria-labelledby":Ja,className:`space-y-3`,"data-field":`section:sharing`,children:[t,(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:(0,$.jsx)(m,{id:`eQn7nI`})}),(0,$.jsx)(ia,{className:`h-24`})]})]}),e[11]=n):n=e[11],n}let g=n.mode===`no-git`,_;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(m,{id:`cs4mps`}),e[12]=_):_=e[12];let v;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(qa,{titleId:Ja,title:_,scope:`project`,level:`block`,adornment:(0,$.jsx)(Zi,{}),children:(0,$.jsx)(m,{id:`N55YNr`})}),e[13]=v):v=e[13];let y;e[14]!==i||e[15]!==g||e[16]!==p||e[17]!==n.mode?(y=g?(0,$.jsx)(`p`,{className:`rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,role:`status`,"data-testid":`settings-sharing-no-git`,children:(0,$.jsx)(m,{id:`ju38ms`})}):(0,$.jsxs)(qe,{value:n.mode,onValueChange:e=>void p(e),disabled:i,className:`gap-2`,"aria-labelledby":Ja,"data-testid":`settings-sharing-radiogroup`,children:[(0,$.jsxs)(`label`,{htmlFor:`settings-sharing-local-only`,className:`flex items-start gap-2 text-sm`,children:[(0,$.jsx)(Ke,{id:`settings-sharing-local-only`,value:`local-only`,"data-testid":`settings-sharing-local-only`,className:`mt-1`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`font-medium`,children:(0,$.jsx)(m,{id:`QjzFZj`})}),(0,$.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,$.jsx)(m,{id:`un-K1H`})})]})]}),(0,$.jsxs)(`label`,{htmlFor:`settings-sharing-shared`,className:`flex items-start gap-2 text-sm`,children:[(0,$.jsx)(Ke,{id:`settings-sharing-shared`,value:`shared`,"data-testid":`settings-sharing-shared`,className:`mt-1`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`font-medium`,children:(0,$.jsx)(m,{id:`0Gd0NU`})}),(0,$.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,$.jsx)(m,{id:`dJw2_7`})})]})]})]}),e[14]=i,e[15]=g,e[16]=p,e[17]=n.mode,e[18]=y):y=e[18];let b;e[19]===o?b=e[20]:(b=o===null?null:(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border border-destructive bg-destructive/10 p-3 text-sm`,role:`alert`,"data-testid":`settings-sharing-refusal`,children:[(0,$.jsx)(`p`,{className:`font-semibold`,children:(0,$.jsx)(m,{id:`ZscwQ0`})}),(0,$.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-xs leading-relaxed`,children:o.remediation}),(0,$.jsx)(H,{variant:`outline`,size:`sm`,onClick:()=>s(null),children:(0,$.jsx)(m,{id:`1QfxQT`})})]}),e[19]=o,e[20]=b);let x;e[21]!==o||e[22]!==n.mode||e[23]!==n.trackedUpstream?(x=n.trackedUpstream.length>0&&n.mode!==`no-git`&&o===null?(0,$.jsxs)(`div`,{className:`space-y-1 rounded-md border border-muted-foreground/30 bg-muted/40 p-3 text-sm`,"data-testid":`settings-sharing-tracked-info`,children:[(0,$.jsx)(`p`,{className:`font-medium`,children:(0,$.jsx)(m,{id:`LhWYpm`})}),(0,$.jsx)(`ul`,{className:`list-disc pl-5 font-mono text-xs text-muted-foreground`,children:n.trackedUpstream.map(Qa)}),(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(m,{id:`1XSMhZ`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{})}})})]}):null,e[21]=o,e[22]=n.mode,e[23]=n.trackedUpstream,e[24]=x):x=e[24];let S;return e[25]!==y||e[26]!==b||e[27]!==x?(S=(0,$.jsxs)(`section`,{"aria-labelledby":Ja,className:`space-y-4`,"data-testid":`settings-sharing`,"data-field":`section:sharing`,children:[v,y,b,x]}),e[25]=y,e[26]=b,e[27]=x,e[28]=S):S=e[28],S}function Qa(e){return(0,$.jsx)(`li`,{children:e},e)}function $a(e){return e??{kind:`status`,mode:`no-git`,excluded:[],trackedUpstream:[]}}var eo=`[a-z0-9](?:[a-z0-9-]*[a-z0-9])?`,to=RegExp(`^${eo}(?:\\.${eo})*$`),no=/^[a-z][a-z0-9+.-]*:\/\//i;function ro(e){if(no.test(e))try{return new URL(e).host}catch{return null}let t=e.split(`/`)[0]??``;return t.slice(t.lastIndexOf(`@`)+1).replace(/:(?!\d+$).*$/,``)}function io(e,t){let n=e.trim();if(n===``)return{ok:!1,reason:`empty`};let r=ro(n);if(r===null||r===``)return{ok:!1,reason:`invalid`};let i=nn(r);return to.test(i)?i===`github.com`?{ok:!1,reason:`github-com`}:t.has(i)?{ok:!1,reason:`duplicate`}:{ok:!0,host:i}:{ok:!1,reason:`invalid`}}function ao(e){let t=e.git?.hosts??{};return Object.entries(t).filter(([,e])=>e?.provider===`github`).map(([e])=>e).sort((e,t)=>e.localeCompare(t))}function oo(e){let t=(0,Q.c)(59),{binding:n}=e,{_:r}=h(),i=(0,Z.useId)(),a=(0,Z.useId)(),o;t[0]===n?o=t[1]:(o=()=>ao(n.current()),t[0]=n,t[1]=o);let[s,c]=(0,Z.useState)(o),[l,u]=(0,Z.useState)(``),[d,f]=(0,Z.useState)(null),[p,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(null),y;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(y=new Map,t[2]=y):y=t[2];let b=(0,Z.useRef)(y),x=(0,Z.useRef)(null),S,C;t[3]===_?(S=t[4],C=t[5]):(S=()=>{_!==null&&(((_.host===null?null:b.current.get(_.host))??x.current)?.focus(),v(null))},C=[_],t[3]=_,t[4]=S,t[5]=C),(0,Z.useEffect)(S,C);let w,T;t[6]===n?(w=t[7],T=t[8]):(w=()=>n.subscribe(e=>c(ao(e))),T=[n],t[6]=n,t[7]=w,t[8]=T),(0,Z.useEffect)(w,T);let E;t[9]===r?E=t[10]:(E=function(e){switch(e){case`empty`:return r({id:`cFONFy`});case`invalid`:return r({id:`QsnBxE`});case`github-com`:return r({id:`UK3GW4`});case`duplicate`:return r({id:`DEkRZA`})}},t[9]=r,t[10]=E);let D=E,O;t[11]!==n||t[12]!==l||t[13]!==s||t[14]!==D?(O=function(e){e.preventDefault();let t=io(l,new Set(s.map(so)));if(!t.ok){f(D(t.reason));return}let r=n.patch({git:{hosts:{[t.host]:{provider:`github`}}}});if(!r.ok){f(_n(r.error));return}c(ao(r.effective)),u(``),f(null),g(!0)},t[11]=n,t[12]=l,t[13]=s,t[14]=D,t[15]=O):O=t[15];let k=O,A;t[16]!==n||t[17]!==s?(A=function(e){let t=s.indexOf(e),r=s[t+1]??s[t-1]??null,i=n.patch({git:{hosts:{[e]:null}}});if(!i.ok){f(_n(i.error));return}c(ao(i.effective)),v({host:r}),f(null),g(!0)},t[16]=n,t[17]=s,t[18]=A):A=t[18];let j=A,M;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(`h4`,{id:`settings-enterprise-hosts-title`,className:`text-sm font-medium`,children:(0,$.jsx)(m,{id:`J2-D_a`})}),t[19]=M):M=t[19];let N;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(m,{id:`PgY2nN`}),t[20]=N):N=t[20];let P;t[21]===i?P=t[22]:(P=(0,$.jsxs)(`div`,{children:[M,(0,$.jsx)(`p`,{id:i,className:`text-1sm text-muted-foreground`,children:N})]}),t[21]=i,t[22]=P);let F;t[23]!==r||t[24]!==j||t[25]!==s?(F=s.length>0?(0,$.jsx)(`ul`,{className:`space-y-1`,"data-testid":`settings-enterprise-hosts-list`,children:s.map(e=>(0,$.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:e}),(0,$.jsx)(H,{variant:`ghost`,size:`icon`,className:`size-7`,"aria-label":r({id:`xVMoYb`,values:{host:e}}),ref:t=>{t?b.current.set(e,t):b.current.delete(e)},onClick:()=>j(e),children:(0,$.jsx)(di,{"aria-hidden":`true`})})]},e))}):(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`settings-enterprise-hosts-empty`,children:(0,$.jsx)(m,{id:`HK2eIK`})}),t[23]=r,t[24]=j,t[25]=s,t[26]=F):F=t[26];let I;t[27]===r?I=t[28]:(I=r({id:`Qbf7Q4`}),t[27]=r,t[28]=I);let L=d!==null,R=d===null?i:`${i} ${a}`,z;t[29]===d?z=t[30]:(z=e=>{u(e.target.value),d!==null&&f(null)},t[29]=d,t[30]=z);let B;t[31]!==l||t[32]!==I||t[33]!==L||t[34]!==R||t[35]!==z?(B=(0,$.jsx)(Pi,{ref:x,value:l,"aria-label":I,placeholder:`github.example.com`,autoComplete:`off`,spellCheck:!1,inputMode:`url`,className:`h-7 flex-1 font-mono text-xs`,"aria-invalid":L,"aria-describedby":R,onChange:z}),t[31]=l,t[32]=I,t[33]=L,t[34]=R,t[35]=z,t[36]=B):B=t[36];let V;t[37]===l?V=t[38]:(V=l.trim(),t[37]=l,t[38]=V);let U=V===``,W;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,$.jsx)(m,{id:`ALFlyF`}),t[39]=W):W=t[39];let G;t[40]===U?G=t[41]:(G=(0,$.jsx)(H,{type:`submit`,size:`sm`,variant:`secondary`,disabled:U,className:`h-7 px-2 font-normal text-xs`,children:W}),t[40]=U,t[41]=G);let K;t[42]!==k||t[43]!==B||t[44]!==G?(K=(0,$.jsxs)(`form`,{className:`flex items-center gap-2 pt-1`,onSubmit:k,noValidate:!0,children:[B,G]}),t[42]=k,t[43]=B,t[44]=G,t[45]=K):K=t[45];let ee;t[46]!==d||t[47]!==a?(ee=d===null?null:(0,$.jsx)(`p`,{id:a,role:`alert`,className:`text-1sm text-destructive`,children:d}),t[46]=d,t[47]=a,t[48]=ee):ee=t[48];let te;t[49]===p?te=t[50]:(te=p?(0,$.jsx)(`p`,{role:`status`,className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(m,{id:`3LuFP-`})}):null,t[49]=p,t[50]=te);let q;t[51]!==F||t[52]!==K||t[53]!==ee||t[54]!==te?(q=(0,$.jsxs)(`div`,{className:`space-y-2 rounded-lg border bg-card p-3`,children:[F,K,ee,te]}),t[51]=F,t[52]=K,t[53]=ee,t[54]=te,t[55]=q):q=t[55];let J;return t[56]!==P||t[57]!==q?(J=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-enterprise-hosts-title`,className:`space-y-4 pt-5`,"data-field":`section:enterprise-hosts`,"data-testid":`settings-enterprise-hosts`,children:[P,q]}),t[56]=P,t[57]=q,t[58]=J):J=t[58],J}function so(e){return nn(e)}function co(e){let t=(0,Q.c)(38),{authQueryTransport:n,authTransport:r,userBinding:i}=e,{_:a}=h(),o;t[0]===n?o=t[1]:(o=n??Ur(),t[0]=n,t[1]=o);let s=o,c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c={phase:`loading`},t[2]=c):c=t[2];let[l,u]=(0,Z.useState)(c),[d,f]=(0,Z.useState)(!1),[p,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(null),y=(0,Z.useRef)(!1),b;t[3]===s?b=t[4]:(b=async function(){u({phase:`loading`});try{let e=await s.status();u({phase:`loaded`,result:e}),ti(e)}catch(e){console.warn(`[AccountSection] GitHub status check failed`,e),u({phase:`check-failed`})}},t[3]=s,t[4]=b);let x=b,S;t[5]===x?S=t[6]:(S=()=>{x()},t[5]=x,t[6]=S);let C;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(C=[],t[7]=C):C=t[7],(0,Z.useEffect)(S,C);let w;t[8]!==a||t[9]!==x||t[10]!==s?(w=async function(){if(y.current)return;y.current=!0,f(!1),g(!0),v(null);let e=null;try{let t=s.signout?await s.signout():{ok:!1,error:a({id:`8cpOa8`})};t.ok||(e=t.error??a({id:`8cpOa8`}))}catch(t){console.warn(`[AccountSection] GitHub disconnect failed`,t),e=a({id:`8cpOa8`})}await x(),e&&v(e),g(!1),y.current=!1},t[8]=a,t[9]=x,t[10]=s,t[11]=w):w=t[11];let T=w,E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(m,{id:`AeXO77`}),t[12]=E):E=t[12];let D;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(qa,{titleId:`settings-account-title`,title:E,scope:`user`,children:(0,$.jsx)(m,{id:`E6lrpp`})}),t[13]=D):D=t[13];let O;t[14]!==_||t[15]!==p||t[16]!==T||t[17]!==x||t[18]!==l.phase||t[19]!==l.result?(O=l.phase===`loading`?(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-loading`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:(0,$.jsx)(m,{id:`IWGfGF`})}),(0,$.jsx)(ia,{className:`h-4 w-40`}),(0,$.jsx)(ia,{className:`h-8 w-32`})]}):l.phase===`check-failed`?(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-check-failed`,children:[(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:(0,$.jsx)(m,{id:`T_wG4n`})}),(0,$.jsx)(H,{variant:`outline`,size:`sm`,onClick:()=>void x(),children:(0,$.jsx)(m,{id:`KDw4GX`})})]}):l.result.authenticated?l.result.tier===`A`?(0,$.jsx)(uo,{login:l.result.login}):(0,$.jsx)(lo,{login:l.result.login,disconnecting:p,error:_,onDisconnect:()=>void T()}):l.result.unsupportedOrigin===void 0?(0,$.jsx)(po,{onConnect:()=>f(!0)}):(0,$.jsx)(fo,{host:l.result.unsupportedOrigin.host}),t[14]=_,t[15]=p,t[16]=T,t[17]=x,t[18]=l.phase,t[19]=l.result,t[20]=O):O=t[20];let k;t[21]===i?k=t[22]:(k=(0,$.jsx)(oo,{binding:i}),t[21]=i,t[22]=k);let A;t[23]===x?A=t[24]:(A=e=>{f(e),e||x()},t[23]=x,t[24]=A);let j=l.phase===`loaded`?l.result.host:void 0,M=l.phase===`loaded`?l.result.ghAvailable:void 0,N;t[25]===x?N=t[26]:(N=()=>{x()},t[25]=x,t[26]=N);let P;t[27]!==d||t[28]!==r||t[29]!==A||t[30]!==j||t[31]!==M||t[32]!==N?(P=(0,$.jsx)(kr,{open:d,onOpenChange:A,transport:r,host:j,ghAvailable:M,onSuccess:N}),t[27]=d,t[28]=r,t[29]=A,t[30]=j,t[31]=M,t[32]=N,t[33]=P):P=t[33];let F;return t[34]!==k||t[35]!==P||t[36]!==O?(F=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-account-title`,className:`space-y-3`,"data-testid":`settings-account`,children:[D,O,k,P]}),t[34]=k,t[35]=P,t[36]=O,t[37]=F):F=t[37],F}function lo(e){let t=(0,Q.c)(20),{login:n,disconnecting:r,error:i,onDisconnect:a}=e,o;t[0]===n?o=t[1]:(o=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(m,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(m,{id:`nxlOpL`})}),t[2]=s):s=t[2];let c;t[3]===o?c=t[4]:(c=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[o,s]}),t[3]=o,t[4]=c);let l;t[5]===r?l=t[6]:(l=r?(0,$.jsx)(m,{id:`rppgXF`}):(0,$.jsx)(m,{id:`-K0AvT`}),t[5]=r,t[6]=l);let u;t[7]!==r||t[8]!==a||t[9]!==l?(u=(0,$.jsx)(H,{variant:`outline`,onClick:a,disabled:r,"aria-describedby":`settings-account-disconnect-caveat`,"data-testid":`settings-account-disconnect`,children:l}),t[7]=r,t[8]=a,t[9]=l,t[10]=u):u=t[10];let d;t[11]!==c||t[12]!==u?(d=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[c,u]}),t[11]=c,t[12]=u,t[13]=d):d=t[13];let f;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`p`,{id:`settings-account-disconnect-caveat`,className:`text-muted-foreground text-1sm`,"data-testid":`settings-account-disconnect-caveat`,children:(0,$.jsx)(m,{id:`msOK6I`})}),t[14]=f):f=t[14];let p;t[15]===i?p=t[16]:(p=i?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,"data-testid":`settings-account-disconnect-error`,children:i}):null,t[15]=i,t[16]=p);let h;return t[17]!==d||t[18]!==p?(h=(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-connected`,children:[d,f,p]}),t[17]=d,t[18]=p,t[19]=h):h=t[19],h}function uo(e){let t=(0,Q.c)(5),{login:n}=e,r;t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(m,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(m,{id:`ny6vNn`})}),t[2]=i):i=t[2];let a;return t[3]===r?a=t[4]:(a=(0,$.jsx)(`div`,{className:`rounded-md border p-3`,"data-testid":`settings-account-gh-cli`,children:(0,$.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[r,i]})}),t[3]=r,t[4]=a),a}function fo(e){let t=(0,Q.c)(3),{host:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(m,{id:`xBjIs7`})}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,$.jsxs)(`div`,{role:`status`,className:`space-y-1 rounded-md border p-3`,"data-testid":`settings-account-unsupported-origin`,children:[r,(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:n===null?(0,$.jsx)(m,{id:`XBpH6-`}):(0,$.jsx)(m,{id:`7_I248`,values:{host:n}})})]}),t[1]=n,t[2]=i),i}function po(e){let t=(0,Q.c)(5),{onConnect:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(m,{id:`S33tz3`})}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[r,(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(m,{id:`EJuO7B`})})]}),t[1]=i):i=t[1];let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(m,{id:`5lWFkC`}),t[2]=a):a=t[2];let o;return t[3]===n?o=t[4]:(o=(0,$.jsx)(`div`,{className:`rounded-md border p-3`,"data-testid":`settings-account-disconnected`,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[i,(0,$.jsx)(H,{onClick:n,"data-testid":`settings-account-connect`,children:a})]})}),t[3]=n,t[4]=o),o}function mo(e){if(e===void 0)return null;let t=e.params?.agent;if(typeof t!=`string`)return null;let n=mn[t]??t;return e.id===`followup.enable-manually`?An._({id:`followup.enable-manually`,values:{agent:n}}):null}function ho(e){let{enabled:t,installedCount:n,presence:r,configurable:i,setupDocSlug:a,installUrl:o}=e,s=n>0,c=r===`absent`,l=()=>a===null?{kind:`none`}:{kind:`setup-doc`,slug:a};return c?o==null||o===``?l():{kind:`install`,url:o}:i?t?s?{kind:`manage`}:{kind:`connect`}:s?{kind:`remove`}:{kind:`none`}:s?{kind:`remove`}:l()}function go(e){return e.presence===`absent`&&e.installedCount>0}function _o(e){let t=(0,Q.c)(32),{icon:n,name:r,hint:i,status:a,action:o,checked:s,disabled:c,ariaLabel:l,testId:u,rowTestId:d,statusId:f,onToggle:p}=e,m=i?`${d}-hint`:void 0,h;t[0]===n?h=t[1]:(h=(0,$.jsx)(`span`,{className:`flex h-5 shrink-0 items-center`,children:n}),t[0]=n,t[1]=h);let g;t[2]===r?g=t[3]:(g=(0,$.jsx)(`span`,{className:`truncate text-sm leading-5`,children:r}),t[2]=r,t[3]=g);let _;t[4]!==i||t[5]!==m?(_=i?(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,$.jsx)(`span`,{id:m,className:`truncate text-muted-foreground text-1sm`,children:i.text}),i.action]}):null,t[4]=i,t[5]=m,t[6]=_):_=t[6];let v;t[7]!==a||t[8]!==f?(v=a?(0,$.jsx)(`span`,{id:f,children:a}):null,t[7]=a,t[8]=f,t[9]=v):v=t[9];let y;t[10]!==g||t[11]!==_||t[12]!==v?(y=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[g,_,v]}),t[10]=g,t[11]=_,t[12]=v,t[13]=y):y=t[13];let b;t[14]!==h||t[15]!==y?(b=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2.5`,children:[h,y]}),t[14]=h,t[15]=y,t[16]=b):b=t[16];let x;t[17]!==l||t[18]!==s||t[19]!==c||t[20]!==m||t[21]!==p||t[22]!==f||t[23]!==u?(x=p===void 0?null:(0,$.jsx)(Je,{checked:s??!1,disabled:c,onCheckedChange:p,"aria-label":l,"aria-describedby":[m,f].filter(Boolean).join(` `)||void 0,"data-testid":u}),t[17]=l,t[18]=s,t[19]=c,t[20]=m,t[21]=p,t[22]=f,t[23]=u,t[24]=x):x=t[24];let S;t[25]!==o||t[26]!==x?(S=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[o,x]}),t[25]=o,t[26]=x,t[27]=S):S=t[27];let C;return t[28]!==d||t[29]!==b||t[30]!==S?(C=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 py-2.5`,"data-testid":d,children:[b,S]}),t[28]=d,t[29]=b,t[30]=S,t[31]=C):C=t[31],C}function vo(e){let t=(0,Q.c)(15),{target:n,projectDir:r,displayName:i}=e,{_:a}=h(),o;t[0]!==r||t[1]!==n?(o=()=>Un(n,r),t[0]=r,t[1]=n,t[2]=o):o=t[2];let[s,c]=(0,Z.useState)(o);if(!s)return null;let l;t[3]!==a||t[4]!==i?(l=a({id:`jIWP0P`,values:{displayName:i}}),t[3]=a,t[4]=i,t[5]=l):l=t[5];let u;t[6]!==r||t[7]!==n?(u=()=>{Hn(n,r,!1),c(Un(n,r))},t[6]=r,t[7]=n,t[8]=u):u=t[8];let d;t[9]===a?d=t[10]:(d=a({id:`LhVIxY`}),t[9]=a,t[10]=d);let f;return t[11]!==l||t[12]!==u||t[13]!==d?(f=(0,$.jsx)(H,{variant:`ghost`,size:`sm`,className:`shrink-0 font-mono uppercase`,"aria-label":l,onClick:u,children:d}),t[11]=l,t[12]=u,t[13]=d,t[14]=f):f=t[14],f}function yo(e,t){return e===`absent`&&!t}function bo(e){let t=(0,Q.c)(15),{label:n,labelIcon:r,subtitle:i,children:a,labelId:o}=e,s;t[0]!==n||t[1]!==r||t[2]!==o?(s=(0,$.jsxs)(`h4`,{id:o,tabIndex:-1,className:`flex items-center gap-1.5 font-mono text-muted-foreground text-xs uppercase tracking-wide`,children:[n,r]}),t[0]=n,t[1]=r,t[2]=o,t[3]=s):s=t[3];let c;t[4]===i?c=t[5]:(c=i?(0,$.jsx)(`p`,{className:`mt-1 text-muted-foreground text-xs`,children:i}):null,t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,$.jsxs)(`div`,{className:`mb-2`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]===a?u=t[10]:(u=(0,$.jsx)(`div`,{className:`divide-y overflow-hidden rounded-md border`,children:a}),t[9]=a,t[10]=u);let d;return t[11]!==o||t[12]!==l||t[13]!==u?(d=(0,$.jsxs)(`section`,{"aria-labelledby":o,children:[l,u]}),t[11]=o,t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function xo(e){if(e)return()=>{e.ownerDocument.activeElement===e&&V(e)?.focus()}}function So(e){let t=(0,Q.c)(9),{hiddenCount:n,expanded:r,onToggle:i,testId:a}=e,{_:o}=h();if(n<=0)return null;let s;t[0]!==o||t[1]!==r||t[2]!==n?(s=o(r?{id:`6lGV3K`}:{id:`INN7OX`,values:{hiddenCount:n}}),t[0]=o,t[1]=r,t[2]=n,t[3]=s):s=t[3];let c;return t[4]!==r||t[5]!==i||t[6]!==s||t[7]!==a?(c=(0,$.jsx)(H,{ref:xo,type:`button`,variant:`ghost`,onClick:i,"aria-expanded":r,className:`w-full justify-center rounded-none font-normal text-1sm text-muted-foreground`,"data-testid":a,children:s}),t[4]=r,t[5]=i,t[6]=s,t[7]=a,t[8]=c):c=t[8],c}function Co(e){let t=(0,Q.c)(10),{status:n,enabled:r}=e,{_:i}=h();if(n===`connected`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(cr,{"aria-hidden":!0,className:`size-3.5`}),t[0]=e):e=t[0];let n;t[1]===i?n=t[2]:(n=i({id:`QHcLEN`}),t[1]=i,t[2]=n);let r;return t[3]===n?r=t[4]:(r=(0,$.jsxs)(`span`,{className:`mt-0.5 inline-flex items-center gap-1 text-muted-foreground text-xs`,children:[e,n]}),t[3]=n,t[4]=r),r}if(n===`not-connected`&&r){let e;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(fi,{"aria-hidden":!0,className:`size-3.5`}),t[5]=e):e=t[5];let n;t[6]===i?n=t[7]:(n=i({id:`S33tz3`}),t[6]=i,t[7]=n);let r;return t[8]===n?r=t[9]:(r=(0,$.jsxs)(`span`,{className:`mt-0.5 inline-flex items-center gap-1 text-amber-700 text-xs dark:text-amber-400`,children:[e,n]}),t[8]=n,t[9]=r),r}return null}function wo(e){let t=(0,Q.c)(52),{action:n,rowLabel:r,describedById:i,onConfigure:a,onRemove:o}=e,{_:s}=h();switch(n.kind){case`none`:return null;case`install`:{let e=n.url,a;t[0]!==s||t[1]!==r?(a=s({id:`wfZwqe`,values:{rowLabel:r}}),t[0]=s,t[1]=r,t[2]=a):a=t[2];let o;t[3]===s?o=t[4]:(o=s({id:`TKQ7K-`}),t[3]=s,t[4]=o);let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(sr,{"aria-hidden":!0}),t[5]=c):c=t[5];let l;return t[6]!==n.url||t[7]!==i||t[8]!==a||t[9]!==o?(l=(0,$.jsx)(H,{variant:`link`,size:`sm`,className:`shrink-0 text-muted-foreground hover:text-foreground`,asChild:!0,children:(0,$.jsxs)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,"aria-label":a,"aria-describedby":i,children:[o,c]})}),t[6]=n.url,t[7]=i,t[8]=a,t[9]=o,t[10]=l):l=t[10],l}case`setup-doc`:{let e=`https://openknowledge.ai/docs/integrations/${n.slug}`,a;t[11]!==s||t[12]!==r?(a=s({id:`Kuw5NN`,values:{rowLabel:r}}),t[11]=s,t[12]=r,t[13]=a):a=t[13];let o;t[14]===s?o=t[15]:(o=s({id:`P_bX4O`}),t[14]=s,t[15]=o);let c;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(sr,{"aria-hidden":!0}),t[16]=c):c=t[16];let l;return t[17]!==i||t[18]!==e||t[19]!==a||t[20]!==o?(l=(0,$.jsx)(H,{variant:`link`,size:`sm`,className:`shrink-0 text-muted-foreground hover:text-foreground`,asChild:!0,children:(0,$.jsxs)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,"aria-label":a,"aria-describedby":i,children:[o,c]})}),t[17]=i,t[18]=e,t[19]=a,t[20]=o,t[21]=l):l=t[21],l}case`connect`:{let e;t[22]!==s||t[23]!==r?(e=s({id:`_uxBz5`,values:{rowLabel:r}}),t[22]=s,t[23]=r,t[24]=e):e=t[24];let n;t[25]===s?n=t[26]:(n=s({id:`q63KUv`}),t[25]=s,t[26]=n);let o;return t[27]!==i||t[28]!==a||t[29]!==e||t[30]!==n?(o=(0,$.jsx)(H,{size:`sm`,className:`shrink-0 font-mono uppercase`,onClick:a,"aria-label":e,"aria-describedby":i,children:n}),t[27]=i,t[28]=a,t[29]=e,t[30]=n,t[31]=o):o=t[31],o}case`manage`:{let e;t[32]!==s||t[33]!==r?(e=s({id:`wSBXaS`,values:{rowLabel:r}}),t[32]=s,t[33]=r,t[34]=e):e=t[34];let n;t[35]===s?n=t[36]:(n=s({id:`wckWOP`}),t[35]=s,t[36]=n);let o;return t[37]!==i||t[38]!==a||t[39]!==e||t[40]!==n?(o=(0,$.jsx)(H,{variant:`outline`,size:`sm`,className:`shrink-0 font-mono uppercase`,onClick:a,"aria-label":e,"aria-describedby":i,children:n}),t[37]=i,t[38]=a,t[39]=e,t[40]=n,t[41]=o):o=t[41],o}case`remove`:{let e;t[42]!==s||t[43]!==r?(e=s({id:`vRlzx-`,values:{rowLabel:r}}),t[42]=s,t[43]=r,t[44]=e):e=t[44];let n;t[45]===s?n=t[46]:(n=s({id:`t_YqKh`}),t[45]=s,t[46]=n);let a;return t[47]!==i||t[48]!==o||t[49]!==e||t[50]!==n?(a=(0,$.jsx)(H,{variant:`outline`,size:`sm`,className:`shrink-0 font-mono uppercase`,onClick:o,"aria-label":e,"aria-describedby":i,children:n}),t[47]=i,t[48]=o,t[49]=e,t[50]=n,t[51]=a):a=t[51],a}}}function To(e){let t=(0,Q.c)(9),{rowLabel:n,onRemove:r}=e,{_:i}=h(),a;t[0]!==i||t[1]!==n?(a=i({id:`vRlzx-`,values:{rowLabel:n}}),t[0]=i,t[1]=n,t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=i({id:`t_YqKh`}),t[3]=i,t[4]=o);let s;return t[5]!==r||t[6]!==a||t[7]!==o?(s=(0,$.jsx)(H,{type:`button`,variant:`link-muted`,className:`h-auto p-0 text-1sm underline underline-offset-4 hover:text-destructive`,onClick:r,"aria-label":a,children:o}),t[5]=r,t[6]=a,t[7]=o,t[8]=s):s=t[8],s}function Eo(e){return e===void 0?null:pt[e].external?.installUrl??null}function Do(e){return e!==null&&Object.values(e.probes.satisfiers).some(e=>e!==void 0&&e.state!==`unprobed`)}function Oo(e){return`${e.source}:${e.id}`}function ko(e,t,n){let r=t.has(Oo(n)),i=dt(n);return at(e,n.source,n.id,r||i,n.supported)}function Ao(e,t,n){return n.harness!==void 0&&lt(n)===0||ko(e,t,n)}function jo(e,t,n){let r=new Set(n.map(e=>Oo(e))),i=e=>Ao(t,r,e),a=[...e].sort((e,t)=>Number(i(t))-Number(i(e))||e.name.localeCompare(t.name));return{primaryKeys:new Set(a.filter(i).map(Oo)),ranks:new Map(a.map((e,t)=>[Oo(e),t]))}}function Mo(e,t,n,r){let i=t.filter(t=>!e.ranks.has(Oo(t)));if(i.length===0)return e;let a=new Set(r.map(e=>Oo(e))),o=e=>Ao(n,a,e),s=i.filter(o).sort((e,t)=>e.name.localeCompare(t.name)),c=i.filter(e=>!o(e)).sort((e,t)=>e.name.localeCompare(t.name)),l=[...e.ranks.entries()].sort(([,e],[,t])=>e-t).map(([e])=>e),u=l.filter(t=>e.primaryKeys.has(t)),d=l.filter(t=>!e.primaryKeys.has(t)),f=[...u,...s.map(Oo),...d,...c.map(Oo)];return{primaryKeys:new Set([...e.primaryKeys,...s.map(Oo)]),ranks:new Map(f.map((e,t)=>[e,t]))}}function No(e){let t=(0,Q.c)(125),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{applyConnections:r}=n,i=r===void 0?L:r,{_:a}=h(),o=st(),s=ct(),{states:c,refresh:l}=zn(),u=Bn(),d=Oi(),[f,p]=(0,Z.useState)(``),[m,_]=(0,Z.useState)(!1),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(!1),[w,B]=(0,Z.useState)(null),[V,U]=(0,Z.useState)(!1),[W,G]=(0,Z.useState)(!1),[K,ee]=(0,Z.useState)(!1),[te,q]=(0,Z.useState)(0),[J,ne]=(0,Z.useState)(null),[re,ie]=(0,Z.useState)(null),ae=(0,Z.useRef)(null),oe=(0,Z.useRef)(0),se;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(se={queryKey:[`acp-catalog`],queryFn:Uo,staleTime:3e5},t[2]=se):se=t[2];let ce=g(se),le;t[3]!==ce.data||t[4]!==o||t[5]!==s?(le=()=>ce.data===void 0?null:jo(ce.data.agents,o,s),t[3]=ce.data,t[4]=o,t[5]=s,t[6]=le):le=t[6];let[ue,de]=(0,Z.useState)(le),fe=ue??jo([],o,s);if(ce.data!==void 0){let e;t[7]!==ce.data.agents||t[8]!==ue||t[9]!==o||t[10]!==s?(e=ue===null?jo(ce.data.agents,o,s):Mo(ue,ce.data.agents,o,s),t[7]=ce.data.agents,t[8]=ue,t[9]=o,t[10]=s,t[11]=e):e=t[11];let n=e;n!==ue&&de(n),fe=n}let pe;t[12]===l?pe=t[13]:(pe=()=>{l()},t[12]=l,t[13]=pe);let me=(0,Z.useEffectEvent)(pe),he;t[14]===me?he=t[15]:(he=()=>{me()},t[14]=me,t[15]=he);let ge;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(ge=[],t[16]=ge):ge=t[16],(0,Z.useEffect)(he,ge);let _e;t[17]===i?_e=t[18]:(_e=()=>{let e=!0,t=oe.current+=1;return i([]).then(n=>{!e||oe.current!==t||(n.snapshot!==null&&B(n.snapshot),U(!Do(n.snapshot)),G(n.unavailable===!0),ee(n.devBuild===!0))}).catch(()=>{e&&oe.current===t&&U(!0)}),()=>{e=!1}},t[17]=i,t[18]=_e);let ve;t[19]!==i||t[20]!==te?(ve=[i,te],t[19]=i,t[20]=te,t[21]=ve):ve=t[21],(0,Z.useEffect)(_e,ve);let ye=ce.data?.agents,be=new Set(s.map(Ho)),xe;t[22]===u?.installedClis?xe=t[23]:(xe=u?.installedClis??{},t[22]=u?.installedClis,t[23]=xe);let Se=xe,Ce=w===null?[]:D(w),we=Ce.find(e=>e.id===J)??null,Te=Ce.find(e=>e.id===re)??null,Ee;t[24]===i?Ee=t[25]:(Ee=async function(e){let t=await i(e);return oe.current+=1,t.snapshot!==null&&B(t.snapshot),U(!Do(t.snapshot)),t.unavailable===!0&&G(!0),t.devBuild===!0&&ee(!0),t},t[24]=i,t[25]=Ee);let De=Ee,Oe;t[26]===w?Oe=t[27]:(Oe=function(e,t){return t===!1?`absent`:t===!0?`present`:e===void 0?`unknown`:N(e,w,t)},t[26]=w,t[27]=Oe);let ke=Oe,Ae;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=new Set(Pt.map(Dt).filter(Vo)),t[28]=Ae):Ae=t[28];let je=Ae,Me;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(Me=new Set(xt.map(Bo).filter(zo)),t[29]=Me):Me=t[29];let Ne=Me,Pe;t[30]!==Se||t[31]!==ke||t[32]!==c?(Pe=function(e,t){if(t===`terminal`){let t=pt[e].external?.targetId;return t===void 0?`unknown`:ke(e,c[t]?.installed??null)}let n=Pt.find(t=>Dt(t)===e);return n===void 0?`unknown`:ke(e,Se[n]??null)},t[30]=Se,t[31]=ke,t[32]=c,t[33]=Pe):Pe=t[33];let Fe=Pe,Ie=function(e,t,n,r,i,a,o,s){let c=e===void 0?void 0:Ce.find(t=>t.id===e);if(c===void 0||e===void 0||w===null||!Do(w))return{status:void 0,action:void 0,hintAction:void 0,residualFiles:!1,statusId:void 0};let l={enabled:i,installedCount:k(S(c)),presence:o,configurable:P(c),setupDocSlug:c.row.setupDocSlug,installUrl:s===void 0?pt[e].external?.installUrl??null:s},u=ho(l),d=M(e)&&Fe(e,r)!==`absent`,f=go(l)&&!d,p=F({agentId:e,mode:r,snapshot:w,detected:a}),m=p===`connected`||p===`not-connected`&&i,h=m?`${n}-status`:void 0,g=!W||u.kind===`install`||u.kind===`setup-doc`,_=c.cells.projectMcp,v=_===void 0||!M(e)||C(_.consentClass)===r?mo(A({agentId:e,mode:r,snapshot:w,detected:a,projectMcp:_})):null;return{status:m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Co,{status:p,enabled:i}),v===null?null:(0,$.jsx)(`span`,{className:`mt-0.5 block text-muted-foreground text-xs`,"data-testid":`${n}-followup`,children:v})]}):void 0,action:g?(0,$.jsx)(wo,{action:u,rowLabel:t,describedById:h,onConfigure:()=>ne(e),onRemove:()=>ie(e)}):void 0,hintAction:f&&!W?(0,$.jsx)(To,{rowLabel:t,onRemove:()=>ie(e)}):void 0,residualFiles:f,statusId:h}},Le;t[34]===a?Le=t[35]:(Le=function(e,t){return a(e===`not-installed`?t?{id:`06Ucfz`}:{id:`5SwVv1`}:t?{id:`V0Jk_K`}:{id:`EDD3UL`})},t[34]=a,t[35]=Le);let Re=Le,ze=function(e,t,n,r,i){if($e(e,r),!r||W||t===void 0||w===null)return;let a=Ce.find(e=>e.id===t);a===void 0||!P(a)||F({agentId:t,mode:n,snapshot:w,detected:i})===`not-connected`&&(ae.current=e,ne(t))},Be;t[36]!==ye||t[37]!==o||t[38]!==s?(Be=function(){ye!==void 0&&de(jo(ye,o,s))},t[36]=ye,t[37]=o,t[38]=s,t[39]=Be):Be=t[39];let Ve=Be,He;t[40]!==f||t[41]!==Ve?(He=function(e){f.trim()!==``&&e.trim()===``&&Ve(),p(e)},t[40]=f,t[41]=Ve,t[42]=He):He=t[42];let Ue=He,We;t[43]!==Ve||t[44]!==m?(We=function(){m&&Ve(),_(!m)},t[43]=Ve,t[44]=m,t[45]=We):We=t[45];let Ge=We,Ke=f.trim().toLowerCase(),qe=e=>Ke===``||e.toLowerCase().includes(Ke),Je=(ye??[]).filter(e=>qe(e.name)),Ye;t[46]===Se?Ye=t[47]:(Ye=e=>Se[e]!==!1,t[46]=Se,t[47]=Ye);let Xe=Ye,Ze;t[48]===Xe?Ze=t[49]:(Ze=(e,t)=>Number(Xe(t))-Number(Xe(e))||jt[e].displayName.localeCompare(jt[t].displayName),t[48]=Xe,t[49]=Ze);let lt=Pt.filter(e=>{let{displayName:t}=jt[e];return qe(t)||qe(a({id:`QYfQdv`,values:{displayName:t}}))||qe(e)}).sort(Ze),ut;t[50]!==ke||t[51]!==c?(ut=e=>ke(Ct(e),c[e]?.installed??null),t[50]=ke,t[51]=c,t[52]=ut):ut=t[52];let ft=ut,mt;t[53]===ft?mt=t[54]:(mt=(e,t)=>Number(ft(e.id)===`absent`)-Number(ft(t.id)===`absent`),t[53]=ft,t[54]=mt);let ht=xt.filter(e=>{let{displayName:t}=e;return qe(a({id:`CZBqrX`,values:{displayName:t}}))||qe(e.id)}).sort(mt),gt=u!==null,_t;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(_t=new Set([...je,...Ne]),t[55]=_t):_t=t[55];let vt=_t,yt=tn.filter(e=>!vt.has(e)&&qe(E(e))),bt=Ke!==``,St=!ce.isLoading&&!ce.isError,wt=bt&&St&&Je.length===0&&lt.length===0&&ht.length===0&&yt.length===0,Tt=!bt||ce.isLoading||ce.isError||Je.length>0,Et=!bt||lt.length>0,Ot=!bt||ht.length>0||yt.length>0,kt=e=>ko(o,be,e),At=e=>fe.primaryKeys.has(Oo(e)),Mt=e=>fe.ranks.get(Oo(e))??2**53-1,Nt=Je.filter(At),Ft=[...bt||m?Je:Nt].sort((e,t)=>Mt(e)-Mt(t)||e.name.localeCompare(t.name)),It=bt?0:Je.length-Nt.length,Lt=lt.filter(Xe),Rt=Lt.length>0&&Lt.length<lt.length,zt=!Rt||bt||v?lt:Lt,Bt=Rt&&!bt?lt.length-Lt.length:0,Vt;t[56]===ft?Vt=t[57]:(Vt=e=>ft(e.id)!==`absent`,t[56]=ft,t[57]=Vt);let Ht=ht.filter(Vt),Ut=yt.filter(e=>ke(e,Ce.find(t=>t.id===e)?.row.detected??null)!==`absent`),Wt=Ht.length+Ut.length,Gt=ht.length+yt.length,Kt=Wt>0&&Wt<Gt,qt=!Kt||bt||b,Jt=qt?ht:Ht,Yt=qt?yt:Ut,Xt=Kt&&!bt?Gt-Wt:0,Zt=!St||Je.some(dt),Qt=gt&&lt.some(Xe),$t;t[58]===c?$t=t[59]:($t=e=>c[e.id]?.installed===!0,t[58]=c,t[59]=$t);let en=ht.some($t),nn=Tt?(0,$.jsx)(bo,{label:a({id:`RXEbZy`}),labelId:`settings-configure-agents-in-app`,children:ce.isLoading?(0,$.jsxs)(`div`,{className:`flex items-center justify-center gap-2 px-3 py-6 text-muted-foreground text-sm`,children:[(0,$.jsx)(Tr,{className:`size-4`,"aria-hidden":`true`}),a({id:`ucXZ0k`})]}):ce.isError?(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-3 py-6 text-center text-muted-foreground text-sm`,children:[(0,$.jsx)(Wa,{className:`size-5`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{children:a({id:`FqGWeR`})}),(0,$.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void ce.refetch(),children:a({id:`6gRgw8`})})]}):(ye?.length??0)===0?(0,$.jsx)(`p`,{className:`px-3 py-6 text-center text-muted-foreground text-sm`,children:a({id:`QQbwzK`})}):(0,$.jsxs)($.Fragment,{children:[Ft.map(e=>{let t=Oo(e),n=kt(e),r=e.supported?e.description:a({id:`5jEnaB`});return(0,$.jsx)(_o,{icon:(0,$.jsx)(ot,{agentId:e.id,iconUrl:e.iconUrl,className:`size-4`}),name:e.name,hint:r===void 0?void 0:{text:r},checked:n,disabled:!e.supported,ariaLabel:a({id:`FZtBeR`,values:{0:e.name}}),testId:`configure-agents-in-app-${t}`,rowTestId:`configure-agents-in-app-row-${t}`,onToggle:n=>{n?(et({source:e.source,id:e.id,name:e.name,supported:e.supported,featured:e.featured,...e.iconUrl===void 0?{}:{iconUrl:e.iconUrl}},{makeDefault:!1}),$e(Y(e.source,e.id),!0)):($e(Y(e.source,e.id),!1),tt(t,e=>at(o,e.source,e.id,!0,e.supported)))}},t)}),(0,$.jsx)(So,{hiddenCount:It,expanded:m,onToggle:Ge,testId:`configure-agents-in-app-show-more`})]})},`in-app`):null,rn=Et?(0,$.jsxs)(bo,{label:a({id:`ALhMYW`}),labelId:`settings-configure-agents-terminal`,children:[zt.map(e=>{let{displayName:t}=jt[e],n=Se[e]??null,r=ke(Dt(e),n),i=Qe(o,e,r===`absent`),s=`configure-agents-terminal-row-${e}`,{status:c,action:l,hintAction:u,residualFiles:d,statusId:f}=Ie(Dt(e),a({id:`QYfQdv`,values:{displayName:t}}),s,`terminal`,i,n,r,Eo(Dt(e))??jt[e].docsUrl);return(0,$.jsx)(_o,{icon:(0,$.jsx)(Rn,{id:na(e),className:`size-4`,"aria-hidden":`true`}),name:a({id:`QYfQdv`,values:{displayName:t}}),hint:r===`absent`?{text:Re(`not-installed`,d),action:u}:void 0,status:c,action:l,checked:i,disabled:yo(r,i),ariaLabel:a({id:`27TLNq`,values:{displayName:t}}),testId:`configure-agents-terminal-${e}`,rowTestId:s,statusId:f,onToggle:gt?t=>ze(nt(e),Dt(e),`terminal`,t,Se[e]??null):void 0},e)}),(0,$.jsx)(So,{hiddenCount:Bt,expanded:v,onToggle:()=>y(Ro),testId:`configure-agents-terminal-show-more`})]},`terminal`):null,an=Ot?(0,$.jsxs)(bo,{label:a({id:`BwKH4d`}),labelId:`settings-configure-agents-desktop`,labelIcon:(0,$.jsx)(sr,{"aria-hidden":`true`,className:`size-3`}),children:[Jt.map(e=>{let t=c[e.id]?.installed??null,{displayName:n}=e,r=rt(o,e.id,t),i=ke(Ct(e.id),t),s=`configure-agents-desktop-row-${e.id}`,{status:l,action:u,hintAction:f,residualFiles:p,statusId:m}=Ie(Ct(e.id),a({id:`CZBqrX`,values:{displayName:n}}),s,`external`,r,t,i);return(0,$.jsx)(_o,{icon:(0,$.jsx)(Rn,{id:e.id,className:`size-4`,"aria-hidden":`true`}),name:a({id:`CZBqrX`,values:{displayName:n}}),hint:i===`absent`?{text:Re(`not-installed`,p),action:f}:void 0,status:l,action:(0,$.jsxs)($.Fragment,{children:[u,d===null?null:(0,$.jsx)(vo,{target:e.id,projectDir:d.contentDir,displayName:n},`${d.contentDir}:${e.id}`)]}),checked:r,disabled:yo(i,r),ariaLabel:a({id:`cdBape`,values:{displayName:n}}),testId:`configure-agents-desktop-${e.id}`,rowTestId:s,statusId:m,onToggle:n=>ze(it(e.id),Ct(e.id),`external`,n,t)},e.id)}),Yt.map(e=>{let t=Ce.find(t=>t.id===e)??null,n=t?.row.detected??null,r=E(e),i=ke(e,n),a=`agent-connection-${e}`,o=Ie(e,r,a,`external`,t===null||!R(t),n,i);return(0,$.jsx)(_o,{icon:(0,$.jsx)(T,{agentId:e,className:`size-4 text-muted-foreground`}),name:r,hint:i===`absent`?{text:Re(`not-detected`,o.residualFiles),action:o.hintAction}:void 0,status:o.status,action:o.action,ariaLabel:r,testId:`configure-agents-unlaunchable-${e}`,rowTestId:a,statusId:o.statusId},e)}),(0,$.jsx)(So,{hiddenCount:Xt,expanded:b,onToggle:()=>x(Lo),testId:`configure-agents-desktop-show-more`})]},`desktop`):null,on=[{node:nn,hasPresent:Zt},{node:rn,hasPresent:Qt},{node:an,hasPresent:en}].sort(Io).map(Fo),sn;t[60]===a?sn=t[61]:(sn=a({id:`lBN3T6`}),t[60]=a,t[61]=sn);let cn;t[62]===a?cn=t[63]:(cn=a({id:`D4I0F9`}),t[62]=a,t[63]=cn);let ln;t[64]!==sn||t[65]!==cn?(ln=(0,$.jsx)(qa,{titleId:`settings-configure-agents-title`,title:sn,children:cn}),t[64]=sn,t[65]=cn,t[66]=ln):ln=t[66];let un;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(un=(0,$.jsx)(Nn,{className:`-translate-y-1/2 absolute top-1/2 start-2.5 size-4 text-muted-foreground`,"aria-hidden":`true`}),t[67]=un):un=t[67];let dn;t[68]===Ue?dn=t[69]:(dn=e=>Ue(e.target.value),t[68]=Ue,t[69]=dn);let fn;t[70]===a?fn=t[71]:(fn=a({id:`-7s4fw`}),t[70]=a,t[71]=fn);let pn;t[72]===a?pn=t[73]:(pn=a({id:`-7s4fw`}),t[72]=a,t[73]=pn);let mn;t[74]!==f||t[75]!==dn||t[76]!==fn||t[77]!==pn?(mn=(0,$.jsxs)(`div`,{className:`relative`,children:[un,(0,$.jsx)(Pi,{value:f,onChange:dn,placeholder:fn,"aria-label":pn,className:`ps-8`,"data-testid":`configure-agents-search`})]}),t[74]=f,t[75]=dn,t[76]=fn,t[77]=pn,t[78]=mn):mn=t[78];let hn;t[79]!==a||t[80]!==K||t[81]!==W?(hn=W?(0,$.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2 rounded-md border px-3 py-2.5 text-muted-foreground text-sm`,"data-testid":`configure-agents-read-only`,children:[(0,$.jsx)(fi,{"aria-hidden":!0,className:`size-4 shrink-0`}),(0,$.jsx)(`span`,{children:a(K?{id:`AUORpp`}:{id:`RD8cCw`})})]}):null,t[79]=a,t[80]=K,t[81]=W,t[82]=hn):hn=t[82];let gn;t[83]!==a||t[84]!==V?(gn=V?(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border px-3 py-2.5 text-muted-foreground text-sm`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(Wa,{"aria-hidden":!0,className:`size-4 shrink-0`}),(0,$.jsx)(`span`,{role:`status`,children:a({id:`4sE6E9`})})]}),(0,$.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,className:`shrink-0`,onClick:()=>q(Po),children:a({id:`6gRgw8`})})]}):null,t[83]=a,t[84]=V,t[85]=gn):gn=t[85];let _n;t[86]!==a||t[87]!==wt?(_n=wt?(0,$.jsx)(`p`,{className:`py-6 text-center text-muted-foreground text-sm`,"data-testid":`configure-agents-no-results`,children:a({id:`Nay2Yr`})}):null,t[86]=a,t[87]=wt,t[88]=_n):_n=t[88];let vn=`configure:${J??`closed`}`,yn;t[89]===J?yn=t[90]:(yn=J!==null&&M(J),t[89]=J,t[90]=yn);let bn=we!==null,X;t[91]===ae?X=t[92]:(X=e=>{e||(ae.current!==null&&($e(ae.current,!1),ae.current=null),ne(null))},t[91]=ae,t[92]=X);let xn;t[93]!==De||t[94]!==we||t[95]!==ae?(xn=(e,t)=>we===null?Promise.resolve({ok:!1,report:{actions:[],conflicts:[],withheld:[]},snapshot:null}):De(O(we,e,t)).then(e=>(e.ok&&(ae.current=null),e)),t[93]=De,t[94]=we,t[95]=ae,t[96]=xn):xn=t[96];let Sn;t[97]!==we||t[98]!==vn||t[99]!==yn||t[100]!==bn||t[101]!==X||t[102]!==xn?(Sn=(0,$.jsx)(I,{connection:we,paired:yn,open:bn,onOpenChange:X,onSave:xn},vn),t[97]=we,t[98]=vn,t[99]=yn,t[100]=bn,t[101]=X,t[102]=xn,t[103]=Sn):Sn=t[103];let Cn=`remove:${re??`closed`}`,wn;t[104]===re?wn=t[105]:(wn=re!==null&&M(re),t[104]=re,t[105]=wn);let Tn=Te!==null,En;t[106]===Symbol.for(`react.memo_cache_sentinel`)?(En=e=>{e||ie(null)},t[106]=En):En=t[106];let Dn;t[107]!==De||t[108]!==Te?(Dn=e=>Te===null?Promise.resolve({ok:!1,report:{actions:[],conflicts:[],withheld:[]},snapshot:null}):De(z(Te,e===void 0?[]:e)),t[107]=De,t[108]=Te,t[109]=Dn):Dn=t[109];let On;t[110]!==Te||t[111]!==Cn||t[112]!==wn||t[113]!==Tn||t[114]!==Dn?(On=(0,$.jsx)(j,{connection:Te,paired:wn,open:Tn,onOpenChange:En,onRemove:Dn},Cn),t[110]=Te,t[111]=Cn,t[112]=wn,t[113]=Tn,t[114]=Dn,t[115]=On):On=t[115];let kn;return t[116]!==on||t[117]!==ln||t[118]!==mn||t[119]!==hn||t[120]!==gn||t[121]!==_n||t[122]!==Sn||t[123]!==On?(kn=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-configure-agents-title`,className:`space-y-6`,"data-field":`section:agent-connections`,"data-testid":`settings-configure-agents`,children:[ln,mn,hn,gn,_n,on,Sn,On]}),t[116]=on,t[117]=ln,t[118]=mn,t[119]=hn,t[120]=gn,t[121]=_n,t[122]=Sn,t[123]=On,t[124]=kn):kn=t[124],kn}function Po(e){return e+1}function Fo(e){return e.node}function Io(e,t){return Number(t.hasPresent)-Number(e.hasPresent)}function Lo(e){return!e}function Ro(e){return!e}function zo(e){return e!==void 0}function Bo(e){return Ct(e.id)}function Vo(e){return e!==void 0}function Ho(e){return Oo(e)}function Uo(e){let{signal:t}=e;return ut(t)}var Wo=`open-knowledge-app`;function Go({from:e,to:t}){try{bn.getTracer(Wo).startSpan(`ok.language.preferenceChanged`,{attributes:{"ok.language.from":e,"ok.language.to":t}}).end()}catch(e){console.warn(`[language-telemetry] span emit failed:`,e instanceof Error?e:String(e))}}var Ko=`open-knowledge-app`;function qo(e){let t=e.light.startsWith(`saved-`),n=e.dark.startsWith(`saved-`);return!t||!n?`incomplete`:e.light===e.dark?`same`:`different`}function Jo(e){try{bn.getTracer(Ko).startSpan(`ok.saved_themes.assignment`,{attributes:{"saved_theme.pair":qo(e)}}).end()}catch(e){console.warn(`[saved-theme-telemetry] assignment span emit failed:`,e instanceof Error?e:String(e))}}var Yo=`system`;function Xo(e){return typeof e==`string`&&gn.includes(e)}function Zo(e){return Xo(e)?e:Yo}function Qo(e){return new Intl.DisplayNames([e],{type:`language`}).of(e)??e}function $o(e){let t=(0,Q.c)(6),{choice:n}=e;if(n===Yo){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(m,{id:`D-NlUC`}),t[0]=e):e=t[0],e}let r;t[1]===n?r=t[2]:(r=Qo(n),t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=(0,$.jsx)(`span`,{lang:n,className:`capitalize`,children:r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function es(e){let t=(0,Q.c)(22),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({value:o,onValueChange:r,onBlur:n,ref:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===o?s=t[7]:(s=Zo(o),t[6]=o,t[7]=s);let c=s,l;t[8]===r?l=t[9]:(l=e=>r(Zo(e)),t[8]=r,t[9]=l);let u;t[10]===c?u=t[11]:(u=(0,$.jsx)(We,{children:(0,$.jsx)($o,{choice:c})}),t[10]=c,t[11]=u);let d;t[12]!==n||t[13]!==i||t[14]!==a||t[15]!==u?(d=(0,$.jsx)(Ue,{...a,ref:i,onBlur:n,size:`sm`,className:`w-48`,children:u}),t[12]=n,t[13]=i,t[14]=a,t[15]=u,t[16]=d):d=t[16];let f;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsxs)(He,{children:[(0,$.jsx)(Ve,{value:Yo,children:(0,$.jsx)($o,{choice:Yo})}),cn.map(ts)]}),t[17]=f):f=t[17];let p;return t[18]!==c||t[19]!==l||t[20]!==d?(p=(0,$.jsxs)(Ge,{value:c,onValueChange:l,children:[d,f]}),t[18]=c,t[19]=l,t[20]=d,t[21]=p):p=t[21],p}function ts(e){return(0,$.jsx)(Ve,{value:e,children:(0,$.jsx)($o,{choice:e})},e)}function ns(e){return{chrome:e.sidebar,surface:e.background,bar:e.primary,line:e.border,dots:[e[`syntax-string`],e[`syntax-keyword`],e[`syntax-atom`]]}}function rs(e,t,n){return e.id===`custom`?ns(Zt(Ji(t))):e.scheme?ns(Zt(e.scheme)):ns(Hi(n))}function is(e){let t=(0,Q.c)(38),{theme:n,customSeed:r,slotMode:i}=e,a,o,s,c,l,u,d,f,p,m;t[0]!==r||t[1]!==i||t[2]!==n?(a=rs(n,r,i),u=!0,d=``,f=`aspect-[4/3] w-full overflow-hidden rounded-md border`,p={backgroundColor:a.surface,borderColor:a.line},m=(0,$.jsxs)(`div`,{className:`flex h-1/3 items-center gap-1 px-1.5`,style:{backgroundColor:a.chrome,borderBottom:`1px solid ${a.line}`},children:[(0,$.jsx)(`span`,{className:`h-1.5 w-5 rounded-full`,style:{backgroundColor:a.bar}}),(0,$.jsx)(`span`,{className:`h-1.5 flex-1 rounded-full opacity-50`,style:{backgroundColor:a.line}})]}),l=`flex h-2/3`,o=`flex w-1/4 flex-col items-center justify-center gap-1`,s={backgroundColor:a.chrome,borderRight:`1px solid ${a.line}`},c=a.dots.map(as),t[0]=r,t[1]=i,t[2]=n,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m):(a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12]);let h;t[13]!==o||t[14]!==s||t[15]!==c?(h=(0,$.jsx)(`div`,{className:o,style:s,children:c}),t[13]=o,t[14]=s,t[15]=c,t[16]=h):h=t[16];let g;t[17]===a.dots[1]?g=t[18]:(g=(0,$.jsx)(`span`,{className:`h-1.5 w-3/4 rounded-full`,style:{backgroundColor:a.dots[1]}}),t[17]=a.dots[1],t[18]=g);let _;t[19]===a.line?_=t[20]:(_=(0,$.jsx)(`span`,{className:`h-1.5 w-1/2 rounded-full opacity-60`,style:{backgroundColor:a.line}}),t[19]=a.line,t[20]=_);let v;t[21]===a.dots[0]?v=t[22]:(v=(0,$.jsx)(`span`,{className:`h-1.5 w-2/3 rounded-full`,style:{backgroundColor:a.dots[0]}}),t[21]=a.dots[0],t[22]=v);let y;t[23]!==g||t[24]!==_||t[25]!==v?(y=(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col justify-center gap-1 px-1.5`,children:[g,_,v]}),t[23]=g,t[24]=_,t[25]=v,t[26]=y):y=t[26];let b;t[27]!==h||t[28]!==y||t[29]!==l?(b=(0,$.jsxs)(`div`,{className:l,children:[h,y]}),t[27]=h,t[28]=y,t[29]=l,t[30]=b):b=t[30];let x;return t[31]!==b||t[32]!==u||t[33]!==d||t[34]!==f||t[35]!==p||t[36]!==m?(x=(0,$.jsxs)(`div`,{"aria-hidden":u,"data-theme-swatch":d,className:f,style:p,children:[m,b]}),t[31]=b,t[32]=u,t[33]=d,t[34]=f,t[35]=p,t[36]=m,t[37]=x):x=t[37],x}function as(e,t){return(0,$.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{backgroundColor:e}},t)}function os(e){return b(`size-6 min-w-6 rounded-md border p-0 transition-colors`,e?`border-primary bg-primary/15 text-primary hover:bg-primary/20 data-[state=on]:bg-primary/15`:`border-border/70 text-muted-foreground/70 hover:text-foreground`)}function ss(e){return b(`size-3.5`,e&&`fill-current`)}function cs(e){let t=(0,Q.c)(33),{selection:n,themes:r,unavailableThemes:i,onAssign:a,editControl:o,deleteControl:s,createControl:c,slotMode:l,customSeed:u,firstItemId:d,"aria-label":f,"aria-describedby":p,"aria-invalid":m}=e,g=r===void 0?an:r,_;t[0]===i?_=t[1]:(_=i===void 0?[]:i,t[0]=i,t[1]=_);let v=_,y=l===void 0?`light`:l,{_:x}=h(),S;if(t[2]!==x||t[3]!==u||t[4]!==s||t[5]!==o||t[6]!==d||t[7]!==a||t[8]!==n||t[9]!==y||t[10]!==g){let e;t[12]!==x||t[13]!==u||t[14]!==s||t[15]!==o||t[16]!==d||t[17]!==a||t[18]!==n||t[19]!==y?(e=(e,t)=>{let r=n.light===e.id,i=n.dark===e.id,c=o?.themeIds.includes(e.id)??!1,l=s?.themeIds.includes(e.id)??!1,f=o?.selectedId===e.id,p=x(y===`light`?{id:`hgF0al`,values:{0:e.label}}:{id:`6Nea1q`,values:{0:e.label}});return(0,$.jsxs)(`fieldset`,{"aria-label":e.label,className:b(`relative flex min-w-0 flex-col gap-1.5 rounded-lg border-2 p-1 text-left`,n[y]===e.id?`border-primary`:`border-transparent`),children:[(0,$.jsx)(H,{type:`button`,variant:`ghost`,"aria-label":p,"data-theme-focus-target":``,onClick:()=>a(y,e.id),className:`h-auto w-full cursor-pointer p-0 transition-opacity hover:bg-transparent hover:opacity-90`,children:(0,$.jsx)(is,{theme:e,customSeed:u,slotMode:y})}),l?(0,$.jsx)(H,{type:`button`,variant:`outline`,size:`icon-sm`,title:x({id:`Y2tU6I`,values:{0:e.label}}),"aria-label":x({id:`Y2tU6I`,values:{0:e.label}}),className:`absolute top-2 end-2 z-10 border-border/80 bg-background/85 text-muted-foreground shadow-sm backdrop-blur-sm hover:border-destructive/50 hover:bg-destructive/15 hover:text-destructive focus-visible:border-destructive/50 focus-visible:text-destructive focus-visible:ring-destructive/20 dark:bg-background/80 dark:hover:bg-destructive/20`,onClick:async t=>{let n=t.currentTarget.closest(`fieldset`),r=n?.previousElementSibling?.querySelector(`[data-theme-focus-target]`)??n?.nextElementSibling?.querySelector(`[data-theme-focus-target]`);await s?.onDelete(e.id)!==!1&&r?.focus()},children:(0,$.jsx)(di,{"aria-hidden":!0})}):null,(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-1 px-0.5`,children:[(0,$.jsx)(`span`,{className:`truncate text-1sm font-medium text-foreground`,children:e.label}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[c?(0,$.jsx)(Xe,{className:os(f),pressed:f,onPressedChange:t=>{o?.onSelect(t?e.id:null)},"aria-label":x(f?{id:`8x6zk9`,values:{0:e.label}}:{id:`N6j2JH`,values:{0:e.label}}),children:(0,$.jsx)(Pn,{className:`size-3.5`})}):null,(0,$.jsx)(Xe,{id:t===0?d:void 0,className:os(r),pressed:r,onPressedChange:t=>{t&&a(`light`,e.id)},"aria-label":x({id:`sq4WQH`,values:{0:e.label}}),children:(0,$.jsx)(Er,{className:ss(r)})}),(0,$.jsx)(Xe,{className:os(i),pressed:i,onPressedChange:t=>{t&&a(`dark`,e.id)},"aria-label":x({id:`lZvQrY`,values:{0:e.label}}),children:(0,$.jsx)(Dr,{className:ss(i)})})]})]})]},e.id)},t[12]=x,t[13]=u,t[14]=s,t[15]=o,t[16]=d,t[17]=a,t[18]=n,t[19]=y,t[20]=e):e=t[20],S=g.map(e),t[2]=x,t[3]=u,t[4]=s,t[5]=o,t[6]=d,t[7]=a,t[8]=n,t[9]=y,t[10]=g,t[11]=S}else S=t[11];let C;t[21]!==x||t[22]!==c?(C=c?(0,$.jsxs)(H,{type:`button`,variant:`ghost`,onClick:c.onCreate,className:`group h-auto min-w-0 flex-col items-stretch gap-1.5 rounded-lg border-2 border-transparent p-1 text-left text-muted-foreground hover:bg-transparent hover:text-foreground`,children:[(0,$.jsx)(`span`,{className:`flex aspect-[4/3] w-full items-center justify-center rounded-md border border-dashed border-border bg-muted/10 transition-colors group-hover:border-foreground/40`,children:(0,$.jsx)(Mn,{"aria-hidden":!0,className:`size-6`})}),(0,$.jsx)(`span`,{className:`truncate px-0.5 text-1sm font-medium`,children:x({id:`AJ7_B2`})})]}):null,t[21]=x,t[22]=c,t[23]=C):C=t[23];let w;t[24]===v?w=t[25]:(w=v.map(ls),t[24]=v,t[25]=w);let T;return t[26]!==p||t[27]!==m||t[28]!==f||t[29]!==S||t[30]!==C||t[31]!==w?(T=(0,$.jsxs)(`fieldset`,{"aria-label":f,"aria-describedby":p,"aria-invalid":m,className:`grid w-full min-w-0 grid-cols-2 gap-2 sm:grid-cols-3`,children:[S,C,w]}),t[26]=p,t[27]=m,t[28]=f,t[29]=S,t[30]=C,t[31]=w,t[32]=T):T=t[32],T}function ls(e){return(0,$.jsxs)(`fieldset`,{"aria-label":e.label,className:`flex min-w-0 flex-col gap-1.5 rounded-lg border-2 border-destructive/40 bg-destructive/5 p-1 text-left`,children:[(0,$.jsx)(`div`,{"aria-hidden":!0,className:`flex aspect-[4/3] w-full items-center justify-center rounded-md border border-destructive/30 bg-muted/40 text-destructive`,children:(0,$.jsx)(fr,{className:`size-6`})}),(0,$.jsx)(`span`,{className:`truncate px-0.5 text-1sm font-medium text-foreground`,children:e.label}),(0,$.jsx)(`span`,{className:`px-0.5 text-xs font-medium text-destructive`,children:e.problem}),(0,$.jsx)(`span`,{className:`px-0.5 pb-0.5 text-xs text-muted-foreground`,children:e.detail})]},e.key)}var us=12e3;function ds(e){let t=(0,Q.c)(210),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({appearance:n,onAssign:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{_:a}=h(),{themes:o,warnings:s,truncated:c,loadError:l,refresh:u,deleteTheme:d,restoreTheme:f,editingThemeId:p,themeEditorOpen:m,selectThemeToEdit:g}=ji(),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(``),[x,S]=(0,Z.useState)(null),[C,w]=(0,Z.useState)(!1),T=(0,Z.useRef)(null),E,D;t[4]===u?(E=t[5],D=t[6]):(E=()=>{u()},D=[u],t[4]=u,t[5]=E,t[6]=D),(0,Z.useEffect)(E,D);let O;t[7]!==n||t[8]!==o?(O=Ot(n,o),t[7]=n,t[8]=o,t[9]=O):O=t[9];let k=O,A,j,M,N,P,F,I,L,R,z,B,V,U,W,G,K,ee,te,q,J,ne;if(t[10]!==a||t[11]!==x||t[12]!==y||t[13]!==_||t[14]!==d||t[15]!==p||t[16]!==C||t[17]!==l||t[18]!==r||t[19]!==i||t[20]!==u||t[21]!==f||t[22]!==g||t[23]!==k||t[24]!==m||t[25]!==o||t[26]!==c||t[27]!==s){let e=$t(y),n;t[49]===o?n=t[50]:(n=o.filter(gs),t[49]=o,t[50]=n);let h=n,E,D,O,re,ie,ae,oe,se,ce;if(t[51]!==a||t[52]!==y||t[53]!==d||t[54]!==p||t[55]!==h||t[56]!==C||t[57]!==l||t[58]!==r||t[59]!==i||t[60]!==u||t[61]!==f||t[62]!==g||t[63]!==k||t[64]!==m||t[65]!==o||t[66]!==c||t[67]!==s){let e=o.flatMap(hs),n;t[80]!==a||t[81]!==u||t[82]!==f?(n=async function(e){let t=await f({id:e.id,name:e.scheme.name,stem:e.stem,scheme:{...e.scheme,palette:{...e.scheme.palette}},extension:e.filename.endsWith(`.yml`)?`.yml`:`.yaml`});if(t.ok){await u(),X.success(a({id:`Kx881F`,values:{0:e.label}}));return}if(t.reason===`name-taken`){X.error(a({id:`oZUYMv`,values:{0:e.label}}));return}X.error(a({id:`7O7REc`,values:{0:e.label}}))},t[80]=a,t[81]=u,t[82]=f,t[83]=n):n=t[83];let _=n;O=async function(t){let n=e.find(e=>e.id===t);if(!n)return X.error(a({id:`ANFxWn`})),!1;let r=await d(n.id);if(!r.ok)return X.error(a({id:`kkux8f`,values:{0:n.label}})),!1;if(p===n.id&&g(null),await u(),!r.existed)return X(a({id:`ekSPiP`,values:{0:n.label}})),!0;let i={...n,filename:r.filename,label:r.scheme.name,scheme:r.scheme};return X(a({id:`YCmS3k`,values:{0:i.label}}),{duration:us,action:{label:a({id:`9uI_rE`}),onClick:()=>_(i)}}),!0};let x;t[84]!==a||t[85]!==y||t[86]!==C||t[87]!==r||t[88]!==i||t[89]!==u||t[90]!==f||t[91]!==g||t[92]!==k||t[93]!==o?(x=async function(e){if(e.preventDefault(),C)return;let t=$t(y);if(!t.ok){S(a({id:`RG3yW6`})),T.current?.focus();return}let n=i.slotMode??`light`,s=o.find(e=>e.id===k[n])?.scheme??Ji(i.customSeed),c={name:t.name,variant:s.variant,palette:{...s.palette}};S(null),w(!0);let l=await f({id:t.id,name:t.name,scheme:c});if(!l.ok){S(l.reason===`name-taken`?a({id:`_IfSZn`}):l.reason===`name-invalid`?a({id:`qtnmEX`}):a({id:`DmkTrb`})),w(!1),T.current?.focus();return}let d={id:l.id,label:c.name,kind:c.variant,scheme:c,toTokens:()=>Zt(c)};r(n,l.id,k,[...o,d]),await u(),b(``),v(!1),w(!1),g(l.id)},t[84]=a,t[85]=y,t[86]=C,t[87]=r,t[88]=i,t[89]=u,t[90]=f,t[91]=g,t[92]=k,t[93]=o,t[94]=x):x=t[94],D=x;let A;if(t[95]!==a||t[96]!==s){let e;t[98]===a?e=t[99]:(e=e=>{let t;bb90:switch(e.code){case`unparseable`:t=a({id:`g12y1g`});break bb90;case`not-a-scheme`:t=a({id:`p7Utw8`});break bb90;case`missing-slots`:t=a({id:`GUZHkL`});break bb90;case`bad-hex`:t=a({id:`IMLUBh`});break bb90;case`empty`:t=a({id:`k_tFzX`});break bb90;case`too-long`:t=a({id:`FyyIjH`});break bb90;case`invalid-chars`:t=a({id:`JaU1ld`});break bb90;case`unsupported-extension-case`:t=a({id:`R30SFt`});break bb90;case`duplicate-identity`:t=a({id:`DUb7Ax`});break bb90;case`symlink`:t=a({id:`hFmYGU`});break bb90;case`not-regular-file`:t=a({id:`UH0Zqw`});break bb90;case`file-too-large`:t=a({id:`-othoN`});break bb90;case`read-failed`:t=a({id:`cLn264`});break bb90;default:t=a({id:`WBNpt9`,values:{0:e.code}})}return{key:e.filename,label:e.filename,problem:t,detail:e.conflictingFilenames?a({id:`QwG_zJ`,values:{0:e.conflictingFilenames.join(`, `)}}):a({id:`kwNS82`})}},t[98]=a,t[99]=e),A=s.map(e),t[95]=a,t[96]=s,t[97]=A}else A=t[97];let j=A;V=`flex w-full min-w-0 flex-col gap-2`,t[100]!==a||t[101]!==l||t[102]!==u?(U=l?(0,$.jsxs)(`div`,{role:`alert`,className:`flex items-center justify-between gap-2 rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-foreground`,children:[(0,$.jsx)(`span`,{children:a({id:`hVzt9x`})}),(0,$.jsx)(H,{type:`button`,variant:`outline`,size:`xs`,onClick:()=>void u(),children:a({id:`KDw4GX`})})]}):null,t[100]=a,t[101]=l,t[102]=u,t[103]=U):U=t[103];let M;t[104]!==a||t[105]!==c?(M=c?(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-sm text-foreground`,children:[(0,$.jsx)(fi,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-amber-600`}),(0,$.jsx)(`span`,{children:a({id:`DLIljL`})})]}):null,t[104]=a,t[105]=c,t[106]=M):M=t[106],t[107]===M?W=t[108]:(W=(0,$.jsx)(`div`,{role:`status`,children:M}),t[107]=M,t[108]=W),E=cs,ie=i,ae=k,oe=h,se=j;let N;t[109]===o?N=t[110]:(N=o.filter(ms).map(ps),t[109]=o,t[110]=N);let P=m?p:null;t[111]!==g||t[112]!==N||t[113]!==P?(ce={themeIds:N,selectedId:P,onSelect:g},t[111]=g,t[112]=N,t[113]=P,t[114]=ce):ce=t[114],re=e.map(fs),t[51]=a,t[52]=y,t[53]=d,t[54]=p,t[55]=h,t[56]=C,t[57]=l,t[58]=r,t[59]=i,t[60]=u,t[61]=f,t[62]=g,t[63]=k,t[64]=m,t[65]=o,t[66]=c,t[67]=s,t[68]=E,t[69]=D,t[70]=O,t[71]=V,t[72]=U,t[73]=W,t[74]=re,t[75]=ie,t[76]=ae,t[77]=oe,t[78]=se,t[79]=ce}else E=t[68],D=t[69],O=t[70],V=t[71],U=t[72],W=t[73],re=t[74],ie=t[75],ae=t[76],oe=t[77],se=t[78],ce=t[79];let le;t[115]!==O||t[116]!==re?(le={themeIds:re,onDelete:O},t[115]=O,t[116]=re,t[117]=le):le=t[117];let ue;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(ue={onCreate:()=>v(!0)},t[118]=ue):ue=t[118];let de;t[119]!==r||t[120]!==k||t[121]!==o?(de=(e,t)=>r(e,t,k,o),t[119]=r,t[120]=k,t[121]=o,t[122]=de):de=t[122],t[123]!==E||t[124]!==ie||t[125]!==ae||t[126]!==oe||t[127]!==se||t[128]!==ce||t[129]!==le||t[130]!==de?(G=(0,$.jsx)(E,{...ie,selection:ae,themes:oe,unavailableThemes:se,editControl:ce,deleteControl:le,createControl:ue,onAssign:de}),t[123]=E,t[124]=ie,t[125]=ae,t[126]=oe,t[127]=se,t[128]=ce,t[129]=le,t[130]=de,t[131]=G):G=t[131],P=Si,z=_,t[132]===C?B=t[133]:(B=e=>{C||v(e)},t[132]=C,t[133]=B),N=_i;let fe;t[134]===a?fe=t[135]:(fe=a({id:`Z_nNa2`}),t[134]=a,t[135]=fe);let pe;t[136]===fe?pe=t[137]:(pe=(0,$.jsx)(gi,{children:fe}),t[136]=fe,t[137]=pe);let me;t[138]===a?me=t[139]:(me=a({id:`nTM8ab`}),t[138]=a,t[139]=me);let he;t[140]===me?he=t[141]:(he=(0,$.jsx)(hi,{children:me}),t[140]=me,t[141]=he),t[142]!==pe||t[143]!==he?(R=(0,$.jsxs)(xi,{className:`gap-2`,children:[pe,he]}),t[142]=pe,t[143]=he,t[144]=R):R=t[144],M=vi,F=`create-saved-theme-form`,I=!0,L=D,j=Ei,q=x!==null;let ge;t[145]===a?ge=t[146]:(ge=a({id:`HZ7fEu`}),t[145]=a,t[146]=ge),t[147]===ge?J=t[148]:(J=(0,$.jsx)(wi,{htmlFor:`create-saved-theme-name`,children:ge}),t[147]=ge,t[148]=J);let _e=x!==null,ve=x?`create-saved-theme-help create-saved-theme-error`:`create-saved-theme-help`,ye;t[149]===x?ye=t[150]:(ye=e=>{b(e.target.value),x&&S(null)},t[149]=x,t[150]=ye),t[151]!==y||t[152]!==C||t[153]!==_e||t[154]!==ve||t[155]!==ye?(ne=(0,$.jsx)(Pi,{ref:T,id:`create-saved-theme-name`,value:y,autoFocus:!0,autoComplete:`off`,required:!0,readOnly:C,"aria-invalid":_e,"aria-describedby":ve,onChange:ye}),t[151]=y,t[152]=C,t[153]=_e,t[154]=ve,t[155]=ye,t[156]=ne):ne=t[156],A=Ti,K=`create-saved-theme-help`,ee=`font-mono`,te=e.ok?a({id:`Yb82LN`,values:{0:e.stem}}):a({id:`4d0VYJ`}),t[10]=a,t[11]=x,t[12]=y,t[13]=_,t[14]=d,t[15]=p,t[16]=C,t[17]=l,t[18]=r,t[19]=i,t[20]=u,t[21]=f,t[22]=g,t[23]=k,t[24]=m,t[25]=o,t[26]=c,t[27]=s,t[28]=A,t[29]=j,t[30]=M,t[31]=N,t[32]=P,t[33]=F,t[34]=I,t[35]=L,t[36]=R,t[37]=z,t[38]=B,t[39]=V,t[40]=U,t[41]=W,t[42]=G,t[43]=K,t[44]=ee,t[45]=te,t[46]=q,t[47]=J,t[48]=ne}else A=t[28],j=t[29],M=t[30],N=t[31],P=t[32],F=t[33],I=t[34],L=t[35],R=t[36],z=t[37],B=t[38],V=t[39],U=t[40],W=t[41],G=t[42],K=t[43],ee=t[44],te=t[45],q=t[46],J=t[47],ne=t[48];let re;t[157]!==A||t[158]!==K||t[159]!==ee||t[160]!==te?(re=(0,$.jsx)(A,{id:K,className:ee,children:te}),t[157]=A,t[158]=K,t[159]=ee,t[160]=te,t[161]=re):re=t[161];let ie;t[162]===x?ie=t[163]:(ie=x?(0,$.jsx)(Ci,{id:`create-saved-theme-error`,children:x}):null,t[162]=x,t[163]=ie);let ae;t[164]!==j||t[165]!==re||t[166]!==ie||t[167]!==q||t[168]!==J||t[169]!==ne?(ae=(0,$.jsxs)(j,{"data-invalid":q,children:[J,ne,re,ie]}),t[164]=j,t[165]=re,t[166]=ie,t[167]=q,t[168]=J,t[169]=ne,t[170]=ae):ae=t[170];let oe;t[171]!==F||t[172]!==I||t[173]!==L||t[174]!==ae?(oe=(0,$.jsx)(`form`,{id:F,noValidate:I,onSubmit:L,children:ae}),t[171]=F,t[172]=I,t[173]=L,t[174]=ae,t[175]=oe):oe=t[175];let se;t[176]!==M||t[177]!==oe?(se=(0,$.jsx)(M,{children:oe}),t[176]=M,t[177]=oe,t[178]=se):se=t[178];let ce;t[179]===Symbol.for(`react.memo_cache_sentinel`)?(ce=()=>v(!1),t[179]=ce):ce=t[179];let le;t[180]===a?le=t[181]:(le=a({id:`dEgA5A`}),t[180]=a,t[181]=le);let ue;t[182]!==C||t[183]!==le?(ue=(0,$.jsx)(H,{type:`button`,variant:`outline`,disabled:C,onClick:ce,children:le}),t[182]=C,t[183]=le,t[184]=ue):ue=t[184];let de;t[185]!==a||t[186]!==C?(de=a(C?{id:`_DwR-n`}:{id:`cuHhjo`}),t[185]=a,t[186]=C,t[187]=de):de=t[187];let fe;t[188]!==C||t[189]!==de?(fe=(0,$.jsx)(H,{type:`submit`,form:`create-saved-theme-form`,disabled:C,children:de}),t[188]=C,t[189]=de,t[190]=fe):fe=t[190];let pe;t[191]!==ue||t[192]!==fe?(pe=(0,$.jsxs)(yi,{children:[ue,fe]}),t[191]=ue,t[192]=fe,t[193]=pe):pe=t[193];let me;t[194]!==N||t[195]!==R||t[196]!==se||t[197]!==pe?(me=(0,$.jsxs)(N,{children:[R,se,pe]}),t[194]=N,t[195]=R,t[196]=se,t[197]=pe,t[198]=me):me=t[198];let he;t[199]!==P||t[200]!==z||t[201]!==B||t[202]!==me?(he=(0,$.jsx)(P,{open:z,onOpenChange:B,children:me}),t[199]=P,t[200]=z,t[201]=B,t[202]=me,t[203]=he):he=t[203];let ge;return t[204]!==V||t[205]!==U||t[206]!==W||t[207]!==G||t[208]!==he?(ge=(0,$.jsxs)(`div`,{className:V,children:[U,W,G,he]}),t[204]=V,t[205]=U,t[206]=W,t[207]=G,t[208]=he,t[209]=ge):ge=t[209],ge}function fs(e){return e.id}function ps(e){return e.id}function ms(e){return e.id.startsWith(`saved-`)}function hs(e){let t=Mt(e.id);return!t.ok||!e.scheme?[]:[{id:e.id,stem:t.stem,label:e.label,scheme:e.scheme}]}function gs(e){return e.id!==`custom`}function _s(e,t){if(e.length===0)throw Error(`buildPatch: path must be non-empty`);let[n,...r]=e;return r.length===0?{[String(n)]:t}:{[String(n)]:_s(r,t)}}function vs(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(e?.type===`default`){let t=e.defaultValue;return typeof t==`function`?t():t}let n=t?._zod?.def?.innerType;if(n===void 0)return;t=n}}function ys(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(!e)return;if(e.type===`default`||e.type===`optional`||e.type===`nullable`){t=e.innerType;continue}return e.type}}function bs(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(!e)return;if(e.type===`enum`)return e.entries?Object.values(e.entries):void 0;if(e.innerType!==void 0){t=e.innerType;continue}return}}function xs(e){let t=(0,Q.c)(14),n;t[0]===e?n=t[1]:(n=e.current(),t[0]=e,t[1]=n);let r=n,i;t[2]===r?i=t[3]:(i={defaultValues:r,mode:`onBlur`},t[2]=r,t[3]=i);let a=Oa(i),o,s;t[4]!==e||t[5]!==a?(o=()=>e.subscribe(e=>{Ss(a,e)}),s=[e,a],t[4]=e,t[5]=a,t[6]=o,t[7]=s):(o=t[6],s=t[7]),(0,Z.useEffect)(o,s);let c;t[8]!==e||t[9]!==a?(c=t=>Cs(a,e,t),t[8]=e,t[9]=a,t[10]=c):c=t[10];let l=c,u;return t[11]!==l||t[12]!==a?(u={form:a,commitField:l},t[11]=l,t[12]=a,t[13]=u):u=t[13],u}function Ss(e,t){e.reset(t,{keepDirtyValues:!0,keepDirty:!0,keepTouched:!0})}function Cs(e,t,n){let r=e.getValues(n),i=_s(Es(n),r),a=t.patch(i);if(a.ok)return e.clearErrors(n),e.resetField(n,{defaultValue:r,keepError:!1}),!0;if(vt(a.error)&&a.error.code===`SCHEMA_INVALID`&&a.error.issues.length>0){e.clearErrors(n);for(let t of a.error.issues){let r=t.path.length>0?t.path.map(String).join(`.`):n;e.setError(r,{type:`config-binding`,message:t.message})}}else e.setError(n,{type:`config-binding`,message:ws(a.error,n)});return!1}function ws(e,t){if(vt(e)&&e.code===`SCHEMA_INVALID`){let n=e.issues.find(e=>Ts(e,t));if(n)return n.message}return _n(e)}function Ts(e,t){return e.path.map(String).join(`.`)===t}function Es(e){return e.split(`.`)}function Ds(e){if(!vt(e)||e.code!==`SCHEMA_INVALID`)return null;let t=e.issues[0];return!t||t.path.length===0?null:t.path.map(String).join(`.`)}function Os(){let e=(0,Q.c)(3),t,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(ia,{className:`h-5 w-32`}),n=(0,$.jsx)(ia,{className:`h-4 w-64`}),e[0]=t,e[1]=n):(t=e[0],n=e[1]);let r;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsxs)(`div`,{className:`space-y-3`,children:[t,n,(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(ia,{className:`h-9 w-full`}),(0,$.jsx)(ia,{className:`h-9 w-full`})]})]}),e[2]=r):r=e[2],r}function ks({field:e,scope:t,commitField:n,isFlashed:r}){"use no memo";let{_:i}=h(),a=Ma(),{setTheme:o}=_(),s=Fn(),c=Lt(St,e.path),l=c?ys(c):void 0,u=c?vs(c):void 0,d=c?bs(c):void 0,f=c?Kt(c):void 0,p=f?.scope===`project`&&t!==`project`||f?.scope===`user`&&t!==`user`,g=e.path.join(`.`),v=i(e.label),[y,x]=(0,Z.useState)(!1),S=(0,Z.useRef)(null);(0,Z.useEffect)(()=>()=>{S.current&&clearTimeout(S.current)},[]);let C=()=>{x(!0),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>x(!1),1200)},w=()=>{let e=n(g);return e&&C(),e},T=()=>a.getFieldState(g).isDirty?w():!0,E=()=>{if(e.control===`theme-tiles`){let e=s?.userBinding;if(!e)return;let t=e.patch({appearance:Vi()});t.ok?C():a.setError(g,{type:`manual`,message:ws(t.error,g)});return}let t=u===void 0?null:u;a.setValue(g,t,{shouldDirty:!1}),e.control===`theme-cards`&&o(Ln(t)),w()},D=b(`relative`,r&&`animate-settings-flash`);return(0,$.jsx)(ka,{control:a.control,name:g,render:({field:n})=>{let r=!p&&(u!==void 0||n.value!==void 0);return(0,$.jsxs)(Da,{className:D,"data-field":e.path.join(`.`),"data-scope":t,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(ja,{className:`text-sm font-medium`,children:v}),r?(0,$.jsxs)(K,{children:[(0,$.jsx)(U,{asChild:!0,children:(0,$.jsx)(H,{variant:`ghost`,size:`icon`,className:`h-5 w-5 text-muted-foreground opacity-60 hover:opacity-100`,onClick:E,"aria-label":i({id:`lhjq3G`,values:{labelText:v}}),children:(0,$.jsx)(li,{className:`size-3.5`})})}),(0,$.jsx)(W,{children:(0,$.jsx)(m,{id:`L-rMC9`})})]}):null]}),e.description?(0,$.jsx)(Na,{className:`text-muted-foreground text-1sm`,children:i(e.description)}):null,(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Aa,{children:(0,$.jsx)(js,{field:e,ctl:n,typeTag:l,enumOptions:d,onCommit:T,onRevertToBaseline:()=>a.resetField(g,{keepError:!0}),onSavedOutsideForm:C,onWriteRejected:e=>{a.setError(g,{type:`manual`,message:ws(e,g)})}})}),(0,$.jsx)(Fs,{visible:y,srOnly:As(e.control)})]}),(0,$.jsx)(Pa,{"data-field-error":e.path.join(`.`)})]})}})}function As(e){return e===`theme-tiles`||e===`theme-cards`}function js({field:e,ctl:t,typeTag:n,enumOptions:r,onCommit:i,onRevertToBaseline:a,onSavedOutsideForm:o,onWriteRejected:s,...c}){"use no memo";let{_:l}=h(),{setTheme:u,systemTheme:d}=_(),f=Fn(),p=f?.merged??null;if(e.control===`language-select`)return(0,$.jsx)(es,{...c,value:t.value,ref:t.ref,onBlur:t.onBlur,onValueChange:e=>{let n=Yi(t.value)??`system`;n!==e&&Go({from:n,to:e}),t.onChange(e),i()}});if(e.control===`theme-cards`){let{id:n,...r}=c;return(0,$.jsx)(Or,{...r,firstItemId:n,value:Ln(t.value),"aria-label":l(e.label),onValueChange:e=>{let n=Ln(t.value);u(e),t.onChange(e),!i()&&(u(n),a())}})}if(e.control===`theme-tiles`){let{id:t,...n}=c,r=p?.appearance?.customTheme,i=p?.appearance?.theme,a=ht(i,d===`dark`);return(0,$.jsx)(ds,{...n,firstItemId:t,appearance:p?.appearance,customSeed:r,slotMode:a,"aria-label":l(e.label),onAssign:(e,t,n,c)=>{let l=f?.userBinding;if(!l)return;let d={...n,[e]:t},p=e=>{let t=e[a];return t===`custom`?Wi(Ji(r)):Bi(t,c)};zi({selection:d,modePreference:i,slotMode:a,customSeed:r,themes:c}),u(p(d)??i??`system`);let m=l.patch({appearance:Gi(d)});if(m.ok){Jo(d),o();return}zi({selection:n,modePreference:i,slotMode:a,customSeed:r,themes:c}),u(p(n)??i??`system`),s(m.error)}})}if(n===`boolean`)return(0,$.jsx)(Je,{...c,checked:!!t.value,ref:t.ref,onCheckedChange:e=>{t.onChange(e),i()},onBlur:t.onBlur});if(n===`enum`&&r&&r.length>0&&(e.control===`enum-toggle`||r.length<=4)){let{id:n,...a}=c;return(0,$.jsx)(Ze,{...a,type:`single`,value:typeof t.value==`string`?t.value:``,ref:t.ref,onValueChange:e=>{e&&(t.onChange(e),i())},onBlur:t.onBlur,variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-lg`,"aria-label":l(e.label),children:r.map((e,t)=>(0,$.jsx)(Ye,{value:e,id:t===0?n:void 0,className:`text-1sm capitalize`,children:e},e))})}return n===`number`||n===`int`?(0,$.jsx)(Ns,{ctl:t,onCommit:i,...c}):n===`array`?(0,$.jsx)(Ps,{ctl:t,onCommit:i,...c}):(0,$.jsx)(Ms,{ctl:t,onCommit:i,...c})}function Ms({ctl:e,onCommit:t,...n}){"use no memo";return(0,$.jsx)(Pi,{...n,value:typeof e.value==`string`?e.value:``,ref:e.ref,onChange:t=>e.onChange(t.target.value),onBlur:()=>{e.onBlur(),t()},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),t())},className:`h-8 text-sm`})}function Ns({ctl:e,onCommit:t,...n}){"use no memo";let[r,i]=(0,Z.useState)(e.value===void 0?``:String(e.value)),a=(0,Z.useRef)(e.value);(0,Z.useEffect)(()=>{a.current!==e.value&&(i(e.value===void 0?``:String(e.value)),a.current=e.value)},[e.value]);let o=()=>{let n=Number(r);if(!Number.isFinite(n)){e.onChange(r),t();return}e.onChange(n),t(),a.current=n};return(0,$.jsx)(Pi,{...n,type:`number`,value:r,ref:e.ref,onChange:e=>i(e.target.value),onBlur:()=>{e.onBlur(),o()},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),o())},className:`h-8 w-28 text-sm tabular-nums`})}function Ps({ctl:e,onCommit:t,...n}){"use no memo";let r=Array.isArray(e.value)?e.value.join(`
1
+ import{o as e,t}from"./chunk-CYidjpOJ.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{B as r,O as i,at as a,dt as o,hi as s,lt as c,st as l,ut as u,xr as d,z as f}from"./DocumentContext-Be48_bAF.js";import{t as p}from"./react-f2sANaYj.js";import{n as m,r as h}from"./dist-Nvb76hAm.js";import{t as g}from"./useQuery-ZeEDLtxh.js";import{n as _}from"./dist-PQ5KMVDh.js";import{t as v}from"./react-dom-DPxgxlDT.js";import{t as y}from"./compiler-runtime-BfE3aGVn.js";import{t as b}from"./utils-CPqDy6Hr.js";import{S as x,_ as S,a as C,b as w,c as T,d as E,f as D,g as O,h as k,i as A,l as j,m as M,o as N,p as P,r as F,s as I,t as L,u as R,v as z,x as B,y as V}from"./agent-connections-B2xlqiAt.js";import{t as H}from"./button-BeFNZANd.js";import{i as U,n as W,r as G,t as K}from"./tooltip-DVBVVaAs.js";import{n as ee,r as te,t as q}from"./collapsible-DYySK8La.js";import{a as J,c as ne,i as re,l as ie,n as ae,o as oe,r as se,s as ce,t as le}from"./alert-dialog-CqqfqWNT.js";import{n as ue,t as de}from"./with-selector-PRoyWQiu.js";import{t as fe}from"./checkbox-dUuNlQM9.js";import{A as pe,C as me,D as he,E as ge,O as _e,S as ve,T as ye,_ as be,b as xe,f as Se,g as Ce,h as we,j as Te,k as Ee,m as De,p as Oe,r as ke,v as Ae,w as je,x as Me,y as Ne}from"./floating-ui.dom-CDtYEnEj.js";import{c as Pe,d as Fe,l as Ie,o as Le,s as Re,u as ze}from"./dist-DYso7MCm.js";import{t as Be}from"./label-D-K3fWtj.js";import{i as Ve,n as He,o as Ue,s as We,t as Ge}from"./select-CsHr_Rz5.js";import{n as Ke,t as qe}from"./radio-group-npdxiS6E.js";import{t as Je}from"./switch-iwBsEWej.js";import{n as Ye,r as Xe,t as Ze}from"./toggle-group-BxIyZnUJ.js";import{a as Qe,c as $e,g as et,h as tt,l as nt,n as rt,o as it,r as at,s as Y,t as ot,u as st,y as ct}from"./RegisteredAgentIcon-XDCjRE4q.js";import{a as lt,i as ut,o as dt}from"./terminal-telemetry-C0nwSvRH.js";import{$o as ft,Ac as pt,As as mt,Bs as ht,Ci as gt,Cn as _t,Cs as vt,Ec as yt,Es as bt,Fc as xt,Go as St,Ic as Ct,Is as wt,Jo as Tt,Kc as Et,Lc as Dt,Ls as Ot,Mr as kt,Ms as At,Nc as jt,Ns as Mt,Ot as Nt,Pc as Pt,Qc as Ft,Qs as It,Rs as Lt,Un as Rt,Uo as zt,Wo as Bt,Xn as Vt,Xo as Ht,Yc as Ut,Yo as Wt,Ys as Gt,_s as Kt,as as qt,ba as Jt,cs as Yt,fi as Xt,fs as Zt,gi as Qt,gs as $t,is as en,jc as tn,js as nn,ks as rn,ls as an,ms as on,mt as sn,os as cn,ot as ln,ps as un,pt as dn,qo as fn,qs as pn,rl as mn,rs as hn,ss as gn,vs as _n,wn as vn,zs as yn}from"./dist-DmvVdMAc.js";import{t as bn}from"./trace-api-BP9dN1Hz.js";import{n as X}from"./dist-CJhtNlOm2.js";import{d as xn,f as Sn,h as Cn,n as wn,o as Tn,p as En,r as Dn,u as On,v as kn}from"./use-settings-route-DI6YfB7r.js";import{t as An}from"./dist-Cr4-nBVI.js";import{c as jn}from"./documents-events-DChefUoE.js";import{a as Mn,i as Nn,o as Pn}from"./local-menu-action-bus-DaoT7_kL.js";import{a as Fn,i as In,t as Ln}from"./use-apply-config-theme-B5w38X1P.js";import{t as Rn}from"./OpenInAgentMenuItem-tMDoc20x.js";import{g as zn,h as Bn,p as Vn,v as Hn,y as Un}from"./SkillInstallMenu-BW2fj8iT.js";import{t as Wn}from"./createLucideIcon-B6ULg5PN.js";import{C as Gn,S as Kn,_ as qn,a as Jn,c as Yn,d as Xn,f as Zn,h as Qn,n as $n,o as er,s as tr,t as nr,u as rr,v as ir,y as ar}from"./SyncStatusBadge-CMEBaJDA.js";import{f as or}from"./Mermaid-bW_7Lznj.js";import{t as sr}from"./arrow-up-right-BSqX8NAd.js";import{t as cr}from"./check-Q5jd3Hs-.js";import{t as lr}from"./chevron-right-By2JkAgT.js";import{n as ur,t as dr}from"./lint-plugin-meta-DmtRmLsN.js";import{t as fr}from"./circle-alert-_EpKBna4.js";import{i as pr,r as mr}from"./prop-types-B2w_fFJW.js";import{a as hr,h as gr,r as _r,t as vr}from"./dropdown-menu-57MhAniC.js";import{It as yr}from"./CodeMirrorPropInput-DF3sY_TW.js";import{i as br,r as xr,t as Sr}from"./use-git-sync-status-CLv7EZOq.js";import{o as Cr}from"./folder-config-api-y_2lDcJg.js";import{t as wr}from"./info-Bem3FDH_.js";import{t as Tr}from"./spinner-D7ppCG-D.js";import{n as Er,r as Dr,t as Or}from"./ThemePicker-BULIP0sp.js";import{B as kr,C as Ar,E as jr,F as Mr,G as Nr,I as Pr,L as Fr,M as Ir,N as Lr,O as Rr,P as zr,R as Br,S as Vr,T as Hr,U as Ur,Z as Wr,b as Gr,c as Kr,d as qr,f as Jr,h as Yr,i as Xr,j as Zr,k as Qr,l as $r,m as ei,n as ti,o as ni,p as ri,q as ii,w as ai,x as oi,y as si,z as ci}from"./auth-state-cache-DkvW2mTJ.js";import{t as li}from"./rotate-ccw-B_k-Metp.js";import{t as ui}from"./square-pen-BTtb6SXV.js";import{t as di}from"./trash-2-CYyUeKpx.js";import{t as fi}from"./triangle-alert--Fl5KoVX.js";import{t as pi}from"./x-BcfoD9-8.js";import{t as mi}from"./badge-NLcybMIN.js";import{a as hi,c as gi,i as _i,n as vi,o as yi,r as bi,s as xi,t as Si}from"./dialog-BTFtzetj.js";import{i as Ci,o as wi,r as Ti,t as Ei}from"./field-Bp-wqfBg.js";import{t as Di}from"./tool-list-format-BBT_vsDw.js";import{n as Oi}from"./use-workspace-Byr5yIN5.js";import{d as ki}from"./doc-paths-CU5xFEmw.js";import{a as Ai}from"./startup-marks-CJJqLRKP.js";import{n as ji}from"./config-provider-myFxAeZJ.js";import{a as Mi}from"./skill-scope-DX2Q9lzh.js";import{m as Ni}from"./skills-api-Cpwwq_FO.js";import{t as Pi}from"./input-FC65XODQ.js";import{a as Fi,i as Ii,t as Li}from"./popover-D9P6t6oT.js";import{_ as Ri,a as zi,d as Bi,f as Vi,g as Hi,h as Ui,m as Wi,p as Gi,u as Ki,v as qi,y as Ji}from"./css-color-to-hex-B1w0Vq2i.js";import{n as Yi}from"./use-apply-config-language--jTlcFWU.js";import{t as Xi}from"./external-link-C41LkPrP.js";import{t as Zi}from"./ConfigSharingInfoTooltip-BTe9yAD7.js";import{t as Qi}from"./use-skills-B1b-aZeu.js";import{o as $i,s as ea,t as ta}from"./use-open-skill-DV5hhMVO.js";import{r as na,t as ra}from"./DeleteConfirmationDialog-CW-EDwBk.js";import{t as ia}from"./skeleton-8MBf7Lwj.js";import{d as aa,n as oa,r as sa,t as ca,u as la}from"./lint-config-client-kGMpwF3X.js";import{_ as ua,a as da,d as fa,f as pa,g as ma,h as ha,i as ga,o as _a,s as va,t as ya,u as ba}from"./sortable.esm-CGLSbuEH.js";import{t as xa}from"./textarea-3qB7PlP7.js";import{r as Sa,t as Ca}from"./terminal-command-events-CoI7bIgQ.js";import{i as wa,n as Ta,t as Ea}from"./input-group-BOzKjVFi.js";import{a as Da,f as Oa,i as ka,n as Aa,o as ja,p as Ma,r as Na,s as Pa,t as Fa}from"./form-C_vp_Cww.js";import{t as Ia}from"./tag-pill-input-DLQqKzbN.js";import{t as La}from"./markdownlint-rule-browser-BZlDsCDj.js";import{n as Ra}from"./schema-fields-view-intent-DYg7KWFO.js";import{n as za,t as Ba}from"./use-terminal-enabled-Djcq-lbC.js";var Va=Wn(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),Ha=Wn(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Ua=Wn(`unlink`,[[`path`,{d:`m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71`,key:`yqzxt4`}],[`path`,{d:`m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71`,key:`4qinb0`}],[`line`,{x1:`8`,x2:`8`,y1:`2`,y2:`5`,key:`1041cp`}],[`line`,{x1:`2`,x2:`5`,y1:`8`,y2:`8`,key:`14m1p5`}],[`line`,{x1:`16`,x2:`16`,y1:`19`,y2:`22`,key:`rzdirn`}],[`line`,{x1:`19`,x2:`22`,y1:`16`,y2:`16`,key:`ox905f`}]]),Wa=Wn(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Z=e(p(),1),Q=y(),$=n();function Ga(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(mi,{variant:`gray`,children:(0,$.jsx)(m,{id:`YBt9YP`})}),e[0]=t):t=e[0],t}function Ka(e){let t=(0,Q.c)(10),{scope:n}=e,r=`settings-scope-badge-${n}`,i;t[0]===n?i=t[1]:(i=n===`user`?(0,$.jsx)(m,{id:`7PzzBU`}):n===`project-local`?(0,$.jsx)(m,{id:`ImTzPZ`}):(0,$.jsx)(m,{id:`e0NrBM`}),t[0]=n,t[1]=i);let a;t[2]!==r||t[3]!==i?(a=(0,$.jsx)(U,{asChild:!0,children:(0,$.jsx)(mi,{variant:`gray`,tabIndex:0,className:`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,"data-testid":r,children:i})}),t[2]=r,t[3]=i,t[4]=a):a=t[4];let o;t[5]===n?o=t[6]:(o=(0,$.jsx)(W,{children:n===`user`?(0,$.jsx)(m,{id:`cFSbbh`}):n===`project-local`?(0,$.jsx)(m,{id:`YlwI5F`}):(0,$.jsx)(m,{id:`ebqMh6`})}),t[5]=n,t[6]=o);let s;return t[7]!==a||t[8]!==o?(s=(0,$.jsx)(G,{children:(0,$.jsxs)(K,{children:[a,o]})}),t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function qa(e){let t=(0,Q.c)(27),{titleId:n,title:r,scope:i,level:a,beta:o,adornment:s,docUrl:c,children:l}=e,u=a===void 0?`page`:a,{_:d}=h(),f=u===`page`?`h3`:`h4`,p=u===`page`?`text-lg`:`text-base`,g;t[0]===p?g=t[1]:(g=b(`font-semibold`,p),t[0]=p,t[1]=g);let _;t[2]!==f||t[3]!==g||t[4]!==r||t[5]!==n?(_=(0,$.jsx)(f,{id:n,className:g,children:r}),t[2]=f,t[3]=g,t[4]=r,t[5]=n,t[6]=_):_=t[6];let v;t[7]===o?v=t[8]:(v=o?(0,$.jsx)(Ga,{}):null,t[7]=o,t[8]=v);let y;t[9]===i?y=t[10]:(y=i?(0,$.jsx)(Ka,{scope:i}):null,t[9]=i,t[10]=y);let x;t[11]!==s||t[12]!==_||t[13]!==v||t[14]!==y?(x=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[_,s,v,y]}),t[11]=s,t[12]=_,t[13]=v,t[14]=y,t[15]=x):x=t[15];let S;t[16]===l?S=t[17]:(S=l?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:l}):null,t[16]=l,t[17]=S);let C;t[18]!==d||t[19]!==c||t[20]!==r||t[21]!==n?(C=c===void 0?null:(0,$.jsxs)(`a`,{href:c,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>Xi(e,c),onAuxClick:e=>Xi(e,c),"aria-label":d(typeof r==`string`?{id:`Li4U-T`,values:{title:r}}:{id:`zwWKhA`}),className:`inline-flex items-center gap-0.5 text-sm text-muted-foreground underline-offset-2 hover:text-foreground hover:underline`,"data-testid":`${n}-docs-link`,children:[(0,$.jsx)(m,{id:`zwWKhA`}),(0,$.jsx)(sr,{"aria-hidden":!0,className:`size-3`})]}),t[18]=d,t[19]=c,t[20]=r,t[21]=n,t[22]=C):C=t[22];let w;return t[23]!==x||t[24]!==S||t[25]!==C?(w=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[x,S,C]}),t[23]=x,t[24]=S,t[25]=C,t[26]=w):w=t[26],w}var Ja=`settings-sharing-title`;function Ya(){let e=(0,Q.c)(1),t=(typeof window<`u`?window.okDesktop:void 0)?.sharing,n;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=t===void 0?(0,$.jsx)(Xa,{}):(0,$.jsx)(Za,{}),e[0]=n):n=e[0],n}function Xa(){let e=(0,Q.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(m,{id:`cs4mps`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`section`,{"aria-labelledby":Ja,className:`space-y-3`,"data-field":`section:sharing`,children:(0,$.jsx)(qa,{titleId:Ja,title:t,scope:`project`,level:`block`,children:(0,$.jsx)(m,{id:`7YRrJ9`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{}),2:(0,$.jsx)(`code`,{})}})})}),e[1]=n):n=e[1],n}function Za(){let e=(0,Q.c)(29),{_:t}=h(),[n,r]=(0,Z.useState)(null),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(null),c;e[0]===t?c=e[1]:(c=async function(){let e=window.okDesktop?.sharing;if(e)try{r(await e.status())}catch(e){let n=e;X.error(n instanceof Error?n.message:t({id:`K0N7zS`})),r($a)}},e[0]=t,e[1]=c);let l=c,u;e[2]===l?u=e[3]:(u=()=>{l()},e[2]=l,e[3]=u);let d;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=[],e[4]=d):d=e[4],(0,Z.useEffect)(u,d);let f;e[5]!==t||e[6]!==i||e[7]!==l||e[8]!==n?(f=async function(e){let r=window.okDesktop?.sharing;if(!r||n===null||i||n.mode===e)return;a(!0),s(null);let o=null,c=null;try{o=await r.setMode(e)}catch(e){c=e}if(a(!1),c!==null){X.error(c instanceof Error?c.message:t({id:`qZv5ZR`}));return}o!==null&&(o.kind===`refused-tracked`?(s({tracked:o.tracked,remediation:o.remediation}),X.error(t({id:`z2JdQ-`}),{duration:5e3})):o.kind===`no-exclude`?X.warning(o.reason===`no-git`?t({id:`YSFv5w`}):t({id:`8cS0nH`,values:{0:o.reason}})):X.success(t(e===`local-only`?{id:`wdzBgi`}:{id:`k_pade`})),await l())},e[5]=t,e[6]=i,e[7]=l,e[8]=n,e[9]=f):f=e[9];let p=f;if(n===null){let t;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(qa,{titleId:Ja,title:(0,$.jsx)(m,{id:`cs4mps`}),scope:`project`,level:`block`}),e[10]=t):t=e[10];let n;return e[11]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`section`,{"aria-labelledby":Ja,className:`space-y-3`,"data-field":`section:sharing`,children:[t,(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:(0,$.jsx)(m,{id:`eQn7nI`})}),(0,$.jsx)(ia,{className:`h-24`})]})]}),e[11]=n):n=e[11],n}let g=n.mode===`no-git`,_;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(m,{id:`cs4mps`}),e[12]=_):_=e[12];let v;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(qa,{titleId:Ja,title:_,scope:`project`,level:`block`,adornment:(0,$.jsx)(Zi,{}),children:(0,$.jsx)(m,{id:`N55YNr`})}),e[13]=v):v=e[13];let y;e[14]!==i||e[15]!==g||e[16]!==p||e[17]!==n.mode?(y=g?(0,$.jsx)(`p`,{className:`rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,role:`status`,"data-testid":`settings-sharing-no-git`,children:(0,$.jsx)(m,{id:`ju38ms`})}):(0,$.jsxs)(qe,{value:n.mode,onValueChange:e=>void p(e),disabled:i,className:`gap-2`,"aria-labelledby":Ja,"data-testid":`settings-sharing-radiogroup`,children:[(0,$.jsxs)(`label`,{htmlFor:`settings-sharing-local-only`,className:`flex items-start gap-2 text-sm`,children:[(0,$.jsx)(Ke,{id:`settings-sharing-local-only`,value:`local-only`,"data-testid":`settings-sharing-local-only`,className:`mt-1`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`font-medium`,children:(0,$.jsx)(m,{id:`QjzFZj`})}),(0,$.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,$.jsx)(m,{id:`un-K1H`})})]})]}),(0,$.jsxs)(`label`,{htmlFor:`settings-sharing-shared`,className:`flex items-start gap-2 text-sm`,children:[(0,$.jsx)(Ke,{id:`settings-sharing-shared`,value:`shared`,"data-testid":`settings-sharing-shared`,className:`mt-1`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`font-medium`,children:(0,$.jsx)(m,{id:`0Gd0NU`})}),(0,$.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,$.jsx)(m,{id:`dJw2_7`})})]})]})]}),e[14]=i,e[15]=g,e[16]=p,e[17]=n.mode,e[18]=y):y=e[18];let b;e[19]===o?b=e[20]:(b=o===null?null:(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border border-destructive bg-destructive/10 p-3 text-sm`,role:`alert`,"data-testid":`settings-sharing-refusal`,children:[(0,$.jsx)(`p`,{className:`font-semibold`,children:(0,$.jsx)(m,{id:`ZscwQ0`})}),(0,$.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-xs leading-relaxed`,children:o.remediation}),(0,$.jsx)(H,{variant:`outline`,size:`sm`,onClick:()=>s(null),children:(0,$.jsx)(m,{id:`1QfxQT`})})]}),e[19]=o,e[20]=b);let x;e[21]!==o||e[22]!==n.mode||e[23]!==n.trackedUpstream?(x=n.trackedUpstream.length>0&&n.mode!==`no-git`&&o===null?(0,$.jsxs)(`div`,{className:`space-y-1 rounded-md border border-muted-foreground/30 bg-muted/40 p-3 text-sm`,"data-testid":`settings-sharing-tracked-info`,children:[(0,$.jsx)(`p`,{className:`font-medium`,children:(0,$.jsx)(m,{id:`LhWYpm`})}),(0,$.jsx)(`ul`,{className:`list-disc pl-5 font-mono text-xs text-muted-foreground`,children:n.trackedUpstream.map(Qa)}),(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(m,{id:`1XSMhZ`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{})}})})]}):null,e[21]=o,e[22]=n.mode,e[23]=n.trackedUpstream,e[24]=x):x=e[24];let S;return e[25]!==y||e[26]!==b||e[27]!==x?(S=(0,$.jsxs)(`section`,{"aria-labelledby":Ja,className:`space-y-4`,"data-testid":`settings-sharing`,"data-field":`section:sharing`,children:[v,y,b,x]}),e[25]=y,e[26]=b,e[27]=x,e[28]=S):S=e[28],S}function Qa(e){return(0,$.jsx)(`li`,{children:e},e)}function $a(e){return e??{kind:`status`,mode:`no-git`,excluded:[],trackedUpstream:[]}}var eo=`[a-z0-9](?:[a-z0-9-]*[a-z0-9])?`,to=RegExp(`^${eo}(?:\\.${eo})*$`),no=/^[a-z][a-z0-9+.-]*:\/\//i;function ro(e){if(no.test(e))try{return new URL(e).host}catch{return null}let t=e.split(`/`)[0]??``;return t.slice(t.lastIndexOf(`@`)+1).replace(/:(?!\d+$).*$/,``)}function io(e,t){let n=e.trim();if(n===``)return{ok:!1,reason:`empty`};let r=ro(n);if(r===null||r===``)return{ok:!1,reason:`invalid`};let i=nn(r);return to.test(i)?i===`github.com`?{ok:!1,reason:`github-com`}:t.has(i)?{ok:!1,reason:`duplicate`}:{ok:!0,host:i}:{ok:!1,reason:`invalid`}}function ao(e){let t=e.git?.hosts??{};return Object.entries(t).filter(([,e])=>e?.provider===`github`).map(([e])=>e).sort((e,t)=>e.localeCompare(t))}function oo(e){let t=(0,Q.c)(59),{binding:n}=e,{_:r}=h(),i=(0,Z.useId)(),a=(0,Z.useId)(),o;t[0]===n?o=t[1]:(o=()=>ao(n.current()),t[0]=n,t[1]=o);let[s,c]=(0,Z.useState)(o),[l,u]=(0,Z.useState)(``),[d,f]=(0,Z.useState)(null),[p,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(null),y;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(y=new Map,t[2]=y):y=t[2];let b=(0,Z.useRef)(y),x=(0,Z.useRef)(null),S,C;t[3]===_?(S=t[4],C=t[5]):(S=()=>{_!==null&&(((_.host===null?null:b.current.get(_.host))??x.current)?.focus(),v(null))},C=[_],t[3]=_,t[4]=S,t[5]=C),(0,Z.useEffect)(S,C);let w,T;t[6]===n?(w=t[7],T=t[8]):(w=()=>n.subscribe(e=>c(ao(e))),T=[n],t[6]=n,t[7]=w,t[8]=T),(0,Z.useEffect)(w,T);let E;t[9]===r?E=t[10]:(E=function(e){switch(e){case`empty`:return r({id:`cFONFy`});case`invalid`:return r({id:`QsnBxE`});case`github-com`:return r({id:`UK3GW4`});case`duplicate`:return r({id:`DEkRZA`})}},t[9]=r,t[10]=E);let D=E,O;t[11]!==n||t[12]!==l||t[13]!==s||t[14]!==D?(O=function(e){e.preventDefault();let t=io(l,new Set(s.map(so)));if(!t.ok){f(D(t.reason));return}let r=n.patch({git:{hosts:{[t.host]:{provider:`github`}}}});if(!r.ok){f(_n(r.error));return}c(ao(r.effective)),u(``),f(null),g(!0)},t[11]=n,t[12]=l,t[13]=s,t[14]=D,t[15]=O):O=t[15];let k=O,A;t[16]!==n||t[17]!==s?(A=function(e){let t=s.indexOf(e),r=s[t+1]??s[t-1]??null,i=n.patch({git:{hosts:{[e]:null}}});if(!i.ok){f(_n(i.error));return}c(ao(i.effective)),v({host:r}),f(null),g(!0)},t[16]=n,t[17]=s,t[18]=A):A=t[18];let j=A,M;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(`h4`,{id:`settings-enterprise-hosts-title`,className:`text-sm font-medium`,children:(0,$.jsx)(m,{id:`J2-D_a`})}),t[19]=M):M=t[19];let N;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(m,{id:`PgY2nN`}),t[20]=N):N=t[20];let P;t[21]===i?P=t[22]:(P=(0,$.jsxs)(`div`,{children:[M,(0,$.jsx)(`p`,{id:i,className:`text-1sm text-muted-foreground`,children:N})]}),t[21]=i,t[22]=P);let F;t[23]!==r||t[24]!==j||t[25]!==s?(F=s.length>0?(0,$.jsx)(`ul`,{className:`space-y-1`,"data-testid":`settings-enterprise-hosts-list`,children:s.map(e=>(0,$.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:e}),(0,$.jsx)(H,{variant:`ghost`,size:`icon`,className:`size-7`,"aria-label":r({id:`xVMoYb`,values:{host:e}}),ref:t=>{t?b.current.set(e,t):b.current.delete(e)},onClick:()=>j(e),children:(0,$.jsx)(di,{"aria-hidden":`true`})})]},e))}):(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`settings-enterprise-hosts-empty`,children:(0,$.jsx)(m,{id:`HK2eIK`})}),t[23]=r,t[24]=j,t[25]=s,t[26]=F):F=t[26];let I;t[27]===r?I=t[28]:(I=r({id:`Qbf7Q4`}),t[27]=r,t[28]=I);let L=d!==null,R=d===null?i:`${i} ${a}`,z;t[29]===d?z=t[30]:(z=e=>{u(e.target.value),d!==null&&f(null)},t[29]=d,t[30]=z);let B;t[31]!==l||t[32]!==I||t[33]!==L||t[34]!==R||t[35]!==z?(B=(0,$.jsx)(Pi,{ref:x,value:l,"aria-label":I,placeholder:`github.example.com`,autoComplete:`off`,spellCheck:!1,inputMode:`url`,className:`h-7 flex-1 font-mono text-xs`,"aria-invalid":L,"aria-describedby":R,onChange:z}),t[31]=l,t[32]=I,t[33]=L,t[34]=R,t[35]=z,t[36]=B):B=t[36];let V;t[37]===l?V=t[38]:(V=l.trim(),t[37]=l,t[38]=V);let U=V===``,W;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,$.jsx)(m,{id:`ALFlyF`}),t[39]=W):W=t[39];let G;t[40]===U?G=t[41]:(G=(0,$.jsx)(H,{type:`submit`,size:`sm`,variant:`secondary`,disabled:U,className:`h-7 px-2 font-normal text-xs`,children:W}),t[40]=U,t[41]=G);let K;t[42]!==k||t[43]!==B||t[44]!==G?(K=(0,$.jsxs)(`form`,{className:`flex items-center gap-2 pt-1`,onSubmit:k,noValidate:!0,children:[B,G]}),t[42]=k,t[43]=B,t[44]=G,t[45]=K):K=t[45];let ee;t[46]!==d||t[47]!==a?(ee=d===null?null:(0,$.jsx)(`p`,{id:a,role:`alert`,className:`text-1sm text-destructive`,children:d}),t[46]=d,t[47]=a,t[48]=ee):ee=t[48];let te;t[49]===p?te=t[50]:(te=p?(0,$.jsx)(`p`,{role:`status`,className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(m,{id:`3LuFP-`})}):null,t[49]=p,t[50]=te);let q;t[51]!==F||t[52]!==K||t[53]!==ee||t[54]!==te?(q=(0,$.jsxs)(`div`,{className:`space-y-2 rounded-lg border bg-card p-3`,children:[F,K,ee,te]}),t[51]=F,t[52]=K,t[53]=ee,t[54]=te,t[55]=q):q=t[55];let J;return t[56]!==P||t[57]!==q?(J=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-enterprise-hosts-title`,className:`space-y-4 pt-5`,"data-field":`section:enterprise-hosts`,"data-testid":`settings-enterprise-hosts`,children:[P,q]}),t[56]=P,t[57]=q,t[58]=J):J=t[58],J}function so(e){return nn(e)}function co(e){let t=(0,Q.c)(38),{authQueryTransport:n,authTransport:r,userBinding:i}=e,{_:a}=h(),o;t[0]===n?o=t[1]:(o=n??Ur(),t[0]=n,t[1]=o);let s=o,c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c={phase:`loading`},t[2]=c):c=t[2];let[l,u]=(0,Z.useState)(c),[d,f]=(0,Z.useState)(!1),[p,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(null),y=(0,Z.useRef)(!1),b;t[3]===s?b=t[4]:(b=async function(){u({phase:`loading`});try{let e=await s.status();u({phase:`loaded`,result:e}),ti(e)}catch(e){console.warn(`[AccountSection] GitHub status check failed`,e),u({phase:`check-failed`})}},t[3]=s,t[4]=b);let x=b,S;t[5]===x?S=t[6]:(S=()=>{x()},t[5]=x,t[6]=S);let C;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(C=[],t[7]=C):C=t[7],(0,Z.useEffect)(S,C);let w;t[8]!==a||t[9]!==x||t[10]!==s?(w=async function(){if(y.current)return;y.current=!0,f(!1),g(!0),v(null);let e=null;try{let t=s.signout?await s.signout():{ok:!1,error:a({id:`8cpOa8`})};t.ok||(e=t.error??a({id:`8cpOa8`}))}catch(t){console.warn(`[AccountSection] GitHub disconnect failed`,t),e=a({id:`8cpOa8`})}await x(),e&&v(e),g(!1),y.current=!1},t[8]=a,t[9]=x,t[10]=s,t[11]=w):w=t[11];let T=w,E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(m,{id:`AeXO77`}),t[12]=E):E=t[12];let D;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(qa,{titleId:`settings-account-title`,title:E,scope:`user`,children:(0,$.jsx)(m,{id:`E6lrpp`})}),t[13]=D):D=t[13];let O;t[14]!==_||t[15]!==p||t[16]!==T||t[17]!==x||t[18]!==l.phase||t[19]!==l.result?(O=l.phase===`loading`?(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-loading`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:(0,$.jsx)(m,{id:`IWGfGF`})}),(0,$.jsx)(ia,{className:`h-4 w-40`}),(0,$.jsx)(ia,{className:`h-8 w-32`})]}):l.phase===`check-failed`?(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-check-failed`,children:[(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:(0,$.jsx)(m,{id:`T_wG4n`})}),(0,$.jsx)(H,{variant:`outline`,size:`sm`,onClick:()=>void x(),children:(0,$.jsx)(m,{id:`KDw4GX`})})]}):l.result.authenticated?l.result.tier===`A`?(0,$.jsx)(uo,{login:l.result.login}):(0,$.jsx)(lo,{login:l.result.login,disconnecting:p,error:_,onDisconnect:()=>void T()}):l.result.unsupportedOrigin===void 0?(0,$.jsx)(po,{onConnect:()=>f(!0)}):(0,$.jsx)(fo,{host:l.result.unsupportedOrigin.host}),t[14]=_,t[15]=p,t[16]=T,t[17]=x,t[18]=l.phase,t[19]=l.result,t[20]=O):O=t[20];let k;t[21]===i?k=t[22]:(k=(0,$.jsx)(oo,{binding:i}),t[21]=i,t[22]=k);let A;t[23]===x?A=t[24]:(A=e=>{f(e),e||x()},t[23]=x,t[24]=A);let j=l.phase===`loaded`?l.result.host:void 0,M=l.phase===`loaded`?l.result.ghAvailable:void 0,N;t[25]===x?N=t[26]:(N=()=>{x()},t[25]=x,t[26]=N);let P;t[27]!==d||t[28]!==r||t[29]!==A||t[30]!==j||t[31]!==M||t[32]!==N?(P=(0,$.jsx)(kr,{open:d,onOpenChange:A,transport:r,host:j,ghAvailable:M,onSuccess:N}),t[27]=d,t[28]=r,t[29]=A,t[30]=j,t[31]=M,t[32]=N,t[33]=P):P=t[33];let F;return t[34]!==k||t[35]!==P||t[36]!==O?(F=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-account-title`,className:`space-y-3`,"data-testid":`settings-account`,children:[D,O,k,P]}),t[34]=k,t[35]=P,t[36]=O,t[37]=F):F=t[37],F}function lo(e){let t=(0,Q.c)(20),{login:n,disconnecting:r,error:i,onDisconnect:a}=e,o;t[0]===n?o=t[1]:(o=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(m,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(m,{id:`nxlOpL`})}),t[2]=s):s=t[2];let c;t[3]===o?c=t[4]:(c=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[o,s]}),t[3]=o,t[4]=c);let l;t[5]===r?l=t[6]:(l=r?(0,$.jsx)(m,{id:`rppgXF`}):(0,$.jsx)(m,{id:`-K0AvT`}),t[5]=r,t[6]=l);let u;t[7]!==r||t[8]!==a||t[9]!==l?(u=(0,$.jsx)(H,{variant:`outline`,onClick:a,disabled:r,"aria-describedby":`settings-account-disconnect-caveat`,"data-testid":`settings-account-disconnect`,children:l}),t[7]=r,t[8]=a,t[9]=l,t[10]=u):u=t[10];let d;t[11]!==c||t[12]!==u?(d=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[c,u]}),t[11]=c,t[12]=u,t[13]=d):d=t[13];let f;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`p`,{id:`settings-account-disconnect-caveat`,className:`text-muted-foreground text-1sm`,"data-testid":`settings-account-disconnect-caveat`,children:(0,$.jsx)(m,{id:`msOK6I`})}),t[14]=f):f=t[14];let p;t[15]===i?p=t[16]:(p=i?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,"data-testid":`settings-account-disconnect-error`,children:i}):null,t[15]=i,t[16]=p);let h;return t[17]!==d||t[18]!==p?(h=(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-connected`,children:[d,f,p]}),t[17]=d,t[18]=p,t[19]=h):h=t[19],h}function uo(e){let t=(0,Q.c)(5),{login:n}=e,r;t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(m,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(m,{id:`ny6vNn`})}),t[2]=i):i=t[2];let a;return t[3]===r?a=t[4]:(a=(0,$.jsx)(`div`,{className:`rounded-md border p-3`,"data-testid":`settings-account-gh-cli`,children:(0,$.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[r,i]})}),t[3]=r,t[4]=a),a}function fo(e){let t=(0,Q.c)(3),{host:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(m,{id:`xBjIs7`})}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,$.jsxs)(`div`,{role:`status`,className:`space-y-1 rounded-md border p-3`,"data-testid":`settings-account-unsupported-origin`,children:[r,(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:n===null?(0,$.jsx)(m,{id:`XBpH6-`}):(0,$.jsx)(m,{id:`7_I248`,values:{host:n}})})]}),t[1]=n,t[2]=i),i}function po(e){let t=(0,Q.c)(5),{onConnect:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`div`,{className:`text-sm font-medium`,children:(0,$.jsx)(m,{id:`S33tz3`})}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[r,(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(m,{id:`EJuO7B`})})]}),t[1]=i):i=t[1];let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(m,{id:`5lWFkC`}),t[2]=a):a=t[2];let o;return t[3]===n?o=t[4]:(o=(0,$.jsx)(`div`,{className:`rounded-md border p-3`,"data-testid":`settings-account-disconnected`,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[i,(0,$.jsx)(H,{onClick:n,"data-testid":`settings-account-connect`,children:a})]})}),t[3]=n,t[4]=o),o}function mo(e){if(e===void 0)return null;let t=e.params?.agent;if(typeof t!=`string`)return null;let n=mn[t]??t;return e.id===`followup.enable-manually`?An._({id:`followup.enable-manually`,values:{agent:n}}):null}function ho(e){let{enabled:t,installedCount:n,presence:r,configurable:i,setupDocSlug:a,installUrl:o}=e,s=n>0,c=r===`absent`,l=()=>a===null?{kind:`none`}:{kind:`setup-doc`,slug:a};return c?o==null||o===``?l():{kind:`install`,url:o}:i?t?s?{kind:`manage`}:{kind:`connect`}:s?{kind:`remove`}:{kind:`none`}:s?{kind:`remove`}:l()}function go(e){return e.presence===`absent`&&e.installedCount>0}function _o(e){let t=(0,Q.c)(32),{icon:n,name:r,hint:i,status:a,action:o,checked:s,disabled:c,ariaLabel:l,testId:u,rowTestId:d,statusId:f,onToggle:p}=e,m=i?`${d}-hint`:void 0,h;t[0]===n?h=t[1]:(h=(0,$.jsx)(`span`,{className:`flex h-5 shrink-0 items-center`,children:n}),t[0]=n,t[1]=h);let g;t[2]===r?g=t[3]:(g=(0,$.jsx)(`span`,{className:`truncate text-sm leading-5`,children:r}),t[2]=r,t[3]=g);let _;t[4]!==i||t[5]!==m?(_=i?(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,$.jsx)(`span`,{id:m,className:`truncate text-muted-foreground text-1sm`,children:i.text}),i.action]}):null,t[4]=i,t[5]=m,t[6]=_):_=t[6];let v;t[7]!==a||t[8]!==f?(v=a?(0,$.jsx)(`span`,{id:f,children:a}):null,t[7]=a,t[8]=f,t[9]=v):v=t[9];let y;t[10]!==g||t[11]!==_||t[12]!==v?(y=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[g,_,v]}),t[10]=g,t[11]=_,t[12]=v,t[13]=y):y=t[13];let b;t[14]!==h||t[15]!==y?(b=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2.5`,children:[h,y]}),t[14]=h,t[15]=y,t[16]=b):b=t[16];let x;t[17]!==l||t[18]!==s||t[19]!==c||t[20]!==m||t[21]!==p||t[22]!==f||t[23]!==u?(x=p===void 0?null:(0,$.jsx)(Je,{checked:s??!1,disabled:c,onCheckedChange:p,"aria-label":l,"aria-describedby":[m,f].filter(Boolean).join(` `)||void 0,"data-testid":u}),t[17]=l,t[18]=s,t[19]=c,t[20]=m,t[21]=p,t[22]=f,t[23]=u,t[24]=x):x=t[24];let S;t[25]!==o||t[26]!==x?(S=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[o,x]}),t[25]=o,t[26]=x,t[27]=S):S=t[27];let C;return t[28]!==d||t[29]!==b||t[30]!==S?(C=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 py-2.5`,"data-testid":d,children:[b,S]}),t[28]=d,t[29]=b,t[30]=S,t[31]=C):C=t[31],C}function vo(e){let t=(0,Q.c)(15),{target:n,projectDir:r,displayName:i}=e,{_:a}=h(),o;t[0]!==r||t[1]!==n?(o=()=>Un(n,r),t[0]=r,t[1]=n,t[2]=o):o=t[2];let[s,c]=(0,Z.useState)(o);if(!s)return null;let l;t[3]!==a||t[4]!==i?(l=a({id:`jIWP0P`,values:{displayName:i}}),t[3]=a,t[4]=i,t[5]=l):l=t[5];let u;t[6]!==r||t[7]!==n?(u=()=>{Hn(n,r,!1),c(Un(n,r))},t[6]=r,t[7]=n,t[8]=u):u=t[8];let d;t[9]===a?d=t[10]:(d=a({id:`LhVIxY`}),t[9]=a,t[10]=d);let f;return t[11]!==l||t[12]!==u||t[13]!==d?(f=(0,$.jsx)(H,{variant:`ghost`,size:`sm`,className:`shrink-0 font-mono uppercase`,"aria-label":l,onClick:u,children:d}),t[11]=l,t[12]=u,t[13]=d,t[14]=f):f=t[14],f}function yo(e,t){return e===`absent`&&!t}function bo(e){let t=(0,Q.c)(15),{label:n,labelIcon:r,subtitle:i,children:a,labelId:o}=e,s;t[0]!==n||t[1]!==r||t[2]!==o?(s=(0,$.jsxs)(`h4`,{id:o,tabIndex:-1,className:`flex items-center gap-1.5 font-mono text-muted-foreground text-xs uppercase tracking-wide`,children:[n,r]}),t[0]=n,t[1]=r,t[2]=o,t[3]=s):s=t[3];let c;t[4]===i?c=t[5]:(c=i?(0,$.jsx)(`p`,{className:`mt-1 text-muted-foreground text-xs`,children:i}):null,t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,$.jsxs)(`div`,{className:`mb-2`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]===a?u=t[10]:(u=(0,$.jsx)(`div`,{className:`divide-y overflow-hidden rounded-md border`,children:a}),t[9]=a,t[10]=u);let d;return t[11]!==o||t[12]!==l||t[13]!==u?(d=(0,$.jsxs)(`section`,{"aria-labelledby":o,children:[l,u]}),t[11]=o,t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function xo(e){if(e)return()=>{e.ownerDocument.activeElement===e&&V(e)?.focus()}}function So(e){let t=(0,Q.c)(9),{hiddenCount:n,expanded:r,onToggle:i,testId:a}=e,{_:o}=h();if(n<=0)return null;let s;t[0]!==o||t[1]!==r||t[2]!==n?(s=o(r?{id:`6lGV3K`}:{id:`INN7OX`,values:{hiddenCount:n}}),t[0]=o,t[1]=r,t[2]=n,t[3]=s):s=t[3];let c;return t[4]!==r||t[5]!==i||t[6]!==s||t[7]!==a?(c=(0,$.jsx)(H,{ref:xo,type:`button`,variant:`ghost`,onClick:i,"aria-expanded":r,className:`w-full justify-center rounded-none font-normal text-1sm text-muted-foreground`,"data-testid":a,children:s}),t[4]=r,t[5]=i,t[6]=s,t[7]=a,t[8]=c):c=t[8],c}function Co(e){let t=(0,Q.c)(10),{status:n,enabled:r}=e,{_:i}=h();if(n===`connected`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(cr,{"aria-hidden":!0,className:`size-3.5`}),t[0]=e):e=t[0];let n;t[1]===i?n=t[2]:(n=i({id:`QHcLEN`}),t[1]=i,t[2]=n);let r;return t[3]===n?r=t[4]:(r=(0,$.jsxs)(`span`,{className:`mt-0.5 inline-flex items-center gap-1 text-muted-foreground text-xs`,children:[e,n]}),t[3]=n,t[4]=r),r}if(n===`not-connected`&&r){let e;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(fi,{"aria-hidden":!0,className:`size-3.5`}),t[5]=e):e=t[5];let n;t[6]===i?n=t[7]:(n=i({id:`S33tz3`}),t[6]=i,t[7]=n);let r;return t[8]===n?r=t[9]:(r=(0,$.jsxs)(`span`,{className:`mt-0.5 inline-flex items-center gap-1 text-amber-700 text-xs dark:text-amber-400`,children:[e,n]}),t[8]=n,t[9]=r),r}return null}function wo(e){let t=(0,Q.c)(52),{action:n,rowLabel:r,describedById:i,onConfigure:a,onRemove:o}=e,{_:s}=h();switch(n.kind){case`none`:return null;case`install`:{let e=n.url,a;t[0]!==s||t[1]!==r?(a=s({id:`wfZwqe`,values:{rowLabel:r}}),t[0]=s,t[1]=r,t[2]=a):a=t[2];let o;t[3]===s?o=t[4]:(o=s({id:`TKQ7K-`}),t[3]=s,t[4]=o);let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(sr,{"aria-hidden":!0}),t[5]=c):c=t[5];let l;return t[6]!==n.url||t[7]!==i||t[8]!==a||t[9]!==o?(l=(0,$.jsx)(H,{variant:`link`,size:`sm`,className:`shrink-0 text-muted-foreground hover:text-foreground`,asChild:!0,children:(0,$.jsxs)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,"aria-label":a,"aria-describedby":i,children:[o,c]})}),t[6]=n.url,t[7]=i,t[8]=a,t[9]=o,t[10]=l):l=t[10],l}case`setup-doc`:{let e=`https://openknowledge.ai/docs/integrations/${n.slug}`,a;t[11]!==s||t[12]!==r?(a=s({id:`Kuw5NN`,values:{rowLabel:r}}),t[11]=s,t[12]=r,t[13]=a):a=t[13];let o;t[14]===s?o=t[15]:(o=s({id:`P_bX4O`}),t[14]=s,t[15]=o);let c;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(sr,{"aria-hidden":!0}),t[16]=c):c=t[16];let l;return t[17]!==i||t[18]!==e||t[19]!==a||t[20]!==o?(l=(0,$.jsx)(H,{variant:`link`,size:`sm`,className:`shrink-0 text-muted-foreground hover:text-foreground`,asChild:!0,children:(0,$.jsxs)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,"aria-label":a,"aria-describedby":i,children:[o,c]})}),t[17]=i,t[18]=e,t[19]=a,t[20]=o,t[21]=l):l=t[21],l}case`connect`:{let e;t[22]!==s||t[23]!==r?(e=s({id:`_uxBz5`,values:{rowLabel:r}}),t[22]=s,t[23]=r,t[24]=e):e=t[24];let n;t[25]===s?n=t[26]:(n=s({id:`q63KUv`}),t[25]=s,t[26]=n);let o;return t[27]!==i||t[28]!==a||t[29]!==e||t[30]!==n?(o=(0,$.jsx)(H,{size:`sm`,className:`shrink-0 font-mono uppercase`,onClick:a,"aria-label":e,"aria-describedby":i,children:n}),t[27]=i,t[28]=a,t[29]=e,t[30]=n,t[31]=o):o=t[31],o}case`manage`:{let e;t[32]!==s||t[33]!==r?(e=s({id:`wSBXaS`,values:{rowLabel:r}}),t[32]=s,t[33]=r,t[34]=e):e=t[34];let n;t[35]===s?n=t[36]:(n=s({id:`wckWOP`}),t[35]=s,t[36]=n);let o;return t[37]!==i||t[38]!==a||t[39]!==e||t[40]!==n?(o=(0,$.jsx)(H,{variant:`outline`,size:`sm`,className:`shrink-0 font-mono uppercase`,onClick:a,"aria-label":e,"aria-describedby":i,children:n}),t[37]=i,t[38]=a,t[39]=e,t[40]=n,t[41]=o):o=t[41],o}case`remove`:{let e;t[42]!==s||t[43]!==r?(e=s({id:`vRlzx-`,values:{rowLabel:r}}),t[42]=s,t[43]=r,t[44]=e):e=t[44];let n;t[45]===s?n=t[46]:(n=s({id:`t_YqKh`}),t[45]=s,t[46]=n);let a;return t[47]!==i||t[48]!==o||t[49]!==e||t[50]!==n?(a=(0,$.jsx)(H,{variant:`outline`,size:`sm`,className:`shrink-0 font-mono uppercase`,onClick:o,"aria-label":e,"aria-describedby":i,children:n}),t[47]=i,t[48]=o,t[49]=e,t[50]=n,t[51]=a):a=t[51],a}}}function To(e){let t=(0,Q.c)(9),{rowLabel:n,onRemove:r}=e,{_:i}=h(),a;t[0]!==i||t[1]!==n?(a=i({id:`vRlzx-`,values:{rowLabel:n}}),t[0]=i,t[1]=n,t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=i({id:`t_YqKh`}),t[3]=i,t[4]=o);let s;return t[5]!==r||t[6]!==a||t[7]!==o?(s=(0,$.jsx)(H,{type:`button`,variant:`link-muted`,className:`h-auto p-0 text-1sm underline underline-offset-4 hover:text-destructive`,onClick:r,"aria-label":a,children:o}),t[5]=r,t[6]=a,t[7]=o,t[8]=s):s=t[8],s}function Eo(e){return e===void 0?null:pt[e].external?.installUrl??null}function Do(e){return e!==null&&Object.values(e.probes.satisfiers).some(e=>e!==void 0&&e.state!==`unprobed`)}function Oo(e){return`${e.source}:${e.id}`}function ko(e,t,n){let r=t.has(Oo(n)),i=dt(n);return at(e,n.source,n.id,r||i,n.supported)}function Ao(e,t,n){return n.harness!==void 0&&lt(n)===0||ko(e,t,n)}function jo(e,t,n){let r=new Set(n.map(e=>Oo(e))),i=e=>Ao(t,r,e),a=[...e].sort((e,t)=>Number(i(t))-Number(i(e))||e.name.localeCompare(t.name));return{primaryKeys:new Set(a.filter(i).map(Oo)),ranks:new Map(a.map((e,t)=>[Oo(e),t]))}}function Mo(e,t,n,r){let i=t.filter(t=>!e.ranks.has(Oo(t)));if(i.length===0)return e;let a=new Set(r.map(e=>Oo(e))),o=e=>Ao(n,a,e),s=i.filter(o).sort((e,t)=>e.name.localeCompare(t.name)),c=i.filter(e=>!o(e)).sort((e,t)=>e.name.localeCompare(t.name)),l=[...e.ranks.entries()].sort(([,e],[,t])=>e-t).map(([e])=>e),u=l.filter(t=>e.primaryKeys.has(t)),d=l.filter(t=>!e.primaryKeys.has(t)),f=[...u,...s.map(Oo),...d,...c.map(Oo)];return{primaryKeys:new Set([...e.primaryKeys,...s.map(Oo)]),ranks:new Map(f.map((e,t)=>[e,t]))}}function No(e){let t=(0,Q.c)(125),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{applyConnections:r}=n,i=r===void 0?L:r,{_:a}=h(),o=st(),s=ct(),{states:c,refresh:l}=zn(),u=Bn(),d=Oi(),[f,p]=(0,Z.useState)(``),[m,_]=(0,Z.useState)(!1),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(!1),[w,B]=(0,Z.useState)(null),[V,U]=(0,Z.useState)(!1),[W,G]=(0,Z.useState)(!1),[K,ee]=(0,Z.useState)(!1),[te,q]=(0,Z.useState)(0),[J,ne]=(0,Z.useState)(null),[re,ie]=(0,Z.useState)(null),ae=(0,Z.useRef)(null),oe=(0,Z.useRef)(0),se;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(se={queryKey:[`acp-catalog`],queryFn:Uo,staleTime:3e5},t[2]=se):se=t[2];let ce=g(se),le;t[3]!==ce.data||t[4]!==o||t[5]!==s?(le=()=>ce.data===void 0?null:jo(ce.data.agents,o,s),t[3]=ce.data,t[4]=o,t[5]=s,t[6]=le):le=t[6];let[ue,de]=(0,Z.useState)(le),fe=ue??jo([],o,s);if(ce.data!==void 0){let e;t[7]!==ce.data.agents||t[8]!==ue||t[9]!==o||t[10]!==s?(e=ue===null?jo(ce.data.agents,o,s):Mo(ue,ce.data.agents,o,s),t[7]=ce.data.agents,t[8]=ue,t[9]=o,t[10]=s,t[11]=e):e=t[11];let n=e;n!==ue&&de(n),fe=n}let pe;t[12]===l?pe=t[13]:(pe=()=>{l()},t[12]=l,t[13]=pe);let me=(0,Z.useEffectEvent)(pe),he;t[14]===me?he=t[15]:(he=()=>{me()},t[14]=me,t[15]=he);let ge;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(ge=[],t[16]=ge):ge=t[16],(0,Z.useEffect)(he,ge);let _e;t[17]===i?_e=t[18]:(_e=()=>{let e=!0,t=oe.current+=1;return i([]).then(n=>{!e||oe.current!==t||(n.snapshot!==null&&B(n.snapshot),U(!Do(n.snapshot)),G(n.unavailable===!0),ee(n.devBuild===!0))}).catch(()=>{e&&oe.current===t&&U(!0)}),()=>{e=!1}},t[17]=i,t[18]=_e);let ve;t[19]!==i||t[20]!==te?(ve=[i,te],t[19]=i,t[20]=te,t[21]=ve):ve=t[21],(0,Z.useEffect)(_e,ve);let ye=ce.data?.agents,be=new Set(s.map(Ho)),xe;t[22]===u?.installedClis?xe=t[23]:(xe=u?.installedClis??{},t[22]=u?.installedClis,t[23]=xe);let Se=xe,Ce=w===null?[]:D(w),we=Ce.find(e=>e.id===J)??null,Te=Ce.find(e=>e.id===re)??null,Ee;t[24]===i?Ee=t[25]:(Ee=async function(e){let t=await i(e);return oe.current+=1,t.snapshot!==null&&B(t.snapshot),U(!Do(t.snapshot)),t.unavailable===!0&&G(!0),t.devBuild===!0&&ee(!0),t},t[24]=i,t[25]=Ee);let De=Ee,Oe;t[26]===w?Oe=t[27]:(Oe=function(e,t){return t===!1?`absent`:t===!0?`present`:e===void 0?`unknown`:N(e,w,t)},t[26]=w,t[27]=Oe);let ke=Oe,Ae;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=new Set(Pt.map(Dt).filter(Vo)),t[28]=Ae):Ae=t[28];let je=Ae,Me;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(Me=new Set(xt.map(Bo).filter(zo)),t[29]=Me):Me=t[29];let Ne=Me,Pe;t[30]!==Se||t[31]!==ke||t[32]!==c?(Pe=function(e,t){if(t===`terminal`){let t=pt[e].external?.targetId;return t===void 0?`unknown`:ke(e,c[t]?.installed??null)}let n=Pt.find(t=>Dt(t)===e);return n===void 0?`unknown`:ke(e,Se[n]??null)},t[30]=Se,t[31]=ke,t[32]=c,t[33]=Pe):Pe=t[33];let Fe=Pe,Ie=function(e,t,n,r,i,a,o,s){let c=e===void 0?void 0:Ce.find(t=>t.id===e);if(c===void 0||e===void 0||w===null||!Do(w))return{status:void 0,action:void 0,hintAction:void 0,residualFiles:!1,statusId:void 0};let l={enabled:i,installedCount:k(S(c)),presence:o,configurable:P(c),setupDocSlug:c.row.setupDocSlug,installUrl:s===void 0?pt[e].external?.installUrl??null:s},u=ho(l),d=M(e)&&Fe(e,r)!==`absent`,f=go(l)&&!d,p=F({agentId:e,mode:r,snapshot:w,detected:a}),m=p===`connected`||p===`not-connected`&&i,h=m?`${n}-status`:void 0,g=!W||u.kind===`install`||u.kind===`setup-doc`,_=c.cells.projectMcp,v=_===void 0||!M(e)||C(_.consentClass)===r?mo(A({agentId:e,mode:r,snapshot:w,detected:a,projectMcp:_})):null;return{status:m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Co,{status:p,enabled:i}),v===null?null:(0,$.jsx)(`span`,{className:`mt-0.5 block text-muted-foreground text-xs`,"data-testid":`${n}-followup`,children:v})]}):void 0,action:g?(0,$.jsx)(wo,{action:u,rowLabel:t,describedById:h,onConfigure:()=>ne(e),onRemove:()=>ie(e)}):void 0,hintAction:f&&!W?(0,$.jsx)(To,{rowLabel:t,onRemove:()=>ie(e)}):void 0,residualFiles:f,statusId:h}},Le;t[34]===a?Le=t[35]:(Le=function(e,t){return a(e===`not-installed`?t?{id:`06Ucfz`}:{id:`5SwVv1`}:t?{id:`V0Jk_K`}:{id:`EDD3UL`})},t[34]=a,t[35]=Le);let Re=Le,ze=function(e,t,n,r,i){if($e(e,r),!r||W||t===void 0||w===null)return;let a=Ce.find(e=>e.id===t);a===void 0||!P(a)||F({agentId:t,mode:n,snapshot:w,detected:i})===`not-connected`&&(ae.current=e,ne(t))},Be;t[36]!==ye||t[37]!==o||t[38]!==s?(Be=function(){ye!==void 0&&de(jo(ye,o,s))},t[36]=ye,t[37]=o,t[38]=s,t[39]=Be):Be=t[39];let Ve=Be,He;t[40]!==f||t[41]!==Ve?(He=function(e){f.trim()!==``&&e.trim()===``&&Ve(),p(e)},t[40]=f,t[41]=Ve,t[42]=He):He=t[42];let Ue=He,We;t[43]!==Ve||t[44]!==m?(We=function(){m&&Ve(),_(!m)},t[43]=Ve,t[44]=m,t[45]=We):We=t[45];let Ge=We,Ke=f.trim().toLowerCase(),qe=e=>Ke===``||e.toLowerCase().includes(Ke),Je=(ye??[]).filter(e=>qe(e.name)),Ye;t[46]===Se?Ye=t[47]:(Ye=e=>Se[e]!==!1,t[46]=Se,t[47]=Ye);let Xe=Ye,Ze;t[48]===Xe?Ze=t[49]:(Ze=(e,t)=>Number(Xe(t))-Number(Xe(e))||jt[e].displayName.localeCompare(jt[t].displayName),t[48]=Xe,t[49]=Ze);let lt=Pt.filter(e=>{let{displayName:t}=jt[e];return qe(t)||qe(a({id:`QYfQdv`,values:{displayName:t}}))||qe(e)}).sort(Ze),ut;t[50]!==ke||t[51]!==c?(ut=e=>ke(Ct(e),c[e]?.installed??null),t[50]=ke,t[51]=c,t[52]=ut):ut=t[52];let ft=ut,mt;t[53]===ft?mt=t[54]:(mt=(e,t)=>Number(ft(e.id)===`absent`)-Number(ft(t.id)===`absent`),t[53]=ft,t[54]=mt);let ht=xt.filter(e=>{let{displayName:t}=e;return qe(a({id:`CZBqrX`,values:{displayName:t}}))||qe(e.id)}).sort(mt),gt=u!==null,_t;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(_t=new Set([...je,...Ne]),t[55]=_t):_t=t[55];let vt=_t,yt=tn.filter(e=>!vt.has(e)&&qe(E(e))),bt=Ke!==``,St=!ce.isLoading&&!ce.isError,wt=bt&&St&&Je.length===0&&lt.length===0&&ht.length===0&&yt.length===0,Tt=!bt||ce.isLoading||ce.isError||Je.length>0,Et=!bt||lt.length>0,Ot=!bt||ht.length>0||yt.length>0,kt=e=>ko(o,be,e),At=e=>fe.primaryKeys.has(Oo(e)),Mt=e=>fe.ranks.get(Oo(e))??2**53-1,Nt=Je.filter(At),Ft=[...bt||m?Je:Nt].sort((e,t)=>Mt(e)-Mt(t)||e.name.localeCompare(t.name)),It=bt?0:Je.length-Nt.length,Lt=lt.filter(Xe),Rt=Lt.length>0&&Lt.length<lt.length,zt=!Rt||bt||v?lt:Lt,Bt=Rt&&!bt?lt.length-Lt.length:0,Vt;t[56]===ft?Vt=t[57]:(Vt=e=>ft(e.id)!==`absent`,t[56]=ft,t[57]=Vt);let Ht=ht.filter(Vt),Ut=yt.filter(e=>ke(e,Ce.find(t=>t.id===e)?.row.detected??null)!==`absent`),Wt=Ht.length+Ut.length,Gt=ht.length+yt.length,Kt=Wt>0&&Wt<Gt,qt=!Kt||bt||b,Jt=qt?ht:Ht,Yt=qt?yt:Ut,Xt=Kt&&!bt?Gt-Wt:0,Zt=!St||Je.some(dt),Qt=gt&&lt.some(Xe),$t;t[58]===c?$t=t[59]:($t=e=>c[e.id]?.installed===!0,t[58]=c,t[59]=$t);let en=ht.some($t),nn=Tt?(0,$.jsx)(bo,{label:a({id:`RXEbZy`}),labelId:`settings-configure-agents-in-app`,children:ce.isLoading?(0,$.jsxs)(`div`,{className:`flex items-center justify-center gap-2 px-3 py-6 text-muted-foreground text-sm`,children:[(0,$.jsx)(Tr,{className:`size-4`,"aria-hidden":`true`}),a({id:`ucXZ0k`})]}):ce.isError?(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-3 py-6 text-center text-muted-foreground text-sm`,children:[(0,$.jsx)(Wa,{className:`size-5`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{children:a({id:`FqGWeR`})}),(0,$.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void ce.refetch(),children:a({id:`6gRgw8`})})]}):(ye?.length??0)===0?(0,$.jsx)(`p`,{className:`px-3 py-6 text-center text-muted-foreground text-sm`,children:a({id:`QQbwzK`})}):(0,$.jsxs)($.Fragment,{children:[Ft.map(e=>{let t=Oo(e),n=kt(e),r=e.supported?e.description:a({id:`5jEnaB`});return(0,$.jsx)(_o,{icon:(0,$.jsx)(ot,{agentId:e.id,iconUrl:e.iconUrl,className:`size-4`}),name:e.name,hint:r===void 0?void 0:{text:r},checked:n,disabled:!e.supported,ariaLabel:a({id:`FZtBeR`,values:{0:e.name}}),testId:`configure-agents-in-app-${t}`,rowTestId:`configure-agents-in-app-row-${t}`,onToggle:n=>{n?(et({source:e.source,id:e.id,name:e.name,supported:e.supported,featured:e.featured,...e.iconUrl===void 0?{}:{iconUrl:e.iconUrl}},{makeDefault:!1}),$e(Y(e.source,e.id),!0)):($e(Y(e.source,e.id),!1),tt(t,e=>at(o,e.source,e.id,!0,e.supported)))}},t)}),(0,$.jsx)(So,{hiddenCount:It,expanded:m,onToggle:Ge,testId:`configure-agents-in-app-show-more`})]})},`in-app`):null,rn=Et?(0,$.jsxs)(bo,{label:a({id:`ALhMYW`}),labelId:`settings-configure-agents-terminal`,children:[zt.map(e=>{let{displayName:t}=jt[e],n=Se[e]??null,r=ke(Dt(e),n),i=Qe(o,e,r===`absent`),s=`configure-agents-terminal-row-${e}`,{status:c,action:l,hintAction:u,residualFiles:d,statusId:f}=Ie(Dt(e),a({id:`QYfQdv`,values:{displayName:t}}),s,`terminal`,i,n,r,Eo(Dt(e))??jt[e].docsUrl);return(0,$.jsx)(_o,{icon:(0,$.jsx)(Rn,{id:na(e),className:`size-4`,"aria-hidden":`true`}),name:a({id:`QYfQdv`,values:{displayName:t}}),hint:r===`absent`?{text:Re(`not-installed`,d),action:u}:void 0,status:c,action:l,checked:i,disabled:yo(r,i),ariaLabel:a({id:`27TLNq`,values:{displayName:t}}),testId:`configure-agents-terminal-${e}`,rowTestId:s,statusId:f,onToggle:gt?t=>ze(nt(e),Dt(e),`terminal`,t,Se[e]??null):void 0},e)}),(0,$.jsx)(So,{hiddenCount:Bt,expanded:v,onToggle:()=>y(Ro),testId:`configure-agents-terminal-show-more`})]},`terminal`):null,an=Ot?(0,$.jsxs)(bo,{label:a({id:`BwKH4d`}),labelId:`settings-configure-agents-desktop`,labelIcon:(0,$.jsx)(sr,{"aria-hidden":`true`,className:`size-3`}),children:[Jt.map(e=>{let t=c[e.id]?.installed??null,{displayName:n}=e,r=rt(o,e.id,t),i=ke(Ct(e.id),t),s=`configure-agents-desktop-row-${e.id}`,{status:l,action:u,hintAction:f,residualFiles:p,statusId:m}=Ie(Ct(e.id),a({id:`CZBqrX`,values:{displayName:n}}),s,`external`,r,t,i);return(0,$.jsx)(_o,{icon:(0,$.jsx)(Rn,{id:e.id,className:`size-4`,"aria-hidden":`true`}),name:a({id:`CZBqrX`,values:{displayName:n}}),hint:i===`absent`?{text:Re(`not-installed`,p),action:f}:void 0,status:l,action:(0,$.jsxs)($.Fragment,{children:[u,d===null?null:(0,$.jsx)(vo,{target:e.id,projectDir:d.contentDir,displayName:n},`${d.contentDir}:${e.id}`)]}),checked:r,disabled:yo(i,r),ariaLabel:a({id:`cdBape`,values:{displayName:n}}),testId:`configure-agents-desktop-${e.id}`,rowTestId:s,statusId:m,onToggle:n=>ze(it(e.id),Ct(e.id),`external`,n,t)},e.id)}),Yt.map(e=>{let t=Ce.find(t=>t.id===e)??null,n=t?.row.detected??null,r=E(e),i=ke(e,n),a=`agent-connection-${e}`,o=Ie(e,r,a,`external`,t===null||!R(t),n,i);return(0,$.jsx)(_o,{icon:(0,$.jsx)(T,{agentId:e,className:`size-4 text-muted-foreground`}),name:r,hint:i===`absent`?{text:Re(`not-detected`,o.residualFiles),action:o.hintAction}:void 0,status:o.status,action:o.action,ariaLabel:r,testId:`configure-agents-unlaunchable-${e}`,rowTestId:a,statusId:o.statusId},e)}),(0,$.jsx)(So,{hiddenCount:Xt,expanded:b,onToggle:()=>x(Lo),testId:`configure-agents-desktop-show-more`})]},`desktop`):null,on=[{node:nn,hasPresent:Zt},{node:rn,hasPresent:Qt},{node:an,hasPresent:en}].sort(Io).map(Fo),sn;t[60]===a?sn=t[61]:(sn=a({id:`lBN3T6`}),t[60]=a,t[61]=sn);let cn;t[62]===a?cn=t[63]:(cn=a({id:`D4I0F9`}),t[62]=a,t[63]=cn);let ln;t[64]!==sn||t[65]!==cn?(ln=(0,$.jsx)(qa,{titleId:`settings-configure-agents-title`,title:sn,children:cn}),t[64]=sn,t[65]=cn,t[66]=ln):ln=t[66];let un;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(un=(0,$.jsx)(Nn,{className:`-translate-y-1/2 absolute top-1/2 start-2.5 size-4 text-muted-foreground`,"aria-hidden":`true`}),t[67]=un):un=t[67];let dn;t[68]===Ue?dn=t[69]:(dn=e=>Ue(e.target.value),t[68]=Ue,t[69]=dn);let fn;t[70]===a?fn=t[71]:(fn=a({id:`-7s4fw`}),t[70]=a,t[71]=fn);let pn;t[72]===a?pn=t[73]:(pn=a({id:`-7s4fw`}),t[72]=a,t[73]=pn);let mn;t[74]!==f||t[75]!==dn||t[76]!==fn||t[77]!==pn?(mn=(0,$.jsxs)(`div`,{className:`relative`,children:[un,(0,$.jsx)(Pi,{value:f,onChange:dn,placeholder:fn,"aria-label":pn,className:`ps-8`,"data-testid":`configure-agents-search`})]}),t[74]=f,t[75]=dn,t[76]=fn,t[77]=pn,t[78]=mn):mn=t[78];let hn;t[79]!==a||t[80]!==K||t[81]!==W?(hn=W?(0,$.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2 rounded-md border px-3 py-2.5 text-muted-foreground text-sm`,"data-testid":`configure-agents-read-only`,children:[(0,$.jsx)(fi,{"aria-hidden":!0,className:`size-4 shrink-0`}),(0,$.jsx)(`span`,{children:a(K?{id:`AUORpp`}:{id:`RD8cCw`})})]}):null,t[79]=a,t[80]=K,t[81]=W,t[82]=hn):hn=t[82];let gn;t[83]!==a||t[84]!==V?(gn=V?(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border px-3 py-2.5 text-muted-foreground text-sm`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(Wa,{"aria-hidden":!0,className:`size-4 shrink-0`}),(0,$.jsx)(`span`,{role:`status`,children:a({id:`4sE6E9`})})]}),(0,$.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,className:`shrink-0`,onClick:()=>q(Po),children:a({id:`6gRgw8`})})]}):null,t[83]=a,t[84]=V,t[85]=gn):gn=t[85];let _n;t[86]!==a||t[87]!==wt?(_n=wt?(0,$.jsx)(`p`,{className:`py-6 text-center text-muted-foreground text-sm`,"data-testid":`configure-agents-no-results`,children:a({id:`Nay2Yr`})}):null,t[86]=a,t[87]=wt,t[88]=_n):_n=t[88];let vn=`configure:${J??`closed`}`,yn;t[89]===J?yn=t[90]:(yn=J!==null&&M(J),t[89]=J,t[90]=yn);let bn=we!==null,X;t[91]===ae?X=t[92]:(X=e=>{e||(ae.current!==null&&($e(ae.current,!1),ae.current=null),ne(null))},t[91]=ae,t[92]=X);let xn;t[93]!==De||t[94]!==we||t[95]!==ae?(xn=(e,t)=>we===null?Promise.resolve({ok:!1,report:{actions:[],conflicts:[],withheld:[]},snapshot:null}):De(O(we,e,t)).then(e=>(e.ok&&(ae.current=null),e)),t[93]=De,t[94]=we,t[95]=ae,t[96]=xn):xn=t[96];let Sn;t[97]!==we||t[98]!==vn||t[99]!==yn||t[100]!==bn||t[101]!==X||t[102]!==xn?(Sn=(0,$.jsx)(I,{connection:we,paired:yn,open:bn,onOpenChange:X,onSave:xn},vn),t[97]=we,t[98]=vn,t[99]=yn,t[100]=bn,t[101]=X,t[102]=xn,t[103]=Sn):Sn=t[103];let Cn=`remove:${re??`closed`}`,wn;t[104]===re?wn=t[105]:(wn=re!==null&&M(re),t[104]=re,t[105]=wn);let Tn=Te!==null,En;t[106]===Symbol.for(`react.memo_cache_sentinel`)?(En=e=>{e||ie(null)},t[106]=En):En=t[106];let Dn;t[107]!==De||t[108]!==Te?(Dn=e=>Te===null?Promise.resolve({ok:!1,report:{actions:[],conflicts:[],withheld:[]},snapshot:null}):De(z(Te,e===void 0?[]:e)),t[107]=De,t[108]=Te,t[109]=Dn):Dn=t[109];let On;t[110]!==Te||t[111]!==Cn||t[112]!==wn||t[113]!==Tn||t[114]!==Dn?(On=(0,$.jsx)(j,{connection:Te,paired:wn,open:Tn,onOpenChange:En,onRemove:Dn},Cn),t[110]=Te,t[111]=Cn,t[112]=wn,t[113]=Tn,t[114]=Dn,t[115]=On):On=t[115];let kn;return t[116]!==on||t[117]!==ln||t[118]!==mn||t[119]!==hn||t[120]!==gn||t[121]!==_n||t[122]!==Sn||t[123]!==On?(kn=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-configure-agents-title`,className:`space-y-6`,"data-field":`section:agent-connections`,"data-testid":`settings-configure-agents`,children:[ln,mn,hn,gn,_n,on,Sn,On]}),t[116]=on,t[117]=ln,t[118]=mn,t[119]=hn,t[120]=gn,t[121]=_n,t[122]=Sn,t[123]=On,t[124]=kn):kn=t[124],kn}function Po(e){return e+1}function Fo(e){return e.node}function Io(e,t){return Number(t.hasPresent)-Number(e.hasPresent)}function Lo(e){return!e}function Ro(e){return!e}function zo(e){return e!==void 0}function Bo(e){return Ct(e.id)}function Vo(e){return e!==void 0}function Ho(e){return Oo(e)}function Uo(e){let{signal:t}=e;return ut(t)}var Wo=`open-knowledge-app`;function Go({from:e,to:t}){try{bn.getTracer(Wo).startSpan(`ok.language.preferenceChanged`,{attributes:{"ok.language.from":e,"ok.language.to":t}}).end()}catch(e){console.warn(`[language-telemetry] span emit failed:`,e instanceof Error?e:String(e))}}var Ko=`open-knowledge-app`;function qo(e){let t=e.light.startsWith(`saved-`),n=e.dark.startsWith(`saved-`);return!t||!n?`incomplete`:e.light===e.dark?`same`:`different`}function Jo(e){try{bn.getTracer(Ko).startSpan(`ok.saved_themes.assignment`,{attributes:{"saved_theme.pair":qo(e)}}).end()}catch(e){console.warn(`[saved-theme-telemetry] assignment span emit failed:`,e instanceof Error?e:String(e))}}var Yo=`system`;function Xo(e){return typeof e==`string`&&gn.includes(e)}function Zo(e){return Xo(e)?e:Yo}function Qo(e){return new Intl.DisplayNames([e],{type:`language`}).of(e)??e}function $o(e){let t=(0,Q.c)(6),{choice:n}=e;if(n===Yo){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(m,{id:`D-NlUC`}),t[0]=e):e=t[0],e}let r;t[1]===n?r=t[2]:(r=Qo(n),t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=(0,$.jsx)(`span`,{lang:n,className:`capitalize`,children:r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function es(e){let t=(0,Q.c)(22),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({value:o,onValueChange:r,onBlur:n,ref:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===o?s=t[7]:(s=Zo(o),t[6]=o,t[7]=s);let c=s,l;t[8]===r?l=t[9]:(l=e=>r(Zo(e)),t[8]=r,t[9]=l);let u;t[10]===c?u=t[11]:(u=(0,$.jsx)(We,{children:(0,$.jsx)($o,{choice:c})}),t[10]=c,t[11]=u);let d;t[12]!==n||t[13]!==i||t[14]!==a||t[15]!==u?(d=(0,$.jsx)(Ue,{...a,ref:i,onBlur:n,size:`sm`,className:`w-48`,children:u}),t[12]=n,t[13]=i,t[14]=a,t[15]=u,t[16]=d):d=t[16];let f;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsxs)(He,{children:[(0,$.jsx)(Ve,{value:Yo,children:(0,$.jsx)($o,{choice:Yo})}),cn.map(ts)]}),t[17]=f):f=t[17];let p;return t[18]!==c||t[19]!==l||t[20]!==d?(p=(0,$.jsxs)(Ge,{value:c,onValueChange:l,children:[d,f]}),t[18]=c,t[19]=l,t[20]=d,t[21]=p):p=t[21],p}function ts(e){return(0,$.jsx)(Ve,{value:e,children:(0,$.jsx)($o,{choice:e})},e)}function ns(e){return{chrome:e.sidebar,surface:e.background,bar:e.primary,line:e.border,dots:[e[`syntax-string`],e[`syntax-keyword`],e[`syntax-atom`]]}}function rs(e,t,n){return e.id===`custom`?ns(Zt(Ji(t))):e.scheme?ns(Zt(e.scheme)):ns(Hi(n))}function is(e){let t=(0,Q.c)(38),{theme:n,customSeed:r,slotMode:i}=e,a,o,s,c,l,u,d,f,p,m;t[0]!==r||t[1]!==i||t[2]!==n?(a=rs(n,r,i),u=!0,d=``,f=`aspect-[4/3] w-full overflow-hidden rounded-md border`,p={backgroundColor:a.surface,borderColor:a.line},m=(0,$.jsxs)(`div`,{className:`flex h-1/3 items-center gap-1 px-1.5`,style:{backgroundColor:a.chrome,borderBottom:`1px solid ${a.line}`},children:[(0,$.jsx)(`span`,{className:`h-1.5 w-5 rounded-full`,style:{backgroundColor:a.bar}}),(0,$.jsx)(`span`,{className:`h-1.5 flex-1 rounded-full opacity-50`,style:{backgroundColor:a.line}})]}),l=`flex h-2/3`,o=`flex w-1/4 flex-col items-center justify-center gap-1`,s={backgroundColor:a.chrome,borderRight:`1px solid ${a.line}`},c=a.dots.map(as),t[0]=r,t[1]=i,t[2]=n,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m):(a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12]);let h;t[13]!==o||t[14]!==s||t[15]!==c?(h=(0,$.jsx)(`div`,{className:o,style:s,children:c}),t[13]=o,t[14]=s,t[15]=c,t[16]=h):h=t[16];let g;t[17]===a.dots[1]?g=t[18]:(g=(0,$.jsx)(`span`,{className:`h-1.5 w-3/4 rounded-full`,style:{backgroundColor:a.dots[1]}}),t[17]=a.dots[1],t[18]=g);let _;t[19]===a.line?_=t[20]:(_=(0,$.jsx)(`span`,{className:`h-1.5 w-1/2 rounded-full opacity-60`,style:{backgroundColor:a.line}}),t[19]=a.line,t[20]=_);let v;t[21]===a.dots[0]?v=t[22]:(v=(0,$.jsx)(`span`,{className:`h-1.5 w-2/3 rounded-full`,style:{backgroundColor:a.dots[0]}}),t[21]=a.dots[0],t[22]=v);let y;t[23]!==g||t[24]!==_||t[25]!==v?(y=(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col justify-center gap-1 px-1.5`,children:[g,_,v]}),t[23]=g,t[24]=_,t[25]=v,t[26]=y):y=t[26];let b;t[27]!==h||t[28]!==y||t[29]!==l?(b=(0,$.jsxs)(`div`,{className:l,children:[h,y]}),t[27]=h,t[28]=y,t[29]=l,t[30]=b):b=t[30];let x;return t[31]!==b||t[32]!==u||t[33]!==d||t[34]!==f||t[35]!==p||t[36]!==m?(x=(0,$.jsxs)(`div`,{"aria-hidden":u,"data-theme-swatch":d,className:f,style:p,children:[m,b]}),t[31]=b,t[32]=u,t[33]=d,t[34]=f,t[35]=p,t[36]=m,t[37]=x):x=t[37],x}function as(e,t){return(0,$.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{backgroundColor:e}},t)}function os(e){return b(`size-6 min-w-6 rounded-md border p-0 transition-colors`,e?`border-primary bg-primary/15 text-primary hover:bg-primary/20 data-[state=on]:bg-primary/15`:`border-border/70 text-muted-foreground/70 hover:text-foreground`)}function ss(e){return b(`size-3.5`,e&&`fill-current`)}function cs(e){let t=(0,Q.c)(33),{selection:n,themes:r,unavailableThemes:i,onAssign:a,editControl:o,deleteControl:s,createControl:c,slotMode:l,customSeed:u,firstItemId:d,"aria-label":f,"aria-describedby":p,"aria-invalid":m}=e,g=r===void 0?an:r,_;t[0]===i?_=t[1]:(_=i===void 0?[]:i,t[0]=i,t[1]=_);let v=_,y=l===void 0?`light`:l,{_:x}=h(),S;if(t[2]!==x||t[3]!==u||t[4]!==s||t[5]!==o||t[6]!==d||t[7]!==a||t[8]!==n||t[9]!==y||t[10]!==g){let e;t[12]!==x||t[13]!==u||t[14]!==s||t[15]!==o||t[16]!==d||t[17]!==a||t[18]!==n||t[19]!==y?(e=(e,t)=>{let r=n.light===e.id,i=n.dark===e.id,c=o?.themeIds.includes(e.id)??!1,l=s?.themeIds.includes(e.id)??!1,f=o?.selectedId===e.id,p=x(y===`light`?{id:`hgF0al`,values:{0:e.label}}:{id:`6Nea1q`,values:{0:e.label}});return(0,$.jsxs)(`fieldset`,{"aria-label":e.label,className:b(`relative flex min-w-0 flex-col gap-1.5 rounded-lg border-2 p-1 text-left`,n[y]===e.id?`border-primary`:`border-transparent`),children:[(0,$.jsx)(H,{type:`button`,variant:`ghost`,"aria-label":p,"data-theme-focus-target":``,onClick:()=>a(y,e.id),className:`h-auto w-full cursor-pointer p-0 transition-opacity hover:bg-transparent hover:opacity-90`,children:(0,$.jsx)(is,{theme:e,customSeed:u,slotMode:y})}),l?(0,$.jsx)(H,{type:`button`,variant:`outline`,size:`icon-sm`,title:x({id:`Y2tU6I`,values:{0:e.label}}),"aria-label":x({id:`Y2tU6I`,values:{0:e.label}}),className:`absolute top-2 end-2 z-10 border-border/80 bg-background/85 text-muted-foreground shadow-sm backdrop-blur-sm hover:border-destructive/50 hover:bg-destructive/15 hover:text-destructive focus-visible:border-destructive/50 focus-visible:text-destructive focus-visible:ring-destructive/20 dark:bg-background/80 dark:hover:bg-destructive/20`,onClick:async t=>{let n=t.currentTarget.closest(`fieldset`),r=n?.previousElementSibling?.querySelector(`[data-theme-focus-target]`)??n?.nextElementSibling?.querySelector(`[data-theme-focus-target]`);await s?.onDelete(e.id)!==!1&&r?.focus()},children:(0,$.jsx)(di,{"aria-hidden":!0})}):null,(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-1 px-0.5`,children:[(0,$.jsx)(`span`,{className:`truncate text-1sm font-medium text-foreground`,children:e.label}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[c?(0,$.jsx)(Xe,{className:os(f),pressed:f,onPressedChange:t=>{o?.onSelect(t?e.id:null)},"aria-label":x(f?{id:`8x6zk9`,values:{0:e.label}}:{id:`N6j2JH`,values:{0:e.label}}),children:(0,$.jsx)(Pn,{className:`size-3.5`})}):null,(0,$.jsx)(Xe,{id:t===0?d:void 0,className:os(r),pressed:r,onPressedChange:t=>{t&&a(`light`,e.id)},"aria-label":x({id:`sq4WQH`,values:{0:e.label}}),children:(0,$.jsx)(Er,{className:ss(r)})}),(0,$.jsx)(Xe,{className:os(i),pressed:i,onPressedChange:t=>{t&&a(`dark`,e.id)},"aria-label":x({id:`lZvQrY`,values:{0:e.label}}),children:(0,$.jsx)(Dr,{className:ss(i)})})]})]})]},e.id)},t[12]=x,t[13]=u,t[14]=s,t[15]=o,t[16]=d,t[17]=a,t[18]=n,t[19]=y,t[20]=e):e=t[20],S=g.map(e),t[2]=x,t[3]=u,t[4]=s,t[5]=o,t[6]=d,t[7]=a,t[8]=n,t[9]=y,t[10]=g,t[11]=S}else S=t[11];let C;t[21]!==x||t[22]!==c?(C=c?(0,$.jsxs)(H,{type:`button`,variant:`ghost`,onClick:c.onCreate,className:`group h-auto min-w-0 flex-col items-stretch gap-1.5 rounded-lg border-2 border-transparent p-1 text-left text-muted-foreground hover:bg-transparent hover:text-foreground`,children:[(0,$.jsx)(`span`,{className:`flex aspect-[4/3] w-full items-center justify-center rounded-md border border-dashed border-border bg-muted/10 transition-colors group-hover:border-foreground/40`,children:(0,$.jsx)(Mn,{"aria-hidden":!0,className:`size-6`})}),(0,$.jsx)(`span`,{className:`truncate px-0.5 text-1sm font-medium`,children:x({id:`AJ7_B2`})})]}):null,t[21]=x,t[22]=c,t[23]=C):C=t[23];let w;t[24]===v?w=t[25]:(w=v.map(ls),t[24]=v,t[25]=w);let T;return t[26]!==p||t[27]!==m||t[28]!==f||t[29]!==S||t[30]!==C||t[31]!==w?(T=(0,$.jsxs)(`fieldset`,{"aria-label":f,"aria-describedby":p,"aria-invalid":m,className:`grid w-full min-w-0 grid-cols-2 gap-2 sm:grid-cols-3`,children:[S,C,w]}),t[26]=p,t[27]=m,t[28]=f,t[29]=S,t[30]=C,t[31]=w,t[32]=T):T=t[32],T}function ls(e){return(0,$.jsxs)(`fieldset`,{"aria-label":e.label,className:`flex min-w-0 flex-col gap-1.5 rounded-lg border-2 border-destructive/40 bg-destructive/5 p-1 text-left`,children:[(0,$.jsx)(`div`,{"aria-hidden":!0,className:`flex aspect-[4/3] w-full items-center justify-center rounded-md border border-destructive/30 bg-muted/40 text-destructive`,children:(0,$.jsx)(fr,{className:`size-6`})}),(0,$.jsx)(`span`,{className:`truncate px-0.5 text-1sm font-medium text-foreground`,children:e.label}),(0,$.jsx)(`span`,{className:`px-0.5 text-xs font-medium text-destructive`,children:e.problem}),(0,$.jsx)(`span`,{className:`px-0.5 pb-0.5 text-xs text-muted-foreground`,children:e.detail})]},e.key)}var us=12e3;function ds(e){let t=(0,Q.c)(210),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({appearance:n,onAssign:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{_:a}=h(),{themes:o,warnings:s,truncated:c,loadError:l,refresh:u,deleteTheme:d,restoreTheme:f,editingThemeId:p,themeEditorOpen:m,selectThemeToEdit:g}=ji(),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(``),[x,S]=(0,Z.useState)(null),[C,w]=(0,Z.useState)(!1),T=(0,Z.useRef)(null),E,D;t[4]===u?(E=t[5],D=t[6]):(E=()=>{u()},D=[u],t[4]=u,t[5]=E,t[6]=D),(0,Z.useEffect)(E,D);let O;t[7]!==n||t[8]!==o?(O=Ot(n,o),t[7]=n,t[8]=o,t[9]=O):O=t[9];let k=O,A,j,M,N,P,F,I,L,R,z,B,V,U,W,G,K,ee,te,q,J,ne;if(t[10]!==a||t[11]!==x||t[12]!==y||t[13]!==_||t[14]!==d||t[15]!==p||t[16]!==C||t[17]!==l||t[18]!==r||t[19]!==i||t[20]!==u||t[21]!==f||t[22]!==g||t[23]!==k||t[24]!==m||t[25]!==o||t[26]!==c||t[27]!==s){let e=$t(y),n;t[49]===o?n=t[50]:(n=o.filter(gs),t[49]=o,t[50]=n);let h=n,E,D,O,re,ie,ae,oe,se,ce;if(t[51]!==a||t[52]!==y||t[53]!==d||t[54]!==p||t[55]!==h||t[56]!==C||t[57]!==l||t[58]!==r||t[59]!==i||t[60]!==u||t[61]!==f||t[62]!==g||t[63]!==k||t[64]!==m||t[65]!==o||t[66]!==c||t[67]!==s){let e=o.flatMap(hs),n;t[80]!==a||t[81]!==u||t[82]!==f?(n=async function(e){let t=await f({id:e.id,name:e.scheme.name,stem:e.stem,scheme:{...e.scheme,palette:{...e.scheme.palette}},extension:e.filename.endsWith(`.yml`)?`.yml`:`.yaml`});if(t.ok){await u(),X.success(a({id:`Kx881F`,values:{0:e.label}}));return}if(t.reason===`name-taken`){X.error(a({id:`oZUYMv`,values:{0:e.label}}));return}X.error(a({id:`7O7REc`,values:{0:e.label}}))},t[80]=a,t[81]=u,t[82]=f,t[83]=n):n=t[83];let _=n;O=async function(t){let n=e.find(e=>e.id===t);if(!n)return X.error(a({id:`ANFxWn`})),!1;let r=await d(n.id);if(!r.ok)return X.error(a({id:`kkux8f`,values:{0:n.label}})),!1;if(p===n.id&&g(null),await u(),!r.existed)return X(a({id:`ekSPiP`,values:{0:n.label}})),!0;let i={...n,filename:r.filename,label:r.scheme.name,scheme:r.scheme};return X(a({id:`YCmS3k`,values:{0:i.label}}),{duration:us,action:{label:a({id:`9uI_rE`}),onClick:()=>_(i)}}),!0};let x;t[84]!==a||t[85]!==y||t[86]!==C||t[87]!==r||t[88]!==i||t[89]!==u||t[90]!==f||t[91]!==g||t[92]!==k||t[93]!==o?(x=async function(e){if(e.preventDefault(),C)return;let t=$t(y);if(!t.ok){S(a({id:`RG3yW6`})),T.current?.focus();return}let n=i.slotMode??`light`,s=o.find(e=>e.id===k[n])?.scheme??Ji(i.customSeed),c={name:t.name,variant:s.variant,palette:{...s.palette}};S(null),w(!0);let l=await f({id:t.id,name:t.name,scheme:c});if(!l.ok){S(l.reason===`name-taken`?a({id:`_IfSZn`}):l.reason===`name-invalid`?a({id:`qtnmEX`}):a({id:`DmkTrb`})),w(!1),T.current?.focus();return}let d={id:l.id,label:c.name,kind:c.variant,scheme:c,toTokens:()=>Zt(c)};r(n,l.id,k,[...o,d]),await u(),b(``),v(!1),w(!1),g(l.id)},t[84]=a,t[85]=y,t[86]=C,t[87]=r,t[88]=i,t[89]=u,t[90]=f,t[91]=g,t[92]=k,t[93]=o,t[94]=x):x=t[94],D=x;let A;if(t[95]!==a||t[96]!==s){let e;t[98]===a?e=t[99]:(e=e=>{let t;bb90:switch(e.code){case`unparseable`:t=a({id:`g12y1g`});break bb90;case`not-a-scheme`:t=a({id:`p7Utw8`});break bb90;case`missing-slots`:t=a({id:`GUZHkL`});break bb90;case`bad-hex`:t=a({id:`IMLUBh`});break bb90;case`empty`:t=a({id:`k_tFzX`});break bb90;case`too-long`:t=a({id:`FyyIjH`});break bb90;case`invalid-chars`:t=a({id:`JaU1ld`});break bb90;case`unsupported-extension-case`:t=a({id:`R30SFt`});break bb90;case`duplicate-identity`:t=a({id:`DUb7Ax`});break bb90;case`symlink`:t=a({id:`hFmYGU`});break bb90;case`not-regular-file`:t=a({id:`UH0Zqw`});break bb90;case`file-too-large`:t=a({id:`-othoN`});break bb90;case`read-failed`:t=a({id:`cLn264`});break bb90;default:t=a({id:`WBNpt9`,values:{0:e.code}})}return{key:e.filename,label:e.filename,problem:t,detail:e.conflictingFilenames?a({id:`QwG_zJ`,values:{0:e.conflictingFilenames.join(`, `)}}):a({id:`kwNS82`})}},t[98]=a,t[99]=e),A=s.map(e),t[95]=a,t[96]=s,t[97]=A}else A=t[97];let j=A;V=`flex w-full min-w-0 flex-col gap-2`,t[100]!==a||t[101]!==l||t[102]!==u?(U=l?(0,$.jsxs)(`div`,{role:`alert`,className:`flex items-center justify-between gap-2 rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-foreground`,children:[(0,$.jsx)(`span`,{children:a({id:`hVzt9x`})}),(0,$.jsx)(H,{type:`button`,variant:`outline`,size:`xs`,onClick:()=>void u(),children:a({id:`KDw4GX`})})]}):null,t[100]=a,t[101]=l,t[102]=u,t[103]=U):U=t[103];let M;t[104]!==a||t[105]!==c?(M=c?(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-sm text-foreground`,children:[(0,$.jsx)(fi,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-amber-600`}),(0,$.jsx)(`span`,{children:a({id:`DLIljL`})})]}):null,t[104]=a,t[105]=c,t[106]=M):M=t[106],t[107]===M?W=t[108]:(W=(0,$.jsx)(`div`,{role:`status`,children:M}),t[107]=M,t[108]=W),E=cs,ie=i,ae=k,oe=h,se=j;let N;t[109]===o?N=t[110]:(N=o.filter(ms).map(ps),t[109]=o,t[110]=N);let P=m?p:null;t[111]!==g||t[112]!==N||t[113]!==P?(ce={themeIds:N,selectedId:P,onSelect:g},t[111]=g,t[112]=N,t[113]=P,t[114]=ce):ce=t[114],re=e.map(fs),t[51]=a,t[52]=y,t[53]=d,t[54]=p,t[55]=h,t[56]=C,t[57]=l,t[58]=r,t[59]=i,t[60]=u,t[61]=f,t[62]=g,t[63]=k,t[64]=m,t[65]=o,t[66]=c,t[67]=s,t[68]=E,t[69]=D,t[70]=O,t[71]=V,t[72]=U,t[73]=W,t[74]=re,t[75]=ie,t[76]=ae,t[77]=oe,t[78]=se,t[79]=ce}else E=t[68],D=t[69],O=t[70],V=t[71],U=t[72],W=t[73],re=t[74],ie=t[75],ae=t[76],oe=t[77],se=t[78],ce=t[79];let le;t[115]!==O||t[116]!==re?(le={themeIds:re,onDelete:O},t[115]=O,t[116]=re,t[117]=le):le=t[117];let ue;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(ue={onCreate:()=>v(!0)},t[118]=ue):ue=t[118];let de;t[119]!==r||t[120]!==k||t[121]!==o?(de=(e,t)=>r(e,t,k,o),t[119]=r,t[120]=k,t[121]=o,t[122]=de):de=t[122],t[123]!==E||t[124]!==ie||t[125]!==ae||t[126]!==oe||t[127]!==se||t[128]!==ce||t[129]!==le||t[130]!==de?(G=(0,$.jsx)(E,{...ie,selection:ae,themes:oe,unavailableThemes:se,editControl:ce,deleteControl:le,createControl:ue,onAssign:de}),t[123]=E,t[124]=ie,t[125]=ae,t[126]=oe,t[127]=se,t[128]=ce,t[129]=le,t[130]=de,t[131]=G):G=t[131],P=Si,z=_,t[132]===C?B=t[133]:(B=e=>{C||v(e)},t[132]=C,t[133]=B),N=_i;let fe;t[134]===a?fe=t[135]:(fe=a({id:`Z_nNa2`}),t[134]=a,t[135]=fe);let pe;t[136]===fe?pe=t[137]:(pe=(0,$.jsx)(gi,{children:fe}),t[136]=fe,t[137]=pe);let me;t[138]===a?me=t[139]:(me=a({id:`nTM8ab`}),t[138]=a,t[139]=me);let he;t[140]===me?he=t[141]:(he=(0,$.jsx)(hi,{children:me}),t[140]=me,t[141]=he),t[142]!==pe||t[143]!==he?(R=(0,$.jsxs)(xi,{className:`gap-2`,children:[pe,he]}),t[142]=pe,t[143]=he,t[144]=R):R=t[144],M=vi,F=`create-saved-theme-form`,I=!0,L=D,j=Ei,q=x!==null;let ge;t[145]===a?ge=t[146]:(ge=a({id:`HZ7fEu`}),t[145]=a,t[146]=ge),t[147]===ge?J=t[148]:(J=(0,$.jsx)(wi,{htmlFor:`create-saved-theme-name`,children:ge}),t[147]=ge,t[148]=J);let _e=x!==null,ve=x?`create-saved-theme-help create-saved-theme-error`:`create-saved-theme-help`,ye;t[149]===x?ye=t[150]:(ye=e=>{b(e.target.value),x&&S(null)},t[149]=x,t[150]=ye),t[151]!==y||t[152]!==C||t[153]!==_e||t[154]!==ve||t[155]!==ye?(ne=(0,$.jsx)(Pi,{ref:T,id:`create-saved-theme-name`,value:y,autoFocus:!0,autoComplete:`off`,required:!0,readOnly:C,"aria-invalid":_e,"aria-describedby":ve,onChange:ye}),t[151]=y,t[152]=C,t[153]=_e,t[154]=ve,t[155]=ye,t[156]=ne):ne=t[156],A=Ti,K=`create-saved-theme-help`,ee=`font-mono`,te=e.ok?a({id:`Yb82LN`,values:{0:e.stem}}):a({id:`4d0VYJ`}),t[10]=a,t[11]=x,t[12]=y,t[13]=_,t[14]=d,t[15]=p,t[16]=C,t[17]=l,t[18]=r,t[19]=i,t[20]=u,t[21]=f,t[22]=g,t[23]=k,t[24]=m,t[25]=o,t[26]=c,t[27]=s,t[28]=A,t[29]=j,t[30]=M,t[31]=N,t[32]=P,t[33]=F,t[34]=I,t[35]=L,t[36]=R,t[37]=z,t[38]=B,t[39]=V,t[40]=U,t[41]=W,t[42]=G,t[43]=K,t[44]=ee,t[45]=te,t[46]=q,t[47]=J,t[48]=ne}else A=t[28],j=t[29],M=t[30],N=t[31],P=t[32],F=t[33],I=t[34],L=t[35],R=t[36],z=t[37],B=t[38],V=t[39],U=t[40],W=t[41],G=t[42],K=t[43],ee=t[44],te=t[45],q=t[46],J=t[47],ne=t[48];let re;t[157]!==A||t[158]!==K||t[159]!==ee||t[160]!==te?(re=(0,$.jsx)(A,{id:K,className:ee,children:te}),t[157]=A,t[158]=K,t[159]=ee,t[160]=te,t[161]=re):re=t[161];let ie;t[162]===x?ie=t[163]:(ie=x?(0,$.jsx)(Ci,{id:`create-saved-theme-error`,children:x}):null,t[162]=x,t[163]=ie);let ae;t[164]!==j||t[165]!==re||t[166]!==ie||t[167]!==q||t[168]!==J||t[169]!==ne?(ae=(0,$.jsxs)(j,{"data-invalid":q,children:[J,ne,re,ie]}),t[164]=j,t[165]=re,t[166]=ie,t[167]=q,t[168]=J,t[169]=ne,t[170]=ae):ae=t[170];let oe;t[171]!==F||t[172]!==I||t[173]!==L||t[174]!==ae?(oe=(0,$.jsx)(`form`,{id:F,noValidate:I,onSubmit:L,children:ae}),t[171]=F,t[172]=I,t[173]=L,t[174]=ae,t[175]=oe):oe=t[175];let se;t[176]!==M||t[177]!==oe?(se=(0,$.jsx)(M,{children:oe}),t[176]=M,t[177]=oe,t[178]=se):se=t[178];let ce;t[179]===Symbol.for(`react.memo_cache_sentinel`)?(ce=()=>v(!1),t[179]=ce):ce=t[179];let le;t[180]===a?le=t[181]:(le=a({id:`dEgA5A`}),t[180]=a,t[181]=le);let ue;t[182]!==C||t[183]!==le?(ue=(0,$.jsx)(H,{type:`button`,variant:`outline`,disabled:C,onClick:ce,children:le}),t[182]=C,t[183]=le,t[184]=ue):ue=t[184];let de;t[185]!==a||t[186]!==C?(de=a(C?{id:`_DwR-n`}:{id:`cuHhjo`}),t[185]=a,t[186]=C,t[187]=de):de=t[187];let fe;t[188]!==C||t[189]!==de?(fe=(0,$.jsx)(H,{type:`submit`,form:`create-saved-theme-form`,disabled:C,children:de}),t[188]=C,t[189]=de,t[190]=fe):fe=t[190];let pe;t[191]!==ue||t[192]!==fe?(pe=(0,$.jsxs)(yi,{children:[ue,fe]}),t[191]=ue,t[192]=fe,t[193]=pe):pe=t[193];let me;t[194]!==N||t[195]!==R||t[196]!==se||t[197]!==pe?(me=(0,$.jsxs)(N,{children:[R,se,pe]}),t[194]=N,t[195]=R,t[196]=se,t[197]=pe,t[198]=me):me=t[198];let he;t[199]!==P||t[200]!==z||t[201]!==B||t[202]!==me?(he=(0,$.jsx)(P,{open:z,onOpenChange:B,children:me}),t[199]=P,t[200]=z,t[201]=B,t[202]=me,t[203]=he):he=t[203];let ge;return t[204]!==V||t[205]!==U||t[206]!==W||t[207]!==G||t[208]!==he?(ge=(0,$.jsxs)(`div`,{className:V,children:[U,W,G,he]}),t[204]=V,t[205]=U,t[206]=W,t[207]=G,t[208]=he,t[209]=ge):ge=t[209],ge}function fs(e){return e.id}function ps(e){return e.id}function ms(e){return e.id.startsWith(`saved-`)}function hs(e){let t=Mt(e.id);return!t.ok||!e.scheme?[]:[{id:e.id,stem:t.stem,label:e.label,scheme:e.scheme}]}function gs(e){return e.id!==`custom`}function _s(e,t){if(e.length===0)throw Error(`buildPatch: path must be non-empty`);let[n,...r]=e;return r.length===0?{[String(n)]:t}:{[String(n)]:_s(r,t)}}function vs(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(e?.type===`default`){let t=e.defaultValue;return typeof t==`function`?t():t}let n=t?._zod?.def?.innerType;if(n===void 0)return;t=n}}function ys(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(!e)return;if(e.type===`default`||e.type===`optional`||e.type===`nullable`){t=e.innerType;continue}return e.type}}function bs(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(!e)return;if(e.type===`enum`)return e.entries?Object.values(e.entries):void 0;if(e.innerType!==void 0){t=e.innerType;continue}return}}function xs(e){let t=(0,Q.c)(14),n;t[0]===e?n=t[1]:(n=e.current(),t[0]=e,t[1]=n);let r=n,i;t[2]===r?i=t[3]:(i={defaultValues:r,mode:`onBlur`},t[2]=r,t[3]=i);let a=Oa(i),o,s;t[4]!==e||t[5]!==a?(o=()=>e.subscribe(e=>{Ss(a,e)}),s=[e,a],t[4]=e,t[5]=a,t[6]=o,t[7]=s):(o=t[6],s=t[7]),(0,Z.useEffect)(o,s);let c;t[8]!==e||t[9]!==a?(c=t=>Cs(a,e,t),t[8]=e,t[9]=a,t[10]=c):c=t[10];let l=c,u;return t[11]!==l||t[12]!==a?(u={form:a,commitField:l},t[11]=l,t[12]=a,t[13]=u):u=t[13],u}function Ss(e,t){e.reset(t,{keepDirtyValues:!0,keepDirty:!0,keepTouched:!0})}function Cs(e,t,n){let r=e.getValues(n),i=_s(Es(n),r),a=t.patch(i);if(a.ok)return e.clearErrors(n),e.resetField(n,{defaultValue:r,keepError:!1}),!0;if(vt(a.error)&&a.error.code===`SCHEMA_INVALID`&&a.error.issues.length>0){e.clearErrors(n);for(let t of a.error.issues){let r=t.path.length>0?t.path.map(String).join(`.`):n;e.setError(r,{type:`config-binding`,message:t.message})}}else e.setError(n,{type:`config-binding`,message:ws(a.error,n)});return!1}function ws(e,t){if(vt(e)&&e.code===`SCHEMA_INVALID`){let n=e.issues.find(e=>Ts(e,t));if(n)return n.message}return _n(e)}function Ts(e,t){return e.path.map(String).join(`.`)===t}function Es(e){return e.split(`.`)}function Ds(e){if(!vt(e)||e.code!==`SCHEMA_INVALID`)return null;let t=e.issues[0];return!t||t.path.length===0?null:t.path.map(String).join(`.`)}function Os(){let e=(0,Q.c)(3),t,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(ia,{className:`h-5 w-32`}),n=(0,$.jsx)(ia,{className:`h-4 w-64`}),e[0]=t,e[1]=n):(t=e[0],n=e[1]);let r;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsxs)(`div`,{className:`space-y-3`,children:[t,n,(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(ia,{className:`h-9 w-full`}),(0,$.jsx)(ia,{className:`h-9 w-full`})]})]}),e[2]=r):r=e[2],r}function ks({field:e,scope:t,commitField:n,isFlashed:r}){"use no memo";let{_:i}=h(),a=Ma(),{setTheme:o}=_(),s=Fn(),c=Lt(St,e.path),l=c?ys(c):void 0,u=c?vs(c):void 0,d=c?bs(c):void 0,f=c?Kt(c):void 0,p=f?.scope===`project`&&t!==`project`||f?.scope===`user`&&t!==`user`,g=e.path.join(`.`),v=i(e.label),[y,x]=(0,Z.useState)(!1),S=(0,Z.useRef)(null);(0,Z.useEffect)(()=>()=>{S.current&&clearTimeout(S.current)},[]);let C=()=>{x(!0),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>x(!1),1200)},w=()=>{let e=n(g);return e&&C(),e},T=()=>a.getFieldState(g).isDirty?w():!0,E=()=>{if(e.control===`theme-tiles`){let e=s?.userBinding;if(!e)return;let t=e.patch({appearance:Vi()});t.ok?C():a.setError(g,{type:`manual`,message:ws(t.error,g)});return}let t=u===void 0?null:u;a.setValue(g,t,{shouldDirty:!1}),e.control===`theme-cards`&&o(Ln(t)),w()},D=b(`relative`,r&&`animate-settings-flash`);return(0,$.jsx)(ka,{control:a.control,name:g,render:({field:n})=>{let r=!p&&(u!==void 0||n.value!==void 0);return(0,$.jsxs)(Da,{className:D,"data-field":e.path.join(`.`),"data-scope":t,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(ja,{className:`text-sm font-medium`,children:v}),r?(0,$.jsxs)(K,{children:[(0,$.jsx)(U,{asChild:!0,children:(0,$.jsx)(H,{variant:`ghost`,size:`icon`,className:`h-5 w-5 text-muted-foreground opacity-60 hover:opacity-100`,onClick:E,"aria-label":i({id:`lhjq3G`,values:{labelText:v}}),children:(0,$.jsx)(li,{className:`size-3.5`})})}),(0,$.jsx)(W,{children:(0,$.jsx)(m,{id:`L-rMC9`})})]}):null]}),e.description?(0,$.jsx)(Na,{className:`text-muted-foreground text-1sm`,children:i(e.description)}):null,(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Aa,{children:(0,$.jsx)(js,{field:e,ctl:n,typeTag:l,enumOptions:d,onCommit:T,onRevertToBaseline:()=>a.resetField(g,{keepError:!0}),onSavedOutsideForm:C,onWriteRejected:e=>{a.setError(g,{type:`manual`,message:ws(e,g)})}})}),(0,$.jsx)(Fs,{visible:y,srOnly:As(e.control)})]}),(0,$.jsx)(Pa,{"data-field-error":e.path.join(`.`)})]})}})}function As(e){return e===`theme-tiles`||e===`theme-cards`}function js({field:e,ctl:t,typeTag:n,enumOptions:r,onCommit:i,onRevertToBaseline:a,onSavedOutsideForm:o,onWriteRejected:s,...c}){"use no memo";let{_:l}=h(),{setTheme:u,systemTheme:d}=_(),f=Fn(),p=f?.merged??null;if(e.control===`language-select`)return(0,$.jsx)(es,{...c,value:t.value,ref:t.ref,onBlur:t.onBlur,onValueChange:e=>{let n=Yi(t.value)??`system`;n!==e&&Go({from:n,to:e}),t.onChange(e),i()}});if(e.control===`theme-cards`){let{id:n,...r}=c;return(0,$.jsx)(Or,{...r,firstItemId:n,value:Ln(t.value),"aria-label":l(e.label),onValueChange:e=>{let n=Ln(t.value);u(e),t.onChange(e),!i()&&(u(n),a())}})}if(e.control===`theme-tiles`){let{id:t,...n}=c,r=p?.appearance?.customTheme,i=p?.appearance?.theme,a=ht(i,d===`dark`);return(0,$.jsx)(ds,{...n,firstItemId:t,appearance:p?.appearance,customSeed:r,slotMode:a,"aria-label":l(e.label),onAssign:(e,t,n,c)=>{let l=f?.userBinding;if(!l)return;let d={...n,[e]:t},p=e=>{let t=e[a];return t===`custom`?Wi(Ji(r)):Bi(t,c)};zi({selection:d,modePreference:i,slotMode:a,customSeed:r,themes:c}),u(p(d)??i??`system`);let m=l.patch({appearance:Gi(d)});if(m.ok){Jo(d),o();return}zi({selection:n,modePreference:i,slotMode:a,customSeed:r,themes:c}),u(p(n)??i??`system`),s(m.error)}})}if(n===`boolean`)return(0,$.jsx)(Je,{...c,checked:!!t.value,ref:t.ref,onCheckedChange:e=>{t.onChange(e),i()},onBlur:t.onBlur});if(n===`enum`&&r&&r.length>0&&(e.control===`enum-toggle`||r.length<=4)){let{id:n,...a}=c;return(0,$.jsx)(Ze,{...a,type:`single`,value:typeof t.value==`string`?t.value:``,ref:t.ref,onValueChange:e=>{e&&(t.onChange(e),i())},onBlur:t.onBlur,variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-lg`,"aria-label":l(e.label),children:r.map((e,t)=>(0,$.jsx)(Ye,{value:e,id:t===0?n:void 0,className:`text-1sm capitalize`,children:e},e))})}return n===`number`||n===`int`?(0,$.jsx)(Ns,{ctl:t,onCommit:i,...c}):n===`array`?(0,$.jsx)(Ps,{ctl:t,onCommit:i,...c}):(0,$.jsx)(Ms,{ctl:t,onCommit:i,...c})}function Ms({ctl:e,onCommit:t,...n}){"use no memo";return(0,$.jsx)(Pi,{...n,value:typeof e.value==`string`?e.value:``,ref:e.ref,onChange:t=>e.onChange(t.target.value),onBlur:()=>{e.onBlur(),t()},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),t())},className:`h-8 text-sm`})}function Ns({ctl:e,onCommit:t,...n}){"use no memo";let[r,i]=(0,Z.useState)(e.value===void 0?``:String(e.value)),a=(0,Z.useRef)(e.value);(0,Z.useEffect)(()=>{a.current!==e.value&&(i(e.value===void 0?``:String(e.value)),a.current=e.value)},[e.value]);let o=()=>{let n=Number(r);if(!Number.isFinite(n)){e.onChange(r),t();return}e.onChange(n),t(),a.current=n};return(0,$.jsx)(Pi,{...n,type:`number`,value:r,ref:e.ref,onChange:e=>i(e.target.value),onBlur:()=>{e.onBlur(),o()},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),o())},className:`h-8 w-28 text-sm tabular-nums`})}function Ps({ctl:e,onCommit:t,...n}){"use no memo";let r=Array.isArray(e.value)?e.value.join(`
2
2
  `):``,[i,a]=(0,Z.useState)(r),o=(0,Z.useRef)(r);(0,Z.useEffect)(()=>{let t=Array.isArray(e.value)?e.value.join(`
3
3
  `):``;t!==o.current&&(a(t),o.current=t)},[e.value]);let s=()=>{let n=i.split(`
4
4
  `).map(e=>e.trim()).filter(e=>e.length>0);e.onChange(n),t(),o.current=n.join(`
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-BeFNZANd.js";import{n as s}from"./dist-CJhtNlOm2.js";import{t as ee}from"./dist-Cr4-nBVI.js";import{t as c}from"./desktop-bridge-types-oYPdTDmz.js";import{n as l,t as te}from"./git-branch-B_QTfwFA.js";import{t as u}from"./spinner-D7ppCG-D.js";import{n as ne,t as d}from"./miss-dialog-store-CWiUu3y7.js";import{a as re,c as ie,i as ae,n as oe,o as f,s as se,t as ce}from"./dialog-BTFtzetj.js";import{t as le}from"./tool-list-format-BBT_vsDw.js";import{i as ue,n as p,t as m}from"./auth-prompt-store-DKA-QhmR.js";import{a as h,n as de}from"./receive-store-CvglCO2B.js";import{t as fe}from"./share-metadata-rows-CBVJZE24.js";var g=e(n(),1),pe=a();function me(e){let t=e.shareTargetExists,n=e.dirtyConflicts.conflicts,r=e.dirtyConflicts.files;return t&&!n?{kind:`A`,openCurrentEnabled:!0,switchEnabled:!0,conflictingFiles:r}:!t&&!n?{kind:`B`,openCurrentEnabled:!1,switchEnabled:!0,conflictingFiles:r}:t&&n?{kind:`C`,openCurrentEnabled:!0,switchEnabled:!1,conflictingFiles:r}:{kind:`D`,openCurrentEnabled:!1,switchEnabled:!1,conflictingFiles:r}}function he(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function _(e){if(e.ok)return{action:`await-cc1`};switch(e.reason){case`dirty-conflict`:return{action:`rerender-conflict`,files:e.files??[]};case`branch-not-found`:return{action:`dismiss-with-toast`,reason:`branch-not-found`};case`fetch-failed`:case`checkout-failed`:return{action:`stay-with-toast`,reason:e.reason};case`branch-in-other-worktree`:{let t=e.otherWorktreePath;return t===void 0||t.length===0?{action:`stay-with-toast`,reason:`checkout-failed`}:{action:`pivot-to-other-worktree`,otherWorktreePath:t}}case`ff-diverged`:return{action:`branch-diverged`};case`unsafe-symlinks`:return{action:`refused-unsafe-symlinks`,paths:e.refusedSymlinkPaths??[]};case`symlink-check-failed`:return{action:`stay-with-toast`,reason:`symlink-check-failed`};default:{let t=e.reason;throw Error(`Unhandled CheckoutFailureReason: ${String(t)}`)}}}var ge={phase:`loading`};function _e(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function ve(e,t){return e.phase!==`ready`&&e.phase!==`verdict`?e:{phase:`switching`,info:e.info,pendingDoc:t}}function ye(e){return e.phase===`ready`?{phase:`creating-worktree`,info:e.info}:e}function be(e){return me(e).kind===`B`&&e.shareTargetOnOriginBranch===!1}function xe(e){return e.phase===`ready`?{phase:`verdict-pending`,info:e.info}:e}function Se(e,t){if(e.phase!==`verdict-pending`)return e;if(t===null||t.verdict===`unknown`||t.verdict===`changed-locally`)return{phase:`ready`,info:e.info};let n=t.verdict===`renamed`?{kind:`renamed`,renamedTo:t.renamedTo}:{kind:t.verdict};return{phase:`verdict`,info:e.info,resolution:n}}function Ce(e,t){if(e.phase!==`switching`)return{state:e};if(t===null)return{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}};let n=_(t);return n.action===`await-cc1`?{state:{phase:`awaiting-cc1-recycle`,pendingDoc:e.pendingDoc}}:n.action===`rerender-conflict`?{state:{phase:`ready`,info:{...e.info,dirtyConflicts:{conflicts:!0,files:n.files.slice()}}}}:n.action===`pivot-to-other-worktree`?{state:{phase:`branch-in-other-worktree`,info:e.info,otherWorktreePath:n.otherWorktreePath,pendingDoc:e.pendingDoc}}:n.action===`dismiss-with-toast`?{state:{phase:`dismissed`,reason:n.reason},sideEffect:{kind:`toast`,reason:n.reason}}:n.action===`branch-diverged`?{state:{phase:`verdict`,info:e.info,resolution:{kind:`diverged`}}}:n.action===`refused-unsafe-symlinks`?{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`unsafe-symlinks`,paths:n.paths}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:n.reason}}}function we(e,t){return e.phase===`creating-worktree`?t===null?{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}}:t.ok?{state:{phase:`opening-worktree`,path:t.path}}:t.reason===`branch-not-found`?{state:{phase:`dismissed`,reason:`branch-not-found`},sideEffect:{kind:`toast`,reason:`branch-not-found`}}:t.reason===`project-scope-unavailable`?{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:t.reason,projectScopeIssue:t.issue}}:t.reason===`unsafe-symlinks`?{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:t.reason,paths:t.refusedSymlinkPaths}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:t.reason,helper:t.helper,authFailed:t.reason===`fetch-failed`?t.authFailed:void 0,notFoundAsIdentity:t.reason===`fetch-failed`?t.notFoundAsIdentity:void 0}}:{state:e}}var v=t();function Te(e){return c(e.repositoryTarget)}function Ee(e,t=c(e.target)){let n=e.contentRootDepth===null?t:[...Te(e).split(`/`).slice(0,e.contentRootDepth),...t===``?[]:t.split(`/`)].join(`/`);return{kind:e.target.kind,path:t,repositoryPath:n,...e.contentRootDepth===null?{}:{contentRootDepth:e.contentRootDepth}}}function De(e){return e!==null&&e.kind===`project-branch-switch`}var Oe=5;function ke(e){return`share-branch-unsafe-symlinks:${e}`}function Ae(e){let t=(0,pe.c)(221),{bridge:n,store:a}=e,m=a===void 0?de:a,{_}=i(),Ae;t[0]===_?Ae=t[1]:(Ae=function(e){let t=e.slice(0,Oe),n=e.length-t.length,r=n>0?[...t,_({id:`pCJv30`,values:{hiddenCount:n}})]:t;return r.length===0?void 0:le(r,ee.locale)},t[0]=_,t[1]=Ae);let y=Ae,b=(0,g.useSyncExternalStore)(m.subscribe,m.getSnapshot,Re),[x,S]=(0,g.useState)(ge),ze=(0,g.useRef)(!1),Be=(0,g.useRef)(!1),Ve=(0,g.useRef)(!1),He=(0,g.useRef)(null),Ue;t[2]===b?Ue=t[3]:(Ue=De(b)?b:null,t[2]=b,t[3]=Ue);let C=Ue,We;t[4]!==_||t[5]!==C?.share.target.kind?(We=C?.share.target.kind===`folder`?_({id:`ugoTXs`}):_({id:`XH30C4`}),t[4]=_,t[5]=C?.share.target.kind,t[6]=We):We=t[6];let w=We,Ge;t[7]===C?Ge=t[8]:(Ge=()=>{S(ge),ze.current=!1,Be.current=!1,Ve.current=!1,He.current=C},t[7]=C,t[8]=Ge);let Ke;t[9]===b?Ke=t[10]:(Ke=[b],t[9]=b,t[10]=Ke),(0,g.useEffect)(Ge,Ke);let qe;t[11]!==C||t[12]!==n?(qe=()=>{if(!C||ze.current)return;ze.current=!0;let e=!1;return n.project.fetchBranchInfo({projectPath:C.projectPath,branch:C.share.branch,kind:C.share.repositoryTarget.kind,path:Te(C.share)}).then(t=>{e||S(e=>_e(e,t))}).catch(t=>{e||(console.warn(`[receive] branch-info-fetch-failed`,t instanceof Error?t.message:t),S(Le))}),()=>{e=!0}},t[11]=C,t[12]=n,t[13]=qe):qe=t[13];let Je;t[14]===C?Je=t[15]:(Je=[C],t[14]=C,t[15]=Je),(0,g.useEffect)(qe,Je);let Ye;t[16]!==C||t[17]!==x.info||t[18]!==x.phase||t[19]!==n?(Ye=()=>{if(!C||x.phase!==`ready`||Ve.current||!be(x.info))return;Ve.current=!0,S(xe);let e=C;n.project.fetchTargetStatus({projectPath:C.projectPath,branch:C.share.branch,kind:C.share.target.kind,path:Te(C.share),...C.share.contentRootDepth===null?{}:{contentRootDepth:C.share.contentRootDepth}}).then(t=>{He.current===e&&S(e=>Se(e,t))}).catch(t=>{He.current===e&&(console.warn(`[receive] target-status-fetch-failed`,t instanceof Error?t.message:t),S(Ie))})},t[16]=C,t[17]=x.info,t[18]=x.phase,t[19]=n,t[20]=Ye):Ye=t[20];let Xe;t[21]!==C||t[22]!==x.phase?(Xe=[x.phase,C],t[21]=C,t[22]=x.phase,t[23]=Xe):Xe=t[23],(0,g.useEffect)(Ye,Xe);let Ze;t[24]!==C||t[25]!==x.phase||t[26]!==x.resolution||t[27]!==m?(Ze=()=>{if(x.phase!==`verdict`)return;let{kind:e}=x.resolution;e!==`deleted`&&e!==`never-on-branch`||C&&(d.arm({kind:C.share.target.kind,path:c(C.share.target),repositoryPath:Te(C.share),...C.share.contentRootDepth===null?{}:{contentRootDepth:C.share.contentRootDepth},branch:C.share.branch}),m.dismiss())},t[24]=C,t[25]=x.phase,t[26]=x.resolution,t[27]=m,t[28]=Ze):Ze=t[28];let Qe;t[29]!==C||t[30]!==x||t[31]!==m?(Qe=[x,C,m],t[29]=C,t[30]=x,t[31]=m,t[32]=Qe):Qe=t[32],(0,g.useEffect)(Ze,Qe);let $e;t[33]!==x.phase||t[34]!==x.resolution?($e=()=>{x.phase===`verdict`&&console.log(h({verdict_cell:x.resolution.kind}))},t[33]=x.phase,t[34]=x.resolution,t[35]=$e):$e=t[35];let et;t[36]===x?et=t[37]:(et=[x],t[36]=x,t[37]=et),(0,g.useEffect)($e,et);let tt;t[38]!==_||t[39]!==C||t[40]!==x.pendingDoc||t[41]!==x.phase||t[42]!==n||t[43]!==m||t[44]!==w?(tt=()=>{if(x.phase!==`awaiting-cc1-recycle`||!C)return;let e=C.share.branch,t=x.pendingDoc;if(!e){m.dismiss();return}if(Be.current)return;Be.current=!0;let r=!1;return n.project.awaitBranchSwitched({projectPath:C.projectPath,branch:e,timeoutMs:3e4}).then(i=>{if(!r){if(i.ok){console.log(h({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:C.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Ee(C.share,t),pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),s.error(_({id:`gQV-9w`,values:{targetNoun:w}}))}),m.dismiss();return}console.log(h({branch_dialog_action:`branch-switch-timeout`,branch:e})),s.error(_({id:`LBwUR6`,values:{targetNoun:w}})),m.dismiss()}}).catch(e=>{r||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),s.error(_({id:`Jw6EC4`,values:{targetNoun:w}})),m.dismiss())}),()=>{r=!0}},t[38]=_,t[39]=C,t[40]=x.pendingDoc,t[41]=x.phase,t[42]=n,t[43]=m,t[44]=w,t[45]=tt):tt=t[45];let nt;if(t[46]!==C||t[47]!==x.phase?(nt=[x.phase,C],t[46]=C,t[47]=x.phase,t[48]=nt):nt=t[48],(0,g.useEffect)(tt,nt),!C)return null;let{share:T,projectPath:E,currentBranch:rt}=C,D=T.branch,it;t[49]!==_||t[50]!==n.project||t[51]!==E||t[52]!==y||t[53]!==D||t[54]!==m?(it=function(e,t,r){console.log(h({branch_dialog_action:`switch`,branch_action:`switch`,branch:D,verdict_cell:r})),S(t=>ve(t,e)),n.project.runCheckout(t?{projectPath:E,branch:D,fastForward:!0}:{projectPath:E,branch:D}).then(e=>{let t=null,n=!1,r=[];S(i=>{let{state:a,sideEffect:o}=Ce(i,e);return o&&(t=o.reason,r=o.paths??[],n=a.phase===`dismissed`),a});let i=ke(D);t!==`unsafe-symlinks`&&s.dismiss(i),t===`unsafe-symlinks`?s.error(_({id:`461Vg9`,values:{shareBranch:D}}),{description:y(r),id:i,duration:1/0}):t===`branch-not-found`?s.error(_({id:`NJyQi_`,values:{shareBranch:D}})):t===`fetch-failed`?s.error(_({id:`bWLmRK`})):t===`symlink-check-failed`?s.error(_({id:`0uxLib`,values:{shareBranch:D}})):(t===`checkout-failed`||t===`proxy-null`)&&s.error(_({id:`c863eW`,values:{shareBranch:D}})),n&&m.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),S(Fe),s.dismiss(ke(D)),s.error(_({id:`c863eW`,values:{shareBranch:D}}))})},t[49]=_,t[50]=n.project,t[51]=E,t[52]=y,t[53]=D,t[54]=m,t[55]=it):it=t[55];let O=it,at;t[56]!==x.info||t[57]!==x.phase||t[58]!==O||t[59]!==T.target?(at=function(){x.phase===`ready`&&me(x.info).switchEnabled&&O(c(T.target),!1)},t[56]=x.info,t[57]=x.phase,t[58]=O,t[59]=T.target,t[60]=at):at=t[60];let ot=at,st;t[61]!==x.phase||t[62]!==x.resolution||t[63]!==O||t[64]!==T.target?(st=function(){x.phase===`verdict`&&O(c(T.target),!0,x.resolution.kind)},t[61]=x.phase,t[62]=x.resolution,t[63]=O,t[64]=T.target,t[65]=st):st=t[65];let ct=st,lt;t[66]!==x.phase||t[67]!==x.resolution||t[68]!==O?(lt=function(){x.phase===`verdict`&&x.resolution.kind===`renamed`&&O(x.resolution.renamedTo,!0,x.resolution.kind)},t[66]=x.phase,t[67]=x.resolution,t[68]=O,t[69]=lt):lt=t[69];let ut=lt,dt;t[70]!==x.phase||t[71]!==x.resolution||t[72]!==O||t[73]!==T.target?(dt=function(){x.phase===`verdict`&&O(c(T.target),!1,x.resolution.kind)},t[70]=x.phase,t[71]=x.resolution,t[72]=O,t[73]=T.target,t[74]=dt):dt=t[74];let ft=dt,pt;t[75]!==_||t[76]!==n.project||t[77]!==E||t[78]!==T||t[79]!==D||t[80]!==m||t[81]!==w?(pt=function(){console.log(h({branch_dialog_action:`open-current`,branch:D})),n.project.open({path:E,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Ee(T)}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),s.error(_({id:`b5aNbi`,values:{targetNoun:w}}))}),m.dismiss()},t[75]=_,t[76]=n.project,t[77]=E,t[78]=T,t[79]=D,t[80]=m,t[81]=w,t[82]=pt):pt=t[82];let mt=pt,ht;t[83]!==_||t[84]!==y||t[85]!==D?(ht=function(e){let{reason:t}=e,n=`helper`in e?e.helper:void 0,r=`authFailed`in e?e.authFailed:void 0,i=`notFoundAsIdentity`in e?e.notFoundAsIdentity:void 0;if(t===`fetch-failed`&&i){s.error(_({id:`jRsjlF`}));return}if(t===`fetch-failed`&&r){s.error(_({id:`gfb-CM`}),{action:{label:_({id:`5lWFkC`}),onClick:Pe}});return}switch(t){case`helper-not-found`:{let e=n??_({id:`cHhH3i`});s.error(_({id:`Z7x_Zh`,values:{tool:e}}));return}case`branch-not-found`:s.error(_({id:`NJyQi_`,values:{shareBranch:D}}));return;case`fetch-failed`:s.error(_({id:`bWLmRK`}));return;case`already-checked-out`:s.error(_({id:`ljHjfg`}));return;case`branch-exists`:s.error(_({id:`h3QZcB`,values:{shareBranch:D}}));return;case`path-exists`:s.error(_({id:`cN1Gcp`,values:{shareBranch:D}}));return;case`no-git`:s.error(_({id:`CFnavk`}));return;case`empty-repo`:s.error(_({id:`5IgYAM`}));return;case`invalid-branch`:s.error(_({id:`JfPuv7`,values:{shareBranch:D}}));return;case`project-scope-unavailable`:s.error(_(p({reason:t,issue:e.projectScopeIssue})));return;case`unsafe-symlinks`:s.error(_({id:`_6cS9O`,values:{shareBranch:D}}),{description:y(e.paths),id:ke(D),duration:1/0});return;case`proxy-null`:case`error`:s.error(_({id:`e8zYa8`,values:{shareBranch:D}}));return;default:throw Error(`Unhandled worktree failure reason: ${String(t)}`)}},t[83]=_,t[84]=y,t[85]=D,t[86]=ht):ht=t[86];let gt=ht,_t;t[87]!==_||t[88]!==n.project||t[89]!==T||t[90]!==D||t[91]!==gt||t[92]!==m?(_t=function(e){e?.ok===!1&&e.reason===`project-scope-unavailable`&&ue();let t,r=!1,i=null;if(S(n=>{let{state:a,sideEffect:o}=we(n,e);return o&&(t=o,r=a.phase===`dismissed`),a.phase===`opening-worktree`&&(i=a.path),a}),t?.reason!==`unsafe-symlinks`&&s.dismiss(ke(D)),t!==void 0&&(console.log(h({branch_dialog_action:`open-worktree-failed:${t.reason}`,branch:D})),gt(t)),i!==null){ue();let e=i;n.project.open({path:e,target:`new-window`,entryPoint:`worktree`,pendingDeepLinkTarget:Ee(T),pendingBranch:D}).catch(t=>{console.warn(`[receive] worktree-open-failed branch_dialog_action=open-worktree`,t instanceof Error?t.message:t),s.error(_({id:`LdABLa`,values:{target:e}}))}),m.dismiss()}r&&m.dismiss()},t[87]=_,t[88]=n.project,t[89]=T,t[90]=D,t[91]=gt,t[92]=m,t[93]=_t):_t=t[93];let vt=_t,yt;t[94]!==vt||t[95]!==x.phase||t[96]!==n.worktree||t[97]!==D?(yt=function(){x.phase===`ready`&&(console.log(h({branch_dialog_action:`open-worktree`,branch:D})),S(ye),n.worktree.checkout({branch:D}).then(e=>{vt(e)}).catch(e=>{console.warn(`[receive] worktree-checkout rejected branch_dialog_action=open-worktree`,e instanceof Error?e.message:e),vt(null)}))},t[94]=vt,t[95]=x.phase,t[96]=n.worktree,t[97]=D,t[98]=yt):yt=t[98];let bt=yt,xt;t[99]!==_||t[100]!==x.otherWorktreePath||t[101]!==x.phase||t[102]!==n.project||t[103]!==T||t[104]!==D||t[105]!==m?(xt=function(){if(x.phase!==`branch-in-other-worktree`)return;let e=x.otherWorktreePath;console.log(h({branch_dialog_action:`pivot-to-other-worktree`,branch:D})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Ee(T),pendingBranch:D}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),s.error(_({id:`LdABLa`,values:{target:e}}))}),m.dismiss()},t[99]=_,t[100]=x.otherWorktreePath,t[101]=x.phase,t[102]=n.project,t[103]=T,t[104]=D,t[105]=m,t[106]=xt):xt=t[106];let St=xt,Ct;t[107]!==x.phase||t[108]!==x.resolution||t[109]!==m?(Ct=function(){console.log(h({branch_dialog_action:`cancel`,verdict_cell:x.phase===`verdict`?x.resolution.kind:void 0})),m.dismiss()},t[107]=x.phase,t[108]=x.resolution,t[109]=m,t[110]=Ct):Ct=t[110];let k=Ct,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K,q,J;if(t[111]!==_||t[112]!==x.info||t[113]!==x.otherWorktreePath||t[114]!==x.phase||t[115]!==x.resolution||t[116]!==k||t[117]!==rt||t[118]!==T.branch||t[119]!==T.owner||t[120]!==T.repo||t[121]!==T.target||t[122]!==D||t[123]!==w){q=x.phase===`ready`||x.phase===`switching`||x.phase===`creating-worktree`?me(x.info):null;let e;t[143]!==x.info||t[144]!==x.phase||t[145]!==rt?(e=x.phase===`ready`||x.phase===`switching`||x.phase===`creating-worktree`?he(x.info):rt??`HEAD`,t[143]=x.info,t[144]=x.phase,t[145]=rt,t[146]=e):e=t[146];let n=e;I=x.phase===`switching`||x.phase===`awaiting-cc1-recycle`,N=x.phase===`creating-worktree`;let i;t[147]===_?i=t[148]:(i=_({id:`OuY8t9`}),t[147]=_,t[148]=i),P=i;let a;t[149]===_?a=t[150]:(a=_({id:`XZkdtg`}),t[149]=_,t[150]=a),F=a;let o;t[151]===_?o=t[152]:(o=_({id:`VTulZj`}),t[151]=_,t[152]=o),J=o;let s=x.phase===`loading`,ee=x.phase===`error`;M=ce,G=!0,t[153]===k?K=t[154]:(K=e=>{e||k()},t[153]=k,t[154]=K),j=ae,B=`sm:max-w-xl`,V=`share-branch-switch-dialog`,H=Ne,U=Me;let l;t[155]===w?l=t[156]:(l=(0,v.jsx)(ie,{children:(0,v.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:w}})}),t[155]=w,t[156]=l);let te=T.owner,ne=T.repo,d;t[157]===T.target?d=t[158]:(d=c(T.target),t[157]=T.target,t[158]=d);let f;t[159]!==T.owner||t[160]!==T.repo||t[161]!==d?(f=(0,v.jsx)(re,{className:`sr-only`,children:(0,v.jsx)(r,{id:`f8jU-L`,values:{0:te,1:ne,2:d}})}),t[159]=T.owner,t[160]=T.repo,t[161]=d,t[162]=f):f=t[162],t[163]!==l||t[164]!==f?(W=(0,v.jsxs)(se,{children:[l,f]}),t[163]=l,t[164]=f,t[165]=W):W=t[165],A=oe;let le=T.owner,ue=T.repo,p;t[166]===T.target?p=t[167]:(p=c(T.target),t[166]=T.target,t[167]=p),t[168]!==T.branch||t[169]!==T.owner||t[170]!==T.repo||t[171]!==T.target.kind||t[172]!==p?(L=(0,v.jsx)(`div`,{className:`mb-4`,children:(0,v.jsx)(fe,{owner:le,repo:ue,path:p,kind:T.target.kind,branch:T.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[168]=T.branch,t[169]=T.owner,t[170]=T.repo,t[171]=T.target.kind,t[172]=p,t[173]=L):L=t[173],R=x.phase===`branch-in-other-worktree`?(0,v.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,v.jsx)(`p`,{className:`leading-6`,children:(0,v.jsx)(r,{id:`yjExfe`,values:{shareBranch:D},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,v.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:x.otherWorktreePath})]}):x.phase===`verdict-pending`?(0,v.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-pending`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`c8jBgX`})]}):x.phase===`verdict`?x.resolution.kind===`on-origin`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-on-origin`,children:(0,v.jsx)(r,{id:`Uay5NL`,values:{targetNoun:w,shareBranch:D},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):x.resolution.kind===`renamed`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-renamed`,children:(0,v.jsx)(r,{id:`P0HC30`,values:{0:x.resolution.renamedTo,targetNoun:w},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):x.resolution.kind===`diverged`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-diverged`,children:(0,v.jsx)(r,{id:`kLv8d3`,values:{shareBranch:D,targetNoun:w},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,v.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-handoff`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`c8jBgX`})]}):s?(0,v.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-loading`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`jerqF0`})]}):ee?(0,v.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,v.jsx)(r,{id:`w4hMYl`})}):q?.kind===`D`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,v.jsx)(r,{id:`DTI-fp`,values:{targetNoun:w,shareBranch:D},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):q?.kind===`B`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,v.jsx)(r,{id:`sZ2IOu`,values:{targetNoun:w,shareBranch:D,currentLabel:n},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,v.jsx)(r,{id:`_902BE`,values:{targetNoun:w,shareBranch:D,currentLabel:n},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),z=q&&!q.switchEnabled&&q.conflictingFiles.length>0?(0,v.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm`,"data-testid":`share-branch-switch-conflict`,children:[(0,v.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,v.jsx)(r,{id:`n2lRue`})}),(0,v.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:q.conflictingFiles.map(je)})]}):null,t[111]=_,t[112]=x.info,t[113]=x.otherWorktreePath,t[114]=x.phase,t[115]=x.resolution,t[116]=k,t[117]=rt,t[118]=T.branch,t[119]=T.owner,t[120]=T.repo,t[121]=T.target,t[122]=D,t[123]=w,t[124]=A,t[125]=j,t[126]=M,t[127]=N,t[128]=P,t[129]=F,t[130]=I,t[131]=L,t[132]=R,t[133]=z,t[134]=B,t[135]=V,t[136]=H,t[137]=U,t[138]=W,t[139]=G,t[140]=K,t[141]=q,t[142]=J}else A=t[124],j=t[125],M=t[126],N=t[127],P=t[128],F=t[129],I=t[130],L=t[131],R=t[132],z=t[133],B=t[134],V=t[135],H=t[136],U=t[137],W=t[138],G=t[139],K=t[140],q=t[141],J=t[142];let Y;t[174]===I?Y=t[175]:(Y=I?(0,v.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-switching`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`CU3AiE`})]}):null,t[174]=I,t[175]=Y);let X;t[176]===N?X=t[177]:(X=N?(0,v.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-creating-worktree`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`PZtgO0`})]}):null,t[176]=N,t[177]=X);let Z;t[178]!==A||t[179]!==L||t[180]!==R||t[181]!==z||t[182]!==Y||t[183]!==X?(Z=(0,v.jsxs)(A,{children:[L,R,z,Y,X]}),t[178]=A,t[179]=L,t[180]=R,t[181]=z,t[182]=Y,t[183]=X,t[184]=Z):Z=t[184];let wt;t[185]===Symbol.for(`react.memo_cache_sentinel`)?(wt=(0,v.jsx)(r,{id:`dEgA5A`}),t[185]=wt):wt=t[185];let Q;t[186]===k?Q=t[187]:(Q=(0,v.jsx)(o,{variant:`ghost`,onClick:k,"data-testid":`share-branch-switch-cancel`,children:wt}),t[186]=k,t[187]=Q);let Tt;t[188]!==x.phase||t[189]!==x.resolution||t[190]!==N||t[191]!==mt||t[192]!==ut||t[193]!==bt||t[194]!==St||t[195]!==ft||t[196]!==ot||t[197]!==ct||t[198]!==P||t[199]!==F||t[200]!==I||t[201]!==q||t[202]!==J?(Tt=x.phase===`branch-in-other-worktree`?(0,v.jsx)(o,{onClick:St,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,v.jsx)(r,{id:`hyCxJY`})}):x.phase===`verdict`?x.resolution.kind===`on-origin`?(0,v.jsxs)(o,{onClick:ct,"data-testid":`share-branch-switch-verdict-switch-update`,children:[(0,v.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),(0,v.jsx)(r,{id:`uA_jXp`})]}):x.resolution.kind===`renamed`?(0,v.jsxs)(o,{onClick:ut,"data-testid":`share-branch-switch-verdict-open-renamed`,children:[(0,v.jsx)(ne,{className:`size-3.5`,"aria-hidden":!0}),(0,v.jsx)(r,{id:`AItsE5`})]}):x.resolution.kind===`diverged`?(0,v.jsxs)(o,{onClick:ft,"data-testid":`share-branch-switch-verdict-plain-switch`,children:[(0,v.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),F]}):null:(0,v.jsxs)(`div`,{className:`flex min-w-0 flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:justify-end sm:gap-2`,children:[q?.openCurrentEnabled?(0,v.jsxs)(o,{variant:`outline`,onClick:mt,disabled:I||N,"data-testid":`share-branch-switch-open-current`,children:[(0,v.jsx)(ne,{className:`size-3.5`,"aria-hidden":!0}),P]}):null,(0,v.jsx)(o,{variant:`outline`,onClick:ot,disabled:!q?.switchEnabled||I||N,"aria-disabled":!q?.switchEnabled||I||N,"aria-describedby":q&&!q.switchEnabled&&q.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:I?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(u,{className:`size-3.5`,"aria-hidden":`true`}),F]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),F]})}),(0,v.jsx)(o,{onClick:bt,disabled:!q||I||N,"data-testid":`share-branch-switch-worktree`,children:N?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(u,{className:`size-3.5`,"aria-hidden":`true`}),J]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),J]})})]}),t[188]=x.phase,t[189]=x.resolution,t[190]=N,t[191]=mt,t[192]=ut,t[193]=bt,t[194]=St,t[195]=ft,t[196]=ot,t[197]=ct,t[198]=P,t[199]=F,t[200]=I,t[201]=q,t[202]=J,t[203]=Tt):Tt=t[203];let Et;t[204]!==Q||t[205]!==Tt?(Et=(0,v.jsxs)(f,{className:`sm:justify-between`,children:[Q,Tt]}),t[204]=Q,t[205]=Tt,t[206]=Et):Et=t[206];let $;t[207]!==j||t[208]!==B||t[209]!==V||t[210]!==H||t[211]!==U||t[212]!==W||t[213]!==Z||t[214]!==Et?($=(0,v.jsxs)(j,{className:B,"data-testid":V,onInteractOutside:H,onPointerDownOutside:U,children:[W,Z,Et]}),t[207]=j,t[208]=B,t[209]=V,t[210]=H,t[211]=U,t[212]=W,t[213]=Z,t[214]=Et,t[215]=$):$=t[215];let Dt;return t[216]!==M||t[217]!==G||t[218]!==K||t[219]!==$?(Dt=(0,v.jsx)(M,{open:G,onOpenChange:K,children:$}),t[216]=M,t[217]=G,t[218]=K,t[219]=$,t[220]=Dt):Dt=t[220],Dt}function je(e){return(0,v.jsx)(`li`,{children:(0,v.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function Me(e){e.preventDefault()}function Ne(e){e.preventDefault()}function Pe(){return m.request()}function Fe(e){return Ce(e,null).state}function Ie(e){return Se(e,null)}function Le(e){return _e(e,null)}function Re(){return null}export{Ae as ShareBranchSwitchDialog};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-BeFNZANd.js";import{n as s}from"./dist-CJhtNlOm2.js";import{t as ee}from"./dist-Cr4-nBVI.js";import{t as c}from"./desktop-bridge-types-oYPdTDmz.js";import{n as l,t as te}from"./git-branch-B_QTfwFA.js";import{t as u}from"./spinner-D7ppCG-D.js";import{n as ne,t as d}from"./miss-dialog-store-CWiUu3y7.js";import{a as re,c as ie,i as ae,n as oe,o as f,s as se,t as ce}from"./dialog-BTFtzetj.js";import{t as le}from"./tool-list-format-BBT_vsDw.js";import{i as ue,n as p,t as m}from"./auth-prompt-store-DKA-QhmR.js";import{a as h,n as de}from"./receive-store-VACJKx3F.js";import{t as fe}from"./share-metadata-rows-CBVJZE24.js";var g=e(n(),1),pe=a();function me(e){let t=e.shareTargetExists,n=e.dirtyConflicts.conflicts,r=e.dirtyConflicts.files;return t&&!n?{kind:`A`,openCurrentEnabled:!0,switchEnabled:!0,conflictingFiles:r}:!t&&!n?{kind:`B`,openCurrentEnabled:!1,switchEnabled:!0,conflictingFiles:r}:t&&n?{kind:`C`,openCurrentEnabled:!0,switchEnabled:!1,conflictingFiles:r}:{kind:`D`,openCurrentEnabled:!1,switchEnabled:!1,conflictingFiles:r}}function he(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function _(e){if(e.ok)return{action:`await-cc1`};switch(e.reason){case`dirty-conflict`:return{action:`rerender-conflict`,files:e.files??[]};case`branch-not-found`:return{action:`dismiss-with-toast`,reason:`branch-not-found`};case`fetch-failed`:case`checkout-failed`:return{action:`stay-with-toast`,reason:e.reason};case`branch-in-other-worktree`:{let t=e.otherWorktreePath;return t===void 0||t.length===0?{action:`stay-with-toast`,reason:`checkout-failed`}:{action:`pivot-to-other-worktree`,otherWorktreePath:t}}case`ff-diverged`:return{action:`branch-diverged`};case`unsafe-symlinks`:return{action:`refused-unsafe-symlinks`,paths:e.refusedSymlinkPaths??[]};case`symlink-check-failed`:return{action:`stay-with-toast`,reason:`symlink-check-failed`};default:{let t=e.reason;throw Error(`Unhandled CheckoutFailureReason: ${String(t)}`)}}}var ge={phase:`loading`};function _e(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function ve(e,t){return e.phase!==`ready`&&e.phase!==`verdict`?e:{phase:`switching`,info:e.info,pendingDoc:t}}function ye(e){return e.phase===`ready`?{phase:`creating-worktree`,info:e.info}:e}function be(e){return me(e).kind===`B`&&e.shareTargetOnOriginBranch===!1}function xe(e){return e.phase===`ready`?{phase:`verdict-pending`,info:e.info}:e}function Se(e,t){if(e.phase!==`verdict-pending`)return e;if(t===null||t.verdict===`unknown`||t.verdict===`changed-locally`)return{phase:`ready`,info:e.info};let n=t.verdict===`renamed`?{kind:`renamed`,renamedTo:t.renamedTo}:{kind:t.verdict};return{phase:`verdict`,info:e.info,resolution:n}}function Ce(e,t){if(e.phase!==`switching`)return{state:e};if(t===null)return{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}};let n=_(t);return n.action===`await-cc1`?{state:{phase:`awaiting-cc1-recycle`,pendingDoc:e.pendingDoc}}:n.action===`rerender-conflict`?{state:{phase:`ready`,info:{...e.info,dirtyConflicts:{conflicts:!0,files:n.files.slice()}}}}:n.action===`pivot-to-other-worktree`?{state:{phase:`branch-in-other-worktree`,info:e.info,otherWorktreePath:n.otherWorktreePath,pendingDoc:e.pendingDoc}}:n.action===`dismiss-with-toast`?{state:{phase:`dismissed`,reason:n.reason},sideEffect:{kind:`toast`,reason:n.reason}}:n.action===`branch-diverged`?{state:{phase:`verdict`,info:e.info,resolution:{kind:`diverged`}}}:n.action===`refused-unsafe-symlinks`?{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`unsafe-symlinks`,paths:n.paths}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:n.reason}}}function we(e,t){return e.phase===`creating-worktree`?t===null?{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}}:t.ok?{state:{phase:`opening-worktree`,path:t.path}}:t.reason===`branch-not-found`?{state:{phase:`dismissed`,reason:`branch-not-found`},sideEffect:{kind:`toast`,reason:`branch-not-found`}}:t.reason===`project-scope-unavailable`?{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:t.reason,projectScopeIssue:t.issue}}:t.reason===`unsafe-symlinks`?{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:t.reason,paths:t.refusedSymlinkPaths}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:t.reason,helper:t.helper,authFailed:t.reason===`fetch-failed`?t.authFailed:void 0,notFoundAsIdentity:t.reason===`fetch-failed`?t.notFoundAsIdentity:void 0}}:{state:e}}var v=t();function Te(e){return c(e.repositoryTarget)}function Ee(e,t=c(e.target)){let n=e.contentRootDepth===null?t:[...Te(e).split(`/`).slice(0,e.contentRootDepth),...t===``?[]:t.split(`/`)].join(`/`);return{kind:e.target.kind,path:t,repositoryPath:n,...e.contentRootDepth===null?{}:{contentRootDepth:e.contentRootDepth}}}function De(e){return e!==null&&e.kind===`project-branch-switch`}var Oe=5;function ke(e){return`share-branch-unsafe-symlinks:${e}`}function Ae(e){let t=(0,pe.c)(221),{bridge:n,store:a}=e,m=a===void 0?de:a,{_}=i(),Ae;t[0]===_?Ae=t[1]:(Ae=function(e){let t=e.slice(0,Oe),n=e.length-t.length,r=n>0?[...t,_({id:`pCJv30`,values:{hiddenCount:n}})]:t;return r.length===0?void 0:le(r,ee.locale)},t[0]=_,t[1]=Ae);let y=Ae,b=(0,g.useSyncExternalStore)(m.subscribe,m.getSnapshot,Re),[x,S]=(0,g.useState)(ge),ze=(0,g.useRef)(!1),Be=(0,g.useRef)(!1),Ve=(0,g.useRef)(!1),He=(0,g.useRef)(null),Ue;t[2]===b?Ue=t[3]:(Ue=De(b)?b:null,t[2]=b,t[3]=Ue);let C=Ue,We;t[4]!==_||t[5]!==C?.share.target.kind?(We=C?.share.target.kind===`folder`?_({id:`ugoTXs`}):_({id:`XH30C4`}),t[4]=_,t[5]=C?.share.target.kind,t[6]=We):We=t[6];let w=We,Ge;t[7]===C?Ge=t[8]:(Ge=()=>{S(ge),ze.current=!1,Be.current=!1,Ve.current=!1,He.current=C},t[7]=C,t[8]=Ge);let Ke;t[9]===b?Ke=t[10]:(Ke=[b],t[9]=b,t[10]=Ke),(0,g.useEffect)(Ge,Ke);let qe;t[11]!==C||t[12]!==n?(qe=()=>{if(!C||ze.current)return;ze.current=!0;let e=!1;return n.project.fetchBranchInfo({projectPath:C.projectPath,branch:C.share.branch,kind:C.share.repositoryTarget.kind,path:Te(C.share)}).then(t=>{e||S(e=>_e(e,t))}).catch(t=>{e||(console.warn(`[receive] branch-info-fetch-failed`,t instanceof Error?t.message:t),S(Le))}),()=>{e=!0}},t[11]=C,t[12]=n,t[13]=qe):qe=t[13];let Je;t[14]===C?Je=t[15]:(Je=[C],t[14]=C,t[15]=Je),(0,g.useEffect)(qe,Je);let Ye;t[16]!==C||t[17]!==x.info||t[18]!==x.phase||t[19]!==n?(Ye=()=>{if(!C||x.phase!==`ready`||Ve.current||!be(x.info))return;Ve.current=!0,S(xe);let e=C;n.project.fetchTargetStatus({projectPath:C.projectPath,branch:C.share.branch,kind:C.share.target.kind,path:Te(C.share),...C.share.contentRootDepth===null?{}:{contentRootDepth:C.share.contentRootDepth}}).then(t=>{He.current===e&&S(e=>Se(e,t))}).catch(t=>{He.current===e&&(console.warn(`[receive] target-status-fetch-failed`,t instanceof Error?t.message:t),S(Ie))})},t[16]=C,t[17]=x.info,t[18]=x.phase,t[19]=n,t[20]=Ye):Ye=t[20];let Xe;t[21]!==C||t[22]!==x.phase?(Xe=[x.phase,C],t[21]=C,t[22]=x.phase,t[23]=Xe):Xe=t[23],(0,g.useEffect)(Ye,Xe);let Ze;t[24]!==C||t[25]!==x.phase||t[26]!==x.resolution||t[27]!==m?(Ze=()=>{if(x.phase!==`verdict`)return;let{kind:e}=x.resolution;e!==`deleted`&&e!==`never-on-branch`||C&&(d.arm({kind:C.share.target.kind,path:c(C.share.target),repositoryPath:Te(C.share),...C.share.contentRootDepth===null?{}:{contentRootDepth:C.share.contentRootDepth},branch:C.share.branch}),m.dismiss())},t[24]=C,t[25]=x.phase,t[26]=x.resolution,t[27]=m,t[28]=Ze):Ze=t[28];let Qe;t[29]!==C||t[30]!==x||t[31]!==m?(Qe=[x,C,m],t[29]=C,t[30]=x,t[31]=m,t[32]=Qe):Qe=t[32],(0,g.useEffect)(Ze,Qe);let $e;t[33]!==x.phase||t[34]!==x.resolution?($e=()=>{x.phase===`verdict`&&console.log(h({verdict_cell:x.resolution.kind}))},t[33]=x.phase,t[34]=x.resolution,t[35]=$e):$e=t[35];let et;t[36]===x?et=t[37]:(et=[x],t[36]=x,t[37]=et),(0,g.useEffect)($e,et);let tt;t[38]!==_||t[39]!==C||t[40]!==x.pendingDoc||t[41]!==x.phase||t[42]!==n||t[43]!==m||t[44]!==w?(tt=()=>{if(x.phase!==`awaiting-cc1-recycle`||!C)return;let e=C.share.branch,t=x.pendingDoc;if(!e){m.dismiss();return}if(Be.current)return;Be.current=!0;let r=!1;return n.project.awaitBranchSwitched({projectPath:C.projectPath,branch:e,timeoutMs:3e4}).then(i=>{if(!r){if(i.ok){console.log(h({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:C.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Ee(C.share,t),pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),s.error(_({id:`gQV-9w`,values:{targetNoun:w}}))}),m.dismiss();return}console.log(h({branch_dialog_action:`branch-switch-timeout`,branch:e})),s.error(_({id:`LBwUR6`,values:{targetNoun:w}})),m.dismiss()}}).catch(e=>{r||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),s.error(_({id:`Jw6EC4`,values:{targetNoun:w}})),m.dismiss())}),()=>{r=!0}},t[38]=_,t[39]=C,t[40]=x.pendingDoc,t[41]=x.phase,t[42]=n,t[43]=m,t[44]=w,t[45]=tt):tt=t[45];let nt;if(t[46]!==C||t[47]!==x.phase?(nt=[x.phase,C],t[46]=C,t[47]=x.phase,t[48]=nt):nt=t[48],(0,g.useEffect)(tt,nt),!C)return null;let{share:T,projectPath:E,currentBranch:rt}=C,D=T.branch,it;t[49]!==_||t[50]!==n.project||t[51]!==E||t[52]!==y||t[53]!==D||t[54]!==m?(it=function(e,t,r){console.log(h({branch_dialog_action:`switch`,branch_action:`switch`,branch:D,verdict_cell:r})),S(t=>ve(t,e)),n.project.runCheckout(t?{projectPath:E,branch:D,fastForward:!0}:{projectPath:E,branch:D}).then(e=>{let t=null,n=!1,r=[];S(i=>{let{state:a,sideEffect:o}=Ce(i,e);return o&&(t=o.reason,r=o.paths??[],n=a.phase===`dismissed`),a});let i=ke(D);t!==`unsafe-symlinks`&&s.dismiss(i),t===`unsafe-symlinks`?s.error(_({id:`461Vg9`,values:{shareBranch:D}}),{description:y(r),id:i,duration:1/0}):t===`branch-not-found`?s.error(_({id:`NJyQi_`,values:{shareBranch:D}})):t===`fetch-failed`?s.error(_({id:`bWLmRK`})):t===`symlink-check-failed`?s.error(_({id:`0uxLib`,values:{shareBranch:D}})):(t===`checkout-failed`||t===`proxy-null`)&&s.error(_({id:`c863eW`,values:{shareBranch:D}})),n&&m.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),S(Fe),s.dismiss(ke(D)),s.error(_({id:`c863eW`,values:{shareBranch:D}}))})},t[49]=_,t[50]=n.project,t[51]=E,t[52]=y,t[53]=D,t[54]=m,t[55]=it):it=t[55];let O=it,at;t[56]!==x.info||t[57]!==x.phase||t[58]!==O||t[59]!==T.target?(at=function(){x.phase===`ready`&&me(x.info).switchEnabled&&O(c(T.target),!1)},t[56]=x.info,t[57]=x.phase,t[58]=O,t[59]=T.target,t[60]=at):at=t[60];let ot=at,st;t[61]!==x.phase||t[62]!==x.resolution||t[63]!==O||t[64]!==T.target?(st=function(){x.phase===`verdict`&&O(c(T.target),!0,x.resolution.kind)},t[61]=x.phase,t[62]=x.resolution,t[63]=O,t[64]=T.target,t[65]=st):st=t[65];let ct=st,lt;t[66]!==x.phase||t[67]!==x.resolution||t[68]!==O?(lt=function(){x.phase===`verdict`&&x.resolution.kind===`renamed`&&O(x.resolution.renamedTo,!0,x.resolution.kind)},t[66]=x.phase,t[67]=x.resolution,t[68]=O,t[69]=lt):lt=t[69];let ut=lt,dt;t[70]!==x.phase||t[71]!==x.resolution||t[72]!==O||t[73]!==T.target?(dt=function(){x.phase===`verdict`&&O(c(T.target),!1,x.resolution.kind)},t[70]=x.phase,t[71]=x.resolution,t[72]=O,t[73]=T.target,t[74]=dt):dt=t[74];let ft=dt,pt;t[75]!==_||t[76]!==n.project||t[77]!==E||t[78]!==T||t[79]!==D||t[80]!==m||t[81]!==w?(pt=function(){console.log(h({branch_dialog_action:`open-current`,branch:D})),n.project.open({path:E,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Ee(T)}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),s.error(_({id:`b5aNbi`,values:{targetNoun:w}}))}),m.dismiss()},t[75]=_,t[76]=n.project,t[77]=E,t[78]=T,t[79]=D,t[80]=m,t[81]=w,t[82]=pt):pt=t[82];let mt=pt,ht;t[83]!==_||t[84]!==y||t[85]!==D?(ht=function(e){let{reason:t}=e,n=`helper`in e?e.helper:void 0,r=`authFailed`in e?e.authFailed:void 0,i=`notFoundAsIdentity`in e?e.notFoundAsIdentity:void 0;if(t===`fetch-failed`&&i){s.error(_({id:`jRsjlF`}));return}if(t===`fetch-failed`&&r){s.error(_({id:`gfb-CM`}),{action:{label:_({id:`5lWFkC`}),onClick:Pe}});return}switch(t){case`helper-not-found`:{let e=n??_({id:`cHhH3i`});s.error(_({id:`Z7x_Zh`,values:{tool:e}}));return}case`branch-not-found`:s.error(_({id:`NJyQi_`,values:{shareBranch:D}}));return;case`fetch-failed`:s.error(_({id:`bWLmRK`}));return;case`already-checked-out`:s.error(_({id:`ljHjfg`}));return;case`branch-exists`:s.error(_({id:`h3QZcB`,values:{shareBranch:D}}));return;case`path-exists`:s.error(_({id:`cN1Gcp`,values:{shareBranch:D}}));return;case`no-git`:s.error(_({id:`CFnavk`}));return;case`empty-repo`:s.error(_({id:`5IgYAM`}));return;case`invalid-branch`:s.error(_({id:`JfPuv7`,values:{shareBranch:D}}));return;case`project-scope-unavailable`:s.error(_(p({reason:t,issue:e.projectScopeIssue})));return;case`unsafe-symlinks`:s.error(_({id:`_6cS9O`,values:{shareBranch:D}}),{description:y(e.paths),id:ke(D),duration:1/0});return;case`proxy-null`:case`error`:s.error(_({id:`e8zYa8`,values:{shareBranch:D}}));return;default:throw Error(`Unhandled worktree failure reason: ${String(t)}`)}},t[83]=_,t[84]=y,t[85]=D,t[86]=ht):ht=t[86];let gt=ht,_t;t[87]!==_||t[88]!==n.project||t[89]!==T||t[90]!==D||t[91]!==gt||t[92]!==m?(_t=function(e){e?.ok===!1&&e.reason===`project-scope-unavailable`&&ue();let t,r=!1,i=null;if(S(n=>{let{state:a,sideEffect:o}=we(n,e);return o&&(t=o,r=a.phase===`dismissed`),a.phase===`opening-worktree`&&(i=a.path),a}),t?.reason!==`unsafe-symlinks`&&s.dismiss(ke(D)),t!==void 0&&(console.log(h({branch_dialog_action:`open-worktree-failed:${t.reason}`,branch:D})),gt(t)),i!==null){ue();let e=i;n.project.open({path:e,target:`new-window`,entryPoint:`worktree`,pendingDeepLinkTarget:Ee(T),pendingBranch:D}).catch(t=>{console.warn(`[receive] worktree-open-failed branch_dialog_action=open-worktree`,t instanceof Error?t.message:t),s.error(_({id:`LdABLa`,values:{target:e}}))}),m.dismiss()}r&&m.dismiss()},t[87]=_,t[88]=n.project,t[89]=T,t[90]=D,t[91]=gt,t[92]=m,t[93]=_t):_t=t[93];let vt=_t,yt;t[94]!==vt||t[95]!==x.phase||t[96]!==n.worktree||t[97]!==D?(yt=function(){x.phase===`ready`&&(console.log(h({branch_dialog_action:`open-worktree`,branch:D})),S(ye),n.worktree.checkout({branch:D}).then(e=>{vt(e)}).catch(e=>{console.warn(`[receive] worktree-checkout rejected branch_dialog_action=open-worktree`,e instanceof Error?e.message:e),vt(null)}))},t[94]=vt,t[95]=x.phase,t[96]=n.worktree,t[97]=D,t[98]=yt):yt=t[98];let bt=yt,xt;t[99]!==_||t[100]!==x.otherWorktreePath||t[101]!==x.phase||t[102]!==n.project||t[103]!==T||t[104]!==D||t[105]!==m?(xt=function(){if(x.phase!==`branch-in-other-worktree`)return;let e=x.otherWorktreePath;console.log(h({branch_dialog_action:`pivot-to-other-worktree`,branch:D})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Ee(T),pendingBranch:D}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),s.error(_({id:`LdABLa`,values:{target:e}}))}),m.dismiss()},t[99]=_,t[100]=x.otherWorktreePath,t[101]=x.phase,t[102]=n.project,t[103]=T,t[104]=D,t[105]=m,t[106]=xt):xt=t[106];let St=xt,Ct;t[107]!==x.phase||t[108]!==x.resolution||t[109]!==m?(Ct=function(){console.log(h({branch_dialog_action:`cancel`,verdict_cell:x.phase===`verdict`?x.resolution.kind:void 0})),m.dismiss()},t[107]=x.phase,t[108]=x.resolution,t[109]=m,t[110]=Ct):Ct=t[110];let k=Ct,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K,q,J;if(t[111]!==_||t[112]!==x.info||t[113]!==x.otherWorktreePath||t[114]!==x.phase||t[115]!==x.resolution||t[116]!==k||t[117]!==rt||t[118]!==T.branch||t[119]!==T.owner||t[120]!==T.repo||t[121]!==T.target||t[122]!==D||t[123]!==w){q=x.phase===`ready`||x.phase===`switching`||x.phase===`creating-worktree`?me(x.info):null;let e;t[143]!==x.info||t[144]!==x.phase||t[145]!==rt?(e=x.phase===`ready`||x.phase===`switching`||x.phase===`creating-worktree`?he(x.info):rt??`HEAD`,t[143]=x.info,t[144]=x.phase,t[145]=rt,t[146]=e):e=t[146];let n=e;I=x.phase===`switching`||x.phase===`awaiting-cc1-recycle`,N=x.phase===`creating-worktree`;let i;t[147]===_?i=t[148]:(i=_({id:`OuY8t9`}),t[147]=_,t[148]=i),P=i;let a;t[149]===_?a=t[150]:(a=_({id:`XZkdtg`}),t[149]=_,t[150]=a),F=a;let o;t[151]===_?o=t[152]:(o=_({id:`VTulZj`}),t[151]=_,t[152]=o),J=o;let s=x.phase===`loading`,ee=x.phase===`error`;M=ce,G=!0,t[153]===k?K=t[154]:(K=e=>{e||k()},t[153]=k,t[154]=K),j=ae,B=`sm:max-w-xl`,V=`share-branch-switch-dialog`,H=Ne,U=Me;let l;t[155]===w?l=t[156]:(l=(0,v.jsx)(ie,{children:(0,v.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:w}})}),t[155]=w,t[156]=l);let te=T.owner,ne=T.repo,d;t[157]===T.target?d=t[158]:(d=c(T.target),t[157]=T.target,t[158]=d);let f;t[159]!==T.owner||t[160]!==T.repo||t[161]!==d?(f=(0,v.jsx)(re,{className:`sr-only`,children:(0,v.jsx)(r,{id:`f8jU-L`,values:{0:te,1:ne,2:d}})}),t[159]=T.owner,t[160]=T.repo,t[161]=d,t[162]=f):f=t[162],t[163]!==l||t[164]!==f?(W=(0,v.jsxs)(se,{children:[l,f]}),t[163]=l,t[164]=f,t[165]=W):W=t[165],A=oe;let le=T.owner,ue=T.repo,p;t[166]===T.target?p=t[167]:(p=c(T.target),t[166]=T.target,t[167]=p),t[168]!==T.branch||t[169]!==T.owner||t[170]!==T.repo||t[171]!==T.target.kind||t[172]!==p?(L=(0,v.jsx)(`div`,{className:`mb-4`,children:(0,v.jsx)(fe,{owner:le,repo:ue,path:p,kind:T.target.kind,branch:T.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[168]=T.branch,t[169]=T.owner,t[170]=T.repo,t[171]=T.target.kind,t[172]=p,t[173]=L):L=t[173],R=x.phase===`branch-in-other-worktree`?(0,v.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,v.jsx)(`p`,{className:`leading-6`,children:(0,v.jsx)(r,{id:`yjExfe`,values:{shareBranch:D},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,v.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:x.otherWorktreePath})]}):x.phase===`verdict-pending`?(0,v.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-pending`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`c8jBgX`})]}):x.phase===`verdict`?x.resolution.kind===`on-origin`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-on-origin`,children:(0,v.jsx)(r,{id:`Uay5NL`,values:{targetNoun:w,shareBranch:D},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):x.resolution.kind===`renamed`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-renamed`,children:(0,v.jsx)(r,{id:`P0HC30`,values:{0:x.resolution.renamedTo,targetNoun:w},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):x.resolution.kind===`diverged`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-diverged`,children:(0,v.jsx)(r,{id:`kLv8d3`,values:{shareBranch:D,targetNoun:w},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,v.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-verdict-handoff`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`c8jBgX`})]}):s?(0,v.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-loading`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`jerqF0`})]}):ee?(0,v.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,v.jsx)(r,{id:`w4hMYl`})}):q?.kind===`D`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,v.jsx)(r,{id:`DTI-fp`,values:{targetNoun:w,shareBranch:D},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):q?.kind===`B`?(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,v.jsx)(r,{id:`sZ2IOu`,values:{targetNoun:w,shareBranch:D,currentLabel:n},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,v.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,v.jsx)(r,{id:`_902BE`,values:{targetNoun:w,shareBranch:D,currentLabel:n},components:{0:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,v.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),z=q&&!q.switchEnabled&&q.conflictingFiles.length>0?(0,v.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm`,"data-testid":`share-branch-switch-conflict`,children:[(0,v.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,v.jsx)(r,{id:`n2lRue`})}),(0,v.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:q.conflictingFiles.map(je)})]}):null,t[111]=_,t[112]=x.info,t[113]=x.otherWorktreePath,t[114]=x.phase,t[115]=x.resolution,t[116]=k,t[117]=rt,t[118]=T.branch,t[119]=T.owner,t[120]=T.repo,t[121]=T.target,t[122]=D,t[123]=w,t[124]=A,t[125]=j,t[126]=M,t[127]=N,t[128]=P,t[129]=F,t[130]=I,t[131]=L,t[132]=R,t[133]=z,t[134]=B,t[135]=V,t[136]=H,t[137]=U,t[138]=W,t[139]=G,t[140]=K,t[141]=q,t[142]=J}else A=t[124],j=t[125],M=t[126],N=t[127],P=t[128],F=t[129],I=t[130],L=t[131],R=t[132],z=t[133],B=t[134],V=t[135],H=t[136],U=t[137],W=t[138],G=t[139],K=t[140],q=t[141],J=t[142];let Y;t[174]===I?Y=t[175]:(Y=I?(0,v.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-switching`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`CU3AiE`})]}):null,t[174]=I,t[175]=Y);let X;t[176]===N?X=t[177]:(X=N?(0,v.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-creating-worktree`,role:`status`,"aria-live":`polite`,children:[(0,v.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,v.jsx)(r,{id:`PZtgO0`})]}):null,t[176]=N,t[177]=X);let Z;t[178]!==A||t[179]!==L||t[180]!==R||t[181]!==z||t[182]!==Y||t[183]!==X?(Z=(0,v.jsxs)(A,{children:[L,R,z,Y,X]}),t[178]=A,t[179]=L,t[180]=R,t[181]=z,t[182]=Y,t[183]=X,t[184]=Z):Z=t[184];let wt;t[185]===Symbol.for(`react.memo_cache_sentinel`)?(wt=(0,v.jsx)(r,{id:`dEgA5A`}),t[185]=wt):wt=t[185];let Q;t[186]===k?Q=t[187]:(Q=(0,v.jsx)(o,{variant:`ghost`,onClick:k,"data-testid":`share-branch-switch-cancel`,children:wt}),t[186]=k,t[187]=Q);let Tt;t[188]!==x.phase||t[189]!==x.resolution||t[190]!==N||t[191]!==mt||t[192]!==ut||t[193]!==bt||t[194]!==St||t[195]!==ft||t[196]!==ot||t[197]!==ct||t[198]!==P||t[199]!==F||t[200]!==I||t[201]!==q||t[202]!==J?(Tt=x.phase===`branch-in-other-worktree`?(0,v.jsx)(o,{onClick:St,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,v.jsx)(r,{id:`hyCxJY`})}):x.phase===`verdict`?x.resolution.kind===`on-origin`?(0,v.jsxs)(o,{onClick:ct,"data-testid":`share-branch-switch-verdict-switch-update`,children:[(0,v.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),(0,v.jsx)(r,{id:`uA_jXp`})]}):x.resolution.kind===`renamed`?(0,v.jsxs)(o,{onClick:ut,"data-testid":`share-branch-switch-verdict-open-renamed`,children:[(0,v.jsx)(ne,{className:`size-3.5`,"aria-hidden":!0}),(0,v.jsx)(r,{id:`AItsE5`})]}):x.resolution.kind===`diverged`?(0,v.jsxs)(o,{onClick:ft,"data-testid":`share-branch-switch-verdict-plain-switch`,children:[(0,v.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),F]}):null:(0,v.jsxs)(`div`,{className:`flex min-w-0 flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:justify-end sm:gap-2`,children:[q?.openCurrentEnabled?(0,v.jsxs)(o,{variant:`outline`,onClick:mt,disabled:I||N,"data-testid":`share-branch-switch-open-current`,children:[(0,v.jsx)(ne,{className:`size-3.5`,"aria-hidden":!0}),P]}):null,(0,v.jsx)(o,{variant:`outline`,onClick:ot,disabled:!q?.switchEnabled||I||N,"aria-disabled":!q?.switchEnabled||I||N,"aria-describedby":q&&!q.switchEnabled&&q.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:I?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(u,{className:`size-3.5`,"aria-hidden":`true`}),F]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),F]})}),(0,v.jsx)(o,{onClick:bt,disabled:!q||I||N,"data-testid":`share-branch-switch-worktree`,children:N?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(u,{className:`size-3.5`,"aria-hidden":`true`}),J]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),J]})})]}),t[188]=x.phase,t[189]=x.resolution,t[190]=N,t[191]=mt,t[192]=ut,t[193]=bt,t[194]=St,t[195]=ft,t[196]=ot,t[197]=ct,t[198]=P,t[199]=F,t[200]=I,t[201]=q,t[202]=J,t[203]=Tt):Tt=t[203];let Et;t[204]!==Q||t[205]!==Tt?(Et=(0,v.jsxs)(f,{className:`sm:justify-between`,children:[Q,Tt]}),t[204]=Q,t[205]=Tt,t[206]=Et):Et=t[206];let $;t[207]!==j||t[208]!==B||t[209]!==V||t[210]!==H||t[211]!==U||t[212]!==W||t[213]!==Z||t[214]!==Et?($=(0,v.jsxs)(j,{className:B,"data-testid":V,onInteractOutside:H,onPointerDownOutside:U,children:[W,Z,Et]}),t[207]=j,t[208]=B,t[209]=V,t[210]=H,t[211]=U,t[212]=W,t[213]=Z,t[214]=Et,t[215]=$):$=t[215];let Dt;return t[216]!==M||t[217]!==G||t[218]!==K||t[219]!==$?(Dt=(0,v.jsx)(M,{open:G,onOpenChange:K,children:$}),t[216]=M,t[217]=G,t[218]=K,t[219]=$,t[220]=Dt):Dt=t[220],Dt}function je(e){return(0,v.jsx)(`li`,{children:(0,v.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function Me(e){e.preventDefault()}function Ne(e){e.preventDefault()}function Pe(){return m.request()}function Fe(e){return Ce(e,null).state}function Ie(e){return Se(e,null)}function Le(e){return _e(e,null)}function Re(){return null}export{Ae as ShareBranchSwitchDialog};