@inkeep/open-knowledge 0.77.9-beta.0 → 0.77.9-beta.1

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 (146) hide show
  1. package/dist/cli.mjs +68 -68
  2. package/dist/constants-DjcsE1aU.mjs +1 -0
  3. package/dist/{dist-DeiwO3MR.mjs → dist-DEDXRbh0.mjs} +1 -1
  4. package/dist/{dist-gqMlO9g5.mjs → dist-DcJArHq7.mjs} +436 -436
  5. package/dist/index.mjs +180 -180
  6. package/dist/init-B-sAo7zD.mjs +1 -0
  7. package/dist/{init-C-24amuv.mjs → init-CbXAMIbD.mjs} +34 -34
  8. package/dist/{launch-json-removal-DZGXboeh.mjs → launch-json-removal-CP7tSZPj.mjs} +1 -1
  9. package/dist/loader-D1l3w-4T.mjs +1 -0
  10. package/dist/{loader-0WU8op48.mjs → loader-D2-o7csT.mjs} +1 -1
  11. package/dist/{md-manager-BGnqyqi1-DKflYxqj.mjs → md-manager-BGnqyqi1-CofDfbRH.mjs} +106 -106
  12. package/dist/{open-browser-Dz6ZNMx3.mjs → open-browser-CxyHo50J.mjs} +1 -1
  13. package/dist/parse-worker.mjs +1 -1
  14. package/dist/preview-CmAl4v3q.mjs +1 -0
  15. package/dist/{preview-BSLfKB1h.mjs → preview-SCS9uRyV.mjs} +1 -1
  16. package/dist/public/assets/{ActivityModeContent-BY6wH-wO.js → ActivityModeContent-CKuIA-vj.js} +1 -1
  17. package/dist/public/assets/{AddPropertiesButton-C09dSw6a.js → AddPropertiesButton-DO1jEnTz.js} +2 -2
  18. package/dist/public/assets/{AgentDiffPane-imVcQAvw.js → AgentDiffPane-B5RiGMoL.js} +1 -1
  19. package/dist/public/assets/{AgentIconCluster-CX0heJ76.js → AgentIconCluster-0UCRKo29.js} +1 -1
  20. package/dist/public/assets/{AgentThreadClientBinder-CM_Hnzrg.js → AgentThreadClientBinder-CCxqYyJC.js} +1 -1
  21. package/dist/public/assets/{BugReportHistory-CpWgA9i6.js → BugReportHistory-DxvYMoq8.js} +1 -1
  22. package/dist/public/assets/{BugReportHistoryDialog-Bh3IoStx.js → BugReportHistoryDialog-T_quySbG.js} +1 -1
  23. package/dist/public/assets/{CodeMirrorPropInput-CKTzBmVA.js → CodeMirrorPropInput-zaXO57hT.js} +1 -1
  24. package/dist/public/assets/{ConsentDialogBody-Crr37Gw8.js → ConsentDialogBody-D3s62I9H.js} +1 -1
  25. package/dist/public/assets/{DeleteConfirmationDialog-BTQgbqfd.js → DeleteConfirmationDialog-C5r0h_Ud.js} +1 -1
  26. package/dist/public/assets/{DiffViewBoundary-8RVTpygC.js → DiffViewBoundary-C6M7WbN7.js} +1 -1
  27. package/dist/public/assets/{DocumentContext-C1m9UXHM.js → DocumentContext-UFOE2JWI.js} +1 -1
  28. package/dist/public/assets/{EditorModeToggle-iQ8C1HyA.js → EditorModeToggle-of13PGw3.js} +1 -1
  29. package/dist/public/assets/{EnableSyncConfirmDialog-ot1ZDxq3.js → EnableSyncConfirmDialog-CyQt5yIK.js} +1 -1
  30. package/dist/public/assets/{ExcalidrawDocEditor-YCIaO1FB.js → ExcalidrawDocEditor-w-ELObJ2.js} +1 -1
  31. package/dist/public/assets/FeedbackForm-BTos6Q47.js +1 -0
  32. package/dist/public/assets/{GraphPanel-C3eHn4gW.js → GraphPanel-DXdturwZ.js} +1 -1
  33. package/dist/public/assets/{ImageAttachments-DSlR8TcI.js → ImageAttachments-CiNpc4OD.js} +1 -1
  34. package/dist/public/assets/{ImportSkillDialog-CkAJnfOt.js → ImportSkillDialog-DzwS-_gT.js} +1 -1
  35. package/dist/public/assets/{LintConfigEditor-IydG9Wjj.js → LintConfigEditor-3-bEQ38f.js} +1 -1
  36. package/dist/public/assets/ManagedArtifactProperties-Boovg5M3.js +1 -0
  37. package/dist/public/assets/{ManagedArtifactProperties-BftkuLdv.js → ManagedArtifactProperties-BvP7p4Fn.js} +1 -1
  38. package/dist/public/assets/{MermaidDocEditor-BWUuY8HN.js → MermaidDocEditor-DGUB9_es.js} +1 -1
  39. package/dist/public/assets/{OpenInAgentMenuItem-BAwvIzLB.js → OpenInAgentMenuItem-CIgeKbxm.js} +1 -1
  40. package/dist/public/assets/{PropertyDisplayRow-Uu4HftXO.js → PropertyDisplayRow-Ca_QJFFO.js} +1 -1
  41. package/dist/public/assets/{RegisteredAgentIcon-9VM9CSSM.js → RegisteredAgentIcon-Dt6m0JWd.js} +1 -1
  42. package/dist/public/assets/{ReportBugDialogBody-DpKnchmQ.js → ReportBugDialogBody-3mxOVavv.js} +1 -1
  43. package/dist/public/assets/{ReportBugMenuTrigger-DSs8yLxa.js → ReportBugMenuTrigger-BOQJthK2.js} +2 -2
  44. package/dist/public/assets/{SchemaConfigEditor-59CZ81RK.js → SchemaConfigEditor-Cva8N_Vx.js} +1 -1
  45. package/dist/public/assets/{SessionsHost-BGDWcekB.js → SessionsHost-BEdlvzTb.js} +2 -2
  46. package/dist/public/assets/{SettingsDialogBody-BZT6pxq7.js → SettingsDialogBody-J6zZfbkq.js} +1 -1
  47. package/dist/public/assets/{ShareBranchSwitchDialog-CTDAYuOX.js → ShareBranchSwitchDialog-CqSvdNYn.js} +1 -1
  48. package/dist/public/assets/{ShareReceiveDialog-Cuf5ASDY.js → ShareReceiveDialog-DjUoZWSP.js} +1 -1
  49. package/dist/public/assets/{ShareReceiveMissDialog-XYo17yEk.js → ShareReceiveMissDialog-Bmm-LBUo.js} +1 -1
  50. package/dist/public/assets/{SkillCostValue-BE6EBNfT.js → SkillCostValue-B1jRndjn.js} +1 -1
  51. package/dist/public/assets/{SkillEditBanner-BycfTypX.js → SkillEditBanner-Dg8_RY9w.js} +1 -1
  52. package/dist/public/assets/{SkillForkDialog-SINB-id1.js → SkillForkDialog-BmygC534.js} +1 -1
  53. package/dist/public/assets/{SkillInstallMenu-6CFDq4BF.js → SkillInstallMenu-BvdiguPV.js} +1 -1
  54. package/dist/public/assets/{SkillOriginInline-Cgl8RIR-.js → SkillOriginInline-CtSexbCD.js} +1 -1
  55. package/dist/public/assets/{SkillToolbarControls-BK_AaeoX.js → SkillToolbarControls-BnOTw0g5.js} +1 -1
  56. package/dist/public/assets/{SlidesToolbarControls-60y5ydf2.js → SlidesToolbarControls-DxXFhc_a.js} +1 -1
  57. package/dist/public/assets/{SourceEditor-CBrv7dJo.js → SourceEditor-Do6LuSl-.js} +1 -1
  58. package/dist/public/assets/{TerminalPanel-Bkzcs2Nj.js → TerminalPanel-CsFd9pep.js} +1 -1
  59. package/dist/public/assets/{TerminalWindowApp-D0A8V7Nm.js → TerminalWindowApp-Cvu8cLGl.js} +1 -1
  60. package/dist/public/assets/{TextDocEditor-C6ucmNYD.js → TextDocEditor-Bfu8j-OT.js} +1 -1
  61. package/dist/public/assets/{ThreadView-BIIMjhFk.js → ThreadView-BupzJ5yH.js} +1 -1
  62. package/dist/public/assets/{TimelineDiffPane-L_Q3Y78K.js → TimelineDiffPane-D64_zZAN.js} +1 -1
  63. package/dist/public/assets/{agent-connection-status-BgT1U0id.js → agent-connection-status-DHhTS7mm.js} +1 -1
  64. package/dist/public/assets/{auth-state-cache-NYgkVRT6.js → auth-state-cache-BoBofHh-.js} +1 -1
  65. package/dist/public/assets/{bug-report-send-manager-Bmqwf2M5.js → bug-report-send-manager-pKm1r3MP.js} +1 -1
  66. package/dist/public/assets/{client-version-DR53JJn2.js → client-version-VcA1CS9y.js} +1 -1
  67. package/dist/public/assets/{comment-chips-DeBWzeAe.js → comment-chips-B2XxLI4U.js} +1 -1
  68. package/dist/public/assets/{config-provider-DiJSKkg8.js → config-provider-KvgyFqbI.js} +1 -1
  69. package/dist/public/assets/{css-color-to-hex-wMBAsSG3.js → css-color-to-hex-Dn6DirAJ.js} +1 -1
  70. package/dist/public/assets/{diagnostic-breadcrumb-BjDNQhui.js → diagnostic-breadcrumb-BK7w-wbl.js} +1 -1
  71. package/dist/public/assets/{dist-C_owXiVJ.js → dist-C-xa487z.js} +1 -1
  72. package/dist/public/assets/{doc-paths-dCv8glmi.js → doc-paths-CiKYU4qz.js} +1 -1
  73. package/dist/public/assets/{doc-undo-manager-CLhUJl8z.js → doc-undo-manager-xnWvYKmd.js} +1 -1
  74. package/dist/public/assets/{documents-events-ByK-A_Qe.js → documents-events-BzjTnFaj.js} +1 -1
  75. package/dist/public/assets/{file-tree-adapter-CrD2Zh_o.js → file-tree-adapter-Cvq5dIQn.js} +1 -1
  76. package/dist/public/assets/{file-tree-utils-elC-lbdd.js → file-tree-utils-tm22NIqT.js} +1 -1
  77. package/dist/public/assets/{folder-config-api-C6_l3om9.js → folder-config-api-BYHJ-2CJ.js} +1 -1
  78. package/dist/public/assets/{index-MPigSfWz.js → index-BoV4ZgCO.js} +8 -8
  79. package/dist/public/assets/{lint-config-client-DBFw6OHC.js → lint-config-client-Dutmij5k.js} +1 -1
  80. package/dist/public/assets/{markdownlint-rule-browser-BoWbwkTH.js → markdownlint-rule-browser-BcpMbocU.js} +1 -1
  81. package/dist/public/assets/{messages-hVCpOrm3.js → messages-BHhMAkK_.js} +1 -1
  82. package/dist/public/assets/{messages-Cu3nrgO4.js → messages-BNMfFbl0.js} +1 -1
  83. package/dist/public/assets/{messages-CN6bx_s-.js → messages-BaRzw5BK.js} +1 -1
  84. package/dist/public/assets/{messages-BDBEmoWh.js → messages-C2RvwrlQ.js} +1 -1
  85. package/dist/public/assets/{messages-B2R3Y06g.js → messages-CTHXCi99.js} +1 -1
  86. package/dist/public/assets/{messages-NQv6lBnJ.js → messages-D7fA0LQr.js} +1 -1
  87. package/dist/public/assets/{messages-WhrJ5T4P.js → messages-DPPth-dJ.js} +1 -1
  88. package/dist/public/assets/{messages-CbSNKie_.js → messages-DQRWgXkq.js} +1 -1
  89. package/dist/public/assets/{messages-Dh8tUASl.js → messages-D_JXKK6K.js} +1 -1
  90. package/dist/public/assets/{messages-DFb3Vzg0.js → messages-Dba8d9Jv.js} +1 -1
  91. package/dist/public/assets/{messages-T88bnbcm.js → messages-OAfaaxsv.js} +1 -1
  92. package/dist/public/assets/{messages-y3Nv7XrJ.js → messages-zt85fQDE.js} +1 -1
  93. package/dist/public/assets/{navigation-targets-CvNinRyp.js → navigation-targets-BL5wW6Pq.js} +1 -1
  94. package/dist/public/assets/{page-list-cache-DvhqPgdF.js → page-list-cache-D3JYubhG.js} +1 -1
  95. package/dist/public/assets/{pending-receive-nav-store-o2g0a-Bn.js → pending-receive-nav-store-CuH4lWq3.js} +1 -1
  96. package/dist/public/assets/{preferred-session-events-K_HaJMAn.js → preferred-session-events-5P5vFEmA.js} +1 -1
  97. package/dist/public/assets/{progress-CkEBTFSF.js → progress-01dDXuWD.js} +1 -1
  98. package/dist/public/assets/{project-paths-BzuFAe-N.js → project-paths-DJMqNt89.js} +1 -1
  99. package/dist/public/assets/{prop-types-DI-i5R8d.js → prop-types-CN6SItze.js} +1 -1
  100. package/dist/public/assets/{receive-store-Djrqwgcm.js → receive-store-mjPNDOwU.js} +1 -1
  101. package/dist/public/assets/{selection-context-DzTEr8je.js → selection-context-3hqQN4uG.js} +1 -1
  102. package/dist/public/assets/{skill-scope-BnHkWlIp.js → skill-scope-DQRx7jdL.js} +1 -1
  103. package/dist/public/assets/{skills-api-C9lYknem.js → skills-api-CA8SmuDI.js} +1 -1
  104. package/dist/public/assets/{src-DWAR0qhq.js → src-BHYeoZko.js} +1 -1
  105. package/dist/public/assets/{startup-marks--VxxzHYd.js → startup-marks-B-g3E2Nd.js} +1 -1
  106. package/dist/public/assets/{tag-pill-input-L67HH_ro.js → tag-pill-input-zmNsl2tf.js} +1 -1
  107. package/dist/public/assets/{target-navigation-intent-DAHHkidf.js → target-navigation-intent-CRrGgZfN.js} +1 -1
  108. package/dist/public/assets/{telemetry-startup-DhtP83qd.js → telemetry-startup-06i4tjpG.js} +1 -1
  109. package/dist/public/assets/{terminal-command-events-DonTra6W.js → terminal-command-events-BKSe5MpD.js} +1 -1
  110. package/dist/public/assets/{terminal-launch-events-C87UeOVG.js → terminal-launch-events-BN3VcLCe.js} +1 -1
  111. package/dist/public/assets/{terminal-telemetry-rnrKpL-Q.js → terminal-telemetry-tq_aM2-R.js} +1 -1
  112. package/dist/public/assets/{typing-burst-detector-BLuUdN-d.js → typing-burst-detector-BRbbn7RW.js} +1 -1
  113. package/dist/public/assets/{uninstall-Bnt3uUvy.js → uninstall-CzGXcf8z.js} +1 -1
  114. package/dist/public/assets/{use-activity-panel-DhnfRmuH.js → use-activity-panel-BAF-Ucz2.js} +1 -1
  115. package/dist/public/assets/{use-apply-config-language-ChGKbbl6.js → use-apply-config-language-DlfoA7DK.js} +2 -2
  116. package/dist/public/assets/{use-collab-url-DnDtI_86.js → use-collab-url-DBIPcV7i.js} +1 -1
  117. package/dist/public/assets/{use-conflicts-DYvfJWip.js → use-conflicts-DPj0GwSi.js} +1 -1
  118. package/dist/public/assets/{use-live-xterm-theme-BDq8DzaU.js → use-live-xterm-theme-Cg6WeiJo.js} +1 -1
  119. package/dist/public/assets/{use-open-skill-BK-vnG6-.js → use-open-skill-Cio74U1q.js} +1 -1
  120. package/dist/public/assets/{use-settings-route-8XQTWK31.js → use-settings-route-CyhF9ifY.js} +1 -1
  121. package/dist/public/assets/{use-skill-origin-B1YmBhKN.js → use-skill-origin-DuSzEzyo.js} +1 -1
  122. package/dist/public/assets/{use-skills-CYMgz3tV.js → use-skills-BpBiRwqs.js} +1 -1
  123. package/dist/public/assets/{use-terminal-enabled-DYkPSupQ.js → use-terminal-enabled-CW9xf1Ty.js} +1 -1
  124. package/dist/public/assets/{use-timeline-entry-diff-CNgx0eFH.js → use-timeline-entry-diff-595jKiGo.js} +1 -1
  125. package/dist/public/assets/{use-workspace-TNZRqr22.js → use-workspace-B6pir6UE.js} +1 -1
  126. package/dist/public/index.html +57 -57
  127. package/dist/public/uninstall.html +4 -4
  128. package/dist/registry-probes-DcQmklSR.mjs +17 -0
  129. package/dist/{removal-file-path-BXR6pfkp.mjs → removal-file-path-Bm-2uQPi.mjs} +1 -1
  130. package/dist/{repair-launch-json-DP6KyVNN.mjs → repair-launch-json-b1UC0Z9Y.mjs} +1 -1
  131. package/dist/{repair-mcp-configs-B4GpHKFe.mjs → repair-mcp-configs-Boh7ga7s.mjs} +1 -1
  132. package/dist/src-73Vc4tlm.mjs +11 -0
  133. package/dist/src-uidD5ZLv.mjs +1 -0
  134. package/dist/{start-YF7-qdEa.mjs → start-B81qeDBS.mjs} +3 -3
  135. package/dist/start-Rczs5F9g.mjs +1 -0
  136. package/package.json +4 -4
  137. package/dist/constants-CdiHNFvt.mjs +0 -1
  138. package/dist/init-BNRf8IKE.mjs +0 -1
  139. package/dist/loader-0rF9tfd3.mjs +0 -1
  140. package/dist/preview-CvKb1PXt.mjs +0 -1
  141. package/dist/public/assets/FeedbackForm-CDTuiQCm.js +0 -1
  142. package/dist/public/assets/ManagedArtifactProperties-Biuoihpn.js +0 -1
  143. package/dist/registry-probes-CADyDcpU.mjs +0 -17
  144. package/dist/src-BY955T7w.mjs +0 -11
  145. package/dist/src-DYZb5r4K.mjs +0 -1
  146. package/dist/start-C-EE421o.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,br as o,dt as s,lt as c,mi as l,st as u,ut as d,z as f}from"./DocumentContext-C1m9UXHM.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{n as x,r as S,t as C}from"./AgentIconCluster-CX0heJ76.js";import{t as w}from"./button-HKX9wT1K.js";import{i as T,n as E,r as D,t as O}from"./tooltip-BnyyQDRs.js";import{n as k,r as A,t as j}from"./collapsible-DYySK8La.js";import{a as M,c as N,i as P,l as F,n as I,o as L,r as R,s as z,t as B}from"./alert-dialog-BJIyfEVh.js";import{n as V,t as H}from"./with-selector-PRoyWQiu.js";import{t as ee}from"./checkbox-Crs_F_Np.js";import{A as U,C as W,D as G,E as te,O as ne,S as K,T as q,_ as J,b as re,f as ie,g as ae,h as oe,j as se,k as ce,m as le,p as ue,r as de,v as fe,w as pe,x as me,y as he}from"./floating-ui.dom-CDtYEnEj.js";import{c as ge,d as _e,l as ve,o as ye,s as be,u as xe}from"./dist-DYso7MCm.js";import{t as Se}from"./label-D-K3fWtj.js";import{i as Ce,n as we,o as Te,s as Ee,t as De}from"./select-ByJwKu6h.js";import{n as Oe,t as ke}from"./radio-group-npdxiS6E.js";import{t as Ae}from"./switch-iwBsEWej.js";import{n as je,r as Me,t as Ne}from"./toggle-group-ZKcYQ5bn.js";import{a as Pe,c as Fe,d as Ie,f as Le,g as Re,h as ze,i as Be,l as Ve,s as He,t as Ue,u as We,y as Ge}from"./RegisteredAgentIcon-9VM9CSSM.js";import{a as Ke,i as qe,o as Je}from"./terminal-telemetry-rnrKpL-Q.js";import{Ar as Ye,Cc as Xe,Cn as Ze,Cs as Qe,Dc as $e,Ds as et,Dt as tt,Ec as nt,Es as rt,Fo as it,Go as at,Hc as Y,Ic as ot,Io as st,Is as ct,Jn as lt,Jo as ut,Ko as dt,Lo as ft,Mo as pt,No as mt,Ps as ht,Ro as gt,Sn as _t,Tc as vt,Ts as yt,Vn as bt,Vo as xt,Xo as St,Yo as Ct,Zo as wt,_c as Tt,_s as Et,as as Dt,at as Ot,bs as kt,di as At,ds as jt,es as Mt,fc as Nt,ft as Pt,gc as Ft,is as It,jo as Lt,ms as Rt,ns as zt,os as Bt,pa as Vt,pt as Ht,qc as Ut,qo as Wt,si as Gt,ts as Kt,vi as qt,vs as Jt,wc as Yt,ws as Xt,ys as Zt,zc as Qt,zs as $t}from"./dist-C_owXiVJ.js";import{t as en}from"./trace-api-BP9dN1Hz.js";import{n as X}from"./dist-CJhtNlOm2.js";import{d as tn,f as nn,h as rn,n as an,o as on,p as sn,r as cn,u as ln,v as un}from"./use-settings-route-8XQTWK31.js";import{t as dn}from"./dist-Cr4-nBVI.js";import{c as fn}from"./documents-events-ByK-A_Qe.js";import{a as pn,i as mn,o as hn}from"./local-menu-action-bus-DaoT7_kL.js";import{a as gn,i as _n,t as vn}from"./use-apply-config-theme-B5w38X1P.js";import{t as yn}from"./OpenInAgentMenuItem-BAwvIzLB.js";import{t as bn}from"./createLucideIcon-B6ULg5PN.js";import{a as xn,c as Sn,f as Cn,g as wn,l as Tn,m as En,p as Dn,s as On,t as kn}from"./EnableSyncConfirmDialog-ot1ZDxq3.js";import{p as An}from"./Mermaid-DHu2w9uV.js";import{t as jn}from"./arrow-up-right-B3B9a7te.js";import{t as Mn}from"./check-BzfGb3KU.js";import{t as Nn}from"./chevron-right-C-g4JuT4.js";import{n as Pn,t as Fn}from"./lint-plugin-meta-zA9wHIBR.js";import{n as In}from"./upload-DGQJhdiQ.js";import{i as Ln,r as Rn}from"./prop-types-DI-i5R8d.js";import{a as zn,h as Bn,r as Vn,t as Hn}from"./dropdown-menu-raSZ06x1.js";import{A as Un,B as Wn,C as Gn,F as Kn,G as qn,H as Jn,J as Yn,K as Xn,L as Zn,M as Qn,N as $n,O as er,P as tr,Q as nr,R as rr,S as ir,U as ar,V as or,W as sr,Y as cr,at as lr,b as ur,c as dr,d as fr,et as pr,f as mr,h as hr,i as gr,j as _r,k as vr,l as yr,m as br,n as xr,nt as Sr,o as Cr,p as wr,q as Tr,v as Er,w as Dr,x as Or,y as kr}from"./auth-state-cache-NYgkVRT6.js";import{g as Ar,h as jr,p as Mr}from"./SkillInstallMenu-6CFDq4BF.js";import{It as Nr}from"./CodeMirrorPropInput-CKTzBmVA.js";import{o as Pr}from"./folder-config-api-C6_l3om9.js";import{t as Fr}from"./info-CilGMBpP.js";import{t as Ir}from"./spinner-Bp2_BYkl.js";import{n as Lr,r as Rr,t as zr}from"./ThemePicker-wGe4WU58.js";import{t as Br}from"./rotate-ccw-B05K_aam.js";import{t as Vr}from"./square-pen-BhqhPrdL.js";import{t as Hr}from"./terminal-DGmaW797.js";import{t as Ur}from"./trash-2-B9Flu-41.js";import{t as Wr}from"./triangle-alert-CCeXtPLU.js";import{t as Gr}from"./x-DIayTyoR.js";import{d as Kr}from"./doc-paths-dCv8glmi.js";import{a as qr}from"./startup-marks--VxxzHYd.js";import{n as Jr}from"./config-provider-DiJSKkg8.js";import{a as Yr}from"./skill-scope-BnHkWlIp.js";import{a as Xr,c as Zr,i as Qr,n as $r,o as ei,r as ti,s as ni,t as ri}from"./dialog-Cv_pRVgB.js";import{m as ii}from"./skills-api-C9lYknem.js";import{t as ai}from"./input-6HnhfmYW.js";import{a as oi,i as si,t as ci}from"./popover-BQOia0v4.js";import{_ as li,a as ui,d as di,f as fi,g as pi,h as mi,m as hi,p as gi,u as _i,v as vi,y as yi}from"./css-color-to-hex-wMBAsSG3.js";import{n as bi}from"./use-apply-config-language-ChGKbbl6.js";import{t as xi}from"./external-link-iDv4MHBU.js";import{t as Si}from"./badge-EmKkAvTN.js";import{t as Ci}from"./tool-list-format-C-Zu064J.js";import{i as wi,o as Ti,r as Ei,t as Di}from"./field-CKJVhgvN.js";import{t as Oi}from"./ConfigSharingInfoTooltip-DTnyEAkk.js";import{t as ki}from"./use-skills-CYMgz3tV.js";import{o as Ai,s as ji,t as Mi}from"./use-open-skill-BK-vnG6-.js";import{r as Ni,t as Pi}from"./DeleteConfirmationDialog-BTQgbqfd.js";import{t as Fi}from"./skeleton-dNp6WrHl.js";import{d as Ii,n as Li,r as Ri,t as zi,u as Bi}from"./lint-config-client-DBFw6OHC.js";import{_ as Vi,a as Hi,d as Ui,f as Wi,g as Gi,h as Ki,i as qi,o as Ji,s as Yi,t as Xi,u as Zi}from"./sortable.esm-D50Gs9Eb.js";import{t as Qi}from"./textarea-DUYJ_2l0.js";import{i as $i,n as ea,t as ta}from"./input-group-D2I6Z888.js";import{a as na,f as ra,i as ia,n as aa,o as oa,p as sa,r as ca,s as la,t as ua}from"./form-L3zDbeZR.js";import{r as da,t as fa}from"./terminal-command-events-DonTra6W.js";import{t as pa}from"./tag-pill-input-L67HH_ro.js";import{t as ma}from"./markdownlint-rule-browser-BoWbwkTH.js";import{n as ha}from"./schema-fields-view-intent-DelPzufU.js";import{n as ga,t as _a}from"./use-terminal-enabled-DYkPSupQ.js";import{_ as va,a as ya,c as ba,d as xa,f as Sa,g as Ca,h as wa,i as Ta,l as Ea,m as Da,n as Oa,o as ka,p as Aa,r as ja,s as Ma,t as Na,u as Pa,v as Fa}from"./agent-connection-status-BgT1U0id.js";var Ia=bn(`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`}]]),La=bn(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Ra=bn(`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`}]]),za=bn(`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 Ba(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Si,{variant:`gray`,children:(0,$.jsx)(m,{id:`YBt9YP`})}),e[0]=t):t=e[0],t}function Va(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)(T,{asChild:!0,children:(0,$.jsx)(Si,{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)(E,{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)(D,{children:(0,$.jsxs)(O,{children:[a,o]})}),t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function Ha(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)(Ba,{}):null,t[7]=o,t[8]=v);let y;t[9]===i?y=t[10]:(y=i?(0,$.jsx)(Va,{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)(jn,{"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 Ua=`settings-sharing-title`;function Wa(){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)(Ga,{}):(0,$.jsx)(Ka,{}),e[0]=n):n=e[0],n}function Ga(){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":Ua,className:`space-y-3`,"data-field":`section:sharing`,children:(0,$.jsx)(Ha,{titleId:Ua,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 Ka(){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(Ja)}},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)(Ha,{titleId:Ua,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":Ua,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)(Fi,{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)(Ha,{titleId:Ua,title:_,scope:`project`,level:`block`,adornment:(0,$.jsx)(Oi,{}),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)(ke,{value:n.mode,onValueChange:e=>void p(e),disabled:i,className:`gap-2`,"aria-labelledby":Ua,"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)(Oe,{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)(Oe,{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)(w,{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":Ua,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 Ja(e){return e??{kind:`status`,mode:`no-git`,excluded:[],trackedUpstream:[]}}function Ya(e){let t=(0,Q.c)(35),{authQueryTransport:n,authTransport:r}=e,{_:i}=h(),a;t[0]===n?a=t[1]:(a=n??nr(),t[0]=n,t[1]=a);let o=a,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={phase:`loading`},t[2]=s):s=t[2];let[c,l]=(0,Z.useState)(s),[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(null),v=(0,Z.useRef)(!1),y;t[3]===o?y=t[4]:(y=async function(){l({phase:`loading`});try{let e=await o.status();l({phase:`loaded`,result:e}),xr(e.authenticated)}catch(e){console.warn(`[AccountSection] GitHub status check failed`,e),l({phase:`check-failed`})}},t[3]=o,t[4]=y);let b=y,x;t[5]===b?x=t[6]:(x=()=>{b()},t[5]=b,t[6]=x);let S;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[7]=S):S=t[7],(0,Z.useEffect)(x,S);let C;t[8]!==i||t[9]!==b||t[10]!==o?(C=async function(){if(v.current)return;v.current=!0,d(!1),p(!0),_(null);let e=null;try{let t=o.signout?await o.signout():{ok:!1,error:i({id:`8cpOa8`})};t.ok||(e=t.error??i({id:`8cpOa8`}))}catch(t){console.warn(`[AccountSection] GitHub disconnect failed`,t),e=i({id:`8cpOa8`})}await b(),e&&_(e),p(!1),v.current=!1},t[8]=i,t[9]=b,t[10]=o,t[11]=C):C=t[11];let T=C,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)(Ha,{titleId:`settings-account-title`,title:E,scope:`user`,children:(0,$.jsx)(m,{id:`E6lrpp`})}),t[13]=D):D=t[13];let O;t[14]!==g||t[15]!==f||t[16]!==T||t[17]!==b||t[18]!==c.phase||t[19]!==c.result?(O=c.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)(Fi,{className:`h-4 w-40`}),(0,$.jsx)(Fi,{className:`h-8 w-32`})]}):c.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)(w,{variant:`outline`,size:`sm`,onClick:()=>void b(),children:(0,$.jsx)(m,{id:`KDw4GX`})})]}):c.result.authenticated?c.result.tier===`A`?(0,$.jsx)(Za,{login:c.result.login}):(0,$.jsx)(Xa,{login:c.result.login,disconnecting:f,error:g,onDisconnect:()=>void T()}):(0,$.jsx)(Qa,{onConnect:()=>d(!0)}),t[14]=g,t[15]=f,t[16]=T,t[17]=b,t[18]=c.phase,t[19]=c.result,t[20]=O):O=t[20];let k;t[21]===b?k=t[22]:(k=e=>{d(e),e||b()},t[21]=b,t[22]=k);let A=c.phase===`loaded`?c.result.host:void 0,j=c.phase===`loaded`?c.result.ghAvailable:void 0,M;t[23]===b?M=t[24]:(M=()=>{b()},t[23]=b,t[24]=M);let N;t[25]!==u||t[26]!==r||t[27]!==k||t[28]!==A||t[29]!==j||t[30]!==M?(N=(0,$.jsx)(cr,{open:u,onOpenChange:k,transport:r,host:A,ghAvailable:j,onSuccess:M}),t[25]=u,t[26]=r,t[27]=k,t[28]=A,t[29]=j,t[30]=M,t[31]=N):N=t[31];let P;return t[32]!==N||t[33]!==O?(P=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-account-title`,className:`space-y-3`,"data-testid":`settings-account`,children:[D,O,N]}),t[32]=N,t[33]=O,t[34]=P):P=t[34],P}function Xa(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)(w,{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 Za(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 Qa(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)(w,{onClick:n,"data-testid":`settings-account-connect`,children:a})]})}),t[3]=n,t[4]=o),o}function $a(e){if(e===void 0)return null;let t=e.params?.agent;if(typeof t!=`string`)return null;let n=Ut[t]??t;return e.id===`followup.enable-manually`?dn._({id:`followup.enable-manually`,values:{agent:n}}):null}function eo(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 to(e){return e.presence===`absent`&&e.installedCount>0}function no(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)(Ae,{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 ro(e,t){return e===`absent`&&!t}function io(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 ao(e){if(e)return()=>{e.ownerDocument.activeElement===e&&va(e)?.focus()}}function oo(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)(w,{ref:ao,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 so(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)(Mn,{"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)(Wr,{"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 co(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)(jn,{"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)(w,{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)(jn,{"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)(w,{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)(w,{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)(w,{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)(w,{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 lo(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)(w,{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 uo(e){return e===void 0?null:Ft[e].external?.installUrl??null}function fo(e){return e!==null&&Object.values(e.probes.satisfiers).some(e=>e!==void 0&&e.state!==`unprobed`)}function po(e){return`${e.source}:${e.id}`}function mo(e,t,n){let r=t.has(po(n)),i=Je(n);return Pe(e,n.source,n.id,r||i,n.supported)}function ho(e,t,n){return n.harness!==void 0&&Ke(n)===0||mo(e,t,n)}function go(e,t,n){let r=new Set(n.map(e=>po(e))),i=e=>ho(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(po)),ranks:new Map(a.map((e,t)=>[po(e),t]))}}function _o(e,t,n,r){let i=t.filter(t=>!e.ranks.has(po(t)));if(i.length===0)return e;let a=new Set(r.map(e=>po(e))),o=e=>ho(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(po),...d,...c.map(po)];return{primaryKeys:new Set([...e.primaryKeys,...s.map(po)]),ranks:new Map(f.map((e,t)=>[e,t]))}}function vo(e){let t=(0,Q.c)(124),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?Fa:r,{_:a}=h(),o=Le(),s=Ge(),{states:c,refresh:l}=Ar(),u=jr(),[d,f]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(null),[C,T]=(0,Z.useState)(!1),[E,D]=(0,Z.useState)(!1),[O,k]=(0,Z.useState)(0),[A,j]=(0,Z.useState)(null),[M,N]=(0,Z.useState)(null),P=(0,Z.useRef)(null),F=(0,Z.useRef)(0),I;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(I={queryKey:[`acp-catalog`],queryFn:Oo,staleTime:3e5},t[2]=I):I=t[2];let L=g(I),R;t[3]!==L.data||t[4]!==o||t[5]!==s?(R=()=>L.data===void 0?null:go(L.data.agents,o,s),t[3]=L.data,t[4]=o,t[5]=s,t[6]=R):R=t[6];let[z,B]=(0,Z.useState)(R),V=z??go([],o,s);if(L.data!==void 0){let e;t[7]!==L.data.agents||t[8]!==z||t[9]!==o||t[10]!==s?(e=z===null?go(L.data.agents,o,s):_o(z,L.data.agents,o,s),t[7]=L.data.agents,t[8]=z,t[9]=o,t[10]=s,t[11]=e):e=t[11];let n=e;n!==z&&B(n),V=n}let H;t[12]===l?H=t[13]:(H=()=>{l()},t[12]=l,t[13]=H);let ee=(0,Z.useEffectEvent)(H),U;t[14]===ee?U=t[15]:(U=()=>{ee()},t[14]=ee,t[15]=U);let W;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(W=[],t[16]=W):W=t[16],(0,Z.useEffect)(U,W);let G;t[17]===i?G=t[18]:(G=()=>{let e=!0,t=F.current+=1;return i([]).then(n=>{!e||F.current!==t||(n.snapshot!==null&&S(n.snapshot),T(!fo(n.snapshot)),D(n.unavailable===!0))}).catch(()=>{e&&F.current===t&&T(!0)}),()=>{e=!1}},t[17]=i,t[18]=G);let te;t[19]!==i||t[20]!==O?(te=[i,O],t[19]=i,t[20]=O,t[21]=te):te=t[21],(0,Z.useEffect)(G,te);let ne=L.data?.agents,K=new Set(s.map(Do)),q;t[22]===u?.installedClis?q=t[23]:(q=u?.installedClis??{},t[22]=u?.installedClis,t[23]=q);let J=q,re=x===null?[]:Pa(x),ie=re.find(e=>e.id===A)??null,ae=re.find(e=>e.id===M)??null,oe;t[24]===i?oe=t[25]:(oe=async function(e){let t=await i(e);return F.current+=1,t.snapshot!==null&&S(t.snapshot),T(!fo(t.snapshot)),t.unavailable===!0&&D(!0),t},t[24]=i,t[25]=oe);let se=oe,ce;t[26]===x?ce=t[27]:(ce=function(e,t){return t===!1?`absent`:t===!0?`present`:e===void 0?`unknown`:Ta(e,x,t)},t[26]=x,t[27]=ce);let le=ce,ue;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(ue=new Set(Yt.map($e).filter(Eo)),t[28]=ue):ue=t[28];let de=ue,fe;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(fe=new Set(vt.map(To).filter(wo)),t[29]=fe):fe=t[29];let pe=fe,me;t[30]!==J||t[31]!==le||t[32]!==c?(me=function(e,t){if(t===`terminal`){let t=Ft[e].external?.targetId;return t===void 0?`unknown`:le(e,c[t]?.installed??null)}let n=Yt.find(t=>$e(t)===e);return n===void 0?`unknown`:le(e,J[n]??null)},t[30]=J,t[31]=le,t[32]=c,t[33]=me):me=t[33];let he=me,ge=function(e,t,n,r,i,a,o,s){let c=e===void 0?void 0:re.find(t=>t.id===e);if(c===void 0||e===void 0||x===null||!fo(x))return{status:void 0,action:void 0,hintAction:void 0,residualFiles:!1,statusId:void 0};let l={enabled:i,installedCount:Aa(wa(c)),presence:o,configurable:xa(c),setupDocSlug:c.row.setupDocSlug,installUrl:s===void 0?Ft[e].external?.installUrl??null:s},u=eo(l),d=Sa(e)&&he(e,r)!==`absent`,f=to(l)&&!d,p=Na({agentId:e,mode:r,snapshot:x,detected:a}),m=p===`connected`||p===`not-connected`&&i,h=m?`${n}-status`:void 0,g=!E||u.kind===`install`||u.kind===`setup-doc`,_=c.cells.projectMcp,v=_===void 0||!Sa(e)||ja(_.consentClass)===r?$a(Oa({agentId:e,mode:r,snapshot:x,detected:a,projectMcp:_})):null;return{status:m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(so,{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)(co,{action:u,rowLabel:t,describedById:h,onConfigure:()=>j(e),onRemove:()=>N(e)}):void 0,hintAction:f&&!E?(0,$.jsx)(lo,{rowLabel:t,onRemove:()=>N(e)}):void 0,residualFiles:f,statusId:h}},_e;t[34]===a?_e=t[35]:(_e=function(e,t){return a(e===`not-installed`?t?{id:`06Ucfz`}:{id:`5SwVv1`}:t?{id:`V0Jk_K`}:{id:`EDD3UL`})},t[34]=a,t[35]=_e);let ve=_e,ye=function(e,t,n,r,i){if(We(e,r),!r||E||t===void 0||x===null)return;let a=re.find(e=>e.id===t);a===void 0||!xa(a)||Na({agentId:t,mode:n,snapshot:x,detected:i})===`not-connected`&&(P.current=e,j(t))},be;t[36]!==ne||t[37]!==o||t[38]!==s?(be=function(){ne!==void 0&&B(go(ne,o,s))},t[36]=ne,t[37]=o,t[38]=s,t[39]=be):be=t[39];let xe=be,Se;t[40]!==d||t[41]!==xe?(Se=function(e){d.trim()!==``&&e.trim()===``&&xe(),f(e)},t[40]=d,t[41]=xe,t[42]=Se):Se=t[42];let Ce=Se,we;t[43]!==xe||t[44]!==p?(we=function(){p&&xe(),m(!p)},t[43]=xe,t[44]=p,t[45]=we):we=t[45];let Te=we,Ee=d.trim().toLowerCase(),De=e=>Ee===``||e.toLowerCase().includes(Ee),Oe=(ne??[]).filter(e=>De(e.name)),ke;t[46]===J?ke=t[47]:(ke=e=>J[e]!==!1,t[46]=J,t[47]=ke);let Ae=ke,je;t[48]===Ae?je=t[49]:(je=(e,t)=>Number(Ae(t))-Number(Ae(e))||Xe[e].displayName.localeCompare(Xe[t].displayName),t[48]=Ae,t[49]=je);let Me=Yt.filter(e=>{let{displayName:t}=Xe[e];return De(t)||De(a({id:`QYfQdv`,values:{displayName:t}}))||De(e)}).sort(je),Ne;t[50]!==le||t[51]!==c?(Ne=e=>le(nt(e),c[e]?.installed??null),t[50]=le,t[51]=c,t[52]=Ne):Ne=t[52];let Ke=Ne,qe;t[53]===Ke?qe=t[54]:(qe=(e,t)=>Number(Ke(e.id)===`absent`)-Number(Ke(t.id)===`absent`),t[53]=Ke,t[54]=qe);let Ye=vt.filter(e=>{let{displayName:t}=e;return De(a({id:`CZBqrX`,values:{displayName:t}}))||De(e.id)}).sort(qe),Ze=u!==null,Qe;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=new Set([...de,...pe]),t[55]=Qe):Qe=t[55];let et=Qe,tt=Tt.filter(e=>!et.has(e)&&De(Ea(e))),rt=Ee!==``,it=!L.isLoading&&!L.isError,at=rt&&it&&Oe.length===0&&Me.length===0&&Ye.length===0&&tt.length===0,Y=!rt||L.isLoading||L.isError||Oe.length>0,ot=!rt||Me.length>0,st=!rt||Ye.length>0||tt.length>0,ct=e=>mo(o,K,e),lt=e=>V.primaryKeys.has(po(e)),ut=e=>V.ranks.get(po(e))??2**53-1,dt=Oe.filter(lt),ft=[...rt||p?Oe:dt].sort((e,t)=>ut(e)-ut(t)||e.name.localeCompare(t.name)),pt=rt?0:Oe.length-dt.length,mt=Me.filter(Ae),ht=mt.length>0&&mt.length<Me.length,gt=!ht||rt||_?Me:mt,_t=ht&&!rt?Me.length-mt.length:0,yt;t[56]===Ke?yt=t[57]:(yt=e=>Ke(e.id)!==`absent`,t[56]=Ke,t[57]=yt);let bt=Ye.filter(yt),xt=tt.filter(e=>le(e,re.find(t=>t.id===e)?.row.detected??null)!==`absent`),St=bt.length+xt.length,Ct=Ye.length+tt.length,wt=St>0&&St<Ct,Et=!wt||rt||y,Dt=Et?Ye:bt,Ot=Et?tt:xt,kt=wt&&!rt?Ct-St:0,At=!it||Oe.some(Je),jt=Ze&&Me.some(Ae),Mt;t[58]===c?Mt=t[59]:(Mt=e=>c[e.id]?.installed===!0,t[58]=c,t[59]=Mt);let Nt=Ye.some(Mt),Pt=Y?(0,$.jsx)(io,{label:a({id:`RXEbZy`}),labelId:`settings-configure-agents-in-app`,children:L.isLoading?(0,$.jsxs)(`div`,{className:`flex items-center justify-center gap-2 px-3 py-6 text-muted-foreground text-sm`,children:[(0,$.jsx)(Ir,{className:`size-4`,"aria-hidden":`true`}),a({id:`ucXZ0k`})]}):L.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)(za,{className:`size-5`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{children:a({id:`FqGWeR`})}),(0,$.jsx)(w,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void L.refetch(),children:a({id:`6gRgw8`})})]}):(ne?.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=po(e),n=ct(e),r=e.supported?e.description:a({id:`5jEnaB`});return(0,$.jsx)(no,{icon:(0,$.jsx)(Ue,{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?(Re({source:e.source,id:e.id,name:e.name,supported:e.supported,featured:e.featured,...e.iconUrl===void 0?{}:{iconUrl:e.iconUrl}},{makeDefault:!1}),We(Ve(e.source,e.id),!0)):(We(Ve(e.source,e.id),!1),ze(t,e=>Pe(o,e.source,e.id,!0,e.supported)))}},t)}),(0,$.jsx)(oo,{hiddenCount:pt,expanded:p,onToggle:Te,testId:`configure-agents-in-app-show-more`})]})},`in-app`):null,It=ot?(0,$.jsxs)(io,{label:a({id:`ALhMYW`}),labelId:`settings-configure-agents-terminal`,children:[gt.map(e=>{let{displayName:t}=Xe[e],n=J[e]??null,r=le($e(e),n),i=He(o,e,r===`absent`),s=`configure-agents-terminal-row-${e}`,{status:c,action:l,hintAction:u,residualFiles:d,statusId:f}=ge($e(e),a({id:`QYfQdv`,values:{displayName:t}}),s,`terminal`,i,n,r,uo($e(e))??Xe[e].docsUrl);return(0,$.jsx)(no,{icon:(0,$.jsx)(yn,{id:Ni(e),className:`size-4`,"aria-hidden":`true`}),name:a({id:`QYfQdv`,values:{displayName:t}}),hint:r===`absent`?{text:ve(`not-installed`,d),action:u}:void 0,status:c,action:l,checked:i,disabled:ro(r,i),ariaLabel:a({id:`27TLNq`,values:{displayName:t}}),testId:`configure-agents-terminal-${e}`,rowTestId:s,statusId:f,onToggle:Ze?t=>ye(Ie(e),$e(e),`terminal`,t,J[e]??null):void 0},e)}),(0,$.jsx)(oo,{hiddenCount:_t,expanded:_,onToggle:()=>v(Co),testId:`configure-agents-terminal-show-more`})]},`terminal`):null,Lt=st?(0,$.jsxs)(io,{label:a({id:`BwKH4d`}),labelId:`settings-configure-agents-desktop`,labelIcon:(0,$.jsx)(jn,{"aria-hidden":`true`,className:`size-3`}),children:[Dt.map(e=>{let t=c[e.id]?.installed??null,{displayName:n}=e,r=Be(o,e.id,t),i=le(nt(e.id),t),s=`configure-agents-desktop-row-${e.id}`,{status:l,action:u,hintAction:d,residualFiles:f,statusId:p}=ge(nt(e.id),a({id:`CZBqrX`,values:{displayName:n}}),s,`external`,r,t,i);return(0,$.jsx)(no,{icon:(0,$.jsx)(yn,{id:e.id,className:`size-4`,"aria-hidden":`true`}),name:a({id:`CZBqrX`,values:{displayName:n}}),hint:i===`absent`?{text:ve(`not-installed`,f),action:d}:void 0,status:l,action:u,checked:r,disabled:ro(i,r),ariaLabel:a({id:`cdBape`,values:{displayName:n}}),testId:`configure-agents-desktop-${e.id}`,rowTestId:s,statusId:p,onToggle:n=>ye(Fe(e.id),nt(e.id),`external`,n,t)},e.id)}),Ot.map(e=>{let t=re.find(t=>t.id===e)??null,n=t?.row.detected??null,r=Ea(e),i=le(e,n),a=`agent-connection-${e}`,o=ge(e,r,a,`external`,t===null||!ba(t),n,i);return(0,$.jsx)(no,{icon:(0,$.jsx)(ka,{agentId:e,className:`size-4 text-muted-foreground`}),name:r,hint:i===`absent`?{text:ve(`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)(oo,{hiddenCount:kt,expanded:y,onToggle:()=>b(So),testId:`configure-agents-desktop-show-more`})]},`desktop`):null,Rt=[{node:Pt,hasPresent:At},{node:It,hasPresent:jt},{node:Lt,hasPresent:Nt}].sort(xo).map(bo),zt;t[60]===a?zt=t[61]:(zt=a({id:`lBN3T6`}),t[60]=a,t[61]=zt);let Bt;t[62]===a?Bt=t[63]:(Bt=a({id:`D4I0F9`}),t[62]=a,t[63]=Bt);let Vt;t[64]!==zt||t[65]!==Bt?(Vt=(0,$.jsx)(Ha,{titleId:`settings-configure-agents-title`,title:zt,children:Bt}),t[64]=zt,t[65]=Bt,t[66]=Vt):Vt=t[66];let Ht;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(Ht=(0,$.jsx)(mn,{className:`-translate-y-1/2 absolute top-1/2 start-2.5 size-4 text-muted-foreground`,"aria-hidden":`true`}),t[67]=Ht):Ht=t[67];let Ut;t[68]===Ce?Ut=t[69]:(Ut=e=>Ce(e.target.value),t[68]=Ce,t[69]=Ut);let Wt;t[70]===a?Wt=t[71]:(Wt=a({id:`-7s4fw`}),t[70]=a,t[71]=Wt);let Gt;t[72]===a?Gt=t[73]:(Gt=a({id:`-7s4fw`}),t[72]=a,t[73]=Gt);let Kt;t[74]!==d||t[75]!==Ut||t[76]!==Wt||t[77]!==Gt?(Kt=(0,$.jsxs)(`div`,{className:`relative`,children:[Ht,(0,$.jsx)(ai,{value:d,onChange:Ut,placeholder:Wt,"aria-label":Gt,className:`ps-8`,"data-testid":`configure-agents-search`})]}),t[74]=d,t[75]=Ut,t[76]=Wt,t[77]=Gt,t[78]=Kt):Kt=t[78];let qt;t[79]!==a||t[80]!==E?(qt=E?(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)(Wr,{"aria-hidden":!0,className:`size-4 shrink-0`}),(0,$.jsx)(`span`,{children:a({id:`RD8cCw`})})]}):null,t[79]=a,t[80]=E,t[81]=qt):qt=t[81];let Jt;t[82]!==a||t[83]!==C?(Jt=C?(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)(za,{"aria-hidden":!0,className:`size-4 shrink-0`}),(0,$.jsx)(`span`,{role:`status`,children:a({id:`4sE6E9`})})]}),(0,$.jsx)(w,{type:`button`,variant:`outline`,size:`sm`,className:`shrink-0`,onClick:()=>k(yo),children:a({id:`6gRgw8`})})]}):null,t[82]=a,t[83]=C,t[84]=Jt):Jt=t[84];let Xt;t[85]!==a||t[86]!==at?(Xt=at?(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[85]=a,t[86]=at,t[87]=Xt):Xt=t[87];let Zt=`configure:${A??`closed`}`,Qt;t[88]===A?Qt=t[89]:(Qt=A!==null&&Sa(A),t[88]=A,t[89]=Qt);let $t=ie!==null,en;t[90]===P?en=t[91]:(en=e=>{e||(P.current!==null&&(We(P.current,!1),P.current=null),j(null))},t[90]=P,t[91]=en);let X;t[92]!==se||t[93]!==ie||t[94]!==P?(X=(e,t)=>ie===null?Promise.resolve({ok:!1,report:{actions:[],conflicts:[],withheld:[]},snapshot:null}):se(Da(ie,e,t)).then(e=>(e.ok&&(P.current=null),e)),t[92]=se,t[93]=ie,t[94]=P,t[95]=X):X=t[95];let tn;t[96]!==ie||t[97]!==Zt||t[98]!==Qt||t[99]!==$t||t[100]!==en||t[101]!==X?(tn=(0,$.jsx)(ya,{connection:ie,paired:Qt,open:$t,onOpenChange:en,onSave:X},Zt),t[96]=ie,t[97]=Zt,t[98]=Qt,t[99]=$t,t[100]=en,t[101]=X,t[102]=tn):tn=t[102];let nn=`remove:${M??`closed`}`,rn;t[103]===M?rn=t[104]:(rn=M!==null&&Sa(M),t[103]=M,t[104]=rn);let an=ae!==null,on;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(on=e=>{e||N(null)},t[105]=on):on=t[105];let sn;t[106]!==se||t[107]!==ae?(sn=e=>ae===null?Promise.resolve({ok:!1,report:{actions:[],conflicts:[],withheld:[]},snapshot:null}):se(Ca(ae,e===void 0?[]:e)),t[106]=se,t[107]=ae,t[108]=sn):sn=t[108];let cn;t[109]!==ae||t[110]!==nn||t[111]!==rn||t[112]!==an||t[113]!==sn?(cn=(0,$.jsx)(Ma,{connection:ae,paired:rn,open:an,onOpenChange:on,onRemove:sn},nn),t[109]=ae,t[110]=nn,t[111]=rn,t[112]=an,t[113]=sn,t[114]=cn):cn=t[114];let ln;return t[115]!==Rt||t[116]!==Vt||t[117]!==Kt||t[118]!==qt||t[119]!==Jt||t[120]!==Xt||t[121]!==tn||t[122]!==cn?(ln=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-configure-agents-title`,className:`space-y-6`,"data-field":`section:agent-connections`,"data-testid":`settings-configure-agents`,children:[Vt,Kt,qt,Jt,Xt,Rt,tn,cn]}),t[115]=Rt,t[116]=Vt,t[117]=Kt,t[118]=qt,t[119]=Jt,t[120]=Xt,t[121]=tn,t[122]=cn,t[123]=ln):ln=t[123],ln}function yo(e){return e+1}function bo(e){return e.node}function xo(e,t){return Number(t.hasPresent)-Number(e.hasPresent)}function So(e){return!e}function Co(e){return!e}function wo(e){return e!==void 0}function To(e){return nt(e.id)}function Eo(e){return e!==void 0}function Do(e){return po(e)}function Oo(e){let{signal:t}=e;return qe(t)}var ko=`open-knowledge-app`;function Ao({from:e,to:t}){try{en.getTracer(ko).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 jo=`open-knowledge-app`;function Mo(e){let t=e.light.startsWith(`saved-`),n=e.dark.startsWith(`saved-`);return!t||!n?`incomplete`:e.light===e.dark?`same`:`different`}function No(e){try{en.getTracer(jo).startSpan(`ok.saved_themes.assignment`,{attributes:{"saved_theme.pair":Mo(e)}}).end()}catch(e){console.warn(`[saved-theme-telemetry] assignment span emit failed:`,e instanceof Error?e:String(e))}}var Po=`system`;function Fo(e){return typeof e==`string`&&Ct.includes(e)}function Io(e){return Fo(e)?e:Po}function Lo(e){return new Intl.DisplayNames([e],{type:`language`}).of(e)??e}function Ro(e){let t=(0,Q.c)(6),{choice:n}=e;if(n===Po){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=Lo(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 zo(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=Io(o),t[6]=o,t[7]=s);let c=s,l;t[8]===r?l=t[9]:(l=e=>r(Io(e)),t[8]=r,t[9]=l);let u;t[10]===c?u=t[11]:(u=(0,$.jsx)(Ee,{children:(0,$.jsx)(Ro,{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)(Te,{...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)(we,{children:[(0,$.jsx)(Ce,{value:Po,children:(0,$.jsx)(Ro,{choice:Po})}),ut.map(Bo)]}),t[17]=f):f=t[17];let p;return t[18]!==c||t[19]!==l||t[20]!==d?(p=(0,$.jsxs)(De,{value:c,onValueChange:l,children:[d,f]}),t[18]=c,t[19]=l,t[20]=d,t[21]=p):p=t[21],p}function Bo(e){return(0,$.jsx)(Ce,{value:e,children:(0,$.jsx)(Ro,{choice:e})},e)}function Vo(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 Ho(e,t,n){return e.id===`custom`?Vo(Mt(yi(t))):e.scheme?Vo(Mt(e.scheme)):Vo(pi(n))}function Uo(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=Ho(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(Wo),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 Wo(e,t){return(0,$.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{backgroundColor:e}},t)}function Go(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 Ko(e){return b(`size-3.5`,e&&`fill-current`)}function qo(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?wt: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)(w,{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)(Uo,{theme:e,customSeed:u,slotMode:y})}),l?(0,$.jsx)(w,{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)(Ur,{"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)(Me,{className:Go(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)(hn,{className:`size-3.5`})}):null,(0,$.jsx)(Me,{id:t===0?d:void 0,className:Go(r),pressed:r,onPressedChange:t=>{t&&a(`light`,e.id)},"aria-label":x({id:`sq4WQH`,values:{0:e.label}}),children:(0,$.jsx)(Lr,{className:Ko(r)})}),(0,$.jsx)(Me,{className:Go(i),pressed:i,onPressedChange:t=>{t&&a(`dark`,e.id)},"aria-label":x({id:`lZvQrY`,values:{0:e.label}}),children:(0,$.jsx)(Rr,{className:Ko(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)(w,{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)(pn,{"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 T;t[24]===v?T=t[25]:(T=v.map(Jo),t[24]=v,t[25]=T);let E;return t[26]!==p||t[27]!==m||t[28]!==f||t[29]!==S||t[30]!==C||t[31]!==T?(E=(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,T]}),t[26]=p,t[27]=m,t[28]=f,t[29]=S,t[30]=C,t[31]=T,t[32]=E):E=t[32],E}function Jo(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)(In,{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 Yo=12e3;function Xo(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}=Jr(),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(``),[x,S]=(0,Z.useState)(null),[C,T]=(0,Z.useState)(!1),E=(0,Z.useRef)(null),D,O;t[4]===u?(D=t[5],O=t[6]):(D=()=>{u()},O=[u],t[4]=u,t[5]=D,t[6]=O),(0,Z.useEffect)(D,O);let k;t[7]!==n||t[8]!==o?(k=Xt(n,o),t[7]=n,t[8]=o,t[9]=k):k=t[9];let A=k,j,M,N,P,F,I,L,R,z,B,V,H,ee,U,W,G,te,ne,K,q,J;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]!==A||t[24]!==m||t[25]!==o||t[26]!==c||t[27]!==s){let e=It(y),n;t[49]===o?n=t[50]:(n=o.filter(ts),t[49]=o,t[50]=n);let h=n,D,O,k,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]!==A||t[64]!==m||t[65]!==o||t[66]!==c||t[67]!==s){let e=o.flatMap(es),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;k=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:Yo,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]!==A||t[93]!==o?(x=async function(e){if(e.preventDefault(),C)return;let t=It(y);if(!t.ok){S(a({id:`RG3yW6`})),E.current?.focus();return}let n=i.slotMode??`light`,s=o.find(e=>e.id===A[n])?.scheme??yi(i.customSeed),c={name:t.name,variant:s.variant,palette:{...s.palette}};S(null),T(!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`})),T(!1),E.current?.focus();return}let d={id:l.id,label:c.name,kind:c.variant,scheme:c,toTokens:()=>Mt(c)};r(n,l.id,A,[...o,d]),await u(),b(``),v(!1),T(!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]=A,t[93]=o,t[94]=x):x=t[94],O=x;let j;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),j=s.map(e),t[95]=a,t[96]=s,t[97]=j}else j=t[97];let M=j;H=`flex w-full min-w-0 flex-col gap-2`,t[100]!==a||t[101]!==l||t[102]!==u?(ee=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)(w,{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]=ee):ee=t[103];let N;t[104]!==a||t[105]!==c?(N=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)(Wr,{"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]=N):N=t[106],t[107]===N?U=t[108]:(U=(0,$.jsx)(`div`,{role:`status`,children:N}),t[107]=N,t[108]=U),D=qo,ie=i,ae=A,oe=h,se=M;let P;t[109]===o?P=t[110]:(P=o.filter($o).map(Qo),t[109]=o,t[110]=P);let F=m?p:null;t[111]!==g||t[112]!==P||t[113]!==F?(ce={themeIds:P,selectedId:F,onSelect:g},t[111]=g,t[112]=P,t[113]=F,t[114]=ce):ce=t[114],re=e.map(Zo),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]=A,t[64]=m,t[65]=o,t[66]=c,t[67]=s,t[68]=D,t[69]=O,t[70]=k,t[71]=H,t[72]=ee,t[73]=U,t[74]=re,t[75]=ie,t[76]=ae,t[77]=oe,t[78]=se,t[79]=ce}else D=t[68],O=t[69],k=t[70],H=t[71],ee=t[72],U=t[73],re=t[74],ie=t[75],ae=t[76],oe=t[77],se=t[78],ce=t[79];let le;t[115]!==k||t[116]!==re?(le={themeIds:re,onDelete:k},t[115]=k,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]!==A||t[121]!==o?(de=(e,t)=>r(e,t,A,o),t[119]=r,t[120]=A,t[121]=o,t[122]=de):de=t[122],t[123]!==D||t[124]!==ie||t[125]!==ae||t[126]!==oe||t[127]!==se||t[128]!==ce||t[129]!==le||t[130]!==de?(W=(0,$.jsx)(D,{...ie,selection:ae,themes:oe,unavailableThemes:se,editControl:ce,deleteControl:le,createControl:ue,onAssign:de}),t[123]=D,t[124]=ie,t[125]=ae,t[126]=oe,t[127]=se,t[128]=ce,t[129]=le,t[130]=de,t[131]=W):W=t[131],F=ri,B=_,t[132]===C?V=t[133]:(V=e=>{C||v(e)},t[132]=C,t[133]=V),P=Qr;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)(Zr,{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)(Xr,{children:me}),t[140]=me,t[141]=he),t[142]!==pe||t[143]!==he?(z=(0,$.jsxs)(ni,{className:`gap-2`,children:[pe,he]}),t[142]=pe,t[143]=he,t[144]=z):z=t[144],N=$r,I=`create-saved-theme-form`,L=!0,R=O,M=Di,K=x!==null;let ge;t[145]===a?ge=t[146]:(ge=a({id:`HZ7fEu`}),t[145]=a,t[146]=ge),t[147]===ge?q=t[148]:(q=(0,$.jsx)(Ti,{htmlFor:`create-saved-theme-name`,children:ge}),t[147]=ge,t[148]=q);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?(J=(0,$.jsx)(ai,{ref:E,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]=J):J=t[156],j=Ei,G=`create-saved-theme-help`,te=`font-mono`,ne=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]=A,t[24]=m,t[25]=o,t[26]=c,t[27]=s,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]=H,t[40]=ee,t[41]=U,t[42]=W,t[43]=G,t[44]=te,t[45]=ne,t[46]=K,t[47]=q,t[48]=J}else j=t[28],M=t[29],N=t[30],P=t[31],F=t[32],I=t[33],L=t[34],R=t[35],z=t[36],B=t[37],V=t[38],H=t[39],ee=t[40],U=t[41],W=t[42],G=t[43],te=t[44],ne=t[45],K=t[46],q=t[47],J=t[48];let re;t[157]!==j||t[158]!==G||t[159]!==te||t[160]!==ne?(re=(0,$.jsx)(j,{id:G,className:te,children:ne}),t[157]=j,t[158]=G,t[159]=te,t[160]=ne,t[161]=re):re=t[161];let ie;t[162]===x?ie=t[163]:(ie=x?(0,$.jsx)(wi,{id:`create-saved-theme-error`,children:x}):null,t[162]=x,t[163]=ie);let ae;t[164]!==M||t[165]!==re||t[166]!==ie||t[167]!==K||t[168]!==q||t[169]!==J?(ae=(0,$.jsxs)(M,{"data-invalid":K,children:[q,J,re,ie]}),t[164]=M,t[165]=re,t[166]=ie,t[167]=K,t[168]=q,t[169]=J,t[170]=ae):ae=t[170];let oe;t[171]!==I||t[172]!==L||t[173]!==R||t[174]!==ae?(oe=(0,$.jsx)(`form`,{id:I,noValidate:L,onSubmit:R,children:ae}),t[171]=I,t[172]=L,t[173]=R,t[174]=ae,t[175]=oe):oe=t[175];let se;t[176]!==N||t[177]!==oe?(se=(0,$.jsx)(N,{children:oe}),t[176]=N,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)(w,{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)(w,{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)(ei,{children:[ue,fe]}),t[191]=ue,t[192]=fe,t[193]=pe):pe=t[193];let me;t[194]!==P||t[195]!==z||t[196]!==se||t[197]!==pe?(me=(0,$.jsxs)(P,{children:[z,se,pe]}),t[194]=P,t[195]=z,t[196]=se,t[197]=pe,t[198]=me):me=t[198];let he;t[199]!==F||t[200]!==B||t[201]!==V||t[202]!==me?(he=(0,$.jsx)(F,{open:B,onOpenChange:V,children:me}),t[199]=F,t[200]=B,t[201]=V,t[202]=me,t[203]=he):he=t[203];let ge;return t[204]!==H||t[205]!==ee||t[206]!==U||t[207]!==W||t[208]!==he?(ge=(0,$.jsxs)(`div`,{className:H,children:[ee,U,W,he]}),t[204]=H,t[205]=ee,t[206]=U,t[207]=W,t[208]=he,t[209]=ge):ge=t[209],ge}function Zo(e){return e.id}function Qo(e){return e.id}function $o(e){return e.id.startsWith(`saved-`)}function es(e){let t=kt(e.id);return!t.ok||!e.scheme?[]:[{id:e.id,stem:t.stem,label:e.label,scheme:e.scheme}]}function ts(e){return e.id!==`custom`}function ns(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)]:ns(r,t)}}function rs(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 is(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 as(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 os(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=ra(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=ns(ds(n),r),a=t.patch(i);if(a.ok)return e.clearErrors(n),e.resetField(n,{defaultValue:r,keepError:!1}),!0;if(jt(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:ls(a.error,n)});return!1}function ls(e,t){if(jt(e)&&e.code===`SCHEMA_INVALID`){let n=e.issues.find(e=>us(e,t));if(n)return n.message}return Bt(e)}function us(e,t){return e.path.map(String).join(`.`)===t}function ds(e){return e.split(`.`)}function fs(e){if(!jt(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 ps(){let e=(0,Q.c)(3),t,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Fi,{className:`h-5 w-32`}),n=(0,$.jsx)(Fi,{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)(Fi,{className:`h-9 w-full`}),(0,$.jsx)(Fi,{className:`h-9 w-full`})]})]}),e[2]=r):r=e[2],r}function ms({field:e,scope:t,commitField:n,isFlashed:r}){"use no memo";let{_:i}=h(),a=sa(),{setTheme:o}=_(),s=gn(),c=yt(mt,e.path),l=c?is(c):void 0,u=c?rs(c):void 0,d=c?as(c):void 0,f=c?Dt(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)},D=()=>{let e=n(g);return e&&C(),e},k=()=>a.getFieldState(g).isDirty?D():!0,A=()=>{if(e.control===`theme-tiles`){let e=s?.userBinding;if(!e)return;let t=e.patch({appearance:fi()});t.ok?C():a.setError(g,{type:`manual`,message:ls(t.error,g)});return}let t=u===void 0?null:u;a.setValue(g,t,{shouldDirty:!1}),e.control===`theme-cards`&&o(vn(t)),D()},j=b(`relative`,r&&`animate-settings-flash`);return(0,$.jsx)(ia,{control:a.control,name:g,render:({field:n})=>{let r=!p&&(u!==void 0||n.value!==void 0);return(0,$.jsxs)(na,{className:j,"data-field":e.path.join(`.`),"data-scope":t,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(oa,{className:`text-sm font-medium`,children:v}),r?(0,$.jsxs)(O,{children:[(0,$.jsx)(T,{asChild:!0,children:(0,$.jsx)(w,{variant:`ghost`,size:`icon`,className:`h-5 w-5 text-muted-foreground opacity-60 hover:opacity-100`,onClick:A,"aria-label":i({id:`lhjq3G`,values:{labelText:v}}),children:(0,$.jsx)(Br,{className:`size-3.5`})})}),(0,$.jsx)(E,{children:(0,$.jsx)(m,{id:`L-rMC9`})})]}):null]}),e.description?(0,$.jsx)(ca,{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)(gs,{field:e,ctl:n,typeTag:l,enumOptions:d,onCommit:k,onRevertToBaseline:()=>a.resetField(g,{keepError:!0}),onSavedOutsideForm:C,onWriteRejected:e=>{a.setError(g,{type:`manual`,message:ls(e,g)})}})}),(0,$.jsx)(bs,{visible:y,srOnly:hs(e.control)})]}),(0,$.jsx)(la,{"data-field-error":e.path.join(`.`)})]})}})}function hs(e){return e===`theme-tiles`||e===`theme-cards`}function gs({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=gn(),p=f?.merged??null;if(e.control===`language-select`)return(0,$.jsx)(zo,{...c,value:t.value,ref:t.ref,onBlur:t.onBlur,onValueChange:e=>{let n=bi(t.value)??`system`;n!==e&&Ao({from:n,to:e}),t.onChange(e),i()}});if(e.control===`theme-cards`){let{id:n,...r}=c;return(0,$.jsx)(zr,{...r,firstItemId:n,value:vn(t.value),"aria-label":l(e.label),onValueChange:e=>{let n=vn(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=et(i,d===`dark`);return(0,$.jsx)(Xo,{...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`?hi(yi(r)):di(t,c)};ui({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){No(d),o();return}ui({selection:n,modePreference:i,slotMode:a,customSeed:r,themes:c}),u(p(n)??i??`system`),s(m.error)}})}if(n===`boolean`)return(0,$.jsx)(Ae,{...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)(Ne,{...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)(je,{value:e,id:t===0?n:void 0,className:`text-1sm capitalize`,children:e},e))})}return n===`number`||n===`int`?(0,$.jsx)(vs,{ctl:t,onCommit:i,...c}):n===`array`?(0,$.jsx)(ys,{ctl:t,onCommit:i,...c}):(0,$.jsx)(_s,{ctl:t,onCommit:i,...c})}function _s({ctl:e,onCommit:t,...n}){"use no memo";return(0,$.jsx)(ai,{...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 vs({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)(ai,{...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 ys({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,br as o,dt as s,lt as c,mi as l,st as u,ut as d,z as f}from"./DocumentContext-UFOE2JWI.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{n as x,r as S,t as C}from"./AgentIconCluster-0UCRKo29.js";import{t as w}from"./button-HKX9wT1K.js";import{i as T,n as E,r as D,t as O}from"./tooltip-BnyyQDRs.js";import{n as k,r as A,t as j}from"./collapsible-DYySK8La.js";import{a as M,c as N,i as P,l as F,n as I,o as L,r as R,s as z,t as B}from"./alert-dialog-BJIyfEVh.js";import{n as V,t as H}from"./with-selector-PRoyWQiu.js";import{t as ee}from"./checkbox-Crs_F_Np.js";import{A as U,C as W,D as G,E as te,O as ne,S as K,T as q,_ as J,b as re,f as ie,g as ae,h as oe,j as se,k as ce,m as le,p as ue,r as de,v as fe,w as pe,x as me,y as he}from"./floating-ui.dom-CDtYEnEj.js";import{c as ge,d as _e,l as ve,o as ye,s as be,u as xe}from"./dist-DYso7MCm.js";import{t as Se}from"./label-D-K3fWtj.js";import{i as Ce,n as we,o as Te,s as Ee,t as De}from"./select-ByJwKu6h.js";import{n as Oe,t as ke}from"./radio-group-npdxiS6E.js";import{t as Ae}from"./switch-iwBsEWej.js";import{n as je,r as Me,t as Ne}from"./toggle-group-ZKcYQ5bn.js";import{a as Pe,c as Fe,d as Ie,f as Le,g as Re,h as ze,i as Be,l as Ve,s as He,t as Ue,u as We,y as Ge}from"./RegisteredAgentIcon-Dt6m0JWd.js";import{a as Ke,i as qe,o as Je}from"./terminal-telemetry-tq_aM2-R.js";import{Ar as Ye,Cc as Xe,Cn as Ze,Cs as Qe,Dc as $e,Ds as et,Dt as tt,Ec as nt,Es as rt,Fo as it,Go as at,Hc as Y,Ic as ot,Io as st,Is as ct,Jn as lt,Jo as ut,Ko as dt,Lo as ft,Mo as pt,No as mt,Ps as ht,Ro as gt,Sn as _t,Tc as vt,Ts as yt,Vn as bt,Vo as xt,Xo as St,Yo as Ct,Zo as wt,_c as Tt,_s as Et,as as Dt,at as Ot,bs as kt,di as At,ds as jt,es as Mt,fc as Nt,ft as Pt,gc as Ft,is as It,jo as Lt,ms as Rt,ns as zt,os as Bt,pa as Vt,pt as Ht,qc as Ut,qo as Wt,si as Gt,ts as Kt,vi as qt,vs as Jt,wc as Yt,ws as Xt,ys as Zt,zc as Qt,zs as $t}from"./dist-C-xa487z.js";import{t as en}from"./trace-api-BP9dN1Hz.js";import{n as X}from"./dist-CJhtNlOm2.js";import{d as tn,f as nn,h as rn,n as an,o as on,p as sn,r as cn,u as ln,v as un}from"./use-settings-route-CyhF9ifY.js";import{t as dn}from"./dist-Cr4-nBVI.js";import{c as fn}from"./documents-events-BzjTnFaj.js";import{a as pn,i as mn,o as hn}from"./local-menu-action-bus-DaoT7_kL.js";import{a as gn,i as _n,t as vn}from"./use-apply-config-theme-B5w38X1P.js";import{t as yn}from"./OpenInAgentMenuItem-CIgeKbxm.js";import{t as bn}from"./createLucideIcon-B6ULg5PN.js";import{a as xn,c as Sn,f as Cn,g as wn,l as Tn,m as En,p as Dn,s as On,t as kn}from"./EnableSyncConfirmDialog-CyQt5yIK.js";import{p as An}from"./Mermaid-DHu2w9uV.js";import{t as jn}from"./arrow-up-right-B3B9a7te.js";import{t as Mn}from"./check-BzfGb3KU.js";import{t as Nn}from"./chevron-right-C-g4JuT4.js";import{n as Pn,t as Fn}from"./lint-plugin-meta-zA9wHIBR.js";import{n as In}from"./upload-DGQJhdiQ.js";import{i as Ln,r as Rn}from"./prop-types-CN6SItze.js";import{a as zn,h as Bn,r as Vn,t as Hn}from"./dropdown-menu-raSZ06x1.js";import{A as Un,B as Wn,C as Gn,F as Kn,G as qn,H as Jn,J as Yn,K as Xn,L as Zn,M as Qn,N as $n,O as er,P as tr,Q as nr,R as rr,S as ir,U as ar,V as or,W as sr,Y as cr,at as lr,b as ur,c as dr,d as fr,et as pr,f as mr,h as hr,i as gr,j as _r,k as vr,l as yr,m as br,n as xr,nt as Sr,o as Cr,p as wr,q as Tr,v as Er,w as Dr,x as Or,y as kr}from"./auth-state-cache-BoBofHh-.js";import{g as Ar,h as jr,p as Mr}from"./SkillInstallMenu-BvdiguPV.js";import{It as Nr}from"./CodeMirrorPropInput-zaXO57hT.js";import{o as Pr}from"./folder-config-api-BYHJ-2CJ.js";import{t as Fr}from"./info-CilGMBpP.js";import{t as Ir}from"./spinner-Bp2_BYkl.js";import{n as Lr,r as Rr,t as zr}from"./ThemePicker-wGe4WU58.js";import{t as Br}from"./rotate-ccw-B05K_aam.js";import{t as Vr}from"./square-pen-BhqhPrdL.js";import{t as Hr}from"./terminal-DGmaW797.js";import{t as Ur}from"./trash-2-B9Flu-41.js";import{t as Wr}from"./triangle-alert-CCeXtPLU.js";import{t as Gr}from"./x-DIayTyoR.js";import{d as Kr}from"./doc-paths-CiKYU4qz.js";import{a as qr}from"./startup-marks-B-g3E2Nd.js";import{n as Jr}from"./config-provider-KvgyFqbI.js";import{a as Yr}from"./skill-scope-DQRx7jdL.js";import{a as Xr,c as Zr,i as Qr,n as $r,o as ei,r as ti,s as ni,t as ri}from"./dialog-Cv_pRVgB.js";import{m as ii}from"./skills-api-CA8SmuDI.js";import{t as ai}from"./input-6HnhfmYW.js";import{a as oi,i as si,t as ci}from"./popover-BQOia0v4.js";import{_ as li,a as ui,d as di,f as fi,g as pi,h as mi,m as hi,p as gi,u as _i,v as vi,y as yi}from"./css-color-to-hex-Dn6DirAJ.js";import{n as bi}from"./use-apply-config-language-DlfoA7DK.js";import{t as xi}from"./external-link-iDv4MHBU.js";import{t as Si}from"./badge-EmKkAvTN.js";import{t as Ci}from"./tool-list-format-C-Zu064J.js";import{i as wi,o as Ti,r as Ei,t as Di}from"./field-CKJVhgvN.js";import{t as Oi}from"./ConfigSharingInfoTooltip-DTnyEAkk.js";import{t as ki}from"./use-skills-BpBiRwqs.js";import{o as Ai,s as ji,t as Mi}from"./use-open-skill-Cio74U1q.js";import{r as Ni,t as Pi}from"./DeleteConfirmationDialog-C5r0h_Ud.js";import{t as Fi}from"./skeleton-dNp6WrHl.js";import{d as Ii,n as Li,r as Ri,t as zi,u as Bi}from"./lint-config-client-Dutmij5k.js";import{_ as Vi,a as Hi,d as Ui,f as Wi,g as Gi,h as Ki,i as qi,o as Ji,s as Yi,t as Xi,u as Zi}from"./sortable.esm-D50Gs9Eb.js";import{t as Qi}from"./textarea-DUYJ_2l0.js";import{i as $i,n as ea,t as ta}from"./input-group-D2I6Z888.js";import{a as na,f as ra,i as ia,n as aa,o as oa,p as sa,r as ca,s as la,t as ua}from"./form-L3zDbeZR.js";import{r as da,t as fa}from"./terminal-command-events-BKSe5MpD.js";import{t as pa}from"./tag-pill-input-zmNsl2tf.js";import{t as ma}from"./markdownlint-rule-browser-BcpMbocU.js";import{n as ha}from"./schema-fields-view-intent-DelPzufU.js";import{n as ga,t as _a}from"./use-terminal-enabled-CW9xf1Ty.js";import{_ as va,a as ya,c as ba,d as xa,f as Sa,g as Ca,h as wa,i as Ta,l as Ea,m as Da,n as Oa,o as ka,p as Aa,r as ja,s as Ma,t as Na,u as Pa,v as Fa}from"./agent-connection-status-DHhTS7mm.js";var Ia=bn(`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`}]]),La=bn(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Ra=bn(`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`}]]),za=bn(`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 Ba(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Si,{variant:`gray`,children:(0,$.jsx)(m,{id:`YBt9YP`})}),e[0]=t):t=e[0],t}function Va(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)(T,{asChild:!0,children:(0,$.jsx)(Si,{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)(E,{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)(D,{children:(0,$.jsxs)(O,{children:[a,o]})}),t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function Ha(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)(Ba,{}):null,t[7]=o,t[8]=v);let y;t[9]===i?y=t[10]:(y=i?(0,$.jsx)(Va,{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)(jn,{"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 Ua=`settings-sharing-title`;function Wa(){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)(Ga,{}):(0,$.jsx)(Ka,{}),e[0]=n):n=e[0],n}function Ga(){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":Ua,className:`space-y-3`,"data-field":`section:sharing`,children:(0,$.jsx)(Ha,{titleId:Ua,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 Ka(){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(Ja)}},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)(Ha,{titleId:Ua,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":Ua,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)(Fi,{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)(Ha,{titleId:Ua,title:_,scope:`project`,level:`block`,adornment:(0,$.jsx)(Oi,{}),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)(ke,{value:n.mode,onValueChange:e=>void p(e),disabled:i,className:`gap-2`,"aria-labelledby":Ua,"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)(Oe,{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)(Oe,{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)(w,{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":Ua,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 Ja(e){return e??{kind:`status`,mode:`no-git`,excluded:[],trackedUpstream:[]}}function Ya(e){let t=(0,Q.c)(35),{authQueryTransport:n,authTransport:r}=e,{_:i}=h(),a;t[0]===n?a=t[1]:(a=n??nr(),t[0]=n,t[1]=a);let o=a,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={phase:`loading`},t[2]=s):s=t[2];let[c,l]=(0,Z.useState)(s),[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(null),v=(0,Z.useRef)(!1),y;t[3]===o?y=t[4]:(y=async function(){l({phase:`loading`});try{let e=await o.status();l({phase:`loaded`,result:e}),xr(e.authenticated)}catch(e){console.warn(`[AccountSection] GitHub status check failed`,e),l({phase:`check-failed`})}},t[3]=o,t[4]=y);let b=y,x;t[5]===b?x=t[6]:(x=()=>{b()},t[5]=b,t[6]=x);let S;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[7]=S):S=t[7],(0,Z.useEffect)(x,S);let C;t[8]!==i||t[9]!==b||t[10]!==o?(C=async function(){if(v.current)return;v.current=!0,d(!1),p(!0),_(null);let e=null;try{let t=o.signout?await o.signout():{ok:!1,error:i({id:`8cpOa8`})};t.ok||(e=t.error??i({id:`8cpOa8`}))}catch(t){console.warn(`[AccountSection] GitHub disconnect failed`,t),e=i({id:`8cpOa8`})}await b(),e&&_(e),p(!1),v.current=!1},t[8]=i,t[9]=b,t[10]=o,t[11]=C):C=t[11];let T=C,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)(Ha,{titleId:`settings-account-title`,title:E,scope:`user`,children:(0,$.jsx)(m,{id:`E6lrpp`})}),t[13]=D):D=t[13];let O;t[14]!==g||t[15]!==f||t[16]!==T||t[17]!==b||t[18]!==c.phase||t[19]!==c.result?(O=c.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)(Fi,{className:`h-4 w-40`}),(0,$.jsx)(Fi,{className:`h-8 w-32`})]}):c.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)(w,{variant:`outline`,size:`sm`,onClick:()=>void b(),children:(0,$.jsx)(m,{id:`KDw4GX`})})]}):c.result.authenticated?c.result.tier===`A`?(0,$.jsx)(Za,{login:c.result.login}):(0,$.jsx)(Xa,{login:c.result.login,disconnecting:f,error:g,onDisconnect:()=>void T()}):(0,$.jsx)(Qa,{onConnect:()=>d(!0)}),t[14]=g,t[15]=f,t[16]=T,t[17]=b,t[18]=c.phase,t[19]=c.result,t[20]=O):O=t[20];let k;t[21]===b?k=t[22]:(k=e=>{d(e),e||b()},t[21]=b,t[22]=k);let A=c.phase===`loaded`?c.result.host:void 0,j=c.phase===`loaded`?c.result.ghAvailable:void 0,M;t[23]===b?M=t[24]:(M=()=>{b()},t[23]=b,t[24]=M);let N;t[25]!==u||t[26]!==r||t[27]!==k||t[28]!==A||t[29]!==j||t[30]!==M?(N=(0,$.jsx)(cr,{open:u,onOpenChange:k,transport:r,host:A,ghAvailable:j,onSuccess:M}),t[25]=u,t[26]=r,t[27]=k,t[28]=A,t[29]=j,t[30]=M,t[31]=N):N=t[31];let P;return t[32]!==N||t[33]!==O?(P=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-account-title`,className:`space-y-3`,"data-testid":`settings-account`,children:[D,O,N]}),t[32]=N,t[33]=O,t[34]=P):P=t[34],P}function Xa(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)(w,{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 Za(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 Qa(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)(w,{onClick:n,"data-testid":`settings-account-connect`,children:a})]})}),t[3]=n,t[4]=o),o}function $a(e){if(e===void 0)return null;let t=e.params?.agent;if(typeof t!=`string`)return null;let n=Ut[t]??t;return e.id===`followup.enable-manually`?dn._({id:`followup.enable-manually`,values:{agent:n}}):null}function eo(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 to(e){return e.presence===`absent`&&e.installedCount>0}function no(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)(Ae,{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 ro(e,t){return e===`absent`&&!t}function io(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 ao(e){if(e)return()=>{e.ownerDocument.activeElement===e&&va(e)?.focus()}}function oo(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)(w,{ref:ao,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 so(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)(Mn,{"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)(Wr,{"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 co(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)(jn,{"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)(w,{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)(jn,{"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)(w,{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)(w,{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)(w,{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)(w,{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 lo(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)(w,{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 uo(e){return e===void 0?null:Ft[e].external?.installUrl??null}function fo(e){return e!==null&&Object.values(e.probes.satisfiers).some(e=>e!==void 0&&e.state!==`unprobed`)}function po(e){return`${e.source}:${e.id}`}function mo(e,t,n){let r=t.has(po(n)),i=Je(n);return Pe(e,n.source,n.id,r||i,n.supported)}function ho(e,t,n){return n.harness!==void 0&&Ke(n)===0||mo(e,t,n)}function go(e,t,n){let r=new Set(n.map(e=>po(e))),i=e=>ho(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(po)),ranks:new Map(a.map((e,t)=>[po(e),t]))}}function _o(e,t,n,r){let i=t.filter(t=>!e.ranks.has(po(t)));if(i.length===0)return e;let a=new Set(r.map(e=>po(e))),o=e=>ho(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(po),...d,...c.map(po)];return{primaryKeys:new Set([...e.primaryKeys,...s.map(po)]),ranks:new Map(f.map((e,t)=>[e,t]))}}function vo(e){let t=(0,Q.c)(124),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?Fa:r,{_:a}=h(),o=Le(),s=Ge(),{states:c,refresh:l}=Ar(),u=jr(),[d,f]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(null),[C,T]=(0,Z.useState)(!1),[E,D]=(0,Z.useState)(!1),[O,k]=(0,Z.useState)(0),[A,j]=(0,Z.useState)(null),[M,N]=(0,Z.useState)(null),P=(0,Z.useRef)(null),F=(0,Z.useRef)(0),I;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(I={queryKey:[`acp-catalog`],queryFn:Oo,staleTime:3e5},t[2]=I):I=t[2];let L=g(I),R;t[3]!==L.data||t[4]!==o||t[5]!==s?(R=()=>L.data===void 0?null:go(L.data.agents,o,s),t[3]=L.data,t[4]=o,t[5]=s,t[6]=R):R=t[6];let[z,B]=(0,Z.useState)(R),V=z??go([],o,s);if(L.data!==void 0){let e;t[7]!==L.data.agents||t[8]!==z||t[9]!==o||t[10]!==s?(e=z===null?go(L.data.agents,o,s):_o(z,L.data.agents,o,s),t[7]=L.data.agents,t[8]=z,t[9]=o,t[10]=s,t[11]=e):e=t[11];let n=e;n!==z&&B(n),V=n}let H;t[12]===l?H=t[13]:(H=()=>{l()},t[12]=l,t[13]=H);let ee=(0,Z.useEffectEvent)(H),U;t[14]===ee?U=t[15]:(U=()=>{ee()},t[14]=ee,t[15]=U);let W;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(W=[],t[16]=W):W=t[16],(0,Z.useEffect)(U,W);let G;t[17]===i?G=t[18]:(G=()=>{let e=!0,t=F.current+=1;return i([]).then(n=>{!e||F.current!==t||(n.snapshot!==null&&S(n.snapshot),T(!fo(n.snapshot)),D(n.unavailable===!0))}).catch(()=>{e&&F.current===t&&T(!0)}),()=>{e=!1}},t[17]=i,t[18]=G);let te;t[19]!==i||t[20]!==O?(te=[i,O],t[19]=i,t[20]=O,t[21]=te):te=t[21],(0,Z.useEffect)(G,te);let ne=L.data?.agents,K=new Set(s.map(Do)),q;t[22]===u?.installedClis?q=t[23]:(q=u?.installedClis??{},t[22]=u?.installedClis,t[23]=q);let J=q,re=x===null?[]:Pa(x),ie=re.find(e=>e.id===A)??null,ae=re.find(e=>e.id===M)??null,oe;t[24]===i?oe=t[25]:(oe=async function(e){let t=await i(e);return F.current+=1,t.snapshot!==null&&S(t.snapshot),T(!fo(t.snapshot)),t.unavailable===!0&&D(!0),t},t[24]=i,t[25]=oe);let se=oe,ce;t[26]===x?ce=t[27]:(ce=function(e,t){return t===!1?`absent`:t===!0?`present`:e===void 0?`unknown`:Ta(e,x,t)},t[26]=x,t[27]=ce);let le=ce,ue;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(ue=new Set(Yt.map($e).filter(Eo)),t[28]=ue):ue=t[28];let de=ue,fe;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(fe=new Set(vt.map(To).filter(wo)),t[29]=fe):fe=t[29];let pe=fe,me;t[30]!==J||t[31]!==le||t[32]!==c?(me=function(e,t){if(t===`terminal`){let t=Ft[e].external?.targetId;return t===void 0?`unknown`:le(e,c[t]?.installed??null)}let n=Yt.find(t=>$e(t)===e);return n===void 0?`unknown`:le(e,J[n]??null)},t[30]=J,t[31]=le,t[32]=c,t[33]=me):me=t[33];let he=me,ge=function(e,t,n,r,i,a,o,s){let c=e===void 0?void 0:re.find(t=>t.id===e);if(c===void 0||e===void 0||x===null||!fo(x))return{status:void 0,action:void 0,hintAction:void 0,residualFiles:!1,statusId:void 0};let l={enabled:i,installedCount:Aa(wa(c)),presence:o,configurable:xa(c),setupDocSlug:c.row.setupDocSlug,installUrl:s===void 0?Ft[e].external?.installUrl??null:s},u=eo(l),d=Sa(e)&&he(e,r)!==`absent`,f=to(l)&&!d,p=Na({agentId:e,mode:r,snapshot:x,detected:a}),m=p===`connected`||p===`not-connected`&&i,h=m?`${n}-status`:void 0,g=!E||u.kind===`install`||u.kind===`setup-doc`,_=c.cells.projectMcp,v=_===void 0||!Sa(e)||ja(_.consentClass)===r?$a(Oa({agentId:e,mode:r,snapshot:x,detected:a,projectMcp:_})):null;return{status:m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(so,{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)(co,{action:u,rowLabel:t,describedById:h,onConfigure:()=>j(e),onRemove:()=>N(e)}):void 0,hintAction:f&&!E?(0,$.jsx)(lo,{rowLabel:t,onRemove:()=>N(e)}):void 0,residualFiles:f,statusId:h}},_e;t[34]===a?_e=t[35]:(_e=function(e,t){return a(e===`not-installed`?t?{id:`06Ucfz`}:{id:`5SwVv1`}:t?{id:`V0Jk_K`}:{id:`EDD3UL`})},t[34]=a,t[35]=_e);let ve=_e,ye=function(e,t,n,r,i){if(We(e,r),!r||E||t===void 0||x===null)return;let a=re.find(e=>e.id===t);a===void 0||!xa(a)||Na({agentId:t,mode:n,snapshot:x,detected:i})===`not-connected`&&(P.current=e,j(t))},be;t[36]!==ne||t[37]!==o||t[38]!==s?(be=function(){ne!==void 0&&B(go(ne,o,s))},t[36]=ne,t[37]=o,t[38]=s,t[39]=be):be=t[39];let xe=be,Se;t[40]!==d||t[41]!==xe?(Se=function(e){d.trim()!==``&&e.trim()===``&&xe(),f(e)},t[40]=d,t[41]=xe,t[42]=Se):Se=t[42];let Ce=Se,we;t[43]!==xe||t[44]!==p?(we=function(){p&&xe(),m(!p)},t[43]=xe,t[44]=p,t[45]=we):we=t[45];let Te=we,Ee=d.trim().toLowerCase(),De=e=>Ee===``||e.toLowerCase().includes(Ee),Oe=(ne??[]).filter(e=>De(e.name)),ke;t[46]===J?ke=t[47]:(ke=e=>J[e]!==!1,t[46]=J,t[47]=ke);let Ae=ke,je;t[48]===Ae?je=t[49]:(je=(e,t)=>Number(Ae(t))-Number(Ae(e))||Xe[e].displayName.localeCompare(Xe[t].displayName),t[48]=Ae,t[49]=je);let Me=Yt.filter(e=>{let{displayName:t}=Xe[e];return De(t)||De(a({id:`QYfQdv`,values:{displayName:t}}))||De(e)}).sort(je),Ne;t[50]!==le||t[51]!==c?(Ne=e=>le(nt(e),c[e]?.installed??null),t[50]=le,t[51]=c,t[52]=Ne):Ne=t[52];let Ke=Ne,qe;t[53]===Ke?qe=t[54]:(qe=(e,t)=>Number(Ke(e.id)===`absent`)-Number(Ke(t.id)===`absent`),t[53]=Ke,t[54]=qe);let Ye=vt.filter(e=>{let{displayName:t}=e;return De(a({id:`CZBqrX`,values:{displayName:t}}))||De(e.id)}).sort(qe),Ze=u!==null,Qe;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=new Set([...de,...pe]),t[55]=Qe):Qe=t[55];let et=Qe,tt=Tt.filter(e=>!et.has(e)&&De(Ea(e))),rt=Ee!==``,it=!L.isLoading&&!L.isError,at=rt&&it&&Oe.length===0&&Me.length===0&&Ye.length===0&&tt.length===0,Y=!rt||L.isLoading||L.isError||Oe.length>0,ot=!rt||Me.length>0,st=!rt||Ye.length>0||tt.length>0,ct=e=>mo(o,K,e),lt=e=>V.primaryKeys.has(po(e)),ut=e=>V.ranks.get(po(e))??2**53-1,dt=Oe.filter(lt),ft=[...rt||p?Oe:dt].sort((e,t)=>ut(e)-ut(t)||e.name.localeCompare(t.name)),pt=rt?0:Oe.length-dt.length,mt=Me.filter(Ae),ht=mt.length>0&&mt.length<Me.length,gt=!ht||rt||_?Me:mt,_t=ht&&!rt?Me.length-mt.length:0,yt;t[56]===Ke?yt=t[57]:(yt=e=>Ke(e.id)!==`absent`,t[56]=Ke,t[57]=yt);let bt=Ye.filter(yt),xt=tt.filter(e=>le(e,re.find(t=>t.id===e)?.row.detected??null)!==`absent`),St=bt.length+xt.length,Ct=Ye.length+tt.length,wt=St>0&&St<Ct,Et=!wt||rt||y,Dt=Et?Ye:bt,Ot=Et?tt:xt,kt=wt&&!rt?Ct-St:0,At=!it||Oe.some(Je),jt=Ze&&Me.some(Ae),Mt;t[58]===c?Mt=t[59]:(Mt=e=>c[e.id]?.installed===!0,t[58]=c,t[59]=Mt);let Nt=Ye.some(Mt),Pt=Y?(0,$.jsx)(io,{label:a({id:`RXEbZy`}),labelId:`settings-configure-agents-in-app`,children:L.isLoading?(0,$.jsxs)(`div`,{className:`flex items-center justify-center gap-2 px-3 py-6 text-muted-foreground text-sm`,children:[(0,$.jsx)(Ir,{className:`size-4`,"aria-hidden":`true`}),a({id:`ucXZ0k`})]}):L.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)(za,{className:`size-5`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{children:a({id:`FqGWeR`})}),(0,$.jsx)(w,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void L.refetch(),children:a({id:`6gRgw8`})})]}):(ne?.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=po(e),n=ct(e),r=e.supported?e.description:a({id:`5jEnaB`});return(0,$.jsx)(no,{icon:(0,$.jsx)(Ue,{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?(Re({source:e.source,id:e.id,name:e.name,supported:e.supported,featured:e.featured,...e.iconUrl===void 0?{}:{iconUrl:e.iconUrl}},{makeDefault:!1}),We(Ve(e.source,e.id),!0)):(We(Ve(e.source,e.id),!1),ze(t,e=>Pe(o,e.source,e.id,!0,e.supported)))}},t)}),(0,$.jsx)(oo,{hiddenCount:pt,expanded:p,onToggle:Te,testId:`configure-agents-in-app-show-more`})]})},`in-app`):null,It=ot?(0,$.jsxs)(io,{label:a({id:`ALhMYW`}),labelId:`settings-configure-agents-terminal`,children:[gt.map(e=>{let{displayName:t}=Xe[e],n=J[e]??null,r=le($e(e),n),i=He(o,e,r===`absent`),s=`configure-agents-terminal-row-${e}`,{status:c,action:l,hintAction:u,residualFiles:d,statusId:f}=ge($e(e),a({id:`QYfQdv`,values:{displayName:t}}),s,`terminal`,i,n,r,uo($e(e))??Xe[e].docsUrl);return(0,$.jsx)(no,{icon:(0,$.jsx)(yn,{id:Ni(e),className:`size-4`,"aria-hidden":`true`}),name:a({id:`QYfQdv`,values:{displayName:t}}),hint:r===`absent`?{text:ve(`not-installed`,d),action:u}:void 0,status:c,action:l,checked:i,disabled:ro(r,i),ariaLabel:a({id:`27TLNq`,values:{displayName:t}}),testId:`configure-agents-terminal-${e}`,rowTestId:s,statusId:f,onToggle:Ze?t=>ye(Ie(e),$e(e),`terminal`,t,J[e]??null):void 0},e)}),(0,$.jsx)(oo,{hiddenCount:_t,expanded:_,onToggle:()=>v(Co),testId:`configure-agents-terminal-show-more`})]},`terminal`):null,Lt=st?(0,$.jsxs)(io,{label:a({id:`BwKH4d`}),labelId:`settings-configure-agents-desktop`,labelIcon:(0,$.jsx)(jn,{"aria-hidden":`true`,className:`size-3`}),children:[Dt.map(e=>{let t=c[e.id]?.installed??null,{displayName:n}=e,r=Be(o,e.id,t),i=le(nt(e.id),t),s=`configure-agents-desktop-row-${e.id}`,{status:l,action:u,hintAction:d,residualFiles:f,statusId:p}=ge(nt(e.id),a({id:`CZBqrX`,values:{displayName:n}}),s,`external`,r,t,i);return(0,$.jsx)(no,{icon:(0,$.jsx)(yn,{id:e.id,className:`size-4`,"aria-hidden":`true`}),name:a({id:`CZBqrX`,values:{displayName:n}}),hint:i===`absent`?{text:ve(`not-installed`,f),action:d}:void 0,status:l,action:u,checked:r,disabled:ro(i,r),ariaLabel:a({id:`cdBape`,values:{displayName:n}}),testId:`configure-agents-desktop-${e.id}`,rowTestId:s,statusId:p,onToggle:n=>ye(Fe(e.id),nt(e.id),`external`,n,t)},e.id)}),Ot.map(e=>{let t=re.find(t=>t.id===e)??null,n=t?.row.detected??null,r=Ea(e),i=le(e,n),a=`agent-connection-${e}`,o=ge(e,r,a,`external`,t===null||!ba(t),n,i);return(0,$.jsx)(no,{icon:(0,$.jsx)(ka,{agentId:e,className:`size-4 text-muted-foreground`}),name:r,hint:i===`absent`?{text:ve(`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)(oo,{hiddenCount:kt,expanded:y,onToggle:()=>b(So),testId:`configure-agents-desktop-show-more`})]},`desktop`):null,Rt=[{node:Pt,hasPresent:At},{node:It,hasPresent:jt},{node:Lt,hasPresent:Nt}].sort(xo).map(bo),zt;t[60]===a?zt=t[61]:(zt=a({id:`lBN3T6`}),t[60]=a,t[61]=zt);let Bt;t[62]===a?Bt=t[63]:(Bt=a({id:`D4I0F9`}),t[62]=a,t[63]=Bt);let Vt;t[64]!==zt||t[65]!==Bt?(Vt=(0,$.jsx)(Ha,{titleId:`settings-configure-agents-title`,title:zt,children:Bt}),t[64]=zt,t[65]=Bt,t[66]=Vt):Vt=t[66];let Ht;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(Ht=(0,$.jsx)(mn,{className:`-translate-y-1/2 absolute top-1/2 start-2.5 size-4 text-muted-foreground`,"aria-hidden":`true`}),t[67]=Ht):Ht=t[67];let Ut;t[68]===Ce?Ut=t[69]:(Ut=e=>Ce(e.target.value),t[68]=Ce,t[69]=Ut);let Wt;t[70]===a?Wt=t[71]:(Wt=a({id:`-7s4fw`}),t[70]=a,t[71]=Wt);let Gt;t[72]===a?Gt=t[73]:(Gt=a({id:`-7s4fw`}),t[72]=a,t[73]=Gt);let Kt;t[74]!==d||t[75]!==Ut||t[76]!==Wt||t[77]!==Gt?(Kt=(0,$.jsxs)(`div`,{className:`relative`,children:[Ht,(0,$.jsx)(ai,{value:d,onChange:Ut,placeholder:Wt,"aria-label":Gt,className:`ps-8`,"data-testid":`configure-agents-search`})]}),t[74]=d,t[75]=Ut,t[76]=Wt,t[77]=Gt,t[78]=Kt):Kt=t[78];let qt;t[79]!==a||t[80]!==E?(qt=E?(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)(Wr,{"aria-hidden":!0,className:`size-4 shrink-0`}),(0,$.jsx)(`span`,{children:a({id:`RD8cCw`})})]}):null,t[79]=a,t[80]=E,t[81]=qt):qt=t[81];let Jt;t[82]!==a||t[83]!==C?(Jt=C?(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)(za,{"aria-hidden":!0,className:`size-4 shrink-0`}),(0,$.jsx)(`span`,{role:`status`,children:a({id:`4sE6E9`})})]}),(0,$.jsx)(w,{type:`button`,variant:`outline`,size:`sm`,className:`shrink-0`,onClick:()=>k(yo),children:a({id:`6gRgw8`})})]}):null,t[82]=a,t[83]=C,t[84]=Jt):Jt=t[84];let Xt;t[85]!==a||t[86]!==at?(Xt=at?(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[85]=a,t[86]=at,t[87]=Xt):Xt=t[87];let Zt=`configure:${A??`closed`}`,Qt;t[88]===A?Qt=t[89]:(Qt=A!==null&&Sa(A),t[88]=A,t[89]=Qt);let $t=ie!==null,en;t[90]===P?en=t[91]:(en=e=>{e||(P.current!==null&&(We(P.current,!1),P.current=null),j(null))},t[90]=P,t[91]=en);let X;t[92]!==se||t[93]!==ie||t[94]!==P?(X=(e,t)=>ie===null?Promise.resolve({ok:!1,report:{actions:[],conflicts:[],withheld:[]},snapshot:null}):se(Da(ie,e,t)).then(e=>(e.ok&&(P.current=null),e)),t[92]=se,t[93]=ie,t[94]=P,t[95]=X):X=t[95];let tn;t[96]!==ie||t[97]!==Zt||t[98]!==Qt||t[99]!==$t||t[100]!==en||t[101]!==X?(tn=(0,$.jsx)(ya,{connection:ie,paired:Qt,open:$t,onOpenChange:en,onSave:X},Zt),t[96]=ie,t[97]=Zt,t[98]=Qt,t[99]=$t,t[100]=en,t[101]=X,t[102]=tn):tn=t[102];let nn=`remove:${M??`closed`}`,rn;t[103]===M?rn=t[104]:(rn=M!==null&&Sa(M),t[103]=M,t[104]=rn);let an=ae!==null,on;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(on=e=>{e||N(null)},t[105]=on):on=t[105];let sn;t[106]!==se||t[107]!==ae?(sn=e=>ae===null?Promise.resolve({ok:!1,report:{actions:[],conflicts:[],withheld:[]},snapshot:null}):se(Ca(ae,e===void 0?[]:e)),t[106]=se,t[107]=ae,t[108]=sn):sn=t[108];let cn;t[109]!==ae||t[110]!==nn||t[111]!==rn||t[112]!==an||t[113]!==sn?(cn=(0,$.jsx)(Ma,{connection:ae,paired:rn,open:an,onOpenChange:on,onRemove:sn},nn),t[109]=ae,t[110]=nn,t[111]=rn,t[112]=an,t[113]=sn,t[114]=cn):cn=t[114];let ln;return t[115]!==Rt||t[116]!==Vt||t[117]!==Kt||t[118]!==qt||t[119]!==Jt||t[120]!==Xt||t[121]!==tn||t[122]!==cn?(ln=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-configure-agents-title`,className:`space-y-6`,"data-field":`section:agent-connections`,"data-testid":`settings-configure-agents`,children:[Vt,Kt,qt,Jt,Xt,Rt,tn,cn]}),t[115]=Rt,t[116]=Vt,t[117]=Kt,t[118]=qt,t[119]=Jt,t[120]=Xt,t[121]=tn,t[122]=cn,t[123]=ln):ln=t[123],ln}function yo(e){return e+1}function bo(e){return e.node}function xo(e,t){return Number(t.hasPresent)-Number(e.hasPresent)}function So(e){return!e}function Co(e){return!e}function wo(e){return e!==void 0}function To(e){return nt(e.id)}function Eo(e){return e!==void 0}function Do(e){return po(e)}function Oo(e){let{signal:t}=e;return qe(t)}var ko=`open-knowledge-app`;function Ao({from:e,to:t}){try{en.getTracer(ko).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 jo=`open-knowledge-app`;function Mo(e){let t=e.light.startsWith(`saved-`),n=e.dark.startsWith(`saved-`);return!t||!n?`incomplete`:e.light===e.dark?`same`:`different`}function No(e){try{en.getTracer(jo).startSpan(`ok.saved_themes.assignment`,{attributes:{"saved_theme.pair":Mo(e)}}).end()}catch(e){console.warn(`[saved-theme-telemetry] assignment span emit failed:`,e instanceof Error?e:String(e))}}var Po=`system`;function Fo(e){return typeof e==`string`&&Ct.includes(e)}function Io(e){return Fo(e)?e:Po}function Lo(e){return new Intl.DisplayNames([e],{type:`language`}).of(e)??e}function Ro(e){let t=(0,Q.c)(6),{choice:n}=e;if(n===Po){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=Lo(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 zo(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=Io(o),t[6]=o,t[7]=s);let c=s,l;t[8]===r?l=t[9]:(l=e=>r(Io(e)),t[8]=r,t[9]=l);let u;t[10]===c?u=t[11]:(u=(0,$.jsx)(Ee,{children:(0,$.jsx)(Ro,{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)(Te,{...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)(we,{children:[(0,$.jsx)(Ce,{value:Po,children:(0,$.jsx)(Ro,{choice:Po})}),ut.map(Bo)]}),t[17]=f):f=t[17];let p;return t[18]!==c||t[19]!==l||t[20]!==d?(p=(0,$.jsxs)(De,{value:c,onValueChange:l,children:[d,f]}),t[18]=c,t[19]=l,t[20]=d,t[21]=p):p=t[21],p}function Bo(e){return(0,$.jsx)(Ce,{value:e,children:(0,$.jsx)(Ro,{choice:e})},e)}function Vo(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 Ho(e,t,n){return e.id===`custom`?Vo(Mt(yi(t))):e.scheme?Vo(Mt(e.scheme)):Vo(pi(n))}function Uo(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=Ho(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(Wo),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 Wo(e,t){return(0,$.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{backgroundColor:e}},t)}function Go(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 Ko(e){return b(`size-3.5`,e&&`fill-current`)}function qo(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?wt: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)(w,{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)(Uo,{theme:e,customSeed:u,slotMode:y})}),l?(0,$.jsx)(w,{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)(Ur,{"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)(Me,{className:Go(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)(hn,{className:`size-3.5`})}):null,(0,$.jsx)(Me,{id:t===0?d:void 0,className:Go(r),pressed:r,onPressedChange:t=>{t&&a(`light`,e.id)},"aria-label":x({id:`sq4WQH`,values:{0:e.label}}),children:(0,$.jsx)(Lr,{className:Ko(r)})}),(0,$.jsx)(Me,{className:Go(i),pressed:i,onPressedChange:t=>{t&&a(`dark`,e.id)},"aria-label":x({id:`lZvQrY`,values:{0:e.label}}),children:(0,$.jsx)(Rr,{className:Ko(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)(w,{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)(pn,{"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 T;t[24]===v?T=t[25]:(T=v.map(Jo),t[24]=v,t[25]=T);let E;return t[26]!==p||t[27]!==m||t[28]!==f||t[29]!==S||t[30]!==C||t[31]!==T?(E=(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,T]}),t[26]=p,t[27]=m,t[28]=f,t[29]=S,t[30]=C,t[31]=T,t[32]=E):E=t[32],E}function Jo(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)(In,{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 Yo=12e3;function Xo(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}=Jr(),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(``),[x,S]=(0,Z.useState)(null),[C,T]=(0,Z.useState)(!1),E=(0,Z.useRef)(null),D,O;t[4]===u?(D=t[5],O=t[6]):(D=()=>{u()},O=[u],t[4]=u,t[5]=D,t[6]=O),(0,Z.useEffect)(D,O);let k;t[7]!==n||t[8]!==o?(k=Xt(n,o),t[7]=n,t[8]=o,t[9]=k):k=t[9];let A=k,j,M,N,P,F,I,L,R,z,B,V,H,ee,U,W,G,te,ne,K,q,J;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]!==A||t[24]!==m||t[25]!==o||t[26]!==c||t[27]!==s){let e=It(y),n;t[49]===o?n=t[50]:(n=o.filter(ts),t[49]=o,t[50]=n);let h=n,D,O,k,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]!==A||t[64]!==m||t[65]!==o||t[66]!==c||t[67]!==s){let e=o.flatMap(es),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;k=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:Yo,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]!==A||t[93]!==o?(x=async function(e){if(e.preventDefault(),C)return;let t=It(y);if(!t.ok){S(a({id:`RG3yW6`})),E.current?.focus();return}let n=i.slotMode??`light`,s=o.find(e=>e.id===A[n])?.scheme??yi(i.customSeed),c={name:t.name,variant:s.variant,palette:{...s.palette}};S(null),T(!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`})),T(!1),E.current?.focus();return}let d={id:l.id,label:c.name,kind:c.variant,scheme:c,toTokens:()=>Mt(c)};r(n,l.id,A,[...o,d]),await u(),b(``),v(!1),T(!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]=A,t[93]=o,t[94]=x):x=t[94],O=x;let j;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),j=s.map(e),t[95]=a,t[96]=s,t[97]=j}else j=t[97];let M=j;H=`flex w-full min-w-0 flex-col gap-2`,t[100]!==a||t[101]!==l||t[102]!==u?(ee=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)(w,{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]=ee):ee=t[103];let N;t[104]!==a||t[105]!==c?(N=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)(Wr,{"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]=N):N=t[106],t[107]===N?U=t[108]:(U=(0,$.jsx)(`div`,{role:`status`,children:N}),t[107]=N,t[108]=U),D=qo,ie=i,ae=A,oe=h,se=M;let P;t[109]===o?P=t[110]:(P=o.filter($o).map(Qo),t[109]=o,t[110]=P);let F=m?p:null;t[111]!==g||t[112]!==P||t[113]!==F?(ce={themeIds:P,selectedId:F,onSelect:g},t[111]=g,t[112]=P,t[113]=F,t[114]=ce):ce=t[114],re=e.map(Zo),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]=A,t[64]=m,t[65]=o,t[66]=c,t[67]=s,t[68]=D,t[69]=O,t[70]=k,t[71]=H,t[72]=ee,t[73]=U,t[74]=re,t[75]=ie,t[76]=ae,t[77]=oe,t[78]=se,t[79]=ce}else D=t[68],O=t[69],k=t[70],H=t[71],ee=t[72],U=t[73],re=t[74],ie=t[75],ae=t[76],oe=t[77],se=t[78],ce=t[79];let le;t[115]!==k||t[116]!==re?(le={themeIds:re,onDelete:k},t[115]=k,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]!==A||t[121]!==o?(de=(e,t)=>r(e,t,A,o),t[119]=r,t[120]=A,t[121]=o,t[122]=de):de=t[122],t[123]!==D||t[124]!==ie||t[125]!==ae||t[126]!==oe||t[127]!==se||t[128]!==ce||t[129]!==le||t[130]!==de?(W=(0,$.jsx)(D,{...ie,selection:ae,themes:oe,unavailableThemes:se,editControl:ce,deleteControl:le,createControl:ue,onAssign:de}),t[123]=D,t[124]=ie,t[125]=ae,t[126]=oe,t[127]=se,t[128]=ce,t[129]=le,t[130]=de,t[131]=W):W=t[131],F=ri,B=_,t[132]===C?V=t[133]:(V=e=>{C||v(e)},t[132]=C,t[133]=V),P=Qr;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)(Zr,{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)(Xr,{children:me}),t[140]=me,t[141]=he),t[142]!==pe||t[143]!==he?(z=(0,$.jsxs)(ni,{className:`gap-2`,children:[pe,he]}),t[142]=pe,t[143]=he,t[144]=z):z=t[144],N=$r,I=`create-saved-theme-form`,L=!0,R=O,M=Di,K=x!==null;let ge;t[145]===a?ge=t[146]:(ge=a({id:`HZ7fEu`}),t[145]=a,t[146]=ge),t[147]===ge?q=t[148]:(q=(0,$.jsx)(Ti,{htmlFor:`create-saved-theme-name`,children:ge}),t[147]=ge,t[148]=q);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?(J=(0,$.jsx)(ai,{ref:E,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]=J):J=t[156],j=Ei,G=`create-saved-theme-help`,te=`font-mono`,ne=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]=A,t[24]=m,t[25]=o,t[26]=c,t[27]=s,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]=H,t[40]=ee,t[41]=U,t[42]=W,t[43]=G,t[44]=te,t[45]=ne,t[46]=K,t[47]=q,t[48]=J}else j=t[28],M=t[29],N=t[30],P=t[31],F=t[32],I=t[33],L=t[34],R=t[35],z=t[36],B=t[37],V=t[38],H=t[39],ee=t[40],U=t[41],W=t[42],G=t[43],te=t[44],ne=t[45],K=t[46],q=t[47],J=t[48];let re;t[157]!==j||t[158]!==G||t[159]!==te||t[160]!==ne?(re=(0,$.jsx)(j,{id:G,className:te,children:ne}),t[157]=j,t[158]=G,t[159]=te,t[160]=ne,t[161]=re):re=t[161];let ie;t[162]===x?ie=t[163]:(ie=x?(0,$.jsx)(wi,{id:`create-saved-theme-error`,children:x}):null,t[162]=x,t[163]=ie);let ae;t[164]!==M||t[165]!==re||t[166]!==ie||t[167]!==K||t[168]!==q||t[169]!==J?(ae=(0,$.jsxs)(M,{"data-invalid":K,children:[q,J,re,ie]}),t[164]=M,t[165]=re,t[166]=ie,t[167]=K,t[168]=q,t[169]=J,t[170]=ae):ae=t[170];let oe;t[171]!==I||t[172]!==L||t[173]!==R||t[174]!==ae?(oe=(0,$.jsx)(`form`,{id:I,noValidate:L,onSubmit:R,children:ae}),t[171]=I,t[172]=L,t[173]=R,t[174]=ae,t[175]=oe):oe=t[175];let se;t[176]!==N||t[177]!==oe?(se=(0,$.jsx)(N,{children:oe}),t[176]=N,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)(w,{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)(w,{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)(ei,{children:[ue,fe]}),t[191]=ue,t[192]=fe,t[193]=pe):pe=t[193];let me;t[194]!==P||t[195]!==z||t[196]!==se||t[197]!==pe?(me=(0,$.jsxs)(P,{children:[z,se,pe]}),t[194]=P,t[195]=z,t[196]=se,t[197]=pe,t[198]=me):me=t[198];let he;t[199]!==F||t[200]!==B||t[201]!==V||t[202]!==me?(he=(0,$.jsx)(F,{open:B,onOpenChange:V,children:me}),t[199]=F,t[200]=B,t[201]=V,t[202]=me,t[203]=he):he=t[203];let ge;return t[204]!==H||t[205]!==ee||t[206]!==U||t[207]!==W||t[208]!==he?(ge=(0,$.jsxs)(`div`,{className:H,children:[ee,U,W,he]}),t[204]=H,t[205]=ee,t[206]=U,t[207]=W,t[208]=he,t[209]=ge):ge=t[209],ge}function Zo(e){return e.id}function Qo(e){return e.id}function $o(e){return e.id.startsWith(`saved-`)}function es(e){let t=kt(e.id);return!t.ok||!e.scheme?[]:[{id:e.id,stem:t.stem,label:e.label,scheme:e.scheme}]}function ts(e){return e.id!==`custom`}function ns(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)]:ns(r,t)}}function rs(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 is(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 as(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 os(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=ra(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=ns(ds(n),r),a=t.patch(i);if(a.ok)return e.clearErrors(n),e.resetField(n,{defaultValue:r,keepError:!1}),!0;if(jt(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:ls(a.error,n)});return!1}function ls(e,t){if(jt(e)&&e.code===`SCHEMA_INVALID`){let n=e.issues.find(e=>us(e,t));if(n)return n.message}return Bt(e)}function us(e,t){return e.path.map(String).join(`.`)===t}function ds(e){return e.split(`.`)}function fs(e){if(!jt(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 ps(){let e=(0,Q.c)(3),t,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Fi,{className:`h-5 w-32`}),n=(0,$.jsx)(Fi,{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)(Fi,{className:`h-9 w-full`}),(0,$.jsx)(Fi,{className:`h-9 w-full`})]})]}),e[2]=r):r=e[2],r}function ms({field:e,scope:t,commitField:n,isFlashed:r}){"use no memo";let{_:i}=h(),a=sa(),{setTheme:o}=_(),s=gn(),c=yt(mt,e.path),l=c?is(c):void 0,u=c?rs(c):void 0,d=c?as(c):void 0,f=c?Dt(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)},D=()=>{let e=n(g);return e&&C(),e},k=()=>a.getFieldState(g).isDirty?D():!0,A=()=>{if(e.control===`theme-tiles`){let e=s?.userBinding;if(!e)return;let t=e.patch({appearance:fi()});t.ok?C():a.setError(g,{type:`manual`,message:ls(t.error,g)});return}let t=u===void 0?null:u;a.setValue(g,t,{shouldDirty:!1}),e.control===`theme-cards`&&o(vn(t)),D()},j=b(`relative`,r&&`animate-settings-flash`);return(0,$.jsx)(ia,{control:a.control,name:g,render:({field:n})=>{let r=!p&&(u!==void 0||n.value!==void 0);return(0,$.jsxs)(na,{className:j,"data-field":e.path.join(`.`),"data-scope":t,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(oa,{className:`text-sm font-medium`,children:v}),r?(0,$.jsxs)(O,{children:[(0,$.jsx)(T,{asChild:!0,children:(0,$.jsx)(w,{variant:`ghost`,size:`icon`,className:`h-5 w-5 text-muted-foreground opacity-60 hover:opacity-100`,onClick:A,"aria-label":i({id:`lhjq3G`,values:{labelText:v}}),children:(0,$.jsx)(Br,{className:`size-3.5`})})}),(0,$.jsx)(E,{children:(0,$.jsx)(m,{id:`L-rMC9`})})]}):null]}),e.description?(0,$.jsx)(ca,{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)(gs,{field:e,ctl:n,typeTag:l,enumOptions:d,onCommit:k,onRevertToBaseline:()=>a.resetField(g,{keepError:!0}),onSavedOutsideForm:C,onWriteRejected:e=>{a.setError(g,{type:`manual`,message:ls(e,g)})}})}),(0,$.jsx)(bs,{visible:y,srOnly:hs(e.control)})]}),(0,$.jsx)(la,{"data-field-error":e.path.join(`.`)})]})}})}function hs(e){return e===`theme-tiles`||e===`theme-cards`}function gs({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=gn(),p=f?.merged??null;if(e.control===`language-select`)return(0,$.jsx)(zo,{...c,value:t.value,ref:t.ref,onBlur:t.onBlur,onValueChange:e=>{let n=bi(t.value)??`system`;n!==e&&Ao({from:n,to:e}),t.onChange(e),i()}});if(e.control===`theme-cards`){let{id:n,...r}=c;return(0,$.jsx)(zr,{...r,firstItemId:n,value:vn(t.value),"aria-label":l(e.label),onValueChange:e=>{let n=vn(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=et(i,d===`dark`);return(0,$.jsx)(Xo,{...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`?hi(yi(r)):di(t,c)};ui({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){No(d),o();return}ui({selection:n,modePreference:i,slotMode:a,customSeed:r,themes:c}),u(p(n)??i??`system`),s(m.error)}})}if(n===`boolean`)return(0,$.jsx)(Ae,{...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)(Ne,{...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)(je,{value:e,id:t===0?n:void 0,className:`text-1sm capitalize`,children:e},e))})}return n===`number`||n===`int`?(0,$.jsx)(vs,{ctl:t,onCommit:i,...c}):n===`array`?(0,$.jsx)(ys,{ctl:t,onCommit:i,...c}):(0,$.jsx)(_s,{ctl:t,onCommit:i,...c})}function _s({ctl:e,onCommit:t,...n}){"use no memo";return(0,$.jsx)(ai,{...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 vs({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)(ai,{...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 ys({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-HKX9wT1K.js";import{n as s}from"./dist-CJhtNlOm2.js";import{t as c}from"./desktop-bridge-types-oYPdTDmz.js";import{n as l,t as u}from"./git-branch-B_QTfwFA.js";import{t as d}from"./spinner-Bp2_BYkl.js";import{n as ee,t as te}from"./miss-dialog-store-CNJRdTPE.js";import{a as ne,c as re,i as ie,n as ae,o as f,s as oe,t as se}from"./dialog-Cv_pRVgB.js";import{r as p,t as m}from"./auth-prompt-store-BG1KGa5o.js";import{a as h,n as g}from"./receive-store-Djrqwgcm.js";import{t as ce}from"./share-metadata-rows-iQiWNrX5.js";var _=e(n(),1),le=a();function ue(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 de(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function v(e){if(e.ok)return{action:`await-cc1`};switch(e.reason){case`dirty-conflict`:return{action:`rerender-conflict`,files:e.files??[]};case`branch-not-found`:return{action:`dismiss-with-toast`,reason:`branch-not-found`};case`fetch-failed`:case`checkout-failed`:return{action:`stay-with-toast`,reason:e.reason};case`branch-in-other-worktree`:{let t=e.otherWorktreePath;return t===void 0||t.length===0?{action:`stay-with-toast`,reason:`checkout-failed`}:{action:`pivot-to-other-worktree`,otherWorktreePath:t}}case`ff-diverged`:return{action:`branch-diverged`};default:{let t=e.reason;throw Error(`Unhandled CheckoutFailureReason: ${String(t)}`)}}}var fe={phase:`loading`};function pe(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function me(e,t){return e.phase!==`ready`&&e.phase!==`verdict`?e:{phase:`switching`,info:e.info,pendingDoc:t}}function he(e){return e.phase===`ready`?{phase:`creating-worktree`,info:e.info}:e}function ge(e){return ue(e).kind===`B`&&e.shareTargetOnOriginBranch===!1}function _e(e){return e.phase===`ready`?{phase:`verdict-pending`,info:e.info}:e}function ve(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 ye(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=v(t);return n.action===`await-cc1`?{state:{phase:`awaiting-cc1-recycle`,pendingDoc:e.pendingDoc}}:n.action===`rerender-conflict`?{state:{phase:`ready`,info:{...e.info,dirtyConflicts:{conflicts:!0,files:n.files.slice()}}}}:n.action===`pivot-to-other-worktree`?{state:{phase:`branch-in-other-worktree`,info:e.info,otherWorktreePath:n.otherWorktreePath,pendingDoc:e.pendingDoc}}:n.action===`dismiss-with-toast`?{state:{phase:`dismissed`,reason:n.reason},sideEffect:{kind:`toast`,reason:n.reason}}:n.action===`branch-diverged`?{state:{phase:`verdict`,info:e.info,resolution:{kind:`diverged`}}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:n.reason}}}function be(e,t){return e.phase===`creating-worktree`?t===null?{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}}:t.ok?{state:{phase:`opening-worktree`,path:t.path}}:t.reason===`branch-not-found`?{state:{phase:`dismissed`,reason:`branch-not-found`},sideEffect:{kind:`toast`,reason:`branch-not-found`}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:t.reason,helper:t.helper,authFailed:t.reason===`fetch-failed`?t.authFailed:void 0,notFoundAsIdentity:t.reason===`fetch-failed`?t.notFoundAsIdentity:void 0}}:{state:e}}var y=t();function xe(e){return c(e.repositoryTarget)}function Se(e,t=c(e.target)){let n=e.contentRootDepth===null?t:[...xe(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 Ce(e){return e!==null&&e.kind===`project-branch-switch`}function b(e){let t=(0,le.c)(217),{bridge:n,store:a}=e,m=a===void 0?g:a,{_:v}=i(),b=(0,_.useSyncExternalStore)(m.subscribe,m.getSnapshot,je),[x,S]=(0,_.useState)(fe),Me=(0,_.useRef)(!1),Ne=(0,_.useRef)(!1),Pe=(0,_.useRef)(!1),Fe=(0,_.useRef)(null),Ie;t[0]===b?Ie=t[1]:(Ie=Ce(b)?b:null,t[0]=b,t[1]=Ie);let C=Ie,Le;t[2]!==v||t[3]!==C?.share.target.kind?(Le=C?.share.target.kind===`folder`?v({id:`ugoTXs`}):v({id:`XH30C4`}),t[2]=v,t[3]=C?.share.target.kind,t[4]=Le):Le=t[4];let w=Le,Re;t[5]===C?Re=t[6]:(Re=()=>{S(fe),Me.current=!1,Ne.current=!1,Pe.current=!1,Fe.current=C},t[5]=C,t[6]=Re);let ze;t[7]===b?ze=t[8]:(ze=[b],t[7]=b,t[8]=ze),(0,_.useEffect)(Re,ze);let Be;t[9]!==C||t[10]!==n?(Be=()=>{if(!C||Me.current)return;Me.current=!0;let e=!1;return n.project.fetchBranchInfo({projectPath:C.projectPath,branch:C.share.branch,kind:C.share.repositoryTarget.kind,path:xe(C.share)}).then(t=>{e||S(e=>pe(e,t))}).catch(t=>{e||(console.warn(`[receive] branch-info-fetch-failed`,t instanceof Error?t.message:t),S(Ae))}),()=>{e=!0}},t[9]=C,t[10]=n,t[11]=Be):Be=t[11];let Ve;t[12]===C?Ve=t[13]:(Ve=[C],t[12]=C,t[13]=Ve),(0,_.useEffect)(Be,Ve);let He;t[14]!==C||t[15]!==x.info||t[16]!==x.phase||t[17]!==n?(He=()=>{if(!C||x.phase!==`ready`||Pe.current||!ge(x.info))return;Pe.current=!0,S(_e);let e=C;n.project.fetchTargetStatus({projectPath:C.projectPath,branch:C.share.branch,kind:C.share.target.kind,path:xe(C.share),...C.share.contentRootDepth===null?{}:{contentRootDepth:C.share.contentRootDepth}}).then(t=>{Fe.current===e&&S(e=>ve(e,t))}).catch(t=>{Fe.current===e&&(console.warn(`[receive] target-status-fetch-failed`,t instanceof Error?t.message:t),S(ke))})},t[14]=C,t[15]=x.info,t[16]=x.phase,t[17]=n,t[18]=He):He=t[18];let Ue;t[19]!==C||t[20]!==x.phase?(Ue=[x.phase,C],t[19]=C,t[20]=x.phase,t[21]=Ue):Ue=t[21],(0,_.useEffect)(He,Ue);let We;t[22]!==C||t[23]!==x.phase||t[24]!==x.resolution||t[25]!==m?(We=()=>{if(x.phase!==`verdict`)return;let{kind:e}=x.resolution;e!==`deleted`&&e!==`never-on-branch`||C&&(te.arm({kind:C.share.target.kind,path:c(C.share.target),repositoryPath:xe(C.share),...C.share.contentRootDepth===null?{}:{contentRootDepth:C.share.contentRootDepth},branch:C.share.branch}),m.dismiss())},t[22]=C,t[23]=x.phase,t[24]=x.resolution,t[25]=m,t[26]=We):We=t[26];let Ge;t[27]!==C||t[28]!==x||t[29]!==m?(Ge=[x,C,m],t[27]=C,t[28]=x,t[29]=m,t[30]=Ge):Ge=t[30],(0,_.useEffect)(We,Ge);let Ke;t[31]!==x.phase||t[32]!==x.resolution?(Ke=()=>{x.phase===`verdict`&&console.log(h({verdict_cell:x.resolution.kind}))},t[31]=x.phase,t[32]=x.resolution,t[33]=Ke):Ke=t[33];let qe;t[34]===x?qe=t[35]:(qe=[x],t[34]=x,t[35]=qe),(0,_.useEffect)(Ke,qe);let Je;t[36]!==v||t[37]!==C||t[38]!==x.pendingDoc||t[39]!==x.phase||t[40]!==n||t[41]!==m||t[42]!==w?(Je=()=>{if(x.phase!==`awaiting-cc1-recycle`||!C)return;let e=C.share.branch,t=x.pendingDoc;if(!e){m.dismiss();return}if(Ne.current)return;Ne.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:Se(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(v({id:`gQV-9w`,values:{targetNoun:w}}))}),m.dismiss();return}console.log(h({branch_dialog_action:`branch-switch-timeout`,branch:e})),s.error(v({id:`LBwUR6`,values:{targetNoun:w}})),m.dismiss()}}).catch(e=>{r||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),s.error(v({id:`Jw6EC4`,values:{targetNoun:w}})),m.dismiss())}),()=>{r=!0}},t[36]=v,t[37]=C,t[38]=x.pendingDoc,t[39]=x.phase,t[40]=n,t[41]=m,t[42]=w,t[43]=Je):Je=t[43];let Ye;if(t[44]!==C||t[45]!==x.phase?(Ye=[x.phase,C],t[44]=C,t[45]=x.phase,t[46]=Ye):Ye=t[46],(0,_.useEffect)(Je,Ye),!C)return null;let{share:T,projectPath:E,currentBranch:Xe}=C,D=T.branch,Ze;t[47]!==v||t[48]!==n.project||t[49]!==E||t[50]!==D||t[51]!==m?(Ze=function(e,t,r){console.log(h({branch_dialog_action:`switch`,branch_action:`switch`,branch:D,verdict_cell:r})),S(t=>me(t,e)),n.project.runCheckout(t?{projectPath:E,branch:D,fastForward:!0}:{projectPath:E,branch:D}).then(e=>{let t=null,n=!1;S(r=>{let{state:i,sideEffect:a}=ye(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?s.error(v({id:`NJyQi_`,values:{shareBranch:D}})):t===`fetch-failed`?s.error(v({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&s.error(v({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(Oe),s.error(v({id:`c863eW`,values:{shareBranch:D}}))})},t[47]=v,t[48]=n.project,t[49]=E,t[50]=D,t[51]=m,t[52]=Ze):Ze=t[52];let O=Ze,Qe;t[53]!==x.info||t[54]!==x.phase||t[55]!==O||t[56]!==T.target?(Qe=function(){x.phase===`ready`&&ue(x.info).switchEnabled&&O(c(T.target),!1)},t[53]=x.info,t[54]=x.phase,t[55]=O,t[56]=T.target,t[57]=Qe):Qe=t[57];let $e=Qe,et;t[58]!==x.phase||t[59]!==x.resolution||t[60]!==O||t[61]!==T.target?(et=function(){x.phase===`verdict`&&O(c(T.target),!0,x.resolution.kind)},t[58]=x.phase,t[59]=x.resolution,t[60]=O,t[61]=T.target,t[62]=et):et=t[62];let tt=et,nt;t[63]!==x.phase||t[64]!==x.resolution||t[65]!==O?(nt=function(){x.phase===`verdict`&&x.resolution.kind===`renamed`&&O(x.resolution.renamedTo,!0,x.resolution.kind)},t[63]=x.phase,t[64]=x.resolution,t[65]=O,t[66]=nt):nt=t[66];let rt=nt,it;t[67]!==x.phase||t[68]!==x.resolution||t[69]!==O||t[70]!==T.target?(it=function(){x.phase===`verdict`&&O(c(T.target),!1,x.resolution.kind)},t[67]=x.phase,t[68]=x.resolution,t[69]=O,t[70]=T.target,t[71]=it):it=t[71];let at=it,ot;t[72]!==v||t[73]!==n.project||t[74]!==E||t[75]!==T||t[76]!==D||t[77]!==m||t[78]!==w?(ot=function(){console.log(h({branch_dialog_action:`open-current`,branch:D})),n.project.open({path:E,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Se(T)}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),s.error(v({id:`b5aNbi`,values:{targetNoun:w}}))}),m.dismiss()},t[72]=v,t[73]=n.project,t[74]=E,t[75]=T,t[76]=D,t[77]=m,t[78]=w,t[79]=ot):ot=t[79];let st=ot,ct;t[80]!==v||t[81]!==D?(ct=function(e,t){let{helper:n,authFailed:r,notFoundAsIdentity:i}=t===void 0?{}:t;if(e===`fetch-failed`&&i){s.error(v({id:`jRsjlF`}));return}if(e===`fetch-failed`&&r){s.error(v({id:`gfb-CM`}),{action:{label:v({id:`5lWFkC`}),onClick:De}});return}switch(e){case`helper-not-found`:{let e=n??v({id:`cHhH3i`});s.error(v({id:`Z7x_Zh`,values:{tool:e}}));return}case`branch-not-found`:s.error(v({id:`NJyQi_`,values:{shareBranch:D}}));return;case`fetch-failed`:s.error(v({id:`bWLmRK`}));return;case`already-checked-out`:s.error(v({id:`ljHjfg`}));return;case`branch-exists`:s.error(v({id:`h3QZcB`,values:{shareBranch:D}}));return;case`path-exists`:s.error(v({id:`cN1Gcp`,values:{shareBranch:D}}));return;case`no-git`:s.error(v({id:`CFnavk`}));return;case`empty-repo`:s.error(v({id:`5IgYAM`}));return;case`invalid-branch`:s.error(v({id:`JfPuv7`,values:{shareBranch:D}}));return;case`proxy-null`:case`error`:s.error(v({id:`e8zYa8`,values:{shareBranch:D}}));return;default:throw Error(`Unhandled worktree failure reason: ${String(e)}`)}},t[80]=v,t[81]=D,t[82]=ct):ct=t[82];let lt=ct,ut;t[83]!==v||t[84]!==n.project||t[85]!==T||t[86]!==D||t[87]!==lt||t[88]!==m?(ut=function(e){let t=null,r,i,a,o=!1,c=null;if(S(n=>{let{state:s,sideEffect:l}=be(n,e);return l&&(t=l.reason,r=l.helper,i=l.authFailed,a=l.notFoundAsIdentity,o=s.phase===`dismissed`),s.phase===`opening-worktree`&&(c=s.path),s}),t!==null&&(console.log(h({branch_dialog_action:`open-worktree-failed:${t}`,branch:D})),lt(t,{helper:r,authFailed:i,notFoundAsIdentity:a})),c!==null){p();let e=c;n.project.open({path:e,target:`new-window`,entryPoint:`worktree`,pendingDeepLinkTarget:Se(T),pendingBranch:D}).catch(t=>{console.warn(`[receive] worktree-open-failed branch_dialog_action=open-worktree`,t instanceof Error?t.message:t),s.error(v({id:`LdABLa`,values:{target:e}}))}),m.dismiss()}o&&m.dismiss()},t[83]=v,t[84]=n.project,t[85]=T,t[86]=D,t[87]=lt,t[88]=m,t[89]=ut):ut=t[89];let dt=ut,ft;t[90]!==dt||t[91]!==x.phase||t[92]!==n.worktree||t[93]!==D?(ft=function(){x.phase===`ready`&&(console.log(h({branch_dialog_action:`open-worktree`,branch:D})),S(he),n.worktree.checkout({branch:D}).then(e=>{dt(e)}).catch(e=>{console.warn(`[receive] worktree-checkout rejected branch_dialog_action=open-worktree`,e instanceof Error?e.message:e),dt(null)}))},t[90]=dt,t[91]=x.phase,t[92]=n.worktree,t[93]=D,t[94]=ft):ft=t[94];let pt=ft,mt;t[95]!==v||t[96]!==x.otherWorktreePath||t[97]!==x.phase||t[98]!==n.project||t[99]!==T||t[100]!==D||t[101]!==m?(mt=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:Se(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(v({id:`LdABLa`,values:{target:e}}))}),m.dismiss()},t[95]=v,t[96]=x.otherWorktreePath,t[97]=x.phase,t[98]=n.project,t[99]=T,t[100]=D,t[101]=m,t[102]=mt):mt=t[102];let ht=mt,gt;t[103]!==x.phase||t[104]!==x.resolution||t[105]!==m?(gt=function(){console.log(h({branch_dialog_action:`cancel`,verdict_cell:x.phase===`verdict`?x.resolution.kind:void 0})),m.dismiss()},t[103]=x.phase,t[104]=x.resolution,t[105]=m,t[106]=gt):gt=t[106];let k=gt,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K,q,J;if(t[107]!==v||t[108]!==x.info||t[109]!==x.otherWorktreePath||t[110]!==x.phase||t[111]!==x.resolution||t[112]!==k||t[113]!==Xe||t[114]!==T.branch||t[115]!==T.owner||t[116]!==T.repo||t[117]!==T.target||t[118]!==D||t[119]!==w){q=x.phase===`ready`||x.phase===`switching`||x.phase===`creating-worktree`?ue(x.info):null;let e;t[139]!==x.info||t[140]!==x.phase||t[141]!==Xe?(e=x.phase===`ready`||x.phase===`switching`||x.phase===`creating-worktree`?de(x.info):Xe??`HEAD`,t[139]=x.info,t[140]=x.phase,t[141]=Xe,t[142]=e):e=t[142];let n=e;I=x.phase===`switching`||x.phase===`awaiting-cc1-recycle`,N=x.phase===`creating-worktree`;let i;t[143]===v?i=t[144]:(i=v({id:`OuY8t9`}),t[143]=v,t[144]=i),P=i;let a;t[145]===v?a=t[146]:(a=v({id:`XZkdtg`}),t[145]=v,t[146]=a),F=a;let o;t[147]===v?o=t[148]:(o=v({id:`VTulZj`}),t[147]=v,t[148]=o),J=o;let s=x.phase===`loading`,l=x.phase===`error`;M=se,G=!0,t[149]===k?K=t[150]:(K=e=>{e||k()},t[149]=k,t[150]=K),j=ie,B=`sm:max-w-xl`,V=`share-branch-switch-dialog`,H=Ee,U=Te;let u;t[151]===w?u=t[152]:(u=(0,y.jsx)(re,{children:(0,y.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:w}})}),t[151]=w,t[152]=u);let ee=T.owner,te=T.repo,f;t[153]===T.target?f=t[154]:(f=c(T.target),t[153]=T.target,t[154]=f);let p;t[155]!==T.owner||t[156]!==T.repo||t[157]!==f?(p=(0,y.jsx)(ne,{className:`sr-only`,children:(0,y.jsx)(r,{id:`f8jU-L`,values:{0:ee,1:te,2:f}})}),t[155]=T.owner,t[156]=T.repo,t[157]=f,t[158]=p):p=t[158],t[159]!==u||t[160]!==p?(W=(0,y.jsxs)(oe,{children:[u,p]}),t[159]=u,t[160]=p,t[161]=W):W=t[161],A=ae;let m=T.owner,h=T.repo,g;t[162]===T.target?g=t[163]:(g=c(T.target),t[162]=T.target,t[163]=g),t[164]!==T.branch||t[165]!==T.owner||t[166]!==T.repo||t[167]!==T.target.kind||t[168]!==g?(L=(0,y.jsx)(`div`,{className:`mb-4`,children:(0,y.jsx)(ce,{owner:m,repo:h,path:g,kind:T.target.kind,branch:T.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[164]=T.branch,t[165]=T.owner,t[166]=T.repo,t[167]=T.target.kind,t[168]=g,t[169]=L):L=t[169],R=x.phase===`branch-in-other-worktree`?(0,y.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,y.jsx)(`p`,{className:`leading-6`,children:(0,y.jsx)(r,{id:`yjExfe`,values:{shareBranch:D},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,y.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,y.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,y.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,y.jsx)(r,{id:`c8jBgX`})]}):x.phase===`verdict`?x.resolution.kind===`on-origin`?(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-on-origin`,children:(0,y.jsx)(r,{id:`Uay5NL`,values:{targetNoun:w,shareBranch:D},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):x.resolution.kind===`renamed`?(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-renamed`,children:(0,y.jsx)(r,{id:`P0HC30`,values:{0:x.resolution.renamedTo,targetNoun:w},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):x.resolution.kind===`diverged`?(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-diverged`,children:(0,y.jsx)(r,{id:`kLv8d3`,values:{shareBranch:D,targetNoun:w},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,y.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,y.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,y.jsx)(r,{id:`c8jBgX`})]}):s?(0,y.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,y.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,y.jsx)(r,{id:`jerqF0`})]}):l?(0,y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,y.jsx)(r,{id:`w4hMYl`})}):q?.kind===`D`?(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,y.jsx)(r,{id:`DTI-fp`,values:{targetNoun:w,shareBranch:D},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):q?.kind===`B`?(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,y.jsx)(r,{id:`sZ2IOu`,values:{targetNoun:w,shareBranch:D,currentLabel:n},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,y.jsx)(r,{id:`_902BE`,values:{targetNoun:w,shareBranch:D,currentLabel:n},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),z=q&&!q.switchEnabled&&q.conflictingFiles.length>0?(0,y.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,y.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,y.jsx)(r,{id:`n2lRue`})}),(0,y.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(we)})]}):null,t[107]=v,t[108]=x.info,t[109]=x.otherWorktreePath,t[110]=x.phase,t[111]=x.resolution,t[112]=k,t[113]=Xe,t[114]=T.branch,t[115]=T.owner,t[116]=T.repo,t[117]=T.target,t[118]=D,t[119]=w,t[120]=A,t[121]=j,t[122]=M,t[123]=N,t[124]=P,t[125]=F,t[126]=I,t[127]=L,t[128]=R,t[129]=z,t[130]=B,t[131]=V,t[132]=H,t[133]=U,t[134]=W,t[135]=G,t[136]=K,t[137]=q,t[138]=J}else A=t[120],j=t[121],M=t[122],N=t[123],P=t[124],F=t[125],I=t[126],L=t[127],R=t[128],z=t[129],B=t[130],V=t[131],H=t[132],U=t[133],W=t[134],G=t[135],K=t[136],q=t[137],J=t[138];let Y;t[170]===I?Y=t[171]:(Y=I?(0,y.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,y.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,y.jsx)(r,{id:`CU3AiE`})]}):null,t[170]=I,t[171]=Y);let X;t[172]===N?X=t[173]:(X=N?(0,y.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,y.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,y.jsx)(r,{id:`PZtgO0`})]}):null,t[172]=N,t[173]=X);let Z;t[174]!==A||t[175]!==L||t[176]!==R||t[177]!==z||t[178]!==Y||t[179]!==X?(Z=(0,y.jsxs)(A,{children:[L,R,z,Y,X]}),t[174]=A,t[175]=L,t[176]=R,t[177]=z,t[178]=Y,t[179]=X,t[180]=Z):Z=t[180];let _t;t[181]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,y.jsx)(r,{id:`dEgA5A`}),t[181]=_t):_t=t[181];let Q;t[182]===k?Q=t[183]:(Q=(0,y.jsx)(o,{variant:`ghost`,onClick:k,"data-testid":`share-branch-switch-cancel`,children:_t}),t[182]=k,t[183]=Q);let vt;t[184]!==x.phase||t[185]!==x.resolution||t[186]!==N||t[187]!==st||t[188]!==rt||t[189]!==pt||t[190]!==ht||t[191]!==at||t[192]!==$e||t[193]!==tt||t[194]!==P||t[195]!==F||t[196]!==I||t[197]!==q||t[198]!==J?(vt=x.phase===`branch-in-other-worktree`?(0,y.jsx)(o,{onClick:ht,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,y.jsx)(r,{id:`hyCxJY`})}):x.phase===`verdict`?x.resolution.kind===`on-origin`?(0,y.jsxs)(o,{onClick:tt,"data-testid":`share-branch-switch-verdict-switch-update`,children:[(0,y.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}),(0,y.jsx)(r,{id:`uA_jXp`})]}):x.resolution.kind===`renamed`?(0,y.jsxs)(o,{onClick:rt,"data-testid":`share-branch-switch-verdict-open-renamed`,children:[(0,y.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),(0,y.jsx)(r,{id:`AItsE5`})]}):x.resolution.kind===`diverged`?(0,y.jsxs)(o,{onClick:at,"data-testid":`share-branch-switch-verdict-plain-switch`,children:[(0,y.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}),F]}):null:(0,y.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,y.jsxs)(o,{variant:`outline`,onClick:st,disabled:I||N,"data-testid":`share-branch-switch-open-current`,children:[(0,y.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),P]}):null,(0,y.jsx)(o,{variant:`outline`,onClick:$e,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,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(d,{className:`size-3.5`,"aria-hidden":`true`}),F]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}),F]})}),(0,y.jsx)(o,{onClick:pt,disabled:!q||I||N,"data-testid":`share-branch-switch-worktree`,children:N?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(d,{className:`size-3.5`,"aria-hidden":`true`}),J]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),J]})})]}),t[184]=x.phase,t[185]=x.resolution,t[186]=N,t[187]=st,t[188]=rt,t[189]=pt,t[190]=ht,t[191]=at,t[192]=$e,t[193]=tt,t[194]=P,t[195]=F,t[196]=I,t[197]=q,t[198]=J,t[199]=vt):vt=t[199];let yt;t[200]!==Q||t[201]!==vt?(yt=(0,y.jsxs)(f,{className:`sm:justify-between`,children:[Q,vt]}),t[200]=Q,t[201]=vt,t[202]=yt):yt=t[202];let $;t[203]!==j||t[204]!==B||t[205]!==V||t[206]!==H||t[207]!==U||t[208]!==W||t[209]!==Z||t[210]!==yt?($=(0,y.jsxs)(j,{className:B,"data-testid":V,onInteractOutside:H,onPointerDownOutside:U,children:[W,Z,yt]}),t[203]=j,t[204]=B,t[205]=V,t[206]=H,t[207]=U,t[208]=W,t[209]=Z,t[210]=yt,t[211]=$):$=t[211];let bt;return t[212]!==M||t[213]!==G||t[214]!==K||t[215]!==$?(bt=(0,y.jsx)(M,{open:G,onOpenChange:K,children:$}),t[212]=M,t[213]=G,t[214]=K,t[215]=$,t[216]=bt):bt=t[216],bt}function we(e){return(0,y.jsx)(`li`,{children:(0,y.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function Te(e){e.preventDefault()}function Ee(e){e.preventDefault()}function De(){return m.request()}function Oe(e){return ye(e,null).state}function ke(e){return ve(e,null)}function Ae(e){return pe(e,null)}function je(){return null}export{b 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-HKX9wT1K.js";import{n as s}from"./dist-CJhtNlOm2.js";import{t as c}from"./desktop-bridge-types-oYPdTDmz.js";import{n as l,t as u}from"./git-branch-B_QTfwFA.js";import{t as d}from"./spinner-Bp2_BYkl.js";import{n as ee,t as te}from"./miss-dialog-store-CNJRdTPE.js";import{a as ne,c as re,i as ie,n as ae,o as f,s as oe,t as se}from"./dialog-Cv_pRVgB.js";import{r as p,t as m}from"./auth-prompt-store-BG1KGa5o.js";import{a as h,n as g}from"./receive-store-mjPNDOwU.js";import{t as ce}from"./share-metadata-rows-iQiWNrX5.js";var _=e(n(),1),le=a();function ue(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 de(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function v(e){if(e.ok)return{action:`await-cc1`};switch(e.reason){case`dirty-conflict`:return{action:`rerender-conflict`,files:e.files??[]};case`branch-not-found`:return{action:`dismiss-with-toast`,reason:`branch-not-found`};case`fetch-failed`:case`checkout-failed`:return{action:`stay-with-toast`,reason:e.reason};case`branch-in-other-worktree`:{let t=e.otherWorktreePath;return t===void 0||t.length===0?{action:`stay-with-toast`,reason:`checkout-failed`}:{action:`pivot-to-other-worktree`,otherWorktreePath:t}}case`ff-diverged`:return{action:`branch-diverged`};default:{let t=e.reason;throw Error(`Unhandled CheckoutFailureReason: ${String(t)}`)}}}var fe={phase:`loading`};function pe(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function me(e,t){return e.phase!==`ready`&&e.phase!==`verdict`?e:{phase:`switching`,info:e.info,pendingDoc:t}}function he(e){return e.phase===`ready`?{phase:`creating-worktree`,info:e.info}:e}function ge(e){return ue(e).kind===`B`&&e.shareTargetOnOriginBranch===!1}function _e(e){return e.phase===`ready`?{phase:`verdict-pending`,info:e.info}:e}function ve(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 ye(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=v(t);return n.action===`await-cc1`?{state:{phase:`awaiting-cc1-recycle`,pendingDoc:e.pendingDoc}}:n.action===`rerender-conflict`?{state:{phase:`ready`,info:{...e.info,dirtyConflicts:{conflicts:!0,files:n.files.slice()}}}}:n.action===`pivot-to-other-worktree`?{state:{phase:`branch-in-other-worktree`,info:e.info,otherWorktreePath:n.otherWorktreePath,pendingDoc:e.pendingDoc}}:n.action===`dismiss-with-toast`?{state:{phase:`dismissed`,reason:n.reason},sideEffect:{kind:`toast`,reason:n.reason}}:n.action===`branch-diverged`?{state:{phase:`verdict`,info:e.info,resolution:{kind:`diverged`}}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:n.reason}}}function be(e,t){return e.phase===`creating-worktree`?t===null?{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}}:t.ok?{state:{phase:`opening-worktree`,path:t.path}}:t.reason===`branch-not-found`?{state:{phase:`dismissed`,reason:`branch-not-found`},sideEffect:{kind:`toast`,reason:`branch-not-found`}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:t.reason,helper:t.helper,authFailed:t.reason===`fetch-failed`?t.authFailed:void 0,notFoundAsIdentity:t.reason===`fetch-failed`?t.notFoundAsIdentity:void 0}}:{state:e}}var y=t();function xe(e){return c(e.repositoryTarget)}function Se(e,t=c(e.target)){let n=e.contentRootDepth===null?t:[...xe(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 Ce(e){return e!==null&&e.kind===`project-branch-switch`}function b(e){let t=(0,le.c)(217),{bridge:n,store:a}=e,m=a===void 0?g:a,{_:v}=i(),b=(0,_.useSyncExternalStore)(m.subscribe,m.getSnapshot,je),[x,S]=(0,_.useState)(fe),Me=(0,_.useRef)(!1),Ne=(0,_.useRef)(!1),Pe=(0,_.useRef)(!1),Fe=(0,_.useRef)(null),Ie;t[0]===b?Ie=t[1]:(Ie=Ce(b)?b:null,t[0]=b,t[1]=Ie);let C=Ie,Le;t[2]!==v||t[3]!==C?.share.target.kind?(Le=C?.share.target.kind===`folder`?v({id:`ugoTXs`}):v({id:`XH30C4`}),t[2]=v,t[3]=C?.share.target.kind,t[4]=Le):Le=t[4];let w=Le,Re;t[5]===C?Re=t[6]:(Re=()=>{S(fe),Me.current=!1,Ne.current=!1,Pe.current=!1,Fe.current=C},t[5]=C,t[6]=Re);let ze;t[7]===b?ze=t[8]:(ze=[b],t[7]=b,t[8]=ze),(0,_.useEffect)(Re,ze);let Be;t[9]!==C||t[10]!==n?(Be=()=>{if(!C||Me.current)return;Me.current=!0;let e=!1;return n.project.fetchBranchInfo({projectPath:C.projectPath,branch:C.share.branch,kind:C.share.repositoryTarget.kind,path:xe(C.share)}).then(t=>{e||S(e=>pe(e,t))}).catch(t=>{e||(console.warn(`[receive] branch-info-fetch-failed`,t instanceof Error?t.message:t),S(Ae))}),()=>{e=!0}},t[9]=C,t[10]=n,t[11]=Be):Be=t[11];let Ve;t[12]===C?Ve=t[13]:(Ve=[C],t[12]=C,t[13]=Ve),(0,_.useEffect)(Be,Ve);let He;t[14]!==C||t[15]!==x.info||t[16]!==x.phase||t[17]!==n?(He=()=>{if(!C||x.phase!==`ready`||Pe.current||!ge(x.info))return;Pe.current=!0,S(_e);let e=C;n.project.fetchTargetStatus({projectPath:C.projectPath,branch:C.share.branch,kind:C.share.target.kind,path:xe(C.share),...C.share.contentRootDepth===null?{}:{contentRootDepth:C.share.contentRootDepth}}).then(t=>{Fe.current===e&&S(e=>ve(e,t))}).catch(t=>{Fe.current===e&&(console.warn(`[receive] target-status-fetch-failed`,t instanceof Error?t.message:t),S(ke))})},t[14]=C,t[15]=x.info,t[16]=x.phase,t[17]=n,t[18]=He):He=t[18];let Ue;t[19]!==C||t[20]!==x.phase?(Ue=[x.phase,C],t[19]=C,t[20]=x.phase,t[21]=Ue):Ue=t[21],(0,_.useEffect)(He,Ue);let We;t[22]!==C||t[23]!==x.phase||t[24]!==x.resolution||t[25]!==m?(We=()=>{if(x.phase!==`verdict`)return;let{kind:e}=x.resolution;e!==`deleted`&&e!==`never-on-branch`||C&&(te.arm({kind:C.share.target.kind,path:c(C.share.target),repositoryPath:xe(C.share),...C.share.contentRootDepth===null?{}:{contentRootDepth:C.share.contentRootDepth},branch:C.share.branch}),m.dismiss())},t[22]=C,t[23]=x.phase,t[24]=x.resolution,t[25]=m,t[26]=We):We=t[26];let Ge;t[27]!==C||t[28]!==x||t[29]!==m?(Ge=[x,C,m],t[27]=C,t[28]=x,t[29]=m,t[30]=Ge):Ge=t[30],(0,_.useEffect)(We,Ge);let Ke;t[31]!==x.phase||t[32]!==x.resolution?(Ke=()=>{x.phase===`verdict`&&console.log(h({verdict_cell:x.resolution.kind}))},t[31]=x.phase,t[32]=x.resolution,t[33]=Ke):Ke=t[33];let qe;t[34]===x?qe=t[35]:(qe=[x],t[34]=x,t[35]=qe),(0,_.useEffect)(Ke,qe);let Je;t[36]!==v||t[37]!==C||t[38]!==x.pendingDoc||t[39]!==x.phase||t[40]!==n||t[41]!==m||t[42]!==w?(Je=()=>{if(x.phase!==`awaiting-cc1-recycle`||!C)return;let e=C.share.branch,t=x.pendingDoc;if(!e){m.dismiss();return}if(Ne.current)return;Ne.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:Se(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(v({id:`gQV-9w`,values:{targetNoun:w}}))}),m.dismiss();return}console.log(h({branch_dialog_action:`branch-switch-timeout`,branch:e})),s.error(v({id:`LBwUR6`,values:{targetNoun:w}})),m.dismiss()}}).catch(e=>{r||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),s.error(v({id:`Jw6EC4`,values:{targetNoun:w}})),m.dismiss())}),()=>{r=!0}},t[36]=v,t[37]=C,t[38]=x.pendingDoc,t[39]=x.phase,t[40]=n,t[41]=m,t[42]=w,t[43]=Je):Je=t[43];let Ye;if(t[44]!==C||t[45]!==x.phase?(Ye=[x.phase,C],t[44]=C,t[45]=x.phase,t[46]=Ye):Ye=t[46],(0,_.useEffect)(Je,Ye),!C)return null;let{share:T,projectPath:E,currentBranch:Xe}=C,D=T.branch,Ze;t[47]!==v||t[48]!==n.project||t[49]!==E||t[50]!==D||t[51]!==m?(Ze=function(e,t,r){console.log(h({branch_dialog_action:`switch`,branch_action:`switch`,branch:D,verdict_cell:r})),S(t=>me(t,e)),n.project.runCheckout(t?{projectPath:E,branch:D,fastForward:!0}:{projectPath:E,branch:D}).then(e=>{let t=null,n=!1;S(r=>{let{state:i,sideEffect:a}=ye(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?s.error(v({id:`NJyQi_`,values:{shareBranch:D}})):t===`fetch-failed`?s.error(v({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&s.error(v({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(Oe),s.error(v({id:`c863eW`,values:{shareBranch:D}}))})},t[47]=v,t[48]=n.project,t[49]=E,t[50]=D,t[51]=m,t[52]=Ze):Ze=t[52];let O=Ze,Qe;t[53]!==x.info||t[54]!==x.phase||t[55]!==O||t[56]!==T.target?(Qe=function(){x.phase===`ready`&&ue(x.info).switchEnabled&&O(c(T.target),!1)},t[53]=x.info,t[54]=x.phase,t[55]=O,t[56]=T.target,t[57]=Qe):Qe=t[57];let $e=Qe,et;t[58]!==x.phase||t[59]!==x.resolution||t[60]!==O||t[61]!==T.target?(et=function(){x.phase===`verdict`&&O(c(T.target),!0,x.resolution.kind)},t[58]=x.phase,t[59]=x.resolution,t[60]=O,t[61]=T.target,t[62]=et):et=t[62];let tt=et,nt;t[63]!==x.phase||t[64]!==x.resolution||t[65]!==O?(nt=function(){x.phase===`verdict`&&x.resolution.kind===`renamed`&&O(x.resolution.renamedTo,!0,x.resolution.kind)},t[63]=x.phase,t[64]=x.resolution,t[65]=O,t[66]=nt):nt=t[66];let rt=nt,it;t[67]!==x.phase||t[68]!==x.resolution||t[69]!==O||t[70]!==T.target?(it=function(){x.phase===`verdict`&&O(c(T.target),!1,x.resolution.kind)},t[67]=x.phase,t[68]=x.resolution,t[69]=O,t[70]=T.target,t[71]=it):it=t[71];let at=it,ot;t[72]!==v||t[73]!==n.project||t[74]!==E||t[75]!==T||t[76]!==D||t[77]!==m||t[78]!==w?(ot=function(){console.log(h({branch_dialog_action:`open-current`,branch:D})),n.project.open({path:E,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:Se(T)}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),s.error(v({id:`b5aNbi`,values:{targetNoun:w}}))}),m.dismiss()},t[72]=v,t[73]=n.project,t[74]=E,t[75]=T,t[76]=D,t[77]=m,t[78]=w,t[79]=ot):ot=t[79];let st=ot,ct;t[80]!==v||t[81]!==D?(ct=function(e,t){let{helper:n,authFailed:r,notFoundAsIdentity:i}=t===void 0?{}:t;if(e===`fetch-failed`&&i){s.error(v({id:`jRsjlF`}));return}if(e===`fetch-failed`&&r){s.error(v({id:`gfb-CM`}),{action:{label:v({id:`5lWFkC`}),onClick:De}});return}switch(e){case`helper-not-found`:{let e=n??v({id:`cHhH3i`});s.error(v({id:`Z7x_Zh`,values:{tool:e}}));return}case`branch-not-found`:s.error(v({id:`NJyQi_`,values:{shareBranch:D}}));return;case`fetch-failed`:s.error(v({id:`bWLmRK`}));return;case`already-checked-out`:s.error(v({id:`ljHjfg`}));return;case`branch-exists`:s.error(v({id:`h3QZcB`,values:{shareBranch:D}}));return;case`path-exists`:s.error(v({id:`cN1Gcp`,values:{shareBranch:D}}));return;case`no-git`:s.error(v({id:`CFnavk`}));return;case`empty-repo`:s.error(v({id:`5IgYAM`}));return;case`invalid-branch`:s.error(v({id:`JfPuv7`,values:{shareBranch:D}}));return;case`proxy-null`:case`error`:s.error(v({id:`e8zYa8`,values:{shareBranch:D}}));return;default:throw Error(`Unhandled worktree failure reason: ${String(e)}`)}},t[80]=v,t[81]=D,t[82]=ct):ct=t[82];let lt=ct,ut;t[83]!==v||t[84]!==n.project||t[85]!==T||t[86]!==D||t[87]!==lt||t[88]!==m?(ut=function(e){let t=null,r,i,a,o=!1,c=null;if(S(n=>{let{state:s,sideEffect:l}=be(n,e);return l&&(t=l.reason,r=l.helper,i=l.authFailed,a=l.notFoundAsIdentity,o=s.phase===`dismissed`),s.phase===`opening-worktree`&&(c=s.path),s}),t!==null&&(console.log(h({branch_dialog_action:`open-worktree-failed:${t}`,branch:D})),lt(t,{helper:r,authFailed:i,notFoundAsIdentity:a})),c!==null){p();let e=c;n.project.open({path:e,target:`new-window`,entryPoint:`worktree`,pendingDeepLinkTarget:Se(T),pendingBranch:D}).catch(t=>{console.warn(`[receive] worktree-open-failed branch_dialog_action=open-worktree`,t instanceof Error?t.message:t),s.error(v({id:`LdABLa`,values:{target:e}}))}),m.dismiss()}o&&m.dismiss()},t[83]=v,t[84]=n.project,t[85]=T,t[86]=D,t[87]=lt,t[88]=m,t[89]=ut):ut=t[89];let dt=ut,ft;t[90]!==dt||t[91]!==x.phase||t[92]!==n.worktree||t[93]!==D?(ft=function(){x.phase===`ready`&&(console.log(h({branch_dialog_action:`open-worktree`,branch:D})),S(he),n.worktree.checkout({branch:D}).then(e=>{dt(e)}).catch(e=>{console.warn(`[receive] worktree-checkout rejected branch_dialog_action=open-worktree`,e instanceof Error?e.message:e),dt(null)}))},t[90]=dt,t[91]=x.phase,t[92]=n.worktree,t[93]=D,t[94]=ft):ft=t[94];let pt=ft,mt;t[95]!==v||t[96]!==x.otherWorktreePath||t[97]!==x.phase||t[98]!==n.project||t[99]!==T||t[100]!==D||t[101]!==m?(mt=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:Se(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(v({id:`LdABLa`,values:{target:e}}))}),m.dismiss()},t[95]=v,t[96]=x.otherWorktreePath,t[97]=x.phase,t[98]=n.project,t[99]=T,t[100]=D,t[101]=m,t[102]=mt):mt=t[102];let ht=mt,gt;t[103]!==x.phase||t[104]!==x.resolution||t[105]!==m?(gt=function(){console.log(h({branch_dialog_action:`cancel`,verdict_cell:x.phase===`verdict`?x.resolution.kind:void 0})),m.dismiss()},t[103]=x.phase,t[104]=x.resolution,t[105]=m,t[106]=gt):gt=t[106];let k=gt,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K,q,J;if(t[107]!==v||t[108]!==x.info||t[109]!==x.otherWorktreePath||t[110]!==x.phase||t[111]!==x.resolution||t[112]!==k||t[113]!==Xe||t[114]!==T.branch||t[115]!==T.owner||t[116]!==T.repo||t[117]!==T.target||t[118]!==D||t[119]!==w){q=x.phase===`ready`||x.phase===`switching`||x.phase===`creating-worktree`?ue(x.info):null;let e;t[139]!==x.info||t[140]!==x.phase||t[141]!==Xe?(e=x.phase===`ready`||x.phase===`switching`||x.phase===`creating-worktree`?de(x.info):Xe??`HEAD`,t[139]=x.info,t[140]=x.phase,t[141]=Xe,t[142]=e):e=t[142];let n=e;I=x.phase===`switching`||x.phase===`awaiting-cc1-recycle`,N=x.phase===`creating-worktree`;let i;t[143]===v?i=t[144]:(i=v({id:`OuY8t9`}),t[143]=v,t[144]=i),P=i;let a;t[145]===v?a=t[146]:(a=v({id:`XZkdtg`}),t[145]=v,t[146]=a),F=a;let o;t[147]===v?o=t[148]:(o=v({id:`VTulZj`}),t[147]=v,t[148]=o),J=o;let s=x.phase===`loading`,l=x.phase===`error`;M=se,G=!0,t[149]===k?K=t[150]:(K=e=>{e||k()},t[149]=k,t[150]=K),j=ie,B=`sm:max-w-xl`,V=`share-branch-switch-dialog`,H=Ee,U=Te;let u;t[151]===w?u=t[152]:(u=(0,y.jsx)(re,{children:(0,y.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:w}})}),t[151]=w,t[152]=u);let ee=T.owner,te=T.repo,f;t[153]===T.target?f=t[154]:(f=c(T.target),t[153]=T.target,t[154]=f);let p;t[155]!==T.owner||t[156]!==T.repo||t[157]!==f?(p=(0,y.jsx)(ne,{className:`sr-only`,children:(0,y.jsx)(r,{id:`f8jU-L`,values:{0:ee,1:te,2:f}})}),t[155]=T.owner,t[156]=T.repo,t[157]=f,t[158]=p):p=t[158],t[159]!==u||t[160]!==p?(W=(0,y.jsxs)(oe,{children:[u,p]}),t[159]=u,t[160]=p,t[161]=W):W=t[161],A=ae;let m=T.owner,h=T.repo,g;t[162]===T.target?g=t[163]:(g=c(T.target),t[162]=T.target,t[163]=g),t[164]!==T.branch||t[165]!==T.owner||t[166]!==T.repo||t[167]!==T.target.kind||t[168]!==g?(L=(0,y.jsx)(`div`,{className:`mb-4`,children:(0,y.jsx)(ce,{owner:m,repo:h,path:g,kind:T.target.kind,branch:T.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[164]=T.branch,t[165]=T.owner,t[166]=T.repo,t[167]=T.target.kind,t[168]=g,t[169]=L):L=t[169],R=x.phase===`branch-in-other-worktree`?(0,y.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,y.jsx)(`p`,{className:`leading-6`,children:(0,y.jsx)(r,{id:`yjExfe`,values:{shareBranch:D},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,y.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,y.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,y.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,y.jsx)(r,{id:`c8jBgX`})]}):x.phase===`verdict`?x.resolution.kind===`on-origin`?(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-on-origin`,children:(0,y.jsx)(r,{id:`Uay5NL`,values:{targetNoun:w,shareBranch:D},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):x.resolution.kind===`renamed`?(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-renamed`,children:(0,y.jsx)(r,{id:`P0HC30`,values:{0:x.resolution.renamedTo,targetNoun:w},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):x.resolution.kind===`diverged`?(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,"data-testid":`share-branch-switch-verdict-diverged`,children:(0,y.jsx)(r,{id:`kLv8d3`,values:{shareBranch:D,targetNoun:w},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,y.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,y.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,y.jsx)(r,{id:`c8jBgX`})]}):s?(0,y.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,y.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,y.jsx)(r,{id:`jerqF0`})]}):l?(0,y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,y.jsx)(r,{id:`w4hMYl`})}):q?.kind===`D`?(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,y.jsx)(r,{id:`DTI-fp`,values:{targetNoun:w,shareBranch:D},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):q?.kind===`B`?(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,y.jsx)(r,{id:`sZ2IOu`,values:{targetNoun:w,shareBranch:D,currentLabel:n},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,y.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,y.jsx)(r,{id:`_902BE`,values:{targetNoun:w,shareBranch:D,currentLabel:n},components:{0:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,y.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),z=q&&!q.switchEnabled&&q.conflictingFiles.length>0?(0,y.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,y.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,y.jsx)(r,{id:`n2lRue`})}),(0,y.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(we)})]}):null,t[107]=v,t[108]=x.info,t[109]=x.otherWorktreePath,t[110]=x.phase,t[111]=x.resolution,t[112]=k,t[113]=Xe,t[114]=T.branch,t[115]=T.owner,t[116]=T.repo,t[117]=T.target,t[118]=D,t[119]=w,t[120]=A,t[121]=j,t[122]=M,t[123]=N,t[124]=P,t[125]=F,t[126]=I,t[127]=L,t[128]=R,t[129]=z,t[130]=B,t[131]=V,t[132]=H,t[133]=U,t[134]=W,t[135]=G,t[136]=K,t[137]=q,t[138]=J}else A=t[120],j=t[121],M=t[122],N=t[123],P=t[124],F=t[125],I=t[126],L=t[127],R=t[128],z=t[129],B=t[130],V=t[131],H=t[132],U=t[133],W=t[134],G=t[135],K=t[136],q=t[137],J=t[138];let Y;t[170]===I?Y=t[171]:(Y=I?(0,y.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,y.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,y.jsx)(r,{id:`CU3AiE`})]}):null,t[170]=I,t[171]=Y);let X;t[172]===N?X=t[173]:(X=N?(0,y.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,y.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,y.jsx)(r,{id:`PZtgO0`})]}):null,t[172]=N,t[173]=X);let Z;t[174]!==A||t[175]!==L||t[176]!==R||t[177]!==z||t[178]!==Y||t[179]!==X?(Z=(0,y.jsxs)(A,{children:[L,R,z,Y,X]}),t[174]=A,t[175]=L,t[176]=R,t[177]=z,t[178]=Y,t[179]=X,t[180]=Z):Z=t[180];let _t;t[181]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,y.jsx)(r,{id:`dEgA5A`}),t[181]=_t):_t=t[181];let Q;t[182]===k?Q=t[183]:(Q=(0,y.jsx)(o,{variant:`ghost`,onClick:k,"data-testid":`share-branch-switch-cancel`,children:_t}),t[182]=k,t[183]=Q);let vt;t[184]!==x.phase||t[185]!==x.resolution||t[186]!==N||t[187]!==st||t[188]!==rt||t[189]!==pt||t[190]!==ht||t[191]!==at||t[192]!==$e||t[193]!==tt||t[194]!==P||t[195]!==F||t[196]!==I||t[197]!==q||t[198]!==J?(vt=x.phase===`branch-in-other-worktree`?(0,y.jsx)(o,{onClick:ht,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,y.jsx)(r,{id:`hyCxJY`})}):x.phase===`verdict`?x.resolution.kind===`on-origin`?(0,y.jsxs)(o,{onClick:tt,"data-testid":`share-branch-switch-verdict-switch-update`,children:[(0,y.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}),(0,y.jsx)(r,{id:`uA_jXp`})]}):x.resolution.kind===`renamed`?(0,y.jsxs)(o,{onClick:rt,"data-testid":`share-branch-switch-verdict-open-renamed`,children:[(0,y.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),(0,y.jsx)(r,{id:`AItsE5`})]}):x.resolution.kind===`diverged`?(0,y.jsxs)(o,{onClick:at,"data-testid":`share-branch-switch-verdict-plain-switch`,children:[(0,y.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}),F]}):null:(0,y.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,y.jsxs)(o,{variant:`outline`,onClick:st,disabled:I||N,"data-testid":`share-branch-switch-open-current`,children:[(0,y.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),P]}):null,(0,y.jsx)(o,{variant:`outline`,onClick:$e,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,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(d,{className:`size-3.5`,"aria-hidden":`true`}),F]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}),F]})}),(0,y.jsx)(o,{onClick:pt,disabled:!q||I||N,"data-testid":`share-branch-switch-worktree`,children:N?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(d,{className:`size-3.5`,"aria-hidden":`true`}),J]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),J]})})]}),t[184]=x.phase,t[185]=x.resolution,t[186]=N,t[187]=st,t[188]=rt,t[189]=pt,t[190]=ht,t[191]=at,t[192]=$e,t[193]=tt,t[194]=P,t[195]=F,t[196]=I,t[197]=q,t[198]=J,t[199]=vt):vt=t[199];let yt;t[200]!==Q||t[201]!==vt?(yt=(0,y.jsxs)(f,{className:`sm:justify-between`,children:[Q,vt]}),t[200]=Q,t[201]=vt,t[202]=yt):yt=t[202];let $;t[203]!==j||t[204]!==B||t[205]!==V||t[206]!==H||t[207]!==U||t[208]!==W||t[209]!==Z||t[210]!==yt?($=(0,y.jsxs)(j,{className:B,"data-testid":V,onInteractOutside:H,onPointerDownOutside:U,children:[W,Z,yt]}),t[203]=j,t[204]=B,t[205]=V,t[206]=H,t[207]=U,t[208]=W,t[209]=Z,t[210]=yt,t[211]=$):$=t[211];let bt;return t[212]!==M||t[213]!==G||t[214]!==K||t[215]!==$?(bt=(0,y.jsx)(M,{open:G,onOpenChange:K,children:$}),t[212]=M,t[213]=G,t[214]=K,t[215]=$,t[216]=bt):bt=t[216],bt}function we(e){return(0,y.jsx)(`li`,{children:(0,y.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function Te(e){e.preventDefault()}function Ee(e){e.preventDefault()}function De(){return m.request()}function Oe(e){return ye(e,null).state}function ke(e){return ve(e,null)}function Ae(e){return pe(e,null)}function je(){return null}export{b as ShareBranchSwitchDialog};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-HKX9wT1K.js";import{In as s,zn as c}from"./dist-C_owXiVJ.js";import{n as l}from"./dist-CJhtNlOm2.js";import{t as u}from"./desktop-bridge-types-oYPdTDmz.js";import{t as ee}from"./spinner-Bp2_BYkl.js";import{a as d,c as f,i as p,n as te,o as m,s as h,t as g}from"./dialog-Cv_pRVgB.js";import{a as ne,i as _,n as v,o as y,r as re,s as b}from"./receive-store-Djrqwgcm.js";import{t as ie}from"./share-metadata-rows-iQiWNrX5.js";var x=e(n(),1),S=a(),C=e=>({phase:`ready`,seed:e});function w(e){return e.phase===`ready`?{phase:`initializing`,seed:e.seed}:e}function T(e,t){return e.phase===`initializing`?t.ok?{phase:`opening`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:t.reason,message:t.message}:e}function E(e,t){return e.phase===`opening`?t.ok?{phase:`done`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:`network-error`,message:t.message}:e}function D(e){return e.phase===`done`||e.phase===`cancelled`||e.phase===`error`?e:{phase:`cancelled`,seed:e.seed}}var O=t();function k(e){return{kind:e.target.kind,path:u(e.target),repositoryPath:u(e.repositoryTarget),...e.contentRootDepth===null?{}:{contentRootDepth:e.contentRootDepth}}}function A(e){return e!==null&&e.kind===`launcher-consent`}function j(e){return e!==null&&e.kind===`launcher-miss`}function M(e){let t=(0,S.c)(14),{bridge:n,cloneController:r,store:i}=e,a=i===void 0?v:i,o=(0,x.useSyncExternalStore)(a.subscribe,a.getSnapshot,P),[s,c]=(0,x.useState)(0),[u,ee]=(0,x.useState)(o);o!==u&&(ee(o),c(N));let d,f;t[0]!==o||t[1]!==a?(d=()=>{if(!o)return;let e=b(o);e&&(l.error(e.message),a.dismiss())},f=[o,a],t[0]=o,t[1]=a,t[2]=d,t[3]=f):(d=t[2],f=t[3]),(0,x.useEffect)(d,f);let p;t[4]===o?p=t[5]:(p=j(o)?o:null,t[4]=o,t[5]=p);let te=p,m;t[6]===o?m=t[7]:(m=A(o)?o:null,t[6]=o,t[7]=m);let h=m??te;if(!h)return null;let g;return t[8]!==h||t[9]!==n||t[10]!==r||t[11]!==s||t[12]!==a?(g=(0,O.jsx)(F,{payload:h,bridge:n,cloneController:r,store:a},s),t[8]=h,t[9]=n,t[10]=r,t[11]=s,t[12]=a,t[13]=g):g=t[13],g}function N(e){return e+1}function P(){return null}function F(e){let t=(0,S.c)(165),{payload:n,bridge:a,cloneController:v,store:b}=e,{_:w}=i(),[D,M]=(0,x.useState)(!1),[N,P]=(0,x.useState)(null),[F,ue]=(0,x.useState)(!1),[I,de]=(0,x.useState)(!1),[L,fe]=(0,x.useState)(null),[R,z]=(0,x.useState)(null),pe=(0,x.useRef)(!1),me=(0,x.useRef)(null),he,ge;t[0]===L?(he=t[1],ge=t[2]):(he=()=>{L&&me.current?.focus()},ge=[L],t[0]=L,t[1]=he,t[2]=ge),(0,x.useEffect)(he,ge);let _e;t[3]!==R||t[4]!==n?(_e=()=>{A(n)&&R===null&&(console.warn(`[receive] q1_hit=true selection=branch_match_non_ok candidate=${n.candidatePath}`),z(C({candidatePath:n.candidatePath,branch:n.share.branch,targetPath:u(n.share.target),targetKind:n.share.target.kind,repositoryPath:u(n.share.repositoryTarget),...n.share.contentRootDepth===null?{}:{contentRootDepth:n.share.contentRootDepth},parentProjectName:n.parentProjectName})))},t[3]=R,t[4]=n,t[5]=_e):_e=t[5];let ve;t[6]===n?ve=t[7]:(ve=[n],t[6]=n,t[7]=ve),(0,x.useEffect)(_e,ve);let ye;t[8]!==N||t[9]!==v||t[10]!==n?(ye=()=>{if(!v||!j(n)||N!==null||pe.current)return;pe.current=!0,ue(!0);let e=n.share.host;v.getAuthStatus(e).then(e=>{P(e)}).catch(t=>{console.warn(`[receive] auth pre-flight probe failed`,t instanceof Error?t.message:t),P({authenticated:!1,host:e})}).finally(()=>{ue(!1)})},t[8]=N,t[9]=v,t[10]=n,t[11]=ye):ye=t[11];let be;t[12]!==N||t[13]!==n?(be=[n,N],t[12]=N,t[13]=n,t[14]=be):be=t[14],(0,x.useEffect)(ye,be);let B=j(n)?n:null,xe=A(n)?n:null,V=B?.share??xe?.share??null,H,Se,U,W,G,Ce,K,q;if(t[15]!==w||t[16]!==F||t[17]!==a||t[18]!==v||t[19]!==I||t[20]!==R||t[21]!==B||t[22]!==D||t[23]!==V||t[24]!==b){K=Symbol.for(`react.early_return_sentinel`);bb0:{let e=V?{host:V.host,owner:V.owner,repo:V.repo}:null,n;t[33]!==w||t[34]!==V?.target.kind?(n=V?.target.kind===`folder`?w({id:`ugoTXs`}):w({id:`XH30C4`}),t[33]=w,t[34]=V?.target.kind,t[35]=n):n=t[35],q=n,U=async function(){if(!B||!e)return;if(console.log(ne({q2_path:`clone`})),!v){l.info(w({id:`27XW26`}),{action:{label:w({id:`B3NAZC`}),onClick:()=>{a.navigator.open()}},duration:8e3});return}if(I)return;fe(null),de(!0);let t=re(e),n;try{n=await v.runClone({url:t,branch:B.share.branch})}catch(e){let t=e;console.warn(`[receive] runClone threw unexpectedly`,t),de(!1),fe({detail:t instanceof Error?t.message:String(t)});return}if(de(!1),n.kind===`error`){fe({detail:n.detail??null});return}if(n.kind===`ok`){try{await a.project.open({path:n.dir,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:k(B.share)}),b.dismiss()}catch(e){let t=e;console.warn(`[receive] project open after clone failed`,t instanceof Error?t.message:t),l.error(w({id:`438Fca`}))}return}};let i;t[36]!==w||t[37]!==F||t[38]!==v?(i=async function(){if(!(!v||F)){ue(!0);try{let e=await v.startSignIn();ue(!1),e!==null&&P(e)}catch(e){let t=e;ue(!1),console.warn(`[receive] startSignIn failed`,t instanceof Error?t.message:t),l.error(w({id:`lzwo7p`}))}}},t[36]=w,t[37]=F,t[38]=v,t[39]=i):i=t[39],G=i,W=async function(){if(!(!B||!e||D)){fe(null),M(!0),console.log(ne({q2_path:`local`}));try{for(;;){let t=await a.dialog.openFolder();if(!t)break;let n=await a.share.validateLocalFolder({folderPath:t,host:e.host,owner:e.owner,repo:e.repo});if(console.log(ne({folder_validate:n.kind})),n.kind===`ok`){let e=B.share.branch,n={currentBranch:null,headSha:null,detached:!1};try{n=await a.project.readHeadBranch(t)}catch(e){let t=e;console.warn(`[receive] local-folder readHeadBranch failed`,t instanceof Error?t.message:t)}let r=c(e,n)!==`true`;try{await a.project.open({path:t,target:`new-window`,entryPoint:`share-receive`,...r?{pendingShareBranchSwitch:{share:B.share,projectPath:t,currentBranch:n.currentBranch}}:{pendingDeepLinkTarget:k(B.share)}}),b.dismiss()}catch(e){let t=e;console.warn(`[receive] local-folder-open failed`,t instanceof Error?t.message:t),l.error(w({id:`phM8Kh`}))}break}let r=y(n,e);r&&l.error(r)}}catch(e){let t=e;console.warn(`[receive] local-folder-validate failed`,t instanceof Error?t.message:t),l.error(w({id:`rlUzXK`}))}M(!1)}};let _;t[40]!==w||t[41]!==a||t[42]!==R||t[43]!==b?(_=function(){if(R===null||R.phase!==`ready`)return;let e=R.seed;console.warn(`[receive] consent_dialog action=initialize worktree=${e.candidatePath}`),z(le),a.project.okInit({projectPath:e.candidatePath}).then(async t=>{if(t.ok===!0){z(e=>e===null?e:T(e,{ok:!0,projectPath:t.projectPath}));try{await a.project.open({path:t.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:e.targetKind,path:e.targetPath,repositoryPath:e.repositoryPath??e.targetPath,...e.contentRootDepth===void 0?{}:{contentRootDepth:e.contentRootDepth}},pendingBranch:e.branch}),z(ce),b.dismiss()}catch(t){let n=t,r=n instanceof Error?n.message:String(n);z(e=>e===null?e:E(e,{ok:!1,message:r})),l.error(w({id:`nDT8qt`,values:{0:e.candidatePath}}))}return}let n=t.reason,r=t.message||`Initialization failed.`;z(e=>e===null?e:T(e,{ok:!1,reason:n,message:r})),l.error(r)}).catch(t=>{let n=t instanceof Error?t.message:String(t);z(e=>e===null?e:T(e,{ok:!1,reason:`network-error`,message:n})),l.error(w({id:`3Mwaly`,values:{0:e.candidatePath}}))})},t[40]=w,t[41]=a,t[42]=R,t[43]=b,t[44]=_):_=t[44];let x=_,S;t[45]!==R||t[46]!==b?(S=function(){R!==null&&console.warn(`[receive] consent_dialog action=cancel worktree=${R.seed.candidatePath}`),z(se),b.dismiss()},t[45]=R,t[46]=b,t[47]=S):S=t[47];let C=S;if(R!==null&&R.phase!==`cancelled`&&R.phase!==`done`&&V!==null){let e=R.seed,n=R.phase===`initializing`||R.phase===`opening`,i;t[48]===C?i=t[49]:(i=e=>{e||C()},t[48]=C,t[49]=i);let a;t[50]===q?a=t[51]:(a=(0,O.jsx)(f,{children:(0,O.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:q}})}),t[50]=q,t[51]=a);let s;t[52]===V.target?s=t[53]:(s=u(V.target)?`— ${u(V.target)}`:``,t[52]=V.target,t[53]=s);let c;t[54]!==V.owner||t[55]!==V.repo||t[56]!==s?(c=(0,O.jsx)(d,{className:`sr-only`,children:(0,O.jsx)(r,{id:`pgq_xf`,values:{0:V.owner,1:V.repo,2:s}})}),t[54]=V.owner,t[55]=V.repo,t[56]=s,t[57]=c):c=t[57];let l=V.owner,ne=V.repo,_;t[58]===V.target?_=t[59]:(_=u(V.target),t[58]=V.target,t[59]=_);let v;t[60]!==V.branch||t[61]!==V.owner||t[62]!==V.repo||t[63]!==V.target.kind||t[64]!==_?(v=(0,O.jsx)(ie,{owner:l,repo:ne,path:_,kind:V.target.kind,branch:V.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[60]=V.branch,t[61]=V.owner,t[62]=V.repo,t[63]=V.target.kind,t[64]=_,t[65]=v):v=t[65];let y;t[66]!==a||t[67]!==c||t[68]!==v?(y=(0,O.jsxs)(h,{children:[a,c,v]}),t[66]=a,t[67]=c,t[68]=v,t[69]=y):y=t[69];let re;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`KsAPaB`})}),t[70]=re):re=t[70];let b;t[71]===e.candidatePath?b=t[72]:(b=(0,O.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-receive-consent-path`,children:e.candidatePath}),t[71]=e.candidatePath,t[72]=b);let S;t[73]===e.parentProjectName?S=t[74]:(S=e.parentProjectName===null?null:(0,O.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,"data-testid":`share-receive-consent-parent`,children:(0,O.jsx)(r,{id:`JmfgFc`,values:{0:e.parentProjectName}})}),t[73]=e.parentProjectName,t[74]=S);let w;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,O.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`w7SsvI`})}),t[75]=w):w=t[75];let T;t[76]!==R.message||t[77]!==R.phase?(T=R.phase===`error`?(0,O.jsx)(`p`,{className:`mt-3 text-sm text-destructive`,"data-testid":`share-receive-consent-error`,role:`alert`,children:R.message}):null,t[76]=R.message,t[77]=R.phase,t[78]=T):T=t[78];let E;t[79]!==b||t[80]!==S||t[81]!==T?(E=(0,O.jsxs)(te,{children:[re,b,S,w,T]}),t[79]=b,t[80]=S,t[81]=T,t[82]=E):E=t[82];let D;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,O.jsx)(r,{id:`dEgA5A`}),t[83]=D):D=t[83];let k;t[84]===C?k=t[85]:(k=(0,O.jsx)(o,{variant:`ghost`,onClick:C,"data-testid":`share-receive-consent-cancel`,children:D}),t[84]=C,t[85]=k);let A=n||R.phase===`error`,j=n||R.phase===`error`,M;t[86]===n?M=t[87]:(M=n?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(ee,{className:`mr-2 h-4 w-4`,"aria-hidden":`true`}),(0,O.jsx)(r,{id:`NKkZXl`})]}):(0,O.jsx)(r,{id:`NKkZXl`}),t[86]=n,t[87]=M);let N;t[88]!==x||t[89]!==A||t[90]!==j||t[91]!==M?(N=(0,O.jsx)(o,{onClick:x,disabled:A,"aria-disabled":j,"data-testid":`share-receive-consent-initialize`,children:M}),t[88]=x,t[89]=A,t[90]=j,t[91]=M,t[92]=N):N=t[92];let P;t[93]!==k||t[94]!==N?(P=(0,O.jsxs)(m,{children:[k,N]}),t[93]=k,t[94]=N,t[95]=P):P=t[95];let F;t[96]!==y||t[97]!==E||t[98]!==P?(F=(0,O.jsxs)(p,{className:`sm:max-w-xl`,"data-testid":`share-receive-consent-dialog`,onInteractOutside:oe,onPointerDownOutside:ae,children:[y,E,P]}),t[96]=y,t[97]=E,t[98]=P,t[99]=F):F=t[99];let se;t[100]!==i||t[101]!==F?(se=(0,O.jsx)(g,{open:!0,onOpenChange:i,children:F}),t[100]=i,t[101]=F,t[102]=se):se=t[102],K=se;break bb0}if(!B||!V||!e){K=null;break bb0}H=v!==void 0&&!I;let A;t[103]!==w||t[104]!==I?(A=w(I?{id:`YjhKI5`}:{id:`LE7t79`}),t[103]=w,t[104]=I,t[105]=A):A=t[105],Se=A,Ce=s(e)}t[15]=w,t[16]=F,t[17]=a,t[18]=v,t[19]=I,t[20]=R,t[21]=B,t[22]=D,t[23]=V,t[24]=b,t[25]=H,t[26]=Se,t[27]=U,t[28]=W,t[29]=G,t[30]=Ce,t[31]=K,t[32]=q}else H=t[25],Se=t[26],U=t[27],W=t[28],G=t[29],Ce=t[30],K=t[31],q=t[32];if(K!==Symbol.for(`react.early_return_sentinel`))return K;let we=Ce,Te=N?.authenticated?N.login:void 0,Ee;t[106]===L?Ee=t[107]:(Ee=L?.detail?_(L.detail):``,t[106]=L,t[107]=Ee);let De=Ee,J;t[108]===b?J=t[109]:(J=e=>{e||b.dismiss()},t[108]=b,t[109]=J);let Y;t[110]===q?Y=t[111]:(Y=(0,O.jsx)(f,{children:(0,O.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:q}})}),t[110]=q,t[111]=Y);let X;t[112]===V.target?X=t[113]:(X=u(V.target)?` — ${u(V.target)}`:null,t[112]=V.target,t[113]=X);let Z;t[114]!==V.owner||t[115]!==V.repo||t[116]!==X?(Z=(0,O.jsxs)(d,{className:`sr-only`,children:[V.owner,`/`,V.repo,X]}),t[114]=V.owner,t[115]=V.repo,t[116]=X,t[117]=Z):Z=t[117];let Oe=V.owner,ke=V.repo,Q;t[118]===V.target?Q=t[119]:(Q=u(V.target),t[118]=V.target,t[119]=Q);let Ae;t[120]!==V.branch||t[121]!==V.owner||t[122]!==V.repo||t[123]!==V.target.kind||t[124]!==Q?(Ae=(0,O.jsx)(ie,{owner:Oe,repo:ke,path:Q,kind:V.target.kind,branch:V.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[120]=V.branch,t[121]=V.owner,t[122]=V.repo,t[123]=V.target.kind,t[124]=Q,t[125]=Ae):Ae=t[125];let je;t[126]!==Y||t[127]!==Z||t[128]!==Ae?(je=(0,O.jsxs)(h,{children:[Y,Z,Ae]}),t[126]=Y,t[127]=Z,t[128]=Ae,t[129]=je):je=t[129];let Me;t[130]!==v||t[131]!==H||t[132]!==L||t[133]!==De||t[134]!==Se||t[135]!==I||t[136]!==U||t[137]!==W||t[138]!==D?(Me=L?(0,O.jsxs)(`div`,{ref:me,tabIndex:-1,className:`rounded-lg border border-destructive/40 bg-destructive/5 p-4 outline-none`,"data-testid":`share-receive-clone-error`,children:[(0,O.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,role:`alert`,children:(0,O.jsx)(r,{id:`aiArms`})}),De?(0,O.jsxs)(`p`,{className:`mt-2 break-words text-xs text-destructive`,"data-testid":`share-receive-clone-error-message`,children:[(0,O.jsx)(r,{id:`4BITzH`}),` `,(0,O.jsxs)(`span`,{className:`font-mono text-foreground/80`,children:[`"`,De,`"`]})]}):null,(0,O.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`Llyqvo`})}),(0,O.jsxs)(`ul`,{className:`mt-1 list-disc space-y-1 pl-5 text-sm text-muted-foreground`,"data-testid":`share-receive-clone-error-reasons`,children:[(0,O.jsx)(`li`,{children:(0,O.jsx)(r,{id:`6LbUG7`})}),(0,O.jsx)(`li`,{children:(0,O.jsx)(r,{id:`_pY_Vq`})}),(0,O.jsx)(`li`,{children:(0,O.jsx)(r,{id:`J6mxC1`})})]}),(0,O.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,O.jsx)(o,{onClick:()=>{U()},"data-testid":`share-receive-clone-retry`,children:(0,O.jsx)(r,{id:`KDw4GX`})}),(0,O.jsx)(o,{variant:`outline`,onClick:()=>{W()},disabled:D||I,"data-testid":`share-receive-error-local`,children:(0,O.jsx)(r,{id:`xFQRu4`})})]})]}):(0,O.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,O.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-clone`,className:`flex flex-col items-start gap-2 rounded-lg border border-primary/50 bg-primary/5 p-4 text-left transition hover:border-primary hover:bg-primary/10 focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-primary/50 disabled:hover:bg-primary/5`,onClick:()=>{U()},disabled:v!==void 0&&!H,"aria-disabled":v!==void 0&&!H,children:[(0,O.jsx)(`span`,{className:`text-sm font-semibold`,children:Se}),(0,O.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`fj5YiP`})})]}),(0,O.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-local`,className:`flex flex-col items-start gap-2 rounded-lg border border-border bg-card p-4 text-left transition hover:border-foreground/50 hover:bg-accent focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,onClick:()=>{W()},disabled:D||I,children:[(0,O.jsx)(`span`,{className:`text-sm font-semibold`,children:(0,O.jsx)(r,{id:`HfI1dR`})}),(0,O.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`_qD6mn`})})]})]}),t[130]=v,t[131]=H,t[132]=L,t[133]=De,t[134]=Se,t[135]=I,t[136]=U,t[137]=W,t[138]=D,t[139]=Me):Me=t[139];let Ne;t[140]!==F||t[141]!==N||t[142]!==v||t[143]!==G||t[144]!==Te?(Ne=v?(0,O.jsx)(`div`,{className:`mt-3 flex items-center justify-between rounded-md border border-border bg-muted/30 px-3 py-2 text-xs`,"data-testid":`share-receive-auth-banner`,role:`status`,"aria-live":`polite`,children:N===null?(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:(0,O.jsx)(r,{id:`UDFrWm`})}):N.authenticated?(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:(0,O.jsx)(r,{id:`VAHWL_`,values:{signedInLogin:Te},components:{0:(0,O.jsx)(`span`,{className:`font-medium text-foreground/90`})}})}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:(0,O.jsx)(r,{id:`SgKLfA`})}),(0,O.jsx)(`button`,{type:`button`,"data-testid":`share-receive-signin`,className:`font-medium text-primary underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded`,onClick:()=>{G()},disabled:F,children:F?(0,O.jsx)(r,{id:`PKLY-1`}):(0,O.jsx)(r,{id:`3jod3l`})})]})}):null,t[140]=F,t[141]=N,t[142]=v,t[143]=G,t[144]=Te,t[145]=Ne):Ne=t[145];let Pe;t[146]!==L||t[147]!==we?(Pe=L?null:(0,O.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`RJ3a8Z`,values:{lookingForUrl:we},components:{0:(0,O.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),t[146]=L,t[147]=we,t[148]=Pe):Pe=t[148];let Fe;t[149]!==Me||t[150]!==Ne||t[151]!==Pe?(Fe=(0,O.jsxs)(te,{children:[Me,Ne,Pe]}),t[149]=Me,t[150]=Ne,t[151]=Pe,t[152]=Fe):Fe=t[152];let Ie;t[153]===b?Ie=t[154]:(Ie=()=>b.dismiss(),t[153]=b,t[154]=Ie);let Le;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,O.jsx)(r,{id:`dEgA5A`}),t[155]=Le):Le=t[155];let Re;t[156]===Ie?Re=t[157]:(Re=(0,O.jsx)(m,{children:(0,O.jsx)(o,{variant:`outline`,onClick:Ie,children:Le})}),t[156]=Ie,t[157]=Re);let $;t[158]!==je||t[159]!==Fe||t[160]!==Re?($=(0,O.jsxs)(p,{className:`sm:max-w-xl`,"data-testid":`share-receive-dialog`,children:[je,Fe,Re]}),t[158]=je,t[159]=Fe,t[160]=Re,t[161]=$):$=t[161];let ze;return t[162]!==J||t[163]!==$?(ze=(0,O.jsx)(g,{open:!0,onOpenChange:J,children:$}),t[162]=J,t[163]=$,t[164]=ze):ze=t[164],ze}function ae(e){return e.preventDefault()}function oe(e){return e.preventDefault()}function se(e){return e===null?e:D(e)}function ce(e){return e===null?e:E(e,{ok:!0})}function le(e){return e===null?e:w(e)}export{M as ShareReceiveDialog};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-HKX9wT1K.js";import{In as s,zn as c}from"./dist-C-xa487z.js";import{n as l}from"./dist-CJhtNlOm2.js";import{t as u}from"./desktop-bridge-types-oYPdTDmz.js";import{t as ee}from"./spinner-Bp2_BYkl.js";import{a as d,c as f,i as p,n as te,o as m,s as h,t as g}from"./dialog-Cv_pRVgB.js";import{a as ne,i as _,n as v,o as y,r as re,s as b}from"./receive-store-mjPNDOwU.js";import{t as ie}from"./share-metadata-rows-iQiWNrX5.js";var x=e(n(),1),S=a(),C=e=>({phase:`ready`,seed:e});function w(e){return e.phase===`ready`?{phase:`initializing`,seed:e.seed}:e}function T(e,t){return e.phase===`initializing`?t.ok?{phase:`opening`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:t.reason,message:t.message}:e}function E(e,t){return e.phase===`opening`?t.ok?{phase:`done`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:`network-error`,message:t.message}:e}function D(e){return e.phase===`done`||e.phase===`cancelled`||e.phase===`error`?e:{phase:`cancelled`,seed:e.seed}}var O=t();function k(e){return{kind:e.target.kind,path:u(e.target),repositoryPath:u(e.repositoryTarget),...e.contentRootDepth===null?{}:{contentRootDepth:e.contentRootDepth}}}function A(e){return e!==null&&e.kind===`launcher-consent`}function j(e){return e!==null&&e.kind===`launcher-miss`}function M(e){let t=(0,S.c)(14),{bridge:n,cloneController:r,store:i}=e,a=i===void 0?v:i,o=(0,x.useSyncExternalStore)(a.subscribe,a.getSnapshot,P),[s,c]=(0,x.useState)(0),[u,ee]=(0,x.useState)(o);o!==u&&(ee(o),c(N));let d,f;t[0]!==o||t[1]!==a?(d=()=>{if(!o)return;let e=b(o);e&&(l.error(e.message),a.dismiss())},f=[o,a],t[0]=o,t[1]=a,t[2]=d,t[3]=f):(d=t[2],f=t[3]),(0,x.useEffect)(d,f);let p;t[4]===o?p=t[5]:(p=j(o)?o:null,t[4]=o,t[5]=p);let te=p,m;t[6]===o?m=t[7]:(m=A(o)?o:null,t[6]=o,t[7]=m);let h=m??te;if(!h)return null;let g;return t[8]!==h||t[9]!==n||t[10]!==r||t[11]!==s||t[12]!==a?(g=(0,O.jsx)(F,{payload:h,bridge:n,cloneController:r,store:a},s),t[8]=h,t[9]=n,t[10]=r,t[11]=s,t[12]=a,t[13]=g):g=t[13],g}function N(e){return e+1}function P(){return null}function F(e){let t=(0,S.c)(165),{payload:n,bridge:a,cloneController:v,store:b}=e,{_:w}=i(),[D,M]=(0,x.useState)(!1),[N,P]=(0,x.useState)(null),[F,ue]=(0,x.useState)(!1),[I,de]=(0,x.useState)(!1),[L,fe]=(0,x.useState)(null),[R,z]=(0,x.useState)(null),pe=(0,x.useRef)(!1),me=(0,x.useRef)(null),he,ge;t[0]===L?(he=t[1],ge=t[2]):(he=()=>{L&&me.current?.focus()},ge=[L],t[0]=L,t[1]=he,t[2]=ge),(0,x.useEffect)(he,ge);let _e;t[3]!==R||t[4]!==n?(_e=()=>{A(n)&&R===null&&(console.warn(`[receive] q1_hit=true selection=branch_match_non_ok candidate=${n.candidatePath}`),z(C({candidatePath:n.candidatePath,branch:n.share.branch,targetPath:u(n.share.target),targetKind:n.share.target.kind,repositoryPath:u(n.share.repositoryTarget),...n.share.contentRootDepth===null?{}:{contentRootDepth:n.share.contentRootDepth},parentProjectName:n.parentProjectName})))},t[3]=R,t[4]=n,t[5]=_e):_e=t[5];let ve;t[6]===n?ve=t[7]:(ve=[n],t[6]=n,t[7]=ve),(0,x.useEffect)(_e,ve);let ye;t[8]!==N||t[9]!==v||t[10]!==n?(ye=()=>{if(!v||!j(n)||N!==null||pe.current)return;pe.current=!0,ue(!0);let e=n.share.host;v.getAuthStatus(e).then(e=>{P(e)}).catch(t=>{console.warn(`[receive] auth pre-flight probe failed`,t instanceof Error?t.message:t),P({authenticated:!1,host:e})}).finally(()=>{ue(!1)})},t[8]=N,t[9]=v,t[10]=n,t[11]=ye):ye=t[11];let be;t[12]!==N||t[13]!==n?(be=[n,N],t[12]=N,t[13]=n,t[14]=be):be=t[14],(0,x.useEffect)(ye,be);let B=j(n)?n:null,xe=A(n)?n:null,V=B?.share??xe?.share??null,H,Se,U,W,G,Ce,K,q;if(t[15]!==w||t[16]!==F||t[17]!==a||t[18]!==v||t[19]!==I||t[20]!==R||t[21]!==B||t[22]!==D||t[23]!==V||t[24]!==b){K=Symbol.for(`react.early_return_sentinel`);bb0:{let e=V?{host:V.host,owner:V.owner,repo:V.repo}:null,n;t[33]!==w||t[34]!==V?.target.kind?(n=V?.target.kind===`folder`?w({id:`ugoTXs`}):w({id:`XH30C4`}),t[33]=w,t[34]=V?.target.kind,t[35]=n):n=t[35],q=n,U=async function(){if(!B||!e)return;if(console.log(ne({q2_path:`clone`})),!v){l.info(w({id:`27XW26`}),{action:{label:w({id:`B3NAZC`}),onClick:()=>{a.navigator.open()}},duration:8e3});return}if(I)return;fe(null),de(!0);let t=re(e),n;try{n=await v.runClone({url:t,branch:B.share.branch})}catch(e){let t=e;console.warn(`[receive] runClone threw unexpectedly`,t),de(!1),fe({detail:t instanceof Error?t.message:String(t)});return}if(de(!1),n.kind===`error`){fe({detail:n.detail??null});return}if(n.kind===`ok`){try{await a.project.open({path:n.dir,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:k(B.share)}),b.dismiss()}catch(e){let t=e;console.warn(`[receive] project open after clone failed`,t instanceof Error?t.message:t),l.error(w({id:`438Fca`}))}return}};let i;t[36]!==w||t[37]!==F||t[38]!==v?(i=async function(){if(!(!v||F)){ue(!0);try{let e=await v.startSignIn();ue(!1),e!==null&&P(e)}catch(e){let t=e;ue(!1),console.warn(`[receive] startSignIn failed`,t instanceof Error?t.message:t),l.error(w({id:`lzwo7p`}))}}},t[36]=w,t[37]=F,t[38]=v,t[39]=i):i=t[39],G=i,W=async function(){if(!(!B||!e||D)){fe(null),M(!0),console.log(ne({q2_path:`local`}));try{for(;;){let t=await a.dialog.openFolder();if(!t)break;let n=await a.share.validateLocalFolder({folderPath:t,host:e.host,owner:e.owner,repo:e.repo});if(console.log(ne({folder_validate:n.kind})),n.kind===`ok`){let e=B.share.branch,n={currentBranch:null,headSha:null,detached:!1};try{n=await a.project.readHeadBranch(t)}catch(e){let t=e;console.warn(`[receive] local-folder readHeadBranch failed`,t instanceof Error?t.message:t)}let r=c(e,n)!==`true`;try{await a.project.open({path:t,target:`new-window`,entryPoint:`share-receive`,...r?{pendingShareBranchSwitch:{share:B.share,projectPath:t,currentBranch:n.currentBranch}}:{pendingDeepLinkTarget:k(B.share)}}),b.dismiss()}catch(e){let t=e;console.warn(`[receive] local-folder-open failed`,t instanceof Error?t.message:t),l.error(w({id:`phM8Kh`}))}break}let r=y(n,e);r&&l.error(r)}}catch(e){let t=e;console.warn(`[receive] local-folder-validate failed`,t instanceof Error?t.message:t),l.error(w({id:`rlUzXK`}))}M(!1)}};let _;t[40]!==w||t[41]!==a||t[42]!==R||t[43]!==b?(_=function(){if(R===null||R.phase!==`ready`)return;let e=R.seed;console.warn(`[receive] consent_dialog action=initialize worktree=${e.candidatePath}`),z(le),a.project.okInit({projectPath:e.candidatePath}).then(async t=>{if(t.ok===!0){z(e=>e===null?e:T(e,{ok:!0,projectPath:t.projectPath}));try{await a.project.open({path:t.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:e.targetKind,path:e.targetPath,repositoryPath:e.repositoryPath??e.targetPath,...e.contentRootDepth===void 0?{}:{contentRootDepth:e.contentRootDepth}},pendingBranch:e.branch}),z(ce),b.dismiss()}catch(t){let n=t,r=n instanceof Error?n.message:String(n);z(e=>e===null?e:E(e,{ok:!1,message:r})),l.error(w({id:`nDT8qt`,values:{0:e.candidatePath}}))}return}let n=t.reason,r=t.message||`Initialization failed.`;z(e=>e===null?e:T(e,{ok:!1,reason:n,message:r})),l.error(r)}).catch(t=>{let n=t instanceof Error?t.message:String(t);z(e=>e===null?e:T(e,{ok:!1,reason:`network-error`,message:n})),l.error(w({id:`3Mwaly`,values:{0:e.candidatePath}}))})},t[40]=w,t[41]=a,t[42]=R,t[43]=b,t[44]=_):_=t[44];let x=_,S;t[45]!==R||t[46]!==b?(S=function(){R!==null&&console.warn(`[receive] consent_dialog action=cancel worktree=${R.seed.candidatePath}`),z(se),b.dismiss()},t[45]=R,t[46]=b,t[47]=S):S=t[47];let C=S;if(R!==null&&R.phase!==`cancelled`&&R.phase!==`done`&&V!==null){let e=R.seed,n=R.phase===`initializing`||R.phase===`opening`,i;t[48]===C?i=t[49]:(i=e=>{e||C()},t[48]=C,t[49]=i);let a;t[50]===q?a=t[51]:(a=(0,O.jsx)(f,{children:(0,O.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:q}})}),t[50]=q,t[51]=a);let s;t[52]===V.target?s=t[53]:(s=u(V.target)?`— ${u(V.target)}`:``,t[52]=V.target,t[53]=s);let c;t[54]!==V.owner||t[55]!==V.repo||t[56]!==s?(c=(0,O.jsx)(d,{className:`sr-only`,children:(0,O.jsx)(r,{id:`pgq_xf`,values:{0:V.owner,1:V.repo,2:s}})}),t[54]=V.owner,t[55]=V.repo,t[56]=s,t[57]=c):c=t[57];let l=V.owner,ne=V.repo,_;t[58]===V.target?_=t[59]:(_=u(V.target),t[58]=V.target,t[59]=_);let v;t[60]!==V.branch||t[61]!==V.owner||t[62]!==V.repo||t[63]!==V.target.kind||t[64]!==_?(v=(0,O.jsx)(ie,{owner:l,repo:ne,path:_,kind:V.target.kind,branch:V.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[60]=V.branch,t[61]=V.owner,t[62]=V.repo,t[63]=V.target.kind,t[64]=_,t[65]=v):v=t[65];let y;t[66]!==a||t[67]!==c||t[68]!==v?(y=(0,O.jsxs)(h,{children:[a,c,v]}),t[66]=a,t[67]=c,t[68]=v,t[69]=y):y=t[69];let re;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`KsAPaB`})}),t[70]=re):re=t[70];let b;t[71]===e.candidatePath?b=t[72]:(b=(0,O.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-receive-consent-path`,children:e.candidatePath}),t[71]=e.candidatePath,t[72]=b);let S;t[73]===e.parentProjectName?S=t[74]:(S=e.parentProjectName===null?null:(0,O.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,"data-testid":`share-receive-consent-parent`,children:(0,O.jsx)(r,{id:`JmfgFc`,values:{0:e.parentProjectName}})}),t[73]=e.parentProjectName,t[74]=S);let w;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,O.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`w7SsvI`})}),t[75]=w):w=t[75];let T;t[76]!==R.message||t[77]!==R.phase?(T=R.phase===`error`?(0,O.jsx)(`p`,{className:`mt-3 text-sm text-destructive`,"data-testid":`share-receive-consent-error`,role:`alert`,children:R.message}):null,t[76]=R.message,t[77]=R.phase,t[78]=T):T=t[78];let E;t[79]!==b||t[80]!==S||t[81]!==T?(E=(0,O.jsxs)(te,{children:[re,b,S,w,T]}),t[79]=b,t[80]=S,t[81]=T,t[82]=E):E=t[82];let D;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,O.jsx)(r,{id:`dEgA5A`}),t[83]=D):D=t[83];let k;t[84]===C?k=t[85]:(k=(0,O.jsx)(o,{variant:`ghost`,onClick:C,"data-testid":`share-receive-consent-cancel`,children:D}),t[84]=C,t[85]=k);let A=n||R.phase===`error`,j=n||R.phase===`error`,M;t[86]===n?M=t[87]:(M=n?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(ee,{className:`mr-2 h-4 w-4`,"aria-hidden":`true`}),(0,O.jsx)(r,{id:`NKkZXl`})]}):(0,O.jsx)(r,{id:`NKkZXl`}),t[86]=n,t[87]=M);let N;t[88]!==x||t[89]!==A||t[90]!==j||t[91]!==M?(N=(0,O.jsx)(o,{onClick:x,disabled:A,"aria-disabled":j,"data-testid":`share-receive-consent-initialize`,children:M}),t[88]=x,t[89]=A,t[90]=j,t[91]=M,t[92]=N):N=t[92];let P;t[93]!==k||t[94]!==N?(P=(0,O.jsxs)(m,{children:[k,N]}),t[93]=k,t[94]=N,t[95]=P):P=t[95];let F;t[96]!==y||t[97]!==E||t[98]!==P?(F=(0,O.jsxs)(p,{className:`sm:max-w-xl`,"data-testid":`share-receive-consent-dialog`,onInteractOutside:oe,onPointerDownOutside:ae,children:[y,E,P]}),t[96]=y,t[97]=E,t[98]=P,t[99]=F):F=t[99];let se;t[100]!==i||t[101]!==F?(se=(0,O.jsx)(g,{open:!0,onOpenChange:i,children:F}),t[100]=i,t[101]=F,t[102]=se):se=t[102],K=se;break bb0}if(!B||!V||!e){K=null;break bb0}H=v!==void 0&&!I;let A;t[103]!==w||t[104]!==I?(A=w(I?{id:`YjhKI5`}:{id:`LE7t79`}),t[103]=w,t[104]=I,t[105]=A):A=t[105],Se=A,Ce=s(e)}t[15]=w,t[16]=F,t[17]=a,t[18]=v,t[19]=I,t[20]=R,t[21]=B,t[22]=D,t[23]=V,t[24]=b,t[25]=H,t[26]=Se,t[27]=U,t[28]=W,t[29]=G,t[30]=Ce,t[31]=K,t[32]=q}else H=t[25],Se=t[26],U=t[27],W=t[28],G=t[29],Ce=t[30],K=t[31],q=t[32];if(K!==Symbol.for(`react.early_return_sentinel`))return K;let we=Ce,Te=N?.authenticated?N.login:void 0,Ee;t[106]===L?Ee=t[107]:(Ee=L?.detail?_(L.detail):``,t[106]=L,t[107]=Ee);let De=Ee,J;t[108]===b?J=t[109]:(J=e=>{e||b.dismiss()},t[108]=b,t[109]=J);let Y;t[110]===q?Y=t[111]:(Y=(0,O.jsx)(f,{children:(0,O.jsx)(r,{id:`RY6Bq1`,values:{targetNoun:q}})}),t[110]=q,t[111]=Y);let X;t[112]===V.target?X=t[113]:(X=u(V.target)?` — ${u(V.target)}`:null,t[112]=V.target,t[113]=X);let Z;t[114]!==V.owner||t[115]!==V.repo||t[116]!==X?(Z=(0,O.jsxs)(d,{className:`sr-only`,children:[V.owner,`/`,V.repo,X]}),t[114]=V.owner,t[115]=V.repo,t[116]=X,t[117]=Z):Z=t[117];let Oe=V.owner,ke=V.repo,Q;t[118]===V.target?Q=t[119]:(Q=u(V.target),t[118]=V.target,t[119]=Q);let Ae;t[120]!==V.branch||t[121]!==V.owner||t[122]!==V.repo||t[123]!==V.target.kind||t[124]!==Q?(Ae=(0,O.jsx)(ie,{owner:Oe,repo:ke,path:Q,kind:V.target.kind,branch:V.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[120]=V.branch,t[121]=V.owner,t[122]=V.repo,t[123]=V.target.kind,t[124]=Q,t[125]=Ae):Ae=t[125];let je;t[126]!==Y||t[127]!==Z||t[128]!==Ae?(je=(0,O.jsxs)(h,{children:[Y,Z,Ae]}),t[126]=Y,t[127]=Z,t[128]=Ae,t[129]=je):je=t[129];let Me;t[130]!==v||t[131]!==H||t[132]!==L||t[133]!==De||t[134]!==Se||t[135]!==I||t[136]!==U||t[137]!==W||t[138]!==D?(Me=L?(0,O.jsxs)(`div`,{ref:me,tabIndex:-1,className:`rounded-lg border border-destructive/40 bg-destructive/5 p-4 outline-none`,"data-testid":`share-receive-clone-error`,children:[(0,O.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,role:`alert`,children:(0,O.jsx)(r,{id:`aiArms`})}),De?(0,O.jsxs)(`p`,{className:`mt-2 break-words text-xs text-destructive`,"data-testid":`share-receive-clone-error-message`,children:[(0,O.jsx)(r,{id:`4BITzH`}),` `,(0,O.jsxs)(`span`,{className:`font-mono text-foreground/80`,children:[`"`,De,`"`]})]}):null,(0,O.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`Llyqvo`})}),(0,O.jsxs)(`ul`,{className:`mt-1 list-disc space-y-1 pl-5 text-sm text-muted-foreground`,"data-testid":`share-receive-clone-error-reasons`,children:[(0,O.jsx)(`li`,{children:(0,O.jsx)(r,{id:`6LbUG7`})}),(0,O.jsx)(`li`,{children:(0,O.jsx)(r,{id:`_pY_Vq`})}),(0,O.jsx)(`li`,{children:(0,O.jsx)(r,{id:`J6mxC1`})})]}),(0,O.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,O.jsx)(o,{onClick:()=>{U()},"data-testid":`share-receive-clone-retry`,children:(0,O.jsx)(r,{id:`KDw4GX`})}),(0,O.jsx)(o,{variant:`outline`,onClick:()=>{W()},disabled:D||I,"data-testid":`share-receive-error-local`,children:(0,O.jsx)(r,{id:`xFQRu4`})})]})]}):(0,O.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,O.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-clone`,className:`flex flex-col items-start gap-2 rounded-lg border border-primary/50 bg-primary/5 p-4 text-left transition hover:border-primary hover:bg-primary/10 focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-primary/50 disabled:hover:bg-primary/5`,onClick:()=>{U()},disabled:v!==void 0&&!H,"aria-disabled":v!==void 0&&!H,children:[(0,O.jsx)(`span`,{className:`text-sm font-semibold`,children:Se}),(0,O.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`fj5YiP`})})]}),(0,O.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-local`,className:`flex flex-col items-start gap-2 rounded-lg border border-border bg-card p-4 text-left transition hover:border-foreground/50 hover:bg-accent focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,onClick:()=>{W()},disabled:D||I,children:[(0,O.jsx)(`span`,{className:`text-sm font-semibold`,children:(0,O.jsx)(r,{id:`HfI1dR`})}),(0,O.jsx)(`span`,{className:`line-clamp-2 text-1sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`_qD6mn`})})]})]}),t[130]=v,t[131]=H,t[132]=L,t[133]=De,t[134]=Se,t[135]=I,t[136]=U,t[137]=W,t[138]=D,t[139]=Me):Me=t[139];let Ne;t[140]!==F||t[141]!==N||t[142]!==v||t[143]!==G||t[144]!==Te?(Ne=v?(0,O.jsx)(`div`,{className:`mt-3 flex items-center justify-between rounded-md border border-border bg-muted/30 px-3 py-2 text-xs`,"data-testid":`share-receive-auth-banner`,role:`status`,"aria-live":`polite`,children:N===null?(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:(0,O.jsx)(r,{id:`UDFrWm`})}):N.authenticated?(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:(0,O.jsx)(r,{id:`VAHWL_`,values:{signedInLogin:Te},components:{0:(0,O.jsx)(`span`,{className:`font-medium text-foreground/90`})}})}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:(0,O.jsx)(r,{id:`SgKLfA`})}),(0,O.jsx)(`button`,{type:`button`,"data-testid":`share-receive-signin`,className:`font-medium text-primary underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded`,onClick:()=>{G()},disabled:F,children:F?(0,O.jsx)(r,{id:`PKLY-1`}):(0,O.jsx)(r,{id:`3jod3l`})})]})}):null,t[140]=F,t[141]=N,t[142]=v,t[143]=G,t[144]=Te,t[145]=Ne):Ne=t[145];let Pe;t[146]!==L||t[147]!==we?(Pe=L?null:(0,O.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,O.jsx)(r,{id:`RJ3a8Z`,values:{lookingForUrl:we},components:{0:(0,O.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),t[146]=L,t[147]=we,t[148]=Pe):Pe=t[148];let Fe;t[149]!==Me||t[150]!==Ne||t[151]!==Pe?(Fe=(0,O.jsxs)(te,{children:[Me,Ne,Pe]}),t[149]=Me,t[150]=Ne,t[151]=Pe,t[152]=Fe):Fe=t[152];let Ie;t[153]===b?Ie=t[154]:(Ie=()=>b.dismiss(),t[153]=b,t[154]=Ie);let Le;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,O.jsx)(r,{id:`dEgA5A`}),t[155]=Le):Le=t[155];let Re;t[156]===Ie?Re=t[157]:(Re=(0,O.jsx)(m,{children:(0,O.jsx)(o,{variant:`outline`,onClick:Ie,children:Le})}),t[156]=Ie,t[157]=Re);let $;t[158]!==je||t[159]!==Fe||t[160]!==Re?($=(0,O.jsxs)(p,{className:`sm:max-w-xl`,"data-testid":`share-receive-dialog`,children:[je,Fe,Re]}),t[158]=je,t[159]=Fe,t[160]=Re,t[161]=$):$=t[161];let ze;return t[162]!==J||t[163]!==$?(ze=(0,O.jsx)(g,{open:!0,onOpenChange:J,children:$}),t[162]=J,t[163]=$,t[164]=ze):ze=t[164],ze}function ae(e){return e.preventDefault()}function oe(e){return e.preventDefault()}function se(e){return e===null?e:D(e)}function ce(e){return e===null?e:E(e,{ok:!0})}function le(e){return e===null?e:w(e)}export{M as ShareReceiveDialog};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{a as i,i as a,n as o,o as s,r as c}from"./pending-receive-nav-store-o2g0a-Bn.js";import{t as l}from"./miss-dialog-store-CNJRdTPE.js";import{f as u,p as d}from"./doc-paths-dCv8glmi.js";import{c as f,i as p,n as m,s as h,t as g}from"./dialog-Cv_pRVgB.js";var _=r(),v=e(n(),1),y=t();function b(e){let t=e.split(`/`).filter(Boolean);return t.length>0?t[t.length-1]:e}function x(){let e=(0,_.c)(2),t=(0,v.useSyncExternalStore)(l.subscribe,l.getSnapshot,S);if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=(0,y.jsx)(C,{nav:t},t.path),e[0]=t,e[1]=n),n}function S(){return null}function C(e){let t=(0,_.c)(28),{nav:n}=e,{state:r,refetch:v}=s(n),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=function(){l.dismiss()},t[0]=x):x=t[0];let S=x,C;t[1]===n.path?C=t[2]:(C=function(){window.location.hash=d(i(n.path)),S()},t[1]=n.path,t[2]=C);let w=C,T;t[3]===n?T=t[4]:(T=function(e){c.arm(o(n,e)),window.location.hash=n.kind===`folder`?d(e):u(e),S()},t[3]=n,t[4]=T);let E=T,D;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>{e||S()},t[5]=D):D=t[5];let O=r.phase,k=r.phase===`resolved`?r.resolution.verdict:void 0,A;t[6]===n.path?A=t[7]:(A=b(n.path),t[6]=n.path,t[7]=A);let j;t[8]===A?j=t[9]:(j=(0,y.jsx)(h,{children:(0,y.jsx)(f,{className:`truncate`,children:A})}),t[8]=A,t[9]=j);let M=r.phase===`pending`?`flex flex-col items-center justify-center gap-3 py-6 text-center text-sm text-muted-foreground`:`flex flex-col items-center justify-center gap-6 py-2 text-center`,N;t[10]!==n.path||t[11]!==E?(N=()=>E(n.path),t[10]=n.path,t[11]=E,t[12]=N):N=t[12];let P;t[13]!==w||t[14]!==n||t[15]!==E||t[16]!==v||t[17]!==r||t[18]!==N?(P=(0,y.jsx)(a,{nav:n,state:r,onBrowseFolder:w,onOpenRenamed:E,onEnableAutoSync:S,onSyncCompleted:v,onPullApplied:N}),t[13]=w,t[14]=n,t[15]=E,t[16]=v,t[17]=r,t[18]=N,t[19]=P):P=t[19];let F;t[20]!==P||t[21]!==M?(F=(0,y.jsx)(m,{className:M,children:P}),t[20]=P,t[21]=M,t[22]=F):F=t[22];let I;return t[23]!==r.phase||t[24]!==F||t[25]!==k||t[26]!==j?(I=(0,y.jsx)(g,{open:!0,onOpenChange:D,children:(0,y.jsxs)(p,{className:`sm:max-w-md`,"data-testid":`share-receive-miss-dialog`,"data-phase":O,"data-verdict":k,children:[j,F]})}),t[23]=r.phase,t[24]=F,t[25]=k,t[26]=j,t[27]=I):I=t[27],I}export{x as ShareReceiveMissDialog};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{a as i,i as a,n as o,o as s,r as c}from"./pending-receive-nav-store-CuH4lWq3.js";import{t as l}from"./miss-dialog-store-CNJRdTPE.js";import{f as u,p as d}from"./doc-paths-CiKYU4qz.js";import{c as f,i as p,n as m,s as h,t as g}from"./dialog-Cv_pRVgB.js";var _=r(),v=e(n(),1),y=t();function b(e){let t=e.split(`/`).filter(Boolean);return t.length>0?t[t.length-1]:e}function x(){let e=(0,_.c)(2),t=(0,v.useSyncExternalStore)(l.subscribe,l.getSnapshot,S);if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=(0,y.jsx)(C,{nav:t},t.path),e[0]=t,e[1]=n),n}function S(){return null}function C(e){let t=(0,_.c)(28),{nav:n}=e,{state:r,refetch:v}=s(n),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=function(){l.dismiss()},t[0]=x):x=t[0];let S=x,C;t[1]===n.path?C=t[2]:(C=function(){window.location.hash=d(i(n.path)),S()},t[1]=n.path,t[2]=C);let w=C,T;t[3]===n?T=t[4]:(T=function(e){c.arm(o(n,e)),window.location.hash=n.kind===`folder`?d(e):u(e),S()},t[3]=n,t[4]=T);let E=T,D;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>{e||S()},t[5]=D):D=t[5];let O=r.phase,k=r.phase===`resolved`?r.resolution.verdict:void 0,A;t[6]===n.path?A=t[7]:(A=b(n.path),t[6]=n.path,t[7]=A);let j;t[8]===A?j=t[9]:(j=(0,y.jsx)(h,{children:(0,y.jsx)(f,{className:`truncate`,children:A})}),t[8]=A,t[9]=j);let M=r.phase===`pending`?`flex flex-col items-center justify-center gap-3 py-6 text-center text-sm text-muted-foreground`:`flex flex-col items-center justify-center gap-6 py-2 text-center`,N;t[10]!==n.path||t[11]!==E?(N=()=>E(n.path),t[10]=n.path,t[11]=E,t[12]=N):N=t[12];let P;t[13]!==w||t[14]!==n||t[15]!==E||t[16]!==v||t[17]!==r||t[18]!==N?(P=(0,y.jsx)(a,{nav:n,state:r,onBrowseFolder:w,onOpenRenamed:E,onEnableAutoSync:S,onSyncCompleted:v,onPullApplied:N}),t[13]=w,t[14]=n,t[15]=E,t[16]=v,t[17]=r,t[18]=N,t[19]=P):P=t[19];let F;t[20]!==P||t[21]!==M?(F=(0,y.jsx)(m,{className:M,children:P}),t[20]=P,t[21]=M,t[22]=F):F=t[22];let I;return t[23]!==r.phase||t[24]!==F||t[25]!==k||t[26]!==j?(I=(0,y.jsx)(g,{open:!0,onOpenChange:D,children:(0,y.jsxs)(p,{className:`sm:max-w-md`,"data-testid":`share-receive-miss-dialog`,"data-phase":O,"data-verdict":k,children:[j,F]})}),t[23]=r.phase,t[24]=F,t[25]=k,t[26]=j,t[27]=I):I=t[27],I}export{x as ShareReceiveMissDialog};