pisper 0.5.21-linux-x64.0 → 0.5.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +53 -0
- package/README.md +46 -46
- package/bin/pisper.mjs +48 -0
- package/lib/install.mjs +392 -0
- package/lib/npm-platform.mjs +41 -0
- package/lib/npm-update.mjs +165 -0
- package/lib/platform.mjs +43 -0
- package/lib/postinstall.mjs +3 -0
- package/package.json +36 -14
- package/updater.pubkey +1 -0
- package/web/.vite/manifest.json +2249 -0
- package/web/assets/AnimatedContent-BiVNqD3m.js +1 -0
- package/web/assets/AnimatedList-CJTx-B8I.js +1 -0
- package/web/assets/AppOverlays-C_v-1VL6.js +1 -0
- package/web/assets/AppSelect-g6etLk2g.js +1 -0
- package/web/assets/AssetsPage-Dt5ST6Ej.js +1 -0
- package/web/assets/ChannelsPage-C9dO2yLN.js +1 -0
- package/web/assets/ChatHistoryPage-ZvSTAtXB.js +1 -0
- package/web/assets/ChatPage-BD3WkozH.js +9 -0
- package/web/assets/ClickSpark-BhxL8WOQ.js +1 -0
- package/web/assets/ConfigPage-ifZdPO01.js +1 -0
- package/web/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/web/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/web/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/web/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/web/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/web/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/web/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/web/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/web/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/web/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/web/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/web/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/web/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/web/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/web/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/web/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/web/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/web/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/web/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/web/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/web/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/web/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/web/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/web/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/web/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/web/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/web/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/web/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/web/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/web/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/web/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/web/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/web/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/web/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/web/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/web/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/web/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/web/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/web/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/web/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/web/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/web/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/web/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/web/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/web/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/web/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/web/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/web/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/web/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/web/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/web/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/web/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/web/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/web/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/web/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/web/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/web/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/web/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/web/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/web/assets/MarkdownMessage-CMr3WuAI.js +1 -0
- package/web/assets/MemoryPage-D5Hjoc5p.js +1 -0
- package/web/assets/PageHeader-BKfO_vPe.js +1 -0
- package/web/assets/PluginsPage-DhkVJf05.js +1 -0
- package/web/assets/PreviewPages-mRjRmA0i.js +1 -0
- package/web/assets/SchedulesPage-DNe-Y6o5.js +1 -0
- package/web/assets/ShinyText-fuaKxKqJ.js +1 -0
- package/web/assets/SkillsPage-PguSYt8I.js +1 -0
- package/web/assets/StarOrbit-BlI6MhVr.js +1 -0
- package/web/assets/TerminalPanel-BrP-ENHg.css +1 -0
- package/web/assets/TerminalPanel-DrnfpA8m.js +18 -0
- package/web/assets/Threads-DskDSsK6.js +1 -0
- package/web/assets/WelcomeEffects-Bf8Z6qHU.js +1 -0
- package/web/assets/WorkflowsPage-C6sGl2oG.js +1 -0
- package/web/assets/WorkspacePicker-Cu2Z5jid.js +1 -0
- package/web/assets/alert-B7D8joCd.js +1 -0
- package/web/assets/alert-dialog-D5F_JQyX.js +1 -0
- package/web/assets/andromeeda-vGVdxbeo.js +1 -0
- package/web/assets/angular-html-17rlCfBS.js +1 -0
- package/web/assets/angular-ts-it3MaXWH.js +1 -0
- package/web/assets/astro-BEVDzCov.js +1 -0
- package/web/assets/aurora-x-CDeNXAV0.js +1 -0
- package/web/assets/ayu-dark-DluEY0Gj.js +1 -0
- package/web/assets/ayu-light-C3h-C4tm.js +1 -0
- package/web/assets/ayu-mirage-Bqwy1Gya.js +1 -0
- package/web/assets/blade-B3yUZIOx.js +1 -0
- package/web/assets/brand-CFOXmGdd.js +1 -0
- package/web/assets/button-DzlQCSNK.js +1 -0
- package/web/assets/c-aGSZMVdM.js +1 -0
- package/web/assets/catppuccin-frappe-C9Q5zVZY.js +1 -0
- package/web/assets/catppuccin-latte-CtsyrtPq.js +1 -0
- package/web/assets/catppuccin-macchiato-R8nAf1vR.js +1 -0
- package/web/assets/catppuccin-mocha-DjuaAJKi.js +1 -0
- package/web/assets/chevron-down-DXmj1gMQ.js +1 -0
- package/web/assets/circle-dot-CbGG7s_7.js +1 -0
- package/web/assets/coffee-ouOQ86EC.js +1 -0
- package/web/assets/copy-DO0sQBgx.js +1 -0
- package/web/assets/cpp-Bm3vm43L.js +1 -0
- package/web/assets/css-CWcS1xXm.js +1 -0
- package/web/assets/csv-Dx-8-gkx.js +1 -0
- package/web/assets/dark-plus-Cs2F2srj.js +1 -0
- package/web/assets/dist-BaCXUSxG.js +1 -0
- package/web/assets/dist-Bv5OI2pf.js +1 -0
- package/web/assets/dracula-BHWKrbxM.js +1 -0
- package/web/assets/dracula-soft-5eyTD99u.js +1 -0
- package/web/assets/earth-D-KiHvdO.js +1 -0
- package/web/assets/es2015-CfKlxLgF.js +41 -0
- package/web/assets/everforest-dark-sB-x3p7T.js +1 -0
- package/web/assets/everforest-light-Df2xbC6M.js +1 -0
- package/web/assets/field-CCo2X7MX.js +1 -0
- package/web/assets/file-B6GksU4A.js +1 -0
- package/web/assets/file-code-corner-3gopYCm4.js +1 -0
- package/web/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
- package/web/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
- package/web/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
- package/web/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/web/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
- package/web/assets/github-dark-C-LZuMrd.js +1 -0
- package/web/assets/github-dark-default-DXG-b-1a.js +1 -0
- package/web/assets/github-dark-dimmed-Bx1FflLF.js +1 -0
- package/web/assets/github-dark-high-contrast-B_tTalzw.js +1 -0
- package/web/assets/github-light-EUqPIrTm.js +1 -0
- package/web/assets/github-light-default-BXViO-2h.js +1 -0
- package/web/assets/github-light-high-contrast-B68TUdTA.js +1 -0
- package/web/assets/glsl-TOBAB6bO.js +1 -0
- package/web/assets/graphql-BEmIBNve.js +1 -0
- package/web/assets/gruvbox-dark-hard-C820rvS2.js +1 -0
- package/web/assets/gruvbox-dark-medium-BPjhmG05.js +1 -0
- package/web/assets/gruvbox-dark-soft-MrdJrrXF.js +1 -0
- package/web/assets/gruvbox-light-hard-BC_s9l72.js +1 -0
- package/web/assets/gruvbox-light-medium-BAWPOn9u.js +1 -0
- package/web/assets/gruvbox-light-soft-BSMLrYjP.js +1 -0
- package/web/assets/haml-CDWtFtU9.js +1 -0
- package/web/assets/handlebars-BNtjo3pL.js +1 -0
- package/web/assets/horizon-CE9ld1lL.js +1 -0
- package/web/assets/horizon-bright-DSNQnXHK.js +1 -0
- package/web/assets/houston-CsvMBhTu.js +1 -0
- package/web/assets/html-BVyvp26C.js +1 -0
- package/web/assets/html-derivative-BseLpURQ.js +1 -0
- package/web/assets/http-CkCfSMV9.js +1 -0
- package/web/assets/hurl-syYMt6Rn.js +1 -0
- package/web/assets/image-Bu_a9jz0.js +1 -0
- package/web/assets/imba-DsUTQ-LC.js +1 -0
- package/web/assets/index-BIQcwjFR.js +41 -0
- package/web/assets/index-Btu6aNk7.css +2 -0
- package/web/assets/java-duG_UTKe.js +1 -0
- package/web/assets/javascript-DWVbOe4X.js +1 -0
- package/web/assets/jinja-Boj4niAz.js +1 -0
- package/web/assets/jison-CHwnC1Pv.js +1 -0
- package/web/assets/json-qhed-kSA.js +1 -0
- package/web/assets/json5-BR5RXkoi.js +1 -0
- package/web/assets/jsonc-CYpm1nAK.js +1 -0
- package/web/assets/jsonl-CmCQp5Yx.js +1 -0
- package/web/assets/jsx-fcCEM_-L.js +1 -0
- package/web/assets/julia-VoF7UKfw.js +1 -0
- package/web/assets/kanagawa-dragon-Bozd7klA.js +1 -0
- package/web/assets/kanagawa-lotus-BmuOG9ZW.js +1 -0
- package/web/assets/kanagawa-wave-BML5mF2J.js +1 -0
- package/web/assets/laserwave-C_8bwKvT.js +1 -0
- package/web/assets/less-DVTAwKKz.js +1 -0
- package/web/assets/light-plus-DVQuIRkW.js +1 -0
- package/web/assets/link-2-SOWAopyR.js +1 -0
- package/web/assets/loader-circle-i0WYlBWu.js +1 -0
- package/web/assets/markdown-BYOwaDjH.js +1 -0
- package/web/assets/marko-Cupn1xhw.js +1 -0
- package/web/assets/material-theme-Bm3Qr25_.js +1 -0
- package/web/assets/material-theme-darker-2IIEA8gg.js +1 -0
- package/web/assets/material-theme-lighter-uhdI0v04.js +1 -0
- package/web/assets/material-theme-ocean-CHQ94UKr.js +1 -0
- package/web/assets/material-theme-palenight-B5W6OYN7.js +1 -0
- package/web/assets/mdc-4FfK5iWR.js +1 -0
- package/web/assets/mdx-DQZ5AkYe.js +1 -0
- package/web/assets/message-circle-C3tSGsW0.js +1 -0
- package/web/assets/min-dark-BSWPekZh.js +1 -0
- package/web/assets/min-light-DDpmG2fV.js +1 -0
- package/web/assets/monokai-B_bV9PQ9.js +1 -0
- package/web/assets/network-zt1ahOiz.js +1 -0
- package/web/assets/night-owl-DhmEMT88.js +1 -0
- package/web/assets/night-owl-light-eJ-hLW7d.js +1 -0
- package/web/assets/nord-Cb4Vim4T.js +1 -0
- package/web/assets/one-dark-pro-CLwyXe_n.js +1 -0
- package/web/assets/one-light-D7Lr4KcI.js +1 -0
- package/web/assets/panel-top-DYcS-wiY.js +1 -0
- package/web/assets/paperclip-t0nP1kBQ.js +1 -0
- package/web/assets/pencil-BOb7CieI.js +1 -0
- package/web/assets/php-CUREQQ7f.js +1 -0
- package/web/assets/pick-system-directory-BnIFt85A.js +1 -0
- package/web/assets/plastic-DQwYfKfQ.js +1 -0
- package/web/assets/play-V5zloi0R.js +1 -0
- package/web/assets/poimandres-DRFjx7u4.js +1 -0
- package/web/assets/postcss-BXeXVLqQ.js +1 -0
- package/web/assets/progress-DWkHIRCG.js +6 -0
- package/web/assets/pug-CQyGKZpv.js +1 -0
- package/web/assets/python-gzcpVVnB.js +1 -0
- package/web/assets/r-C5FwQflr.js +1 -0
- package/web/assets/react-bits-DQli9s7O.css +1 -0
- package/web/assets/red-DX1BQOs8.js +1 -0
- package/web/assets/regexp--aR2_iz7.js +1 -0
- package/web/assets/rolldown-runtime-B0Z9INg1.js +1 -0
- package/web/assets/rose-pine-aMsaMD1D.js +1 -0
- package/web/assets/rose-pine-dawn-8PwUyIlP.js +1 -0
- package/web/assets/rose-pine-moon-DO-qXg-I.js +1 -0
- package/web/assets/sass-DXrisJhu.js +1 -0
- package/web/assets/save-CTsP04bb.js +1 -0
- package/web/assets/scss-Davl4E3T.js +1 -0
- package/web/assets/search-Chj7BjSz.js +1 -0
- package/web/assets/shellscript-CLZ0U2zV.js +1 -0
- package/web/assets/shield-check-By9gGYwr.js +1 -0
- package/web/assets/slack-dark-DnToyrRv.js +1 -0
- package/web/assets/slack-ochin-B2OO5cIa.js +1 -0
- package/web/assets/smithy-Dgaz7aur.js +1 -0
- package/web/assets/snazzy-light-4G7pJPwS.js +1 -0
- package/web/assets/solarized-dark-UdsmMDCL.js +1 -0
- package/web/assets/solarized-light-C1IUL_tW.js +1 -0
- package/web/assets/sql-b92rrcVl.js +1 -0
- package/web/assets/square-DQQwOv3-.js +1 -0
- package/web/assets/square-terminal-ByK0g_OZ.js +1 -0
- package/web/assets/stylus-B6D30XZt.js +1 -0
- package/web/assets/sun-CiCuEpCg.js +1 -0
- package/web/assets/svelte-BfstjgUc.js +1 -0
- package/web/assets/synthwave-84-nFMaYfgc.js +1 -0
- package/web/assets/tag-B0fT5ThM.js +1 -0
- package/web/assets/tokyo-night-oM2G3aXe.js +1 -0
- package/web/assets/trash-2-2GzVxk5J.js +1 -0
- package/web/assets/ts-tags-Cckpt1jI.js +1 -0
- package/web/assets/tsx-JMDX3aQ7.js +1 -0
- package/web/assets/typescript-BAz-bF8J.js +1 -0
- package/web/assets/use-i18n-DmLwOjO5.js +1 -0
- package/web/assets/usePagePrimaryAction-Bw0OFTDZ.js +1 -0
- package/web/assets/utils-C8uzG5AZ.js +1 -0
- package/web/assets/vendor-dockview-D5adAaCg.css +1 -0
- package/web/assets/vendor-dockview-yY5mBM3U.js +1 -0
- package/web/assets/vendor-markdown-CWK5AVhB.js +130 -0
- package/web/assets/vendor-markdown-plugins-DCl4I7Pz.js +263 -0
- package/web/assets/vendor-motion-XxgxfZSY.js +9 -0
- package/web/assets/vendor-react-CHuvPdJE.js +9 -0
- package/web/assets/vendor-router-Bw2aAdMs.js +4 -0
- package/web/assets/vendor-shiki-runtime-CxE5QolQ.js +153 -0
- package/web/assets/vendor-state-DE1O_s6m.js +1 -0
- package/web/assets/vendor-ui-DvrYggeS.js +1 -0
- package/web/assets/vendor-xyflow-CnjXtcyK.js +7 -0
- package/web/assets/vendor-xyflow-DLioOiRN.css +1 -0
- package/web/assets/vesper-DdrHHSXu.js +1 -0
- package/web/assets/vitesse-black-fwtXNY1n.js +1 -0
- package/web/assets/vitesse-dark-BZCL-v6S.js +1 -0
- package/web/assets/vitesse-light-VbXTXTou.js +1 -0
- package/web/assets/vue-3H7P6ncC.js +1 -0
- package/web/assets/vue-html-DZGW9MGR.js +1 -0
- package/web/assets/vue-vine-BECt67gq.js +1 -0
- package/web/assets/wasm-BnjxR4X6.js +1 -0
- package/web/assets/wasm-ByWQv1Qj.js +1 -0
- package/web/assets/wgsl-BsKzXJz4.js +1 -0
- package/web/assets/wit-DdvCle-K.js +1 -0
- package/web/assets/wrench-DkHcVlxK.js +1 -0
- package/web/assets/xml-CNfvW5JP.js +1 -0
- package/web/assets/yaml-rwi0_p6S.js +1 -0
- package/web/assets/zap-CRNpJWAy.js +1 -0
- package/web/favicon.svg +25 -0
- package/web/icons.svg +24 -0
- package/web/index.html +72 -0
- package/web/memory-galaxy-background.webp +0 -0
- package/web/mobile-startup.html +316 -0
- package/web/notification-sw.js +13 -0
- package/web/tauri-pet.css +117 -0
- package/web/tauri-pet.html +16 -0
- package/web/tauri-pet.js +117 -0
- package/components/runtime/Pisper_Runtime_Node_0.5.20_linux_x86_64.tar.gz +0 -0
- package/components/runtime/Pisper_Runtime_Node_0.5.20_linux_x86_64.tar.gz.sig +0 -1
- package/components/tui/Pisper_TUI_Component_0.5.12_linux_x86_64.tar.gz +0 -0
- package/components/tui/Pisper_TUI_Component_0.5.12_linux_x86_64.tar.gz.sig +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,t as n}from"./vendor-react-CHuvPdJE.js";import{t as r}from"./utils-C8uzG5AZ.js";/* empty css */var i=e(t(),1),a=n();function o({className:e,onPointerDownCapture:t,children:n,...o}){let[s,c]=(0,i.useState)(null),l=(0,i.useCallback)(e=>{let n=e.currentTarget.getBoundingClientRect();c({id:Date.now(),x:e.clientX-n.left,y:e.clientY-n.top}),t?.(e)},[t]);return(0,a.jsxs)(`span`,{className:r(`rb-click-spark`,e),onPointerDownCapture:l,...o,children:[n,s&&(0,a.jsx)(`span`,{"aria-hidden":`true`,className:`rb-click-spark-burst`,style:{left:s.x,top:s.y},children:Array.from({length:8},(e,t)=>(0,a.jsx)(`i`,{style:{"--rb-spark-angle":`${t*45}deg`}},t))},s.id)]})}export{o as ClickSpark};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,t as n}from"./vendor-react-CHuvPdJE.js";import{n as r,r as i,s as a,t as o}from"./button-DzlQCSNK.js";import{d as s,h as c,m as l,p as u,r as d,s as f,t as p,u as m}from"./use-i18n-DmLwOjO5.js";import{i as h,n as g,r as _,t as v}from"./AppSelect-g6etLk2g.js";import{t as y}from"./utils-C8uzG5AZ.js";import{i as b,n as x,r as S,t as C}from"./MarkdownMessage-CMr3WuAI.js";import{t as w}from"./chevron-down-DXmj1gMQ.js";import{n as T}from"./copy-DO0sQBgx.js";import{t as E}from"./earth-D-KiHvdO.js";import{t as D}from"./loader-circle-i0WYlBWu.js";import{n as O,r as k,t as A}from"./sun-CiCuEpCg.js";import{t as j}from"./network-zt1ahOiz.js";import{t as M}from"./save-CTsP04bb.js";import{t as N}from"./search-Chj7BjSz.js";import{t as P}from"./shield-check-By9gGYwr.js";import{t as F}from"./square-terminal-ByK0g_OZ.js";import{t as I}from"./trash-2-2GzVxk5J.js";import{t as ee}from"./wrench-DkHcVlxK.js";import{t as te}from"./zap-CRNpJWAy.js";import{A as ne,B as re,Bt as ie,C as L,Ct as ae,D as oe,Dt as R,E as se,Et as ce,F as le,Ft as ue,G as z,Ht as de,It as fe,Lt as pe,M as me,Mt as he,N as ge,Ot as _e,P as ve,S as B,St as V,T as ye,Tt as be,U as xe,Vt as Se,a as H,b as Ce,bt as we,gt as Te,i as Ee,j as De,k as Oe,kt as ke,l as Ae,n as je,nn as Me,o as Ne,r as Pe,rn as Fe,s as Ie,t as Le,v as Re,w as ze,x as Be,y as Ve,z as He,zt as Ue}from"./index-BIQcwjFR.js";import{t as U}from"./field-CCo2X7MX.js";import{t as We}from"./usePagePrimaryAction-Bw0OFTDZ.js";import{n as Ge}from"./brand-CFOXmGdd.js";var W=e(t(),1),G=n(),Ke=Object.defineProperty,K=(e,t)=>Ke(e,`name`,{value:t,configurable:!0}),qe=[`PageUp`,`PageDown`],Je=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],Ye={"from-left":[`Home`,`PageDown`,`ArrowDown`,`ArrowLeft`],"from-right":[`Home`,`PageDown`,`ArrowDown`,`ArrowRight`],"from-bottom":[`Home`,`PageDown`,`ArrowDown`,`ArrowLeft`],"from-top":[`Home`,`PageDown`,`ArrowUp`,`ArrowLeft`]},Xe=`Slider`,[Ze,Qe,$e]=Fe(Xe),[et,tt]=l(Xe,[$e]),[nt,rt]=et(Xe),it=W.forwardRef(K(function(e,t){let{name:n,min:r=0,max:i=100,step:o=1,orientation:c=`horizontal`,disabled:l=!1,minStepsBetweenThumbs:d=0,defaultValue:f=[r],value:p,onValueChange:m=K(()=>{},`onValueChange`),onValueCommit:h=K(()=>{},`onValueCommit`),inverted:g=!1,form:v,...y}=e,b=W.useRef(new Set),x=W.useRef(0),S=W.useRef(!1),C=c===`horizontal`?st:ct,[w,T]=W.useState(null),E=a(t,T),[D=[],O]=s({prop:p,defaultProp:f,onChange:K(e=>{[...b.current][x.current]?.focus({preventScroll:!0,focusVisible:S.current}),S.current=!1,m(e)},`onChange`)}),k=W.useRef(D),A=W.useRef(D);W.useEffect(()=>{let e=v?w?.ownerDocument.getElementById(v):w?.closest(`form`);if(e instanceof HTMLFormElement){let t=K(()=>O(A.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[w,v,O]);function j(e){P(e,Et(D,e))}K(j,`handleSlideStart`);function M(e){P(e,x.current)}K(M,`handleSlideMove`);function N(){String(D)!==String(k.current)&&h(D)}K(N,`handleSlideEnd`);function P(e,t,{commit:n}={commit:!1}){let a=jt(o),s=Mt(Math.round((e-r)/o)*o+r,a),c=_(s,[r,i]);O((e=[])=>{let r=Ct(e,c,t);if(kt(r,d*o)){x.current=r.indexOf(c);let t=String(r)!==String(e);return t&&n&&h(r),t?r:e}return e})}return K(P,`updateValues`),(0,G.jsx)(nt,{scope:e.__scopeSlider,name:n,disabled:l,min:r,max:i,valueIndexToChangeRef:x,thumbs:b.current,values:D,orientation:c,form:v,children:(0,G.jsx)(Ze.Provider,{scope:e.__scopeSlider,children:(0,G.jsx)(Ze.Slot,{scope:e.__scopeSlider,children:(0,G.jsx)(C,{"aria-disabled":l,"data-disabled":l?``:void 0,...y,ref:E,onPointerDown:u(y.onPointerDown,()=>{l||(k.current=D,S.current=!1)}),min:r,max:i,inverted:g,onSlideStart:l?void 0:j,onSlideMove:l?void 0:M,onSlideEnd:l?void 0:N,onHomeKeyDown:()=>{l||(S.current=!0,P(r,0,{commit:!0}))},onEndKeyDown:()=>{l||(S.current=!0,P(i,D.length-1,{commit:!0}))},onStepKeyDown:({event:e,direction:t})=>{if(!l){S.current=!0;let n=qe.includes(e.key)||e.shiftKey&&Je.includes(e.key)?10:1,i=x.current,a=D[i];P(Nt(a,{min:r,step:o,direction:t,multiplier:n}),i,{commit:!0})}}})})})})},`Slider`)),[at,ot]=et(Xe,{startEdge:`left`,endEdge:`right`,size:`width`,direction:1}),st=W.forwardRef(K(function(e,t){let{min:n,max:r,dir:i,inverted:o,onSlideStart:s,onSlideMove:c,onSlideEnd:l,onStepKeyDown:u,...d}=e,[f,p]=W.useState(null),m=a(t,p),h=W.useRef(void 0),g=Me(i),_=g===`ltr`,v=_&&!o||!_&&o;function y(e){let t=h.current||f.getBoundingClientRect(),i=At([0,t.width],v?[n,r]:[r,n]);return h.current=t,i(e-t.left)}return K(y,`getValueFromPointer`),(0,G.jsx)(at,{scope:e.__scopeSlider,startEdge:v?`left`:`right`,endEdge:v?`right`:`left`,direction:v?1:-1,size:`width`,children:(0,G.jsx)(lt,{dir:g,"data-orientation":`horizontal`,...d,ref:m,style:{...d.style,"--radix-slider-thumb-transform":`translateX(-50%)`},onSlideStart:e=>{let t=y(e.clientX);s?.(t)},onSlideMove:e=>{let t=y(e.clientX);c?.(t)},onSlideEnd:()=>{h.current=void 0,l?.()},onStepKeyDown:e=>{let t=Ye[v?`from-left`:`from-right`].includes(e.key);u?.({event:e,direction:t?-1:1})}})})},`SliderHorizontal`)),ct=W.forwardRef(K(function(e,t){let{min:n,max:r,inverted:i,onSlideStart:o,onSlideMove:s,onSlideEnd:c,onStepKeyDown:l,...u}=e,d=W.useRef(null),f=a(t,d),p=W.useRef(void 0),m=!i;function h(e){let t=p.current||d.current.getBoundingClientRect(),i=At([0,t.height],m?[r,n]:[n,r]);return p.current=t,i(e-t.top)}return K(h,`getValueFromPointer`),(0,G.jsx)(at,{scope:e.__scopeSlider,startEdge:m?`bottom`:`top`,endEdge:m?`top`:`bottom`,size:`height`,direction:m?1:-1,children:(0,G.jsx)(lt,{"data-orientation":`vertical`,...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":`translateY(50%)`},onSlideStart:e=>{let t=h(e.clientY);o?.(t)},onSlideMove:e=>{let t=h(e.clientY);s?.(t)},onSlideEnd:()=>{p.current=void 0,c?.()},onStepKeyDown:e=>{let t=Ye[m?`from-bottom`:`from-top`].includes(e.key);l?.({event:e,direction:t?-1:1})}})})},`SliderVertical`)),lt=W.forwardRef(K(function(e,t){let{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:a,onHomeKeyDown:o,onEndKeyDown:s,onStepKeyDown:l,...d}=e,f=rt(Xe,n);return(0,G.jsx)(c.span,{...d,ref:t,onKeyDown:u(e.onKeyDown,e=>{e.key===`Home`?(o(e),e.preventDefault()):e.key===`End`?(s(e),e.preventDefault()):qe.concat(Je).includes(e.key)&&(l(e),e.preventDefault())}),onPointerDown:u(e.onPointerDown,e=>{let t=e.target;t.setPointerCapture(e.pointerId),e.preventDefault(),f.thumbs.has(t)?t.focus({preventScroll:!0,focusVisible:!1}):r(e)}),onPointerMove:u(e.onPointerMove,e=>{e.target.hasPointerCapture(e.pointerId)&&i(e)}),onPointerUp:u(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&(t.releasePointerCapture(e.pointerId),a(e))})})},`SliderImpl`)),ut=`SliderTrack`,dt=W.forwardRef(K(function(e,t){let{__scopeSlider:n,...r}=e,i=rt(ut,n);return(0,G.jsx)(c.span,{"data-disabled":i.disabled?``:void 0,"data-orientation":i.orientation,...r,ref:t})},`SliderTrack`)),ft=`SliderRange`,pt=W.forwardRef(K(function(e,t){let{__scopeSlider:n,...r}=e,i=rt(ft,n),o=ot(ft,n),s=W.useRef(null),l=a(t,s),u=i.values.length,d=i.values.map(e=>wt(e,i.min,i.max)),f=u>1?Math.min(...d):0,p=100-Math.max(...d);return(0,G.jsx)(c.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?``:void 0,...r,ref:l,style:{...e.style,[o.startEdge]:f+`%`,[o.endEdge]:p+`%`}})},`SliderRange`)),[mt,ht]=et(`SliderThumb`),gt=`SliderThumbProvider`;function _t(e){let{__scopeSlider:t,name:n,children:r,internal_do_not_use_render:i}=e,a=rt(gt,t),o=Qe(t),[s,c]=W.useState(null),l=W.useMemo(()=>s?o().findIndex(e=>e.ref.current===s):-1,[o,s]),u=m(s),d=!s||!!a.form||!!s.closest(`form`),f=a.values[l],p=n??(a.name?a.name+(a.values.length>1?`[]`:``):void 0),h=f===void 0?0:wt(f,a.min,a.max);W.useEffect(()=>{if(s)return a.thumbs.add(s),()=>{a.thumbs.delete(s)}},[s,a.thumbs]);let g={value:f,name:p,form:a.form,isFormControl:d,index:l,thumb:s,onThumbChange:c,percent:h,size:u};return(0,G.jsx)(mt,{scope:t,...g,children:Pt(i)?i(g):r})}K(_t,`SliderThumbProvider`);var vt=`SliderThumbTrigger`,yt=W.forwardRef(K(function(e,t){let{__scopeSlider:n,...r}=e,i=rt(vt,n),o=ot(vt,n),{index:s,value:l,percent:d,size:f,onThumbChange:p}=ht(vt,n),m=a(t,p),h=Tt(s,i.values.length),g=f?.[o.size],_=g?Dt(g,d,o.direction):0;return(0,G.jsx)(`span`,{style:{transform:`var(--radix-slider-thumb-transform)`,position:`absolute`,[o.startEdge]:`calc(${d}% + ${_}px)`},children:(0,G.jsx)(Ze.ItemSlot,{scope:n,children:(0,G.jsx)(c.span,{role:`slider`,"aria-label":e[`aria-label`]||h,"aria-valuemin":i.min,"aria-valuenow":l,"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:l===void 0?{display:`none`}:e.style,onFocus:u(e.onFocus,()=>{i.valueIndexToChangeRef.current=s})})})})},`SliderThumbTrigger`)),bt=W.forwardRef(K(function(e,t){let{__scopeSlider:n,name:r,...i}=e;return(0,G.jsx)(_t,{__scopeSlider:n,name:r,internal_do_not_use_render:({index:e,isFormControl:r})=>(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(yt,{...i,ref:t,__scopeSlider:n}),r?(0,G.jsx)(St,{__scopeSlider:n},e):null]})})},`SliderThumb`)),xt=`SliderBubbleInput`,St=W.forwardRef(K(function({__scopeSlider:e,...t},n){let{value:r,name:i,form:o}=ht(xt,e),s=W.useRef(null),l=a(s,n),u=h(r);return W.useEffect(()=>{let e=s.current;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(u!==r&&n){let t=new Event(`input`,{bubbles:!0});n.call(e,r),e.dispatchEvent(t)}},[u,r]),(0,G.jsx)(c.input,{style:{display:`none`},name:i,form:o,...t,ref:l,defaultValue:r})},`SliderBubbleInput`));function Ct(e=[],t,n){let r=[...e];return r[n]=t,r.sort((e,t)=>e-t)}K(Ct,`getNextSortedValues`);function wt(e,t,n){let r=100/(n-t)*(e-t);return _(r,[0,100])}K(wt,`convertValueToPercentage`);function Tt(e,t){if(t>2)return`Value ${e+1} of ${t}`;if(t===2)return[`Minimum`,`Maximum`][e]}K(Tt,`getLabel`);function Et(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)}K(Et,`getClosestValueIndex`);function Dt(e,t,n){let r=e/2;return(r-At([0,50],[0,r])(t)*n)*n}K(Dt,`getThumbInBoundsOffset`);function Ot(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}K(Ot,`getStepsBetweenValues`);function kt(e,t){if(t>0){let n=Ot(e);return Math.min(...n)>=t}return!0}K(kt,`hasMinStepsBetweenValues`);function At(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])}}K(At,`linearScale`);function jt(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}K(jt,`getDecimalCount`);function Mt(e,t){let n=10**t;return Math.round(e*n)/n}K(Mt,`roundValue`);function Nt(e,{min:t,step:n,direction:r,multiplier:i}){let a=jt(n),o=(e-t)/n,s=Math.round(o),c=Mt(s*n+t,a)===Mt(e,a),l;return l=c?s+i*r:r>0?Math.ceil(o):Math.floor(o),Mt(l*n+t,a)}K(Nt,`getNextStepValue`);function Pt(e){return typeof e==`function`}K(Pt,`isFunction`);var Ft=r(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),It=r(`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`}]]),Lt=r(`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`}]]),Rt=r(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),zt=r(`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`}]]),Bt=r(`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`}]]),Vt=r(`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`}]]),Ht=r(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),Ut=r(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),Wt=r(`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`}]]),Gt=r(`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`}]]),Kt=r(`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`}]]),qt=r(`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`}]]),Jt=r(`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`}]]),Yt=r(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Xt=r(`scale`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`m19 8 3 8a5 5 0 0 1-6 0zV7`,key:`zcdpyk`}],[`path`,{d:`M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1`,key:`1yorad`}],[`path`,{d:`m5 8 3 8a5 5 0 0 1-6 0zV7`,key:`eua70x`}],[`path`,{d:`M7 21h10`,key:`1b0cd5`}]]),Zt=r(`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`}]]),Qt=r(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),$t=r(`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`}]]),en=r(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),tn=r(`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`}]]),nn=r(`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`}]]),q=Le,J=Ne,Y=Ae;function X(e){return(0,G.jsx)(Ie,{density:`compact`,...e})}var rn=`0.5.19`,an=`https://ling-kong-ran.github.io/pisper/`,on=`https://github.com/ling-kong-ran/pisper`,sn=`${on}/blob/release/LICENSE`;function cn({href:e,icon:t,label:n,value:r}){return(0,G.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`,children:[(0,G.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,G.jsx)(t,{size:16})}),(0,G.jsxs)(`span`,{className:`min-w-0`,children:[(0,G.jsx)(`strong`,{className:`block text-[13px] text-[var(--text)]`,children:n}),(0,G.jsx)(`small`,{className:`mt-0.5 block truncate text-[12px] text-[var(--text-muted)]`,children:r})]}),(0,G.jsx)(ue,{className:`text-[var(--text-muted)] transition-colors group-hover:text-[var(--star-strong)]`,size:14})]})}function ln({update:e}){let{t}=p(),n=e.info?.version||rn;return(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[760px] flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-4 px-1 py-3`,children:[(0,G.jsx)(`img`,{className:`size-16 shrink-0 rounded-[14px] shadow-[0_10px_28px_-14px_var(--shadow)]`,src:`/favicon.svg`,alt:`Pisper`}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`h1`,{className:`text-[22px] font-bold tracking-[0]`,children:`Pisper`}),(0,G.jsxs)(Y,{tone:`gray`,children:[`v`,n]})]}),(0,G.jsx)(`p`,{className:`mt-1 text-[13px] leading-5 text-[var(--text-muted)]`,children:t(`config:aboutSettings.description`)})]})]}),(0,G.jsxs)(q,{className:`p-5`,children:[(0,G.jsx)(J,{title:t(`config:aboutSettings.projectInformation`)}),(0,G.jsxs)(`div`,{className:`mt-3 divide-y divide-[var(--stroke-soft)] border-y border-[var(--stroke-soft)]`,children:[(0,G.jsx)(cn,{href:an,icon:E,label:t(`config:aboutSettings.website`),value:`ling-kong-ran.github.io/pisper`}),(0,G.jsx)(cn,{href:on,icon:T,label:t(`config:aboutSettings.sourceCode`),value:`github.com/ling-kong-ran/pisper`}),(0,G.jsx)(cn,{href:sn,icon:Xt,label:t(`config:aboutSettings.license`),value:`MIT License`})]})]}),(0,G.jsx)(q,{className:`p-5`,children:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4 max-[540px]:flex-col max-[540px]:items-stretch`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(J,{title:t(`config:aboutSettings.supportPisper`)}),(0,G.jsx)(`p`,{className:`mt-1 max-w-[520px] text-[13px] leading-5 text-[var(--text-muted)]`,children:t(`config:aboutSettings.supportDescription`)})]}),(0,G.jsx)(o,{asChild:!0,size:`lg`,className:`max-[540px]:w-full`,children:(0,G.jsxs)(`a`,{href:on,target:`_blank`,rel:`noopener noreferrer`,children:[(0,G.jsx)($t,{size:15}),t(`config:aboutSettings.starOnGitHub`)]})})]})}),(0,G.jsx)(`p`,{className:`px-1 py-2 text-center text-[12px] text-[var(--text-muted)]`,children:t(`config:aboutSettings.copyright`)})]})}function un({className:e,defaultValue:t,value:n,min:r=0,max:i=100,...a}){let o=W.useMemo(()=>Array.isArray(n)?n:Array.isArray(t)?t:[r,i],[n,t,r,i]);return(0,G.jsxs)(it,{"data-slot":`slider`,defaultValue:t,value:n,min:r,max:i,className:y(`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,G.jsx)(dt,{"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,G.jsx)(pt,{"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,G.jsx)(bt,{"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 dn(e){window.dispatchEvent(new CustomEvent(`pisper:desktop-pet-changed`,{detail:e}))}function fn({notify:e,requestConfirm:t}){let{t:n}=p(),r=window.pisperDesktop,i=(0,W.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:()=>z(`/api/desktop-pet`),setEnabled:e=>z(`/api/desktop-pet/enabled`,{method:`POST`,body:{enabled:e}}),setOpacity:e=>z(`/api/desktop-pet/opacity`,{method:`POST`,body:{opacity:e}}),search:e=>z(`/api/desktop-pet/catalog?query=${encodeURIComponent(e)}`),install:e=>z(`/api/desktop-pet/install`,{method:`POST`,body:{slug:e}}),select:e=>z(`/api/desktop-pet/select`,{method:`POST`,body:{slug:e}}),remove:e=>z(`/api/desktop-pet/${encodeURIComponent(e)}`,{method:`DELETE`}),openCatalog:()=>window.open(`https://petdex.dev`,`_blank`,`noopener,noreferrer`)},[r]),[a,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(``),[u,d]=(0,W.useState)([]),[f,m]=(0,W.useState)(100),[h,g]=(0,W.useState)(``),[_,v]=(0,W.useState)(``),y=(0,W.useCallback)(e=>{s(e),m(Math.round((e.opacity??1)*100))},[]),b=(0,W.useCallback)(async()=>{try{v(``),y(await i.getStatus())}catch(e){v(e instanceof Error?e.message:String(e))}},[y,i]),x=(0,W.useCallback)(async()=>{g(`search`);try{v(``),d(await i.search(c))}catch(e){v(e instanceof Error?e.message:String(e))}finally{g(``)}},[i,c]);(0,W.useEffect)(()=>{b(),i.search(``).then(d).catch(()=>{})},[i,b]);let S=async t=>{let r=a;s(e=>e&&{...e,enabled:t,running:!!(t&&e.installed.length)}),g(`toggle`);try{v(``);let r=await i.setEnabled(t);y(r),dn(r),e(n(t?`config:desktopPetSettings.petEnabled`:`config:desktopPetSettings.petDisabled`))}catch(e){s(r),v(e instanceof Error?e.message:String(e))}finally{g(``)}},C=async e=>{g(`opacity`);try{v(``);let t=await i.setOpacity(e);y(t),dn(t)}catch(e){m(Math.round((a?.opacity??1)*100)),v(e instanceof Error?e.message:String(e))}finally{g(``)}},w=async(t=c)=>{if(t.trim()){g(`install`);try{v(``);let r=await i.install(t);y(r),dn(r),e(n(`config:desktopPetSettings.petInstalled`,{name:r.selectedName||t}))}catch(e){v(e instanceof Error?e.message:String(e))}finally{g(``)}}},T=async t=>{if(t!==a?.selectedSlug){g(`select:${t}`);try{v(``);let r=await i.select(t);y(r),dn(r),e(n(`config:desktopPetSettings.petSelected`,{name:r.selectedName||t}))}catch(e){v(e instanceof Error?e.message:String(e))}finally{g(``)}}},E=async r=>{if(await t({title:n(`config:desktopPetSettings.deleteTitle`),message:n(`config:desktopPetSettings.deleteConfirm`,{name:r.name}),confirmLabel:n(`config:desktopPetSettings.delete`),tone:`danger`})){g(`remove:${r.slug}`);try{v(``);let t=await i.remove(r.slug);y(t),dn(t),e(n(`config:desktopPetSettings.petRemoved`,{name:r.name}))}catch(e){v(e instanceof Error?e.message:String(e))}finally{g(``)}}};return(0,G.jsxs)(`div`,{className:`flex w-[min(100%,_760px)] flex-col gap-[12px] desktop-pet-settings`,children:[(0,G.jsxs)(q,{className:`[padding:18px]`,children:[(0,G.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,G.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,G.jsx)(Lt,{size:19})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{children:n(`config:desktopPetSettings.title`)}),(0,G.jsx)(`p`,{children:n(`config:desktopPetSettings.description`)})]})]}),a?(0,G.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] mt-4`,children:[(0,G.jsx)(Lt,{size:18}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:n(`config:desktopPetSettings.showOnDesktop`)}),(0,G.jsx)(`small`,{children:a.selectedName?n(`config:desktopPetSettings.currentPet`,{name:a.selectedName}):n(`config:desktopPetSettings.installBeforeEnabling`)})]}),(0,G.jsx)(Y,{tone:a.running?`green`:`gray`,children:a.running?n(`config:desktopPetSettings.running`):n(`config:desktopPetSettings.stopped`)}),(0,G.jsx)(X,{value:a.enabled,disabled:!!h||!a.installed.length,onChange:S,ariaLabel:n(`config:desktopPetSettings.showOnDesktop`)})]}):(0,G.jsxs)(H,{className:`[margin-top:15px]`,children:[(0,G.jsx)(R,{className:`animate-spin`,size:16}),(0,G.jsx)(`span`,{children:n(`config:desktopPetSettings.loading`)})]}),a&&(0,G.jsxs)(`div`,{className:`desktop-pet-opacity [&_>_div]:flex [&_>_div]:items-center [&_>_div]:justify-between [&_>_div]:gap-[8px] [&_>_div]:text-[12px] [&_>_div_span]:text-[var(--text-muted)] [&_>_div_span]:[font-variant-numeric:tabular-nums] grid grid-cols-[150px_minmax(0,1fr)] items-center gap-[14px] [border-top:1px_solid_var(--stroke-soft)] [padding-top:14px] mt-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:n(`config:desktopPetSettings.opacity`)}),(0,G.jsxs)(`span`,{children:[f,`%`]})]}),(0,G.jsx)(un,{value:[f],min:20,max:100,step:5,disabled:h===`opacity`,onValueChange:([e])=>m(e),onValueCommit:([e])=>void C(e/100),"aria-label":n(`config:desktopPetSettings.opacity`)})]}),_&&(0,G.jsx)(`div`,{className:`text-[var(--danger)] text-[13px] mt-3`,children:_})]}),(0,G.jsxs)(q,{className:`[padding:18px]`,children:[(0,G.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,G.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,G.jsx)(fe,{size:19})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{children:n(`config:desktopPetSettings.installTitle`)}),(0,G.jsx)(`p`,{children:n(`config:desktopPetSettings.installDescription`)})]})]}),(0,G.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,G.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&x()},placeholder:n(`config:desktopPetSettings.searchPlaceholder`),"aria-label":n(`config:desktopPetSettings.petSlug`)}),(0,G.jsxs)(o,{size:`lg`,className:`min-w-[104px]`,disabled:h===`search`,onClick:x,children:[h===`search`?(0,G.jsx)(R,{className:`animate-spin`,size:14}):(0,G.jsx)(N,{size:14}),n(`config:desktopPetSettings.search`)]})]}),u.length>0&&(0,G.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`,children:u.map(e=>{let t=a?.installed.some(t=>t.slug===e.slug);return(0,G.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:!!h,onClick:()=>t?T(e.slug):w(e.slug),children:[(0,G.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,G.jsx)(Lt,{size:16})}),(0,G.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,G.jsx)(`strong`,{children:e.displayName}),(0,G.jsx)(`small`,{children:e.slug})]}),(0,G.jsx)(Y,{tone:t?`green`:`blue`,children:n(t?`config:desktopPetSettings.installed`:`config:desktopPetSettings.install`)})]},e.slug)})}),(0,G.jsx)(`div`,{className:`mt-[15px] flex gap-2 max-[650px]:flex-wrap`,children:(0,G.jsxs)(o,{variant:`outline`,size:`lg`,className:`bg-surface-subtle`,onClick:i.openCatalog,children:[(0,G.jsx)(ue,{size:14}),n(`config:desktopPetSettings.browsePetdex`)]})})]}),a&&a.installed.length>0&&(0,G.jsxs)(q,{className:`[padding:18px]`,children:[(0,G.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,G.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,G.jsx)(Lt,{size:19})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{children:n(`config:desktopPetSettings.installedTitle`)}),(0,G.jsx)(`p`,{children:n(`config:desktopPetSettings.installedDescription`)})]})]}),(0,G.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,G.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,G.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:!!h,onClick:()=>T(e.slug),children:[(0,G.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,G.jsx)(Lt,{size:16})}),(0,G.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,G.jsx)(`strong`,{children:e.name}),(0,G.jsx)(`small`,{children:e.slug})]}),(0,G.jsx)(Y,{tone:e.source===`pisper`?`blue`:`gray`,children:e.source===`pisper`?`Pisper`:`Petdex`})]}),e.source===`pisper`&&(0,G.jsx)(o,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`text-content-muted hover:text-destructive`,disabled:!!h,onClick:()=>void E(e),"aria-label":n(`config:desktopPetSettings.delete`),title:n(`config:desktopPetSettings.delete`),children:h===`remove:${e.slug}`?(0,G.jsx)(R,{className:`animate-spin`,size:14}):(0,G.jsx)(I,{size:14})})]},`${e.source}:${e.slug}`)})})]})]})}function pn(e,t){return t(e===`en-US`?`config:languageSettings.english`:`config:languageSettings.simplifiedChinese`)}function mn({notify:e}){let{language:t,setLanguage:n,t:r}=p(),i=r=>{r!==t&&(n(r),e(f(r===`en-US`?`config:languageSettings.displayLanguageChangedToEnglish`:`config:languageSettings.displayLanguageChangedToSimplifiedChinese`,r)))};return(0,G.jsxs)(q,{className:`p-[18px]`,children:[(0,G.jsxs)(`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,G.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,G.jsx)(Ut,{size:19})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{children:r(`config:languageSettings.displayLanguage`)}),(0,G.jsx)(`p`,{children:r(`config:languageSettings.chooseTheLanguageUsedByPisperChangesApplyImmediatelyAndAreSavedForYourNextVisit`)})]})]}),(0,G.jsx)(`div`,{className:`mt-[18px] grid grid-cols-2 gap-[9px] max-[650px]:grid-cols-1`,role:`radiogroup`,"aria-label":r(`config:languageSettings.displayLanguage`),children:d.map(e=>{let n=e.value===t;return(0,G.jsxs)(`button`,{type:`button`,className:`grid min-h-[80px] grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2.5 rounded-[var(--r-sm)] border bg-[var(--surface-subtle)] p-[11px] text-left text-[var(--text)] transition hover:-translate-y-px hover:border-[var(--star)] hover:bg-[var(--accent-soft)] ${n?`border-[var(--star)] bg-[var(--star-soft)] shadow-[0_0_0_3px_var(--accent-ring)]`:`border-[var(--stroke)]`}`,role:`radio`,"aria-checked":n,onClick:()=>i(e.value),children:[(0,G.jsx)(`span`,{className:`grid size-[34px] place-items-center rounded-[var(--r-xs)] text-[12px] font-extrabold ${e.value===`en-US`?`bg-[var(--brand-blue-soft)] text-[var(--brand-blue-strong)]`:`bg-[var(--solid)] text-[var(--star-strong)]`}`,children:e.shortName}),(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-[3px] [&_small]:text-[var(--text-muted)] [&_strong]:text-[13px]`,children:[(0,G.jsx)(`strong`,{children:pn(e.value,r)}),(0,G.jsx)(`small`,{children:e.value===`zh-CN`?r(`config:languageSettings.chineseInterface`):r(`config:languageSettings.englishInterface`)})]}),n&&(0,G.jsx)(`span`,{className:`grid size-[21px] place-items-center rounded-full bg-[var(--star)] text-[var(--on-accent)]`,children:(0,G.jsx)(g,{size:15})})]},e.value)})}),(0,G.jsxs)(H,{className:`mt-[15px]`,children:[(0,G.jsx)(Ut,{size:16}),(0,G.jsxs)(`span`,{children:[(0,G.jsxs)(`strong`,{children:[r(`config:languageSettings.currentLanguage`),` · `,pn(t,r)]}),(0,G.jsx)(`small`,{children:r(`config:languageSettings.thisSettingChangesInterfaceTextOnlyItDoesNotControlTheLanguageOfAgentResponses`)})]})]})]})}function hn({icon:e,title:t,description:n}){return(0,G.jsxs)(`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,G.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,G.jsx)(e,{size:19})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{children:t}),(0,G.jsx)(`p`,{children:n})]})]})}function gn({label:e,options:t,value:n,onChange:r}){return(0,G.jsx)(`div`,{className:`mt-4 grid grid-cols-2 gap-2 max-[650px]:grid-cols-1`,role:`radiogroup`,"aria-label":e,children:t.map(e=>{let t=e.value===n,i=e.icon;return(0,G.jsxs)(`button`,{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:-translate-y-px hover:border-[var(--star)] hover:bg-[var(--accent-soft)] ${t?`border-[var(--star)] bg-[var(--star-soft)] shadow-[0_0_0_3px_var(--accent-ring)]`:`border-[var(--stroke)] bg-[var(--surface-subtle)]`}`,role:`radio`,"aria-checked":t,onClick:()=>r(e.value),children:[(0,G.jsx)(`span`,{className:`grid size-8 place-items-center rounded-[var(--r-xs)] bg-[var(--solid)] text-[var(--star-strong)]`,children:(0,G.jsx)(i,{size:16})}),(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,G.jsx)(`strong`,{className:`text-[13px]`,children:e.label}),(0,G.jsx)(`small`,{className:`text-[var(--text-muted)]`,children:e.description})]}),t&&(0,G.jsx)(`span`,{className:`grid size-5 place-items-center rounded-full bg-[var(--star)] text-[var(--on-accent)]`,children:(0,G.jsx)(g,{size:13})})]},e.value)})})}function _n({label:e,options:t,value:n,onChange:r}){return(0,G.jsx)(`div`,{className:`grid grid-cols-3 gap-1 rounded-[var(--r-sm)] bg-[var(--surface-muted)] p-1`,role:`radiogroup`,"aria-label":e,children:t.map(e=>(0,G.jsx)(`button`,{type:`button`,className:`min-h-8 rounded-[var(--r-xs)] px-2 text-[12px] font-semibold transition ${e.value===n?`bg-[var(--solid)] text-[var(--text)] shadow-sm`:`text-[var(--text-muted)] hover:text-[var(--text)]`}`,role:`radio`,"aria-checked":e.value===n,onClick:()=>r(e.value),children:e.label},e.value))})}var vn={neutral:`#18181b`,blue:`#1677e8`,teal:`#0f766e`,violet:`#7557c8`,coral:`#c94f5d`,custom:`#1677e8`};function yn({notify:e}){let{t}=p(),n=L(e=>e.theme),r=L(e=>e.density),i=L(e=>e.accent),a=L(e=>e.customAccent),s=L(e=>e.fontScale),c=L(e=>e.radius),l=L(e=>e.motion),u=L(e=>e.setTheme),d=L(e=>e.setDensity),f=L(e=>e.setAccent),m=L(e=>e.setCustomAccent),h=L(e=>e.setFontScale),_=L(e=>e.setRadius),v=L(e=>e.setMotion),y=L(e=>e.resetAppearance),b=n!==B.theme||r!==B.density||i!==B.accent||a!==B.customAccent||s!==B.fontScale||c!==B.radius||l!==B.motion,[x,C]=(0,W.useState)(a);(0,W.useEffect)(()=>C(a),[a]);let w=Te(x),T=!!x.trim()&&!w,E=e=>{C(e);let t=Te(e);t&&j(m)(t)},D=()=>e(t(`config:interfaceSettings.preferencesUpdated`)),j=e=>t=>{e(t),D()},M=[{value:`system`,label:t(`config:interfaceSettings.followSystem`),description:t(`config:interfaceSettings.followSystemDescription`),icon:k},{value:`scheduled`,label:t(`config:interfaceSettings.automaticByTime`),description:t(`config:interfaceSettings.automaticByTimeDescription`),icon:S},{value:`light`,label:t(`config:interfaceSettings.light`),description:t(`config:interfaceSettings.lightDescription`),icon:A},{value:`dark`,label:t(`config:interfaceSettings.dark`),description:t(`config:interfaceSettings.darkDescription`),icon:O}],N=[{value:`comfortable`,label:t(`config:interfaceSettings.comfortable`),description:t(`config:interfaceSettings.comfortableDescription`),icon:nn},{value:`compact`,label:t(`config:interfaceSettings.compact`),description:t(`config:interfaceSettings.compactDescription`),icon:Bt}],P=[{value:`system`,label:t(`config:interfaceSettings.motionSystem`),description:t(`config:interfaceSettings.motionSystemDescription`),icon:k},{value:`full`,label:t(`config:interfaceSettings.motionFull`),description:t(`config:interfaceSettings.motionFullDescription`),icon:ae},{value:`reduced`,label:t(`config:interfaceSettings.motionReduced`),description:t(`config:interfaceSettings.motionReducedDescription`),icon:Ft}],F=[{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`)}],I=[{value:`small`,label:t(`config:interfaceSettings.small`)},{value:`default`,label:t(`config:interfaceSettings.standard`)},{value:`large`,label:t(`config:interfaceSettings.large`)}],ee=[{value:`sharp`,label:t(`config:interfaceSettings.sharp`)},{value:`default`,label:t(`config:interfaceSettings.standard`)},{value:`soft`,label:t(`config:interfaceSettings.soft`)}];return(0,G.jsxs)(`div`,{className:`flex w-[min(100%,920px)] flex-col gap-3`,children:[(0,G.jsxs)(q,{className:`p-[18px]`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4 max-[650px]:flex-col`,children:[(0,G.jsx)(hn,{icon:Kt,title:t(`config:interfaceSettings.appearance`),description:t(`config:interfaceSettings.appearanceDescription`)}),(0,G.jsxs)(o,{type:`button`,variant:`outline`,size:`sm`,disabled:!b,onClick:()=>{y(),e(t(`config:interfaceSettings.defaultsRestored`))},children:[(0,G.jsx)(Yt,{size:14}),t(`config:interfaceSettings.restoreDefaults`)]})]}),(0,G.jsx)(gn,{label:t(`config:interfaceSettings.colorMode`),options:M,value:n,onChange:j(u)}),(0,G.jsxs)(`div`,{className:`mt-5 border-t border-[var(--stroke-soft)] pt-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px] font-bold text-[var(--text-soft)]`,children:[(0,G.jsx)(Kt,{size:15}),t(`config:interfaceSettings.accentColor`)]}),(0,G.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,role:`radiogroup`,"aria-label":t(`config:interfaceSettings.accentColor`),children:F.map(e=>(0,G.jsxs)(`button`,{type:`button`,className:`flex min-h-9 items-center gap-2 rounded-[var(--r-sm)] border px-2.5 text-[12px] font-semibold transition hover:border-[var(--star)] ${i===e.value?`border-[var(--star)] bg-[var(--star-soft)] text-[var(--star-strong)] shadow-[0_0_0_3px_var(--accent-ring)]`:`border-[var(--stroke)] bg-[var(--surface-subtle)] text-[var(--text-soft)]`}`,role:`radio`,"aria-checked":i===e.value,onClick:()=>j(f)(e.value),children:[(0,G.jsx)(`span`,{className:`size-3.5 rounded-full border border-black/10 shadow-sm`,style:{backgroundColor:e.value===`custom`?a:vn[e.value]}}),e.label,i===e.value&&(0,G.jsx)(g,{size:13})]},e.value))}),i===`custom`&&(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 rounded-[var(--r-sm)] border border-[var(--stroke)] bg-[var(--surface-subtle)] p-3`,children:[(0,G.jsx)(`input`,{type:`color`,value:Te(a)||`#1677e8`,onChange:e=>j(m)(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,G.jsx)(`input`,{type:`text`,value:x,onChange:e=>E(e.target.value),spellCheck:!1,"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)] ${T?`border-[var(--danger)]`:`border-[var(--stroke)]`}`}),(0,G.jsx)(`span`,{className:`text-[12px] ${T?`text-[var(--danger)]`:`text-[var(--text-muted)]`}`,children:t(T?`config:interfaceSettings.invalidAccentColor`:`config:interfaceSettings.customAccentHint`)})]})]}),(0,G.jsxs)(`div`,{className:`mt-5 grid grid-cols-[minmax(0,1fr)_minmax(260px,.72fr)] gap-4 border-t border-[var(--stroke-soft)] pt-4 max-[720px]:grid-cols-1`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px] font-bold text-[var(--text-soft)]`,children:[(0,G.jsx)(tn,{size:15}),t(`config:interfaceSettings.interfaceStyle`)]}),(0,G.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3 max-[470px]:grid-cols-1`,children:[(0,G.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-[12px] text-[var(--text-muted)]`,children:t(`config:interfaceSettings.fontSize`)}),(0,G.jsx)(_n,{label:t(`config:interfaceSettings.fontSize`),options:I,value:s,onChange:j(h)})]}),(0,G.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-[12px] text-[var(--text-muted)]`,children:t(`config:interfaceSettings.cornerStyle`)}),(0,G.jsx)(_n,{label:t(`config:interfaceSettings.cornerStyle`),options:ee,value:c,onChange:j(_)})]})]})]}),(0,G.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,G.jsxs)(`div`,{className:`flex h-8 items-center gap-1.5 border-b border-[var(--stroke)] bg-[var(--surface-subtle)] px-3`,children:[(0,G.jsx)(`span`,{className:`size-1.5 rounded-full bg-[var(--brand-blue)]`}),(0,G.jsx)(`span`,{className:`text-[11px] font-bold text-[var(--text-muted)]`,children:t(`config:interfaceSettings.livePreview`)})]}),(0,G.jsxs)(`div`,{className:`grid gap-2.5 p-3`,children:[(0,G.jsx)(`div`,{className:`mr-7 rounded-[var(--r-sm)] bg-[var(--surface-muted)] p-2 text-[var(--app-font-size)] text-[var(--text-soft)]`,children:t(`config:interfaceSettings.previewAgentMessage`)}),(0,G.jsx)(`div`,{className:`ml-7 rounded-[var(--r-sm)] bg-[var(--star)] p-2 text-[var(--app-font-size)] text-[var(--on-accent)]`,children:t(`config:interfaceSettings.previewUserMessage`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`h-1.5 flex-1 overflow-hidden rounded-full bg-[var(--surface-muted)]`,children:(0,G.jsx)(`span`,{className:`block h-full w-2/3 rounded-full bg-[var(--brand-blue)]`})}),(0,G.jsx)(`span`,{className:`text-[11px] text-[var(--text-muted)]`,children:`67%`})]})]})]})]})]}),(0,G.jsxs)(q,{className:`p-[18px]`,children:[(0,G.jsx)(hn,{icon:Ft,title:t(`config:interfaceSettings.displayAndMotion`),description:t(`config:interfaceSettings.displayAndMotionDescription`)}),(0,G.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-5 max-[720px]:grid-cols-1`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[13px] font-bold text-[var(--text-soft)]`,children:t(`config:interfaceSettings.interfaceDensity`)}),(0,G.jsx)(gn,{label:t(`config:interfaceSettings.interfaceDensity`),options:N,value:r,onChange:j(d)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[13px] font-bold text-[var(--text-soft)]`,children:t(`config:interfaceSettings.motion`)}),(0,G.jsx)(gn,{label:t(`config:interfaceSettings.motion`),options:P,value:l,onChange:j(v)})]})]})]}),(0,G.jsx)(mn,{notify:e})]})}var bn=[[`openai-responses`,`OpenAI Responses`],[`openai-completions`,`OpenAI Chat Completions`],[`anthropic-messages`,`Anthropic Messages`],[`google-generative-ai`,`Google Generative AI`]];function xn({provider:e,draft:t,toggling:n,apiKeyInputRef:r,onPatchDraft:i,onSelectProviderType:a,onToggleProvider:s,onDeleteProvider:c}){let{t:l}=p(),u=e.id===`openai-codex`,d=t.providerType===`visual`;return(0,G.jsxs)(q,{children:[(0,G.jsxs)(je,{children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{children:e.name}),(0,G.jsxs)(`p`,{children:[e.id,` · `,e.api,` ·`,` `,l(`config:configPage.authenticationAndEndpointsAreStoredIndependentlyForEachConnection`)]})]}),(0,G.jsxs)(`div`,{className:`provider-header-status flex items-center justify-between gap-[8px] flex-none`,children:[(0,G.jsx)(Y,{tone:e.configured?e.enabled?`green`:`gray`:`amber`,children:e.configured?e.enabled?l(`config:configPage.authenticationReady`):l(`config:configPage.disabled2`):l(u?`config:configPage.codexCLILoginRequired`:`config:configPage.apiKeyRequired`)}),(0,G.jsx)(X,{value:e.configured&&e.enabled,disabled:!e.configured||n===e.id,onChange:t=>s(e,t)}),e.custom&&(0,G.jsx)(o,{variant:`destructive`,size:`icon`,title:l(`config:configPage.deleteProvider`),onClick:()=>c(e),children:(0,G.jsx)(I,{size:14})})]})]}),u?(0,G.jsxs)(`div`,{className:`oauth-provider-note [&_>_span]:flex [&_>_span]:min-w-0 [&_>_span]:flex-col [&_>_span]:gap-[3px] [&_strong]:text-[var(--text)] [&_strong]:text-[12px] [&_small]:text-[var(--text-muted)] [&_small]:text-[12px] [&_small]:leading-[1.45] flex items-start gap-[9px] [margin-top:14px] [border:1px_solid_var(--star-border)] rounded-[var(--r-sm)] bg-[var(--star-soft)] [padding:10px_11px] text-[var(--star-strong)]`,children:[(0,G.jsx)(P,{size:17}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{children:e.configured?l(`config:configPage.chatGPTOAuthConnected`):l(`config:configPage.codexCLILoginRequired`)}),(0,G.jsx)(`small`,{children:e.configured?l(`config:configPage.openAICodexUsesChatGPTPlusProOAuthAndDoesNotAcceptARegularAPIKey`):l(`config:configPage.signInWithCodexCLIThenLoadItFromTheLocalProvidersSectionAbove`)})]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(J,{title:l(`config:configPage.authentication`)}),(0,G.jsxs)(U,{variant:`control`,children:[`API Key`,(0,G.jsxs)(`span`,{className:`input-wrap [&_button]:absolute [&_button]:right-[3px] [&_button]:top-[3px] [&_button]:grid [&_button]:w-[32px] [&_button]:h-[32px] [&_button]:place-items-center [&_button]:border-0 [&_button]:bg-transparent [&_button]:text-[var(--text-muted)] [&_>_svg]:absolute [&_>_svg]:right-[9px] [&_>_svg]:top-[8px] [&_>_svg]:text-[var(--text-muted)] relative flex`,children:[(0,G.jsx)(`input`,{ref:r,type:`password`,name:`provider-api-key-${e.id}`,autoComplete:`new-password`,value:t.apiKey,onChange:e=>i({apiKey:e.currentTarget.value}),onInput:e=>{let n=e.currentTarget.value;t.apiKey!==n&&i({apiKey:n})},placeholder:e.configured?l(`config:configPage.configuredLeaveBlankToKeepTheExistingKey`):l(`config:configPage.enterTheProviderAPIKey`)}),(0,G.jsx)(Ht,{size:14})]})]}),(0,G.jsxs)(U,{variant:`control`,children:[l(`config:configPage.apiProtocol`),(0,G.jsx)(v,{value:t.api,onChange:e=>i({api:e.target.value}),children:bn.map(([e,t])=>(0,G.jsx)(`option`,{value:e,children:t},e))})]}),(0,G.jsx)(J,{title:l(`config:configPage.endpoint`)}),(0,G.jsxs)(U,{variant:`control`,children:[`Provider Base URL`,(0,G.jsx)(`input`,{value:t.baseUrl,onChange:e=>i({baseUrl:e.target.value}),placeholder:l(`config:configPage.defaultEndpointForModelsInThisConnection`)})]}),(0,G.jsxs)(U,{variant:`control`,children:[`Organization`,(0,G.jsx)(`input`,{value:t.organization,onChange:e=>i({organization:e.target.value}),placeholder:l(`config:configPage.optionalUsedOnlyForOpenAIOrganization`)})]})]}),(0,G.jsxs)(U,{variant:`control`,children:[l(`config:configPage.providerPurpose`),(0,G.jsxs)(v,{value:t.providerType,onChange:e=>a(e.target.value),children:[(0,G.jsx)(`option`,{value:`chat`,children:l(`config:configPage.chatProvider`)}),(0,G.jsx)(`option`,{value:`visual`,children:l(`config:configPage.visualProvider`)})]}),(0,G.jsx)(`small`,{children:l(d?`config:configPage.usedOnlyForImageGenerationVideoGenerationAndImageEditingChatModelsAreIgnored`:`config:configPage.usedForAgentChatAndMayAlsoIncludeVisualModels`)})]})]})}var Sn={openai:ie,"openai-codex":ie,anthropic:Ue,google:ae,deepseek:T,xai:te,openrouter:j,"kimi-coding":ae,"zai-coding-cn":Ue};function Cn({providers:e,selectedProviderId:t,onAdd:n,onSelect:r}){let{t:i}=p();return(0,G.jsxs)(q,{className:`hidden max-[900px]:block`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(J,{title:i(`config:configPage.modelService`)}),(0,G.jsx)(o,{variant:`ghost`,size:`icon`,title:i(`config:configPage.addProvider`),onClick:n,children:(0,G.jsx)(ke,{size:15})})]}),(0,G.jsxs)(U,{variant:`control`,className:`mt-2`,children:[i(`config:configPage.currentModelService`),(0,G.jsx)(v,{className:`!h-11 rounded-[var(--r-sm)] px-3 text-sm`,value:t,onChange:t=>{let n=e.find(e=>e.id===t.target.value);n&&r(n)},children:e.map(e=>(0,G.jsxs)(`option`,{value:e.id,children:[e.name,` ·`,` `,e.configured?i(`config:configPage.configured`):e.id===`openai-codex`?i(`config:configPage.codexCLILoginRequired`):i(`config:configPage.apiKeyRequired`)]},e.id))})]})]})}function wn({className:e,providers:t,selectedProviderId:n,toggling:r,onAdd:i,onSelect:a,onToggle:s}){let{t:c}=p();return(0,G.jsxs)(q,{className:y(`selection-list [.config-layout_>_&]:max-h-[calc(100dvh_-_280px)] [.config-layout_>_&]:overflow-y-auto max-[900px]:[.config-layout_>_&]:max-h-[300px] max-[650px]:[.config-layout_>_&]:max-h-[240px] min-h-0 overflow-auto`,e),children:[(0,G.jsxs)(`div`,{className:`provider-list-heading flex items-center justify-between gap-[8px] [margin-bottom:4px]`,children:[(0,G.jsx)(J,{title:c(`config:configPage.providerConnections`)}),(0,G.jsx)(o,{variant:`ghost`,size:`icon`,title:c(`config:configPage.addProvider`),onClick:i,children:(0,G.jsx)(ke,{size:15})})]}),t.map(e=>{let t=Sn[e.id]||be;return(0,G.jsxs)(`div`,{className:`provider-list-item grid w-full grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-[9px] border-0 [border-top:1px_solid_var(--stroke-soft)] bg-transparent p-[10px_8px] text-left hover:rounded-[var(--r-sm)] hover:bg-[var(--accent-soft)] [&.active]:rounded-[var(--r-sm)] [&.active]:bg-[var(--accent-soft)] [&.active]:relative [&.active::before]:[content:''] [&.active::before]:absolute [&.active::before]:left-0 [&.active::before]:top-[9px] [&.active::before]:bottom-[9px] [&.active::before]:w-[3px] [&.active::before]:rounded-[var(--r-pill)] [&.active::before]:bg-[var(--brand-blue)] [&_>_span:nth-child(2)]:flex [&_>_span:nth-child(2)]:flex-col [&_>_span:nth-child(2)]:gap-[3px] [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] [&.disabled-provider:not(.active)]:opacity-[.65] grid-cols-[minmax(0,1fr)_auto] gap-[5px] [padding:4px] ${n===e.id?`active`:``} ${e.enabled?``:`disabled-provider`}`,children:[(0,G.jsxs)(`button`,{className:`provider-select-main [&_>_span:nth-child(2)]:flex [&_>_span:nth-child(2)]:min-w-0 [&_>_span:nth-child(2)]:flex-col [&_>_span:nth-child(2)]:gap-[3px] [&_strong]:overflow-hidden [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap [&_small]:overflow-hidden [&_small]:text-ellipsis [&_small]:whitespace-nowrap grid min-w-0 h-[48px] grid-cols-[auto_minmax(0,1fr)] items-center gap-[9px] border-0 bg-transparent [padding:4px] text-left`,onClick:()=>a(e),children:[(0,G.jsx)(`span`,{className:`list-icon [.chat-resource-list_&]:grid [.chat-resource-list_&]:w-[28px] [.chat-resource-list_&]:h-[28px] [.chat-resource-list_&]:place-items-center [.chat-resource-list_&]:rounded-[var(--r-sm)] [.chat-resource-list_&]:bg-[var(--surface-subtle)] [.chat-resource-list_&]:text-[var(--star-strong)] [.session-workflow-summary_&]:grid [.session-workflow-summary_&]:w-[28px] [.session-workflow-summary_&]:h-[28px] [.session-workflow-summary_&]:place-items-center [.session-workflow-summary_&]:rounded-[var(--r-sm)] [.session-workflow-summary_&]:bg-[var(--surface-subtle)] [.session-workflow-summary_&]:text-[var(--star-strong)] grid w-[27px] h-[27px] place-items-center rounded-[var(--r-sm)] bg-[var(--accent-soft)] text-[var(--star-strong)] [.workflow-template-gallery_&]:grid [.workflow-template-gallery_&]:w-[32px] [.workflow-template-gallery_&]:h-[32px] [.workflow-template-gallery_&]:place-items-center [.workflow-template-gallery_&]:rounded-[var(--r-sm)] [.workflow-template-gallery_&]:bg-[var(--surface-subtle)] [.workflow-template-gallery_&]:text-[var(--star-strong)]`,children:(0,G.jsx)(t,{size:16})}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{children:e.name}),(0,G.jsxs)(`small`,{children:[e.id,` ·`,` `,c(`config:configPage.countModels`,{count:e.models.length})]})]})]}),(0,G.jsx)(`div`,{className:`flex items-center gap-[6px] [padding-right:3px]`,children:(0,G.jsx)(X,{value:e.configured&&e.enabled,disabled:!e.configured||r===e.id,onChange:t=>s(e,t)})})]},e.id)})]})}function Tn({provider:e,draft:t,onPatchDraft:n,onSelectModel:r,onOpenModelDialog:i}){let{t:a}=p(),s=t.providerType===`visual`,c=e.id===`openai-codex`,l=s?[]:e.models.filter(e=>e.kind===`chat`),u=e.models.filter(e=>e.kind!==`chat`),d=e.models.find(e=>e.id===t.model);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`model-config-heading flex items-center justify-between gap-[8px] [margin-top:13px] [border-top:1px_solid_var(--stroke-soft)] [padding-top:12px]`,children:[(0,G.jsx)(J,{title:a(`config:configPage.models`)}),!c&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(o,{variant:`outline`,className:`bg-surface-subtle`,onClick:()=>i(`discover`),children:[(0,G.jsx)(R,{size:13}),a(`config:configPage.fetchModels`)]}),(0,G.jsxs)(o,{variant:`outline`,className:`bg-surface-subtle`,onClick:()=>i(`manual`),children:[(0,G.jsx)(ke,{size:13}),a(`config:configPage.addModel`)]})]})]}),!s&&l.length>0?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(U,{variant:`control`,children:[a(`config:configPage.defaultChatModel`),(0,G.jsx)(v,{value:t.model,onChange:e=>r(e.target.value),children:l.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),!c&&(0,G.jsxs)(U,{variant:`control`,children:[a(`config:configPage.modelBaseURL`),(0,G.jsx)(`input`,{value:t.modelBaseUrl,onChange:e=>n({modelBaseUrl:e.target.value}),placeholder:a(`config:configPage.optionalOverrideTheProviderBaseURLForThisModel`)})]}),(0,G.jsxs)(`div`,{className:`tag-field [&_>_span:first-child]:mr-[3px] [&_>_span:first-child]:text-[var(--text-secondary)] [&_>_span:first-child]:text-[12px] [&_>_span:first-child]:font-[600] flex items-center flex-wrap gap-[6px] [margin-top:10px]`,children:[(0,G.jsx)(Y,{children:t.provider}),(0,G.jsx)(Y,{children:d?.reasoning?a(`config:configPage.reasoningSupported`):a(`config:configPage.standardModel`)}),(0,G.jsx)(Y,{tone:`gray`,children:d?.contextWindow?`${Math.round(d.contextWindow/1e3)}K context`:a(`config:configPage.automaticContext`)}),d?.baseUrlOverride&&(0,G.jsx)(Y,{tone:`amber`,children:a(`config:configPage.customBaseURL`)})]})]}):s?(0,G.jsxs)(H,{children:[(0,G.jsx)(ae,{size:16}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{children:a(`config:configPage.visualOnlyProvider`)}),(0,G.jsx)(`small`,{children:a(`config:configPage.usedOnlyForImageGenerationVideoGenerationAndImageEditingAndExcludedFromAgentChatModelSelection`)})]})]}):(0,G.jsxs)(H,{children:[(0,G.jsx)(V,{size:16}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{children:a(`config:configPage.noChatModelAvailable`)}),(0,G.jsx)(`small`,{children:a(`config:configPage.fetchOrAddAChatModel`)})]})]}),u.length>0&&(0,G.jsxs)(`div`,{className:`visual-model-list [&_>_span]:mr-[3px] [&_>_span]:text-[var(--text-muted)] [&_>_span]:text-[12px] [&_>_span]:font-[700] flex flex-wrap items-center gap-[7px] [margin-top:12px] [border-top:1px_solid_var(--stroke-soft)] [padding-top:12px]`,children:[(0,G.jsx)(`span`,{children:a(`config:configPage.visualModels`)}),u.map(e=>(0,G.jsxs)(Y,{tone:`blue`,children:[e.name,` ·`,` `,e.kind===`video`?a(`config:configPage.videoGeneration`):a(`config:configPage.imageGenerationAndEditing`)]},e.id))]})]})}function En({onClose:e,onCreated:t}){let{t:n}=p(),[r,i]=(0,W.useState)({name:``,id:``,providerType:`chat`,api:`openai-responses`,baseUrl:``,apiKey:``,model:``,modelName:``,modelKind:`chat`,reasoning:!0,enabled:!0}),[a,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(``),u=e=>i(t=>({...t,name:e,id:t.id||e.toLowerCase().replace(/[^a-z0-9._-]+/g,`-`).replace(/^-+|-+$/g,``)})),d=e=>i(t=>({...t,providerType:e,modelKind:e===`visual`?t.modelKind===`image`||t.modelKind===`video`?t.modelKind:`image`:t.modelKind===`chat`?t.modelKind:`chat`}));return(0,G.jsx)(`div`,{className:`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=>t.target===t.currentTarget&&e(),children:(0,G.jsxs)(`form`,{className:`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=>{e.preventDefault(),s(!0),l(``);try{t(await z(`/api/providers`,{method:`POST`,body:JSON.stringify(r)}))}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(!1)}},children:[(0,G.jsxs)(je,{children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{children:n(`config:configPage.addProviderConnection`)}),(0,G.jsx)(`p`,{children:n(`config:configPage.youCanCreateMultipleConnectionsUsingTheSameProtocolEachWithItsOwnKeyAndBaseURL`)})]}),(0,G.jsx)(o,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":n(`config:configPage.closeDialog`),onClick:e,children:(0,G.jsx)(we,{size:17})})]}),(0,G.jsxs)(`div`,{className:`form-grid grid gap-[9px]`,children:[(0,G.jsxs)(U,{variant:`control`,children:[n(`config:configPage.displayName`),(0,G.jsx)(`input`,{value:r.name,onChange:e=>u(e.target.value),placeholder:n(`config:configPage.forExampleOpenAIOfficial`)})]}),(0,G.jsxs)(U,{variant:`control`,children:[`Provider ID`,(0,G.jsx)(`input`,{value:r.id,onChange:e=>i({...r,id:e.target.value}),placeholder:`openai-official`})]})]}),(0,G.jsxs)(U,{variant:`control`,children:[n(`config:configPage.providerPurpose`),(0,G.jsxs)(v,{value:r.providerType,onChange:e=>d(e.target.value),children:[(0,G.jsx)(`option`,{value:`chat`,children:n(`config:configPage.chatProvider`)}),(0,G.jsx)(`option`,{value:`visual`,children:n(`config:configPage.visualProvider`)})]}),(0,G.jsx)(`small`,{children:r.providerType===`visual`?n(`config:configPage.usedOnlyForImageGenerationVideoGenerationAndImageEditingChatModelsAreIgnored`):n(`config:configPage.usedForAgentChatAndMayAlsoIncludeVisualModels`)})]}),(0,G.jsxs)(U,{variant:`control`,children:[n(`config:configPage.apiProtocol`),(0,G.jsx)(v,{value:r.api,onChange:e=>i({...r,api:e.target.value}),children:bn.map(([e,t])=>(0,G.jsx)(`option`,{value:e,children:t},e))})]}),(0,G.jsxs)(U,{variant:`control`,children:[`Base URL`,(0,G.jsx)(`input`,{value:r.baseUrl,onChange:e=>i({...r,baseUrl:e.target.value}),placeholder:`https://api.openai.com/v1`})]}),(0,G.jsxs)(U,{variant:`control`,children:[`API Key`,(0,G.jsx)(`input`,{type:`password`,value:r.apiKey,onChange:e=>i({...r,apiKey:e.target.value}),placeholder:n(`config:configPage.enterTheAPIKeyForThisConnection`)})]}),(0,G.jsxs)(`div`,{className:`form-grid grid gap-[9px]`,children:[(0,G.jsxs)(U,{variant:`control`,children:[n(`config:configPage.initialModelID`),(0,G.jsx)(`input`,{value:r.model,onChange:e=>i({...r,model:e.target.value}),placeholder:r.providerType===`visual`?`gpt-image-2 or grok-imagine-video`:`gpt-5.4 or gpt-image-1`})]}),(0,G.jsxs)(U,{variant:`control`,children:[n(`config:configPage.modelName`),(0,G.jsx)(`input`,{value:r.modelName,onChange:e=>i({...r,modelName:e.target.value}),placeholder:n(`config:configPage.leaveBlankToUseTheModelID`)})]})]}),(0,G.jsxs)(U,{variant:`control`,children:[n(`config:configPage.modelType`),(0,G.jsxs)(v,{value:r.modelKind,onChange:e=>i({...r,modelKind:e.target.value}),children:[r.providerType!==`visual`&&(0,G.jsx)(`option`,{value:`chat`,children:n(`config:configPage.chat`)}),(0,G.jsx)(`option`,{value:`image`,children:n(`config:configPage.imageGenerationAndEditing`)}),(0,G.jsx)(`option`,{value:`video`,children:n(`config:configPage.videoGeneration`)})]})]}),(0,G.jsxs)(`div`,{className:`modal-toggle-row [&_>_span]:flex [&_>_span]:flex-col [&_>_span]:gap-[3px] [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] dark:bg-[var(--surface-subtle)] flex min-h-[45px] items-center justify-between gap-[12px] [margin-top:10px] [border:1px_solid_var(--stroke-soft)] rounded-[var(--r-sm)] bg-[var(--surface-subtle)] [padding:8px_10px]`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{children:n(`config:configPage.enableAfterCreation`)}),(0,G.jsx)(`small`,{children:n(`config:configPage.visualModelsAreSelectedByTheVisualGenerationToolAndDoNotAppearInTheChatModelList`)})]}),(0,G.jsx)(X,{value:r.enabled,onChange:e=>i({...r,enabled:e})})]}),c&&(0,G.jsxs)(Ee,{children:[(0,G.jsx)(V,{size:13}),c]}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-[8px] [margin-top:18px]`,children:[(0,G.jsx)(o,{type:`button`,variant:`outline`,size:`lg`,className:`bg-surface-subtle`,onClick:e,children:n(`config:configPage.cancel`)}),(0,G.jsxs)(o,{size:`lg`,disabled:a,children:[a?(0,G.jsx)(R,{className:`animate-spin`,size:14}):(0,G.jsx)(ke,{size:14}),n(a?`config:configPage.creating`:`config:configPage.createConnection`)]})]})]})})}function Dn({provider:e,connectionDraft:t,autoDiscover:n,onClose:r,onSynchronized:i,onCreated:a}){let{t:s}=p(),[c,l]=(0,W.useState)({id:``,name:``,api:e.api||`openai-responses`,baseUrl:``,kind:e.type===`visual`?`image`:`chat`,reasoning:!0}),[u,d]=(0,W.useState)(e.type===`visual`?`image`:`chat`),[f,m]=(0,W.useState)(t.api||e.api||`openai-responses`),[h,_]=(0,W.useState)(!1),[y,b]=(0,W.useState)(!1),[x,S]=(0,W.useState)([]),[C,w]=(0,W.useState)([]),[T,E]=(0,W.useState)(``),[D,O]=(0,W.useState)(``),k=(0,W.useRef)(i);(0,W.useEffect)(()=>{k.current=i},[i]);let A=t.api,j=t.providerType,M=t.baseUrl,N=t.apiKey,P=t.organization,F=(0,W.useCallback)(async()=>{b(!0),O(``);try{let t=await z(`/api/providers/${encodeURIComponent(e.id)}/models/discover`,{method:`POST`,body:JSON.stringify({providerType:j,api:A,baseUrl:M,apiKey:N,organization:P})});S(t.models||[]),w([]),t.config&&k.current(t.config)}catch(e){O(e instanceof Error?e.message:String(e))}finally{b(!1)}},[A,N,M,P,j,e.id]);(0,W.useEffect)(()=>{n&&F()},[n,F]);let I=e=>{e.added||w(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},ee=async t=>{t.preventDefault(),_(!0),O(``);try{if(C.length){let t=x.filter(e=>C.includes(e.id)).map(e=>({id:e.id,name:e.name,kind:u,api:f,reasoning:u===`chat`}));a(await z(`/api/providers/${encodeURIComponent(e.id)}/models/batch`,{method:`POST`,body:JSON.stringify({models:t})}),C[0])}else a(await z(`/api/providers/${encodeURIComponent(e.id)}/models`,{method:`POST`,body:JSON.stringify(c)}),c.id)}catch(e){O(e instanceof Error?e.message:String(e))}finally{_(!1)}},te=T.trim().toLowerCase(),ne=x.filter(e=>!te||e.id.toLowerCase().includes(te)||e.name.toLowerCase().includes(te)),re=C.length>0||c.id.trim();return(0,G.jsx)(`div`,{className:`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:e=>e.target===e.currentTarget&&r(),children:(0,G.jsxs)(`form`,{className:`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)]`,onSubmit:ee,children:[(0,G.jsxs)(je,{children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{children:s(`config:configPage.addModel`)}),(0,G.jsx)(`p`,{children:s(`config:configPage.fetchModelIDsFromProviderOrAddOneManually`,{provider:e.name})})]}),(0,G.jsx)(o,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":s(`config:configPage.closeDialog`),onClick:r,children:(0,G.jsx)(we,{size:17})})]}),(0,G.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,G.jsxs)(U,{variant:`control`,className:`min-w-0 flex-1`,children:[s(`config:configPage.remoteModelCatalog`),(0,G.jsx)(`input`,{value:T,onChange:e=>E(e.target.value),placeholder:s(`config:configPage.searchModelIDOrName`),disabled:!x.length})]}),(0,G.jsxs)(o,{type:`button`,variant:`outline`,size:`lg`,className:`bg-surface-subtle h-9 shrink-0`,disabled:y,onClick:F,children:[y?(0,G.jsx)(R,{className:`animate-spin`,size:14}):(0,G.jsx)(R,{size:14}),y?s(`config:configPage.fetching`):x.length?s(`config:configPage.fetchAgain`):s(`config:configPage.fetchFromAPI`)]})]}),x.length>0&&(0,G.jsxs)(`div`,{className:`form-grid grid gap-[9px]`,children:[(0,G.jsxs)(U,{variant:`control`,children:[s(`config:configPage.modelType`),(0,G.jsxs)(v,{value:u,onChange:e=>d(e.target.value),children:[e.type!==`visual`&&(0,G.jsx)(`option`,{value:`chat`,children:s(`config:configPage.chat`)}),(0,G.jsx)(`option`,{value:`image`,children:s(`config:configPage.imageGenerationAndEditing`)}),(0,G.jsx)(`option`,{value:`video`,children:s(`config:configPage.videoGeneration`)})]})]}),(0,G.jsxs)(U,{variant:`control`,children:[s(`config:configPage.apiProtocol`),(0,G.jsx)(v,{value:f,onChange:e=>m(e.target.value),children:bn.map(([e,t])=>(0,G.jsx)(`option`,{value:e,children:t},e))})]})]}),x.length>0&&(0,G.jsxs)(`div`,{className:`max-h-64 space-y-1 overflow-y-auto rounded-[var(--r-sm)] border border-[var(--stroke)] bg-[var(--surface-subtle)] p-1`,role:`listbox`,"aria-multiselectable":`true`,children:[ne.map(e=>{let t=C.includes(e.id);return(0,G.jsxs)(`button`,{type:`button`,className:`flex min-h-10 w-full items-center gap-2 rounded-[var(--r-xs)] border px-2.5 py-1.5 text-left text-[13px] ${t?`border-[var(--control-selected-border)] bg-[var(--control-selected-bg)] text-[var(--control-selected-text)]`:`border-transparent bg-transparent text-[var(--text)] hover:bg-[var(--surface-hover)]`} ${e.added?`cursor-default opacity-55`:``}`,role:`option`,"aria-selected":t,disabled:e.added,onClick:()=>I(e),children:[(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`strong`,{className:`block truncate`,children:e.id}),e.name!==e.id&&(0,G.jsx)(`small`,{className:`block truncate text-[12px] ${t?`text-inherit opacity-75`:`text-[var(--text-muted)]`}`,children:e.name})]}),e.added?(0,G.jsx)(Y,{tone:`gray`,children:s(`config:configPage.added`)}):t?(0,G.jsx)(g,{size:15}):null]},e.id)}),!ne.length&&(0,G.jsx)(`div`,{className:`px-3 py-6 text-center text-[13px] text-[var(--text-muted)]`,children:s(`config:configPage.noMatchingModels`)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 text-[12px] text-[var(--text-muted)]`,children:[(0,G.jsx)(`span`,{className:`h-px flex-1 bg-[var(--stroke)]`}),(0,G.jsx)(`span`,{children:s(`config:configPage.addManually`)}),(0,G.jsx)(`span`,{className:`h-px flex-1 bg-[var(--stroke)]`})]}),(0,G.jsxs)(`div`,{className:`form-grid grid gap-[9px]`,children:[(0,G.jsxs)(U,{variant:`control`,children:[s(`config:configPage.modelID`),(0,G.jsx)(`input`,{value:c.id,onChange:e=>l({...c,id:e.target.value}),placeholder:`gpt-5.4-mini, gpt-image-1, or sora-2`})]}),(0,G.jsxs)(U,{variant:`control`,children:[s(`config:configPage.displayName`),(0,G.jsx)(`input`,{value:c.name,onChange:e=>l({...c,name:e.target.value}),placeholder:s(`config:configPage.leaveBlankToUseTheModelID`)})]})]}),(0,G.jsxs)(U,{variant:`control`,children:[s(`config:configPage.modelBaseURL`),(0,G.jsx)(`input`,{value:c.baseUrl,onChange:e=>l({...c,baseUrl:e.target.value}),placeholder:s(`config:configPage.optionalLeaveBlankToInheritTheProviderBaseURL`)})]}),(0,G.jsxs)(U,{variant:`control`,children:[s(`config:configPage.apiProtocol`),(0,G.jsx)(v,{value:c.api,onChange:e=>l({...c,api:e.target.value}),children:bn.map(([e,t])=>(0,G.jsx)(`option`,{value:e,children:t},e))})]}),(0,G.jsxs)(U,{variant:`control`,children:[s(`config:configPage.modelType`),(0,G.jsxs)(v,{value:c.kind,onChange:e=>l({...c,kind:e.target.value}),children:[e.type!==`visual`&&(0,G.jsx)(`option`,{value:`chat`,children:s(`config:configPage.chat`)}),(0,G.jsx)(`option`,{value:`image`,children:s(`config:configPage.imageGenerationAndEditing`)}),(0,G.jsx)(`option`,{value:`video`,children:s(`config:configPage.videoGeneration`)})]})]}),c.kind!==`image`&&c.kind!==`video`&&(0,G.jsxs)(`div`,{className:`modal-toggle-row [&_>_span]:flex [&_>_span]:flex-col [&_>_span]:gap-[3px] [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] dark:bg-[var(--surface-subtle)] flex min-h-[45px] items-center justify-between gap-[12px] [margin-top:10px] [border:1px_solid_var(--stroke-soft)] rounded-[var(--r-sm)] bg-[var(--surface-subtle)] [padding:8px_10px]`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{children:s(`config:configPage.reasoningModel`)}),(0,G.jsx)(`small`,{children:s(`config:configPage.enableReasoningEffortThinkingLevel`)})]}),(0,G.jsx)(X,{value:c.reasoning,onChange:e=>l({...c,reasoning:e})})]}),D&&(0,G.jsxs)(Ee,{children:[(0,G.jsx)(V,{size:13}),D]}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-[8px] [margin-top:18px]`,children:[(0,G.jsx)(o,{type:`button`,variant:`outline`,size:`lg`,className:`bg-surface-subtle`,onClick:r,children:s(`config:configPage.cancel`)}),(0,G.jsxs)(o,{size:`lg`,disabled:h||!re,children:[h?(0,G.jsx)(R,{className:`animate-spin`,size:14}):(0,G.jsx)(ke,{size:14}),h?s(`config:configPage.adding`):C.length?s(`config:configPage.addCountModels`,{count:C.length}):s(`config:configPage.addModel`)]})]})]})})}function On(e){return(e.providers||[]).some(e=>e.importable&&!e.imported&&!e.conflict)}function kn(e,t){return!t&&!On(e)}function An(e,t,n){let r=e.providers||[],i=e.errors||[],a=On(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 jn(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 Mn(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 Nn(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 Pn({discovery:e,discovering:t,error:n,importing:r,onRefresh:i,onImport:a}){let{t:s}=p(),[c,l]=(0,W.useState)(null),u=e.providers||[],d=e.errors||[];if(!An(e,t,n))return null;let f=c??kn(e,t),m=()=>(l(null),i()),h=e=>(l(null),a(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,G.jsxs)(q,{className:`[margin-bottom:12px] [padding:12px_14px]`,children:[(0,G.jsxs)(`div`,{className:`provider-discovery-head [&_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,G.jsxs)(`button`,{type:`button`,className:`provider-discovery-toggle [&_>_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":!f,onClick:()=>l(!f),children:[(0,G.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,G.jsx)(be,{size:18})}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{children:s(`config:configPage.localProviderConfiguration`)}),(0,G.jsx)(`small`,{children:s(`config:configPage.readProviderEndpointModelAndAuthenticationFieldsFromCodexConfigTomlAndClaudeSettingsJson`)})]}),(0,G.jsx)(w,{size:15,className:`provider-discovery-caret [&.open]:[transform:rotate(180deg)] flex-none text-[var(--text-muted)] [transition:transform_var(--d1)_var(--ease-out)] ${f?``:`open`}`})]}),(0,G.jsxs)(o,{type:`button`,variant:`outline`,className:`bg-surface-subtle`,disabled:t||!!r,onClick:m,children:[t?(0,G.jsx)(R,{className:`animate-spin`,size:13}):(0,G.jsx)(R,{size:13}),s(`config:configPage.rescan`)]})]}),!f&&(0,G.jsxs)(G.Fragment,{children:[t&&!u.length?(0,G.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,G.jsx)(R,{className:`animate-spin`,size:15}),s(`config:configPage.scanningProviderConfigurationFiles`)]}):u.length?(0,G.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:u.map(e=>{let t=jn(e),n=r===e.id,i=e.source.startsWith(`claude-`)?Ue:ie,a=e.kind===`authentication`?s(`config:configPage.officialProviderAuthenticationOnly`):e.models?.length?e.models.map(e=>e.id).join(`, `):s(`config:configPage.noModelSpecified`);return(0,G.jsxs)(`div`,{className:`provider-discovery-card grid min-w-0 min-h-[68px] grid-cols-[auto_minmax(0,1fr)_auto] 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,G.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,G.jsx)(i,{size:17})}),(0,G.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,G.jsxs)(`strong`,{children:[t,` · `,e.providerName]}),(0,G.jsxs)(`small`,{children:[e.api,` · `,a]}),(0,G.jsxs)(`small`,{children:[e.kind===`authentication`?s(`config:configPage.officialEndpointOnly`):e.baseUrl||s(`config:configPage.noBaseURLSpecified`),` `,`· `,Mn(e,s),` · `,e.location]})]}),(0,G.jsx)(`span`,{className:`flex flex-none items-center`,children:e.imported?(0,G.jsx)(Y,{tone:`green`,children:s(`config:configPage.loaded`)}):e.conflict?(0,G.jsx)(Y,{tone:`amber`,children:s(`config:configPage.conflictDetected`)}):e.importable?(0,G.jsxs)(o,{type:`button`,disabled:n||!!r,onClick:()=>h(e),children:[n?(0,G.jsx)(R,{className:`animate-spin`,size:12}):(0,G.jsx)(fe,{size:12}),n?s(`config:configPage.loading`):e.kind===`authentication`?s(`config:configPage.loadLoginState`):s(`config:configPage.loadConfiguration`)]}):(0,G.jsx)(Y,{tone:`gray`,children:s(`config:configPage.cannotLoad`)})})]},e.id)})}):(0,G.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,G.jsx)(be,{size:15}),s(`config:configPage.noImportableCodexOrClaudeProviderConfigurationWasDetected`)]}),(n||d.length>0||u.some(e=>e.warnings?.some(e=>e.code!==`login_auth_not_imported`)))&&(0,G.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,G.jsxs)(`span`,{children:[(0,G.jsx)(V,{size:13}),n]}),d.map((e,t)=>(0,G.jsxs)(`span`,{children:[(0,G.jsx)(V,{size:13}),jn(e),` · `,g(e)]},`${e.source}-${e.code}-${t}`)),u.flatMap(e=>(e.warnings||[]).filter(e=>e.code!==`login_auth_not_imported`).map((t,n)=>(0,G.jsxs)(`span`,{children:[(0,G.jsx)(V,{size:13}),jn(e),` · `,Nn(t.code,s)]},`${e.id}-${t.code}-${n}`)))]})]})]})}function Fn({draft:e,onPatchDraft:t}){let{t:n}=p();return(0,G.jsxs)(U,{variant:`control`,children:[n(`config:configPage.thinkingLevel`),(0,G.jsx)(v,{value:e.thinkingLevel,onChange:e=>t({thinkingLevel:e.target.value}),children:[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`].map(e=>(0,G.jsx)(`option`,{children:e},e))})]})}function In({draft:e,onPatchDraft:t}){let{t:n}=p();return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(U,{variant:`control`,children:[n(`config:configPage.availableTools`),(0,G.jsxs)(v,{value:e.toolMode,onChange:e=>t({toolMode:e.target.value}),children:[(0,G.jsx)(`option`,{value:`read-only`,children:n(`config:configPage.readOnlyInspectionTools`)}),(0,G.jsx)(`option`,{value:`workspace`,children:n(`config:configPage.fileEditingTools`)}),(0,G.jsx)(`option`,{value:`full`,children:n(`config:configPage.fullToolAccess`)}),(0,G.jsx)(`option`,{value:`custom`,children:n(`config:configPage.customManageEachToolOnThePluginsPage`)})]})]}),(0,G.jsxs)(H,{children:[(0,G.jsx)(P,{size:16}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{children:n(`config:configPage.permissionsAreEnforcedByTheRuntime`)}),(0,G.jsx)(`small`,{children:n(`config:configPage.afterSavingExistingRuntimesAreReleasedAndNewChatsUseTheLatestPolicy`)})]})]})]})}function Ln(e){let{t}=p();return(0,G.jsxs)(q,{children:[(0,G.jsx)(J,{title:t(`config:configPage.agentRuntimePolicy`)}),(0,G.jsx)(Fn,{...e}),(0,G.jsx)(In,{...e})]})}function Rn({provider:e,visualOnly:t,codexOAuth:n,saving:r,dirty:i,error:a,hasModel:s,isDefault:c,onSave:l}){let{t:u}=p();return(0,G.jsxs)(`div`,{className:`provider-save-bar [&[data-dirty]]:border-[var(--star-border)] max-[650px]:grid-cols-[minmax(0,1fr)] sticky z-[6] top-0 grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-[10px] [border:1px_solid_var(--stroke)] rounded-[var(--r-sm)] bg-[var(--panel)] [padding:9px_10px] shadow-[var(--sh-surface)]`,"data-dirty":i||void 0,children:[(0,G.jsxs)(`div`,{className:`provider-save-state [.provider-save-bar[data-dirty]_&]:text-[var(--star-strong)] [&_>_span]:flex [&_>_span]:min-w-0 [&_>_span]:flex-col [&_>_span]:gap-[2px] [&_strong]:text-[var(--text)] [&_strong]:text-[12px] [&_small]:overflow-hidden [&_small]:text-[var(--text-muted)] [&_small]:text-[11px] [&_small]:text-ellipsis [&_small]:whitespace-nowrap flex min-w-0 items-center gap-[8px] text-[var(--success)]`,children:[i?(0,G.jsx)(Rt,{size:17}):(0,G.jsx)(pe,{size:17}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{children:u(i?`config:configPage.unsavedChanges`:`config:configPage.allChangesSaved`)}),(0,G.jsx)(`small`,{children:e.name})]})]}),(0,G.jsxs)(`div`,{className:`provider-save-actions max-[650px]:[justify-content:stretch] flex min-w-0 items-center justify-end flex-wrap gap-[7px]`,children:[!t&&s&&(0,G.jsxs)(o,{variant:`outline`,size:`lg`,className:`bg-surface-subtle`,disabled:r||!i||c||n&&!e.configured,onClick:()=>l(!0),children:[(0,G.jsx)(P,{size:14}),u(c?`config:configPage.currentDefaultProvider`:`config:configPage.setAsDefaultProvider`)]}),(0,G.jsxs)(o,{size:`lg`,disabled:r||!i||n&&!e.configured,onClick:()=>l(!1),children:[r?(0,G.jsx)(R,{className:`animate-spin`,size:14}):(0,G.jsx)(M,{size:14}),r?u(`config:configPage.saving`):n&&!e.configured?u(`config:configPage.loadAuthenticationToSave`):u(t?`config:configPage.saveVisualModelSettings`:`config:configPage.saveProviderSettings`)]})]}),a&&(0,G.jsxs)(Ee,{children:[(0,G.jsx)(V,{size:13}),a]})]})}function zn({provider:e}){let{t}=p();return(0,G.jsxs)(q,{className:`usage-card [&_>_small]:block [&_>_small]:m-[4px_0_12px] [&_>_small]:text-[var(--text-muted)] [&_>_small]:text-[13px]`,children:[(0,G.jsx)(J,{title:t(`config:configPage.runtimeStatus`)}),(0,G.jsxs)(`div`,{className:`usage-number [&_span]:text-[var(--text-muted)] [&_span]:text-[12px] [&_strong]:font-[ui-monospace,_SFMono-Regular,_Consolas,_'Liberation_Mono',_monospace] [&_strong]:text-[15px] flex [align-items:baseline] justify-between [margin-top:10px]`,children:[(0,G.jsx)(`span`,{children:`Engine`}),(0,G.jsxs)(`strong`,{children:[Ge,` Runtime`]})]}),(0,G.jsxs)(`div`,{className:`usage-number [&_span]:text-[var(--text-muted)] [&_span]:text-[12px] [&_strong]:font-[ui-monospace,_SFMono-Regular,_Consolas,_'Liberation_Mono',_monospace] [&_strong]:text-[15px] flex [align-items:baseline] justify-between [margin-top:10px]`,children:[(0,G.jsx)(`span`,{children:`Provider`}),(0,G.jsx)(`strong`,{children:e.name})]}),(0,G.jsxs)(`div`,{className:`usage-number [&_span]:text-[var(--text-muted)] [&_span]:text-[12px] [&_strong]:font-[ui-monospace,_SFMono-Regular,_Consolas,_'Liberation_Mono',_monospace] [&_strong]:text-[15px] flex [align-items:baseline] justify-between [margin-top:10px]`,children:[(0,G.jsx)(`span`,{children:`Models`}),(0,G.jsx)(`strong`,{children:e.models.length})]}),(0,G.jsxs)(`div`,{className:`usage-number [&_span]:text-[var(--text-muted)] [&_span]:text-[12px] [&_strong]:font-[ui-monospace,_SFMono-Regular,_Consolas,_'Liberation_Mono',_monospace] [&_strong]:text-[15px] flex [align-items:baseline] justify-between [margin-top:10px]`,children:[(0,G.jsx)(`span`,{children:t(`config:configPage.status`)}),(0,G.jsx)(`strong`,{children:e.enabled?t(`config:configPage.enabled`):t(`config:configPage.disabled`)})]})]})}var Bn={config:null,draft:null,loading:!0,saving:!1,toggling:``,error:``,dirty:!1};function Vn(e,t,n){let r=t?.models.filter(e=>e.kind===`chat`)||[],i=r.find(e=>e.id===n)||r.find(e=>e.id===t?.defaultModel)||r[0];return{provider:t?.id||`openai`,providerType:t?.type||`chat`,api:t?.api||`openai-responses`,model:i?.id||``,apiKey:``,baseUrl:t?.baseUrl||``,modelBaseUrl:i?.baseUrlOverride||``,organization:t?.organization||``,thinkingLevel:e.thinkingLevel||`medium`,toolMode:e.toolMode||`full`}}function Hn(e,t){if(!t)return Vn(e,e.providers.find(t=>t.id===e.provider)||e.providers[0],e.model);let n=e.providers.find(e=>e.id===t.provider)||e.providers.find(t=>t.id===e.provider)||e.providers[0],r=n?.models.filter(e=>e.kind===`chat`)||[],i=r.find(e=>e.id===t.model)||r[0];return{...t,provider:n?.id||t.provider,providerType:t.providerType||n?.type||`chat`,api:n&&n.id!==t.provider?n.api||`openai-responses`:t.api||n?.api||`openai-responses`,model:i?.id||``,modelBaseUrl:i?.baseUrlOverride||``}}function Un(e,t,n,r){return{...Vn(e,t,r),thinkingLevel:n?.thinkingLevel||e.thinkingLevel||`medium`,toolMode:n?.toolMode||e.toolMode||`full`}}function Wn(e,t){switch(t.type){case`load-succeeded`:{let n=t.config.providers.find(e=>e.id===t.config.provider)||t.config.providers[0];return{...e,config:t.config,draft:Vn(t.config,n,t.config.model),loading:!1,error:``,dirty:!1}}case`refresh-succeeded`:return{...e,config:t.config,draft:Hn(t.config,e.draft)};case`replace`:return{...e,config:t.config,draft:t.draft,loading:!1,error:``,dirty:t.dirty};case`patch-draft`:return e.draft?{...e,draft:{...e.draft,...t.patch},dirty:!0}:e;case`config-updated`:return{...e,config:t.config};case`set-loading`:return{...e,loading:t.value};case`set-saving`:return{...e,saving:t.value};case`set-toggling`:return{...e,toggling:t.value};case`set-error`:return{...e,error:t.value};case`save-succeeded`:{if(!e.draft)return{...e,config:t.config,dirty:!1};let n=t.config.providers.find(t=>t.id===e.draft?.provider)||t.config.providers[0];return{...e,config:t.config,draft:{...Vn(t.config,n,e.draft.model),thinkingLevel:e.draft.thinkingLevel,toolMode:e.draft.toolMode},error:``,dirty:!1}}}}function Gn(e){return e instanceof Error?e.message:String(e)}function Kn({notify:e,requestConfirm:t,t:n}){let[r,i]=(0,W.useReducer)(Wn,Bn),a=(0,W.useRef)(null);(0,W.useEffect)(()=>{let e=!0;return z(`/api/config`).then(t=>{if(e)return i({type:`load-succeeded`,config:t}),z(`/api/providers/models/refresh`,{method:`POST`,body:`{}`})}).then(t=>{!e||!t?.config||i({type:`refresh-succeeded`,config:t.config})}).catch(t=>{e&&(i({type:`set-error`,value:Gn(t)}),i({type:`set-loading`,value:!1}))}),()=>{e=!1}},[]);let o=(0,W.useMemo)(()=>r.config&&r.draft?r.config.providers.find(e=>e.id===r.draft?.provider)||r.config.providers[0]:null,[r.config,r.draft]),s=(0,W.useCallback)(e=>{i({type:`patch-draft`,patch:e})},[]),c=(0,W.useCallback)(e=>{r.config&&i({type:`replace`,config:r.config,draft:Un(r.config,e,r.draft),dirty:!1})},[r.config,r.draft]),l=(0,W.useCallback)(e=>{if(!o)return;let t=o.models.find(t=>t.id===e);s({model:e,modelBaseUrl:t?.baseUrlOverride||``})},[s,o]),u=(0,W.useCallback)(e=>{if(!r.draft||!o)return;let t=o.models.find(e=>e.kind===`chat`);s({providerType:e,model:e===`visual`?``:r.draft.model||t?.id||``,modelBaseUrl:e===`visual`?``:r.draft.modelBaseUrl||t?.baseUrlOverride||``})},[s,o,r.draft]),d=(0,W.useCallback)(async(t,r)=>{i({type:`set-toggling`,value:t.id}),i({type:`set-error`,value:``});try{let a=await z(`/api/providers/${encodeURIComponent(t.id)}/enabled`,{method:`PUT`,body:JSON.stringify({enabled:r})});i({type:`config-updated`,config:a}),e(n(`config:configPage.nameState`,{name:t.name,state:n(r?`config:configPage.enabled`:`config:configPage.disabled`)}))}catch(e){i({type:`set-error`,value:Gn(e)})}finally{i({type:`set-toggling`,value:``})}},[e,n]),f=(0,W.useCallback)(async r=>{if(await t({title:n(`config:configPage.deleteProviderConnection`),message:n(`config:configPage.deleteNameItsModelSettingsAndAuthenticationDetailsWillAlsoBeRemoved`,{name:r.name}),confirmLabel:n(`config:configPage.delete`)})){i({type:`set-error`,value:``});try{let t=await z(`/api/providers/${encodeURIComponent(r.id)}`,{method:`DELETE`}),a=t.providers.find(e=>e.id===t.provider)||t.providers[0];i({type:`replace`,config:t,draft:Vn(t,a,t.model),dirty:!1}),e(n(`config:configPage.providerConnectionDeleted`))}catch(e){i({type:`set-error`,value:Gn(e)})}}},[e,t,n]),p=(0,W.useCallback)(async(t=!1)=>{let o=r.draft;if(!o||!r.dirty)return;let s=r.config?.providers.find(e=>e.id===o.provider),c=a.current?.value||o.apiKey;if(!o.baseUrl.trim()){i({type:`set-error`,value:n(`config:configPage.enterProviderBaseURLBeforeSaving`)});return}if(o.providerType!==`visual`&&!o.model.trim()){i({type:`set-error`,value:n(`config:configPage.selectAChatModelBeforeSaving`)});return}if(!s?.configured&&!c.trim()){i({type:`set-error`,value:n(`config:configPage.completeProviderAuthenticationBeforeSaving`)});return}i({type:`set-saving`,value:!0}),i({type:`set-error`,value:``});try{let r=await z(`/api/config`,{method:`PUT`,body:JSON.stringify({...o,apiKey:c,setAsDefault:t,enabled:!0})});if(c.trim()&&!r.apiKeyUpdated)throw Error(n(`config:configPage.apiKeyCouldNotBeUpdatedPleaseRetry`));let a=r.providers.find(e=>e.id===o.provider);if(!a?.configured||!a.enabled)throw Error(n(`config:configPage.providerWasNotReadyAfterSaving`));i({type:`save-succeeded`,config:r}),e(a.type===`visual`?n(`config:configPage.visualModelSettingsSaved`):t&&o.model?n(`config:configPage.agentSettingsSavedNewChatsWillUseThisModel`):n(`config:configPage.providerSettingsSaved`))}catch(e){i({type:`set-error`,value:Gn(e)})}finally{i({type:`set-saving`,value:!1})}},[e,r.config,r.dirty,r.draft,n]),m=(0,W.useCallback)(t=>{let a=t.config.providers.find(e=>e.id===t.providerId)||t.config.providers[0];if(t.kind===`authentication`){i({type:`refresh-succeeded`,config:t.config}),e(n(`config:configPage.nameLoginStateHasBeenLoadedIntoPisper`,{name:a.name}));return}i({type:`replace`,config:t.config,draft:Un(t.config,a,r.draft,t.selectedModel),dirty:!0}),e(n(`config:configPage.nameConfigurationHasBeenLoadedIntoPisper`,{name:a.name}))},[e,r.draft,n]),h=(0,W.useCallback)(t=>{let r=t.providers.find(e=>e.id===t.createdProviderId);i({type:`replace`,config:t,draft:Vn(t,r),dirty:!0}),e(n(`config:configPage.providerConnectionCreated`))},[e,n]),g=(0,W.useCallback)(e=>{i({type:`refresh-succeeded`,config:e})},[]),_=(0,W.useCallback)((t,a,o)=>{let s=t.providers.find(e=>e.id===a),c={...Vn(t,s,o),providerType:r.draft?.providerType||s?.type||`chat`,thinkingLevel:r.draft?.thinkingLevel||t.thinkingLevel,toolMode:r.draft?.toolMode||t.toolMode};i({type:`replace`,config:t,draft:c,dirty:!0}),e(n(`config:configPage.countModelsAdded`,{count:t.addedModelIds?.length||1}))},[e,r.draft,n]);return{...r,selectedProvider:o,apiKeyInputRef:a,patchDraft:s,selectProvider:c,selectModel:l,selectProviderType:u,toggleProvider:d,deleteProvider:f,save:p,applyImportedProvider:m,applyCreatedProvider:h,applySynchronizedModels:g,applyCreatedModels:_}}function qn({requestConfirm:e,onImported:t,t:n}){let[r,i]=(0,W.useState)({providers:[],errors:[]}),[a,o]=(0,W.useState)(!0),[s,c]=(0,W.useState)(``),[l,u]=(0,W.useState)(``),[d,f]=(0,W.useState)(``),p=(0,W.useCallback)(async()=>{o(!0),c(``);try{i(await z(`/api/providers/discovery`))}catch(e){c(Gn(e))}finally{o(!1)}},[]);return(0,W.useEffect)(()=>{p()},[p]),{discovery:r,discovering:a,error:s,operationError:l,importing:d,refresh:p,importProvider:(0,W.useCallback)(async r=>{let a=r.source===`codex-config`?`Codex config.toml`:r.source===`claude-config`?`Claude settings.json`:r.source===`codex-auth`?`Codex login`:`Claude login`,o=r.kind===`authentication`;if(await e({title:n(o?`config:configPage.loadLoginState`:`config:configPage.loadProviderConfiguration`),message:n(o?`config:configPage.loadOfficialProviderLoginStateFromSource`:`config:configPage.loadThisProviderConfigurationFromSource`,{source:a}),confirmLabel:n(o?`config:configPage.loadLoginState`:`config:configPage.loadConfiguration`)})){f(r.id),u(``);try{let e=await z(`/api/providers/${encodeURIComponent(r.id)}/import`,{method:`POST`,body:`{}`});i(e.discovery),t(e)}catch(e){u(Gn(e))}finally{f(``)}}},[t,e,n])}}function Jn({notify:e,registerPrimaryAction:t,requestConfirm:n}){let{t:r}=p(),[i,a]=(0,W.useState)(!1),[o,s]=(0,W.useState)(``),c=(0,W.useRef)(null),l=Kn({notify:e,requestConfirm:n,t:r}),u=qn({requestConfirm:n,onImported:l.applyImportedProvider,t:r});if(We(t,()=>a(!0)),!l.config||!l.draft||!l.selectedProvider)return(0,G.jsxs)(Pe,{children:[(0,G.jsx)(R,{className:`animate-spin`,size:24}),(0,G.jsx)(`h2`,{children:r(`config:configPage.loadingModelCatalog`)}),(0,G.jsx)(`p`,{children:r(`config:configPage.readingProvidersAndAuthenticationStatus`)}),l.error&&(0,G.jsx)(Ee,{children:l.error})]});let{config:d,draft:f,selectedProvider:m}=l,h=f.providerType===`visual`,g=m.id===`openai-codex`,_=e=>{l.selectProvider(e),window.matchMedia(`(max-width: 900px)`).matches&&window.setTimeout(()=>{!e.configured&&e.id!==`openai-codex`?(l.apiKeyInputRef.current?.scrollIntoView({behavior:`smooth`,block:`center`}),l.apiKeyInputRef.current?.focus({preventScroll:!0})):c.current?.scrollIntoView({behavior:`smooth`,block:`start`})},350)};return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Pn,{discovery:u.discovery,discovering:u.discovering,error:u.error||u.operationError,importing:u.importing,onRefresh:u.refresh,onImport:u.importProvider}),(0,G.jsxs)(`div`,{className:`split-list-detail config-layout grid min-h-full grid-cols-[300px_minmax(0,1fr)] items-start gap-3 max-[900px]:grid-cols-1`,children:[(0,G.jsx)(wn,{className:`max-[900px]:hidden`,providers:d.providers,selectedProviderId:f.provider,toggling:l.toggling,onAdd:()=>a(!0),onSelect:_,onToggle:l.toggleProvider}),(0,G.jsx)(Cn,{providers:d.providers,selectedProviderId:f.provider,onAdd:()=>a(!0),onSelect:_}),(0,G.jsxs)(`div`,{className:`detail-stack flex min-w-0 scroll-mt-2 flex-col gap-[12px] [.mcp-layout_>_&]:min-h-0 max-[1150px]:[.memory-layout_>_&]:[grid-column:1/-1] max-[1150px]:[.memory-layout_>_&]:grid max-[1150px]:[.memory-layout_>_&]:grid-cols-[repeat(2,minmax(0,1fr))] max-[1150px]:[.mcp-layout_>_&]:[grid-column:1/-1] max-[1150px]:[.mcp-layout_>_&]:grid max-[1150px]:[.mcp-layout_>_&]:grid-cols-[repeat(2,minmax(0,1fr))] max-[1150px]:[.skills-layout_>_&]:[grid-column:1/-1] max-[1150px]:[.skills-layout_>_&]:grid max-[1150px]:[.skills-layout_>_&]:grid-cols-[repeat(2,minmax(0,1fr))] max-[650px]:[.memory-layout_>_&]:[grid-column:auto] max-[650px]:[.memory-layout_>_&]:grid-cols-[1fr] max-[650px]:[.mcp-layout_>_&]:[grid-column:auto] max-[650px]:[.mcp-layout_>_&]:grid-cols-[1fr] max-[650px]:[.skills-layout_>_&]:[grid-column:auto] max-[650px]:[.skills-layout_>_&]:grid-cols-[1fr]`,ref:c,children:[(0,G.jsx)(`div`,{className:`order-1 min-[901px]:order-2`,children:(0,G.jsx)(xn,{provider:m,draft:f,toggling:l.toggling,apiKeyInputRef:l.apiKeyInputRef,onPatchDraft:l.patchDraft,onSelectProviderType:l.selectProviderType,onToggleProvider:l.toggleProvider,onDeleteProvider:l.deleteProvider})}),(0,G.jsx)(`div`,{className:`order-2 min-[901px]:order-1`,children:(0,G.jsx)(Rn,{provider:m,visualOnly:h,codexOAuth:g,saving:l.saving,dirty:l.dirty,error:l.error,hasModel:!!f.model,isDefault:(d.defaultProvider||d.provider)===m.id&&(d.defaultModel||d.model)===f.model,onSave:l.save})}),(0,G.jsx)(q,{className:`order-3`,children:(0,G.jsx)(Tn,{provider:m,draft:f,onPatchDraft:l.patchDraft,onSelectModel:l.selectModel,onOpenModelDialog:s})}),(0,G.jsxs)(`div`,{className:`config-bottom order-4 max-[900px]:grid-cols-[1fr] grid grid-cols-[minmax(0,1.5fr)_minmax(210px,.7fr)] gap-[12px]`,children:[(0,G.jsx)(Ln,{draft:f,onPatchDraft:l.patchDraft}),(0,G.jsx)(zn,{provider:m})]})]})]}),i&&(0,G.jsx)(En,{onClose:()=>a(!1),onCreated:e=>{l.applyCreatedProvider(e),a(!1)}}),o&&(0,G.jsx)(Dn,{provider:{...m,type:f.providerType},connectionDraft:{providerType:f.providerType,api:f.api||m.api,baseUrl:f.baseUrl,apiKey:f.apiKey,organization:f.organization},autoDiscover:o===`discover`,onClose:()=>s(``),onSynchronized:l.applySynchronizedModels,onCreated:(e,t)=>{l.applyCreatedModels(e,m.id,t),s(``)}})]})}function Z(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 Yn(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 Xn,Q,Zn,Qn,$n=`__TAURI_TO_IPC_KEY__`;function er(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}var tr=class{constructor(e){Xn.set(this,void 0),Q.set(this,0),Zn.set(this,[]),Qn.set(this,void 0),Yn(this,Xn,e||(()=>{}),`f`),this.id=er(e=>{let t=e.index;if(`end`in e){t==Z(this,Q,`f`)?this.cleanupCallback():Yn(this,Qn,t,`f`);return}let n=e.message;if(t==Z(this,Q,`f`)){for(Z(this,Xn,`f`).call(this,n),Yn(this,Q,Z(this,Q,`f`)+1,`f`);Z(this,Q,`f`)in Z(this,Zn,`f`);){let e=Z(this,Zn,`f`)[Z(this,Q,`f`)];Z(this,Xn,`f`).call(this,e),delete Z(this,Zn,`f`)[Z(this,Q,`f`)],Yn(this,Q,Z(this,Q,`f`)+1,`f`)}Z(this,Q,`f`)===Z(this,Qn,`f`)&&this.cleanupCallback()}else Z(this,Zn,`f`)[t]=n})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(e){Yn(this,Xn,e,`f`)}get onmessage(){return Z(this,Xn,`f`)}[(Xn=new WeakMap,Q=new WeakMap,Zn=new WeakMap,Qn=new WeakMap,$n)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[$n]()}};function $(e,t){let n=window.__TAURI__?.core?.invoke??window.__TAURI_INTERNALS__?.invoke;return n?n(e,t):Promise.reject(Error(`native bridge unavailable`))}function nr(e,t){return $(`plugin:barcode-scanner|${e}`,t)}function rr(e){return e instanceof Error?e.message:String(e)}function ir(e){return/cancel(?:led|ed)/i.test(rr(e))}function ar(){return new Promise(e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))})}function or(e){return Array.isArray(e)?new TextDecoder().decode(Uint8Array.from(e)):``}function sr(e){if(!e.isActive||!e.port)return null;let t=or(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=or(e.txt.name)||e.name||`Pisper Desktop`,a=`https://${r}:${e.port}`;return{id:`${e.fullName}:${a}`,name:i,url:a,fingerprint:t}}function cr(e){return new Promise(t=>window.setTimeout(t,e))}function lr({open:e,onOpenChange:t}){let{t:n}=p(),[r,i]=(0,W.useState)(``),[a,s]=(0,W.useState)(``),[c,l]=(0,W.useState)(``),[u,d]=(0,W.useState)(null),[f,m]=(0,W.useState)(!1),[h,g]=(0,W.useState)([]),[_,v]=(0,W.useState)(!1),[y,b]=(0,W.useState)(``),[x,S]=(0,W.useState)(``),[C,w]=(0,W.useState)(``),T=(0,W.useRef)(!1),E=(0,W.useRef)(!1),O=(0,W.useRef)(!1),k=(0,W.useRef)(0),A=(0,W.useRef)(``),j=(0,W.useCallback)(e=>{T.current=e,m(e)},[]),M=(0,W.useCallback)(async()=>{E.current=!0,T.current&&await nr(`cancel`).catch(()=>void 0),j(!1),d(null)},[j]);(0,W.useEffect)(()=>{if(!f)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)}},[f]),(0,W.useEffect)(()=>{if(!f)return;let e=`pisper-scanner-${Date.now()}`;window.history.pushState({...window.history.state,pisperScanner:e},``);let t=()=>void M();return window.addEventListener(`popstate`,t),()=>{window.removeEventListener(`popstate`,t),!O.current&&window.history.state?.pisperScanner===e&&window.history.back()}},[M,f]);let N=e=>{if(!e.proxyUrl)throw Error(n(`config:mobileServer.pairFailed`));window.location.replace(e.proxyUrl)},P=(0,W.useCallback)(async()=>{let e=++k.current;v(!0),b(``),g([]);let t=new tr;t.onmessage=t=>{if(k.current!==e)return;if(t.reason===`permission-denied`){b(n(`config:mobileServer.localNetworkDenied`));return}if(t.reason?.startsWith(`error:`)){b(n(`config:mobileServer.discoveryFailed`));return}if(!t.service)return;if(!t.service.isActive){g(e=>e.filter(e=>!e.id.startsWith(`${t.service?.fullName}:`)));return}let r=sr(t.service);r&&g(e=>[...e.filter(e=>e.fingerprint!==r.fingerprint),r])};let r=null;try{await $(`mobile_ensure_local_network_permission`),r=(await $(`plugin:dns-sd|browse_start`,{options:{service:{type:`pisper`,protocol:`tcp`,domain:`local`},timeoutMs:4e3},channel:t})).browseId,await cr(4300)}catch(t){k.current===e&&b(rr(t).includes(`local_network_permission_denied`)?n(`config:mobileServer.localNetworkDenied`):n(`config:mobileServer.discoveryFailed`))}finally{r!==null&&await $(`plugin:dns-sd|browse_stop`,{browseId:r}).catch(()=>void 0),k.current===e&&v(!1)}},[n]);(0,W.useEffect)(()=>{if(!(!e||f))return P(),()=>{k.current+=1}},[P,e,f]);let F=(0,W.useCallback)(async()=>{let e=A.current;A.current=``,e&&await $(`mobile_cancel_lan_pairing`,{operationId:e}).catch(()=>void 0),d(null),S(``)},[]),I=async e=>{let t=globalThis.crypto?.randomUUID?.()||`lan-${Date.now()}-${Math.random().toString(16).slice(2)}`;A.current=t,d(`lan:${e.id}`),w(``),S(n(`config:mobileServer.awaitingApproval`,{name:e.name}));try{let n=await $(`mobile_pair_lan`,{operationId:t,name:e.name,url:e.url,fingerprint:e.fingerprint,deviceName:null});if(A.current!==t)return;N(n)}catch(e){A.current===t&&w(rr(e))}finally{A.current===t&&(A.current=``,d(null),S(``))}},ee=async()=>{E.current=!1,O.current=!1,d(`scan`),w(``);try{let e=await nr(`check_permissions`);if(e.camera!==`granted`&&(e=await nr(`request_permissions`)),e.camera!==`granted`)throw Error(n(`config:mobileServer.cameraDenied`));if(E.current||(j(!0),await ar(),E.current))return;let t=await nr(`scan`,{windowed:!0,formats:[`QR_CODE`]});if(!t.content)throw Error(n(`config:mobileServer.scanFailed`));O.current=!0,N(await $(`mobile_pair`,{payloadJson:t.content,deviceName:null}))}catch(e){!E.current&&!ir(e)&&w(rr(e))}finally{j(!1),d(null),E.current=!1}},te=async()=>{d(`manual`),w(``);try{N(await $(`mobile_pair_manual`,{url:r,code:a,fingerprint:c,deviceName:null}))}catch(e){w(rr(e))}finally{d(null)}};return(0,G.jsx)(ne,{open:e,onOpenChange:e=>{if(!e&&f){M();return}if(!e&&u?.startsWith(`lan:`)){F(),t(!1);return}u||(e||w(``),t(e))},children:(0,G.jsx)(De,{showCloseButton:!f,overlayClassName:f?`bg-transparent supports-backdrop-filter:backdrop-blur-none`:void 0,className:f?`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:f?e=>e.preventDefault():void 0,children:f?(0,G.jsxs)(`div`,{className:`flex h-dvh w-screen flex-col overflow-hidden`,children:[(0,G.jsxs)(ve,{className:`sr-only`,children:[(0,G.jsx)(le,{children:n(`config:mobileServer.scanTitle`)}),(0,G.jsx)(me,{children:n(`config:mobileServer.scanHint`)})]}),(0,G.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,G.jsxs)(o,{variant:`ghost`,className:`h-10 bg-black/40 px-3 text-white hover:bg-black/70 hover:text-white`,onClick:()=>void M(),children:[(0,G.jsx)(de,{}),n(`config:mobileServer.cancelScan`)]}),(0,G.jsx)(`div`,{className:`min-w-0 truncate text-sm font-medium`,children:n(`config:mobileServer.scanTitle`)}),(0,G.jsx)(`div`,{className:`w-[88px]`,"aria-hidden":`true`})]}),(0,G.jsx)(`main`,{className:`grid min-h-0 flex-1 place-items-center p-6`,children:(0,G.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,G.jsx)(Zt,{className:`absolute top-1/2 left-1/2 size-10 -translate-x-1/2 -translate-y-1/2 text-white/75`})})}),(0,G.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,G.jsx)(`p`,{className:`max-w-sm text-sm leading-relaxed text-white/90`,children:n(`config:mobileServer.scanHint`)}),(0,G.jsx)(o,{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 M(),children:n(`config:mobileServer.cancelScan`)})]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(ve,{children:[(0,G.jsx)(le,{children:n(`config:mobileServer.addServer`)}),(0,G.jsx)(me,{children:n(`config:mobileServer.discoverDescription`)})]}),(0,G.jsxs)(`section`,{className:`grid gap-2`,"aria-live":`polite`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,G.jsx)(Jt,{className:`size-4`}),n(`config:mobileServer.nearby`)]}),(0,G.jsx)(o,{size:`icon-sm`,variant:`ghost`,disabled:_||u!==null,"aria-label":n(`config:mobileServer.rediscover`),onClick:()=>void P(),children:(0,G.jsx)(R,{className:_?`animate-spin`:void 0})})]}),h.length?(0,G.jsx)(`ul`,{className:`grid max-h-44 gap-1.5 overflow-y-auto`,children:h.map(e=>{let t=u===`lan:${e.id}`;return(0,G.jsxs)(`li`,{className:`flex min-h-12 items-center justify-between gap-3 rounded-md border px-3 py-2`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(be,{className:`size-4 flex-none text-muted-foreground`}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`truncate text-sm`,children:e.name}),(0,G.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e.url})]})]}),(0,G.jsxs)(o,{size:`sm`,disabled:u!==null,onClick:()=>void I(e),children:[t?(0,G.jsx)(D,{className:`animate-spin`}):null,n(`config:mobileServer.requestConnect`)]})]},e.id)})}):(0,G.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:n(_?`config:mobileServer.discovering`:`config:mobileServer.noNearby`)}),y?(0,G.jsx)(`p`,{className:`text-xs leading-relaxed text-destructive`,children:y}):null,x?(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md bg-muted px-3 py-2`,children:[(0,G.jsx)(`p`,{className:`text-xs leading-relaxed`,children:x}),(0,G.jsx)(o,{size:`sm`,variant:`outline`,onClick:()=>void F(),children:n(`config:mobileServer.cancelRequest`)})]}):null]}),(0,G.jsxs)(`div`,{className:`relative py-1`,children:[(0,G.jsx)(He,{}),(0,G.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,G.jsxs)(o,{className:`w-full`,disabled:u!==null,onClick:()=>void ee(),children:[u===`scan`?(0,G.jsx)(D,{className:`animate-spin`}):(0,G.jsx)(qt,{}),n(`config:mobileServer.scan`)]}),(0,G.jsxs)(`div`,{className:`relative py-1`,children:[(0,G.jsx)(He,{}),(0,G.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.manual`)})]}),(0,G.jsxs)(`form`,{className:`grid gap-3`,onSubmit:e=>{e.preventDefault(),te()},children:[(0,G.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,G.jsx)(Oe,{htmlFor:`mobile-pair-url`,children:n(`config:mobileServer.url`)}),(0,G.jsx)(re,{id:`mobile-pair-url`,inputMode:`url`,autoCapitalize:`off`,autoCorrect:`off`,placeholder:`https://192.168.1.5:5174`,value:r,onChange:e=>i(e.target.value)})]}),(0,G.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,G.jsx)(Oe,{htmlFor:`mobile-pair-code`,children:n(`config:mobileServer.code`)}),(0,G.jsx)(re,{id:`mobile-pair-code`,autoCapitalize:`characters`,autoCorrect:`off`,placeholder:`ABCD-EFGH`,value:a,onChange:e=>s(e.target.value)})]}),(0,G.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,G.jsx)(Oe,{htmlFor:`mobile-pair-fingerprint`,children:n(`config:remoteAccess.fingerprint`)}),(0,G.jsx)(re,{id:`mobile-pair-fingerprint`,autoCapitalize:`characters`,autoCorrect:`off`,placeholder:`SHA256:1BA3FEB1`,value:c,onChange:e=>l(e.target.value)})]}),C?(0,G.jsx)(`p`,{className:`text-xs leading-relaxed text-destructive`,children:C}):null,(0,G.jsx)(ge,{className:`mt-1`,children:(0,G.jsxs)(o,{type:`submit`,disabled:u!==null||!r||!a||!c,children:[u===`manual`?(0,G.jsx)(D,{className:`animate-spin`}):null,n(`config:mobileServer.pair`)]})})]})]})})})}function ur(e,t){let n=window.__TAURI__?.core?.invoke??window.__TAURI_INTERNALS__?.invoke;return n?n(e,t):Promise.reject(Error(`native bridge unavailable`))}function dr(){let{t:e}=p(),[t,n]=(0,W.useState)(null),[r,i]=(0,W.useState)(``),[a,s]=(0,W.useState)(``),[c,l]=(0,W.useState)(!1),u=(0,W.useCallback)(async()=>{try{n(await ur(`mobile_state`)),i(``)}catch{i(e(`config:mobileServer.loadFailed`))}},[e]);(0,W.useEffect)(()=>{u()},[u]);let d=async(e,t,r=``)=>{s(r||e);try{n(await ur(e,t)),i(``)}catch(e){i(String(e))}finally{s(``)}},f=async e=>{s(e);try{let t=await ur(`mobile_select_server`,{id:e});n(t),i(``),t.proxyUrl&&window.location.replace(t.proxyUrl)}catch(e){i(String(e))}finally{s(``)}},m=t?.mode===`local`;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsx)(lr,{open:c,onOpenChange:l}),(0,G.jsxs)(q,{className:`flex flex-col gap-3 p-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-[11px]`,children:[(0,G.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,G.jsx)(he,{size:19})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-[16px]`,children:e(`config:mobileServer.title`)}),(0,G.jsx)(`p`,{className:`mt-1 text-[13px] leading-[1.55] text-[var(--text-muted)]`,children:e(`config:mobileServer.description`)})]})]}),(0,G.jsxs)(o,{size:`sm`,onClick:()=>l(!0),children:[(0,G.jsx)(ke,{size:14}),e(`config:mobileServer.addServer`)]})]}),r?(0,G.jsx)(`p`,{className:`text-[12px] text-[var(--danger)]`,children:r}):null]}),(0,G.jsx)(q,{className:`flex flex-col gap-3 p-4`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-[11px]`,children:[(0,G.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,G.jsx)(Qt,{size:19})}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h2`,{className:`flex items-center gap-2 text-[16px]`,children:[e(`config:mobileServer.localTitle`),m?(0,G.jsx)(`span`,{className:`text-[11px] text-[var(--star-strong)]`,children:e(`config:mobileServer.currentLocal`)}):null]}),(0,G.jsx)(`p`,{className:`mt-1 text-[13px] leading-[1.55] text-[var(--text-muted)]`,children:e(`config:mobileServer.localDescription`)})]})]}),(0,G.jsx)(o,{size:`sm`,variant:`outline`,disabled:m||a===`mobile_enter_local`,onClick:()=>void(async()=>{s(`mobile_enter_local`);try{let e=await ur(`mobile_enter_local`);e.onDevice.url&&window.location.replace(e.onDevice.url)}catch(e){i(String(e))}finally{s(``)}})(),children:e(m?`config:mobileServer.currentLocal`:`config:mobileServer.enterLocal`)})]})}),(0,G.jsx)(q,{className:`flex flex-col gap-3 p-4`,children:t?.servers?.length?(0,G.jsx)(`ul`,{className:`flex flex-col gap-2`,children:t.servers.map(n=>{let r=t.mode===`remote`&&n.id===t.activeId,i=n.endpoints.find(e=>e.url),s=n.endpoints.find(e=>e.t===`iroh`),c=i?.url||(s?.nodeId?`Iroh ${s.nodeId.slice(0,12)}`:`Iroh`);return(0,G.jsxs)(`li`,{className:`flex items-center justify-between gap-3 rounded-[var(--r-sm)] border border-[var(--border)] px-3 py-2`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(be,{size:15,className:`flex-none text-[var(--text-muted)]`}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`truncate text-[13px]`,children:[n.name,r?(0,G.jsx)(`span`,{className:`ml-2 text-[11px] text-[var(--star-strong)]`,children:e(`config:mobileServer.current`)}):null]}),(0,G.jsxs)(`div`,{className:`truncate text-[11px] text-[var(--text-muted)]`,children:[c,(0,G.jsx)(`span`,{className:`ml-2`,children:e(i&&s?`config:mobileServer.transportLanP2p`:s?`config:mobileServer.transportP2p`:`config:mobileServer.transportLan`)})]}),r&&t.activeTransport?(0,G.jsx)(`div`,{className:`text-[11px] text-[var(--star-strong)]`,children:e(`config:mobileServer.activeTransport`,{transport:t.activeTransport===`iroh`?e(`config:mobileServer.transportP2p`):e(`config:mobileServer.transportLan`)})}):null]})]}),(0,G.jsxs)(`div`,{className:`flex flex-none items-center gap-1`,children:[r?null:(0,G.jsx)(o,{size:`sm`,variant:`ghost`,disabled:a===n.id,onClick:()=>void f(n.id),children:e(`config:mobileServer.connect`)}),(0,G.jsx)(o,{size:`sm`,variant:`ghost`,"aria-label":e(`config:mobileServer.forget`),onClick:()=>{window.confirm(e(`config:mobileServer.forgetConfirm`))&&d(`mobile_forget_server`,{id:n.id},n.id)},children:(0,G.jsx)(I,{size:14})})]})]},n.id)})}):(0,G.jsx)(`p`,{className:`text-[12px] text-[var(--text-muted)]`,children:e(`config:mobileServer.empty`)})})]})}var fr={feishu:{tone:`blue`},weixin:{tone:`green`},browser:{tone:`blue`}};function pr(e,t){return t(e===`feishu`?`config:notificationSettings.feishu`:e===`weixin`?`config:notificationSettings.weChat`:`config:notificationSettings.browserNotification`)}function mr(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 hr(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 gr(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 _r(){return typeof window<`u`&&window.pisperDesktop?.showNotification?window.pisperDesktop.getNotificationStatus?`checking`:`granted`:typeof window<`u`&&Re()?`checking`:ze()}function vr(e,t){return t(e===`system-disabled`||e===`app-disabled`?`config:notificationSettings.systemNotificationsAreOffAllowPisperToSendNotificationsInYourOperatingSystemSettings`:e===`unsupported`?`config:notificationSettings.systemNotificationsAreNotSupportedInThisEnvironment`:`config:notificationSettings.theOperatingSystemDidNotAcceptTheNotificationCheckYourSystemNotificationSettings`)}function yr(e){return e instanceof Error?e.message:String(e)}function br({notify:e,onBrowserNotificationChange:t}){let{t:n}=p(),[r,i]=(0,W.useState)({browser:{enabled:!1},connections:{},scopes:[],templates:[]}),[a,s]=(0,W.useState)(!0),[c,l]=(0,W.useState)(``),u=!!window.pisperDesktop?.showNotification,d=Re(),[f,m]=(0,W.useState)(_r),[h,g]=(0,W.useState)(!1),_=(0,W.useCallback)(async()=>{if(!u)return;let e=window.pisperDesktop?.getNotificationStatus;if(!e){m(`granted`);return}try{let t=await e(),n=t?.permission;m(n==="default"||n===`denied`||n===`granted`||n===`checking`||n===`unsupported`?n:t?.supported===!1?`unsupported`:`granted`)}catch{m(`unsupported`)}},[u]),v=(0,W.useCallback)(async()=>{try{l(``);let e=await z(`/api/settings/notifications`);i(e),t?.(e)}catch(e){l(yr(e))}finally{s(!1)}},[t]);(0,W.useEffect)(()=>{v()},[v]),(0,W.useEffect)(()=>{if(!u)return;_();let e=()=>{_()};return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[u,_]);let y=(0,W.useCallback)(async()=>{if(!(u||!d))try{let e=await Ve();m(e===!0?`granted`:e===!1?`denied`:`default`)}catch{m(`unsupported`)}},[u,d]);(0,W.useEffect)(()=>{if(u||!d)return;y();let e=()=>void y();return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[u,d,y]);let b=async r=>{let a=``;if(r){if(u&&f!==`granted`)a=vr(`system-disabled`,n);else if(!u&&d){let e=`denied`;try{let t=await Ve()===!0?`granted`:await Be();e=t===`granted`?`granted`:t===`denied`?`denied`:`default`}catch{e=`unsupported`}m(e),e!==`granted`&&(a=n(`config:notificationSettings.systemNotificationsAreOffAllowPisperToSendNotificationsInYourOperatingSystemSettings`))}else if(!u){let e=await se();if(m(e),e!==`granted`)a=n(e===`unsupported`?`config:notificationSettings.systemNotificationsAreNotSupportedInThisEnvironment`:`config:notificationSettings.notificationPermissionWasNotGrantedAllowNotificationsInTheBrowserSiteSettings`);else try{await ye()}catch{a=n(`config:notificationSettings.theBrowserBackgroundNotificationServiceCouldNotBeRegistered`)}}}g(!0);try{let o=await z(`/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(yr(t),`error`)}finally{g(!1)}},x=(0,W.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 m(i.permission??`denied`),Error(vr(i.reason,n));return i}return d?(await Ce(e,t),{shown:!0,transport:`tauri`}):oe({title:e,body:t,tag:r,url:window.location.href})},[u,d,n]),S=async()=>{if(f!==`granted`){e(f===`unsupported`?vr(`unsupported`,n):u?vr(`system-disabled`,n):n(`config:notificationSettings.notificationPermissionWasNotGrantedAllowNotificationsInTheBrowserSiteSettings`),`error`);return}try{await x(n(`config:notificationSettings.appNotificationTest`,{app:Ge}),n(`config:notificationSettings.notificationsAreWorking`)),e(n(`config:notificationSettings.theTestNotificationWasSentCheckYourSystemNotificationCenter`),`info`)}catch(t){e(yr(t)||n(`config:notificationSettings.theOperatingSystemDidNotAcceptTheNotificationCheckYourSystemNotificationSettings`),`error`)}},C=async()=>{try{await window.pisperDesktop?.openNotificationSettings?.()||e(n(`config:notificationSettings.openNotificationPermissionsInYourOperatingSystemSettings`),`info`)}catch{e(n(`config:notificationSettings.openNotificationPermissionsInYourOperatingSystemSettings`),`info`)}};if(a)return(0,G.jsxs)(Pe,{children:[(0,G.jsx)(R,{className:`animate-spin`,size:23}),(0,G.jsx)(`h2`,{children:n(`config:notificationSettings.loadingNotificationSettings`)})]});let w=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`),T=f===`granted`?`green`:f==="default"||f===`checking`?`amber`:`red`;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-[12px]`,children:[c&&(0,G.jsxs)(Ee,{children:[(0,G.jsx)(V,{size:13}),c]}),(0,G.jsxs)(q,{className:`browser-notification-card`,children:[(0,G.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,G.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,G.jsx)(Se,{size:18}):(0,G.jsx)(It,{size:18})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:n(`config:notificationSettings.notification`)}),(0,G.jsx)(`small`,{children:n(`config:notificationSettings.pisperUsesTheCurrentPlatformNotificationSystemWhenAnAgentCompletesOrFails`)})]}),(0,G.jsx)(Y,{tone:T,children:w}),(0,G.jsx)(X,{value:r.browser.enabled,disabled:h||f===`checking`,onChange:b})]}),(0,G.jsxs)(H,{children:[(0,G.jsx)(P,{size:15}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{children:n(u?`config:notificationSettings.controlledByOperatingSystemNotificationSettings`:`config:notificationSettings.controlledByBrowserSitePermissions`)}),(0,G.jsx)(`small`,{children:n(u?`config:notificationSettings.theDesktopAppUsesOperatingSystemNotificationsTurningThisOffDoesNotChangeTheOperatingSystemPermis`:`config:notificationSettings.theWebAppUsesBrowserSiteNotificationsTurningThisOffDoesNotChangeTheBrowserPermissionItself`)})]})]}),(0,G.jsxs)(`div`,{className:`mt-[15px] flex gap-2 max-[650px]:flex-wrap`,children:[u&&f===`denied`&&(0,G.jsxs)(o,{variant:`outline`,size:`lg`,className:`bg-surface-subtle`,onClick:C,children:[(0,G.jsx)(P,{size:14}),n(`config:notificationSettings.openSystemNotificationSettings`)]}),(0,G.jsxs)(o,{variant:`outline`,size:`lg`,className:`bg-surface-subtle`,disabled:!r.browser.enabled||f!==`granted`,onClick:S,children:[(0,G.jsx)(Se,{size:14}),n(`config:notificationSettings.sendTestNotification`)]})]})]}),(0,G.jsx)(xr,{data:r,setData:i,notify:e,permission:f,onBrowserTest:x,onSettingsChange:t})]})}function xr({data:e,setData:t,notify:n,permission:r,onBrowserTest:i,onSettingsChange:a}){let{t:s}=p(),[c,l]=(0,W.useState)(e.templates[0]?.id||``),[u,d]=(0,W.useState)(`feishu`),f=e.templates.find(e=>e.id===c)||e.templates[0],m=f?.channels?.[u],[h,g]=(0,W.useState)(m?.content||``),[_,v]=(0,W.useState)(!1),y=e.scopes.find(e=>e.platform===u),b=u===`browser`?e.browser.enabled&&r===`granted`:!!y,S=fr;return(0,W.useEffect)(()=>{g(m?.content||``)},[c,u,m?.content]),f?(0,G.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,G.jsxs)(q,{children:[(0,G.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,G.jsx)(J,{title:s(`config:notificationSettings.notificationTemplates`)}),(0,G.jsx)(`span`,{children:s(`config:notificationSettings.sharedByChatsScheduledTasksAndWorkflows`)})]}),e.templates.map(e=>(0,G.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,G.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,G.jsx)(x,{size:14})}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{children:mr(e.id,e.name,s)}),(0,G.jsx)(`small`,{children:hr(e.id,e.description,s)})]}),(0,G.jsx)(Y,{tone:e.enabled?`green`:`gray`,children:e.enabled?s(`config:notificationSettings.enabled`):s(`config:notificationSettings.disabled`)})]},e.id))]}),(0,G.jsxs)(q,{className:`channel-template-editor [&_textarea]:min-h-[118px] [&_textarea]:font-[ui-monospace,_SFMono-Regular,_Consolas,_'Liberation_Mono',_monospace] [&_textarea]:leading-[1.55]`,children:[(0,G.jsxs)(je,{children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{children:mr(f.id,f.name,s)}),(0,G.jsx)(`p`,{children:hr(f.id,f.description,s)})]}),(0,G.jsx)(X,{value:f.enabled,onChange:e=>t(t=>({...t,templates:t.templates.map(t=>t.id===f.id?{...t,enabled:e}:t)}))})]}),(0,G.jsx)(`div`,{className:`channel-template-platforms [&_>_button]:flex [&_>_button]:min-h-[36px] [&_>_button]:items-center [&_>_button]:justify-between [&_>_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(3,minmax(0,1fr))] gap-[7px] [margin-top:13px]`,children:Object.entries(S).map(([t,n])=>{let r=t===`browser`?e.browser.enabled:e.connections?.[t];return(0,G.jsxs)(`button`,{className:u===t?`active`:``,onClick:()=>d(t),children:[pr(t,s),(0,G.jsx)(Y,{tone:r?n.tone:`gray`,children:s(r?t===`browser`?`config:notificationSettings.enabled2`:`config:notificationSettings.connected`:t===`browser`?`config:notificationSettings.notEnabled`:`config:notificationSettings.notConnected`)})]},t)})}),(0,G.jsxs)(U,{variant:`control`,children:[s(`config:notificationSettings.messageContent`),(0,G.jsx)(`textarea`,{value:h,onChange:e=>g(e.target.value)})]}),(0,G.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,G.jsx)(`span`,{children:s(`config:notificationSettings.availableVariables`)}),f.variables.map(e=>(0,G.jsx)(`code`,{children:`{{${e}}}`},e))]}),(0,G.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,G.jsx)(`small`,{children:s(`config:notificationSettings.preview`)}),(0,G.jsx)(`pre`,{children:gr(h,s)})]}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-[8px] [margin-top:18px]`,children:[(0,G.jsxs)(o,{variant:`outline`,size:`lg`,className:`bg-surface-subtle`,disabled:_||!b,onClick:async()=>{v(!0);try{let e=await z(`/api/settings/notifications/templates/${encodeURIComponent(f.id)}/${u}/test`,{method:`POST`,body:`{}`});u===`browser`&&await i?.(e.title||mr(f.id,f.name,s),e.body||e.preview||``,`pisper-template-${f.id}`),n(s(u===`browser`?`config:notificationSettings.theTestNotificationWasSentCheckYourSystemNotificationCenter`:`config:notificationSettings.testNotificationSentToCountChats`,{count:e.sent}))}catch(e){n(yr(e),`error`)}finally{v(!1)}},children:[(0,G.jsx)(x,{size:14}),s(`config:notificationSettings.sendTest`)]}),(0,G.jsxs)(o,{size:`lg`,disabled:_||!h.trim(),onClick:async()=>{v(!0);try{let e=await z(`/api/settings/notifications/templates/${encodeURIComponent(f.id)}/${u}`,{method:`PUT`,body:JSON.stringify({enabled:f.enabled,content:h})});t(e),a?.(e),n(s(`config:notificationSettings.notificationTemplateSaved`))}catch(e){n(yr(e),`error`)}finally{v(!1)}},children:[_?(0,G.jsx)(R,{className:`animate-spin`,size:14}):(0,G.jsx)(M,{size:14}),s(`config:notificationSettings.saveTemplate`)]})]})]})]}):null}function Sr({notify:e}){let{t,language:n}=p(),[r,i]=(0,W.useState)(null),[a,s]=(0,W.useState)([]),[c,l]=(0,W.useState)([]),[u,d]=(0,W.useState)(null),[f,m]=(0,W.useState)(!1),[h,_]=(0,W.useState)(``),[v,y]=(0,W.useState)(``),[b,x]=(0,W.useState)(!1),[S,C]=(0,W.useState)(``),w=(0,W.useCallback)(async()=>{try{let[e,t,n]=await Promise.all([z(`/api/remote/status`),z(`/api/remote/devices`),z(`/api/remote/pairing-requests`).catch(()=>({requests:[]}))]);i(e),s(t.devices.filter(e=>!e.revokedAt)),l(n.requests),C(``)}catch{C(t(`config:remoteAccess.loadFailed`))}},[t]);(0,W.useEffect)(()=>{w()},[w]),(0,W.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 z(`/api/remote/enabled`,{method:`PUT`,body:{enabled:n}});let e=window.__TAURI__?.core?.invoke??window.__TAURI_INTERNALS__?.invoke;e&&await e(`desktop_iroh_set_enabled`,{enabled:n}).catch(()=>void 0),n||(d(null),m(!1),_(``)),await w()}catch(n){e(t(`config:remoteAccess.toggleFailed`,{message:String(n)}),`error`)}finally{x(!1)}},E=async()=>{x(!0),_(``);try{let e=await z(`/api/remote/pairing-code`,{method:`POST`});if(!e?.code||!e?.expiresAt)throw Error(t(`config:remoteAccess.qrUnavailable`));d(e),m(!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)}},O=async(n,r)=>{y(n.id);try{await z(`/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(``)}},k=async n=>{if(window.confirm(t(`config:remoteAccess.revokeConfirm`,{name:n.name})))try{await z(`/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,G.jsx)(q,{className:`p-4 text-[13px] text-[var(--text-muted)]`,children:S}):r?(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsx)(ne,{open:f&&u!==null,onOpenChange:m,children:(0,G.jsxs)(De,{className:`sm:max-w-md`,children:[(0,G.jsxs)(ve,{children:[(0,G.jsx)(le,{children:t(`config:remoteAccess.pairingQrTitle`)}),(0,G.jsx)(me,{children:t(`config:remoteAccess.scanQrDescription`)})]}),(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-2`,"aria-live":`polite`,children:[u?.qrDataUrl?(0,G.jsx)(`img`,{src:u.qrDataUrl,alt:t(`config:remoteAccess.qrAlt`),className:`size-64 max-w-full rounded-[var(--r-sm)] bg-white p-2`}):null,h?(0,G.jsx)(`p`,{className:`text-center text-[12px] leading-relaxed text-[var(--danger)]`,children:h}):null,u?(0,G.jsxs)(`div`,{className:`text-center`,children:[(0,G.jsx)(`div`,{className:`font-mono text-[20px] tracking-[0.2em]`,children:u.code}),(0,G.jsx)(`div`,{className:`mt-1 text-[11px] text-[var(--text-muted)]`,children:t(`config:remoteAccess.codeExpiresAt`,{time:xe(u.expiresAt,n)})})]}):null]}),(0,G.jsx)(ge,{children:(0,G.jsxs)(o,{disabled:b,onClick:()=>void E(),children:[b?(0,G.jsx)(D,{className:`animate-spin`}):(0,G.jsx)(R,{}),t(b?`config:remoteAccess.generatingQr`:`config:remoteAccess.regenerate`)]})})]})}),(0,G.jsxs)(q,{className:`flex flex-col gap-3 p-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-[11px]`,children:[(0,G.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,G.jsx)(he,{size:19})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-[16px]`,children:t(`config:remoteAccess.title`)}),(0,G.jsx)(`p`,{className:`mt-1 text-[13px] leading-[1.55] text-[var(--text-muted)]`,children:t(`config:remoteAccess.description`)})]})]}),(0,G.jsx)(X,{value:r.enabled&&r.listening,disabled:b,onChange:e=>void T(e),ariaLabel:t(`config:remoteAccess.title`)})]}),r.error?(0,G.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,r.listening?(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-[12px] text-[var(--text-muted)]`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(P,{size:14,className:`flex-none`}),(0,G.jsx)(`span`,{children:t(`config:remoteAccess.fingerprint`)}),(0,G.jsx)(`code`,{className:`break-all text-[11px]`,children:r.fingerprint})]}),r.iroh?(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(_e,{size:14,className:`mt-0.5 flex-none`}),(0,G.jsx)(`span`,{children:r.iroh.error?t(`config:remoteAccess.irohFailed`,{message:r.iroh.error}):r.iroh.relayConnected?t(`config:remoteAccess.irohReady`):r.iroh.available?t(`config:remoteAccess.irohDirectOnly`):t(`config:remoteAccess.irohStarting`)}),r.iroh.nodeId?(0,G.jsx)(`code`,{className:`min-w-0 truncate text-[11px]`,title:r.iroh.nodeId,children:r.iroh.nodeId.slice(0,12)}):null]}):null,r.endpoints.filter(e=>e.t!==`iroh`).map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`w-10 flex-none rounded border border-[var(--border)] px-1 text-center text-[10px] uppercase`,children:e.t}),(0,G.jsx)(`code`,{className:`break-all text-[11px]`,children:e.url})]},`${e.t}:${e.url}`))]}):null]}),r.listening&&c.length?(0,G.jsxs)(q,{className:`flex flex-col gap-3 p-4`,"aria-live":`polite`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[14px]`,children:[(0,G.jsx)(Qt,{size:16}),t(`config:remoteAccess.pendingApprovals`)]}),(0,G.jsx)(`p`,{className:`text-[12px] leading-relaxed text-[var(--text-muted)]`,children:t(`config:remoteAccess.pendingApprovalsDescription`)}),(0,G.jsx)(`ul`,{className:`flex flex-col gap-2`,children:c.map(e=>(0,G.jsxs)(`li`,{className:`flex items-center justify-between gap-3 rounded-[var(--r-sm)] border border-[var(--border)] px-3 py-2`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`truncate text-[13px]`,children:e.deviceName}),(0,G.jsx)(`div`,{className:`text-[11px] text-[var(--text-muted)]`,children:t(`config:remoteAccess.requestedAt`,{time:xe(e.requestedAt,n)})}),(0,G.jsx)(`code`,{className:`block truncate text-[11px] text-[var(--text-muted)]`,children:t(`config:remoteAccess.requestSource`,{ip:e.ip})})]}),(0,G.jsxs)(`div`,{className:`flex flex-none items-center gap-1`,children:[(0,G.jsxs)(o,{size:`sm`,variant:`ghost`,disabled:v===e.id,onClick:()=>void O(e,!1),children:[(0,G.jsx)(we,{}),t(`config:remoteAccess.reject`)]}),(0,G.jsxs)(o,{size:`sm`,disabled:v===e.id,onClick:()=>void O(e,!0),children:[v===e.id?(0,G.jsx)(D,{className:`animate-spin`}):(0,G.jsx)(g,{}),t(`config:remoteAccess.approve`)]})]})]},e.id))})]}):null,r.listening?(0,G.jsxs)(q,{className:`flex flex-col gap-3 p-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[14px]`,children:[(0,G.jsx)(qt,{size:16}),t(`config:remoteAccess.pairing`)]}),(0,G.jsxs)(o,{size:`sm`,disabled:b,onClick:()=>void E(),children:[b?(0,G.jsx)(D,{className:`animate-spin`}):(0,G.jsx)(qt,{}),t(b?`config:remoteAccess.generatingQr`:`config:remoteAccess.generateQr`)]})]}),(0,G.jsx)(`p`,{className:`text-[12px] leading-[1.6] text-[var(--text-muted)]`,children:t(`config:remoteAccess.pairingDescription`)}),h&&!f?(0,G.jsx)(`p`,{className:`text-[12px] leading-relaxed text-[var(--danger)]`,"aria-live":`polite`,children:h}):null]}):null,(0,G.jsxs)(q,{className:`flex flex-col gap-3 p-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[14px]`,children:[(0,G.jsx)(Qt,{size:16}),t(`config:remoteAccess.devices`)]}),(0,G.jsx)(o,{size:`sm`,variant:`ghost`,onClick:()=>void w(),"aria-label":t(`config:remoteAccess.refresh`),children:(0,G.jsx)(R,{size:14})})]}),a.length===0?(0,G.jsx)(`p`,{className:`text-[12px] text-[var(--text-muted)]`,children:t(`config:remoteAccess.noDevices`)}):(0,G.jsx)(`ul`,{className:`flex flex-col gap-2`,children:a.map(e=>(0,G.jsxs)(`li`,{className:`flex items-center justify-between gap-3 rounded-[var(--r-sm)] border border-[var(--border)] px-3 py-2`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`truncate text-[13px]`,children:[e.name,e.current?(0,G.jsx)(`span`,{className:`ml-2 text-[11px] text-[var(--text-muted)]`,children:t(`config:remoteAccess.currentDevice`)}):null]}),(0,G.jsx)(`div`,{className:`text-[11px] text-[var(--text-muted)]`,children:t(`config:remoteAccess.lastSeen`,{time:xe(e.lastSeenAt,n)})})]}),(0,G.jsx)(o,{size:`sm`,variant:`ghost`,onClick:()=>void k(e),children:t(`config:remoteAccess.revoke`)})]},e.id))})]})]}):null}function Cr({notify:e}){let{t}=p(),n=window.pisperDesktop,[r,i]=(0,W.useState)(null),[a,s]=(0,W.useState)(``),[c,l]=(0,W.useState)(``);(0,W.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){s(`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{s(``)}}},f=async()=>{if(n?.uninstallCli){s(`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{s(``)}}},m=u&&!r,h=u?m?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,G.jsxs)(q,{className:`[padding:18px] cli-settings-card`,children:[(0,G.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,G.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,G.jsx)(en,{size:19})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{children:t(`config:cliSettings.title`)}),(0,G.jsx)(`p`,{children:t(`config:cliSettings.description`)})]}),(0,G.jsx)(Y,{tone:r?.installed&&!r.needsRepair?`green`:r?.needsRepair?`blue`:`gray`,children:h})]}),r&&(0,G.jsxs)(H,{className:`[margin-top:15px] cli-settings-status [&_small]:[overflow-wrap:anywhere]`,children:[r.installed&&!r.needsRepair?(0,G.jsx)(pe,{size:16}):(0,G.jsx)(en,{size:16}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{children:r.installed?t(`config:cliSettings.commandReady`,{command:r.command}):t(`config:cliSettings.commandNotInstalled`,{command:r.command})}),(0,G.jsx)(`small`,{children:r.installPath}),r.installed&&(0,G.jsx)(`small`,{children:r.pathConfigured?t(`config:cliSettings.pathConfigured`):t(`config:cliSettings.pathNeedsRepair`)})]})]}),c&&(0,G.jsx)(Ee,{children:c}),u&&(0,G.jsxs)(`div`,{className:`mt-3.5 flex justify-end gap-2 max-[650px]:flex-wrap`,children:[r?.installed&&(0,G.jsxs)(o,{type:`button`,variant:`outline`,size:`lg`,className:`bg-surface-subtle`,disabled:!!a,onClick:()=>void f(),children:[a===`uninstall`?(0,G.jsx)(R,{className:`animate-spin`,size:14}):(0,G.jsx)(I,{size:14}),t(`config:cliSettings.uninstall`)]}),(!r?.installed||r.needsRepair)&&(0,G.jsxs)(o,{type:`button`,size:`lg`,disabled:!!a||m||r?.supported===!1,onClick:()=>void d(),children:[a===`install`?(0,G.jsx)(R,{className:`animate-spin`,size:14}):r?.needsRepair?(0,G.jsx)(ee,{size:14}):(0,G.jsx)(fe,{size:14}),r?.needsRepair?t(`config:cliSettings.repair`):t(`config:cliSettings.install`)]})]}),u&&(0,G.jsx)(`small`,{className:`block [margin:9px_1px_0] text-[var(--text-muted)] text-[12px]`,children:t(`config:cliSettings.restartTerminal`)})]})}var wr=`0.5.19`,Tr=9e5,Er=2592e6;function Dr(){try{let e=JSON.parse(localStorage.getItem(i.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 Or(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 kr(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 Ar({notify:e,update:t}){let{t:n,language:r}=p(),a=t?.info||{desktop:!1,packaged:!1,version:wr,platform:`browser`,arch:``},s=t?.status||{state:`idle`},c=!!a.desktop,l=!!a.mobile,u=c||l,[d,f]=(0,W.useState)({version:wr,date:``,notes:``}),[m,h]=(0,W.useState)([]),[g,_]=(0,W.useState)(``),[v,y]=(0,W.useState)(Dr);(0,W.useEffect)(()=>{let e=!0;return fetch(`/release-notes.json`,{cache:`no-store`}).then(e=>e.ok?e.json():null).then(t=>{e&&t&&f(t)}).catch(()=>{}),()=>{e=!1}},[]),(0,W.useEffect)(()=>{let e=!0,t=(t=!1)=>z(`/api/sponsors/settings-updates?locale=${encodeURIComponent(r)}${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),Tr);return()=>{e=!1,window.clearInterval(n)}},[r]);let x=e=>{let t={...v,[e]:Date.now()+Er};y(t);try{localStorage.setItem(i.sponsorDismissals,JSON.stringify(t))}catch{}},S=async()=>{if(t){_(`check`);try{await t.check()}finally{_(``)}}},w=()=>t?.openReleases(),T=()=>t?.openUpdateLog?.(),E=async()=>{_(c?`install`:``);try{c?await t?.installComponents():await t?.download()}catch(t){e(t instanceof Error?t.message:String(t),`error`)}finally{_(``)}},D=()=>t?.install(),O=d.version===a.version?d:null,k=s.notes||(u?O?.notes||n(`config:updateSettings.noReleaseNotesAreAvailableForThisVersion`):s.state===`current`?n(`config:updateSettings.theCurrentWebSourceIsSyncedWithBranch`,{branch:s.branch||`main`}):n(`config:updateSettings.commitsThatHaveNotBeenSyncedWillAppearHereAfterTheCheck`)),A=s.state===`available`,j=s.state===`error`&&s.canResume&&s.canDownload,M=s.state===`downloaded`,N=s.state===`checking`||g===`check`,P=s.state===`downloading`||g===`install`,I=N?`checking`:P?`downloading`:s.state,ee=u?`v${a.version}`:`v${a.version}${s.currentCommit?` · ${s.currentCommit.slice(0,7)}`:``}`,te=u?`v${s.availableVersion||O?.version||a.version}`:s.availableCommit?.slice(0,7)||s.currentCommit?.slice(0,7)||d.version||a.version,ne=m.filter(e=>(v[e.id]||0)<=Date.now()),re=(0,W.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]),ie=(0,W.useMemo)(()=>({idle:[n(`config:updateSettings.notChecked`),`gray`],checking:[n(`config:updateSettings.checking`),`blue`],current:[n(`config:updateSettings.upToDate`),`green`],available:[n(u?`config:updateSettings.updateAvailable`:`config:updateSettings.sourceUpdatesAvailable`),`blue`],downloading:[n(`config:updateSettings.downloading`),`blue`],downloaded:[n(`config:updateSettings.readyToRestart`),`green`],installed:[n(`config:updateSettings.upToDate`),`green`],error:[n(j?`config:updateSettings.downloadPaused`:`config:updateSettings.checkFailed`),`red`]})[I]||[n(`config:updateSettings.notChecked`),`gray`],[u,I,j,n]);return(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[880px] flex-col gap-3`,children:[(0,G.jsxs)(q,{className:`p-5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,G.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,G.jsx)(Gt,{size:19})}),(0,G.jsx)(`span`,{className:`min-w-0`,children:(0,G.jsx)(`strong`,{className:`block text-[16px]`,children:n(`config:updateSettings.pisperAppUpdates`)})})]}),(0,G.jsx)(Y,{tone:ie[1],children:ie[0]})]}),(0,G.jsxs)(`div`,{className:`mt-5 grid gap-2 sm:grid-cols-3`,children:[(0,G.jsxs)(`div`,{className:`rounded-[var(--r-sm)] bg-[var(--surface-muted)] p-3`,children:[(0,G.jsx)(`small`,{className:`text-[12px] text-[var(--text-muted)]`,children:n(u?`config:updateSettings.currentVersion`:`config:updateSettings.currentSource`)}),(0,G.jsx)(`strong`,{className:`mt-1 block font-mono text-[14px]`,children:ee})]}),(0,G.jsxs)(`div`,{className:`rounded-[var(--r-sm)] bg-[var(--surface-muted)] p-3`,children:[(0,G.jsx)(`small`,{className:`text-[12px] text-[var(--text-muted)]`,children:n(`config:updateSettings.platform`)}),(0,G.jsx)(`strong`,{className:`mt-1 block text-[14px]`,children:Or(a,n)})]}),(0,G.jsxs)(`div`,{className:`rounded-[var(--r-sm)] bg-[var(--surface-muted)] p-3`,children:[(0,G.jsx)(`small`,{className:`text-[12px] text-[var(--text-muted)]`,children:n(`config:updateSettings.updateChannel`)}),(0,G.jsx)(`strong`,{className:`mt-1 block text-[14px]`,children:u?`Stable`:s.branch||`main`})]})]}),s.message&&(0,G.jsxs)(`div`,{className:`mt-4 flex items-start gap-2 rounded-[var(--r-sm)] p-3 text-[13px] ${s.state===`error`?`bg-[var(--danger-soft)] text-[var(--danger)]`:`bg-[var(--accent-soft)] text-[var(--text)]`}`,children:[s.state===`error`?(0,G.jsx)(V,{className:`mt-0.5 shrink-0`,size:15}):(0,G.jsx)(Wt,{className:`mt-0.5 shrink-0`,size:15}),(0,G.jsx)(`span`,{children:s.message})]}),j&&(0,G.jsx)(`small`,{className:`mt-2 block text-[12px] text-[var(--text-muted)]`,children:n(`config:updateSettings.downloadedDataWasPreservedAndCanResumeFromTheInterruptionPoint`)}),P&&(0,G.jsxs)(`div`,{className:`mt-4`,children:[(0,G.jsxs)(`div`,{className:`flex justify-between text-[12px] text-[var(--text-muted)]`,children:[(0,G.jsx)(`span`,{children:n(`config:updateSettings.downloadProgress`)}),(0,G.jsxs)(`span`,{children:[Math.round(s.percent||0),`% · `,kr(s.transferred,r),` /`,` `,kr(s.total,r)]})]}),(0,G.jsx)(`div`,{className:`mt-2 h-1.5 overflow-hidden rounded-full bg-[var(--progress-track)]`,children:(0,G.jsx)(`i`,{className:`block h-full bg-[var(--star)] transition-[width]`,style:{width:`${s.percent||0}%`}})})]}),(0,G.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[(0,G.jsxs)(o,{size:`lg`,disabled:N||P||!!g,onClick:M?D:A||j?E:S,children:[N||P?(0,G.jsx)(R,{className:`animate-spin`,size:14}):M?(0,G.jsx)(ce,{size:14}):A||j?s.canDownload?(0,G.jsx)(fe,{size:14}):(0,G.jsx)(ue,{size:14}):(0,G.jsx)(R,{size:14}),N||P?n(P&&c?`config:updateSettings.installingUpdates`:`config:updateSettings.checking2`):M?n(`config:updateSettings.restartAndInstall`):j?n(`config:updateSettings.resumeDownload`):A?s.canDownload?n(c?`config:updateSettings.downloadAndInstallUpdates`:`config:updateSettings.downloadUpdate`):n(u?`config:updateSettings.viewRelease`:`config:updateSettings.viewSourceUpdates`):n(`config:updateSettings.checkForUpdates`)]}),(0,G.jsxs)(o,{variant:`outline`,size:`lg`,className:`bg-surface-subtle`,onClick:w,children:[(0,G.jsx)(ue,{size:14}),u?`GitHub Releases`:`GitHub Compare`]}),c&&(0,G.jsxs)(o,{variant:`outline`,size:`lg`,className:`bg-surface-subtle`,onClick:T,children:[(0,G.jsx)(ue,{size:14}),n(`config:updateSettings.viewUpdateDiagnosticLog`)]})]}),!l&&(0,G.jsxs)(`div`,{className:`mt-6 border-t border-[var(--border)] pt-5`,children:[(0,G.jsx)(J,{title:n(`config:updateSettings.appComponents`)}),(0,G.jsx)(`div`,{className:`mt-3 divide-y divide-[var(--border)]`,children:re.map(e=>{let t=e.component===`desktop`?Wt:e.component===`tui`?F:zt,i=e.component===`desktop`?n(`config:updateSettings.desktopFrontend`):e.component===`tui`?n(`config:updateSettings.tuiClient`):n(`config:updateSettings.runtime`),a=e.state===`error`?`red`:e.state===`available`?`blue`:e.state===`installed`||e.state===`current`?`green`:`gray`,o=e.state===`checking`?n(`config:updateSettings.checking`):e.state===`downloading`?n(`config:updateSettings.downloading`):e.state===`available`?n(`config:updateSettings.updateAvailable`):e.state===`installed`?n(`config:updateSettings.installed`):e.state===`error`?n(`config:updateSettings.checkFailed`):e.state===`current`?n(`config:updateSettings.upToDate`):n(`config:updateSettings.notChecked`);return(0,G.jsxs)(`div`,{className:`grid min-h-[68px] items-center gap-3 py-3 sm:grid-cols-[minmax(0,1fr)_auto_auto]`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,G.jsx)(t,{className:`shrink-0 text-[var(--text-muted)]`,size:17}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`strong`,{className:`block text-[14px]`,children:i}),e.message&&(0,G.jsx)(`small`,{className:`mt-0.5 block text-[12px] text-[var(--text-muted)]`,children:e.message})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 font-mono text-[12px]`,children:[(0,G.jsxs)(`span`,{children:[`v`,e.currentVersion]}),e.availableVersion&&e.availableVersion!==e.currentVersion&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(b,{size:12}),(0,G.jsxs)(`span`,{children:[`v`,e.availableVersion]})]}),e.size>0&&e.state===`available`&&(0,G.jsx)(`span`,{className:`font-sans text-[var(--text-muted)]`,children:kr(e.size,r)})]}),(0,G.jsx)(Y,{tone:a,children:o})]},e.component)})})]})]}),!l&&(0,G.jsx)(Cr,{notify:e}),(0,G.jsxs)(q,{className:`p-5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsx)(J,{title:n(u?A||j||M||P?`config:updateSettings.newVersionReleaseNotes`:`config:updateSettings.currentReleaseNotes`:A?`config:updateSettings.commitsToSync`:`config:updateSettings.currentSourceStatus`)}),(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[12px] text-[var(--text-muted)]`,children:[(0,G.jsx)(pe,{size:13}),A||j||M||P?te:u?`v${O?.version||a.version}`:s.currentCommit?.slice(0,7)||n(`config:updateSettings.notChecked`)]})]}),(s.releaseDate||u&&O?.date)&&(0,G.jsx)(`small`,{className:`mt-2 block text-[12px] text-[var(--text-muted)]`,children:new Intl.DateTimeFormat(r,{dateStyle:`long`}).format(new Date(s.releaseDate||O?.date||``))}),(0,G.jsx)(`div`,{className:`mt-4 rounded-[var(--r-sm)] border border-[var(--stroke-soft)] bg-[var(--surface-subtle)] p-4`,children:(0,G.jsx)(C,{children:k})})]}),ne.length>0&&(0,G.jsxs)(q,{className:`p-5`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,G.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,G.jsx)(Vt,{size:19})}),(0,G.jsxs)(`span`,{className:`min-w-0`,children:[(0,G.jsx)(J,{title:n(`config:updateSettings.sponsors`)}),(0,G.jsx)(`small`,{className:`mt-1 block text-[12px] leading-5 text-[var(--text-muted)]`,children:n(`config:updateSettings.sponsorsDescription`)})]})]}),(0,G.jsx)(`div`,{className:`mt-4 divide-y divide-[var(--stroke-soft)] border-y border-[var(--stroke-soft)]`,children:ne.map(e=>(0,G.jsxs)(`div`,{className:`grid min-h-16 grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-3 py-3`,children:[(0,G.jsxs)(`span`,{className:`min-w-0`,children:[(0,G.jsxs)(`span`,{className:`mb-1 flex items-center gap-2`,children:[(0,G.jsx)(`strong`,{className:`truncate text-[14px]`,children:e.name}),(0,G.jsx)(Y,{tone:`gray`,children:n(`config:updateSettings.sponsored`)})]}),(0,G.jsx)(`small`,{className:`block text-[12px] leading-5 text-[var(--text-muted)]`,children:e.description})]}),(0,G.jsx)(o,{asChild:!0,variant:`outline`,className:`bg-surface-subtle`,children:(0,G.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer sponsored`,children:[(0,G.jsx)(ue,{size:13}),n(`config:updateSettings.visitSponsor`)]})}),(0,G.jsx)(o,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0`,"aria-label":n(`config:updateSettings.hideSponsor`),title:n(`config:updateSettings.hideSponsor`),onClick:()=>x(e.id),children:(0,G.jsx)(we,{size:15})})]},e.id))})]})]})}function jr({notify:e,registerPrimaryAction:t,section:n,onBrowserNotificationChange:r,requestConfirm:i,update:a}){let o;return o=n===`notifications`?(0,G.jsx)(br,{notify:e,onBrowserNotificationChange:r}):n===`interface`?(0,G.jsx)(yn,{notify:e}):n===`desktop-pet`?(0,G.jsx)(fn,{notify:e,requestConfirm:i}):n===`mobile-server`?(0,G.jsx)(dr,{}):n===`remote-access`?(0,G.jsx)(Sr,{notify:e}):n===`updates`?(0,G.jsx)(Ar,{notify:e,update:a}):n===`about`?(0,G.jsx)(ln,{update:a}):(0,G.jsx)(Jn,{notify:e,registerPrimaryAction:t,requestConfirm:i}),o}export{jr as ConfigPage};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,t as n}from"./vendor-react-CHuvPdJE.js";import{n as r,t as i}from"./button-DzlQCSNK.js";import{t as a}from"./use-i18n-DmLwOjO5.js";import{n as o}from"./AppSelect-g6etLk2g.js";import{t as s}from"./utils-C8uzG5AZ.js";import{t as c}from"./copy-DO0sQBgx.js";import{n as l,t as u}from"./vendor-markdown-plugins-DCl4I7Pz.js";import{i as d,n as f,r as p,t as m}from"./vendor-markdown-CWK5AVhB.js";import{n as h,r as g,t as _}from"./vendor-shiki-runtime-CxE5QolQ.js";var v=r(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),y=r(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),b=r(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),x=e(t(),1),S=[`github-dark`,`github-dark`],ee=150,C=new Set([`text`,`txt`,`plain`,`plaintext`]),w=new Map;for(let e of h){w.set(e.id,e.id);for(let t of e.aliases??[])w.set(t,e.id)}function T(e){return typeof e==`string`?e:e.name??`custom`}function E(e){let t=String(e||``).trim().toLowerCase();return w.get(t)??`text`}function D(e,t,n){return`${t}:${T(n[0])}:${T(n[1])}:${e.length}:${e.slice(0,64)}:${e.slice(-64)}`}var O=new Map;function k(e){let t=O.get(e);return t&&(O.delete(e),O.set(e,t)),t}function A(e,t){for(O.delete(e),O.set(e,t);O.size>ee;){let e=O.keys().next().value;if(e===void 0)break;O.delete(e)}}var j=null,M=new Map;function N(){return j??=g({themes:[...S],langs:[],engine:_({forgiving:!0})}),j}function P(e,t){if(C.has(t)||e.getLoadedLanguages().includes(t))return Promise.resolve();let n=h.find(e=>e.id===t);if(!n)return Promise.resolve();let r=M.get(t);return r||(r=e.loadLanguage(()=>n.import().then(e=>e.default)).catch(e=>{throw M.delete(t),e}),M.set(t,r)),r}var F=new Map;function I(){return{name:`shiki`,type:`code-highlighter`,supportsLanguage(e){return w.has(String(e||``).trim().toLowerCase())},getSupportedLanguages(){return h.map(e=>e.id)},getThemes(){return S},highlight({code:e,language:t,themes:n},r){let i=E(t),a=D(e,i,n),o=k(a);if(o)return o;let s=F.get(a),c=!!s;return s||(s=new Set,F.set(a,s)),r&&s.add(r),c||(async()=>{try{let t=await N();await P(t,i);let r=t.getLoadedLanguages().includes(i)?i:`text`,o=t.codeToTokens(e,{lang:r,themes:{light:n[0],dark:n[1]}});A(a,o);let s=F.get(a);if(F.delete(a),s)for(let e of s)e(o)}catch(e){F.delete(a),console.error(`[streamdown] Failed to highlight code:`,e)}})(),null}}}var L=I(),R={cjk:l,code:L,math:u};function te(){let e=``,t=[];return n=>{if(n===e)return t;if(t.length>0&&n.startsWith(e)){let r=t[t.length-1],i=e.length-r.length,a=f(n.slice(i)),o=[...t.slice(0,-1),...a];return e=n,t=o,o}return e=n,t=f(n),t}}var z=n(),B={a:K,code:Q,img:q,strong:J,table:Y},V=!1,H={linkMode:`text-only`};function U(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(U).join(``):(0,x.isValidElement)(e)?U(e.props.children):``}function W(e){return String(e||``).match(/language-([\w-]+)/)?.[1]||`text`}function G(e){if(navigator.clipboard?.writeText)return navigator.clipboard.writeText(e);let t=document.createElement(`textarea`);return t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.append(t),t.select(),document.execCommand(`copy`),t.remove(),Promise.resolve()}function K({children:e,node:t,className:n,href:r,...i}){let a=U(e).trim()?e:r;return r?(0,z.jsx)(`a`,{...i,className:s(`markdown-link`,n),href:r,target:`_blank`,rel:`noopener noreferrer`,children:a}):(0,z.jsx)(`span`,{className:s(`markdown-link`,n),children:a})}function q({node:e,...t}){return(0,z.jsx)(`img`,{loading:`lazy`,...t})}function J({node:e,...t}){return(0,z.jsx)(`strong`,{...t})}function Y({node:e,...t}){return(0,z.jsx)(`table`,{...t})}function X({source:e}){let{t}=a(),[n,r]=(0,x.useState)(!1);return(0,z.jsxs)(i,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 gap-1 px-[7px] text-[11px] font-bold text-[var(--code-toolbar-text)] hover:bg-white/10 hover:text-[var(--code-toolbar-text)]`,"data-streamdown":`code-block-copy-button`,onClick:async()=>{try{await G(e),r(!0),window.setTimeout(()=>r(!1),1800)}catch{r(!1)}},"aria-label":t(`common:markdownMessage.copyCode`),title:t(`common:markdownMessage.copyCode`),children:[n?(0,z.jsx)(o,{size:13}):(0,z.jsx)(c,{size:13}),t(n?`common:markdownMessage.copied`:`common:markdownMessage.copy`)]})}function Z({language:e,source:t}){return(0,z.jsxs)(`div`,{className:`my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2`,"data-incomplete":`true`,"data-language":e,"data-streamdown":`code-block`,style:{contentVisibility:`auto`,containIntrinsicSize:`auto 200px`},children:[(0,z.jsxs)(`div`,{className:`flex h-8 items-center justify-between text-muted-foreground text-xs`,"data-language":e,"data-streamdown":`code-block-header`,children:[(0,z.jsx)(`span`,{className:`ml-1 font-mono lowercase`,children:e}),(0,z.jsx)(X,{source:t})]}),(0,z.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border bg-background p-4 text-sm`,"data-language":e,"data-streamdown":`code-block-body`,children:(0,z.jsx)(`pre`,{className:`bg-transparent`,children:(0,z.jsx)(`code`,{children:t})})})]})}function Q({children:e,className:t,node:n,...r}){let i=d();if(!Object.hasOwn(r,`data-block`))return(0,z.jsx)(`code`,{className:t||``,...r,children:e});let a=U(e).replace(/\n$/,``),o=W(t);return i?(0,z.jsx)(Z,{language:o,source:a}):(0,z.jsx)(p,{code:a,isIncomplete:i,language:o,lineNumbers:!1,children:(0,z.jsx)(X,{source:a})})}function ne({children:e,className:t,streaming:n=!1}){let r=String(e??``),[i]=(0,x.useState)(()=>te());return(0,z.jsx)(`div`,{className:s(`markdown-body`,n&&`markdown-streaming`,t),"aria-busy":n||void 0,children:(0,z.jsx)(m,{className:`markdown-content space-y-0`,components:B,controls:V,isAnimating:n,lineNumbers:!1,mode:`streaming`,parseMarkdownIntoBlocksFn:i,plugins:R,remend:H,children:r})})}var $=(0,x.memo)(ne);$.displayName=`MarkdownMessage`;export{v as i,b as n,y as r,$ as t};
|