pisper 0.6.6 → 0.6.7

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 (115) hide show
  1. package/package.json +7 -7
  2. package/web/.vite/manifest.json +481 -336
  3. package/web/assets/AppDialog-DuxuKq-0.js +1 -0
  4. package/web/assets/{AppOverlays-C_WrmeqC.js → AppOverlays-YPxRUvLN.js} +1 -1
  5. package/web/assets/{AppSelect-DNIjPL7I.js → AppSelect-DEmkrcvY.js} +1 -1
  6. package/web/assets/{AppShortcuts-V38tUYTp.js → AppShortcuts-CA7hbebL.js} +1 -1
  7. package/web/assets/{AssetsPage-BmSnyLZ5.js → AssetsPage-CkNI_8qz.js} +1 -1
  8. package/web/assets/{ChannelsPage-Da3JaYaC.js → ChannelsPage-BYfRQyV0.js} +1 -1
  9. package/web/assets/ChatAppearancePage-N_2bunil.js +2 -0
  10. package/web/assets/{ChatDockView-5Aptiph6.js → ChatDockView-B4nZfbx5.js} +1 -1
  11. package/web/assets/ChatHistoryPage-Di3epmcR.js +1 -0
  12. package/web/assets/ChatPage-IN5m7Fqh.js +4 -0
  13. package/web/assets/ConfigPage-BKTEOlQE.js +1 -0
  14. package/web/assets/{DecisionsPage-BwJ7RTAE.js → DecisionsPage-DNAUZCij.js} +1 -1
  15. package/web/assets/{DesktopWindowControls-CLVd8sg6.js → DesktopWindowControls-BAnWUUAZ.js} +1 -1
  16. package/web/assets/{FileAttachmentPreview-C6QaQFwb.js → FileAttachmentPreview-x4AORCVt.js} +1 -1
  17. package/web/assets/{FloatingWidgets-QMhElaDR.js → FloatingWidgets-CdbBMke7.js} +1 -1
  18. package/web/assets/GitDiffViewer-oJDF7l74.js +2 -0
  19. package/web/assets/{ListDetailLayout-S-IBs4f_.js → ListDetailLayout-Ctr6r0OI.js} +1 -1
  20. package/web/assets/{MarkdownMessage-bfyuGoi1.js → MarkdownMessage-D9zxSf6j.js} +1 -1
  21. package/web/assets/McpPage-DaOkWcq6.js +1 -0
  22. package/web/assets/{MemoryPage-CC37SohP.js → MemoryPage-B5sqhaYW.js} +1 -1
  23. package/web/assets/MobileContextScreen-DiM-lGec.js +2 -0
  24. package/web/assets/MobileNavigation-DZx6cE9f.js +1 -0
  25. package/web/assets/MobileShellContext-Cvv0RcjA.js +1 -0
  26. package/web/assets/MobileViewportStabilizer-BAI_nmS_.js +1 -0
  27. package/web/assets/{PageHeader-75eh-Z_A.js → PageHeader-FBipSHuW.js} +1 -1
  28. package/web/assets/{PluginsPage-za6FNr_k.js → PluginsPage-BFLnVcnm.js} +1 -1
  29. package/web/assets/{QuickPromptIdeas-CEjBwWlM.js → QuickPromptIdeas-CVcEEpAl.js} +1 -1
  30. package/web/assets/{SchedulesPage-BR1oIqzi.js → SchedulesPage-CVnoI4wZ.js} +1 -1
  31. package/web/assets/SessionContextPanel-CEmCvPx4.js +2 -0
  32. package/web/assets/SessionFilesPane-CAdkivkE.js +2 -0
  33. package/web/assets/{SidebarUpdateStatus-Chfb-00K.js → SidebarUpdateStatus-Co3QAKmb.js} +1 -1
  34. package/web/assets/{SkillsPage-DfFjecBO.js → SkillsPage-d8t6_KDS.js} +1 -1
  35. package/web/assets/{TaskProcessesPane-DJszMYjM.js → TaskProcessesPane-PRgpCplN.js} +1 -1
  36. package/web/assets/{TaskTerminalView-DyTURB64.js → TaskTerminalView-Dt8gIY5E.js} +1 -1
  37. package/web/assets/{TerminalPanel-BFqST5ja.js → TerminalPanel-BRib2LP-.js} +1 -1
  38. package/web/assets/{ThemeToggleButton-DmYU4_Nh.js → ThemeToggleButton-C1lL__80.js} +1 -1
  39. package/web/assets/{WebDesktopPet-COIAEeuY.js → WebDesktopPet-BWpgoZI3.js} +1 -1
  40. package/web/assets/WorkbenchNavigation-DmNiD2FD.js +1 -0
  41. package/web/assets/{WorkflowsPage-Heg3iqQg.js → WorkflowsPage-aRy0lYQ1.js} +1 -1
  42. package/web/assets/{WorkspacePicker-DFCZ_IJu.js → WorkspacePicker-NkoVoqez.js} +1 -1
  43. package/web/assets/{api-D8wGrWiI.js → api-CiEo53J1.js} +1 -1
  44. package/web/assets/app-update-CLhMRrNS.js +32 -0
  45. package/web/assets/calendar-clock-VIxTaqqy.js +1 -0
  46. package/web/assets/catalog-DLWnYiJc.js +1 -0
  47. package/web/assets/chat-api-CbgoP-8X.js +1 -0
  48. package/web/assets/{client-store-lT3geTlX.js → client-store-DCqgdbAp.js} +1 -1
  49. package/web/assets/{component-api-kxyOYPJN.js → component-api-BboiUuyG.js} +1 -1
  50. package/web/assets/{config-search-BThCMhnj.js → config-search-Cwglajsz.js} +1 -1
  51. package/web/assets/events-f8vVvSfH.js +1 -0
  52. package/web/assets/{floating-widgets-store-BhuWgVRT.js → floating-widgets-store-BAfPpV4Z.js} +2 -2
  53. package/web/assets/git-diff-f-zMaQOk.js +3 -0
  54. package/web/assets/{http-rQRvhTOP.js → http-Dx387MGl.js} +1 -1
  55. package/web/assets/i18n-CblgkPOp.js +1 -0
  56. package/web/assets/{index-BVIvzUyZ.js → index-BAYzSwUr.js} +2 -2
  57. package/web/assets/index-Bcpvpefn.css +2 -0
  58. package/web/assets/monitor-ORxecA9m.js +1 -0
  59. package/web/assets/mount-app-DGgK0IVe.js +9 -0
  60. package/web/assets/mutation-CEbxdVYy.js +1 -0
  61. package/web/assets/panels-top-left-K8n2CefH.js +1 -0
  62. package/web/assets/project-diff-summary-BzAMC_7C.js +1 -0
  63. package/web/assets/public-Cv_Xe2Sp.js +1 -0
  64. package/web/assets/{public-components-CS0BXa3D.js → public-components-Dfm4D7vP.js} +1 -1
  65. package/web/assets/public-navigation-zJPpUiuy.js +2 -0
  66. package/web/assets/query-Bj-DUNYq.js +1 -0
  67. package/web/assets/radio-tower-jGQwrFWB.js +1 -0
  68. package/web/assets/{runtime-capabilities-store-D5g-oC-Z.js → runtime-capabilities-store-C1lkVKpw.js} +1 -1
  69. package/web/assets/scale-pAyho3H9.js +1 -0
  70. package/web/assets/{session-change-summary-api-4_dTNU4L.js → session-change-summary-api-CqJa3Wdh.js} +1 -1
  71. package/web/assets/{session-organization-api-1F_dNhFa.js → session-organization-api-B0E2RXLS.js} +1 -1
  72. package/web/assets/session-streaming-state-DUehpyTs.js +3 -0
  73. package/web/assets/settings-navigation-BhTYSdv9.js +1 -0
  74. package/web/assets/{shortcuts-CAyIKRpZ.js → shortcuts-ChJr3RP4.js} +1 -1
  75. package/web/assets/{sidebar-CjfGBEog.js → sidebar-CERcJRog.js} +1 -1
  76. package/web/assets/{speech-session-BoAvAzPN.js → speech-session-BPNbd_CM.js} +1 -1
  77. package/web/assets/startup-queries-uKXB2KOP.js +1 -0
  78. package/web/assets/{ui-store-D-oOtKbW.js → ui-store-BM6pl-Rq.js} +1 -1
  79. package/web/assets/use-back-layer-B4dm_FZt.js +1 -0
  80. package/web/assets/{use-i18n-Dpn7lxcE.js → use-i18n-BrWBoyFl.js} +1 -1
  81. package/web/assets/use-mobile-PCHaokZZ.js +1 -0
  82. package/web/assets/{useCustomUiComponents-DzY3OjE_.js → useCustomUiComponents-IxX7wKrp.js} +1 -1
  83. package/web/assets/useQuery-DdcpUQhO.js +1 -0
  84. package/web/assets/web-preview-D1qOo-1X.js +1 -0
  85. package/web/assets/{web-preview-events-BS5O8D7_.js → web-preview-events-BMXsxTa3.js} +1 -1
  86. package/web/assets/web-preview-panel-B7JAZr2D.js +552 -0
  87. package/web/index.html +2 -2
  88. package/web/assets/ChatAppearancePage-Cjy9iir_.js +0 -2
  89. package/web/assets/ChatHistoryPage-BhXVvudL.js +0 -1
  90. package/web/assets/ChatPage-CzcvU3Tv.js +0 -4
  91. package/web/assets/ConfigPage-F1Y_oed5.js +0 -1
  92. package/web/assets/GitDiffViewer-Dv9WOiX1.js +0 -4
  93. package/web/assets/McpPage-CaUm1pYY.js +0 -1
  94. package/web/assets/MobileViewportStabilizer-OtwVmIPm.js +0 -1
  95. package/web/assets/SessionContextPanel-nvijY4R5.js +0 -2
  96. package/web/assets/WorkbenchNavigation-BBZRfeaC.js +0 -1
  97. package/web/assets/app-update-BHhqGwQp.js +0 -32
  98. package/web/assets/back-navigation-DS0YlxM8.js +0 -1
  99. package/web/assets/catalog-DpGpcvIi.js +0 -1
  100. package/web/assets/chat-api-CYidanXn.js +0 -1
  101. package/web/assets/events-By17Y3YI.js +0 -1
  102. package/web/assets/i18n-CAJMli-q.js +0 -1
  103. package/web/assets/index-Z8qQPd8t.css +0 -2
  104. package/web/assets/mount-app-Sl2T_gzZ.js +0 -9
  105. package/web/assets/mutation-Difliohy.js +0 -1
  106. package/web/assets/public-DAsd8NDM.js +0 -1
  107. package/web/assets/public-navigation-BzM_ocRb.js +0 -2
  108. package/web/assets/radio-tower-BW78Ns4R.js +0 -1
  109. package/web/assets/session-streaming-state-CX6zkOkc.js +0 -3
  110. package/web/assets/startup-queries-DItwFTRv.js +0 -1
  111. package/web/assets/use-back-layer-Cxm0-40v.js +0 -1
  112. package/web/assets/use-mobile-YXncArOq.js +0 -1
  113. package/web/assets/useQuery-Bg3cTjsY.js +0 -1
  114. package/web/assets/web-preview-C3u-dblt.js +0 -1
  115. package/web/assets/web-preview-panel-CHiIjAoR.js +0 -552
