pisper 0.5.7-linux-x64.0 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +226 -0
- package/README.md +88 -88
- 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 +2229 -0
- package/web/assets/AnimatedContent-BiVNqD3m.js +1 -0
- package/web/assets/AnimatedList-D6P3Wwa6.js +1 -0
- package/web/assets/AppOverlays-Bo-73s-n.js +1 -0
- package/web/assets/AppSelect-l56OkqAr.js +1 -0
- package/web/assets/AssetsPage-CWh-uj58.js +1 -0
- package/web/assets/ChannelsPage-Cep_4I7t.js +1 -0
- package/web/assets/ChatHistoryPage-BlbsMb30.js +1 -0
- package/web/assets/ChatPage-le0nPcD1.js +9 -0
- package/web/assets/ClickSpark-BxLJ1PyT.js +1 -0
- package/web/assets/ConfigPage-BFIO2iP2.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-V5P_ju04.js +1 -0
- package/web/assets/MemoryPage-ChJiwiY2.js +1 -0
- package/web/assets/PageHeader-D4IcjMaf.js +1 -0
- package/web/assets/PluginsPage-Ddn4ddSH.js +1 -0
- package/web/assets/PreviewPages-QHVHP2Va.js +1 -0
- package/web/assets/SchedulesPage-CIVyEGxY.js +1 -0
- package/web/assets/ShinyText-K2BPzduJ.js +1 -0
- package/web/assets/SkillsPage-Bt8HOstx.js +1 -0
- package/web/assets/StarOrbit-BlI6MhVr.js +1 -0
- package/web/assets/TerminalPanel-BrP-ENHg.css +1 -0
- package/web/assets/TerminalPanel-aBx1dW6l.js +18 -0
- package/web/assets/Threads-CS40baGh.js +1 -0
- package/web/assets/WelcomeEffects-CcCmeYMZ.js +1 -0
- package/web/assets/WorkflowsPage-HlbVqL2p.js +1 -0
- package/web/assets/WorkspacePicker-DzA6j4ji.js +1 -0
- package/web/assets/alert-B7D8joCd.js +1 -0
- package/web/assets/alert-dialog-DkhscHhE.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-CDkfouZn.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-Cb6bnqQ4.js +1 -0
- package/web/assets/circle-dot-D28dfrea.js +1 -0
- package/web/assets/coffee-ouOQ86EC.js +1 -0
- package/web/assets/copy-BqjQWrFh.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-CQmH4pR0.js +1 -0
- package/web/assets/dist-UAxlPNGL.js +1 -0
- package/web/assets/dracula-BHWKrbxM.js +1 -0
- package/web/assets/dracula-soft-5eyTD99u.js +1 -0
- package/web/assets/es2015-BHubIpKC.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-DqrpgISR.js +1 -0
- package/web/assets/file-D4w8IUw4.js +1 -0
- package/web/assets/file-code-corner-Dqjb0Cug.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-DfmT5l79.js +1 -0
- package/web/assets/imba-DsUTQ-LC.js +1 -0
- package/web/assets/index-CDLlUDfT.css +2 -0
- package/web/assets/index-D1NIRA25.js +10 -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-CDKitOSW.js +1 -0
- package/web/assets/loader-circle-XRCZj0q4.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-BW-CPcmG.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-KzJTl7t7.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-DByYVkbw.js +1 -0
- package/web/assets/paperclip-CI8irkCX.js +1 -0
- package/web/assets/pencil-C67WdsWU.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-CRwfAjca.js +1 -0
- package/web/assets/poimandres-DRFjx7u4.js +1 -0
- package/web/assets/postcss-BXeXVLqQ.js +1 -0
- package/web/assets/progress-Bhpb60DH.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-BFnYwuxx.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-DAkFWHyI.js +1 -0
- package/web/assets/scss-Davl4E3T.js +1 -0
- package/web/assets/search-CAq4c_43.js +1 -0
- package/web/assets/shellscript-CLZ0U2zV.js +1 -0
- package/web/assets/shield-check-C62jDUnP.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-D2anbrZz.js +1 -0
- package/web/assets/square-terminal-Pww63y-M.js +1 -0
- package/web/assets/stylus-B6D30XZt.js +1 -0
- package/web/assets/svelte-BfstjgUc.js +1 -0
- package/web/assets/synthwave-84-nFMaYfgc.js +1 -0
- package/web/assets/tag-CqZUIGvX.js +1 -0
- package/web/assets/tokyo-night-oM2G3aXe.js +1 -0
- package/web/assets/trash-2-CsljwZ9-.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-D_qTnnhp.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-BIgib2eu.js +1 -0
- package/web/assets/xml-CNfvW5JP.js +1 -0
- package/web/assets/yaml-rwi0_p6S.js +1 -0
- package/web/assets/zap-evw8kNGN.js +1 -0
- package/web/favicon.svg +25 -0
- package/web/icons.svg +24 -0
- package/web/index.html +54 -0
- package/web/memory-galaxy-background.webp +0 -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.7_linux_x86_64.tar.gz +0 -0
- package/components/runtime/Pisper_Runtime_Node_0.5.7_linux_x86_64.tar.gz.sig +0 -1
- package/components/tui/Pisper_TUI_Component_0.5.5_linux_x86_64.tar.gz +0 -0
- package/components/tui/Pisper_TUI_Component_0.5.5_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-CDkfouZn.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-D_qTnnhp.js";import{i as h,n as g,r as _,t as v}from"./AppSelect-l56OkqAr.js";import{t as y}from"./utils-C8uzG5AZ.js";import{n as b,r as x,t as S}from"./MarkdownMessage-V5P_ju04.js";import{t as C}from"./chevron-down-Cb6bnqQ4.js";import{n as w}from"./copy-BqjQWrFh.js";import{t as T}from"./network-KzJTl7t7.js";import{t as E}from"./save-DAkFWHyI.js";import{t as D}from"./search-CAq4c_43.js";import{t as O}from"./shield-check-C62jDUnP.js";import{t as ee}from"./square-terminal-Pww63y-M.js";import{t as k}from"./trash-2-CsljwZ9-.js";import{t as A}from"./wrench-BIgib2eu.js";import{t as j}from"./zap-evw8kNGN.js";import{Ct as M,Dt as N,Gt as P,L as F,Ot as I,S as te,Tt as L,Wt as R,_t as z,a as B,b as ne,ft as V,gt as re,ht as ie,i as H,kt as ae,l as oe,n as se,o as ce,pt as le,r as ue,s as de,t as fe,ut as pe,v as me,vt as he,wt as ge,x as _e,y as ve}from"./index-D1NIRA25.js";import{t as U}from"./field-DqrpgISR.js";import{t as ye}from"./usePagePrimaryAction-Bw0OFTDZ.js";import{n as be}from"./brand-CFOXmGdd.js";var W=e(t(),1),G=n(),xe=Object.defineProperty,K=(e,t)=>xe(e,`name`,{value:t,configurable:!0}),Se=[`PageUp`,`PageDown`],Ce=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],we={"from-left":[`Home`,`PageDown`,`ArrowDown`,`ArrowLeft`],"from-right":[`Home`,`PageDown`,`ArrowDown`,`ArrowRight`],"from-bottom":[`Home`,`PageDown`,`ArrowDown`,`ArrowLeft`],"from-top":[`Home`,`PageDown`,`ArrowUp`,`ArrowLeft`]},Te=`Slider`,[Ee,De,Oe]=P(Te),[ke,Ae]=l(Te,[Oe]),[je,Me]=ke(Te),Ne=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`?Ie:Le,[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`)}),ee=W.useRef(D),k=W.useRef(D);W.useEffect(()=>{let e=v?w?.ownerDocument.getElementById(v):w?.closest(`form`);if(e instanceof HTMLFormElement){let t=K(()=>O(k.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[w,v,O]);function A(e){N(e,tt(D,e))}K(A,`handleSlideStart`);function j(e){N(e,x.current)}K(j,`handleSlideMove`);function M(){String(D)!==String(ee.current)&&h(D)}K(M,`handleSlideEnd`);function N(e,t,{commit:n}={commit:!1}){let a=ot(o),s=st(Math.round((e-r)/o)*o+r,a),c=_(s,[r,i]);O((e=[])=>{let r=Qe(e,c,t);if(it(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(N,`updateValues`),(0,G.jsx)(je,{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)(Ee.Provider,{scope:e.__scopeSlider,children:(0,G.jsx)(Ee.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||(ee.current=D,S.current=!1)}),min:r,max:i,inverted:g,onSlideStart:l?void 0:A,onSlideMove:l?void 0:j,onSlideEnd:l?void 0:M,onHomeKeyDown:()=>{l||(S.current=!0,N(r,0,{commit:!0}))},onEndKeyDown:()=>{l||(S.current=!0,N(i,D.length-1,{commit:!0}))},onStepKeyDown:({event:e,direction:t})=>{if(!l){S.current=!0;let n=Se.includes(e.key)||e.shiftKey&&Ce.includes(e.key)?10:1,i=x.current,a=D[i];N(ct(a,{min:r,step:o,direction:t,multiplier:n}),i,{commit:!0})}}})})})})},`Slider`)),[Pe,Fe]=ke(Te,{startEdge:`left`,endEdge:`right`,size:`width`,direction:1}),Ie=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=R(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)(Pe,{scope:e.__scopeSlider,startEdge:v?`left`:`right`,endEdge:v?`right`:`left`,direction:v?1:-1,size:`width`,children:(0,G.jsx)(Re,{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=we[v?`from-left`:`from-right`].includes(e.key);u?.({event:e,direction:t?-1:1})}})})},`SliderHorizontal`)),Le=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)(Pe,{scope:e.__scopeSlider,startEdge:m?`bottom`:`top`,endEdge:m?`top`:`bottom`,size:`height`,direction:m?1:-1,children:(0,G.jsx)(Re,{"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=we[m?`from-bottom`:`from-top`].includes(e.key);l?.({event:e,direction:t?-1:1})}})})},`SliderVertical`)),Re=W.forwardRef(K(function(e,t){let{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:a,onHomeKeyDown:o,onEndKeyDown:s,onStepKeyDown:l,...d}=e,f=Me(Te,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()):Se.concat(Ce).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`)),ze=`SliderTrack`,Be=W.forwardRef(K(function(e,t){let{__scopeSlider:n,...r}=e,i=Me(ze,n);return(0,G.jsx)(c.span,{"data-disabled":i.disabled?``:void 0,"data-orientation":i.orientation,...r,ref:t})},`SliderTrack`)),Ve=`SliderRange`,He=W.forwardRef(K(function(e,t){let{__scopeSlider:n,...r}=e,i=Me(Ve,n),o=Fe(Ve,n),s=W.useRef(null),l=a(t,s),u=i.values.length,d=i.values.map(e=>$e(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`)),[Ue,We]=ke(`SliderThumb`),Ge=`SliderThumbProvider`;function Ke(e){let{__scopeSlider:t,name:n,children:r,internal_do_not_use_render:i}=e,a=Me(Ge,t),o=De(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:$e(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)(Ue,{scope:t,...g,children:lt(i)?i(g):r})}K(Ke,`SliderThumbProvider`);var qe=`SliderThumbTrigger`,Je=W.forwardRef(K(function(e,t){let{__scopeSlider:n,...r}=e,i=Me(qe,n),o=Fe(qe,n),{index:s,value:l,percent:d,size:f,onThumbChange:p}=We(qe,n),m=a(t,p),h=et(s,i.values.length),g=f?.[o.size],_=g?nt(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)(Ee.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`)),Ye=W.forwardRef(K(function(e,t){let{__scopeSlider:n,name:r,...i}=e;return(0,G.jsx)(Ke,{__scopeSlider:n,name:r,internal_do_not_use_render:({index:e,isFormControl:r})=>(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Je,{...i,ref:t,__scopeSlider:n}),r?(0,G.jsx)(Ze,{__scopeSlider:n},e):null]})})},`SliderThumb`)),Xe=`SliderBubbleInput`,Ze=W.forwardRef(K(function({__scopeSlider:e,...t},n){let{value:r,name:i,form:o}=We(Xe,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 Qe(e=[],t,n){let r=[...e];return r[n]=t,r.sort((e,t)=>e-t)}K(Qe,`getNextSortedValues`);function $e(e,t,n){let r=100/(n-t)*(e-t);return _(r,[0,100])}K($e,`convertValueToPercentage`);function et(e,t){if(t>2)return`Value ${e+1} of ${t}`;if(t===2)return[`Minimum`,`Maximum`][e]}K(et,`getLabel`);function tt(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(tt,`getClosestValueIndex`);function nt(e,t,n){let r=e/2;return(r-at([0,50],[0,r])(t)*n)*n}K(nt,`getThumbInBoundsOffset`);function rt(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}K(rt,`getStepsBetweenValues`);function it(e,t){if(t>0){let n=rt(e);return Math.min(...n)>=t}return!0}K(it,`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 ot(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(ot,`getDecimalCount`);function st(e,t){let n=10**t;return Math.round(e*n)/n}K(st,`roundValue`);function ct(e,{min:t,step:n,direction:r,multiplier:i}){let a=ot(n),o=(e-t)/n,s=Math.round(o),c=st(s*n+t,a)===st(e,a),l;return l=c?s+i*r:r>0?Math.ceil(o):Math.floor(o),st(l*n+t,a)}K(ct,`getNextStepValue`);function lt(e){return typeof e==`function`}K(lt,`isFunction`);var ut=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`}]]),dt=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`}]]),ft=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`}]]),pt=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`}]]),mt=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`}]]),ht=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`}]]),gt=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`}]]),_t=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`}]]),vt=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`}]]),yt=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`}]]),bt=r(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),xt=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=fe,J=ce,Y=oe;function X(e){return(0,G.jsx)(de,{density:`compact`,...e})}function St({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)(Ne,{"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)(Be,{"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)(He,{"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)(Ye,{"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 Ct(e){window.dispatchEvent(new CustomEvent(`pisper:desktop-pet-changed`,{detail:e}))}function wt({notify:e}){let{t}=p(),n=window.pisperDesktop,r=(0,W.useMemo)(()=>n?.getPetStatus?{getStatus:()=>n.getPetStatus(),setEnabled:e=>n.setPetEnabled(e),setOpacity:e=>n.setPetOpacity(e),search:e=>n.searchPets(e),install:e=>n.installPet(e),select:e=>n.selectPet(e),openCatalog:()=>void n.openPetdex?.()}:{getStatus:()=>F(`/api/desktop-pet`),setEnabled:e=>F(`/api/desktop-pet/enabled`,{method:`POST`,body:{enabled:e}}),setOpacity:e=>F(`/api/desktop-pet/opacity`,{method:`POST`,body:{opacity:e}}),search:e=>F(`/api/desktop-pet/catalog?query=${encodeURIComponent(e)}`),install:e=>F(`/api/desktop-pet/install`,{method:`POST`,body:{slug:e}}),select:e=>F(`/api/desktop-pet/select`,{method:`POST`,body:{slug:e}}),openCatalog:()=>window.open(`https://petdex.dev`,`_blank`,`noopener,noreferrer`)},[n]),[i,a]=(0,W.useState)(null),[s,c]=(0,W.useState)(``),[l,u]=(0,W.useState)([]),[d,f]=(0,W.useState)(``),[m,h]=(0,W.useState)(``),g=(0,W.useCallback)(async()=>{try{h(``),a(await r.getStatus())}catch(e){h(e instanceof Error?e.message:String(e))}},[r]),_=(0,W.useCallback)(async()=>{f(`search`);try{h(``),u(await r.search(s))}catch(e){h(e instanceof Error?e.message:String(e))}finally{f(``)}},[r,s]);(0,W.useEffect)(()=>{g(),r.search(``).then(u).catch(()=>{})},[r,g]);let v=async n=>{f(`toggle`);try{h(``);let i=await r.setEnabled(n);a(i),Ct(i),e(t(n?`config:desktopPetSettings.petEnabled`:`config:desktopPetSettings.petDisabled`))}catch(e){h(e instanceof Error?e.message:String(e))}finally{f(``)}},y=async e=>{f(`opacity`);try{h(``);let t=await r.setOpacity(e);a(t),Ct(t)}catch(e){h(e instanceof Error?e.message:String(e))}finally{f(``)}},b=async(n=s)=>{if(n.trim()){f(`install`);try{h(``);let i=await r.install(n);a(i),Ct(i),e(t(`config:desktopPetSettings.petInstalled`,{name:i.selectedName||n}))}catch(e){h(e instanceof Error?e.message:String(e))}finally{f(``)}}},x=async n=>{if(n!==i?.selectedSlug){f(`select:${n}`);try{h(``);let i=await r.select(n);a(i),Ct(i),e(t(`config:desktopPetSettings.petSelected`,{name:i.selectedName||n}))}catch(e){h(e instanceof Error?e.message:String(e))}finally{f(``)}}};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)(dt,{size:19})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{children:t(`config:desktopPetSettings.title`)}),(0,G.jsx)(`p`,{children:t(`config:desktopPetSettings.description`)})]})]}),i?(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)(dt,{size:18}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:t(`config:desktopPetSettings.showOnDesktop`)}),(0,G.jsx)(`small`,{children:i.selectedName?t(`config:desktopPetSettings.currentPet`,{name:i.selectedName}):t(`config:desktopPetSettings.installBeforeEnabling`)})]}),(0,G.jsx)(Y,{tone:i.running?`green`:`gray`,children:i.running?t(`config:desktopPetSettings.running`):t(`config:desktopPetSettings.stopped`)}),(0,G.jsx)(X,{value:i.enabled,disabled:d===`toggle`||!i.installed.length,onChange:v,ariaLabel:t(`config:desktopPetSettings.showOnDesktop`)})]}):(0,G.jsxs)(B,{className:`[margin-top:15px]`,children:[(0,G.jsx)(z,{className:`animate-spin`,size:16}),(0,G.jsx)(`span`,{children:t(`config:desktopPetSettings.loading`)})]}),i&&(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:t(`config:desktopPetSettings.opacity`)}),(0,G.jsxs)(`span`,{children:[Math.round((i.opacity??1)*100),`%`]})]}),(0,G.jsx)(St,{value:[Math.round((i.opacity??1)*100)],min:20,max:100,step:5,disabled:d===`opacity`,onValueCommit:([e])=>void y(e/100),"aria-label":t(`config:desktopPetSettings.opacity`)})]}),m&&(0,G.jsx)(`div`,{className:`text-[var(--danger)] text-[13px] mt-3`,children:m})]}),(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)(ge,{size:19})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{children:t(`config:desktopPetSettings.installTitle`)}),(0,G.jsx)(`p`,{children:t(`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:s,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&_()},placeholder:t(`config:desktopPetSettings.searchPlaceholder`),"aria-label":t(`config:desktopPetSettings.petSlug`)}),(0,G.jsxs)(o,{size:`lg`,className:`min-w-[104px]`,disabled:d===`search`,onClick:_,children:[d===`search`?(0,G.jsx)(z,{className:`animate-spin`,size:14}):(0,G.jsx)(D,{size:14}),t(`config:desktopPetSettings.search`)]})]}),l.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:l.map(e=>{let n=i?.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:d===`install`,onClick:()=>n?x(e.slug):b(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)(dt,{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:n?`green`:`blue`,children:t(n?`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:r.openCatalog,children:[(0,G.jsx)(M,{size:14}),t(`config:desktopPetSettings.browsePetdex`)]})})]}),i&&i.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)(dt,{size:19})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{children:t(`config:desktopPetSettings.installedTitle`)}),(0,G.jsx)(`p`,{children:t(`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:i.installed.map(e=>{let t=e.slug===i.selectedSlug;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)] ${t?`selected`:``}`,role:`radio`,"aria-checked":t,disabled:d===`select:${e.slug}`,onClick:()=>x(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)(dt,{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}:${e.slug}`)})})]})]})}function Tt(e,t){return t(e===`en-US`?`config:languageSettings.english`:`config:languageSettings.simplifiedChinese`)}function Et({notify:e}){let{language:t,setLanguage:n,t:r}=p(),i=me(e=>e.density),a=me(e=>e.setDensity),o=r=>{r!==t&&(n(r),e(f(r===`en-US`?`config:languageSettings.displayLanguageChangedToEnglish`:`config:languageSettings.displayLanguageChangedToSimplifiedChinese`,r)))},s=t=>{t!==i&&(a(t),e(r(`config:languageSettings.interfaceDensitySwitchedToDensity`,{density:r(t===`compact`?`config:languageSettings.compact`:`config:languageSettings.comfortable`)})))},c=[[`comfortable`,r(`config:languageSettings.comfortable`),r(`config:languageSettings.defaultSpacingAndSizing`),xt],[`compact`,r(`config:languageSettings.compact`),r(`config:languageSettings.fitMoreContentOnScreen`),mt]];return(0,G.jsxs)(`div`,{className:`flex w-[min(100%,_760px)] flex-col gap-[12px]`,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)(_t,{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:`language-choice-grid max-[650px]:grid-cols-[1fr] grid grid-cols-[repeat(2,_minmax(0,_1fr))] gap-[9px] [margin-top:18px]`,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:`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)] ${n?`selected`:``}`,role:`radio`,"aria-checked":n,onClick:()=>o(e.value),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] ${e.value===`en-US`?`english [.language-choice-mark&]:bg-[var(--brand-blue-soft)] [.language-choice-mark&]:text-[var(--brand-blue-strong)]`:``}`,children:e.shortName}),(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:Tt(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 w-[21px] h-[21px] place-items-center rounded-[50%] bg-[var(--star)] text-[var(--on-accent)]`,children:(0,G.jsx)(g,{size:15})})]},e.value)})}),(0,G.jsxs)(B,{className:`[margin-top:15px]`,children:[(0,G.jsx)(_t,{size:16}),(0,G.jsxs)(`span`,{children:[(0,G.jsxs)(`strong`,{children:[r(`config:languageSettings.currentLanguage`),` · `,Tt(t,r)]}),(0,G.jsx)(`small`,{children:r(`config:languageSettings.thisSettingChangesInterfaceTextOnlyItDoesNotControlTheLanguageOfAgentResponses`)})]})]}),(0,G.jsx)(`small`,{className:`block [margin:9px_1px_0] text-[var(--text-muted)] text-[12px]`,children:r(`config:languageSettings.languagePreferenceIsStoredInThisBrowser`)})]}),(0,G.jsxs)(q,{className:`[padding:18px] density-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]`,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)(mt,{size:19})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{children:r(`config:languageSettings.interfaceDensity`)}),(0,G.jsx)(`p`,{children:r(`config:languageSettings.adjustSpacingAndSizingCompactModeFitsMoreContentOnScreen`)})]})]}),(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]`,role:`radiogroup`,"aria-label":r(`config:languageSettings.interfaceDensity`),children:c.map(([e,t,n,r])=>{let a=e===i;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)] ${a?`selected`:``}`,role:`radio`,"aria-checked":a,onClick:()=>s(e),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)(r,{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:t}),(0,G.jsx)(`small`,{children:n})]}),a&&(0,G.jsx)(`span`,{className:`grid w-[21px] h-[21px] place-items-center rounded-[50%] bg-[var(--star)] text-[var(--on-accent)]`,children:(0,G.jsx)(g,{size:15})})]},e)})}),(0,G.jsxs)(B,{className:`[margin-top:15px]`,children:[(0,G.jsx)(mt,{size:16}),(0,G.jsxs)(`span`,{children:[(0,G.jsxs)(`strong`,{children:[r(`config:languageSettings.currentDensity`),` ·`,` `,r(i===`compact`?`config:languageSettings.compact`:`config:languageSettings.comfortable`)]}),(0,G.jsx)(`small`,{children:r(`config:languageSettings.thisSettingOnlyAffectsTheInterfaceInThisBrowser`)})]})]})]})]})}var Dt=[[`openai-responses`,`OpenAI Responses`],[`openai-completions`,`OpenAI Chat Completions`],[`anthropic-messages`,`Anthropic Messages`],[`google-generative-ai`,`Google Generative AI`]];function Ot({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)(se,{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.enabled?e.configured?`green`:`amber`:`gray`,children:e.enabled?e.configured?l(`config:configPage.authenticationReady`):l(u?`config:configPage.codexCLILoginRequired`:`config:configPage.apiKeyRequired`):l(`config:configPage.disabled2`)}),(0,G.jsx)(X,{value: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)(k,{size:14})})]})]}),(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`)})]}),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)(O,{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:[l(`config:configPage.apiProtocol`),(0,G.jsx)(v,{value:t.api,onChange:e=>i({api:e.target.value}),children:Dt.map(([e,t])=>(0,G.jsx)(`option`,{value:e,children:t},e))})]}),(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)(gt,{size:14})]})]}),(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`)})]})]})]})}var kt={openai:I,"openai-codex":I,anthropic:N,google:le,deepseek:w,xai:j,openrouter:T,"kimi-coding":le,"zai-coding-cn":N};function At({providers:e,selectedProviderId:t,toggling:n,onAdd:r,onSelect:i,onToggle:a}){let{t:s}=p();return(0,G.jsxs)(q,{className:`selection-list [.config-layout_>_&]:max-h-[calc(100dvh_-_280px)] [.config-layout_>_&]:overflow-y-auto max-[900px]:max-h-[300px] min-h-0 overflow-auto`,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:s(`config:configPage.providerConnections`)}),(0,G.jsx)(o,{variant:`ghost`,size:`icon`,title:s(`config:configPage.addProvider`),onClick:r,children:(0,G.jsx)(he,{size:15})})]}),e.map(e=>{let r=kt[e.id]||ie;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] ${t===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:()=>i(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)(r,{size:16})}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{children:e.name}),(0,G.jsxs)(`small`,{children:[e.id,` ·`,` `,s(`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.enabled,disabled:!e.configured||n===e.id,onChange:t=>a(e,t)})})]},e.id)})]})}function jt({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)(z,{size:13}),a(`config:configPage.fetchModels`)]}),(0,G.jsxs)(o,{variant:`outline`,className:`bg-surface-subtle`,onClick:()=>i(`manual`),children:[(0,G.jsx)(he,{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)(B,{children:[(0,G.jsx)(le,{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)(B,{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 Mt({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 F(`/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)(se,{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)(pe,{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:Dt.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)(H,{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)(z,{className:`animate-spin`,size:14}):(0,G.jsx)(he,{size:14}),n(a?`config:configPage.creating`:`config:configPage.createConnection`)]})]})]})})}function Nt({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)(``),ee=(0,W.useRef)(i);(0,W.useEffect)(()=>{ee.current=i},[i]);let k=t.api,A=t.providerType,j=t.baseUrl,M=t.apiKey,N=t.organization,P=(0,W.useCallback)(async()=>{b(!0),O(``);try{let t=await F(`/api/providers/${encodeURIComponent(e.id)}/models/discover`,{method:`POST`,body:JSON.stringify({providerType:A,api:k,baseUrl:j,apiKey:M,organization:N})});S(t.models||[]),w([]),t.config&&ee.current(t.config)}catch(e){O(e instanceof Error?e.message:String(e))}finally{b(!1)}},[k,M,j,N,A,e.id]);(0,W.useEffect)(()=>{n&&P()},[n,P]);let I=e=>{e.added||w(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},te=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 F(`/api/providers/${encodeURIComponent(e.id)}/models/batch`,{method:`POST`,body:JSON.stringify({models:t})}),C[0])}else a(await F(`/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)}},L=T.trim().toLowerCase(),R=x.filter(e=>!L||e.id.toLowerCase().includes(L)||e.name.toLowerCase().includes(L)),B=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:te,children:[(0,G.jsxs)(se,{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)(pe,{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:P,children:[y?(0,G.jsx)(z,{className:`animate-spin`,size:14}):(0,G.jsx)(z,{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:Dt.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:[R.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)}),!R.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:Dt.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)(H,{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||!B,children:[h?(0,G.jsx)(z,{className:`animate-spin`,size:14}):(0,G.jsx)(he,{size:14}),h?s(`config:configPage.adding`):C.length?s(`config:configPage.addCountModels`,{count:C.length}):s(`config:configPage.addModel`)]})]})]})})}function Pt(e){return(e.providers||[]).some(e=>e.importable&&!e.imported&&!e.conflict)}function Ft(e,t){return!t&&!Pt(e)}function It(e,t,n){let r=e.providers||[],i=e.errors||[],a=Pt(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 Lt(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 Rt(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 zt(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 Bt({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(!It(e,t,n))return null;let f=c??Ft(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)(ie,{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)(C,{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)(z,{className:`animate-spin`,size:13}):(0,G.jsx)(z,{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)(z,{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=Lt(e),n=r===e.id,i=e.source.startsWith(`claude-`)?N:I,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`),` `,`· `,Rt(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)(z,{className:`animate-spin`,size:12}):(0,G.jsx)(ge,{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)(ie,{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}),Lt(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}),Lt(e),` · `,zt(t.code,s)]},`${e.id}-${t.code}-${n}`)))]})]})]})}function Vt({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 Ht({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)(B,{children:[(0,G.jsx)(O,{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 Ut(e){let{t}=p();return(0,G.jsxs)(q,{children:[(0,G.jsx)(J,{title:t(`config:configPage.agentRuntimePolicy`)}),(0,G.jsx)(Vt,{...e}),(0,G.jsx)(Ht,{...e})]})}function Wt({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)(ft,{size:17}):(0,G.jsx)(L,{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)(O,{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)(z,{className:`animate-spin`,size:14}):(0,G.jsx)(E,{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)(H,{children:[(0,G.jsx)(V,{size:13}),a]})]})}function Gt({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:[be,` 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 Kt={config:null,draft:null,loading:!0,saving:!1,toggling:``,error:``,dirty:!1};function Z(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 qt(e,t){if(!t)return Z(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 Jt(e,t,n,r){return{...Z(e,t,r),thinkingLevel:n?.thinkingLevel||e.thinkingLevel||`medium`,toolMode:n?.toolMode||e.toolMode||`full`}}function Yt(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:Z(t.config,n,t.config.model),loading:!1,error:``,dirty:!1}}case`refresh-succeeded`:return{...e,config:t.config,draft:qt(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:{...Z(t.config,n,e.draft.model),thinkingLevel:e.draft.thinkingLevel,toolMode:e.draft.toolMode},error:``,dirty:!1}}}}function Q(e){return e instanceof Error?e.message:String(e)}function Xt({notify:e,requestConfirm:t,t:n}){let[r,i]=(0,W.useReducer)(Yt,Kt),a=(0,W.useRef)(null);(0,W.useEffect)(()=>{let e=!0;return F(`/api/config`).then(t=>{if(e)return i({type:`load-succeeded`,config:t}),F(`/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:Q(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:Jt(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 F(`/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:Q(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 F(`/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:Z(t,a,t.model),dirty:!1}),e(n(`config:configPage.providerConnectionDeleted`))}catch(e){i({type:`set-error`,value:Q(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 F(`/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:Q(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:Jt(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:Z(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={...Z(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 Zt({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 F(`/api/providers/discovery`))}catch(e){c(Q(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 F(`/api/providers/${encodeURIComponent(r.id)}/import`,{method:`POST`,body:`{}`});i(e.discovery),t(e)}catch(e){u(Q(e))}finally{f(``)}}},[t,e,n])}}function Qt({notify:e,registerPrimaryAction:t,requestConfirm:n}){let{t:r}=p(),[i,a]=(0,W.useState)(!1),[o,s]=(0,W.useState)(``),c=Xt({notify:e,requestConfirm:n,t:r}),l=Zt({requestConfirm:n,onImported:c.applyImportedProvider,t:r});if(ye(t,()=>a(!0)),!c.config||!c.draft||!c.selectedProvider)return(0,G.jsxs)(ue,{children:[(0,G.jsx)(z,{className:`animate-spin`,size:24}),(0,G.jsx)(`h2`,{children:r(`config:configPage.loadingModelCatalog`)}),(0,G.jsx)(`p`,{children:r(`config:configPage.readingProvidersAndAuthenticationStatus`)}),c.error&&(0,G.jsx)(H,{children:c.error})]});let{config:u,draft:d,selectedProvider:f}=c,m=d.providerType===`visual`,h=f.id===`openai-codex`;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Bt,{discovery:l.discovery,discovering:l.discovering,error:l.error||l.operationError,importing:l.importing,onRefresh:l.refresh,onImport:l.importProvider}),(0,G.jsxs)(`div`,{className:`split-list-detail grid min-h-[100%] grid-cols-[330px_minmax(0,1fr)] gap-[12px] max-[900px]:grid-cols-[1fr] config-layout !grid-cols-[300px_minmax(0,1fr)] [align-items:start]`,children:[(0,G.jsx)(At,{providers:u.providers,selectedProviderId:d.provider,toggling:c.toggling,onAdd:()=>a(!0),onSelect:c.selectProvider,onToggle:c.toggleProvider}),(0,G.jsxs)(`div`,{className:`detail-stack flex min-w-0 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]`,children:[(0,G.jsx)(Wt,{provider:f,visualOnly:m,codexOAuth:h,saving:c.saving,dirty:c.dirty,error:c.error,hasModel:!!d.model,isDefault:(u.defaultProvider||u.provider)===f.id&&(u.defaultModel||u.model)===d.model,onSave:c.save}),(0,G.jsx)(Ot,{provider:f,draft:d,toggling:c.toggling,apiKeyInputRef:c.apiKeyInputRef,onPatchDraft:c.patchDraft,onSelectProviderType:c.selectProviderType,onToggleProvider:c.toggleProvider,onDeleteProvider:c.deleteProvider}),(0,G.jsx)(q,{children:(0,G.jsx)(jt,{provider:f,draft:d,onPatchDraft:c.patchDraft,onSelectModel:c.selectModel,onOpenModelDialog:s})}),(0,G.jsxs)(`div`,{className:`config-bottom max-[900px]:grid-cols-[1fr] grid grid-cols-[minmax(0,1.5fr)_minmax(210px,.7fr)] gap-[12px]`,children:[(0,G.jsx)(Ut,{draft:d,onPatchDraft:c.patchDraft}),(0,G.jsx)(Gt,{provider:f})]})]})]}),i&&(0,G.jsx)(Mt,{onClose:()=>a(!1),onCreated:e=>{c.applyCreatedProvider(e),a(!1)}}),o&&(0,G.jsx)(Nt,{provider:{...f,type:d.providerType},connectionDraft:{providerType:d.providerType,api:d.api||f.api,baseUrl:d.baseUrl,apiKey:d.apiKey,organization:d.organization},autoDiscover:o===`discover`,onClose:()=>s(``),onSynchronized:c.applySynchronizedModels,onCreated:(e,t)=>{c.applyCreatedModels(e,f.id,t),s(``)}})]})}var $t={feishu:{tone:`blue`},weixin:{tone:`green`},browser:{tone:`blue`}};function en(e,t){return t(e===`feishu`?`config:notificationSettings.feishu`:e===`weixin`?`config:notificationSettings.weChat`:`config:notificationSettings.browserNotification`)}function tn(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 nn(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 rn(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 an(){return typeof window<`u`&&window.pisperDesktop?.showNotification?window.pisperDesktop.getNotificationStatus?`checking`:`granted`:ve()}function on(e,t){return t(e===`system-disabled`||e===`app-disabled`?`config:notificationSettings.systemNotificationsAreOffAllowPisperToSendNotificationsInYourOperatingSystemSettings`:e===`unsupported`?`config:notificationSettings.systemNotificationsAreNotSupportedInThisEnvironment`:`config:notificationSettings.theOperatingSystemDidNotAcceptTheNotificationCheckYourSystemNotificationSettings`)}function $(e){return e instanceof Error?e.message:String(e)}function sn({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,f]=(0,W.useState)(an),[m,h]=(0,W.useState)(!1),g=(0,W.useCallback)(async()=>{if(!u)return;let e=window.pisperDesktop?.getNotificationStatus;if(!e){f(`granted`);return}try{let t=await e(),n=t?.permission;f(n==="default"||n===`denied`||n===`granted`||n===`checking`||n===`unsupported`?n:t?.supported===!1?`unsupported`:`granted`)}catch{f(`unsupported`)}},[u]),_=(0,W.useCallback)(async()=>{try{l(``);let e=await F(`/api/settings/notifications`);i(e),t?.(e)}catch(e){l($(e))}finally{s(!1)}},[t]);(0,W.useEffect)(()=>{_()},[_]),(0,W.useEffect)(()=>{if(!u)return;g();let e=()=>{g()};return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[u,g]);let v=async r=>{if(r){if(d===`unsupported`){e(n(`config:notificationSettings.systemNotificationsAreNotSupportedInThisEnvironment`),`error`);return}if(u&&d!==`granted`){e(on(`system-disabled`,n),`error`);return}if(!u){let t=await _e();if(f(t),t!==`granted`){e(n(`config:notificationSettings.notificationPermissionWasNotGrantedAllowNotificationsInTheBrowserSiteSettings`),`error`);return}try{await ne()}catch(t){e($(t)||n(`config:notificationSettings.theBrowserBackgroundNotificationServiceCouldNotBeRegistered`),`error`);return}}}h(!0);try{let a=await F(`/api/settings/notifications/browser`,{method:`PATCH`,body:JSON.stringify({enabled:r})});i(a),t?.(a),e(n(r?`config:notificationSettings.notificationsEnabled`:`config:notificationSettings.notificationsDisabled`))}catch(t){e($(t),`error`)}finally{h(!1)}},y=(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 f(i.permission??`denied`),Error(on(i.reason,n));return i}return te({title:e,body:t,tag:r,url:window.location.href})},[u,n]),b=async()=>{if(d!==`granted`){e(d===`unsupported`?on(`unsupported`,n):u?on(`system-disabled`,n):n(`config:notificationSettings.notificationPermissionWasNotGrantedAllowNotificationsInTheBrowserSiteSettings`),`error`);return}try{await y(n(`config:notificationSettings.appNotificationTest`,{app:be}),n(`config:notificationSettings.notificationsAreWorking`)),e(n(`config:notificationSettings.theTestNotificationWasSentCheckYourSystemNotificationCenter`),`info`)}catch(t){e($(t)||n(`config:notificationSettings.theOperatingSystemDidNotAcceptTheNotificationCheckYourSystemNotificationSettings`),`error`)}},x=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)(ue,{children:[(0,G.jsx)(z,{className:`animate-spin`,size:23}),(0,G.jsx)(`h2`,{children:n(`config:notificationSettings.loadingNotificationSettings`)})]});let S=n(d===`granted`?`config:notificationSettings.permissionGranted`:d===`denied`?u?`config:notificationSettings.systemNotificationsAreOff`:`config:notificationSettings.browserNotificationsAreBlocked`:d===`unsupported`?`config:notificationSettings.notSupported`:d===`checking`?`config:notificationSettings.checking`:`config:notificationSettings.waitingForPermission`),C=d===`granted`?`green`:d==="default"||d===`checking`?`amber`:`red`;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-[12px]`,children:[c&&(0,G.jsxs)(H,{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)(ae,{size:18}):(0,G.jsx)(ut,{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:C,children:S}),(0,G.jsx)(X,{value:r.browser.enabled,disabled:m||d===`unsupported`||d===`checking`,onChange:v})]}),(0,G.jsxs)(B,{children:[(0,G.jsx)(O,{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&&d===`denied`&&(0,G.jsxs)(o,{variant:`outline`,size:`lg`,className:`bg-surface-subtle`,onClick:x,children:[(0,G.jsx)(O,{size:14}),n(`config:notificationSettings.openSystemNotificationSettings`)]}),(0,G.jsxs)(o,{variant:`outline`,size:`lg`,className:`bg-surface-subtle`,disabled:!r.browser.enabled||d!==`granted`,onClick:b,children:[(0,G.jsx)(ae,{size:14}),n(`config:notificationSettings.sendTestNotification`)]})]})]}),(0,G.jsx)(cn,{data:r,setData:i,notify:e,permission:d,onBrowserTest:y,onSettingsChange:t})]})}function cn({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),x=u===`browser`?e.browser.enabled&&r===`granted`:!!y,S=$t;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)(b,{size:14})}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{children:tn(e.id,e.name,s)}),(0,G.jsx)(`small`,{children:nn(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)(se,{children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{children:tn(f.id,f.name,s)}),(0,G.jsx)(`p`,{children:nn(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:[en(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:rn(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:_||!x,onClick:async()=>{v(!0);try{let e=await F(`/api/settings/notifications/templates/${encodeURIComponent(f.id)}/${u}/test`,{method:`POST`,body:`{}`});u===`browser`&&await i?.(e.title||tn(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($(e),`error`)}finally{v(!1)}},children:[(0,G.jsx)(b,{size:14}),s(`config:notificationSettings.sendTest`)]}),(0,G.jsxs)(o,{size:`lg`,disabled:_||!h.trim(),onClick:async()=>{v(!0);try{let e=await F(`/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($(e),`error`)}finally{v(!1)}},children:[_?(0,G.jsx)(z,{className:`animate-spin`,size:14}):(0,G.jsx)(E,{size:14}),s(`config:notificationSettings.saveTemplate`)]})]})]})]}):null}function ln({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)(bt,{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)(B,{className:`[margin-top:15px] cli-settings-status [&_small]:[overflow-wrap:anywhere]`,children:[r.installed&&!r.needsRepair?(0,G.jsx)(L,{size:16}):(0,G.jsx)(bt,{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)(H,{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)(z,{className:`animate-spin`,size:14}):(0,G.jsx)(k,{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)(z,{className:`animate-spin`,size:14}):r?.needsRepair?(0,G.jsx)(A,{size:14}):(0,G.jsx)(ge,{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 un=`0.5.6`,dn=9e5,fn=2592e6;function pn(){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 mn(e,t){return e.desktop?`${{win32:`Windows`,darwin:`macOS`,linux:`Linux`}[e.platform]||e.platform} · ${e.arch}`:t(`config:updateSettings.browserMode`)}function hn(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 gn({notify:e,update:t}){let{t:n,language:r}=p(),a=t?.info||{desktop:!1,packaged:!1,version:un,platform:`browser`,arch:``},s=t?.status||{state:`idle`},c=!!a.desktop,[l,u]=(0,W.useState)({version:un,date:``,notes:``}),[d,f]=(0,W.useState)([]),[m,h]=(0,W.useState)(``),[g,_]=(0,W.useState)(pn);(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&&u(t)}).catch(()=>{}),()=>{e=!1}},[]),(0,W.useEffect)(()=>{let e=!0,t=(t=!1)=>F(`/api/sponsors/settings-updates?locale=${encodeURIComponent(r)}${t?`&refresh=1`:``}`).then(t=>{e&&f(Array.isArray(t.campaigns)?t.campaigns:[])}).catch(()=>{e&&!t&&f([])});t();let n=window.setInterval(()=>void t(!0),dn);return()=>{e=!1,window.clearInterval(n)}},[r]);let v=e=>{let t={...g,[e]:Date.now()+fn};_(t);try{localStorage.setItem(i.sponsorDismissals,JSON.stringify(t))}catch{}},y=async()=>{if(t){h(`check`);try{await t.check()}finally{h(``)}}},b=()=>t?.openReleases(),C=()=>t?.openUpdateLog?.(),w=async()=>{h(c?`install`:``);try{c?await t?.installComponents():await t?.download()}catch(t){e(t instanceof Error?t.message:String(t),`error`)}finally{h(``)}},T=()=>t?.install(),E=l.version===a.version?l:null,D=s.notes||(c?E?.notes||n(`config:updateSettings.noReleaseNotesAreAvailableForThisVersion`):s.state===`current`?n(`config:updateSettings.theCurrentWebSourceIsSyncedWithBranch`,{branch:s.branch||`main`}):n(`config:updateSettings.commitsThatHaveNotBeenSyncedWillAppearHereAfterTheCheck`)),O=s.state===`available`,k=s.state===`error`&&s.canResume&&s.canDownload,A=s.state===`downloaded`,j=s.state===`checking`||m===`check`,N=s.state===`downloading`||m===`install`,P=j?`checking`:N?`downloading`:s.state,I=c?`v${a.version}`:`v${a.version}${s.currentCommit?` · ${s.currentCommit.slice(0,7)}`:``}`,te=c?`v${s.availableVersion||E?.version||a.version}`:s.availableCommit?.slice(0,7)||s.currentCommit?.slice(0,7)||l.version||a.version,R=d.filter(e=>(g[e.id]||0)<=Date.now()),B=(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]),ne=(0,W.useMemo)(()=>({idle:[n(`config:updateSettings.notChecked`),`gray`],checking:[n(`config:updateSettings.checking`),`blue`],current:[n(`config:updateSettings.upToDate`),`green`],available:[n(c?`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(k?`config:updateSettings.downloadPaused`:`config:updateSettings.checkFailed`),`red`]})[P]||[n(`config:updateSettings.notChecked`),`gray`],[c,P,k,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)(yt,{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:ne[1],children:ne[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(c?`config:updateSettings.currentVersion`:`config:updateSettings.currentSource`)}),(0,G.jsx)(`strong`,{className:`mt-1 block font-mono text-[14px]`,children:I})]}),(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:mn(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:c?`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)(vt,{className:`mt-0.5 shrink-0`,size:15}),(0,G.jsx)(`span`,{children:s.message})]}),k&&(0,G.jsx)(`small`,{className:`mt-2 block text-[12px] text-[var(--text-muted)]`,children:n(`config:updateSettings.downloadedDataWasPreservedAndCanResumeFromTheInterruptionPoint`)}),N&&(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),`% · `,hn(s.transferred,r),` /`,` `,hn(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:j||N||!!m,onClick:A?T:O||k?w:y,children:[j||N?(0,G.jsx)(z,{className:`animate-spin`,size:14}):A?(0,G.jsx)(re,{size:14}):O||k?s.canDownload?(0,G.jsx)(ge,{size:14}):(0,G.jsx)(M,{size:14}):(0,G.jsx)(z,{size:14}),j||N?n(N&&c?`config:updateSettings.installingUpdates`:`config:updateSettings.checking2`):A?n(`config:updateSettings.restartAndInstall`):k?n(`config:updateSettings.resumeDownload`):O?s.canDownload?n(c?`config:updateSettings.downloadAndInstallUpdates`:`config:updateSettings.downloadUpdate`):n(c?`config:updateSettings.viewRelease`:`config:updateSettings.viewSourceUpdates`):n(`config:updateSettings.checkForUpdates`)]}),(0,G.jsxs)(o,{variant:`outline`,size:`lg`,className:`bg-surface-subtle`,onClick:b,children:[(0,G.jsx)(M,{size:14}),c?`GitHub Releases`:`GitHub Compare`]}),c&&(0,G.jsxs)(o,{variant:`outline`,size:`lg`,className:`bg-surface-subtle`,onClick:C,children:[(0,G.jsx)(M,{size:14}),n(`config:updateSettings.viewUpdateDiagnosticLog`)]})]}),(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:B.map(e=>{let t=e.component===`desktop`?vt:e.component===`tui`?ee:pt,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)(x,{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:hn(e.size,r)})]}),(0,G.jsx)(Y,{tone:a,children:o})]},e.component)})})]})]}),(0,G.jsx)(ln,{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(c?O||k||A||N?`config:updateSettings.newVersionReleaseNotes`:`config:updateSettings.currentReleaseNotes`:O?`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)(L,{size:13}),O||k||A||N?te:c?`v${E?.version||a.version}`:s.currentCommit?.slice(0,7)||n(`config:updateSettings.notChecked`)]})]}),(s.releaseDate||c&&E?.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||E?.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)(S,{children:D})})]}),R.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)(ht,{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:R.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)(M,{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:()=>v(e.id),children:(0,G.jsx)(pe,{size:15})})]},e.id))})]})]})}function _n({notify:e,registerPrimaryAction:t,section:n,onBrowserNotificationChange:r,requestConfirm:i,update:a}){let o;return o=n===`notifications`?(0,G.jsx)(sn,{notify:e,onBrowserNotificationChange:r}):n===`interface`?(0,G.jsx)(Et,{notify:e}):n===`desktop-pet`?(0,G.jsx)(wt,{notify:e}):n===`updates`?(0,G.jsx)(gn,{notify:e,update:a}):(0,G.jsx)(Qt,{notify:e,registerPrimaryAction:t,requestConfirm:i}),o}export{_n 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-CDkfouZn.js";import{t as a}from"./use-i18n-D_qTnnhp.js";import{n as o}from"./AppSelect-l56OkqAr.js";import{t as s}from"./utils-C8uzG5AZ.js";import{t as c}from"./copy-BqjQWrFh.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 ee,t as g}from"./vendor-shiki-runtime-CxE5QolQ.js";var _=r(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),v=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`}]]),y=e(t(),1),b=[`github-dark`,`github-dark`],x=150,S=new Set([`text`,`txt`,`plain`,`plaintext`]),C=new Map;for(let e of h){C.set(e.id,e.id);for(let t of e.aliases??[])C.set(t,e.id)}function w(e){return typeof e==`string`?e:e.name??`custom`}function T(e){let t=String(e||``).trim().toLowerCase();return C.get(t)??`text`}function E(e,t,n){return`${t}:${w(n[0])}:${w(n[1])}:${e.length}:${e.slice(0,64)}:${e.slice(-64)}`}var D=new Map;function O(e){let t=D.get(e);return t&&(D.delete(e),D.set(e,t)),t}function k(e,t){for(D.delete(e),D.set(e,t);D.size>x;){let e=D.keys().next().value;if(e===void 0)break;D.delete(e)}}var A=null,j=new Map;function M(){return A??=ee({themes:[...b],langs:[],engine:g({forgiving:!0})}),A}function N(e,t){if(S.has(t)||e.getLoadedLanguages().includes(t))return Promise.resolve();let n=h.find(e=>e.id===t);if(!n)return Promise.resolve();let r=j.get(t);return r||(r=e.loadLanguage(()=>n.import().then(e=>e.default)).catch(e=>{throw j.delete(t),e}),j.set(t,r)),r}var P=new Map;function F(){return{name:`shiki`,type:`code-highlighter`,supportsLanguage(e){return C.has(String(e||``).trim().toLowerCase())},getSupportedLanguages(){return h.map(e=>e.id)},getThemes(){return b},highlight({code:e,language:t,themes:n},r){let i=T(t),a=E(e,i,n),o=O(a);if(o)return o;let s=P.get(a),c=!!s;return s||(s=new Set,P.set(a,s)),r&&s.add(r),c||(async()=>{try{let t=await M();await N(t,i);let r=t.getLoadedLanguages().includes(i)?i:`text`,o=t.codeToTokens(e,{lang:r,themes:{light:n[0],dark:n[1]}});k(a,o);let s=P.get(a);if(P.delete(a),s)for(let e of s)e(o)}catch(e){P.delete(a),console.error(`[streamdown] Failed to highlight code:`,e)}})(),null}}}var I=F(),L={cjk:l,code:I,math:u};function R(){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,y.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,y.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 te({children:e,className:t,streaming:n=!1}){let r=String(e??``),[i]=(0,y.useState)(()=>R());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:L,remend:H,children:r})})}var $=(0,y.memo)(te);$.displayName=`MarkdownMessage`;export{v as n,_ as r,$ as t};
|
|
@@ -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-CDkfouZn.js";import{t as a}from"./use-i18n-D_qTnnhp.js";import{n as o,t as s}from"./AppSelect-l56OkqAr.js";import{t as c}from"./file-code-corner-Dqjb0Cug.js";import{t as l}from"./loader-circle-XRCZj0q4.js";import{t as u}from"./pencil-C67WdsWU.js";import{t as d}from"./trash-2-CsljwZ9-.js";import{Et as f,L as p,_t as m,i as h,n as g,o as _,t as v,ut as y,vt as b}from"./index-D1NIRA25.js";import{t as x}from"./field-DqrpgISR.js";import{t as ee}from"./StarOrbit-BlI6MhVr.js";import{t as te}from"./usePagePrimaryAction-Bw0OFTDZ.js";var ne=r(`zoom-out`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),re=r(`zoom-in`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),S=e(t(),1),C=n(),w={width:600,height:420,cx:300,cy:206},T=24,ie=Math.PI*(3-Math.sqrt(5)),ae=[`concept`,`file`,`risk`,`preference`,`decision`,`fact`,`task`];function E(e,t){return t(e===`file`?`memory:memoryPage.fileType`:e===`risk`?`memory:memoryPage.riskType`:e===`preference`?`memory:memoryPage.preferenceType`:e===`decision`?`memory:memoryPage.decisionType`:e===`fact`?`memory:memoryPage.factType`:e===`task`?`memory:memoryPage.taskType`:`memory:memoryPage.conceptType`)}var D={concept:`var(--g-concept)`,file:`var(--g-file)`,risk:`var(--g-risk)`,preference:`var(--g-preference)`,decision:`var(--g-decision)`,fact:`var(--g-fact)`,task:`var(--g-task)`},oe={concept:`var(--g-concept-glow)`,file:`var(--g-file-glow)`,risk:`var(--g-risk-glow)`,preference:`var(--g-preference-glow)`,decision:`var(--g-decision-glow)`,fact:`var(--g-fact-glow)`,task:`var(--g-task-glow)`};function O(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*31+e.charCodeAt(n)>>>0;return t}function se(e,t){let n=e.slice(0,T);if(!n.length)return[];if(n.length===1)return[{node:n[0],x:w.cx,y:w.cy,twinkle:0}];let r=O(t||`galaxy`)%628/100,i=172/Math.sqrt(n.length);return n.map((e,t)=>{let n=O(e.id),a=t*ie+r,o=i*Math.sqrt(t+.55)+n%11-5;return{node:e,x:w.cx+Math.cos(a)*o*1.38,y:w.cy+Math.sin(a)*o*.74,twinkle:n%50/10}})}function k(e,t=`zh-CN`){if(!e)return`—`;let n=new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(n)}function A(e,t=e=>e){return e?.kind===`global`?t(`memory:memoryPage.globalMemorySpace`):e?.name||``}function ce(e,t,n){let r=t.x-e.x,i=t.y-e.y,a=Math.hypot(r,i)||1,o=Math.min(24,a*.16)*(n%2==0?1:-1),s=(e.x+t.x)/2-i/a*o,c=(e.y+t.y)/2+r/a*o;return`M ${e.x.toFixed(1)} ${e.y.toFixed(1)} Q ${s.toFixed(1)} ${c.toFixed(1)} ${t.x.toFixed(1)} ${t.y.toFixed(1)}`}function j(e){return e instanceof Error?e.message:String(e)}function M({notify:e,query:t=``,registerPrimaryAction:n,requestConfirm:r}){let{t:s,language:x}=a(),[T,ie]=(0,S.useState)({spaces:[],nodes:[],links:[],candidates:[],selectedSpaceId:``}),[M,N]=(0,S.useState)(``),[P,F]=(0,S.useState)(``),[de,fe]=(0,S.useState)(!0),[pe,I]=(0,S.useState)(``),[me,he]=(0,S.useState)(1),[L,R]=(0,S.useState)(null),[z,B]=(0,S.useState)(null),[ge,_e]=(0,S.useState)(``),[V,H]=(0,S.useState)(``),[U,W]=(0,S.useState)(null),[G,ve]=(0,S.useState)(!1),K=(0,S.useRef)(null),q=(0,S.useRef)(0);te(n,()=>R({spaceId:M||T.selectedSpaceId}));let ye=e=>{let t=K.current;if(!t)return;let n=t.getBoundingClientRect(),r=((e.clientX-n.left)/n.width-.5)*2,i=((e.clientY-n.top)/n.height-.5)*2;cancelAnimationFrame(q.current),q.current=requestAnimationFrame(()=>{t.style.setProperty(`--px`,r.toFixed(3)),t.style.setProperty(`--py`,i.toFixed(3))})},be=()=>{cancelAnimationFrame(q.current),K.current?.style.setProperty(`--px`,`0`),K.current?.style.setProperty(`--py`,`0`)},J=(0,S.useCallback)(async(e=``)=>{fe(!0),I(``);try{let n=new URLSearchParams;e&&n.set(`spaceId`,e),t.trim()&&n.set(`query`,t.trim());let r=await p(`/api/memory?${n}`);ie(r),N(r.selectedSpaceId||``),F(e=>r.nodes.some(t=>t.id===e)?e:r.nodes[0]?.id||``)}catch(e){I(j(e))}finally{fe(!1)}},[t]);(0,S.useEffect)(()=>{J(M)},[J,M]),(0,S.useEffect)(()=>{let e=!0;return p(`/api/settings/memory`).then(t=>e&&W(t.autoApproveConfidence)).catch(()=>e&&W(60)),()=>{e=!1}},[]);let xe=async()=>{let t=U;if(t===null||G)return;let n=Math.min(100,Math.max(0,Math.round(t)));n!==t&&W(n),ve(!0);try{await p(`/api/settings/memory`,{method:`PATCH`,body:{autoApproveConfidence:n}}),e(s(`memory:memoryPage.autoApproveSaved`))}catch(e){I(j(e))}finally{ve(!1)}},Y=T.nodes.find(e=>e.id===P)||null,X=(0,S.useMemo)(()=>se(T.nodes,M),[T.nodes,M]),Z=(0,S.useMemo)(()=>new Map(X.map(e=>[e.node.id,e])),[X]),Se=(0,S.useMemo)(()=>{let e=new Set(X.map(e=>e.node.id));return T.links.filter(t=>e.has(t.sourceId)&&e.has(t.targetId))},[X,T.links]),Ce=new Set(T.links.flatMap(e=>e.sourceId===P?[e.targetId]:e.targetId===P?[e.sourceId]:[])),Q=ge||P,we=new Set(T.links.flatMap(e=>e.sourceId===Q?[e.targetId]:e.targetId===Q?[e.sourceId]:[])),Te=T.nodes.filter(e=>e.type===`file`&&(Ce.has(e.id)||e.id===P)),$=T.spaces.find(e=>e.id===M),Ee=async t=>{if(await r({title:s(`memory:memoryPage.deleteMemory`),message:s(`memory:memoryPage.deleteMemoryName`,{name:t.title}),confirmLabel:s(`memory:memoryPage.delete`)}))try{await p(`/api/memory/nodes/${encodeURIComponent(t.id)}`,{method:`DELETE`}),e(s(`memory:memoryPage.memoryDeleted`)),await J(M)}catch(e){I(j(e))}},De=async(t,n)=>{if(!V){H(t.id),I(``);try{await p(`/api/memory/candidates/${encodeURIComponent(t.id)}/${n}`,{method:`POST`,body:`{}`}),e(s(n===`accept`?`memory:memoryPage.memoryCandidateConfirmed`:`memory:memoryPage.memoryCandidateIgnored`)),await J(M)}catch(e){I(j(e))}finally{H(``)}}};return(0,C.jsxs)(`div`,{className:`memory-layout max-[1150px]:grid-cols-[220px_minmax(340px,1fr)] max-[650px]:grid-cols-[1fr] grid min-h-[100%] grid-cols-[230px_minmax(360px,1fr)_290px] gap-[12px]`,children:[(0,C.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-[12px]`,children:[(0,C.jsxs)(v,{className:`wiki-panel [&_>_button]:grid [&_>_button]:w-full [&_>_button]:grid-cols-[minmax(0,1fr)_auto_auto] [&_>_button]:items-center [&_>_button]:gap-[6px] [&_>_button]:border-0 [&_>_button]:[border-top:1px_solid_var(--stroke-soft)] [&_>_button]:bg-transparent [&_>_button]:p-[9px_5px] [&_>_button]:text-left [&_>_button]:text-[12px] [&_>_button.active]:rounded-[var(--r-xs)] [&_>_button.active]:bg-[var(--accent-soft)] [&_>_button_small]:text-[var(--text-muted)] [&_>_button_small]:text-[13px]`,children:[(0,C.jsxs)(g,{children:[(0,C.jsx)(_,{title:s(`memory:memoryPage.memorySpaces`)}),(0,C.jsx)(i,{variant:`ghost`,size:`icon`,title:s(`memory:memoryPage.newMemorySpace`),onClick:()=>B({}),children:(0,C.jsx)(b,{size:13})})]}),T.spaces.map(e=>(0,C.jsxs)(`button`,{className:e.id===M?`active`:``,onClick:()=>{N(e.id),F(``)},children:[(0,C.jsx)(`span`,{children:A(e,s)}),(0,C.jsx)(`small`,{children:s(`memory:memoryPage.countMemories`,{count:e.nodeCount})}),(0,C.jsx)(f,{size:13})]},e.id)),$&&(0,C.jsxs)(`div`,{className:`memory-space-actions [&_button]:inline-flex [&_button]:items-center [&_button]:gap-[4px] [&_button]:border-0 [&_button]:bg-transparent [&_button]:text-[var(--text-soft)] [&_button]:text-[13px] [&_button.danger]:text-[var(--danger)] flex gap-[6px] [margin-top:10px] [border-top:1px_solid_var(--stroke-soft)] [padding-top:9px]`,children:[(0,C.jsxs)(`button`,{onClick:()=>B($),children:[(0,C.jsx)(u,{size:12}),s(`memory:memoryPage.rename`)]}),$.kind!==`global`&&(0,C.jsxs)(`button`,{className:`danger`,onClick:async()=>{if($&&await r({title:s(`memory:memoryPage.deleteMemorySpace`),message:s(`memory:memoryPage.deleteMemorySpaceNameAndAllMemoriesInIt`,{name:A($,s)}),confirmLabel:s(`memory:memoryPage.delete`)}))try{await p(`/api/memory/spaces/${encodeURIComponent($.id)}`,{method:`DELETE`}),N(``),F(``),e(s(`memory:memoryPage.memorySpaceDeleted`))}catch(e){I(j(e))}},children:[(0,C.jsx)(d,{size:12}),s(`memory:memoryPage.delete`)]})]})]}),(0,C.jsxs)(v,{className:`memory-legend-panel`,children:[(0,C.jsx)(_,{title:s(`memory:memoryPage.memoryMapTypes`)}),(0,C.jsx)(`div`,{className:`galaxy-legend [&_span]:flex [&_span]:items-center [&_span]:gap-[7px] [&_span]:text-[var(--text-soft)] [&_span]:text-[12px] grid grid-cols-[repeat(2,minmax(0,1fr))] gap-[8px_10px] [margin-top:11px]`,children:ae.map(e=>(0,C.jsxs)(`span`,{children:[(0,C.jsx)(`i`,{className:`g-dot [&.g-concept]:bg-[var(--g-concept)] [&.g-concept]:shadow-[0_0_5px_var(--g-concept-glow)] [&.g-file]:bg-[var(--g-file)] [&.g-file]:shadow-[0_0_5px_var(--g-file-glow)] [&.g-risk]:bg-[var(--g-risk)] [&.g-risk]:shadow-[0_0_5px_var(--g-risk-glow)] [&.g-preference]:bg-[var(--g-preference)] [&.g-preference]:shadow-[0_0_5px_var(--g-preference-glow)] [&.g-decision]:bg-[var(--g-decision)] [&.g-decision]:shadow-[0_0_5px_var(--g-decision-glow)] [&.g-fact]:bg-[var(--g-fact)] [&.g-fact]:shadow-[0_0_5px_var(--g-fact-glow)] [&.g-task]:bg-[var(--g-task)] [&.g-task]:shadow-[0_0_5px_var(--g-task-glow)] inline-block w-[7px] h-[7px] flex-none rounded-[50%] g-${e}`}),E(e,s)]},e))})]}),(0,C.jsxs)(v,{className:`min-h-0`,children:[(0,C.jsxs)(g,{children:[(0,C.jsx)(_,{title:`${s(`memory:memoryPage.memoryDrafts`)} · ${T.candidates?.length||0}`}),!!T.candidates?.length&&(0,C.jsxs)(i,{variant:`outline`,className:`bg-surface-subtle`,disabled:!!V,onClick:async()=>{if(!(V||!T.candidates?.length)){H(`__all__`),I(``);try{let t=await p(`/api/memory/candidates/reject-all`,{method:`POST`,body:`{}`});e(s(`memory:memoryPage.ignoredCountMemoryDrafts`,{count:t.rejected||0})),await J(M)}catch(e){I(j(e))}finally{H(``)}}},children:[(0,C.jsx)(y,{size:12}),s(`memory:memoryPage.ignoreAll`)]})]}),U!==null&&(0,C.jsxs)(`div`,{className:`memory-auto-approve-row [&_label]:flex [&_label]:min-w-0 [&_label]:flex-col [&_label]:gap-[2px] [&_label_span]:text-[12px] [&_label_span]:font-[600] [&_label_small]:text-[var(--text-muted)] [&_label_small]:text-[10px] [&_label_small]:leading-[1.4] flex items-center justify-between gap-[10px] [border-bottom:1px_solid_var(--stroke-soft)] [padding:8px_0_10px]`,children:[(0,C.jsxs)(`label`,{children:[(0,C.jsx)(`span`,{children:s(`memory:memoryPage.autoApproveThreshold`)}),(0,C.jsx)(`small`,{children:s(`memory:memoryPage.autoApproveThresholdHint`)})]}),(0,C.jsxs)(`span`,{className:`memory-auto-approve-input [&_input]:w-[64px] [&_input]:[border:1px_solid_var(--stroke-soft)] [&_input]:rounded-[6px] [&_input]:bg-[var(--surface-muted)] [&_input]:p-[4px_6px] [&_input]:text-[var(--text)] [&_input]:text-[12px] [&_input]:text-right [&_em]:text-[var(--text-muted)] [&_em]:text-[11px] [&_em]:[font-style:normal] flex flex-none items-center gap-[5px]`,children:[(0,C.jsx)(`input`,{type:`number`,min:0,max:100,step:5,value:U,disabled:G,"aria-label":s(`memory:memoryPage.autoApproveThreshold`),onChange:e=>W(e.target.value?Number(e.target.value):0),onBlur:()=>void xe(),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),xe())}}),(0,C.jsx)(`em`,{children:`%`}),G&&(0,C.jsx)(l,{className:`animate-spin`,size:12})]})]}),(0,C.jsxs)(`div`,{className:`flex max-h-[300px] flex-col gap-[8px] overflow-auto`,children:[(T.candidates||[]).map(e=>(0,C.jsxs)(`div`,{className:`memory-candidate [&_>_strong]:text-[12px] [&_>_span]:text-[var(--text-muted)] [&_>_span]:text-[11px] [&_>_span]:leading-[1.45] [&_>_small]:text-[var(--text-muted)] [&_>_small]:text-[11px] [&_>_small]:leading-[1.45] [&_>_div]:flex [&_>_div]:gap-[6px] [&_button]:inline-flex [&_button]:items-center [&_button]:gap-[4px] [&_button]:[border:1px_solid_var(--stroke-soft)] [&_button]:rounded-[6px] [&_button]:bg-transparent [&_button]:p-[4px_7px] [&_button]:text-[var(--text)] [&_button]:text-[11px] [&_button.danger]:text-[var(--danger)] flex flex-col gap-[5px] [border:1px_solid_var(--stroke-soft)] rounded-[8px] bg-[var(--surface-muted)] [padding:8px]`,children:[(0,C.jsx)(`strong`,{children:e.title}),(0,C.jsxs)(`small`,{children:[A(T.spaces.find(t=>t.id===e.spaceId),s),` · `,e.sourceType===`agent`?s(`memory:memoryPage.agentProposed`):s(`memory:memoryPage.conversationExtracted`),` · `,s(`memory:memoryPage.confidencePercent`,{value:Math.round((e.confidence||0)*100)})]}),(0,C.jsx)(`span`,{children:e.content}),e.topicKey&&(0,C.jsxs)(`small`,{children:[s(`memory:memoryPage.topic`),`:`,e.topicKey]}),e.evidence&&(0,C.jsxs)(`small`,{children:[s(`memory:memoryPage.evidence`),`:`,e.evidence]}),(0,C.jsxs)(`small`,{children:[s(`memory:memoryPage.created`),`:`,k(e.createdAt,x),e.expiresAt?` · ${s(`memory:memoryPage.expires`)}:${k(e.expiresAt,x)}`:``]}),(0,C.jsxs)(`div`,{children:[(0,C.jsxs)(`button`,{disabled:!!V,title:s(`memory:memoryPage.confirm`),onClick:()=>De(e,`accept`),children:[(0,C.jsx)(o,{size:12}),s(`memory:memoryPage.confirm`)]}),(0,C.jsxs)(`button`,{disabled:!!V,className:`danger`,title:s(`memory:memoryPage.ignore`),onClick:()=>De(e,`reject`),children:[(0,C.jsx)(y,{size:12}),s(`memory:memoryPage.ignore`)]})]})]},e.id)),!T.candidates?.length&&(0,C.jsx)(`small`,{children:s(`memory:memoryPage.thereAreNoPendingMemoryCandidates`)})]})]})]}),(0,C.jsxs)(v,{className:`graph-panel before:[content:''] before:absolute before:z-[0] before:inset-0 before:pointer-events-none before:bg-[url('/memory-galaxy-background.webp')] before:[background-position:center_48%] before:[background-size:cover] before:bg-no-repeat before:[filter:saturate(.62)_contrast(1.08)] before:[mix-blend-mode:screen] before:opacity-[.42] after:[content:''] after:absolute after:z-[0] after:inset-0 after:pointer-events-none after:[background-image:radial-gradient(var(--galaxy-dot)_.9px,transparent_1.2px),_radial-gradient(var(--galaxy-dot-dim)_.8px,transparent_1.2px),_radial-gradient(var(--galaxy-dot)_1.2px,transparent_1.6px)] after:[background-position:0_0,_37px_53px,_71px_19px] after:[background-size:96px_96px,_152px_152px,_236px_236px] after:[animation:galaxy-field-twinkle_6.4s_ease-in-out_infinite] after:opacity-[.7] before:inset-[-8%] before:[animation:galaxy-background-drift_34s_ease-in-out_infinite_alternate] before:[will-change:transform] after:[animation:galaxy-field-drift_15s_ease-in-out_infinite_alternate] after:[will-change:background-position,opacity] max-[650px]:min-h-[430px] relative min-h-[500px] overflow-hidden [border-color:var(--galaxy-border)] bg-[var(--galaxy-bg)]! [background-image:radial-gradient(ellipse_46%_40%_at_50%_48%,_var(--galaxy-core),_transparent_72%),_radial-gradient(ellipse_62%_48%_at_16%_6%,_var(--galaxy-nebula-a),_transparent_70%),_radial-gradient(ellipse_56%_52%_at_88%_98%,_var(--galaxy-nebula-b),_transparent_72%)] p-0 backdrop-blur-none! galaxy-panel`,onPointerMove:ye,onPointerLeave:be,children:[(0,C.jsxs)(`div`,{className:`graph-toolbar [&_button]:grid [&_button]:w-[32px] [&_button]:h-[32px] [&_button]:place-items-center [&_button]:border-0 [&_button]:bg-transparent [&_button]:text-[12px] [.galaxy-panel_&]:border-[var(--galaxy-toolbar-border)] [.galaxy-panel_&]:bg-[var(--galaxy-toolbar-bg)] [.galaxy-panel_&]:text-[var(--galaxy-toolbar-text)] [.galaxy-panel_&]:[backdrop-filter:blur(9px)] [.galaxy-panel_&_button:hover]:bg-[var(--galaxy-toolbar-hover)] dark:bg-[var(--solid)] dark:text-[var(--text)] absolute z-[4] [top:10px] [left:10px] flex gap-[3px] [padding:3px] [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--solid)]`,children:[(0,C.jsx)(`button`,{title:s(`memory:memoryPage.addMemory`),onClick:()=>R({spaceId:M}),children:(0,C.jsx)(b,{size:14})}),(0,C.jsx)(`button`,{title:s(`memory:memoryPage.zoomIn`),onClick:()=>he(e=>Math.min(1.6,Number((e+.15).toFixed(2)))),children:(0,C.jsx)(re,{size:13})}),(0,C.jsx)(`button`,{title:s(`memory:memoryPage.zoomOut`),onClick:()=>he(e=>Math.max(.7,Number((e-.15).toFixed(2)))),children:(0,C.jsx)(ne,{size:13})}),(0,C.jsx)(`button`,{title:s(`memory:memoryPage.refresh`),onClick:()=>J(M),children:(0,C.jsx)(m,{className:de?`animate-spin`:``,size:13})})]}),(0,C.jsxs)(`div`,{className:`galaxy-stage [&_>_svg]:absolute [&_>_svg]:inset-0 [&_>_svg]:w-full [&_>_svg]:h-full [&_>_svg]:overflow-visible [&_>_svg]:z-[1] [&_>_svg]:[transform:translate3d(calc(var(--px,0)_*_9px),calc(var(--py,0)_*_6px),0)] [&_>_svg]:[transition:transform_.9s_var(--ease-out)] absolute z-[1] inset-0 [transform-origin:50%_50%] [transition:transform_var(--d2)_var(--ease-out)] ${Q?`has-focus`:``}`,ref:K,style:{transform:`scale(${me})`},children:[(0,C.jsx)(`i`,{className:`galaxy-spiral absolute z-[0] block pointer-events-none [left:9%] [top:13%] w-[82%] h-[74%] rounded-[50%] bg-[conic-gradient(from_-18deg,transparent_0deg,var(--galaxy-nebula-a)_28deg,transparent_68deg,var(--galaxy-nebula-b)_118deg,transparent_170deg,var(--galaxy-nebula-a)_224deg,transparent_278deg,var(--galaxy-nebula-b)_322deg,transparent_360deg)] [filter:blur(13px)] [mask-image:radial-gradient(ellipse,transparent_0%,transparent_15%,var(--g-star-core)_38%,transparent_74%)] [-webkit-mask-image:radial-gradient(ellipse,transparent_0%,transparent_15%,var(--g-star-core)_38%,transparent_74%)] [mix-blend-mode:screen] opacity-[.38] [animation:galaxy-spiral-turn_42s_linear_infinite] [will-change:transform]`,"aria-hidden":`true`}),(0,C.jsx)(`i`,{className:`galaxy-core absolute z-[0] block pointer-events-none before:[content:''] before:absolute before:left-[50%] before:top-[50%] before:w-[46px] before:h-[46px] before:rounded-[50%] before:bg-[radial-gradient(circle,rgba(255,255,255,.82),rgba(191,219,254,.3)_55%,transparent_76%)] before:[filter:blur(6px)] before:[transform:translate(-50%,-50%)] [left:50%] [top:49%] w-[34%] h-[40%] rounded-[50%] bg-[radial-gradient(ellipse,rgba(219,232,255,.3)_0%,rgba(126,156,255,.15)_36%,transparent_70%)] [filter:blur(9px)] [mix-blend-mode:screen] [transform:translate(-50%,-50%)] [animation:galaxy-core-breathe_7.5s_ease-in-out_infinite] [will-change:transform,opacity]`,"aria-hidden":`true`}),(0,C.jsx)(`i`,{className:`galaxy-aurora absolute z-[0] block pointer-events-none w-[46%] h-[31%] rounded-[50%] [filter:blur(21px)] [mix-blend-mode:screen] opacity-[.42] [will-change:transform,opacity] [left:8%] [top:20%] bg-[radial-gradient(ellipse,var(--galaxy-nebula-a),transparent_70%)] [animation:galaxy-aurora-drift_18s_ease-in-out_infinite_alternate]`,"aria-hidden":`true`}),(0,C.jsx)(`i`,{className:`galaxy-aurora absolute z-[0] block pointer-events-none w-[46%] h-[31%] rounded-[50%] [filter:blur(21px)] [mix-blend-mode:screen] opacity-[.42] [will-change:transform,opacity] [right:5%] [bottom:14%] bg-[radial-gradient(ellipse,var(--galaxy-nebula-b),transparent_70%)] [animation:galaxy-aurora-drift_23s_ease-in-out_-9s_infinite_alternate-reverse]`,"aria-hidden":`true`}),(0,C.jsx)(`i`,{className:`galaxy-aurora absolute z-[0] block pointer-events-none w-[46%] h-[31%] rounded-[50%] [filter:blur(21px)] [mix-blend-mode:screen] opacity-[.42] [will-change:transform,opacity] galaxy-aurora-three left-[30%] top-[60%] !w-[40%] !h-[27%] bg-[radial-gradient(ellipse,var(--galaxy-nebula-c),transparent_70%)] [animation:galaxy-aurora-drift_27s_ease-in-out_-14s_infinite_alternate]`,"aria-hidden":`true`}),(0,C.jsxs)(`svg`,{viewBox:`0 0 600 420`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[(0,C.jsxs)(`g`,{className:`galaxy-orbits [&_ellipse]:[fill:none] [&_ellipse]:[stroke:var(--galaxy-line)] [&_ellipse]:[stroke-width:.72] [&_ellipse]:[stroke-dasharray:3_7] [&_ellipse]:opacity-[.52] [transform-box:fill-box] [transform-origin:center] [animation:galaxy-orbit-drift_90s_linear_infinite]`,children:[(0,C.jsx)(`ellipse`,{cx:`300`,cy:`206`,rx:`205`,ry:`122`,transform:`rotate(-8 300 206)`}),(0,C.jsx)(`ellipse`,{cx:`300`,cy:`206`,rx:`154`,ry:`88`,transform:`rotate(18 300 206)`}),(0,C.jsx)(`ellipse`,{cx:`300`,cy:`206`,rx:`95`,ry:`54`,transform:`rotate(-24 300 206)`})]}),(0,C.jsx)(`defs`,{children:Se.map((e,t)=>{let n=Z.get(e.sourceId),r=Z.get(e.targetId);return!n||!r?null:(0,C.jsxs)(`linearGradient`,{id:`lg-${t}`,gradientUnits:`userSpaceOnUse`,x1:n.x,y1:n.y,x2:r.x,y2:r.y,children:[(0,C.jsx)(`stop`,{offset:`0`,stopColor:D[n.node.type]||`var(--galaxy-line-active)`}),(0,C.jsx)(`stop`,{offset:`1`,stopColor:D[r.node.type]||`var(--galaxy-line-active)`})]},e.id)})}),Se.map((e,t)=>{let n=Z.get(e.sourceId),r=Z.get(e.targetId);if(!n||!r)return null;let i=e.sourceId===Q||e.targetId===Q,a=ce(n,r,O(e.id));return(0,C.jsxs)(`g`,{children:[(0,C.jsx)(`path`,{className:`link-path [.galaxy-stage_>_svg_&]:[fill:none] [.galaxy-stage_>_svg_&]:[stroke-width:1.05] [.galaxy-stage_>_svg_&]:[stroke-dasharray:3_5] [.galaxy-stage_>_svg_&]:opacity-[.5] [.galaxy-stage_>_svg_&]:[animation:galaxy-link-flow_30s_linear_infinite] [.galaxy-stage_>_svg_&]:[transition:opacity_var(--d2)_var(--ease-out)] [.galaxy-stage_>_svg_&.active]:[stroke-width:1.55] [.galaxy-stage_>_svg_&.active]:[stroke-dasharray:none] [.galaxy-stage_>_svg_&.active]:opacity-100 [.galaxy-stage_>_svg_&.active]:[filter:drop-shadow(0_0_3.5px_var(--galaxy-line-active))] [.galaxy-stage.has-focus_&]:opacity-[.14] [.galaxy-stage.has-focus_&.active]:opacity-100 ${i?`active`:``}`,d:a,stroke:`url(#lg-${t})`}),i&&(0,C.jsx)(`circle`,{className:`link-pulse [.galaxy-stage_>_svg_&]:[fill:var(--g-star-core)] [.galaxy-stage_>_svg_&]:[filter:drop-shadow(0_0_4px_var(--galaxy-line-active))] [.galaxy-stage_>_svg_&]:pointer-events-none`,r:`2.1`,children:(0,C.jsx)(`animateMotion`,{dur:`2.8s`,repeatCount:`indefinite`,path:a})})]},e.id)})]}),(0,C.jsx)(`i`,{className:`galaxy-meteor before:[content:''] before:absolute before:top-[50%] before:left-[1px] before:w-[72px] before:h-[1px] before:bg-[linear-gradient(90deg,transparent,var(--galaxy-dot))] before:[transform:translateY(-50%)] absolute [top:14%] [left:80%] w-[2.4px] h-[2.4px] rounded-[50%] bg-[var(--galaxy-label-active)] shadow-[0_0_7px_1px_var(--galaxy-dot)] opacity-0 pointer-events-none [animation:galaxy-meteor_12s_linear_infinite] z-[3]`,"aria-hidden":`true`}),(0,C.jsx)(`i`,{className:`galaxy-meteor before:[content:''] before:absolute before:top-[50%] before:left-[1px] before:w-[72px] before:h-[1px] before:bg-[linear-gradient(90deg,transparent,var(--galaxy-dot))] before:[transform:translateY(-50%)] absolute [top:14%] [left:80%] w-[2.4px] h-[2.4px] rounded-[50%] bg-[var(--galaxy-label-active)] shadow-[0_0_7px_1px_var(--galaxy-dot)] opacity-0 pointer-events-none [animation:galaxy-meteor_12s_linear_infinite] z-[3] meteor-two [.galaxy-meteor&]:top-[63%] [.galaxy-meteor&]:left-[89%] [.galaxy-meteor&]:[animation:galaxy-meteor-b_17s_linear_4.5s_infinite]`,"aria-hidden":`true`}),(0,C.jsx)(`i`,{className:`galaxy-meteor before:[content:''] before:absolute before:top-[50%] before:left-[1px] before:w-[72px] before:h-[1px] before:bg-[linear-gradient(90deg,transparent,var(--galaxy-dot))] before:[transform:translateY(-50%)] absolute [top:14%] [left:80%] w-[2.4px] h-[2.4px] rounded-[50%] bg-[var(--galaxy-label-active)] shadow-[0_0_7px_1px_var(--galaxy-dot)] opacity-0 pointer-events-none [animation:galaxy-meteor_12s_linear_infinite] z-[3] meteor-three [.galaxy-meteor&]:top-[7%] [.galaxy-meteor&]:left-[36%] [.galaxy-meteor&]:[animation:galaxy-meteor-c_23s_linear_11s_infinite]`,"aria-hidden":`true`}),X.map(({node:e,x:t,y:n,twinkle:r},i)=>(0,C.jsxs)(`button`,{className:`galaxy-star focus-visible:rounded-[50%] focus-visible:[outline-color:var(--galaxy-line-active)] before:[content:''] before:absolute before:w-[calc(var(--star-size)_+_26px)] before:h-[calc(var(--star-size)_+_26px)] before:rounded-[50%] before:bg-[radial-gradient(circle,var(--g-star-glow),transparent_68%)] before:[filter:blur(3px)] before:opacity-[.76] before:pointer-events-none [&.active::after]:[content:''] [&.active::after]:absolute [&.active::after]:w-[calc(var(--star-size)_+_31px)] [&.active::after]:h-[calc(var(--star-size)_+_31px)] [&.active::after]:[border:1px_solid_var(--g-star-glow)] [&.active::after]:rounded-[50%] [&.active::after]:pointer-events-none [&.active::after]:[animation:galaxy-star-selection-pulse_2.3s_var(--ease-out)_infinite] [&:hover::before]:opacity-100 [&.active::before]:opacity-100 absolute z-[2] grid w-[52px] h-[52px] min-w-0 min-h-[52px] place-items-center [transform:translate(-50%,-50%)_translate3d(calc(var(--px,0)_*_(9px_+_var(--depth,0)_*_7px)),calc(var(--py,0)_*_(6px_+_var(--depth,0)_*_5px)),0)] border-0 rounded-[50%] bg-transparent p-0 cursor-pointer [transition:transform_.9s_var(--ease-out),opacity_.45s_var(--ease-out),filter_.45s_var(--ease-out)] [animation:galaxy-star-enter_.72s_var(--ease-out)_var(--enter-delay,0ms)_backwards] ${P===e.id?`active`:``} ${Q&&e.id!==Q&&!we.has(e.id)?`dimmed [.galaxy-stage.has-focus_.galaxy-star&]:opacity-[.32] [.galaxy-stage.has-focus_.galaxy-star&]:[filter:saturate(.4)_brightness(.82)]`:``}`,onClick:()=>F(e.id),onMouseEnter:()=>_e(e.id),onMouseLeave:()=>_e(``),style:{left:`${t/w.width*100}%`,top:`${n/w.height*100}%`,"--star-size":`${12+Math.round((e.importance||.5)*9)}px`,"--twinkle-delay":`${r}s`,"--enter-delay":`${i*55}ms`,"--depth":O(e.id)%100/100,"--g-star-color":D[e.type],"--g-star-glow":oe[e.type]},title:e.content,children:[P===e.id&&(0,C.jsx)(`i`,{className:`orbit-ring [.galaxy-star_&]:absolute [.galaxy-star_&]:left-[50%] [.galaxy-star_&]:top-[50%] [.galaxy-star_&]:w-[calc(var(--star-size)_+_36px)] [.galaxy-star_&]:h-[calc(var(--star-size)_+_36px)] [.galaxy-star_&]:[border:1px_solid_var(--galaxy-line-active)] [.galaxy-star_&]:rounded-[50%] [.galaxy-star_&]:pointer-events-none [.galaxy-star_&]:[transform:translate(-50%,-50%)_rotate(-22deg)_scaleY(.44)] [.galaxy-star_&]:[animation:galaxy-selected-orbit_6s_linear_infinite] [.galaxy-star_&]:opacity-[.8] [.galaxy-star_&::before]:[content:''] [.galaxy-star_&::before]:absolute [.galaxy-star_&::before]:top-[-2.2px] [.galaxy-star_&::before]:left-[50%] [.galaxy-star_&::before]:w-[4.4px] [.galaxy-star_&::before]:h-[4.4px] [.galaxy-star_&::before]:ml-[-2.2px] [.galaxy-star_&::before]:rounded-[50%] [.galaxy-star_&::before]:bg-[var(--g-star-color)] [.galaxy-star_&::before]:shadow-[0_0_6px_1px_var(--g-star-glow)]`,"aria-hidden":`true`}),P===e.id&&(0,C.jsx)(`i`,{className:`dash-ring [.galaxy-star_&]:absolute [.galaxy-star_&]:left-[50%] [.galaxy-star_&]:top-[50%] [.galaxy-star_&]:w-[calc(var(--star-size)_+_23px)] [.galaxy-star_&]:h-[calc(var(--star-size)_+_23px)] [.galaxy-star_&]:[border:1px_dashed_var(--g-star-glow)] [.galaxy-star_&]:rounded-[50%] [.galaxy-star_&]:opacity-[.9] [.galaxy-star_&]:pointer-events-none [.galaxy-star_&]:[transform:translate(-50%,-50%)] [.galaxy-star_&]:[animation:galaxy-dash-spin_16s_linear_infinite]`,"aria-hidden":`true`}),(0,C.jsxs)(`svg`,{className:`star-core [.galaxy-star_&]:relative [.galaxy-star_&]:block [.galaxy-star_&]:w-[var(--star-size)] [.galaxy-star_&]:h-[var(--star-size)] [.galaxy-star_&]:[transition:transform_var(--d2)_var(--ease-spring)] [.galaxy-star_&]:[animation:galaxy-star-twinkle_3.8s_ease-in-out_var(--twinkle-delay)_infinite] [.galaxy-star_&]:overflow-visible [.galaxy-star_&]:rounded-[0] [.galaxy-star_&]:bg-transparent [.galaxy-star_&]:shadow-[none] [.galaxy-star_&]:[filter:drop-shadow(0_0_3px_var(--g-star-glow))_drop-shadow(0_0_8px_var(--g-star-glow))] [.galaxy-star_&]:origin-[center] [.galaxy-star:hover_&]:[transform:scale(1.28)] [.galaxy-star.active_&]:[transform:scale(1.32)] [.galaxy-star.active_&]:[animation:galaxy-star-twinkle_2.1s_ease-in-out_var(--twinkle-delay)_infinite]`,viewBox:`0 0 32 32`,"aria-hidden":`true`,children:[(0,C.jsx)(`path`,{className:`star-ray [.galaxy-star_.star-core_&]:[fill:var(--g-star-glow)] [.galaxy-star_.star-core_&]:opacity-[.58] [.galaxy-star_.star-core_&]:[transform-box:fill-box] [.galaxy-star_.star-core_&]:origin-[center] [.galaxy-star_.star-core_&]:[transform:scale(1.45)] [.galaxy-star.active_.star-core_&]:opacity-[.88] [.galaxy-star.active_.star-core_&]:[transform:scale(1.82)]`,d:`M16 0 L19.7 12.3 L32 16 L19.7 19.7 L16 32 L12.3 19.7 L0 16 L12.3 12.3 Z`}),(0,C.jsx)(`path`,{className:`star-shape [.galaxy-star_.star-core_&]:[fill:var(--g-star-color)]`,d:`M16 2 L18.8 13.2 L30 16 L18.8 18.8 L16 30 L13.2 18.8 L2 16 L13.2 13.2 Z`}),(0,C.jsx)(`circle`,{className:`star-heart [.galaxy-star_.star-core_&]:[fill:var(--g-star-core)]`,cx:`16`,cy:`16`,r:`3.2`})]}),(0,C.jsx)(`span`,{className:`star-label [.galaxy-stage.has-focus_.galaxy-star.dimmed_&]:opacity-[.3] [.galaxy-stage.has-focus_.galaxy-star.dimmed_&]:[transition:opacity_.45s_var(--ease-out)] [.galaxy-star_&]:absolute [.galaxy-star_&]:top-[calc(50%_+_17px)] [.galaxy-star_&]:left-[50%] [.galaxy-star_&]:max-w-[120px] [.galaxy-star_&]:overflow-hidden [.galaxy-star_&]:text-[var(--galaxy-label)] [.galaxy-star_&]:text-[11px] [.galaxy-star_&]:leading-[1.35] [.galaxy-star_&]:pointer-events-none [.galaxy-star_&]:text-ellipsis [.galaxy-star_&]:[text-shadow:0_1px_7px_var(--galaxy-bg)] [.galaxy-star_&]:[transform:translateX(-50%)] [.galaxy-star_&]:[transition:color_var(--d1)_var(--ease-out)] [.galaxy-star_&]:whitespace-nowrap [.galaxy-star:hover_&]:text-[var(--galaxy-label-active)] [.galaxy-star.active_&]:text-[var(--galaxy-label-active)] [.galaxy-star.active_&]:font-[700]`,children:e.title})]},e.id))]}),!!X.length&&(0,C.jsxs)(`span`,{className:`absolute z-[3] [right:12px] [bottom:9px] [border:1px_solid_var(--galaxy-toolbar-border)] rounded-[var(--r-pill)] bg-[rgba(12,11,20,.52)] [padding:3px_10px] text-[var(--galaxy-label)] text-[11px] tracking-[.5px] pointer-events-none [backdrop-filter:blur(6px)]`,children:[`✦`,` `,s(`memory:memoryPage.visibleTotalMemories`,{visible:X.length,total:T.nodes.length})]}),!de&&!X.length&&(0,C.jsxs)(`div`,{className:`memory-empty [.galaxy-panel_&]:text-[var(--galaxy-label)] [.galaxy-panel_&]:[--stroke:var(--galaxy-toolbar-border)] [.galaxy-panel_&]:[--control-muted:var(--galaxy-label)] [.galaxy-panel_&]:[--star:var(--g-decision)] [.galaxy-panel_&]:[--text-muted:var(--galaxy-label)] absolute z-[3] inset-0 grid [align-content:center] justify-items-center gap-[8px] text-[var(--text-muted)] text-[12px] pointer-events-none`,children:[(0,C.jsx)(ee,{size:44}),(0,C.jsx)(`span`,{children:s(`memory:memoryPage.thisMemorySpaceIsStillUnlitClickInTheTopLeftToPlantTheFirstStar`)})]})]}),(0,C.jsxs)(`div`,{className:`detail-stack flex min-w-0 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]`,children:[(0,C.jsxs)(v,{children:[(0,C.jsx)(_,{title:s(`memory:memoryPage.selectedMemory`)}),Y?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`h2`,{children:Y.title}),(0,C.jsx)(`p`,{className:`muted-copy m-[8px_0_14px] text-[var(--text-muted)] text-[12px] leading-[1.55]`,children:Y.content}),(0,C.jsxs)(`div`,{className:`key-value [&:first-of-type]:mt-[7px] [&_span]:text-[var(--text-muted)] [&_button]:flex [&_button]:items-center [&_button]:gap-[4px] [&_button]:border-0 [&_button]:bg-transparent [&_button]:text-[var(--text-soft)] [&_button]:text-[12px] [&_strong]:min-w-0 [&_strong]:overflow-hidden [&_strong]:text-[13px] [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap flex min-h-[31px] items-center justify-between gap-[10px] [border-top:1px_solid_var(--stroke-soft)] text-[13px]`,children:[(0,C.jsx)(`span`,{children:s(`memory:memoryPage.memoryType`)}),(0,C.jsxs)(`strong`,{className:`inline-flex items-center gap-[6px]`,children:[(0,C.jsx)(`i`,{className:`g-dot [&.g-concept]:bg-[var(--g-concept)] [&.g-concept]:shadow-[0_0_5px_var(--g-concept-glow)] [&.g-file]:bg-[var(--g-file)] [&.g-file]:shadow-[0_0_5px_var(--g-file-glow)] [&.g-risk]:bg-[var(--g-risk)] [&.g-risk]:shadow-[0_0_5px_var(--g-risk-glow)] [&.g-preference]:bg-[var(--g-preference)] [&.g-preference]:shadow-[0_0_5px_var(--g-preference-glow)] [&.g-decision]:bg-[var(--g-decision)] [&.g-decision]:shadow-[0_0_5px_var(--g-decision-glow)] [&.g-fact]:bg-[var(--g-fact)] [&.g-fact]:shadow-[0_0_5px_var(--g-fact-glow)] [&.g-task]:bg-[var(--g-task)] [&.g-task]:shadow-[0_0_5px_var(--g-task-glow)] inline-block w-[7px] h-[7px] flex-none rounded-[50%] g-${Y.type}`}),E(Y.type,s)]})]}),(0,C.jsxs)(`div`,{className:`key-value [&:first-of-type]:mt-[7px] [&_span]:text-[var(--text-muted)] [&_button]:flex [&_button]:items-center [&_button]:gap-[4px] [&_button]:border-0 [&_button]:bg-transparent [&_button]:text-[var(--text-soft)] [&_button]:text-[12px] [&_strong]:min-w-0 [&_strong]:overflow-hidden [&_strong]:text-[13px] [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap flex min-h-[31px] items-center justify-between gap-[10px] [border-top:1px_solid_var(--stroke-soft)] text-[13px]`,children:[(0,C.jsx)(`span`,{children:s(`memory:memoryPage.source`)}),(0,C.jsx)(`strong`,{children:Y.sourceType===`conversation_confirmed`?s(`memory:memoryPage.userConfirmedConversationCandidate`):Y.sourceType===`user_confirmed`?s(`memory:memoryPage.explicitUserRequest`):Y.sourceType===`agent`?s(`memory:memoryPage.createdByAgent`):s(`memory:memoryPage.addedManually`)})]}),(0,C.jsxs)(`div`,{className:`key-value [&:first-of-type]:mt-[7px] [&_span]:text-[var(--text-muted)] [&_button]:flex [&_button]:items-center [&_button]:gap-[4px] [&_button]:border-0 [&_button]:bg-transparent [&_button]:text-[var(--text-soft)] [&_button]:text-[12px] [&_strong]:min-w-0 [&_strong]:overflow-hidden [&_strong]:text-[13px] [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap flex min-h-[31px] items-center justify-between gap-[10px] [border-top:1px_solid_var(--stroke-soft)] text-[13px]`,children:[(0,C.jsx)(`span`,{children:s(`memory:memoryPage.authority`)}),(0,C.jsxs)(`strong`,{children:[Y.authority??0,`/100`]})]}),Y.evidence&&(0,C.jsxs)(`div`,{className:`key-value [&:first-of-type]:mt-[7px] [&_span]:text-[var(--text-muted)] [&_button]:flex [&_button]:items-center [&_button]:gap-[4px] [&_button]:border-0 [&_button]:bg-transparent [&_button]:text-[var(--text-soft)] [&_button]:text-[12px] [&_strong]:min-w-0 [&_strong]:overflow-hidden [&_strong]:text-[13px] [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap flex min-h-[31px] items-center justify-between gap-[10px] [border-top:1px_solid_var(--stroke-soft)] text-[13px]`,children:[(0,C.jsx)(`span`,{children:s(`memory:memoryPage.evidence`)}),(0,C.jsx)(`strong`,{children:Y.evidence})]}),(0,C.jsxs)(`div`,{className:`key-value [&:first-of-type]:mt-[7px] [&_span]:text-[var(--text-muted)] [&_button]:flex [&_button]:items-center [&_button]:gap-[4px] [&_button]:border-0 [&_button]:bg-transparent [&_button]:text-[var(--text-soft)] [&_button]:text-[12px] [&_strong]:min-w-0 [&_strong]:overflow-hidden [&_strong]:text-[13px] [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap flex min-h-[31px] items-center justify-between gap-[10px] [border-top:1px_solid_var(--stroke-soft)] text-[13px]`,children:[(0,C.jsx)(`span`,{children:s(`memory:memoryPage.created`)}),(0,C.jsx)(`strong`,{children:k(Y.createdAt,x)})]}),(0,C.jsxs)(`div`,{className:`key-value [&:first-of-type]:mt-[7px] [&_span]:text-[var(--text-muted)] [&_button]:flex [&_button]:items-center [&_button]:gap-[4px] [&_button]:border-0 [&_button]:bg-transparent [&_button]:text-[var(--text-soft)] [&_button]:text-[12px] [&_strong]:min-w-0 [&_strong]:overflow-hidden [&_strong]:text-[13px] [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap flex min-h-[31px] items-center justify-between gap-[10px] [border-top:1px_solid_var(--stroke-soft)] text-[13px]`,children:[(0,C.jsx)(`span`,{children:s(`memory:memoryPage.relatedMemories`)}),(0,C.jsx)(`strong`,{children:s(`memory:memoryPage.count`,{count:Ce.size})})]}),(0,C.jsxs)(`div`,{className:`mt-[15px] flex gap-2 max-[650px]:flex-wrap`,children:[(0,C.jsxs)(i,{size:`lg`,onClick:()=>R(Y),children:[(0,C.jsx)(u,{size:14}),s(`memory:memoryPage.edit`)]}),(0,C.jsxs)(i,{variant:`destructive`,size:`lg`,onClick:()=>Ee(Y),children:[(0,C.jsx)(d,{size:14}),s(`memory:memoryPage.delete`)]})]})]}):(0,C.jsx)(`p`,{className:`muted-copy m-[8px_0_14px] text-[var(--text-muted)] text-[12px] leading-[1.55]`,children:s(`memory:memoryPage.selectAMemoryInTheMapToViewItsDetails`)}),pe&&(0,C.jsx)(h,{children:pe})]}),(0,C.jsxs)(v,{children:[(0,C.jsx)(_,{title:s(`memory:memoryPage.relatedFiles`)}),Te.map(e=>(0,C.jsxs)(`div`,{className:`file-row [&_span]:flex [&_span]:min-w-0 [&_span]:flex-col [&_span]:gap-[3px] [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] [&_button]:border-0 [&_button]:bg-transparent [&_button]:text-[var(--text-soft)] [&_button]:text-[13px] grid grid-cols-[auto_minmax(0,1fr)_auto_auto_auto] items-center gap-[6px] [border-top:1px_solid_var(--stroke-soft)] [padding:8px_0]`,children:[(0,C.jsx)(c,{size:15}),(0,C.jsxs)(`span`,{children:[(0,C.jsx)(`strong`,{children:e.title}),(0,C.jsx)(`small`,{children:e.sourcePath||e.cwd||s(`memory:memoryPage.localMemory`)})]}),(0,C.jsx)(`button`,{onClick:()=>F(e.id),children:s(`memory:memoryPage.view`)}),(0,C.jsx)(`button`,{onClick:()=>R(e),children:(0,C.jsx)(u,{size:13})}),(0,C.jsx)(`button`,{className:`danger`,onClick:()=>Ee(e),children:(0,C.jsx)(d,{size:13})})]},e.id)),!Te.length&&(0,C.jsx)(`p`,{className:`muted-copy m-[8px_0_14px] text-[var(--text-muted)] text-[12px] leading-[1.55]`,children:s(`memory:memoryPage.thisMemoryHasNoRelatedFiles`)})]})]}),L&&(0,C.jsx)(le,{spaces:T.spaces,node:L.id?L:null,initialSpaceId:L.spaceId||M,onClose:()=>R(null),onSaved:async t=>{R(null),e(t),await J(M)}}),z&&(0,C.jsx)(ue,{space:z.id?z:null,onClose:()=>B(null),onSaved:async(t,n)=>{B(null),N(t.id),e(n)}})]})}function le({spaces:e,node:t,initialSpaceId:n,onClose:r,onSaved:o}){let{t:c}=a(),[l,d]=(0,S.useState)({spaceId:t?.spaceId||n||e[0]?.id||``,title:t?.title||``,content:t?.content||``,type:t?.type||`concept`,sourcePath:t?.sourcePath||``,importance:t?.importance??.5}),[f,_]=(0,S.useState)(!1),[v,b]=(0,S.useState)(``);return(0,C.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,C.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:async e=>{e.preventDefault(),_(!0),b(``);try{await p(t?`/api/memory/nodes/${encodeURIComponent(t.id)}`:`/api/memory/nodes`,{method:t?`PATCH`:`POST`,body:JSON.stringify(l)}),await o(c(t?`memory:memoryPage.memoryUpdated`:`memory:memoryPage.memoryCreated`))}catch(e){b(j(e))}finally{_(!1)}},children:[(0,C.jsxs)(g,{children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h2`,{children:c(t?`memory:memoryPage.editMemory`:`memory:memoryPage.addMemory`)}),(0,C.jsx)(`p`,{children:c(`memory:memoryPage.lightUpIdeasWorthKeepingAsMemoriesYouCanReturnToLater`)})]}),(0,C.jsx)(i,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":c(`memory:memoryPage.closeDialog`),onClick:r,children:(0,C.jsx)(y,{size:17})})]}),(0,C.jsxs)(x,{variant:`control`,children:[c(`memory:memoryPage.memorySpace`),(0,C.jsx)(s,{value:l.spaceId,onChange:e=>d({...l,spaceId:e.target.value}),children:e.map(e=>(0,C.jsx)(`option`,{value:e.id,children:A(e,c)},e.id))})]}),(0,C.jsxs)(x,{variant:`control`,children:[c(`memory:memoryPage.memoryTitle`),(0,C.jsx)(`input`,{value:l.title,onChange:e=>d({...l,title:e.target.value}),placeholder:c(`memory:memoryPage.forExampleProjectUIConstraints`)})]}),(0,C.jsxs)(x,{variant:`control`,children:[c(`memory:memoryPage.memoryContent`),(0,C.jsx)(`textarea`,{value:l.content,onChange:e=>d({...l,content:e.target.value}),placeholder:c(`memory:memoryPage.recordStandaloneReusableMemoryForFutureChats`)})]}),(0,C.jsxs)(`div`,{className:`form-grid grid gap-[9px]`,children:[(0,C.jsxs)(x,{variant:`control`,children:[c(`memory:memoryPage.memoryType`),(0,C.jsx)(s,{value:l.type,onChange:e=>d({...l,type:e.target.value}),children:ae.map(e=>(0,C.jsx)(`option`,{value:e,children:E(e,c)},e))})]}),(0,C.jsxs)(x,{variant:`control`,children:[c(`memory:memoryPage.importance`),(0,C.jsxs)(s,{value:l.importance,onChange:e=>d({...l,importance:Number(e.target.value)}),children:[(0,C.jsx)(`option`,{value:`0.3`,children:c(`memory:memoryPage.normal`)}),(0,C.jsx)(`option`,{value:`0.5`,children:c(`memory:memoryPage.common`)}),(0,C.jsx)(`option`,{value:`0.8`,children:c(`memory:memoryPage.important`)}),(0,C.jsx)(`option`,{value:`1`,children:c(`memory:memoryPage.strict`)})]})]})]}),(0,C.jsxs)(x,{variant:`control`,children:[c(`memory:memoryPage.relatedFilePath`),(0,C.jsx)(`input`,{value:l.sourcePath,onChange:e=>d({...l,sourcePath:e.target.value}),placeholder:c(`memory:memoryPage.optionalForExampleECodeProjectREADMEMd`)})]}),v&&(0,C.jsx)(h,{children:v}),(0,C.jsxs)(`div`,{className:`flex justify-end gap-[8px] [margin-top:18px]`,children:[(0,C.jsx)(i,{type:`button`,variant:`outline`,size:`lg`,className:`bg-surface-subtle`,onClick:r,children:c(`memory:memoryPage.cancel`)}),(0,C.jsxs)(i,{size:`lg`,disabled:f||!l.spaceId||!l.title.trim()||!l.content.trim(),children:[f?(0,C.jsx)(m,{className:`animate-spin`,size:14}):(0,C.jsx)(u,{size:14}),c(f?`memory:memoryPage.saving`:`memory:memoryPage.save`)]})]})]})})}function ue({space:e,onClose:t,onSaved:n}){let{t:r}=a(),[o,s]=(0,S.useState)(e?.name||``),[c,l]=(0,S.useState)(!1),[u,d]=(0,S.useState)(``);return(0,C.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&&t(),children:(0,C.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:async t=>{t.preventDefault(),l(!0),d(``);try{await n(await p(e?`/api/memory/spaces/${encodeURIComponent(e.id)}`:`/api/memory/spaces`,{method:e?`PATCH`:`POST`,body:JSON.stringify({name:o,kind:`custom`})}),r(e?`memory:memoryPage.memorySpaceRenamed`:`memory:memoryPage.memorySpaceCreated`))}catch(e){d(j(e))}finally{l(!1)}},children:[(0,C.jsxs)(g,{children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h2`,{children:r(e?`memory:memoryPage.renameMemorySpace`:`memory:memoryPage.newMemorySpace`)}),(0,C.jsx)(`p`,{children:r(`memory:memoryPage.giveEachThemeOrProjectItsOwnMemorySpaceSoDurableMemoriesHaveSomewhereToBelong`)})]}),(0,C.jsx)(i,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":r(`memory:memoryPage.closeDialog`),onClick:t,children:(0,C.jsx)(y,{size:17})})]}),(0,C.jsxs)(x,{variant:`control`,children:[r(`memory:memoryPage.memorySpaceName`),(0,C.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),placeholder:r(`memory:memoryPage.forExampleProductDesignGuidelines`),autoFocus:!0})]}),u&&(0,C.jsx)(h,{children:u}),(0,C.jsxs)(`div`,{className:`flex justify-end gap-[8px] [margin-top:18px]`,children:[(0,C.jsx)(i,{type:`button`,variant:`outline`,size:`lg`,className:`bg-surface-subtle`,onClick:t,children:r(`memory:memoryPage.cancel`)}),(0,C.jsxs)(i,{size:`lg`,disabled:c||!o.trim(),children:[c?(0,C.jsx)(m,{className:`animate-spin`,size:14}):(0,C.jsx)(b,{size:14}),r(c?`memory:memoryPage.saving`:`memory:memoryPage.save`)]})]})]})})}export{M as MemoryPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./vendor-react-CHuvPdJE.js";import{n as t,t as n}from"./button-CDkfouZn.js";import{t as r}from"./use-i18n-D_qTnnhp.js";import{t as i}from"./utils-C8uzG5AZ.js";import{t as a}from"./link-2-CDKitOSW.js";import{t as o}from"./play-CRwfAjca.js";import{t as s}from"./save-DAkFWHyI.js";import{t as c}from"./search-CAq4c_43.js";import{t as l}from"./square-terminal-Pww63y-M.js";import{t as u}from"./square-D2anbrZz.js";import{gt as d,j as f,vt as p}from"./index-D1NIRA25.js";var m=t(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),h=t(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),g=t(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),_=t(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),v=e(),y={system:m,light:_,dark:g};function b({meta:e,page:t,query:m,setQuery:g,configSection:_,onMenu:b,onPrimary:x,theme:S,onCycleTheme:C,searchInputRef:w,workflowActions:T,desktopPlatform:E,terminalOpen:D,onToggleTerminal:O}){let{t:k}=r(),A={chatHistory:[k(`navigation:pageHeader.newChat`),p],assets:[k(`navigation:pageHeader.addLink`),a],channels:[k(`navigation:pageHeader.connectChannel`),p],schedules:[k(`navigation:pageHeader.newTask`),p],config:[k(`navigation:pageHeader.addProvider`),p],plugins:[k(`navigation:pageHeader.savePolicy`),s],memory:[k(`navigation:pageHeader.addMemory`),p],mcp:[k(`navigation:pageHeader.addService`),p],skills:[k(`navigation:pageHeader.installSkill`),p],workflows:[k(`navigation:pageHeader.newWorkflow`),p],workflowCreate:[k(`navigation:pageHeader.publish`),d]},j=t===`config`&&_!==`models`?null:A[t],M=y[S],N=k(S===`light`?`navigation:pageHeader.light`:S===`dark`?`navigation:pageHeader.dark`:`navigation:pageHeader.system`),P=!!E;return(0,v.jsxs)(`header`,{className:i(`relative z-[2] flex min-h-14 flex-none items-center gap-3.5 px-6 pt-[9px] pb-[7px] in-data-[density=compact]:min-h-[50px] in-data-[density=compact]:pt-1.5 in-data-[density=compact]:pb-[5px] max-[650px]:min-h-[126px] max-[650px]:flex-wrap max-[650px]:content-center max-[650px]:gap-2.5 max-[650px]:px-4 max-[650px]:py-2.5`,t===`chat`&&`min-h-[52px] px-5 pt-2 pb-1.5 in-data-[density=compact]:min-h-[46px] max-[650px]:min-h-[126px] max-[650px]:px-4 max-[650px]:pt-3.5 max-[650px]:pb-2.5`,P&&`[-webkit-app-region:drag]`,E===`darwin`&&`pl-[74px]`),children:[(0,v.jsx)(f,{className:i(`hidden size-[34px] place-items-center rounded-[var(--r-sm)] border border-[var(--stroke)] bg-[var(--solid)] max-[900px]:grid`,P&&`[-webkit-app-region:no-drag]`),onClick:b,children:(0,v.jsx)(h,{size:19})}),(0,v.jsxs)(`div`,{className:`mr-auto flex min-w-[170px] items-baseline gap-2.5 max-[650px]:block max-[650px]:min-w-0 max-[650px]:flex-1`,children:[(0,v.jsx)(`h1`,{className:`text-base leading-[1.15] font-bold tracking-[0] max-[650px]:text-[21px]`,children:e[0]}),(0,v.jsx)(`p`,{className:`mt-0 min-w-0 overflow-hidden text-[12px] text-ellipsis whitespace-nowrap text-[var(--text-muted)] max-[650px]:mt-[3px] max-[650px]:whitespace-normal`,children:e[1]})]}),(0,v.jsxs)(`div`,{className:i(`flex min-w-0 items-center justify-end gap-2 max-[650px]:grid max-[650px]:w-full max-[650px]:grid-cols-[minmax(0,1fr)_auto] max-[650px]:justify-stretch`,t===`workflowCreate`&&`max-[650px]:grid-cols-[repeat(3,auto)] max-[650px]:justify-end`,P&&`[-webkit-app-region:no-drag]`,E&&E!==`darwin`&&`pr-[138px]`),children:[t===`workflowCreate`?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(n,{variant:`outline`,size:`lg`,className:`bg-surface-subtle max-[650px]:col-auto max-[650px]:row-start-1`,disabled:!T||T.busy||T.running,onClick:()=>T?.save(),children:[(0,v.jsx)(s,{size:15}),k(`navigation:pageHeader.saveDraft`)]}),(0,v.jsxs)(n,{size:`lg`,className:`max-[650px]:col-auto max-[650px]:row-start-1`,disabled:!T||T.busy,onClick:()=>T?.run(),children:[T?.running?(0,v.jsx)(u,{size:15}):(0,v.jsx)(o,{size:15}),T?.running?k(`navigation:pageHeader.stop`):k(`navigation:pageHeader.testRun`)]})]}):t===`chat`?null:(0,v.jsxs)(`label`,{className:`flex h-[34px] w-[min(250px,24vw)] items-center gap-[7px] rounded-[var(--r-sm)] border border-[var(--stroke)] bg-[var(--search-bg)] px-2.5 text-[var(--text-muted)] focus-within:border-[var(--focus)] focus-within:shadow-[0_0_0_3px_var(--focus-ring)] in-data-[density=compact]:h-[30px] max-[900px]:w-[190px] max-[650px]:col-start-1 max-[650px]:row-start-1 max-[650px]:w-full max-[650px]:min-w-0`,title:k(`navigation:pageHeader.search`),children:[(0,v.jsx)(c,{size:15}),(0,v.jsx)(`input`,{className:`w-full min-w-0 border-0 bg-transparent text-[13px] text-[var(--text)] outline-none`,ref:w,value:m,onChange:e=>g(e.target.value),placeholder:t===`mcp`?k(`navigation:pageHeader.searchServicesOrTools`):t===`memory`?k(`navigation:pageHeader.searchMemoriesOrFiles`):k(`navigation:pageHeader.searchPage`,{page:e[0]})})]}),j&&(0,v.jsxs)(n,{size:`lg`,className:`max-[650px]:col-start-2 max-[650px]:row-start-1`,title:k(`navigation:pageHeader.primaryActionShortcut`,{action:j[0]}),onClick:x,children:[(()=>{let e=j[1];return(0,v.jsx)(e,{size:15})})(),j[0]]}),P&&(0,v.jsx)(n,{variant:`ghost`,size:`icon`,className:D?`bg-surface-hover text-brand`:void 0,title:k(`navigation:pageHeader.toggleTerminal`),"aria-label":k(`navigation:pageHeader.toggleTerminal`),"aria-pressed":D,onClick:O,children:(0,v.jsx)(l,{size:16})}),(0,v.jsx)(n,{variant:`outline`,size:`icon`,className:`bg-[var(--solid)] max-[650px]:absolute max-[650px]:top-3.5 max-[650px]:right-4`,title:k(`navigation:pageHeader.themeThemeClickToSwitch`,{theme:N}),"aria-label":k(`navigation:pageHeader.themeThemeClickToSwitchThemes`,{theme:N}),onClick:C,children:(0,v.jsx)(M,{size:16})})]})]})}export{b as PageHeader};
|