limixbot 0.3.141 → 0.3.143
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/dist/assets/{ActivityPanel-D2qDgfNj.js → ActivityPanel-D5VsAHpV.js} +1 -1
- package/dist/assets/{App-DVlUATuq.js → App-BFnQK962.js} +91 -91
- package/dist/assets/{AppEventEditor-CmS34S85.js → AppEventEditor-npoRs7Gv.js} +1 -1
- package/dist/assets/{BotSettingsDialog-BY263Hpx.js → BotSettingsDialog-DyQB_KER.js} +1 -1
- package/dist/assets/{BrowserPanel-DLVH7EJz.js → BrowserPanel-B-Gb4Ryo.js} +1 -1
- package/dist/assets/{BrowserProfilesManager-D3g9wElR.js → BrowserProfilesManager-C4_r4TCi.js} +1 -1
- package/dist/assets/{CloudAddDialog-DPjSxdZe.js → CloudAddDialog-BiZwg41q.js} +1 -1
- package/dist/assets/{ComputerFilesPane-CIPgFHiZ.js → ComputerFilesPane-DfJRiNEq.js} +1 -1
- package/dist/assets/{ComputerPanel-DKZ15Lrh.js → ComputerPanel-WDw0cKiS.js} +2 -2
- package/dist/assets/{DataPanel-DkAmUHzs.js → DataPanel-CA6Q5vTA.js} +1 -1
- package/dist/assets/{DesktopViewer-DHpPKouz.js → DesktopViewer-CiOyDjp2.js} +1 -1
- package/dist/assets/{GrokMoveDialog-CgvM91-Q.js → GrokMoveDialog-CdQMwpiq.js} +1 -1
- package/dist/assets/{InspectorPanel-CaqVaz-4.js → InspectorPanel-6owsh6AF.js} +1 -1
- package/dist/assets/{KeyboardShortcutsModal-CFccCEn6.js → KeyboardShortcutsModal-BmmNyVQ1.js} +1 -1
- package/dist/assets/{LimixResizeHandles-B05qQGL-.js → LimixResizeHandles-B9fy1QSR.js} +1 -1
- package/dist/assets/{LiveDesktop-Bmf7e4Tu.js → LiveDesktop-BjD6CYlm.js} +1 -1
- package/dist/assets/{LocalVmWorkspace-B3bDhQ9N.js → LocalVmWorkspace-CKA42noW.js} +1 -1
- package/dist/assets/{MacLocalControl-D8SRatvL.js → MacLocalControl-CR4SkBMx.js} +1 -1
- package/dist/assets/{MarkdownFilePreview-C9mfh0mo.js → MarkdownFilePreview-DpSyTelP.js} +1 -1
- package/dist/assets/{MenuMotion-DuXPPcvo.js → MenuMotion-CJ3EL6xi.js} +1 -1
- package/dist/assets/{NewBotDialog-CLFDLsS2.js → NewBotDialog-CTj8zOTI.js} +1 -1
- package/dist/assets/{PhoneAppDialog-DnUaN-Fw.js → PhoneAppDialog-DUOfnoVL.js} +1 -1
- package/dist/assets/{PlacesRail-BJ-bXfSa.js → PlacesRail-owo7-LYs.js} +1 -1
- package/dist/assets/{PluginsPanel-BZBrWQa4.js → PluginsPanel-BaDKsIiF.js} +1 -1
- package/dist/assets/{ProIntroduction-CKjldFF7.js → ProIntroduction-ygc-IDwt.js} +1 -1
- package/dist/assets/{RemoteAgentSettingsPanel-DR-uywnp.js → RemoteAgentSettingsPanel-Bsk-uLU6.js} +1 -1
- package/dist/assets/{RoomPanel-DziKRgaS.js → RoomPanel-Beak5cFq.js} +1 -1
- package/dist/assets/RoutinesPage-E0_zyR6z.js +4 -0
- package/dist/assets/{SettingsModal-B6gPauoi.js → SettingsModal-B7L3QwQY.js} +1 -1
- package/dist/assets/{ShareTeamDialog-poRrRYw-.js → ShareTeamDialog-0eIGkV95.js} +1 -1
- package/dist/assets/{SignedInSites-CRn_yDkj.js → SignedInSites-DJDN1MMs.js} +1 -1
- package/dist/assets/{TeamLibraryPanel-xD4xGcM6.js → TeamLibraryPanel-T_B92anY.js} +1 -1
- package/dist/assets/{TeamMapPage-BRw5VmSq.js → TeamMapPage-BRnNgoL4.js} +1 -1
- package/dist/assets/{TriggersPage-C1ZtmBq8.js → TriggersPage-B9x6InCY.js} +1 -1
- package/dist/assets/{VisibilitySection-C9airA4D.js → VisibilitySection-CM3W0MSu.js} +1 -1
- package/dist/assets/{WebhookTrigger-zYpN5d7o.js → WebhookTrigger-CBbyorl9.js} +1 -1
- package/dist/assets/{WorksOnGrid-KJ3p-nHy.js → WorksOnGrid-D_dPyzr3.js} +1 -1
- package/dist/assets/{abnfDiagram-YUKMZFIV-CSHaWbId.js → abnfDiagram-YUKMZFIV-BShIKw4N.js} +1 -1
- package/dist/assets/{activity-B-rv6SH8.js → activity-Dg86AW-Y.js} +1 -1
- package/dist/assets/{architectureDiagram-47P4ROYG-Ck3N_K_O.js → architectureDiagram-47P4ROYG-CmJg21RW.js} +1 -1
- package/dist/assets/{blockDiagram-E7TT5TSB-pBM7maMq.js → blockDiagram-E7TT5TSB-Aj1hwdGc.js} +1 -1
- package/dist/assets/{c4Diagram-CRA5TL53-Bf-p0I8b.js → c4Diagram-CRA5TL53-DW8z1IzA.js} +1 -1
- package/dist/assets/{calendar-days-CHQoR3I7.js → calendar-days-uny4AeNj.js} +1 -1
- package/dist/assets/channel-DI3JBS-g.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-DlQOtOaL.js → chunk-2Q5K7J3B-Td582DAI.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-CiOX0aHl.js → chunk-5VM5RSS4-DcogMbBa.js} +1 -1
- package/dist/assets/{chunk-7TKQ45FW-BTushWZv.js → chunk-7TKQ45FW-C3iGtJOF.js} +1 -1
- package/dist/assets/{chunk-AW2ZBBNX-aJ3nOFgT.js → chunk-AW2ZBBNX-CrMPDJa8.js} +1 -1
- package/dist/assets/{chunk-FVRAUYC3-CyeNqn_N.js → chunk-FVRAUYC3-o1j5js-h.js} +2 -2
- package/dist/assets/{chunk-HTAEGDNF-P55CSFqg.js → chunk-HTAEGDNF-11Po0gGl.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-BhrD2ioJ.js → chunk-JWPE2WC7-DNNG2IRB.js} +1 -1
- package/dist/assets/{chunk-KQW6MTUR-BDxkLHse.js → chunk-KQW6MTUR-8bqxTMty.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-BPP3938f.js → chunk-XXDRQBXY-nBGQqm9O.js} +1 -1
- package/dist/assets/{classDiagram-v2-K4WV4PDN-BZbKyiCn.js → classDiagram-v2-K4WV4PDN-tyTV-26Y.js} +1 -1
- package/dist/assets/{coins-C9XJU_4V.js → coins-9fYbHf4u.js} +1 -1
- package/dist/assets/{core-BUwTlq4P.js → core-C06bWOSD.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-C7d1E0jy.js → cose-bilkent-JH36ORCC-B3N4BJ97.js} +1 -1
- package/dist/assets/{cynefin-EF2NZ3EQ-Dpnrpxzf.js → cynefin-EF2NZ3EQ-CkGBluyX.js} +1 -1
- package/dist/assets/{cynefinDiagram-3GCD6N5R-1qGYRFwt.js → cynefinDiagram-3GCD6N5R-Cw7BUT2F.js} +1 -1
- package/dist/assets/{dagre-W4DXFKR2-DSfoACwc.js → dagre-W4DXFKR2-D0Adi0WD.js} +1 -1
- package/dist/assets/{diagram-2UJZ2QOL-Dr3i5W8y.js → diagram-2UJZ2QOL-DglYBdi-.js} +1 -1
- package/dist/assets/{diagram-OVF4WLC6-Kp35HPdA.js → diagram-OVF4WLC6-BCESoOTI.js} +1 -1
- package/dist/assets/{diagram-PFPMY2P6-CjlhrI6Z.js → diagram-PFPMY2P6-CJPe3Aln.js} +1 -1
- package/dist/assets/{diagram-UMYRVEAY-DTW5ZRM1.js → diagram-UMYRVEAY-dihXhKwO.js} +1 -1
- package/dist/assets/{diagram-YEKJPTXX-m5Lo1ObV.js → diagram-YEKJPTXX-fMI2BfDq.js} +1 -1
- package/dist/assets/{diagram-ZIFT7M5P-D5C5w_He.js → diagram-ZIFT7M5P-BsyTuxHx.js} +1 -1
- package/dist/assets/{ebnfDiagram-VR2GEFS7-C-d31ZAB.js → ebnfDiagram-VR2GEFS7-DqUUqK6O.js} +1 -1
- package/dist/assets/{elk-IJKZMXRS-Bp6SD_1S.js → elk-IJKZMXRS-CInxAtfn.js} +1 -1
- package/dist/assets/{erDiagram-O2IAPWRE-B2JhynZv.js → erDiagram-O2IAPWRE-CtLhNkB3.js} +1 -1
- package/dist/assets/{file-up-C1s0CBrI.js → file-up-0W3zPN3C.js} +1 -1
- package/dist/assets/{flowDiagram-OXPTDLAJ-DeWXJ4_K.js → flowDiagram-OXPTDLAJ-CSJXQyPz.js} +1 -1
- package/dist/assets/{ganttDiagram-R7TSEDQI-CEqLhR3V.js → ganttDiagram-R7TSEDQI-BxPwhRE_.js} +1 -1
- package/dist/assets/{gitGraphDiagram-XJZIOB7I-BSgcVYrZ.js → gitGraphDiagram-XJZIOB7I-B7_5GQWX.js} +1 -1
- package/dist/assets/{import-name-DbblQVDB.js → import-name-DSkjrWGm.js} +1 -1
- package/dist/assets/{index-CZOD-N3O.js → index-DZeZApXw.js} +3 -3
- package/dist/assets/{index-D4gkCUyb.js → index-x-tLeVCm.js} +1 -1
- package/dist/assets/{infoDiagram-5W2HQ5XZ-BLfUURj8.js → infoDiagram-5W2HQ5XZ-DTe4tqre.js} +1 -1
- package/dist/assets/{ishikawaDiagram-K3B6WC7H-CrNMsTRP.js → ishikawaDiagram-K3B6WC7H-D_lFS_pL.js} +1 -1
- package/dist/assets/{journeyDiagram-COXZFDF6-CzPPBwy1.js → journeyDiagram-COXZFDF6-BWwkG9Wu.js} +1 -1
- package/dist/assets/{kanban-definition-P3RFRI5V-andT-HRd.js → kanban-definition-P3RFRI5V-yY-GGfzv.js} +1 -1
- package/dist/assets/{mermaid.core-BwghuPvM.js → mermaid.core-DH28Cv2M.js} +4 -4
- package/dist/assets/{mindmap-definition-LZFPQGKD-DZLJJqER.js → mindmap-definition-LZFPQGKD--BlKMUpH.js} +1 -1
- package/dist/assets/{minimize-CyN9vCVh.js → minimize-Cub3T_xk.js} +1 -1
- package/dist/assets/{monitor-rsXvQAT7.js → monitor-Bt-Nw5iC.js} +1 -1
- package/dist/assets/{new-bot-CrUATi6Y.js → new-bot-RHcTiQhX.js} +1 -1
- package/dist/assets/{org-library-DMy-TMqt.js → org-library-CWZn7Pto.js} +1 -1
- package/dist/assets/{package-format-DxsHLDfa.js → package-format-pwodjdBX.js} +1 -1
- package/dist/assets/{pegDiagram-BGZESJAR-Ag5ieNd4.js → pegDiagram-BGZESJAR-xNMFigxg.js} +1 -1
- package/dist/assets/{pieDiagram-CAPJLFHJ-BEKrcMMG.js → pieDiagram-CAPJLFHJ-BeqCVqVc.js} +1 -1
- package/dist/assets/{quadrantDiagram-GDMTTRAM-5NrUzt7G.js → quadrantDiagram-GDMTTRAM-BcXtvC07.js} +1 -1
- package/dist/assets/{rail-BEuN4gG8.js → rail-Bh9Kz5ar.js} +1 -1
- package/dist/assets/{railroadDiagram-SM67HX2B-BQUI7-8z.js → railroadDiagram-SM67HX2B-BBvW1QlX.js} +1 -1
- package/dist/assets/{remote-desktop-panel-DCwNJ1YY.js → remote-desktop-panel-ClKGLfg-.js} +1 -1
- package/dist/assets/{requirementDiagram-X7JNWC4A-DJizyC_R.js → requirementDiagram-X7JNWC4A-CJW-jnaM.js} +1 -1
- package/dist/assets/{sankeyDiagram-UM26HJRW-BDQyU8Wh.js → sankeyDiagram-UM26HJRW-DM75AxXv.js} +1 -1
- package/dist/assets/{sequenceDiagram-ZO4K6R2Y-BTaigEFp.js → sequenceDiagram-ZO4K6R2Y-C89f2OJQ.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-J__bNJvX.js → sizeCapture-INFHLROL-FvDzKQKk.js} +1 -1
- package/dist/assets/{stateDiagram-v2-TBUQTH76-CKOTLRyo.js → stateDiagram-v2-TBUQTH76-CBLS4xm0.js} +1 -1
- package/dist/assets/{styles-XkQHO_MZ.js → styles-B38kYzzJ.js} +4 -4
- package/dist/assets/{styles-LX3LEBWb.css → styles-Pta9BaPs.css} +1 -1
- package/dist/assets/{swimlanes-N4OXWK64-DPAhFVMp.js → swimlanes-N4OXWK64-0bIYZbSm.js} +1 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-BDfw8Tlz.js +8 -0
- package/dist/assets/{team-share-BqhAEQhI.js → team-share-DLeRlsAM.js} +1 -1
- package/dist/assets/{timeline-definition-YOQAKGHF-CUrEL6lo.js → timeline-definition-YOQAKGHF-D90qmKgS.js} +1 -1
- package/dist/assets/{usecaseDiagram-VIAY4XPW-DdD_FmQL.js → usecaseDiagram-VIAY4XPW-ZU4U3uEB.js} +1 -1
- package/dist/assets/{vennDiagram-BLWOH2XV-i8yTvYzp.js → vennDiagram-BLWOH2XV-DaL2hish.js} +1 -1
- package/dist/assets/{vi-Ck4CHn3q.js → vi-DyvsTHbT.js} +3 -3
- package/dist/assets/{wardleyDiagram-YMQ3BMBF-CK5DR3ZK.js → wardleyDiagram-YMQ3BMBF-idgSzgFw.js} +1 -1
- package/dist/assets/{xychartDiagram-TAQBALBS-BvUrUg5I.js → xychartDiagram-TAQBALBS-Dux_Zrd0.js} +1 -1
- package/dist/index.html +3 -3
- package/dist/rail.html +5 -5
- package/dist-server/index.js +41 -37
- package/dist-server/package.json +1 -1
- package/dist-server/server/automation-reports.js +5 -2
- package/dist-server/server/host/proactive.js +5 -2
- package/dist-server/server/host/routine-checks.js +30 -8
- package/dist-server/server/routine-execution.js +3 -1
- package/dist-server/server/routine-lines.js +3 -0
- package/dist-server/shared/routine-quiet.js +9 -0
- package/package.json +1 -1
- package/dist/assets/RoutinesPage-BCXo72z8.js +0 -2
- package/dist/assets/channel-COvC08kf.js +0 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-BRiVojk7.js +0 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as s,r as l,b as De,j as e,X as we,d as Oe,a as te,ah as je,ai as Me,q as Ue,v as Fe,aj as ze,ak as Ie,al as Ke,l as ke,am as _e,an as $e,ao as qe,ap as He,aq as Je,p as ce,G as Ve}from"./styles-XkQHO_MZ.js";import{j as C,E as We,u as S,bV as se,bW as Ye,a2 as v,S as R,bX as Ge,bY as Se,bZ as ne,b_ as Xe,b$ as Ze,c0 as Qe,c1 as et,c2 as de,c3 as ue,c4 as tt,c5 as st,c6 as nt,c7 as Ne,w as D,c8 as at,c9 as it,ca as rt,x as H,cb as lt,b as Ce,cc as pe,cd as ot,ce as ct,cf as dt,cg as ut,ch as pt,ci as xt,cj as mt,ck as gt,cl as ht,cm as ft,cn as bt,co as vt,cp as xe,cq as yt,cr as wt,cs as jt,ct as kt,cu as Ee,bM as ee,cv as St,cw as Nt,cx as Ct,cy as Et,cz as Bt,cA as me,T as Be,cB as Rt}from"./App-DVlUATuq.js";import{B as ge,E as Pt,s as At,r as he,p as Tt,c as Lt,a as Dt}from"./new-bot-CrUATi6Y.js";import{o as Ot}from"./index-CZOD-N3O.js";import{I as Mt,S as Ut,a as Ft,A as zt,M as It,P as Kt,V as _t,v as $t,i as fe}from"./VisibilitySection-C9airA4D.js";import{R as qt}from"./RoutinesPage-BCXo72z8.js";import{r as Ht,L as Y,Q as Jt,R as Vt,U as Wt,P as Yt}from"./PlacesRail-BJ-bXfSa.js";import{p as Gt,d as Xt,e as Zt,f as Qt}from"./team-share-BqhAEQhI.js";import{B as es}from"./BrowserProfilesManager-D3g9wElR.js";function ts(t){const n=[];for(const a of t){const i=a.source==="org"?s("newBot.presetsFromOrganization",{name:a.publisherName??a.packageName}):s("newBot.presetsImported"),r=n.find(d=>d.label===i);r?r.presets.push(a):n.push({label:i,presets:[a]})}return n}function ss(t){const n={name:t.bot.name??t.name,title:t.bot.title??"",description:t.bot.description??"",soul:t.bot.soul??""},a=t.bot.appearance;return a&&(n.color=a.color,n.mascotExpression=a.mascotExpression??null,a.mascotBody&&(n.mascotBody=a.mascotBody)),n}function ns(t){const n=t.bot.appearance?.avatar;if(!n)return null;let a;try{a=atob(n.data)}catch{return null}const i=new Uint8Array(a.length);for(let r=0;r<a.length;r+=1)i[r]=a.charCodeAt(r);return new File([i],`preset.${n.mime.slice(6)}`,{type:n.mime})}function as(t){const n=[t.source==="org"&&t.publisherName?s("newBot.presetFromOrg",{package:t.packageName,release:t.release,publisher:t.publisherName}):s("newBot.presetFrom",{package:t.packageName,release:t.release})];t.description&&n.push(t.description);const a=t.skills.map(i=>i.name).join(", ");return a&&n.push(s(t.skillsEnabled?"newBot.presetSkillsOn":"newBot.presetSkillsOff",{names:a})),t.notes.length&&n.push(s("newBot.presetNotes",{names:t.notes.join(", ")})),t.playbooks.length&&n.push(s("newBot.presetPlaybooks",{names:t.playbooks.join(", ")})),n.push(s("newBot.presetKeeps")),n}function is(t){return{id:t.id,skills:t.skills.map(n=>n.name),notes:[...t.notes]}}function be(t){const n=a=>a?.trim()?a.trim():void 0;return{format:"package",version:2,kind:"library",name:n(t.name),presetName:n(t.name),presetDescription:n(t.description),release:n(t.release),notes:n(t.notes),includeMemory:t.includeNotes,...t.picture?{presetAvatar:t.picture}:{},...t.dryRun?{dryRun:!0}:{}}}function ve({preview:t,localSkips:n}){const a=t.document.package.presets?.[0],i=Object.keys(a?.seed?.memory??{}).length,r=[[s("teamShare.part.skills"),a?.skills?.length?`${a.skills.length} · ${a.skills.join(", ")}`:"0"],[s("teamShare.part.notes"),i?String(i):s("teamShare.none")],[s("teamShare.part.pictures"),a?.bot.appearance?.avatar?s("teamShare.yes"):s("teamShare.none")]],d=[...n,...t.skipped.map(c=>Xt(c,t.document))];return e.jsxs("div",{children:[e.jsx("div",{className:"text-[12px] font-medium text-ink-secondary",children:s("teamShare.included")}),e.jsx("dl",{className:"mt-2 grid grid-cols-[minmax(0,1fr)_auto] gap-x-4 gap-y-1.5 rounded-xl bg-raised/45 px-4 py-3 text-[13px]",children:r.map(([c,p])=>e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"text-ink-secondary",children:c}),e.jsx("dd",{className:"max-w-[300px] truncate text-right text-ink",title:p,children:p})]},c))}),e.jsxs("p",{className:"mt-3 flex items-start gap-2 text-[13px] leading-relaxed text-ink-secondary",children:[e.jsx(We,{size:15,className:"mt-0.5 shrink-0 text-success"}),e.jsx("span",{children:s("presetShare.never")})]}),t.redacted.length>0&&e.jsxs("div",{className:"mt-3 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:s("teamShare.redacted")}),e.jsx("ul",{className:"mt-1 list-disc pl-5",children:t.redacted.map(c=>e.jsx("li",{children:Zt(c,t.document)},c))})]}),d.length>0&&e.jsxs("div",{className:"mt-3 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:s("teamShare.skipped")}),e.jsx("ul",{className:"mt-1 list-disc pl-5",children:d.map((c,p)=>e.jsx("li",{children:c},`${c}-${p}`))})]})]})}function rs({onClose:t}){const n=l.useRef(null),[a,i]=l.useState(""),[r,d]=l.useState(""),[c,p]=l.useState(""),[o,h]=l.useState(""),[y,O]=l.useState(!0),[w,m]=l.useState(!0),[g,P]=l.useState(null),[b,A]=l.useState(null),[f,T]=l.useState(!1),[M,G]=l.useState(null),[I,F]=l.useState(""),_=l.useRef(0);l.useEffect(()=>{let u=!1;return C("/api/bot-defaults").then(async({defaults:E})=>{!u&&E.profile.name?.trim()&&i(L=>L||E.profile.name.trim());const N=await Gt([{id:"defaults",avatarUrl:E.profile.avatarUrl,avatarCrop:E.profile.avatarCrop}]);u||P({dataUrl:N.avatars.defaults,skipped:N.skipped.map(L=>`${s("teamShare.field.picture")} — ${De(`teamShare.skip.${L.reason}`,L.reason)}`)})}).catch(()=>{u||P({skipped:[]})}),()=>{u=!0}},[]);const $=u=>({name:a,description:r,release:c,notes:o,includeNotes:y,dryRun:u,...w&&g?.dataUrl?{picture:g.dataUrl}:{}});l.useEffect(()=>{if(!g)return;const u=++_.current,E=window.setTimeout(()=>{C("/api/teams/export",{method:"POST",body:JSON.stringify(be({...$(!0),release:void 0}))}).then(N=>{u===_.current&&(A(N),F(""),p(L=>L||N.document.package.release))}).catch(N=>{u===_.current&&(A(null),F(N instanceof Error?N.message:String(N)))})},250);return()=>window.clearTimeout(E)},[g,y,w]);const X=async()=>{if(!f){T(!0),F("");try{const u=await C("/api/teams/export",{method:"POST",body:JSON.stringify(be($(!1)))});Qt(u.filename,u.document),G(u)}catch(u){F(u instanceof Error?u.message:String(u))}finally{T(!1)}}};l.useEffect(()=>{const u=document.activeElement instanceof HTMLElement?document.activeElement:null;return n.current?.focus(),()=>{u?.isConnected&&u.focus()}},[]);const z=w?g?.skipped??[]:[],K="mt-1 w-full rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[14px] text-ink disabled:opacity-60";return Ht.createPortal(e.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center bg-black/55 p-4",onMouseDown:u=>u.stopPropagation(),children:e.jsxs("div",{ref:n,role:"dialog","aria-modal":"true","aria-labelledby":"share-preset-title",tabIndex:-1,className:"flex max-h-[90vh] w-full max-w-[560px] flex-col overflow-hidden rounded-2xl border border-hairline/50 bg-panel text-ink shadow-2xl outline-none",onKeyDown:u=>{if(u.key==="Escape"&&!f&&(u.stopPropagation(),t()),u.key==="Tab"){const E=n.current?.querySelectorAll("input:enabled, textarea:enabled, button:enabled");if(!E?.length)return;const N=E[0],L=E[E.length-1];u.shiftKey&&document.activeElement===N?(u.preventDefault(),L.focus()):!u.shiftKey&&document.activeElement===L&&(u.preventDefault(),N.focus())}},children:[e.jsxs("header",{className:"flex items-start justify-between gap-3 px-6 pb-2 pt-5",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"share-preset-title",className:"text-[17px] font-semibold",children:s("presetShare.title")}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:s("presetShare.intro")})]}),e.jsx("button",{"aria-label":s("presetShare.close"),disabled:f,onClick:t,className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised",children:e.jsx(we,{size:18})})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pb-4 pt-2",children:M?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"flex items-center gap-2 text-[14px] font-medium text-ink",children:[e.jsx(Oe,{size:16,className:"text-success"}),s("teamShare.saved",{filename:M.filename})]}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:s("presetShare.savedHint")}),e.jsx("div",{className:"mt-4",children:e.jsx(ve,{preview:M,localSkips:z})})]}):e.jsxs(e.Fragment,{children:[b?e.jsx(ve,{preview:b,localSkips:z}):!I&&e.jsxs("div",{className:"flex items-center gap-2 py-6 text-[13px] text-ink-secondary",children:[e.jsx(Y,{size:15,className:"animate-spin"}),s("presetShare.preparing")]}),e.jsxs("fieldset",{className:"mt-4 space-y-2 text-[13px]",disabled:f,children:[e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",className:"size-4 accent-accent",checked:w,onChange:u=>m(u.target.checked)}),s("presetShare.includePicture")]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",className:"size-4 accent-accent",checked:y,onChange:u=>O(u.target.checked)}),s("presetShare.includeNotes")]})]}),e.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:[e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("presetShare.name"),e.jsx("input",{value:a,maxLength:100,disabled:f,onChange:u=>i(u.target.value),className:K})]}),e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("teamShare.release"),e.jsx("input",{value:c,maxLength:20,disabled:f,placeholder:"1.0.0",onChange:u=>p(u.target.value),className:K})]})]}),e.jsxs("label",{className:"mt-3 block text-[13px] text-ink-secondary",children:[s("presetShare.description"),e.jsx("input",{value:r,maxLength:300,disabled:f,onChange:u=>d(u.target.value),className:K})]}),e.jsxs("label",{className:"mt-3 block text-[13px] text-ink-secondary",children:[s("teamShare.notes"),e.jsx("textarea",{value:o,maxLength:4e3,rows:2,disabled:f,onChange:u=>h(u.target.value),className:K})]})]})}),I&&e.jsx("p",{role:"alert",className:"mx-6 mb-2 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:I}),e.jsx("footer",{className:"flex justify-end gap-2 border-t border-hairline/35 px-6 py-3",children:M?e.jsx("button",{onClick:t,className:"rounded-lg bg-accent px-4 py-2 text-[13px] font-medium text-white",children:s("teamShare.done")}):e.jsxs(e.Fragment,{children:[e.jsx("button",{disabled:f,onClick:t,className:"rounded-lg px-3 py-2 text-[13px] text-ink-secondary hover:bg-raised",children:s("common.cancel")}),e.jsxs("button",{disabled:f||!b,onClick:()=>{X()},className:"flex items-center gap-2 rounded-lg bg-accent px-4 py-2 text-[13px] font-medium text-white disabled:opacity-40",children:[f&&e.jsx(Y,{size:14,className:"animate-spin"}),f?s("teamShare.saving"):s("teamShare.save")]})]})})]})}),document.body)}function ae(){const{dispatch:t}=S(),[n,a]=l.useState(!1),[i,r]=l.useState("");return{saving:n,error:i,save:async c=>{if(!n){a(!0),r("");try{const p=await C("/api/config",{method:"PATCH",body:JSON.stringify(c)});t({type:"configStatus",config:p})}catch(p){r(p instanceof Error?p.message:s("settings.experimental.error"))}finally{a(!1)}}}}}function Ts(){const{state:t}=S(),n=se(t.config),a=Ye(t.config),i=t.config?.browserEngine?.installable===!0,r=window.ogb?.platform==="win32"&&!a&&!i,{saving:d,error:c,save:p}=ae();return e.jsx(v,{title:s("settings.experimental.browserAria"),subtitle:a?n?s("settings.experimental.browserOn"):s("settings.experimental.browserOff"):r?s("settings.experimental.browserWindows"):Ge(t.config),message:c?e.jsx("p",{role:"alert",className:"text-danger",children:c}):null,children:e.jsx(R,{checked:n,"aria-label":s("settings.experimental.browserAria"),disabled:d||!n&&!a&&!i,onClick:()=>{p({features:{browser:!n}})},className:"disabled:cursor-wait disabled:opacity-50"})})}function Ls(){const{state:t}=S(),n=Se(),a=t.config?.browserEngine?.serverSites,{saving:i,error:r,save:d}=ae();return a===void 0||n!==!0||!se(t.config)?null:e.jsx(v,{title:s("settings.browser.serverSites"),subtitle:s("settings.browser.serverSitesDetail"),message:r?e.jsx("p",{role:"alert",className:"text-danger",children:r}):null,children:e.jsx(R,{checked:a,"aria-label":s("settings.browser.serverSites"),disabled:i,onClick:()=>{d({browserEngine:{egress:{localNetwork:!a}}})},className:"disabled:cursor-wait disabled:opacity-50"})})}function ls(){const{state:t}=S(),n=t.config?.browserEngine?.engine==="chrome",{saving:a,error:i,save:r}=ae();return e.jsxs("div",{className:"mt-4 border-t border-hairline/30 pt-4","data-testid":"new-browser-settings",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("settings.experimental.newBrowser")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s("settings.experimental.newBrowserDetail")})]}),e.jsx(R,{checked:n,"aria-label":s("settings.experimental.newBrowserAria"),disabled:a,onClick:()=>{r({browserEngine:{engine:n?"agent-browser":"chrome"}})},className:"disabled:cursor-wait disabled:opacity-50"})]}),i?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:i}):null]})}function os(){const{state:t,dispatch:n}=S(),a=ne(t.config),i=Xe(t.config),r=Ze(t.config),d=Qe(t.config),c=et(t.bots,t.instances),[p,o]=l.useState(String(d)),[h,y]=l.useState(!1),[O,w]=l.useState(!1),[m,g]=l.useState(""),P=l.useRef(!1);l.useEffect(()=>{h||o(String(d))},[d,h]);const b=async f=>{if(P.current)return!1;P.current=!0,w(!0),g("");try{const T=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:f})});return n({type:"configStatus",config:T}),!0}catch(T){return g(T instanceof Error?T.message:s("settings.experimental.error")),!1}finally{P.current=!1,w(!1)}},A=async()=>{if(!h)return;const f=tt(p);if(f===null){g(s("settings.experimental.skillReviewStepsRange",{min:ue,max:de}));return}await b({skillReviewSteps:f})&&y(!1)};return e.jsxs("div",{className:"mt-4 border-t border-hairline/30 pt-4","data-testid":"skill-review-settings",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("settings.experimental.skillReview")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s(a?"settings.experimental.skillReviewDetail":"settings.experimental.skillReviewNeedsAuthoring")})]}),e.jsx(R,{checked:i,"aria-label":s("settings.experimental.skillReviewAria"),disabled:O||!a,onClick:()=>{b({skillReview:!i})},className:"disabled:cursor-not-allowed disabled:opacity-50"})]}),e.jsx(cs,{engines:c}),i?e.jsxs("div",{className:"mt-3 flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[13px] text-ink",children:s("settings.experimental.skillAutoApply")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s("settings.experimental.skillAutoApplyDetail")})]}),e.jsx(R,{checked:r,"aria-label":s("settings.experimental.skillAutoApplyAria"),disabled:O,onClick:()=>{b({skillAutoApply:!r})},className:"disabled:cursor-not-allowed disabled:opacity-50"})]}):null,i?e.jsxs("div",{className:"mt-3 flex items-center gap-3",children:[e.jsx("label",{htmlFor:"skill-review-steps",className:"text-[13px] text-ink",children:s("settings.experimental.skillReviewSteps")}),e.jsx("div",{className:`flex w-[96px] items-center rounded-lg border bg-inset ${m?"border-danger/60":"border-hairline/40 focus-within:border-focus"}`,children:e.jsx("input",{id:"skill-review-steps",type:"number",min:ue,max:de,step:1,inputMode:"numeric",value:p,disabled:O,"aria-invalid":!!m,onChange:f=>{o(f.target.value),y(!0),g("")},onBlur:()=>{A()},onKeyDown:f=>{f.key==="Enter"&&f.currentTarget.blur()},className:"min-w-0 flex-1 bg-transparent px-3 py-1.5 text-[14px] tabular-nums text-ink focus:outline-none"})})]}):null,m?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:m}):null]})}function cs({engines:t}){return t.length?e.jsx("p",{className:"mt-2 text-[12px] leading-relaxed text-ink-secondary","data-testid":"skill-review-engine-note",children:s("settings.experimental.skillReviewNoEngine",{engines:t.join(", ")})}):null}const ds=[{value:"off",label:"settings.experimental.shareSkillsOff"},{value:"ask",label:"settings.experimental.shareSkillsAsk"},{value:"auto",label:"settings.experimental.shareSkillsAuto"}];function us(){const{state:t,dispatch:n}=S(),[a,i]=l.useState(!1),[r,d]=l.useState("");if(!st(t.config))return null;const c=ne(t.config),p=nt(t.config),o=async h=>{if(!(a||h===p)){i(!0),d("");try{const y=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:{shareLearnedSkills:h}})});n({type:"configStatus",config:y})}catch(y){d(y instanceof Error?y.message:s("settings.experimental.error"))}finally{i(!1)}}};return e.jsxs("div",{className:"mt-4 border-t border-hairline/30 pt-4","data-testid":"share-learned-skills-settings",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("settings.experimental.shareSkills")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s(c?"settings.experimental.shareSkillsDetail":"settings.experimental.shareSkillsNeedsAuthoring")})]}),e.jsx("div",{className:"inline-flex shrink-0 rounded-xl bg-inset p-1",role:"radiogroup","aria-label":s("settings.experimental.shareSkillsAria"),children:ds.map(h=>e.jsx("button",{type:"button",role:"radio","aria-checked":p===h.value,disabled:a||!c,onClick:()=>{o(h.value)},className:te("rounded-lg px-3 py-1.5 text-[13px] transition-colors disabled:cursor-not-allowed disabled:opacity-50",p===h.value?"bg-raised text-ink shadow":"text-ink-secondary hover:text-ink"),children:s(h.label)},h.value))})]}),r?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:r}):null]})}function ps(){return e.jsxs(e.Fragment,{children:[e.jsx(os,{}),e.jsx(us,{})]})}function Ds({title:t=s("settings.updates.title")}){const n=vt(),a=window.ogb?.updater;if(!n||!a)return null;const i=n.status==="checking"?s("settings.updates.checking"):n.status==="downloading"?n.percent==null?s("settings.updates.startingDownload"):s("settings.updates.downloading",{percent:Math.round(n.percent)}):n.status==="preparing"?s("settings.updates.preparing"):n.status==="downloaded"?n.installMode==="handoff"?s("settings.updates.readyInstall",{app:ce(),version:n.version??""}):s("settings.updates.ready",{app:ce(),version:n.version??""}):n.status==="installing"?xe(n)||(n.installMode==="handoff"?s("settings.updates.openingTerminal"):s("settings.updates.restarting")):n.status==="handed-off"?s("settings.updates.handedOff"):n.status==="error"?s("settings.updates.failed",{message:xe(n)??s("settings.updates.unknownError")}):s("settings.updates.latest");return e.jsx(v,{title:t,subtitle:i,children:e.jsx("button",{onClick:()=>{if(n.status==="downloaded")return void a.install();a.check()},disabled:n.status==="checking"||n.status==="downloading"||n.status==="preparing"||n.status==="installing"||n.retryable===!1,className:"ui-button",children:n.retryable===!1?s("settings.updates.quitReopen"):n.status==="downloaded"?n.installMode==="handoff"?s("settings.updates.install"):s("settings.updates.restart"):n.status==="preparing"?s("settings.updates.preparingShort"):n.status==="installing"?n.installMode==="handoff"?s("settings.updates.opening"):s("settings.updates.restartingShort"):s("settings.updates.check")})})}function Re(){const{state:t,dispatch:n}=S(),a=t.config?.newBots?.effort??"",[i,r]=l.useState(!1),[d,c]=l.useState("");return{current:a,saving:i,error:d,save:async o=>{if(!i){r(!0),c("");try{const h=await C("/api/config",{method:"PATCH",body:JSON.stringify({newBots:{effort:kt(o)?o:null}})});n({type:"configStatus",config:h})}catch(h){c(h instanceof Error?h.message:s("settings.newBotEffort.error"))}finally{r(!1)}}}}}function Pe({effort:t,className:n}){return e.jsxs(D,{size:"sm",className:n,value:t.current,disabled:t.saving,"aria-label":s("settings.newBotEffort.aria"),onChange:a=>{t.save(a.target.value)},children:[e.jsx("option",{value:"",children:s("settings.newBotEffort.default")}),yt.map(a=>e.jsx("option",{value:a,children:wt(a)},a))]})}function Os(){const t=Re();return e.jsx(v,{title:s("settings.newBotEffort.title"),subtitle:s("settings.newBotEffort.subtitle"),message:t.error?e.jsx("p",{role:"alert",className:"text-danger",children:t.error}):null,children:e.jsx(Pe,{effort:t,className:"w-full max-w-[240px]"})})}function xs({onEdit:t,onShare:n}){const a=Re();return e.jsx(v,{title:s("newBot.defaults"),subtitle:s("settings.newBotEffort.title"),message:a.error?e.jsx("p",{role:"alert",className:"text-danger",children:a.error}):null,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Pe,{effort:a,className:"w-auto"}),e.jsx("button",{type:"button",className:"ui-button","data-new-bot-share":!0,onClick:n,children:s("newBot.sharePreset")}),e.jsx("button",{type:"button",className:"ui-button","data-new-bot-defaults":!0,onClick:t,children:s("newBot.edit")})]})})}function ms(){const{state:t,dispatch:n}=S(),[a,i]=l.useState(!1),[r,d]=l.useState(!1);return e.jsxs("div",{children:[e.jsx("button",{disabled:a,onClick:()=>{i(!0),d(!1),C("/api/config",{method:"PUT",body:JSON.stringify({onboarding:{...t.config?.onboarding?.completedAt?{}:Jt().onboarding,hintsSeen:jt(t.config?.onboarding)}}),signal:AbortSignal.timeout(1e4)}).then(c=>{n({type:"configStatus",config:c}),n({type:"toggleTour",open:!0})}).catch(()=>d(!0)).finally(()=>i(!1))},className:"ui-button",children:s("settings.welcome.appTour")}),r&&e.jsx("p",{role:"alert",className:"mt-2 text-[13px] text-danger",children:s("onboarding.tour.error")})]})}function Ms(){const{dispatch:t}=S();return e.jsx(v,{title:s("settings.welcome.title"),subtitle:s("settings.welcome.subtitleShort"),children:e.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[e.jsx(ms,{}),e.jsx("button",{onClick:()=>t({type:"toggleWelcome",open:!0}),className:"ui-button",children:s("settings.welcome.replay")})]})})}function Us({simple:t=!1}){const{state:n}=S(),a=Ue(Fe(),n.config?.language);return e.jsx(v,{title:s("settings.language.title"),subtitle:Ke()?s("settings.language.subtitleComplete"):t?ke()==="en"?void 0:s("settings.simple.language.partial"):s("settings.language.subtitle"),children:e.jsxs(D,{size:"sm",variant:t?"ghost":"field",className:t?void 0:"w-full max-w-[240px]",value:a,"aria-label":s("settings.language.aria"),onChange:i=>Ie(i.target.value),children:[e.jsx("option",{value:"",children:s(t?"settings.simple.language.system":"settings.language.system")}),ze.map(({code:i,label:r})=>e.jsx("option",{value:i,children:r},i))]})})}function Fs(){const t=rt(),n=H("Gợi ý tin nhắn tiếp theo","Next-message suggestions");return e.jsx(v,{title:n,subtitle:H("Chế độ tự động có thể dùng lượt gọi mô hình của bot trên cuộc trò chuyện hiện tại.","Automatic mode can use an extra model call for the current conversation."),children:e.jsxs(D,{size:"sm",value:t,"aria-label":n,onChange:a=>lt(a.target.value),children:[e.jsx("option",{value:"auto",children:H("Tự động","Automatic")}),e.jsx("option",{value:"local",children:H("Chỉ dùng quy tắc cục bộ","Local rules only")}),e.jsx("option",{value:"off",children:H("Tắt","Off")})]})})}function zs({simple:t=!1}){const n=Ce();return e.jsx(v,{title:s("settings.sendKey.title"),subtitle:s(t?"settings.simple.sendKey":"settings.sendKey.subtitle",{key:pe("mod-enter")}),children:e.jsx(D,{size:"sm",variant:t?"ghost":"field",className:t?void 0:"w-full max-w-[240px]",value:n,"aria-label":s("settings.sendKey.title"),onChange:a=>ot(ct(a.target.value)),children:_e.map(a=>e.jsx("option",{value:a,children:pe(a)},a))})})}function Is({simple:t=!1}){const n=dt(),a=ut(Ce());return e.jsx(v,{title:s("settings.followUp.title"),subtitle:s(t?"settings.simple.followUp":"settings.followUp.subtitle",{key:a}),children:e.jsxs(D,{size:"sm",variant:t?"ghost":"field",className:t?void 0:"w-full max-w-[240px]",value:n,"aria-label":s("settings.followUp.title"),onChange:i=>pt(xt(i.target.value)),children:[e.jsx("option",{value:"steer",children:s("settings.followUp.steer")}),e.jsx("option",{value:"queue",children:s("settings.followUp.queue")})]})})}function Ks({simple:t=!1}){const n=at();return e.jsx(v,{title:s(t?"settings.userBubbles.simpleTitle":"settings.userBubbles.title"),subtitle:t?void 0:s("settings.userBubbles.subtitle"),children:e.jsx(R,{checked:n,"aria-label":s("settings.userBubbles.aria"),onClick:()=>it(!n)})})}function _s({simple:t=!1}){const n=je();return e.jsx(v,{className:t?void 0:"rounded-2xl border border-accent-border/40 bg-raised-hover/40 py-4",title:s("settings.advancedMode.title"),subtitle:s(t?"settings.simple.advancedMode":"settings.advancedMode.subtitle"),children:e.jsx(R,{checked:n,"aria-label":s("settings.advancedMode.title"),onClick:()=>Me(!n)})})}function $s(){const t=$e();return e.jsx(v,{title:s("settings.threadDisplay.title"),subtitle:s("settings.threadDisplay.subtitle"),children:e.jsx(R,{checked:t,"aria-label":s("settings.threadDisplay.show"),onClick:()=>qe(!t)})})}function qs(){const t=mt();return e.jsx(v,{title:s("settings.pinnedCircles.title"),subtitle:s("settings.pinnedCircles.subtitle"),children:e.jsx(R,{checked:t,"aria-label":s("settings.pinnedCircles.title"),onClick:()=>gt(!t)})})}function Hs(){const t=He();return e.jsx(v,{title:s("settings.runCard.title"),subtitle:s("settings.runCard.subtitle"),children:e.jsx(R,{checked:t,"aria-label":s("settings.runCard.show"),onClick:()=>Je(!t)})})}function Js(){const t=ht();return e.jsx(v,{title:s("settings.universalPins.title"),subtitle:s("settings.universalPins.subtitle"),children:e.jsx(R,{checked:t,"aria-label":s("settings.universalPins.title"),onClick:()=>ft(!t)})})}function Vs(){const{state:t,dispatch:n}=S(),a=bt(t.config),[i,r]=l.useState(!1),[d,c]=l.useState(""),p=async()=>{if(!i){r(!0),c("");try{const o=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:{showToolCalls:!a}})});n({type:"configStatus",config:o})}catch(o){c(o instanceof Error?o.message:s("settings.toolCalls.error"))}finally{r(!1)}}};return e.jsx(v,{title:s("settings.toolCalls.title"),subtitle:e.jsxs(e.Fragment,{children:[s("settings.toolCalls.subtitle")," ",s("settings.toolCalls.detail")]}),message:d?e.jsx("p",{role:"alert",className:"text-danger",children:d}):null,children:e.jsx(R,{checked:a,"aria-label":s("settings.toolCalls.aria"),disabled:i,onClick:()=>{p()},className:"disabled:cursor-wait disabled:opacity-50"})})}function Ws(){const{state:t,dispatch:n}=S(),a=ne(t.config),[i,r]=l.useState(!1),[d,c]=l.useState(""),p=async o=>{if(!i){r(!0),c("");try{const h=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:{skillAuthoring:o}})});n({type:"configStatus",config:h})}catch(h){c(h instanceof Error?h.message:s("settings.experimental.error"))}finally{r(!1)}}};return e.jsxs(Ne,{title:s("settings.experimental.title"),subtitle:s("settings.experimental.subtitle"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("settings.experimental.skillAuthoring")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s("settings.experimental.skillAuthoringDetail")})]}),e.jsx(R,{checked:a,"aria-label":s("settings.experimental.skillAuthoringAria"),disabled:i,onClick:()=>{p(!a)},className:"disabled:cursor-wait disabled:opacity-50"})]}),d?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:d}):null,e.jsx(ps,{}),e.jsx(ls,{})]})}function Ys(){const{state:t}=S(),n=t.config?.browserProfiles??[];return!se(t.config)&&n.length===0?null:e.jsx(Ne,{title:s("settings.profiles.title"),subtitle:s("settings.profiles.sharedSubtitle"),children:e.jsx(es,{})})}const ye=["Identity","Soul","Skills","Memory","Routines","Access","Model","Permissions","Voice & alerts"],gs={Identity:"botSettings.sections.identity",Soul:"botSettings.sections.soul",Skills:"botSettings.sections.skills",Memory:"botSettings.sections.memory",Routines:"botSettings.sections.routines",Access:"botSettings.sections.access",Model:"botSettings.sections.model",Permissions:"botSettings.sections.permissions","Voice & alerts":"botSettings.sections.voice"};function Ae(t){return e.jsx(Vt,{modal:!0,children:e.jsx(hs,{...t})})}function hs({defaultsMode:t=!1,onClose:n,onCreated:a,readyBotId:i,readyBotData:r}){const d=Wt(),c=S(),[,p]=l.useState(0),[o,h]=l.useState(()=>new ge(Pt,()=>p(x=>x+1))),[y,O]=l.useState("Identity"),[w,m]=l.useState(!1),[g,P]=l.useState(!1),b=g||c.state.botCreationPending,A=l.useRef(!1),f=l.useRef(!0),[T,M]=l.useState(""),[G,I]=l.useState(null),[F,_]=l.useState("everyone"),[$,X]=l.useState(""),z=Ee(),K=c.state.config?.team?.name,[u,E]=l.useState(null),N=Se(),L=Ve(),Te=je()?ye:ye.filter(x=>x!=="Model"),ie=!t&&typeof window<"u"&&!window.ogb&&N===!0,J=l.useRef(null),q=l.useRef(n);q.current=n,l.useEffect(()=>{let x=!1;return C("/api/bot-defaults").then(B=>{if(x)return;const j=At(B,!t),k=t?void 0:r??(i?ee(i):void 0),U=new ge(k?St(j,k,ke()):j,()=>p(W=>W+1));k&&ee(k.id)&&(U.role=k.id),h(U),m(!0)}).catch(B=>{x||M(String(B))}),()=>{x=!0}},[t,i,r]),l.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]),l.useEffect(()=>()=>o.dispose(),[o]),l.useEffect(()=>{b&&J.current?.focus()},[b]),l.useEffect(()=>{const x=document.activeElement instanceof HTMLElement?document.activeElement:null;J.current?.focus();const B=j=>{if(!d())return;const k=J.current;if(!k||j.target instanceof Node&&!k.contains(j.target))return;const U=k.querySelector('[role="dialog"], [role="alertdialog"]');if(U&&U.getClientRects().length||(j.key==="Escape"&&(j.preventDefault(),q.current()),j.key!=="Tab"))return;const W=[...k.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex="0"]')].filter(oe=>oe.getClientRects().length&&!oe.closest("[hidden],fieldset:disabled")),Z=W[0],Q=W.at(-1);if(!Z||!Q){j.preventDefault(),k.focus();return}j.shiftKey&&(document.activeElement===Z||document.activeElement===k)?(j.preventDefault(),Q.focus()):!j.shiftKey&&(document.activeElement===Q||document.activeElement===k)&&(j.preventDefault(),Z.focus())};return window.addEventListener("keydown",B),()=>{window.removeEventListener("keydown",B),x?.isConnected&&x.focus()}},[d]);const re=async()=>{if(!w||A.current||c.state.botCreationPending)return;if(!t&&o.bot.approvalMode==="auto"&&o.bot.computer==="local"&&!o.consent.acknowledgeLocalAuto){I("local");return}const x=ie?$t(F,$):null;if(x&&!x.ok){M(s("botSettings.visibility.needPeople"));return}A.current=!0,P(!0),M(""),c.dispatch({type:"botCreationPending",on:!0});try{if(t)await C("/api/config",{method:"PATCH",body:JSON.stringify({newBotDefaults:await Tt(o)})});else{const{bot:B,warnings:j,paused:k}=await Lt(o,void 0,void 0,void 0,x?.ok?x.visibility:void 0,z?he(u,o.bot.section,c.state.bots,z)??void 0:void 0);Dt(c.dispatch,B,j,{showThreads:L,source:o.preset?"preset":o.role?"template":"blank",role:o.role,paused:k});try{await a?.(B)}catch(U){c.dispatch({type:"error",message:U instanceof Error?U.message:String(U)})}}A.current=!1,f.current&&q.current()}catch(B){f.current&&M(B instanceof Error?B.message:String(B))}finally{A.current=!1,c.dispatch({type:"botCreationPending",on:!1}),f.current&&P(!1)}},V=o.bot,Le={...c,state:{...c.state,bots:[V,...c.state.bots],routines:o.routines,routineRuns:[],routinesLoadState:"ready"},flushBotPatches:async()=>V,dispatch:x=>{x.type==="updateBot"&&x.botId===o.id?o.patch(x.patch):x.type==="setModel"&&x.botId===o.id?(o.setModel(x.selection),x.resetApprovalToAsk&&o.patch({approvalMode:"ask"})):x.type==="routinePatched"||x.type==="toggleSettings"||c.dispatch(x)}},le=t?s("newBot.defaults"):s("sidebar.newBot");return e.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center bg-black/60 p-3 sm:p-5",hidden:!t&&c.state.appSettingsOpen,children:e.jsxs("div",{ref:J,role:"dialog","aria-modal":"true","aria-label":le,"aria-busy":b,tabIndex:-1,className:"flex h-[min(760px,94dvh)] w-full max-w-[900px] flex-col overflow-hidden rounded-2xl border border-hairline/50 bg-panel shadow-2xl outline-none",children:[e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-hairline/40 px-5 py-4",children:[e.jsx("h2",{className:"text-[17px] font-semibold text-ink",children:le}),e.jsx("button",{type:"button",onClick:()=>q.current(),"aria-label":s("common.close"),className:"flex size-8 shrink-0 items-center justify-center rounded-lg text-ink-secondary hover:bg-control hover:text-ink disabled:opacity-40",children:e.jsx(we,{size:18,className:"pointer-events-none"})})]}),z&&!t&&K&&e.jsx(fs,{team:K}),ie&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-5 pt-3 text-[13px] text-ink-secondary","data-new-bot-visibility":!0,children:[e.jsxs("label",{className:"flex items-center gap-2",children:[s("botSettings.visibility.title"),e.jsxs(D,{size:"sm",value:F,disabled:b,onChange:x=>_(x.target.value),children:[e.jsx("option",{value:"everyone",children:s("botSettings.visibility.everyone")}),e.jsx("option",{value:"admins",children:s("botSettings.visibility.admins")}),e.jsx("option",{value:"people",children:s("botSettings.visibility.people")})]})]}),F==="people"&&e.jsx("input",{value:$,disabled:b,onChange:x=>X(x.target.value),placeholder:s("botSettings.visibility.peoplePlaceholder"),"aria-label":s("botSettings.visibility.peopleLabel"),className:"min-w-[16rem] flex-1 rounded-lg border border-hairline/40 bg-inset px-3 py-1.5 text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col sm:flex-row",children:[e.jsx("nav",{"aria-label":s("newBot.sections"),className:"flex shrink-0 gap-1 overflow-x-auto border-b border-hairline/40 p-2 sm:w-40 sm:flex-col sm:border-b-0 sm:border-r",children:Te.map(x=>e.jsx("button",{type:"button",onClick:()=>O(x),"aria-current":y===x?"page":void 0,className:te("shrink-0 rounded-lg px-3 py-2 text-left text-[13px]",y===x?"bg-control text-ink":"text-ink-secondary hover:bg-control/50"),children:s(gs[x])},x))}),e.jsxs("div",{className:"min-h-0 min-w-0 flex-1 overflow-y-auto p-4 sm:p-5",children:[!w&&!T&&e.jsxs("div",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[e.jsx(Y,{size:16,className:"animate-spin"}),s("newBot.loading")]}),w&&e.jsx("fieldset",{disabled:b,className:"min-w-0",children:e.jsx(Nt,{value:Le,children:e.jsx(Ct.Provider,{value:{request:o.request,draft:!0,uploadAvatar:o.uploadAvatar},children:e.jsx(bs,{active:y,draft:o,defaultsMode:t,owner:z&&!t?{value:he(u,V.section,c.state.bots,z),choose:E}:void 0})})})})]})]}),T&&e.jsx("p",{role:"alert",className:"max-h-24 overflow-y-auto border-t border-hairline/40 px-5 py-3 text-[13px] text-danger",children:T}),e.jsxs("div",{className:"flex shrink-0 justify-end gap-2 border-t border-hairline/40 px-5 py-3",children:[e.jsx("button",{type:"button",onClick:()=>q.current(),className:"rounded-lg px-4 py-2 text-[13px] text-ink-secondary hover:bg-control",children:s("common.cancel")}),e.jsxs("button",{type:"button",disabled:!w||b||!t&&!V.name.trim(),onClick:()=>{re()},className:"ui-button-primary flex items-center gap-2 rounded-lg bg-accent px-5 py-2 text-[13px] font-medium text-white hover:brightness-110 disabled:opacity-40",children:[b&&e.jsx(Y,{size:15,className:"animate-spin"}),s(t?"newBot.saveDefaults":"newBot.create")]})]}),e.jsx(Et,{open:G==="local",onCancel:()=>I(null),onConfirm:()=>{o.consent.acknowledgeLocalAuto=!0,I(null),re()}})]})})}function fs({team:t}){const n=typeof window>"u"?void 0:window.ogb?.workspaces;return e.jsxs("div",{"data-new-bot-shared":!0,className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-b border-hairline/40 bg-raised/30 px-5 py-2.5 text-[13px] text-ink-secondary",children:[e.jsx("span",{children:s("newBot.sharedWith",{team:t})}),n?e.jsx("button",{type:"button",onClick:()=>{Ot(n).catch(()=>{})},className:"font-medium text-accent hover:underline",children:s("newBot.justForYou")}):e.jsx("span",{children:s("newBot.justForYou").replace(/\s*→$/,"")})]})}function bs({active:t,draft:n,defaultsMode:a,owner:i}){const r=n.bot,{state:d}=S(),c=Ee(),p=Bt(r);return t==="Identity"?e.jsxs("div",{className:"space-y-4",children:[e.jsx(vs,{draft:n,defaultsMode:a}),e.jsx(Mt,{bot:r,patch:p.patch,activeState:p.activeState,mascotMotion:null,namePlaceholder:a?s("newBot.randomName"):void 0}),e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("newBot.team"),e.jsxs(D,{size:"lg",className:"mt-1.5 w-full",value:r.section??"",onChange:o=>n.patch({section:o.target.value}),children:[e.jsx("option",{value:"",children:s("teamSettings.general")}),[...new Set([...d.sections??[],...d.bots.map(o=>o.section??"")])].filter(Boolean).map(o=>e.jsx("option",{children:o},o))]})]}),i&&c&&e.jsxs("label",{className:"block text-[13px] text-ink-secondary","data-new-bot-reports-to":!0,children:[s("lookedAfter.newBot"),e.jsx(D,{size:"lg",className:"mt-1.5 w-full",value:i.value??"",onChange:o=>i.choose(o.target.value),children:c.people.map(o=>e.jsx("option",{value:o.email,children:o.you?s("owner.you",{name:o.name}):o.name},o.email))}),e.jsx("span",{className:"mt-1 block text-[12px]",children:s("lookedAfter.pickHint")})]})]}):t==="Soul"?e.jsx(Ut,{bot:r,patch:p.patch}):t==="Skills"?e.jsx(Ft,{bot:r}):t==="Memory"?e.jsx(ys,{draft:n}):t==="Routines"?e.jsx(ws,{draft:n}):t==="Access"?e.jsx(zt,{bot:r,derived:p}):t==="Model"?e.jsx(It,{bot:r}):t==="Permissions"?e.jsx(Kt,{bot:r,derived:p}):e.jsx(_t,{bot:r,derived:p})}function vs({draft:t,defaultsMode:n}){const[a,i]=l.useState([]),[r,d]=l.useState(0),[c,p]=l.useState(""),o=l.useRef(!1);l.useEffect(()=>{if(n)return;let m=!1;return C("/api/bot-presets").then(g=>{m||i(g.presets)}).catch(()=>{m||i([])}),()=>{m=!0}},[n,r]);const h=t.preset?a.find(m=>m.id===t.preset.id):void 0,y=async m=>{p("");const g=m.startsWith("preset:")?a.find(b=>b.id===m.slice(7)):void 0;if(!g){t.choosePreset(void 0);const b=me.find(f=>f.id===m);t.chooseRole(b?.id);const A=b&&ee(b.id)?.look;b&&t.patch({...Rt(b),...A});return}t.patch(ss(g)),t.choosePreset(is(g));const P=ns(g);try{P?(t.patch({avatarUrl:await t.uploadAvatar(P),avatarCrop:g.bot.appearance.avatar.crop}),o.current=!0):o.current&&(t.patch({avatarUrl:""}),o.current=!1)}catch(b){p(b instanceof Error?b.message:String(b))}},O=async m=>{p("");try{await C(`/api/bot-presets/${encodeURIComponent(m.id)}`,{method:"DELETE"}),t.preset?.id===m.id&&t.choosePreset(void 0),d(g=>g+1)}catch(g){p(g instanceof Error?g.message:String(g))}},w=me.map(m=>e.jsx("option",{value:m.id,children:m.title},m.id));return e.jsxs("div",{children:[e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("newBot.startingRole"),e.jsxs(D,{size:"lg",className:"mt-1.5 w-full",value:t.preset?`preset:${t.preset.id}`:"",onChange:m=>{y(m.target.value)},children:[e.jsx("option",{value:"",children:s("newBot.customSettings")}),ts(a).map(m=>e.jsx("optgroup",{label:m.label,children:m.presets.map(g=>e.jsx("option",{value:`preset:${g.id}`,children:g.name},g.id))},m.label)),a.length?e.jsx("optgroup",{label:s("newBot.builtInRoles"),children:w}):w]})]}),h&&e.jsxs("div",{className:"mt-2 space-y-1 rounded-lg bg-card px-3 py-2.5 text-[13px] text-ink-secondary","data-new-bot-preset":!0,children:[as(h).map((m,g)=>e.jsx("p",{className:"break-words",children:m},g)),h.source==="file"&&e.jsx("button",{type:"button",onClick:()=>{O(h)},className:"mt-1 rounded-md px-2 py-1 text-[12px] text-ink-secondary hover:bg-control hover:text-ink",children:s("newBot.presetRemove")})]}),c&&e.jsx("p",{role:"alert",className:"mt-2 text-[13px] text-danger",children:c})]})}function ys({draft:t}){const[n,a]=l.useState("MEMORY.md"),[i,r]=l.useState("");return e.jsxs("div",{className:"space-y-3",children:[e.jsx(D,{size:"lg",className:"w-full","aria-label":s("memory.fileLabel",{path:n}),value:n,onChange:d=>a(d.target.value),children:[...new Set(["MEMORY.md",...Object.keys(t.template.memory)])].map(d=>e.jsx("option",{children:d},d))}),e.jsx("textarea",{className:te(fe,"min-h-72 font-mono"),"aria-label":s("memory.contents"),value:t.template.memory[n]??"",onChange:d=>t.setMemory(n,d.target.value)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{className:fe,"aria-label":s("memory.newTopicLabel"),placeholder:s("memory.newTopicLabel"),value:i,onChange:d=>r(d.target.value)}),e.jsx("button",{type:"button","aria-label":s("memory.addTopic"),disabled:!/^[a-zA-Z0-9_-]+$/.test(i),className:"rounded-lg bg-control px-3 disabled:opacity-40",onClick:()=>{const d=`memory/${i}.md`;d in t.template.memory||t.setMemory(d,""),a(d),r("")},children:e.jsx(Yt,{size:16})}),n!=="MEMORY.md"&&e.jsx("button",{type:"button","aria-label":s("memory.removeTopic"),className:"rounded-lg bg-control px-3",onClick:()=>{t.setMemory(n,null),a("MEMORY.md")},children:e.jsx(Be,{size:16})})]})]})}function ws({draft:t}){const[n,a]=l.useState(null);return e.jsxs("div",{className:"space-y-3",children:[e.jsx("button",{type:"button",className:"rounded-lg bg-accent px-3 py-2 text-[13px] text-white",onClick:()=>a("new"),children:s("computer.routines.create")}),t.routines.map(i=>e.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-card p-3",children:[e.jsx("button",{type:"button",className:"min-w-0 flex-1 text-left text-[13px]",onClick:()=>a(i),children:i.name}),e.jsxs("label",{className:"flex items-center gap-1.5 text-[12px] text-ink-secondary",children:[e.jsx("input",{type:"checkbox",checked:i.enabled,onChange:r=>t.setRoutineEnabled(i.id,r.target.checked)}),s("newBot.enabled")]}),e.jsx("button",{type:"button","aria-label":s("newBot.removeRoutine",{name:i.name}),onClick:()=>t.removeRoutine(i.id),className:"rounded p-1.5 hover:bg-control",children:e.jsx(Be,{size:15})})]},i.id)),n&&e.jsx(qt,{routine:n==="new"?void 0:n,bots:[t.bot],lockedBotId:t.id,onClose:()=>a(null)})]})}function js({simple:t=!1}){const[n,a]=l.useState(!1),[i,r]=l.useState(!1),d=e.jsxs(e.Fragment,{children:[n&&e.jsx(Ae,{defaultsMode:!0,onClose:()=>a(!1)}),i&&e.jsx(rs,{onClose:()=>r(!1)})]});if(t)return e.jsxs(e.Fragment,{children:[e.jsx(xs,{onEdit:()=>a(!0),onShare:()=>r(!0)}),d]});const c=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex shrink-0 gap-2",children:[e.jsx("button",{type:"button",onClick:()=>r(!0),className:"cursor-pointer rounded-lg px-3 py-1.5 text-[13px] text-ink-secondary hover:bg-control hover:text-ink",children:s("newBot.sharePreset")}),e.jsx("button",{type:"button",onClick:()=>a(!0),className:"cursor-pointer rounded-lg bg-control px-3 py-1.5 text-[13px] text-ink hover:bg-raised-hover",children:s("newBot.edit")})]}),d]});return e.jsx(v,{title:s("newBot.defaults"),children:c})}const Gs=Object.freeze(Object.defineProperty({__proto__:null,DefaultBotSettings:js,NewBotDialog:Ae},Symbol.toStringTag,{value:"Module"}));export{_s as A,Ts as B,Ks as C,js as D,Ws as E,Is as F,Us as L,Os as N,qs as P,Ms as R,Ls as S,Vs as T,Ds as U,Ys as a,Fs as b,zs as c,$s as d,Js as e,Hs as f,Gs as g};
|
|
1
|
+
import{t as s,r as l,b as De,j as e,X as we,d as Oe,a as te,ah as je,ai as Me,q as Ue,v as Fe,aj as ze,ak as Ie,al as Ke,l as ke,am as _e,an as $e,ao as qe,ap as He,aq as Je,p as ce,G as Ve}from"./styles-B38kYzzJ.js";import{j as C,E as We,u as S,bV as se,bW as Ye,a2 as v,S as R,bX as Ge,bY as Se,bZ as ne,b_ as Xe,b$ as Ze,c0 as Qe,c1 as et,c2 as de,c3 as ue,c4 as tt,c5 as st,c6 as nt,c7 as Ne,w as D,c8 as at,c9 as it,ca as rt,x as H,cb as lt,b as Ce,cc as pe,cd as ot,ce as ct,cf as dt,cg as ut,ch as pt,ci as xt,cj as mt,ck as gt,cl as ht,cm as ft,cn as bt,co as vt,cp as xe,cq as yt,cr as wt,cs as jt,ct as kt,cu as Ee,bM as ee,cv as St,cw as Nt,cx as Ct,cy as Et,cz as Bt,cA as me,T as Be,cB as Rt}from"./App-BFnQK962.js";import{B as ge,E as Pt,s as At,r as he,p as Tt,c as Lt,a as Dt}from"./new-bot-RHcTiQhX.js";import{o as Ot}from"./index-DZeZApXw.js";import{I as Mt,S as Ut,a as Ft,A as zt,M as It,P as Kt,V as _t,v as $t,i as fe}from"./VisibilitySection-CM3W0MSu.js";import{R as qt}from"./RoutinesPage-E0_zyR6z.js";import{r as Ht,L as Y,Q as Jt,R as Vt,U as Wt,P as Yt}from"./PlacesRail-owo7-LYs.js";import{p as Gt,d as Xt,e as Zt,f as Qt}from"./team-share-DLeRlsAM.js";import{B as es}from"./BrowserProfilesManager-C4_r4TCi.js";function ts(t){const n=[];for(const a of t){const i=a.source==="org"?s("newBot.presetsFromOrganization",{name:a.publisherName??a.packageName}):s("newBot.presetsImported"),r=n.find(d=>d.label===i);r?r.presets.push(a):n.push({label:i,presets:[a]})}return n}function ss(t){const n={name:t.bot.name??t.name,title:t.bot.title??"",description:t.bot.description??"",soul:t.bot.soul??""},a=t.bot.appearance;return a&&(n.color=a.color,n.mascotExpression=a.mascotExpression??null,a.mascotBody&&(n.mascotBody=a.mascotBody)),n}function ns(t){const n=t.bot.appearance?.avatar;if(!n)return null;let a;try{a=atob(n.data)}catch{return null}const i=new Uint8Array(a.length);for(let r=0;r<a.length;r+=1)i[r]=a.charCodeAt(r);return new File([i],`preset.${n.mime.slice(6)}`,{type:n.mime})}function as(t){const n=[t.source==="org"&&t.publisherName?s("newBot.presetFromOrg",{package:t.packageName,release:t.release,publisher:t.publisherName}):s("newBot.presetFrom",{package:t.packageName,release:t.release})];t.description&&n.push(t.description);const a=t.skills.map(i=>i.name).join(", ");return a&&n.push(s(t.skillsEnabled?"newBot.presetSkillsOn":"newBot.presetSkillsOff",{names:a})),t.notes.length&&n.push(s("newBot.presetNotes",{names:t.notes.join(", ")})),t.playbooks.length&&n.push(s("newBot.presetPlaybooks",{names:t.playbooks.join(", ")})),n.push(s("newBot.presetKeeps")),n}function is(t){return{id:t.id,skills:t.skills.map(n=>n.name),notes:[...t.notes]}}function be(t){const n=a=>a?.trim()?a.trim():void 0;return{format:"package",version:2,kind:"library",name:n(t.name),presetName:n(t.name),presetDescription:n(t.description),release:n(t.release),notes:n(t.notes),includeMemory:t.includeNotes,...t.picture?{presetAvatar:t.picture}:{},...t.dryRun?{dryRun:!0}:{}}}function ve({preview:t,localSkips:n}){const a=t.document.package.presets?.[0],i=Object.keys(a?.seed?.memory??{}).length,r=[[s("teamShare.part.skills"),a?.skills?.length?`${a.skills.length} · ${a.skills.join(", ")}`:"0"],[s("teamShare.part.notes"),i?String(i):s("teamShare.none")],[s("teamShare.part.pictures"),a?.bot.appearance?.avatar?s("teamShare.yes"):s("teamShare.none")]],d=[...n,...t.skipped.map(c=>Xt(c,t.document))];return e.jsxs("div",{children:[e.jsx("div",{className:"text-[12px] font-medium text-ink-secondary",children:s("teamShare.included")}),e.jsx("dl",{className:"mt-2 grid grid-cols-[minmax(0,1fr)_auto] gap-x-4 gap-y-1.5 rounded-xl bg-raised/45 px-4 py-3 text-[13px]",children:r.map(([c,p])=>e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"text-ink-secondary",children:c}),e.jsx("dd",{className:"max-w-[300px] truncate text-right text-ink",title:p,children:p})]},c))}),e.jsxs("p",{className:"mt-3 flex items-start gap-2 text-[13px] leading-relaxed text-ink-secondary",children:[e.jsx(We,{size:15,className:"mt-0.5 shrink-0 text-success"}),e.jsx("span",{children:s("presetShare.never")})]}),t.redacted.length>0&&e.jsxs("div",{className:"mt-3 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:s("teamShare.redacted")}),e.jsx("ul",{className:"mt-1 list-disc pl-5",children:t.redacted.map(c=>e.jsx("li",{children:Zt(c,t.document)},c))})]}),d.length>0&&e.jsxs("div",{className:"mt-3 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:s("teamShare.skipped")}),e.jsx("ul",{className:"mt-1 list-disc pl-5",children:d.map((c,p)=>e.jsx("li",{children:c},`${c}-${p}`))})]})]})}function rs({onClose:t}){const n=l.useRef(null),[a,i]=l.useState(""),[r,d]=l.useState(""),[c,p]=l.useState(""),[o,h]=l.useState(""),[y,O]=l.useState(!0),[w,m]=l.useState(!0),[g,P]=l.useState(null),[b,A]=l.useState(null),[f,T]=l.useState(!1),[M,G]=l.useState(null),[I,F]=l.useState(""),_=l.useRef(0);l.useEffect(()=>{let u=!1;return C("/api/bot-defaults").then(async({defaults:E})=>{!u&&E.profile.name?.trim()&&i(L=>L||E.profile.name.trim());const N=await Gt([{id:"defaults",avatarUrl:E.profile.avatarUrl,avatarCrop:E.profile.avatarCrop}]);u||P({dataUrl:N.avatars.defaults,skipped:N.skipped.map(L=>`${s("teamShare.field.picture")} — ${De(`teamShare.skip.${L.reason}`,L.reason)}`)})}).catch(()=>{u||P({skipped:[]})}),()=>{u=!0}},[]);const $=u=>({name:a,description:r,release:c,notes:o,includeNotes:y,dryRun:u,...w&&g?.dataUrl?{picture:g.dataUrl}:{}});l.useEffect(()=>{if(!g)return;const u=++_.current,E=window.setTimeout(()=>{C("/api/teams/export",{method:"POST",body:JSON.stringify(be({...$(!0),release:void 0}))}).then(N=>{u===_.current&&(A(N),F(""),p(L=>L||N.document.package.release))}).catch(N=>{u===_.current&&(A(null),F(N instanceof Error?N.message:String(N)))})},250);return()=>window.clearTimeout(E)},[g,y,w]);const X=async()=>{if(!f){T(!0),F("");try{const u=await C("/api/teams/export",{method:"POST",body:JSON.stringify(be($(!1)))});Qt(u.filename,u.document),G(u)}catch(u){F(u instanceof Error?u.message:String(u))}finally{T(!1)}}};l.useEffect(()=>{const u=document.activeElement instanceof HTMLElement?document.activeElement:null;return n.current?.focus(),()=>{u?.isConnected&&u.focus()}},[]);const z=w?g?.skipped??[]:[],K="mt-1 w-full rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[14px] text-ink disabled:opacity-60";return Ht.createPortal(e.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center bg-black/55 p-4",onMouseDown:u=>u.stopPropagation(),children:e.jsxs("div",{ref:n,role:"dialog","aria-modal":"true","aria-labelledby":"share-preset-title",tabIndex:-1,className:"flex max-h-[90vh] w-full max-w-[560px] flex-col overflow-hidden rounded-2xl border border-hairline/50 bg-panel text-ink shadow-2xl outline-none",onKeyDown:u=>{if(u.key==="Escape"&&!f&&(u.stopPropagation(),t()),u.key==="Tab"){const E=n.current?.querySelectorAll("input:enabled, textarea:enabled, button:enabled");if(!E?.length)return;const N=E[0],L=E[E.length-1];u.shiftKey&&document.activeElement===N?(u.preventDefault(),L.focus()):!u.shiftKey&&document.activeElement===L&&(u.preventDefault(),N.focus())}},children:[e.jsxs("header",{className:"flex items-start justify-between gap-3 px-6 pb-2 pt-5",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"share-preset-title",className:"text-[17px] font-semibold",children:s("presetShare.title")}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:s("presetShare.intro")})]}),e.jsx("button",{"aria-label":s("presetShare.close"),disabled:f,onClick:t,className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised",children:e.jsx(we,{size:18})})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pb-4 pt-2",children:M?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"flex items-center gap-2 text-[14px] font-medium text-ink",children:[e.jsx(Oe,{size:16,className:"text-success"}),s("teamShare.saved",{filename:M.filename})]}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:s("presetShare.savedHint")}),e.jsx("div",{className:"mt-4",children:e.jsx(ve,{preview:M,localSkips:z})})]}):e.jsxs(e.Fragment,{children:[b?e.jsx(ve,{preview:b,localSkips:z}):!I&&e.jsxs("div",{className:"flex items-center gap-2 py-6 text-[13px] text-ink-secondary",children:[e.jsx(Y,{size:15,className:"animate-spin"}),s("presetShare.preparing")]}),e.jsxs("fieldset",{className:"mt-4 space-y-2 text-[13px]",disabled:f,children:[e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",className:"size-4 accent-accent",checked:w,onChange:u=>m(u.target.checked)}),s("presetShare.includePicture")]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",className:"size-4 accent-accent",checked:y,onChange:u=>O(u.target.checked)}),s("presetShare.includeNotes")]})]}),e.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:[e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("presetShare.name"),e.jsx("input",{value:a,maxLength:100,disabled:f,onChange:u=>i(u.target.value),className:K})]}),e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("teamShare.release"),e.jsx("input",{value:c,maxLength:20,disabled:f,placeholder:"1.0.0",onChange:u=>p(u.target.value),className:K})]})]}),e.jsxs("label",{className:"mt-3 block text-[13px] text-ink-secondary",children:[s("presetShare.description"),e.jsx("input",{value:r,maxLength:300,disabled:f,onChange:u=>d(u.target.value),className:K})]}),e.jsxs("label",{className:"mt-3 block text-[13px] text-ink-secondary",children:[s("teamShare.notes"),e.jsx("textarea",{value:o,maxLength:4e3,rows:2,disabled:f,onChange:u=>h(u.target.value),className:K})]})]})}),I&&e.jsx("p",{role:"alert",className:"mx-6 mb-2 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:I}),e.jsx("footer",{className:"flex justify-end gap-2 border-t border-hairline/35 px-6 py-3",children:M?e.jsx("button",{onClick:t,className:"rounded-lg bg-accent px-4 py-2 text-[13px] font-medium text-white",children:s("teamShare.done")}):e.jsxs(e.Fragment,{children:[e.jsx("button",{disabled:f,onClick:t,className:"rounded-lg px-3 py-2 text-[13px] text-ink-secondary hover:bg-raised",children:s("common.cancel")}),e.jsxs("button",{disabled:f||!b,onClick:()=>{X()},className:"flex items-center gap-2 rounded-lg bg-accent px-4 py-2 text-[13px] font-medium text-white disabled:opacity-40",children:[f&&e.jsx(Y,{size:14,className:"animate-spin"}),f?s("teamShare.saving"):s("teamShare.save")]})]})})]})}),document.body)}function ae(){const{dispatch:t}=S(),[n,a]=l.useState(!1),[i,r]=l.useState("");return{saving:n,error:i,save:async c=>{if(!n){a(!0),r("");try{const p=await C("/api/config",{method:"PATCH",body:JSON.stringify(c)});t({type:"configStatus",config:p})}catch(p){r(p instanceof Error?p.message:s("settings.experimental.error"))}finally{a(!1)}}}}}function Ts(){const{state:t}=S(),n=se(t.config),a=Ye(t.config),i=t.config?.browserEngine?.installable===!0,r=window.ogb?.platform==="win32"&&!a&&!i,{saving:d,error:c,save:p}=ae();return e.jsx(v,{title:s("settings.experimental.browserAria"),subtitle:a?n?s("settings.experimental.browserOn"):s("settings.experimental.browserOff"):r?s("settings.experimental.browserWindows"):Ge(t.config),message:c?e.jsx("p",{role:"alert",className:"text-danger",children:c}):null,children:e.jsx(R,{checked:n,"aria-label":s("settings.experimental.browserAria"),disabled:d||!n&&!a&&!i,onClick:()=>{p({features:{browser:!n}})},className:"disabled:cursor-wait disabled:opacity-50"})})}function Ls(){const{state:t}=S(),n=Se(),a=t.config?.browserEngine?.serverSites,{saving:i,error:r,save:d}=ae();return a===void 0||n!==!0||!se(t.config)?null:e.jsx(v,{title:s("settings.browser.serverSites"),subtitle:s("settings.browser.serverSitesDetail"),message:r?e.jsx("p",{role:"alert",className:"text-danger",children:r}):null,children:e.jsx(R,{checked:a,"aria-label":s("settings.browser.serverSites"),disabled:i,onClick:()=>{d({browserEngine:{egress:{localNetwork:!a}}})},className:"disabled:cursor-wait disabled:opacity-50"})})}function ls(){const{state:t}=S(),n=t.config?.browserEngine?.engine==="chrome",{saving:a,error:i,save:r}=ae();return e.jsxs("div",{className:"mt-4 border-t border-hairline/30 pt-4","data-testid":"new-browser-settings",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("settings.experimental.newBrowser")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s("settings.experimental.newBrowserDetail")})]}),e.jsx(R,{checked:n,"aria-label":s("settings.experimental.newBrowserAria"),disabled:a,onClick:()=>{r({browserEngine:{engine:n?"agent-browser":"chrome"}})},className:"disabled:cursor-wait disabled:opacity-50"})]}),i?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:i}):null]})}function os(){const{state:t,dispatch:n}=S(),a=ne(t.config),i=Xe(t.config),r=Ze(t.config),d=Qe(t.config),c=et(t.bots,t.instances),[p,o]=l.useState(String(d)),[h,y]=l.useState(!1),[O,w]=l.useState(!1),[m,g]=l.useState(""),P=l.useRef(!1);l.useEffect(()=>{h||o(String(d))},[d,h]);const b=async f=>{if(P.current)return!1;P.current=!0,w(!0),g("");try{const T=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:f})});return n({type:"configStatus",config:T}),!0}catch(T){return g(T instanceof Error?T.message:s("settings.experimental.error")),!1}finally{P.current=!1,w(!1)}},A=async()=>{if(!h)return;const f=tt(p);if(f===null){g(s("settings.experimental.skillReviewStepsRange",{min:ue,max:de}));return}await b({skillReviewSteps:f})&&y(!1)};return e.jsxs("div",{className:"mt-4 border-t border-hairline/30 pt-4","data-testid":"skill-review-settings",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("settings.experimental.skillReview")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s(a?"settings.experimental.skillReviewDetail":"settings.experimental.skillReviewNeedsAuthoring")})]}),e.jsx(R,{checked:i,"aria-label":s("settings.experimental.skillReviewAria"),disabled:O||!a,onClick:()=>{b({skillReview:!i})},className:"disabled:cursor-not-allowed disabled:opacity-50"})]}),e.jsx(cs,{engines:c}),i?e.jsxs("div",{className:"mt-3 flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[13px] text-ink",children:s("settings.experimental.skillAutoApply")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s("settings.experimental.skillAutoApplyDetail")})]}),e.jsx(R,{checked:r,"aria-label":s("settings.experimental.skillAutoApplyAria"),disabled:O,onClick:()=>{b({skillAutoApply:!r})},className:"disabled:cursor-not-allowed disabled:opacity-50"})]}):null,i?e.jsxs("div",{className:"mt-3 flex items-center gap-3",children:[e.jsx("label",{htmlFor:"skill-review-steps",className:"text-[13px] text-ink",children:s("settings.experimental.skillReviewSteps")}),e.jsx("div",{className:`flex w-[96px] items-center rounded-lg border bg-inset ${m?"border-danger/60":"border-hairline/40 focus-within:border-focus"}`,children:e.jsx("input",{id:"skill-review-steps",type:"number",min:ue,max:de,step:1,inputMode:"numeric",value:p,disabled:O,"aria-invalid":!!m,onChange:f=>{o(f.target.value),y(!0),g("")},onBlur:()=>{A()},onKeyDown:f=>{f.key==="Enter"&&f.currentTarget.blur()},className:"min-w-0 flex-1 bg-transparent px-3 py-1.5 text-[14px] tabular-nums text-ink focus:outline-none"})})]}):null,m?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:m}):null]})}function cs({engines:t}){return t.length?e.jsx("p",{className:"mt-2 text-[12px] leading-relaxed text-ink-secondary","data-testid":"skill-review-engine-note",children:s("settings.experimental.skillReviewNoEngine",{engines:t.join(", ")})}):null}const ds=[{value:"off",label:"settings.experimental.shareSkillsOff"},{value:"ask",label:"settings.experimental.shareSkillsAsk"},{value:"auto",label:"settings.experimental.shareSkillsAuto"}];function us(){const{state:t,dispatch:n}=S(),[a,i]=l.useState(!1),[r,d]=l.useState("");if(!st(t.config))return null;const c=ne(t.config),p=nt(t.config),o=async h=>{if(!(a||h===p)){i(!0),d("");try{const y=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:{shareLearnedSkills:h}})});n({type:"configStatus",config:y})}catch(y){d(y instanceof Error?y.message:s("settings.experimental.error"))}finally{i(!1)}}};return e.jsxs("div",{className:"mt-4 border-t border-hairline/30 pt-4","data-testid":"share-learned-skills-settings",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("settings.experimental.shareSkills")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s(c?"settings.experimental.shareSkillsDetail":"settings.experimental.shareSkillsNeedsAuthoring")})]}),e.jsx("div",{className:"inline-flex shrink-0 rounded-xl bg-inset p-1",role:"radiogroup","aria-label":s("settings.experimental.shareSkillsAria"),children:ds.map(h=>e.jsx("button",{type:"button",role:"radio","aria-checked":p===h.value,disabled:a||!c,onClick:()=>{o(h.value)},className:te("rounded-lg px-3 py-1.5 text-[13px] transition-colors disabled:cursor-not-allowed disabled:opacity-50",p===h.value?"bg-raised text-ink shadow":"text-ink-secondary hover:text-ink"),children:s(h.label)},h.value))})]}),r?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:r}):null]})}function ps(){return e.jsxs(e.Fragment,{children:[e.jsx(os,{}),e.jsx(us,{})]})}function Ds({title:t=s("settings.updates.title")}){const n=vt(),a=window.ogb?.updater;if(!n||!a)return null;const i=n.status==="checking"?s("settings.updates.checking"):n.status==="downloading"?n.percent==null?s("settings.updates.startingDownload"):s("settings.updates.downloading",{percent:Math.round(n.percent)}):n.status==="preparing"?s("settings.updates.preparing"):n.status==="downloaded"?n.installMode==="handoff"?s("settings.updates.readyInstall",{app:ce(),version:n.version??""}):s("settings.updates.ready",{app:ce(),version:n.version??""}):n.status==="installing"?xe(n)||(n.installMode==="handoff"?s("settings.updates.openingTerminal"):s("settings.updates.restarting")):n.status==="handed-off"?s("settings.updates.handedOff"):n.status==="error"?s("settings.updates.failed",{message:xe(n)??s("settings.updates.unknownError")}):s("settings.updates.latest");return e.jsx(v,{title:t,subtitle:i,children:e.jsx("button",{onClick:()=>{if(n.status==="downloaded")return void a.install();a.check()},disabled:n.status==="checking"||n.status==="downloading"||n.status==="preparing"||n.status==="installing"||n.retryable===!1,className:"ui-button",children:n.retryable===!1?s("settings.updates.quitReopen"):n.status==="downloaded"?n.installMode==="handoff"?s("settings.updates.install"):s("settings.updates.restart"):n.status==="preparing"?s("settings.updates.preparingShort"):n.status==="installing"?n.installMode==="handoff"?s("settings.updates.opening"):s("settings.updates.restartingShort"):s("settings.updates.check")})})}function Re(){const{state:t,dispatch:n}=S(),a=t.config?.newBots?.effort??"",[i,r]=l.useState(!1),[d,c]=l.useState("");return{current:a,saving:i,error:d,save:async o=>{if(!i){r(!0),c("");try{const h=await C("/api/config",{method:"PATCH",body:JSON.stringify({newBots:{effort:kt(o)?o:null}})});n({type:"configStatus",config:h})}catch(h){c(h instanceof Error?h.message:s("settings.newBotEffort.error"))}finally{r(!1)}}}}}function Pe({effort:t,className:n}){return e.jsxs(D,{size:"sm",className:n,value:t.current,disabled:t.saving,"aria-label":s("settings.newBotEffort.aria"),onChange:a=>{t.save(a.target.value)},children:[e.jsx("option",{value:"",children:s("settings.newBotEffort.default")}),yt.map(a=>e.jsx("option",{value:a,children:wt(a)},a))]})}function Os(){const t=Re();return e.jsx(v,{title:s("settings.newBotEffort.title"),subtitle:s("settings.newBotEffort.subtitle"),message:t.error?e.jsx("p",{role:"alert",className:"text-danger",children:t.error}):null,children:e.jsx(Pe,{effort:t,className:"w-full max-w-[240px]"})})}function xs({onEdit:t,onShare:n}){const a=Re();return e.jsx(v,{title:s("newBot.defaults"),subtitle:s("settings.newBotEffort.title"),message:a.error?e.jsx("p",{role:"alert",className:"text-danger",children:a.error}):null,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Pe,{effort:a,className:"w-auto"}),e.jsx("button",{type:"button",className:"ui-button","data-new-bot-share":!0,onClick:n,children:s("newBot.sharePreset")}),e.jsx("button",{type:"button",className:"ui-button","data-new-bot-defaults":!0,onClick:t,children:s("newBot.edit")})]})})}function ms(){const{state:t,dispatch:n}=S(),[a,i]=l.useState(!1),[r,d]=l.useState(!1);return e.jsxs("div",{children:[e.jsx("button",{disabled:a,onClick:()=>{i(!0),d(!1),C("/api/config",{method:"PUT",body:JSON.stringify({onboarding:{...t.config?.onboarding?.completedAt?{}:Jt().onboarding,hintsSeen:jt(t.config?.onboarding)}}),signal:AbortSignal.timeout(1e4)}).then(c=>{n({type:"configStatus",config:c}),n({type:"toggleTour",open:!0})}).catch(()=>d(!0)).finally(()=>i(!1))},className:"ui-button",children:s("settings.welcome.appTour")}),r&&e.jsx("p",{role:"alert",className:"mt-2 text-[13px] text-danger",children:s("onboarding.tour.error")})]})}function Ms(){const{dispatch:t}=S();return e.jsx(v,{title:s("settings.welcome.title"),subtitle:s("settings.welcome.subtitleShort"),children:e.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[e.jsx(ms,{}),e.jsx("button",{onClick:()=>t({type:"toggleWelcome",open:!0}),className:"ui-button",children:s("settings.welcome.replay")})]})})}function Us({simple:t=!1}){const{state:n}=S(),a=Ue(Fe(),n.config?.language);return e.jsx(v,{title:s("settings.language.title"),subtitle:Ke()?s("settings.language.subtitleComplete"):t?ke()==="en"?void 0:s("settings.simple.language.partial"):s("settings.language.subtitle"),children:e.jsxs(D,{size:"sm",variant:t?"ghost":"field",className:t?void 0:"w-full max-w-[240px]",value:a,"aria-label":s("settings.language.aria"),onChange:i=>Ie(i.target.value),children:[e.jsx("option",{value:"",children:s(t?"settings.simple.language.system":"settings.language.system")}),ze.map(({code:i,label:r})=>e.jsx("option",{value:i,children:r},i))]})})}function Fs(){const t=rt(),n=H("Gợi ý tin nhắn tiếp theo","Next-message suggestions");return e.jsx(v,{title:n,subtitle:H("Chế độ tự động có thể dùng lượt gọi mô hình của bot trên cuộc trò chuyện hiện tại.","Automatic mode can use an extra model call for the current conversation."),children:e.jsxs(D,{size:"sm",value:t,"aria-label":n,onChange:a=>lt(a.target.value),children:[e.jsx("option",{value:"auto",children:H("Tự động","Automatic")}),e.jsx("option",{value:"local",children:H("Chỉ dùng quy tắc cục bộ","Local rules only")}),e.jsx("option",{value:"off",children:H("Tắt","Off")})]})})}function zs({simple:t=!1}){const n=Ce();return e.jsx(v,{title:s("settings.sendKey.title"),subtitle:s(t?"settings.simple.sendKey":"settings.sendKey.subtitle",{key:pe("mod-enter")}),children:e.jsx(D,{size:"sm",variant:t?"ghost":"field",className:t?void 0:"w-full max-w-[240px]",value:n,"aria-label":s("settings.sendKey.title"),onChange:a=>ot(ct(a.target.value)),children:_e.map(a=>e.jsx("option",{value:a,children:pe(a)},a))})})}function Is({simple:t=!1}){const n=dt(),a=ut(Ce());return e.jsx(v,{title:s("settings.followUp.title"),subtitle:s(t?"settings.simple.followUp":"settings.followUp.subtitle",{key:a}),children:e.jsxs(D,{size:"sm",variant:t?"ghost":"field",className:t?void 0:"w-full max-w-[240px]",value:n,"aria-label":s("settings.followUp.title"),onChange:i=>pt(xt(i.target.value)),children:[e.jsx("option",{value:"steer",children:s("settings.followUp.steer")}),e.jsx("option",{value:"queue",children:s("settings.followUp.queue")})]})})}function Ks({simple:t=!1}){const n=at();return e.jsx(v,{title:s(t?"settings.userBubbles.simpleTitle":"settings.userBubbles.title"),subtitle:t?void 0:s("settings.userBubbles.subtitle"),children:e.jsx(R,{checked:n,"aria-label":s("settings.userBubbles.aria"),onClick:()=>it(!n)})})}function _s({simple:t=!1}){const n=je();return e.jsx(v,{className:t?void 0:"rounded-2xl border border-accent-border/40 bg-raised-hover/40 py-4",title:s("settings.advancedMode.title"),subtitle:s(t?"settings.simple.advancedMode":"settings.advancedMode.subtitle"),children:e.jsx(R,{checked:n,"aria-label":s("settings.advancedMode.title"),onClick:()=>Me(!n)})})}function $s(){const t=$e();return e.jsx(v,{title:s("settings.threadDisplay.title"),subtitle:s("settings.threadDisplay.subtitle"),children:e.jsx(R,{checked:t,"aria-label":s("settings.threadDisplay.show"),onClick:()=>qe(!t)})})}function qs(){const t=mt();return e.jsx(v,{title:s("settings.pinnedCircles.title"),subtitle:s("settings.pinnedCircles.subtitle"),children:e.jsx(R,{checked:t,"aria-label":s("settings.pinnedCircles.title"),onClick:()=>gt(!t)})})}function Hs(){const t=He();return e.jsx(v,{title:s("settings.runCard.title"),subtitle:s("settings.runCard.subtitle"),children:e.jsx(R,{checked:t,"aria-label":s("settings.runCard.show"),onClick:()=>Je(!t)})})}function Js(){const t=ht();return e.jsx(v,{title:s("settings.universalPins.title"),subtitle:s("settings.universalPins.subtitle"),children:e.jsx(R,{checked:t,"aria-label":s("settings.universalPins.title"),onClick:()=>ft(!t)})})}function Vs(){const{state:t,dispatch:n}=S(),a=bt(t.config),[i,r]=l.useState(!1),[d,c]=l.useState(""),p=async()=>{if(!i){r(!0),c("");try{const o=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:{showToolCalls:!a}})});n({type:"configStatus",config:o})}catch(o){c(o instanceof Error?o.message:s("settings.toolCalls.error"))}finally{r(!1)}}};return e.jsx(v,{title:s("settings.toolCalls.title"),subtitle:e.jsxs(e.Fragment,{children:[s("settings.toolCalls.subtitle")," ",s("settings.toolCalls.detail")]}),message:d?e.jsx("p",{role:"alert",className:"text-danger",children:d}):null,children:e.jsx(R,{checked:a,"aria-label":s("settings.toolCalls.aria"),disabled:i,onClick:()=>{p()},className:"disabled:cursor-wait disabled:opacity-50"})})}function Ws(){const{state:t,dispatch:n}=S(),a=ne(t.config),[i,r]=l.useState(!1),[d,c]=l.useState(""),p=async o=>{if(!i){r(!0),c("");try{const h=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:{skillAuthoring:o}})});n({type:"configStatus",config:h})}catch(h){c(h instanceof Error?h.message:s("settings.experimental.error"))}finally{r(!1)}}};return e.jsxs(Ne,{title:s("settings.experimental.title"),subtitle:s("settings.experimental.subtitle"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("settings.experimental.skillAuthoring")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s("settings.experimental.skillAuthoringDetail")})]}),e.jsx(R,{checked:a,"aria-label":s("settings.experimental.skillAuthoringAria"),disabled:i,onClick:()=>{p(!a)},className:"disabled:cursor-wait disabled:opacity-50"})]}),d?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:d}):null,e.jsx(ps,{}),e.jsx(ls,{})]})}function Ys(){const{state:t}=S(),n=t.config?.browserProfiles??[];return!se(t.config)&&n.length===0?null:e.jsx(Ne,{title:s("settings.profiles.title"),subtitle:s("settings.profiles.sharedSubtitle"),children:e.jsx(es,{})})}const ye=["Identity","Soul","Skills","Memory","Routines","Access","Model","Permissions","Voice & alerts"],gs={Identity:"botSettings.sections.identity",Soul:"botSettings.sections.soul",Skills:"botSettings.sections.skills",Memory:"botSettings.sections.memory",Routines:"botSettings.sections.routines",Access:"botSettings.sections.access",Model:"botSettings.sections.model",Permissions:"botSettings.sections.permissions","Voice & alerts":"botSettings.sections.voice"};function Ae(t){return e.jsx(Vt,{modal:!0,children:e.jsx(hs,{...t})})}function hs({defaultsMode:t=!1,onClose:n,onCreated:a,readyBotId:i,readyBotData:r}){const d=Wt(),c=S(),[,p]=l.useState(0),[o,h]=l.useState(()=>new ge(Pt,()=>p(x=>x+1))),[y,O]=l.useState("Identity"),[w,m]=l.useState(!1),[g,P]=l.useState(!1),b=g||c.state.botCreationPending,A=l.useRef(!1),f=l.useRef(!0),[T,M]=l.useState(""),[G,I]=l.useState(null),[F,_]=l.useState("everyone"),[$,X]=l.useState(""),z=Ee(),K=c.state.config?.team?.name,[u,E]=l.useState(null),N=Se(),L=Ve(),Te=je()?ye:ye.filter(x=>x!=="Model"),ie=!t&&typeof window<"u"&&!window.ogb&&N===!0,J=l.useRef(null),q=l.useRef(n);q.current=n,l.useEffect(()=>{let x=!1;return C("/api/bot-defaults").then(B=>{if(x)return;const j=At(B,!t),k=t?void 0:r??(i?ee(i):void 0),U=new ge(k?St(j,k,ke()):j,()=>p(W=>W+1));k&&ee(k.id)&&(U.role=k.id),h(U),m(!0)}).catch(B=>{x||M(String(B))}),()=>{x=!0}},[t,i,r]),l.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]),l.useEffect(()=>()=>o.dispose(),[o]),l.useEffect(()=>{b&&J.current?.focus()},[b]),l.useEffect(()=>{const x=document.activeElement instanceof HTMLElement?document.activeElement:null;J.current?.focus();const B=j=>{if(!d())return;const k=J.current;if(!k||j.target instanceof Node&&!k.contains(j.target))return;const U=k.querySelector('[role="dialog"], [role="alertdialog"]');if(U&&U.getClientRects().length||(j.key==="Escape"&&(j.preventDefault(),q.current()),j.key!=="Tab"))return;const W=[...k.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex="0"]')].filter(oe=>oe.getClientRects().length&&!oe.closest("[hidden],fieldset:disabled")),Z=W[0],Q=W.at(-1);if(!Z||!Q){j.preventDefault(),k.focus();return}j.shiftKey&&(document.activeElement===Z||document.activeElement===k)?(j.preventDefault(),Q.focus()):!j.shiftKey&&(document.activeElement===Q||document.activeElement===k)&&(j.preventDefault(),Z.focus())};return window.addEventListener("keydown",B),()=>{window.removeEventListener("keydown",B),x?.isConnected&&x.focus()}},[d]);const re=async()=>{if(!w||A.current||c.state.botCreationPending)return;if(!t&&o.bot.approvalMode==="auto"&&o.bot.computer==="local"&&!o.consent.acknowledgeLocalAuto){I("local");return}const x=ie?$t(F,$):null;if(x&&!x.ok){M(s("botSettings.visibility.needPeople"));return}A.current=!0,P(!0),M(""),c.dispatch({type:"botCreationPending",on:!0});try{if(t)await C("/api/config",{method:"PATCH",body:JSON.stringify({newBotDefaults:await Tt(o)})});else{const{bot:B,warnings:j,paused:k}=await Lt(o,void 0,void 0,void 0,x?.ok?x.visibility:void 0,z?he(u,o.bot.section,c.state.bots,z)??void 0:void 0);Dt(c.dispatch,B,j,{showThreads:L,source:o.preset?"preset":o.role?"template":"blank",role:o.role,paused:k});try{await a?.(B)}catch(U){c.dispatch({type:"error",message:U instanceof Error?U.message:String(U)})}}A.current=!1,f.current&&q.current()}catch(B){f.current&&M(B instanceof Error?B.message:String(B))}finally{A.current=!1,c.dispatch({type:"botCreationPending",on:!1}),f.current&&P(!1)}},V=o.bot,Le={...c,state:{...c.state,bots:[V,...c.state.bots],routines:o.routines,routineRuns:[],routinesLoadState:"ready"},flushBotPatches:async()=>V,dispatch:x=>{x.type==="updateBot"&&x.botId===o.id?o.patch(x.patch):x.type==="setModel"&&x.botId===o.id?(o.setModel(x.selection),x.resetApprovalToAsk&&o.patch({approvalMode:"ask"})):x.type==="routinePatched"||x.type==="toggleSettings"||c.dispatch(x)}},le=t?s("newBot.defaults"):s("sidebar.newBot");return e.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center bg-black/60 p-3 sm:p-5",hidden:!t&&c.state.appSettingsOpen,children:e.jsxs("div",{ref:J,role:"dialog","aria-modal":"true","aria-label":le,"aria-busy":b,tabIndex:-1,className:"flex h-[min(760px,94dvh)] w-full max-w-[900px] flex-col overflow-hidden rounded-2xl border border-hairline/50 bg-panel shadow-2xl outline-none",children:[e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-hairline/40 px-5 py-4",children:[e.jsx("h2",{className:"text-[17px] font-semibold text-ink",children:le}),e.jsx("button",{type:"button",onClick:()=>q.current(),"aria-label":s("common.close"),className:"flex size-8 shrink-0 items-center justify-center rounded-lg text-ink-secondary hover:bg-control hover:text-ink disabled:opacity-40",children:e.jsx(we,{size:18,className:"pointer-events-none"})})]}),z&&!t&&K&&e.jsx(fs,{team:K}),ie&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-5 pt-3 text-[13px] text-ink-secondary","data-new-bot-visibility":!0,children:[e.jsxs("label",{className:"flex items-center gap-2",children:[s("botSettings.visibility.title"),e.jsxs(D,{size:"sm",value:F,disabled:b,onChange:x=>_(x.target.value),children:[e.jsx("option",{value:"everyone",children:s("botSettings.visibility.everyone")}),e.jsx("option",{value:"admins",children:s("botSettings.visibility.admins")}),e.jsx("option",{value:"people",children:s("botSettings.visibility.people")})]})]}),F==="people"&&e.jsx("input",{value:$,disabled:b,onChange:x=>X(x.target.value),placeholder:s("botSettings.visibility.peoplePlaceholder"),"aria-label":s("botSettings.visibility.peopleLabel"),className:"min-w-[16rem] flex-1 rounded-lg border border-hairline/40 bg-inset px-3 py-1.5 text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col sm:flex-row",children:[e.jsx("nav",{"aria-label":s("newBot.sections"),className:"flex shrink-0 gap-1 overflow-x-auto border-b border-hairline/40 p-2 sm:w-40 sm:flex-col sm:border-b-0 sm:border-r",children:Te.map(x=>e.jsx("button",{type:"button",onClick:()=>O(x),"aria-current":y===x?"page":void 0,className:te("shrink-0 rounded-lg px-3 py-2 text-left text-[13px]",y===x?"bg-control text-ink":"text-ink-secondary hover:bg-control/50"),children:s(gs[x])},x))}),e.jsxs("div",{className:"min-h-0 min-w-0 flex-1 overflow-y-auto p-4 sm:p-5",children:[!w&&!T&&e.jsxs("div",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[e.jsx(Y,{size:16,className:"animate-spin"}),s("newBot.loading")]}),w&&e.jsx("fieldset",{disabled:b,className:"min-w-0",children:e.jsx(Nt,{value:Le,children:e.jsx(Ct.Provider,{value:{request:o.request,draft:!0,uploadAvatar:o.uploadAvatar},children:e.jsx(bs,{active:y,draft:o,defaultsMode:t,owner:z&&!t?{value:he(u,V.section,c.state.bots,z),choose:E}:void 0})})})})]})]}),T&&e.jsx("p",{role:"alert",className:"max-h-24 overflow-y-auto border-t border-hairline/40 px-5 py-3 text-[13px] text-danger",children:T}),e.jsxs("div",{className:"flex shrink-0 justify-end gap-2 border-t border-hairline/40 px-5 py-3",children:[e.jsx("button",{type:"button",onClick:()=>q.current(),className:"rounded-lg px-4 py-2 text-[13px] text-ink-secondary hover:bg-control",children:s("common.cancel")}),e.jsxs("button",{type:"button",disabled:!w||b||!t&&!V.name.trim(),onClick:()=>{re()},className:"ui-button-primary flex items-center gap-2 rounded-lg bg-accent px-5 py-2 text-[13px] font-medium text-white hover:brightness-110 disabled:opacity-40",children:[b&&e.jsx(Y,{size:15,className:"animate-spin"}),s(t?"newBot.saveDefaults":"newBot.create")]})]}),e.jsx(Et,{open:G==="local",onCancel:()=>I(null),onConfirm:()=>{o.consent.acknowledgeLocalAuto=!0,I(null),re()}})]})})}function fs({team:t}){const n=typeof window>"u"?void 0:window.ogb?.workspaces;return e.jsxs("div",{"data-new-bot-shared":!0,className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-b border-hairline/40 bg-raised/30 px-5 py-2.5 text-[13px] text-ink-secondary",children:[e.jsx("span",{children:s("newBot.sharedWith",{team:t})}),n?e.jsx("button",{type:"button",onClick:()=>{Ot(n).catch(()=>{})},className:"font-medium text-accent hover:underline",children:s("newBot.justForYou")}):e.jsx("span",{children:s("newBot.justForYou").replace(/\s*→$/,"")})]})}function bs({active:t,draft:n,defaultsMode:a,owner:i}){const r=n.bot,{state:d}=S(),c=Ee(),p=Bt(r);return t==="Identity"?e.jsxs("div",{className:"space-y-4",children:[e.jsx(vs,{draft:n,defaultsMode:a}),e.jsx(Mt,{bot:r,patch:p.patch,activeState:p.activeState,mascotMotion:null,namePlaceholder:a?s("newBot.randomName"):void 0}),e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("newBot.team"),e.jsxs(D,{size:"lg",className:"mt-1.5 w-full",value:r.section??"",onChange:o=>n.patch({section:o.target.value}),children:[e.jsx("option",{value:"",children:s("teamSettings.general")}),[...new Set([...d.sections??[],...d.bots.map(o=>o.section??"")])].filter(Boolean).map(o=>e.jsx("option",{children:o},o))]})]}),i&&c&&e.jsxs("label",{className:"block text-[13px] text-ink-secondary","data-new-bot-reports-to":!0,children:[s("lookedAfter.newBot"),e.jsx(D,{size:"lg",className:"mt-1.5 w-full",value:i.value??"",onChange:o=>i.choose(o.target.value),children:c.people.map(o=>e.jsx("option",{value:o.email,children:o.you?s("owner.you",{name:o.name}):o.name},o.email))}),e.jsx("span",{className:"mt-1 block text-[12px]",children:s("lookedAfter.pickHint")})]})]}):t==="Soul"?e.jsx(Ut,{bot:r,patch:p.patch}):t==="Skills"?e.jsx(Ft,{bot:r}):t==="Memory"?e.jsx(ys,{draft:n}):t==="Routines"?e.jsx(ws,{draft:n}):t==="Access"?e.jsx(zt,{bot:r,derived:p}):t==="Model"?e.jsx(It,{bot:r}):t==="Permissions"?e.jsx(Kt,{bot:r,derived:p}):e.jsx(_t,{bot:r,derived:p})}function vs({draft:t,defaultsMode:n}){const[a,i]=l.useState([]),[r,d]=l.useState(0),[c,p]=l.useState(""),o=l.useRef(!1);l.useEffect(()=>{if(n)return;let m=!1;return C("/api/bot-presets").then(g=>{m||i(g.presets)}).catch(()=>{m||i([])}),()=>{m=!0}},[n,r]);const h=t.preset?a.find(m=>m.id===t.preset.id):void 0,y=async m=>{p("");const g=m.startsWith("preset:")?a.find(b=>b.id===m.slice(7)):void 0;if(!g){t.choosePreset(void 0);const b=me.find(f=>f.id===m);t.chooseRole(b?.id);const A=b&&ee(b.id)?.look;b&&t.patch({...Rt(b),...A});return}t.patch(ss(g)),t.choosePreset(is(g));const P=ns(g);try{P?(t.patch({avatarUrl:await t.uploadAvatar(P),avatarCrop:g.bot.appearance.avatar.crop}),o.current=!0):o.current&&(t.patch({avatarUrl:""}),o.current=!1)}catch(b){p(b instanceof Error?b.message:String(b))}},O=async m=>{p("");try{await C(`/api/bot-presets/${encodeURIComponent(m.id)}`,{method:"DELETE"}),t.preset?.id===m.id&&t.choosePreset(void 0),d(g=>g+1)}catch(g){p(g instanceof Error?g.message:String(g))}},w=me.map(m=>e.jsx("option",{value:m.id,children:m.title},m.id));return e.jsxs("div",{children:[e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("newBot.startingRole"),e.jsxs(D,{size:"lg",className:"mt-1.5 w-full",value:t.preset?`preset:${t.preset.id}`:"",onChange:m=>{y(m.target.value)},children:[e.jsx("option",{value:"",children:s("newBot.customSettings")}),ts(a).map(m=>e.jsx("optgroup",{label:m.label,children:m.presets.map(g=>e.jsx("option",{value:`preset:${g.id}`,children:g.name},g.id))},m.label)),a.length?e.jsx("optgroup",{label:s("newBot.builtInRoles"),children:w}):w]})]}),h&&e.jsxs("div",{className:"mt-2 space-y-1 rounded-lg bg-card px-3 py-2.5 text-[13px] text-ink-secondary","data-new-bot-preset":!0,children:[as(h).map((m,g)=>e.jsx("p",{className:"break-words",children:m},g)),h.source==="file"&&e.jsx("button",{type:"button",onClick:()=>{O(h)},className:"mt-1 rounded-md px-2 py-1 text-[12px] text-ink-secondary hover:bg-control hover:text-ink",children:s("newBot.presetRemove")})]}),c&&e.jsx("p",{role:"alert",className:"mt-2 text-[13px] text-danger",children:c})]})}function ys({draft:t}){const[n,a]=l.useState("MEMORY.md"),[i,r]=l.useState("");return e.jsxs("div",{className:"space-y-3",children:[e.jsx(D,{size:"lg",className:"w-full","aria-label":s("memory.fileLabel",{path:n}),value:n,onChange:d=>a(d.target.value),children:[...new Set(["MEMORY.md",...Object.keys(t.template.memory)])].map(d=>e.jsx("option",{children:d},d))}),e.jsx("textarea",{className:te(fe,"min-h-72 font-mono"),"aria-label":s("memory.contents"),value:t.template.memory[n]??"",onChange:d=>t.setMemory(n,d.target.value)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{className:fe,"aria-label":s("memory.newTopicLabel"),placeholder:s("memory.newTopicLabel"),value:i,onChange:d=>r(d.target.value)}),e.jsx("button",{type:"button","aria-label":s("memory.addTopic"),disabled:!/^[a-zA-Z0-9_-]+$/.test(i),className:"rounded-lg bg-control px-3 disabled:opacity-40",onClick:()=>{const d=`memory/${i}.md`;d in t.template.memory||t.setMemory(d,""),a(d),r("")},children:e.jsx(Yt,{size:16})}),n!=="MEMORY.md"&&e.jsx("button",{type:"button","aria-label":s("memory.removeTopic"),className:"rounded-lg bg-control px-3",onClick:()=>{t.setMemory(n,null),a("MEMORY.md")},children:e.jsx(Be,{size:16})})]})]})}function ws({draft:t}){const[n,a]=l.useState(null);return e.jsxs("div",{className:"space-y-3",children:[e.jsx("button",{type:"button",className:"rounded-lg bg-accent px-3 py-2 text-[13px] text-white",onClick:()=>a("new"),children:s("computer.routines.create")}),t.routines.map(i=>e.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-card p-3",children:[e.jsx("button",{type:"button",className:"min-w-0 flex-1 text-left text-[13px]",onClick:()=>a(i),children:i.name}),e.jsxs("label",{className:"flex items-center gap-1.5 text-[12px] text-ink-secondary",children:[e.jsx("input",{type:"checkbox",checked:i.enabled,onChange:r=>t.setRoutineEnabled(i.id,r.target.checked)}),s("newBot.enabled")]}),e.jsx("button",{type:"button","aria-label":s("newBot.removeRoutine",{name:i.name}),onClick:()=>t.removeRoutine(i.id),className:"rounded p-1.5 hover:bg-control",children:e.jsx(Be,{size:15})})]},i.id)),n&&e.jsx(qt,{routine:n==="new"?void 0:n,bots:[t.bot],lockedBotId:t.id,onClose:()=>a(null)})]})}function js({simple:t=!1}){const[n,a]=l.useState(!1),[i,r]=l.useState(!1),d=e.jsxs(e.Fragment,{children:[n&&e.jsx(Ae,{defaultsMode:!0,onClose:()=>a(!1)}),i&&e.jsx(rs,{onClose:()=>r(!1)})]});if(t)return e.jsxs(e.Fragment,{children:[e.jsx(xs,{onEdit:()=>a(!0),onShare:()=>r(!0)}),d]});const c=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex shrink-0 gap-2",children:[e.jsx("button",{type:"button",onClick:()=>r(!0),className:"cursor-pointer rounded-lg px-3 py-1.5 text-[13px] text-ink-secondary hover:bg-control hover:text-ink",children:s("newBot.sharePreset")}),e.jsx("button",{type:"button",onClick:()=>a(!0),className:"cursor-pointer rounded-lg bg-control px-3 py-1.5 text-[13px] text-ink hover:bg-raised-hover",children:s("newBot.edit")})]}),d]});return e.jsx(v,{title:s("newBot.defaults"),children:c})}const Gs=Object.freeze(Object.defineProperty({__proto__:null,DefaultBotSettings:js,NewBotDialog:Ae},Symbol.toStringTag,{value:"Module"}));export{_s as A,Ts as B,Ks as C,js as D,Ws as E,Is as F,Us as L,Os as N,qs as P,Ms as R,Ls as S,Vs as T,Ds as U,Ys as a,Fs as b,zs as c,$s as d,Js as e,Hs as f,Gs as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as d,j as t,t as n}from"./styles-
|
|
1
|
+
import{r as d,j as t,t as n}from"./styles-B38kYzzJ.js";import{r as c}from"./PlacesRail-owo7-LYs.js";import{y as x,z as p,Q as m,D as u}from"./App-BFnQK962.js";import"./monitor-Bt-Nw5iC.js";import"./index-DZeZApXw.js";import"./MenuMotion-CJ3EL6xi.js";const f=[{id:"ios",nameKey:"phoneApp.ios",actionKey:"phoneApp.iosAction",url:x},{id:"android",nameKey:"phoneApp.android",actionKey:"phoneApp.androidAction",url:p}];function v({open:r,onClose:o,connect:i=[]}){const a=d.useRef(null);if(d.useEffect(()=>{if(!r)return;a.current?.focus();const e=l=>{l.key==="Escape"&&(l.preventDefault(),o())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[r,o]),!r)return null;const s=t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-6",onMouseDown:e=>e.stopPropagation(),children:t.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"phone-app-dialog-title",className:"max-h-full w-full max-w-[460px] overflow-y-auto rounded-2xl border border-hairline/50 bg-panel p-6 shadow-2xl",children:[t.jsx("h2",{id:"phone-app-dialog-title",className:"text-[17px] font-semibold text-ink",children:n("phoneApp.title")}),t.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:n("phoneApp.subtitle")}),t.jsx("ul",{className:"mt-4 grid grid-cols-1 gap-3 sm:grid-cols-2",children:f.map(e=>t.jsxs("li",{"data-phone-app":e.id,className:"flex flex-col items-center gap-3 rounded-xl bg-card p-4 text-center",children:[t.jsx("div",{className:"text-[14px] font-medium text-ink",children:n(e.nameKey)}),t.jsx("div",{className:"rounded-md bg-white p-2",children:t.jsx(m,{value:e.url,size:132,level:"M",bgColor:"#ffffff",fgColor:"#111111",title:n(e.actionKey)})}),t.jsx("button",{type:"button",onClick:()=>{u(e.url)},className:"text-[13px] text-accent hover:underline",children:n(e.actionKey)})]},e.id))}),i.length?t.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[t.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:n("phoneApp.next")}),i.map((e,l)=>t.jsxs("button",{type:"button","data-phone-app-connect":e.key,onClick:()=>{o(),e.onSelect()},className:l===0?"flex w-full flex-col items-center rounded-xl bg-accent px-4 py-2 text-[13px] font-medium text-accent-ink hover:opacity-90":"flex w-full flex-col items-center rounded-xl border border-hairline/50 px-4 py-2 text-[13px] font-medium text-ink hover:bg-raised",children:[t.jsx("span",{children:n("sidebar.menu.connectPhone")}),t.jsx("span",{className:"text-[12px] font-normal opacity-80",children:e.subtitle})]},e.key))]}):null,t.jsx("button",{ref:a,type:"button",onClick:o,className:"mt-3 w-full rounded-xl bg-raised px-4 py-2 text-[13px] font-medium text-ink hover:brightness-110",children:n("common.close")})]})});return typeof document>"u"?s:c.createPortal(s,document.body)}export{f as PHONE_APPS,v as PhoneAppDialog};
|