@@ -1 +0,0 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{s as t}from"./vendor-router-CZg2bCPV.js";import{t as n}from"./index-BVIvzUyZ.js";import{i as r,r as i}from"./vendor-react-DwNgTV1j.js";import{n as a,s as o,u as s}from"./i18n-CAJMli-q.js";import{t as c}from"./use-i18n-Dpn7lxcE.js";import{t as l}from"./storage-BpAqa-YY.js";import{i as u}from"./dist-Cfh4kzCK.js";import{c as d,i as f,o as p,s as m}from"./dist-B_a0oV4U.js";import{a as h,i as g,n as _,r as v,t as y}from"./dist-DAs5KRGl.js";import{n as b,r as x,t as S}from"./collapsible-C__hRcbA.js";import{t as C}from"./dist-TksYpDID.js";import{l as w,n as T,r as E,t as D}from"./dropdown-menu-LKlOCZsZ.js";import{t as O}from"./label-BzlNatZM.js";import{a as k,c as A,i as j,n as M,o as N,r as ee,s as te,t as P}from"./AppSelect-DNIjPL7I.js";import{t as ne}from"./separator-BDICnhEL.js";import{n as F}from"./switch-Ci_hmu39.js";import{t as I}from"./utils-C8uzG5AZ.js";import{t as L}from"./createLucideIcon-Cd-3GVxJ.js";import{t as re}from"./activity-BCxvXCG3.js";import{t as ie}from"./arrow-left-B8oVrQ2S.js";import{t as ae}from"./arrow-right-DqLOhpA2.js";import{i as R,n as oe,r as se,t as ce}from"./zap-3wDb3GcJ.js";import{t as le}from"./bell-BjONAtgH.js";import{t as ue}from"./bot-B3TaBp_T.js";import{t as de}from"./brain-qxhnKqYP.js";import{t as fe}from"./check-2vYc6QaP.js";import{t as pe}from"./chevron-down-CxtxIjiP.js";import{t as me}from"./circle-alert-DCChabnT.js";import{t as he}from"./circle-check-iEdCm3Pw.js";import{t as ge}from"./clock-3-CBHGbD_G.js";import{t as _e}from"./code-xml-BrUXrBax.js";import{t as ve}from"./copy-DHmIFc52.js";import{t as ye}from"./download-BCfIiuaL.js";import{t as be}from"./earth-Ddy13fHh.js";import{t as xe}from"./ellipsis-CfGKfbq6.js";import{t as Se}from"./external-link-CEQqPcqc.js";import{t as Ce}from"./flask-conical-DhW5v7Zz.js";import{t as we}from"./image-BY_c3FYU.js";import{a as Te,c as Ee,d as De,i as Oe,l as ke,o as Ae,r as je,u as Me}from"./app-update-BHhqGwQp.js";import{t as Ne}from"./loader-circle-BOwQzHB-.js";import{t as Pe}from"./message-square-SKjZyY3v.js";import{n as Fe,r as Ie,t as Le}from"./sun-DBWBo3We.js";import{t as Re}from"./plus-fQbSqB1n.js";import{t as z}from"./refresh-cw-TbWxTY4K.js";import{t as ze}from"./rocket-BgLSjoHY.js";import{t as Be}from"./rotate-ccw-C0v8V77_.js";import{t as Ve}from"./save-CHBB52P8.js";import{t as He}from"./search-D0mqDaf_.js";import{t as Ue}from"./send-Cj-W03w_.js";import{t as B}from"./server-BgNvmqwJ.js";import{t as We}from"./shield-check-Gvek4RJ7.js";import{t as Ge}from"./sliders-horizontal-Dryf1XyC.js";import{t as Ke}from"./sparkles-S_eeuqn9.js";import{t as qe}from"./square-terminal-BVG6cUT1.js";import{t as Je}from"./trash-2-CNrPOoPR.js";import{t as Ye}from"./triangle-alert-CE1q54ci.js";import{t as Xe}from"./wand-sparkles-DdQneChm.js";import{t as Ze}from"./wrench-6pg6_bqI.js";import{t as Qe}from"./x-07u4-129.js";import{t as V}from"./api-D8wGrWiI.js";import{t as H}from"./button-BcPDt1Ge.js";import{a as $e,i as et,o as tt,r as nt,s as rt,t as it}from"./dialog-CGGxREwU.js";import{t as at}from"./input-CvjGYteF.js";import{t as U}from"./field-3bN8nouy.js";import{r as ot}from"./format-BRFKAYMT.js";import{a as st,i as ct,l as lt,n as ut,o as dt,r as ft,s as pt,t as mt}from"./app-primitives-DhqJLud3.js";import{a as ht,c as gt,d as _t,l as vt,s as yt,t as bt,u as xt}from"./shortcuts-CAyIKRpZ.js";import{r as W,t as St}from"./ui-store-D-oOtKbW.js";import{t as Ct}from"./PageFrame-BiJUCJku.js";import{t as wt}from"./usePagePrimaryAction-CWPC0C_f.js";import{t as Tt}from"./MarkdownMessage-bfyuGoi1.js";import{t as Et}from"./brand-DIEc3fK8.js";import{i as Dt,t as Ot}from"./config-search-BThCMhnj.js";import{i as kt,n as At,r as jt,t as Mt}from"./browser-notifications-DBS0oXqN.js";var G=e(r(),1),K=i(),Nt=Object.defineProperty,q=(e,t)=>Nt(e,`name`,{value:t,configurable:!0}),Pt=`Radio`,[Ft,It]=m(Pt),[Lt,Rt]=Ft(Pt);function zt(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]=G.useState(null),[p,m]=G.useState(null),h=G.useRef(!1),[g,_]=G.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:q(()=>s?.(),`onCheck`)};return(0,K.jsx)(Lt,{scope:t,...v,children:Wt(u)?u(v):r})}q(zt,`RadioProvider`);var Bt=`RadioTrigger`,Vt=G.forwardRef(q(function({__scopeRadio:e,onClick:t,...n},r){let{checked:i,disabled:a,value:o,setControl:s,onCheck:c,hasConsumerStoppedPropagationRef:l,onUserInteraction:f,isFormControl:m,bubbleInput:h}=Rt(Bt,e),g=u(r,s);return(0,K.jsx)(d.button,{type:`button`,role:`radio`,"aria-checked":i,"data-state":Gt(i),"data-disabled":a?``:void 0,disabled:a,value:o,...n,ref:g,onClick:p(t,e=>{i||(f(),c()),h&&m&&(l.current=e.isPropagationStopped(),l.current||e.stopPropagation())})})},`RadioTrigger`)),Ht=`RadioBubbleInput`,Ut=G.forwardRef(q(function({__scopeRadio:e,onClick:t,...n},r){let{control:i,checked:a,required:o,disabled:s,name:c,value:l,form:f,bubbleInput:m,setBubbleInput:h,hasConsumerStoppedPropagationRef:g,userInteractionCount:_}=Rt(Ht,e),v=u(r,h),y=C(i),b=G.useRef(!1),x=G.useRef(a),S=G.useRef(_);G.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=_!==S.current;S.current=_;let i=x.current!==a;x.current=a;let o=!(r&&g.current);if(i&&n){b.current=!r;let t=new Event(`click`,{bubbles:o});n.call(e,a),e.dispatchEvent(t),b.current=!1}},[m,a,g,_]);let w=G.useRef(a);return(0,K.jsx)(d.input,{type:`radio`,"aria-hidden":!0,defaultChecked:w.current,required:o,disabled:s,name:c,value:l,form:f,...n,tabIndex:-1,ref:v,onClick:p(t,e=>{b.current&&e.stopPropagation()}),style:{...n.style,...y,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`RadioBubbleInput`));function Wt(e){return typeof e==`function`}q(Wt,`isFunction`);function Gt(e){return e?`checked`:`unchecked`}q(Gt,`getState`);var Kt=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],qt=`RadioGroup`,[Jt,Yt]=m(qt,[v,It]),Xt=v(),Zt=It(),[Qt,$t]=Jt(qt),en=G.forwardRef(q(function(e,t){let{__scopeRadioGroup:n,name:r,form:i,defaultValue:a,value:o,required:s=!1,disabled:c=!1,orientation:l,dir:p,loop:m=!0,onValueChange:h,...v}=e,y=Xt(n),b=g(p),[x,S]=f({prop:o,defaultProp:a??null,onChange:h,caller:qt}),[C,w]=G.useState(null),T=u(t,w),E=G.useRef(x);return G.useEffect(()=>{let e=i?C?.ownerDocument.getElementById(i):C?.closest(`form`);if(e instanceof HTMLFormElement){let t=q(()=>S(E.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[C,i,S]),(0,K.jsx)(Qt,{scope:n,name:r,form:i,required:s,disabled:c,value:x,onValueChange:S,children:(0,K.jsx)(_,{asChild:!0,...y,orientation:l,dir:b,loop:m,children:(0,K.jsx)(d.div,{role:`radiogroup`,"aria-required":s,"aria-orientation":l,"data-disabled":c?``:void 0,dir:b,...v,ref:T})})})},`RadioGroup`)),tn=`RadioGroupItemProvider`,nn=`RadioGroupItemTrigger`;function rn(e){let{__scopeRadioGroup:t,value:n,disabled:r,children:i,internal_do_not_use_render:a}=e,o=$t(tn,t),s=Zt(t),c=o.disabled||r;return(0,K.jsx)(zt,{...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})}q(rn,`RadioGroupItemProvider`);var an=G.forwardRef(q(function(e,t){let{__scopeRadioGroup:n,...r}=e,i=Xt(n),a=Zt(n),{checked:o,disabled:s}=Rt(nn,a.__scopeRadio),c=G.useRef(null),l=u(t,c),d=G.useRef(!1);return G.useEffect(()=>{let e=q(e=>{Kt.includes(e.key)&&(d.current=!0)},`handleKeyDown`),t=q(()=>d.current=!1,`handleKeyUp`);return document.addEventListener(`keydown`,e),document.addEventListener(`keyup`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`keyup`,t)}},[]),(0,K.jsx)(y,{asChild:!0,...i,focusable:!s,active:o,children:(0,K.jsx)(Vt,{...a,...r,ref:l,onKeyDown:p(r.onKeyDown,e=>{e.key===`Enter`&&e.preventDefault()}),onFocus:p(r.onFocus,()=>{d.current&&c.current?.click()})})})},`RadioGroupItemTrigger`)),on=G.forwardRef(q(function(e,t){let{__scopeRadioGroup:n,value:r,disabled:i,...a}=e;return(0,K.jsx)(rn,{__scopeRadioGroup:n,value:r,disabled:i,internal_do_not_use_render:({isFormControl:e})=>(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(an,{...a,ref:t,__scopeRadioGroup:n}),e&&(0,K.jsx)(sn,{__scopeRadioGroup:n})]})})},`RadioGroupItem`)),sn=G.forwardRef(q(function(e,t){let{__scopeRadioGroup:n,...r}=e,i=Zt(n);return(0,K.jsx)(Ut,{...i,...r,ref:t})},`RadioGroupItemBubbleInput`)),cn=Object.defineProperty,J=(e,t)=>cn(e,`name`,{value:t,configurable:!0}),ln=[`PageUp`,`PageDown`],un=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],dn={"from-left":[`Home`,`PageDown`,`ArrowDown`,`ArrowLeft`],"from-right":[`Home`,`PageDown`,`ArrowDown`,`ArrowRight`],"from-bottom":[`Home`,`PageDown`,`ArrowDown`,`ArrowLeft`],"from-top":[`Home`,`PageDown`,`ArrowUp`,`ArrowLeft`]},fn=`Slider`,[pn,mn,hn]=h(fn),[gn,_n]=m(fn,[hn]),[vn,yn]=gn(fn),bn=G.forwardRef(J(function(e,t){let{name:n,min:r=0,max:i=100,step:a=1,orientation:o=`horizontal`,disabled:s=!1,minStepsBetweenThumbs:c=0,defaultValue:l=[r],value:d,onValueChange:m=J(()=>{},`onValueChange`),onValueCommit:h=J(()=>{},`onValueCommit`),inverted:g=!1,form:_,...v}=e,y=G.useRef(new Set),b=G.useRef(0),x=G.useRef(!1),S=o===`horizontal`?Cn:wn,[C,w]=G.useState(null),T=u(t,w),[E=[],D]=f({prop:d,defaultProp:l,onChange:J(e=>{[...y.current][b.current]?.focus({preventScroll:!0,focusVisible:x.current}),x.current=!1,m(e)},`onChange`)}),O=G.useRef(E),k=G.useRef(E);G.useEffect(()=>{let e=_?C?.ownerDocument.getElementById(_):C?.closest(`form`);if(e instanceof HTMLFormElement){let t=J(()=>D(k.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[C,_,D]);function A(e){N(e,Hn(E,e))}J(A,`handleSlideStart`);function j(e){N(e,b.current)}J(j,`handleSlideMove`);function M(){String(E)!==String(O.current)&&h(E)}J(M,`handleSlideEnd`);function N(e,t,{commit:n}={commit:!1}){let o=qn(a),s=Jn(Math.round((e-r)/a)*a+r,o),l=te(s,[r,i]);D((e=[])=>{let r=zn(e,l,t);if(Gn(r,c*a)){b.current=r.indexOf(l);let t=String(r)!==String(e);return t&&n&&h(r),t?r:e}return e})}return J(N,`updateValues`),(0,K.jsx)(vn,{scope:e.__scopeSlider,name:n,disabled:s,min:r,max:i,valueIndexToChangeRef:b,thumbs:y.current,values:E,orientation:o,form:_,children:(0,K.jsx)(pn.Provider,{scope:e.__scopeSlider,children:(0,K.jsx)(pn.Slot,{scope:e.__scopeSlider,children:(0,K.jsx)(S,{"aria-disabled":s,"data-disabled":s?``:void 0,...v,ref:T,onPointerDown:p(v.onPointerDown,()=>{s||(O.current=E,x.current=!1)}),min:r,max:i,inverted:g,onSlideStart:s?void 0:A,onSlideMove:s?void 0:j,onSlideEnd:s?void 0:M,onHomeKeyDown:()=>{s||(x.current=!0,N(r,0,{commit:!0}))},onEndKeyDown:()=>{s||(x.current=!0,N(i,E.length-1,{commit:!0}))},onStepKeyDown:({event:e,direction:t})=>{if(!s){x.current=!0;let n=ln.includes(e.key)||e.shiftKey&&un.includes(e.key)?10:1,i=b.current,o=E[i];N(Yn(o,{min:r,step:a,direction:t,multiplier:n}),i,{commit:!0})}}})})})})},`Slider`)),[xn,Sn]=gn(fn,{startEdge:`left`,endEdge:`right`,size:`width`,direction:1}),Cn=G.forwardRef(J(function(e,t){let{min:n,max:r,dir:i,inverted:a,onSlideStart:o,onSlideMove:s,onSlideEnd:c,onStepKeyDown:l,...d}=e,[f,p]=G.useState(null),m=u(t,p),h=G.useRef(void 0),_=g(i),v=_===`ltr`,y=v&&!a||!v&&a;function b(e){let t=h.current||f.getBoundingClientRect(),i=Kn([0,t.width],y?[n,r]:[r,n]);return h.current=t,i(e-t.left)}return J(b,`getValueFromPointer`),(0,K.jsx)(xn,{scope:e.__scopeSlider,startEdge:y?`left`:`right`,endEdge:y?`right`:`left`,direction:y?1:-1,size:`width`,children:(0,K.jsx)(Tn,{dir:_,"data-orientation":`horizontal`,...d,ref:m,style:{...d.style,"--radix-slider-thumb-transform":`translateX(-50%)`},onSlideStart:e=>{let t=b(e.clientX);o?.(t)},onSlideMove:e=>{let t=b(e.clientX);s?.(t)},onSlideEnd:()=>{h.current=void 0,c?.()},onStepKeyDown:e=>{let t=dn[y?`from-left`:`from-right`].includes(e.key);l?.({event:e,direction:t?-1:1})}})})},`SliderHorizontal`)),wn=G.forwardRef(J(function(e,t){let{min:n,max:r,inverted:i,onSlideStart:a,onSlideMove:o,onSlideEnd:s,onStepKeyDown:c,...l}=e,d=G.useRef(null),f=u(t,d),p=G.useRef(void 0),m=!i;function h(e){let t=p.current||d.current.getBoundingClientRect(),i=Kn([0,t.height],m?[r,n]:[n,r]);return p.current=t,i(e-t.top)}return J(h,`getValueFromPointer`),(0,K.jsx)(xn,{scope:e.__scopeSlider,startEdge:m?`bottom`:`top`,endEdge:m?`top`:`bottom`,size:`height`,direction:m?1:-1,children:(0,K.jsx)(Tn,{"data-orientation":`vertical`,...l,ref:f,style:{...l.style,"--radix-slider-thumb-transform":`translateY(50%)`},onSlideStart:e=>{let t=h(e.clientY);a?.(t)},onSlideMove:e=>{let t=h(e.clientY);o?.(t)},onSlideEnd:()=>{p.current=void 0,s?.()},onStepKeyDown:e=>{let t=dn[m?`from-bottom`:`from-top`].includes(e.key);c?.({event:e,direction:t?-1:1})}})})},`SliderVertical`)),Tn=G.forwardRef(J(function(e,t){let{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:a,onHomeKeyDown:o,onEndKeyDown:s,onStepKeyDown:c,...l}=e,u=yn(fn,n);return(0,K.jsx)(d.span,{...l,ref:t,onKeyDown:p(e.onKeyDown,e=>{e.key===`Home`?(o(e),e.preventDefault()):e.key===`End`?(s(e),e.preventDefault()):ln.concat(un).includes(e.key)&&(c(e),e.preventDefault())}),onPointerDown:p(e.onPointerDown,e=>{let t=e.target;t.setPointerCapture(e.pointerId),e.preventDefault(),u.thumbs.has(t)?t.focus({preventScroll:!0,focusVisible:!1}):r(e)}),onPointerMove:p(e.onPointerMove,e=>{e.target.hasPointerCapture(e.pointerId)&&i(e)}),onPointerUp:p(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&(t.releasePointerCapture(e.pointerId),a(e))})})},`SliderImpl`)),En=`SliderTrack`,Dn=G.forwardRef(J(function(e,t){let{__scopeSlider:n,...r}=e,i=yn(En,n);return(0,K.jsx)(d.span,{"data-disabled":i.disabled?``:void 0,"data-orientation":i.orientation,...r,ref:t})},`SliderTrack`)),On=`SliderRange`,kn=G.forwardRef(J(function(e,t){let{__scopeSlider:n,...r}=e,i=yn(On,n),a=Sn(On,n),o=G.useRef(null),s=u(t,o),c=i.values.length,l=i.values.map(e=>Bn(e,i.min,i.max)),f=c>1?Math.min(...l):0,p=100-Math.max(...l);return(0,K.jsx)(d.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?``:void 0,...r,ref:s,style:{...e.style,[a.startEdge]:f+`%`,[a.endEdge]:p+`%`}})},`SliderRange`)),[An,jn]=gn(`SliderThumb`),Mn=`SliderThumbProvider`;function Nn(e){let{__scopeSlider:t,name:n,children:r,internal_do_not_use_render:i}=e,a=yn(Mn,t),o=mn(t),[s,c]=G.useState(null),l=G.useMemo(()=>s?o().findIndex(e=>e.ref.current===s):-1,[o,s]),u=C(s),d=!s||!!a.form||!!s.closest(`form`),f=a.values[l],p=n??(a.name?a.name+(a.values.length>1?`[]`:``):void 0),m=f===void 0?0:Bn(f,a.min,a.max);G.useEffect(()=>{if(s)return a.thumbs.add(s),()=>{a.thumbs.delete(s)}},[s,a.thumbs]);let h={value:f,name:p,form:a.form,isFormControl:d,index:l,thumb:s,onThumbChange:c,percent:m,size:u};return(0,K.jsx)(An,{scope:t,...h,children:Xn(i)?i(h):r})}J(Nn,`SliderThumbProvider`);var Pn=`SliderThumbTrigger`,Fn=G.forwardRef(J(function(e,t){let{__scopeSlider:n,...r}=e,i=yn(Pn,n),a=Sn(Pn,n),{index:o,value:s,percent:c,size:l,onThumbChange:f}=jn(Pn,n),m=u(t,f),h=Vn(o,i.values.length),g=l?.[a.size],_=g?Un(g,c,a.direction):0;return(0,K.jsx)(`span`,{style:{transform:`var(--radix-slider-thumb-transform)`,position:`absolute`,[a.startEdge]:`calc(${c}% + ${_}px)`},children:(0,K.jsx)(pn.ItemSlot,{scope:n,children:(0,K.jsx)(d.span,{role:`slider`,"aria-label":e[`aria-label`]||h,"aria-valuemin":i.min,"aria-valuenow":s,"aria-valuemax":i.max,"aria-orientation":i.orientation,"data-orientation":i.orientation,"data-disabled":i.disabled?``:void 0,tabIndex:i.disabled?void 0:0,...r,ref:m,style:s===void 0?{display:`none`}:e.style,onFocus:p(e.onFocus,()=>{i.valueIndexToChangeRef.current=o})})})})},`SliderThumbTrigger`)),In=G.forwardRef(J(function(e,t){let{__scopeSlider:n,name:r,...i}=e;return(0,K.jsx)(Nn,{__scopeSlider:n,name:r,internal_do_not_use_render:({index:e,isFormControl:r})=>(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Fn,{...i,ref:t,__scopeSlider:n}),r?(0,K.jsx)(Rn,{__scopeSlider:n},e):null]})})},`SliderThumb`)),Ln=`SliderBubbleInput`,Rn=G.forwardRef(J(function({__scopeSlider:e,...t},n){let{value:r,name:i,form:a}=jn(Ln,e),o=G.useRef(null),s=u(o,n),c=A(r);return G.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(c!==r&&n){let t=new Event(`input`,{bubbles:!0});n.call(e,r),e.dispatchEvent(t)}},[c,r]),(0,K.jsx)(d.input,{style:{display:`none`},name:i,form:a,...t,ref:s,defaultValue:r})},`SliderBubbleInput`));function zn(e=[],t,n){let r=[...e];return r[n]=t,r.sort((e,t)=>e-t)}J(zn,`getNextSortedValues`);function Bn(e,t,n){let r=100/(n-t)*(e-t);return te(r,[0,100])}J(Bn,`convertValueToPercentage`);function Vn(e,t){if(t>2)return`Value ${e+1} of ${t}`;if(t===2)return[`Minimum`,`Maximum`][e]}J(Vn,`getLabel`);function Hn(e,t){if(e.length===1)return 0;let n=e.map(e=>Math.abs(e-t)),r=Math.min(...n);return n.indexOf(r)}J(Hn,`getClosestValueIndex`);function Un(e,t,n){let r=e/2;return(r-Kn([0,50],[0,r])(t)*n)*n}J(Un,`getThumbInBoundsOffset`);function Wn(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}J(Wn,`getStepsBetweenValues`);function Gn(e,t){if(t>0){let n=Wn(e);return Math.min(...n)>=t}return!0}J(Gn,`hasMinStepsBetweenValues`);function Kn(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}J(Kn,`linearScale`);function qn(e){if(!Number.isFinite(e))return 0;let t=e.toString();if(t.includes(`e`)){let[e,n]=t.split(`e`),r=e.split(`.`)[1]||``,i=Number(n);return Math.max(0,r.length-i)}let n=t.split(`.`)[1];return n?n.length:0}J(qn,`getDecimalCount`);function Jn(e,t){let n=10**t;return Math.round(e*n)/n}J(Jn,`roundValue`);function Yn(e,{min:t,step:n,direction:r,multiplier:i}){let a=qn(n),o=(e-t)/n,s=Math.round(o),c=Jn(s*n+t,a)===Jn(e,a),l;return l=c?s+i*r:r>0?Math.ceil(o):Math.floor(o),Jn(l*n+t,a)}J(Yn,`getNextStepValue`);function Xn(e){return typeof e==`function`}J(Xn,`isFunction`);var Zn=L(`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`}]]),Qn=L(`blend`,[[`circle`,{cx:`9`,cy:`9`,r:`7`,key:`p2h5vp`}],[`circle`,{cx:`15`,cy:`15`,r:`7`,key:`19ennj`}]]),$n=L(`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`}]]),er=L(`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`}]]),tr=L(`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`}]]),nr=L(`handshake`,[[`path`,{d:`m11 17 2 2a1 1 0 1 0 3-3`,key:`efffak`}],[`path`,{d:`m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4`,key:`9pr0kb`}],[`path`,{d:`m21 3 1 11h-2`,key:`1tisrp`}],[`path`,{d:`M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3`,key:`1uvwmv`}],[`path`,{d:`M3 4h8`,key:`1ep09j`}]]),rr=L(`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`}]]),ir=L(`package-check`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`m16 17 2 2 4-4`,key:`uh5qu3`}],[`path`,{d:`M21 11.127V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.32-.753`,key:`kpkbpo`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]),ar=L(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),or=L(`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`}]]),sr=L(`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`}]]),cr=L(`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`}]]),lr=L(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),ur=L(`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`}]]),dr=L(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),fr=L(`type`,[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]),pr=L(`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`}]]);function mr(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 Y=mt,hr=dt,X=lt;function gr(e){return(0,K.jsx)(pt,{density:`compact`,...e})}var _r=`0.5.64`,vr=`https://ling-kong-ran.github.io/pisper/`,yr=`https://github.com/ling-kong-ran/pisper`,br=`${yr}/blob/release/LICENSE`;function xr({href:e,icon:t,label:n,value:r,onClick:i}){return(0,K.jsxs)(`a`,{className:`group grid min-h-14 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-3 py-3 text-left no-underline`,href:e,target:`_blank`,rel:`noopener noreferrer`,"data-web-preview":`external`,onClick:i,children:[(0,K.jsx)(`span`,{className:`grid size-8 place-items-center rounded-[var(--r-xs)] bg-[var(--surface-muted)] text-[var(--text-muted)] transition-colors group-hover:text-[var(--star-strong)]`,children:(0,K.jsx)(t,{size:16})}),(0,K.jsxs)(`span`,{className:`min-w-0`,children:[(0,K.jsx)(`strong`,{className:`block text-[13px] text-[var(--text)]`,children:n}),(0,K.jsx)(`small`,{className:`mt-0.5 block truncate text-[12px] text-[var(--text-muted)]`,children:r})]}),(0,K.jsx)(Se,{className:`text-[var(--text-muted)] transition-colors group-hover:text-[var(--star-strong)]`,size:14})]})}function Sr({update:e,notify:t}){let{t:n}=c(),r=e.info?.version||_r,i=e=>{mr(e,e.currentTarget.href)?.catch(()=>t(n(`config:aboutSettings.openLinkFailed`),`error`))};return(0,K.jsxs)(`div`,{className:`mx-auto flex w-full flex-col gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-4 px-1 py-3`,children:[(0,K.jsx)(`img`,{className:`size-16 shrink-0 rounded-[14px] shadow-[0_10px_28px_-14px_var(--shadow)]`,src:`/favicon.svg`,alt:`Pisper`}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(`h1`,{className:`text-[22px] font-bold tracking-[0]`,children:`Pisper`}),(0,K.jsxs)(X,{tone:`gray`,children:[`v`,r]})]}),(0,K.jsx)(`p`,{className:`mt-1 text-[13px] leading-5 text-[var(--text-muted)]`,children:n(`config:aboutSettings.description`)})]})]}),(0,K.jsxs)(Y,{className:`p-5`,"data-config-card":`about-project`,children:[(0,K.jsx)(hr,{title:n(`config:aboutSettings.projectInformation`)}),(0,K.jsxs)(`div`,{className:`mt-3 divide-y divide-[var(--stroke-soft)] border-y border-[var(--stroke-soft)]`,children:[(0,K.jsx)(xr,{href:vr,icon:be,label:n(`config:aboutSettings.website`),value:`ling-kong-ran.github.io/pisper`,onClick:i}),(0,K.jsx)(xr,{href:yr,icon:_e,label:n(`config:aboutSettings.sourceCode`),value:`github.com/ling-kong-ran/pisper`,onClick:i}),(0,K.jsx)(xr,{href:br,icon:ke,label:n(`config:aboutSettings.license`),value:`MIT License`,onClick:i})]})]}),(0,K.jsx)(Y,{className:`p-5`,"data-config-card":`about-support`,children:(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4 max-[540px]:flex-col max-[540px]:items-stretch`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(hr,{title:n(`config:aboutSettings.supportPisper`)}),(0,K.jsx)(`p`,{className:`mt-1 max-w-[520px] text-[13px] leading-5 text-[var(--text-muted)]`,children:n(`config:aboutSettings.supportDescription`)})]}),(0,K.jsx)(H,{asChild:!0,size:`lg`,className:`max-[540px]:w-full`,children:(0,K.jsxs)(`a`,{href:yr,target:`_blank`,rel:`noopener noreferrer`,"data-web-preview":`external`,onClick:i,children:[(0,K.jsx)(ur,{size:15}),n(`config:aboutSettings.starOnGitHub`)]})})]})}),(0,K.jsx)(`p`,{className:`px-1 py-2 text-center text-[12px] text-[var(--text-muted)]`,children:n(`config:aboutSettings.copyright`)})]})}function Cr({className:e,defaultValue:t,value:n,min:r=0,max:i=100,...a}){let o=G.useMemo(()=>Array.isArray(n)?n:Array.isArray(t)?t:[r,i],[n,t,r,i]);return(0,K.jsxs)(bn,{"data-slot":`slider`,defaultValue:t,value:n,min:r,max:i,className:I(`relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col`,e),...a,children:[(0,K.jsx)(Dn,{"data-slot":`slider-track`,className:`relative grow overflow-hidden rounded-full bg-muted data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1`,children:(0,K.jsx)(kn,{"data-slot":`slider-range`,className:`absolute bg-primary select-none data-horizontal:h-full data-vertical:w-full`})}),Array.from({length:o.length},(e,t)=>(0,K.jsx)(In,{"data-slot":`slider-thumb`,className:`relative block size-3 shrink-0 rounded-full border border-ring bg-white ring-ring/50 transition-[color,box-shadow] select-none after:absolute after:-inset-2 hover:ring-3 focus-visible:ring-3 focus-visible:outline-hidden active:ring-3 disabled:pointer-events-none disabled:opacity-50`},t))]})}function wr(e){window.dispatchEvent(new CustomEvent(`pisper:desktop-pet-changed`,{detail:e}))}function Tr({notify:e,requestConfirm:t}){let{t:n}=c(),r=window.pisperDesktop,i=(0,G.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:()=>V(`/api/desktop-pet`),setEnabled:e=>V(`/api/desktop-pet/enabled`,{method:`POST`,body:{enabled:e}}),setOpacity:e=>V(`/api/desktop-pet/opacity`,{method:`POST`,body:{opacity:e}}),search:e=>V(`/api/desktop-pet/catalog?query=${encodeURIComponent(e)}`),install:e=>V(`/api/desktop-pet/install`,{method:`POST`,body:{slug:e}}),select:e=>V(`/api/desktop-pet/select`,{method:`POST`,body:{slug:e}}),remove:e=>V(`/api/desktop-pet/${encodeURIComponent(e)}`,{method:`DELETE`}),openCatalog:()=>window.open(`https://petdex.dev`,`_blank`,`noopener,noreferrer`)},[r]),[a,o]=(0,G.useState)(null),[s,l]=(0,G.useState)(``),[u,d]=(0,G.useState)([]),[f,p]=(0,G.useState)(100),[m,h]=(0,G.useState)(``),[g,_]=(0,G.useState)(``),v=(0,G.useCallback)(e=>{o(e),p(Math.round((e.opacity??1)*100))},[]),y=(0,G.useCallback)(async()=>{try{_(``),v(await i.getStatus())}catch(e){_(e instanceof Error?e.message:String(e))}},[v,i]),b=(0,G.useCallback)(async()=>{h(`search`);try{_(``),d(await i.search(s))}catch(e){_(e instanceof Error?e.message:String(e))}finally{h(``)}},[i,s]);(0,G.useEffect)(()=>{y(),i.search(``).then(d).catch(()=>{})},[i,y]);let x=async t=>{let r=a;o(e=>e&&{...e,enabled:t,running:!!(t&&e.installed.length)}),h(`toggle`);try{_(``);let r=await i.setEnabled(t);v(r),wr(r),e(n(t?`config:desktopPetSettings.petEnabled`:`config:desktopPetSettings.petDisabled`))}catch(e){o(r),_(e instanceof Error?e.message:String(e))}finally{h(``)}},S=async e=>{h(`opacity`);try{_(``);let t=await i.setOpacity(e);v(t),wr(t)}catch(e){p(Math.round((a?.opacity??1)*100)),_(e instanceof Error?e.message:String(e))}finally{h(``)}},C=async(t=s)=>{if(t.trim()){h(`install`);try{_(``);let r=await i.install(t);v(r),wr(r),e(n(`config:desktopPetSettings.petInstalled`,{name:r.selectedName||t}))}catch(e){_(e instanceof Error?e.message:String(e))}finally{h(``)}}},w=async t=>{if(t!==a?.selectedSlug){h(`select:${t}`);try{_(``);let r=await i.select(t);v(r),wr(r),e(n(`config:desktopPetSettings.petSelected`,{name:r.selectedName||t}))}catch(e){_(e instanceof Error?e.message:String(e))}finally{h(``)}}},T=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`})){h(`remove:${r.slug}`);try{_(``);let t=await i.remove(r.slug);v(t),wr(t),e(n(`config:desktopPetSettings.petRemoved`,{name:r.name}))}catch(e){_(e instanceof Error?e.message:String(e))}finally{h(``)}}};return(0,K.jsxs)(`div`,{className:`flex flex-col gap-[12px] desktop-pet-settings`,children:[(0,K.jsxs)(Y,{className:`[padding:18px]`,"data-config-card":`desktop-pet-settings`,children:[(0,K.jsxs)(`div`,{className:`language-settings-heading flex items-start gap-[11px] [&_h2]:text-[16px] [&_p]:mt-[4px] [&_p]:text-[var(--text-muted)] [&_p]:text-[13px] [&_p]:leading-[1.55]`,children:[(0,K.jsx)(`span`,{className:`grid w-[38px] h-[38px] [flex:0_0_auto] place-items-center rounded-[11px] bg-[var(--star-soft)] text-[var(--star-strong)]`,children:(0,K.jsx)($n,{size:19})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h2`,{children:n(`config:desktopPetSettings.title`)}),(0,K.jsx)(`p`,{children:n(`config:desktopPetSettings.description`)})]})]}),a?(0,K.jsxs)(`div`,{className:`max-w-1/2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center snotification-option [&_>_div]:flex [&_>_div]:min-w-0 [&_>_div]:flex-col [&_>_div]:gap-1 gap-2.75 mt-4`,children:[(0,K.jsx)($n,{size:18}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`font-bold`,children:n(`config:desktopPetSettings.showOnDesktop`)}),` `,(0,K.jsx)(X,{tone:a.running?`green`:`gray`,children:a.running?n(`config:desktopPetSettings.running`):n(`config:desktopPetSettings.stopped`)})]}),(0,K.jsx)(`span`,{className:`text-xs`,children:a.selectedName?n(`config:desktopPetSettings.currentPet`,{name:a.selectedName}):n(`config:desktopPetSettings.installBeforeEnabling`)})]}),(0,K.jsx)(gr,{value:a.enabled,disabled:!!m||!a.installed.length,onChange:x,ariaLabel:n(`config:desktopPetSettings.showOnDesktop`),className:`ml-4`})]}),a&&(0,K.jsxs)(`div`,{className:`flex items-center snotification-option gap-2.75 mt-4`,children:[(0,K.jsx)(Qn,{size:18}),(0,K.jsxs)(`div`,{className:`flex items-center justify-center gap-2`,children:[(0,K.jsx)(`span`,{className:`font-bold`,children:n(`config:desktopPetSettings.opacity`)}),(0,K.jsxs)(`span`,{className:`text-xs`,children:[f,`%`]})]}),(0,K.jsx)(Cr,{value:[f],min:20,max:100,step:5,disabled:m===`opacity`,onValueChange:([e])=>p(e),onValueCommit:([e])=>void S(e/100),"aria-label":n(`config:desktopPetSettings.opacity`),className:`flex-1 w-auto ml-4`})]})]}):(0,K.jsxs)(st,{className:`[margin-top:15px]`,children:[(0,K.jsx)(z,{className:`animate-spin`,size:16}),(0,K.jsx)(`span`,{children:n(`config:desktopPetSettings.loading`)})]}),g&&(0,K.jsx)(`div`,{className:`text-[var(--danger)] text-[13px] mt-3`,children:g})]}),(0,K.jsxs)(Y,{className:`[padding:18px]`,"data-config-card":`desktop-pet-install`,children:[(0,K.jsxs)(`div`,{className:`language-settings-heading flex items-start gap-[11px] [&_h2]:text-[16px] [&_p]:mt-[4px] [&_p]:text-[var(--text-muted)] [&_p]:text-[13px] [&_p]:leading-[1.55]`,children:[(0,K.jsx)(`span`,{className:`grid w-[38px] h-[38px] [flex:0_0_auto] place-items-center rounded-[11px] bg-[var(--star-soft)] text-[var(--star-strong)]`,children:(0,K.jsx)(ye,{size:19})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h2`,{children:n(`config:desktopPetSettings.installTitle`)}),(0,K.jsx)(`p`,{children:n(`config:desktopPetSettings.installDescription`)})]})]}),(0,K.jsxs)(`div`,{className:`workspace-path-form grid h-[39px] grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-[8px] mt-[16px] [border:1px_solid_var(--stroke)] rounded-[var(--r-sm)] p-[3px_3px_3px_10px] text-[var(--text-muted)] [&_input]:min-w-0 [&_input]:border-0 [&_input]:[outline:0] [&_input]:font-[ui-monospace,_SFMono-Regular,_Consolas,_'Liberation_Mono',_monospace] [&_input]:text-[12px] dark:[&_input]:bg-[var(--solid)] dark:[&_input]:text-[var(--text)] desktop-pet-search !grid-cols-[minmax(0,1fr)_auto] mt-4`,children:[(0,K.jsx)(`input`,{value:s,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&b()},placeholder:n(`config:desktopPetSettings.searchPlaceholder`),"aria-label":n(`config:desktopPetSettings.petSlug`)}),(0,K.jsxs)(H,{size:`lg`,className:`min-w-[104px]`,disabled:m===`search`,onClick:b,children:[m===`search`?(0,K.jsx)(z,{className:`animate-spin`,size:14}):(0,K.jsx)(He,{size:14}),n(`config:desktopPetSettings.search`)]})]}),u.length>0&&(0,K.jsx)(`div`,{className:`language-choice-grid grid grid-cols-4 max-[650px]:grid-cols-1 max-[1300px]:grid-cols-2 gap-2.25 mt-4`,children:u.map(e=>{let t=a?.installed.some(t=>t.slug===e.slug);return(0,K.jsxs)(`button`,{type:`button`,className:`language-choice hover:border-[var(--star)] hover:bg-[var(--accent-soft)] hover:[transform:translateY(-1px)] [&.selected]:border-[var(--star)] [&.selected]:bg-[var(--star-soft)] [&.selected]:shadow-[0_0_0_3px_var(--accent-ring)] grid min-h-[80px] grid-cols-[auto_minmax(0,_1fr)_auto] items-center gap-[10px] [border:1px_solid_var(--stroke)] rounded-[var(--r-sm)] bg-[var(--surface-subtle)] [padding:11px] text-[var(--text)] text-left [transition:border-color_var(--d1)_var(--ease-out),_background_var(--d1)_var(--ease-out),_box-shadow_var(--d1)_var(--ease-out),_transform_var(--d1)_var(--ease-out)]`,disabled:!!m,onClick:()=>t?w(e.slug):C(e.slug),children:[(0,K.jsx)(`span`,{className:`language-choice-mark grid w-[34px] h-[34px] place-items-center rounded-[9px] bg-[var(--solid)] text-[var(--star-strong)] text-[12px] font-[800] tracking-[.03em]`,children:(0,K.jsx)($n,{size:16})}),(0,K.jsxs)(`span`,{className:`language-choice-copy [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[12px] flex min-w-0 flex-col gap-[3px]`,children:[(0,K.jsx)(`strong`,{children:e.displayName}),(0,K.jsx)(`small`,{children:e.slug})]}),(0,K.jsx)(X,{tone:t?`green`:`blue`,children:n(t?`config:desktopPetSettings.installed`:`config:desktopPetSettings.install`)})]},e.slug)})}),(0,K.jsx)(`div`,{className:`mt-[15px] flex gap-2 max-[650px]:flex-wrap`,children:(0,K.jsxs)(H,{variant:`outline`,size:`lg`,className:`bg-surface-subtle`,onClick:i.openCatalog,children:[(0,K.jsx)(Se,{size:14}),n(`config:desktopPetSettings.browsePetdex`)]})})]}),a&&a.installed.length>0&&(0,K.jsxs)(Y,{className:`[padding:18px]`,"data-config-card":`desktop-pet-installed`,children:[(0,K.jsxs)(`div`,{className:`language-settings-heading flex items-start gap-[11px] [&_h2]:text-[16px] [&_p]:mt-[4px] [&_p]:text-[var(--text-muted)] [&_p]:text-[13px] [&_p]:leading-[1.55]`,children:[(0,K.jsx)(`span`,{className:`grid w-[38px] h-[38px] [flex:0_0_auto] place-items-center rounded-[11px] bg-[var(--star-soft)] text-[var(--star-strong)]`,children:(0,K.jsx)($n,{size:19})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h2`,{children:n(`config:desktopPetSettings.installedTitle`)}),(0,K.jsx)(`p`,{children:n(`config:desktopPetSettings.installedDescription`)})]})]}),(0,K.jsx)(`div`,{className:`language-choice-grid max-[650px]:grid-cols-[1fr] grid grid-cols-[repeat(2,_minmax(0,_1fr))] gap-[9px] [margin-top:18px] mt-4`,role:`radiogroup`,children:a.installed.map(e=>{let t=e.slug===a.selectedSlug;return(0,K.jsxs)(`div`,{className:`language-choice hover:border-[var(--star)] hover:bg-[var(--accent-soft)] [&.selected]:border-[var(--star)] [&.selected]:bg-[var(--star-soft)] [&.selected]:shadow-[0_0_0_3px_var(--accent-ring)] grid min-h-[80px] grid-cols-[minmax(0,_1fr)_auto] items-center gap-[4px] [border:1px_solid_var(--stroke)] rounded-[var(--r-sm)] bg-[var(--surface-subtle)] [padding:4px] text-[var(--text)] [transition:border-color_var(--d1)_var(--ease-out),_background_var(--d1)_var(--ease-out),_box-shadow_var(--d1)_var(--ease-out)] ${t?`selected`:``}`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`grid min-h-[70px] grid-cols-[auto_minmax(0,_1fr)_auto] items-center gap-[10px] rounded-[calc(var(--r-sm)-2px)] [padding:7px] text-left outline-none focus-visible:ring-2 focus-visible:ring-[var(--star)] disabled:pointer-events-none disabled:opacity-50 ${e.source===`pisper`?``:`col-span-2`}`,role:`radio`,"aria-checked":t,disabled:!!m,onClick:()=>w(e.slug),children:[(0,K.jsx)(`span`,{className:`language-choice-mark grid w-[34px] h-[34px] place-items-center rounded-[9px] bg-[var(--solid)] text-[var(--star-strong)] text-[12px] font-[800] tracking-[.03em]`,children:(0,K.jsx)($n,{size:16})}),(0,K.jsxs)(`span`,{className:`language-choice-copy [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[12px] flex min-w-0 flex-col gap-[3px]`,children:[(0,K.jsx)(`strong`,{children:e.name}),(0,K.jsx)(`small`,{children:e.slug})]}),(0,K.jsx)(X,{tone:e.source===`pisper`?`blue`:`gray`,children:e.source===`pisper`?`Pisper`:`Petdex`})]}),e.source===`pisper`&&(0,K.jsx)(H,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`text-content-muted hover:text-destructive`,disabled:!!m,onClick:()=>void T(e),"aria-label":n(`config:desktopPetSettings.delete`),title:n(`config:desktopPetSettings.delete`),children:m===`remove:${e.slug}`?(0,K.jsx)(z,{className:`animate-spin`,size:14}):(0,K.jsx)(Je,{size:14})})]},`${e.source}:${e.slug}`)})})]})]})}function Er(e,t){return t(e===`en-US`?`config:languageSettings.english`:`config:languageSettings.simplifiedChinese`)}function Dr({notify:e}){let{language:t,setLanguage:n,t:r}=c(),i=(0,G.useId)(),o=(0,G.useId)(),l=r=>{r!==t&&(n(r),e(s(r===`en-US`?`config:languageSettings.displayLanguageChangedToEnglish`:`config:languageSettings.displayLanguageChangedToSimplifiedChinese`,r)))};return(0,K.jsxs)(Y,{className:`flex flex-row flex-wrap items-center justify-between gap-3 rounded-2xl p-4 shadow-none`,"data-config-card":`interface-language`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1 basis-40`,children:[(0,K.jsx)(`h2`,{id:i,className:`text-base font-medium`,children:r(`config:languageSettings.displayLanguage`)}),(0,K.jsx)(`p`,{id:o,className:`mt-1 text-sm leading-relaxed text-muted-foreground`,children:r(`config:languageSettings.interfaceOnlyHint`)})]}),(0,K.jsxs)(M,{value:t,onValueChange:e=>{let t=a.find(t=>t.value===e);t&&l(t.value)},children:[(0,K.jsx)(k,{"aria-labelledby":i,"aria-describedby":o,className:`min-h-9 min-w-32 shrink-0 rounded-full px-3 max-[650px]:min-h-11`,children:(0,K.jsx)(N,{})}),(0,K.jsx)(ee,{position:`popper`,align:`end`,className:`p-1`,children:a.map(e=>(0,K.jsx)(j,{value:e.value,className:`min-h-9 px-3 pr-8 max-[650px]:min-h-11`,children:Er(e.value,r)},e.value))})]})]})}function Or({className:e,...t}){return(0,K.jsx)(en,{"data-slot":`radio-group`,className:I(`grid w-full gap-2`,e),...t})}function kr({className:e,...t}){return(0,K.jsx)(on,{"data-slot":`radio-group-option`,className:I(`outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`,e),...t})}function Ar({title:e,description:t}){return(0,K.jsx)(`div`,{className:`flex items-start gap-[11px] [&_h2]:text-[16px] [&_p]:mt-1 [&_p]:text-[13px] [&_p]:leading-[1.55] [&_p]:text-[var(--text-muted)]`,children:(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h2`,{children:e}),(0,K.jsx)(`p`,{children:t})]})})}function jr({label:e,options:t,value:n,onChange:r,className:i,preview:a=!1}){return(0,K.jsx)(Or,{value:n,onValueChange:e=>{let n=t.find(t=>t.value===e);n&&r(n.value)},className:I(a?`flex w-auto flex-wrap justify-end gap-3`:`mt-4 grid grid-cols-4 gap-2 max-[650px]:grid-cols-1 max-[1300px]:grid-cols-2`,i),"aria-label":e,children:t.map(e=>{let t=e.value===n,r=e.icon;return a?(0,K.jsxs)(kr,{type:`button`,value:e.value,"aria-label":`${e.label} ${e.description}`,title:e.description,className:I(`group flex w-20 flex-col items-center gap-1.5 rounded-xl p-1 text-xs text-muted-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring`,t&&`text-foreground`),children:[(0,K.jsxs)(`span`,{"aria-hidden":`true`,className:I(`relative block h-14 w-full overflow-hidden rounded-lg border-2 border-border bg-[#f0f0f0] p-1 transition group-hover:border-ring/50`,t&&`border-ring`),children:[(0,K.jsxs)(`span`,{className:`absolute inset-1 rounded border border-black/10 bg-white shadow-sm`,children:[(0,K.jsx)(`span`,{className:`absolute inset-y-0 left-0 w-3 border-r border-black/10 bg-[#f5f5f5]`}),(0,K.jsx)(`span`,{className:`absolute top-2 right-1 h-0.5 w-6 rounded bg-ring`}),(0,K.jsx)(`span`,{className:`absolute top-4 left-4 h-0.5 w-7 rounded bg-black/15`}),(0,K.jsx)(`span`,{className:`absolute top-6 left-4 h-0.5 w-5 rounded bg-black/15`}),(0,K.jsx)(`span`,{className:`absolute right-1 bottom-1 left-4 h-2 rounded-full border border-black/10`})]}),e.value!==`light`&&(0,K.jsxs)(`span`,{className:I(`absolute inset-1 overflow-hidden rounded bg-[#0f0f0f]`,e.value!==`dark`&&`left-1/2 rounded-l-none`),children:[(0,K.jsx)(`span`,{className:`absolute top-2 right-1 h-0.5 w-6 rounded bg-ring`}),(0,K.jsx)(`span`,{className:`absolute top-4 right-1 h-0.5 w-7 rounded bg-white/25`}),(0,K.jsx)(`span`,{className:`absolute top-6 right-3 h-0.5 w-5 rounded bg-white/25`}),(0,K.jsx)(`span`,{className:`absolute right-1 bottom-1 left-1 h-2 rounded-full border border-white/25`})]}),e.value===`scheduled`&&(0,K.jsx)(ge,{className:`absolute top-1 left-1 size-3 text-black`})]}),(0,K.jsx)(`span`,{children:e.label})]},e.value):(0,K.jsxs)(kr,{type:`button`,className:`grid min-h-[72px] grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2.5 rounded-[var(--r-sm)] border p-2.5 text-left transition hover:border-[var(--star)] hover:bg-[var(--accent-soft)] ${t?`border-[var(--star)] bg-[var(--star-soft)] `:`border-[var(--stroke)] bg-[var(--surface-subtle)]`}`,value:e.value,children:[(0,K.jsx)(`span`,{className:`grid size-8 place-items-center rounded-[var(--r-xs)] bg-[var(--solid)] text-[var(--star-strong)]`,children:(0,K.jsx)(r,{size:16})}),(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,K.jsx)(`strong`,{className:`text-[13px]`,children:e.label}),(0,K.jsx)(`small`,{className:`text-[var(--text-muted)]`,children:e.description})]}),t&&(0,K.jsx)(`span`,{className:`grid size-5 place-items-center rounded-full bg-[var(--star)] text-[var(--on-accent)]`,children:(0,K.jsx)(fe,{size:13})})]},e.value)})})}function Mr({label:e,options:t,value:n,onChange:r}){return(0,K.jsx)(Or,{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-1 rounded-[var(--r-sm)] bg-[var(--surface-muted)] p-1`,"aria-label":e,children:t.map(e=>(0,K.jsx)(kr,{type:`button`,className:`min-h-9 max-[650px]:min-h-11 rounded-lg px-2 text-sm font-normal transition ${e.value===n?`bg-[var(--solid)] text-[var(--text)] shadow-sm`:`text-[var(--text-muted)] hover:text-[var(--text)]`}`,value:e.value,children:e.label},e.value))})}var Nr={neutral:`#18181b`,blue:`#1677e8`,teal:`#0f766e`,violet:`#7557c8`,coral:`#c94f5d`,custom:`#1677e8`};function Pr({notify:e}){let{t}=c(),n=W(e=>e.theme),r=W(e=>e.density),i=W(e=>e.accent),a=W(e=>e.customAccent),o=W(e=>e.fontScale),s=W(e=>e.radius),l=W(e=>e.motion),u=W(e=>e.setTheme),d=W(e=>e.setDensity),f=W(e=>e.setAccent),p=W(e=>e.setCustomAccent),m=W(e=>e.setFontScale),h=W(e=>e.setRadius),g=W(e=>e.setMotion),_=W(e=>e.resetAppearance),v=n!==St.theme||r!==St.density||i!==St.accent||a!==St.customAccent||o!==St.fontScale||s!==St.radius||l!==St.motion,[y,b]=(0,G.useState)(a);(0,G.useEffect)(()=>b(a),[a]);let x=Ee(y),S=!!y.trim()&&!x,C=e=>{b(e);let t=Ee(e);t&&T(p)(t)},w=()=>e(t(`config:interfaceSettings.preferencesUpdated`)),T=e=>t=>{e(t),w()},E=[{value:`system`,label:t(`config:interfaceSettings.followSystem`),description:t(`config:interfaceSettings.followSystemDescription`),icon:Ie},{value:`scheduled`,label:t(`config:interfaceSettings.automaticByTime`),description:t(`config:interfaceSettings.automaticByTimeDescription`),icon:ge},{value:`light`,label:t(`config:interfaceSettings.light`),description:t(`config:interfaceSettings.lightDescription`),icon:Le},{value:`dark`,label:t(`config:interfaceSettings.dark`),description:t(`config:interfaceSettings.darkDescription`),icon:Fe}],D=[{value:`comfortable`,label:t(`config:interfaceSettings.comfortable`),description:t(`config:interfaceSettings.comfortableDescription`),icon:pr},{value:`compact`,label:t(`config:interfaceSettings.compact`),description:t(`config:interfaceSettings.compactDescription`),icon:tr}],O=[{value:`system`,label:t(`config:interfaceSettings.motionSystem`),description:t(`config:interfaceSettings.motionSystemDescription`),icon:Ie},{value:`full`,label:t(`config:interfaceSettings.motionFull`),description:t(`config:interfaceSettings.motionFullDescription`),icon:Ke},{value:`reduced`,label:t(`config:interfaceSettings.motionReduced`),description:t(`config:interfaceSettings.motionReducedDescription`),icon:re}],A=[{value:`neutral`,label:t(`config:interfaceSettings.accentNeutral`)},{value:`blue`,label:t(`config:interfaceSettings.accentBlue`)},{value:`teal`,label:t(`config:interfaceSettings.accentTeal`)},{value:`violet`,label:t(`config:interfaceSettings.accentViolet`)},{value:`coral`,label:t(`config:interfaceSettings.accentCoral`)},{value:`custom`,label:t(`config:interfaceSettings.accentCustom`)}],te=[{value:`small`,label:t(`config:interfaceSettings.small`)},{value:`default`,label:t(`config:interfaceSettings.standard`)},{value:`large`,label:t(`config:interfaceSettings.large`)}],P=[{value:`sharp`,label:t(`config:interfaceSettings.sharp`)},{value:`default`,label:t(`config:interfaceSettings.standard`)},{value:`soft`,label:t(`config:interfaceSettings.soft`)}];return(0,K.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,K.jsxs)(Y,{className:`border-0 bg-transparent p-0 shadow-none ring-0`,"data-config-card":`interface-appearance`,children:[(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-4 max-[650px]:flex-col`,children:[(0,K.jsx)(Ar,{title:t(`config:interfaceSettings.visualStyle`),description:t(`config:interfaceSettings.appearanceDescription`)}),(0,K.jsxs)(H,{type:`button`,variant:`outline`,size:`sm`,disabled:!v,onClick:()=>{_(),e(t(`config:interfaceSettings.defaultsRestored`))},children:[(0,K.jsx)(Be,{size:14}),t(`config:interfaceSettings.restoreDefaults`)]})]}),(0,K.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center justify-between gap-4 rounded-2xl border border-border p-4`,children:[(0,K.jsx)(`span`,{className:`text-sm font-medium`,children:t(`config:interfaceSettings.colorMode`)}),(0,K.jsx)(jr,{label:t(`config:interfaceSettings.colorMode`),options:E,value:n,onChange:T(u),preview:!0})]}),(0,K.jsxs)(`div`,{className:`mt-4 rounded-2xl border border-border p-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-foreground`,children:[(0,K.jsx)(ar,{size:15}),t(`config:interfaceSettings.accentColor`)]}),(0,K.jsx)(`p`,{className:`mt-1 text-xs text-content-muted`,children:t(`config:interfaceSettings.accentDescription`)})]}),(0,K.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-3`,children:(0,K.jsxs)(M,{value:i,onValueChange:e=>{let t=A.find(t=>t.value===e);t&&T(f)(t.value)},children:[(0,K.jsx)(k,{"aria-label":t(`config:interfaceSettings.accentColor`),className:`min-h-9 rounded-full max-[650px]:min-h-11`,children:(0,K.jsx)(N,{})}),(0,K.jsx)(ee,{position:`popper`,className:`rounded-xl`,children:A.map(e=>(0,K.jsxs)(j,{value:e.value,className:`min-h-9 max-[650px]:min-h-11`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`size-3.5 rounded-full border border-black/10`,style:{backgroundColor:e.value===`custom`?a:Nr[e.value]}}),e.label]},e.value))})]})})]}),i===`custom`&&(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-end gap-3`,children:[(0,K.jsx)(`input`,{type:`color`,value:Ee(a)||`#1677e8`,onChange:e=>T(p)(e.target.value),"aria-label":t(`config:interfaceSettings.customAccentColor`),className:`h-9 w-14 cursor-pointer rounded-[var(--r-xs)] border border-[var(--stroke)] bg-[var(--solid)] p-1`}),(0,K.jsx)(`input`,{type:`text`,value:y,onChange:e=>C(e.target.value),spellCheck:!1,"aria-invalid":S,"aria-describedby":`custom-accent-hint`,"aria-label":t(`config:interfaceSettings.customAccentHex`),className:`h-9 w-[116px] rounded-[var(--r-xs)] border bg-[var(--solid)] px-2.5 font-mono text-[12.5px] text-[var(--text)] ${S?`border-[var(--danger)]`:`border-[var(--stroke)]`}`}),(0,K.jsx)(`span`,{id:`custom-accent-hint`,className:`text-[12px] ${S?`text-[var(--danger)]`:`text-[var(--text-muted)]`}`,children:t(S?`config:interfaceSettings.invalidAccentColor`:`config:interfaceSettings.customAccentHint`)})]})]})]}),(0,K.jsxs)(`details`,{className:`group/advanced`,children:[(0,K.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center justify-between rounded-lg px-1 text-sm font-medium text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring [&::-webkit-details-marker]:hidden`,children:[t(`config:interfaceSettings.advanced`),(0,K.jsx)(pe,{"aria-hidden":`true`,size:16,className:`transition-transform group-open/advanced:rotate-180`})]}),(0,K.jsxs)(`div`,{className:`mt-3 flex flex-col gap-4`,children:[(0,K.jsxs)(`div`,{"data-config-card":`interface-style`,className:`grid grid-cols-[minmax(0,1fr)_minmax(240px,.72fr)] gap-4 rounded-2xl border border-border p-4 max-[900px]:grid-cols-1`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-foreground`,children:[(0,K.jsx)(fr,{size:15}),t(`config:interfaceSettings.interfaceStyle`)]}),(0,K.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3 max-[470px]:grid-cols-1`,children:[(0,K.jsxs)(`div`,{className:`grid content-start gap-1.5`,children:[(0,K.jsx)(`span`,{className:`text-[12px] text-[var(--text-muted)]`,children:t(`config:interfaceSettings.fontSize`)}),(0,K.jsx)(Mr,{label:t(`config:interfaceSettings.fontSize`),options:te,value:o,onChange:T(m)}),(0,K.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:t(`config:interfaceSettings.fontScaleHint`)})]}),(0,K.jsxs)(`div`,{className:`grid content-start gap-1.5`,children:[(0,K.jsx)(`span`,{className:`text-[12px] text-[var(--text-muted)]`,children:t(`config:interfaceSettings.cornerStyle`)}),(0,K.jsx)(Mr,{label:t(`config:interfaceSettings.cornerStyle`),options:P,value:s,onChange:T(h)})]})]})]}),(0,K.jsxs)(`div`,{className:`overflow-hidden rounded-[var(--r-md)] border border-[var(--stroke)] bg-[var(--main-surface-bg)] shadow-[var(--sh-surface)]`,"aria-label":t(`config:interfaceSettings.livePreview`),children:[(0,K.jsxs)(`div`,{className:`flex h-8 items-center gap-1.5 border-b border-[var(--stroke)] bg-[var(--surface-subtle)] px-3`,children:[(0,K.jsx)(`span`,{className:`size-1.5 rounded-full bg-[var(--brand-blue)]`}),(0,K.jsx)(`span`,{className:`text-[11px] font-bold text-[var(--text-muted)]`,children:t(`config:interfaceSettings.livePreview`)})]}),(0,K.jsxs)(`div`,{className:`grid gap-2.5 p-3`,children:[(0,K.jsx)(`div`,{className:`mr-7 rounded-[var(--r-sm)] bg-transparent p-2 text-[var(--app-font-size)] text-[var(--text)]`,children:t(`config:interfaceSettings.previewAgentMessage`)}),(0,K.jsx)(`div`,{className:`ml-7 rounded-[var(--r-sm)] bg-[var(--user-bubble-bg)] p-2 text-[var(--app-font-size)] text-[var(--user-bubble-text)]`,children:t(`config:interfaceSettings.previewUserMessage`)}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`h-1.5 flex-1 overflow-hidden rounded-full bg-[var(--surface-muted)]`,children:(0,K.jsx)(`span`,{className:`block h-full w-2/3 rounded-full bg-[var(--brand-blue)]`})}),(0,K.jsx)(`span`,{className:`text-[11px] text-[var(--text-muted)]`,children:`67%`})]})]})]})]}),(0,K.jsxs)(Y,{className:`rounded-2xl p-4 shadow-none`,"data-config-card":`interface-motion`,children:[(0,K.jsx)(Ar,{title:t(`config:interfaceSettings.displayAndMotion`),description:t(`config:interfaceSettings.displayAndMotionDescription`)}),(0,K.jsxs)(`div`,{className:`mt-4 flex flex-col divide-y divide-border`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 py-3`,children:[(0,K.jsx)(`div`,{className:`text-sm font-medium`,children:t(`config:interfaceSettings.interfaceDensity`)}),(0,K.jsx)(Mr,{label:t(`config:interfaceSettings.interfaceDensity`),options:D,value:r,onChange:T(d)})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 py-3`,children:[(0,K.jsx)(`div`,{className:`text-sm font-medium`,children:t(`config:interfaceSettings.motion`)}),(0,K.jsx)(Mr,{label:t(`config:interfaceSettings.motion`),options:O,value:l,onChange:T(g)})]})]})]})]})]}),(0,K.jsx)(Dr,{notify:e})]})}var Fr=[`voiceInput`,`sendMessage`,`commandPalette`,`primaryAction`],Ir=vt.filter(e=>!Fr.includes(e));function Lr({requestConfirm:e}){let{t}=c(),n=yt(e=>e.bindings),r=yt(e=>e.setBinding),i=yt(e=>e.resetBindings),[a,o]=(0,G.useState)(null),[s,l]=(0,G.useState)(null),[u,d]=(0,G.useState)(!1),f={commandPalette:t(`config:shortcuts.commandPalette`),primaryAction:t(`config:shortcuts.primaryAction`),focusSearch:t(`config:shortcuts.focusSearch`),toggleSidebar:t(`config:shortcuts.toggleSidebar`),toggleTerminal:t(`config:shortcuts.toggleTerminal`),openSettings:t(`config:shortcuts.openSettings`),focusComposer:t(`config:shortcuts.focusComposer`),sendMessage:t(`config:shortcuts.sendMessage`),voiceInput:t(`config:shortcuts.voiceInput`)},p=(e,i)=>{d(!1);let a=xt(n,e,i);if(a){l({action:e,message:t(`config:shortcuts.conflict`,{action:f[a]})});return}try{_t({...n,[e]:i})}catch{l({action:e,message:t(`config:shortcuts.invalid`)});return}try{r(e,i),o(null),l(null),d(!0)}catch{l({action:e,message:t(`config:shortcuts.saveFailed`)})}},m=(e,n)=>{if(a!==n)return;if(e.key===`Tab`){o(null);return}let r=ht(e.nativeEvent);if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){o(null),l(null);return}r?p(n,r):!e.nativeEvent.isComposing&&e.keyCode!==229&&!e.repeat&&![`Control`,`Meta`,`Alt`,`Shift`,`AltGraph`,`Dead`,`Process`].includes(e.key)&&l({action:n,message:t(`config:shortcuts.invalid`)})},h=async()=>{if(o(null),await e({title:t(`config:shortcuts.resetAll`),message:t(`config:shortcuts.resetConfirm`),confirmLabel:t(`config:shortcuts.resetAll`)}))try{i(),l(null),d(!0)}catch{l({action:null,message:t(`config:shortcuts.saveFailed`)})}},g=vt.some(e=>n[e]!==gt[e]),_=e=>(0,K.jsxs)(`div`,{className:`py-3`,"data-shortcut-action":e,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-x-5 gap-y-2`,children:[(0,K.jsx)(`label`,{htmlFor:`shortcut-${e}`,className:`min-w-0 text-sm font-medium`,children:f[e]}),(0,K.jsxs)(`div`,{className:`flex min-w-0 max-w-full items-center gap-1`,children:[(0,K.jsx)(H,{id:`shortcut-${e}`,"data-shortcut-recorder":!0,variant:`outline`,className:`h-9 w-44 min-w-0 justify-center gap-2 px-2.5 text-xs max-[400px]:w-40`,"aria-label":t(`config:shortcuts.edit`,{action:f[e]}),"aria-pressed":a===e,"aria-describedby":s?.action===e?`shortcut-error-${e}`:void 0,onClick:()=>{o(e),l(null),d(!1)},onBlur:()=>o(t=>t===e?null:t),onKeyDown:t=>m(t,e),children:(0,K.jsx)(`span`,{className:`min-w-0 whitespace-normal break-words text-left`,children:a===e?t(`config:shortcuts.recording`):bt(n[e])||t(`config:shortcuts.disabled`)})}),(0,K.jsxs)(D,{children:[(0,K.jsx)(w,{asChild:!0,children:(0,K.jsx)(H,{variant:`ghost`,size:`icon`,title:t(`config:shortcuts.options`,{action:f[e]}),"aria-label":t(`config:shortcuts.options`,{action:f[e]}),children:(0,K.jsx)(xe,{className:`size-4`})})}),(0,K.jsxs)(T,{align:`end`,className:`w-40`,onCloseAutoFocus:e=>{document.activeElement?.hasAttribute(`data-shortcut-recorder`)&&e.preventDefault()},children:[(0,K.jsxs)(E,{disabled:n[e]===null,onSelect:()=>p(e,null),children:[(0,K.jsx)(Qe,{className:`size-4`}),t(`config:shortcuts.disableKey`)]}),(0,K.jsxs)(E,{disabled:n[e]===gt[e],onSelect:()=>p(e,gt[e]),children:[(0,K.jsx)(Be,{className:`size-4`}),t(`config:shortcuts.resetAll`)]})]})]})]})]}),s?.action===e&&(0,K.jsx)(`p`,{id:`shortcut-error-${e}`,role:`alert`,className:`mt-2 text-sm text-destructive`,children:s.message})]},e);return(0,K.jsxs)(`section`,{className:`w-full min-w-0`,"data-config-card":`shortcuts-bindings`,children:[(0,K.jsxs)(`div`,{className:`mb-5 flex items-center justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(De,{className:`size-5 text-muted-foreground`,"aria-hidden":`true`}),(0,K.jsx)(`h2`,{className:`text-base font-semibold`,children:t(`config:configPage.shortcuts`)})]}),(0,K.jsx)(H,{variant:`ghost`,size:`icon`,disabled:!g,title:t(`config:shortcuts.resetAll`),"aria-label":t(`config:shortcuts.resetAll`),onClick:()=>void h(),children:(0,K.jsx)(Be,{className:`size-4`})})]}),(0,K.jsx)(`div`,{className:`divide-y divide-border border-y border-border`,children:Fr.map(_)}),(0,K.jsxs)(`details`,{className:`group mt-3`,onToggle:()=>o(null),children:[(0,K.jsxs)(`summary`,{className:`flex w-fit cursor-pointer list-none items-center gap-1.5 py-2 text-sm text-muted-foreground hover:text-foreground [&::-webkit-details-marker]:hidden`,children:[(0,K.jsx)(pe,{className:`size-4 transition-transform group-open:rotate-180`}),t(`config:shortcuts.more`)]}),(0,K.jsx)(`div`,{className:`divide-y divide-border border-b border-border`,children:Ir.map(_)})]}),(0,K.jsx)(`div`,{className:`mt-3 min-h-5 text-xs text-muted-foreground`,role:`status`,"aria-live":`polite`,children:s?.action===null?(0,K.jsx)(`span`,{className:`text-destructive`,children:s.message}):t(u?`config:shortcuts.saved`:`config:shortcuts.deviceScope`)})]})}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`});var Rr=[[`openai-responses`,`OpenAI Responses`],[`openai-completions`,`OpenAI Chat Completions`],[`anthropic-messages`,`Anthropic Messages`],[`google-generative-ai`,`Google Generative AI`]],zr={openai:ue,"openai-codex":ue,anthropic:de,google:Ke,deepseek:_e,xai:ce,openrouter:se,"kimi-coding":Ke,"zai-coding-cn":de},Br={deleteModel(e,t){return V(`/api/providers/`+encodeURIComponent(e)+`/models`,{method:`DELETE`,body:JSON.stringify({modelId:t})})},saveModel(e,t,n=!1){return V(`/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 V(`/api/providers/`+encodeURIComponent(e)+`/connection`,{method:`PUT`,body:JSON.stringify(t)})},importLocal(){return V(`/api/providers/import-local`,{method:`POST`,body:`{}`})}};function Vr({provider:e,onSave:t,draft:n,onDraftChange:r,onSavingChange:i}){let{t:a}=c(),[o,s]=(0,G.useState)(!1),[l,u]=(0,G.useState)(``),d=n.name!==e.name||n.api!==e.api||n.baseUrl!==(e.baseUrl||``)||!!n.apiKey,f=async a=>{if(a.preventDefault(),!o){s(!0),i(!0),u(``);try{t(await Br.saveConnection(e.id,{...n,apiKey:n.apiKey.trim()||void 0})),r(void 0)}catch(e){u(e instanceof Error?e.message:String(e))}finally{s(!1),i(!1)}}};return(0,K.jsxs)(`form`,{onSubmit:e=>void f(e),className:`space-y-4`,"data-provider-connection-editor":!0,children:[(0,K.jsxs)(`fieldset`,{disabled:o,className:`grid gap-4`,children:[(0,K.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[a(`config:configPage.displayName`),(0,K.jsx)(at,{required:!0,value:n.name,onChange:e=>r({...n,name:e.target.value})})]}),(0,K.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[a(`config:configPage.apiKey`),(0,K.jsx)(at,{type:`password`,autoComplete:`new-password`,value:n.apiKey,placeholder:e.configured?a(`config:configPage.leaveBlankToKeepExistingKey`):a(`config:configPage.enterTheProviderAPIKey`),onChange:e=>r({...n,apiKey:e.target.value})})]}),(0,K.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-[minmax(0,1fr)_minmax(0,1.8fr)]`,children:[(0,K.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[a(`config:configPage.apiProtocol`),(0,K.jsx)(P,{value:n.api,onChange:e=>r({...n,api:e.target.value}),children:Rr.map(([e,t])=>(0,K.jsx)(`option`,{value:e,children:t},e))})]}),(0,K.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[`Base URL`,(0,K.jsx)(at,{required:!0,type:`url`,value:n.baseUrl,onChange:e=>r({...n,baseUrl:e.target.value})})]})]})]}),l&&(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:l}),d&&(0,K.jsx)(`div`,{className:`flex justify-end`,children:(0,K.jsxs)(H,{type:`submit`,size:`sm`,disabled:o,children:[o&&(0,K.jsx)(Ne,{size:14,className:`animate-spin`}),a(o?`config:configPage.saving`:`config:configPage.saveChanges`)]})})]})}var Hr=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`];function Ur({label:e,checked:t,disabled:n,onChange:r}){return(0,K.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":t,disabled:n,onClick:r,className:I(`inline-flex h-9 items-center gap-2 rounded-lg border px-3 text-sm transition-colors disabled:opacity-50`,t?`border-foreground/30 bg-muted text-foreground`:`border-border hover:bg-muted/60`),children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:I(`grid size-3.5 place-items-center rounded-[3px] border`,t&&`border-primary bg-primary text-primary-foreground`),children:t&&(0,K.jsx)(fe,{size:11})}),e]})}function Wr({provider:e,model:t,onSave:n,onClose:r}){let{t:i}=c(),[a,o]=(0,G.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,contextWindow:t?.contextWindow||2e5,maxTokens:t?.maxTokens||8192})),[s,l]=(0,G.useState)(t?.thinkingLevels||[`off`,`low`,`medium`,`high`]),[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(!1),[m,h]=(0,G.useState)(``),g=a.capabilities.includes(`chat`),_=async i=>{if(i.preventDefault(),!f){p(!0),h(``);try{n(await Br.saveModel(e.id,{...a,modelId:a.modelId.trim(),thinkingLevels:u||!t?s:void 0},!t)),r()}catch(e){h(e instanceof Error?e.message:String(e))}finally{p(!1)}}};return(0,K.jsx)(it,{open:!0,onOpenChange:e=>{!e&&!f&&r()},children:(0,K.jsxs)(nt,{className:`sm:max-w-[540px] p-5`,showCloseButton:!f,onEscapeKeyDown:e=>{f&&e.preventDefault()},onInteractOutside:e=>e.preventDefault(),children:[(0,K.jsxs)(tt,{children:[(0,K.jsx)(rt,{children:i(t?`providers:modelEditor.edit`:`providers:modelEditor.add`)}),(0,K.jsxs)(et,{children:[e.name,` · `,i(`providers:modelEditor.description`)]})]}),(0,K.jsxs)(`form`,{onSubmit:e=>void _(e),className:`space-y-5`,children:[(0,K.jsxs)(`fieldset`,{disabled:f,className:`space-y-5`,children:[(0,K.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,K.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[i(`providers:modelEditor.id`),(0,K.jsx)(at,{required:!0,disabled:!!t,value:a.modelId,onChange:e=>o({...a,modelId:e.target.value})})]}),(0,K.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[i(`config:configPage.modelName`),(0,K.jsx)(at,{value:a.name,onChange:e=>o({...a,name:e.target.value})})]})]}),(0,K.jsxs)(`fieldset`,{className:`space-y-2`,children:[(0,K.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:i(`providers:modelEditor.capabilities`)}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[`chat`,`image`,`video`].map(e=>(0,K.jsx)(Ur,{label:i(e===`chat`?`providers:modelEditor.chat`:e===`image`?`providers:modelEditor.image`:`providers:modelEditor.video`),checked:a.capabilities.includes(e),onChange:()=>o({...a,capabilities:a.capabilities.includes(e)?a.capabilities.filter(t=>t!==e):[...a.capabilities,e]})},e))}),(0,K.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:i(`providers:modelEditor.capabilitiesHint`)})]}),g&&(0,K.jsxs)(`fieldset`,{className:`space-y-2`,children:[(0,K.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:i(`providers:modelEditor.chatCapabilities`)}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(Ur,{label:i(`providers:modelEditor.vision`),checked:a.input.includes(`image`),onChange:()=>o({...a,input:a.input.includes(`image`)?[`text`]:[`text`,`image`]})}),(0,K.jsx)(Ur,{label:i(`providers:modelEditor.reasoning`),checked:a.reasoning,onChange:()=>o({...a,reasoning:!a.reasoning})})]})]}),g&&a.reasoning&&(0,K.jsxs)(`fieldset`,{children:[(0,K.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:i(`config:configPage.modelThinkingLevels`)}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Hr.map(e=>(0,K.jsx)(Ur,{label:e,checked:e===`off`||s.includes(e),disabled:e===`off`,onChange:()=>{d(!0),l(s.includes(e)?s.filter(t=>t!==e):[...s,e])}},e))})]}),g&&(0,K.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[`contextWindow`,`maxTokens`].map(e=>(0,K.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[i(e===`contextWindow`?`providers:modelEditor.contextWindow`:`providers:modelEditor.maxTokens`),(0,K.jsx)(at,{required:!0,type:`number`,min:1,max:1e8,step:1,value:a[e],onChange:t=>o({...a,[e]:Number(t.target.value)})})]},e))})]}),m&&(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:m}),(0,K.jsxs)($e,{children:[(0,K.jsx)(H,{type:`button`,variant:`ghost`,disabled:f,onClick:r,children:i(`config:configPage.cancel`)}),(0,K.jsxs)(H,{type:`submit`,disabled:f||!a.capabilities.length||!a.modelId.trim(),children:[f&&(0,K.jsx)(Ne,{className:`animate-spin`,size:14}),` `,i(f?`config:configPage.saving`:`config:configPage.saveChanges`)]})]})]})]})})}function Gr(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 Kr(e){let{t}=c(),n=(0,G.useId)(),{providers:r,selected:i,defaultId:a}=Gr(e.config,e.selectedProviderId),[o,s]=(0,G.useState)({}),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(null),p=i&&zr[i.id]||B,m=r.length>0,h=!!(l||e.settingDefault||e.settingModel||e.toggling||e.deletingModel);return(0,K.jsxs)(`section`,{"data-config-card":`models-connections`,className:`overflow-hidden rounded-xl border border-border bg-card`,children:[(0,K.jsxs)(`div`,{"data-model-provider-split-panel":!0,className:I(`grid grid-cols-1 content-start`,m&&`min-h-[36rem] md:grid-cols-[224px_minmax(0,1fr)]`),children:[m&&(0,K.jsxs)(`nav`,{"aria-label":t(`config:configPage.connections`),className:`min-w-0 border-b border-border p-3 md:border-r md:border-b-0`,children:[(0,K.jsx)(`p`,{className:`mb-2 px-2 text-xs text-muted-foreground`,children:t(`config:configPage.connections`)}),(0,K.jsx)(`div`,{className:`flex gap-1 overflow-x-auto pb-1 md:flex-col md:overflow-x-visible md:pb-0`,children:r.map(r=>{let o=zr[r.id]||B,s=r.id===a;return(0,K.jsxs)(`button`,{type:`button`,title:r.name,"aria-label":r.name,"aria-describedby":s?n:void 0,"aria-current":i?.id===r.id?`true`:void 0,disabled:h,onClick:()=>e.onSelectProvider(r.id),className:I(`flex min-h-11 max-w-64 shrink-0 items-center gap-2.5 rounded-lg border px-3 text-left text-sm md:min-h-10 md:w-full md:px-2`,i?.id===r.id?`border-border bg-muted text-foreground`:`border-transparent text-muted-foreground hover:bg-muted/60 hover:text-foreground`),children:[(0,K.jsx)(o,{size:17,className:`shrink-0`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:r.name}),s&&(0,K.jsx)(F,{id:n,variant:`secondary`,className:`px-1.5`,children:t(`config:providerWorkbench.default`)}),(0,K.jsx)(`span`,{className:I(`size-1.5 shrink-0 rounded-full`,r.configured&&r.enabled?`bg-emerald-500`:`bg-muted-foreground/25`)})]},r.id)})})]}),(0,K.jsx)(`div`,{className:`min-w-0 p-4 sm:p-6`,children:i?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`mb-6 flex min-w-0 items-center gap-3`,children:[(0,K.jsx)(`span`,{className:`grid size-10 shrink-0 place-items-center rounded-xl border border-border`,children:(0,K.jsx)(p,{size:23})}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,K.jsx)(`h2`,{className:`max-w-full truncate text-lg font-semibold`,children:i.name}),i.id===a&&(0,K.jsx)(F,{variant:`secondary`,children:t(`config:providerWorkbench.defaultProvider`)})]}),(0,K.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:i.id})]}),(0,K.jsx)(gr,{value:i.configured&&i.enabled,disabled:!i.configured||h,onChange:()=>void e.onToggle(i,!i.enabled),ariaLabel:t(`config:configPage.providerEnabled`,{name:i.name})}),(0,K.jsxs)(D,{children:[(0,K.jsx)(w,{asChild:!0,children:(0,K.jsx)(H,{variant:`ghost`,size:`icon-sm`,"aria-label":t(`config:providerWorkbench.actions`),children:(0,K.jsx)(xe,{size:16})})}),(0,K.jsxs)(T,{align:`end`,children:[(0,K.jsxs)(E,{disabled:i.id===a||!i.configured||!i.enabled||!i.defaultModel||h,onSelect:()=>void e.onSetDefault(i),children:[(0,K.jsx)(ur,{size:14}),t(`config:configPage.setAsDefaultProvider`)]}),(0,K.jsxs)(E,{disabled:h,onSelect:()=>e.onClone(i),children:[(0,K.jsx)(ve,{size:14}),t(`config:configPage.cloneProvider`)]}),i.custom&&(0,K.jsxs)(E,{className:`text-destructive`,disabled:h,onSelect:()=>void e.onDelete(i),children:[(0,K.jsx)(Je,{size:14}),t(`config:configPage.deleteProvider`)]})]})]})]}),(0,K.jsx)(Vr,{provider:i,draft:o[i.id]??{name:i.name,api:i.api,baseUrl:i.baseUrl||``,apiKey:``},onDraftChange:e=>s(t=>({...t,[i.id]:e})),onSavingChange:u,onSave:e.onSave},i.id),(0,K.jsxs)(`div`,{className:`mt-6 border-t border-border pt-5`,children:[(0,K.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-2`,children:[(0,K.jsxs)(`h3`,{className:`text-sm font-medium`,children:[t(`config:providerWorkbench.models`),` `,(0,K.jsx)(`span`,{className:`ml-1 font-normal text-muted-foreground`,children:i.models.length})]}),(0,K.jsxs)(H,{variant:`ghost`,size:`sm`,disabled:h,onClick:()=>f({provider:i}),children:[(0,K.jsx)(Re,{size:14}),t(`providers:modelEditor.add`)]})]}),(0,K.jsx)(`div`,{className:`space-y-1.5`,children:i.models.map(n=>{let r=n.capabilities||[n.kind];return(0,K.jsxs)(`div`,{"data-provider-model":n.id,className:`flex min-w-0 items-center gap-2 rounded-lg border border-border/70 px-3 py-2.5`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>f({provider:i,model:n}),disabled:h,className:`min-w-0 flex-1 text-left`,"aria-label":t(`providers:modelEditor.editNamed`,{name:n.name||n.id}),children:[(0,K.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:n.name||n.id}),(0,K.jsxs)(`span`,{className:`mt-0.5 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:n.id}),r.includes(`chat`)&&(0,K.jsx)(Pe,{size:12}),` `,r.includes(`image`)&&(0,K.jsx)(we,{size:12}),` `,r.includes(`video`)&&(0,K.jsx)(oe,{size:12}),` `,n.reasoning&&r.includes(`chat`)&&(0,K.jsx)(de,{size:12})]})]}),n.kind===`chat`&&(0,K.jsx)(H,{variant:`ghost`,size:`icon-sm`,"aria-label":t(`config:configPage.providerDefaultModel`)+`: `+n.id,title:t(`config:configPage.providerDefaultModel`),"aria-pressed":i.defaultModel===n.id,disabled:h||!i.configured||i.defaultModel===n.id,onClick:()=>void e.onSetDefaultModel(i,n.id),children:i.defaultModel===n.id?(0,K.jsx)(fe,{size:15}):(0,K.jsx)(ur,{size:15})}),(0,K.jsx)(H,{variant:`ghost`,size:`icon-sm`,"aria-label":t(`providers:modelEditor.optionsNamed`,{name:n.id}),disabled:h,onClick:()=>f({provider:i,model:n}),children:(0,K.jsx)(Ge,{size:14})}),(0,K.jsx)(H,{variant:`ghost`,size:`icon-sm`,disabled:h,"aria-label":t(`providers:modelEditor.deleteNamed`,{name:n.name||n.id}),title:t(`providers:modelEditor.delete`),onClick:()=>void e.onDeleteModel(i,n),children:(0,K.jsx)(Je,{size:14})})]},n.id)})})]})]}):(0,K.jsxs)(`div`,{className:`grid min-h-80 place-content-center gap-4 text-center`,children:[(0,K.jsx)(B,{size:28,className:`mx-auto text-muted-foreground`}),(0,K.jsx)(`p`,{className:`text-sm font-medium`,children:t(`config:providerWorkbench.noConnections`)}),(0,K.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:t(`config:providerWorkbench.addConnectionHint`)})]})})]}),d&&(0,K.jsx)(Wr,{provider:d.provider,model:d.model,onSave:e.onSave,onClose:()=>f(null)})]})}function qr(){let e=globalThis.crypto.getRandomValues(new Uint32Array(4));return`custom-${Array.from(e,e=>e.toString(16).padStart(8,`0`)).join(``)}`}function Jr({value:e,onChange:t,configured:n=!1,cloning:r=!1}){let{t:i}=c();return(0,K.jsxs)(U,{variant:`control`,children:[i(`config:configPage.apiKey`),(0,K.jsx)(`input`,{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 Yr({ids:e,onChange:t,placeholder:n,primaryId:r=``}){let{t:i}=c(),[a,o]=(0,G.useState)(``),s=()=>{let n=a.trim();!n||n===r.trim()||e.includes(n)||(t([...e,n]),o(``))};return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(U,{variant:`control`,children:[i(`config:configPage.manualModelIds`),(0,K.jsxs)(`div`,{className:`flex items-stretch gap-[6px]`,children:[(0,K.jsx)(`input`,{"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,K.jsx)(H,{type:`button`,size:`icon`,className:`h-[31px] w-[31px] flex-none`,"aria-label":i(`config:configPage.manualModelIds`),disabled:!a.trim(),onClick:s,children:(0,K.jsx)(Re,{size:14})})]})]}),e.length>0&&(0,K.jsx)(`div`,{className:`flex flex-col gap-[6px]`,children:e.map(n=>(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-[8px] [border:1px_solid_var(--stroke-soft)] rounded-[var(--r-sm)] bg-[var(--surface-subtle)] p-[6px_10px]`,children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-[13px]`,children:n}),(0,K.jsx)(`button`,{type:`button`,"aria-label":i(`config:configPage.delete`),className:`grid w-[20px] h-[20px] flex-none cursor-pointer place-items-center rounded-full border-0 bg-transparent p-0 text-[var(--text-muted)] hover:bg-[var(--surface-highlight)] hover:text-[var(--text)]`,onClick:()=>t(e.filter(e=>e!==n)),children:(0,K.jsx)(Qe,{size:12})})]},n))}),(0,K.jsx)(`p`,{className:`[margin:0] text-[11px] text-[var(--text-tertiary)]`,children:i(`config:configPage.manualModelIdsHint`)})]})}function Xr(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 Zr({onClose:e,onCreated:t,onConfigChanged:n,initialProviderType:r=`chat`,initialProvider:i,cloneProvider:a,embedded:o=!1}){let{t:s}=c(),l=i||a,u=!!a,d=l?.type||r,f=Xr(l,d),[p,m]=(0,G.useState)(``),h=!!(i||p),[g,_]=(0,G.useState)(()=>({name:a?s(`config:configPage.clonedProviderName`,{name:a.name}):i?.name||``,id:a?qr():i?.id||``,providerType:d,api:i?.api||`openai-responses`,baseUrl:i?.baseUrl||``,model:f?.id||``,modelName:f?.name||``,modelKind:f?.kind===`image`||f?.kind===`video`?f.kind:d===`visual`?`image`:`chat`,reasoning:f?.reasoning!==!1,thinkingLevels:f?.thinkingLevels||[],enabled:i?.enabled??!0})),v=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`],[y,b]=(0,G.useState)(!1),x=e=>{b(!0),_(t=>({...t,thinkingLevels:t.thinkingLevels.includes(e)?t.thinkingLevels.filter(t=>t!==e):[...t.thinkingLevels,e]}))},[S,C]=(0,G.useState)(!1),[w,T]=(0,G.useState)(``),[E,D]=(0,G.useState)(``),O=E.trim()||void 0,[k,A]=(0,G.useState)([]),j=e=>_(t=>({...t,name:e,id:t.id||e.toLowerCase().replace(/[^a-z0-9._-]+/g,`-`).replace(/^-+|-+$/g,``)}));return(0,G.useEffect)(()=>{if(o||S)return;let t=t=>{t.key===`Escape`&&(t.preventDefault(),t.stopPropagation(),e())};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[o,e,S]),(0,K.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)] [backdrop-filter:blur(3px)] [padding:20px] [overscroll-behavior:contain] [animation:fade-in_var(--d1)_var(--ease-out)]`,onMouseDown:t=>!o&&!S&&t.target===t.currentTarget&&e(),children:(0,K.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 !w-[min(430px,100%)] max-h-[calc(100dvh_-_40px)] overflow-y-auto [overscroll-behavior:contain] [border:1px_solid_var(--surface-highlight)] rounded-[var(--r-md)] bg-[var(--solid)] p-[18px] shadow-[0_26px_70px_-25px_var(--shadow-strong)] [animation:modal-in_var(--d2)_var(--ease-out)] max-[650px]:max-h-[calc(100dvh_-_16px)] provider-config-modal !w-[min(620px,100%)]`,onSubmit:async e=>{if(e.preventDefault(),!S){if(!u&&!O&&!i?.configured&&!p){T(s(`config:configPage.enterTheAPIKeyForThisConnection`));return}C(!0),T(``);try{if(a){t(await V(`/api/providers/${encodeURIComponent(a.id)}/clone`,{method:`POST`,body:JSON.stringify({name:g.name,id:g.id,apiKey:O})}));return}let e=h?await V(`/api/config`,{method:`PUT`,body:JSON.stringify({...g,apiKey:O,thinkingLevels:y?g.thinkingLevels:void 0,provider:p||g.id,providerName:g.name,setAsDefault:!1})}):await V(`/api/providers`,{method:`POST`,body:JSON.stringify({...g,apiKey:O,thinkingLevels:y?g.thinkingLevels:void 0})}),r=e.createdProviderId||p||g.id;i||(m(r),_(e=>({...e,id:r})),n?.(e));let o=new Set((i?.models||[]).map(e=>e.id)),s=k.filter(e=>e!==g.model.trim()&&!o.has(e));if(s.length)try{e=await V(`/api/providers/${encodeURIComponent(r)}/models/batch`,{method:`POST`,body:JSON.stringify({models:s.map(e=>({id:e,kind:g.providerType===`visual`?g.modelKind:`chat`}))})})}catch(e){T(e instanceof Error?e.message:String(e));return}t(e)}catch(e){T(e instanceof Error?e.message:String(e))}finally{C(!1)}}},children:[!o&&(0,K.jsxs)(ut,{children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h2`,{children:s(u?`config:configPage.cloneProvider`:h?`config:configPage.editProviderConnection`:`config:configPage.addProviderConnection`)}),!u&&(0,K.jsx)(`p`,{children:s(h?`config:configPage.updateProviderKeyURLAndModelSettings`:`config:configPage.youCanCreateMultipleConnectionsUsingTheSameProtocolEachWithItsOwnKeyAndBaseURL`)})]}),(0,K.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":s(`config:configPage.closeDialog`),disabled:S,onClick:t=>{t.preventDefault(),t.stopPropagation(),e()},children:(0,K.jsx)(Qe,{size:17})})]}),(0,K.jsxs)(`div`,{className:`form-grid grid gap-3 sm:grid-cols-2`,children:[(0,K.jsxs)(U,{variant:`control`,children:[s(`config:configPage.displayName`),(0,K.jsx)(`input`,{value:g.name,onChange:e=>j(e.target.value),placeholder:s(`config:configPage.forExampleOpenAIOfficial`)})]}),(0,K.jsxs)(U,{variant:`control`,children:[`Provider ID`,(0,K.jsx)(`input`,{value:g.id,disabled:h,onChange:e=>_({...g,id:e.target.value}),placeholder:`openai-official`})]})]}),(0,K.jsx)(Jr,{value:E,onChange:D,configured:i?.configured,cloning:u}),!u&&(0,K.jsxs)(K.Fragment,{children:[!o&&(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-[8px] [margin-top:10px] [border:1px_solid_var(--stroke-soft)] rounded-[var(--r-sm)] bg-[var(--surface-subtle)] p-[8px_10px]`,children:[(0,K.jsx)(`span`,{className:`text-[12px] text-[var(--text-muted)]`,children:s(`config:configPage.providerPurpose`)}),(0,K.jsx)(`strong`,{className:`text-[12px]`,children:g.providerType===`visual`?s(`config:configPage.visualProvider`):s(`config:configPage.chatProvider`)})]}),(0,K.jsxs)(U,{variant:`control`,children:[s(`config:configPage.apiProtocol`),(0,K.jsx)(P,{value:g.api,onChange:e=>_({...g,api:e.target.value}),children:Rr.map(([e,t])=>(0,K.jsx)(`option`,{value:e,children:t},e))})]}),(0,K.jsxs)(U,{variant:`control`,children:[`Base URL`,(0,K.jsx)(`input`,{value:g.baseUrl,onChange:e=>_({...g,baseUrl:e.target.value}),placeholder:`https://api.openai.com/v1`})]}),(0,K.jsxs)(`div`,{className:`form-grid grid gap-3 sm:grid-cols-2`,children:[(0,K.jsxs)(U,{variant:`control`,children:[s(h?`config:configPage.providerDefaultModel`:`config:configPage.initialModelID`),(0,K.jsx)(`input`,{value:g.model,onChange:e=>_({...g,model:e.target.value}),placeholder:g.providerType===`visual`?`gpt-image-2 or grok-imagine-video`:`gpt-5.4 or gpt-image-1`})]}),(0,K.jsxs)(U,{variant:`control`,children:[s(`config:configPage.modelName`),(0,K.jsx)(`input`,{value:g.modelName,onChange:e=>_({...g,modelName:e.target.value}),placeholder:s(`config:configPage.leaveBlankToUseTheModelID`)})]})]}),(0,K.jsxs)(`details`,{open:!o||void 0,className:`group rounded-lg border border-border px-3 py-2 [&[open]]:space-y-3`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-[13px] text-muted-foreground`,children:s(`config:providerWorkbench.modelOptions`)}),(0,K.jsxs)(U,{variant:`control`,children:[s(`config:configPage.modelType`),(0,K.jsxs)(P,{value:g.modelKind,onChange:e=>_({...g,modelKind:e.target.value,providerType:e.target.value===`chat`?`chat`:`visual`}),children:[(0,K.jsx)(`option`,{value:`chat`,children:s(`providers:modelEditor.chat`)}),(0,K.jsx)(`option`,{value:`image`,children:s(`providers:modelEditor.image`)}),(0,K.jsx)(`option`,{value:`video`,children:s(`providers:modelEditor.video`)})]})]}),(0,K.jsx)(`div`,{className:`grid gap-[9px]`,children:(0,K.jsx)(Yr,{ids:k,onChange:A,primaryId:g.model,placeholder:g.providerType===`visual`?`gpt-image-1`:`gpt-5.5`})}),g.modelKind===`chat`&&(0,K.jsxs)(U,{variant:`control`,children:[s(`config:configPage.modelThinkingLevels`),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-[6px]`,children:v.map(e=>{let t=e===`off`,n=t||g.thinkingLevels.includes(e),r=t||!g.reasoning&&e!==`off`;return(0,K.jsxs)(`button`,{type:`button`,"aria-pressed":n,disabled:r,onClick:()=>!t&&x(e),className:I(`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,K.jsx)(fe,{size:12}),e]},e)})}),(0,K.jsx)(`small`,{className:`text-[var(--text-muted)]`,children:s(`config:configPage.modelThinkingLevelsHint`)})]})]}),!o&&(0,K.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,K.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,K.jsx)(`strong`,{className:`text-[13px]`,children:h?s(`config:configPage.providerEnabled`,{name:g.name}):s(`config:configPage.enableAfterCreation`)}),g.providerType===`visual`&&(0,K.jsx)(`small`,{className:`text-[13px] text-muted-foreground`,children:s(`config:configPage.visualModelsAreSelectedByTheVisualGenerationToolAndDoNotAppearInTheChatModelList`)})]}),(0,K.jsx)(gr,{value:g.enabled,onChange:e=>_({...g,enabled:e})})]})]}),w&&(0,K.jsxs)(ct,{children:[(0,K.jsx)(Ye,{size:13}),w]}),(0,K.jsxs)(`div`,{className:`flex justify-end gap-[8px] [margin-top:18px]`,children:[(0,K.jsx)(H,{type:`button`,variant:`outline`,size:`lg`,className:`bg-surface-subtle`,disabled:S,onClick:e,children:s(`config:configPage.cancel`)}),(0,K.jsxs)(H,{size:`lg`,disabled:S,children:[S?(0,K.jsx)(z,{className:`animate-spin`,size:14}):h?(0,K.jsx)(fe,{size:14}):(0,K.jsx)(Re,{size:14}),s(S?`config:configPage.saving`:u?`config:configPage.cloneProvider`:h?`config:configPage.saveChanges`:`config:configPage.createConnection`)]})]})]})})}function Qr(e){return(e.providers||[]).filter(e=>e.importable&&!e.imported&&!e.conflict).length}function $r(e){return Qr(e)>0}function ei(e,t){return!t&&!$r(e)}function ti(e,t,n){let r=e.providers||[],i=e.errors||[],a=$r(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 ni(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 ri(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 ii(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 ai({discovery:e,discovering:t,error:n,importing:r,forceVisible:i=!1,onRefresh:a,onImport:o}){let{t:s}=c(),[l,u]=(0,G.useState)(null),d=e.providers||[],f=e.errors||[];if(!i&&!ti(e,t,n))return null;let p=l??(!i&&ei(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,K.jsxs)(Y,{className:`[margin-bottom:12px] [padding:12px_14px]`,children:[(0,K.jsxs)(`div`,{className:`[&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[12px] [&_small]:leading-[1.45] max-[650px]:flex-wrap flex items-center gap-[10px]`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`max-[650px]:basis-full [&_>_span:nth-child(2)]:flex [&_>_span:nth-child(2)]:min-w-0 [&_>_span:nth-child(2)]:flex-1 [&_>_span:nth-child(2)]:flex-col [&_>_span:nth-child(2)]:gap-[3px] flex min-w-0 flex-1 items-center gap-[10px] border-0 bg-transparent p-0 text-inherit text-left cursor-pointer`,"aria-expanded":!p,onClick:()=>u(!p),children:[(0,K.jsx)(`span`,{className:`grid w-[38px] h-[38px] [flex:0_0_auto] place-items-center rounded-[11px] bg-[var(--star-soft)] text-[var(--star-strong)]`,children:(0,K.jsx)(B,{size:18})}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`strong`,{children:s(`config:configPage.localProviderConfiguration`)}),(0,K.jsx)(`small`,{children:s(`config:configPage.readProviderEndpointModelAndAuthenticationFieldsFromCodexConfigTomlAndClaudeSettingsJson`)})]}),(0,K.jsx)(pe,{size:15,className:`provider-discovery-caret [&.open]:[transform:rotate(180deg)] flex-none text-[var(--text-muted)] [transition:transform_var(--d1)_var(--ease-out)] ${p?``:`open`}`})]}),(0,K.jsxs)(H,{type:`button`,variant:`outline`,className:`bg-surface-subtle`,disabled:t||!!r,onClick:m,children:[t?(0,K.jsx)(z,{className:`animate-spin`,size:13}):(0,K.jsx)(z,{size:13}),s(`config:configPage.rescan`)]})]}),!p&&(0,K.jsxs)(K.Fragment,{children:[t&&!d.length?(0,K.jsxs)(`div`,{className:`flex min-h-[48px] items-center justify-center gap-[7px] [margin-top:9px] rounded-[var(--r-sm)] bg-[var(--surface-subtle)] text-[var(--text-muted)] text-[12px]`,children:[(0,K.jsx)(z,{className:`animate-spin`,size:15}),s(`config:configPage.scanningProviderConfigurationFiles`)]}):d.length?(0,K.jsx)(`div`,{className:`provider-discovery-list max-[650px]:grid-cols-[1fr] grid grid-cols-[repeat(2,minmax(0,1fr))] gap-[8px] [margin-top:11px]`,children:d.map(e=>{let t=ni(e),n=r===e.id,i=e.source.startsWith(`claude-`)?de:ue,a=e.kind===`authentication`?s(`config:configPage.officialProviderAuthenticationOnly`):e.models?.length?e.models.map(e=>e.id).join(`, `):s(`config:configPage.noModelSpecified`);return(0,K.jsxs)(`div`,{className:`provider-discovery-card grid min-w-0 min-h-[68px] grid-cols-[auto_minmax(0,1fr)_auto] max-[650px]:grid-cols-[auto_minmax(0,1fr)] items-center gap-[9px] [border:1px_solid_var(--stroke)] rounded-[var(--r-sm)] bg-[var(--surface-subtle)] [padding:8px_9px] ${e.imported?`configured [.provider-discovery-card&]:border-[var(--success-border)] [.provider-discovery-card&]:bg-[var(--success-soft)]`:``}`,children:[(0,K.jsx)(`span`,{className:`provider-discovery-icon [&.source-claude-config]:bg-[var(--brand-blue-soft)] [&.source-claude-config]:text-[var(--brand-blue-strong)] grid w-[32px] h-[32px] place-items-center rounded-[var(--r-sm)] bg-[var(--star-soft)] text-[var(--star-strong)] source-${e.source}`,children:(0,K.jsx)(i,{size:17})}),(0,K.jsxs)(`span`,{className:`provider-discovery-copy [&_strong]:overflow-hidden [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap [&_small]:overflow-hidden [&_small]:text-ellipsis [&_small]:whitespace-nowrap [&_strong]:text-[12px] [&_small]:text-[var(--text-muted)] [&_small]:text-[11px] flex min-w-0 flex-col gap-[3px]`,children:[(0,K.jsxs)(`strong`,{children:[t,` · `,e.providerName]}),(0,K.jsxs)(`small`,{children:[e.api,` · `,a]}),(0,K.jsxs)(`small`,{children:[e.kind===`authentication`?s(`config:configPage.officialEndpointOnly`):e.baseUrl||s(`config:configPage.noBaseURLSpecified`),` `,`· `,ri(e,s),` · `,e.location]})]}),(0,K.jsx)(`span`,{className:`flex min-w-0 flex-none items-center max-[650px]:col-start-2`,children:e.imported?(0,K.jsx)(X,{tone:`green`,children:s(`config:configPage.loaded`)}):e.conflict?(0,K.jsx)(X,{tone:`amber`,children:s(`config:configPage.conflictDetected`)}):e.importable?(0,K.jsxs)(H,{type:`button`,disabled:n||!!r,onClick:()=>h(e),children:[n?(0,K.jsx)(z,{className:`animate-spin`,size:12}):(0,K.jsx)(ye,{size:12}),n?s(`config:configPage.loading`):e.kind===`authentication`?s(`config:configPage.loadLoginState`):s(`config:configPage.loadConfiguration`)]}):(0,K.jsx)(X,{tone:`gray`,children:s(`config:configPage.cannotLoad`)})})]},e.id)})}):(0,K.jsxs)(`div`,{className:`flex min-h-[48px] items-center justify-center gap-[7px] [margin-top:9px] rounded-[var(--r-sm)] bg-[var(--surface-subtle)] text-[var(--text-muted)] text-[12px]`,children:[(0,K.jsx)(B,{size:15}),s(`config:configPage.noImportableCodexOrClaudeProviderConfigurationWasDetected`)]}),(n||f.length>0||d.some(e=>e.warnings?.some(e=>e.code!==`login_auth_not_imported`)))&&(0,K.jsxs)(`div`,{className:`provider-discovery-errors [&_span]:flex [&_span]:items-center [&_span]:gap-[5px] flex flex-col gap-[4px] [margin-top:8px] text-[var(--danger)] text-[11px]`,"aria-live":`polite`,children:[n&&(0,K.jsxs)(`span`,{children:[(0,K.jsx)(Ye,{size:13}),n]}),f.map((e,t)=>(0,K.jsxs)(`span`,{children:[(0,K.jsx)(Ye,{size:13}),ni(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,K.jsxs)(`span`,{children:[(0,K.jsx)(Ye,{size:13}),ni(e),` · `,ii(t.code,s)]},`${e.id}-${t.code}-${n}`)))]})]})]})}function oi(e){try{return{name:new URL(e).hostname.replace(/^www\./i,``)||`Custom Provider`}}catch{return{name:`Custom Provider`}}}function si({config:e,providerType:t=`chat`,initialProviderId:n,onClose:r,onConfigChanged:i,onCompleted:a}){let{t:o}=c(),s=n&&e.providers.find(e=>e.id===n)||null,[l,u]=(0,G.useState)(1),[d,f]=(0,G.useState)(s),[p]=(0,G.useState)(qr),[m,h]=(0,G.useState)(``),g=(0,G.useRef)(null),_=(0,G.useRef)(null),[v,y]=(0,G.useState)(s?.baseUrl||``),[b,x]=(0,G.useState)(s?.api||`openai-responses`),[S,C]=(0,G.useState)(``),w=S.trim()||void 0,[T,E]=(0,G.useState)(s?.organization||``),[D,O]=(0,G.useState)(s?.name||``),[k,A]=(0,G.useState)(s?.models||[]),[j,M]=(0,G.useState)(s?.defaultModel||``),[N,ee]=(0,G.useState)([]),[te,ne]=(0,G.useState)(s?.models.find(e=>e.id===s.defaultModel)?.kind||(t===`visual`?`image`:`chat`)),[F,L]=(0,G.useState)(!1),[re,R]=(0,G.useState)(``),[oe,se]=(0,G.useState)(``),ce=oi(v),le=o(t===`visual`?`config:configPage.visualProvider`:`config:configPage.chatProvider`),ue=o(l===1?`config:configPage.quickSetupStepBaseUrl`:l===2?`config:configPage.quickSetupStepProtocol`:`config:configPage.quickSetupStepModel`),de=k.filter(e=>t===`visual`?e.kind===`image`||e.kind===`video`:e.kind===`chat`),pe=()=>{let e=v.trim();try{let t=new URL(e);if(![`http:`,`https:`].includes(t.protocol))throw Error()}catch{R(o(`config:configPage.providerBaseURLMustBeHTTPOrHTTPS`));return}R(``),D.trim()||O(ce.name),u(2)},me=()=>{if(!b){R(o(`config:configPage.selectAPIProtocol`));return}R(``),u(3)},he=async()=>{if(F)return;let e=d;if(!w&&!e?.configured&&!m){R(o(`config:configPage.enterTheAPIKeyForThisConnection`));return}L(!0),R(``),se(``);try{let n=((await V(`/api/providers/models/discover-connection`,{method:`POST`,body:JSON.stringify({providerId:e?.id||m,providerType:t,api:b,baseUrl:v,organization:T,apiKey:w})})).models||[]).filter(e=>t===`visual`?e.kind===`image`||e.kind===`video`:e.kind===`chat`);if(!n.length){R(o(t===`visual`?`config:configPage.fetchOrAddAVisualModel`:`config:configPage.fetchOrAddAChatModel`));return}A(n);let r=n.find(e=>e.id===j)||n[0];M(r.id),ne(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){A(i);let e=i.find(e=>e.id===j)||i[0];M(e.id),ne(t===`visual`?e.kind:`chat`),se(r)}else R(r)}finally{L(!1)}},ge=async()=>{if(F)return;let e=j.trim()||N[0]||``;if(!e){R(o(`config:configPage.selectModelToFinish`));return}if(!w&&!d?.configured&&!m){R(o(`config:configPage.enterTheAPIKeyForThisConnection`));return}let n=new Set((d?.models||[]).map(e=>e.id)),r=N.filter(t=>t!==e&&!n.has(t));L(!0),R(``);try{let n=d?.id||m,o=n?await V(`/api/config`,{method:`PUT`,body:JSON.stringify({provider:n,providerType:t,api:b,baseUrl:v,organization:T,model:e,modelKind:t===`visual`?te:`chat`,apiKey:w,setAsDefault:!1,enabled:!0})}):await V(`/api/providers`,{method:`POST`,body:JSON.stringify({id:p,name:D.trim()||ce.name,providerType:t,api:b,baseUrl:v,organization:T,apiKey:w,model:e,modelKind:t===`visual`?te:`chat`,enabled:!0})}),c=n||o.createdProviderId||p,l=s?``:c;l&&h(l);let u=o.providers.find(e=>e.id===c);if(u&&f(u),i?.(l?{...o,createdProviderId:l}:o),r.length){let e=t===`visual`?te:`chat`;try{o=await V(`/api/providers/${encodeURIComponent(c)}/models/batch`,{method:`POST`,body:JSON.stringify({models:r.map(t=>({id:t,kind:e}))})})}catch(e){R(e instanceof Error?e.message:String(e));return}}a(l?{...o,createdProviderId:l}:o)}catch(e){R(e instanceof Error?e.message:String(e))}finally{L(!1)}};return(0,K.jsx)(it,{open:!0,onOpenChange:e=>{!e&&!F&&r()},children:(0,K.jsxs)(nt,{showCloseButton:!1,className:`modal z-[80] block max-h-[calc(100dvh_-_40px)] w-[calc(100%_-_40px)] max-w-lg overflow-y-auto [overscroll-behavior:contain] [border:1px_solid_var(--surface-highlight)] rounded-[var(--r-md)] bg-[var(--solid)] p-[18px] shadow-[0_26px_70px_-25px_var(--shadow-strong)] sm:max-w-lg max-[650px]:max-h-[calc(100dvh_-_16px)] max-[650px]:w-[calc(100%_-_16px)]`,overlayClassName:`z-[70] bg-[var(--modal-overlay)] [backdrop-filter:blur(3px)]`,"aria-busy":F,onEscapeKeyDown:e=>{F&&e.preventDefault()},onInteractOutside:e=>{F&&e.preventDefault()},onOpenAutoFocus:e=>{e.preventDefault(),g.current=document.activeElement instanceof HTMLElement?document.activeElement:null,_.current?.focus()},onCloseAutoFocus:e=>{e.preventDefault(),g.current?.focus()},children:[(0,K.jsxs)(ut,{children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(rt,{asChild:!0,children:(0,K.jsx)(`h2`,{children:o(t===`visual`?`config:configPage.visualQuickSetupTitle`:`config:configPage.quickSetupTitle`)})}),(0,K.jsx)(et,{asChild:!0,children:(0,K.jsxs)(`p`,{children:[o(`config:configPage.stepIndicator`,{current:l,total:3}),` · `,ue]})})]}),(0,K.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":o(`config:configPage.closeDialog`),disabled:F,onClick:r,children:(0,K.jsx)(Qe,{size:17})})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-[8px] [margin-top:12px] [border:1px_solid_var(--stroke-soft)] rounded-[var(--r-sm)] bg-[var(--surface-subtle)] p-[9px_10px]`,children:[(0,K.jsx)(`span`,{className:`grid w-[30px] h-[30px] flex-none place-items-center rounded-[var(--r-sm)] bg-[var(--accent-soft)] text-[var(--star-strong)]`,children:(0,K.jsx)(B,{size:16})}),(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,K.jsx)(`strong`,{className:`overflow-hidden text-ellipsis whitespace-nowrap text-[13px]`,children:D||ce.name}),(0,K.jsx)(`small`,{className:`text-[11px] text-[var(--text-muted)]`,children:le})]}),(0,K.jsx)(X,{tone:`gray`,children:le})]}),l===1&&(0,K.jsxs)(`div`,{className:`[margin-top:14px]`,children:[(0,K.jsxs)(U,{variant:`control`,children:[`Base URL`,(0,K.jsx)(`input`,{ref:_,value:v,onChange:e=>y(e.target.value),placeholder:`https://api.example.com/v1`,inputMode:`url`})]}),(0,K.jsx)(`p`,{className:`[margin:8px_0_0] text-[12px] leading-[1.5] text-[var(--text-muted)]`,children:o(`config:configPage.quickSetupBaseUrlHint`)})]}),l===2&&(0,K.jsxs)(`div`,{className:`[margin-top:14px]`,children:[(0,K.jsxs)(U,{variant:`control`,children:[o(`config:configPage.apiProtocol`),(0,K.jsx)(P,{value:b,onChange:e=>x(e.target.value),children:Rr.map(([e,t])=>(0,K.jsx)(`option`,{value:e,children:t},e))})]}),(0,K.jsxs)(U,{variant:`control`,children:[`Organization`,(0,K.jsx)(`input`,{value:T,onChange:e=>E(e.target.value),placeholder:o(`config:configPage.optionalUsedOnlyForOpenAIOrganization`)})]})]}),l===3&&(0,K.jsxs)(`div`,{className:`[margin-top:14px]`,children:[!d&&(0,K.jsxs)(U,{variant:`control`,children:[o(`config:configPage.displayName`),(0,K.jsx)(`input`,{value:D,onChange:e=>O(e.target.value),placeholder:ce.name})]}),(0,K.jsx)(Jr,{value:S,onChange:C,configured:d?.configured}),(0,K.jsxs)(H,{type:`button`,size:`lg`,className:`[margin-top:10px] w-full`,disabled:F,onClick:()=>void he(),children:[F?(0,K.jsx)(z,{className:`animate-spin`,size:14}):(0,K.jsx)(z,{size:14}),o(F?`config:configPage.fetchingModels`:`config:configPage.fetchModels`)]}),oe&&(0,K.jsxs)(st,{className:`[margin-top:10px]`,children:[(0,K.jsx)(Ye,{size:15}),(0,K.jsx)(`small`,{children:o(`config:configPage.discoverFailedUsingExisting`,{message:oe})})]}),de.length>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`[margin:14px_0_8px] text-[12px] leading-[1.5] text-[var(--text-muted)]`,children:o(t===`visual`?`config:configPage.selectVisualModelToFinish`:`config:configPage.selectModelToFinish`)}),(0,K.jsx)(`div`,{className:`flex max-h-[260px] flex-col gap-[6px] overflow-y-auto`,children:de.map(e=>(0,K.jsxs)(`button`,{type:`button`,className:I(`flex min-w-0 cursor-pointer items-center gap-[8px] [border:1px_solid_var(--stroke-soft)] rounded-[var(--r-sm)] bg-[var(--surface-subtle)] p-[8px_10px] text-left hover:border-[var(--accent-border)]`,j===e.id&&`[border-color:var(--accent-border)] bg-[var(--accent-soft)]`),onClick:()=>{M(e.id),ne(t===`visual`?e.kind:`chat`)},children:[(0,K.jsx)(`span`,{className:I(`grid w-[16px] h-[16px] flex-none place-items-center rounded-full [border:1px_solid_var(--stroke)] text-transparent`,j===e.id&&`[border-color:var(--brand-blue)] bg-[var(--brand-blue)] text-white`),children:(0,K.jsx)(fe,{size:11})}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-[13px]`,children:e.name}),t===`visual`&&(0,K.jsx)(X,{tone:`gray`,children:e.kind===`video`?o(`config:configPage.visualVideoModel`):o(`config:configPage.visualImageModel`)})]},`${e.id}-${e.kind}`))})]}),(0,K.jsxs)(`div`,{className:`[margin-top:14px] grid gap-[9px]`,children:[(0,K.jsxs)(U,{variant:`control`,children:[o(`config:configPage.manualModelId`),(0,K.jsx)(`input`,{value:j,onChange:e=>M(e.target.value),placeholder:t===`visual`?`gpt-image-1`:`gpt-5.4`})]}),(0,K.jsx)(`p`,{className:`[margin:0] text-[11px] text-[var(--text-tertiary)]`,children:o(`config:configPage.manualModelIdHint`)}),t===`visual`&&(0,K.jsxs)(U,{variant:`control`,children:[o(`config:configPage.modelType`),(0,K.jsxs)(P,{value:te,onChange:e=>ne(e.target.value),children:[(0,K.jsx)(`option`,{value:`image`,children:o(`config:configPage.imageGenerationAndEditing`)}),(0,K.jsx)(`option`,{value:`video`,children:o(`config:configPage.videoGeneration`)})]})]}),(0,K.jsx)(Yr,{ids:N,onChange:ee,primaryId:j,placeholder:t===`visual`?`gpt-image-1`:`gpt-5.5`})]})]}),re&&(0,K.jsxs)(ct,{children:[(0,K.jsx)(Ye,{size:13}),re]}),(0,K.jsxs)(`div`,{className:`flex justify-between gap-[8px] [margin-top:18px]`,children:[(0,K.jsxs)(H,{type:`button`,variant:`outline`,size:`lg`,className:`bg-surface-subtle`,disabled:F||l===1,onClick:()=>{R(``),u(l-1)},children:[(0,K.jsx)(ie,{size:14}),o(`config:configPage.previousStep`)]}),l===1?(0,K.jsxs)(H,{type:`button`,size:`lg`,disabled:F||!v.trim(),onClick:pe,children:[(0,K.jsx)(ae,{size:14}),o(`config:configPage.nextStep`)]}):l===2?(0,K.jsxs)(H,{type:`button`,size:`lg`,disabled:F,onClick:me,children:[(0,K.jsx)(ae,{size:14}),o(`config:configPage.nextStep`)]}):(0,K.jsxs)(H,{type:`button`,size:`lg`,disabled:F||!j.trim()&&N.length===0,onClick:()=>void ge(),children:[F?(0,K.jsx)(z,{className:`animate-spin`,size:14}):(0,K.jsx)(fe,{size:14}),o(F?`config:configPage.saving`:`config:configPage.saveChanges`)]})]})]})})}function ci({config:e,notify:t,onConfigChanged:n}){let{t:r}=c(),[i,a]=(0,G.useState)(e.thinkingLevel),[o,s]=(0,G.useState)(e.toolMode),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(``);(0,G.useEffect)(()=>{a(e.thinkingLevel),s(e.toolMode)},[e.thinkingLevel,e.toolMode]);let p=e.defaultProvider||e.provider,m=e.defaultModel||e.model,h=e.providers.find(e=>e.id===p),g=!!(h?.configured&&m),_=i!==e.thinkingLevel||o!==e.toolMode,v=async()=>{if(!(!h||!m)){u(!0),f(``);try{n(await V(`/api/config`,{method:`PUT`,body:JSON.stringify({provider:h.id,providerType:h.type,api:h.api,baseUrl:h.baseUrl||``,organization:h.organization||``,model:m,thinkingLevel:i,toolMode:o,setAsDefault:!1})})),t(r(`config:configPage.runtimePolicySaved`))}catch(e){f(e instanceof Error?e.message:String(e))}finally{u(!1)}}};return(0,K.jsxs)(Y,{children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-[8px]`,children:[(0,K.jsx)(hr,{title:r(`config:configPage.agentRuntimePolicy`)}),(0,K.jsxs)(H,{size:`sm`,className:`h-[27px] px-[10px] text-[12px]`,disabled:l||!_||!g,onClick:()=>void v(),children:[l?(0,K.jsx)(z,{className:`animate-spin`,size:13}):(0,K.jsx)(Ve,{size:13}),r(l?`config:configPage.saving`:`config:configPage.saveSettings`)]})]}),(0,K.jsxs)(U,{variant:`control`,children:[r(`config:configPage.thinkingLevel`),(0,K.jsx)(P,{value:i,onChange:e=>a(e.target.value),children:[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`].map(e=>(0,K.jsx)(`option`,{children:e},e))})]}),(0,K.jsxs)(U,{variant:`control`,children:[r(`config:configPage.availableTools`),(0,K.jsxs)(P,{value:o,onChange:e=>s(e.target.value),children:[(0,K.jsx)(`option`,{value:`full`,children:r(`config:configPage.fullToolAccess`)}),(0,K.jsx)(`option`,{value:`custom`,children:r(`config:configPage.customManageEachToolOnThePluginsPage`)})]})]}),(0,K.jsxs)(st,{children:[(0,K.jsx)(We,{size:16}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`strong`,{children:r(`config:configPage.permissionsAreEnforcedByTheRuntime`)}),(0,K.jsx)(`small`,{children:r(`config:configPage.afterSavingExistingRuntimesAreReleasedAndNewChatsUseTheLatestPolicy`)})]})]}),d&&(0,K.jsxs)(ct,{children:[(0,K.jsx)(Ye,{size:13}),d]})]})}function li(e){return e instanceof Error?e.message:String(e)}function ui({notify:e,requestConfirm:t,t:n}){let[r,i]=(0,G.useState)(null),[a,o]=(0,G.useState)(!0),[s,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(``),[d,f]=(0,G.useState)(``),[p,m]=(0,G.useState)(``),[h,g]=(0,G.useState)(``),_=(0,G.useRef)(0),v=(0,G.useRef)(!1);(0,G.useEffect)(()=>{let e=!0;v.current=!0;let t=_.current;return V(`/api/config`).then(n=>{if(e)return _.current===t&&i(n),o(!1),V(`/api/providers/models/refresh`,{method:`POST`,body:`{}`})}).then(n=>{!e||_.current!==t||!n?.config||i(n.config)}).catch(n=>{!e||_.current!==t||(c(li(n)),o(!1))}),()=>{e=!1,v.current=!1,_.current+=1}},[]);let y=(0,G.useCallback)(e=>{_.current+=1,i(e),o(!1),c(``)},[]),b=(0,G.useCallback)(async()=>{let e=_.current,t=await V(`/api/config`);v.current&&_.current===e&&y(t)},[y]),x=(0,G.useCallback)(async(t,r)=>{u(t.id),c(``);try{let i=await V(`/api/providers/${encodeURIComponent(t.id)}/enabled`,{method:`PUT`,body:JSON.stringify({enabled:r})});y(i),e(n(`config:configPage.nameState`,{name:t.name,state:n(r?`config:configPage.enabled`:`config:configPage.disabled`)}))}catch(e){c(li(e))}finally{u(``)}},[y,e,n]),S=(0,G.useCallback)(async t=>{f(t.id),c(``);try{let r=await V(`/api/config`,{method:`PUT`,body:JSON.stringify({provider:t.id,setAsDefault:!0})});y(r),e(n(`config:configPage.defaultProviderUpdated`,{name:t.name}))}catch(e){c(li(e))}finally{f(``)}},[y,e,n]),C=(0,G.useCallback)(async(t,r)=>{m(t.id),c(``);try{let i=await V(`/api/config`,{method:`PUT`,body:JSON.stringify({provider:t.id,model:r,setAsDefault:!1})});y(i),e(n(`config:configPage.providerConnectionUpdated`))}catch(e){c(li(e))}finally{m(``)}},[y,e,n]),w=(0,G.useCallback)(async(r,i)=>{if(await t({title:n(`providers:modelEditor.delete`),message:n(`providers:modelEditor.deleteConfirmation`,{name:i.name||i.id}),confirmLabel:n(`config:configPage.delete`)})){g(`${r.id}/${i.id}`),c(``);try{y(await Br.deleteModel(r.id,i.id)),e(n(`providers:modelEditor.deleted`))}catch(e){c(li(e))}finally{g(``)}}},[y,e,t,n]);return{config:r,loading:a,error:s,toggling:l,settingDefault:d,settingModel:p,deletingModel:h,applyConfig:y,refreshConfig:b,setDefaultProvider:S,setProviderDefaultModel:C,toggleProvider:x,deleteProvider:(0,G.useCallback)(async r=>{if(await t({title:n(`config:configPage.deleteProviderConnection`),message:n(`config:configPage.deleteNameItsModelSettingsAndAuthenticationDetailsWillAlsoBeRemoved`,{name:r.name}),confirmLabel:n(`config:configPage.delete`)})){c(``);try{let t=await V(`/api/providers/${encodeURIComponent(r.id)}`,{method:`DELETE`});y(t),e(n(`config:configPage.providerConnectionDeleted`))}catch(e){c(li(e))}}},[y,e,t,n]),deleteModel:w}}function di({requestConfirm:e,onImported:t,onAutoImported:n,t:r}){let[i,a]=(0,G.useState)({providers:[],errors:[]}),[o,s]=(0,G.useState)(!0),[c,l]=(0,G.useState)(``),[u,d]=(0,G.useState)(``),[f,p]=(0,G.useState)(``),[m,h]=(0,G.useState)({imported:0,skipped:0}),g=(0,G.useRef)(0),_=(0,G.useRef)(n);_.current=n;let v=(0,G.useCallback)(async()=>{let e=++g.current;s(!0),l(``);try{let t=await Br.importLocal();if(e!==g.current)return;a(t.discovery),h({imported:t.imported.length,skipped:t.skipped.length}),t.imported.length&&await _.current()}catch(t){e===g.current&&l(li(t))}finally{e===g.current&&s(!1)}},[]);return(0,G.useEffect)(()=>(v(),()=>{g.current+=1}),[v]),{discovery:i,autoImport:m,discovering:o,error:c,operationError:u,importing:f,refresh:v,importProvider:(0,G.useCallback)(async n=>{let i=n.source===`codex-config`?`Codex config.toml`:n.source===`claude-config`?`Claude settings.json`:n.source===`codex-auth`?`Codex login`:`Claude login`,o=n.kind===`authentication`;if(await e({title:r(o?`config:configPage.loadLoginState`:`config:configPage.loadProviderConfiguration`),message:r(o?`config:configPage.loadOfficialProviderLoginStateFromSource`:`config:configPage.loadThisProviderConfigurationFromSource`,{source:i}),confirmLabel:r(o?`config:configPage.loadLoginState`:`config:configPage.loadConfiguration`)})){p(n.id),d(``);try{let e=await V(`/api/providers/${encodeURIComponent(n.id)}/import`,{method:`POST`,body:`{}`});a(e.discovery),t(e)}catch(e){d(li(e))}finally{p(``)}}},[t,e,r])}}function fi({providers:e,defaultProviderId:t=``,toggling:n,settingDefault:r=``,settingModel:i=``,onConfigure:a,onClone:o,onSetDefault:s,onSetDefaultModel:l,onToggle:u,onDelete:d}){let{t:f}=c(),p=e.filter(e=>e.configured||e.custom);return(0,K.jsx)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3`,children:p.map(e=>{let c=zr[e.id]||B,p=e.id===t,m=e.configured?e.enabled?f(`config:configPage.authenticationReady`):f(`config:configPage.disabled2`):e.id===`openai-codex`?f(`config:configPage.codexCLILoginRequired`):f(`config:configPage.apiKeyRequired`);return(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 border border-[var(--stroke-soft)] rounded-sm bg-[var(--surface-subtle)] px-3 py-2.5`,children:[(0,K.jsxs)(`button`,{type:`button`,title:f(`config:configPage.configure`),className:`flex min-w-0 cursor-pointer items-center gap-2 rounded-sm border-0 bg-transparent p-0 text-left hover:text-[var(--brand-blue)] focus-visible:outline-2 focus-visible:outline-[var(--focus)]`,onClick:()=>a(e),children:[(0,K.jsx)(`span`,{className:`grid w-[30px] h-[30px] flex-none place-items-center rounded-[var(--r-sm)] bg-[var(--accent-soft)] text-[var(--star-strong)]`,children:(0,K.jsx)(c,{size:16})}),(0,K.jsx)(`strong`,{className:`min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-[13px]`,children:e.name}),p&&(0,K.jsx)(X,{tone:`green`,children:f(`config:configPage.defaultBadge`)})]}),l&&e.models.some(e=>e.kind===`chat`)?(0,K.jsxs)(`label`,{className:`grid min-w-0 gap-1 text-[12px] text-[var(--text-muted)]`,children:[f(`config:configPage.providerDefaultModel`),(0,K.jsxs)(P,{"aria-label":`${f(`config:configPage.providerDefaultModel`)}: ${e.name}`,value:e.defaultModel||``,disabled:!!(i||r),onChange:t=>void l(e,t.target.value),children:[!e.models.some(t=>t.kind===`chat`&&t.id===e.defaultModel)&&(0,K.jsx)(`option`,{value:e.defaultModel||``,disabled:!0,children:e.defaultModel||f(`config:configPage.selectModel`)}),e.models.filter(e=>e.kind===`chat`).map(e=>(0,K.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}):e.defaultModel?(0,K.jsxs)(`small`,{className:`truncate text-[12px] text-[var(--text-muted)]`,title:e.defaultModel,children:[f(`config:configPage.providerDefaultModel`),`: `,e.defaultModel]}):null,(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-[8px]`,children:[(0,K.jsx)(`small`,{className:`text-[12px] text-[var(--text-muted)]`,children:m}),(0,K.jsxs)(`div`,{className:`flex flex-none items-center gap-[6px]`,children:[s&&(0,K.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,className:`h-[26px] w-[26px]`,title:f(`config:configPage.setAsDefaultProvider`),"aria-label":f(`config:configPage.setAsDefaultProvider`),"aria-pressed":p,disabled:p||!e.configured||!e.enabled||!e.defaultModel||!!(r||i),onClick:()=>void s(e),children:(0,K.jsx)(ur,{size:13})}),(0,K.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,className:`h-[26px] w-[26px]`,title:f(`config:configPage.cloneProvider`),"aria-label":f(`config:configPage.cloneProvider`),onClick:()=>o(e),children:(0,K.jsx)(ve,{size:13})}),(0,K.jsx)(gr,{ariaLabel:f(`config:configPage.providerEnabled`,{name:e.name}),value:e.configured&&e.enabled,disabled:!e.configured||n===e.id,onChange:t=>u(e,t)}),e.custom&&(0,K.jsx)(H,{type:`button`,variant:`destructive`,size:`icon`,className:`h-[26px] w-[26px]`,title:f(`config:configPage.deleteProvider`),"aria-label":f(`config:configPage.deleteProvider`),onClick:()=>void d(e),children:(0,K.jsx)(Je,{size:13})})]})]})]},e.id)})})}var pi=`pisper.config.visualConnectionsOpen`,Z={running:null,result:null,error:``};function mi(){return n.getItem(pi)===`1`}function hi({config:e,notify:t,toggling:r,onToggleProvider:i,onDeleteProvider:a,onCloneProvider:o,onQuickSetup:s,onEditVisualProvider:l}){let{t:u}=c(),[d,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(!0),[h,g]=(0,G.useState)(``),[_,v]=(0,G.useState)(!1),[y,C]=(0,G.useState)(null),[w,T]=(0,G.useState)(``),[E,D]=(0,G.useState)(mi),O=(0,G.useCallback)(async()=>{try{f(await V(`/api/visual/models`)),T(``)}catch(e){T(e instanceof Error?e.message:String(e))}finally{m(!1)}},[]);(0,G.useEffect)(()=>{O()},[O,e]),(0,G.useEffect)(()=>{Z.result&&C(Z.result),Z.error&&T(Z.error);let e=Z.running;if(!e)return;v(!0);let t=!0;return e.then(e=>{t&&C(e)}).catch(()=>{t&&T(Z.error)}).finally(()=>{t&&v(!1)}),()=>{t=!1}},[]);let k=async(e,n)=>{g(e),T(``);try{f(await V(`/api/visual/models/${e}`,{method:`PUT`,body:JSON.stringify({model:n})})),t(u(`config:configPage.visualModelUpdated`))}catch(e){T(e instanceof Error?e.message:String(e))}finally{g(``)}},A=async()=>{if(Z.running)return;v(!0),T(``),C(null),Z.result=null,Z.error=``;let e=V(`/api/visual/test`,{method:`POST`,body:`{}`,timeout:21e4});Z.running=e;try{let n=await e;Z.result=n,C(n),t(u(`config:configPage.testSucceeded`))}catch(e){let n=e instanceof Error?e.message:String(e);Z.error=n,T(n),t(n)}finally{Z.running=null,v(!1)}},j=e=>{D(e),n.setItem(pi,e?`1`:`0`)},M=e.providers.filter(e=>e.type===`visual`),N=M.filter(e=>e.configured||e.custom),ee=d?.imageModels||[],te=d?.videoModels||[];return(0,K.jsxs)(`section`,{className:`[margin-top:12px]`,children:[(0,K.jsxs)(Y,{className:`[margin-bottom:12px]`,"data-config-card":`models-visual`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,K.jsx)(`span`,{className:`grid size-10 flex-none place-items-center rounded-lg bg-[var(--accent-soft)] text-[var(--star-strong)]`,children:(0,K.jsx)(Ke,{size:19})}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[3px]`,children:[(0,K.jsx)(`span`,{className:`text-[12px] font-[600] text-[var(--text-muted)]`,children:u(`config:configPage.currentVisualModel`)}),p?(0,K.jsxs)(`span`,{className:`flex items-center gap-[7px] text-[12px] text-[var(--text-muted)]`,children:[(0,K.jsx)(z,{className:`animate-spin`,size:13}),u(`config:configPage.loadingVisualStatus`)]}):d?.image?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-[7px]`,children:[(0,K.jsxs)(`strong`,{className:`overflow-hidden text-ellipsis whitespace-nowrap text-[15px]`,children:[d.image.providerName,` / `,d.image.name]}),(0,K.jsxs)(X,{tone:`green`,children:[(0,K.jsx)(he,{size:11,className:`mr-[3px] inline`}),u(`config:configPage.authenticationReady`)]})]}),d.video&&(0,K.jsxs)(`small`,{className:`text-[12px] text-[var(--text-muted)] [overflow-wrap:anywhere]`,children:[u(`config:configPage.visualVideoModel`),`:`,d.video.providerName,` /`,` `,d.video.name]})]}):(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-[2px]`,children:[(0,K.jsxs)(`strong`,{className:`flex items-center gap-[6px] text-[14px] text-[var(--warning-strong)]`,children:[(0,K.jsx)(me,{size:15}),u(`config:configPage.visualNoneConfigured`)]}),(0,K.jsx)(`small`,{className:`text-[12px] text-[var(--text-muted)]`,children:u(`config:configPage.visualEmptyHint`)})]})]}),(0,K.jsxs)(`div`,{className:`flex w-full min-w-0 max-w-full flex-none flex-wrap items-center gap-[7px] sm:w-auto`,children:[d?.image&&(0,K.jsxs)(H,{variant:`outline`,className:`bg-surface-subtle`,disabled:_,onClick:()=>void A(),children:[_?(0,K.jsx)(z,{className:`animate-spin`,size:13}):(0,K.jsx)(Ce,{size:13}),u(_?`config:configPage.testingGeneration`:`config:configPage.testGeneration`)]}),(0,K.jsxs)(H,{onClick:s,children:[(0,K.jsx)(Xe,{size:13}),u(`config:configPage.visualQuickSetup`)]})]})]}),y&&(0,K.jsxs)(`div`,{className:`flex items-center gap-[10px] [margin-top:10px] [border:1px_solid_var(--stroke-soft)] rounded-[var(--r-sm)] bg-[var(--surface-subtle)] p-[8px_10px]`,children:[y.previewDataUrl?(0,K.jsx)(`img`,{src:y.previewDataUrl,alt:y.modelName,className:`h-[44px] w-[44px] flex-none rounded-[var(--r-xs)] object-cover`}):(0,K.jsx)(fe,{size:16,className:`flex-none text-[var(--success)]`}),(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-[1px] text-[12px]`,children:[(0,K.jsx)(`strong`,{className:`text-[var(--success-strong)]`,children:u(`config:configPage.testSucceeded`)}),(0,K.jsxs)(`span`,{className:`overflow-hidden text-ellipsis whitespace-nowrap text-[var(--text-muted)]`,children:[y.providerName,` / `,y.modelName,` · `,y.path]})]})]})]}),(0,K.jsxs)(S,{open:E,onOpenChange:j,children:[(0,K.jsx)(x,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,className:`group flex w-full cursor-pointer items-center gap-[7px] border-0 bg-transparent p-[4px_2px] text-left`,children:[(0,K.jsx)(pe,{size:15,className:`flex-none text-[var(--text-muted)] transition-transform group-data-[state=closed]:-rotate-90`}),(0,K.jsx)(`span`,{className:`shrink-0 text-[13px] font-[700] text-[var(--text-secondary)]`,children:u(`config:configPage.visualConnections`)}),(0,K.jsx)(`span`,{className:`min-w-0 text-[12px] text-[var(--text-tertiary)]`,children:u(`config:configPage.visualConnectionsHint`)})]})}),(0,K.jsx)(b,{children:(0,K.jsxs)(Y,{children:[(0,K.jsx)(fi,{providers:M,toggling:r,onClone:o,onConfigure:e=>l(e.id),onToggle:i,onDelete:a}),N.length===0&&(0,K.jsx)(`p`,{className:`[margin:2px_0_0] text-[12px] text-[var(--text-muted)]`,children:u(`config:configPage.visualEmptyHint`)}),(ee.length>0||te.length>0)&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-[8px] [border-top:1px_solid_var(--stroke-soft)] [margin-top:10px] pt-[10px]`,children:[ee.length>0&&(0,K.jsxs)(`div`,{className:`flex items-center gap-[8px]`,children:[(0,K.jsx)(`span`,{className:`w-[64px] flex-none text-[12px] text-[var(--text-muted)]`,children:u(`config:configPage.visualImageModel`)}),(0,K.jsxs)(P,{className:`min-w-0 flex-1`,value:d?.imageSelection||``,disabled:h===`image`,"aria-label":u(`config:configPage.visualImageModel`),onChange:e=>void k(`image`,e.target.value),children:[(0,K.jsx)(`option`,{value:``,children:u(`config:configPage.visualAutoSelected`)}),ee.map(e=>(0,K.jsxs)(`option`,{value:`${e.providerId}/${e.id}`,children:[e.providerName,` · `,e.name]},`${e.providerId}/${e.id}`))]})]}),te.length>0&&(0,K.jsxs)(`div`,{className:`flex items-center gap-[8px]`,children:[(0,K.jsx)(`span`,{className:`w-[64px] flex-none text-[12px] text-[var(--text-muted)]`,children:u(`config:configPage.visualVideoModel`)}),(0,K.jsxs)(P,{className:`min-w-0 flex-1`,value:d?.videoSelection||``,disabled:h===`video`,"aria-label":u(`config:configPage.visualVideoModel`),onChange:e=>void k(`video`,e.target.value),children:[(0,K.jsx)(`option`,{value:``,children:u(`config:configPage.visualAutoSelected`)}),te.map(e=>(0,K.jsxs)(`option`,{value:`${e.providerId}/${e.id}`,children:[e.providerName,` · `,e.name]},`${e.providerId}/${e.id}`))]})]}),(0,K.jsx)(`small`,{className:`text-[11px] text-[var(--text-tertiary)]`,children:u(`config:configPage.visualModelsAreSelectedByTheVisualGenerationToolAndDoNotAppearInTheChatModelList`)})]})]})})]}),w&&(0,K.jsx)(`div`,{className:`[margin-top:10px]`,children:(0,K.jsxs)(ct,{children:[(0,K.jsx)(Ye,{size:13}),w]})})]})}var gi=`pisper.config.manageConnectionsOpen`;function _i(){let e=n.getItem(gi);return e===`1`||e!==`0`&&null}function vi({notify:e,registerPrimaryAction:r,requestConfirm:i}){let{t:a}=c(),o=t(),s=new URLSearchParams(o.search).get(`import`)===`1`,[l,u]=(0,G.useState)(``),[d,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(null),[h,g]=(0,G.useState)(()=>s?!0:_i());(0,G.useEffect)(()=>{s&&g(!0)},[s]);let _=ui({notify:e,requestConfirm:i,t:a}),{config:v}=_,y=di({requestConfirm:i,onAutoImported:_.refreshConfig,onImported:t=>{_.applyConfig(t.config);let n=t.config.providers.find(e=>e.id===t.providerId);e(t.kind===`authentication`?a(`config:configPage.nameLoginStateHasBeenLoadedIntoPisper`,{name:n?.name||t.providerId}):a(`config:configPage.nameConfigurationHasBeenLoadedIntoPisper`,{name:n?.name||t.providerId}))},t:a});if(wt(r,()=>f({providerType:`chat`})),!v)return(0,K.jsxs)(ft,{children:[(0,K.jsx)(z,{className:`animate-spin`,size:24}),(0,K.jsx)(`h2`,{children:a(`config:configPage.loadingModelCatalog`)}),(0,K.jsx)(`p`,{children:a(`config:configPage.readingProvidersAndAuthenticationStatus`)}),_.error&&(0,K.jsx)(ct,{children:_.error})]});let C=v.defaultProvider||v.provider,w=v.providers.find(e=>e.id===C&&e.configured),T=v.defaultModel||v.model,E=h??!1,D=Qr(y.discovery),O=e=>{g(e),n.setItem(gi,e?`1`:`0`)},k=e=>m(e);return(0,K.jsxs)(K.Fragment,{children:[w&&T&&(0,K.jsx)(`div`,{className:`mb-4 text-sm`,children:(0,K.jsxs)(`p`,{className:`min-w-0 truncate text-muted-foreground`,children:[a(`config:configPage.currentChatModel`),` ·`,` `,(0,K.jsxs)(`span`,{className:`text-foreground`,children:[w.name,` / `,T]})]})}),(0,K.jsxs)(`p`,{className:`mb-4 flex items-center gap-2 text-xs text-muted-foreground`,role:`status`,children:[y.discovering&&(0,K.jsx)(z,{size:12,className:`animate-spin`}),y.discovering?a(`config:providerWorkbench.scanningLocal`):a(`config:providerWorkbench.localImportStatus`,{imported:y.autoImport.imported,skipped:y.autoImport.skipped})]}),(0,K.jsx)(Kr,{config:v,selectedProviderId:l,onSelectProvider:u,toggling:_.toggling,settingDefault:_.settingDefault,settingModel:_.settingModel,onSave:t=>{_.applyConfig(t),e(a(`config:configPage.providerConnectionUpdated`))},onClone:k,onDelete:_.deleteProvider,deletingModel:_.deletingModel,onDeleteModel:_.deleteModel,onToggle:_.toggleProvider,onSetDefault:_.setDefaultProvider,onSetDefaultModel:_.setProviderDefaultModel}),_.error&&(0,K.jsx)(ct,{children:_.error}),D>0&&(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0 text-[length:var(--app-small-size)] text-[var(--text-muted)]`,children:[(0,K.jsx)(`span`,{children:a(`config:configPage.localProviderImportHint`,{count:D})}),(0,K.jsx)(H,{type:`button`,variant:`link`,size:`sm`,className:`h-auto min-h-11 shrink-0 px-1 py-0 font-normal text-[var(--text-secondary)] sm:min-h-8`,"aria-expanded":E,"aria-controls":`model-connection-management`,onClick:()=>O(!0),children:a(`config:configPage.reviewLocalProviders`)})]}),(0,K.jsxs)(S,{open:E,onOpenChange:O,"data-config-card":`models-advanced`,children:[(0,K.jsx)(x,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,className:`group flex w-full cursor-pointer items-center gap-[7px] [margin:2px_0_10px] border-0 bg-transparent p-[4px_2px] text-left`,children:[(0,K.jsx)(pe,{size:15,className:`shrink-0 text-[var(--text-muted)] transition-transform group-data-[state=closed]:-rotate-90`}),(0,K.jsx)(`span`,{className:`shrink-0 text-[13px] font-[700] text-[var(--text-secondary)]`,children:a(`config:providerWorkbench.advanced`)}),(0,K.jsx)(`span`,{className:`min-w-0 text-[12px] text-[var(--text-tertiary)]`,children:a(`config:providerWorkbench.advancedHint`)})]})}),(0,K.jsxs)(b,{id:`model-connection-management`,children:[(0,K.jsx)(ai,{discovery:y.discovery,discovering:y.discovering,error:y.error||y.operationError,importing:y.importing,forceVisible:s,onRefresh:y.refresh,onImport:y.importProvider}),(0,K.jsx)(`div`,{className:`[margin-top:12px]`,children:(0,K.jsx)(ci,{config:v,notify:e,onConfigChanged:_.applyConfig})}),(0,K.jsx)(hi,{config:v,notify:e,toggling:_.toggling,onToggleProvider:_.toggleProvider,onCloneProvider:k,onDeleteProvider:_.deleteProvider,onQuickSetup:()=>f({providerType:`visual`}),onEditVisualProvider:e=>{let t=v.providers.find(t=>t.id===e);t&&(u(t.id),document.querySelector(`[data-model-provider-split-panel]`)?.scrollIntoView({block:`start`,behavior:`smooth`}))}})]})]}),d&&(0,K.jsx)(si,{config:v,providerType:d.providerType||`chat`,initialProviderId:d.providerId,onConfigChanged:e=>{_.applyConfig(e),e.createdProviderId&&u(e.createdProviderId)},onClose:()=>f(null),onCompleted:t=>{_.applyConfig(t),t.createdProviderId&&u(t.createdProviderId),e(a(`config:configPage.setupComplete`)),f(null)}}),p&&(0,K.jsx)(Zr,{initialProviderType:p.type,cloneProvider:p,onClose:()=>m(null),onCreated:t=>{_.applyConfig(t),t.createdProviderId&&u(t.createdProviderId),e(a(`config:configPage.providerConnectionCreated`)),m(null)}})]})}function Q(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 yi(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 bi,$,xi,Si,Ci=`__TAURI_TO_IPC_KEY__`;function wi(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}var Ti=class{constructor(e){bi.set(this,void 0),$.set(this,0),xi.set(this,[]),Si.set(this,void 0),yi(this,bi,e||(()=>{}),`f`),this.id=wi(e=>{let t=e.index;if(`end`in e){t==Q(this,$,`f`)?this.cleanupCallback():yi(this,Si,t,`f`);return}let n=e.message;if(t==Q(this,$,`f`)){for(Q(this,bi,`f`).call(this,n),yi(this,$,Q(this,$,`f`)+1,`f`);Q(this,$,`f`)in Q(this,xi,`f`);){let e=Q(this,xi,`f`)[Q(this,$,`f`)];Q(this,bi,`f`).call(this,e),delete Q(this,xi,`f`)[Q(this,$,`f`)],yi(this,$,Q(this,$,`f`)+1,`f`)}Q(this,$,`f`)===Q(this,Si,`f`)&&this.cleanupCallback()}else Q(this,xi,`f`)[t]=n})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(e){yi(this,bi,e,`f`)}get onmessage(){return Q(this,bi,`f`)}[(bi=new WeakMap,$=new WeakMap,xi=new WeakMap,Si=new WeakMap,Ci)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[Ci]()}};function Ei(e,t){let n=window.__TAURI__?.core?.invoke??window.__TAURI_INTERNALS__?.invoke;return n?n(e,t):Promise.reject(Error(`native bridge unavailable`))}function Di(e,t){return Ei(`plugin:barcode-scanner|${e}`,t)}function Oi(e){return e instanceof Error?e.message:String(e)}function ki(e){return/cancel(?:led|ed)/i.test(Oi(e))}function Ai(){return new Promise(e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))})}function ji(e){return Array.isArray(e)?new TextDecoder().decode(Uint8Array.from(e)):``}function Mi(e){if(!e.isActive||!e.port)return null;let t=ji(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=ji(e.txt.name)||e.name||`Pisper Desktop`,a=`https://${r}:${e.port}`;return{id:`${e.fullName}:${a}`,name:i,url:a,fingerprint:t}}function Ni(e){return new Promise(t=>window.setTimeout(t,e))}function Pi({open:e,onOpenChange:t}){let{t:n}=c(),[r,i]=(0,G.useState)(null),[a,o]=(0,G.useState)(!1),[s,l]=(0,G.useState)([]),[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(``),[m,h]=(0,G.useState)(``),[g,_]=(0,G.useState)(``),v=(0,G.useRef)(!1),y=(0,G.useRef)(!1),b=(0,G.useRef)(!1),x=(0,G.useRef)(0),S=(0,G.useRef)(``),C=(0,G.useCallback)(e=>{v.current=e,o(e)},[]),w=(0,G.useCallback)(async()=>{y.current=!0,v.current&&await Di(`cancel`).catch(()=>void 0),C(!1),i(null)},[C]);(0,G.useEffect)(()=>{if(!a)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)}},[a]),(0,G.useEffect)(()=>{if(!a)return;let e=`pisper-scanner-${Date.now()}`;window.history.pushState({...window.history.state,pisperScanner:e},``);let t=()=>void w();return window.addEventListener(`popstate`,t),()=>{window.removeEventListener(`popstate`,t),!b.current&&window.history.state?.pisperScanner===e&&window.history.back()}},[w,a]);let T=e=>{if(!e.proxyUrl)throw Error(n(`config:mobileServer.pairFailed`));window.location.replace(e.proxyUrl)},E=(0,G.useCallback)(async()=>{let e=++x.current;d(!0),p(``),l([]);let t=new Ti;t.onmessage=t=>{if(x.current!==e)return;if(t.reason===`permission-denied`){p(n(`config:mobileServer.localNetworkDenied`));return}if(t.reason?.startsWith(`error:`)){p(n(`config:mobileServer.discoveryFailed`));return}if(!t.service)return;if(!t.service.isActive){l(e=>e.filter(e=>!e.id.startsWith(`${t.service?.fullName}:`)));return}let r=Mi(t.service);r&&l(e=>[...e.filter(e=>e.fingerprint!==r.fingerprint),r])};let r=null;try{await Ei(`mobile_ensure_local_network_permission`),r=(await Ei(`plugin:dns-sd|browse_start`,{options:{service:{type:`pisper`,protocol:`tcp`,domain:`local`},timeoutMs:4e3},channel:t})).browseId,await Ni(4300)}catch(t){x.current===e&&p(Oi(t).includes(`local_network_permission_denied`)?n(`config:mobileServer.localNetworkDenied`):n(`config:mobileServer.discoveryFailed`))}finally{r!==null&&await Ei(`plugin:dns-sd|browse_stop`,{browseId:r}).catch(()=>void 0),x.current===e&&d(!1)}},[n]);(0,G.useEffect)(()=>{if(!(!e||a))return E(),()=>{x.current+=1}},[E,e,a]);let D=(0,G.useCallback)(async()=>{let e=S.current;S.current=``,e&&await Ei(`mobile_cancel_lan_pairing`,{operationId:e}).catch(()=>void 0),i(null),h(``)},[]),O=async e=>{let t=globalThis.crypto?.randomUUID?.()||`lan-${Date.now()}-${Math.random().toString(16).slice(2)}`;S.current=t,i(`lan:${e.id}`),_(``),h(n(`config:mobileServer.awaitingApproval`,{name:e.name}));try{let n=await Ei(`mobile_pair_lan`,{operationId:t,name:e.name,url:e.url,fingerprint:e.fingerprint,deviceName:null});if(S.current!==t)return;T(n)}catch(e){S.current===t&&_(Oi(e))}finally{S.current===t&&(S.current=``,i(null),h(``))}},k=async()=>{y.current=!1,b.current=!1,i(`scan`),_(``);try{let e=await Di(`check_permissions`);if(e.camera!==`granted`&&(e=await Di(`request_permissions`)),e.camera!==`granted`)throw Error(n(`config:mobileServer.cameraDenied`));if(y.current||(C(!0),await Ai(),y.current))return;let t=await Di(`scan`,{windowed:!0,formats:[]});if(!t.content)throw Error(n(`config:mobileServer.scanFailed`));b.current=!0,T(await Ei(`mobile_pair`,{payloadJson:t.content,deviceName:null}))}catch(e){!y.current&&!ki(e)&&_(Oi(e))}finally{C(!1),i(null),y.current=!1}};return(0,K.jsx)(it,{open:e,onOpenChange:e=>{if(!e&&a){w();return}if(!e&&r?.startsWith(`lan:`)){D(),t(!1);return}r||(e||_(``),t(e))},children:(0,K.jsx)(nt,{showCloseButton:!a,overlayClassName:a?`bg-transparent supports-backdrop-filter:backdrop-blur-none`:void 0,className:a?`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:a?e=>e.preventDefault():void 0,children:a?(0,K.jsxs)(`div`,{className:`flex h-dvh w-screen flex-col overflow-hidden`,children:[(0,K.jsxs)(tt,{className:`sr-only`,children:[(0,K.jsx)(rt,{children:n(`config:mobileServer.scanTitle`)}),(0,K.jsx)(et,{children:n(`config:mobileServer.scanHint`)})]}),(0,K.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,K.jsxs)(H,{variant:`ghost`,className:`h-10 bg-black/40 px-3 text-white hover:bg-black/70 hover:text-white`,onClick:()=>void w(),children:[(0,K.jsx)(ie,{}),n(`config:mobileServer.cancelScan`)]}),(0,K.jsx)(`div`,{className:`min-w-0 truncate text-sm font-medium`,children:n(`config:mobileServer.scanTitle`)}),(0,K.jsx)(`div`,{className:`w-[88px]`,"aria-hidden":`true`})]}),(0,K.jsx)(`main`,{className:`grid min-h-0 flex-1 place-items-center p-6`,children:(0,K.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,K.jsx)(cr,{className:`absolute top-1/2 left-1/2 size-10 -translate-x-1/2 -translate-y-1/2 text-white/75`})})}),(0,K.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,K.jsx)(`p`,{className:`max-w-sm text-sm leading-relaxed text-white/90`,children:n(`config:mobileServer.scanHint`)}),(0,K.jsx)(H,{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 w(),children:n(`config:mobileServer.cancelScan`)})]})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(tt,{children:[(0,K.jsx)(rt,{children:n(`config:mobileServer.addServer`)}),(0,K.jsx)(et,{children:n(`config:mobileServer.discoverDescription`)})]}),(0,K.jsxs)(`section`,{className:`grid gap-2`,"aria-live":`polite`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,K.jsx)(sr,{className:`size-4`}),n(`config:mobileServer.nearby`)]}),(0,K.jsx)(H,{size:`icon-sm`,variant:`ghost`,disabled:u||r!==null,"aria-label":n(`config:mobileServer.rediscover`),onClick:()=>void E(),children:(0,K.jsx)(z,{className:u?`animate-spin`:void 0})})]}),s.length?(0,K.jsx)(`ul`,{className:`grid max-h-44 gap-1.5 overflow-y-auto`,children:s.map(e=>{let t=r===`lan:${e.id}`;return(0,K.jsxs)(`li`,{className:`flex min-h-12 items-center justify-between gap-3 rounded-md border px-3 py-2`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(B,{className:`size-4 flex-none text-muted-foreground`}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`div`,{className:`truncate text-sm`,children:e.name}),(0,K.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e.url})]})]}),(0,K.jsxs)(H,{size:`sm`,disabled:r!==null,onClick:()=>void O(e),children:[t?(0,K.jsx)(Ne,{className:`animate-spin`}):null,n(`config:mobileServer.requestConnect`)]})]},e.id)})}):(0,K.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:n(u?`config:mobileServer.discovering`:`config:mobileServer.noNearby`)}),f?(0,K.jsx)(`p`,{className:`text-xs leading-relaxed text-destructive`,children:f}):null,m?(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md bg-muted px-3 py-2`,children:[(0,K.jsx)(`p`,{className:`text-xs leading-relaxed`,children:m}),(0,K.jsx)(H,{size:`sm`,variant:`outline`,onClick:()=>void D(),children:n(`config:mobileServer.cancelRequest`)})]}):null]}),(0,K.jsxs)(`div`,{className:`relative py-1`,children:[(0,K.jsx)(ne,{}),(0,K.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,K.jsxs)(H,{className:`w-full`,disabled:r!==null,onClick:()=>void k(),children:[r===`scan`?(0,K.jsx)(Ne,{className:`animate-spin`}):(0,K.jsx)(or,{}),n(`config:mobileServer.scan`)]}),g?(0,K.jsx)(`p`,{className:`text-xs leading-relaxed text-destructive`,children:g}):null]})})})}function Fi(e,t){let n=window.__TAURI__?.core?.invoke??window.__TAURI_INTERNALS__?.invoke;return n?n(e,t):Promise.reject(Error(`native bridge unavailable`))}function Ii({requestConfirm:e}){let{t}=c(),[n,r]=(0,G.useState)(null),[i,a]=(0,G.useState)(``),[o,s]=(0,G.useState)(``),[l,u]=(0,G.useState)(!1),d=(0,G.useCallback)(async()=>{try{r(await Fi(`mobile_state`)),a(``)}catch{a(t(`config:mobileServer.loadFailed`))}},[t]);(0,G.useEffect)(()=>{d()},[d]);let f=async(e,t,n=``)=>{s(n||e);try{r(await Fi(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 Fi(`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`);return(0,K.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex min-h-10 items-center gap-2 rounded-[var(--r-sm)] border px-3 py-2 text-[12px] ${_?`border-[var(--success)] bg-[var(--success-soft)] text-[var(--success-strong)]`:`border-[var(--stroke)] bg-[var(--surface-subtle)] text-[var(--text-muted)]`}`,role:`status`,"aria-live":`polite`,children:[(0,K.jsx)(_?he:me,{size:15,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:v}),n?.activeTransport?(0,K.jsx)(`span`,{className:`flex-none text-[11px] opacity-80`,children:n.activeTransport===`iroh`?t(`config:mobileServer.transportP2p`):t(`config:mobileServer.transportLan`)}):null]}),(0,K.jsx)(Pi,{open:l,onOpenChange:u}),(0,K.jsxs)(Y,{className:`flex flex-col gap-3 p-4`,"data-config-card":`mobile-server-main`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-[11px]`,children:[(0,K.jsx)(`span`,{className:`grid size-[38px] flex-none place-items-center rounded-[var(--r-sm)] bg-[var(--star-soft)] text-[var(--star-strong)]`,children:(0,K.jsx)(Me,{size:19})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h2`,{className:`text-[16px]`,children:t(`config:mobileServer.title`)}),(0,K.jsx)(`p`,{className:`mt-1 text-[13px] leading-[1.55] text-[var(--text-muted)]`,children:t(`config:mobileServer.description`)})]})]}),(0,K.jsxs)(H,{size:`sm`,className:`max-[650px]:h-10 max-[650px]:px-3`,onClick:()=>u(!0),children:[(0,K.jsx)(Re,{size:14}),t(`config:mobileServer.addServer`)]})]}),i?(0,K.jsx)(`p`,{className:`text-[12px] text-[var(--danger)]`,children:i}):null]}),(0,K.jsx)(Y,{className:`flex flex-col gap-3 p-4`,"data-config-card":`mobile-server-local`,children:(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 basis-48 items-start gap-[11px]`,children:[(0,K.jsx)(`span`,{className:`grid size-[38px] flex-none place-items-center rounded-[var(--r-sm)] bg-[var(--star-soft)] text-[var(--star-strong)]`,children:(0,K.jsx)(lr,{size:19})}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`h2`,{className:`flex flex-wrap items-center gap-2 text-[16px]`,children:[t(`config:mobileServer.localTitle`),h?(0,K.jsx)(`span`,{className:`text-[11px] text-[var(--star-strong)]`,children:t(`config:mobileServer.currentLocal`)}):null]}),(0,K.jsx)(`p`,{className:`mt-1 text-[13px] leading-[1.55] text-[var(--text-muted)]`,children:t(`config:mobileServer.localDescription`)})]})]}),(0,K.jsx)(H,{size:`sm`,variant:`outline`,className:`flex-none max-[650px]:h-10 max-[650px]:px-3`,disabled:h||!!o,onClick:()=>void(async()=>{s(`mobile_enter_local`);try{let e=await Fi(`mobile_enter_local`);e.onDevice.url&&window.location.replace(e.onDevice.url)}catch(e){a(String(e))}finally{s(``)}})(),children:t(h?`config:mobileServer.currentLocal`:`config:mobileServer.enterLocal`)})]})}),(0,K.jsx)(Y,{className:`flex flex-col gap-3 p-4`,children:n?.servers?.length?(0,K.jsx)(`ul`,{className:`flex flex-col gap-2`,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,K.jsxs)(`li`,{className:`flex items-center justify-between gap-3 rounded-[var(--r-sm)] border border-[var(--border)] px-3 py-2 max-[650px]:items-start max-[650px]:flex-wrap`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(B,{size:15,className:`flex-none text-[var(--text-muted)]`}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`truncate text-[13px]`,children:[e.name,r?(0,K.jsx)(`span`,{className:`ml-2 text-[11px] text-[var(--star-strong)]`,children:t(`config:mobileServer.current`)}):null]}),(0,K.jsxs)(`div`,{className:`truncate text-[11px] text-[var(--text-muted)]`,children:[s,(0,K.jsx)(`span`,{className:`ml-2`,children:t(i&&a?`config:mobileServer.transportLanP2p`:a?`config:mobileServer.transportP2p`:`config:mobileServer.transportLan`)})]}),r&&n.activeTransport?(0,K.jsx)(`div`,{className:`text-[11px] text-[var(--star-strong)]`,children:t(`config:mobileServer.activeTransport`,{transport:n.activeTransport===`iroh`?t(`config:mobileServer.transportP2p`):t(`config:mobileServer.transportLan`)})}):null]})]}),(0,K.jsxs)(`div`,{className:`flex flex-none items-center gap-1`,children:[r?null:(0,K.jsx)(H,{size:`sm`,variant:`ghost`,className:`max-[650px]:h-10 max-[650px]:px-3`,disabled:o===e.id,onClick:()=>void m(e.id),children:t(`config:mobileServer.connect`)}),(0,K.jsx)(H,{size:`sm`,variant:`ghost`,className:`max-[650px]:size-10`,"aria-label":t(`config:mobileServer.forget`),title:t(`config:mobileServer.forget`),disabled:!!o,onClick:()=>void p(e),children:(0,K.jsx)(Je,{size:14})})]})]},e.id)})}):(0,K.jsx)(`p`,{className:`text-[12px] text-[var(--text-muted)]`,children:t(`config:mobileServer.empty`)})})]})}var Li={feishu:{tone:`blue`},weixin:{tone:`green`},qq:{tone:`blue`},telegram:{tone:`blue`},browser:{tone:`blue`}};function Ri(e,t){return t(e===`feishu`?`config:notificationSettings.feishu`:e===`weixin`?`config:notificationSettings.weChat`:e===`qq`?`config:notificationSettings.qq`:e===`telegram`?`config:notificationSettings.telegram`:`config:notificationSettings.browserNotification`)}function zi(e,t,n){return e===`chat.completed`?n(`config:notificationSettings.chatCompleted`):e===`chat.waiting`?n(`config:notificationSettings.chatWaiting`):e===`schedule.completed`?n(`config:notificationSettings.scheduleCompleted`):e===`schedule.failed`?n(`config:notificationSettings.scheduleFailed`):e===`workflow.completed`?n(`config:notificationSettings.workflowCompleted`):e===`workflow.failed`?n(`config:notificationSettings.workflowFailed`):t}function Bi(e,t,n){return e===`chat.completed`?n(`config:notificationSettings.chatCompletedDescription`):e===`chat.waiting`?n(`config:notificationSettings.chatWaitingDescription`):e===`schedule.completed`?n(`config:notificationSettings.scheduleCompletedDescription`):e===`schedule.failed`?n(`config:notificationSettings.scheduleFailedDescription`):e===`workflow.completed`?n(`config:notificationSettings.workflowCompletedDescription`):e===`workflow.failed`?n(`config:notificationSettings.workflowFailedDescription`):t}function Vi(e,t){let n={"chat.title":t(`config:notificationSettings.fixChannelNotification`),"chat.summary":t(`config:notificationSettings.implementationIsCompleteTestsAndBuildHavePassed`),"chat.tool":`bash`,"chat.reason":t(`config:notificationSettings.confirmationIsRequired`),"chat.model":`openai/gpt-5.4`,"task.name":t(`config:notificationSettings.dailyCodeReview`),"task.summary":t(`config:notificationSettings.found2IssuesToAddressTheReportHasBeenArchived`),"task.duration":t(`config:notificationSettings.message2Min18Sec`),"task.nextRun":t(`config:notificationSettings.tomorrow0900`),"task.error":t(`config:notificationSettings.testProcessTimedOut`),"workflow.name":t(`config:notificationSettings.preReleaseChecks`),"workflow.summary":t(`config:notificationSettings.testsBuildAndSecurityChecksHaveAllPassed`),"workflow.duration":t(`config:notificationSettings.message6Min42Sec`),"workflow.runId":`run_20260718_001`,"workflow.node":t(`config:notificationSettings.endToEndTests`),"workflow.error":t(`config:notificationSettings.browserFailedToStart`)};return String(e||``).replace(/\{\{\s*([\w.]+)\s*\}\}/g,(e,t)=>n[t]||`{{${t}}}`)}function Hi(){return typeof window<`u`&&window.pisperDesktop?.showNotification?window.pisperDesktop.getNotificationStatus?`checking`:`granted`:typeof window<`u`&&je()?`checking`:Mt()}function Ui(e,t){return t(e===`system-disabled`||e===`app-disabled`?`config:notificationSettings.systemNotificationsAreOffAllowPisperToSendNotificationsInYourOperatingSystemSettings`:e===`unsupported`?`config:notificationSettings.systemNotificationsAreNotSupportedInThisEnvironment`:`config:notificationSettings.theOperatingSystemDidNotAcceptTheNotificationCheckYourSystemNotificationSettings`)}function Wi(e){return e instanceof Error?e.message:String(e)}function Gi({notify:e,onBrowserNotificationChange:t}){let{t:n}=c(),[r,i]=(0,G.useState)({browser:{enabled:!1},connections:{},scopes:[],templates:[]}),[a,o]=(0,G.useState)(!0),[s,l]=(0,G.useState)(``),u=!!window.pisperDesktop?.showNotification,d=je(),[f,p]=(0,G.useState)(Hi),[m,h]=(0,G.useState)(!1),g=(0,G.useCallback)(async()=>{if(!u)return;let e=window.pisperDesktop?.getNotificationStatus;if(!e){p(`granted`);return}try{let t=await e(),n=t?.permission;p(n==="default"||n===`denied`||n===`granted`||n===`checking`||n===`unsupported`?n:t?.supported===!1?`unsupported`:`granted`)}catch{p(`unsupported`)}},[u]),_=(0,G.useCallback)(async()=>{try{l(``);let e=await V(`/api/settings/notifications`);i(e),t?.(e)}catch(e){l(Wi(e))}finally{o(!1)}},[t]);(0,G.useEffect)(()=>{_()},[_]),(0,G.useEffect)(()=>{if(!u)return;g();let e=()=>{g()};return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[u,g]);let v=(0,G.useCallback)(async()=>{if(!(u||!d))try{let e=await Oe();p(e===!0?`granted`:e===!1?`denied`:`default`)}catch{p(`unsupported`)}},[u,d]);(0,G.useEffect)(()=>{if(u||!d)return;v();let e=()=>void v();return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[u,d,v]);let y=async r=>{let a=``;if(r){if(u&&f!==`granted`)a=Ui(`system-disabled`,n);else if(!u&&d){let e=`denied`;try{let t=await Oe()===!0?`granted`:await Ae();e=t===`granted`?`granted`:t===`denied`?`denied`:`default`}catch{e=`unsupported`}p(e),e!==`granted`&&(a=n(`config:notificationSettings.systemNotificationsAreOffAllowPisperToSendNotificationsInYourOperatingSystemSettings`))}else if(!u){let e=await jt();if(p(e),e!==`granted`)a=n(e===`unsupported`?`config:notificationSettings.systemNotificationsAreNotSupportedInThisEnvironment`:`config:notificationSettings.notificationPermissionWasNotGrantedAllowNotificationsInTheBrowserSiteSettings`);else try{await At()}catch{a=n(`config:notificationSettings.theBrowserBackgroundNotificationServiceCouldNotBeRegistered`)}}}h(!0);try{let o=await V(`/api/settings/notifications/browser`,{method:`PATCH`,body:JSON.stringify({enabled:r})});i(o),t?.(o),a?e(n(`config:notificationSettings.savedButLocalDeliveryUnavailable`,{reason:a}),`info`):e(n(r?`config:notificationSettings.notificationsEnabled`:`config:notificationSettings.notificationsDisabled`))}catch(t){e(Wi(t),`error`)}finally{h(!1)}},b=(0,G.useCallback)(async(e,t,r=`pisper-browser-test`)=>{if(u){let r=window.pisperDesktop?.showNotification;if(!r)throw Error(n(`config:notificationSettings.systemNotificationsAreNotSupportedInThisEnvironment`));let i=await r({title:e,body:t});if(i&&typeof i==`object`&&i.shown===!1)throw p(i.permission??`denied`),Error(Ui(i.reason,n));return i}return d?(await Te(e,t),{shown:!0,transport:`tauri`}):kt({title:e,body:t,tag:r,url:window.location.href})},[u,d,n]),x=async()=>{if(f!==`granted`){e(f===`unsupported`?Ui(`unsupported`,n):u?Ui(`system-disabled`,n):n(`config:notificationSettings.notificationPermissionWasNotGrantedAllowNotificationsInTheBrowserSiteSettings`),`error`);return}try{await b(n(`config:notificationSettings.appNotificationTest`,{app:Et}),n(`config:notificationSettings.notificationsAreWorking`)),e(n(`config:notificationSettings.theTestNotificationWasSentCheckYourSystemNotificationCenter`),`info`)}catch(t){e(Wi(t)||n(`config:notificationSettings.theOperatingSystemDidNotAcceptTheNotificationCheckYourSystemNotificationSettings`),`error`)}},S=async()=>{try{await window.pisperDesktop?.openNotificationSettings?.()||e(n(`config:notificationSettings.openNotificationPermissionsInYourOperatingSystemSettings`),`info`)}catch{e(n(`config:notificationSettings.openNotificationPermissionsInYourOperatingSystemSettings`),`info`)}};if(a)return(0,K.jsxs)(ft,{children:[(0,K.jsx)(z,{className:`animate-spin`,size:23}),(0,K.jsx)(`h2`,{children:n(`config:notificationSettings.loadingNotificationSettings`)})]});let C=n(f===`granted`?`config:notificationSettings.permissionGranted`:f===`denied`?u?`config:notificationSettings.systemNotificationsAreOff`:`config:notificationSettings.browserNotificationsAreBlocked`:f===`unsupported`?`config:notificationSettings.notSupported`:f===`checking`?`config:notificationSettings.checking`:`config:notificationSettings.waitingForPermission`),w=f===`granted`?`green`:f==="default"||f===`checking`?`amber`:`red`;return(0,K.jsxs)(`div`,{className:`flex flex-col gap-[12px]`,children:[s&&(0,K.jsxs)(ct,{children:[(0,K.jsx)(Ye,{size:13}),s]}),(0,K.jsxs)(Y,{className:`browser-notification-card`,"data-config-card":`notifications-browser`,children:[(0,K.jsxs)(`div`,{className:`notification-option [&_>_div]:flex [&_>_div]:min-w-0 [&_>_div]:flex-col [&_>_div]:gap-[4px] [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[12px] [&_small]:leading-[1.45] grid grid-cols-[auto_minmax(0,1fr)_auto_auto] items-center gap-[11px]`,children:[(0,K.jsx)(`span`,{className:`provider-icon [&_svg]:w-[19px] [&.green]:bg-[var(--success-soft)] [&.green]:text-[var(--success)] [&.blue]:bg-[var(--brand-blue-soft)] [&.blue]:text-[var(--brand-blue-strong)] [.notification-option_&:not(.blue)]:bg-[var(--surface-muted)] [.notification-option_&:not(.blue)]:text-[var(--text-muted)] grid w-[38px] h-[38px] place-items-center rounded-[var(--r-md)] ${r.browser.enabled?`blue`:``}`,children:r.browser.enabled?(0,K.jsx)(le,{size:18}):(0,K.jsx)(Zn,{size:18})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{children:n(`config:notificationSettings.notification`)}),(0,K.jsx)(`small`,{children:n(`config:notificationSettings.pisperUsesTheCurrentPlatformNotificationSystemWhenAnAgentCompletesOrFails`)})]}),(0,K.jsx)(X,{tone:w,children:C}),(0,K.jsx)(gr,{value:r.browser.enabled,disabled:m||f===`checking`,onChange:y})]}),(0,K.jsxs)(st,{children:[(0,K.jsx)(We,{size:15}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`strong`,{children:n(u?`config:notificationSettings.controlledByOperatingSystemNotificationSettings`:`config:notificationSettings.controlledByBrowserSitePermissions`)}),(0,K.jsx)(`small`,{children:n(u?`config:notificationSettings.theDesktopAppUsesOperatingSystemNotificationsTurningThisOffDoesNotChangeTheOperatingSystemPermis`:`config:notificationSettings.theWebAppUsesBrowserSiteNotificationsTurningThisOffDoesNotChangeTheBrowserPermissionItself`)})]})]}),(0,K.jsxs)(`div`,{className:`mt-[15px] flex gap-2 max-[650px]:flex-wrap`,children:[u&&f===`denied`&&(0,K.jsxs)(H,{variant:`outline`,size:`lg`,className:`bg-surface-subtle`,onClick:S,children:[(0,K.jsx)(We,{size:14}),n(`config:notificationSettings.openSystemNotificationSettings`)]}),(0,K.jsxs)(H,{variant:`outline`,size:`lg`,className:`bg-surface-subtle`,disabled:!r.browser.enabled||f!==`granted`,onClick:x,children:[(0,K.jsx)(le,{size:14}),n(`config:notificationSettings.sendTestNotification`)]})]})]}),(0,K.jsx)(Ki,{data:r,setData:i,notify:e,permission:f,onBrowserTest:b,onSettingsChange:t})]})}function Ki({data:e,setData:t,notify:n,permission:r,onBrowserTest:i,onSettingsChange:a}){let{t:o}=c(),[s,l]=(0,G.useState)(e.templates[0]?.id||``),[u,d]=(0,G.useState)(`feishu`),f=e.templates.find(e=>e.id===s)||e.templates[0],p=f?.channels?.[u],[m,h]=(0,G.useState)(p?.content||``),[g,_]=(0,G.useState)(!1),v=e.scopes.find(e=>e.platform===u),y=u===`browser`?e.browser.enabled&&r===`granted`:!!v,b=Li;return(0,G.useEffect)(()=>{h(p?.content||``)},[s,u,p?.content]),f?(0,K.jsxs)(`div`,{className:`two-one-grid max-[900px]:grid-cols-[1fr] grid grid-cols-[minmax(0,2fr)_minmax(260px,1fr)] gap-[12px] [margin-top:0]`,children:[(0,K.jsxs)(Y,{"data-config-card":`notifications-templates`,children:[(0,K.jsxs)(`div`,{className:`channel-section-head [&_>_span]:text-[var(--text-muted)] [&_>_span]:text-[13px] flex items-center justify-between gap-[8px] [margin-bottom:8px]`,children:[(0,K.jsx)(hr,{title:o(`config:notificationSettings.notificationTemplates`)}),(0,K.jsx)(`span`,{children:o(`config:notificationSettings.sharedByChatsScheduledTasksAndWorkflows`)})]}),e.templates.map(e=>(0,K.jsxs)(`button`,{className:`channel-template-row hover:rounded-[var(--r-sm)] hover:bg-[var(--accent-soft)] [&.selected]:rounded-[var(--r-sm)] [&.selected]:bg-[var(--accent-soft)] [&_>_span:nth-child(2)]:flex [&_>_span:nth-child(2)]:min-w-0 [&_>_span:nth-child(2)]:flex-col [&_>_span:nth-child(2)]:gap-[4px] [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] grid w-full min-h-[58px] grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-[9px] border-0 [border-top:1px_solid_var(--stroke-soft)] bg-transparent [padding:8px_6px] text-left ${e.id===f.id?`selected`:``}`,onClick:()=>l(e.id),children:[(0,K.jsx)(`span`,{className:`route-icon grid w-[27px] h-[27px] place-items-center rounded-[var(--r-sm)] bg-[var(--accent-soft)] text-[var(--star-strong)]`,children:(0,K.jsx)(Ue,{size:14})}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`strong`,{children:zi(e.id,e.name,o)}),(0,K.jsx)(`small`,{children:Bi(e.id,e.description,o)})]}),(0,K.jsx)(X,{tone:e.enabled?`green`:`gray`,children:e.enabled?o(`config:notificationSettings.enabled`):o(`config:notificationSettings.disabled`)})]},e.id))]}),(0,K.jsxs)(Y,{className:`channel-template-editor [&_textarea]:min-h-[118px] [&_textarea]:font-[ui-monospace,_SFMono-Regular,_Consolas,_'Liberation_Mono',_monospace] [&_textarea]:leading-[1.55]`,children:[(0,K.jsxs)(ut,{children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h2`,{children:zi(f.id,f.name,o)}),(0,K.jsx)(`p`,{children:Bi(f.id,f.description,o)})]}),(0,K.jsx)(gr,{value:f.enabled,onChange:e=>t(t=>({...t,templates:t.templates.map(t=>t.id===f.id?{...t,enabled:e}:t)}))})]}),(0,K.jsx)(`div`,{className:`channel-template-platforms [&_>_button]:relative [&_>_button]:flex [&_>_button]:min-h-9 [&_>_button]:items-center [&_>_button]:justify-center [&_>_button]:gap-[7px] [&_>_button]:[border:1px_solid_var(--stroke)] [&_>_button]:rounded-[var(--r-sm)] [&_>_button]:bg-[var(--surface-subtle)] [&_>_button]:p-[0_9px] [&_>_button]:text-[12px] [&_>_button]:font-[700] [&_>_button.active]:border-[var(--focus)] [&_>_button.active]:bg-[var(--accent-soft)] [&_>_button.active]:text-[var(--star-strong)] max-[650px]:grid-cols-[1fr] grid grid-cols-[repeat(5,minmax(0,1fr))] gap-[7px] [margin-top:13px]`,children:Object.entries(b).map(([t,n])=>{let r=t===`browser`?e.browser.enabled:e.connections?.[t];return(0,K.jsxs)(`button`,{className:u===t?`active`:``,onClick:()=>d(t),children:[Ri(t,o),(0,K.jsx)(X,{tone:r?n.tone:`red`,className:` absolute -top-2.5 -right-1.5`,children:o(r?t===`browser`?`config:notificationSettings.enabled2`:`config:notificationSettings.connected`:t===`browser`?`config:notificationSettings.notEnabled`:`config:notificationSettings.notConnected`)})]},t)})}),(0,K.jsxs)(U,{variant:`control`,children:[o(`config:notificationSettings.messageContent`),(0,K.jsx)(`textarea`,{value:m,onChange:e=>h(e.target.value)})]}),(0,K.jsxs)(`div`,{className:`channel-template-vars [&_>_span]:mr-[3px] [&_>_span]:text-[var(--text-muted)] [&_>_span]:text-[13px] [&_code]:rounded-[var(--r-xs)] [&_code]:bg-[var(--template-code-bg)] [&_code]:text-[var(--template-code-text)] [&_code]:p-[3px_5px] [&_code]:font-[ui-monospace,_SFMono-Regular,_Consolas,_'Liberation_Mono',_monospace] [&_code]:text-[13px] flex flex-wrap items-center gap-[5px] [margin-top:10px]`,children:[(0,K.jsx)(`span`,{children:o(`config:notificationSettings.availableVariables`)}),f.variables.map(e=>(0,K.jsx)(`code`,{children:`{{${e}}}`},e))]}),(0,K.jsxs)(`div`,{className:`channel-template-preview [&_>_small]:text-[var(--text-muted)] [&_>_small]:text-[13px] [&_pre]:m-[7px_0_0] [&_pre]:overflow-auto [&_pre]:text-[var(--text-soft)] [&_pre]:font-[inherit] [&_pre]:text-[12px] [&_pre]:leading-[1.55] [&_pre]:whitespace-pre-wrap [margin-top:10px] [border:1px_solid_var(--stroke-soft)] rounded-[var(--r-sm)] bg-[var(--surface-subtle)] [padding:9px]`,children:[(0,K.jsx)(`small`,{children:o(`config:notificationSettings.preview`)}),(0,K.jsx)(`pre`,{children:Vi(m,o)})]}),(0,K.jsxs)(`div`,{className:`flex justify-end gap-[8px] [margin-top:18px]`,children:[(0,K.jsxs)(H,{variant:`outline`,size:`lg`,className:`bg-surface-subtle`,disabled:g||!y,onClick:async()=>{_(!0);try{let e=await V(`/api/settings/notifications/templates/${encodeURIComponent(f.id)}/${u}/test`,{method:`POST`,body:`{}`});u===`browser`&&await i?.(e.title||zi(f.id,f.name,o),e.body||e.preview||``,`pisper-template-${f.id}`),n(o(u===`browser`?`config:notificationSettings.theTestNotificationWasSentCheckYourSystemNotificationCenter`:`config:notificationSettings.testNotificationSentToCountChats`,{count:e.sent}))}catch(e){n(Wi(e),`error`)}finally{_(!1)}},children:[(0,K.jsx)(Ue,{size:14}),o(`config:notificationSettings.sendTest`)]}),(0,K.jsxs)(H,{size:`lg`,disabled:g||!m.trim(),onClick:async()=>{_(!0);try{let e=await V(`/api/settings/notifications/templates/${encodeURIComponent(f.id)}/${u}`,{method:`PUT`,body:JSON.stringify({enabled:f.enabled,content:m})});t(e),a?.(e),n(o(`config:notificationSettings.notificationTemplateSaved`))}catch(e){n(Wi(e),`error`)}finally{_(!1)}},children:[g?(0,K.jsx)(z,{className:`animate-spin`,size:14}):(0,K.jsx)(Ve,{size:14}),o(`config:notificationSettings.saveTemplate`)]})]})]})]}):null}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 qi({notify:e}){let{t,language:n}=c(),[r,i]=(0,G.useState)(null),[a,o]=(0,G.useState)(null),[s,l]=(0,G.useState)([]),[u,d]=(0,G.useState)([]),[f,p]=(0,G.useState)(null),[m,h]=(0,G.useState)(!1),[g,_]=(0,G.useState)(``),[v,y]=(0,G.useState)(``),[b,x]=(0,G.useState)(!1),[S,C]=(0,G.useState)(``),w=(0,G.useCallback)(async()=>{try{let[e,t,n,r]=await Promise.all([V(`/api/remote/status`),V(`/api/remote/devices`),V(`/api/remote/pairing-requests`).catch(()=>({requests:[]})),V(`/api/remote/firewall`).catch(e=>{if(e&&typeof e==`object`&&`status`in e&&e.status===403)return null;throw e})]);i(e),o(r),l(t.devices.filter(e=>!e.revokedAt)),d(n.requests),C(``)}catch{C(t(`config:remoteAccess.loadFailed`))}},[t]);(0,G.useEffect)(()=>{w()},[w]),(0,G.useEffect)(()=>{if(!r?.listening)return;let e=window.setInterval(()=>void w(),2e3);return()=>window.clearInterval(e)},[w,r?.listening]);let T=async n=>{x(!0);try{await V(`/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||(p(null),h(!1),_(``)),await w()}catch(n){e(t(`config:remoteAccess.toggleFailed`,{message:String(n)}),`error`)}finally{x(!1)}},E=async()=>{x(!0);try{await V(`/api/remote/firewall/retry`,{method:`POST`,body:{},timeout:15e4}),await w()}catch(n){e(t(`config:remoteAccess.firewallRetryFailed`,{message:String(n)}),`error`)}finally{x(!1)}},D={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`)},O={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`)},k=async()=>{x(!0),_(``);try{let e=await V(`/api/remote/pairing-code`,{method:`POST`});if(!e?.code||!e?.expiresAt)throw Error(t(`config:remoteAccess.qrUnavailable`));e.connectionInfo=await V(`/api/remote/connection-info`).catch(()=>void 0),p(e),h(!0),e.qrDataUrl||_(t(`config:remoteAccess.qrUnavailable`))}catch(n){let r=t(`config:remoteAccess.pairingFailed`,{message:String(n)});_(r),e(r,`error`)}finally{x(!1)}},A=async(n,r)=>{y(n.id);try{await V(`/api/remote/pairing-requests/${encodeURIComponent(n.id)}/decision`,{method:`POST`,body:{approved:r}}),await w()}catch(n){e(t(`config:remoteAccess.approvalFailed`,{message:String(n)}),`error`)}finally{y(``)}},j=async n=>{if(window.confirm(t(`config:remoteAccess.revokeConfirm`,{name:n.name})))try{await V(`/api/remote/devices/${encodeURIComponent(n.id)}/revoke`,{method:`POST`}),await w()}catch(n){e(t(`config:remoteAccess.revokeFailed`,{message:String(n)}),`error`)}};return S?(0,K.jsx)(Y,{className:`p-4 text-[13px] text-[var(--text-muted)]`,children:S}):r?(0,K.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,K.jsx)(it,{open:m&&f!==null,onOpenChange:h,children:(0,K.jsxs)(nt,{className:`sm:max-w-md`,children:[(0,K.jsxs)(tt,{children:[(0,K.jsx)(rt,{children:t(`config:remoteAccess.pairingQrTitle`)}),(0,K.jsx)(et,{children:t(`config:remoteAccess.scanQrDescription`)})]}),(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-2`,"aria-live":`polite`,children:[f?.qrDataUrl?(0,K.jsx)(`img`,{src:f.qrDataUrl,alt:t(`config:remoteAccess.qrAlt`),className:`size-64 max-w-full rounded-[var(--r-sm)] bg-white p-2`}):null,g?(0,K.jsx)(`p`,{className:`text-center text-[12px] leading-relaxed text-[var(--danger)]`,children:g}):null,f?(0,K.jsxs)(`div`,{className:`text-center`,children:[(0,K.jsx)(`div`,{className:`font-mono text-[20px] tracking-[0.2em]`,children:f.code}),(0,K.jsx)(`div`,{className:`mt-1 text-[11px] text-[var(--text-muted)]`,children:t(`config:remoteAccess.codeExpiresAt`,{time:ot(f.expiresAt,n)})})]}):null]}),f?.connectionInfo&&(0,K.jsxs)(`details`,{className:`min-w-0 rounded-md border px-3 py-2 text-sm`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer`,children:t(`remote-workspace:manualConnection`)}),(0,K.jsxs)(`div`,{className:`mt-2 space-y-2 text-xs`,children:[(0,K.jsx)(`div`,{children:t(`remote-workspace:serverAddress`)}),f.connectionInfo.endpoints.map(e=>(0,K.jsx)(`code`,{className:`block select-all break-all`,children:e.url},e.url)),(0,K.jsx)(`div`,{children:t(`remote-workspace:fingerprint`)}),(0,K.jsx)(`code`,{className:`block select-all break-all`,children:f.connectionInfo.fingerprint})]})]}),(0,K.jsx)($e,{children:(0,K.jsxs)(H,{disabled:b,onClick:()=>void k(),children:[b?(0,K.jsx)(Ne,{className:`animate-spin`}):(0,K.jsx)(z,{}),t(b?`config:remoteAccess.generatingQr`:`config:remoteAccess.regenerate`)]})})]})}),(0,K.jsxs)(Y,{className:`flex flex-col gap-3 p-4`,"data-config-card":`remote-access-main`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-[11px]`,children:[(0,K.jsx)(`span`,{className:`grid size-[38px] flex-none place-items-center rounded-[var(--r-sm)] bg-[var(--star-soft)] text-[var(--star-strong)]`,children:(0,K.jsx)(Me,{size:19})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h2`,{className:`text-[16px]`,children:t(`config:remoteAccess.title`)}),(0,K.jsx)(`p`,{className:`mt-1 text-[13px] leading-[1.55] text-[var(--text-muted)]`,children:t(`config:remoteAccess.description`)})]})]}),(0,K.jsx)(gr,{value:r.enabled,disabled:b,onChange:e=>void T(e),ariaLabel:t(`config:remoteAccess.title`)})]}),r.error?(0,K.jsx)(`p`,{className:`rounded-[var(--r-sm)] bg-[var(--danger-soft)] px-3 py-2 text-[12px] text-[var(--danger)]`,children:t(`config:remoteAccess.listenFailed`,{message:r.error})}):null]}),a?(0,K.jsxs)(Y,{className:`flex flex-col gap-3 p-4`,"aria-live":`polite`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsx)(`h3`,{className:`text-[14px]`,children:t(`config:remoteAccess.firewallTitle`)}),r.enabled||a.state===`cleanup_pending`?(0,K.jsxs)(H,{size:`sm`,disabled:b||a.busy,onClick:()=>void E(),children:[b||a.busy?(0,K.jsx)(Ne,{className:`animate-spin`}):(0,K.jsx)(z,{}),r.enabled?t(`config:remoteAccess.firewallRetry`):t(`config:remoteAccess.firewallRetryCleanup`)]}):null]}),(0,K.jsx)(`p`,{className:`text-[13px]`,children:a.busy?t(`config:remoteAccess.firewallWorking`):D[a.state]}),a.reason&&O[a.reason]?(0,K.jsx)(`p`,{className:`text-[12px] text-[var(--text-muted)]`,children:O[a.reason]}):null,r.enabled?(0,K.jsx)(`p`,{className:`text-[12px] leading-relaxed text-[var(--text-muted)]`,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,K.jsx)(`p`,{className:`text-[12px] leading-relaxed text-[var(--text-muted)]`,children:t(`config:remoteAccess.firewallReachability`)}),a.checkedAt?(0,K.jsx)(`p`,{className:`text-[11px] text-[var(--text-muted)]`,children:t(`config:remoteAccess.firewallCheckedAt`,{time:ot(a.checkedAt,n)})}):null]}):null,r.listening&&u.length?(0,K.jsxs)(Y,{className:`flex flex-col gap-3 p-4`,"aria-live":`polite`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-[14px]`,children:[(0,K.jsx)(lr,{size:16}),t(`config:remoteAccess.pendingApprovals`)]}),(0,K.jsx)(`p`,{className:`text-[12px] leading-relaxed text-[var(--text-muted)]`,children:t(`config:remoteAccess.pendingApprovalsDescription`)}),(0,K.jsx)(`ul`,{className:`flex flex-col gap-2`,children:u.map(e=>(0,K.jsxs)(`li`,{className:`flex items-center justify-between gap-3 rounded-[var(--r-sm)] border border-[var(--border)] px-3 py-2`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`div`,{className:`truncate text-[13px]`,children:e.deviceName}),(0,K.jsx)(`div`,{className:`text-[11px] text-[var(--text-muted)]`,children:t(`config:remoteAccess.requestedAt`,{time:ot(e.requestedAt,n)})}),(0,K.jsx)(`code`,{className:`block truncate text-[11px] text-[var(--text-muted)]`,children:t(`config:remoteAccess.requestSource`,{ip:e.ip})})]}),(0,K.jsxs)(`div`,{className:`flex flex-none items-center gap-1`,children:[(0,K.jsxs)(H,{size:`sm`,variant:`ghost`,disabled:v===e.id,onClick:()=>void A(e,!1),children:[(0,K.jsx)(Qe,{}),t(`config:remoteAccess.reject`)]}),(0,K.jsxs)(H,{size:`sm`,disabled:v===e.id,onClick:()=>void A(e,!0),children:[v===e.id?(0,K.jsx)(Ne,{className:`animate-spin`}):(0,K.jsx)(fe,{}),t(`config:remoteAccess.approve`)]})]})]},e.id))})]}):null,r.listening?(0,K.jsxs)(Y,{className:`flex flex-col gap-3 p-4`,"data-config-card":`remote-access-pairing`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-[14px]`,children:[(0,K.jsx)(or,{size:16}),t(`config:remoteAccess.pairing`)]}),(0,K.jsxs)(H,{size:`sm`,disabled:b,onClick:()=>void k(),children:[b?(0,K.jsx)(Ne,{className:`animate-spin`}):(0,K.jsx)(or,{}),t(b?`config:remoteAccess.generatingQr`:`config:remoteAccess.generateQr`)]})]}),(0,K.jsx)(`p`,{className:`text-[12px] leading-[1.6] text-[var(--text-muted)]`,children:t(`config:remoteAccess.pairingDescription`)}),g&&!m?(0,K.jsx)(`p`,{className:`text-[12px] leading-relaxed text-[var(--danger)]`,"aria-live":`polite`,children:g}):null]}):null,(0,K.jsxs)(Y,{className:`flex flex-col gap-3 p-4`,"data-config-card":`remote-access-devices`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-[14px]`,children:[(0,K.jsx)(lr,{size:16}),t(`config:remoteAccess.devices`)]}),(0,K.jsx)(H,{size:`sm`,variant:`ghost`,onClick:()=>void w(),"aria-label":t(`config:remoteAccess.refresh`),children:(0,K.jsx)(z,{size:14})})]}),s.length===0?(0,K.jsx)(`p`,{className:`text-[12px] text-[var(--text-muted)]`,children:t(`config:remoteAccess.noDevices`)}):(0,K.jsx)(`ul`,{className:`flex flex-col gap-2`,children:s.map(e=>(0,K.jsxs)(`li`,{className:`flex items-center justify-between gap-3 rounded-[var(--r-sm)] border border-[var(--border)] px-3 py-2`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`truncate text-[13px]`,children:[e.name,e.current?(0,K.jsx)(`span`,{className:`ml-2 text-[11px] text-[var(--text-muted)]`,children:t(`config:remoteAccess.currentDevice`)}):null]}),(0,K.jsx)(`div`,{className:`text-[11px] text-[var(--text-muted)]`,children:t(`config:remoteAccess.lastSeen`,{time:ot(e.lastSeenAt,n)})})]}),(0,K.jsx)(H,{size:`sm`,variant:`ghost`,onClick:()=>void j(e),children:t(`config:remoteAccess.revoke`)})]},e.id))})]})]}):null}function Ji({requestConfirm:e}){let{t}=c(),n=window.pisperDesktop?.remoteWorkspaces,[r,i]=(0,G.useState)([]),[a,o]=(0,G.useState)(``),[s,l]=(0,G.useState)(``),[u,d]=(0,G.useState)(``),[f,p]=(0,G.useState)(``),[m,h]=(0,G.useState)(!1),[g,_]=(0,G.useState)(``),v=(0,G.useCallback)(async()=>{n&&i(await n.list())},[n]);(0,G.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,K.jsxs)(Y,{"data-config-card":`remote-workspaces`,className:`space-y-3`,children:[(0,K.jsxs)(`h2`,{className:`flex items-center gap-2 font-semibold`,children:[(0,K.jsx)(B,{className:`size-4`}),t(`remote-workspace:activeTitle`)]}),(0,K.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:t(`remote-workspace:activeDescription`)}),(0,K.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:t(`remote-workspace:isolation`)})]}):n?(0,K.jsxs)(Y,{"data-config-card":`remote-workspaces`,className:`space-y-4`,children:[(0,K.jsxs)(`header`,{className:`flex items-start justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`space-y-1`,children:[(0,K.jsxs)(`h2`,{className:`flex items-center gap-2 font-semibold`,children:[(0,K.jsx)(B,{className:`size-4`}),t(`config:remoteWorkspace.title`)]}),(0,K.jsx)(`p`,{className:`max-w-[64ch] text-sm leading-relaxed text-muted-foreground`,children:t(`remote-workspace:description`)})]}),(0,K.jsx)(H,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:m,"aria-label":t(`remote-workspace:refresh`),onClick:()=>void y(v),children:(0,K.jsx)(z,{className:`size-3.5`})})]}),(0,K.jsx)(`p`,{className:`rounded-md bg-muted/50 px-3 py-2 text-sm leading-relaxed text-muted-foreground`,children:t(`remote-workspace:instructions`)}),r.length>0&&(0,K.jsx)(`ul`,{className:`divide-y rounded-lg border`,children:r.map(r=>(0,K.jsxs)(`li`,{className:`flex items-center gap-3 px-3 py-2.5`,children:[(0,K.jsx)(B,{className:`size-4 shrink-0 text-muted-foreground`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`truncate text-sm font-medium`,children:r.name}),(0,K.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:r.address})]}),(0,K.jsxs)(H,{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,K.jsx)(R,{className:`size-3.5`})]}),(0,K.jsx)(H,{type:`button`,variant:`ghost`,size:`icon-sm`,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,K.jsx)(Je,{className:`size-3.5`})})]},r.id))}),(0,K.jsxs)(`form`,{className:`grid gap-3 sm:grid-cols-2`,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,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsx)(O,{htmlFor:`remote-workspace-name`,children:t(`remote-workspace:name`)}),(0,K.jsx)(at,{id:`remote-workspace-name`,value:a,maxLength:160,disabled:m,placeholder:`Linux`,onChange:e=>o(e.target.value)})]}),(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsx)(O,{htmlFor:`remote-workspace-address`,children:t(`remote-workspace:address`)}),(0,K.jsx)(at,{id:`remote-workspace-address`,type:`url`,value:s,required:!0,disabled:m,placeholder:`https://192.168.1.10:5174`,autoComplete:`off`,spellCheck:!1,onChange:e=>l(e.target.value)})]}),(0,K.jsxs)(`div`,{className:`space-y-1.5 sm:col-span-2`,children:[(0,K.jsx)(O,{htmlFor:`remote-workspace-fingerprint`,children:t(`remote-workspace:fingerprint`)}),(0,K.jsx)(at,{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,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsx)(O,{htmlFor:`remote-workspace-code`,children:t(`remote-workspace:code`)}),(0,K.jsx)(at,{id:`remote-workspace-code`,value:f,required:!0,maxLength:64,disabled:m,placeholder:`ABCD-EFGH`,autoComplete:`off`,spellCheck:!1,onChange:e=>p(e.target.value)})]}),(0,K.jsx)(`div`,{className:`flex items-end sm:justify-end`,children:(0,K.jsxs)(H,{type:`submit`,size:`sm`,disabled:m,children:[m?(0,K.jsx)(Ne,{className:`size-3.5 animate-spin`}):(0,K.jsx)(R,{className:`size-3.5`}),t(`remote-workspace:pair`)]})})]}),g&&(0,K.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-destructive`,children:g}),(0,K.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:t(`remote-workspace:isolation`)})]}):null}function Yi({notify:e}){let{t}=c(),n=window.pisperDesktop,[r,i]=(0,G.useState)(null),[a,o]=(0,G.useState)(``),[s,l]=(0,G.useState)(``);(0,G.useEffect)(()=>{if(!n?.getCliStatus)return;let e=!0;return n.getCliStatus().then(t=>e&&i(t)).catch(t=>e&&l(t instanceof Error?t.message:String(t))),()=>{e=!1}},[n]);let u=!!(n?.getCliStatus&&n.installCli&&n.uninstallCli),d=async()=>{if(n?.installCli){o(`install`),l(``);try{let r=await n.installCli();i(r),e(t(`config:cliSettings.installedNotification`))}catch(e){l(e instanceof Error?e.message:String(e))}finally{o(``)}}},f=async()=>{if(n?.uninstallCli){o(`uninstall`),l(``);try{let r=await n.uninstallCli();i(r),e(t(`config:cliSettings.uninstalledNotification`))}catch(e){l(e instanceof Error?e.message:String(e))}finally{o(``)}}},p=u&&!r,m=u?p?t(`config:cliSettings.checking`):r?.supported?r.needsRepair?t(`config:cliSettings.needsRepair`):r.installed?t(`config:cliSettings.installed`):t(`config:cliSettings.notInstalled`):t(`config:cliSettings.unavailable`):t(`config:cliSettings.unavailable`);return(0,K.jsxs)(Y,{className:`[padding:18px] cli-settings-card`,"data-config-card":`updates-cli`,children:[(0,K.jsxs)(`div`,{className:`language-settings-heading flex items-start gap-[11px] [&_h2]:text-[16px] [&_p]:mt-[4px] [&_p]:text-[var(--text-muted)] [&_p]:text-[13px] [&_p]:leading-[1.55] cli-settings-heading !grid grid-cols-[auto_minmax(0,1fr)_auto]`,children:[(0,K.jsx)(`span`,{className:`grid w-[38px] h-[38px] [flex:0_0_auto] place-items-center rounded-[11px] bg-[var(--star-soft)] text-[var(--star-strong)]`,children:(0,K.jsx)(dr,{size:19})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h2`,{children:t(`config:cliSettings.title`)}),(0,K.jsx)(`p`,{children:t(`config:cliSettings.description`)})]}),(0,K.jsx)(X,{className:`self-center`,tone:r?.installed&&!r.needsRepair?`green`:r?.needsRepair?`blue`:`gray`,children:m})]}),r&&(0,K.jsxs)(st,{className:`[margin-top:15px] cli-settings-status [&_small]:[overflow-wrap:anywhere]`,children:[r.installed&&!r.needsRepair?(0,K.jsx)(he,{size:16}):(0,K.jsx)(dr,{size:16}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`strong`,{children:r.installed?t(`config:cliSettings.commandReady`,{command:r.command}):t(`config:cliSettings.commandNotInstalled`,{command:r.command})}),(0,K.jsx)(`small`,{children:r.installPath}),r.installed&&(0,K.jsx)(`small`,{children:r.pathConfigured?t(`config:cliSettings.pathConfigured`):t(`config:cliSettings.pathNeedsRepair`)})]})]}),s&&(0,K.jsx)(ct,{children:s}),u&&(0,K.jsxs)(`div`,{className:`mt-3.5 flex justify-end gap-2 max-[650px]:flex-wrap`,children:[r?.installed&&(0,K.jsxs)(H,{type:`button`,variant:`outline`,size:`lg`,className:`bg-surface-subtle`,disabled:!!a,onClick:()=>void f(),children:[a===`uninstall`?(0,K.jsx)(z,{className:`animate-spin`,size:14}):(0,K.jsx)(Je,{size:14}),t(`config:cliSettings.uninstall`)]}),(!r?.installed||r.needsRepair)&&(0,K.jsxs)(H,{type:`button`,size:`lg`,disabled:!!a||p||r?.supported===!1,onClick:()=>void d(),children:[a===`install`?(0,K.jsx)(z,{className:`animate-spin`,size:14}):r?.needsRepair?(0,K.jsx)(Ze,{size:14}):(0,K.jsx)(ye,{size:14}),r?.needsRepair?t(`config:cliSettings.repair`):t(`config:cliSettings.install`)]})]}),u&&(0,K.jsx)(`small`,{className:`block [margin:9px_1px_0] text-[var(--text-muted)] text-[12px]`,children:t(`config:cliSettings.restartTerminal`)})]})}var Xi=`0.5.64`,Zi=9e5,Qi=2592e6;function $i(){try{let e=JSON.parse(n.getItem(l.sponsorDismissals)||`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`number`&&e[1]>Date.now()))}catch{return{}}}function ea(e,t){return!e.desktop&&!e.mobile?t(`config:updateSettings.browserMode`):`${{win32:`Windows`,darwin:`macOS`,linux:`Linux`,android:`Android`,ios:`iOS`}[e.platform]||e.platform} · ${e.arch}`}function ta(e,t){let n=Number(e)||0;if(!n)return`0 B`;let r=[`B`,`KB`,`MB`,`GB`],i=Math.min(r.length-1,Math.floor(Math.log(n)/Math.log(1024)));return`${(n/1024**i).toLocaleString(t,{maximumFractionDigits:1})} ${r[i]}`}function na({notify:e,update:t}){let{t:r,language:i}=c(),a=t?.info||{desktop:!1,packaged:!1,version:Xi,platform:`browser`,arch:``},o=t?.status||{state:`idle`},s=!!a.desktop,u=!!a.mobile,d=s||u,[f,p]=(0,G.useState)({version:Xi,date:``,notes:``}),[m,h]=(0,G.useState)([]),[g,_]=(0,G.useState)(``),[v,y]=(0,G.useState)($i);(0,G.useEffect)(()=>{let e=!0;return fetch(`/release-notes.json`,{cache:`no-store`}).then(e=>e.ok?e.json():null).then(t=>{e&&t&&p(t)}).catch(()=>{}),()=>{e=!1}},[]),(0,G.useEffect)(()=>{let e=!0,t=(t=!1)=>V(`/api/sponsors/settings-updates?locale=${encodeURIComponent(i)}${t?`&refresh=1`:``}`).then(t=>{e&&h(Array.isArray(t.campaigns)?t.campaigns:[])}).catch(()=>{e&&!t&&h([])});t();let n=window.setInterval(()=>void t(!0),Zi);return()=>{e=!1,window.clearInterval(n)}},[i]);let b=e=>{let t={...v,[e]:Date.now()+Qi};y(t);try{n.setItem(l.sponsorDismissals,JSON.stringify(t))}catch{}},x=async()=>{if(t){_(`check`);try{await t.check()}finally{_(``)}}},S=()=>t?.openReleases(),C=()=>t?.openUpdateLog?.(),w=t=>{mr(t,t.currentTarget.href)?.catch(()=>e(r(`config:aboutSettings.openLinkFailed`),`error`))},T=async()=>{_(s?`install`:``);try{s?await t?.installComponents():await t?.download()}catch(t){e(t instanceof Error?t.message:String(t),`error`)}finally{_(``)}},E=()=>t?.install(),D=f.version===a.version?f:null,O=o.notes||(d?D?.notes||r(`config:updateSettings.noReleaseNotesAreAvailableForThisVersion`):o.state===`current`?r(`config:updateSettings.theCurrentWebSourceIsSyncedWithBranch`,{branch:o.branch||`release`}):r(`config:updateSettings.commitsThatHaveNotBeenSyncedWillAppearHereAfterTheCheck`)),k=o.state===`available`,A=o.state===`error`&&o.canResume&&o.canDownload,j=o.state===`downloaded`,M=o.state===`checking`||g===`check`,N=o.state===`downloading`||g===`install`,ee=M?`checking`:N?`downloading`:o.state,te=d?`v${a.version}`:`v${a.version}${o.currentCommit?` · ${o.currentCommit.slice(0,7)}`:``}`,P=d?`v${o.availableVersion||D?.version||a.version}`:o.availableCommit?.slice(0,7)||o.currentCommit?.slice(0,7)||f.version||a.version,ne=m.filter(e=>(v[e.id]||0)<=Date.now()),F=(0,G.useMemo)(()=>{let e=new Map(t.components.map(e=>[e.component,e]));return[`desktop`,`tui`,`runtime`].map(t=>e.get(t)||{component:t,state:`idle`,currentVersion:t===`desktop`?a.version:`--`,availableVersion:``,message:``,releaseUrl:``,notes:``,size:0,transferred:0,canInstall:!1,restartRequired:!1})},[a.version,t.components]),I=(0,G.useMemo)(()=>({idle:[r(`config:updateSettings.notChecked`),`gray`],checking:[r(`config:updateSettings.checking`),`blue`],current:[r(`config:updateSettings.upToDate`),`green`],available:[r(d?`config:updateSettings.updateAvailable`:`config:updateSettings.sourceUpdatesAvailable`),`blue`],downloading:[r(`config:updateSettings.downloading`),`blue`],downloaded:[r(`config:updateSettings.readyToRestart`),`green`],installed:[r(`config:updateSettings.upToDate`),`green`],error:[r(A?`config:updateSettings.downloadPaused`:`config:updateSettings.checkFailed`),`red`]})[ee]||[r(`config:updateSettings.notChecked`),`gray`],[d,ee,A,r]);return(0,K.jsxs)(`div`,{className:`mx-auto flex w-full flex-col gap-3`,children:[(0,K.jsxs)(Y,{className:`p-5`,"data-config-card":`updates-main`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,K.jsx)(`span`,{className:`grid w-[38px] h-[38px] [flex:0_0_auto] place-items-center rounded-[11px] bg-[var(--star-soft)] text-[var(--star-strong)]`,children:(0,K.jsx)(ir,{size:19})}),(0,K.jsx)(`span`,{className:`min-w-0`,children:(0,K.jsx)(`strong`,{className:`block text-[16px]`,children:r(`config:updateSettings.pisperAppUpdates`)})})]}),(0,K.jsx)(X,{tone:I[1],children:I[0]})]}),(0,K.jsxs)(`div`,{className:`mt-5 grid gap-2 sm:grid-cols-3`,children:[(0,K.jsxs)(`div`,{className:`rounded-[var(--r-sm)] bg-[var(--surface-muted)] p-3`,children:[(0,K.jsx)(`small`,{className:`text-[12px] text-[var(--text-muted)]`,children:r(d?`config:updateSettings.currentVersion`:`config:updateSettings.currentSource`)}),(0,K.jsx)(`strong`,{className:`mt-1 block font-mono text-[14px]`,children:te})]}),(0,K.jsxs)(`div`,{className:`rounded-[var(--r-sm)] bg-[var(--surface-muted)] p-3`,children:[(0,K.jsx)(`small`,{className:`text-[12px] text-[var(--text-muted)]`,children:r(`config:updateSettings.platform`)}),(0,K.jsx)(`strong`,{className:`mt-1 block text-[14px]`,children:ea(a,r)})]}),(0,K.jsxs)(`div`,{className:`rounded-[var(--r-sm)] bg-[var(--surface-muted)] p-3`,children:[(0,K.jsx)(`small`,{className:`text-[12px] text-[var(--text-muted)]`,children:r(`config:updateSettings.updateChannel`)}),(0,K.jsx)(`strong`,{className:`mt-1 block text-[14px]`,children:d?`Stable`:o.branch||`release`})]})]}),o.message&&(0,K.jsxs)(`div`,{className:`mt-4 flex items-start gap-2 rounded-[var(--r-sm)] p-3 text-[13px] ${o.state===`error`?`bg-[var(--danger-soft)] text-[var(--danger)]`:`bg-[var(--accent-soft)] text-[var(--text)]`}`,children:[o.state===`error`?(0,K.jsx)(Ye,{className:`mt-0.5 shrink-0`,size:15}):(0,K.jsx)(rr,{className:`mt-0.5 shrink-0`,size:15}),(0,K.jsx)(`span`,{children:o.message})]}),A&&(0,K.jsx)(`small`,{className:`mt-2 block text-[12px] text-[var(--text-muted)]`,children:r(`config:updateSettings.downloadedDataWasPreservedAndCanResumeFromTheInterruptionPoint`)}),N&&(0,K.jsxs)(`div`,{className:`mt-4`,children:[(0,K.jsxs)(`div`,{className:`flex justify-between text-[12px] text-[var(--text-muted)]`,children:[(0,K.jsx)(`span`,{children:r(`config:updateSettings.downloadProgress`)}),(0,K.jsxs)(`span`,{children:[Math.round(o.percent||0),`% · `,ta(o.transferred,i),` /`,` `,ta(o.total,i)]})]}),(0,K.jsx)(`div`,{className:`mt-2 h-1.5 overflow-hidden rounded-full bg-[var(--progress-track)]`,children:(0,K.jsx)(`i`,{className:`block h-full bg-[var(--star)] transition-[width]`,style:{width:`${o.percent||0}%`}})})]}),(0,K.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[(0,K.jsxs)(H,{size:`lg`,disabled:M||N||!!g,onClick:j?E:k||A?T:x,children:[M||N?(0,K.jsx)(z,{className:`animate-spin`,size:14}):j?(0,K.jsx)(ze,{size:14}):k||A?o.canDownload?(0,K.jsx)(ye,{size:14}):(0,K.jsx)(Se,{size:14}):(0,K.jsx)(z,{size:14}),M||N?r(N&&s?`config:updateSettings.installingUpdates`:`config:updateSettings.checking2`):j?r(`config:updateSettings.restartAndInstall`):A?r(`config:updateSettings.resumeDownload`):k?o.canDownload?r(s?`config:updateSettings.downloadAndInstallUpdates`:`config:updateSettings.downloadUpdate`):r(d?`config:updateSettings.viewRelease`:`config:updateSettings.viewSourceUpdates`):r(`config:updateSettings.checkForUpdates`)]}),(0,K.jsxs)(H,{variant:`outline`,size:`lg`,className:`bg-surface-subtle`,onClick:S,children:[(0,K.jsx)(Se,{size:14}),d?`GitHub Releases`:`GitHub Compare`]}),s&&(0,K.jsxs)(H,{variant:`outline`,size:`lg`,className:`bg-surface-subtle`,onClick:C,children:[(0,K.jsx)(Se,{size:14}),r(`config:updateSettings.viewUpdateDiagnosticLog`)]})]}),!u&&(0,K.jsxs)(`div`,{className:`mt-6 border-t border-[var(--border)] pt-5`,"data-config-card":`updates-components`,children:[(0,K.jsx)(hr,{title:r(`config:updateSettings.appComponents`)}),(0,K.jsx)(`div`,{className:`mt-3 divide-y divide-[var(--border)]`,children:F.map(e=>{let t=e.component===`desktop`?rr:e.component===`tui`?qe:er,n=e.component===`desktop`?r(`config:updateSettings.desktopFrontend`):e.component===`tui`?r(`config:updateSettings.tuiClient`):r(`config:updateSettings.runtime`),a=e.state===`error`?`red`:e.state===`available`?`blue`:e.state===`installed`||e.state===`current`?`green`:`gray`,o=e.state===`checking`?r(`config:updateSettings.checking`):e.state===`downloading`?r(`config:updateSettings.downloading`):e.state===`available`?r(`config:updateSettings.updateAvailable`):e.state===`installed`?r(`config:updateSettings.installed`):e.state===`error`?r(`config:updateSettings.checkFailed`):e.state===`current`?r(`config:updateSettings.upToDate`):r(`config:updateSettings.notChecked`);return(0,K.jsxs)(`div`,{className:`grid min-h-[68px] items-center gap-3 py-3 sm:grid-cols-[minmax(0,1fr)_auto_auto]`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,K.jsx)(t,{className:`shrink-0 text-[var(--text-muted)]`,size:17}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`strong`,{className:`block text-[14px]`,children:n}),e.message&&(0,K.jsx)(`small`,{className:`mt-0.5 block text-[12px] text-[var(--text-muted)]`,children:e.message})]})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2 font-mono text-[12px]`,children:[(0,K.jsxs)(`span`,{children:[`v`,e.currentVersion]}),e.availableVersion&&e.availableVersion!==e.currentVersion&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(ae,{size:12}),(0,K.jsxs)(`span`,{children:[`v`,e.availableVersion]})]}),e.size>0&&e.state===`available`&&(0,K.jsx)(`span`,{className:`font-sans text-[var(--text-muted)]`,children:ta(e.size,i)})]}),(0,K.jsx)(X,{tone:a,children:o})]},e.component)})})]})]}),!u&&(0,K.jsx)(Yi,{notify:e}),(0,K.jsxs)(Y,{className:`p-5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsx)(hr,{title:r(d?k||A||j||N?`config:updateSettings.newVersionReleaseNotes`:`config:updateSettings.currentReleaseNotes`:k?`config:updateSettings.commitsToSync`:`config:updateSettings.currentSourceStatus`)}),(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[12px] text-[var(--text-muted)]`,children:[(0,K.jsx)(he,{size:13}),k||A||j||N?P:d?`v${D?.version||a.version}`:o.currentCommit?.slice(0,7)||r(`config:updateSettings.notChecked`)]})]}),(o.releaseDate||d&&D?.date)&&(0,K.jsx)(`small`,{className:`mt-2 block text-[12px] text-[var(--text-muted)]`,children:new Intl.DateTimeFormat(i,{dateStyle:`long`}).format(new Date(o.releaseDate||D?.date||``))}),(0,K.jsx)(`div`,{className:`mt-4 rounded-[var(--r-sm)] border border-[var(--stroke-soft)] bg-[var(--surface-subtle)] p-4`,children:(0,K.jsx)(Tt,{children:O})})]}),ne.length>0&&(0,K.jsxs)(Y,{className:`p-5`,"data-config-card":`updates-sponsors`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,K.jsx)(`span`,{className:`grid w-[38px] h-[38px] [flex:0_0_auto] place-items-center rounded-[11px] bg-[var(--star-soft)] text-[var(--star-strong)]`,children:(0,K.jsx)(nr,{size:19})}),(0,K.jsxs)(`span`,{className:`min-w-0`,children:[(0,K.jsx)(hr,{title:r(`config:updateSettings.sponsors`)}),(0,K.jsx)(`small`,{className:`mt-1 block text-[12px] leading-5 text-[var(--text-muted)]`,children:r(`config:updateSettings.sponsorsDescription`)})]})]}),(0,K.jsx)(`div`,{className:`mt-4 divide-y divide-[var(--stroke-soft)] border-y border-[var(--stroke-soft)]`,children:ne.map(e=>(0,K.jsxs)(`div`,{className:`grid min-h-16 grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-3 py-3`,children:[(0,K.jsxs)(`span`,{className:`min-w-0`,children:[(0,K.jsxs)(`span`,{className:`mb-1 flex items-center gap-2`,children:[(0,K.jsx)(`strong`,{className:`truncate text-[14px]`,children:e.name}),(0,K.jsx)(X,{tone:`gray`,children:r(`config:updateSettings.sponsored`)})]}),(0,K.jsx)(`small`,{className:`block text-[12px] leading-5 text-[var(--text-muted)]`,children:e.description})]}),(0,K.jsx)(H,{asChild:!0,variant:`outline`,className:`bg-surface-subtle`,children:(0,K.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer sponsored`,"data-web-preview":`external`,onClick:w,children:[(0,K.jsx)(Se,{size:13}),r(`config:updateSettings.visitSponsor`)]})}),(0,K.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0`,"aria-label":r(`config:updateSettings.hideSponsor`),title:r(`config:updateSettings.hideSponsor`),onClick:()=>b(e.id),children:(0,K.jsx)(Qe,{size:15})})]},e.id))})]})]})}function ra({notify:e,registerPrimaryAction:t,section:n,onBrowserNotificationChange:r,requestConfirm:i,update:a,renderInterfaceSettings:o}){Dt(n);let s;if(n===`notifications`)s=(0,K.jsx)(Gi,{notify:e,onBrowserNotificationChange:r});else if(n===`interface`){let t=(0,K.jsx)(Pr,{notify:e});s=o?o(t):t}else s=n===`shortcuts`?(0,K.jsx)(Lr,{requestConfirm:i}):n===`desktop-pet`?(0,K.jsx)(Tr,{notify:e,requestConfirm:i}):n===`mobile-server`?(0,K.jsx)(Ii,{requestConfirm:i}):n===`remote-access`?(0,K.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,K.jsx)(Ji,{requestConfirm:i}),!window.__PISPER_REMOTE_WORKSPACE__&&(0,K.jsx)(qi,{notify:e})]}):n===`updates`?(0,K.jsx)(na,{notify:e,update:a}):n===`about`?(0,K.jsx)(Sr,{update:a,notify:e}):(0,K.jsx)(vi,{notify:e,registerPrimaryAction:t,requestConfirm:i});return(0,K.jsx)(Ct,{variant:n===`models`?`settings-wide`:`settings`,children:(0,K.jsx)(`div`,{"data-config-card":Ot,children:s})})}export{ra as ConfigPage};
@@ -1,4 +0,0 @@
1
- import{a as e,r as t}from"./rolldown-runtime-B0Z9INg1.js";import{i as n,n as r,r as i}from"./vendor-react-DwNgTV1j.js";import{t as a}from"./use-i18n-Dpn7lxcE.js";import{t as o}from"./file-diff-GxOMJkLj.js";import{t as s}from"./x-07u4-129.js";import{t as c}from"./button-BcPDt1Ge.js";import{a as l,s as u}from"./events-By17Y3YI.js";var d=e(n(),1),f=e(r(),1);function p(e){let t=String(e||``).trim().split(` `)[0];if(t.startsWith(`"`)&&t.endsWith(`"`))try{t=JSON.parse(t)}catch{}return t===`/dev/null`?``:t.replace(/^[ab]\//,``)}function m(e){let t=e.match(/^diff --git "a\/(.+)" "b\/(.+)"$/);if(t)return p(`b/${t[2]}`);let n=e.match(/^diff --git a\/(.+) b\/(.+)$/);return n?p(`b/${n[2]}`):``}function h(){return{lineNumber:null,text:``,tone:`empty`}}function g(e){let t=e.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);return{oldLine:Number(t?.[1])||0,newLine:Number(t?.[2])||0}}function _(e){let t=String(e||``).replace(/\r\n/g,`
2
- `).split(`
3
- `),n=[],r=null,i=null,a=0,o=0,s=[],c=[],l=()=>{if(!i||!s.length&&!c.length)return;let e=Math.max(s.length,c.length);for(let t=0;t<e;t+=1){let e=s[t],n=c[t];i.rows.push({kind:`pair`,old:e?{lineNumber:e.lineNumber,text:e.text,tone:`deleted`}:h(),next:n?{lineNumber:n.lineNumber,text:n.text,tone:`added`}:h()})}s=[],c=[]},u=()=>{l(),i=null},d=()=>{u(),r&&=(r.path=r.newPath||r.oldPath||r.path,n.push(r),null)};for(let e of t){if(e.startsWith(`diff --git `)){d(),r={oldPath:``,newPath:``,path:m(e),metadata:[],hunks:[]};continue}if(r){if(e.startsWith(`@@ `)){u();let t=g(e);a=t.oldLine,o=t.newLine,i={header:e,rows:[]},r.hunks.push(i);continue}if(i){if(e.startsWith(`-`))s.push({lineNumber:a,text:e.slice(1)}),a+=1;else if(e.startsWith(`+`))c.push({lineNumber:o,text:e.slice(1)}),o+=1;else if(l(),e.startsWith(` `)){let t=e.slice(1);i.rows.push({kind:`pair`,old:{lineNumber:a,text:t,tone:`context`},next:{lineNumber:o,text:t,tone:`context`}}),a+=1,o+=1}else e.startsWith(`\\ `)&&i.rows.push({kind:`meta`,text:e.slice(2)});continue}e.startsWith(`--- `)?r.oldPath=p(e.slice(4)):e.startsWith(`+++ `)?r.newPath=p(e.slice(4)):e.trim()&&r.metadata.push(e)}}return d(),n}function v(e,t,n){let r=Array(e);return new Proxy(r,{get(r,i,a){if(typeof i==`string`){let a=i.charCodeAt(0);if(a>=48&&a<=57){let a=+i;if(Number.isInteger(a)&&a>=0&&a<e){let e=r[a];if(!e){let i=t[a*2];e=r[a]={index:a,key:n(a),start:i,size:t[a*2+1],end:i+t[a*2+1],lane:0}}return e}}if(i===`length`)return e}return Reflect.get(r,i,a)}})}function y(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return o.length!==r.length||o.some((e,t)=>r[t]!==e)?(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i):i}return o.updateDeps=e=>{r=e},o}function b(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var x=(e,t)=>Math.abs(e-t)<1.01,S=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},C,w=()=>{if(C!==void 0)return C;if(typeof navigator>`u`)return C=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return C=!0;let e=navigator.maxTouchPoints;return C=navigator.platform===`MacIntel`&&e!==void 0&&e>0},T=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},E=e=>e,D=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=Array(n);for(let e=0;e<n;e++)r[e]=t+e;return r},O=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(T(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(T(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},k={passive:!0},A=typeof window>`u`||`onscrollend`in window,j=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&A,o=0,s=a?null:S(i,()=>t(o,!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,k),a&&r.addEventListener(`scrollend`,u,k),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u)}},M=(e,t)=>j(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),N=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},P=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:e+t,behavior:n})},F=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}return}this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:E,rangeExtractor:D,onChange:()=>{},measureElement:N,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,anchorTo:`start`,followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,useCachedMeasurements:!1};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}let n=this.options,r=null,i=null,a=!1;if(n!==void 0&&n.enabled&&t.enabled&&t.anchorTo===`end`&&this.scrollElement!==null){let e=n.count,o=t.count,s=this.getMeasurements(),c=e>0?s[0]?.key??n.getItemKey(0):null,l=e>0?s[e-1]?.key??n.getItemKey(e-1):null;if(o!==e||e>0&&o>0&&(t.getItemKey(0)!==c||t.getItemKey(o-1)!==l)){a=!0;let c=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??s[0]:null;c&&(r=[c.key,this.getScrollOffset()-c.start]);let u=t.followOnAppend===!0?`auto`:t.followOnAppend||null;u&&o>e&&this.isAtEnd(n.scrollEndThreshold)&&(e===0||t.getItemKey(o-1)!==l)&&(i=u)}}this.options=t,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=!1,s=0;if(r&&this.scrollOffset!==null){let[e,t]=r,n=this.getMeasurements(),{count:i,getItemKey:a}=this.options,c=0;for(;c<i&&a(c)!==e;)c++;if(c<i){let e=n[c];if(e){let n=Math.max(0,e.start+t);n!==this.scrollOffset&&(s=n-this.scrollOffset,this.scrollOffset=n,o=!0)}}}(o||i)&&(this.pendingScrollAnchor=[o?r[0]:null,o?r[1]:0,i,s])},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=y(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}if(this.scrollElement=e,this.targetWindow=this.scrollElement&&`ownerDocument`in this.scrollElement?this.scrollElement.ownerDocument.defaultView:this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{if(t&&this._intendedScrollOffset===null&&e===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(e-this._intendedScrollOffset)<1.5&&(e=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;let n=this.getScrollOffset();this.scrollDirection=t?n===e?this.scrollDirection:n<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement){let e=this.scrollElement,t=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,!(!w()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener(`touchstart`,t,k),e.addEventListener(`touchend`,n,k),this.unsubs.push(()=>{e.removeEventListener(`touchstart`,t),e.removeEventListener(`touchend`,n),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let t=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,t&&this.scrollElement&&this.options.enabled){let[e,n,r,i]=t;e!==null&&!r&&(w()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?i!==0&&(this._iosDeferredAdjustment+=i):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),r&&this.scrollToEnd({behavior:r})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;if(this._iosDeferredAdjustment<0&&e>=t-1){this._iosDeferredAdjustment=0;return}let n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=y(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,n,r,i,a,o,s)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s}),{key:!1}),this.getMeasurements=y(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s},c)=>{let l=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=e*2,a=this._flatMeasurements;if(!a||a.length<i){let e=new Float64Array(i);a&&u>0&&e.set(a.subarray(0,u*2)),a=e,this._flatMeasurements=a}let o;if(u===0)o=t+n;else{let e=u-1;o=a[e*2]+a[e*2+1]+s}for(let t=u;t<e;t++){let e=r(t),n=l.get(e),i=typeof n==`number`?n:this.options.estimateSize(t);a[t*2]=o,a[t*2+1]=i,o+=i+s}let c=v(e,a,r);return this.measurementsCache=c,c}let d=this.measurementsCache.slice(0,u),f=Array(a).fill(void 0),p=new Float64Array(a),m=0;for(let e=0;e<u;e++){let t=d[e];t&&(f[t.lane]===void 0&&m++,f[t.lane]=e,p[t.lane]=t.end)}for(let i=u;i<e;i++){let e=r(i),c=this.laneAssignments.get(i),u,h,g=o===`estimate`||l.has(e);if(c!==void 0&&this.options.lanes>1){u=c;let e=f[u],r=e===void 0?void 0:d[e];h=r?r.end+s:t+n}else if(m===a){let e=0,t=p[0],n=f[0];for(let r=1;r<a;r++){let i=p[r];(i<t||i===t&&f[r]<n)&&(e=r,t=i,n=f[r])}u=e,h=t+s,g&&this.laneAssignments.set(i,u)}else u=i%this.options.lanes,h=t+n,g&&this.laneAssignments.set(i,u);let _=l.get(e),v=typeof _==`number`?_:this.options.estimateSize(i),y=h+v;d[i]={index:i,start:h,size:v,end:y,key:e,lane:u},f[u]===void 0&&m++,f[u]=i,p[u]=y}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=y(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=R(e,t,n,r,r===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=y(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e),n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{if(e<0||e>=this.options.count)return;let n,r,i,a=this._flatMeasurements;if(this.options.lanes===1&&a!==null)i=this.options.getItemKey(e),r=a[e*2],n=a[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;i=t.key,r=t.start,n=t.size}let o=this.itemSizeCache.get(i)??n,s=t-o;if(s!==0){let a=this.options.anchorTo===`end`&&this.scrollState?.behavior!==`smooth`&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,c=a?this.getTotalSize():0,l=this.getScrollOffset()+this.scrollAdjustments,u=this.itemSizeCache.has(i)?r+o<=l&&this.scrollDirection!==`backward`:r<l,d=this.scrollState?.behavior!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?u:this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:i,start:r,size:n,end:r+n,lane:0},s,this));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(i,t),this.itemSizeCacheVersion++;let f=!1;a?f=this.applyScrollAdjustment(this.getTotalSize()-c):d&&(f=this.applyScrollAdjustment(s)),this.notify(f)}},this.getVirtualItems=y(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._flatMeasurements,r=this.options.lanes===1&&n!=null;return b(t[I(0,t.length-1,r?e=>n[e*2]:e=>b(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`){if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t]}if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{this._iosDeferredAdjustment=0;let r=this.getOffsetForAlignment(e,t),i=this.now();this.scrollState={index:null,align:t,behavior:n,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{this._iosDeferredAdjustment=0,e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:`start`,behavior:t,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:e=`auto`}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:`end`,behavior:e});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._flatMeasurements;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,t){return e===0?!1:w()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?(this._iosDeferredAdjustment+=e,!1):(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollOffset<0&&(this.scrollOffset=0),this.scrollAdjustments=0),!0)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&x(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let e=this.getSize()||600,n=Math.abs(t-this.getScrollOffset()),r=this.scrollState.behavior===`smooth`&&n>e;this.scrollState.lastTargetOffset=t,r||(this.scrollState.behavior=`auto`),this._scrollToOffset(t,{adjustments:void 0,behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}},I=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function L(e,t,n){let r=0;for(;r<=t;){let i=(r+t)/2|0,a=e[i*2];if(a<n)r=i+1;else if(a>n)t=i-1;else return i}return r>0?r-1:0}function R(e,t,n,r,i){let a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};if(r===1&&i!==null){let e=L(i,a,n),r=e,o=n+t;for(;r<a&&i[r*2]+i[r*2+1]<o;)r++;return{startIndex:e,endIndex:r}}let o=I(0,a,t=>e[t].start,n),s=o;if(r===1)for(;s<a&&e[s].end<n+t;)s++;else if(r>1){let i=Array(r).fill(0);for(;s<a&&i.some(e=>e<n+t);){let t=e[s];i[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var z=typeof document<`u`?d.useLayoutEffect:d.useEffect;function B({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n=`transform`,...r}){let i=d.useReducer(e=>e+1,0)[1],a=d.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=t,a.current.mode=n;let o=e=>{let t=a.current;if(!t.enabled||!t.container)return;let n=e.getTotalSize();if(n!==t.lastSize){t.lastSize=n;let r=e.options.horizontal?`width`:`height`;t.container.style[r]=`${n}px`}},s=e=>{let t=a.current;if(!t.enabled||!t.container)return;o(e);let n=!!e.options.horizontal,r=t.mode===`transform`,i=n?`left`:`top`,s=e.options.scrollMargin,c=e.getVirtualItems();for(let a of c){let o=a.start-s,c=e.elementsCache.get(a.key);c&&t.lastPositions.get(c)!==o&&(t.lastPositions.set(c,o),r?c.style.transform=n?`translate3d(${o}px, 0, 0)`:`translate3d(0, ${o}px, 0)`:c.style[i]=`${o}px`)}},c={...r,onChange:(t,n)=>{var o;let c=a.current,l=!0;if(c.enabled){s(t);let e=t.range,n=c.prevRange;l=!n||n.isScrolling!==t.isScrolling||n.startIndex!==e?.startIndex||n.endIndex!==e?.endIndex,l&&(c.prevRange=e?{startIndex:e.startIndex,endIndex:e.endIndex,isScrolling:t.isScrolling}:null)}l&&(e&&n?(0,f.flushSync)(i):i()),(o=r.onChange)==null||o.call(r,t,n)}},[l]=d.useState(()=>{let e=new F(c);return Object.assign(e,{containerRef:t=>{let n=a.current;if(n.container=t,n.lastSize=null,t&&n.enabled){let r=e.getTotalSize();n.lastSize=r;let i=e.options.horizontal?`width`:`height`;t.style[i]=`${r}px`}}})});return l.setOptions(c),z(()=>l._didMount(),[]),z(()=>(o(l),l._willUpdate())),z(()=>{s(l)}),l}function V(e){return B({observeElementRect:O,observeElementOffset:M,scrollToFn:P,...e})}function H(e,t,n=``){let[r,i]=(0,d.useState)(null),a=(0,d.useRef)({identity:n,position:e||{top:0,left:0}});a.current={identity:n,position:e||{top:0,left:0}};let o=(0,d.useRef)(t);return o.current=t,(0,d.useLayoutEffect)(()=>{if(!r)return;let e=a.current.position,t=!0,i=null,s=()=>{a.current.identity===n&&!t&&r.isConnected&&r.clientHeight>0&&o.current({top:r.scrollTop,left:r.scrollLeft})},c=()=>{i=null,t&&(r.scrollTo({top:e.top,left:e.left,behavior:`instant`}),Math.abs(r.scrollTop-e.top)<1&&Math.abs(r.scrollLeft-e.left)<1&&(t=!1))},d=()=>{t&&i===null&&(i=requestAnimationFrame(c))},f=()=>{t=!1,s()};c();let p=new ResizeObserver(d);p.observe(r);for(let e of r.children)p.observe(e);return r.addEventListener(`scroll`,s),r.addEventListener(`wheel`,f,{passive:!0}),r.addEventListener(`pointerdown`,f),r.addEventListener(`keydown`,f),window.addEventListener(l,s),window.addEventListener(u,s),()=>{s(),p.disconnect(),i!==null&&cancelAnimationFrame(i),r.removeEventListener(`scroll`,s),r.removeEventListener(`wheel`,f),r.removeEventListener(`pointerdown`,f),r.removeEventListener(`keydown`,f),window.removeEventListener(l,s),window.removeEventListener(u,s)}},[r,n]),{element:r,ref:i}}var U=t({GitDiffDialog:()=>Y,InlineGitDiff:()=>X}),W=i();function G({side:e,cell:t}){let n=t.tone===`deleted`?`−`:t.tone===`added`?`+`:` `;return(0,W.jsxs)(`div`,{className:`git-diff-cell grid min-w-0 min-h-[24px] grid-cols-[44px_20px_minmax(0,1fr)] [border-bottom:1px_solid_var(--stroke-soft)] font-[ui-monospace,SFMono-Regular,Consolas,'Liberation_Mono',monospace] text-[11px] leading-[1.55] [&.next]:[border-left:1px_solid_var(--stroke)] [&.deleted]:bg-[var(--danger-soft)] [&.added]:bg-[var(--success-soft)] [&.empty]:bg-[var(--surface-muted)] [&.context]:bg-[var(--solid)] [&_code]:block [&_code]:min-w-0 [&_code]:p-[3px_8px_3px_2px] [&_code]:text-[var(--text)] [&_code]:font-[inherit] [&_code]:whitespace-pre-wrap [&_code]:[overflow-wrap:anywhere] ${e} ${t.tone}`,children:[(0,W.jsx)(`span`,{className:`block [padding:3px_7px_3px_4px] [border-right:1px_solid_var(--stroke-soft)] text-[var(--text-muted)] text-right select-none`,children:t.lineNumber??``}),(0,W.jsx)(`span`,{className:`git-diff-line-marker [.git-diff-cell.deleted_&]:text-[var(--danger)] [.git-diff-cell.added_&]:text-[var(--success)] block [padding:3px_4px] text-[var(--text-muted)] text-center select-none`,"aria-hidden":`true`,children:t.tone===`empty`?``:n}),(0,W.jsx)(`code`,{children:t.text||`\xA0`})]})}function K({file:e,scrollElement:t}){let n=(0,d.useRef)(null),[r,i]=(0,d.useState)(0),a=(0,d.useMemo)(()=>e.hunks.flatMap((e,t)=>[{kind:`header`,hunkIndex:t,header:e.header},...e.rows.map((e,n)=>({kind:`row`,hunkIndex:t,rowIndex:n,row:e}))]),[e.hunks]);(0,d.useLayoutEffect)(()=>{let e=n.current;if(!t||!e)return;let r=()=>{let n=Math.max(0,e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop);i(e=>Math.abs(e-n)<1?e:n)};r();let a=typeof ResizeObserver>`u`?null:new ResizeObserver(r);return a?.observe(t),a?.observe(e),()=>a?.disconnect()},[t]);let o=V({useFlushSync:!1,count:a.length,getScrollElement:()=>t,estimateSize:()=>25,getItemKey:e=>{let t=a[e];return t.kind===`header`?`hunk-${t.hunkIndex}`:`row-${t.hunkIndex}-${t.rowIndex}`},measureElement:e=>Math.ceil(e.getBoundingClientRect().height),overscan:12,scrollMargin:r}),s=o.getVirtualItems();return(0,W.jsx)(`div`,{className:`relative min-w-[880px] w-full`,"data-pisper-diff-row-count":a.length,"data-pisper-rendered-count":s.length,ref:n,style:{height:`${o.getTotalSize()}px`},children:s.map(e=>{let t=a[e.index];return(0,W.jsx)(`div`,{className:`absolute left-0 w-full`,"data-index":e.index,ref:o.measureElement,style:{top:`${e.start-r}px`},children:t.kind===`header`?(0,W.jsx)(`div`,{className:`git-diff-hunk-header [border-bottom:1px_solid_var(--stroke-soft)] bg-[var(--blue-soft)] p-[4px_10px] text-[var(--brand-blue-strong)] font-[ui-monospace,SFMono-Regular,Consolas,'Liberation_Mono',monospace] text-[10px] [white-space:pre]`,children:t.header}):t.row.kind===`meta`?(0,W.jsx)(`div`,{className:`git-diff-row-meta [border-bottom:1px_solid_var(--stroke-soft)] bg-[var(--blue-soft)] p-[4px_10px] text-[var(--brand-blue-strong)] font-[ui-monospace,SFMono-Regular,Consolas,'Liberation_Mono',monospace] text-[10px] [white-space:pre] bg-[var(--surface-muted)] text-[var(--text-muted)]`,children:t.row.text}):(0,W.jsxs)(`div`,{className:`grid min-w-[880px] grid-cols-[minmax(440px,1fr)_minmax(440px,1fr)]`,children:[(0,W.jsx)(G,{side:`old`,cell:t.row.old}),(0,W.jsx)(G,{side:`next`,cell:t.row.next})]})},e.key)})})}function q(e){let t=e.path.replace(/\\/g,`/`),n=t.split(`/`),r=n.pop()||t,i=0,a=0;for(let t of e.hunks)for(let e of t.rows)e.kind===`pair`&&(e.next.tone===`added`&&(i+=1),e.old.tone===`deleted`&&(a+=1));let o=e.metadata.join(`
4
- `),s=/(?:^|\n)new file mode /.test(o)||!e.oldPath&&e.newPath?`added`:/(?:^|\n)deleted file mode /.test(o)||!e.newPath&&e.oldPath?`deleted`:/(?:^|\n)rename (?:from|to) /.test(o)||e.oldPath&&e.newPath&&e.oldPath!==e.newPath?`renamed`:`modified`;return{file:e,name:r,directory:n.join(`/`),added:i,deleted:a,status:s}}function J(e){return e===`added`?`A`:e===`deleted`?`D`:e===`renamed`?`R`:`M`}function Y({diff:e,truncated:t,onClose:n}){let{t:r}=a(),i=(0,d.useMemo)(()=>_(e),[e]),l=(0,d.useMemo)(()=>i.map(q),[i]),[u,p]=(0,d.useState)(0),[m,h]=(0,d.useState)(null),g=Math.min(u,Math.max(l.length-1,0)),v=l[g];(0,d.useEffect)(()=>{let e=document.body.style.overflow,t=e=>{e.key===`Escape`&&!e.defaultPrevented&&(e.preventDefault(),e.stopPropagation(),n())};return document.body.style.overflow=`hidden`,document.addEventListener(`keydown`,t),()=>{document.body.style.overflow=e,document.removeEventListener(`keydown`,t)}},[n]);let y=e=>{p(e),m?.scrollTo({top:0,left:0})};return(0,f.createPortal)((0,W.jsx)(`div`,{className:`git-diff-dialog-backdrop max-[760px]:p-[10px] fixed z-[120] inset-0 grid place-items-center bg-[rgb(0_0_0/.48)] [padding:24px] [backdrop-filter:blur(3px)]`,role:`presentation`,onMouseDown:e=>e.target===e.currentTarget&&n(),children:(0,W.jsxs)(`section`,{className:`git-diff-dialog max-[760px]:w-[calc(100vw_-_20px)] max-[760px]:h-[calc(100vh_-_20px)] flex w-[min(1180px,calc(100vw_-_48px))] h-[min(820px,calc(100vh_-_48px))] min-w-0 min-h-0 flex-col overflow-hidden [border:1px_solid_var(--stroke)] rounded-[var(--r-lg)] bg-[var(--solid)] shadow-[0_28px_90px_-24px_rgb(0_0_0/.65)]`,role:`dialog`,"aria-modal":`true`,"aria-label":r(`chat:focusSession.gitViewDiff`),children:[(0,W.jsxs)(`header`,{className:`git-diff-dialog-head [&_>_span:nth-child(2)]:flex [&_>_span:nth-child(2)]:min-w-0 [&_>_span:nth-child(2)]:flex-col [&_>_span:nth-child(2)]:gap-[2px] [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[11px] grid min-h-[54px] flex-none grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-[10px] [border-bottom:1px_solid_var(--stroke)] [padding:8px_12px]`,children:[(0,W.jsx)(`span`,{className:`grid w-[34px] h-[34px] place-items-center rounded-[var(--r-sm)] bg-[var(--accent-soft)] text-[var(--star-strong)]`,children:(0,W.jsx)(o,{size:17})}),(0,W.jsxs)(`span`,{children:[(0,W.jsx)(`strong`,{children:r(`chat:focusSession.gitViewDiff`)}),(0,W.jsx)(`small`,{children:r(`chat:focusSession.gitDiffFileCount`,{count:i.length})})]}),(0,W.jsx)(c,{type:`button`,variant:`ghost`,size:`icon`,title:r(`chat:focusSession.gitCloseDiff`),"aria-label":r(`chat:focusSession.gitCloseDiff`),onClick:n,children:(0,W.jsx)(s,{size:17})})]}),l.length?(0,W.jsxs)(`div`,{className:`git-diff-layout max-[760px]:grid-rows-[minmax(112px,26vh)_minmax(0,1fr)] max-[760px]:grid-cols-[minmax(0,1fr)] grid min-w-0 min-h-0 flex-1 grid-cols-[252px_minmax(0,1fr)] overflow-hidden`,children:[(0,W.jsxs)(`nav`,{className:`git-diff-file-nav max-[760px]:[border-right:0] max-[760px]:[border-bottom:1px_solid_var(--stroke)] flex min-w-0 min-h-0 flex-col overflow-hidden [border-right:1px_solid_var(--stroke)] bg-[var(--surface-muted)]`,"aria-label":r(`chat:focusSession.gitDiffChangedFiles`),children:[(0,W.jsx)(`strong`,{className:`git-diff-file-nav-title max-[760px]:[padding-block:7px_5px] flex-none [padding:10px_12px_8px] text-[var(--text-muted)] text-[10px] font-[700] tracking-[.055em] [text-transform:uppercase]`,children:r(`chat:focusSession.gitDiffChangedFiles`)}),(0,W.jsx)(`div`,{className:`git-diff-file-nav-list max-[760px]:pb-[6px] min-h-0 flex-1 overflow-x-hidden overflow-y-auto [padding:0_6px_8px]`,children:l.map((e,t)=>{let n=t===g;return(0,W.jsxs)(`button`,{type:`button`,className:`git-diff-file-nav-item hover:bg-[var(--surface-hover)] hover:text-[var(--text)] [&.selected]:bg-[var(--accent-soft)] [&.selected]:text-[var(--text)] [&.selected]:shadow-[inset_2px_0_var(--star-strong)] grid w-full min-h-[42px] grid-cols-[20px_minmax(0,1fr)_auto] items-center gap-[7px] border-0 rounded-[var(--r-sm)] bg-transparent [padding:5px_7px] text-[var(--text-secondary)] text-left cursor-pointer ${e.status} ${n?`selected`:``}`,title:e.file.path,"aria-current":n?`true`:void 0,onClick:()=>y(t),children:[(0,W.jsx)(`span`,{className:`git-diff-file-status font-[ui-monospace,SFMono-Regular,Consolas,'Liberation_Mono',monospace] text-[11px] font-[750] text-center [.git-diff-file-nav-item.added_&]:text-[var(--success)] [.git-diff-file-nav-item.deleted_&]:text-[var(--danger)] [.git-diff-file-nav-item.renamed_&]:text-[var(--warning-strong)] [.git-diff-file-nav-item.modified_&]:text-[var(--star-strong)]`,"aria-hidden":`true`,children:J(e.status)}),(0,W.jsxs)(`span`,{className:`git-diff-file-name [&_strong]:overflow-hidden [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap [&_small]:overflow-hidden [&_small]:text-ellipsis [&_small]:whitespace-nowrap [&_strong]:text-[11px] [&_strong]:font-[650] [&_small]:text-[var(--text-muted)] [&_small]:text-[9px] flex min-w-0 flex-col gap-[1px]`,children:[(0,W.jsx)(`strong`,{children:e.name}),e.directory&&(0,W.jsx)(`small`,{children:e.directory})]}),(0,W.jsxs)(`span`,{className:`git-diff-file-stats inline-flex items-center gap-[4px] font-[ui-monospace,SFMono-Regular,Consolas,'Liberation_Mono',monospace] text-[9px] [&_em]:[font-style:normal]`,"aria-hidden":`true`,children:[e.added>0&&(0,W.jsxs)(`em`,{className:`added [.git-diff-file-stats_&]:text-[var(--success)]`,children:[`+`,e.added]}),e.deleted>0&&(0,W.jsxs)(`em`,{className:`deleted [.git-diff-file-stats_&]:text-[var(--danger)]`,children:[`−`,e.deleted]})]})]},`${e.file.path}-${t}`)})})]}),(0,W.jsxs)(`div`,{className:`min-w-0 min-h-0 overflow-auto bg-[var(--surface-subtle)] [padding:12px]`,ref:h,children:[t&&(0,W.jsx)(`div`,{className:`[margin:0_0_12px] [border:1px_solid_var(--warning-border)] rounded-[var(--r-sm)] bg-[var(--warning-soft)] [padding:8px_10px] text-[var(--warning-strong)] text-[11px]`,children:r(`chat:focusSession.gitDiffTruncated`)}),v&&(0,W.jsxs)(`section`,{className:`min-w-[880px] [overflow:clip] [border:1px_solid_var(--stroke)] rounded-[var(--r-md)] bg-[var(--solid)]`,children:[(0,W.jsxs)(`header`,{className:`git-diff-file-head [&_>_svg]:text-[var(--star-strong)] [&_strong]:overflow-hidden [&_strong]:font-[ui-monospace,SFMono-Regular,Consolas,'Liberation_Mono',monospace] [&_strong]:text-[12px] [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap [&_small]:max-w-[300px] [&_small]:overflow-hidden [&_small]:text-[var(--text-muted)] [&_small]:text-[10px] [&_small]:text-ellipsis [&_small]:whitespace-nowrap sticky z-[3] top-0 grid min-h-[38px] grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-[8px] [border-bottom:1px_solid_var(--stroke)] bg-[var(--solid)] [padding:7px_10px]`,children:[(0,W.jsx)(o,{size:14}),(0,W.jsx)(`strong`,{title:v.file.path,children:v.file.path}),v.file.oldPath&&v.file.newPath&&v.file.oldPath!==v.file.newPath&&(0,W.jsx)(`small`,{title:v.file.oldPath,children:v.file.oldPath})]}),v.file.metadata.length>0&&(0,W.jsx)(`div`,{className:`git-diff-file-meta [border-bottom:1px_solid_var(--stroke-soft)] bg-[var(--surface-muted)] p-[5px_10px] text-[var(--text-muted)] font-[ui-monospace,SFMono-Regular,Consolas,'Liberation_Mono',monospace] text-[10px]`,children:v.file.metadata.join(` · `)}),v.file.hunks.length>0?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`git-diff-column-head [&_span]:p-[5px_10px] [&_span_+_span]:[border-left:1px_solid_var(--stroke)] sticky z-[2] [top:38px] grid grid-cols-[1fr_1fr] [border-bottom:1px_solid_var(--stroke)] bg-[var(--surface-muted)] text-[var(--text-muted)] text-[10px] font-[650] [text-transform:uppercase]`,children:[(0,W.jsx)(`span`,{children:r(`chat:focusSession.gitDiffOriginal`)}),(0,W.jsx)(`span`,{children:r(`chat:focusSession.gitDiffModified`)})]}),(0,W.jsx)(K,{file:v.file,scrollElement:m})]}):(0,W.jsx)(`div`,{className:`[padding:28px_16px] text-[var(--text-muted)] text-[12px] text-center`,children:r(`chat:focusSession.gitDiffNoTextChanges`)})]},v.file.path)]})]}):(0,W.jsx)(`div`,{className:`min-w-0 min-h-0 flex-1 bg-[var(--surface-subtle)] overflow-auto [padding:12px]`,children:(0,W.jsx)(`div`,{className:`[border:1px_solid_var(--stroke)] rounded-[var(--r-md)] bg-[var(--solid)] [padding:20px] text-[var(--text-muted)] whitespace-pre-wrap`,children:e||r(`chat:focusSession.gitDiffUnavailable`)})})]})}),document.body)}function X({diff:e,truncated:t,position:n,onReading:r=()=>{}}){let{t:i}=a(),o=(0,d.useMemo)(()=>_(e),[e]),{element:s,ref:c}=H(n,r);return(0,W.jsxs)(`div`,{children:[t&&(0,W.jsx)(`p`,{className:`px-3 py-2 text-xs text-content-muted`,children:i(`chat:chatMessage.filePreviewTruncated`)}),(0,W.jsx)(`div`,{ref:c,tabIndex:0,className:`max-h-80 min-w-0 overflow-auto border-y border-border bg-background`,children:!o.length||o.every(e=>!e.hunks.length)?(0,W.jsx)(`p`,{className:`p-3 text-xs text-content-muted`,children:i(`chat:focusSession.gitDiffNoTextChanges`)}):o.map((e,t)=>(0,W.jsx)(K,{file:e,scrollElement:s},`${e.path}-${t}`))})]})}export{_ as a,V as i,U as n,H as r,Y as t};