pisper 0.6.25 → 0.6.26

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 (113) hide show
  1. package/package.json +6 -6
  2. package/web/.vite/manifest.json +573 -573
  3. package/web/assets/{AppDialog-CuxO26Km.js → AppDialog-B9y7rq_4.js} +1 -1
  4. package/web/assets/{AppOverlays-Bt5SL3PY.js → AppOverlays-CzdCHrpC.js} +1 -1
  5. package/web/assets/{AssetsPage-BE6AzOGC.js → AssetsPage-MzCklx_a.js} +1 -1
  6. package/web/assets/{BoardPage-DX0fJ_ap.js → BoardPage-CjQXbluj.js} +3 -3
  7. package/web/assets/{ChannelsPage-CyT7oDYZ.js → ChannelsPage-C6HqgnP7.js} +1 -1
  8. package/web/assets/{ChatAppearancePage-B6Dzj2Bj.js → ChatAppearancePage-BRlvWkJX.js} +1 -1
  9. package/web/assets/{ChatHistoryPage-Cq20l93c.js → ChatHistoryPage-D3jSE4oY.js} +1 -1
  10. package/web/assets/{ChatPage-DgiS-Qj_.js → ChatPage-BfG3KbJi.js} +3 -3
  11. package/web/assets/{ConfigPage-CgrWdzb5.js → ConfigPage-CshLFv2D.js} +1 -1
  12. package/web/assets/{DesktopWindowControls-D8axeuEx.js → DesktopWindowControls-BZu-eiS1.js} +1 -1
  13. package/web/assets/{FeaturePage-BB1TeMlr.js → FeaturePage-DD_32h19.js} +1 -1
  14. package/web/assets/{FileAttachmentPreview-DPjT_iYk.js → FileAttachmentPreview-DDX_cRzm.js} +1 -1
  15. package/web/assets/{FloatingWidgets-FI1S4hdn.js → FloatingWidgets-Dc4Lhl5d.js} +1 -1
  16. package/web/assets/{FocusRuntimeControls-CvAx-KDV.js → FocusRuntimeControls-CkYJXBrP.js} +1 -1
  17. package/web/assets/{GitDiffViewer-DwFfeFOA.js → GitDiffViewer-DeVUAwce.js} +1 -1
  18. package/web/assets/{ManageProjectsDialog-BSLNf6qD.js → ManageProjectsDialog-DPzESWUB.js} +1 -1
  19. package/web/assets/{MarkdownMessage-NK7Ixb4Y.js → MarkdownMessage-BfSy1Cg4.js} +1 -1
  20. package/web/assets/{McpPage-Cn-yDgC5.js → McpPage-CcJDe2nE.js} +1 -1
  21. package/web/assets/MemoryEvolution-Cwdreg5P.js +1 -0
  22. package/web/assets/{MemoryPage-ZwoG_oj6.js → MemoryPage-BkALQ2WN.js} +2 -2
  23. package/web/assets/{MobileNavigation-DK5a0kZU.js → MobileNavigation-C1mjjmqO.js} +1 -1
  24. package/web/assets/{MorePage-BL8nDnTQ.js → MorePage-C7kCRfpo.js} +1 -1
  25. package/web/assets/{NewFolderDialog-COkq83LW.js → NewFolderDialog-sqiEXqxJ.js} +1 -1
  26. package/web/assets/{PageHeader-BBTCMqXc.js → PageHeader-DDaW4Sdv.js} +1 -1
  27. package/web/assets/{PhoneDrawer-BcPKJWl-.js → PhoneDrawer-Be7C0xLf.js} +1 -1
  28. package/web/assets/{PhoneMenuButton-D6vdTZdF.js → PhoneMenuButton-1dPMDaRV.js} +1 -1
  29. package/web/assets/{PhoneTopBar-MqNeI69v.js → PhoneTopBar-BLXoPO6P.js} +1 -1
  30. package/web/assets/{PluginsPage-Bp71HpKD.js → PluginsPage-Bjp82DPO.js} +1 -1
  31. package/web/assets/{SafeModePrompt-CpvvU5wL.js → SafeModePrompt-D_OCmR6G.js} +1 -1
  32. package/web/assets/{SchedulesPage-Drs10rEV.js → SchedulesPage-DCOhjQ8W.js} +1 -1
  33. package/web/assets/{SessionBrowserPane-DjtB4MCI.js → SessionBrowserPane-Cvmqo12R.js} +2 -2
  34. package/web/assets/{SessionContextPanel-ETfnp4pT.js → SessionContextPanel-B9KtrMwl.js} +2 -2
  35. package/web/assets/{SessionHome-CHBw3ZvP.js → SessionHome-DMAZBF3M.js} +1 -1
  36. package/web/assets/{SessionInspector-DVaRflQy.js → SessionInspector-DfinUUs5.js} +1 -1
  37. package/web/assets/{SessionShell-CwfQAX7i.js → SessionShell-BxYZQh_O.js} +1 -1
  38. package/web/assets/{SettingsSidebar-FgC-tlY2.js → SettingsSidebar-DWXc-Z4_.js} +1 -1
  39. package/web/assets/{ShortcutHelpDialog-DKbIkUnk.js → ShortcutHelpDialog-QBYqmifG.js} +1 -1
  40. package/web/assets/{ShortcutKeys-BuHXNKVW.js → ShortcutKeys-B6hllpKE.js} +1 -1
  41. package/web/assets/{SidebarUpdateStatus-LKwNKESF.js → SidebarUpdateStatus-C-ebi4wI.js} +1 -1
  42. package/web/assets/{SkillsPage-BbnerW44.js → SkillsPage-CcNononn.js} +1 -1
  43. package/web/assets/{TaskProcessesPane-B2fyZEK9.js → TaskProcessesPane-D442bSux.js} +1 -1
  44. package/web/assets/{TaskTerminalView-CKApgF75.js → TaskTerminalView-B4fD3kVF.js} +1 -1
  45. package/web/assets/{TerminalPanel-D03WycYm.js → TerminalPanel-64E97AR4.js} +1 -1
  46. package/web/assets/{WebDesktopPet-K2dbcbnQ.js → WebDesktopPet-DUpnoJ1_.js} +1 -1
  47. package/web/assets/{WorkflowsPage-CmzftCtz.js → WorkflowsPage-Cj0mQmb3.js} +1 -1
  48. package/web/assets/{WorkspacePicker-DbdbTOV2.js → WorkspacePicker-_dbgAw5b.js} +1 -1
  49. package/web/assets/{api-BW_X0FMZ.js → api-_MWfl2VL.js} +1 -1
  50. package/web/assets/{app-update-DYFXTosD.js → app-update-CJSjwHEp.js} +1 -1
  51. package/web/assets/{approval-confirm-DQ5N_lJB.js → approval-confirm-D9j-l9WE.js} +1 -1
  52. package/web/assets/{board-projects-CrejrMrn.js → board-projects-BI5ssHIa.js} +1 -1
  53. package/web/assets/{bots-store-CNXTx3UY.js → bots-store-D8M80DQa.js} +1 -1
  54. package/web/assets/{chat-api-Bo6nhq40.js → chat-api-9V8j4rSS.js} +1 -1
  55. package/web/assets/{client-store-DzgOPMlh.js → client-store-xZC2AfqC.js} +1 -1
  56. package/web/assets/{config-search-BiQmWst4.js → config-search-VE6brXfx.js} +1 -1
  57. package/web/assets/{dialog-DFZX_Dek.js → dialog-BgFAhLng.js} +1 -1
  58. package/web/assets/{events-PfANjkHx.js → events-C96FsPEU.js} +1 -1
  59. package/web/assets/{focus-session-composer-bits-C_LOpJH_.js → focus-session-composer-bits-DJHZmmrf.js} +1 -1
  60. package/web/assets/{folder-paths-aRRH_MYq.js → folder-paths-BguW7FsR.js} +1 -1
  61. package/web/assets/{hosts-lvoPwC3T.js → hosts-D2X7ud3S.js} +1 -1
  62. package/web/assets/i18n-zKD1z9i9.js +1 -0
  63. package/web/assets/{index-D_zLThH_.js → index-CwdjZZLG.js} +2 -2
  64. package/web/assets/{memory-api-DkPje--t.js → memory-api-DilYLnpG.js} +1 -1
  65. package/web/assets/{mount-app-7pFSwVLO.js → mount-app-Dc-WeJ9N.js} +3 -3
  66. package/web/assets/{permission-rules-api-CAJsSBA5.js → permission-rules-api-CW4GK6hJ.js} +1 -1
  67. package/web/assets/{pick-system-directory-yk6L7wR2.js → pick-system-directory-UTgPstWX.js} +1 -1
  68. package/web/assets/{placements-CMrgmg3t.js → placements-Cw2TcTmd.js} +2 -2
  69. package/web/assets/{popover--q2hs_pT.js → popover-Cw7QFeII.js} +1 -1
  70. package/web/assets/{public-DkqrpWXx.js → public-4OSY9BE4.js} +2 -2
  71. package/web/assets/{public-DWbrDr0p.js → public-DaL-1TT_.js} +1 -1
  72. package/web/assets/{public-62LVX7HU.js → public-DdhGlwHC.js} +1 -1
  73. package/web/assets/{public-components-DHMvCgH2.js → public-components-C0KUBrxH.js} +1 -1
  74. package/web/assets/public-diff-ooK8-fn0.js +1 -0
  75. package/web/assets/public-events-ntCr-b1Y.js +1 -0
  76. package/web/assets/{public-flags-D9LdpQwJ.js → public-flags-D6y-DU98.js} +1 -1
  77. package/web/assets/{public-greeting-DEKYruJJ.js → public-greeting-JGqTdWhf.js} +1 -1
  78. package/web/assets/{public-session-B9UHA6rN.js → public-session-fPM64rB7.js} +1 -1
  79. package/web/assets/{public-sidebar-Lne86i_K.js → public-sidebar-CvLw1vam.js} +1 -1
  80. package/web/assets/{runtime-capabilities-store-BNM5Ug-5.js → runtime-capabilities-store-CWJvmV83.js} +1 -1
  81. package/web/assets/{safe-mode-instance-DnTP7EUr.js → safe-mode-instance-Dz4-ObZg.js} +1 -1
  82. package/web/assets/safe-mode-sentinel-Bg8pbnu-.js +1 -0
  83. package/web/assets/{session-change-summary-api-DMTwGz7o.js → session-change-summary-api-C3QE98fZ.js} +1 -1
  84. package/web/assets/{session-home-DUpZt2dn.js → session-home-CLGrhgld.js} +1 -1
  85. package/web/assets/{session-organization-api-BGyp66Uv.js → session-organization-api-B2UGOx0B.js} +1 -1
  86. package/web/assets/{session-scope-DZITSvZr.js → session-scope-okdygSiV.js} +1 -1
  87. package/web/assets/{session-tree-actions-CRWyFqAD.js → session-tree-actions-9m9DHqIx.js} +1 -1
  88. package/web/assets/{session-tree-summary-HTmAo_9V.js → session-tree-summary-u-RSxXXY.js} +1 -1
  89. package/web/assets/{shortcuts-D72gQCwH.js → shortcuts-CVPFuAiJ.js} +1 -1
  90. package/web/assets/{side-chat-context-D1hZOT7g.js → side-chat-context-By5GbAvl.js} +4 -4
  91. package/web/assets/{sidebar-sj8X80Y9.js → sidebar-BWHi3RGN.js} +1 -1
  92. package/web/assets/{sidebar-store-CXZ7QrOr.js → sidebar-store-CLA6EfOm.js} +1 -1
  93. package/web/assets/{speech-session-D2GQEOAL.js → speech-session-CFUz5f6J.js} +1 -1
  94. package/web/assets/{startup-queries-CuEXV1Zu.js → startup-queries-Xa-I9BT7.js} +1 -1
  95. package/web/assets/{use-i18n-_vdxObu5.js → use-i18n-CIheiCov.js} +1 -1
  96. package/web/assets/{use-open-bot-BTxzOAbZ.js → use-open-bot-zjJ_Tnfv.js} +1 -1
  97. package/web/assets/{use-studio-actions-CbMHRZpd.js → use-studio-actions-BiRUtcRX.js} +1 -1
  98. package/web/assets/{useCatalogProjects-BEkCpADy.js → useCatalogProjects-CbyrRuIn.js} +1 -1
  99. package/web/assets/{useNewProjectPicker-CUtLjwYE.js → useNewProjectPicker-6iK1xIT3.js} +2 -2
  100. package/web/assets/{useNow-eQeBCqQk.js → useNow-CE8ZJGxH.js} +1 -1
  101. package/web/assets/{usePhoneShell-DZHZWXnN.js → usePhoneShell-sWQz-gv8.js} +1 -1
  102. package/web/assets/{useSessionListQuery-BoUzmjZC.js → useSessionListQuery-K7Hh_V_2.js} +1 -1
  103. package/web/assets/{useSessionRowActions-DCqDrGZY.js → useSessionRowActions-Geuo0bzR.js} +1 -1
  104. package/web/assets/{useSidebarModel-CZAfH4Fa.js → useSidebarModel-BuyZjTgh.js} +1 -1
  105. package/web/assets/{web-preview-XrRFo42l.js → web-preview-0hEXH_IN.js} +1 -1
  106. package/web/assets/{web-preview-events-Ba6duwGi.js → web-preview-events-B5w8DSl2.js} +1 -1
  107. package/web/assets/{workspace-order-store-Ao4OZ13V.js → workspace-order-store-GwJH1aiS.js} +1 -1
  108. package/web/index.html +1 -1
  109. package/web/assets/MemoryEvolution-B8IeSLcd.js +0 -1
  110. package/web/assets/i18n-EVP8yIdy.js +0 -1
  111. package/web/assets/public-diff-WjbTu91T.js +0 -1
  112. package/web/assets/public-events-CTdTIu5Q.js +0 -1
  113. package/web/assets/safe-mode-sentinel-DOhqH4gj.js +0 -1
@@ -1,4 +1,4 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{l as t,m as n}from"./vendor-router-CSN_DGvx.js";import{t as r}from"./index-D_zLThH_.js";import{i,r as a}from"./vendor-react-DwNgTV1j.js";import{c as o,d as s,n as c}from"./i18n-EVP8yIdy.js";import{t as l}from"./use-i18n-_vdxObu5.js";import{a as u,l as d,t as f}from"./api-BW_X0FMZ.js";import{n as p}from"./runtime-capabilities-CHYOF_hE.js";import{t as m}from"./runtime-capabilities-store-BNM5Ug-5.js";import{n as h}from"./client-store-DzgOPMlh.js";import{t as g}from"./createLucideIcon-Cd-3GVxJ.js";import{a as _,i as v,t as y}from"./permission-rules-api-CAJsSBA5.js";import{t as b}from"./arrow-left-B8oVrQ2S.js";import{t as x}from"./arrow-right-DqLOhpA2.js";import{t as S}from"./arrow-up-right-B6l8qFZz.js";import{t as C}from"./bell-BjONAtgH.js";import{t as w}from"./bot-B3TaBp_T.js";import{t as T}from"./brain-qxhnKqYP.js";import{t as E}from"./check-2vYc6QaP.js";import{t as D}from"./chevron-down-CxtxIjiP.js";import{t as O}from"./chevron-left-BAtyp3_6.js";import{t as k}from"./circle-alert-DCChabnT.js";import{t as A}from"./circle-check-iEdCm3Pw.js";import{t as j}from"./code-xml-BrUXrBax.js";import{t as M}from"./copy-DHmIFc52.js";import{t as ee}from"./download-BCfIiuaL.js";import{t as N}from"./ellipsis-CfGKfbq6.js";import{t as P}from"./external-link-CEQqPcqc.js";import{i as te,o as ne,s as re}from"./settings-navigation-DiP_AM1C.js";import{t as ie}from"./image-BY_c3FYU.js";import{t as ae}from"./info-DATxy0fb.js";import{t as F}from"./loader-circle-BOwQzHB-.js";import{t as oe}from"./message-square-SKjZyY3v.js";import{t as se}from"./monitor-smartphone-B1gIjItA.js";import{n as I,r as ce,t as le}from"./zap-DZHw5afO.js";import{t as ue}from"./play-DNDjDNGn.js";import{t as de}from"./plus-fQbSqB1n.js";import{t as fe}from"./refresh-cw-TbWxTY4K.js";import{t as pe}from"./rocket-BgLSjoHY.js";import{t as me}from"./rotate-ccw-C0v8V77_.js";import{t as he}from"./search-D0mqDaf_.js";import{t as ge}from"./server-BgNvmqwJ.js";import{t as _e}from"./shield-check-Gvek4RJ7.js";import{t as ve}from"./sliders-horizontal-Dryf1XyC.js";import{t as ye}from"./sparkles-S_eeuqn9.js";import{t as be}from"./square-terminal-BVG6cUT1.js";import{t as xe}from"./trash-2-CNrPOoPR.js";import{t as Se}from"./triangle-alert-CE1q54ci.js";import{t as Ce}from"./wrench-6pg6_bqI.js";import{t as we}from"./x-07u4-129.js";import{t as Te}from"./brand-DIEc3fK8.js";import{a as Ee}from"./dist-41X0pdUs.js";import{c as De,i as Oe,o as ke,s as Ae}from"./dist-BsRXXcSL.js";import{t as je}from"./dist-DzGQ7sLi.js";import{i as Me,n as Ne,r as Pe,t as Fe}from"./accordion-CiJMkjqX.js";import{t as Ie}from"./dist-OB2r6Xsr.js";import{n as Le,r as Re,t as ze}from"./dist-BaBySQmo.js";import{c as Be,i as Ve,n as He,p as Ue,r as We,t as Ge}from"./dropdown-menu-Ds0gD8S8.js";import{i as Ke,n as qe,t as Je}from"./popover--q2hs_pT.js";import{a as Ye,i as Xe,n as Ze,r as Qe,t as $e}from"./select-Bbk9bmXO.js";import{t as et}from"./separator-BPh_qxvc.js";import{t as tt}from"./slider-De8rWVNs.js";import{t as nt}from"./switch-D_G8wFhs.js";import{t as L}from"./utils-C8uzG5AZ.js";import{n as R,r as rt,t as z}from"./button-CCcCN8tE.js";import{n as it,t as at}from"./kbd-CAufZTkl.js";import{i as ot,t as st}from"./config-search-BiQmWst4.js";import{_ as ct,c as lt,d as ut,f as dt,h as ft,l as pt,m as mt,o as ht,p as gt,t as _t,u as vt}from"./shortcuts-D72gQCwH.js";import{a as yt}from"./format-DMJQzoZ7.js";import{t as bt}from"./StatusGlyph-1KgitlUg.js";import{a as xt,i as St,l as Ct,o as wt,s as Tt,t as Et}from"./dialog-DFZX_Dek.js";import{t as B}from"./input-CPw-zkYh.js";import{t as Dt}from"./textarea-DmATpOqT.js";import{t as Ot}from"./model-display-kDwvtxrW.js";import{n as kt,r as At,t as jt}from"./PageState-Cz6vFMXv.js";import{t as Mt}from"./useOverlayFocusReturn-NkxBSSjb.js";import{i as V,n as H,o as U,r as Nt,s as Pt,t as W}from"./FeaturePage-BB1TeMlr.js";import{n as G}from"./field-DoLEb0np.js";import{t as Ft}from"./MarkdownMessage-NK7Ixb4Y.js";import{t as K}from"./AppSelect-DQYKUW5E.js";import{n as It}from"./public-flags-D9LdpQwJ.js";import{t as Lt}from"./badge-CWB3lj2H.js";import{a as Rt,i as zt,l as Bt,n as Vt,o as Ht,r as Ut,s as Wt,t as Gt}from"./app-primitives-Drz_SjnR.js";import{t as Kt}from"./BrandLogo-k3CvJjd4.js";import{n as qt,r as Jt,t as Yt}from"./collapsible-Dcoy-qnz.js";import{C as Xt,_ as Zt,a as Qt,c as $t,d as en,g as tn,i as nn,l as rn,o as an,p as on,r as sn,s as cn,v as ln,x as un,y as dn}from"./app-update-DYFXTosD.js";import{a as fn,n as pn,r as mn,t as hn}from"./ShortcutKeys-BuHXNKVW.js";import{i as gn,n as _n,r as vn,t as yn}from"./browser-notifications-DBS0oXqN.js";var bn=g(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),xn=g(`blend`,[[`circle`,{cx:`9`,cy:`9`,r:`7`,key:`p2h5vp`}],[`circle`,{cx:`15`,cy:`15`,r:`7`,key:`19ennj`}]]),Sn=g(`cat`,[[`path`,{d:`M12 5c.67 0 1.35.09 2 .26 1.78-2 5.03-2.84 6.42-2.26 1.4.58-.42 7-.42 7 .57 1.07 1 2.24 1 3.44C21 17.9 16.97 21 12 21s-9-3-9-7.56c0-1.25.5-2.4 1-3.44 0 0-1.89-6.42-.5-7 1.39-.58 4.72.23 6.5 2.23A9.04 9.04 0 0 1 12 5Z`,key:`x6xyqk`}],[`path`,{d:`M8 14v.5`,key:`1nzgdb`}],[`path`,{d:`M16 14v.5`,key:`1lajdz`}],[`path`,{d:`M11.25 16.25h1.5L12 17l-.75-.75Z`,key:`12kq1m`}]]),Cn=g(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),wn=g(`fold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3-3-3 3`,key:`e37ymu`}],[`path`,{d:`m15 5-3 3-3-3`,key:`19d6lf`}]]),Tn=g(`laptop`,[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]),En=g(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),Dn=g(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),On=g(`qr-code`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),kn=g(`radar`,[[`path`,{d:`M19.07 4.93A10 10 0 0 0 6.99 3.34`,key:`z3du51`}],[`path`,{d:`M4 6h.01`,key:`oypzma`}],[`path`,{d:`M2.29 9.62A10 10 0 1 0 21.31 8.35`,key:`qzzz0`}],[`path`,{d:`M16.24 7.76A6 6 0 1 0 8.23 16.67`,key:`1yjesh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M17.99 11.66A6 6 0 0 1 15.77 16.67`,key:`1u2y91`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`m13.41 10.59 5.66-5.66`,key:`mhq4k0`}]]),An=g(`scale`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`m19 8 3 8a5 5 0 0 1-6 0zV7`,key:`zcdpyk`}],[`path`,{d:`M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1`,key:`1yorad`}],[`path`,{d:`m5 8 3 8a5 5 0 0 1-6 0zV7`,key:`eua70x`}],[`path`,{d:`M7 21h10`,key:`1b0cd5`}]]),jn=g(`scan-line`,[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}]]),Mn=g(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),Nn=g(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),Pn=g(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),Fn=g(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),In=g(`unfold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3 3-3-3`,key:`11eu04`}],[`path`,{d:`m15 5-3-3-3 3`,key:`itvq4r`}]]),Ln=g(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),q=e(i(),1),J=a(),Rn=Object.defineProperty,Y=(e,t)=>Rn(e,`name`,{value:t,configurable:!0}),zn=`Radio`,[Bn,Vn]=Ae(zn),[Hn,Un]=Bn(zn);function Wn(e){let{__scopeRadio:t,checked:n=!1,children:r,disabled:i,form:a,name:o,onCheck:s,required:c,value:l=`on`,internal_do_not_use_render:u}=e,[d,f]=q.useState(null),[p,m]=q.useState(null),h=q.useRef(!1),[g,_]=q.useReducer(e=>e+1,0),v={checked:n,disabled:i,required:c,name:o,form:a,value:l,control:d,setControl:f,hasConsumerStoppedPropagationRef:h,userInteractionCount:g,onUserInteraction:_,isFormControl:!d||!!a||!!d.closest(`form`),bubbleInput:p,setBubbleInput:m,onCheck:Y(()=>s?.(),`onCheck`)};return(0,J.jsx)(Hn,{scope:t,...v,children:Yn(u)?u(v):r})}Y(Wn,`RadioProvider`);var Gn=`RadioTrigger`,Kn=q.forwardRef(Y(function({__scopeRadio:e,onClick:t,...n},r){let{checked:i,disabled:a,value:o,setControl:s,onCheck:c,hasConsumerStoppedPropagationRef:l,onUserInteraction:u,isFormControl:d,bubbleInput:f}=Un(Gn,e),p=Ee(r,s);return(0,J.jsx)(De.button,{type:`button`,role:`radio`,"aria-checked":i,"data-state":Xn(i),"data-disabled":a?``:void 0,disabled:a,value:o,...n,ref:p,onClick:ke(t,e=>{i||(u(),c()),f&&d&&(l.current=e.isPropagationStopped(),l.current||e.stopPropagation())})})},`RadioTrigger`)),qn=`RadioBubbleInput`,Jn=q.forwardRef(Y(function({__scopeRadio:e,onClick:t,...n},r){let{control:i,checked:a,required:o,disabled:s,name:c,value:l,form:u,bubbleInput:d,setBubbleInput:f,hasConsumerStoppedPropagationRef:p,userInteractionCount:m}=Un(qn,e),h=Ee(r,f),g=Ie(i),_=q.useRef(!1),v=q.useRef(a),y=q.useRef(m);q.useEffect(()=>{let e=d;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=m!==y.current;y.current=m;let i=v.current!==a;v.current=a;let o=!(r&&p.current);if(i&&n){_.current=!r;let t=new Event(`click`,{bubbles:o});n.call(e,a),e.dispatchEvent(t),_.current=!1}},[d,a,p,m]);let b=q.useRef(a);return(0,J.jsx)(De.input,{type:`radio`,"aria-hidden":!0,defaultChecked:b.current,required:o,disabled:s,name:c,value:l,form:u,...n,tabIndex:-1,ref:h,onClick:ke(t,e=>{_.current&&e.stopPropagation()}),style:{...n.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`RadioBubbleInput`));function Yn(e){return typeof e==`function`}Y(Yn,`isFunction`);function Xn(e){return e?`checked`:`unchecked`}Y(Xn,`getState`);var Zn=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],Qn=`RadioGroup`,[$n,er]=Ae(Qn,[Re,Vn]),tr=Re(),nr=Vn(),[rr,ir]=$n(Qn),ar=q.forwardRef(Y(function(e,t){let{__scopeRadioGroup:n,name:r,form:i,defaultValue:a,value:o,required:s=!1,disabled:c=!1,orientation:l,dir:u,loop:d=!0,onValueChange:f,...p}=e,m=tr(n),h=je(u),[g,_]=Oe({prop:o,defaultProp:a??null,onChange:f,caller:Qn}),[v,y]=q.useState(null),b=Ee(t,y),x=q.useRef(g);return q.useEffect(()=>{let e=i?v?.ownerDocument.getElementById(i):v?.closest(`form`);if(e instanceof HTMLFormElement){let t=Y(()=>_(x.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[v,i,_]),(0,J.jsx)(rr,{scope:n,name:r,form:i,required:s,disabled:c,value:g,onValueChange:_,children:(0,J.jsx)(Le,{asChild:!0,...m,orientation:l,dir:h,loop:d,children:(0,J.jsx)(De.div,{role:`radiogroup`,"aria-required":s,"aria-orientation":l,"data-disabled":c?``:void 0,dir:h,...p,ref:b})})})},`RadioGroup`)),or=`RadioGroupItemProvider`,sr=`RadioGroupItemTrigger`;function cr(e){let{__scopeRadioGroup:t,value:n,disabled:r,children:i,internal_do_not_use_render:a}=e,o=ir(or,t),s=nr(t),c=o.disabled||r;return(0,J.jsx)(Wn,{...s,checked:o.value===n,disabled:c,required:o.required,name:o.name,form:o.form,value:n,onCheck:()=>o.onValueChange(n),internal_do_not_use_render:a,children:i})}Y(cr,`RadioGroupItemProvider`);var lr=q.forwardRef(Y(function(e,t){let{__scopeRadioGroup:n,...r}=e,i=tr(n),a=nr(n),{checked:o,disabled:s}=Un(sr,a.__scopeRadio),c=q.useRef(null),l=Ee(t,c),u=q.useRef(!1);return q.useEffect(()=>{let e=Y(e=>{Zn.includes(e.key)&&(u.current=!0)},`handleKeyDown`),t=Y(()=>u.current=!1,`handleKeyUp`);return document.addEventListener(`keydown`,e),document.addEventListener(`keyup`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`keyup`,t)}},[]),(0,J.jsx)(ze,{asChild:!0,...i,focusable:!s,active:o,children:(0,J.jsx)(Kn,{...a,...r,ref:l,onKeyDown:ke(r.onKeyDown,e=>{e.key===`Enter`&&e.preventDefault()}),onFocus:ke(r.onFocus,()=>{u.current&&c.current?.click()})})})},`RadioGroupItemTrigger`)),ur=q.forwardRef(Y(function(e,t){let{__scopeRadioGroup:n,value:r,disabled:i,...a}=e;return(0,J.jsx)(cr,{__scopeRadioGroup:n,value:r,disabled:i,internal_do_not_use_render:({isFormControl:e})=>(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(lr,{...a,ref:t,__scopeRadioGroup:n}),e&&(0,J.jsx)(dr,{__scopeRadioGroup:n})]})})},`RadioGroupItem`)),dr=q.forwardRef(Y(function(e,t){let{__scopeRadioGroup:n,...r}=e,i=nr(n);return(0,J.jsx)(Jn,{...i,...r,ref:t})},`RadioGroupItemBubbleInput`));o.addResourceBundle(`zh-CN`,`labs`,{notice:`实验功能还在开发中,可能不稳定,也可能在之后的版本里调整或移除。每项单独开关,随时可以关掉;遇到问题请点「反馈」告诉我们。`,listTitle:`可试用的功能`,loading:`正在读取实验功能…`,loadFailed:`没能读取实验功能:{error}`,retry:`重试`,emptyTitle:`目前没有实验功能`,emptyDescription:`有新功能进入测试时,会出现在这里。`,"stage.experimental":`实验中`,"stage.preview":`即将毕业`,whenOffPrefix:`关掉后:`,feedback:`反馈`,toggleLabel:`开启或关闭“{name}”`,"saving.on":`正在开启…`,"saving.off":`正在关闭…`,enabledNow:`已开启,立即生效`,saveFailed:`没能保存:{error}。开关已恢复。`,"unavailable.runtime":`当前连接的 Runtime 不支持这个功能。升级那台机器上的 Pisper 后即可开启。`,openLinkFailed:`没能打开链接。`,"feature.bots.title":`Bots`,"feature.bots.description":`新建多个常驻的 Bot,在对话里交代事情;它们在自己的电脑上干活,改代码时用独立分支,改完交给你确认。`,"feature.bots.whenOff":`Bots 和它们的会话都不再显示;记录都保留,重新打开就回来。正在运行的任务会跑完。`}),o.addResourceBundle(`en-US`,`labs`,{notice:`Labs features are still in development. They may be unstable and may change or be removed in later versions. Each one has its own switch and can be turned off at any time; use Feedback to tell us about problems.`,listTitle:`Available to try`,loading:`Loading Labs features…`,loadFailed:`Couldn't load Labs features: {error}`,retry:`Retry`,emptyTitle:`No Labs features right now`,emptyDescription:`New features appear here when they enter testing.`,"stage.experimental":`Experimental`,"stage.preview":`Graduating soon`,whenOffPrefix:`When turned off: `,feedback:`Feedback`,toggleLabel:`Turn “{name}” on or off`,"saving.on":`Turning on…`,"saving.off":`Turning off…`,enabledNow:`On, effective immediately`,saveFailed:`Couldn't save: {error}. The switch was restored.`,"unavailable.runtime":`The connected Runtime doesn't support this feature. Update Pisper on that machine to turn it on.`,openLinkFailed:`Couldn't open the link.`,"feature.bots.title":`Bots`,"feature.bots.description":`Create several always-on Bots and tell them what to do in a chat. They work on their own computer, use a separate branch for code changes and hand the result to you to confirm.`,"feature.bots.whenOff":`Bots and their sessions are hidden everywhere; nothing is deleted, and turning it back on brings them back. Running tasks finish.`});function fr(e,t){if(typeof window>`u`||!window.__PISPER_MOBILE_APP__)return null;e.preventDefault();let n=window.__TAURI__?.core?.invoke??window.__TAURI_INTERNALS__?.invoke;return n?n(`mobile_open_external_url`,{url:t}):Promise.reject(Error(`移动端原生桥不可用。`))}var pr={bots:e=>({title:e(`labs:feature.bots.title`),description:e(`labs:feature.bots.description`),whenOff:e(`labs:feature.bots.whenOff`)})};function mr(e,t){return pr[t]?.(e)??{title:t,description:``,whenOff:``}}function hr(e,t){return e(t===`preview`?`labs:stage.preview`:`labs:stage.experimental`)}function gr({notify:e}){let{t}=l(),n=It(e=>e.features),r=It(e=>e.status),i=It(e=>e.error),a=It(e=>e.pending),o=It(e=>e.rowErrors),s=It(e=>e.load),c=It(e=>e.setEnabled),[u,d]=(0,q.useState)(()=>new Set);(0,q.useEffect)(()=>{s()},[s]);let f=async(e,t)=>{await c(e,t);let n=It.getState(),r=!n.rowErrors[e]&&n.features.some(n=>n.id===e&&n.enabled===t);d(n=>{let i=new Set(n);return r&&t?i.add(e):i.delete(e),i})},p=n=>{fr(n,n.currentTarget.href)?.catch(()=>e(t(`labs:openLinkFailed`),`error`))},m;return m=r===`loading`&&n.length===0?(0,J.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 py-6 text-sm text-content-muted`,children:[(0,J.jsx)(rt,{"aria-hidden":`true`}),t(`labs:loading`)]}):n.length===0?r===`error`?null:(0,J.jsx)(jt,{compact:!0,icon:re,title:t(`labs:emptyTitle`),description:t(`labs:emptyDescription`)}):(0,J.jsx)(H,{children:n.map(e=>{let n=mr(t,e.id),r=a[e.id]===!0,i=o[e.id];return(0,J.jsx)(V,{"data-beta-feature":e.id,"data-enabled":e.enabled,icon:(0,J.jsx)(re,{}),name:n.title,status:(0,J.jsx)(Lt,{variant:`outline`,children:hr(t,e.stage)}),description:n.description||void 0,actions:(0,J.jsxs)(`span`,{className:`flex items-center gap-2`,children:[r&&(0,J.jsxs)(`span`,{role:`status`,className:`flex items-center gap-1.5 text-xs text-content-muted`,children:[(0,J.jsx)(rt,{"aria-hidden":`true`}),e.enabled?t(`labs:saving.on`):t(`labs:saving.off`)]}),(0,J.jsx)(nt,{checked:e.enabled,disabled:r||!e.available,"aria-busy":r,"aria-label":t(`labs:toggleLabel`,{name:n.title}),onCheckedChange:t=>void f(e.id,t)})]}),detail:(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5 pb-3 text-xs leading-relaxed text-content-muted`,children:[n.whenOff&&(0,J.jsxs)(`p`,{children:[t(`labs:whenOffPrefix`),n.whenOff]}),e.feedbackUrl&&(0,J.jsxs)(`a`,{className:`inline-flex w-fit items-center gap-1 text-content-secondary underline decoration-stroke-strong underline-offset-3 hover:text-content`,href:e.feedbackUrl,target:`_blank`,rel:`noopener noreferrer`,"data-web-preview":`external`,onClick:p,children:[t(`labs:feedback`),(0,J.jsx)(P,{className:`size-3.5`,"aria-hidden":`true`})]}),!e.available&&(0,J.jsxs)(`p`,{className:`flex items-start gap-1.5 text-content-secondary`,children:[(0,J.jsx)(ae,{className:`mt-[3px] size-3.5 flex-none`,"aria-hidden":`true`}),t(`labs:unavailable.runtime`)]}),e.enabled&&u.has(e.id)&&!r&&(0,J.jsxs)(`p`,{role:`status`,className:`flex items-center gap-1.5 text-content-secondary`,children:[(0,J.jsx)(E,{className:`size-3.5 flex-none`,"aria-hidden":`true`}),t(`labs:enabledNow`)]}),i&&(0,J.jsx)(W,{className:`mt-1`,children:(0,J.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[t(`labs:saveFailed`,{error:i.message}),(0,J.jsx)(z,{size:`sm`,variant:`outline`,onClick:()=>void f(e.id,i.desired),children:t(`labs:retry`)})]})})]})},e.id)})}),(0,J.jsxs)(`div`,{"data-labs-settings":!0,className:`flex min-w-0 flex-col`,children:[(0,J.jsxs)(`p`,{role:`note`,className:`flex items-start gap-2 rounded-[var(--r-md)] bg-surface-subtle px-3 py-2.5 text-[13px] leading-relaxed text-content-secondary`,children:[(0,J.jsx)(re,{className:`mt-[3px] size-3.5 flex-none text-content-muted`,"aria-hidden":`true`}),t(`labs:notice`)]}),r===`error`&&(0,J.jsx)(W,{children:(0,J.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[t(`labs:loadFailed`,{error:i}),(0,J.jsx)(z,{size:`sm`,variant:`outline`,onClick:()=>void s(),children:t(`labs:retry`)})]})}),(0,J.jsx)(U,{title:t(`labs:listTitle`),count:n.length||void 0,children:m})]})}function _r({className:e,...t}){return(0,J.jsx)(Gt,{"data-settings-card":!0,className:L(`rounded-none border-x-0 border-t border-b-0 border-stroke-soft bg-transparent px-0`,e),...t})}var vr=Ht,yr=Bt;function br(e){return(0,J.jsx)(Wt,{density:`compact`,...e})}function xr({className:e,...t}){return(0,J.jsx)(`div`,{"data-settings-group":!0,className:L(`@container/card min-w-0 divide-y divide-stroke-soft border-y border-stroke-soft`,e),...t})}function Sr({label:e,help:t,htmlFor:n,labelId:r,helpId:i,children:a,className:o}){return(0,J.jsxs)(`div`,{className:L(`grid min-w-0 gap-1.5 py-2.5 @min-[480px]/card:grid-cols-[168px_minmax(0,1fr)] @min-[480px]/card:items-center @min-[480px]/card:gap-4`,o),children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`label`,{id:r,htmlFor:n,className:`text-sm font-medium text-content`,children:e}),t&&(0,J.jsx)(`p`,{id:i,className:`mt-0.5 text-xs text-content-muted`,children:t})]}),(0,J.jsx)(`div`,{className:`min-w-0 @min-[480px]/card:max-w-[460px]`,children:a})]})}var Cr=`0.6.23`,wr=`https://github.com/ling-kong-ran/pisper`,Tr=`${wr}/blob/release/LICENSE`;function Er({href:e,icon:t,label:n,value:r,onClick:i}){return(0,J.jsxs)(`a`,{className:`group grid min-h-14 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-3 py-2.5 text-left no-underline`,href:e,target:`_blank`,rel:`noopener noreferrer`,"data-web-preview":`external`,onClick:i,children:[(0,J.jsx)(`span`,{className:`grid size-7.5 place-items-center rounded-md border border-key-border bg-key text-content-muted shadow-key transition-colors group-hover:text-content`,children:(0,J.jsx)(t,{size:16,"aria-hidden":`true`})}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block text-sm font-medium text-content`,children:n}),(0,J.jsx)(`span`,{className:`mt-0.5 block truncate font-mono text-xs text-content-muted`,children:r})]}),(0,J.jsx)(P,{"aria-hidden":`true`,className:`text-content-muted transition-colors group-hover:text-content`,size:14})]})}function Dr({update:e,notify:t}){let{t:n}=l(),r=e.info?.version||Cr,i=e=>{fr(e,e.currentTarget.href)?.catch(()=>t(n(`config:aboutSettings.openLinkFailed`),`error`))};return(0,J.jsxs)(`div`,{className:`mx-auto flex w-full flex-col gap-6`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 rounded-[15px] shadow-raise`,children:(0,J.jsx)(Kt,{size:56})}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`h2`,{className:`text-[length:calc(var(--ui-font-size)*10/7)] leading-[1.3] font-semibold tracking-[-.015em] text-content`,children:`Pisper`}),(0,J.jsxs)(yr,{tone:`gray`,className:`font-mono`,children:[`v`,r]})]}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-content-muted`,children:n(`config:aboutSettings.description`)})]})]}),(0,J.jsxs)(`section`,{"data-config-card":`about-project`,children:[(0,J.jsx)(vr,{title:n(`config:aboutSettings.projectInformation`),className:`mb-3 text-[15px] leading-6 font-medium text-content`}),(0,J.jsxs)(xr,{children:[(0,J.jsx)(Er,{href:wr,icon:j,label:n(`config:aboutSettings.sourceCode`),value:`github.com/ling-kong-ran/pisper`,onClick:i}),(0,J.jsx)(Er,{href:Tr,icon:An,label:n(`config:aboutSettings.license`),value:`MIT License`,onClick:i})]})]}),(0,J.jsx)(_r,{className:`py-4`,"data-config-card":`about-support`,children:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4 max-[540px]:flex-col max-[540px]:items-stretch`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(vr,{title:n(`config:aboutSettings.supportPisper`)}),(0,J.jsx)(`p`,{className:`mt-0.5 max-w-[520px] text-xs leading-5 text-content-muted`,children:n(`config:aboutSettings.supportDescription`)})]}),(0,J.jsx)(z,{asChild:!0,className:`max-[650px]:h-11 max-[540px]:w-full`,children:(0,J.jsxs)(`a`,{href:wr,target:`_blank`,rel:`noopener noreferrer`,"data-web-preview":`external`,onClick:i,children:[(0,J.jsx)(Nn,{size:15}),n(`config:aboutSettings.starOnGitHub`)]})})]})}),(0,J.jsx)(`p`,{className:`text-center text-xs text-content-muted`,children:n(`config:aboutSettings.copyright`)})]})}function Or(e){window.dispatchEvent(new CustomEvent(`pisper:desktop-pet-changed`,{detail:e}))}function kr({notify:e,requestConfirm:t}){let{t:n}=l(),r=window.pisperDesktop,i=(0,q.useMemo)(()=>r?.getPetStatus?{getStatus:()=>r.getPetStatus(),setEnabled:e=>r.setPetEnabled(e),setOpacity:e=>r.setPetOpacity(e),search:e=>r.searchPets(e),install:e=>r.installPet(e),select:e=>r.selectPet(e),remove:e=>r.removePet(e),openCatalog:()=>void r.openPetdex?.()}:{getStatus:()=>f(`/api/desktop-pet`),setEnabled:e=>f(`/api/desktop-pet/enabled`,{method:`POST`,body:{enabled:e}}),setOpacity:e=>f(`/api/desktop-pet/opacity`,{method:`POST`,body:{opacity:e}}),search:e=>f(`/api/desktop-pet/catalog?query=${encodeURIComponent(e)}`),install:e=>f(`/api/desktop-pet/install`,{method:`POST`,body:{slug:e}}),select:e=>f(`/api/desktop-pet/select`,{method:`POST`,body:{slug:e}}),remove:e=>f(`/api/desktop-pet/${encodeURIComponent(e)}`,{method:`DELETE`}),openCatalog:()=>window.open(`https://petdex.dev`,`_blank`,`noopener,noreferrer`)},[r]),[a,o]=(0,q.useState)(null),[s,c]=(0,q.useState)(``),[u,d]=(0,q.useState)([]),[p,m]=(0,q.useState)(100),[h,g]=(0,q.useState)(``),[_,v]=(0,q.useState)(``),y=(0,q.useCallback)(e=>{o(e),m(Math.round((e.opacity??1)*100))},[]),b=(0,q.useCallback)(async()=>{try{v(``),y(await i.getStatus())}catch(e){v(e instanceof Error?e.message:String(e))}},[y,i]),x=(0,q.useCallback)(async()=>{g(`search`);try{v(``),d(await i.search(s))}catch(e){v(e instanceof Error?e.message:String(e))}finally{g(``)}},[i,s]);(0,q.useEffect)(()=>{b(),i.search(``).then(d).catch(()=>{})},[i,b]);let S=async t=>{let r=a;o(e=>e&&{...e,enabled:t,running:!!(t&&e.installed.length)}),g(`toggle`);try{v(``);let r=await i.setEnabled(t);y(r),Or(r),e(n(t?`config:desktopPetSettings.petEnabled`:`config:desktopPetSettings.petDisabled`))}catch(e){o(r),v(e instanceof Error?e.message:String(e))}finally{g(``)}},C=async e=>{g(`opacity`);try{v(``);let t=await i.setOpacity(e);y(t),Or(t)}catch(e){m(Math.round((a?.opacity??1)*100)),v(e instanceof Error?e.message:String(e))}finally{g(``)}},w=async(t=s)=>{if(t.trim()){g(`install`);try{v(``);let r=await i.install(t);y(r),Or(r),e(n(`config:desktopPetSettings.petInstalled`,{name:r.selectedName||t}))}catch(e){v(e instanceof Error?e.message:String(e))}finally{g(``)}}},T=async t=>{if(t!==a?.selectedSlug){g(`select:${t}`);try{v(``);let r=await i.select(t);y(r),Or(r),e(n(`config:desktopPetSettings.petSelected`,{name:r.selectedName||t}))}catch(e){v(e instanceof Error?e.message:String(e))}finally{g(``)}}},D=async r=>{if(await t({title:n(`config:desktopPetSettings.deleteTitle`),message:n(`config:desktopPetSettings.deleteConfirm`,{name:r.name}),confirmLabel:n(`config:desktopPetSettings.delete`),tone:`danger`})){g(`remove:${r.slug}`);try{v(``);let t=await i.remove(r.slug);y(t),Or(t),e(n(`config:desktopPetSettings.petRemoved`,{name:r.name}))}catch(e){v(e instanceof Error?e.message:String(e))}finally{g(``)}}};return(0,J.jsxs)(J.Fragment,{children:[_&&(0,J.jsx)(W,{children:_}),(0,J.jsx)(U,{title:n(`config:desktopPetSettings.displayTitle`),"data-config-card":`desktop-pet-settings`,children:a?(0,J.jsxs)(H,{children:[(0,J.jsx)(V,{icon:(0,J.jsx)(Sn,{}),name:n(`config:desktopPetSettings.showOnDesktop`),description:a.selectedName?n(`config:desktopPetSettings.currentPet`,{name:a.selectedName}):n(`config:desktopPetSettings.installBeforeEnabling`),status:(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[a.running&&(0,J.jsx)(bt,{status:`done`,className:`size-3.5`}),a.running?n(`config:desktopPetSettings.running`):n(`config:desktopPetSettings.stopped`)]}),actions:(0,J.jsx)(nt,{checked:a.enabled,disabled:!!h||!a.installed.length,onCheckedChange:e=>void S(e),"aria-label":n(`config:desktopPetSettings.showOnDesktop`)})}),(0,J.jsx)(V,{icon:(0,J.jsx)(xn,{}),name:n(`config:desktopPetSettings.opacity`),nameMeta:`${p}%`,actions:(0,J.jsx)(tt,{value:[p],min:20,max:100,step:5,disabled:h===`opacity`,onValueChange:([e])=>m(e),onValueCommit:([e])=>void C(e/100),"aria-label":n(`config:desktopPetSettings.opacity`),className:`w-44 max-w-full max-[650px]:w-32`})})]}):(0,J.jsx)(kt,{kind:`loading`,title:n(`config:desktopPetSettings.loading`)})}),(0,J.jsxs)(U,{title:n(`config:desktopPetSettings.installTitle`),"data-config-card":`desktop-pet-install`,description:n(`config:desktopPetSettings.installDescription`),actions:(0,J.jsxs)(z,{variant:`ghost`,size:`sm`,onClick:i.openCatalog,children:[(0,J.jsx)(P,{}),n(`config:desktopPetSettings.browsePetdex`)]}),children:[(0,J.jsxs)(`div`,{className:`mb-3 flex gap-2`,children:[(0,J.jsx)(B,{value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&x()},placeholder:n(`config:desktopPetSettings.searchPlaceholder`),"aria-label":n(`config:desktopPetSettings.petSlug`),className:`h-9 min-w-0 flex-1 font-mono pointer-coarse:min-h-11 max-[650px]:min-h-11`}),(0,J.jsxs)(z,{variant:`secondary`,className:`h-9 shrink-0 pointer-coarse:h-11 max-[650px]:h-11`,disabled:h===`search`,onClick:x,children:[h===`search`?(0,J.jsx)(R,{className:`text-current`}):(0,J.jsx)(he,{}),n(`config:desktopPetSettings.search`)]})]}),u.length>0&&(0,J.jsx)(H,{children:u.map(e=>{let t=a?.installed.some(t=>t.slug===e.slug);return(0,J.jsx)(V,{"data-pet-catalog":e.slug,icon:(0,J.jsx)(Sn,{}),name:e.displayName,nameMeta:e.slug,status:t?n(`config:desktopPetSettings.installed`):void 0,actions:(0,J.jsxs)(z,{size:`sm`,variant:t?`ghost`:`secondary`,disabled:!!h||t&&e.slug===a?.selectedSlug,"aria-label":`${n(t?`config:desktopPetSettings.use`:`config:desktopPetSettings.install`)}: ${e.displayName}`,onClick:()=>void(t?T(e.slug):w(e.slug)),children:[t?(0,J.jsx)(E,{}):(0,J.jsx)(ee,{}),n(t?`config:desktopPetSettings.use`:`config:desktopPetSettings.install`)]})},e.slug)})})]}),a&&a.installed.length>0&&(0,J.jsx)(U,{title:n(`config:desktopPetSettings.installedTitle`),count:a.installed.length,"data-config-card":`desktop-pet-installed`,description:n(`config:desktopPetSettings.installedDescription`),children:(0,J.jsx)(H,{children:a.installed.map(e=>{let t=e.slug===a.selectedSlug;return(0,J.jsx)(V,{"data-pet-installed":e.slug,"data-selected":t||void 0,className:L(`relative`,t&&`after:absolute after:inset-y-3 after:-left-3 after:w-[3px] after:rounded-full after:bg-star`),icon:(0,J.jsx)(Sn,{}),name:e.name,nameMeta:`${e.slug} · ${e.source===`pisper`?`Pisper`:`Petdex`}`,status:t?(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,J.jsx)(bt,{status:`done`,className:`size-3.5`}),n(`config:desktopPetSettings.inUse`)]}):void 0,actions:(0,J.jsxs)(J.Fragment,{children:[!t&&(0,J.jsx)(z,{size:`sm`,variant:`ghost`,disabled:!!h,"aria-label":`${n(`config:desktopPetSettings.use`)}: ${e.name}`,onClick:()=>void T(e.slug),children:n(`config:desktopPetSettings.use`)}),e.source===`pisper`&&(0,J.jsx)(z,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`hover:bg-danger-soft hover:text-danger max-[650px]:size-11 pointer-coarse:size-11`,disabled:!!h,onClick:()=>void D(e),"aria-label":`${n(`config:desktopPetSettings.delete`)}: ${e.name}`,title:n(`config:desktopPetSettings.delete`),children:h===`remove:${e.slug}`?(0,J.jsx)(R,{className:`text-current`}):(0,J.jsx)(xe,{})})]})},`${e.source}:${e.slug}`)})})})]})}function X(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}function Ar(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}var jr,Z,Mr,Nr,Pr=`__TAURI_TO_IPC_KEY__`;function Fr(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}var Ir=class{constructor(e){jr.set(this,void 0),Z.set(this,0),Mr.set(this,[]),Nr.set(this,void 0),Ar(this,jr,e||(()=>{}),`f`),this.id=Fr(e=>{let t=e.index;if(`end`in e){t==X(this,Z,`f`)?this.cleanupCallback():Ar(this,Nr,t,`f`);return}let n=e.message;if(t==X(this,Z,`f`)){for(X(this,jr,`f`).call(this,n),Ar(this,Z,X(this,Z,`f`)+1,`f`);X(this,Z,`f`)in X(this,Mr,`f`);){let e=X(this,Mr,`f`)[X(this,Z,`f`)];X(this,jr,`f`).call(this,e),delete X(this,Mr,`f`)[X(this,Z,`f`)],Ar(this,Z,X(this,Z,`f`)+1,`f`)}X(this,Z,`f`)===X(this,Nr,`f`)&&this.cleanupCallback()}else X(this,Mr,`f`)[t]=n})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(e){Ar(this,jr,e,`f`)}get onmessage(){return X(this,jr,`f`)}[(jr=new WeakMap,Z=new WeakMap,Mr=new WeakMap,Nr=new WeakMap,Pr)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[Pr]()}};function Lr(e,t){let n=window.__TAURI__?.core?.invoke??window.__TAURI_INTERNALS__?.invoke;return n?n(e,t):Promise.reject(Error(`native bridge unavailable`))}function Rr(e,t){return Lr(`plugin:barcode-scanner|${e}`,t)}function zr(e){return e instanceof Error?e.message:String(e)}function Br(e){return/cancel(?:led|ed)/i.test(zr(e))}function Vr(){return new Promise(e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))})}function Hr(e){return Array.isArray(e)?new TextDecoder().decode(Uint8Array.from(e)):``}function Ur(e){if(!e.isActive||!e.port)return null;let t=Hr(e.txt.fp);if(!/^SHA256:[0-9A-F]{64}$/i.test(t))return null;let n=e.addresses.find(e=>/^\d{1,3}(?:\.\d{1,3}){3}$/.test(e))||e.addresses.find(e=>e.includes(`:`));if(!n)return null;let r=n.includes(`:`)?`[${n}]`:n,i=Hr(e.txt.name)||e.name||`Pisper Desktop`,a=`https://${r}:${e.port}`;return{id:`${e.fullName}:${a}`,name:i,url:a,fingerprint:t}}function Wr(e){return new Promise(t=>window.setTimeout(t,e))}function Gr({open:e,onOpenChange:t}){let{t:n}=l(),r=Mt(e),[i,a]=(0,q.useState)(null),[o,s]=(0,q.useState)(!1),[c,u]=(0,q.useState)([]),[d,f]=(0,q.useState)(!1),[p,m]=(0,q.useState)(``),[h,g]=(0,q.useState)(``),[_,v]=(0,q.useState)(``),y=(0,q.useRef)(!1),x=(0,q.useRef)(!1),S=(0,q.useRef)(!1),C=(0,q.useRef)(0),w=(0,q.useRef)(``),T=(0,q.useCallback)(e=>{y.current=e,s(e)},[]),E=(0,q.useCallback)(async()=>{x.current=!0,y.current&&await Rr(`cancel`).catch(()=>void 0),T(!1),a(null)},[T]);(0,q.useEffect)(()=>{if(!o)return;let e=document.getElementById(`root`),t=[],n=(e,n,r)=>{e&&(t.push({element:e,property:n,value:e.style.getPropertyValue(n),priority:e.style.getPropertyPriority(n)}),e.style.setProperty(n,r,`important`))};return n(document.documentElement,`background`,`transparent`),n(document.body,`background`,`transparent`),n(e,`background`,`transparent`),n(e,`visibility`,`hidden`),()=>{for(let{element:e,property:n,value:r,priority:i}of t.reverse())r?e.style.setProperty(n,r,i):e.style.removeProperty(n)}},[o]),(0,q.useEffect)(()=>{if(!o)return;let e=`pisper-scanner-${Date.now()}`;window.history.pushState({...window.history.state,pisperScanner:e},``);let t=()=>void E();return window.addEventListener(`popstate`,t),()=>{window.removeEventListener(`popstate`,t),!S.current&&window.history.state?.pisperScanner===e&&window.history.back()}},[E,o]);let D=e=>{if(!e.proxyUrl)throw Error(n(`config:mobileServer.pairFailed`));window.location.replace(e.proxyUrl)},O=(0,q.useCallback)(async()=>{let e=++C.current;f(!0),m(``),u([]);let t=new Ir;t.onmessage=t=>{if(C.current!==e)return;if(t.reason===`permission-denied`){m(n(`config:mobileServer.localNetworkDenied`));return}if(t.reason?.startsWith(`error:`)){m(n(`config:mobileServer.discoveryFailed`));return}if(!t.service)return;if(!t.service.isActive){u(e=>e.filter(e=>!e.id.startsWith(`${t.service?.fullName}:`)));return}let r=Ur(t.service);r&&u(e=>[...e.filter(e=>e.fingerprint!==r.fingerprint),r])};let r=null;try{await Lr(`mobile_ensure_local_network_permission`),r=(await Lr(`plugin:dns-sd|browse_start`,{options:{service:{type:`pisper`,protocol:`tcp`,domain:`local`},timeoutMs:4e3},channel:t})).browseId,await Wr(4300)}catch(t){C.current===e&&m(zr(t).includes(`local_network_permission_denied`)?n(`config:mobileServer.localNetworkDenied`):n(`config:mobileServer.discoveryFailed`))}finally{r!==null&&await Lr(`plugin:dns-sd|browse_stop`,{browseId:r}).catch(()=>void 0),C.current===e&&f(!1)}},[n]);(0,q.useEffect)(()=>{if(!(!e||o))return O(),()=>{C.current+=1}},[O,e,o]);let k=(0,q.useCallback)(async()=>{let e=w.current;w.current=``,e&&await Lr(`mobile_cancel_lan_pairing`,{operationId:e}).catch(()=>void 0),a(null),g(``)},[]),A=async e=>{let t=globalThis.crypto?.randomUUID?.()||`lan-${Date.now()}-${Math.random().toString(16).slice(2)}`;w.current=t,a(`lan:${e.id}`),v(``),g(n(`config:mobileServer.awaitingApproval`,{name:e.name}));try{let n=await Lr(`mobile_pair_lan`,{operationId:t,name:e.name,url:e.url,fingerprint:e.fingerprint,deviceName:null});if(w.current!==t)return;D(n)}catch(e){w.current===t&&v(zr(e))}finally{w.current===t&&(w.current=``,a(null),g(``))}},j=async()=>{x.current=!1,S.current=!1,a(`scan`),v(``);try{let e=await Rr(`check_permissions`);if(e.camera!==`granted`&&(e=await Rr(`request_permissions`)),e.camera!==`granted`)throw Error(n(`config:mobileServer.cameraDenied`));if(x.current||(T(!0),await Vr(),x.current))return;let t=await Rr(`scan`,{windowed:!0,formats:[]});if(!t.content)throw Error(n(`config:mobileServer.scanFailed`));S.current=!0,D(await Lr(`mobile_pair`,{payloadJson:t.content,deviceName:null}))}catch(e){!x.current&&!Br(e)&&v(zr(e))}finally{T(!1),a(null),x.current=!1}};return(0,J.jsx)(Et,{open:e,onOpenChange:e=>{if(!e&&o){E();return}if(!e&&i?.startsWith(`lan:`)){k(),t(!1);return}i||(e||v(``),t(e))},children:(0,J.jsx)(St,{showCloseButton:!o,overlayClassName:o?`bg-transparent supports-backdrop-filter:backdrop-blur-none`:void 0,className:o?`inset-0 top-0 left-0 h-dvh max-h-none w-screen max-w-none translate-x-0 translate-y-0 gap-0 overflow-hidden rounded-none bg-transparent p-0 text-white ring-0 sm:max-w-none`:`sm:max-w-md`,onPointerDownOutside:o?e=>e.preventDefault():void 0,onCloseAutoFocus:r,children:o?(0,J.jsxs)(`div`,{className:`flex h-dvh w-screen flex-col overflow-hidden`,children:[(0,J.jsxs)(Tt,{className:`sr-only`,children:[(0,J.jsx)(Ct,{children:n(`config:mobileServer.scanTitle`)}),(0,J.jsx)(xt,{children:n(`config:mobileServer.scanHint`)})]}),(0,J.jsxs)(`header`,{className:`flex min-h-16 items-center justify-between gap-3 bg-black/60 px-4 pb-3`,style:{paddingTop:`max(env(safe-area-inset-top), 0.75rem)`},children:[(0,J.jsxs)(z,{variant:`ghost`,className:`h-10 bg-black/40 px-3 text-white hover:bg-black/70 hover:text-white`,onClick:()=>void E(),children:[(0,J.jsx)(b,{}),n(`config:mobileServer.cancelScan`)]}),(0,J.jsx)(`div`,{className:`min-w-0 truncate text-sm font-medium`,children:n(`config:mobileServer.scanTitle`)}),(0,J.jsx)(`div`,{className:`w-[88px]`,"aria-hidden":`true`})]}),(0,J.jsx)(`main`,{className:`grid min-h-0 flex-1 place-items-center p-6`,children:(0,J.jsx)(`div`,{className:`relative aspect-square w-[min(72vw,20rem)] rounded-md border-2 border-white/90 shadow-[0_0_0_9999px_rgba(0,0,0,0.18)]`,children:(0,J.jsx)(jn,{className:`absolute top-1/2 left-1/2 size-10 -translate-x-1/2 -translate-y-1/2 text-white/75`})})}),(0,J.jsxs)(`footer`,{className:`flex flex-col items-center gap-3 bg-black/60 px-5 pt-4 text-center`,style:{paddingBottom:`max(env(safe-area-inset-bottom), 1rem)`},children:[(0,J.jsx)(`p`,{className:`max-w-sm text-sm leading-relaxed text-white/90`,children:n(`config:mobileServer.scanHint`)}),(0,J.jsx)(z,{variant:`outline`,className:`w-full max-w-sm border-white/50 bg-black/30 text-white hover:bg-black/60 hover:text-white`,onClick:()=>void E(),children:n(`config:mobileServer.cancelScan`)})]})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(Tt,{children:[(0,J.jsx)(Ct,{children:n(`config:mobileServer.addServer`)}),(0,J.jsx)(xt,{children:n(`config:mobileServer.discoverDescription`)})]}),(0,J.jsxs)(`section`,{className:`grid gap-2`,"aria-live":`polite`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,J.jsx)(kn,{className:`size-4`}),n(`config:mobileServer.nearby`)]}),(0,J.jsx)(z,{size:`icon-sm`,variant:`ghost`,disabled:d||i!==null,className:`pointer-coarse:size-11`,"aria-label":n(`config:mobileServer.rediscover`),onClick:()=>void O(),children:(0,J.jsx)(fe,{className:d?`animate-spin`:void 0})})]}),c.length?(0,J.jsx)(`ul`,{className:`m-0 grid max-h-44 list-none divide-y divide-stroke-soft overflow-y-auto border-y border-stroke-soft p-0`,children:c.map(e=>{let t=i===`lan:${e.id}`;return(0,J.jsxs)(`li`,{className:`flex min-h-12 items-center justify-between gap-3 py-2`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(ge,{className:`size-4 flex-none text-muted-foreground`}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`truncate text-sm`,children:e.name}),(0,J.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e.url})]})]}),(0,J.jsxs)(z,{size:`sm`,className:`pointer-coarse:min-h-11`,disabled:i!==null,onClick:()=>void A(e),children:[t?(0,J.jsx)(F,{className:`animate-spin`}):null,n(`config:mobileServer.requestConnect`)]})]},e.id)})}):(0,J.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:n(d?`config:mobileServer.discovering`:`config:mobileServer.noNearby`)}),p?(0,J.jsx)(`p`,{role:`alert`,className:`text-xs leading-relaxed text-content-secondary`,children:p}):null,h?(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-[var(--r-md)] bg-surface-subtle px-3 py-2`,children:[(0,J.jsx)(`p`,{role:`status`,className:`text-xs leading-relaxed`,children:h}),(0,J.jsx)(z,{size:`sm`,variant:`outline`,className:`pointer-coarse:min-h-11`,onClick:()=>void k(),children:n(`config:mobileServer.cancelRequest`)})]}):null]}),(0,J.jsxs)(`div`,{className:`relative py-1`,children:[(0,J.jsx)(et,{}),(0,J.jsx)(`span`,{className:`absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-popover px-2 text-xs text-muted-foreground`,children:n(`config:mobileServer.otherMethods`)})]}),(0,J.jsxs)(z,{className:`w-full pointer-coarse:min-h-11`,disabled:i!==null,onClick:()=>void j(),children:[i===`scan`?(0,J.jsx)(F,{className:`animate-spin`}):(0,J.jsx)(On,{}),n(`config:mobileServer.scan`)]}),_?(0,J.jsx)(`p`,{role:`alert`,className:`text-xs leading-relaxed text-content-secondary`,children:_}):null]})})})}function Kr(e,t){let n=window.__TAURI__?.core?.invoke??window.__TAURI_INTERNALS__?.invoke;return n?n(e,t):Promise.reject(Error(`native bridge unavailable`))}function qr({requestConfirm:e}){let{t}=l(),[n,r]=(0,q.useState)(null),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(``),[c,u]=(0,q.useState)(!1),d=(0,q.useCallback)(async()=>{try{r(await Kr(`mobile_state`)),a(``)}catch{a(t(`config:mobileServer.loadFailed`))}},[t]);(0,q.useEffect)(()=>{d()},[d]);let f=async(e,t,n=``)=>{s(n||e);try{r(await Kr(e,t)),a(``)}catch(e){a(String(e))}finally{s(``)}},p=async n=>{o||await e({title:t(`config:mobileServer.forget`),message:t(`config:mobileServer.forgetConfirm`),confirmLabel:t(`config:mobileServer.forget`),tone:`danger`})&&await f(`mobile_forget_server`,{id:n.id},n.id)},m=async e=>{s(e);try{let t=await Kr(`mobile_select_server`,{id:e});r(t),a(``),t.proxyUrl&&window.location.replace(t.proxyUrl)}catch(e){a(String(e))}finally{s(``)}},h=n?.mode===`local`,g=n?.mode===`remote`&&!!n.activeId,_=h||g,v=t(h?`config:mobileServer.currentLocal`:g?`config:mobileServer.current`:`config:mobileServer.empty`),y=e=>t(e===`iroh`?`config:mobileServer.transportP2p`:`config:mobileServer.transportLan`);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`mt-5 flex min-h-11 items-center gap-2 rounded-[var(--r-md)] border border-stroke bg-surface-subtle px-3 py-2 text-xs text-content-secondary`,role:`status`,"aria-live":`polite`,children:[_?(0,J.jsx)(bt,{status:`done`,className:`size-3.5`}):(0,J.jsx)(k,{className:`size-3.5 flex-none text-content-muted`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:v}),n?.activeTransport?(0,J.jsx)(`span`,{className:`flex-none font-mono text-xs text-content-muted`,children:y(n.activeTransport)}):null]}),(0,J.jsx)(Gr,{open:c,onOpenChange:u}),i?(0,J.jsx)(W,{className:`mt-3`,children:i}):null,(0,J.jsx)(U,{title:t(`config:mobileServer.localTitle`),"data-config-card":`mobile-server-local`,children:(0,J.jsx)(H,{children:(0,J.jsx)(V,{icon:(0,J.jsx)(Mn,{}),name:t(`config:mobileServer.localTitle`),description:t(`config:mobileServer.localDescription`),status:h?(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,J.jsx)(bt,{status:`done`,className:`size-3.5`}),t(`config:mobileServer.currentLocal`)]}):void 0,actions:h?void 0:(0,J.jsx)(z,{size:`sm`,variant:`secondary`,className:`flex-none max-[650px]:h-11 max-[650px]:px-3 pointer-coarse:h-11`,disabled:!!o,onClick:()=>void(async()=>{s(`mobile_enter_local`);try{let e=await Kr(`mobile_enter_local`);e.onDevice.url&&window.location.replace(e.onDevice.url)}catch(e){a(String(e))}finally{s(``)}})(),children:t(`config:mobileServer.enterLocal`)})})})}),(0,J.jsx)(U,{title:t(`config:mobileServer.title`),count:n?.servers?.length??0,"data-config-card":`mobile-server-main`,description:t(`config:mobileServer.description`),actions:(0,J.jsxs)(z,{size:`sm`,onClick:()=>u(!0),children:[(0,J.jsx)(de,{}),t(`config:mobileServer.addServer`)]}),children:n?.servers?.length?(0,J.jsx)(H,{children:n.servers.map(e=>{let r=n.mode===`remote`&&e.id===n.activeId,i=e.endpoints.find(e=>e.url),a=e.endpoints.find(e=>e.t===`iroh`),s=i?.url||(a?.nodeId?`Iroh ${a.nodeId.slice(0,12)}`:`Iroh`);return(0,J.jsx)(V,{"data-mobile-server":e.id,icon:(0,J.jsx)(ge,{}),name:e.name,nameMeta:t(i&&a?`config:mobileServer.transportLanP2p`:a?`config:mobileServer.transportP2p`:`config:mobileServer.transportLan`),description:(0,J.jsx)(`span`,{className:`font-mono`,children:s}),status:r?(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,J.jsx)(bt,{status:`done`,className:`size-3.5`}),n.activeTransport?t(`config:mobileServer.activeTransport`,{transport:y(n.activeTransport)}):t(`config:mobileServer.current`)]}):void 0,actions:(0,J.jsxs)(J.Fragment,{children:[r?null:(0,J.jsx)(z,{size:`sm`,variant:`ghost`,disabled:o===e.id,onClick:()=>void m(e.id),children:t(`config:mobileServer.connect`)}),(0,J.jsx)(z,{size:`icon-sm`,variant:`ghost`,className:`hover:bg-danger-soft hover:text-danger max-[650px]:size-11 pointer-coarse:size-11`,"aria-label":t(`config:mobileServer.forget`),title:t(`config:mobileServer.forget`),disabled:!!o,onClick:()=>void p(e),children:(0,J.jsx)(xe,{})})]})},e.id)})}):(0,J.jsx)(jt,{compact:!0,title:t(`config:mobileServer.empty`)})})]})}o.addResourceBundle(`zh-CN`,`remote-workspace`,{description:`使用本机的 Pisper 界面,在另一台 Linux 上运行会话、读写文件和执行任务。`,instructions:`先在 Linux 上运行 Pisper,在「设置 → 远程访问」启用连接,然后复制 HTTPS 地址、证书指纹和配对码。请通过可信渠道核对指纹。`,isolation:`每个工作区在独立窗口中打开。会话、文件、模型配置与任务属于远程机器,不会复制本机密钥;关闭窗口不会停止远程正在执行的任务。本机终端与桌面控制不会在远程窗口中启用。`,refresh:`刷新远程工作区`,name:`工作区名称(可选)`,address:`Linux HTTPS 地址`,fingerprint:`证书指纹`,code:`配对码`,pair:`配对并打开`,open:`连接`,show:`显示窗口`,forget:`移除 {name}`,forgetDescription:`这会关闭该工作区的本机窗口并移除保存的连接,不删除远程文件或会话,也不会停止远程任务。如需吊销设备授权,请在 Linux 的远程访问页操作。`,activeTitle:`当前为远程工作区`,activeDescription:`这里的会话、文件和模型设置属于远程 Linux。连接管理请回到本机主窗口;如需修改远程访问服务,请在 Linux 本机操作。`,manualConnection:`手动连接所需信息`,serverAddress:`HTTPS 服务器地址`}),o.addResourceBundle(`en-US`,`remote-workspace`,{description:`Use the local Pisper interface to run conversations, work with files, and execute tasks on another Linux machine.`,instructions:`Run Pisper on Linux and enable Settings → Remote access. Copy its HTTPS address, certificate fingerprint, and pairing code. Verify the fingerprint through a trusted channel.`,isolation:`Each workspace opens in a separate window. Sessions, files, model settings, and tasks belong to the remote machine; local credentials are not copied. Closing the window does not stop remote tasks. Local terminals and desktop controls are not enabled in remote windows.`,refresh:`Refresh remote workspaces`,name:`Workspace name (optional)`,address:`Linux HTTPS address`,fingerprint:`Certificate fingerprint`,code:`Pairing code`,pair:`Pair and open`,open:`Connect`,show:`Show window`,forget:`Remove {name}`,forgetDescription:`Close this workspace’s local windows and forget the saved connection. Remote files, sessions, and running tasks are not deleted or stopped. To revoke the device authorization, use Remote access on Linux.`,activeTitle:`Remote workspace`,activeDescription:`Sessions, files and model settings in this window belong to the remote Linux machine. Manage connections in your local main window; change remote access service settings directly on Linux.`,manualConnection:`Manual connection details`,serverAddress:`HTTPS server address`});function Jr({notify:e}){let{t,language:n}=l(),[r,i]=(0,q.useState)(null),[a,o]=(0,q.useState)(null),[s,c]=(0,q.useState)([]),[u,d]=(0,q.useState)([]),[p,m]=(0,q.useState)(null),[h,g]=(0,q.useState)(!1),[_,v]=(0,q.useState)(``),[y,b]=(0,q.useState)(``),[x,S]=(0,q.useState)(!1),[C,w]=(0,q.useState)(``),T=(0,q.useCallback)(async()=>{try{let[e,t,n,r]=await Promise.all([f(`/api/remote/status`),f(`/api/remote/devices`),f(`/api/remote/pairing-requests`).catch(()=>({requests:[]})),f(`/api/remote/firewall`).catch(e=>{if(e&&typeof e==`object`&&`status`in e&&e.status===403)return null;throw e})]);i(e),o(r),c(t.devices.filter(e=>!e.revokedAt)),d(n.requests),w(``)}catch{w(t(`config:remoteAccess.loadFailed`))}},[t]);(0,q.useEffect)(()=>{T()},[T]),(0,q.useEffect)(()=>{if(!r?.listening)return;let e=window.setInterval(()=>void T(),2e3);return()=>window.clearInterval(e)},[T,r?.listening]);let D=async n=>{S(!0);try{await f(`/api/remote/enabled`,{method:`PUT`,body:{enabled:n,configureFirewall:a!==null},timeout:15e4});let e=window.__TAURI__?.core?.invoke??window.__TAURI_INTERNALS__?.invoke;e&&await e(`desktop_iroh_set_enabled`,{enabled:n}).catch(()=>void 0),n||(m(null),g(!1),v(``)),await T()}catch(n){e(t(`config:remoteAccess.toggleFailed`,{message:String(n)}),`error`)}finally{S(!1)}},O=async()=>{S(!0);try{await f(`/api/remote/firewall/retry`,{method:`POST`,body:{},timeout:15e4}),await T()}catch(n){e(t(`config:remoteAccess.firewallRetryFailed`,{message:String(n)}),`error`)}finally{S(!1)}},k={disabled:t(`config:remoteAccess.firewallDisabled`),configured:t(`config:remoteAccess.firewallConfigured`),not_needed:t(`config:remoteAccess.firewallNotNeeded`),needs_authorization:t(`config:remoteAccess.firewallNeedsAuthorization`),unsupported:t(`config:remoteAccess.firewallUnsupported`),cancelled:t(`config:remoteAccess.firewallCancelled`),error:t(`config:remoteAccess.firewallError`),cleanup_pending:t(`config:remoteAccess.firewallCleanupPending`)},A={packaged_app_required:t(`config:remoteAccess.firewallPackagedApp`),unsupported_firewall:t(`config:remoteAccess.firewallUnsupportedBackend`),unsupported_platform:t(`config:remoteAccess.firewallUnsupportedBackend`),permission_denied:t(`config:remoteAccess.firewallPermissionDenied`),cancelled:t(`config:remoteAccess.firewallCancelled`),timeout:t(`config:remoteAccess.firewallTimeout`),block_all:t(`config:remoteAccess.firewallBlockAll`),rule_changed:t(`config:remoteAccess.firewallRuleChanged`),inspection_failed:t(`config:remoteAccess.firewallVerificationFailed`),verification_failed:t(`config:remoteAccess.firewallVerificationFailed`),operation_failed:t(`config:remoteAccess.firewallVerificationFailed`),unsupported:t(`config:remoteAccess.firewallUnsupportedBackend`)},j=async()=>{S(!0),v(``);try{let e=await f(`/api/remote/pairing-code`,{method:`POST`});if(!e?.code||!e?.expiresAt)throw Error(t(`config:remoteAccess.qrUnavailable`));e.connectionInfo=await f(`/api/remote/connection-info`).catch(()=>void 0),m(e),g(!0),e.qrDataUrl||v(t(`config:remoteAccess.qrUnavailable`))}catch(n){let r=t(`config:remoteAccess.pairingFailed`,{message:String(n)});v(r),e(r,`error`)}finally{S(!1)}},M=async(n,r)=>{b(n.id);try{await f(`/api/remote/pairing-requests/${encodeURIComponent(n.id)}/decision`,{method:`POST`,body:{approved:r}}),await T()}catch(n){e(t(`config:remoteAccess.approvalFailed`,{message:String(n)}),`error`)}finally{b(``)}},ee=async n=>{if(window.confirm(t(`config:remoteAccess.revokeConfirm`,{name:n.name})))try{await f(`/api/remote/devices/${encodeURIComponent(n.id)}/revoke`,{method:`POST`}),await T()}catch(n){e(t(`config:remoteAccess.revokeFailed`,{message:String(n)}),`error`)}};if(C&&!r)return(0,J.jsx)(kt,{kind:`error`,title:t(`config:remoteAccess.loadFailed`),action:(0,J.jsxs)(z,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>void T(),children:[(0,J.jsx)(fe,{}),t(`config:remoteAccess.refresh`)]})});if(!r)return(0,J.jsx)(kt,{kind:`loading`,title:t(`config:remoteAccess.loading`)});let N=r.error?`failed`:r.listening?`on`:r.enabled?`starting`:`off`,P=a!==null&&!a.busy&&[`needs_authorization`,`cancelled`,`error`,`cleanup_pending`].includes(a.state);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Et,{open:h&&p!==null,onOpenChange:g,children:(0,J.jsxs)(St,{className:`sm:max-w-md`,children:[(0,J.jsxs)(Tt,{children:[(0,J.jsx)(Ct,{children:t(`config:remoteAccess.pairingQrTitle`)}),(0,J.jsx)(xt,{children:t(`config:remoteAccess.scanQrDescription`)})]}),(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-2`,"aria-live":`polite`,children:[p?.qrDataUrl?(0,J.jsx)(`img`,{src:p.qrDataUrl,alt:t(`config:remoteAccess.qrAlt`),className:`size-64 max-w-full rounded-sm border border-stroke bg-white p-2`}):null,_?(0,J.jsx)(`p`,{role:`alert`,className:`text-center text-xs leading-relaxed text-content-secondary`,children:_}):null,p?(0,J.jsxs)(`div`,{className:`text-center`,children:[(0,J.jsx)(`div`,{className:`font-mono text-[20px] font-medium tracking-[0.2em] text-content`,children:p.code}),(0,J.jsx)(`div`,{className:`mt-1 text-xs text-content-muted tabular-nums`,children:t(`config:remoteAccess.codeExpiresAt`,{time:yt(p.expiresAt,n)})})]}):null]}),p?.connectionInfo&&(0,J.jsxs)(`details`,{className:`min-w-0 rounded-md border border-stroke px-3 py-2 text-sm`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer text-content-secondary`,children:t(`remote-workspace:manualConnection`)}),(0,J.jsxs)(`div`,{className:`mt-2 space-y-2 text-xs text-content-muted`,children:[(0,J.jsx)(`div`,{children:t(`remote-workspace:serverAddress`)}),p.connectionInfo.endpoints.map(e=>(0,J.jsx)(`code`,{className:`block font-mono break-all text-content select-all`,children:e.url},e.url)),(0,J.jsx)(`div`,{children:t(`remote-workspace:fingerprint`)}),(0,J.jsx)(`code`,{className:`block font-mono break-all text-content select-all`,children:p.connectionInfo.fingerprint})]})]}),(0,J.jsx)(wt,{children:(0,J.jsxs)(z,{disabled:x,onClick:()=>void j(),children:[x?(0,J.jsx)(R,{className:`text-current`}):(0,J.jsx)(fe,{}),t(x?`config:remoteAccess.generatingQr`:`config:remoteAccess.regenerate`)]})})]})}),C&&(0,J.jsx)(W,{children:C}),(0,J.jsx)(U,{title:t(`config:remoteAccess.thisComputer`),"data-config-card":`remote-access-main`,children:(0,J.jsxs)(H,{children:[(0,J.jsx)(V,{icon:(0,J.jsx)(se,{}),name:t(`config:remoteAccess.allowConnections`),description:t(`config:remoteAccess.description`),status:(0,J.jsx)(Yr,{attention:N===`failed`,glyph:N===`on`?`done`:N===`starting`?`run`:null,children:t(N===`failed`?`config:remoteAccess.stateFailed`:N===`on`?`config:remoteAccess.stateListening`:N===`starting`?`config:remoteAccess.stateStarting`:`config:remoteAccess.stateOff`)}),actions:(0,J.jsx)(nt,{checked:r.enabled,disabled:x,onCheckedChange:e=>void D(e),"aria-label":t(`config:remoteAccess.title`)}),detail:r.error?(0,J.jsx)(`p`,{className:`text-xs leading-relaxed [overflow-wrap:anywhere] text-st-attn`,children:t(`config:remoteAccess.listenFailed`,{message:r.error})}):void 0}),a?(0,J.jsx)(V,{"aria-live":`polite`,icon:(0,J.jsx)(_e,{}),name:t(`config:remoteAccess.firewallTitle`),description:a.busy?t(`config:remoteAccess.firewallWorking`):k[a.state],status:a.busy?(0,J.jsx)(Yr,{glyph:`run`,children:t(`config:remoteAccess.firewallChecking`)}):P?(0,J.jsx)(Yr,{attention:!0,children:t(`config:remoteAccess.firewallNeedsYou`)}):void 0,actions:r.enabled||a.state===`cleanup_pending`?(0,J.jsxs)(z,{size:`sm`,variant:`secondary`,disabled:x||a.busy,onClick:()=>void O(),children:[x||a.busy?(0,J.jsx)(R,{className:`text-current`}):(0,J.jsx)(fe,{}),r.enabled?t(`config:remoteAccess.firewallRetry`):t(`config:remoteAccess.firewallRetryCleanup`)]}):void 0,detail:(0,J.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-xs leading-relaxed text-content-muted`,children:[a.reason&&A[a.reason]?(0,J.jsx)(`p`,{className:`text-content-secondary`,children:A[a.reason]}):null,r.enabled?(0,J.jsx)(`p`,{children:a.scope===`application`?t(`config:remoteAccess.firewallApplicationScope`):a.scope===`program_port`?t(`config:remoteAccess.firewallProgramPortScope`,{port:a.port??`—`}):t(`config:remoteAccess.firewallPortScope`,{port:a.port??`—`})}):null,(0,J.jsx)(`p`,{children:t(`config:remoteAccess.firewallReachability`)}),a.checkedAt?(0,J.jsx)(`p`,{className:`tabular-nums`,children:t(`config:remoteAccess.firewallCheckedAt`,{time:yt(a.checkedAt,n)})}):null]})}):null]})}),r.listening&&u.length?(0,J.jsx)(U,{"aria-live":`polite`,title:t(`config:remoteAccess.pendingApprovals`),count:u.length,meta:(0,J.jsx)(`span`,{className:`font-medium text-st-attn`,children:t(`config:remoteAccess.waitingForYou`)}),description:t(`config:remoteAccess.pendingApprovalsDescription`),children:(0,J.jsx)(H,{children:u.map(e=>(0,J.jsx)(V,{"data-pairing-request":e.id,icon:(0,J.jsx)(Mn,{}),name:e.deviceName,description:(0,J.jsx)(`span`,{className:`font-mono`,children:t(`config:remoteAccess.requestSource`,{ip:e.ip})}),meta:t(`config:remoteAccess.requestedAt`,{time:yt(e.requestedAt,n)}),actions:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(z,{size:`sm`,variant:`ghost`,disabled:y===e.id,onClick:()=>void M(e,!1),children:[(0,J.jsx)(we,{}),t(`config:remoteAccess.reject`)]}),(0,J.jsxs)(z,{size:`sm`,disabled:y===e.id,onClick:()=>void M(e,!0),children:[y===e.id?(0,J.jsx)(R,{className:`text-current`}):(0,J.jsx)(E,{}),t(`config:remoteAccess.approve`)]})]})},e.id))})}):null,r.listening?(0,J.jsx)(U,{title:t(`config:remoteAccess.pairing`),"data-config-card":`remote-access-pairing`,children:(0,J.jsx)(H,{children:(0,J.jsx)(V,{icon:(0,J.jsx)(On,{}),name:t(`config:remoteAccess.pairWithPhone`),description:t(`config:remoteAccess.pairingDescription`),actions:(0,J.jsxs)(z,{size:`sm`,disabled:x,onClick:()=>void j(),children:[x?(0,J.jsx)(R,{className:`text-current`}):(0,J.jsx)(On,{}),t(x?`config:remoteAccess.generatingQr`:`config:remoteAccess.generateQr`)]}),detail:_&&!h?(0,J.jsx)(`p`,{className:`text-xs leading-relaxed text-content-secondary`,"aria-live":`polite`,children:_}):void 0})})}):null,(0,J.jsx)(U,{title:t(`config:remoteAccess.devices`),count:s.length,"data-config-card":`remote-access-devices`,actions:(0,J.jsx)(z,{size:`icon-sm`,variant:`ghost`,className:`pointer-coarse:size-11 max-[650px]:size-11`,onClick:()=>void T(),"aria-label":t(`config:remoteAccess.refresh`),title:t(`config:remoteAccess.refresh`),children:(0,J.jsx)(fe,{})}),children:s.length===0?(0,J.jsx)(jt,{compact:!0,title:t(`config:remoteAccess.noDevices`)}):(0,J.jsx)(H,{children:s.map(e=>(0,J.jsx)(V,{icon:(0,J.jsx)(Mn,{}),name:e.name,nameMeta:e.current?t(`config:remoteAccess.currentDevice`):void 0,description:t(`config:remoteAccess.lastSeen`,{time:yt(e.lastSeenAt,n)}),actions:(0,J.jsx)(z,{size:`sm`,variant:`ghost`,className:`hover:bg-danger-soft hover:text-danger`,"aria-label":`${t(`config:remoteAccess.revoke`)}: ${e.name}`,onClick:()=>void ee(e),children:t(`config:remoteAccess.revoke`)})},e.id))})})]})}function Yr({attention:e=!1,glyph:t=null,children:n}){let r=e?`attention`:t;return(0,J.jsxs)(`span`,{className:L(`inline-flex min-w-0 items-center gap-1.5 whitespace-nowrap`,e?`font-medium text-st-attn`:`text-content-secondary`),children:[r&&(0,J.jsx)(bt,{status:r,className:`size-3.5`}),n]})}function Xr({requestConfirm:e}){let{t}=l(),n=window.pisperDesktop?.remoteWorkspaces,[r,i]=(0,q.useState)([]),[a,o]=(0,q.useState)(``),[s,c]=(0,q.useState)(``),[u,d]=(0,q.useState)(``),[f,p]=(0,q.useState)(``),[m,h]=(0,q.useState)(!1),[g,_]=(0,q.useState)(``),v=(0,q.useCallback)(async()=>{n&&i(await n.list())},[n]);(0,q.useEffect)(()=>{v().catch(e=>_(String(e)))},[v]);let y=async e=>{if(!m){h(!0),_(``);try{await e()}catch(e){_(e instanceof Error?e.message:String(e))}finally{h(!1)}}};return window.__PISPER_REMOTE_WORKSPACE__?(0,J.jsx)(U,{title:t(`config:remoteWorkspace.title`),"data-config-card":`remote-workspaces`,children:(0,J.jsx)(H,{children:(0,J.jsx)(V,{icon:(0,J.jsx)(ge,{}),name:t(`remote-workspace:activeTitle`),description:t(`remote-workspace:activeDescription`),detail:(0,J.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:t(`remote-workspace:isolation`)})})})}):n?(0,J.jsxs)(U,{title:t(`config:remoteWorkspace.title`),count:r.length,"data-config-card":`remote-workspaces`,description:t(`remote-workspace:description`),actions:(0,J.jsx)(z,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`pointer-coarse:size-11`,disabled:m,"aria-label":t(`remote-workspace:refresh`),title:t(`remote-workspace:refresh`),onClick:()=>void y(v),children:(0,J.jsx)(fe,{className:`size-3.5`})}),children:[r.length>0&&(0,J.jsx)(H,{children:r.map(r=>(0,J.jsx)(V,{icon:(0,J.jsx)(ge,{}),name:r.name,description:(0,J.jsx)(`span`,{className:`font-mono`,children:r.address}),actions:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(z,{type:`button`,size:`sm`,variant:`secondary`,disabled:m,onClick:()=>void y(async()=>{await n.open(r.id),await v()}),children:[r.connected?t(`remote-workspace:show`):t(`remote-workspace:open`),(0,J.jsx)(S,{className:`size-3.5`})]}),(0,J.jsx)(z,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`hover:bg-danger-soft hover:text-danger max-[650px]:size-11 pointer-coarse:size-11`,disabled:m,"aria-label":t(`remote-workspace:forget`,{name:r.name}),onClick:()=>void y(async()=>{await e({title:t(`remote-workspace:forget`,{name:r.name}),message:t(`remote-workspace:forgetDescription`)})&&(await n.forget(r.id),await v())}),children:(0,J.jsx)(xe,{className:`size-3.5`})})]})},r.id))}),(0,J.jsxs)(`div`,{className:`@container/card mt-3 rounded-[var(--r-md)] border border-stroke px-3 pt-2 pb-1`,children:[(0,J.jsx)(`p`,{className:`py-1.5 text-xs leading-relaxed text-content-secondary`,children:t(`remote-workspace:instructions`)}),(0,J.jsxs)(`form`,{className:`divide-y divide-stroke-soft border-t border-stroke-soft`,onSubmit:e=>{e.preventDefault(),y(async()=>{let e=await n.pair({name:a,address:s,fingerprint:u,code:f});p(``),await v(),await n.open(e),await v()})},children:[(0,J.jsx)(Sr,{label:t(`remote-workspace:name`),htmlFor:`remote-workspace-name`,children:(0,J.jsx)(B,{id:`remote-workspace-name`,value:a,maxLength:160,disabled:m,placeholder:`Linux`,onChange:e=>o(e.target.value)})}),(0,J.jsx)(Sr,{label:t(`remote-workspace:address`),htmlFor:`remote-workspace-address`,children:(0,J.jsx)(B,{id:`remote-workspace-address`,type:`url`,value:s,required:!0,disabled:m,placeholder:`https://192.168.1.10:5174`,autoComplete:`off`,spellCheck:!1,className:`font-mono`,onChange:e=>c(e.target.value)})}),(0,J.jsx)(Sr,{label:t(`remote-workspace:fingerprint`),htmlFor:`remote-workspace-fingerprint`,children:(0,J.jsx)(B,{id:`remote-workspace-fingerprint`,value:u,required:!0,disabled:m,placeholder:`SHA256:…`,autoComplete:`off`,spellCheck:!1,className:`font-mono text-xs`,onChange:e=>d(e.target.value)})}),(0,J.jsx)(Sr,{label:t(`remote-workspace:code`),htmlFor:`remote-workspace-code`,children:(0,J.jsx)(B,{id:`remote-workspace-code`,value:f,required:!0,maxLength:64,disabled:m,placeholder:`ABCD-EFGH`,autoComplete:`off`,spellCheck:!1,className:`font-mono`,onChange:e=>p(e.target.value)})}),(0,J.jsx)(`div`,{className:`flex justify-end py-3`,children:(0,J.jsxs)(z,{type:`submit`,className:`max-[650px]:h-11`,disabled:m,children:[m?(0,J.jsx)(R,{className:`text-current`}):(0,J.jsx)(S,{className:`size-3.5`}),t(`remote-workspace:pair`)]})})]})]}),g&&(0,J.jsx)(W,{className:`mt-3`,children:g}),(0,J.jsx)(`p`,{className:`mt-3 text-xs leading-relaxed text-content-muted`,children:t(`remote-workspace:isolation`)})]}):null}function Zr({section:e,notify:t,requestConfirm:n,onBack:r}){let{t:i}=l(),a=m(e=>e.capabilities),o=h(),s=p(a,e,{mobileApp:o}),c=i(e===`remote-access`?`config:configPage.remoteAccess`:e===`mobile-server`?`config:configPage.mobileServer`:`config:configPage.desktopPet`),u=i(e===`remote-access`?`config:deviceFeature.remoteAccessLede`:e===`mobile-server`?`config:deviceFeature.mobileServerLede`:`config:desktopPetSettings.description`),d;return d=s.supported?e===`desktop-pet`?(0,J.jsx)(kr,{notify:t,requestConfirm:n}):e===`mobile-server`?(0,J.jsx)(qr,{requestConfirm:n}):(0,J.jsxs)(J.Fragment,{children:[!window.__PISPER_REMOTE_WORKSPACE__&&(0,J.jsx)(Jr,{notify:t}),(0,J.jsx)(Xr,{requestConfirm:n})]}):(0,J.jsx)(Qr,{section:e,support:s}),(0,J.jsx)(Nt,{"data-device-feature":e,title:c,description:u,back:r&&{label:i(`navigation:sidebar.features`),ariaLabel:i(`navigation:shell.backToFeaturesLabel`),onBack:r},children:(0,J.jsx)(`div`,{"data-config-card":st,className:`min-w-0`,children:d})})}function Qr({section:e,support:t}){let{t:n}=l(),r=n(e===`desktop-pet`?`config:desktopPetSettings.showOnDesktop`:e===`mobile-server`?`config:mobileServer.title`:`config:remoteAccess.allowConnections`),i=t.reason===`runtime`?n(`config:deviceFeature.runtimeUnavailable`):t.reason===`mobile-only`?n(`config:deviceFeature.mobileOnly`):n(e===`desktop-pet`?`config:desktopPetSettings.desktopOnlyDescription`:`config:deviceFeature.remoteAccessDesktopOnly`);return(0,J.jsx)(U,{title:n(`config:deviceFeature.unavailableTitle`),"data-device-unsupported":!0,children:(0,J.jsx)(H,{children:(0,J.jsx)(V,{icon:e===`desktop-pet`?(0,J.jsx)(w,{}):(0,J.jsx)(se,{}),name:r,description:i,status:n(`config:deviceFeature.unavailable`),actions:(0,J.jsx)(nt,{checked:!1,disabled:!0,"aria-label":r})})})})}function $r({title:e,description:t,action:n,children:r,className:i,...a}){let o=(0,q.useId)();return(0,J.jsxs)(`section`,{"aria-labelledby":o,className:L(`min-w-0`,i),...a,children:[(0,J.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h2`,{id:o,className:`text-[15px] leading-6 font-medium text-content`,children:e}),t&&(0,J.jsx)(`p`,{className:`mt-0.5 text-[13px] text-content-muted`,children:t})]}),n]}),(0,J.jsx)(`div`,{className:`divide-y divide-stroke-soft`,children:r})]})}function Q({title:e,description:t,control:n,nested:r,children:i,className:a,...o}){return(0,J.jsxs)(`div`,{className:L(`min-w-0 py-3`,r&&`pl-4`,a),...o,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-x-6 gap-y-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1 basis-40`,children:[(0,J.jsx)(`div`,{className:`text-[13px] font-medium text-content`,children:e}),t&&(0,J.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-content-muted`,children:t})]}),n&&(0,J.jsx)(`div`,{className:`max-w-full shrink-0`,children:n})]}),i]})}function ei({className:e,...t}){return(0,J.jsx)(ar,{"data-slot":`radio-group`,className:L(`grid w-full gap-2`,e),...t})}function ti({className:e,...t}){return(0,J.jsx)(ur,{"data-slot":`radio-group-option`,className:L(`disabled:pointer-events-none disabled:opacity-50`,e),...t})}function ni(e,t){return t(e===`en-US`?`config:languageSettings.english`:`config:languageSettings.simplifiedChinese`)}function ri({notify:e}){let{language:t,setLanguage:n,t:r}=l(),i=(0,q.useId)(),a=(0,q.useId)(),o=r=>{r!==t&&(n(r),e(s(r===`en-US`?`config:languageSettings.displayLanguageChangedToEnglish`:`config:languageSettings.displayLanguageChangedToSimplifiedChinese`,r)))};return(0,J.jsxs)(`div`,{className:`flex flex-row flex-wrap items-center justify-between gap-x-6 gap-y-3 border-y border-stroke-soft py-3`,"data-config-card":`interface-language`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1 basis-40`,children:[(0,J.jsx)(`h2`,{id:i,className:`text-sm font-medium text-content`,children:r(`config:languageSettings.displayLanguage`)}),(0,J.jsx)(`p`,{id:a,className:`mt-0.5 text-xs leading-relaxed text-content-muted`,children:r(`config:languageSettings.interfaceOnlyHint`)})]}),(0,J.jsxs)($e,{value:t,onValueChange:e=>{let t=c.find(t=>t.value===e);t&&o(t.value)},children:[(0,J.jsx)(Xe,{"aria-labelledby":i,"aria-describedby":a,className:`min-w-36 shrink-0`,children:(0,J.jsx)(Ye,{})}),(0,J.jsx)(Ze,{align:`end`,children:c.map(e=>(0,J.jsx)(Qe,{value:e.value,children:ni(e.value,r)},e.value))})]})]})}function ii({role:e,label:t,value:n,onCommit:r}){let{t:i}=l(),a=(0,q.useId)(),[o,s]=(0,q.useState)(String(n)),c=(0,q.useRef)(o),u=(0,q.useRef)(n),d=e===`ui`?dn:ln;(0,q.useEffect)(()=>{u.current=n,c.current=String(n),s(String(n))},[n]);let f=o!==String(n)&&un(o,e)===null,p=()=>{let t=un(c.current,e);t!==null&&t!==u.current&&(r(t),u.current=t)};return(0,J.jsxs)(`div`,{className:`flex max-w-full flex-col items-end gap-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(B,{type:`number`,min:d.min,max:d.max,step:1,value:o,"aria-label":t,"aria-invalid":f,"aria-describedby":f?a:void 0,className:`h-8 w-16 text-sm tabular-nums pointer-coarse:min-h-11 max-[650px]:min-h-11`,onChange:e=>{c.current=e.target.value,s(e.target.value)},onPointerUp:p,onBlur:p,onKeyDown:e=>{e.nativeEvent.isComposing||(e.key===`Enter`?(e.preventDefault(),p()):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),c.current=String(n),s(String(n))))}}),(0,J.jsx)(`span`,{className:`text-sm text-content-muted`,children:`px`})]}),f&&(0,J.jsx)(`p`,{id:a,role:`alert`,className:`max-w-56 text-xs text-destructive`,children:i(`config:interfaceSettings.invalidFontSize`,{min:d.min,max:d.max})})]})}function ai({label:e,options:t,value:n,onChange:r}){return(0,J.jsx)(ei,{value:n,onValueChange:e=>{let n=t.find(t=>t.value===e);n&&r(n.value)},className:`grid auto-cols-fr grid-flow-col gap-0.5 rounded-md border border-stroke bg-chrome p-[3px]`,"aria-label":e,children:t.map(e=>(0,J.jsx)(ti,{type:`button`,className:L(`min-h-7 rounded-sm border border-transparent px-2.5 text-sm transition-colors pointer-coarse:min-h-11 max-[650px]:min-h-11`,e.value===n?`border-key-border bg-key font-medium text-content shadow-key`:`text-content-secondary hover:text-content`),value:e.value,children:e.label},e.value))})}var oi={neutral:`var(--primary)`,blue:`#3d4bef`,teal:`#0f766e`,violet:`#6d4ad6`,coral:`#c93a48`,custom:`#3d4bef`};function si(e){let[t,n,r]=[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)/255),i=Math.max(t,n,r),a=i-Math.min(t,n,r),o=0;return a&&(o=i===t?(n-r)/a%6:i===n?(r-t)/a+2:(t-n)/a+4),{hue:(o*60+360)%360,saturation:i?a/i:0,brightness:i}}function ci({hue:e,saturation:t,brightness:n}){let r=n*t,i=r*(1-Math.abs(e/60%2-1));return`#`+[[r,i,0],[i,r,0],[0,r,i],[0,i,r],[i,0,r],[r,0,i]][Math.floor(e/60)%6].map(e=>Math.round((e+n-r)*255).toString(16).padStart(2,`0`)).join(``)}function li({value:e,onCommit:t}){let{t:n}=l(),[r,i]=(0,q.useState)(e),a=(0,q.useRef)(e),[o,s]=(0,q.useState)(()=>si(e)),c=(0,q.useId)(),u=e=>{a.current=e,i(e)};(0,q.useEffect)(()=>{a.current=e,i(e),s(si(e))},[e]);let d=e=>{s(e),u(ci(e))},f=()=>{let n=Xt(a.current);n&&n!==Xt(e)&&t(n)},p=e=>{let t=e.currentTarget.getBoundingClientRect();d({...o,saturation:Math.min(1,Math.max(0,(e.clientX-t.left)/t.width)),brightness:1-Math.min(1,Math.max(0,(e.clientY-t.top)/t.height))})},m=!!r.trim()&&!Xt(r);return(0,J.jsxs)(Je,{onOpenChange:t=>{t||(f(),Xt(a.current)||(u(e),s(si(e))))},children:[(0,J.jsx)(Ke,{asChild:!0,children:(0,J.jsxs)(z,{variant:`outline`,className:`h-8 min-h-0 w-26 gap-1.5 px-2 text-xs tabular-nums pointer-coarse:h-11 max-[650px]:h-11`,"aria-label":n(`config:interfaceSettings.customAccentColor`),children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 shrink-0 rounded-full border border-stroke-strong`,style:{backgroundColor:e}}),(0,J.jsx)(`span`,{className:`font-mono`,children:e})]})}),(0,J.jsxs)(qe,{align:`end`,sideOffset:8,className:`w-auto rounded-xl p-3`,children:[(0,J.jsx)(`div`,{role:`slider`,tabIndex:0,"aria-label":n(`config:interfaceSettings.colorSpectrum`),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(o.saturation*100),"aria-valuetext":r,"aria-describedby":c,className:`relative h-34 w-34 touch-none rounded-lg outline-none focus-visible:ring-2 focus-visible:ring-ring`,style:{background:`linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent), hsl(${o.hue} 100% 50%)`},onPointerDown:e=>{e.currentTarget.setPointerCapture(e.pointerId),p(e)},onPointerMove:e=>{e.currentTarget.hasPointerCapture(e.pointerId)&&p(e)},onPointerUp:e=>{e.currentTarget.hasPointerCapture(e.pointerId)&&(p(e),e.currentTarget.releasePointerCapture(e.pointerId),f())},onPointerCancel:()=>{u(e),s(si(e))},onKeyDown:e=>{[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`].includes(e.key)&&(e.preventDefault(),d({...o,saturation:Math.min(1,Math.max(0,o.saturation+(e.key===`ArrowRight`?.01:e.key===`ArrowLeft`?-.01:0))),brightness:Math.min(1,Math.max(0,o.brightness+(e.key===`ArrowUp`?.01:e.key===`ArrowDown`?-.01:0)))}))},onKeyUp:e=>{e.key.startsWith(`Arrow`)&&f()},onBlur:f,children:(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute size-3 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white shadow-sm`,style:{left:`${o.saturation*100}%`,top:`${(1-o.brightness)*100}%`}})}),(0,J.jsx)(tt,{min:0,max:359,step:1,value:[Math.round(o.hue)],"aria-label":n(`config:interfaceSettings.colorHue`),valueText:`${Math.round(o.hue)}°`,className:`h-7 w-34`,onValueChange:([e])=>d({...o,hue:e}),onValueCommit:()=>f()}),(0,J.jsx)(B,{type:`text`,value:r,spellCheck:!1,"aria-label":n(`config:interfaceSettings.customAccentHex`),"aria-invalid":m,"aria-describedby":c,className:`w-34 font-mono text-xs`,onChange:e=>{u(e.target.value);let t=Xt(e.target.value);t&&s(si(t))},onBlur:f,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),f())}}),(0,J.jsx)(`p`,{id:c,className:`max-w-34 text-xs text-muted-foreground`,children:n(m?`config:interfaceSettings.invalidAccentColor`:`config:interfaceSettings.colorSpectrumHint`)})]})]})}function ui({notify:e,defaultAdvancedExpanded:t=!1,navigationKey:n}){let{t:r}=l(),{theme:i,density:a,accent:o,customAccent:s,uiFontSize:c,codeFontSize:u,radius:d,motion:f,setTheme:p,setDensity:m,setAccent:h,setCustomAccent:g,setUiFontSize:y,setCodeFontSize:b,setRadius:x,setMotion:S,resetAppearance:C}=Zt(),w=v(e=>e.pinned),T=v(e=>e.setPinned),[E,O]=(0,q.useState)(t),k=(0,q.useId)(),A=(0,q.useId)();(0,q.useEffect)(()=>{t&&O(!0)},[t,n]);let j=i!==tn.theme||a!==tn.density||o!==tn.accent||s!==tn.customAccent||c!==tn.uiFontSize||u!==tn.codeFontSize||d!==tn.radius||f!==tn.motion,M=t=>n=>{t(n),e(r(`config:interfaceSettings.preferencesUpdated`))},ee=[{value:`system`,label:r(`config:interfaceSettings.followSystem`),description:r(`config:interfaceSettings.followSystemDescription`),icon:En},{value:`light`,label:r(`config:interfaceSettings.light`),description:r(`config:interfaceSettings.lightDescription`),icon:Pn},{value:`dark`,label:r(`config:interfaceSettings.dark`),description:r(`config:interfaceSettings.darkDescription`),icon:Dn}],N=[{value:`comfortable`,label:r(`config:interfaceSettings.comfortable`),description:r(`config:interfaceSettings.comfortableDescription`),icon:In},{value:`compact`,label:r(`config:interfaceSettings.compact`),description:r(`config:interfaceSettings.compactDescription`),icon:wn}],P=[{value:`system`,label:r(`config:interfaceSettings.motionSystem`),description:r(`config:interfaceSettings.motionSystemDescription`),icon:En},{value:`full`,label:r(`config:interfaceSettings.motionFull`),description:r(`config:interfaceSettings.motionFullDescription`),icon:ye},{value:`reduced`,label:r(`config:interfaceSettings.motionReduced`),description:r(`config:interfaceSettings.motionReducedDescription`),icon:_}],te=[{value:`neutral`,label:r(`config:interfaceSettings.accentNeutral`)},{value:`blue`,label:r(`config:interfaceSettings.accentBlue`)},{value:`teal`,label:r(`config:interfaceSettings.accentTeal`)},{value:`violet`,label:r(`config:interfaceSettings.accentViolet`)},{value:`coral`,label:r(`config:interfaceSettings.accentCoral`)},{value:`custom`,label:r(`config:interfaceSettings.accentCustom`)}],ne=[{value:`sharp`,label:r(`config:interfaceSettings.sharp`)},{value:`default`,label:r(`config:interfaceSettings.standard`)},{value:`soft`,label:r(`config:interfaceSettings.soft`)}];return(0,J.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,J.jsx)($r,{title:r(`config:interfaceSettings.visualStyle`),description:r(`config:interfaceSettings.appearanceDescription`),"data-config-card":`interface-appearance`,action:(0,J.jsxs)(z,{type:`button`,variant:`ghost`,size:`sm`,className:`pointer-coarse:h-11`,disabled:!j,onClick:()=>{C(),e(r(`config:interfaceSettings.defaultsRestored`))},children:[(0,J.jsx)(me,{size:14}),r(`config:interfaceSettings.restoreDefaults`)]}),children:(0,J.jsxs)(xr,{children:[(0,J.jsx)(Q,{title:r(`config:interfaceSettings.colorMode`),control:(0,J.jsx)(`div`,{role:`radiogroup`,"aria-label":r(`config:interfaceSettings.colorMode`),className:`grid w-68 max-w-full grid-cols-3 gap-4`,children:ee.map(e=>(0,J.jsxs)(`label`,{className:`group flex min-w-0 cursor-pointer flex-col items-center gap-2 text-xs text-content-muted`,children:[(0,J.jsx)(`input`,{className:`peer sr-only`,type:`radio`,name:A,value:e.value,checked:i===e.value,onChange:()=>M(p)(e.value)}),(0,J.jsxs)(`span`,{"aria-hidden":`true`,className:L(`relative block aspect-4/3 w-full overflow-hidden rounded-md border border-stroke bg-surface-sunken peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2 peer-focus-visible:outline-focus`,i===e.value&&`border-star ring-2 ring-star`),children:[(0,J.jsxs)(`span`,{className:`absolute inset-2 rounded border border-(--preview-light-line) bg-(--preview-light-bg)`,children:[(0,J.jsx)(`span`,{className:`absolute inset-y-0 left-0 w-1/4 border-r border-(--preview-light-line) bg-(--preview-light-side)`}),(0,J.jsx)(`span`,{className:`absolute top-3 right-1 h-0.5 w-1/2 rounded bg-(--preview-light-line)`}),(0,J.jsx)(`span`,{className:`absolute top-5 right-2 h-0.5 w-1/3 rounded bg-(--preview-light-line)`})]}),e.value!==`light`&&(0,J.jsxs)(`span`,{className:L(`absolute inset-2 rounded border border-(--preview-dark-line) bg-(--preview-dark-bg)`,e.value===`system`&&`left-1/2 rounded-l-none border-l-0`),children:[e.value===`dark`&&(0,J.jsx)(`span`,{className:`absolute inset-y-0 left-0 w-1/4 border-r border-(--preview-dark-line) bg-(--preview-dark-side)`}),(0,J.jsx)(`span`,{className:`absolute top-3 right-1 h-0.5 w-1/2 rounded bg-(--preview-dark-line)`}),(0,J.jsx)(`span`,{className:`absolute top-5 right-2 h-0.5 w-1/3 rounded bg-(--preview-dark-line)`})]})]}),(0,J.jsx)(`span`,{className:L(i===e.value&&`font-medium text-content`),children:e.label})]},e.value))})}),(0,J.jsx)(Q,{title:r(`config:interfaceSettings.accentColor`),description:r(`config:interfaceSettings.accentDescription`),control:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,J.jsxs)($e,{value:o,onValueChange:e=>{let t=te.find(t=>t.value===e);t&&M(h)(t.value)},children:[(0,J.jsx)(Xe,{"aria-label":r(`config:interfaceSettings.accentColor`),className:`min-w-36`,children:(0,J.jsx)(Ye,{})}),(0,J.jsx)(Ze,{align:`end`,children:te.map(e=>(0,J.jsxs)(Qe,{value:e.value,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 rounded-full border border-stroke-strong`,style:{backgroundColor:e.value===`custom`?s:oi[e.value]}}),e.label]},e.value))})]}),o===`custom`&&(0,J.jsx)(li,{value:Xt(s)||tn.customAccent,onCommit:M(g)})]})})]})}),(0,J.jsxs)(Yt,{open:E,onOpenChange:O,children:[(0,J.jsx)(Jt,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,"aria-controls":k,"aria-expanded":E,className:`flex min-h-9 w-full items-center gap-2 rounded-sm text-left text-[15px] leading-6 font-medium text-content max-[650px]:min-h-11`,children:[(0,J.jsx)(D,{size:16,"aria-hidden":`true`,className:L(`text-content-muted transition-transform`,!E&&`-rotate-90`)}),r(`config:interfaceSettings.advanced`)]})}),(0,J.jsx)(qt,{id:k,children:(0,J.jsxs)(xr,{className:`mt-3`,children:[(0,J.jsxs)(`div`,{className:`divide-y divide-stroke-soft`,"data-config-card":`interface-style`,children:[(0,J.jsx)(Q,{title:r(`config:interfaceSettings.uiFontSize`),description:r(`config:interfaceSettings.numericFontHint`),control:(0,J.jsx)(ii,{role:`ui`,label:r(`config:interfaceSettings.uiFontSize`),value:c,onCommit:M(y)})}),(0,J.jsx)(Q,{title:r(`config:interfaceSettings.codeFontSize`),control:(0,J.jsx)(ii,{role:`code`,label:r(`config:interfaceSettings.codeFontSize`),value:u,onCommit:M(b)})}),(0,J.jsx)(Q,{title:r(`config:interfaceSettings.cornerStyle`),control:(0,J.jsx)(ai,{label:r(`config:interfaceSettings.cornerStyle`),options:ne,value:d,onChange:M(x)})})]}),(0,J.jsxs)(`div`,{className:`divide-y divide-stroke-soft`,"data-config-card":`interface-motion`,children:[(0,J.jsx)(Q,{title:r(`config:interfaceSettings.interfaceDensity`),control:(0,J.jsx)(ai,{label:r(`config:interfaceSettings.interfaceDensity`),options:N,value:a,onChange:M(m)})}),(0,J.jsx)(Q,{title:r(`config:interfaceSettings.pinInspector`),description:r(`config:interfaceSettings.pinInspectorDescription`),control:(0,J.jsx)(nt,{checked:w,onCheckedChange:M(T),"aria-label":r(`config:interfaceSettings.pinInspector`),"data-setting":`pin-inspector`})}),(0,J.jsx)(Q,{title:r(`config:interfaceSettings.motion`),control:(0,J.jsx)(ai,{label:r(`config:interfaceSettings.motion`),options:P,value:f,onChange:M(S)})}),(0,J.jsx)(Q,{title:r(`config:interfaceSettings.automaticByTime`),description:r(`config:interfaceSettings.automaticByTimeDescription`),control:(0,J.jsx)(nt,{checked:i===`scheduled`,onCheckedChange:e=>M(p)(e?`scheduled`:`system`),"aria-label":r(`config:interfaceSettings.automaticByTime`)})})]})]})})]}),(0,J.jsx)(ri,{notify:e})]})}function di({requestConfirm:e}){let{t}=l(),n=lt(e=>e.bindings),r=lt(e=>e.boardBindings),i=lt(e=>e.setBinding),a=lt(e=>e.setBoardBinding),o=lt(e=>e.resetBindings),[s,c]=(0,q.useState)(null),[u,d]=(0,q.useState)(null),[f,p]=(0,q.useState)(!1),m=fn(),h=m.actions,g=m.boardActions,_=(e,n)=>{p(!1);let i=mt(r,e,n);if(i){d({action:e,message:t(`config:shortcuts.conflict`,{action:g[i]})});return}try{a(e,n),c(null),d(null),p(!0)}catch{d({action:e,message:t(`config:shortcuts.saveFailed`)})}},v=(e,r)=>{p(!1);let a=ft(n,e,r);if(a){d({action:e,message:t(`config:shortcuts.conflict`,{action:h[a]})});return}try{ct({...n,[e]:r})}catch{d({action:e,message:t(`config:shortcuts.invalid`)});return}try{i(e,r),c(null),d(null),p(!0)}catch{d({action:e,message:t(`config:shortcuts.saveFailed`)})}},y=(e,n)=>{if(s!==n)return;if(e.key===`Tab`){c(null);return}let r=pt.includes(n),i=r?gt(e.nativeEvent):ht(e.nativeEvent);if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){c(null),d(null);return}i&&r?_(n,i):i?v(n,i):!e.nativeEvent.isComposing&&e.keyCode!==229&&!e.repeat&&![`Control`,`Meta`,`Alt`,`Shift`,`AltGraph`,`Dead`,`Process`].includes(e.key)&&d({action:n,message:t(`config:shortcuts.invalid`)})},b=async()=>{if(c(null),await e({title:t(`config:shortcuts.resetAll`),message:t(`config:shortcuts.resetConfirm`),confirmLabel:t(`config:shortcuts.resetAll`)}))try{o(),d(null),p(!0)}catch{d({action:null,message:t(`config:shortcuts.saveFailed`)})}},x=dt.some(e=>n[e]!==ut[e])||pt.some(e=>r[e]!==vt[e]),S=e=>{let i=pt.includes(e),a=i?g[e]:h[e],o=i?r[e]:n[e],l=i?vt[e]:ut[e],f=t=>i?_(e,t):v(e,t);return(0,J.jsxs)(`div`,{className:`py-2.5`,"data-shortcut-action":e,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-x-5 gap-y-2`,children:[(0,J.jsx)(`label`,{htmlFor:`shortcut-${e}`,className:`min-w-0 text-sm font-medium text-content`,children:a}),(0,J.jsxs)(`div`,{className:`flex max-w-full min-w-0 items-center gap-1 max-[650px]:w-full`,children:[(0,J.jsx)(z,{id:`shortcut-${e}`,"data-shortcut-recorder":!0,variant:`outline`,className:L(`h-8 w-44 min-w-0 justify-center gap-2 border-input bg-panel px-2.5 text-xs font-normal shadow-none hover:bg-surface-subtle pointer-coarse:h-11 max-[650px]:h-11 max-[650px]:flex-1`,s===e&&`border-focus text-accent-fg ring-3 ring-focus-ring hover:bg-panel`),"aria-label":t(`config:shortcuts.edit`,{action:a}),"aria-pressed":s===e,"aria-describedby":u?.action===e?`shortcut-error-${e}`:void 0,onClick:()=>{c(e),d(null),p(!1)},onBlur:()=>c(t=>t===e?null:t),onKeyDown:t=>y(t,e),children:s===e?(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t(`config:shortcuts.recording`)}):_t(o)?(0,J.jsx)(it,{className:`min-w-0 flex-wrap justify-center`,children:_t(o).split(` + `).map((e,t)=>(0,J.jsx)(at,{className:`text-content-secondary`,children:e},t))}):(0,J.jsx)(`span`,{className:`text-content-muted`,children:t(`config:shortcuts.disabled`)})}),(0,J.jsxs)(Ge,{children:[(0,J.jsx)(Ue,{asChild:!0,children:(0,J.jsx)(z,{variant:`ghost`,size:`icon`,className:`pointer-coarse:size-11 max-[650px]:size-11`,title:t(`config:shortcuts.options`,{action:a}),"aria-label":t(`config:shortcuts.options`,{action:a}),children:(0,J.jsx)(N,{className:`size-4`})})}),(0,J.jsxs)(We,{align:`end`,className:`w-40`,onCloseAutoFocus:e=>{document.activeElement?.hasAttribute(`data-shortcut-recorder`)&&e.preventDefault()},children:[(0,J.jsxs)(Ve,{disabled:o===null,onSelect:()=>f(null),children:[(0,J.jsx)(we,{className:`size-4`}),t(`config:shortcuts.disableKey`)]}),(0,J.jsxs)(Ve,{disabled:o===l,onSelect:()=>f(l),children:[(0,J.jsx)(me,{className:`size-4`}),t(`config:shortcuts.resetAll`)]})]})]})]})]}),u?.action===e&&(0,J.jsx)(`p`,{id:`shortcut-error-${e}`,role:`alert`,className:`mt-2 text-xs text-danger`,children:u.message})]},e)},C=e=>e.kind===`fixed`?(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-x-5 gap-y-2 py-2.5`,"data-shortcut-fixed":e.id,children:[(0,J.jsxs)(`span`,{className:`min-w-0 text-sm text-content-secondary`,children:[m.label(e),(0,J.jsx)(`span`,{className:`ml-1.5 text-xs text-content-muted`,children:t(`board:shortcuts.fixed`)})]}),(0,J.jsxs)(`div`,{className:`flex max-w-full min-w-0 items-center gap-1 max-[650px]:w-full`,children:[(0,J.jsx)(hn,{keys:e.keys,className:`h-8 w-44 justify-center px-2.5 max-[650px]:flex-1`}),(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`size-7 flex-none pointer-coarse:size-11 max-[650px]:size-11`})]})]},mn(e)):S(e.action);return(0,J.jsxs)(`section`,{className:`w-full min-w-0`,"data-config-card":`shortcuts-bindings`,children:[(0,J.jsx)(`div`,{className:`flex flex-col gap-5`,children:pn.map((e,n)=>(0,J.jsxs)(`section`,{"aria-labelledby":`shortcut-group-${e.id}`,"data-shortcut-group":e.id,children:[(0,J.jsxs)(`div`,{className:`flex min-h-7 items-center justify-between gap-3`,children:[(0,J.jsx)(`h3`,{id:`shortcut-group-${e.id}`,className:`text-[13px] leading-6 font-semibold text-content`,children:m.groups[e.id].title}),n===0&&(0,J.jsxs)(z,{variant:`ghost`,size:`sm`,"data-shortcuts-reset-all":!0,className:`-mr-2 text-content-secondary max-[650px]:h-11 pointer-coarse:h-11`,disabled:!x,onClick:()=>void b(),children:[(0,J.jsx)(me,{className:`size-3.5`,"aria-hidden":`true`}),t(`config:shortcuts.resetAll`)]})]}),(0,J.jsx)(`p`,{className:`mb-2 text-xs text-content-muted`,children:m.groups[e.id].hint}),(0,J.jsx)(xr,{children:e.entries.map(C)})]},e.id))}),(0,J.jsx)(`div`,{className:`mt-3 min-h-5 text-xs text-content-muted`,role:`status`,"aria-live":`polite`,children:u?.action===null?(0,J.jsx)(`span`,{className:`text-destructive`,children:u.message}):t(f?`config:shortcuts.saved`:`config:shortcuts.deviceScope`)})]})}function fi(e,t){let n=(0,q.useRef)(t);n.current=t,(0,q.useEffect)(()=>{if(e)return e(()=>n.current?.())},[e])}o.addResourceBundle(`zh-CN`,`providers`,{"modelEditor.edit":`编辑模型`,"modelEditor.add":`添加模型`,"modelEditor.description":`能力与思考强度`,"modelEditor.id":`模型 ID`,"modelEditor.capabilities":`模型能力`,"modelEditor.chat":`对话`,"modelEditor.image":`图像生成`,"modelEditor.video":`视频生成`,"modelEditor.capabilitiesHint":`可单选或多选。仅选图像生成时,复用此连接的密钥,不会出现在对话模型中。`,"modelEditor.chatCapabilities":`对话能力`,"modelEditor.vision":`图片理解`,"modelEditor.reasoning":`深度思考`,"modelEditor.contextWindow":`上下文窗口(Token)`,"modelEditor.maxTokens":`最大输出(Token)`,"modelEditor.editNamed":`编辑模型 {name}`,"modelEditor.optionsNamed":`模型能力:{name}`,"modelEditor.delete":`删除模型`,"modelEditor.deleteNamed":`删除模型 {name}`,"modelEditor.deleteConfirmation":`删除“{name}”?供应商连接和密钥会保留。若它是默认模型,将选用其他可用模型,没有可用模型时清空默认值;已有会话的模型不会自动替换。之后可以重新添加此模型。`,"modelEditor.deleted":`模型已删除`}),o.addResourceBundle(`en-US`,`providers`,{"modelEditor.edit":`Edit model`,"modelEditor.add":`Add model`,"modelEditor.description":`Capabilities and reasoning levels`,"modelEditor.id":`Model ID`,"modelEditor.capabilities":`Model capabilities`,"modelEditor.chat":`Chat`,"modelEditor.image":`Image generation`,"modelEditor.video":`Video generation`,"modelEditor.capabilitiesHint":`Choose one or more. Image-only models reuse this connection’s key and stay out of the chat model picker.`,"modelEditor.chatCapabilities":`Chat capabilities`,"modelEditor.vision":`Image understanding`,"modelEditor.reasoning":`Reasoning`,"modelEditor.contextWindow":`Context window (tokens)`,"modelEditor.maxTokens":`Maximum output (tokens)`,"modelEditor.editNamed":`Edit model {name}`,"modelEditor.optionsNamed":`Model capabilities: {name}`,"modelEditor.delete":`Delete model`,"modelEditor.deleteNamed":`Delete model {name}`,"modelEditor.deleteConfirmation":`Delete “{name}”? The provider connection and credentials will remain. If this is the default model, another available model will be selected, or the default will be cleared if none is available. Existing conversations will keep their model bindings. You can add this model again later.`,"modelEditor.deleted":`Model deleted`});function pi(e){let t=(0,q.useContext)(on);return(0,q.useLayoutEffect)(()=>{t?.update(e)}),(0,q.useLayoutEffect)(()=>()=>t?.remove(e.id),[t,e.id]),{requestClose:(0,q.useCallback)(n=>{t?t.requestClose(e.id,n):n()},[t,e.id])}}var mi=[[`openai-responses`,`OpenAI Responses`],[`openai-completions`,`OpenAI Chat Completions`],[`anthropic-messages`,`Anthropic Messages`],[`google-generative-ai`,`Google Generative AI`]],hi={"openai-codex-responses":`OpenAI Codex Responses`,"azure-openai-responses":`Azure OpenAI Responses`,"mistral-conversations":`Mistral Conversations`,"bedrock-converse-stream":`Amazon Bedrock Converse`,"google-vertex":`Google Vertex AI`,"pi-messages":`Pi Messages`};function gi(e){return!e||mi.some(([t])=>t===e)?mi:[...mi,[e,hi[e]||e]]}var _i={openai:w,"openai-codex":w,anthropic:T,google:ye,deepseek:j,xai:le,openrouter:ce,"kimi-coding":ye,"zai-coding-cn":T},vi={saveFallbackModels(e){return f(`/api/config/fallback-models`,{method:`PUT`,body:JSON.stringify({models:e})})},saveAuxiliaryModel(e){return f(`/api/config/auxiliary-model`,{method:`PUT`,body:JSON.stringify({model:e})})},deleteModel(e,t){return f(`/api/providers/`+encodeURIComponent(e)+`/models`,{method:`DELETE`,body:JSON.stringify({modelId:t})})},saveModel(e,t,n=!1){return f(`/api/providers/`+encodeURIComponent(e)+`/models`+(n?``:`/options`),{method:n?`POST`:`PUT`,body:JSON.stringify(n?{...t,id:t.modelId,kind:t.capabilities[0]}:t)})},saveConnection(e,t){return f(`/api/providers/`+encodeURIComponent(e)+`/connection`,{method:`PUT`,body:JSON.stringify(t)})},importLocal(){return f(`/api/providers/import-local`,{method:`POST`,body:`{}`})}};function yi(e,t){return t.name!==e.name||t.api!==e.api||t.baseUrl!==(e.baseUrl||``)||!!t.apiKey}function bi({provider:e,onSave:t,draft:n,onDraftChange:r,onSavingChange:i,children:a}){let{t:o}=l(),[s,c]=(0,q.useState)(!1),[u,d]=(0,q.useState)(``),f=(0,q.useId)(),p=yi(e,n),m=async a=>{if(a.preventDefault(),!s){c(!0),i(!0),d(``);try{t(await vi.saveConnection(e.id,{...n,apiKey:n.apiKey.trim()||void 0})),r(void 0)}catch(e){d(e instanceof Error?e.message:String(e))}finally{c(!1),i(!1)}}};return(0,J.jsxs)(`form`,{onSubmit:e=>void m(e),"data-provider-connection-editor":!0,children:[(0,J.jsxs)(`fieldset`,{disabled:s,className:`min-w-0 divide-y divide-stroke-soft`,children:[(0,J.jsx)(Sr,{label:o(`config:configPage.displayName`),htmlFor:`${f}-name`,children:(0,J.jsx)(B,{id:`${f}-name`,required:!0,value:n.name,onChange:e=>r({...n,name:e.target.value})})}),(0,J.jsx)(Sr,{label:o(`config:configPage.apiKey`),htmlFor:`${f}-key`,children:(0,J.jsx)(B,{id:`${f}-key`,type:`password`,autoComplete:`new-password`,className:`font-mono placeholder:font-sans`,value:n.apiKey,placeholder:e.configured?o(`config:configPage.leaveBlankToKeepExistingKey`):o(`config:configPage.enterTheProviderAPIKey`),onChange:e=>r({...n,apiKey:e.target.value})})}),(0,J.jsx)(Sr,{label:o(`config:configPage.apiProtocol`),labelId:`${f}-api-label`,help:(0,J.jsx)(`span`,{className:`font-mono`,children:n.api}),children:(0,J.jsx)(K,{"aria-labelledby":`${f}-api-label`,value:n.api,onChange:e=>r({...n,api:e.target.value}),children:gi(n.api).map(([e,t])=>(0,J.jsx)(`option`,{value:e,children:t},e))})}),(0,J.jsx)(Sr,{label:`Base URL`,htmlFor:`${f}-url`,children:(0,J.jsx)(B,{id:`${f}-url`,required:!0,type:`url`,className:`font-mono`,value:n.baseUrl,onChange:e=>r({...n,baseUrl:e.target.value})})})]}),u&&(0,J.jsx)(W,{className:`mt-2 mb-3`,children:u}),a,(0,J.jsxs)(`div`,{className:L(`flex flex-wrap items-center justify-end gap-2 border-t border-stroke-soft py-3`,p&&`sticky bottom-0 z-[1] bg-background`),children:[p&&(0,J.jsx)(`span`,{role:`status`,className:`mr-auto text-xs text-content-muted`,children:o(`config:configPage.unsavedChanges`)}),(0,J.jsx)(z,{type:`submit`,className:`max-[650px]:h-11`,disabled:!p,loading:s,children:o(s?`config:configPage.saving`:`config:configPage.saveChanges`)})]})]})}var xi=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`];function Si({label:e,checked:t,disabled:n,onChange:r}){return(0,J.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":t,disabled:n,onClick:r,className:L(`inline-flex h-8 items-center gap-2 rounded-sm border px-2.5 text-sm transition-colors disabled:opacity-50 pointer-coarse:h-11`,t?`border-star-border bg-star-soft text-star-strong`:`border-stroke text-content-secondary hover:bg-surface-hover hover:text-content`),children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:L(`grid size-3.5 place-items-center rounded-[3px] border border-control`,t&&`border-star bg-star text-on-accent`),children:t&&(0,J.jsx)(E,{size:11})}),e]})}function Ci({provider:e,model:t,onSave:n,onClose:r}){let{t:i}=l(),[a]=(0,q.useState)(()=>t?.contextWindow||2e5),[o,s]=(0,q.useState)(()=>({modelId:t?.id||``,name:t?.name||``,capabilities:t?.capabilities||[t?.kind===`image`?`image`:t?.kind===`video`?`video`:`chat`],input:t?.input||[`text`],reasoning:t?.reasoning??!0})),[c,u]=(0,q.useState)(()=>({contextWindow:String(a),maxTokens:String(t?.maxTokens||8192)})),[d,f]=(0,q.useState)(t?.thinkingLevels||[`off`,`low`,`medium`,`high`]),[p,m]=(0,q.useState)(!1),[h,g]=(0,q.useState)(!1),[_,v]=(0,q.useState)(``),y=o.capabilities.includes(`chat`),b=async i=>{if(i.preventDefault(),!h){g(!0),v(``);try{n(await vi.saveModel(e.id,{...o,modelId:o.modelId.trim(),thinkingLevels:p?d:void 0,contextWindow:Number(c.contextWindow)===a?void 0:Number(c.contextWindow),maxTokens:Number(c.maxTokens)},!t)),r()}catch(e){v(e instanceof Error?e.message:String(e))}finally{g(!1)}}};return(0,J.jsx)(Et,{open:!0,onOpenChange:e=>{!e&&!h&&r()},children:(0,J.jsxs)(St,{className:`sm:max-w-[540px] p-5`,showCloseButton:!h,onEscapeKeyDown:e=>{h&&e.preventDefault()},onInteractOutside:e=>e.preventDefault(),children:[(0,J.jsxs)(Tt,{children:[(0,J.jsx)(Ct,{children:i(t?`providers:modelEditor.edit`:`providers:modelEditor.add`)}),(0,J.jsxs)(xt,{children:[e.name,` · `,i(`providers:modelEditor.description`)]})]}),(0,J.jsxs)(`form`,{onSubmit:e=>void b(e),className:`space-y-5`,children:[(0,J.jsxs)(`fieldset`,{disabled:h,className:`space-y-5`,children:[(0,J.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[i(`providers:modelEditor.id`),(0,J.jsx)(B,{required:!0,disabled:!!t,value:o.modelId,onChange:e=>s({...o,modelId:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[i(`config:configPage.modelName`),(0,J.jsx)(B,{value:o.name,onChange:e=>s({...o,name:e.target.value})})]})]}),(0,J.jsxs)(`fieldset`,{className:`space-y-2`,children:[(0,J.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:i(`providers:modelEditor.capabilities`)}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[`chat`,`image`,`video`].map(e=>(0,J.jsx)(Si,{label:i(e===`chat`?`providers:modelEditor.chat`:e===`image`?`providers:modelEditor.image`:`providers:modelEditor.video`),checked:o.capabilities.includes(e),onChange:()=>s({...o,capabilities:o.capabilities.includes(e)?o.capabilities.filter(t=>t!==e):[...o.capabilities,e]})},e))}),(0,J.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:i(`providers:modelEditor.capabilitiesHint`)})]}),y&&(0,J.jsxs)(`fieldset`,{className:`space-y-2`,children:[(0,J.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:i(`providers:modelEditor.chatCapabilities`)}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,J.jsx)(Si,{label:i(`providers:modelEditor.vision`),checked:o.input.includes(`image`),onChange:()=>s({...o,input:o.input.includes(`image`)?[`text`]:[`text`,`image`]})}),(0,J.jsx)(Si,{label:i(`providers:modelEditor.reasoning`),checked:o.reasoning,onChange:()=>s({...o,reasoning:!o.reasoning})})]})]}),y&&o.reasoning&&(0,J.jsxs)(`fieldset`,{children:[(0,J.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:i(`config:configPage.modelThinkingLevels`)}),!t&&!p&&(0,J.jsx)(`p`,{className:`mb-2 text-xs text-content-muted`,children:i(`config:configPage.modelThinkingLevelsAutoHint`)}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:xi.map(e=>(0,J.jsx)(Si,{label:e,checked:e===`off`||d.includes(e),disabled:e===`off`,onChange:()=>{m(!0),f(d.includes(e)?d.filter(t=>t!==e):[...d,e])}},e))})]}),y&&(0,J.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[`contextWindow`,`maxTokens`].map(e=>(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[i(e===`contextWindow`?`providers:modelEditor.contextWindow`:`providers:modelEditor.maxTokens`),(0,J.jsx)(B,{required:!0,type:`number`,min:1,max:1e8,step:1,value:c[e],onChange:t=>u({...c,[e]:t.target.value})})]},e))})]}),_&&(0,J.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:_}),(0,J.jsxs)(wt,{children:[(0,J.jsx)(z,{type:`button`,variant:`ghost`,disabled:h,onClick:r,children:i(`config:configPage.cancel`)}),(0,J.jsxs)(z,{type:`submit`,disabled:h||!o.capabilities.length||!o.modelId.trim(),children:[h&&(0,J.jsx)(F,{className:`animate-spin`,size:14}),` `,i(h?`config:configPage.saving`:`config:configPage.saveChanges`)]})]})]})]})})}function wi(e,t){let n=e.providers.filter(e=>e.configured||e.custom),r=e.defaultProvider||e.provider;return{providers:n,selected:n.find(e=>e.id===t)??n.find(e=>e.id===r)??n[0],defaultId:r}}function Ti(e){let t=e.trim().split(/[\s_\-/.]+/).filter(Boolean);if(t.length>1)return(Array.from(t[0])[0]+Array.from(t[1])[0]).toUpperCase();let n=Array.from(t[0]||`?`);return n[0].toUpperCase()+(n[1]||``)}function Ei(e){return e?e>=1e6?`${Number((e/1e6).toFixed(2))}M`:e>=1e3?`${Math.round(e/1e3)}K`:String(e):`—`}function Di(e){return gi(e).find(([t])=>t===e)?.[1]||e}var Oi=`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 @min-[560px]/card:grid-cols-[minmax(0,1.2fr)_minmax(0,1fr)_64px_76px_minmax(88px,auto)]`;function ki(e){let{t}=l(),n=(0,q.useId)(),{providers:r,defaultId:i}=wi(e.config,e.selectedProviderId),a=r.find(t=>t.id===e.selectedProviderId),[o,s]=(0,q.useState)({}),[c,u]=(0,q.useState)(!1),[d,f]=(0,q.useState)(null),p=!!(c||e.settingDefault||e.settingModel||e.toggling||e.deletingModel);pi({id:`provider-drafts-${n}`,dirty:r.some(e=>!!(o[e.id]&&yi(e,o[e.id]))),saving:p,discard:()=>s({})});let m={chat:t(`providers:modelEditor.chat`),image:t(`providers:modelEditor.image`),video:t(`providers:modelEditor.video`),reasoning:t(`providers:modelEditor.reasoning`)},h=e=>{let t=e.capabilities||[e.kind];return[[`chat`,oe,t.includes(`chat`)],[`image`,ie,t.includes(`image`)],[`video`,I,t.includes(`video`)],[`reasoning`,T,!!e.reasoning&&t.includes(`chat`)]].filter(([,,e])=>e).map(([e,t])=>(0,J.jsxs)(`span`,{title:m[e],className:`inline-flex`,children:[(0,J.jsx)(t,{size:13,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`sr-only`,children:m[e]})]},e))},g=e=>e.configured?t(`config:providerWorkbench.keyConfigured`):e.id===`openai-codex`?t(`config:configPage.codexCLILoginRequired`):t(`config:configPage.apiKeyRequired`),_=e=>e.configured?e.enabled?(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,J.jsx)(E,{className:`size-3.5`,"aria-hidden":`true`}),t(`config:providerWorkbench.connected`)]}):t(`config:configPage.disabled2`):t(`config:providerWorkbench.notConnected`),v=n=>(0,J.jsxs)(`div`,{className:`@container/card min-w-0`,"data-provider-detail":n.id,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 border-t border-stroke-soft py-2`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-content-muted`,children:n.id}),(0,J.jsxs)(`span`,{className:`flex items-center gap-2 text-sm text-content-secondary`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:t(`config:configPage.enabled`)}),(0,J.jsx)(br,{value:n.configured&&n.enabled,disabled:!n.configured||p,onChange:()=>void e.onToggle(n,!n.enabled),ariaLabel:t(`config:configPage.providerEnabled`,{name:n.name})})]}),(0,J.jsxs)(Ge,{children:[(0,J.jsx)(Ue,{asChild:!0,children:(0,J.jsx)(z,{variant:`ghost`,size:`icon-sm`,className:`pointer-coarse:size-11 max-[650px]:size-11`,"aria-label":t(`config:providerWorkbench.actions`),children:(0,J.jsx)(N,{size:16})})}),(0,J.jsxs)(We,{align:`end`,children:[(0,J.jsxs)(Ve,{disabled:n.id===i||!n.configured||!n.enabled||!n.defaultModel||p,onSelect:()=>void e.onSetDefault(n),children:[(0,J.jsx)(Nn,{size:14}),t(`config:configPage.setAsDefaultProvider`)]}),(0,J.jsxs)(Ve,{disabled:p,onSelect:()=>e.onClone(n),children:[(0,J.jsx)(M,{size:14}),t(`config:configPage.cloneProvider`)]}),n.custom&&(0,J.jsxs)(Ve,{className:`text-destructive`,disabled:p,onSelect:()=>void e.onDelete(n),children:[(0,J.jsx)(xe,{size:14}),t(`config:configPage.deleteProvider`)]})]})]})]}),(0,J.jsxs)(bi,{provider:n,draft:o[n.id]??{name:n.name,api:n.api,baseUrl:n.baseUrl||``,apiKey:``},onDraftChange:e=>s(t=>({...t,[n.id]:e})),onSavingChange:u,onSave:e.onSave,children:[(0,J.jsxs)(`div`,{className:`mt-2 flex min-h-10 items-center gap-2 border-t border-stroke-soft pt-2`,children:[(0,J.jsxs)(`h3`,{className:`text-[13px] font-medium text-content-muted`,children:[t(`config:providerWorkbench.models`),(0,J.jsxs)(`span`,{className:`tabular-nums`,children:[` · `,n.models.length]})]}),(0,J.jsxs)(z,{type:`button`,variant:`secondary`,size:`sm`,className:`ml-auto pointer-coarse:h-11 max-[650px]:h-11`,disabled:p,onClick:()=>f({provider:n}),children:[(0,J.jsx)(de,{size:14}),t(`providers:modelEditor.add`)]})]}),n.models.length>0&&(0,J.jsxs)(`div`,{className:L(Oi,`hidden h-8 text-xs font-medium text-content-muted @min-[560px]/card:grid`),children:[(0,J.jsx)(`span`,{children:t(`providers:modelEditor.id`)}),(0,J.jsx)(`span`,{children:t(`config:configPage.displayName`)}),(0,J.jsx)(`span`,{className:`text-right`,children:t(`config:providerWorkbench.contextColumn`)}),(0,J.jsx)(`span`,{children:t(`providers:modelEditor.capabilities`)}),(0,J.jsx)(`span`,{"aria-hidden":`true`})]}),n.models.map(r=>{let i=n.defaultModel===r.id;return(0,J.jsxs)(`div`,{"data-provider-model":r.id,className:L(Oi,`min-h-11.5 border-t border-stroke-soft py-px text-sm text-content-secondary`),children:[(0,J.jsxs)(`button`,{type:`button`,onClick:()=>f({provider:n,model:r}),disabled:p,className:`flex min-h-11 min-w-0 flex-col justify-center rounded-xs py-1 text-left`,"aria-label":t(`providers:modelEditor.editNamed`,{name:r.name||r.id}),children:[(0,J.jsx)(`span`,{className:`block truncate font-mono text-[12.5px] text-content`,children:r.id}),(0,J.jsxs)(`span`,{className:`mt-0.5 flex min-w-0 items-center gap-2 text-xs text-content-muted @min-[560px]/card:hidden`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:r.name||r.id}),(0,J.jsx)(`span`,{className:`tabular-nums`,children:Ei(r.contextWindow)}),h(r)]})]}),(0,J.jsx)(`span`,{className:`hidden min-w-0 truncate text-content @min-[560px]/card:block`,children:r.name||r.id}),(0,J.jsx)(`span`,{className:`hidden text-right tabular-nums @min-[560px]/card:block`,children:Ei(r.contextWindow)}),(0,J.jsx)(`span`,{className:`hidden items-center gap-2 text-content-muted @min-[560px]/card:flex`,children:h(r)}),(0,J.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5`,children:[r.kind===`chat`&&(0,J.jsx)(z,{type:`button`,variant:`ghost`,size:`icon-sm`,className:L(`pointer-coarse:size-11 max-[650px]:size-11`,i&&`text-star disabled:opacity-100 aria-disabled:opacity-100`),"aria-label":t(`config:configPage.providerDefaultModel`)+`: `+r.id,title:t(`config:configPage.providerDefaultModel`),"aria-pressed":i,disabled:p||!n.configured||i,onClick:()=>void e.onSetDefaultModel(n,r.id),children:(0,J.jsx)(Nn,{size:15,className:L(i&&`fill-current`)})}),(0,J.jsx)(z,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`pointer-coarse:size-11 max-[650px]:size-11`,"aria-label":t(`providers:modelEditor.optionsNamed`,{name:r.id}),disabled:p,onClick:()=>f({provider:n,model:r}),children:(0,J.jsx)(ve,{size:14})}),(0,J.jsx)(z,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`hover:bg-danger-soft hover:text-danger pointer-coarse:size-11 max-[650px]:size-11`,disabled:p,"aria-label":t(`providers:modelEditor.deleteNamed`,{name:r.name||r.id}),title:t(`providers:modelEditor.delete`),onClick:()=>void e.onDeleteModel(n,r),children:(0,J.jsx)(xe,{size:14})})]})]},r.id)})]},n.id)]});return(0,J.jsxs)(U,{"data-config-card":`models-connections`,"data-model-provider-list":!0,title:t(`config:providerWorkbench.providers`),count:r.length,meta:e.meta,children:[r.length>0?(0,J.jsx)(H,{children:r.map(n=>{let r=n.id===i,o=a?.id===n.id;return(0,J.jsx)(V,{"data-provider-row":n.id,icon:(0,J.jsx)(`span`,{className:`text-[13px] font-semibold text-content-secondary`,children:Ti(n.name)}),name:n.name,description:[...n.configured?[]:[g(n)],t(`config:configPage.countModels`,{count:n.models.length}),Di(n.api)].join(` · `),status:(0,J.jsxs)(J.Fragment,{children:[r&&(0,J.jsx)(Lt,{variant:`outline`,"data-provider-default":!0,className:`mr-2`,children:t(`config:providerWorkbench.default`)}),_(n)]}),expanded:o,onExpandedChange:t=>e.onSelectProvider(t?n.id:``),toggleLabel:t(`config:providerWorkbench.toggleProvider`,{name:n.name}),detail:o?v(n):null},n.id)})}):(0,J.jsxs)(`div`,{className:`grid min-h-48 place-content-center justify-items-center gap-2 border-y border-stroke px-6 py-8 text-center`,children:[(0,J.jsx)(At,{size:40,className:`mb-1`}),(0,J.jsx)(`p`,{className:`text-sm font-medium text-content`,children:t(`config:providerWorkbench.noConnections`)}),(0,J.jsx)(`p`,{className:`max-w-sm text-xs text-content-muted`,children:t(`config:providerWorkbench.addConnectionHint`)})]}),e.onAddConnection&&(0,J.jsxs)(`button`,{type:`button`,"data-add-provider":!0,disabled:p,onClick:e.onAddConnection,className:`flex min-h-[52px] w-full min-w-0 items-center gap-2.5 text-left text-sm text-content-secondary transition-colors duration-(--d-fast) hover:text-content focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus disabled:opacity-50`,children:[(0,J.jsx)(de,{size:16,"aria-hidden":`true`,className:`flex-none text-content-muted`}),(0,J.jsx)(`span`,{className:`flex-none`,children:t(`config:providerWorkbench.addProvider`)}),(0,J.jsx)(`span`,{className:`min-w-0 truncate text-xs text-content-muted`,children:t(`config:providerWorkbench.addProviderHint`)})]}),d&&(0,J.jsx)(Ci,{provider:d.provider,model:d.model,onSave:e.onSave,onClose:()=>f(null)})]})}function Ai(){let e=globalThis.crypto.getRandomValues(new Uint32Array(4));return`custom-${Array.from(e,e=>e.toString(16).padStart(8,`0`)).join(``)}`}function ji({value:e,onChange:t,configured:n=!1,cloning:r=!1}){let{t:i}=l();return(0,J.jsxs)(G,{variant:`control`,children:[i(`config:configPage.apiKey`),(0,J.jsx)(B,{type:`password`,autoComplete:`new-password`,value:e,onChange:e=>t(e.target.value),placeholder:i(r?`config:configPage.leaveBlankToCopySourceKey`:n?`config:configPage.leaveBlankToKeepExistingKey`:`config:configPage.enterTheProviderAPIKey`)})]})}function Mi({ids:e,onChange:t,placeholder:n,primaryId:r=``}){let{t:i}=l(),[a,o]=(0,q.useState)(``),s=()=>{let n=a.trim();!n||n===r.trim()||e.includes(n)||(t([...e,n]),o(``))};return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(G,{variant:`control`,children:[i(`config:configPage.manualModelIds`),(0,J.jsxs)(`div`,{className:`flex items-stretch gap-1.5`,children:[(0,J.jsx)(B,{"aria-label":i(`config:configPage.manualModelIds`),value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),s())},placeholder:n}),(0,J.jsx)(z,{type:`button`,size:`icon`,variant:`secondary`,className:`h-auto w-8.5 flex-none pointer-coarse:w-11`,"aria-label":i(`config:configPage.manualModelIds`),disabled:!a.trim(),onClick:s,children:(0,J.jsx)(de,{size:14})})]})]}),e.length>0&&(0,J.jsx)(`div`,{className:`flex flex-col overflow-hidden rounded-md border border-stroke`,children:e.map(n=>(0,J.jsxs)(`div`,{className:`flex min-h-9 min-w-0 items-center gap-2 border-b border-stroke-soft py-1 pr-1 pl-2.5 last:border-b-0`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[12.5px] text-content`,children:n}),(0,J.jsx)(`button`,{type:`button`,"aria-label":i(`config:configPage.delete`),className:`grid size-7 flex-none cursor-pointer place-items-center rounded-sm border-0 bg-transparent p-0 text-content-muted hover:bg-danger-soft hover:text-danger pointer-coarse:size-11`,onClick:()=>t(e.filter(e=>e!==n)),children:(0,J.jsx)(we,{size:12})})]},n))}),(0,J.jsx)(`p`,{className:`text-xs text-content-muted`,children:i(`config:configPage.manualModelIdsHint`)})]})}function Ni(e,t){return e?.models.find(t=>t.id===e.defaultModel)||(t===`visual`?e?.models.find(e=>e.kind===`image`||e.kind===`video`):e?.models.find(e=>e.kind===`chat`)||e?.models[0])}function Pi({onClose:e,onCreated:t,onConfigChanged:n,initialProviderType:r=`chat`,initialProvider:i,cloneProvider:a,embedded:o=!1}){let{t:s}=l(),c=i||a,u=!!a,d=c?.type||r,p=Ni(c,d),[m,h]=(0,q.useState)(``),g=!!(i||m),[_,v]=(0,q.useState)(()=>({name:a?s(`config:configPage.clonedProviderName`,{name:a.name}):i?.name||``,id:a?Ai():i?.id||``,providerType:d,api:i?.api||`openai-responses`,baseUrl:i?.baseUrl||``,model:p?.id||``,modelName:p?.name||``,modelKind:p?.kind===`image`||p?.kind===`video`?p.kind:d===`visual`?`image`:`chat`,reasoning:p?.reasoning!==!1,thinkingLevels:p?.thinkingLevels||[],enabled:i?.enabled??!0})),y=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`],[b,x]=(0,q.useState)(!1),S=e=>{x(!0),v(t=>({...t,thinkingLevels:t.thinkingLevels.includes(e)?t.thinkingLevels.filter(t=>t!==e):[...t.thinkingLevels,e]}))},[C,w]=(0,q.useState)(!1),[T,D]=(0,q.useState)(``),[O,k]=(0,q.useState)(``),A=O.trim()||void 0,[j,M]=(0,q.useState)([]),ee=e=>v(t=>({...t,name:e,id:t.id||e.toLowerCase().replace(/[^a-z0-9._-]+/g,`-`).replace(/^-+|-+$/g,``)}));return(0,q.useEffect)(()=>{if(o||C)return;let t=t=>{t.key===`Escape`&&(t.preventDefault(),t.stopPropagation(),e())};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[o,e,C]),(0,J.jsx)(`div`,{className:o?`provider-config-inline`:`modal-backdrop max-[650px]:p-[8px] fixed z-[70] inset-0 grid place-items-center overflow-y-auto bg-[var(--modal-overlay)] [padding:20px] [overscroll-behavior:contain] [animation:fade-in_var(--d1)_var(--ease-out)]`,onMouseDown:t=>!o&&!C&&t.target===t.currentTarget&&e(),children:(0,J.jsxs)(`form`,{role:o?void 0:`dialog`,"aria-modal":!o||void 0,className:o?`provider-config-form grid gap-3 text-sm [&_label]:!mt-0 [&_label]:!text-sm [&_label]:font-medium [&_input]:!h-9 [&_input]:!min-h-9 [&_input]:rounded-lg [&_input]:!text-sm [&_select]:!h-9 [&_select]:!min-h-9 [&_select]:rounded-lg [&_select]:!text-sm [&_summary]:text-sm`:`modal provider-config-modal max-h-[calc(100dvh_-_40px)] !w-[min(620px,100%)] overflow-y-auto overscroll-contain rounded-lg border border-stroke bg-solid p-[18px] shadow-float [animation:modal-in_var(--d2)_var(--ease-out)] max-[650px]:max-h-[calc(100dvh_-_16px)]`,onSubmit:async e=>{if(e.preventDefault(),!C){if(!u&&!A&&!i?.configured&&!m){D(s(`config:configPage.enterTheAPIKeyForThisConnection`));return}w(!0),D(``);try{if(a){t(await f(`/api/providers/${encodeURIComponent(a.id)}/clone`,{method:`POST`,body:JSON.stringify({name:_.name,id:_.id,apiKey:A})}));return}let e=g?await f(`/api/config`,{method:`PUT`,body:JSON.stringify({..._,apiKey:A,thinkingLevels:b?_.thinkingLevels:void 0,provider:m||_.id,providerName:_.name,setAsDefault:!1})}):await f(`/api/providers`,{method:`POST`,body:JSON.stringify({..._,apiKey:A,thinkingLevels:b?_.thinkingLevels:void 0})}),r=e.createdProviderId||m||_.id;i||(h(r),v(e=>({...e,id:r})),n?.(e));let o=new Set((i?.models||[]).map(e=>e.id)),s=j.filter(e=>e!==_.model.trim()&&!o.has(e));if(s.length)try{e=await f(`/api/providers/${encodeURIComponent(r)}/models/batch`,{method:`POST`,body:JSON.stringify({models:s.map(e=>({id:e,kind:_.providerType===`visual`?_.modelKind:`chat`}))})})}catch(e){D(e instanceof Error?e.message:String(e));return}t(e)}catch(e){D(e instanceof Error?e.message:String(e))}finally{w(!1)}}},children:[!o&&(0,J.jsxs)(Vt,{children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{children:s(u?`config:configPage.cloneProvider`:g?`config:configPage.editProviderConnection`:`config:configPage.addProviderConnection`)}),!u&&(0,J.jsx)(`p`,{children:s(g?`config:configPage.updateProviderKeyURLAndModelSettings`:`config:configPage.youCanCreateMultipleConnectionsUsingTheSameProtocolEachWithItsOwnKeyAndBaseURL`)})]}),(0,J.jsx)(z,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":s(`config:configPage.closeDialog`),disabled:C,onClick:t=>{t.preventDefault(),t.stopPropagation(),e()},children:(0,J.jsx)(we,{size:17})})]}),(0,J.jsxs)(`div`,{className:`form-grid grid gap-3 sm:grid-cols-2`,children:[(0,J.jsxs)(G,{variant:`control`,children:[s(`config:configPage.displayName`),(0,J.jsx)(B,{value:_.name,onChange:e=>ee(e.target.value),placeholder:s(`config:configPage.forExampleOpenAIOfficial`)})]}),(0,J.jsxs)(G,{variant:`control`,children:[`Provider ID`,(0,J.jsx)(B,{value:_.id,disabled:g,onChange:e=>v({..._,id:e.target.value}),placeholder:`openai-official`})]})]}),(0,J.jsx)(ji,{value:O,onChange:k,configured:i?.configured,cloning:u}),!u&&(0,J.jsxs)(J.Fragment,{children:[!o&&(0,J.jsxs)(`div`,{className:`mt-2.5 flex items-center justify-between gap-2 rounded-sm border border-stroke-soft bg-surface-subtle px-2.5 py-2`,children:[(0,J.jsx)(`span`,{className:`text-xs text-content-muted`,children:s(`config:configPage.providerPurpose`)}),(0,J.jsx)(`strong`,{className:`font-mono text-xs font-medium`,children:_.providerType===`visual`?s(`config:configPage.visualProvider`):s(`config:configPage.chatProvider`)})]}),(0,J.jsxs)(G,{variant:`control`,children:[s(`config:configPage.apiProtocol`),(0,J.jsx)(K,{value:_.api,onChange:e=>v({..._,api:e.target.value}),children:mi.map(([e,t])=>(0,J.jsx)(`option`,{value:e,children:t},e))})]}),(0,J.jsxs)(G,{variant:`control`,children:[`Base URL`,(0,J.jsx)(B,{value:_.baseUrl,onChange:e=>v({..._,baseUrl:e.target.value}),placeholder:`https://api.openai.com/v1`})]}),(0,J.jsxs)(`div`,{className:`form-grid grid gap-3 sm:grid-cols-2`,children:[(0,J.jsxs)(G,{variant:`control`,children:[s(g?`config:configPage.providerDefaultModel`:`config:configPage.initialModelID`),(0,J.jsx)(B,{value:_.model,onChange:e=>v({..._,model:e.target.value}),placeholder:_.providerType===`visual`?`gpt-image-2 or grok-imagine-video`:`gpt-5.4 or gpt-image-1`})]}),(0,J.jsxs)(G,{variant:`control`,children:[s(`config:configPage.modelName`),(0,J.jsx)(B,{value:_.modelName,onChange:e=>v({..._,modelName:e.target.value}),placeholder:s(`config:configPage.leaveBlankToUseTheModelID`)})]})]}),(0,J.jsxs)(`details`,{open:!o||void 0,className:`group rounded-lg border border-border px-3 py-2 [&[open]]:space-y-3`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer text-[13px] text-muted-foreground`,children:s(`config:providerWorkbench.modelOptions`)}),(0,J.jsxs)(G,{variant:`control`,children:[s(`config:configPage.modelType`),(0,J.jsxs)(K,{value:_.modelKind,onChange:e=>v({..._,modelKind:e.target.value,providerType:e.target.value===`chat`?`chat`:`visual`}),children:[(0,J.jsx)(`option`,{value:`chat`,children:s(`providers:modelEditor.chat`)}),(0,J.jsx)(`option`,{value:`image`,children:s(`providers:modelEditor.image`)}),(0,J.jsx)(`option`,{value:`video`,children:s(`providers:modelEditor.video`)})]})]}),(0,J.jsx)(`div`,{className:`grid gap-[9px]`,children:(0,J.jsx)(Mi,{ids:j,onChange:M,primaryId:_.model,placeholder:_.providerType===`visual`?`gpt-image-1`:`gpt-5.5`})}),_.modelKind===`chat`&&(0,J.jsxs)(G,{variant:`control`,children:[s(`config:configPage.modelThinkingLevels`),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-[6px]`,children:y.map(e=>{let t=e===`off`,n=t||_.thinkingLevels.includes(e),r=t||!_.reasoning&&e!==`off`;return(0,J.jsxs)(`button`,{type:`button`,"aria-pressed":n,disabled:r,onClick:()=>!t&&S(e),className:L(`inline-flex h-[27px] cursor-pointer items-center gap-[4px] rounded-full border px-[10px] text-[12px] font-medium transition-colors`,n?`border-[var(--control-selected-border)] bg-[var(--control-selected-bg)] text-[var(--control-selected-text)]`:`border-[var(--stroke)] bg-[var(--surface-subtle)] text-[var(--text)] hover:bg-[var(--surface-highlight)]`,t?`cursor-default`:r&&`cursor-not-allowed opacity-40`),children:[n&&(0,J.jsx)(E,{size:12}),e]},e)})}),(0,J.jsx)(`small`,{className:`text-[var(--text-muted)]`,children:s(`config:configPage.modelThinkingLevelsHint`)})]})]}),!o&&(0,J.jsxs)(`div`,{className:`mt-2.5 flex min-h-11 items-center justify-between gap-3 rounded-sm border border-[var(--stroke-soft)] bg-[var(--surface-subtle)] px-2.5 py-2`,children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,J.jsx)(`strong`,{className:`text-[13px]`,children:g?s(`config:configPage.providerEnabled`,{name:_.name}):s(`config:configPage.enableAfterCreation`)}),_.providerType===`visual`&&(0,J.jsx)(`small`,{className:`text-[13px] text-muted-foreground`,children:s(`config:configPage.visualModelsAreSelectedByTheVisualGenerationToolAndDoNotAppearInTheChatModelList`)})]}),(0,J.jsx)(br,{value:_.enabled,onChange:e=>v({..._,enabled:e})})]})]}),T&&(0,J.jsxs)(zt,{children:[(0,J.jsx)(Se,{size:13}),T]}),(0,J.jsxs)(`div`,{className:`mt-[18px] flex justify-end gap-2`,children:[(0,J.jsx)(z,{type:`button`,variant:`secondary`,className:`max-[650px]:h-11`,disabled:C,onClick:e,children:s(`config:configPage.cancel`)}),(0,J.jsxs)(z,{type:`submit`,className:`max-[650px]:h-11`,disabled:C,children:[C?(0,J.jsx)(R,{className:`text-current`}):g?(0,J.jsx)(E,{size:14}):(0,J.jsx)(de,{size:14}),s(C?`config:configPage.saving`:u?`config:configPage.cloneProvider`:g?`config:configPage.saveChanges`:`config:configPage.createConnection`)]})]})]})})}function Fi(e){return(e.providers||[]).filter(e=>e.importable&&!e.imported&&!e.conflict).length}function Ii(e){return Fi(e)>0}function Li(e,t){return!t&&!Ii(e)}function Ri(e,t,n){let r=e.providers||[],i=e.errors||[],a=Ii(e),o=!!(n||i.length||r.some(e=>e.conflict||!e.imported&&!e.importable||e.warnings?.some(e=>e.code!==`login_auth_not_imported`)));return t||a||o}function zi(e){return e.source===`codex-config`?`Codex config.toml`:e.source===`claude-config`?`Claude settings.json`:e.source===`codex-auth`?`Codex login`:`Claude login`}function Bi(e,t){return e.authType===`environment`?t(`config:configPage.keyVariableName`,{name:e.authVariable}):e.authType===`bearer`||e.authType===`api_key`?t(`config:configPage.authenticationIncludedInConfiguration`):e.authType===`oauth`?t(`config:configPage.loginStateFileDetected`):e.authType===`external-login`?t(`config:configPage.authenticationRequired`):t(`config:configPage.noAuthenticationInConfiguration`)}function Vi(e,t){return t(e===`multiple_auth_values`?`config:configPage.multipleAuthenticationFieldsWereDetectedTheAuthorizationFieldTakesPrecedence`:e===`invalid_url`?`config:configPage.theProviderEndpointIsInvalid`:e===`unsupported_api`?`config:configPage.theAPIProtocolInThisConfigurationIsNotSupportedYet`:e===`invalid_env_name`?`config:configPage.theKeyEnvironmentVariableNameIsInvalid`:`config:configPage.someConfigurationFieldsCannotBeImported`)}function Hi({discovery:e,discovering:t,error:n,importing:r,forceVisible:i=!1,onRefresh:a,onImport:o}){let{t:s}=l(),[c,u]=(0,q.useState)(null),d=e.providers||[],f=e.errors||[];if(!i&&!Ri(e,t,n))return null;let p=c??(!i&&Li(e,t)),m=()=>(u(null),a()),h=e=>(u(null),o(e)),g=e=>[`invalid_json`,`invalid_toml`].includes(e.code)?s(`config:configPage.invalidConfigurationFileFormat`):e.code===`unsupported_config`?s(`config:configPage.noImportableProviderConfigurationWasFound`):e.code===`invalid_login_state`?s(`config:configPage.incompleteLoginState`):e.code===`file_too_large`?s(`config:configPage.configurationFileIsTooLarge`):s(`config:configPage.unableToReadTheConfigurationFile`);return(0,J.jsxs)(_r,{className:`mb-3 py-3.5`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2.5 max-[650px]:flex-wrap`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 cursor-pointer items-center gap-3 rounded-sm border-0 bg-transparent p-0 text-left max-[650px]:basis-full`,"aria-expanded":!p,onClick:()=>u(!p),children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-9.5 shrink-0 place-items-center rounded-lg border border-key-border bg-key text-content-muted shadow-key`,children:(0,J.jsx)(ge,{size:18})}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,J.jsx)(`span`,{className:`text-sm font-medium text-content`,children:s(`config:configPage.localProviderConfiguration`)}),(0,J.jsx)(`span`,{className:`text-xs leading-[1.45] text-content-muted`,children:s(`config:configPage.readProviderEndpointModelAndAuthenticationFieldsFromCodexConfigTomlAndClaudeSettingsJson`)})]}),(0,J.jsx)(D,{size:16,"aria-hidden":`true`,className:L(`flex-none text-content-muted transition-transform`,!p&&`rotate-180`)})]}),(0,J.jsxs)(z,{type:`button`,variant:`secondary`,className:`max-[650px]:h-11`,disabled:t||!!r,onClick:m,children:[t?(0,J.jsx)(R,{className:`text-current`}):(0,J.jsx)(fe,{size:13}),s(`config:configPage.rescan`)]})]}),!p&&(0,J.jsxs)(J.Fragment,{children:[t&&!d.length?(0,J.jsxs)(`div`,{role:`status`,className:`mt-3 flex min-h-12 items-center justify-center gap-2 rounded-sm bg-surface-subtle text-xs text-content-muted`,children:[(0,J.jsx)(R,{}),s(`config:configPage.scanningProviderConfigurationFiles`)]}):d.length?(0,J.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-2 max-[650px]:grid-cols-1`,children:d.map(e=>{let t=zi(e),n=r===e.id,i=e.source.startsWith(`claude-`)?T:w,a=e.kind===`authentication`?s(`config:configPage.officialProviderAuthenticationOnly`):e.models?.length?e.models.map(e=>e.id).join(`, `):s(`config:configPage.noModelSpecified`);return(0,J.jsxs)(`div`,{className:L(`grid min-h-17 min-w-0 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2.5 rounded-md border px-3 py-2 max-[650px]:grid-cols-[auto_minmax(0,1fr)]`,e.imported?`border-success-border bg-success-soft`:`border-stroke bg-panel`),children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-7.5 place-items-center rounded-md border border-key-border bg-key text-content-muted shadow-key`,children:(0,J.jsx)(i,{size:15})}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,J.jsxs)(`span`,{className:`truncate text-sm font-medium text-content`,children:[t,` · `,e.providerName]}),(0,J.jsxs)(`span`,{className:`truncate font-mono text-xs text-content-muted`,children:[e.api,` · `,a]}),(0,J.jsxs)(`span`,{className:`truncate text-xs text-content-muted`,children:[e.kind===`authentication`?s(`config:configPage.officialEndpointOnly`):e.baseUrl||s(`config:configPage.noBaseURLSpecified`),` `,`· `,Bi(e,s),` · `,e.location]})]}),(0,J.jsx)(`span`,{className:`flex min-w-0 flex-none items-center max-[650px]:col-start-2`,children:e.imported?(0,J.jsx)(yr,{tone:`green`,children:s(`config:configPage.loaded`)}):e.conflict?(0,J.jsx)(yr,{tone:`amber`,children:s(`config:configPage.conflictDetected`)}):e.importable?(0,J.jsxs)(z,{type:`button`,size:`sm`,className:`pointer-coarse:h-11`,disabled:n||!!r,onClick:()=>h(e),children:[n?(0,J.jsx)(R,{className:`size-3 text-current`}):(0,J.jsx)(ee,{size:12}),n?s(`config:configPage.loading`):e.kind===`authentication`?s(`config:configPage.loadLoginState`):s(`config:configPage.loadConfiguration`)]}):(0,J.jsx)(yr,{tone:`gray`,children:s(`config:configPage.cannotLoad`)})})]},e.id)})}):(0,J.jsxs)(`div`,{className:`mt-3 flex min-h-12 items-center justify-center gap-2 rounded-sm bg-surface-subtle px-3 text-center text-xs text-content-muted`,children:[(0,J.jsx)(ge,{size:15,"aria-hidden":`true`}),s(`config:configPage.noImportableCodexOrClaudeProviderConfigurationWasDetected`)]}),(n||f.length>0||d.some(e=>e.warnings?.some(e=>e.code!==`login_auth_not_imported`)))&&(0,J.jsxs)(`div`,{className:`mt-2 flex flex-col gap-1 text-xs text-danger [&_span]:flex [&_span]:items-center [&_span]:gap-1.5`,"aria-live":`polite`,children:[n&&(0,J.jsxs)(`span`,{children:[(0,J.jsx)(Se,{size:13}),n]}),f.map((e,t)=>(0,J.jsxs)(`span`,{children:[(0,J.jsx)(Se,{size:13}),zi(e),` · `,g(e)]},`${e.source}-${e.code}-${t}`)),d.flatMap(e=>(e.warnings||[]).filter(e=>e.code!==`login_auth_not_imported`).map((t,n)=>(0,J.jsxs)(`span`,{children:[(0,J.jsx)(Se,{size:13}),zi(e),` · `,Vi(t.code,s)]},`${e.id}-${t.code}-${n}`)))]})]})]})}function Ui(e){try{return{name:new URL(e).hostname.replace(/^www\./i,``)||`Custom Provider`}}catch{return{name:`Custom Provider`}}}function Wi({config:e,providerType:t=`chat`,initialProviderId:n,onClose:r,onConfigChanged:i,onCompleted:a}){let{t:o}=l(),s=n&&e.providers.find(e=>e.id===n)||null,[c,u]=(0,q.useState)(1),[d,p]=(0,q.useState)(s),[m]=(0,q.useState)(Ai),[h,g]=(0,q.useState)(``),_=(0,q.useRef)(null),v=(0,q.useRef)(null),[y,S]=(0,q.useState)(s?.baseUrl||``),[C,w]=(0,q.useState)(s?.api||`openai-responses`),[T,D]=(0,q.useState)(``),O=T.trim()||void 0,[k,A]=(0,q.useState)(s?.organization||``),[j,M]=(0,q.useState)(s?.name||``),[ee,N]=(0,q.useState)(s?.models||[]),[P,te]=(0,q.useState)(s?.defaultModel||``),[ne,re]=(0,q.useState)([]),[ie,ae]=(0,q.useState)(s?.models.find(e=>e.id===s.defaultModel)?.kind||(t===`visual`?`image`:`chat`)),[F,oe]=(0,q.useState)(!1),[se,I]=(0,q.useState)(``),[ce,le]=(0,q.useState)(``),ue=Ui(y),de=o(t===`visual`?`config:configPage.visualProvider`:`config:configPage.chatProvider`),pe=o(c===1?`config:configPage.quickSetupStepBaseUrl`:c===2?`config:configPage.quickSetupStepProtocol`:`config:configPage.quickSetupStepModel`),me=ee.filter(e=>t===`visual`?e.kind===`image`||e.kind===`video`:e.kind===`chat`),he=()=>{let e=y.trim();try{let t=new URL(e);if(![`http:`,`https:`].includes(t.protocol))throw Error()}catch{I(o(`config:configPage.providerBaseURLMustBeHTTPOrHTTPS`));return}I(``),j.trim()||M(ue.name),u(2)},_e=()=>{if(!C){I(o(`config:configPage.selectAPIProtocol`));return}I(``),u(3)},ve=async()=>{if(F)return;let e=d;if(!O&&!e?.configured&&!h){I(o(`config:configPage.enterTheAPIKeyForThisConnection`));return}oe(!0),I(``),le(``);try{let n=((await f(`/api/providers/models/discover-connection`,{method:`POST`,body:JSON.stringify({providerId:e?.id||h,providerType:t,api:C,baseUrl:y,organization:k,apiKey:O})})).models||[]).filter(e=>t===`visual`?e.kind===`image`||e.kind===`video`:e.kind===`chat`);if(!n.length){I(o(t===`visual`?`config:configPage.fetchOrAddAVisualModel`:`config:configPage.fetchOrAddAChatModel`));return}N(n);let r=n.find(e=>e.id===P)||n[0];te(r.id),ae(t===`visual`?r.kind:`chat`)}catch(n){let r=n instanceof Error?n.message:String(n),i=e?.models.filter(e=>t===`visual`?e.kind===`image`||e.kind===`video`:e.kind===`chat`)||[];if(!/\(401\)|\(403\)|鉴权|认证|密钥|API Key/i.test(r)&&i.length){N(i);let e=i.find(e=>e.id===P)||i[0];te(e.id),ae(t===`visual`?e.kind:`chat`),le(r)}else I(r)}finally{oe(!1)}},ye=async()=>{if(F)return;let e=P.trim()||ne[0]||``;if(!e){I(o(`config:configPage.selectModelToFinish`));return}if(!O&&!d?.configured&&!h){I(o(`config:configPage.enterTheAPIKeyForThisConnection`));return}let n=new Set((d?.models||[]).map(e=>e.id)),r=ne.filter(t=>t!==e&&!n.has(t));oe(!0),I(``);try{let n=d?.id||h,o=n?await f(`/api/config`,{method:`PUT`,body:JSON.stringify({provider:n,providerType:t,api:C,baseUrl:y,organization:k,model:e,modelKind:t===`visual`?ie:`chat`,apiKey:O,setAsDefault:!1,enabled:!0})}):await f(`/api/providers`,{method:`POST`,body:JSON.stringify({id:m,name:j.trim()||ue.name,providerType:t,api:C,baseUrl:y,organization:k,apiKey:O,model:e,modelKind:t===`visual`?ie:`chat`,enabled:!0})}),c=n||o.createdProviderId||m,l=s?``:c;l&&g(l);let u=o.providers.find(e=>e.id===c);if(u&&p(u),i?.(l?{...o,createdProviderId:l}:o),r.length){let e=t===`visual`?ie:`chat`;try{o=await f(`/api/providers/${encodeURIComponent(c)}/models/batch`,{method:`POST`,body:JSON.stringify({models:r.map(t=>({id:t,kind:e}))})})}catch(e){I(e instanceof Error?e.message:String(e));return}}a(l?{...o,createdProviderId:l}:o)}catch(e){I(e instanceof Error?e.message:String(e))}finally{oe(!1)}};return(0,J.jsx)(Et,{open:!0,onOpenChange:e=>{!e&&!F&&r()},children:(0,J.jsxs)(St,{showCloseButton:!1,className:`modal z-[80] block max-h-[calc(100dvh_-_40px)] w-[calc(100%_-_40px)] max-w-lg overflow-y-auto overscroll-contain rounded-[var(--r-lg)] border border-stroke bg-solid p-[18px] shadow-float sm:max-w-lg max-[650px]:max-h-[calc(100dvh_-_16px)] max-[650px]:w-[calc(100%_-_16px)]`,overlayClassName:`z-[70] bg-[var(--modal-overlay)]`,"aria-busy":F,onEscapeKeyDown:e=>{F&&e.preventDefault()},onInteractOutside:e=>{F&&e.preventDefault()},onOpenAutoFocus:e=>{e.preventDefault(),_.current=document.activeElement instanceof HTMLElement?document.activeElement:null,v.current?.focus()},onCloseAutoFocus:e=>{e.preventDefault(),_.current?.focus()},children:[(0,J.jsxs)(Vt,{children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(Ct,{asChild:!0,children:(0,J.jsx)(`h2`,{children:o(t===`visual`?`config:configPage.visualQuickSetupTitle`:`config:configPage.quickSetupTitle`)})}),(0,J.jsx)(xt,{asChild:!0,children:(0,J.jsxs)(`p`,{children:[o(`config:configPage.stepIndicator`,{current:c,total:3}),` · `,pe]})})]}),(0,J.jsx)(z,{type:`button`,variant:`ghost`,size:`icon`,className:`pointer-coarse:size-11`,"aria-label":o(`config:configPage.closeDialog`),disabled:F,onClick:r,children:(0,J.jsx)(we,{size:17})})]}),(0,J.jsx)(`div`,{"aria-hidden":`true`,className:`mt-3 grid grid-cols-3 gap-1`,children:[1,2,3].map(e=>(0,J.jsx)(`span`,{className:L(`h-1 rounded-full`,e<=c?`bg-star`:`bg-surface-active`)},e))}),(0,J.jsxs)(`div`,{className:`mt-3 flex items-center gap-2.5 rounded-md border border-stroke-soft bg-surface-subtle px-2.5 py-2`,children:[(0,J.jsx)(`span`,{className:`grid size-7.5 flex-none place-items-center rounded-md border border-key-border bg-key text-content-muted shadow-key`,children:(0,J.jsx)(ge,{size:15,"aria-hidden":`true`})}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,J.jsx)(`span`,{className:`truncate text-sm font-medium text-content`,children:j||ue.name}),(0,J.jsx)(`small`,{className:`text-xs text-content-muted`,children:de})]}),(0,J.jsx)(yr,{tone:`gray`,children:de})]}),c===1&&(0,J.jsxs)(`div`,{className:`[margin-top:14px]`,children:[(0,J.jsxs)(G,{variant:`control`,children:[`Base URL`,(0,J.jsx)(B,{ref:v,value:y,onChange:e=>S(e.target.value),placeholder:`https://api.example.com/v1`,inputMode:`url`})]}),(0,J.jsx)(`p`,{className:`mt-2 text-xs leading-[1.5] text-content-muted`,children:o(`config:configPage.quickSetupBaseUrlHint`)})]}),c===2&&(0,J.jsxs)(`div`,{className:`[margin-top:14px]`,children:[(0,J.jsxs)(G,{variant:`control`,children:[o(`config:configPage.apiProtocol`),(0,J.jsx)(K,{value:C,onChange:e=>w(e.target.value),children:mi.map(([e,t])=>(0,J.jsx)(`option`,{value:e,children:t},e))})]}),(0,J.jsxs)(G,{variant:`control`,children:[`Organization`,(0,J.jsx)(B,{value:k,onChange:e=>A(e.target.value),placeholder:o(`config:configPage.optionalUsedOnlyForOpenAIOrganization`)})]})]}),c===3&&(0,J.jsxs)(`div`,{className:`[margin-top:14px]`,children:[!d&&(0,J.jsxs)(G,{variant:`control`,children:[o(`config:configPage.displayName`),(0,J.jsx)(B,{value:j,onChange:e=>M(e.target.value),placeholder:ue.name})]}),(0,J.jsx)(ji,{value:T,onChange:D,configured:d?.configured}),(0,J.jsxs)(z,{type:`button`,variant:`secondary`,className:`mt-2.5 w-full max-[650px]:h-11`,disabled:F,onClick:()=>void ve(),children:[F?(0,J.jsx)(R,{className:`text-current`}):(0,J.jsx)(fe,{size:14}),o(F?`config:configPage.fetchingModels`:`config:configPage.fetchModels`)]}),ce&&(0,J.jsxs)(Rt,{className:`[margin-top:10px]`,children:[(0,J.jsx)(Se,{size:15}),(0,J.jsx)(`small`,{children:o(`config:configPage.discoverFailedUsingExisting`,{message:ce})})]}),me.length>0&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`mt-3.5 mb-2 text-xs leading-[1.5] text-content-muted`,children:o(t===`visual`?`config:configPage.selectVisualModelToFinish`:`config:configPage.selectModelToFinish`)}),(0,J.jsx)(`div`,{className:`flex max-h-[260px] flex-col overflow-y-auto rounded-md border border-stroke`,children:me.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:L(`relative flex min-h-10 min-w-0 cursor-pointer items-center gap-2 border-b border-stroke-soft px-2.5 py-2 text-left last:border-b-0 hover:bg-surface-subtle pointer-coarse:min-h-11`,P===e.id&&`bg-star-soft before:absolute before:inset-y-2 before:left-0 before:w-[3px] before:rounded-r-[3px] before:bg-star hover:bg-star-soft`),onClick:()=>{te(e.id),ae(t===`visual`?e.kind:`chat`)},children:[(0,J.jsx)(`span`,{className:L(`grid size-4 flex-none place-items-center rounded-full border border-control text-transparent`,P===e.id&&`border-star bg-star text-on-accent`),children:(0,J.jsx)(E,{size:11})}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-content`,children:e.name}),t===`visual`&&(0,J.jsx)(yr,{tone:`gray`,children:e.kind===`video`?o(`config:configPage.visualVideoModel`):o(`config:configPage.visualImageModel`)})]},`${e.id}-${e.kind}`))})]}),(0,J.jsxs)(`div`,{className:`mt-3.5 grid gap-2`,children:[(0,J.jsxs)(G,{variant:`control`,children:[o(`config:configPage.manualModelId`),(0,J.jsx)(B,{value:P,onChange:e=>te(e.target.value),placeholder:t===`visual`?`gpt-image-1`:`gpt-5.4`})]}),(0,J.jsx)(`p`,{className:`text-xs text-content-muted`,children:o(`config:configPage.manualModelIdHint`)}),t===`visual`&&(0,J.jsxs)(G,{variant:`control`,children:[o(`config:configPage.modelType`),(0,J.jsxs)(K,{value:ie,onChange:e=>ae(e.target.value),children:[(0,J.jsx)(`option`,{value:`image`,children:o(`config:configPage.imageGenerationAndEditing`)}),(0,J.jsx)(`option`,{value:`video`,children:o(`config:configPage.videoGeneration`)})]})]}),(0,J.jsx)(Mi,{ids:ne,onChange:re,primaryId:P,placeholder:t===`visual`?`gpt-image-1`:`gpt-5.5`})]})]}),se&&(0,J.jsxs)(zt,{children:[(0,J.jsx)(Se,{size:13}),se]}),(0,J.jsxs)(`div`,{className:`mt-[18px] flex justify-between gap-2`,children:[(0,J.jsxs)(z,{type:`button`,variant:`secondary`,className:`max-[650px]:h-11`,disabled:F||c===1,onClick:()=>{I(``),u(c-1)},children:[(0,J.jsx)(b,{size:14}),o(`config:configPage.previousStep`)]}),c===1?(0,J.jsxs)(z,{type:`button`,className:`max-[650px]:h-11`,disabled:F||!y.trim(),onClick:he,children:[(0,J.jsx)(x,{size:14}),o(`config:configPage.nextStep`)]}):c===2?(0,J.jsxs)(z,{type:`button`,className:`max-[650px]:h-11`,disabled:F,onClick:_e,children:[(0,J.jsx)(x,{size:14}),o(`config:configPage.nextStep`)]}):(0,J.jsxs)(z,{type:`button`,className:`max-[650px]:h-11`,disabled:F||!P.trim()&&ne.length===0,onClick:()=>void ye(),children:[F?(0,J.jsx)(R,{className:`text-current`}):(0,J.jsx)(E,{size:14}),o(F?`config:configPage.saving`:`config:configPage.saveChanges`)]})]})]})})}var Gi=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`],Ki=``;function qi(e){return`${e.provider.id}/${e.model.id}`}function Ji({labelId:e,label:t,hint:n,children:r}){return(0,J.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_minmax(0,280px)] items-center gap-x-6 gap-y-0.5 border-b border-stroke py-4 max-[650px]:grid-cols-[auto_minmax(0,1fr)] max-[650px]:gap-x-3 max-[650px]:gap-y-1 max-[650px]:py-3`,children:[(0,J.jsx)(`div`,{id:e,className:`self-end text-sm font-medium text-content max-[650px]:self-center`,children:t}),(0,J.jsx)(`div`,{className:`row-span-2 min-w-0 max-[650px]:row-span-1`,children:r}),(0,J.jsx)(`p`,{id:`${e}-hint`,className:`col-start-1 self-start text-xs text-content-muted max-[650px]:col-span-2`,children:n})]})}function Yi({config:e,notify:t,busy:n,onConfigChanged:r,onSetDefaultModel:i}){let{t:a}=l(),o=(0,q.useId)(),s={off:a(`chat:focusSession.thinkingLabel.off`),minimal:a(`chat:focusSession.thinkingLabel.minimal`),low:a(`chat:focusSession.thinkingLabel.low`),medium:a(`chat:focusSession.thinkingLabel.medium`),high:a(`chat:focusSession.thinkingLabel.high`),xhigh:a(`chat:focusSession.thinkingLabel.xhigh`),max:a(`chat:focusSession.thinkingLabel.max`)},[c,u]=(0,q.useState)(!1),[d,p]=(0,q.useState)(``),[m,h]=(0,q.useState)(e.thinkingLevel),[g,_]=(0,q.useState)(e.toolMode);(0,q.useEffect)(()=>{h(e.thinkingLevel),_(e.toolMode)},[e.thinkingLevel,e.toolMode]);let v=(e.fallbackModels||[]).join(`
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{l as t,m as n}from"./vendor-router-CSN_DGvx.js";import{t as r}from"./index-CwdjZZLG.js";import{i,r as a}from"./vendor-react-DwNgTV1j.js";import{c as o,d as s,n as c}from"./i18n-zKD1z9i9.js";import{t as l}from"./use-i18n-CIheiCov.js";import{a as u,l as d,t as f}from"./api-_MWfl2VL.js";import{n as p}from"./runtime-capabilities-CHYOF_hE.js";import{t as m}from"./runtime-capabilities-store-CWJvmV83.js";import{n as h}from"./client-store-xZC2AfqC.js";import{t as g}from"./createLucideIcon-Cd-3GVxJ.js";import{a as _,i as v,t as y}from"./permission-rules-api-CW4GK6hJ.js";import{t as b}from"./arrow-left-B8oVrQ2S.js";import{t as x}from"./arrow-right-DqLOhpA2.js";import{t as S}from"./arrow-up-right-B6l8qFZz.js";import{t as C}from"./bell-BjONAtgH.js";import{t as w}from"./bot-B3TaBp_T.js";import{t as T}from"./brain-qxhnKqYP.js";import{t as E}from"./check-2vYc6QaP.js";import{t as D}from"./chevron-down-CxtxIjiP.js";import{t as O}from"./chevron-left-BAtyp3_6.js";import{t as k}from"./circle-alert-DCChabnT.js";import{t as A}from"./circle-check-iEdCm3Pw.js";import{t as j}from"./code-xml-BrUXrBax.js";import{t as M}from"./copy-DHmIFc52.js";import{t as ee}from"./download-BCfIiuaL.js";import{t as N}from"./ellipsis-CfGKfbq6.js";import{t as P}from"./external-link-CEQqPcqc.js";import{i as te,o as ne,s as re}from"./settings-navigation-DiP_AM1C.js";import{t as ie}from"./image-BY_c3FYU.js";import{t as ae}from"./info-DATxy0fb.js";import{t as F}from"./loader-circle-BOwQzHB-.js";import{t as oe}from"./message-square-SKjZyY3v.js";import{t as se}from"./monitor-smartphone-B1gIjItA.js";import{n as I,r as ce,t as le}from"./zap-DZHw5afO.js";import{t as ue}from"./play-DNDjDNGn.js";import{t as de}from"./plus-fQbSqB1n.js";import{t as fe}from"./refresh-cw-TbWxTY4K.js";import{t as pe}from"./rocket-BgLSjoHY.js";import{t as me}from"./rotate-ccw-C0v8V77_.js";import{t as he}from"./search-D0mqDaf_.js";import{t as ge}from"./server-BgNvmqwJ.js";import{t as _e}from"./shield-check-Gvek4RJ7.js";import{t as ve}from"./sliders-horizontal-Dryf1XyC.js";import{t as ye}from"./sparkles-S_eeuqn9.js";import{t as be}from"./square-terminal-BVG6cUT1.js";import{t as xe}from"./trash-2-CNrPOoPR.js";import{t as Se}from"./triangle-alert-CE1q54ci.js";import{t as Ce}from"./wrench-6pg6_bqI.js";import{t as we}from"./x-07u4-129.js";import{t as Te}from"./brand-DIEc3fK8.js";import{a as Ee}from"./dist-41X0pdUs.js";import{c as De,i as Oe,o as ke,s as Ae}from"./dist-BsRXXcSL.js";import{t as je}from"./dist-DzGQ7sLi.js";import{i as Me,n as Ne,r as Pe,t as Fe}from"./accordion-CiJMkjqX.js";import{t as Ie}from"./dist-OB2r6Xsr.js";import{n as Le,r as Re,t as ze}from"./dist-BaBySQmo.js";import{c as Be,i as Ve,n as He,p as Ue,r as We,t as Ge}from"./dropdown-menu-Ds0gD8S8.js";import{i as Ke,n as qe,t as Je}from"./popover-Cw7QFeII.js";import{a as Ye,i as Xe,n as Ze,r as Qe,t as $e}from"./select-Bbk9bmXO.js";import{t as et}from"./separator-BPh_qxvc.js";import{t as tt}from"./slider-De8rWVNs.js";import{t as nt}from"./switch-D_G8wFhs.js";import{t as L}from"./utils-C8uzG5AZ.js";import{n as R,r as rt,t as z}from"./button-CCcCN8tE.js";import{n as it,t as at}from"./kbd-CAufZTkl.js";import{i as ot,t as st}from"./config-search-VE6brXfx.js";import{_ as ct,c as lt,d as ut,f as dt,h as ft,l as pt,m as mt,o as ht,p as gt,t as _t,u as vt}from"./shortcuts-CVPFuAiJ.js";import{a as yt}from"./format-DMJQzoZ7.js";import{t as bt}from"./StatusGlyph-1KgitlUg.js";import{a as xt,i as St,l as Ct,o as wt,s as Tt,t as Et}from"./dialog-BgFAhLng.js";import{t as B}from"./input-CPw-zkYh.js";import{t as Dt}from"./textarea-DmATpOqT.js";import{t as Ot}from"./model-display-kDwvtxrW.js";import{n as kt,r as At,t as jt}from"./PageState-Cz6vFMXv.js";import{t as Mt}from"./useOverlayFocusReturn-NkxBSSjb.js";import{i as V,n as H,o as U,r as Nt,s as Pt,t as W}from"./FeaturePage-DD_32h19.js";import{n as G}from"./field-DoLEb0np.js";import{t as Ft}from"./MarkdownMessage-BfSy1Cg4.js";import{t as K}from"./AppSelect-DQYKUW5E.js";import{n as It}from"./public-flags-D6y-DU98.js";import{t as Lt}from"./badge-CWB3lj2H.js";import{a as Rt,i as zt,l as Bt,n as Vt,o as Ht,r as Ut,s as Wt,t as Gt}from"./app-primitives-Drz_SjnR.js";import{t as Kt}from"./BrandLogo-k3CvJjd4.js";import{n as qt,r as Jt,t as Yt}from"./collapsible-Dcoy-qnz.js";import{C as Xt,_ as Zt,a as Qt,c as $t,d as en,g as tn,i as nn,l as rn,o as an,p as on,r as sn,s as cn,v as ln,x as un,y as dn}from"./app-update-CJSjwHEp.js";import{a as fn,n as pn,r as mn,t as hn}from"./ShortcutKeys-B6hllpKE.js";import{i as gn,n as _n,r as vn,t as yn}from"./browser-notifications-DBS0oXqN.js";var bn=g(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),xn=g(`blend`,[[`circle`,{cx:`9`,cy:`9`,r:`7`,key:`p2h5vp`}],[`circle`,{cx:`15`,cy:`15`,r:`7`,key:`19ennj`}]]),Sn=g(`cat`,[[`path`,{d:`M12 5c.67 0 1.35.09 2 .26 1.78-2 5.03-2.84 6.42-2.26 1.4.58-.42 7-.42 7 .57 1.07 1 2.24 1 3.44C21 17.9 16.97 21 12 21s-9-3-9-7.56c0-1.25.5-2.4 1-3.44 0 0-1.89-6.42-.5-7 1.39-.58 4.72.23 6.5 2.23A9.04 9.04 0 0 1 12 5Z`,key:`x6xyqk`}],[`path`,{d:`M8 14v.5`,key:`1nzgdb`}],[`path`,{d:`M16 14v.5`,key:`1lajdz`}],[`path`,{d:`M11.25 16.25h1.5L12 17l-.75-.75Z`,key:`12kq1m`}]]),Cn=g(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),wn=g(`fold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3-3-3 3`,key:`e37ymu`}],[`path`,{d:`m15 5-3 3-3-3`,key:`19d6lf`}]]),Tn=g(`laptop`,[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]),En=g(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),Dn=g(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),On=g(`qr-code`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),kn=g(`radar`,[[`path`,{d:`M19.07 4.93A10 10 0 0 0 6.99 3.34`,key:`z3du51`}],[`path`,{d:`M4 6h.01`,key:`oypzma`}],[`path`,{d:`M2.29 9.62A10 10 0 1 0 21.31 8.35`,key:`qzzz0`}],[`path`,{d:`M16.24 7.76A6 6 0 1 0 8.23 16.67`,key:`1yjesh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M17.99 11.66A6 6 0 0 1 15.77 16.67`,key:`1u2y91`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`m13.41 10.59 5.66-5.66`,key:`mhq4k0`}]]),An=g(`scale`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`m19 8 3 8a5 5 0 0 1-6 0zV7`,key:`zcdpyk`}],[`path`,{d:`M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1`,key:`1yorad`}],[`path`,{d:`m5 8 3 8a5 5 0 0 1-6 0zV7`,key:`eua70x`}],[`path`,{d:`M7 21h10`,key:`1b0cd5`}]]),jn=g(`scan-line`,[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}]]),Mn=g(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),Nn=g(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),Pn=g(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),Fn=g(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),In=g(`unfold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3 3-3-3`,key:`11eu04`}],[`path`,{d:`m15 5-3-3-3 3`,key:`itvq4r`}]]),Ln=g(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),q=e(i(),1),J=a(),Rn=Object.defineProperty,Y=(e,t)=>Rn(e,`name`,{value:t,configurable:!0}),zn=`Radio`,[Bn,Vn]=Ae(zn),[Hn,Un]=Bn(zn);function Wn(e){let{__scopeRadio:t,checked:n=!1,children:r,disabled:i,form:a,name:o,onCheck:s,required:c,value:l=`on`,internal_do_not_use_render:u}=e,[d,f]=q.useState(null),[p,m]=q.useState(null),h=q.useRef(!1),[g,_]=q.useReducer(e=>e+1,0),v={checked:n,disabled:i,required:c,name:o,form:a,value:l,control:d,setControl:f,hasConsumerStoppedPropagationRef:h,userInteractionCount:g,onUserInteraction:_,isFormControl:!d||!!a||!!d.closest(`form`),bubbleInput:p,setBubbleInput:m,onCheck:Y(()=>s?.(),`onCheck`)};return(0,J.jsx)(Hn,{scope:t,...v,children:Yn(u)?u(v):r})}Y(Wn,`RadioProvider`);var Gn=`RadioTrigger`,Kn=q.forwardRef(Y(function({__scopeRadio:e,onClick:t,...n},r){let{checked:i,disabled:a,value:o,setControl:s,onCheck:c,hasConsumerStoppedPropagationRef:l,onUserInteraction:u,isFormControl:d,bubbleInput:f}=Un(Gn,e),p=Ee(r,s);return(0,J.jsx)(De.button,{type:`button`,role:`radio`,"aria-checked":i,"data-state":Xn(i),"data-disabled":a?``:void 0,disabled:a,value:o,...n,ref:p,onClick:ke(t,e=>{i||(u(),c()),f&&d&&(l.current=e.isPropagationStopped(),l.current||e.stopPropagation())})})},`RadioTrigger`)),qn=`RadioBubbleInput`,Jn=q.forwardRef(Y(function({__scopeRadio:e,onClick:t,...n},r){let{control:i,checked:a,required:o,disabled:s,name:c,value:l,form:u,bubbleInput:d,setBubbleInput:f,hasConsumerStoppedPropagationRef:p,userInteractionCount:m}=Un(qn,e),h=Ee(r,f),g=Ie(i),_=q.useRef(!1),v=q.useRef(a),y=q.useRef(m);q.useEffect(()=>{let e=d;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=m!==y.current;y.current=m;let i=v.current!==a;v.current=a;let o=!(r&&p.current);if(i&&n){_.current=!r;let t=new Event(`click`,{bubbles:o});n.call(e,a),e.dispatchEvent(t),_.current=!1}},[d,a,p,m]);let b=q.useRef(a);return(0,J.jsx)(De.input,{type:`radio`,"aria-hidden":!0,defaultChecked:b.current,required:o,disabled:s,name:c,value:l,form:u,...n,tabIndex:-1,ref:h,onClick:ke(t,e=>{_.current&&e.stopPropagation()}),style:{...n.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`RadioBubbleInput`));function Yn(e){return typeof e==`function`}Y(Yn,`isFunction`);function Xn(e){return e?`checked`:`unchecked`}Y(Xn,`getState`);var Zn=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],Qn=`RadioGroup`,[$n,er]=Ae(Qn,[Re,Vn]),tr=Re(),nr=Vn(),[rr,ir]=$n(Qn),ar=q.forwardRef(Y(function(e,t){let{__scopeRadioGroup:n,name:r,form:i,defaultValue:a,value:o,required:s=!1,disabled:c=!1,orientation:l,dir:u,loop:d=!0,onValueChange:f,...p}=e,m=tr(n),h=je(u),[g,_]=Oe({prop:o,defaultProp:a??null,onChange:f,caller:Qn}),[v,y]=q.useState(null),b=Ee(t,y),x=q.useRef(g);return q.useEffect(()=>{let e=i?v?.ownerDocument.getElementById(i):v?.closest(`form`);if(e instanceof HTMLFormElement){let t=Y(()=>_(x.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[v,i,_]),(0,J.jsx)(rr,{scope:n,name:r,form:i,required:s,disabled:c,value:g,onValueChange:_,children:(0,J.jsx)(Le,{asChild:!0,...m,orientation:l,dir:h,loop:d,children:(0,J.jsx)(De.div,{role:`radiogroup`,"aria-required":s,"aria-orientation":l,"data-disabled":c?``:void 0,dir:h,...p,ref:b})})})},`RadioGroup`)),or=`RadioGroupItemProvider`,sr=`RadioGroupItemTrigger`;function cr(e){let{__scopeRadioGroup:t,value:n,disabled:r,children:i,internal_do_not_use_render:a}=e,o=ir(or,t),s=nr(t),c=o.disabled||r;return(0,J.jsx)(Wn,{...s,checked:o.value===n,disabled:c,required:o.required,name:o.name,form:o.form,value:n,onCheck:()=>o.onValueChange(n),internal_do_not_use_render:a,children:i})}Y(cr,`RadioGroupItemProvider`);var lr=q.forwardRef(Y(function(e,t){let{__scopeRadioGroup:n,...r}=e,i=tr(n),a=nr(n),{checked:o,disabled:s}=Un(sr,a.__scopeRadio),c=q.useRef(null),l=Ee(t,c),u=q.useRef(!1);return q.useEffect(()=>{let e=Y(e=>{Zn.includes(e.key)&&(u.current=!0)},`handleKeyDown`),t=Y(()=>u.current=!1,`handleKeyUp`);return document.addEventListener(`keydown`,e),document.addEventListener(`keyup`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`keyup`,t)}},[]),(0,J.jsx)(ze,{asChild:!0,...i,focusable:!s,active:o,children:(0,J.jsx)(Kn,{...a,...r,ref:l,onKeyDown:ke(r.onKeyDown,e=>{e.key===`Enter`&&e.preventDefault()}),onFocus:ke(r.onFocus,()=>{u.current&&c.current?.click()})})})},`RadioGroupItemTrigger`)),ur=q.forwardRef(Y(function(e,t){let{__scopeRadioGroup:n,value:r,disabled:i,...a}=e;return(0,J.jsx)(cr,{__scopeRadioGroup:n,value:r,disabled:i,internal_do_not_use_render:({isFormControl:e})=>(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(lr,{...a,ref:t,__scopeRadioGroup:n}),e&&(0,J.jsx)(dr,{__scopeRadioGroup:n})]})})},`RadioGroupItem`)),dr=q.forwardRef(Y(function(e,t){let{__scopeRadioGroup:n,...r}=e,i=nr(n);return(0,J.jsx)(Jn,{...i,...r,ref:t})},`RadioGroupItemBubbleInput`));o.addResourceBundle(`zh-CN`,`labs`,{notice:`实验功能还在开发中,可能不稳定,也可能在之后的版本里调整或移除。每项单独开关,随时可以关掉;遇到问题请点「反馈」告诉我们。`,listTitle:`可试用的功能`,loading:`正在读取实验功能…`,loadFailed:`没能读取实验功能:{error}`,retry:`重试`,emptyTitle:`目前没有实验功能`,emptyDescription:`有新功能进入测试时,会出现在这里。`,"stage.experimental":`实验中`,"stage.preview":`即将毕业`,whenOffPrefix:`关掉后:`,feedback:`反馈`,toggleLabel:`开启或关闭“{name}”`,"saving.on":`正在开启…`,"saving.off":`正在关闭…`,enabledNow:`已开启,立即生效`,saveFailed:`没能保存:{error}。开关已恢复。`,"unavailable.runtime":`当前连接的 Runtime 不支持这个功能。升级那台机器上的 Pisper 后即可开启。`,openLinkFailed:`没能打开链接。`,"feature.bots.title":`Bots`,"feature.bots.description":`新建多个常驻的 Bot,在对话里交代事情;它们在自己的电脑上干活,改代码时用独立分支,改完交给你确认。`,"feature.bots.whenOff":`Bots 和它们的会话都不再显示;记录都保留,重新打开就回来。正在运行的任务会跑完。`}),o.addResourceBundle(`en-US`,`labs`,{notice:`Labs features are still in development. They may be unstable and may change or be removed in later versions. Each one has its own switch and can be turned off at any time; use Feedback to tell us about problems.`,listTitle:`Available to try`,loading:`Loading Labs features…`,loadFailed:`Couldn't load Labs features: {error}`,retry:`Retry`,emptyTitle:`No Labs features right now`,emptyDescription:`New features appear here when they enter testing.`,"stage.experimental":`Experimental`,"stage.preview":`Graduating soon`,whenOffPrefix:`When turned off: `,feedback:`Feedback`,toggleLabel:`Turn “{name}” on or off`,"saving.on":`Turning on…`,"saving.off":`Turning off…`,enabledNow:`On, effective immediately`,saveFailed:`Couldn't save: {error}. The switch was restored.`,"unavailable.runtime":`The connected Runtime doesn't support this feature. Update Pisper on that machine to turn it on.`,openLinkFailed:`Couldn't open the link.`,"feature.bots.title":`Bots`,"feature.bots.description":`Create several always-on Bots and tell them what to do in a chat. They work on their own computer, use a separate branch for code changes and hand the result to you to confirm.`,"feature.bots.whenOff":`Bots and their sessions are hidden everywhere; nothing is deleted, and turning it back on brings them back. Running tasks finish.`});function fr(e,t){if(typeof window>`u`||!window.__PISPER_MOBILE_APP__)return null;e.preventDefault();let n=window.__TAURI__?.core?.invoke??window.__TAURI_INTERNALS__?.invoke;return n?n(`mobile_open_external_url`,{url:t}):Promise.reject(Error(`移动端原生桥不可用。`))}var pr={bots:e=>({title:e(`labs:feature.bots.title`),description:e(`labs:feature.bots.description`),whenOff:e(`labs:feature.bots.whenOff`)})};function mr(e,t){return pr[t]?.(e)??{title:t,description:``,whenOff:``}}function hr(e,t){return e(t===`preview`?`labs:stage.preview`:`labs:stage.experimental`)}function gr({notify:e}){let{t}=l(),n=It(e=>e.features),r=It(e=>e.status),i=It(e=>e.error),a=It(e=>e.pending),o=It(e=>e.rowErrors),s=It(e=>e.load),c=It(e=>e.setEnabled),[u,d]=(0,q.useState)(()=>new Set);(0,q.useEffect)(()=>{s()},[s]);let f=async(e,t)=>{await c(e,t);let n=It.getState(),r=!n.rowErrors[e]&&n.features.some(n=>n.id===e&&n.enabled===t);d(n=>{let i=new Set(n);return r&&t?i.add(e):i.delete(e),i})},p=n=>{fr(n,n.currentTarget.href)?.catch(()=>e(t(`labs:openLinkFailed`),`error`))},m;return m=r===`loading`&&n.length===0?(0,J.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 py-6 text-sm text-content-muted`,children:[(0,J.jsx)(rt,{"aria-hidden":`true`}),t(`labs:loading`)]}):n.length===0?r===`error`?null:(0,J.jsx)(jt,{compact:!0,icon:re,title:t(`labs:emptyTitle`),description:t(`labs:emptyDescription`)}):(0,J.jsx)(H,{children:n.map(e=>{let n=mr(t,e.id),r=a[e.id]===!0,i=o[e.id];return(0,J.jsx)(V,{"data-beta-feature":e.id,"data-enabled":e.enabled,icon:(0,J.jsx)(re,{}),name:n.title,status:(0,J.jsx)(Lt,{variant:`outline`,children:hr(t,e.stage)}),description:n.description||void 0,actions:(0,J.jsxs)(`span`,{className:`flex items-center gap-2`,children:[r&&(0,J.jsxs)(`span`,{role:`status`,className:`flex items-center gap-1.5 text-xs text-content-muted`,children:[(0,J.jsx)(rt,{"aria-hidden":`true`}),e.enabled?t(`labs:saving.on`):t(`labs:saving.off`)]}),(0,J.jsx)(nt,{checked:e.enabled,disabled:r||!e.available,"aria-busy":r,"aria-label":t(`labs:toggleLabel`,{name:n.title}),onCheckedChange:t=>void f(e.id,t)})]}),detail:(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5 pb-3 text-xs leading-relaxed text-content-muted`,children:[n.whenOff&&(0,J.jsxs)(`p`,{children:[t(`labs:whenOffPrefix`),n.whenOff]}),e.feedbackUrl&&(0,J.jsxs)(`a`,{className:`inline-flex w-fit items-center gap-1 text-content-secondary underline decoration-stroke-strong underline-offset-3 hover:text-content`,href:e.feedbackUrl,target:`_blank`,rel:`noopener noreferrer`,"data-web-preview":`external`,onClick:p,children:[t(`labs:feedback`),(0,J.jsx)(P,{className:`size-3.5`,"aria-hidden":`true`})]}),!e.available&&(0,J.jsxs)(`p`,{className:`flex items-start gap-1.5 text-content-secondary`,children:[(0,J.jsx)(ae,{className:`mt-[3px] size-3.5 flex-none`,"aria-hidden":`true`}),t(`labs:unavailable.runtime`)]}),e.enabled&&u.has(e.id)&&!r&&(0,J.jsxs)(`p`,{role:`status`,className:`flex items-center gap-1.5 text-content-secondary`,children:[(0,J.jsx)(E,{className:`size-3.5 flex-none`,"aria-hidden":`true`}),t(`labs:enabledNow`)]}),i&&(0,J.jsx)(W,{className:`mt-1`,children:(0,J.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[t(`labs:saveFailed`,{error:i.message}),(0,J.jsx)(z,{size:`sm`,variant:`outline`,onClick:()=>void f(e.id,i.desired),children:t(`labs:retry`)})]})})]})},e.id)})}),(0,J.jsxs)(`div`,{"data-labs-settings":!0,className:`flex min-w-0 flex-col`,children:[(0,J.jsxs)(`p`,{role:`note`,className:`flex items-start gap-2 rounded-[var(--r-md)] bg-surface-subtle px-3 py-2.5 text-[13px] leading-relaxed text-content-secondary`,children:[(0,J.jsx)(re,{className:`mt-[3px] size-3.5 flex-none text-content-muted`,"aria-hidden":`true`}),t(`labs:notice`)]}),r===`error`&&(0,J.jsx)(W,{children:(0,J.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[t(`labs:loadFailed`,{error:i}),(0,J.jsx)(z,{size:`sm`,variant:`outline`,onClick:()=>void s(),children:t(`labs:retry`)})]})}),(0,J.jsx)(U,{title:t(`labs:listTitle`),count:n.length||void 0,children:m})]})}function _r({className:e,...t}){return(0,J.jsx)(Gt,{"data-settings-card":!0,className:L(`rounded-none border-x-0 border-t border-b-0 border-stroke-soft bg-transparent px-0`,e),...t})}var vr=Ht,yr=Bt;function br(e){return(0,J.jsx)(Wt,{density:`compact`,...e})}function xr({className:e,...t}){return(0,J.jsx)(`div`,{"data-settings-group":!0,className:L(`@container/card min-w-0 divide-y divide-stroke-soft border-y border-stroke-soft`,e),...t})}function Sr({label:e,help:t,htmlFor:n,labelId:r,helpId:i,children:a,className:o}){return(0,J.jsxs)(`div`,{className:L(`grid min-w-0 gap-1.5 py-2.5 @min-[480px]/card:grid-cols-[168px_minmax(0,1fr)] @min-[480px]/card:items-center @min-[480px]/card:gap-4`,o),children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`label`,{id:r,htmlFor:n,className:`text-sm font-medium text-content`,children:e}),t&&(0,J.jsx)(`p`,{id:i,className:`mt-0.5 text-xs text-content-muted`,children:t})]}),(0,J.jsx)(`div`,{className:`min-w-0 @min-[480px]/card:max-w-[460px]`,children:a})]})}var Cr=`0.6.23`,wr=`https://github.com/ling-kong-ran/pisper`,Tr=`${wr}/blob/release/LICENSE`;function Er({href:e,icon:t,label:n,value:r,onClick:i}){return(0,J.jsxs)(`a`,{className:`group grid min-h-14 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-3 py-2.5 text-left no-underline`,href:e,target:`_blank`,rel:`noopener noreferrer`,"data-web-preview":`external`,onClick:i,children:[(0,J.jsx)(`span`,{className:`grid size-7.5 place-items-center rounded-md border border-key-border bg-key text-content-muted shadow-key transition-colors group-hover:text-content`,children:(0,J.jsx)(t,{size:16,"aria-hidden":`true`})}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block text-sm font-medium text-content`,children:n}),(0,J.jsx)(`span`,{className:`mt-0.5 block truncate font-mono text-xs text-content-muted`,children:r})]}),(0,J.jsx)(P,{"aria-hidden":`true`,className:`text-content-muted transition-colors group-hover:text-content`,size:14})]})}function Dr({update:e,notify:t}){let{t:n}=l(),r=e.info?.version||Cr,i=e=>{fr(e,e.currentTarget.href)?.catch(()=>t(n(`config:aboutSettings.openLinkFailed`),`error`))};return(0,J.jsxs)(`div`,{className:`mx-auto flex w-full flex-col gap-6`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 rounded-[15px] shadow-raise`,children:(0,J.jsx)(Kt,{size:56})}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`h2`,{className:`text-[length:calc(var(--ui-font-size)*10/7)] leading-[1.3] font-semibold tracking-[-.015em] text-content`,children:`Pisper`}),(0,J.jsxs)(yr,{tone:`gray`,className:`font-mono`,children:[`v`,r]})]}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-content-muted`,children:n(`config:aboutSettings.description`)})]})]}),(0,J.jsxs)(`section`,{"data-config-card":`about-project`,children:[(0,J.jsx)(vr,{title:n(`config:aboutSettings.projectInformation`),className:`mb-3 text-[15px] leading-6 font-medium text-content`}),(0,J.jsxs)(xr,{children:[(0,J.jsx)(Er,{href:wr,icon:j,label:n(`config:aboutSettings.sourceCode`),value:`github.com/ling-kong-ran/pisper`,onClick:i}),(0,J.jsx)(Er,{href:Tr,icon:An,label:n(`config:aboutSettings.license`),value:`MIT License`,onClick:i})]})]}),(0,J.jsx)(_r,{className:`py-4`,"data-config-card":`about-support`,children:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4 max-[540px]:flex-col max-[540px]:items-stretch`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(vr,{title:n(`config:aboutSettings.supportPisper`)}),(0,J.jsx)(`p`,{className:`mt-0.5 max-w-[520px] text-xs leading-5 text-content-muted`,children:n(`config:aboutSettings.supportDescription`)})]}),(0,J.jsx)(z,{asChild:!0,className:`max-[650px]:h-11 max-[540px]:w-full`,children:(0,J.jsxs)(`a`,{href:wr,target:`_blank`,rel:`noopener noreferrer`,"data-web-preview":`external`,onClick:i,children:[(0,J.jsx)(Nn,{size:15}),n(`config:aboutSettings.starOnGitHub`)]})})]})}),(0,J.jsx)(`p`,{className:`text-center text-xs text-content-muted`,children:n(`config:aboutSettings.copyright`)})]})}function Or(e){window.dispatchEvent(new CustomEvent(`pisper:desktop-pet-changed`,{detail:e}))}function kr({notify:e,requestConfirm:t}){let{t:n}=l(),r=window.pisperDesktop,i=(0,q.useMemo)(()=>r?.getPetStatus?{getStatus:()=>r.getPetStatus(),setEnabled:e=>r.setPetEnabled(e),setOpacity:e=>r.setPetOpacity(e),search:e=>r.searchPets(e),install:e=>r.installPet(e),select:e=>r.selectPet(e),remove:e=>r.removePet(e),openCatalog:()=>void r.openPetdex?.()}:{getStatus:()=>f(`/api/desktop-pet`),setEnabled:e=>f(`/api/desktop-pet/enabled`,{method:`POST`,body:{enabled:e}}),setOpacity:e=>f(`/api/desktop-pet/opacity`,{method:`POST`,body:{opacity:e}}),search:e=>f(`/api/desktop-pet/catalog?query=${encodeURIComponent(e)}`),install:e=>f(`/api/desktop-pet/install`,{method:`POST`,body:{slug:e}}),select:e=>f(`/api/desktop-pet/select`,{method:`POST`,body:{slug:e}}),remove:e=>f(`/api/desktop-pet/${encodeURIComponent(e)}`,{method:`DELETE`}),openCatalog:()=>window.open(`https://petdex.dev`,`_blank`,`noopener,noreferrer`)},[r]),[a,o]=(0,q.useState)(null),[s,c]=(0,q.useState)(``),[u,d]=(0,q.useState)([]),[p,m]=(0,q.useState)(100),[h,g]=(0,q.useState)(``),[_,v]=(0,q.useState)(``),y=(0,q.useCallback)(e=>{o(e),m(Math.round((e.opacity??1)*100))},[]),b=(0,q.useCallback)(async()=>{try{v(``),y(await i.getStatus())}catch(e){v(e instanceof Error?e.message:String(e))}},[y,i]),x=(0,q.useCallback)(async()=>{g(`search`);try{v(``),d(await i.search(s))}catch(e){v(e instanceof Error?e.message:String(e))}finally{g(``)}},[i,s]);(0,q.useEffect)(()=>{b(),i.search(``).then(d).catch(()=>{})},[i,b]);let S=async t=>{let r=a;o(e=>e&&{...e,enabled:t,running:!!(t&&e.installed.length)}),g(`toggle`);try{v(``);let r=await i.setEnabled(t);y(r),Or(r),e(n(t?`config:desktopPetSettings.petEnabled`:`config:desktopPetSettings.petDisabled`))}catch(e){o(r),v(e instanceof Error?e.message:String(e))}finally{g(``)}},C=async e=>{g(`opacity`);try{v(``);let t=await i.setOpacity(e);y(t),Or(t)}catch(e){m(Math.round((a?.opacity??1)*100)),v(e instanceof Error?e.message:String(e))}finally{g(``)}},w=async(t=s)=>{if(t.trim()){g(`install`);try{v(``);let r=await i.install(t);y(r),Or(r),e(n(`config:desktopPetSettings.petInstalled`,{name:r.selectedName||t}))}catch(e){v(e instanceof Error?e.message:String(e))}finally{g(``)}}},T=async t=>{if(t!==a?.selectedSlug){g(`select:${t}`);try{v(``);let r=await i.select(t);y(r),Or(r),e(n(`config:desktopPetSettings.petSelected`,{name:r.selectedName||t}))}catch(e){v(e instanceof Error?e.message:String(e))}finally{g(``)}}},D=async r=>{if(await t({title:n(`config:desktopPetSettings.deleteTitle`),message:n(`config:desktopPetSettings.deleteConfirm`,{name:r.name}),confirmLabel:n(`config:desktopPetSettings.delete`),tone:`danger`})){g(`remove:${r.slug}`);try{v(``);let t=await i.remove(r.slug);y(t),Or(t),e(n(`config:desktopPetSettings.petRemoved`,{name:r.name}))}catch(e){v(e instanceof Error?e.message:String(e))}finally{g(``)}}};return(0,J.jsxs)(J.Fragment,{children:[_&&(0,J.jsx)(W,{children:_}),(0,J.jsx)(U,{title:n(`config:desktopPetSettings.displayTitle`),"data-config-card":`desktop-pet-settings`,children:a?(0,J.jsxs)(H,{children:[(0,J.jsx)(V,{icon:(0,J.jsx)(Sn,{}),name:n(`config:desktopPetSettings.showOnDesktop`),description:a.selectedName?n(`config:desktopPetSettings.currentPet`,{name:a.selectedName}):n(`config:desktopPetSettings.installBeforeEnabling`),status:(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[a.running&&(0,J.jsx)(bt,{status:`done`,className:`size-3.5`}),a.running?n(`config:desktopPetSettings.running`):n(`config:desktopPetSettings.stopped`)]}),actions:(0,J.jsx)(nt,{checked:a.enabled,disabled:!!h||!a.installed.length,onCheckedChange:e=>void S(e),"aria-label":n(`config:desktopPetSettings.showOnDesktop`)})}),(0,J.jsx)(V,{icon:(0,J.jsx)(xn,{}),name:n(`config:desktopPetSettings.opacity`),nameMeta:`${p}%`,actions:(0,J.jsx)(tt,{value:[p],min:20,max:100,step:5,disabled:h===`opacity`,onValueChange:([e])=>m(e),onValueCommit:([e])=>void C(e/100),"aria-label":n(`config:desktopPetSettings.opacity`),className:`w-44 max-w-full max-[650px]:w-32`})})]}):(0,J.jsx)(kt,{kind:`loading`,title:n(`config:desktopPetSettings.loading`)})}),(0,J.jsxs)(U,{title:n(`config:desktopPetSettings.installTitle`),"data-config-card":`desktop-pet-install`,description:n(`config:desktopPetSettings.installDescription`),actions:(0,J.jsxs)(z,{variant:`ghost`,size:`sm`,onClick:i.openCatalog,children:[(0,J.jsx)(P,{}),n(`config:desktopPetSettings.browsePetdex`)]}),children:[(0,J.jsxs)(`div`,{className:`mb-3 flex gap-2`,children:[(0,J.jsx)(B,{value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&x()},placeholder:n(`config:desktopPetSettings.searchPlaceholder`),"aria-label":n(`config:desktopPetSettings.petSlug`),className:`h-9 min-w-0 flex-1 font-mono pointer-coarse:min-h-11 max-[650px]:min-h-11`}),(0,J.jsxs)(z,{variant:`secondary`,className:`h-9 shrink-0 pointer-coarse:h-11 max-[650px]:h-11`,disabled:h===`search`,onClick:x,children:[h===`search`?(0,J.jsx)(R,{className:`text-current`}):(0,J.jsx)(he,{}),n(`config:desktopPetSettings.search`)]})]}),u.length>0&&(0,J.jsx)(H,{children:u.map(e=>{let t=a?.installed.some(t=>t.slug===e.slug);return(0,J.jsx)(V,{"data-pet-catalog":e.slug,icon:(0,J.jsx)(Sn,{}),name:e.displayName,nameMeta:e.slug,status:t?n(`config:desktopPetSettings.installed`):void 0,actions:(0,J.jsxs)(z,{size:`sm`,variant:t?`ghost`:`secondary`,disabled:!!h||t&&e.slug===a?.selectedSlug,"aria-label":`${n(t?`config:desktopPetSettings.use`:`config:desktopPetSettings.install`)}: ${e.displayName}`,onClick:()=>void(t?T(e.slug):w(e.slug)),children:[t?(0,J.jsx)(E,{}):(0,J.jsx)(ee,{}),n(t?`config:desktopPetSettings.use`:`config:desktopPetSettings.install`)]})},e.slug)})})]}),a&&a.installed.length>0&&(0,J.jsx)(U,{title:n(`config:desktopPetSettings.installedTitle`),count:a.installed.length,"data-config-card":`desktop-pet-installed`,description:n(`config:desktopPetSettings.installedDescription`),children:(0,J.jsx)(H,{children:a.installed.map(e=>{let t=e.slug===a.selectedSlug;return(0,J.jsx)(V,{"data-pet-installed":e.slug,"data-selected":t||void 0,className:L(`relative`,t&&`after:absolute after:inset-y-3 after:-left-3 after:w-[3px] after:rounded-full after:bg-star`),icon:(0,J.jsx)(Sn,{}),name:e.name,nameMeta:`${e.slug} · ${e.source===`pisper`?`Pisper`:`Petdex`}`,status:t?(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,J.jsx)(bt,{status:`done`,className:`size-3.5`}),n(`config:desktopPetSettings.inUse`)]}):void 0,actions:(0,J.jsxs)(J.Fragment,{children:[!t&&(0,J.jsx)(z,{size:`sm`,variant:`ghost`,disabled:!!h,"aria-label":`${n(`config:desktopPetSettings.use`)}: ${e.name}`,onClick:()=>void T(e.slug),children:n(`config:desktopPetSettings.use`)}),e.source===`pisper`&&(0,J.jsx)(z,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`hover:bg-danger-soft hover:text-danger max-[650px]:size-11 pointer-coarse:size-11`,disabled:!!h,onClick:()=>void D(e),"aria-label":`${n(`config:desktopPetSettings.delete`)}: ${e.name}`,title:n(`config:desktopPetSettings.delete`),children:h===`remove:${e.slug}`?(0,J.jsx)(R,{className:`text-current`}):(0,J.jsx)(xe,{})})]})},`${e.source}:${e.slug}`)})})})]})}function X(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}function Ar(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}var jr,Z,Mr,Nr,Pr=`__TAURI_TO_IPC_KEY__`;function Fr(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}var Ir=class{constructor(e){jr.set(this,void 0),Z.set(this,0),Mr.set(this,[]),Nr.set(this,void 0),Ar(this,jr,e||(()=>{}),`f`),this.id=Fr(e=>{let t=e.index;if(`end`in e){t==X(this,Z,`f`)?this.cleanupCallback():Ar(this,Nr,t,`f`);return}let n=e.message;if(t==X(this,Z,`f`)){for(X(this,jr,`f`).call(this,n),Ar(this,Z,X(this,Z,`f`)+1,`f`);X(this,Z,`f`)in X(this,Mr,`f`);){let e=X(this,Mr,`f`)[X(this,Z,`f`)];X(this,jr,`f`).call(this,e),delete X(this,Mr,`f`)[X(this,Z,`f`)],Ar(this,Z,X(this,Z,`f`)+1,`f`)}X(this,Z,`f`)===X(this,Nr,`f`)&&this.cleanupCallback()}else X(this,Mr,`f`)[t]=n})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(e){Ar(this,jr,e,`f`)}get onmessage(){return X(this,jr,`f`)}[(jr=new WeakMap,Z=new WeakMap,Mr=new WeakMap,Nr=new WeakMap,Pr)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[Pr]()}};function Lr(e,t){let n=window.__TAURI__?.core?.invoke??window.__TAURI_INTERNALS__?.invoke;return n?n(e,t):Promise.reject(Error(`native bridge unavailable`))}function Rr(e,t){return Lr(`plugin:barcode-scanner|${e}`,t)}function zr(e){return e instanceof Error?e.message:String(e)}function Br(e){return/cancel(?:led|ed)/i.test(zr(e))}function Vr(){return new Promise(e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))})}function Hr(e){return Array.isArray(e)?new TextDecoder().decode(Uint8Array.from(e)):``}function Ur(e){if(!e.isActive||!e.port)return null;let t=Hr(e.txt.fp);if(!/^SHA256:[0-9A-F]{64}$/i.test(t))return null;let n=e.addresses.find(e=>/^\d{1,3}(?:\.\d{1,3}){3}$/.test(e))||e.addresses.find(e=>e.includes(`:`));if(!n)return null;let r=n.includes(`:`)?`[${n}]`:n,i=Hr(e.txt.name)||e.name||`Pisper Desktop`,a=`https://${r}:${e.port}`;return{id:`${e.fullName}:${a}`,name:i,url:a,fingerprint:t}}function Wr(e){return new Promise(t=>window.setTimeout(t,e))}function Gr({open:e,onOpenChange:t}){let{t:n}=l(),r=Mt(e),[i,a]=(0,q.useState)(null),[o,s]=(0,q.useState)(!1),[c,u]=(0,q.useState)([]),[d,f]=(0,q.useState)(!1),[p,m]=(0,q.useState)(``),[h,g]=(0,q.useState)(``),[_,v]=(0,q.useState)(``),y=(0,q.useRef)(!1),x=(0,q.useRef)(!1),S=(0,q.useRef)(!1),C=(0,q.useRef)(0),w=(0,q.useRef)(``),T=(0,q.useCallback)(e=>{y.current=e,s(e)},[]),E=(0,q.useCallback)(async()=>{x.current=!0,y.current&&await Rr(`cancel`).catch(()=>void 0),T(!1),a(null)},[T]);(0,q.useEffect)(()=>{if(!o)return;let e=document.getElementById(`root`),t=[],n=(e,n,r)=>{e&&(t.push({element:e,property:n,value:e.style.getPropertyValue(n),priority:e.style.getPropertyPriority(n)}),e.style.setProperty(n,r,`important`))};return n(document.documentElement,`background`,`transparent`),n(document.body,`background`,`transparent`),n(e,`background`,`transparent`),n(e,`visibility`,`hidden`),()=>{for(let{element:e,property:n,value:r,priority:i}of t.reverse())r?e.style.setProperty(n,r,i):e.style.removeProperty(n)}},[o]),(0,q.useEffect)(()=>{if(!o)return;let e=`pisper-scanner-${Date.now()}`;window.history.pushState({...window.history.state,pisperScanner:e},``);let t=()=>void E();return window.addEventListener(`popstate`,t),()=>{window.removeEventListener(`popstate`,t),!S.current&&window.history.state?.pisperScanner===e&&window.history.back()}},[E,o]);let D=e=>{if(!e.proxyUrl)throw Error(n(`config:mobileServer.pairFailed`));window.location.replace(e.proxyUrl)},O=(0,q.useCallback)(async()=>{let e=++C.current;f(!0),m(``),u([]);let t=new Ir;t.onmessage=t=>{if(C.current!==e)return;if(t.reason===`permission-denied`){m(n(`config:mobileServer.localNetworkDenied`));return}if(t.reason?.startsWith(`error:`)){m(n(`config:mobileServer.discoveryFailed`));return}if(!t.service)return;if(!t.service.isActive){u(e=>e.filter(e=>!e.id.startsWith(`${t.service?.fullName}:`)));return}let r=Ur(t.service);r&&u(e=>[...e.filter(e=>e.fingerprint!==r.fingerprint),r])};let r=null;try{await Lr(`mobile_ensure_local_network_permission`),r=(await Lr(`plugin:dns-sd|browse_start`,{options:{service:{type:`pisper`,protocol:`tcp`,domain:`local`},timeoutMs:4e3},channel:t})).browseId,await Wr(4300)}catch(t){C.current===e&&m(zr(t).includes(`local_network_permission_denied`)?n(`config:mobileServer.localNetworkDenied`):n(`config:mobileServer.discoveryFailed`))}finally{r!==null&&await Lr(`plugin:dns-sd|browse_stop`,{browseId:r}).catch(()=>void 0),C.current===e&&f(!1)}},[n]);(0,q.useEffect)(()=>{if(!(!e||o))return O(),()=>{C.current+=1}},[O,e,o]);let k=(0,q.useCallback)(async()=>{let e=w.current;w.current=``,e&&await Lr(`mobile_cancel_lan_pairing`,{operationId:e}).catch(()=>void 0),a(null),g(``)},[]),A=async e=>{let t=globalThis.crypto?.randomUUID?.()||`lan-${Date.now()}-${Math.random().toString(16).slice(2)}`;w.current=t,a(`lan:${e.id}`),v(``),g(n(`config:mobileServer.awaitingApproval`,{name:e.name}));try{let n=await Lr(`mobile_pair_lan`,{operationId:t,name:e.name,url:e.url,fingerprint:e.fingerprint,deviceName:null});if(w.current!==t)return;D(n)}catch(e){w.current===t&&v(zr(e))}finally{w.current===t&&(w.current=``,a(null),g(``))}},j=async()=>{x.current=!1,S.current=!1,a(`scan`),v(``);try{let e=await Rr(`check_permissions`);if(e.camera!==`granted`&&(e=await Rr(`request_permissions`)),e.camera!==`granted`)throw Error(n(`config:mobileServer.cameraDenied`));if(x.current||(T(!0),await Vr(),x.current))return;let t=await Rr(`scan`,{windowed:!0,formats:[]});if(!t.content)throw Error(n(`config:mobileServer.scanFailed`));S.current=!0,D(await Lr(`mobile_pair`,{payloadJson:t.content,deviceName:null}))}catch(e){!x.current&&!Br(e)&&v(zr(e))}finally{T(!1),a(null),x.current=!1}};return(0,J.jsx)(Et,{open:e,onOpenChange:e=>{if(!e&&o){E();return}if(!e&&i?.startsWith(`lan:`)){k(),t(!1);return}i||(e||v(``),t(e))},children:(0,J.jsx)(St,{showCloseButton:!o,overlayClassName:o?`bg-transparent supports-backdrop-filter:backdrop-blur-none`:void 0,className:o?`inset-0 top-0 left-0 h-dvh max-h-none w-screen max-w-none translate-x-0 translate-y-0 gap-0 overflow-hidden rounded-none bg-transparent p-0 text-white ring-0 sm:max-w-none`:`sm:max-w-md`,onPointerDownOutside:o?e=>e.preventDefault():void 0,onCloseAutoFocus:r,children:o?(0,J.jsxs)(`div`,{className:`flex h-dvh w-screen flex-col overflow-hidden`,children:[(0,J.jsxs)(Tt,{className:`sr-only`,children:[(0,J.jsx)(Ct,{children:n(`config:mobileServer.scanTitle`)}),(0,J.jsx)(xt,{children:n(`config:mobileServer.scanHint`)})]}),(0,J.jsxs)(`header`,{className:`flex min-h-16 items-center justify-between gap-3 bg-black/60 px-4 pb-3`,style:{paddingTop:`max(env(safe-area-inset-top), 0.75rem)`},children:[(0,J.jsxs)(z,{variant:`ghost`,className:`h-10 bg-black/40 px-3 text-white hover:bg-black/70 hover:text-white`,onClick:()=>void E(),children:[(0,J.jsx)(b,{}),n(`config:mobileServer.cancelScan`)]}),(0,J.jsx)(`div`,{className:`min-w-0 truncate text-sm font-medium`,children:n(`config:mobileServer.scanTitle`)}),(0,J.jsx)(`div`,{className:`w-[88px]`,"aria-hidden":`true`})]}),(0,J.jsx)(`main`,{className:`grid min-h-0 flex-1 place-items-center p-6`,children:(0,J.jsx)(`div`,{className:`relative aspect-square w-[min(72vw,20rem)] rounded-md border-2 border-white/90 shadow-[0_0_0_9999px_rgba(0,0,0,0.18)]`,children:(0,J.jsx)(jn,{className:`absolute top-1/2 left-1/2 size-10 -translate-x-1/2 -translate-y-1/2 text-white/75`})})}),(0,J.jsxs)(`footer`,{className:`flex flex-col items-center gap-3 bg-black/60 px-5 pt-4 text-center`,style:{paddingBottom:`max(env(safe-area-inset-bottom), 1rem)`},children:[(0,J.jsx)(`p`,{className:`max-w-sm text-sm leading-relaxed text-white/90`,children:n(`config:mobileServer.scanHint`)}),(0,J.jsx)(z,{variant:`outline`,className:`w-full max-w-sm border-white/50 bg-black/30 text-white hover:bg-black/60 hover:text-white`,onClick:()=>void E(),children:n(`config:mobileServer.cancelScan`)})]})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(Tt,{children:[(0,J.jsx)(Ct,{children:n(`config:mobileServer.addServer`)}),(0,J.jsx)(xt,{children:n(`config:mobileServer.discoverDescription`)})]}),(0,J.jsxs)(`section`,{className:`grid gap-2`,"aria-live":`polite`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,J.jsx)(kn,{className:`size-4`}),n(`config:mobileServer.nearby`)]}),(0,J.jsx)(z,{size:`icon-sm`,variant:`ghost`,disabled:d||i!==null,className:`pointer-coarse:size-11`,"aria-label":n(`config:mobileServer.rediscover`),onClick:()=>void O(),children:(0,J.jsx)(fe,{className:d?`animate-spin`:void 0})})]}),c.length?(0,J.jsx)(`ul`,{className:`m-0 grid max-h-44 list-none divide-y divide-stroke-soft overflow-y-auto border-y border-stroke-soft p-0`,children:c.map(e=>{let t=i===`lan:${e.id}`;return(0,J.jsxs)(`li`,{className:`flex min-h-12 items-center justify-between gap-3 py-2`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(ge,{className:`size-4 flex-none text-muted-foreground`}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`truncate text-sm`,children:e.name}),(0,J.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e.url})]})]}),(0,J.jsxs)(z,{size:`sm`,className:`pointer-coarse:min-h-11`,disabled:i!==null,onClick:()=>void A(e),children:[t?(0,J.jsx)(F,{className:`animate-spin`}):null,n(`config:mobileServer.requestConnect`)]})]},e.id)})}):(0,J.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:n(d?`config:mobileServer.discovering`:`config:mobileServer.noNearby`)}),p?(0,J.jsx)(`p`,{role:`alert`,className:`text-xs leading-relaxed text-content-secondary`,children:p}):null,h?(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-[var(--r-md)] bg-surface-subtle px-3 py-2`,children:[(0,J.jsx)(`p`,{role:`status`,className:`text-xs leading-relaxed`,children:h}),(0,J.jsx)(z,{size:`sm`,variant:`outline`,className:`pointer-coarse:min-h-11`,onClick:()=>void k(),children:n(`config:mobileServer.cancelRequest`)})]}):null]}),(0,J.jsxs)(`div`,{className:`relative py-1`,children:[(0,J.jsx)(et,{}),(0,J.jsx)(`span`,{className:`absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-popover px-2 text-xs text-muted-foreground`,children:n(`config:mobileServer.otherMethods`)})]}),(0,J.jsxs)(z,{className:`w-full pointer-coarse:min-h-11`,disabled:i!==null,onClick:()=>void j(),children:[i===`scan`?(0,J.jsx)(F,{className:`animate-spin`}):(0,J.jsx)(On,{}),n(`config:mobileServer.scan`)]}),_?(0,J.jsx)(`p`,{role:`alert`,className:`text-xs leading-relaxed text-content-secondary`,children:_}):null]})})})}function Kr(e,t){let n=window.__TAURI__?.core?.invoke??window.__TAURI_INTERNALS__?.invoke;return n?n(e,t):Promise.reject(Error(`native bridge unavailable`))}function qr({requestConfirm:e}){let{t}=l(),[n,r]=(0,q.useState)(null),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(``),[c,u]=(0,q.useState)(!1),d=(0,q.useCallback)(async()=>{try{r(await Kr(`mobile_state`)),a(``)}catch{a(t(`config:mobileServer.loadFailed`))}},[t]);(0,q.useEffect)(()=>{d()},[d]);let f=async(e,t,n=``)=>{s(n||e);try{r(await Kr(e,t)),a(``)}catch(e){a(String(e))}finally{s(``)}},p=async n=>{o||await e({title:t(`config:mobileServer.forget`),message:t(`config:mobileServer.forgetConfirm`),confirmLabel:t(`config:mobileServer.forget`),tone:`danger`})&&await f(`mobile_forget_server`,{id:n.id},n.id)},m=async e=>{s(e);try{let t=await Kr(`mobile_select_server`,{id:e});r(t),a(``),t.proxyUrl&&window.location.replace(t.proxyUrl)}catch(e){a(String(e))}finally{s(``)}},h=n?.mode===`local`,g=n?.mode===`remote`&&!!n.activeId,_=h||g,v=t(h?`config:mobileServer.currentLocal`:g?`config:mobileServer.current`:`config:mobileServer.empty`),y=e=>t(e===`iroh`?`config:mobileServer.transportP2p`:`config:mobileServer.transportLan`);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`mt-5 flex min-h-11 items-center gap-2 rounded-[var(--r-md)] border border-stroke bg-surface-subtle px-3 py-2 text-xs text-content-secondary`,role:`status`,"aria-live":`polite`,children:[_?(0,J.jsx)(bt,{status:`done`,className:`size-3.5`}):(0,J.jsx)(k,{className:`size-3.5 flex-none text-content-muted`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:v}),n?.activeTransport?(0,J.jsx)(`span`,{className:`flex-none font-mono text-xs text-content-muted`,children:y(n.activeTransport)}):null]}),(0,J.jsx)(Gr,{open:c,onOpenChange:u}),i?(0,J.jsx)(W,{className:`mt-3`,children:i}):null,(0,J.jsx)(U,{title:t(`config:mobileServer.localTitle`),"data-config-card":`mobile-server-local`,children:(0,J.jsx)(H,{children:(0,J.jsx)(V,{icon:(0,J.jsx)(Mn,{}),name:t(`config:mobileServer.localTitle`),description:t(`config:mobileServer.localDescription`),status:h?(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,J.jsx)(bt,{status:`done`,className:`size-3.5`}),t(`config:mobileServer.currentLocal`)]}):void 0,actions:h?void 0:(0,J.jsx)(z,{size:`sm`,variant:`secondary`,className:`flex-none max-[650px]:h-11 max-[650px]:px-3 pointer-coarse:h-11`,disabled:!!o,onClick:()=>void(async()=>{s(`mobile_enter_local`);try{let e=await Kr(`mobile_enter_local`);e.onDevice.url&&window.location.replace(e.onDevice.url)}catch(e){a(String(e))}finally{s(``)}})(),children:t(`config:mobileServer.enterLocal`)})})})}),(0,J.jsx)(U,{title:t(`config:mobileServer.title`),count:n?.servers?.length??0,"data-config-card":`mobile-server-main`,description:t(`config:mobileServer.description`),actions:(0,J.jsxs)(z,{size:`sm`,onClick:()=>u(!0),children:[(0,J.jsx)(de,{}),t(`config:mobileServer.addServer`)]}),children:n?.servers?.length?(0,J.jsx)(H,{children:n.servers.map(e=>{let r=n.mode===`remote`&&e.id===n.activeId,i=e.endpoints.find(e=>e.url),a=e.endpoints.find(e=>e.t===`iroh`),s=i?.url||(a?.nodeId?`Iroh ${a.nodeId.slice(0,12)}`:`Iroh`);return(0,J.jsx)(V,{"data-mobile-server":e.id,icon:(0,J.jsx)(ge,{}),name:e.name,nameMeta:t(i&&a?`config:mobileServer.transportLanP2p`:a?`config:mobileServer.transportP2p`:`config:mobileServer.transportLan`),description:(0,J.jsx)(`span`,{className:`font-mono`,children:s}),status:r?(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,J.jsx)(bt,{status:`done`,className:`size-3.5`}),n.activeTransport?t(`config:mobileServer.activeTransport`,{transport:y(n.activeTransport)}):t(`config:mobileServer.current`)]}):void 0,actions:(0,J.jsxs)(J.Fragment,{children:[r?null:(0,J.jsx)(z,{size:`sm`,variant:`ghost`,disabled:o===e.id,onClick:()=>void m(e.id),children:t(`config:mobileServer.connect`)}),(0,J.jsx)(z,{size:`icon-sm`,variant:`ghost`,className:`hover:bg-danger-soft hover:text-danger max-[650px]:size-11 pointer-coarse:size-11`,"aria-label":t(`config:mobileServer.forget`),title:t(`config:mobileServer.forget`),disabled:!!o,onClick:()=>void p(e),children:(0,J.jsx)(xe,{})})]})},e.id)})}):(0,J.jsx)(jt,{compact:!0,title:t(`config:mobileServer.empty`)})})]})}o.addResourceBundle(`zh-CN`,`remote-workspace`,{description:`使用本机的 Pisper 界面,在另一台 Linux 上运行会话、读写文件和执行任务。`,instructions:`先在 Linux 上运行 Pisper,在「设置 → 远程访问」启用连接,然后复制 HTTPS 地址、证书指纹和配对码。请通过可信渠道核对指纹。`,isolation:`每个工作区在独立窗口中打开。会话、文件、模型配置与任务属于远程机器,不会复制本机密钥;关闭窗口不会停止远程正在执行的任务。本机终端与桌面控制不会在远程窗口中启用。`,refresh:`刷新远程工作区`,name:`工作区名称(可选)`,address:`Linux HTTPS 地址`,fingerprint:`证书指纹`,code:`配对码`,pair:`配对并打开`,open:`连接`,show:`显示窗口`,forget:`移除 {name}`,forgetDescription:`这会关闭该工作区的本机窗口并移除保存的连接,不删除远程文件或会话,也不会停止远程任务。如需吊销设备授权,请在 Linux 的远程访问页操作。`,activeTitle:`当前为远程工作区`,activeDescription:`这里的会话、文件和模型设置属于远程 Linux。连接管理请回到本机主窗口;如需修改远程访问服务,请在 Linux 本机操作。`,manualConnection:`手动连接所需信息`,serverAddress:`HTTPS 服务器地址`}),o.addResourceBundle(`en-US`,`remote-workspace`,{description:`Use the local Pisper interface to run conversations, work with files, and execute tasks on another Linux machine.`,instructions:`Run Pisper on Linux and enable Settings → Remote access. Copy its HTTPS address, certificate fingerprint, and pairing code. Verify the fingerprint through a trusted channel.`,isolation:`Each workspace opens in a separate window. Sessions, files, model settings, and tasks belong to the remote machine; local credentials are not copied. Closing the window does not stop remote tasks. Local terminals and desktop controls are not enabled in remote windows.`,refresh:`Refresh remote workspaces`,name:`Workspace name (optional)`,address:`Linux HTTPS address`,fingerprint:`Certificate fingerprint`,code:`Pairing code`,pair:`Pair and open`,open:`Connect`,show:`Show window`,forget:`Remove {name}`,forgetDescription:`Close this workspace’s local windows and forget the saved connection. Remote files, sessions, and running tasks are not deleted or stopped. To revoke the device authorization, use Remote access on Linux.`,activeTitle:`Remote workspace`,activeDescription:`Sessions, files and model settings in this window belong to the remote Linux machine. Manage connections in your local main window; change remote access service settings directly on Linux.`,manualConnection:`Manual connection details`,serverAddress:`HTTPS server address`});function Jr({notify:e}){let{t,language:n}=l(),[r,i]=(0,q.useState)(null),[a,o]=(0,q.useState)(null),[s,c]=(0,q.useState)([]),[u,d]=(0,q.useState)([]),[p,m]=(0,q.useState)(null),[h,g]=(0,q.useState)(!1),[_,v]=(0,q.useState)(``),[y,b]=(0,q.useState)(``),[x,S]=(0,q.useState)(!1),[C,w]=(0,q.useState)(``),T=(0,q.useCallback)(async()=>{try{let[e,t,n,r]=await Promise.all([f(`/api/remote/status`),f(`/api/remote/devices`),f(`/api/remote/pairing-requests`).catch(()=>({requests:[]})),f(`/api/remote/firewall`).catch(e=>{if(e&&typeof e==`object`&&`status`in e&&e.status===403)return null;throw e})]);i(e),o(r),c(t.devices.filter(e=>!e.revokedAt)),d(n.requests),w(``)}catch{w(t(`config:remoteAccess.loadFailed`))}},[t]);(0,q.useEffect)(()=>{T()},[T]),(0,q.useEffect)(()=>{if(!r?.listening)return;let e=window.setInterval(()=>void T(),2e3);return()=>window.clearInterval(e)},[T,r?.listening]);let D=async n=>{S(!0);try{await f(`/api/remote/enabled`,{method:`PUT`,body:{enabled:n,configureFirewall:a!==null},timeout:15e4});let e=window.__TAURI__?.core?.invoke??window.__TAURI_INTERNALS__?.invoke;e&&await e(`desktop_iroh_set_enabled`,{enabled:n}).catch(()=>void 0),n||(m(null),g(!1),v(``)),await T()}catch(n){e(t(`config:remoteAccess.toggleFailed`,{message:String(n)}),`error`)}finally{S(!1)}},O=async()=>{S(!0);try{await f(`/api/remote/firewall/retry`,{method:`POST`,body:{},timeout:15e4}),await T()}catch(n){e(t(`config:remoteAccess.firewallRetryFailed`,{message:String(n)}),`error`)}finally{S(!1)}},k={disabled:t(`config:remoteAccess.firewallDisabled`),configured:t(`config:remoteAccess.firewallConfigured`),not_needed:t(`config:remoteAccess.firewallNotNeeded`),needs_authorization:t(`config:remoteAccess.firewallNeedsAuthorization`),unsupported:t(`config:remoteAccess.firewallUnsupported`),cancelled:t(`config:remoteAccess.firewallCancelled`),error:t(`config:remoteAccess.firewallError`),cleanup_pending:t(`config:remoteAccess.firewallCleanupPending`)},A={packaged_app_required:t(`config:remoteAccess.firewallPackagedApp`),unsupported_firewall:t(`config:remoteAccess.firewallUnsupportedBackend`),unsupported_platform:t(`config:remoteAccess.firewallUnsupportedBackend`),permission_denied:t(`config:remoteAccess.firewallPermissionDenied`),cancelled:t(`config:remoteAccess.firewallCancelled`),timeout:t(`config:remoteAccess.firewallTimeout`),block_all:t(`config:remoteAccess.firewallBlockAll`),rule_changed:t(`config:remoteAccess.firewallRuleChanged`),inspection_failed:t(`config:remoteAccess.firewallVerificationFailed`),verification_failed:t(`config:remoteAccess.firewallVerificationFailed`),operation_failed:t(`config:remoteAccess.firewallVerificationFailed`),unsupported:t(`config:remoteAccess.firewallUnsupportedBackend`)},j=async()=>{S(!0),v(``);try{let e=await f(`/api/remote/pairing-code`,{method:`POST`});if(!e?.code||!e?.expiresAt)throw Error(t(`config:remoteAccess.qrUnavailable`));e.connectionInfo=await f(`/api/remote/connection-info`).catch(()=>void 0),m(e),g(!0),e.qrDataUrl||v(t(`config:remoteAccess.qrUnavailable`))}catch(n){let r=t(`config:remoteAccess.pairingFailed`,{message:String(n)});v(r),e(r,`error`)}finally{S(!1)}},M=async(n,r)=>{b(n.id);try{await f(`/api/remote/pairing-requests/${encodeURIComponent(n.id)}/decision`,{method:`POST`,body:{approved:r}}),await T()}catch(n){e(t(`config:remoteAccess.approvalFailed`,{message:String(n)}),`error`)}finally{b(``)}},ee=async n=>{if(window.confirm(t(`config:remoteAccess.revokeConfirm`,{name:n.name})))try{await f(`/api/remote/devices/${encodeURIComponent(n.id)}/revoke`,{method:`POST`}),await T()}catch(n){e(t(`config:remoteAccess.revokeFailed`,{message:String(n)}),`error`)}};if(C&&!r)return(0,J.jsx)(kt,{kind:`error`,title:t(`config:remoteAccess.loadFailed`),action:(0,J.jsxs)(z,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>void T(),children:[(0,J.jsx)(fe,{}),t(`config:remoteAccess.refresh`)]})});if(!r)return(0,J.jsx)(kt,{kind:`loading`,title:t(`config:remoteAccess.loading`)});let N=r.error?`failed`:r.listening?`on`:r.enabled?`starting`:`off`,P=a!==null&&!a.busy&&[`needs_authorization`,`cancelled`,`error`,`cleanup_pending`].includes(a.state);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Et,{open:h&&p!==null,onOpenChange:g,children:(0,J.jsxs)(St,{className:`sm:max-w-md`,children:[(0,J.jsxs)(Tt,{children:[(0,J.jsx)(Ct,{children:t(`config:remoteAccess.pairingQrTitle`)}),(0,J.jsx)(xt,{children:t(`config:remoteAccess.scanQrDescription`)})]}),(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-2`,"aria-live":`polite`,children:[p?.qrDataUrl?(0,J.jsx)(`img`,{src:p.qrDataUrl,alt:t(`config:remoteAccess.qrAlt`),className:`size-64 max-w-full rounded-sm border border-stroke bg-white p-2`}):null,_?(0,J.jsx)(`p`,{role:`alert`,className:`text-center text-xs leading-relaxed text-content-secondary`,children:_}):null,p?(0,J.jsxs)(`div`,{className:`text-center`,children:[(0,J.jsx)(`div`,{className:`font-mono text-[20px] font-medium tracking-[0.2em] text-content`,children:p.code}),(0,J.jsx)(`div`,{className:`mt-1 text-xs text-content-muted tabular-nums`,children:t(`config:remoteAccess.codeExpiresAt`,{time:yt(p.expiresAt,n)})})]}):null]}),p?.connectionInfo&&(0,J.jsxs)(`details`,{className:`min-w-0 rounded-md border border-stroke px-3 py-2 text-sm`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer text-content-secondary`,children:t(`remote-workspace:manualConnection`)}),(0,J.jsxs)(`div`,{className:`mt-2 space-y-2 text-xs text-content-muted`,children:[(0,J.jsx)(`div`,{children:t(`remote-workspace:serverAddress`)}),p.connectionInfo.endpoints.map(e=>(0,J.jsx)(`code`,{className:`block font-mono break-all text-content select-all`,children:e.url},e.url)),(0,J.jsx)(`div`,{children:t(`remote-workspace:fingerprint`)}),(0,J.jsx)(`code`,{className:`block font-mono break-all text-content select-all`,children:p.connectionInfo.fingerprint})]})]}),(0,J.jsx)(wt,{children:(0,J.jsxs)(z,{disabled:x,onClick:()=>void j(),children:[x?(0,J.jsx)(R,{className:`text-current`}):(0,J.jsx)(fe,{}),t(x?`config:remoteAccess.generatingQr`:`config:remoteAccess.regenerate`)]})})]})}),C&&(0,J.jsx)(W,{children:C}),(0,J.jsx)(U,{title:t(`config:remoteAccess.thisComputer`),"data-config-card":`remote-access-main`,children:(0,J.jsxs)(H,{children:[(0,J.jsx)(V,{icon:(0,J.jsx)(se,{}),name:t(`config:remoteAccess.allowConnections`),description:t(`config:remoteAccess.description`),status:(0,J.jsx)(Yr,{attention:N===`failed`,glyph:N===`on`?`done`:N===`starting`?`run`:null,children:t(N===`failed`?`config:remoteAccess.stateFailed`:N===`on`?`config:remoteAccess.stateListening`:N===`starting`?`config:remoteAccess.stateStarting`:`config:remoteAccess.stateOff`)}),actions:(0,J.jsx)(nt,{checked:r.enabled,disabled:x,onCheckedChange:e=>void D(e),"aria-label":t(`config:remoteAccess.title`)}),detail:r.error?(0,J.jsx)(`p`,{className:`text-xs leading-relaxed [overflow-wrap:anywhere] text-st-attn`,children:t(`config:remoteAccess.listenFailed`,{message:r.error})}):void 0}),a?(0,J.jsx)(V,{"aria-live":`polite`,icon:(0,J.jsx)(_e,{}),name:t(`config:remoteAccess.firewallTitle`),description:a.busy?t(`config:remoteAccess.firewallWorking`):k[a.state],status:a.busy?(0,J.jsx)(Yr,{glyph:`run`,children:t(`config:remoteAccess.firewallChecking`)}):P?(0,J.jsx)(Yr,{attention:!0,children:t(`config:remoteAccess.firewallNeedsYou`)}):void 0,actions:r.enabled||a.state===`cleanup_pending`?(0,J.jsxs)(z,{size:`sm`,variant:`secondary`,disabled:x||a.busy,onClick:()=>void O(),children:[x||a.busy?(0,J.jsx)(R,{className:`text-current`}):(0,J.jsx)(fe,{}),r.enabled?t(`config:remoteAccess.firewallRetry`):t(`config:remoteAccess.firewallRetryCleanup`)]}):void 0,detail:(0,J.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-xs leading-relaxed text-content-muted`,children:[a.reason&&A[a.reason]?(0,J.jsx)(`p`,{className:`text-content-secondary`,children:A[a.reason]}):null,r.enabled?(0,J.jsx)(`p`,{children:a.scope===`application`?t(`config:remoteAccess.firewallApplicationScope`):a.scope===`program_port`?t(`config:remoteAccess.firewallProgramPortScope`,{port:a.port??`—`}):t(`config:remoteAccess.firewallPortScope`,{port:a.port??`—`})}):null,(0,J.jsx)(`p`,{children:t(`config:remoteAccess.firewallReachability`)}),a.checkedAt?(0,J.jsx)(`p`,{className:`tabular-nums`,children:t(`config:remoteAccess.firewallCheckedAt`,{time:yt(a.checkedAt,n)})}):null]})}):null]})}),r.listening&&u.length?(0,J.jsx)(U,{"aria-live":`polite`,title:t(`config:remoteAccess.pendingApprovals`),count:u.length,meta:(0,J.jsx)(`span`,{className:`font-medium text-st-attn`,children:t(`config:remoteAccess.waitingForYou`)}),description:t(`config:remoteAccess.pendingApprovalsDescription`),children:(0,J.jsx)(H,{children:u.map(e=>(0,J.jsx)(V,{"data-pairing-request":e.id,icon:(0,J.jsx)(Mn,{}),name:e.deviceName,description:(0,J.jsx)(`span`,{className:`font-mono`,children:t(`config:remoteAccess.requestSource`,{ip:e.ip})}),meta:t(`config:remoteAccess.requestedAt`,{time:yt(e.requestedAt,n)}),actions:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(z,{size:`sm`,variant:`ghost`,disabled:y===e.id,onClick:()=>void M(e,!1),children:[(0,J.jsx)(we,{}),t(`config:remoteAccess.reject`)]}),(0,J.jsxs)(z,{size:`sm`,disabled:y===e.id,onClick:()=>void M(e,!0),children:[y===e.id?(0,J.jsx)(R,{className:`text-current`}):(0,J.jsx)(E,{}),t(`config:remoteAccess.approve`)]})]})},e.id))})}):null,r.listening?(0,J.jsx)(U,{title:t(`config:remoteAccess.pairing`),"data-config-card":`remote-access-pairing`,children:(0,J.jsx)(H,{children:(0,J.jsx)(V,{icon:(0,J.jsx)(On,{}),name:t(`config:remoteAccess.pairWithPhone`),description:t(`config:remoteAccess.pairingDescription`),actions:(0,J.jsxs)(z,{size:`sm`,disabled:x,onClick:()=>void j(),children:[x?(0,J.jsx)(R,{className:`text-current`}):(0,J.jsx)(On,{}),t(x?`config:remoteAccess.generatingQr`:`config:remoteAccess.generateQr`)]}),detail:_&&!h?(0,J.jsx)(`p`,{className:`text-xs leading-relaxed text-content-secondary`,"aria-live":`polite`,children:_}):void 0})})}):null,(0,J.jsx)(U,{title:t(`config:remoteAccess.devices`),count:s.length,"data-config-card":`remote-access-devices`,actions:(0,J.jsx)(z,{size:`icon-sm`,variant:`ghost`,className:`pointer-coarse:size-11 max-[650px]:size-11`,onClick:()=>void T(),"aria-label":t(`config:remoteAccess.refresh`),title:t(`config:remoteAccess.refresh`),children:(0,J.jsx)(fe,{})}),children:s.length===0?(0,J.jsx)(jt,{compact:!0,title:t(`config:remoteAccess.noDevices`)}):(0,J.jsx)(H,{children:s.map(e=>(0,J.jsx)(V,{icon:(0,J.jsx)(Mn,{}),name:e.name,nameMeta:e.current?t(`config:remoteAccess.currentDevice`):void 0,description:t(`config:remoteAccess.lastSeen`,{time:yt(e.lastSeenAt,n)}),actions:(0,J.jsx)(z,{size:`sm`,variant:`ghost`,className:`hover:bg-danger-soft hover:text-danger`,"aria-label":`${t(`config:remoteAccess.revoke`)}: ${e.name}`,onClick:()=>void ee(e),children:t(`config:remoteAccess.revoke`)})},e.id))})})]})}function Yr({attention:e=!1,glyph:t=null,children:n}){let r=e?`attention`:t;return(0,J.jsxs)(`span`,{className:L(`inline-flex min-w-0 items-center gap-1.5 whitespace-nowrap`,e?`font-medium text-st-attn`:`text-content-secondary`),children:[r&&(0,J.jsx)(bt,{status:r,className:`size-3.5`}),n]})}function Xr({requestConfirm:e}){let{t}=l(),n=window.pisperDesktop?.remoteWorkspaces,[r,i]=(0,q.useState)([]),[a,o]=(0,q.useState)(``),[s,c]=(0,q.useState)(``),[u,d]=(0,q.useState)(``),[f,p]=(0,q.useState)(``),[m,h]=(0,q.useState)(!1),[g,_]=(0,q.useState)(``),v=(0,q.useCallback)(async()=>{n&&i(await n.list())},[n]);(0,q.useEffect)(()=>{v().catch(e=>_(String(e)))},[v]);let y=async e=>{if(!m){h(!0),_(``);try{await e()}catch(e){_(e instanceof Error?e.message:String(e))}finally{h(!1)}}};return window.__PISPER_REMOTE_WORKSPACE__?(0,J.jsx)(U,{title:t(`config:remoteWorkspace.title`),"data-config-card":`remote-workspaces`,children:(0,J.jsx)(H,{children:(0,J.jsx)(V,{icon:(0,J.jsx)(ge,{}),name:t(`remote-workspace:activeTitle`),description:t(`remote-workspace:activeDescription`),detail:(0,J.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:t(`remote-workspace:isolation`)})})})}):n?(0,J.jsxs)(U,{title:t(`config:remoteWorkspace.title`),count:r.length,"data-config-card":`remote-workspaces`,description:t(`remote-workspace:description`),actions:(0,J.jsx)(z,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`pointer-coarse:size-11`,disabled:m,"aria-label":t(`remote-workspace:refresh`),title:t(`remote-workspace:refresh`),onClick:()=>void y(v),children:(0,J.jsx)(fe,{className:`size-3.5`})}),children:[r.length>0&&(0,J.jsx)(H,{children:r.map(r=>(0,J.jsx)(V,{icon:(0,J.jsx)(ge,{}),name:r.name,description:(0,J.jsx)(`span`,{className:`font-mono`,children:r.address}),actions:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(z,{type:`button`,size:`sm`,variant:`secondary`,disabled:m,onClick:()=>void y(async()=>{await n.open(r.id),await v()}),children:[r.connected?t(`remote-workspace:show`):t(`remote-workspace:open`),(0,J.jsx)(S,{className:`size-3.5`})]}),(0,J.jsx)(z,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`hover:bg-danger-soft hover:text-danger max-[650px]:size-11 pointer-coarse:size-11`,disabled:m,"aria-label":t(`remote-workspace:forget`,{name:r.name}),onClick:()=>void y(async()=>{await e({title:t(`remote-workspace:forget`,{name:r.name}),message:t(`remote-workspace:forgetDescription`)})&&(await n.forget(r.id),await v())}),children:(0,J.jsx)(xe,{className:`size-3.5`})})]})},r.id))}),(0,J.jsxs)(`div`,{className:`@container/card mt-3 rounded-[var(--r-md)] border border-stroke px-3 pt-2 pb-1`,children:[(0,J.jsx)(`p`,{className:`py-1.5 text-xs leading-relaxed text-content-secondary`,children:t(`remote-workspace:instructions`)}),(0,J.jsxs)(`form`,{className:`divide-y divide-stroke-soft border-t border-stroke-soft`,onSubmit:e=>{e.preventDefault(),y(async()=>{let e=await n.pair({name:a,address:s,fingerprint:u,code:f});p(``),await v(),await n.open(e),await v()})},children:[(0,J.jsx)(Sr,{label:t(`remote-workspace:name`),htmlFor:`remote-workspace-name`,children:(0,J.jsx)(B,{id:`remote-workspace-name`,value:a,maxLength:160,disabled:m,placeholder:`Linux`,onChange:e=>o(e.target.value)})}),(0,J.jsx)(Sr,{label:t(`remote-workspace:address`),htmlFor:`remote-workspace-address`,children:(0,J.jsx)(B,{id:`remote-workspace-address`,type:`url`,value:s,required:!0,disabled:m,placeholder:`https://192.168.1.10:5174`,autoComplete:`off`,spellCheck:!1,className:`font-mono`,onChange:e=>c(e.target.value)})}),(0,J.jsx)(Sr,{label:t(`remote-workspace:fingerprint`),htmlFor:`remote-workspace-fingerprint`,children:(0,J.jsx)(B,{id:`remote-workspace-fingerprint`,value:u,required:!0,disabled:m,placeholder:`SHA256:…`,autoComplete:`off`,spellCheck:!1,className:`font-mono text-xs`,onChange:e=>d(e.target.value)})}),(0,J.jsx)(Sr,{label:t(`remote-workspace:code`),htmlFor:`remote-workspace-code`,children:(0,J.jsx)(B,{id:`remote-workspace-code`,value:f,required:!0,maxLength:64,disabled:m,placeholder:`ABCD-EFGH`,autoComplete:`off`,spellCheck:!1,className:`font-mono`,onChange:e=>p(e.target.value)})}),(0,J.jsx)(`div`,{className:`flex justify-end py-3`,children:(0,J.jsxs)(z,{type:`submit`,className:`max-[650px]:h-11`,disabled:m,children:[m?(0,J.jsx)(R,{className:`text-current`}):(0,J.jsx)(S,{className:`size-3.5`}),t(`remote-workspace:pair`)]})})]})]}),g&&(0,J.jsx)(W,{className:`mt-3`,children:g}),(0,J.jsx)(`p`,{className:`mt-3 text-xs leading-relaxed text-content-muted`,children:t(`remote-workspace:isolation`)})]}):null}function Zr({section:e,notify:t,requestConfirm:n,onBack:r}){let{t:i}=l(),a=m(e=>e.capabilities),o=h(),s=p(a,e,{mobileApp:o}),c=i(e===`remote-access`?`config:configPage.remoteAccess`:e===`mobile-server`?`config:configPage.mobileServer`:`config:configPage.desktopPet`),u=i(e===`remote-access`?`config:deviceFeature.remoteAccessLede`:e===`mobile-server`?`config:deviceFeature.mobileServerLede`:`config:desktopPetSettings.description`),d;return d=s.supported?e===`desktop-pet`?(0,J.jsx)(kr,{notify:t,requestConfirm:n}):e===`mobile-server`?(0,J.jsx)(qr,{requestConfirm:n}):(0,J.jsxs)(J.Fragment,{children:[!window.__PISPER_REMOTE_WORKSPACE__&&(0,J.jsx)(Jr,{notify:t}),(0,J.jsx)(Xr,{requestConfirm:n})]}):(0,J.jsx)(Qr,{section:e,support:s}),(0,J.jsx)(Nt,{"data-device-feature":e,title:c,description:u,back:r&&{label:i(`navigation:sidebar.features`),ariaLabel:i(`navigation:shell.backToFeaturesLabel`),onBack:r},children:(0,J.jsx)(`div`,{"data-config-card":st,className:`min-w-0`,children:d})})}function Qr({section:e,support:t}){let{t:n}=l(),r=n(e===`desktop-pet`?`config:desktopPetSettings.showOnDesktop`:e===`mobile-server`?`config:mobileServer.title`:`config:remoteAccess.allowConnections`),i=t.reason===`runtime`?n(`config:deviceFeature.runtimeUnavailable`):t.reason===`mobile-only`?n(`config:deviceFeature.mobileOnly`):n(e===`desktop-pet`?`config:desktopPetSettings.desktopOnlyDescription`:`config:deviceFeature.remoteAccessDesktopOnly`);return(0,J.jsx)(U,{title:n(`config:deviceFeature.unavailableTitle`),"data-device-unsupported":!0,children:(0,J.jsx)(H,{children:(0,J.jsx)(V,{icon:e===`desktop-pet`?(0,J.jsx)(w,{}):(0,J.jsx)(se,{}),name:r,description:i,status:n(`config:deviceFeature.unavailable`),actions:(0,J.jsx)(nt,{checked:!1,disabled:!0,"aria-label":r})})})})}function $r({title:e,description:t,action:n,children:r,className:i,...a}){let o=(0,q.useId)();return(0,J.jsxs)(`section`,{"aria-labelledby":o,className:L(`min-w-0`,i),...a,children:[(0,J.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h2`,{id:o,className:`text-[15px] leading-6 font-medium text-content`,children:e}),t&&(0,J.jsx)(`p`,{className:`mt-0.5 text-[13px] text-content-muted`,children:t})]}),n]}),(0,J.jsx)(`div`,{className:`divide-y divide-stroke-soft`,children:r})]})}function Q({title:e,description:t,control:n,nested:r,children:i,className:a,...o}){return(0,J.jsxs)(`div`,{className:L(`min-w-0 py-3`,r&&`pl-4`,a),...o,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-x-6 gap-y-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1 basis-40`,children:[(0,J.jsx)(`div`,{className:`text-[13px] font-medium text-content`,children:e}),t&&(0,J.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-content-muted`,children:t})]}),n&&(0,J.jsx)(`div`,{className:`max-w-full shrink-0`,children:n})]}),i]})}function ei({className:e,...t}){return(0,J.jsx)(ar,{"data-slot":`radio-group`,className:L(`grid w-full gap-2`,e),...t})}function ti({className:e,...t}){return(0,J.jsx)(ur,{"data-slot":`radio-group-option`,className:L(`disabled:pointer-events-none disabled:opacity-50`,e),...t})}function ni(e,t){return t(e===`en-US`?`config:languageSettings.english`:`config:languageSettings.simplifiedChinese`)}function ri({notify:e}){let{language:t,setLanguage:n,t:r}=l(),i=(0,q.useId)(),a=(0,q.useId)(),o=r=>{r!==t&&(n(r),e(s(r===`en-US`?`config:languageSettings.displayLanguageChangedToEnglish`:`config:languageSettings.displayLanguageChangedToSimplifiedChinese`,r)))};return(0,J.jsxs)(`div`,{className:`flex flex-row flex-wrap items-center justify-between gap-x-6 gap-y-3 border-y border-stroke-soft py-3`,"data-config-card":`interface-language`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1 basis-40`,children:[(0,J.jsx)(`h2`,{id:i,className:`text-sm font-medium text-content`,children:r(`config:languageSettings.displayLanguage`)}),(0,J.jsx)(`p`,{id:a,className:`mt-0.5 text-xs leading-relaxed text-content-muted`,children:r(`config:languageSettings.interfaceOnlyHint`)})]}),(0,J.jsxs)($e,{value:t,onValueChange:e=>{let t=c.find(t=>t.value===e);t&&o(t.value)},children:[(0,J.jsx)(Xe,{"aria-labelledby":i,"aria-describedby":a,className:`min-w-36 shrink-0`,children:(0,J.jsx)(Ye,{})}),(0,J.jsx)(Ze,{align:`end`,children:c.map(e=>(0,J.jsx)(Qe,{value:e.value,children:ni(e.value,r)},e.value))})]})]})}function ii({role:e,label:t,value:n,onCommit:r}){let{t:i}=l(),a=(0,q.useId)(),[o,s]=(0,q.useState)(String(n)),c=(0,q.useRef)(o),u=(0,q.useRef)(n),d=e===`ui`?dn:ln;(0,q.useEffect)(()=>{u.current=n,c.current=String(n),s(String(n))},[n]);let f=o!==String(n)&&un(o,e)===null,p=()=>{let t=un(c.current,e);t!==null&&t!==u.current&&(r(t),u.current=t)};return(0,J.jsxs)(`div`,{className:`flex max-w-full flex-col items-end gap-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(B,{type:`number`,min:d.min,max:d.max,step:1,value:o,"aria-label":t,"aria-invalid":f,"aria-describedby":f?a:void 0,className:`h-8 w-16 text-sm tabular-nums pointer-coarse:min-h-11 max-[650px]:min-h-11`,onChange:e=>{c.current=e.target.value,s(e.target.value)},onPointerUp:p,onBlur:p,onKeyDown:e=>{e.nativeEvent.isComposing||(e.key===`Enter`?(e.preventDefault(),p()):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),c.current=String(n),s(String(n))))}}),(0,J.jsx)(`span`,{className:`text-sm text-content-muted`,children:`px`})]}),f&&(0,J.jsx)(`p`,{id:a,role:`alert`,className:`max-w-56 text-xs text-destructive`,children:i(`config:interfaceSettings.invalidFontSize`,{min:d.min,max:d.max})})]})}function ai({label:e,options:t,value:n,onChange:r}){return(0,J.jsx)(ei,{value:n,onValueChange:e=>{let n=t.find(t=>t.value===e);n&&r(n.value)},className:`grid auto-cols-fr grid-flow-col gap-0.5 rounded-md border border-stroke bg-chrome p-[3px]`,"aria-label":e,children:t.map(e=>(0,J.jsx)(ti,{type:`button`,className:L(`min-h-7 rounded-sm border border-transparent px-2.5 text-sm transition-colors pointer-coarse:min-h-11 max-[650px]:min-h-11`,e.value===n?`border-key-border bg-key font-medium text-content shadow-key`:`text-content-secondary hover:text-content`),value:e.value,children:e.label},e.value))})}var oi={neutral:`var(--primary)`,blue:`#3d4bef`,teal:`#0f766e`,violet:`#6d4ad6`,coral:`#c93a48`,custom:`#3d4bef`};function si(e){let[t,n,r]=[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)/255),i=Math.max(t,n,r),a=i-Math.min(t,n,r),o=0;return a&&(o=i===t?(n-r)/a%6:i===n?(r-t)/a+2:(t-n)/a+4),{hue:(o*60+360)%360,saturation:i?a/i:0,brightness:i}}function ci({hue:e,saturation:t,brightness:n}){let r=n*t,i=r*(1-Math.abs(e/60%2-1));return`#`+[[r,i,0],[i,r,0],[0,r,i],[0,i,r],[i,0,r],[r,0,i]][Math.floor(e/60)%6].map(e=>Math.round((e+n-r)*255).toString(16).padStart(2,`0`)).join(``)}function li({value:e,onCommit:t}){let{t:n}=l(),[r,i]=(0,q.useState)(e),a=(0,q.useRef)(e),[o,s]=(0,q.useState)(()=>si(e)),c=(0,q.useId)(),u=e=>{a.current=e,i(e)};(0,q.useEffect)(()=>{a.current=e,i(e),s(si(e))},[e]);let d=e=>{s(e),u(ci(e))},f=()=>{let n=Xt(a.current);n&&n!==Xt(e)&&t(n)},p=e=>{let t=e.currentTarget.getBoundingClientRect();d({...o,saturation:Math.min(1,Math.max(0,(e.clientX-t.left)/t.width)),brightness:1-Math.min(1,Math.max(0,(e.clientY-t.top)/t.height))})},m=!!r.trim()&&!Xt(r);return(0,J.jsxs)(Je,{onOpenChange:t=>{t||(f(),Xt(a.current)||(u(e),s(si(e))))},children:[(0,J.jsx)(Ke,{asChild:!0,children:(0,J.jsxs)(z,{variant:`outline`,className:`h-8 min-h-0 w-26 gap-1.5 px-2 text-xs tabular-nums pointer-coarse:h-11 max-[650px]:h-11`,"aria-label":n(`config:interfaceSettings.customAccentColor`),children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 shrink-0 rounded-full border border-stroke-strong`,style:{backgroundColor:e}}),(0,J.jsx)(`span`,{className:`font-mono`,children:e})]})}),(0,J.jsxs)(qe,{align:`end`,sideOffset:8,className:`w-auto rounded-xl p-3`,children:[(0,J.jsx)(`div`,{role:`slider`,tabIndex:0,"aria-label":n(`config:interfaceSettings.colorSpectrum`),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(o.saturation*100),"aria-valuetext":r,"aria-describedby":c,className:`relative h-34 w-34 touch-none rounded-lg outline-none focus-visible:ring-2 focus-visible:ring-ring`,style:{background:`linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent), hsl(${o.hue} 100% 50%)`},onPointerDown:e=>{e.currentTarget.setPointerCapture(e.pointerId),p(e)},onPointerMove:e=>{e.currentTarget.hasPointerCapture(e.pointerId)&&p(e)},onPointerUp:e=>{e.currentTarget.hasPointerCapture(e.pointerId)&&(p(e),e.currentTarget.releasePointerCapture(e.pointerId),f())},onPointerCancel:()=>{u(e),s(si(e))},onKeyDown:e=>{[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`].includes(e.key)&&(e.preventDefault(),d({...o,saturation:Math.min(1,Math.max(0,o.saturation+(e.key===`ArrowRight`?.01:e.key===`ArrowLeft`?-.01:0))),brightness:Math.min(1,Math.max(0,o.brightness+(e.key===`ArrowUp`?.01:e.key===`ArrowDown`?-.01:0)))}))},onKeyUp:e=>{e.key.startsWith(`Arrow`)&&f()},onBlur:f,children:(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute size-3 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white shadow-sm`,style:{left:`${o.saturation*100}%`,top:`${(1-o.brightness)*100}%`}})}),(0,J.jsx)(tt,{min:0,max:359,step:1,value:[Math.round(o.hue)],"aria-label":n(`config:interfaceSettings.colorHue`),valueText:`${Math.round(o.hue)}°`,className:`h-7 w-34`,onValueChange:([e])=>d({...o,hue:e}),onValueCommit:()=>f()}),(0,J.jsx)(B,{type:`text`,value:r,spellCheck:!1,"aria-label":n(`config:interfaceSettings.customAccentHex`),"aria-invalid":m,"aria-describedby":c,className:`w-34 font-mono text-xs`,onChange:e=>{u(e.target.value);let t=Xt(e.target.value);t&&s(si(t))},onBlur:f,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),f())}}),(0,J.jsx)(`p`,{id:c,className:`max-w-34 text-xs text-muted-foreground`,children:n(m?`config:interfaceSettings.invalidAccentColor`:`config:interfaceSettings.colorSpectrumHint`)})]})]})}function ui({notify:e,defaultAdvancedExpanded:t=!1,navigationKey:n}){let{t:r}=l(),{theme:i,density:a,accent:o,customAccent:s,uiFontSize:c,codeFontSize:u,radius:d,motion:f,setTheme:p,setDensity:m,setAccent:h,setCustomAccent:g,setUiFontSize:y,setCodeFontSize:b,setRadius:x,setMotion:S,resetAppearance:C}=Zt(),w=v(e=>e.pinned),T=v(e=>e.setPinned),[E,O]=(0,q.useState)(t),k=(0,q.useId)(),A=(0,q.useId)();(0,q.useEffect)(()=>{t&&O(!0)},[t,n]);let j=i!==tn.theme||a!==tn.density||o!==tn.accent||s!==tn.customAccent||c!==tn.uiFontSize||u!==tn.codeFontSize||d!==tn.radius||f!==tn.motion,M=t=>n=>{t(n),e(r(`config:interfaceSettings.preferencesUpdated`))},ee=[{value:`system`,label:r(`config:interfaceSettings.followSystem`),description:r(`config:interfaceSettings.followSystemDescription`),icon:En},{value:`light`,label:r(`config:interfaceSettings.light`),description:r(`config:interfaceSettings.lightDescription`),icon:Pn},{value:`dark`,label:r(`config:interfaceSettings.dark`),description:r(`config:interfaceSettings.darkDescription`),icon:Dn}],N=[{value:`comfortable`,label:r(`config:interfaceSettings.comfortable`),description:r(`config:interfaceSettings.comfortableDescription`),icon:In},{value:`compact`,label:r(`config:interfaceSettings.compact`),description:r(`config:interfaceSettings.compactDescription`),icon:wn}],P=[{value:`system`,label:r(`config:interfaceSettings.motionSystem`),description:r(`config:interfaceSettings.motionSystemDescription`),icon:En},{value:`full`,label:r(`config:interfaceSettings.motionFull`),description:r(`config:interfaceSettings.motionFullDescription`),icon:ye},{value:`reduced`,label:r(`config:interfaceSettings.motionReduced`),description:r(`config:interfaceSettings.motionReducedDescription`),icon:_}],te=[{value:`neutral`,label:r(`config:interfaceSettings.accentNeutral`)},{value:`blue`,label:r(`config:interfaceSettings.accentBlue`)},{value:`teal`,label:r(`config:interfaceSettings.accentTeal`)},{value:`violet`,label:r(`config:interfaceSettings.accentViolet`)},{value:`coral`,label:r(`config:interfaceSettings.accentCoral`)},{value:`custom`,label:r(`config:interfaceSettings.accentCustom`)}],ne=[{value:`sharp`,label:r(`config:interfaceSettings.sharp`)},{value:`default`,label:r(`config:interfaceSettings.standard`)},{value:`soft`,label:r(`config:interfaceSettings.soft`)}];return(0,J.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,J.jsx)($r,{title:r(`config:interfaceSettings.visualStyle`),description:r(`config:interfaceSettings.appearanceDescription`),"data-config-card":`interface-appearance`,action:(0,J.jsxs)(z,{type:`button`,variant:`ghost`,size:`sm`,className:`pointer-coarse:h-11`,disabled:!j,onClick:()=>{C(),e(r(`config:interfaceSettings.defaultsRestored`))},children:[(0,J.jsx)(me,{size:14}),r(`config:interfaceSettings.restoreDefaults`)]}),children:(0,J.jsxs)(xr,{children:[(0,J.jsx)(Q,{title:r(`config:interfaceSettings.colorMode`),control:(0,J.jsx)(`div`,{role:`radiogroup`,"aria-label":r(`config:interfaceSettings.colorMode`),className:`grid w-68 max-w-full grid-cols-3 gap-4`,children:ee.map(e=>(0,J.jsxs)(`label`,{className:`group flex min-w-0 cursor-pointer flex-col items-center gap-2 text-xs text-content-muted`,children:[(0,J.jsx)(`input`,{className:`peer sr-only`,type:`radio`,name:A,value:e.value,checked:i===e.value,onChange:()=>M(p)(e.value)}),(0,J.jsxs)(`span`,{"aria-hidden":`true`,className:L(`relative block aspect-4/3 w-full overflow-hidden rounded-md border border-stroke bg-surface-sunken peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2 peer-focus-visible:outline-focus`,i===e.value&&`border-star ring-2 ring-star`),children:[(0,J.jsxs)(`span`,{className:`absolute inset-2 rounded border border-(--preview-light-line) bg-(--preview-light-bg)`,children:[(0,J.jsx)(`span`,{className:`absolute inset-y-0 left-0 w-1/4 border-r border-(--preview-light-line) bg-(--preview-light-side)`}),(0,J.jsx)(`span`,{className:`absolute top-3 right-1 h-0.5 w-1/2 rounded bg-(--preview-light-line)`}),(0,J.jsx)(`span`,{className:`absolute top-5 right-2 h-0.5 w-1/3 rounded bg-(--preview-light-line)`})]}),e.value!==`light`&&(0,J.jsxs)(`span`,{className:L(`absolute inset-2 rounded border border-(--preview-dark-line) bg-(--preview-dark-bg)`,e.value===`system`&&`left-1/2 rounded-l-none border-l-0`),children:[e.value===`dark`&&(0,J.jsx)(`span`,{className:`absolute inset-y-0 left-0 w-1/4 border-r border-(--preview-dark-line) bg-(--preview-dark-side)`}),(0,J.jsx)(`span`,{className:`absolute top-3 right-1 h-0.5 w-1/2 rounded bg-(--preview-dark-line)`}),(0,J.jsx)(`span`,{className:`absolute top-5 right-2 h-0.5 w-1/3 rounded bg-(--preview-dark-line)`})]})]}),(0,J.jsx)(`span`,{className:L(i===e.value&&`font-medium text-content`),children:e.label})]},e.value))})}),(0,J.jsx)(Q,{title:r(`config:interfaceSettings.accentColor`),description:r(`config:interfaceSettings.accentDescription`),control:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,J.jsxs)($e,{value:o,onValueChange:e=>{let t=te.find(t=>t.value===e);t&&M(h)(t.value)},children:[(0,J.jsx)(Xe,{"aria-label":r(`config:interfaceSettings.accentColor`),className:`min-w-36`,children:(0,J.jsx)(Ye,{})}),(0,J.jsx)(Ze,{align:`end`,children:te.map(e=>(0,J.jsxs)(Qe,{value:e.value,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 rounded-full border border-stroke-strong`,style:{backgroundColor:e.value===`custom`?s:oi[e.value]}}),e.label]},e.value))})]}),o===`custom`&&(0,J.jsx)(li,{value:Xt(s)||tn.customAccent,onCommit:M(g)})]})})]})}),(0,J.jsxs)(Yt,{open:E,onOpenChange:O,children:[(0,J.jsx)(Jt,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,"aria-controls":k,"aria-expanded":E,className:`flex min-h-9 w-full items-center gap-2 rounded-sm text-left text-[15px] leading-6 font-medium text-content max-[650px]:min-h-11`,children:[(0,J.jsx)(D,{size:16,"aria-hidden":`true`,className:L(`text-content-muted transition-transform`,!E&&`-rotate-90`)}),r(`config:interfaceSettings.advanced`)]})}),(0,J.jsx)(qt,{id:k,children:(0,J.jsxs)(xr,{className:`mt-3`,children:[(0,J.jsxs)(`div`,{className:`divide-y divide-stroke-soft`,"data-config-card":`interface-style`,children:[(0,J.jsx)(Q,{title:r(`config:interfaceSettings.uiFontSize`),description:r(`config:interfaceSettings.numericFontHint`),control:(0,J.jsx)(ii,{role:`ui`,label:r(`config:interfaceSettings.uiFontSize`),value:c,onCommit:M(y)})}),(0,J.jsx)(Q,{title:r(`config:interfaceSettings.codeFontSize`),control:(0,J.jsx)(ii,{role:`code`,label:r(`config:interfaceSettings.codeFontSize`),value:u,onCommit:M(b)})}),(0,J.jsx)(Q,{title:r(`config:interfaceSettings.cornerStyle`),control:(0,J.jsx)(ai,{label:r(`config:interfaceSettings.cornerStyle`),options:ne,value:d,onChange:M(x)})})]}),(0,J.jsxs)(`div`,{className:`divide-y divide-stroke-soft`,"data-config-card":`interface-motion`,children:[(0,J.jsx)(Q,{title:r(`config:interfaceSettings.interfaceDensity`),control:(0,J.jsx)(ai,{label:r(`config:interfaceSettings.interfaceDensity`),options:N,value:a,onChange:M(m)})}),(0,J.jsx)(Q,{title:r(`config:interfaceSettings.pinInspector`),description:r(`config:interfaceSettings.pinInspectorDescription`),control:(0,J.jsx)(nt,{checked:w,onCheckedChange:M(T),"aria-label":r(`config:interfaceSettings.pinInspector`),"data-setting":`pin-inspector`})}),(0,J.jsx)(Q,{title:r(`config:interfaceSettings.motion`),control:(0,J.jsx)(ai,{label:r(`config:interfaceSettings.motion`),options:P,value:f,onChange:M(S)})}),(0,J.jsx)(Q,{title:r(`config:interfaceSettings.automaticByTime`),description:r(`config:interfaceSettings.automaticByTimeDescription`),control:(0,J.jsx)(nt,{checked:i===`scheduled`,onCheckedChange:e=>M(p)(e?`scheduled`:`system`),"aria-label":r(`config:interfaceSettings.automaticByTime`)})})]})]})})]}),(0,J.jsx)(ri,{notify:e})]})}function di({requestConfirm:e}){let{t}=l(),n=lt(e=>e.bindings),r=lt(e=>e.boardBindings),i=lt(e=>e.setBinding),a=lt(e=>e.setBoardBinding),o=lt(e=>e.resetBindings),[s,c]=(0,q.useState)(null),[u,d]=(0,q.useState)(null),[f,p]=(0,q.useState)(!1),m=fn(),h=m.actions,g=m.boardActions,_=(e,n)=>{p(!1);let i=mt(r,e,n);if(i){d({action:e,message:t(`config:shortcuts.conflict`,{action:g[i]})});return}try{a(e,n),c(null),d(null),p(!0)}catch{d({action:e,message:t(`config:shortcuts.saveFailed`)})}},v=(e,r)=>{p(!1);let a=ft(n,e,r);if(a){d({action:e,message:t(`config:shortcuts.conflict`,{action:h[a]})});return}try{ct({...n,[e]:r})}catch{d({action:e,message:t(`config:shortcuts.invalid`)});return}try{i(e,r),c(null),d(null),p(!0)}catch{d({action:e,message:t(`config:shortcuts.saveFailed`)})}},y=(e,n)=>{if(s!==n)return;if(e.key===`Tab`){c(null);return}let r=pt.includes(n),i=r?gt(e.nativeEvent):ht(e.nativeEvent);if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){c(null),d(null);return}i&&r?_(n,i):i?v(n,i):!e.nativeEvent.isComposing&&e.keyCode!==229&&!e.repeat&&![`Control`,`Meta`,`Alt`,`Shift`,`AltGraph`,`Dead`,`Process`].includes(e.key)&&d({action:n,message:t(`config:shortcuts.invalid`)})},b=async()=>{if(c(null),await e({title:t(`config:shortcuts.resetAll`),message:t(`config:shortcuts.resetConfirm`),confirmLabel:t(`config:shortcuts.resetAll`)}))try{o(),d(null),p(!0)}catch{d({action:null,message:t(`config:shortcuts.saveFailed`)})}},x=dt.some(e=>n[e]!==ut[e])||pt.some(e=>r[e]!==vt[e]),S=e=>{let i=pt.includes(e),a=i?g[e]:h[e],o=i?r[e]:n[e],l=i?vt[e]:ut[e],f=t=>i?_(e,t):v(e,t);return(0,J.jsxs)(`div`,{className:`py-2.5`,"data-shortcut-action":e,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-x-5 gap-y-2`,children:[(0,J.jsx)(`label`,{htmlFor:`shortcut-${e}`,className:`min-w-0 text-sm font-medium text-content`,children:a}),(0,J.jsxs)(`div`,{className:`flex max-w-full min-w-0 items-center gap-1 max-[650px]:w-full`,children:[(0,J.jsx)(z,{id:`shortcut-${e}`,"data-shortcut-recorder":!0,variant:`outline`,className:L(`h-8 w-44 min-w-0 justify-center gap-2 border-input bg-panel px-2.5 text-xs font-normal shadow-none hover:bg-surface-subtle pointer-coarse:h-11 max-[650px]:h-11 max-[650px]:flex-1`,s===e&&`border-focus text-accent-fg ring-3 ring-focus-ring hover:bg-panel`),"aria-label":t(`config:shortcuts.edit`,{action:a}),"aria-pressed":s===e,"aria-describedby":u?.action===e?`shortcut-error-${e}`:void 0,onClick:()=>{c(e),d(null),p(!1)},onBlur:()=>c(t=>t===e?null:t),onKeyDown:t=>y(t,e),children:s===e?(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t(`config:shortcuts.recording`)}):_t(o)?(0,J.jsx)(it,{className:`min-w-0 flex-wrap justify-center`,children:_t(o).split(` + `).map((e,t)=>(0,J.jsx)(at,{className:`text-content-secondary`,children:e},t))}):(0,J.jsx)(`span`,{className:`text-content-muted`,children:t(`config:shortcuts.disabled`)})}),(0,J.jsxs)(Ge,{children:[(0,J.jsx)(Ue,{asChild:!0,children:(0,J.jsx)(z,{variant:`ghost`,size:`icon`,className:`pointer-coarse:size-11 max-[650px]:size-11`,title:t(`config:shortcuts.options`,{action:a}),"aria-label":t(`config:shortcuts.options`,{action:a}),children:(0,J.jsx)(N,{className:`size-4`})})}),(0,J.jsxs)(We,{align:`end`,className:`w-40`,onCloseAutoFocus:e=>{document.activeElement?.hasAttribute(`data-shortcut-recorder`)&&e.preventDefault()},children:[(0,J.jsxs)(Ve,{disabled:o===null,onSelect:()=>f(null),children:[(0,J.jsx)(we,{className:`size-4`}),t(`config:shortcuts.disableKey`)]}),(0,J.jsxs)(Ve,{disabled:o===l,onSelect:()=>f(l),children:[(0,J.jsx)(me,{className:`size-4`}),t(`config:shortcuts.resetAll`)]})]})]})]})]}),u?.action===e&&(0,J.jsx)(`p`,{id:`shortcut-error-${e}`,role:`alert`,className:`mt-2 text-xs text-danger`,children:u.message})]},e)},C=e=>e.kind===`fixed`?(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-x-5 gap-y-2 py-2.5`,"data-shortcut-fixed":e.id,children:[(0,J.jsxs)(`span`,{className:`min-w-0 text-sm text-content-secondary`,children:[m.label(e),(0,J.jsx)(`span`,{className:`ml-1.5 text-xs text-content-muted`,children:t(`board:shortcuts.fixed`)})]}),(0,J.jsxs)(`div`,{className:`flex max-w-full min-w-0 items-center gap-1 max-[650px]:w-full`,children:[(0,J.jsx)(hn,{keys:e.keys,className:`h-8 w-44 justify-center px-2.5 max-[650px]:flex-1`}),(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`size-7 flex-none pointer-coarse:size-11 max-[650px]:size-11`})]})]},mn(e)):S(e.action);return(0,J.jsxs)(`section`,{className:`w-full min-w-0`,"data-config-card":`shortcuts-bindings`,children:[(0,J.jsx)(`div`,{className:`flex flex-col gap-5`,children:pn.map((e,n)=>(0,J.jsxs)(`section`,{"aria-labelledby":`shortcut-group-${e.id}`,"data-shortcut-group":e.id,children:[(0,J.jsxs)(`div`,{className:`flex min-h-7 items-center justify-between gap-3`,children:[(0,J.jsx)(`h3`,{id:`shortcut-group-${e.id}`,className:`text-[13px] leading-6 font-semibold text-content`,children:m.groups[e.id].title}),n===0&&(0,J.jsxs)(z,{variant:`ghost`,size:`sm`,"data-shortcuts-reset-all":!0,className:`-mr-2 text-content-secondary max-[650px]:h-11 pointer-coarse:h-11`,disabled:!x,onClick:()=>void b(),children:[(0,J.jsx)(me,{className:`size-3.5`,"aria-hidden":`true`}),t(`config:shortcuts.resetAll`)]})]}),(0,J.jsx)(`p`,{className:`mb-2 text-xs text-content-muted`,children:m.groups[e.id].hint}),(0,J.jsx)(xr,{children:e.entries.map(C)})]},e.id))}),(0,J.jsx)(`div`,{className:`mt-3 min-h-5 text-xs text-content-muted`,role:`status`,"aria-live":`polite`,children:u?.action===null?(0,J.jsx)(`span`,{className:`text-destructive`,children:u.message}):t(f?`config:shortcuts.saved`:`config:shortcuts.deviceScope`)})]})}function fi(e,t){let n=(0,q.useRef)(t);n.current=t,(0,q.useEffect)(()=>{if(e)return e(()=>n.current?.())},[e])}o.addResourceBundle(`zh-CN`,`providers`,{"modelEditor.edit":`编辑模型`,"modelEditor.add":`添加模型`,"modelEditor.description":`能力与思考强度`,"modelEditor.id":`模型 ID`,"modelEditor.capabilities":`模型能力`,"modelEditor.chat":`对话`,"modelEditor.image":`图像生成`,"modelEditor.video":`视频生成`,"modelEditor.capabilitiesHint":`可单选或多选。仅选图像生成时,复用此连接的密钥,不会出现在对话模型中。`,"modelEditor.chatCapabilities":`对话能力`,"modelEditor.vision":`图片理解`,"modelEditor.reasoning":`深度思考`,"modelEditor.contextWindow":`上下文窗口(Token)`,"modelEditor.maxTokens":`最大输出(Token)`,"modelEditor.editNamed":`编辑模型 {name}`,"modelEditor.optionsNamed":`模型能力:{name}`,"modelEditor.delete":`删除模型`,"modelEditor.deleteNamed":`删除模型 {name}`,"modelEditor.deleteConfirmation":`删除“{name}”?供应商连接和密钥会保留。若它是默认模型,将选用其他可用模型,没有可用模型时清空默认值;已有会话的模型不会自动替换。之后可以重新添加此模型。`,"modelEditor.deleted":`模型已删除`}),o.addResourceBundle(`en-US`,`providers`,{"modelEditor.edit":`Edit model`,"modelEditor.add":`Add model`,"modelEditor.description":`Capabilities and reasoning levels`,"modelEditor.id":`Model ID`,"modelEditor.capabilities":`Model capabilities`,"modelEditor.chat":`Chat`,"modelEditor.image":`Image generation`,"modelEditor.video":`Video generation`,"modelEditor.capabilitiesHint":`Choose one or more. Image-only models reuse this connection’s key and stay out of the chat model picker.`,"modelEditor.chatCapabilities":`Chat capabilities`,"modelEditor.vision":`Image understanding`,"modelEditor.reasoning":`Reasoning`,"modelEditor.contextWindow":`Context window (tokens)`,"modelEditor.maxTokens":`Maximum output (tokens)`,"modelEditor.editNamed":`Edit model {name}`,"modelEditor.optionsNamed":`Model capabilities: {name}`,"modelEditor.delete":`Delete model`,"modelEditor.deleteNamed":`Delete model {name}`,"modelEditor.deleteConfirmation":`Delete “{name}”? The provider connection and credentials will remain. If this is the default model, another available model will be selected, or the default will be cleared if none is available. Existing conversations will keep their model bindings. You can add this model again later.`,"modelEditor.deleted":`Model deleted`});function pi(e){let t=(0,q.useContext)(on);return(0,q.useLayoutEffect)(()=>{t?.update(e)}),(0,q.useLayoutEffect)(()=>()=>t?.remove(e.id),[t,e.id]),{requestClose:(0,q.useCallback)(n=>{t?t.requestClose(e.id,n):n()},[t,e.id])}}var mi=[[`openai-responses`,`OpenAI Responses`],[`openai-completions`,`OpenAI Chat Completions`],[`anthropic-messages`,`Anthropic Messages`],[`google-generative-ai`,`Google Generative AI`]],hi={"openai-codex-responses":`OpenAI Codex Responses`,"azure-openai-responses":`Azure OpenAI Responses`,"mistral-conversations":`Mistral Conversations`,"bedrock-converse-stream":`Amazon Bedrock Converse`,"google-vertex":`Google Vertex AI`,"pi-messages":`Pi Messages`};function gi(e){return!e||mi.some(([t])=>t===e)?mi:[...mi,[e,hi[e]||e]]}var _i={openai:w,"openai-codex":w,anthropic:T,google:ye,deepseek:j,xai:le,openrouter:ce,"kimi-coding":ye,"zai-coding-cn":T},vi={saveFallbackModels(e){return f(`/api/config/fallback-models`,{method:`PUT`,body:JSON.stringify({models:e})})},saveAuxiliaryModel(e){return f(`/api/config/auxiliary-model`,{method:`PUT`,body:JSON.stringify({model:e})})},deleteModel(e,t){return f(`/api/providers/`+encodeURIComponent(e)+`/models`,{method:`DELETE`,body:JSON.stringify({modelId:t})})},saveModel(e,t,n=!1){return f(`/api/providers/`+encodeURIComponent(e)+`/models`+(n?``:`/options`),{method:n?`POST`:`PUT`,body:JSON.stringify(n?{...t,id:t.modelId,kind:t.capabilities[0]}:t)})},saveConnection(e,t){return f(`/api/providers/`+encodeURIComponent(e)+`/connection`,{method:`PUT`,body:JSON.stringify(t)})},importLocal(){return f(`/api/providers/import-local`,{method:`POST`,body:`{}`})}};function yi(e,t){return t.name!==e.name||t.api!==e.api||t.baseUrl!==(e.baseUrl||``)||!!t.apiKey}function bi({provider:e,onSave:t,draft:n,onDraftChange:r,onSavingChange:i,children:a}){let{t:o}=l(),[s,c]=(0,q.useState)(!1),[u,d]=(0,q.useState)(``),f=(0,q.useId)(),p=yi(e,n),m=async a=>{if(a.preventDefault(),!s){c(!0),i(!0),d(``);try{t(await vi.saveConnection(e.id,{...n,apiKey:n.apiKey.trim()||void 0})),r(void 0)}catch(e){d(e instanceof Error?e.message:String(e))}finally{c(!1),i(!1)}}};return(0,J.jsxs)(`form`,{onSubmit:e=>void m(e),"data-provider-connection-editor":!0,children:[(0,J.jsxs)(`fieldset`,{disabled:s,className:`min-w-0 divide-y divide-stroke-soft`,children:[(0,J.jsx)(Sr,{label:o(`config:configPage.displayName`),htmlFor:`${f}-name`,children:(0,J.jsx)(B,{id:`${f}-name`,required:!0,value:n.name,onChange:e=>r({...n,name:e.target.value})})}),(0,J.jsx)(Sr,{label:o(`config:configPage.apiKey`),htmlFor:`${f}-key`,children:(0,J.jsx)(B,{id:`${f}-key`,type:`password`,autoComplete:`new-password`,className:`font-mono placeholder:font-sans`,value:n.apiKey,placeholder:e.configured?o(`config:configPage.leaveBlankToKeepExistingKey`):o(`config:configPage.enterTheProviderAPIKey`),onChange:e=>r({...n,apiKey:e.target.value})})}),(0,J.jsx)(Sr,{label:o(`config:configPage.apiProtocol`),labelId:`${f}-api-label`,help:(0,J.jsx)(`span`,{className:`font-mono`,children:n.api}),children:(0,J.jsx)(K,{"aria-labelledby":`${f}-api-label`,value:n.api,onChange:e=>r({...n,api:e.target.value}),children:gi(n.api).map(([e,t])=>(0,J.jsx)(`option`,{value:e,children:t},e))})}),(0,J.jsx)(Sr,{label:`Base URL`,htmlFor:`${f}-url`,children:(0,J.jsx)(B,{id:`${f}-url`,required:!0,type:`url`,className:`font-mono`,value:n.baseUrl,onChange:e=>r({...n,baseUrl:e.target.value})})})]}),u&&(0,J.jsx)(W,{className:`mt-2 mb-3`,children:u}),a,(0,J.jsxs)(`div`,{className:L(`flex flex-wrap items-center justify-end gap-2 border-t border-stroke-soft py-3`,p&&`sticky bottom-0 z-[1] bg-background`),children:[p&&(0,J.jsx)(`span`,{role:`status`,className:`mr-auto text-xs text-content-muted`,children:o(`config:configPage.unsavedChanges`)}),(0,J.jsx)(z,{type:`submit`,className:`max-[650px]:h-11`,disabled:!p,loading:s,children:o(s?`config:configPage.saving`:`config:configPage.saveChanges`)})]})]})}var xi=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`];function Si({label:e,checked:t,disabled:n,onChange:r}){return(0,J.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":t,disabled:n,onClick:r,className:L(`inline-flex h-8 items-center gap-2 rounded-sm border px-2.5 text-sm transition-colors disabled:opacity-50 pointer-coarse:h-11`,t?`border-star-border bg-star-soft text-star-strong`:`border-stroke text-content-secondary hover:bg-surface-hover hover:text-content`),children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:L(`grid size-3.5 place-items-center rounded-[3px] border border-control`,t&&`border-star bg-star text-on-accent`),children:t&&(0,J.jsx)(E,{size:11})}),e]})}function Ci({provider:e,model:t,onSave:n,onClose:r}){let{t:i}=l(),[a]=(0,q.useState)(()=>t?.contextWindow||2e5),[o,s]=(0,q.useState)(()=>({modelId:t?.id||``,name:t?.name||``,capabilities:t?.capabilities||[t?.kind===`image`?`image`:t?.kind===`video`?`video`:`chat`],input:t?.input||[`text`],reasoning:t?.reasoning??!0})),[c,u]=(0,q.useState)(()=>({contextWindow:String(a),maxTokens:String(t?.maxTokens||8192)})),[d,f]=(0,q.useState)(t?.thinkingLevels||[`off`,`low`,`medium`,`high`]),[p,m]=(0,q.useState)(!1),[h,g]=(0,q.useState)(!1),[_,v]=(0,q.useState)(``),y=o.capabilities.includes(`chat`),b=async i=>{if(i.preventDefault(),!h){g(!0),v(``);try{n(await vi.saveModel(e.id,{...o,modelId:o.modelId.trim(),thinkingLevels:p?d:void 0,contextWindow:Number(c.contextWindow)===a?void 0:Number(c.contextWindow),maxTokens:Number(c.maxTokens)},!t)),r()}catch(e){v(e instanceof Error?e.message:String(e))}finally{g(!1)}}};return(0,J.jsx)(Et,{open:!0,onOpenChange:e=>{!e&&!h&&r()},children:(0,J.jsxs)(St,{className:`sm:max-w-[540px] p-5`,showCloseButton:!h,onEscapeKeyDown:e=>{h&&e.preventDefault()},onInteractOutside:e=>e.preventDefault(),children:[(0,J.jsxs)(Tt,{children:[(0,J.jsx)(Ct,{children:i(t?`providers:modelEditor.edit`:`providers:modelEditor.add`)}),(0,J.jsxs)(xt,{children:[e.name,` · `,i(`providers:modelEditor.description`)]})]}),(0,J.jsxs)(`form`,{onSubmit:e=>void b(e),className:`space-y-5`,children:[(0,J.jsxs)(`fieldset`,{disabled:h,className:`space-y-5`,children:[(0,J.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[i(`providers:modelEditor.id`),(0,J.jsx)(B,{required:!0,disabled:!!t,value:o.modelId,onChange:e=>s({...o,modelId:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[i(`config:configPage.modelName`),(0,J.jsx)(B,{value:o.name,onChange:e=>s({...o,name:e.target.value})})]})]}),(0,J.jsxs)(`fieldset`,{className:`space-y-2`,children:[(0,J.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:i(`providers:modelEditor.capabilities`)}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[`chat`,`image`,`video`].map(e=>(0,J.jsx)(Si,{label:i(e===`chat`?`providers:modelEditor.chat`:e===`image`?`providers:modelEditor.image`:`providers:modelEditor.video`),checked:o.capabilities.includes(e),onChange:()=>s({...o,capabilities:o.capabilities.includes(e)?o.capabilities.filter(t=>t!==e):[...o.capabilities,e]})},e))}),(0,J.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:i(`providers:modelEditor.capabilitiesHint`)})]}),y&&(0,J.jsxs)(`fieldset`,{className:`space-y-2`,children:[(0,J.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:i(`providers:modelEditor.chatCapabilities`)}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,J.jsx)(Si,{label:i(`providers:modelEditor.vision`),checked:o.input.includes(`image`),onChange:()=>s({...o,input:o.input.includes(`image`)?[`text`]:[`text`,`image`]})}),(0,J.jsx)(Si,{label:i(`providers:modelEditor.reasoning`),checked:o.reasoning,onChange:()=>s({...o,reasoning:!o.reasoning})})]})]}),y&&o.reasoning&&(0,J.jsxs)(`fieldset`,{children:[(0,J.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:i(`config:configPage.modelThinkingLevels`)}),!t&&!p&&(0,J.jsx)(`p`,{className:`mb-2 text-xs text-content-muted`,children:i(`config:configPage.modelThinkingLevelsAutoHint`)}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:xi.map(e=>(0,J.jsx)(Si,{label:e,checked:e===`off`||d.includes(e),disabled:e===`off`,onChange:()=>{m(!0),f(d.includes(e)?d.filter(t=>t!==e):[...d,e])}},e))})]}),y&&(0,J.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[`contextWindow`,`maxTokens`].map(e=>(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[i(e===`contextWindow`?`providers:modelEditor.contextWindow`:`providers:modelEditor.maxTokens`),(0,J.jsx)(B,{required:!0,type:`number`,min:1,max:1e8,step:1,value:c[e],onChange:t=>u({...c,[e]:t.target.value})})]},e))})]}),_&&(0,J.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:_}),(0,J.jsxs)(wt,{children:[(0,J.jsx)(z,{type:`button`,variant:`ghost`,disabled:h,onClick:r,children:i(`config:configPage.cancel`)}),(0,J.jsxs)(z,{type:`submit`,disabled:h||!o.capabilities.length||!o.modelId.trim(),children:[h&&(0,J.jsx)(F,{className:`animate-spin`,size:14}),` `,i(h?`config:configPage.saving`:`config:configPage.saveChanges`)]})]})]})]})})}function wi(e,t){let n=e.providers.filter(e=>e.configured||e.custom),r=e.defaultProvider||e.provider;return{providers:n,selected:n.find(e=>e.id===t)??n.find(e=>e.id===r)??n[0],defaultId:r}}function Ti(e){let t=e.trim().split(/[\s_\-/.]+/).filter(Boolean);if(t.length>1)return(Array.from(t[0])[0]+Array.from(t[1])[0]).toUpperCase();let n=Array.from(t[0]||`?`);return n[0].toUpperCase()+(n[1]||``)}function Ei(e){return e?e>=1e6?`${Number((e/1e6).toFixed(2))}M`:e>=1e3?`${Math.round(e/1e3)}K`:String(e):`—`}function Di(e){return gi(e).find(([t])=>t===e)?.[1]||e}var Oi=`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 @min-[560px]/card:grid-cols-[minmax(0,1.2fr)_minmax(0,1fr)_64px_76px_minmax(88px,auto)]`;function ki(e){let{t}=l(),n=(0,q.useId)(),{providers:r,defaultId:i}=wi(e.config,e.selectedProviderId),a=r.find(t=>t.id===e.selectedProviderId),[o,s]=(0,q.useState)({}),[c,u]=(0,q.useState)(!1),[d,f]=(0,q.useState)(null),p=!!(c||e.settingDefault||e.settingModel||e.toggling||e.deletingModel);pi({id:`provider-drafts-${n}`,dirty:r.some(e=>!!(o[e.id]&&yi(e,o[e.id]))),saving:p,discard:()=>s({})});let m={chat:t(`providers:modelEditor.chat`),image:t(`providers:modelEditor.image`),video:t(`providers:modelEditor.video`),reasoning:t(`providers:modelEditor.reasoning`)},h=e=>{let t=e.capabilities||[e.kind];return[[`chat`,oe,t.includes(`chat`)],[`image`,ie,t.includes(`image`)],[`video`,I,t.includes(`video`)],[`reasoning`,T,!!e.reasoning&&t.includes(`chat`)]].filter(([,,e])=>e).map(([e,t])=>(0,J.jsxs)(`span`,{title:m[e],className:`inline-flex`,children:[(0,J.jsx)(t,{size:13,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`sr-only`,children:m[e]})]},e))},g=e=>e.configured?t(`config:providerWorkbench.keyConfigured`):e.id===`openai-codex`?t(`config:configPage.codexCLILoginRequired`):t(`config:configPage.apiKeyRequired`),_=e=>e.configured?e.enabled?(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,J.jsx)(E,{className:`size-3.5`,"aria-hidden":`true`}),t(`config:providerWorkbench.connected`)]}):t(`config:configPage.disabled2`):t(`config:providerWorkbench.notConnected`),v=n=>(0,J.jsxs)(`div`,{className:`@container/card min-w-0`,"data-provider-detail":n.id,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 border-t border-stroke-soft py-2`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-content-muted`,children:n.id}),(0,J.jsxs)(`span`,{className:`flex items-center gap-2 text-sm text-content-secondary`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,children:t(`config:configPage.enabled`)}),(0,J.jsx)(br,{value:n.configured&&n.enabled,disabled:!n.configured||p,onChange:()=>void e.onToggle(n,!n.enabled),ariaLabel:t(`config:configPage.providerEnabled`,{name:n.name})})]}),(0,J.jsxs)(Ge,{children:[(0,J.jsx)(Ue,{asChild:!0,children:(0,J.jsx)(z,{variant:`ghost`,size:`icon-sm`,className:`pointer-coarse:size-11 max-[650px]:size-11`,"aria-label":t(`config:providerWorkbench.actions`),children:(0,J.jsx)(N,{size:16})})}),(0,J.jsxs)(We,{align:`end`,children:[(0,J.jsxs)(Ve,{disabled:n.id===i||!n.configured||!n.enabled||!n.defaultModel||p,onSelect:()=>void e.onSetDefault(n),children:[(0,J.jsx)(Nn,{size:14}),t(`config:configPage.setAsDefaultProvider`)]}),(0,J.jsxs)(Ve,{disabled:p,onSelect:()=>e.onClone(n),children:[(0,J.jsx)(M,{size:14}),t(`config:configPage.cloneProvider`)]}),n.custom&&(0,J.jsxs)(Ve,{className:`text-destructive`,disabled:p,onSelect:()=>void e.onDelete(n),children:[(0,J.jsx)(xe,{size:14}),t(`config:configPage.deleteProvider`)]})]})]})]}),(0,J.jsxs)(bi,{provider:n,draft:o[n.id]??{name:n.name,api:n.api,baseUrl:n.baseUrl||``,apiKey:``},onDraftChange:e=>s(t=>({...t,[n.id]:e})),onSavingChange:u,onSave:e.onSave,children:[(0,J.jsxs)(`div`,{className:`mt-2 flex min-h-10 items-center gap-2 border-t border-stroke-soft pt-2`,children:[(0,J.jsxs)(`h3`,{className:`text-[13px] font-medium text-content-muted`,children:[t(`config:providerWorkbench.models`),(0,J.jsxs)(`span`,{className:`tabular-nums`,children:[` · `,n.models.length]})]}),(0,J.jsxs)(z,{type:`button`,variant:`secondary`,size:`sm`,className:`ml-auto pointer-coarse:h-11 max-[650px]:h-11`,disabled:p,onClick:()=>f({provider:n}),children:[(0,J.jsx)(de,{size:14}),t(`providers:modelEditor.add`)]})]}),n.models.length>0&&(0,J.jsxs)(`div`,{className:L(Oi,`hidden h-8 text-xs font-medium text-content-muted @min-[560px]/card:grid`),children:[(0,J.jsx)(`span`,{children:t(`providers:modelEditor.id`)}),(0,J.jsx)(`span`,{children:t(`config:configPage.displayName`)}),(0,J.jsx)(`span`,{className:`text-right`,children:t(`config:providerWorkbench.contextColumn`)}),(0,J.jsx)(`span`,{children:t(`providers:modelEditor.capabilities`)}),(0,J.jsx)(`span`,{"aria-hidden":`true`})]}),n.models.map(r=>{let i=n.defaultModel===r.id;return(0,J.jsxs)(`div`,{"data-provider-model":r.id,className:L(Oi,`min-h-11.5 border-t border-stroke-soft py-px text-sm text-content-secondary`),children:[(0,J.jsxs)(`button`,{type:`button`,onClick:()=>f({provider:n,model:r}),disabled:p,className:`flex min-h-11 min-w-0 flex-col justify-center rounded-xs py-1 text-left`,"aria-label":t(`providers:modelEditor.editNamed`,{name:r.name||r.id}),children:[(0,J.jsx)(`span`,{className:`block truncate font-mono text-[12.5px] text-content`,children:r.id}),(0,J.jsxs)(`span`,{className:`mt-0.5 flex min-w-0 items-center gap-2 text-xs text-content-muted @min-[560px]/card:hidden`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:r.name||r.id}),(0,J.jsx)(`span`,{className:`tabular-nums`,children:Ei(r.contextWindow)}),h(r)]})]}),(0,J.jsx)(`span`,{className:`hidden min-w-0 truncate text-content @min-[560px]/card:block`,children:r.name||r.id}),(0,J.jsx)(`span`,{className:`hidden text-right tabular-nums @min-[560px]/card:block`,children:Ei(r.contextWindow)}),(0,J.jsx)(`span`,{className:`hidden items-center gap-2 text-content-muted @min-[560px]/card:flex`,children:h(r)}),(0,J.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5`,children:[r.kind===`chat`&&(0,J.jsx)(z,{type:`button`,variant:`ghost`,size:`icon-sm`,className:L(`pointer-coarse:size-11 max-[650px]:size-11`,i&&`text-star disabled:opacity-100 aria-disabled:opacity-100`),"aria-label":t(`config:configPage.providerDefaultModel`)+`: `+r.id,title:t(`config:configPage.providerDefaultModel`),"aria-pressed":i,disabled:p||!n.configured||i,onClick:()=>void e.onSetDefaultModel(n,r.id),children:(0,J.jsx)(Nn,{size:15,className:L(i&&`fill-current`)})}),(0,J.jsx)(z,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`pointer-coarse:size-11 max-[650px]:size-11`,"aria-label":t(`providers:modelEditor.optionsNamed`,{name:r.id}),disabled:p,onClick:()=>f({provider:n,model:r}),children:(0,J.jsx)(ve,{size:14})}),(0,J.jsx)(z,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`hover:bg-danger-soft hover:text-danger pointer-coarse:size-11 max-[650px]:size-11`,disabled:p,"aria-label":t(`providers:modelEditor.deleteNamed`,{name:r.name||r.id}),title:t(`providers:modelEditor.delete`),onClick:()=>void e.onDeleteModel(n,r),children:(0,J.jsx)(xe,{size:14})})]})]},r.id)})]},n.id)]});return(0,J.jsxs)(U,{"data-config-card":`models-connections`,"data-model-provider-list":!0,title:t(`config:providerWorkbench.providers`),count:r.length,meta:e.meta,children:[r.length>0?(0,J.jsx)(H,{children:r.map(n=>{let r=n.id===i,o=a?.id===n.id;return(0,J.jsx)(V,{"data-provider-row":n.id,icon:(0,J.jsx)(`span`,{className:`text-[13px] font-semibold text-content-secondary`,children:Ti(n.name)}),name:n.name,description:[...n.configured?[]:[g(n)],t(`config:configPage.countModels`,{count:n.models.length}),Di(n.api)].join(` · `),status:(0,J.jsxs)(J.Fragment,{children:[r&&(0,J.jsx)(Lt,{variant:`outline`,"data-provider-default":!0,className:`mr-2`,children:t(`config:providerWorkbench.default`)}),_(n)]}),expanded:o,onExpandedChange:t=>e.onSelectProvider(t?n.id:``),toggleLabel:t(`config:providerWorkbench.toggleProvider`,{name:n.name}),detail:o?v(n):null},n.id)})}):(0,J.jsxs)(`div`,{className:`grid min-h-48 place-content-center justify-items-center gap-2 border-y border-stroke px-6 py-8 text-center`,children:[(0,J.jsx)(At,{size:40,className:`mb-1`}),(0,J.jsx)(`p`,{className:`text-sm font-medium text-content`,children:t(`config:providerWorkbench.noConnections`)}),(0,J.jsx)(`p`,{className:`max-w-sm text-xs text-content-muted`,children:t(`config:providerWorkbench.addConnectionHint`)})]}),e.onAddConnection&&(0,J.jsxs)(`button`,{type:`button`,"data-add-provider":!0,disabled:p,onClick:e.onAddConnection,className:`flex min-h-[52px] w-full min-w-0 items-center gap-2.5 text-left text-sm text-content-secondary transition-colors duration-(--d-fast) hover:text-content focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus disabled:opacity-50`,children:[(0,J.jsx)(de,{size:16,"aria-hidden":`true`,className:`flex-none text-content-muted`}),(0,J.jsx)(`span`,{className:`flex-none`,children:t(`config:providerWorkbench.addProvider`)}),(0,J.jsx)(`span`,{className:`min-w-0 truncate text-xs text-content-muted`,children:t(`config:providerWorkbench.addProviderHint`)})]}),d&&(0,J.jsx)(Ci,{provider:d.provider,model:d.model,onSave:e.onSave,onClose:()=>f(null)})]})}function Ai(){let e=globalThis.crypto.getRandomValues(new Uint32Array(4));return`custom-${Array.from(e,e=>e.toString(16).padStart(8,`0`)).join(``)}`}function ji({value:e,onChange:t,configured:n=!1,cloning:r=!1}){let{t:i}=l();return(0,J.jsxs)(G,{variant:`control`,children:[i(`config:configPage.apiKey`),(0,J.jsx)(B,{type:`password`,autoComplete:`new-password`,value:e,onChange:e=>t(e.target.value),placeholder:i(r?`config:configPage.leaveBlankToCopySourceKey`:n?`config:configPage.leaveBlankToKeepExistingKey`:`config:configPage.enterTheProviderAPIKey`)})]})}function Mi({ids:e,onChange:t,placeholder:n,primaryId:r=``}){let{t:i}=l(),[a,o]=(0,q.useState)(``),s=()=>{let n=a.trim();!n||n===r.trim()||e.includes(n)||(t([...e,n]),o(``))};return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(G,{variant:`control`,children:[i(`config:configPage.manualModelIds`),(0,J.jsxs)(`div`,{className:`flex items-stretch gap-1.5`,children:[(0,J.jsx)(B,{"aria-label":i(`config:configPage.manualModelIds`),value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),s())},placeholder:n}),(0,J.jsx)(z,{type:`button`,size:`icon`,variant:`secondary`,className:`h-auto w-8.5 flex-none pointer-coarse:w-11`,"aria-label":i(`config:configPage.manualModelIds`),disabled:!a.trim(),onClick:s,children:(0,J.jsx)(de,{size:14})})]})]}),e.length>0&&(0,J.jsx)(`div`,{className:`flex flex-col overflow-hidden rounded-md border border-stroke`,children:e.map(n=>(0,J.jsxs)(`div`,{className:`flex min-h-9 min-w-0 items-center gap-2 border-b border-stroke-soft py-1 pr-1 pl-2.5 last:border-b-0`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[12.5px] text-content`,children:n}),(0,J.jsx)(`button`,{type:`button`,"aria-label":i(`config:configPage.delete`),className:`grid size-7 flex-none cursor-pointer place-items-center rounded-sm border-0 bg-transparent p-0 text-content-muted hover:bg-danger-soft hover:text-danger pointer-coarse:size-11`,onClick:()=>t(e.filter(e=>e!==n)),children:(0,J.jsx)(we,{size:12})})]},n))}),(0,J.jsx)(`p`,{className:`text-xs text-content-muted`,children:i(`config:configPage.manualModelIdsHint`)})]})}function Ni(e,t){return e?.models.find(t=>t.id===e.defaultModel)||(t===`visual`?e?.models.find(e=>e.kind===`image`||e.kind===`video`):e?.models.find(e=>e.kind===`chat`)||e?.models[0])}function Pi({onClose:e,onCreated:t,onConfigChanged:n,initialProviderType:r=`chat`,initialProvider:i,cloneProvider:a,embedded:o=!1}){let{t:s}=l(),c=i||a,u=!!a,d=c?.type||r,p=Ni(c,d),[m,h]=(0,q.useState)(``),g=!!(i||m),[_,v]=(0,q.useState)(()=>({name:a?s(`config:configPage.clonedProviderName`,{name:a.name}):i?.name||``,id:a?Ai():i?.id||``,providerType:d,api:i?.api||`openai-responses`,baseUrl:i?.baseUrl||``,model:p?.id||``,modelName:p?.name||``,modelKind:p?.kind===`image`||p?.kind===`video`?p.kind:d===`visual`?`image`:`chat`,reasoning:p?.reasoning!==!1,thinkingLevels:p?.thinkingLevels||[],enabled:i?.enabled??!0})),y=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`],[b,x]=(0,q.useState)(!1),S=e=>{x(!0),v(t=>({...t,thinkingLevels:t.thinkingLevels.includes(e)?t.thinkingLevels.filter(t=>t!==e):[...t.thinkingLevels,e]}))},[C,w]=(0,q.useState)(!1),[T,D]=(0,q.useState)(``),[O,k]=(0,q.useState)(``),A=O.trim()||void 0,[j,M]=(0,q.useState)([]),ee=e=>v(t=>({...t,name:e,id:t.id||e.toLowerCase().replace(/[^a-z0-9._-]+/g,`-`).replace(/^-+|-+$/g,``)}));return(0,q.useEffect)(()=>{if(o||C)return;let t=t=>{t.key===`Escape`&&(t.preventDefault(),t.stopPropagation(),e())};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[o,e,C]),(0,J.jsx)(`div`,{className:o?`provider-config-inline`:`modal-backdrop max-[650px]:p-[8px] fixed z-[70] inset-0 grid place-items-center overflow-y-auto bg-[var(--modal-overlay)] [padding:20px] [overscroll-behavior:contain] [animation:fade-in_var(--d1)_var(--ease-out)]`,onMouseDown:t=>!o&&!C&&t.target===t.currentTarget&&e(),children:(0,J.jsxs)(`form`,{role:o?void 0:`dialog`,"aria-modal":!o||void 0,className:o?`provider-config-form grid gap-3 text-sm [&_label]:!mt-0 [&_label]:!text-sm [&_label]:font-medium [&_input]:!h-9 [&_input]:!min-h-9 [&_input]:rounded-lg [&_input]:!text-sm [&_select]:!h-9 [&_select]:!min-h-9 [&_select]:rounded-lg [&_select]:!text-sm [&_summary]:text-sm`:`modal provider-config-modal max-h-[calc(100dvh_-_40px)] !w-[min(620px,100%)] overflow-y-auto overscroll-contain rounded-lg border border-stroke bg-solid p-[18px] shadow-float [animation:modal-in_var(--d2)_var(--ease-out)] max-[650px]:max-h-[calc(100dvh_-_16px)]`,onSubmit:async e=>{if(e.preventDefault(),!C){if(!u&&!A&&!i?.configured&&!m){D(s(`config:configPage.enterTheAPIKeyForThisConnection`));return}w(!0),D(``);try{if(a){t(await f(`/api/providers/${encodeURIComponent(a.id)}/clone`,{method:`POST`,body:JSON.stringify({name:_.name,id:_.id,apiKey:A})}));return}let e=g?await f(`/api/config`,{method:`PUT`,body:JSON.stringify({..._,apiKey:A,thinkingLevels:b?_.thinkingLevels:void 0,provider:m||_.id,providerName:_.name,setAsDefault:!1})}):await f(`/api/providers`,{method:`POST`,body:JSON.stringify({..._,apiKey:A,thinkingLevels:b?_.thinkingLevels:void 0})}),r=e.createdProviderId||m||_.id;i||(h(r),v(e=>({...e,id:r})),n?.(e));let o=new Set((i?.models||[]).map(e=>e.id)),s=j.filter(e=>e!==_.model.trim()&&!o.has(e));if(s.length)try{e=await f(`/api/providers/${encodeURIComponent(r)}/models/batch`,{method:`POST`,body:JSON.stringify({models:s.map(e=>({id:e,kind:_.providerType===`visual`?_.modelKind:`chat`}))})})}catch(e){D(e instanceof Error?e.message:String(e));return}t(e)}catch(e){D(e instanceof Error?e.message:String(e))}finally{w(!1)}}},children:[!o&&(0,J.jsxs)(Vt,{children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{children:s(u?`config:configPage.cloneProvider`:g?`config:configPage.editProviderConnection`:`config:configPage.addProviderConnection`)}),!u&&(0,J.jsx)(`p`,{children:s(g?`config:configPage.updateProviderKeyURLAndModelSettings`:`config:configPage.youCanCreateMultipleConnectionsUsingTheSameProtocolEachWithItsOwnKeyAndBaseURL`)})]}),(0,J.jsx)(z,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":s(`config:configPage.closeDialog`),disabled:C,onClick:t=>{t.preventDefault(),t.stopPropagation(),e()},children:(0,J.jsx)(we,{size:17})})]}),(0,J.jsxs)(`div`,{className:`form-grid grid gap-3 sm:grid-cols-2`,children:[(0,J.jsxs)(G,{variant:`control`,children:[s(`config:configPage.displayName`),(0,J.jsx)(B,{value:_.name,onChange:e=>ee(e.target.value),placeholder:s(`config:configPage.forExampleOpenAIOfficial`)})]}),(0,J.jsxs)(G,{variant:`control`,children:[`Provider ID`,(0,J.jsx)(B,{value:_.id,disabled:g,onChange:e=>v({..._,id:e.target.value}),placeholder:`openai-official`})]})]}),(0,J.jsx)(ji,{value:O,onChange:k,configured:i?.configured,cloning:u}),!u&&(0,J.jsxs)(J.Fragment,{children:[!o&&(0,J.jsxs)(`div`,{className:`mt-2.5 flex items-center justify-between gap-2 rounded-sm border border-stroke-soft bg-surface-subtle px-2.5 py-2`,children:[(0,J.jsx)(`span`,{className:`text-xs text-content-muted`,children:s(`config:configPage.providerPurpose`)}),(0,J.jsx)(`strong`,{className:`font-mono text-xs font-medium`,children:_.providerType===`visual`?s(`config:configPage.visualProvider`):s(`config:configPage.chatProvider`)})]}),(0,J.jsxs)(G,{variant:`control`,children:[s(`config:configPage.apiProtocol`),(0,J.jsx)(K,{value:_.api,onChange:e=>v({..._,api:e.target.value}),children:mi.map(([e,t])=>(0,J.jsx)(`option`,{value:e,children:t},e))})]}),(0,J.jsxs)(G,{variant:`control`,children:[`Base URL`,(0,J.jsx)(B,{value:_.baseUrl,onChange:e=>v({..._,baseUrl:e.target.value}),placeholder:`https://api.openai.com/v1`})]}),(0,J.jsxs)(`div`,{className:`form-grid grid gap-3 sm:grid-cols-2`,children:[(0,J.jsxs)(G,{variant:`control`,children:[s(g?`config:configPage.providerDefaultModel`:`config:configPage.initialModelID`),(0,J.jsx)(B,{value:_.model,onChange:e=>v({..._,model:e.target.value}),placeholder:_.providerType===`visual`?`gpt-image-2 or grok-imagine-video`:`gpt-5.4 or gpt-image-1`})]}),(0,J.jsxs)(G,{variant:`control`,children:[s(`config:configPage.modelName`),(0,J.jsx)(B,{value:_.modelName,onChange:e=>v({..._,modelName:e.target.value}),placeholder:s(`config:configPage.leaveBlankToUseTheModelID`)})]})]}),(0,J.jsxs)(`details`,{open:!o||void 0,className:`group rounded-lg border border-border px-3 py-2 [&[open]]:space-y-3`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer text-[13px] text-muted-foreground`,children:s(`config:providerWorkbench.modelOptions`)}),(0,J.jsxs)(G,{variant:`control`,children:[s(`config:configPage.modelType`),(0,J.jsxs)(K,{value:_.modelKind,onChange:e=>v({..._,modelKind:e.target.value,providerType:e.target.value===`chat`?`chat`:`visual`}),children:[(0,J.jsx)(`option`,{value:`chat`,children:s(`providers:modelEditor.chat`)}),(0,J.jsx)(`option`,{value:`image`,children:s(`providers:modelEditor.image`)}),(0,J.jsx)(`option`,{value:`video`,children:s(`providers:modelEditor.video`)})]})]}),(0,J.jsx)(`div`,{className:`grid gap-[9px]`,children:(0,J.jsx)(Mi,{ids:j,onChange:M,primaryId:_.model,placeholder:_.providerType===`visual`?`gpt-image-1`:`gpt-5.5`})}),_.modelKind===`chat`&&(0,J.jsxs)(G,{variant:`control`,children:[s(`config:configPage.modelThinkingLevels`),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-[6px]`,children:y.map(e=>{let t=e===`off`,n=t||_.thinkingLevels.includes(e),r=t||!_.reasoning&&e!==`off`;return(0,J.jsxs)(`button`,{type:`button`,"aria-pressed":n,disabled:r,onClick:()=>!t&&S(e),className:L(`inline-flex h-[27px] cursor-pointer items-center gap-[4px] rounded-full border px-[10px] text-[12px] font-medium transition-colors`,n?`border-[var(--control-selected-border)] bg-[var(--control-selected-bg)] text-[var(--control-selected-text)]`:`border-[var(--stroke)] bg-[var(--surface-subtle)] text-[var(--text)] hover:bg-[var(--surface-highlight)]`,t?`cursor-default`:r&&`cursor-not-allowed opacity-40`),children:[n&&(0,J.jsx)(E,{size:12}),e]},e)})}),(0,J.jsx)(`small`,{className:`text-[var(--text-muted)]`,children:s(`config:configPage.modelThinkingLevelsHint`)})]})]}),!o&&(0,J.jsxs)(`div`,{className:`mt-2.5 flex min-h-11 items-center justify-between gap-3 rounded-sm border border-[var(--stroke-soft)] bg-[var(--surface-subtle)] px-2.5 py-2`,children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,J.jsx)(`strong`,{className:`text-[13px]`,children:g?s(`config:configPage.providerEnabled`,{name:_.name}):s(`config:configPage.enableAfterCreation`)}),_.providerType===`visual`&&(0,J.jsx)(`small`,{className:`text-[13px] text-muted-foreground`,children:s(`config:configPage.visualModelsAreSelectedByTheVisualGenerationToolAndDoNotAppearInTheChatModelList`)})]}),(0,J.jsx)(br,{value:_.enabled,onChange:e=>v({..._,enabled:e})})]})]}),T&&(0,J.jsxs)(zt,{children:[(0,J.jsx)(Se,{size:13}),T]}),(0,J.jsxs)(`div`,{className:`mt-[18px] flex justify-end gap-2`,children:[(0,J.jsx)(z,{type:`button`,variant:`secondary`,className:`max-[650px]:h-11`,disabled:C,onClick:e,children:s(`config:configPage.cancel`)}),(0,J.jsxs)(z,{type:`submit`,className:`max-[650px]:h-11`,disabled:C,children:[C?(0,J.jsx)(R,{className:`text-current`}):g?(0,J.jsx)(E,{size:14}):(0,J.jsx)(de,{size:14}),s(C?`config:configPage.saving`:u?`config:configPage.cloneProvider`:g?`config:configPage.saveChanges`:`config:configPage.createConnection`)]})]})]})})}function Fi(e){return(e.providers||[]).filter(e=>e.importable&&!e.imported&&!e.conflict).length}function Ii(e){return Fi(e)>0}function Li(e,t){return!t&&!Ii(e)}function Ri(e,t,n){let r=e.providers||[],i=e.errors||[],a=Ii(e),o=!!(n||i.length||r.some(e=>e.conflict||!e.imported&&!e.importable||e.warnings?.some(e=>e.code!==`login_auth_not_imported`)));return t||a||o}function zi(e){return e.source===`codex-config`?`Codex config.toml`:e.source===`claude-config`?`Claude settings.json`:e.source===`codex-auth`?`Codex login`:`Claude login`}function Bi(e,t){return e.authType===`environment`?t(`config:configPage.keyVariableName`,{name:e.authVariable}):e.authType===`bearer`||e.authType===`api_key`?t(`config:configPage.authenticationIncludedInConfiguration`):e.authType===`oauth`?t(`config:configPage.loginStateFileDetected`):e.authType===`external-login`?t(`config:configPage.authenticationRequired`):t(`config:configPage.noAuthenticationInConfiguration`)}function Vi(e,t){return t(e===`multiple_auth_values`?`config:configPage.multipleAuthenticationFieldsWereDetectedTheAuthorizationFieldTakesPrecedence`:e===`invalid_url`?`config:configPage.theProviderEndpointIsInvalid`:e===`unsupported_api`?`config:configPage.theAPIProtocolInThisConfigurationIsNotSupportedYet`:e===`invalid_env_name`?`config:configPage.theKeyEnvironmentVariableNameIsInvalid`:`config:configPage.someConfigurationFieldsCannotBeImported`)}function Hi({discovery:e,discovering:t,error:n,importing:r,forceVisible:i=!1,onRefresh:a,onImport:o}){let{t:s}=l(),[c,u]=(0,q.useState)(null),d=e.providers||[],f=e.errors||[];if(!i&&!Ri(e,t,n))return null;let p=c??(!i&&Li(e,t)),m=()=>(u(null),a()),h=e=>(u(null),o(e)),g=e=>[`invalid_json`,`invalid_toml`].includes(e.code)?s(`config:configPage.invalidConfigurationFileFormat`):e.code===`unsupported_config`?s(`config:configPage.noImportableProviderConfigurationWasFound`):e.code===`invalid_login_state`?s(`config:configPage.incompleteLoginState`):e.code===`file_too_large`?s(`config:configPage.configurationFileIsTooLarge`):s(`config:configPage.unableToReadTheConfigurationFile`);return(0,J.jsxs)(_r,{className:`mb-3 py-3.5`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2.5 max-[650px]:flex-wrap`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 cursor-pointer items-center gap-3 rounded-sm border-0 bg-transparent p-0 text-left max-[650px]:basis-full`,"aria-expanded":!p,onClick:()=>u(!p),children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-9.5 shrink-0 place-items-center rounded-lg border border-key-border bg-key text-content-muted shadow-key`,children:(0,J.jsx)(ge,{size:18})}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,J.jsx)(`span`,{className:`text-sm font-medium text-content`,children:s(`config:configPage.localProviderConfiguration`)}),(0,J.jsx)(`span`,{className:`text-xs leading-[1.45] text-content-muted`,children:s(`config:configPage.readProviderEndpointModelAndAuthenticationFieldsFromCodexConfigTomlAndClaudeSettingsJson`)})]}),(0,J.jsx)(D,{size:16,"aria-hidden":`true`,className:L(`flex-none text-content-muted transition-transform`,!p&&`rotate-180`)})]}),(0,J.jsxs)(z,{type:`button`,variant:`secondary`,className:`max-[650px]:h-11`,disabled:t||!!r,onClick:m,children:[t?(0,J.jsx)(R,{className:`text-current`}):(0,J.jsx)(fe,{size:13}),s(`config:configPage.rescan`)]})]}),!p&&(0,J.jsxs)(J.Fragment,{children:[t&&!d.length?(0,J.jsxs)(`div`,{role:`status`,className:`mt-3 flex min-h-12 items-center justify-center gap-2 rounded-sm bg-surface-subtle text-xs text-content-muted`,children:[(0,J.jsx)(R,{}),s(`config:configPage.scanningProviderConfigurationFiles`)]}):d.length?(0,J.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-2 max-[650px]:grid-cols-1`,children:d.map(e=>{let t=zi(e),n=r===e.id,i=e.source.startsWith(`claude-`)?T:w,a=e.kind===`authentication`?s(`config:configPage.officialProviderAuthenticationOnly`):e.models?.length?e.models.map(e=>e.id).join(`, `):s(`config:configPage.noModelSpecified`);return(0,J.jsxs)(`div`,{className:L(`grid min-h-17 min-w-0 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2.5 rounded-md border px-3 py-2 max-[650px]:grid-cols-[auto_minmax(0,1fr)]`,e.imported?`border-success-border bg-success-soft`:`border-stroke bg-panel`),children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-7.5 place-items-center rounded-md border border-key-border bg-key text-content-muted shadow-key`,children:(0,J.jsx)(i,{size:15})}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,J.jsxs)(`span`,{className:`truncate text-sm font-medium text-content`,children:[t,` · `,e.providerName]}),(0,J.jsxs)(`span`,{className:`truncate font-mono text-xs text-content-muted`,children:[e.api,` · `,a]}),(0,J.jsxs)(`span`,{className:`truncate text-xs text-content-muted`,children:[e.kind===`authentication`?s(`config:configPage.officialEndpointOnly`):e.baseUrl||s(`config:configPage.noBaseURLSpecified`),` `,`· `,Bi(e,s),` · `,e.location]})]}),(0,J.jsx)(`span`,{className:`flex min-w-0 flex-none items-center max-[650px]:col-start-2`,children:e.imported?(0,J.jsx)(yr,{tone:`green`,children:s(`config:configPage.loaded`)}):e.conflict?(0,J.jsx)(yr,{tone:`amber`,children:s(`config:configPage.conflictDetected`)}):e.importable?(0,J.jsxs)(z,{type:`button`,size:`sm`,className:`pointer-coarse:h-11`,disabled:n||!!r,onClick:()=>h(e),children:[n?(0,J.jsx)(R,{className:`size-3 text-current`}):(0,J.jsx)(ee,{size:12}),n?s(`config:configPage.loading`):e.kind===`authentication`?s(`config:configPage.loadLoginState`):s(`config:configPage.loadConfiguration`)]}):(0,J.jsx)(yr,{tone:`gray`,children:s(`config:configPage.cannotLoad`)})})]},e.id)})}):(0,J.jsxs)(`div`,{className:`mt-3 flex min-h-12 items-center justify-center gap-2 rounded-sm bg-surface-subtle px-3 text-center text-xs text-content-muted`,children:[(0,J.jsx)(ge,{size:15,"aria-hidden":`true`}),s(`config:configPage.noImportableCodexOrClaudeProviderConfigurationWasDetected`)]}),(n||f.length>0||d.some(e=>e.warnings?.some(e=>e.code!==`login_auth_not_imported`)))&&(0,J.jsxs)(`div`,{className:`mt-2 flex flex-col gap-1 text-xs text-danger [&_span]:flex [&_span]:items-center [&_span]:gap-1.5`,"aria-live":`polite`,children:[n&&(0,J.jsxs)(`span`,{children:[(0,J.jsx)(Se,{size:13}),n]}),f.map((e,t)=>(0,J.jsxs)(`span`,{children:[(0,J.jsx)(Se,{size:13}),zi(e),` · `,g(e)]},`${e.source}-${e.code}-${t}`)),d.flatMap(e=>(e.warnings||[]).filter(e=>e.code!==`login_auth_not_imported`).map((t,n)=>(0,J.jsxs)(`span`,{children:[(0,J.jsx)(Se,{size:13}),zi(e),` · `,Vi(t.code,s)]},`${e.id}-${t.code}-${n}`)))]})]})]})}function Ui(e){try{return{name:new URL(e).hostname.replace(/^www\./i,``)||`Custom Provider`}}catch{return{name:`Custom Provider`}}}function Wi({config:e,providerType:t=`chat`,initialProviderId:n,onClose:r,onConfigChanged:i,onCompleted:a}){let{t:o}=l(),s=n&&e.providers.find(e=>e.id===n)||null,[c,u]=(0,q.useState)(1),[d,p]=(0,q.useState)(s),[m]=(0,q.useState)(Ai),[h,g]=(0,q.useState)(``),_=(0,q.useRef)(null),v=(0,q.useRef)(null),[y,S]=(0,q.useState)(s?.baseUrl||``),[C,w]=(0,q.useState)(s?.api||`openai-responses`),[T,D]=(0,q.useState)(``),O=T.trim()||void 0,[k,A]=(0,q.useState)(s?.organization||``),[j,M]=(0,q.useState)(s?.name||``),[ee,N]=(0,q.useState)(s?.models||[]),[P,te]=(0,q.useState)(s?.defaultModel||``),[ne,re]=(0,q.useState)([]),[ie,ae]=(0,q.useState)(s?.models.find(e=>e.id===s.defaultModel)?.kind||(t===`visual`?`image`:`chat`)),[F,oe]=(0,q.useState)(!1),[se,I]=(0,q.useState)(``),[ce,le]=(0,q.useState)(``),ue=Ui(y),de=o(t===`visual`?`config:configPage.visualProvider`:`config:configPage.chatProvider`),pe=o(c===1?`config:configPage.quickSetupStepBaseUrl`:c===2?`config:configPage.quickSetupStepProtocol`:`config:configPage.quickSetupStepModel`),me=ee.filter(e=>t===`visual`?e.kind===`image`||e.kind===`video`:e.kind===`chat`),he=()=>{let e=y.trim();try{let t=new URL(e);if(![`http:`,`https:`].includes(t.protocol))throw Error()}catch{I(o(`config:configPage.providerBaseURLMustBeHTTPOrHTTPS`));return}I(``),j.trim()||M(ue.name),u(2)},_e=()=>{if(!C){I(o(`config:configPage.selectAPIProtocol`));return}I(``),u(3)},ve=async()=>{if(F)return;let e=d;if(!O&&!e?.configured&&!h){I(o(`config:configPage.enterTheAPIKeyForThisConnection`));return}oe(!0),I(``),le(``);try{let n=((await f(`/api/providers/models/discover-connection`,{method:`POST`,body:JSON.stringify({providerId:e?.id||h,providerType:t,api:C,baseUrl:y,organization:k,apiKey:O})})).models||[]).filter(e=>t===`visual`?e.kind===`image`||e.kind===`video`:e.kind===`chat`);if(!n.length){I(o(t===`visual`?`config:configPage.fetchOrAddAVisualModel`:`config:configPage.fetchOrAddAChatModel`));return}N(n);let r=n.find(e=>e.id===P)||n[0];te(r.id),ae(t===`visual`?r.kind:`chat`)}catch(n){let r=n instanceof Error?n.message:String(n),i=e?.models.filter(e=>t===`visual`?e.kind===`image`||e.kind===`video`:e.kind===`chat`)||[];if(!/\(401\)|\(403\)|鉴权|认证|密钥|API Key/i.test(r)&&i.length){N(i);let e=i.find(e=>e.id===P)||i[0];te(e.id),ae(t===`visual`?e.kind:`chat`),le(r)}else I(r)}finally{oe(!1)}},ye=async()=>{if(F)return;let e=P.trim()||ne[0]||``;if(!e){I(o(`config:configPage.selectModelToFinish`));return}if(!O&&!d?.configured&&!h){I(o(`config:configPage.enterTheAPIKeyForThisConnection`));return}let n=new Set((d?.models||[]).map(e=>e.id)),r=ne.filter(t=>t!==e&&!n.has(t));oe(!0),I(``);try{let n=d?.id||h,o=n?await f(`/api/config`,{method:`PUT`,body:JSON.stringify({provider:n,providerType:t,api:C,baseUrl:y,organization:k,model:e,modelKind:t===`visual`?ie:`chat`,apiKey:O,setAsDefault:!1,enabled:!0})}):await f(`/api/providers`,{method:`POST`,body:JSON.stringify({id:m,name:j.trim()||ue.name,providerType:t,api:C,baseUrl:y,organization:k,apiKey:O,model:e,modelKind:t===`visual`?ie:`chat`,enabled:!0})}),c=n||o.createdProviderId||m,l=s?``:c;l&&g(l);let u=o.providers.find(e=>e.id===c);if(u&&p(u),i?.(l?{...o,createdProviderId:l}:o),r.length){let e=t===`visual`?ie:`chat`;try{o=await f(`/api/providers/${encodeURIComponent(c)}/models/batch`,{method:`POST`,body:JSON.stringify({models:r.map(t=>({id:t,kind:e}))})})}catch(e){I(e instanceof Error?e.message:String(e));return}}a(l?{...o,createdProviderId:l}:o)}catch(e){I(e instanceof Error?e.message:String(e))}finally{oe(!1)}};return(0,J.jsx)(Et,{open:!0,onOpenChange:e=>{!e&&!F&&r()},children:(0,J.jsxs)(St,{showCloseButton:!1,className:`modal z-[80] block max-h-[calc(100dvh_-_40px)] w-[calc(100%_-_40px)] max-w-lg overflow-y-auto overscroll-contain rounded-[var(--r-lg)] border border-stroke bg-solid p-[18px] shadow-float sm:max-w-lg max-[650px]:max-h-[calc(100dvh_-_16px)] max-[650px]:w-[calc(100%_-_16px)]`,overlayClassName:`z-[70] bg-[var(--modal-overlay)]`,"aria-busy":F,onEscapeKeyDown:e=>{F&&e.preventDefault()},onInteractOutside:e=>{F&&e.preventDefault()},onOpenAutoFocus:e=>{e.preventDefault(),_.current=document.activeElement instanceof HTMLElement?document.activeElement:null,v.current?.focus()},onCloseAutoFocus:e=>{e.preventDefault(),_.current?.focus()},children:[(0,J.jsxs)(Vt,{children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(Ct,{asChild:!0,children:(0,J.jsx)(`h2`,{children:o(t===`visual`?`config:configPage.visualQuickSetupTitle`:`config:configPage.quickSetupTitle`)})}),(0,J.jsx)(xt,{asChild:!0,children:(0,J.jsxs)(`p`,{children:[o(`config:configPage.stepIndicator`,{current:c,total:3}),` · `,pe]})})]}),(0,J.jsx)(z,{type:`button`,variant:`ghost`,size:`icon`,className:`pointer-coarse:size-11`,"aria-label":o(`config:configPage.closeDialog`),disabled:F,onClick:r,children:(0,J.jsx)(we,{size:17})})]}),(0,J.jsx)(`div`,{"aria-hidden":`true`,className:`mt-3 grid grid-cols-3 gap-1`,children:[1,2,3].map(e=>(0,J.jsx)(`span`,{className:L(`h-1 rounded-full`,e<=c?`bg-star`:`bg-surface-active`)},e))}),(0,J.jsxs)(`div`,{className:`mt-3 flex items-center gap-2.5 rounded-md border border-stroke-soft bg-surface-subtle px-2.5 py-2`,children:[(0,J.jsx)(`span`,{className:`grid size-7.5 flex-none place-items-center rounded-md border border-key-border bg-key text-content-muted shadow-key`,children:(0,J.jsx)(ge,{size:15,"aria-hidden":`true`})}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,J.jsx)(`span`,{className:`truncate text-sm font-medium text-content`,children:j||ue.name}),(0,J.jsx)(`small`,{className:`text-xs text-content-muted`,children:de})]}),(0,J.jsx)(yr,{tone:`gray`,children:de})]}),c===1&&(0,J.jsxs)(`div`,{className:`[margin-top:14px]`,children:[(0,J.jsxs)(G,{variant:`control`,children:[`Base URL`,(0,J.jsx)(B,{ref:v,value:y,onChange:e=>S(e.target.value),placeholder:`https://api.example.com/v1`,inputMode:`url`})]}),(0,J.jsx)(`p`,{className:`mt-2 text-xs leading-[1.5] text-content-muted`,children:o(`config:configPage.quickSetupBaseUrlHint`)})]}),c===2&&(0,J.jsxs)(`div`,{className:`[margin-top:14px]`,children:[(0,J.jsxs)(G,{variant:`control`,children:[o(`config:configPage.apiProtocol`),(0,J.jsx)(K,{value:C,onChange:e=>w(e.target.value),children:mi.map(([e,t])=>(0,J.jsx)(`option`,{value:e,children:t},e))})]}),(0,J.jsxs)(G,{variant:`control`,children:[`Organization`,(0,J.jsx)(B,{value:k,onChange:e=>A(e.target.value),placeholder:o(`config:configPage.optionalUsedOnlyForOpenAIOrganization`)})]})]}),c===3&&(0,J.jsxs)(`div`,{className:`[margin-top:14px]`,children:[!d&&(0,J.jsxs)(G,{variant:`control`,children:[o(`config:configPage.displayName`),(0,J.jsx)(B,{value:j,onChange:e=>M(e.target.value),placeholder:ue.name})]}),(0,J.jsx)(ji,{value:T,onChange:D,configured:d?.configured}),(0,J.jsxs)(z,{type:`button`,variant:`secondary`,className:`mt-2.5 w-full max-[650px]:h-11`,disabled:F,onClick:()=>void ve(),children:[F?(0,J.jsx)(R,{className:`text-current`}):(0,J.jsx)(fe,{size:14}),o(F?`config:configPage.fetchingModels`:`config:configPage.fetchModels`)]}),ce&&(0,J.jsxs)(Rt,{className:`[margin-top:10px]`,children:[(0,J.jsx)(Se,{size:15}),(0,J.jsx)(`small`,{children:o(`config:configPage.discoverFailedUsingExisting`,{message:ce})})]}),me.length>0&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`mt-3.5 mb-2 text-xs leading-[1.5] text-content-muted`,children:o(t===`visual`?`config:configPage.selectVisualModelToFinish`:`config:configPage.selectModelToFinish`)}),(0,J.jsx)(`div`,{className:`flex max-h-[260px] flex-col overflow-y-auto rounded-md border border-stroke`,children:me.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:L(`relative flex min-h-10 min-w-0 cursor-pointer items-center gap-2 border-b border-stroke-soft px-2.5 py-2 text-left last:border-b-0 hover:bg-surface-subtle pointer-coarse:min-h-11`,P===e.id&&`bg-star-soft before:absolute before:inset-y-2 before:left-0 before:w-[3px] before:rounded-r-[3px] before:bg-star hover:bg-star-soft`),onClick:()=>{te(e.id),ae(t===`visual`?e.kind:`chat`)},children:[(0,J.jsx)(`span`,{className:L(`grid size-4 flex-none place-items-center rounded-full border border-control text-transparent`,P===e.id&&`border-star bg-star text-on-accent`),children:(0,J.jsx)(E,{size:11})}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-content`,children:e.name}),t===`visual`&&(0,J.jsx)(yr,{tone:`gray`,children:e.kind===`video`?o(`config:configPage.visualVideoModel`):o(`config:configPage.visualImageModel`)})]},`${e.id}-${e.kind}`))})]}),(0,J.jsxs)(`div`,{className:`mt-3.5 grid gap-2`,children:[(0,J.jsxs)(G,{variant:`control`,children:[o(`config:configPage.manualModelId`),(0,J.jsx)(B,{value:P,onChange:e=>te(e.target.value),placeholder:t===`visual`?`gpt-image-1`:`gpt-5.4`})]}),(0,J.jsx)(`p`,{className:`text-xs text-content-muted`,children:o(`config:configPage.manualModelIdHint`)}),t===`visual`&&(0,J.jsxs)(G,{variant:`control`,children:[o(`config:configPage.modelType`),(0,J.jsxs)(K,{value:ie,onChange:e=>ae(e.target.value),children:[(0,J.jsx)(`option`,{value:`image`,children:o(`config:configPage.imageGenerationAndEditing`)}),(0,J.jsx)(`option`,{value:`video`,children:o(`config:configPage.videoGeneration`)})]})]}),(0,J.jsx)(Mi,{ids:ne,onChange:re,primaryId:P,placeholder:t===`visual`?`gpt-image-1`:`gpt-5.5`})]})]}),se&&(0,J.jsxs)(zt,{children:[(0,J.jsx)(Se,{size:13}),se]}),(0,J.jsxs)(`div`,{className:`mt-[18px] flex justify-between gap-2`,children:[(0,J.jsxs)(z,{type:`button`,variant:`secondary`,className:`max-[650px]:h-11`,disabled:F||c===1,onClick:()=>{I(``),u(c-1)},children:[(0,J.jsx)(b,{size:14}),o(`config:configPage.previousStep`)]}),c===1?(0,J.jsxs)(z,{type:`button`,className:`max-[650px]:h-11`,disabled:F||!y.trim(),onClick:he,children:[(0,J.jsx)(x,{size:14}),o(`config:configPage.nextStep`)]}):c===2?(0,J.jsxs)(z,{type:`button`,className:`max-[650px]:h-11`,disabled:F,onClick:_e,children:[(0,J.jsx)(x,{size:14}),o(`config:configPage.nextStep`)]}):(0,J.jsxs)(z,{type:`button`,className:`max-[650px]:h-11`,disabled:F||!P.trim()&&ne.length===0,onClick:()=>void ye(),children:[F?(0,J.jsx)(R,{className:`text-current`}):(0,J.jsx)(E,{size:14}),o(F?`config:configPage.saving`:`config:configPage.saveChanges`)]})]})]})})}var Gi=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`],Ki=``;function qi(e){return`${e.provider.id}/${e.model.id}`}function Ji({labelId:e,label:t,hint:n,children:r}){return(0,J.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_minmax(0,280px)] items-center gap-x-6 gap-y-0.5 border-b border-stroke py-4 max-[650px]:grid-cols-[auto_minmax(0,1fr)] max-[650px]:gap-x-3 max-[650px]:gap-y-1 max-[650px]:py-3`,children:[(0,J.jsx)(`div`,{id:e,className:`self-end text-sm font-medium text-content max-[650px]:self-center`,children:t}),(0,J.jsx)(`div`,{className:`row-span-2 min-w-0 max-[650px]:row-span-1`,children:r}),(0,J.jsx)(`p`,{id:`${e}-hint`,className:`col-start-1 self-start text-xs text-content-muted max-[650px]:col-span-2`,children:n})]})}function Yi({config:e,notify:t,busy:n,onConfigChanged:r,onSetDefaultModel:i}){let{t:a}=l(),o=(0,q.useId)(),s={off:a(`chat:focusSession.thinkingLabel.off`),minimal:a(`chat:focusSession.thinkingLabel.minimal`),low:a(`chat:focusSession.thinkingLabel.low`),medium:a(`chat:focusSession.thinkingLabel.medium`),high:a(`chat:focusSession.thinkingLabel.high`),xhigh:a(`chat:focusSession.thinkingLabel.xhigh`),max:a(`chat:focusSession.thinkingLabel.max`)},[c,u]=(0,q.useState)(!1),[d,p]=(0,q.useState)(``),[m,h]=(0,q.useState)(e.thinkingLevel),[g,_]=(0,q.useState)(e.toolMode);(0,q.useEffect)(()=>{h(e.thinkingLevel),_(e.toolMode)},[e.thinkingLevel,e.toolMode]);let v=(e.fallbackModels||[]).join(`
2
2
  `),[y,b]=(0,q.useState)(e.fallbackModels||[]);(0,q.useEffect)(()=>{b(v?v.split(`
3
3
  `):[])},[v]);let[x,S]=(0,q.useState)(e.auxiliaryModel||``);(0,q.useEffect)(()=>{S(e.auxiliaryModel||``)},[e.auxiliaryModel]);let C=e.defaultProvider||e.provider,w=e.defaultModel||e.model,T=e.providers.find(e=>e.id===C),E=T?.models.find(e=>e.id===w)?.thinkingLevels,D=Gi.filter(e=>!E?.length||E.includes(e)||e===m),O=e=>E?.length&&!E.includes(e)?a(`config:providerWorkbench.thinkingUnsupportedByModel`,{level:s[e]}):s[e],k=!!(T?.configured&&w),A=e.providers.filter(e=>e.type===`chat`&&e.configured&&e.enabled),j=A.flatMap(e=>e.models.filter(e=>e.kind===`chat`).map(t=>({provider:e,model:t,value:`${e.id}${Ki}${t.id}`}))),M=T&&w?`${T.id}${Ki}${w}`:``,ee=async n=>{if(!(!T||!w)){u(!0),p(``);try{r(await f(`/api/config`,{method:`PUT`,body:JSON.stringify({provider:T.id,providerType:T.type,api:T.api,baseUrl:T.baseUrl||``,organization:T.organization||``,model:w,thinkingLevel:n.thinkingLevel??e.thinkingLevel,toolMode:n.toolMode??e.toolMode,setAsDefault:!1})})),t(a(`config:configPage.runtimePolicySaved`))}catch(t){h(e.thinkingLevel),_(e.toolMode),p(t instanceof Error?t.message:String(t))}finally{u(!1)}}},N=!k||c||n,P=async(e,n)=>{let i=[...y];i[e]=n;let o=i.filter((e,t)=>e&&i.indexOf(e)===t),s=y;b(o),u(!0),p(``);try{r(await vi.saveFallbackModels(o)),t(a(`config:providerWorkbench.fallbackModelsSaved`))}catch(e){b(s),p(e instanceof Error?e.message:String(e))}finally{u(!1)}},te=async e=>{let n=x;S(e),u(!0),p(``);try{r(await vi.saveAuxiliaryModel(e)),t(a(`config:providerWorkbench.auxiliaryModelSaved`))}catch(e){S(n),p(e instanceof Error?e.message:String(e))}finally{u(!1)}},ne=(e,t)=>(0,J.jsxs)(K,{"aria-labelledby":t,className:`w-full`,disabled:!j.length||n||c||e>0&&!y[0],value:y[e]||``,onChange:t=>void P(e,t.target.value),children:[(0,J.jsx)(`option`,{value:``,children:a(`config:providerWorkbench.fallbackNone`)}),y[e]&&!j.some(t=>qi(t)===y[e])&&(0,J.jsx)(`option`,{value:y[e],children:y[e]}),j.map(e=>(0,J.jsx)(`option`,{value:qi(e),children:`${e.model.name||e.model.id} · ${e.provider.name}`},e.value))]});return(0,J.jsxs)(`section`,{"data-config-card":`models-current-model`,"aria-labelledby":`${o}-heading`,"aria-busy":c||void 0,className:`mt-6 min-w-0`,children:[(0,J.jsx)(`h2`,{id:`${o}-heading`,className:`sr-only`,children:a(`config:configPage.currentChatModel`)}),(0,J.jsxs)(`div`,{"data-config-target":`models-runtime-policy`,className:`border-t border-stroke`,children:[(0,J.jsx)(Ji,{labelId:`${o}-model`,label:a(`config:providerWorkbench.defaultModel`),hint:a(`config:providerWorkbench.defaultModelHint`),children:(0,J.jsxs)(K,{"aria-labelledby":`${o}-model`,className:`w-full`,disabled:!j.length||n||c,value:j.some(e=>e.value===M)?M:``,onChange:e=>{let[t,n]=e.target.value.split(Ki),r=A.find(e=>e.id===t);r&&n&&i(r,n)},children:[!j.length&&(0,J.jsx)(`option`,{value:``,children:a(`config:providerWorkbench.noChatModel`)}),j.map(({provider:e,model:t,value:n})=>(0,J.jsx)(`option`,{value:n,children:`${Ot(t.name||t.id,j.map(e=>e.model.name||e.model.id))} · ${e.name}`},n))]})}),(0,J.jsx)(Ji,{labelId:`${o}-fallback`,label:a(`config:providerWorkbench.fallbackModels`),hint:a(`config:providerWorkbench.fallbackModelsHint`),children:(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,J.jsx)(`span`,{id:`${o}-fallback-1`,className:`sr-only`,children:a(`config:providerWorkbench.fallbackFirst`)}),ne(0,`${o}-fallback ${o}-fallback-1`),y[0]&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{id:`${o}-fallback-2`,className:`sr-only`,children:a(`config:providerWorkbench.fallbackSecond`)}),ne(1,`${o}-fallback ${o}-fallback-2`)]})]})}),(0,J.jsx)(Ji,{labelId:`${o}-auxiliary`,label:a(`config:providerWorkbench.auxiliaryModel`),hint:a(`config:providerWorkbench.auxiliaryModelHint`),children:(0,J.jsxs)(K,{"aria-labelledby":`${o}-auxiliary`,"aria-describedby":`${o}-auxiliary-hint`,className:`w-full`,disabled:!j.length||n||c,value:x,onChange:e=>void te(e.target.value),children:[(0,J.jsx)(`option`,{value:``,children:a(`config:providerWorkbench.auxiliaryFollowSession`)}),x&&!j.some(e=>qi(e)===x)&&(0,J.jsx)(`option`,{value:x,children:x}),j.map(e=>(0,J.jsx)(`option`,{value:qi(e),children:`${e.model.name||e.model.id} · ${e.provider.name}`},e.value))]})}),(0,J.jsx)(Ji,{labelId:`${o}-thinking`,label:a(`config:configPage.thinkingLevel`),hint:a(`config:providerWorkbench.thinkingHint`),children:(0,J.jsx)(K,{"aria-labelledby":`${o}-thinking`,className:`w-full`,disabled:N,value:m,onChange:e=>{h(e.target.value),ee({thinkingLevel:e.target.value})},children:D.map(e=>(0,J.jsx)(`option`,{value:e,children:O(e)},e))})}),(0,J.jsx)(Ji,{labelId:`${o}-tools`,label:a(`config:configPage.availableTools`),hint:a(`config:providerWorkbench.toolsHint`),children:(0,J.jsxs)(K,{"aria-labelledby":`${o}-tools`,className:`w-full`,disabled:N,value:g,onChange:e=>{_(e.target.value),ee({toolMode:e.target.value})},children:[(0,J.jsx)(`option`,{value:`full`,children:a(`config:configPage.fullToolAccess`)}),(0,J.jsx)(`option`,{value:`custom`,children:a(`config:configPage.customManageEachToolOnThePluginsPage`)})]})})]}),(!k||c)&&(0,J.jsxs)(`p`,{className:`mt-2 flex items-center gap-2 text-xs text-content-muted`,role:`status`,children:[c&&(0,J.jsx)(R,{className:`size-3`}),a(c?`config:configPage.saving`:`config:providerWorkbench.defaultsNeedProvider`)]}),d&&(0,J.jsx)(W,{children:d})]})}var Xi=[`fast`,`standard`,`strong`],Zi={listProfiles(){return f(`/api/agent-profiles`)},saveModelTiers(e){return f(`/api/config/subagent-model-tiers`,{method:`PUT`,body:JSON.stringify({tiers:e})})}};function Qi({config:e,notify:t,busy:n,onConfigChanged:r}){let{t:i}=l(),a=e=>i(e===`fast`?`config:subagents.tierFast`:e===`standard`?`config:subagents.tierStandard`:`config:subagents.tierStrong`),o=e=>i(e===`fast`?`config:subagents.tierFastHint`:e===`standard`?`config:subagents.tierStandardHint`:`config:subagents.tierStrongHint`),s=(0,q.useId)(),[c,u]=(0,q.useState)(!1),[d,f]=(0,q.useState)(``),[p,m]=(0,q.useState)(null),[h,g]=(0,q.useState)(``),_=e.subagentModelTiers||{},v=Xi.map(e=>_[e]||``).join(`
4
4
  `),[y,b]=(0,q.useState)(_);(0,q.useEffect)(()=>{let e=v.split(`