limixbot 0.3.161 → 0.3.162
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-D4K2fyw7.js → ActivityPanel-CMN_U4H6.js} +1 -1
- package/dist/assets/{App-B6W9JFXZ.js → App-DbfRrJPA.js} +94 -94
- package/dist/assets/{AppEventEditor-OWWzSxPd.js → AppEventEditor-BpXev-Xi.js} +1 -1
- package/dist/assets/{BotSettingsDialog-W_eO05D2.js → BotSettingsDialog-DzL9xn3E.js} +1 -1
- package/dist/assets/{BrowserPanel-C0NOYaOK.js → BrowserPanel-Dq80i975.js} +1 -1
- package/dist/assets/{BrowserProfilesManager-48HNAHJm.js → BrowserProfilesManager-BiDKQm59.js} +1 -1
- package/dist/assets/{CloudAddDialog-RDN92Hbu.js → CloudAddDialog-B-QSFP19.js} +1 -1
- package/dist/assets/{ComputerFilesPane-HhCIEUQ4.js → ComputerFilesPane-DU2CnBSk.js} +1 -1
- package/dist/assets/{ComputerPanel-C8ZuT_hf.js → ComputerPanel-3z4z9zuO.js} +2 -2
- package/dist/assets/{DataPanel-CEPYRb_t.js → DataPanel-D2rowgqx.js} +1 -1
- package/dist/assets/{GrokMoveDialog-BEkVuGJs.js → GrokMoveDialog-BM1fpvD9.js} +1 -1
- package/dist/assets/{InspectorPanel-CYwO5Hpk.js → InspectorPanel-CSXRdQWb.js} +1 -1
- package/dist/assets/{KeyboardShortcutsModal-CvoUyPNv.js → KeyboardShortcutsModal-Bl0rAIm5.js} +1 -1
- package/dist/assets/{KnowledgePanel-Crh_Mb2-.js → KnowledgePanel-BIucsmt4.js} +1 -1
- package/dist/assets/{LiveDesktop-DZV6iCg2.js → LiveDesktop-9xq-uOSe.js} +1 -1
- package/dist/assets/{LocalVmWorkspace-C82LcwJQ.js → LocalVmWorkspace-SpZ3uYGB.js} +1 -1
- package/dist/assets/{MacLocalControl-Bx_fyo-H.js → MacLocalControl-BSQ9KcLo.js} +1 -1
- package/dist/assets/{MarkdownFilePreview-BXNCSmvg.js → MarkdownFilePreview-Bdq8zdL7.js} +1 -1
- package/dist/assets/{NewBotDialog-D0agPdOC.js → NewBotDialog-Y3yhTrdv.js} +1 -1
- package/dist/assets/{PhoneAppDialog-DQpyRnEJ.js → PhoneAppDialog-xyMORAow.js} +1 -1
- package/dist/assets/{PluginsPanel-C4HY0lnL.js → PluginsPanel-BycWst3k.js} +1 -1
- package/dist/assets/{ProIntroduction-BO5ABFTi.js → ProIntroduction-CSoN3fqJ.js} +1 -1
- package/dist/assets/{RemoteAgentSettingsPanel-D0vIEaec.js → RemoteAgentSettingsPanel-BPaZTL6O.js} +1 -1
- package/dist/assets/{RoomPanel-KgR5RAVc.js → RoomPanel-D0qQD9cP.js} +1 -1
- package/dist/assets/{RoutinesPage-CFb9pR_B.js → RoutinesPage-BcixjsUv.js} +1 -1
- package/dist/assets/{SettingsModal-CBovr73q.js → SettingsModal-TeyS-NmE.js} +1 -1
- package/dist/assets/{ShareTeamDialog-E7_x3dOd.js → ShareTeamDialog-lgrszRmR.js} +1 -1
- package/dist/assets/{SignedInSites-tgZ-kFN4.js → SignedInSites-CZ0n7vLp.js} +1 -1
- package/dist/assets/{TeamLibraryPanel-DA7R6knC.js → TeamLibraryPanel-C4-iBK0f.js} +1 -1
- package/dist/assets/{TeamMapPage-CrEl0669.js → TeamMapPage-Bj61D2B3.js} +1 -1
- package/dist/assets/{TriggersPage-DoApzhWG.js → TriggersPage-ByPFvYfu.js} +1 -1
- package/dist/assets/{VisibilitySection-ChKxjJ5C.js → VisibilitySection-DoYze3-2.js} +1 -1
- package/dist/assets/{WebhookTrigger-B_VHQtPd.js → WebhookTrigger-B2um3gdH.js} +1 -1
- package/dist/assets/{WorksOnGrid-CBZxKyOV.js → WorksOnGrid-BHChAxnC.js} +1 -1
- package/dist/assets/{core-DXs_9m1L.js → core-9eGd8K9v.js} +1 -1
- package/dist/assets/{import-name-DviM_E6k.js → import-name-DoP5S_PW.js} +1 -1
- package/dist/assets/{index-kl2U4CdS.js → index-Cmy63UPX.js} +1 -1
- package/dist/assets/{index-Bh1qTRXw.js → index-DAHkvjY_.js} +2 -2
- package/dist/assets/{new-bot-78Wk4hfY.js → new-bot-C-8Y9Kzd.js} +1 -1
- package/dist/assets/{org-library-tkloWFxW.js → org-library-DBxhMG4q.js} +1 -1
- package/dist/assets/{package-format-nQAkOC1F.js → package-format-B8QbigkU.js} +1 -1
- package/dist/assets/{remote-desktop-panel-ByE5Ghzy.js → remote-desktop-panel-WDJu4EfU.js} +1 -1
- package/dist/index.html +1 -1
- package/dist-server/index.js +2495 -2482
- package/dist-server/package.json +1 -1
- package/dist-server/server/index.js +2 -1
- package/dist-server/server/working-drive-import.js +196 -0
- package/dist-server/server/working-folders.js +12 -3
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/App-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/App-DbfRrJPA.js","assets/styles-DnkNzLDs.js","assets/styles-Ck7XEMka.css","assets/PlacesRail-fw4FbMbq.js","assets/monitor-D-rHzZVy.js","assets/MenuMotion-xBTC4eOZ.js","assets/DesktopViewer-Rhj5Rg_E.js","assets/desktop-connection-Dfaq6k5a.js","assets/desktop-viewer-CF-OpSo0.js","assets/minimize-LlGLn-cd.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{t as s,as as vt,s as T,at as St,g as Ye,o as xe,au as qe,O as jt,J as Nt,r as u,av as Et,z as be,aw as Pe,x as Te,ax as Ie,ay as Ct,az as Pt,j as r,S as Je,X as Tt,a as $,aA as It,aB as _t,k as W,L as At,a9 as re,T as ae,af as _e,p as U,aC as Lt,m as Ot,y as Rt,A as $t,B as Ht,D as Dt,aD as Mt,aE as zt,F as Bt,E as Ft,G as Ut,P as Wt,_ as Ze}from"./styles-DnkNzLDs.js";function fo(e,t){if(!t)return;if(t.kind!=="session")return t.kind==="loopback"?e:void 0;if(t.team||t.scopes.includes("admin"))return e;const n=t.email;if(n?.trim())return e?.email?.trim().toLowerCase()===n.trim().toLowerCase()?e:{email:n}}const Qe="omb.team-sign-in";function Kt(e){try{e&&globalThis.localStorage?.setItem(Qe,e)}catch{}}function Vt(){try{return globalThis.localStorage?.getItem(Qe)??null}catch{return null}}async function te(e=fetch){let t;try{t=await e("/api/auth/session",{credentials:"same-origin"})}catch(a){return{kind:"unreachable",error:a instanceof Error?a.message:String(a)}}const n=await t.json().catch(()=>({})),o=Object(n);return t.status===401||t.status===403?{kind:"unauthenticated",error:typeof o.error=="string"?o.error:`${t.status}`}:t.ok?o.kind==="session"&&typeof o.id=="string"?{kind:"session",id:o.id,label:typeof o.label=="string"?o.label:"",...typeof o.email=="string"?{email:o.email}:{},scopes:Array.isArray(o.scopes)?o.scopes.filter(a=>typeof a=="string"):[],expiresAt:typeof o.expiresAt=="number"?o.expiresAt:0,...typeof o.reactor=="string"?{reactor:o.reactor}:{},...typeof o.teamSignIn=="string"?{teamSignIn:o.teamSignIn}:{},...Ae(o.team)?{team:Ae(o.team),openedThreads:Array.isArray(o.openedThreads)?o.openedThreads.filter(a=>typeof a=="string"):[]}:{},...o.cloudGuest===!0?{cloudGuest:!0,openedThreads:Array.isArray(o.openedThreads)?o.openedThreads.filter(a=>typeof a=="string"):[]}:{}}:o.trust==="service"?{kind:"loopback",trust:"service"}:{kind:"loopback"}:{kind:"unreachable",error:`${t.status} ${t.statusText}`}}function Ae(e){const t=Object(e);return typeof t.id=="string"&&typeof t.name=="string"&&typeof t.role=="string"?{id:t.id,name:t.name,role:t.role}:null}function Xt(e){return e?.kind==="session"||e?.kind==="loopback"&&e.trust!=="service"}function et(e){return e?e.kind==="loopback"?e.trust!=="service":e.kind==="session"&&e.scopes.includes("admin"):!1}function Gt(){const e=/[#&]code=([^&]+)/.exec(location.hash);return e?(history.replaceState(null,"",location.pathname+location.search),decodeURIComponent(e[1])):null}function Yt(){if(!/[#&]signin=/.test(location.hash))return null;const e=/[#&]signin=(omb_pair_[A-Za-z0-9_-]{43})(?:&|$)/.exec(location.hash);return history.replaceState(null,"",location.pathname+location.search),e?e[1]:null}function qt(){const e=new URLSearchParams(location.search),t=e.get("email")?.trim().toLowerCase()??"";if(!t)return null;e.delete("email");const n=e.toString();return history.replaceState(null,"",location.pathname+(n?`?${n}`:"")+location.hash),/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(t)?t:null}function tt(e=navigator.userAgent){const t=/Edg\//.test(e)?"Edge":/OPR\//.test(e)?"Opera":/Chrome\//.test(e)?"Chrome":/Firefox\//.test(e)?"Firefox":/Safari\//.test(e)?"Safari":"Browser",n=/iPhone/.test(e)?"iPhone":/iPad/.test(e)?"iPad":/Android/.test(e)?"Android":/Mac OS X/.test(e)?"Mac":/Windows/.test(e)?"Windows":/Linux/.test(e)?"Linux":"";return n?`${t} on ${n}`:t}function J(){return typeof crypto?.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,14)}`}function nt(e,t){const n=Reflect.get(Object(e),"error");return vt(e,typeof n=="string"?n:`${t.status} ${t.statusText}`)}async function ce(e,t=fetch){let n;try{n=await t("/api/auth/pair",{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify({code:e.code,label:e.label,cookie:!0,attemptId:e.attemptId??J(),...e.browser?{browser:!0}:{}})})}catch(a){return{ok:!1,error:s("pair.unreachable",{error:a instanceof Error?a.message:String(a)})}}const o=await n.json().catch(()=>({}));return n.ok?{ok:!0}:{ok:!1,error:nt(o,n)}}async function Jt(e,t=fetch){try{const n=await t("/api/auth/pair",{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify({code:e,browser:!0,preview:!0})}),o=Object(await n.json().catch(()=>({}))),a=Reflect.get(o,"owner"),i=Reflect.get(o,"team");return n.ok&&typeof a=="string"&&a?{owner:a,...typeof i=="string"&&i.trim()?{team:i.trim()}:{}}:null}catch{return null}}function Zt(e,t,n=fetch){return ce({code:e,label:tt(),attemptId:t,browser:!0},n)}function ho(e){const t=Object(e);return t.cloudHome===!0&&typeof t.owner=="string"&&t.owner?t.owner:null}async function ot(e,t,n){let o;try{o=await n(e,{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify(t)})}catch(i){return{ok:!1,error:s("pair.unreachable",{error:i instanceof Error?i.message:String(i)})}}const a=await o.json().catch(()=>({}));return o.ok?{ok:!0}:{ok:!1,error:nt(a,o)}}function Qt(e,t=fetch){return ot("/api/auth/email/start",{email:e},t)}function en(e,t=fetch){return ot("/api/auth/email/verify",{email:e.email,code:e.code,label:e.label},t)}function Le(e){return!e||/through a proxy|loopback host required|cross-origin request|^40[13]$/i.test(e)?null:e}function tn(){window.ogb?.softwareRendering===!0&&(document.documentElement.dataset.softwareRendering="")}const nn="/api/theme-assets/",on="safe-look",rt={cssChars:1e5,assetBytes:10*1024*1024},rn=/^[a-z0-9][a-z0-9-]{0,47}$/,an=/^[a-z0-9][a-z0-9_-]{0,79}\.(png|jpe?g|webp|gif|avif|svg|woff2?|ttf|otf)$/,sn=/^\/api\/theme-assets\/[a-z0-9][a-z0-9-]{0,47}\/[a-z0-9][a-z0-9_-]{0,79}\.[a-z0-9]{2,5}$/,at=["app","panel","frame","raised","raised-hover","card","inset","control","composer","composer-ring","menu","menu-hover","menu-active","hairline","edge","scrollbar","ink","ink-secondary","ink-tertiary","accent","accent-border","accent-text","accent-ink","focus","bubble-user","bubble-user-ink","success","success-ink","danger","danger-ink","warning"],Z=T().trim().regex(/^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i,"a hex colour such as #1a2b3c"),ln=T().trim().min(1).max(120).regex(/^[#a-z0-9(),.%\s/+-]+$/i,"a CSS colour such as #1a2b3c, rgb(…) or color-mix(…)").refine(e=>!/url|image|src|attr/i.test(e),"a colour, not a file"),st=St(Ye(at),ln),Oe=xe({canvas:Z.optional(),accent:Z.optional(),colors:st.optional()}).strict(),ge=xe({name:T().trim().min(1).max(60),skin:Ye([...qe,"system"]).optional(),canvas:Z.optional(),accent:Z.optional(),colors:st.optional(),light:Oe.optional(),dark:Oe.optional(),font:T().trim().max(300).regex(/^[\w\s"',.-]*$/,'a font-family list such as "Inter Variable", serif').optional(),css:T().max(rt.cssChars).optional()}).strict(),cn=1;xe({mausbotTheme:Nt(cn),id:T().regex(rn).optional(),theme:ge,assets:jt(T().regex(an),T().max(Math.ceil(rt.assetBytes*1.4)).regex(/^data:[\w/+.-]+;base64,[A-Za-z0-9+/=]+$/)).optional()}).strict();function it(e){return/^data:/i.test(e)||e.startsWith("#")||sn.test(e)&&!e.includes("..")}function lt(e){const t=e.toLowerCase(),n=[];for(let o=t.indexOf("url(");o!==-1;o=t.indexOf("url(",o+4)){let a=o+4;for(;/\s/.test(e[a]??"");)a++;const i=e[a];let c;if(i==='"'||i==="'"){const l=e.indexOf(i,a+1);if(l===-1)return null;for(c=e.slice(a+1,l),a=l+1;/\s/.test(e[a]??"");)a++;if(e[a]!==")")return null}else{const l=e.indexOf(")",a);if(l===-1||(c=e.slice(a,l).trim(),/[\s"'(]/.test(c)))return null}n.push(c.trim())}return n}const ct=/image-set\(|\bimage\(|\bsrc\(/i;function ut(e){if(e.includes("\\")||ct.test(e))return!0;const t=lt(e);return t===null||t.some(n=>!it(n))}function un(e){let t="";for(let n=0;n<e.length;n++){const o=e[n];if(o==="/"&&e[n+1]==="*"){const a=e.indexOf("*/",n+2);n=a===-1?e.length:a+1,t+=" "}else if(o==='"'||o==="'"){let a=n+1;for(;a<e.length&&e[a]!==o&&e[a]!==`
|
|
3
|
-
`;)a+=e[a]==="\\"?2:1;t+=`${o}${" ".repeat(Math.max(0,a-n-1))}${o}`,n=a}else t+=o}return t}function xo(e){const t=un(e);if(/@import/i.test(t))return"@import is not allowed: themes cannot load other stylesheets.";if(t.includes("\\"))return"Backslash escapes are only allowed inside quoted strings.";if(ct.test(t))return"image-set(), image() and src() are not allowed: use url() with a theme file or a data: address.";const n=e.replace(/\/\*[\s\S]*?\*\//g," "),o=lt(n);if(o===null)return'A url() could not be read. Write url("/api/theme-assets/<theme>/<file>").';const a=o.find(i=>!it(i));return a!==void 0?`url(${a.slice(0,80)}) is not allowed: themes load only their own files (${nn}<theme>/<file>), data: addresses or #ids, never the internet.`:null}function ue(e=typeof document>"u"?null:document.documentElement){if(!e||typeof window>"u"||typeof window.getComputedStyle!="function")return"dark";try{return window.getComputedStyle(e).getPropertyValue("--code-color-scheme").trim()==="light"?"light":"dark"}catch{return"dark"}}function bo(){const[e,t]=u.useState(()=>ue());return u.useEffect(()=>{const n=()=>t(ue());if(n(),typeof MutationObserver>"u")return;const o=new MutationObserver(n);return o.observe(document.documentElement,{attributes:!0,attributeFilter:["data-skin"]}),()=>o.disconnect()},[]),e}const N=[255,255,255],P=[0,0,0];function Q(e){const t=e.trim().replace(/^#/,""),n=t.length===3?[...t].map(a=>a+a).join(""):t,o=Number.parseInt(n.slice(0,6),16);return Number.isFinite(o)?[o>>16&255,o>>8&255,o&255]:P}const K=e=>Math.round(Math.min(255,Math.max(0,e))).toString(16).padStart(2,"0"),d=([e,t,n],o)=>`#${K(e)}${K(t)}${K(n)}${o===void 0?"":K(o*255)}`,v=(e,t,n)=>[0,1,2].map(o=>e[o]+(t[o]-e[o])*n);function ee([e,t,n]){const o=a=>{const i=a/255;return i<=.03928?i/12.92:((i+.055)/1.055)**2.4};return .2126*o(e)+.7152*o(t)+.0722*o(n)}function de(e,t){const[n,o]=[ee(e),ee(t)].sort((a,i)=>i-a);return(n+.05)/(o+.05)}const Re=e=>ee(Q(e))<.2?"dark":"light";function X(e,t,n){const o=ee(t)<.2?N:P;let a=e;for(let i=1;i<=20&&de(a,t)<n;i++)a=v(e,o,i/20);return a}const dt=e=>de(N,e)>=de(P,e)?N:[17,17,17];function dn(e,t){const n=Q(e),o=t==="dark",a=f=>v(n,o?N:P,f),i=o?a(.08):v(n,N,.85),c=a(o?.14:.06),l=X(v(o?N:P,n,o?.04:.1),n,12),x=a(o?.22:.07);return{app:d(n),panel:d(o?v(n,P,.25):v(n,N,.45)),frame:d(o?v(n,P,.25):v(n,N,.45)),raised:d(i),"raised-hover":d(c),card:d(o?a(.07):i),inset:d(o?a(.04):n),control:d(a(o?.12:.07)),composer:d(o?a(.07):i),"composer-ring":d(a(o?.14:.12)),menu:d(i),"menu-hover":d(l,.06),"menu-active":d(l,.09),hairline:d(a(.2)),edge:d(l,.08),scrollbar:d(a(o?.25:.22)),ink:d(l),"ink-secondary":d(X(v(l,n,o?.3:.4),c,4.5)),"ink-tertiary":d(X(v(l,n,o?.42:.5),c,4.5)),"bubble-user":d(x),"bubble-user-ink":d(o?dt(x):l)}}function mn(e,t,n){const o=Q(e),a=X(o,Q(n),4.5);return{accent:d(o),"accent-ink":d(dt(o)),"accent-border":d(t==="dark"?v(o,N,.2):v(o,P,.1)),"accent-text":d(a),focus:d(a)}}class pn extends Error{}function G(e,t){const n=globalThis[t];return typeof n=="function"&&e instanceof n}function $e(e){const t=e.style;return t&&typeof t=="object"&&typeof t.getPropertyValue=="function"?t:null}function He(e){for(let t=e.length-1;t>=0;t--){const n=e.item(t);ut(e.getPropertyValue(n))&&e.removeProperty(n)}}const fn=e=>"cssRules"in e&&typeof e.deleteRule=="function";function De(e,t,n){try{e.deleteRule(t)}catch{if(!G(n,"CSSNamespaceRule"))throw new pn}}function mt(e){for(let t=e.cssRules.length-1;t>=0;t--){const n=e.cssRules[t];if(!n)continue;if(G(n,"CSSKeyframesRule")){for(const a of Array.from(n.cssRules)){const i=$e(a);i&&He(i)}continue}if(G(n,"CSSPropertyRule")){ut(n.initialValue??"")&&De(e,t,n);continue}const o=$e(n);o&&He(o),fn(n)?mt(n):!o&&!G(n,"CSSLayerStatementRule")&&De(e,t,n)}}let R=null,Me="";function ze(e){if(!(typeof document>"u"||typeof CSSStyleSheet>"u"||!("adoptedStyleSheets"in document))&&e!==Me){Me=e,R||(R=new CSSStyleSheet,document.adoptedStyleSheets=[...document.adoptedStyleSheets,R]);try{R.replaceSync(e),mt(R)}catch{R.replaceSync("")}}}const me="omb-theme",Be="omb-safe-look";let A=null,B=[],se=!1;const pe=new Set;function F(e){try{return typeof window>"u"?void 0:window[e]}catch{return}}function hn(){try{return typeof location<"u"&&new URLSearchParams(location.search).has(on)&&F("sessionStorage")?.setItem(Be,"1"),F("sessionStorage")?.getItem(Be)==="1"}catch{return!1}}function go(){return A}function yo(e){return pe.add(e),()=>{pe.delete(e)}}function xn(e){for(const t of B)e.style.removeProperty(t);B=[]}function Y(){if(!(typeof document>"u"||se)){se=!0;try{const e=document.documentElement;xn(e);const t=hn()?null:A?.theme;if(!t){delete e.dataset.theme,ze(""),Te(Ie());return}const n=t.skin??(t.canvas?Ct[Re(t.canvas)]:void 0);Te(n?Pt(n):Ie());const o=ue(e),a=t[o],i=a?.canvas??(t.canvas&&Re(t.canvas)===o?t.canvas:void 0),c=a?.accent??t.accent,l={...i?dn(i,o):{},...c?mn(c,o,i??(o==="dark"?"#121212":"#ffffff")):{},...t.colors,...a?.colors};for(const x of at){const f=l[x];f&&(e.style.setProperty(`--color-${x}`,f),B.push(`--color-${x}`))}i&&(e.style.setProperty("--code-color-scheme",o),B.push("--code-color-scheme")),t.font&&(e.style.setProperty("--font-sans",t.font),B.push("--font-sans")),e.dataset.theme=A.id,ze(t.css??"")}finally{se=!1;for(const e of pe)e()}}}function ye(e){A=e;try{e?F("localStorage")?.setItem(me,JSON.stringify(e)):F("localStorage")?.removeItem(me)}catch{}Y()}function bn(){try{const e=JSON.parse(F("localStorage")?.getItem(me)??"null"),t=ge.safeParse(e?.theme);return typeof e?.id=="string"&&t.success?{id:e.id,theme:t.data}:null}catch{return null}}async function ke(){try{const e=await fetch("/api/themes/active",{headers:{accept:"application/json"}});if(!e.ok)return;const t=await e.json(),n=t.theme?ge.safeParse(t.theme):null;ye(t.id&&n?.success?{id:t.id,theme:n.data}:null)}catch{}}function ko(e){const t=e.skin;(t==="system"||qe.includes(t))&&be(t),ke()}const we=(e,t)=>fetch("/api/themes/active",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({id:e,...t?{skin:t}:{}})}).then(n=>n.ok,()=>!1);function wo(){A&&(ye(null),we(null))}async function vo(e){const t=await we(e);return t&&await ke(),t}function gn(){be(Pe),ye(null),we(null,Pe)}const yn=e=>e.code==="KeyR"&&e.altKey&&e.shiftKey&&(e.metaKey||e.ctrlKey);function kn(){if(!(typeof window>"u")){if(window.addEventListener("keydown",e=>{yn(e)&&(e.preventDefault(),e.stopPropagation(),gn())},{capture:!0}),Et(Y),typeof matchMedia=="function")try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",Y)}catch{}A=bn(),A&&Y()}}function wn({credential:e,owner:t,team:n}){const[o]=u.useState(()=>J()),[a,i]=u.useState(!1),[c,l]=u.useState(null);async function x(){i(!0),l(null);const f=await Zt(e,o);if(f.ok){location.replace("/");return}i(!1),l(f.error)}return r.jsx("main",{className:"flex min-h-screen items-center justify-center bg-app px-6 text-ink",children:r.jsxs("div",{className:"w-full max-w-[420px]",children:[r.jsx("h1",{className:"text-[20px] font-semibold",children:n?s("pair.browser.teamTitle",{team:n,owner:t}):s("pair.browser.title",{owner:t})}),r.jsx("p",{className:"mt-1.5 text-[14px] text-ink-secondary",children:s("pair.browser.notYou")}),c?r.jsx("p",{role:"alert",className:"mt-3 text-[13px] text-danger",children:c}):null,r.jsx("button",{type:"button",onClick:()=>{x()},disabled:a,className:"mt-5 w-full rounded-md bg-accent px-4 py-2 text-[14px] font-medium text-accent-ink disabled:opacity-50",children:s(a?"pair.signingIn":"pair.continue")})]})})}const ve="bg-composer ring-1 ring-inset ring-ink/[0.07]",vn="bg-composer ring-[0.5px] ring-ink/10",So=`${vn} shadow-(--shadow-float)`,pt="transition-colors duration-[120ms] hover:bg-[color-mix(in_srgb,var(--color-composer),var(--color-ink)_7%)]",Sn=`${pt} aria-expanded:bg-[color-mix(in_srgb,var(--color-composer),var(--color-ink)_7%)]`,jo="bg-[color-mix(in_srgb,var(--color-composer),var(--color-ink)_7%)]",No="focus-visible:outline-2 focus-visible:-outline-offset-2! focus-visible:outline-focus",ft="flex size-9 shrink-0 items-center justify-center rounded-full text-ink/90",Se="focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",jn=`${ft} ${ve} ${Sn} ${Se}`,Eo=`${ft} ${ve} ${pt} ${Se}`,Nn=`flex size-[26px] shrink-0 items-center justify-center rounded-lg text-ink-secondary transition-colors hover:bg-ink/[0.06] hover:text-ink aria-expanded:bg-ink/[0.06] aria-expanded:text-ink ${Se}`,Co="flex size-10 shrink-0 items-center justify-center rounded-full border border-hairline bg-card text-ink hover:bg-raised focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",En="flex size-9 shrink-0 items-center justify-center rounded-xl text-ink-secondary hover:bg-raised/60 hover:text-ink focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus";function Po({open:e,onToggle:t,corner:n=!1,ref:o}){return r.jsx("button",{ref:o,type:"button","data-sidebar-search-toggle":!0,onClick:t,"aria-label":s("sidebar.searchAria"),"aria-expanded":e,title:s("sidebar.searchAria"),className:n?Nn:jn,children:r.jsx(Je,{size:n?17:18,strokeWidth:1.5,"aria-hidden":"true"})})}function To({query:e,onQuery:t,onClose:n}){return r.jsx("div",{"data-sidebar-search-pill":!0,className:"px-3 pb-2 pt-0.5",children:r.jsxs("div",{className:$("flex h-[34px] items-center gap-2 rounded-full pl-3 pr-1.5 text-ink-secondary focus-within:ring-focus",ve),children:[r.jsx(Je,{size:15,"aria-hidden":"true",className:"shrink-0"}),r.jsx("input",{autoFocus:!0,value:e,onChange:o=>t(o.target.value),onKeyDown:o=>{o.key==="Escape"&&(o.preventDefault(),n())},placeholder:s("sidebar.searchAria"),"aria-label":s("sidebar.searchAria"),className:"min-w-0 flex-1 bg-transparent text-[13px] text-ink placeholder:text-ink-tertiary focus:outline-none"}),r.jsx("button",{type:"button",onClick:n,"aria-label":s("sidebar.searchClose"),title:s("sidebar.searchClose"),className:"flex size-6 shrink-0 items-center justify-center rounded-full text-ink-tertiary hover:bg-raised hover:text-ink focus-visible:outline focus-visible:outline-2 focus-visible:outline-focus",children:r.jsx(Tt,{size:14,"aria-hidden":"true"})})]})})}function Cn(e,{howTo:t=!1,onClosed:n}={}){return e.menu(t?{from:"howto"}:void 0).finally(()=>{t&&n?.()})}function Io(e){e({type:"cloudHowTo",open:!1})}function Fe({text:e}){return r.jsxs("span",{className:"font-normal text-ink-secondary",children:[" · ",e]})}function Pn(e){return e?.sleeps===!0?!0:e?.status==="paid"?!1:null}function Tn(e){const t=e&&!window.ogb?.remoteClient?.active?window.ogb?.cloudPlan:void 0,n=e||window.ogb?.remoteClient?.active?void 0:window.ogb?.cloudAccount,[o,a]=u.useState(null),[i,c]=u.useState(!1);return u.useEffect(()=>{if(!t)return;let l=!0;return t.state().then(x=>{l&&a(Pn(x))}).catch(()=>{}),()=>{l=!1}},[t]),u.useEffect(()=>n?.onState(l=>c(l.waking===!0)),[n]),{sleeps:t?o:null,waking:i}}function In({cloudHome:e=!1,howTo:t=!1,onMenuClosed:n}){const o=window.ogb?.workspaces,[a,i]=u.useState(null),[c,l]=u.useState(!1),[x,f]=u.useState("");u.useEffect(()=>{let p=!0;const k=()=>{o?.state().then(E=>{p&&i(E)}).catch(()=>{})};k();const I=o?.onChanged?.(k);return()=>{p=!1,I?.()}},[o]);const w=Tn(e||a?.home===!0),m=w.sleeps===null?"":s(w.sleeps?"cloudSetup.sleepsWhenIdle":"cloudSetup.alwaysOn"),g=w.waking?s("cloudHome.waking"):"";return{bridge:o,current:a,cloudHome:e,open:c,error:x,onLine:m,waking:g,openMenu:()=>{!o||c||(f(""),l(!0),Cn(o,{howTo:t,onClosed:n}).catch(()=>f(s("sidebar.switchServerError"))).finally(()=>l(!1)))},switchable:!!o&&a?.home!==!0}}function _n(e){const t=It(),n=r.jsx(An,{...e});return _t(t)?r.jsx("div",{"data-switcher-beside-rail":!0,className:t.beside?"hidden":"contents md:hidden",children:n}):n}function An({compact:e=!1,inline:t=!1,pill:n=!1,rail:o=!1,cloudHome:a=!1,owner:i=null,howTo:c=!1,place:l,onMenuClosed:x}){const f=l||s("cloudSetup.myCloud"),{bridge:w,current:m,open:g,error:y,onLine:p,waking:k,openMenu:I}=In({cloudHome:a,howTo:c,onMenuClosed:x}),E=b=>p?`${b} · ${p}`:b;if(!w||m?.home===!0){if(!a&&!m?.home)return null;const b=i?s("sidebar.cloudOwner",{email:i}):"",j=`${E(f)}${b?` · ${b}`:""}`;return o?r.jsx("div",{"data-cloud-home-indicator":!0,"data-workspace-switcher":"rail",role:"img","aria-label":j,title:j,className:"flex size-9 items-center justify-center text-ink-secondary",children:r.jsx(W,{size:18,"aria-hidden":"true"})}):t?r.jsxs("div",{"data-cloud-home-indicator":!0,"data-workspace-switcher":"inline",title:j,className:n?"flex h-8 min-w-0 items-center gap-1 rounded-full bg-raised/50 px-3 text-[13px] font-medium text-ink":"flex min-w-0 items-center gap-1.5 px-1.5 text-[13px] font-medium text-ink",children:[r.jsx(W,{size:n?15:14,"aria-hidden":"true",className:n?"hidden shrink-0 text-ink-secondary @max-[124px]/sidebar-top:block":"shrink-0 text-ink-secondary"}),r.jsx("span",{className:n?"min-w-0 truncate @max-[124px]/sidebar-top:hidden":"min-w-0 truncate",children:f}),(p||b)&&r.jsxs("span",{className:"sr-only",children:[p?` · ${p}`:"",b?` · ${b}`:""]})]}):r.jsx("div",{"data-cloud-home-indicator":!0,className:$("py-1.5",e?"px-2":"px-3"),children:r.jsxs("div",{title:j,className:$("flex items-center gap-2 py-2 text-[13px] font-medium text-ink",e?"justify-center px-1":"px-2"),children:[r.jsx(W,{size:16,"aria-hidden":"true",className:"shrink-0 text-ink-secondary"}),e?r.jsx("span",{className:"sr-only",children:j}):r.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[f,p&&r.jsx(Fe,{text:p}),b&&r.jsx("span",{className:"block truncate text-[12px] font-normal text-ink-secondary",children:b})]})]})})}const L=m?.profileName??(m?.local&&!m.localPath?s("place.local"):m?.name)??(a?f:s("sidebar.servers")),S=m?.local===!1||a&&!m?W:At,H=a?E(L):L,_=m?.origin?`${H} · ${m.origin}`:H,O=s("sidebar.switchServer",{name:H});return o?r.jsxs("div",{"data-workspace-switcher":"rail",className:"relative",children:[r.jsx("button",{type:"button","aria-label":O,"aria-haspopup":"menu","aria-expanded":g,"data-cloud-home-indicator":a||void 0,"data-tour":"server-switcher",title:_,onClick:I,className:$(En,"aria-expanded:bg-raised"),style:{WebkitAppRegion:"no-drag"},children:re(m?.color)?r.jsx(ae,{color:m?.color,size:18}):r.jsx(S,{size:18,"aria-hidden":"true"})}),y&&r.jsx("p",{role:"alert",className:"absolute bottom-0 left-full z-40 ml-2 w-56 rounded-md bg-menu px-2 py-1 text-[11px] text-danger shadow-lg",children:y}),k&&!y&&r.jsx("p",{role:"status","data-cloud-waking":!0,className:"absolute bottom-0 left-full z-40 ml-2 w-56 rounded-md bg-menu px-2 py-1 text-[11px] text-ink-secondary shadow-lg",children:k})]}):t?r.jsxs("div",{"data-workspace-switcher":"inline",className:"flex min-w-0",children:[r.jsxs("button",{type:"button","aria-label":O,"aria-haspopup":"menu","aria-expanded":g,"data-cloud-home-indicator":a||void 0,"data-tour":"server-switcher",title:_,onClick:I,className:n?"flex h-8 min-w-0 max-w-full items-center gap-1 overflow-hidden rounded-full bg-raised/50 pl-2.5 pr-1.5 text-left text-[13px] font-medium text-ink hover:bg-raised aria-expanded:bg-raised focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus":"flex h-7 min-w-0 max-w-full items-center gap-1.5 overflow-hidden rounded-md px-1.5 text-left text-[13px] font-medium text-ink hover:bg-control focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",style:{WebkitAppRegion:"no-drag"},children:[re(m?.color)?r.jsx(ae,{color:m?.color,size:16}):r.jsx(S,{size:n?15:14,"aria-hidden":"true","data-switcher-icon":!0,className:n?"hidden shrink-0 text-ink-secondary @max-[124px]/sidebar-top:block":"shrink-0 text-ink-secondary"}),r.jsx("span",{className:n?"min-w-0 truncate @max-[124px]/sidebar-top:hidden":"min-w-0 truncate @max-[96px]/sidebar-top:hidden",children:L}),r.jsx(_e,{size:n?12:11,"aria-hidden":"true",className:n?"shrink-0 text-ink-tertiary":"shrink-0 text-ink-secondary"})]}),y&&r.jsx("p",{role:"alert",className:"absolute right-2 top-full z-40 mt-1 w-56 max-w-[calc(100%-1rem)] rounded-md bg-menu px-2 py-1 text-[11px] text-danger shadow-lg",children:y}),k&&!y&&r.jsx("p",{role:"status","data-cloud-waking":!0,className:"absolute right-2 top-full z-40 mt-1 w-56 max-w-[calc(100%-1rem)] rounded-md bg-menu px-2 py-1 text-[11px] text-ink-secondary shadow-lg",children:k})]}):r.jsxs("div",{className:$("py-1.5",e?"px-2":"px-3"),children:[r.jsxs("button",{type:"button","aria-label":O,"aria-haspopup":"menu","aria-expanded":g,"data-cloud-home-indicator":a||void 0,"data-tour":"server-switcher",title:_,onClick:I,className:$("flex w-full items-center gap-2 rounded-lg py-2 text-left text-[13px] font-medium text-ink hover:bg-control focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",e?"justify-center px-1":"px-2"),style:{WebkitAppRegion:"no-drag"},children:[re(m?.color)?r.jsx(ae,{color:m?.color,size:20}):r.jsx(S,{size:16,className:"shrink-0 text-ink-secondary"}),!e&&r.jsxs(r.Fragment,{children:[r.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[L,a&&p&&r.jsx(Fe,{text:p})]}),r.jsx(_e,{size:13,className:"shrink-0 text-ink-secondary"})]})]}),y&&r.jsx("p",{role:"alert",className:"mt-1 text-[11px] text-danger",children:y}),k&&!y&&r.jsx("p",{role:"status","data-cloud-waking":!0,className:"mt-1 text-[11px] text-ink-secondary",children:k})]})}function Ln(e){const t=e&&typeof e=="object"?e.membership:void 0,n=t&&typeof t=="object"?t:{};let o=null;if(typeof n.peopleUrl=="string")try{new URL(n.peopleUrl).protocol==="https:"&&(o=n.peopleUrl)}catch{o=null}return{authority:n.authority==="portal"?"portal":"local",pairingCodes:n.pairingCodes!==!1,peopleUrl:o}}const _o=()=>({type:"toggleAppSettings",open:!0,section:"companion",phonePairing:!0});function Ao(e){const t=typeof window>"u"?void 0:window.ogb;return On({companion:!!t?.companion,remoteClient:t?.remoteClient?.active===!0,cloudHome:e})}function On(e){return e.cloudHome?"cloud":e.companion&&!e.remoteClient?"computer":"server"}const Rn={computer:"sidebar.menu.connectPhone.computer",cloud:"sidebar.menu.connectPhone.cloud",server:"sidebar.menu.connectPhone.server"};function Lo(e,t){const n=t?.session?.kind==="session"?t.session.team?.name:void 0;return n?{target:e,subtitleKey:"sidebar.menu.connectPhone.team",team:n}:e!=="computer"&&!(t&&t.pairingCodes&&et(t.session))?null:{target:e,subtitleKey:Rn[e]}}function Oo(e,t){if(!e)return[];const n={...e,id:"here"};return e.target,[n]}let Ue=null;function Ro(e=fetch){return Ue??=te(e).then(async t=>{if(!et(t))return{session:t,pairingCodes:!1};const n=await e("/api/config",{credentials:"same-origin"}).then(o=>o.ok?o.json():null).catch(()=>null);return{session:t,pairingCodes:Ln(n).pairingCodes}}),Ue}const $n="data-phone-pairing-action";function $o(e,t=n=>window.requestAnimationFrame(n)){return e?(t(()=>{e.scrollIntoView?.({block:"start"}),(e.querySelector(`[${$n}]:not([disabled])`)??e).focus({preventScroll:!0})}),!0):!1}function Ho(e){const t=new URL(e);return t.searchParams.get("desktop-settings")!=="phone"?null:(t.searchParams.delete("desktop-settings"),`${t.pathname}${t.search}${t.hash}`)}function ie(e){const t=new URLSearchParams(e);if(t.get("desktop-settings")==="phone")return"/?desktop-settings=phone";const n=t.get("next");return n&&/^\/(?!\/)/.test(n)&&!n.startsWith("/pair")&&!/[\\\s]/.test(n)?n:"/"}const Hn="23456789ABCDEFGHJKLMNPQRSTUVWXYZ",Dn=12,Mn="omb_pair_",zn=/^omb_pair_[A-Za-z0-9_-]{43}$/;function Bn(e){return e.toUpperCase().replace(/[^A-Z0-9]/g,"").replace(/0/g,"O").replace(/1/g,"I")}const Fn={emailCode:"serverError.pair.emailCode",oldCode:"serverError.pair.oldCode",scriptKey:"serverError.pair.scriptKey",notACode:"serverError.pair.notACode"};function Un(e){let t;try{t=new URL(e)}catch{return null}const n=new URLSearchParams(t.hash.replace(/^#/,""));return t.searchParams.get("token")??t.searchParams.get("code")??n.get("code")}function ht(e){let t=e.trim();if(!t)return{kind:"empty"};if(/^[a-z][a-z0-9+.-]*:\/\//i.test(t)){const a=Un(t);if(!a)return{kind:"wrong",problem:"notACode"};t=a.trim()}if(t.startsWith("omb_sess_"))return{kind:"wrong",problem:"scriptKey"};if(t.startsWith(Mn))return zn.test(t)?{kind:"credential",credential:t}:{kind:"wrong",problem:"notACode"};const n=t.replace(/[\s-]/g,"");if(/^\d{8}$/.test(n))return{kind:"wrong",problem:"emailCode"};if(/^\d{6}$/.test(n))return{kind:"wrong",problem:"oldCode"};const o=Bn(t);return o.length!==Dn||[...o].some(a=>!Hn.includes(a))?{kind:"wrong",problem:"notACode"}:{kind:"code",code:o}}const M="mt-1 w-full rounded-md border border-hairline/40 bg-inset px-3 py-2 text-[14px] text-ink outline-none focus:border-accent-border",We="mt-5 w-full rounded-md bg-accent px-4 py-2 text-[14px] font-medium text-accent-ink disabled:opacity-50",z="mt-4 block text-[12px] font-medium text-ink-secondary";function Wn(e,t=typeof window<"u"&&!!window.ogb?.workspaces){return!!e&&t}function Kn({mode:e,sent:t,email:n,cloudHome:o}){return e==="email"?t?s("pair.intro.emailSent",{email:n}):s("pair.intro.email"):o?s("pair.intro.cloud",{app:U(),open:s("cloudHome.connect"),section:s("settings.section.cloudAccount")}):s("pair.intro.code")}function Vn(e){const t=ht(e);return t.kind==="wrong"&&t.problem!=="notACode"?s(Fn[t.problem]):null}function Xn(e){const t=ht(e).kind;return t==="code"||t==="credential"}function Gn(e){return e.protocol==="http:"&&!Lt(e.hostname)}function Ke(e,t=Vt()){if(!e?.capabilities.cloudTeam||typeof t!="string")return null;try{const n=new URL(t),o=n.protocol==="http:"&&["127.0.0.1","localhost","[::1]"].includes(n.hostname);return(n.protocol==="https:"||o)&&!n.username&&!n.password&&!n.hash?n.href:null}catch{return null}}function Yn(e,t){return e?.capabilities.cloudTeam?e.label:e?.capabilities.cloudHome?s("pair.myCloud"):s(t==="email"?"pair.signInTo":"pair.connectTo",{name:e?.label??s("pair.thisLimixBot",{app:U()})})}function qn({team:e}){return r.jsx("main",{"data-team-left":!0,className:"flex min-h-screen items-center justify-center bg-app px-6 text-ink",children:r.jsx("p",{role:"status",className:"max-w-[420px] text-[16px]",children:s("homeLine.left",{name:e??s("pair.thisLimixBot",{app:U()})})})})}function V({initialCode:e,initialEmail:t=null,reason:n}){const[o,a]=u.useState(e??""),[i,c]=u.useState(tt()),[l,x]=u.useState(null),[f,w]=u.useState(null),[m,g]=u.useState(!1),[y,p]=u.useState(null),[k,I]=u.useState(()=>J()),[E,L]=u.useState(t&&!e?"email":"code"),[S,H]=u.useState(t??""),[_,O]=u.useState(""),[b,j]=u.useState(!1),[ne,bt]=u.useState(()=>Wn(e));u.useEffect(()=>{if(!ne||!e)return;let h=!0;return ce({code:e,label:i,attemptId:k}).then(C=>{if(h){if(C.ok){location.replace(ie(location.search));return}bt(!1),p(C.error)}}),()=>{h=!1}},[]),u.useEffect(()=>{fetch("/.well-known/openmausbot/environment").then(h=>h.ok?h.json():null).then(h=>{x(h)}).catch(()=>{x(null)}),te().then(w)},[]);const oe=Xt(f),gt=l?.capabilities.emailSignIn===!0,D=l?.capabilities.cloudHome===!0,yt=!D&&l?.capabilities.cloudTeam!==!0,Ne=Vn(o),Ee=typeof location<"u"&&typeof location.protocol=="string"?location:null;async function kt(h){h.preventDefault(),g(!0),p(null);const C=await ce({code:o,label:i,attemptId:k});if(g(!1),C.ok){location.replace(ie(location.search));return}p(C.error)}async function wt(h){h.preventDefault(),g(!0),p(null);const C=b?await en({email:S,code:_,label:i}):await Qt(S);if(g(!1),!C.ok){p(C.error);return}if(b){location.replace(ie(location.search));return}j(!0)}function Ce(h){L(h),p(null)}return r.jsxs("main",{className:"flex min-h-screen items-center justify-center bg-app px-6 text-ink",children:[r.jsx("div",{className:"absolute left-3 top-12 max-w-[280px]",children:r.jsx(_n,{})}),r.jsxs("div",{className:"w-full max-w-[420px]",children:[Ee&&Gn(Ee)?r.jsx("p",{role:"alert",className:"mb-4 rounded-md border border-warning/30 bg-warning/10 px-3 py-2 text-[13px] text-warning",children:s("pair.notEncrypted")}):null,ne?r.jsx("p",{role:"status",className:"text-[20px] font-semibold",children:D?s("pair.openingCloud"):s("pair.connectingTo",{name:l?.label??s("pair.thisLimixBot")})}):r.jsxs(r.Fragment,{children:[r.jsx("h1",{className:"text-[20px] font-semibold",children:Yn(l,E)}),r.jsxs("p",{className:"mt-1.5 text-[14px] leading-relaxed text-ink-secondary",children:[l&&!D?`${s("pair.version",{version:l.version,platform:l.platform})} `:"",Kn({mode:E,sent:b,email:S,cloudHome:D})]}),Le(n)&&!oe?r.jsx("p",{className:"mt-3 text-[13px] text-ink-secondary",children:Le(n)}):null,y&&D&&e?r.jsx("p",{className:"mt-3 text-[13px] text-ink-secondary",children:s("pair.expired",{app:U(),open:s("cloudHome.connect"),section:s("settings.section.cloudAccount")})}):null,!oe&&Ke(l)?r.jsxs("div",{"data-team-sign-in":!0,className:"mt-4 flex flex-col items-start gap-1.5",children:[r.jsx("a",{href:Ke(l),className:"rounded-md bg-accent px-4 py-2 text-[14px] font-medium text-accent-ink",children:s("pair.team.open",{team:l.label})}),r.jsx("p",{className:"text-[13px] text-ink-secondary",children:s("pair.team.openHint")})]}):null]}),ne?null:oe?r.jsxs("p",{className:"mt-4 text-[14px]",children:[s("pair.alreadyConnected")," ",r.jsx("a",{href:"/",className:"text-accent underline",children:s("pair.openApp")})]}):E==="email"?r.jsxs("form",{onSubmit:wt,children:[r.jsx("label",{className:z,htmlFor:"signin-email",children:s("cloudBuy.signIn.email")}),r.jsx("input",{id:"signin-email",type:"email",value:S,onChange:h=>{H(h.target.value),j(!1),O("")},autoComplete:"email",inputMode:"email",spellCheck:!1,className:M}),b?r.jsxs(r.Fragment,{children:[r.jsx("label",{className:z,htmlFor:"signin-code",children:s("pair.emailCode")}),r.jsx("input",{id:"signin-code",value:_,onChange:h=>O(h.target.value),placeholder:"12345678",autoComplete:"one-time-code",inputMode:"numeric",spellCheck:!1,className:`${M} font-mono text-[15px] tracking-[0.12em]`}),r.jsx("label",{className:z,htmlFor:"signin-label",children:s("pair.deviceLabel")}),r.jsx("input",{id:"signin-label",value:i,onChange:h=>c(h.target.value),maxLength:80,className:M})]}):null,y?r.jsx("p",{className:"mt-3 text-[13px] text-danger",children:y}):null,r.jsx("button",{type:"submit",disabled:m||!S.includes("@")||b&&_.replace(/\D/g,"").length<8,className:We,children:s(m?b?"pair.signingIn":"pair.sending":b?"pair.signIn":"cloudBuy.signIn.send")}),b?r.jsx("button",{type:"button",onClick:()=>j(!1),className:"mt-3 w-full text-[13px] text-ink-secondary underline",children:s("pair.resend")}):null,r.jsx("button",{type:"button",onClick:()=>Ce("code"),className:"mt-3 w-full text-[13px] text-ink-secondary underline",children:s("pair.useCode")})]}):r.jsxs("form",{onSubmit:kt,children:[r.jsx("label",{className:z,htmlFor:"pair-code",children:s("pair.code")}),r.jsx("input",{id:"pair-code",value:o,onChange:h=>{a(h.target.value),I(J())},placeholder:"XXXX-XXXX-XXXX","aria-describedby":e&&o===e?"pair-code-from-link":void 0,autoComplete:"one-time-code",autoCapitalize:"characters",spellCheck:!1,className:`${M} font-mono text-[15px] tracking-[0.12em]`}),e&&o===e?r.jsx("p",{id:"pair-code-from-link",className:"mt-1 text-[12px] text-ink-secondary",children:s("pair.fromLink")}):null,r.jsx("label",{className:z,htmlFor:"pair-label",children:s("pair.deviceLabel")}),r.jsx("input",{id:"pair-label",value:i,onChange:h=>c(h.target.value),maxLength:80,className:M}),Ne?r.jsx("p",{role:"alert",className:"mt-3 text-[13px] text-danger",children:Ne}):y?r.jsx("p",{className:"mt-3 text-[13px] text-danger",children:y}):null,r.jsx("button",{type:"submit",disabled:m||!Xn(o),className:We,children:s(m?"pair.connecting":"pair.connect")}),null,yt?r.jsxs("p",{className:"mt-3 text-[13px] text-ink-secondary",children:[s("pair.noCode")," ",r.jsx("code",{className:"select-all rounded bg-inset px-1.5 py-0.5 text-[12px] text-ink",children:"npx limixbot pair"})]}):null,gt?r.jsxs("p",{className:"mt-5 border-t border-hairline/40 pt-4 text-[13px] text-ink-secondary",children:[s("pair.invitedByEmail")," ",r.jsx("button",{type:"button",onClick:()=>Ce("email"),className:"text-accent underline",children:s("pair.useEmail")})]}):null]})]})]})}const Do="cloud-welcome-done",Jn="unauthorized: you are no longer in this team",Ve=[["reserving","cloudHome.step.reserving"],["storage","cloudHome.step.storage"],["starting","cloudHome.step.starting"],["checking","cloudHome.step.checking"]];function Zn({step:e}){const t=Ve.findIndex(([n])=>n===e);return r.jsx("ol",{"data-cloud-setup":e,className:"flex flex-col gap-1 text-[13px]",children:Ve.map(([n,o],a)=>r.jsx("li",{"aria-current":a===t?"step":void 0,className:a===t?"font-medium text-ink":a<t?"text-ink-secondary line-through decoration-ink-secondary/40":"text-ink-secondary",children:s(o)},n))})}const Qn={stopped:"cloudHome.stopped","payment-problem":"cloudHome.paymentProblem",failed:"cloudHome.failed"},Xe={host:"cloudHome.unreachableHost",no_answer:"cloudHome.unreachable"};function eo(e,t=Date.now()){const n=new Date(e).getFullYear()!==new Date(t).getFullYear();return new Intl.DateTimeFormat(Ot(),{day:"numeric",month:"long",...n?{year:"numeric"}:{}}).format(new Date(e))}function to(e,t=Date.now()){const n=e?.name??null,o=(a,i)=>n?s(i,{name:n}):s(a);return e?.screen==="setup"?{title:o("homeScreen.setup","homeScreen.setupNamed"),body:s(e.slow?"cloudHome.slow":"homeScreen.setupBody"),reason:null,action:null,busy:!0}:e?.screen==="offline"?{title:o("homeScreen.offline","homeScreen.offlineNamed"),body:s("homeScreen.offlineBack"),reason:e.cause&&Object.hasOwn(Xe,e.cause)?s(Xe[e.cause]):e.reason??null,action:"retry",busy:!1}:e?.screen==="signin"?{title:o("homeScreen.signIn","homeScreen.signInNamed"),body:s(e.other?"homeScreen.signInOther":"homeScreen.signInEnded"),reason:null,action:"sign-in",busy:!1}:e?.screen==="plan"&&e.member&&e.machine!=="failed"?{title:o("homeScreen.plan","homeScreen.planNamed"),body:s("cloudHome.stoppedMember"),reason:null,action:null,busy:!1}:e?.screen==="plan"?{title:o("homeScreen.plan","homeScreen.planNamed"),body:s(Qn[e.machine]??"cloudHome.failed"),reason:null,action:e.machine==="failed"?null:"manage",busy:!1}:e?.screen==="ended"?{title:o("cloudHome.ended","cloudHome.endedNamed"),body:e.deleteAt?s("cloudHome.endedFiles",{date:eo(e.deleteAt,t)}):null,reason:null,action:"buy",busy:!1}:e?.screen==="checkout"?{title:o("cloudHome.checkout","cloudHome.checkoutNamed"),body:null,reason:null,action:"continue",busy:!1}:e?.screen==="payment"?{title:o("cloudHome.payment","cloudHome.paymentNamed"),body:s("cloudHome.paymentBody"),reason:null,action:"card",busy:!1}:e?.screen==="waking"?{title:s("homeScreen.waking"),body:null,reason:null,action:null,busy:!0}:e?.screen==="moving"?{title:o("homeScreen.moving","homeScreen.movingNamed"),body:null,reason:null,action:null,busy:!0}:{title:o("homeScreen.opening","homeScreen.openingNamed"),body:null,reason:null,action:null,busy:!0}}const no={retry:"cloudHome.tryAgain",buy:"cloudHome.buyAgain",continue:"cloudHome.continue",card:"cloudHome.updateCard"};function oo({name:e,remove:t}){const[n,o]=u.useState(!1),[a,i]=u.useState(!1),[c,l]=u.useState(null),x=()=>{i(!0),l(null),t().then(f=>{i(!1),f!=="removed"&&f!=="gone"&&(o(!1),l(f==="refused"?"refused":"failed"))},()=>{i(!1),o(!1),l("failed")})};return r.jsxs("div",{"data-home-remove":!0,className:"flex flex-col items-start gap-2",children:[n?r.jsxs("div",{role:"alertdialog","aria-label":s("rail.remove"),className:"flex flex-col gap-2 rounded-xl border border-hairline/70 bg-card/70 px-4 py-3",children:[r.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:s("rail.removeAsk",{name:e})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{type:"button","data-home-remove-confirm":!0,className:"ui-button ui-button-primary",disabled:a,onClick:x,children:s("rail.removeYes")}),r.jsx("button",{type:"button",className:"ui-button",disabled:a,onClick:()=>o(!1),children:s("rail.removeNo")})]})]}):r.jsx("button",{type:"button","data-home-remove-ask":!0,className:"text-[13px] text-ink-secondary underline-offset-2 hover:text-ink hover:underline",onClick:()=>{l(null),o(!0)},children:s("rail.remove")}),c&&r.jsx("p",{role:"alert",className:"text-[13px] text-danger",children:s(c==="refused"?"rail.removeRefused":"rail.removeFailed")})]})}function ro({bridge:e,manage:t}){const[n,o]=u.useState(null),[a,i]=u.useState(!1);u.useEffect(()=>{let g=!0;const y=e.onState(k=>o(k)),p=()=>{e.retry().then(k=>{g&&o(k)}).catch(()=>{})};return e.state().then(k=>{g&&o(k)}).catch(()=>{}).then(p),window.addEventListener("online",p),window.addEventListener("focus",p),()=>{g=!1,y(),window.removeEventListener("online",p),window.removeEventListener("focus",p)}},[e]);const c=to(n),l=g=>{i(!1),g().catch(()=>i(!0))},x=window.ogb?.cloudAdd?.reopen,f={retry:()=>e.retry().then(g=>o(g)),...t?{manage:t,buy:t,card:t,continue:async()=>{x&&await x().catch(()=>!1)||await t()}}:{}},w=c.action&&c.action!=="sign-in"&&c.action!=="manage"?c.action:null,m=(n?.screen==="ended"||n?.screen==="payment")&&n.removable===!0&&typeof e.remove=="function";return r.jsx("main",{"data-home-screen":n?.screen??"opening",className:"flex min-h-screen items-center justify-center bg-app px-6 text-ink",style:{WebkitAppRegion:"drag"},children:r.jsxs("div",{className:"flex w-full max-w-[420px] flex-col items-start gap-3",style:{WebkitAppRegion:"no-drag"},children:[r.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[20px] font-semibold",children:[c.busy&&r.jsx("span",{"aria-hidden":"true",className:"size-3.5 shrink-0 animate-spin rounded-full border-2 border-hairline border-t-accent"}),c.title]}),c.body&&r.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:c.body}),n?.screen==="setup"&&r.jsx(Zn,{step:n.step??"reserving"}),c.reason&&r.jsx("p",{"data-home-reason":!0,className:"text-[13px] leading-relaxed text-ink-secondary",children:c.reason}),c.action==="sign-in"&&r.jsx("button",{type:"button",className:"ui-button ui-button-primary mt-2",onClick:()=>l(()=>e.signIn()),children:s("homeScreen.signInButton")}),c.action==="manage"&&t&&r.jsx("button",{type:"button",className:"ui-button mt-2",onClick:()=>l(t),children:s("cloudAccount.manageInBrowser")}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[n?.screen==="offline"&&e.openLocal&&r.jsx("button",{type:"button","data-home-action":"local",className:"ui-button ui-button-primary mt-2",onClick:()=>l(async()=>{if(!await e.openLocal())throw new Error}),children:s("homeScreen.useLocal")}),w&&f[w]&&r.jsx("button",{type:"button","data-home-action":w,className:w==="retry"?"ui-button mt-2":"ui-button ui-button-primary mt-2",onClick:()=>l(f[w]),children:s(no[w])})]}),m&&r.jsx(oo,{name:n.name??s("cloudSetup.myCloud"),remove:()=>e.remove()}),a&&r.jsx("p",{role:"alert",className:"text-[13px] text-danger",children:s("cloudAccount.actionFailed")})]})})}function ao({bridge:e,fallback:t}){const[n,o]=u.useState(!1);return u.useEffect(()=>{e.repair().catch(()=>o(!0))},[e]),n?r.jsx(r.Fragment,{children:t}):r.jsx("main",{"data-home-screen":"opening",className:"flex min-h-screen items-center justify-center bg-app px-6 text-ink",children:r.jsx("p",{role:"status",className:"w-full max-w-[420px] text-[20px] font-semibold",children:s("homeScreen.opening")})})}const je="omb.session-ended";let fe=!1,le=null;const he=new Set;function Mo(){fe||le||(le=te().then(e=>{if(e.kind==="unauthenticated"){fe=!0;try{sessionStorage.setItem(je,"1")}catch{}for(const t of he)t()}}).finally(()=>{le=null}))}function Ge(){return fe}function zo(){return u.useSyncExternalStore(e=>(he.add(e),()=>he.delete(e)),Ge,Ge)}function so(){try{return sessionStorage.getItem(je)==="1"}catch{return!1}}function io(){try{sessionStorage.removeItem(je)}catch{}}Rt();be($t());Ht(Dt());tn();Mt(zt());kn();const q=Bt(),lo=new Set(["/home","/pair","/desktop-viewer"]),xt=()=>Ze(()=>import("./App-B6W9JFXZ.js").then(e=>e.ko),__vite__mapDeps([0,1,2,3,4,5])).catch(e=>({default:()=>{throw e}})),co=lo.has(location.pathname)?null:xt(),uo=()=>fetch("/.well-known/openmausbot/environment").then(e=>e.json()).then(e=>e.capabilities?.cloudTeam===!0&&typeof e.label=="string"?e.label:null,()=>null);async function mo(){const e=window.ogb?.home;if(location.pathname==="/home"&&e)return r.jsx(ro,{bridge:e,manage:window.ogb?.cloudPlan?.manage});if(location.pathname==="/pair"){const o=Yt();if(o){const a=await Jt(o);return await q,a?r.jsx(wn,{credential:o,owner:a.owner,team:a.team}):r.jsx(V,{initialCode:null,reason:s("pair.browser.signInFailed")})}return r.jsx(V,{initialCode:Gt(),initialEmail:qt()})}const t=await te();if(t.kind==="unauthenticated"){if(await q,t.error===Jn)return r.jsx(qn,{team:await uo()});const o=r.jsx(V,{initialCode:null,reason:so()?s("pair.sessionEnded"):t.error});return e?r.jsx(ao,{bridge:e,fallback:o}):o}if(io(),t.kind==="session"&&Kt(t.teamSignIn),t.kind==="loopback"&&t.trust==="service")return await q,r.jsx(V,{initialCode:null,reason:s("pair.serviceTrust")});if(location.pathname==="/desktop-viewer"){const{DesktopViewer:o}=await Ze(async()=>{const{DesktopViewer:a}=await import("./DesktopViewer-Rhj5Rg_E.js");return{DesktopViewer:a}},__vite__mapDeps([6,1,2,7,8,5,4,9]));return r.jsx(o,{})}const{default:n}=await(co??xt());return ke(),r.jsx(n,{})}document.title=U();Promise.all([Ft(),mo(),q]).then(([,e])=>{Ut.createRoot(document.getElementById("root")).render(r.jsx(u.StrictMode,{children:r.jsx(Wt,{children:e})}))});export{No as A,ve as B,Zn as C,Nn as D,So as E,jn as F,_n as G,Po as H,To as I,vn as J,ue as K,jo as L,Do as M,zo as N,V as O,Co as P,Ho as Q,Eo as S,rt as T,Ln as a,hn as b,gn as c,vo as d,wo as e,Ao as f,ko as g,Sn as h,et as i,$o as j,Oo as k,ke as l,fo as m,Mo as n,Cn as o,_o as p,Ro as q,te as r,yo as s,xo as t,bo as u,Lo as v,go as w,In as x,Io as y,ho as z};
|
|
3
|
+
`;)a+=e[a]==="\\"?2:1;t+=`${o}${" ".repeat(Math.max(0,a-n-1))}${o}`,n=a}else t+=o}return t}function xo(e){const t=un(e);if(/@import/i.test(t))return"@import is not allowed: themes cannot load other stylesheets.";if(t.includes("\\"))return"Backslash escapes are only allowed inside quoted strings.";if(ct.test(t))return"image-set(), image() and src() are not allowed: use url() with a theme file or a data: address.";const n=e.replace(/\/\*[\s\S]*?\*\//g," "),o=lt(n);if(o===null)return'A url() could not be read. Write url("/api/theme-assets/<theme>/<file>").';const a=o.find(i=>!it(i));return a!==void 0?`url(${a.slice(0,80)}) is not allowed: themes load only their own files (${nn}<theme>/<file>), data: addresses or #ids, never the internet.`:null}function ue(e=typeof document>"u"?null:document.documentElement){if(!e||typeof window>"u"||typeof window.getComputedStyle!="function")return"dark";try{return window.getComputedStyle(e).getPropertyValue("--code-color-scheme").trim()==="light"?"light":"dark"}catch{return"dark"}}function bo(){const[e,t]=u.useState(()=>ue());return u.useEffect(()=>{const n=()=>t(ue());if(n(),typeof MutationObserver>"u")return;const o=new MutationObserver(n);return o.observe(document.documentElement,{attributes:!0,attributeFilter:["data-skin"]}),()=>o.disconnect()},[]),e}const N=[255,255,255],P=[0,0,0];function Q(e){const t=e.trim().replace(/^#/,""),n=t.length===3?[...t].map(a=>a+a).join(""):t,o=Number.parseInt(n.slice(0,6),16);return Number.isFinite(o)?[o>>16&255,o>>8&255,o&255]:P}const K=e=>Math.round(Math.min(255,Math.max(0,e))).toString(16).padStart(2,"0"),d=([e,t,n],o)=>`#${K(e)}${K(t)}${K(n)}${o===void 0?"":K(o*255)}`,v=(e,t,n)=>[0,1,2].map(o=>e[o]+(t[o]-e[o])*n);function ee([e,t,n]){const o=a=>{const i=a/255;return i<=.03928?i/12.92:((i+.055)/1.055)**2.4};return .2126*o(e)+.7152*o(t)+.0722*o(n)}function de(e,t){const[n,o]=[ee(e),ee(t)].sort((a,i)=>i-a);return(n+.05)/(o+.05)}const Re=e=>ee(Q(e))<.2?"dark":"light";function X(e,t,n){const o=ee(t)<.2?N:P;let a=e;for(let i=1;i<=20&&de(a,t)<n;i++)a=v(e,o,i/20);return a}const dt=e=>de(N,e)>=de(P,e)?N:[17,17,17];function dn(e,t){const n=Q(e),o=t==="dark",a=f=>v(n,o?N:P,f),i=o?a(.08):v(n,N,.85),c=a(o?.14:.06),l=X(v(o?N:P,n,o?.04:.1),n,12),x=a(o?.22:.07);return{app:d(n),panel:d(o?v(n,P,.25):v(n,N,.45)),frame:d(o?v(n,P,.25):v(n,N,.45)),raised:d(i),"raised-hover":d(c),card:d(o?a(.07):i),inset:d(o?a(.04):n),control:d(a(o?.12:.07)),composer:d(o?a(.07):i),"composer-ring":d(a(o?.14:.12)),menu:d(i),"menu-hover":d(l,.06),"menu-active":d(l,.09),hairline:d(a(.2)),edge:d(l,.08),scrollbar:d(a(o?.25:.22)),ink:d(l),"ink-secondary":d(X(v(l,n,o?.3:.4),c,4.5)),"ink-tertiary":d(X(v(l,n,o?.42:.5),c,4.5)),"bubble-user":d(x),"bubble-user-ink":d(o?dt(x):l)}}function mn(e,t,n){const o=Q(e),a=X(o,Q(n),4.5);return{accent:d(o),"accent-ink":d(dt(o)),"accent-border":d(t==="dark"?v(o,N,.2):v(o,P,.1)),"accent-text":d(a),focus:d(a)}}class pn extends Error{}function G(e,t){const n=globalThis[t];return typeof n=="function"&&e instanceof n}function $e(e){const t=e.style;return t&&typeof t=="object"&&typeof t.getPropertyValue=="function"?t:null}function He(e){for(let t=e.length-1;t>=0;t--){const n=e.item(t);ut(e.getPropertyValue(n))&&e.removeProperty(n)}}const fn=e=>"cssRules"in e&&typeof e.deleteRule=="function";function De(e,t,n){try{e.deleteRule(t)}catch{if(!G(n,"CSSNamespaceRule"))throw new pn}}function mt(e){for(let t=e.cssRules.length-1;t>=0;t--){const n=e.cssRules[t];if(!n)continue;if(G(n,"CSSKeyframesRule")){for(const a of Array.from(n.cssRules)){const i=$e(a);i&&He(i)}continue}if(G(n,"CSSPropertyRule")){ut(n.initialValue??"")&&De(e,t,n);continue}const o=$e(n);o&&He(o),fn(n)?mt(n):!o&&!G(n,"CSSLayerStatementRule")&&De(e,t,n)}}let R=null,Me="";function ze(e){if(!(typeof document>"u"||typeof CSSStyleSheet>"u"||!("adoptedStyleSheets"in document))&&e!==Me){Me=e,R||(R=new CSSStyleSheet,document.adoptedStyleSheets=[...document.adoptedStyleSheets,R]);try{R.replaceSync(e),mt(R)}catch{R.replaceSync("")}}}const me="omb-theme",Be="omb-safe-look";let A=null,B=[],se=!1;const pe=new Set;function F(e){try{return typeof window>"u"?void 0:window[e]}catch{return}}function hn(){try{return typeof location<"u"&&new URLSearchParams(location.search).has(on)&&F("sessionStorage")?.setItem(Be,"1"),F("sessionStorage")?.getItem(Be)==="1"}catch{return!1}}function go(){return A}function yo(e){return pe.add(e),()=>{pe.delete(e)}}function xn(e){for(const t of B)e.style.removeProperty(t);B=[]}function Y(){if(!(typeof document>"u"||se)){se=!0;try{const e=document.documentElement;xn(e);const t=hn()?null:A?.theme;if(!t){delete e.dataset.theme,ze(""),Te(Ie());return}const n=t.skin??(t.canvas?Ct[Re(t.canvas)]:void 0);Te(n?Pt(n):Ie());const o=ue(e),a=t[o],i=a?.canvas??(t.canvas&&Re(t.canvas)===o?t.canvas:void 0),c=a?.accent??t.accent,l={...i?dn(i,o):{},...c?mn(c,o,i??(o==="dark"?"#121212":"#ffffff")):{},...t.colors,...a?.colors};for(const x of at){const f=l[x];f&&(e.style.setProperty(`--color-${x}`,f),B.push(`--color-${x}`))}i&&(e.style.setProperty("--code-color-scheme",o),B.push("--code-color-scheme")),t.font&&(e.style.setProperty("--font-sans",t.font),B.push("--font-sans")),e.dataset.theme=A.id,ze(t.css??"")}finally{se=!1;for(const e of pe)e()}}}function ye(e){A=e;try{e?F("localStorage")?.setItem(me,JSON.stringify(e)):F("localStorage")?.removeItem(me)}catch{}Y()}function bn(){try{const e=JSON.parse(F("localStorage")?.getItem(me)??"null"),t=ge.safeParse(e?.theme);return typeof e?.id=="string"&&t.success?{id:e.id,theme:t.data}:null}catch{return null}}async function ke(){try{const e=await fetch("/api/themes/active",{headers:{accept:"application/json"}});if(!e.ok)return;const t=await e.json(),n=t.theme?ge.safeParse(t.theme):null;ye(t.id&&n?.success?{id:t.id,theme:n.data}:null)}catch{}}function ko(e){const t=e.skin;(t==="system"||qe.includes(t))&&be(t),ke()}const we=(e,t)=>fetch("/api/themes/active",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({id:e,...t?{skin:t}:{}})}).then(n=>n.ok,()=>!1);function wo(){A&&(ye(null),we(null))}async function vo(e){const t=await we(e);return t&&await ke(),t}function gn(){be(Pe),ye(null),we(null,Pe)}const yn=e=>e.code==="KeyR"&&e.altKey&&e.shiftKey&&(e.metaKey||e.ctrlKey);function kn(){if(!(typeof window>"u")){if(window.addEventListener("keydown",e=>{yn(e)&&(e.preventDefault(),e.stopPropagation(),gn())},{capture:!0}),Et(Y),typeof matchMedia=="function")try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",Y)}catch{}A=bn(),A&&Y()}}function wn({credential:e,owner:t,team:n}){const[o]=u.useState(()=>J()),[a,i]=u.useState(!1),[c,l]=u.useState(null);async function x(){i(!0),l(null);const f=await Zt(e,o);if(f.ok){location.replace("/");return}i(!1),l(f.error)}return r.jsx("main",{className:"flex min-h-screen items-center justify-center bg-app px-6 text-ink",children:r.jsxs("div",{className:"w-full max-w-[420px]",children:[r.jsx("h1",{className:"text-[20px] font-semibold",children:n?s("pair.browser.teamTitle",{team:n,owner:t}):s("pair.browser.title",{owner:t})}),r.jsx("p",{className:"mt-1.5 text-[14px] text-ink-secondary",children:s("pair.browser.notYou")}),c?r.jsx("p",{role:"alert",className:"mt-3 text-[13px] text-danger",children:c}):null,r.jsx("button",{type:"button",onClick:()=>{x()},disabled:a,className:"mt-5 w-full rounded-md bg-accent px-4 py-2 text-[14px] font-medium text-accent-ink disabled:opacity-50",children:s(a?"pair.signingIn":"pair.continue")})]})})}const ve="bg-composer ring-1 ring-inset ring-ink/[0.07]",vn="bg-composer ring-[0.5px] ring-ink/10",So=`${vn} shadow-(--shadow-float)`,pt="transition-colors duration-[120ms] hover:bg-[color-mix(in_srgb,var(--color-composer),var(--color-ink)_7%)]",Sn=`${pt} aria-expanded:bg-[color-mix(in_srgb,var(--color-composer),var(--color-ink)_7%)]`,jo="bg-[color-mix(in_srgb,var(--color-composer),var(--color-ink)_7%)]",No="focus-visible:outline-2 focus-visible:-outline-offset-2! focus-visible:outline-focus",ft="flex size-9 shrink-0 items-center justify-center rounded-full text-ink/90",Se="focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",jn=`${ft} ${ve} ${Sn} ${Se}`,Eo=`${ft} ${ve} ${pt} ${Se}`,Nn=`flex size-[26px] shrink-0 items-center justify-center rounded-lg text-ink-secondary transition-colors hover:bg-ink/[0.06] hover:text-ink aria-expanded:bg-ink/[0.06] aria-expanded:text-ink ${Se}`,Co="flex size-10 shrink-0 items-center justify-center rounded-full border border-hairline bg-card text-ink hover:bg-raised focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",En="flex size-9 shrink-0 items-center justify-center rounded-xl text-ink-secondary hover:bg-raised/60 hover:text-ink focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus";function Po({open:e,onToggle:t,corner:n=!1,ref:o}){return r.jsx("button",{ref:o,type:"button","data-sidebar-search-toggle":!0,onClick:t,"aria-label":s("sidebar.searchAria"),"aria-expanded":e,title:s("sidebar.searchAria"),className:n?Nn:jn,children:r.jsx(Je,{size:n?17:18,strokeWidth:1.5,"aria-hidden":"true"})})}function To({query:e,onQuery:t,onClose:n}){return r.jsx("div",{"data-sidebar-search-pill":!0,className:"px-3 pb-2 pt-0.5",children:r.jsxs("div",{className:$("flex h-[34px] items-center gap-2 rounded-full pl-3 pr-1.5 text-ink-secondary focus-within:ring-focus",ve),children:[r.jsx(Je,{size:15,"aria-hidden":"true",className:"shrink-0"}),r.jsx("input",{autoFocus:!0,value:e,onChange:o=>t(o.target.value),onKeyDown:o=>{o.key==="Escape"&&(o.preventDefault(),n())},placeholder:s("sidebar.searchAria"),"aria-label":s("sidebar.searchAria"),className:"min-w-0 flex-1 bg-transparent text-[13px] text-ink placeholder:text-ink-tertiary focus:outline-none"}),r.jsx("button",{type:"button",onClick:n,"aria-label":s("sidebar.searchClose"),title:s("sidebar.searchClose"),className:"flex size-6 shrink-0 items-center justify-center rounded-full text-ink-tertiary hover:bg-raised hover:text-ink focus-visible:outline focus-visible:outline-2 focus-visible:outline-focus",children:r.jsx(Tt,{size:14,"aria-hidden":"true"})})]})})}function Cn(e,{howTo:t=!1,onClosed:n}={}){return e.menu(t?{from:"howto"}:void 0).finally(()=>{t&&n?.()})}function Io(e){e({type:"cloudHowTo",open:!1})}function Fe({text:e}){return r.jsxs("span",{className:"font-normal text-ink-secondary",children:[" · ",e]})}function Pn(e){return e?.sleeps===!0?!0:e?.status==="paid"?!1:null}function Tn(e){const t=e&&!window.ogb?.remoteClient?.active?window.ogb?.cloudPlan:void 0,n=e||window.ogb?.remoteClient?.active?void 0:window.ogb?.cloudAccount,[o,a]=u.useState(null),[i,c]=u.useState(!1);return u.useEffect(()=>{if(!t)return;let l=!0;return t.state().then(x=>{l&&a(Pn(x))}).catch(()=>{}),()=>{l=!1}},[t]),u.useEffect(()=>n?.onState(l=>c(l.waking===!0)),[n]),{sleeps:t?o:null,waking:i}}function In({cloudHome:e=!1,howTo:t=!1,onMenuClosed:n}){const o=window.ogb?.workspaces,[a,i]=u.useState(null),[c,l]=u.useState(!1),[x,f]=u.useState("");u.useEffect(()=>{let p=!0;const k=()=>{o?.state().then(E=>{p&&i(E)}).catch(()=>{})};k();const I=o?.onChanged?.(k);return()=>{p=!1,I?.()}},[o]);const w=Tn(e||a?.home===!0),m=w.sleeps===null?"":s(w.sleeps?"cloudSetup.sleepsWhenIdle":"cloudSetup.alwaysOn"),g=w.waking?s("cloudHome.waking"):"";return{bridge:o,current:a,cloudHome:e,open:c,error:x,onLine:m,waking:g,openMenu:()=>{!o||c||(f(""),l(!0),Cn(o,{howTo:t,onClosed:n}).catch(()=>f(s("sidebar.switchServerError"))).finally(()=>l(!1)))},switchable:!!o&&a?.home!==!0}}function _n(e){const t=It(),n=r.jsx(An,{...e});return _t(t)?r.jsx("div",{"data-switcher-beside-rail":!0,className:t.beside?"hidden":"contents md:hidden",children:n}):n}function An({compact:e=!1,inline:t=!1,pill:n=!1,rail:o=!1,cloudHome:a=!1,owner:i=null,howTo:c=!1,place:l,onMenuClosed:x}){const f=l||s("cloudSetup.myCloud"),{bridge:w,current:m,open:g,error:y,onLine:p,waking:k,openMenu:I}=In({cloudHome:a,howTo:c,onMenuClosed:x}),E=b=>p?`${b} · ${p}`:b;if(!w||m?.home===!0){if(!a&&!m?.home)return null;const b=i?s("sidebar.cloudOwner",{email:i}):"",j=`${E(f)}${b?` · ${b}`:""}`;return o?r.jsx("div",{"data-cloud-home-indicator":!0,"data-workspace-switcher":"rail",role:"img","aria-label":j,title:j,className:"flex size-9 items-center justify-center text-ink-secondary",children:r.jsx(W,{size:18,"aria-hidden":"true"})}):t?r.jsxs("div",{"data-cloud-home-indicator":!0,"data-workspace-switcher":"inline",title:j,className:n?"flex h-8 min-w-0 items-center gap-1 rounded-full bg-raised/50 px-3 text-[13px] font-medium text-ink":"flex min-w-0 items-center gap-1.5 px-1.5 text-[13px] font-medium text-ink",children:[r.jsx(W,{size:n?15:14,"aria-hidden":"true",className:n?"hidden shrink-0 text-ink-secondary @max-[124px]/sidebar-top:block":"shrink-0 text-ink-secondary"}),r.jsx("span",{className:n?"min-w-0 truncate @max-[124px]/sidebar-top:hidden":"min-w-0 truncate",children:f}),(p||b)&&r.jsxs("span",{className:"sr-only",children:[p?` · ${p}`:"",b?` · ${b}`:""]})]}):r.jsx("div",{"data-cloud-home-indicator":!0,className:$("py-1.5",e?"px-2":"px-3"),children:r.jsxs("div",{title:j,className:$("flex items-center gap-2 py-2 text-[13px] font-medium text-ink",e?"justify-center px-1":"px-2"),children:[r.jsx(W,{size:16,"aria-hidden":"true",className:"shrink-0 text-ink-secondary"}),e?r.jsx("span",{className:"sr-only",children:j}):r.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[f,p&&r.jsx(Fe,{text:p}),b&&r.jsx("span",{className:"block truncate text-[12px] font-normal text-ink-secondary",children:b})]})]})})}const L=m?.profileName??(m?.local&&!m.localPath?s("place.local"):m?.name)??(a?f:s("sidebar.servers")),S=m?.local===!1||a&&!m?W:At,H=a?E(L):L,_=m?.origin?`${H} · ${m.origin}`:H,O=s("sidebar.switchServer",{name:H});return o?r.jsxs("div",{"data-workspace-switcher":"rail",className:"relative",children:[r.jsx("button",{type:"button","aria-label":O,"aria-haspopup":"menu","aria-expanded":g,"data-cloud-home-indicator":a||void 0,"data-tour":"server-switcher",title:_,onClick:I,className:$(En,"aria-expanded:bg-raised"),style:{WebkitAppRegion:"no-drag"},children:re(m?.color)?r.jsx(ae,{color:m?.color,size:18}):r.jsx(S,{size:18,"aria-hidden":"true"})}),y&&r.jsx("p",{role:"alert",className:"absolute bottom-0 left-full z-40 ml-2 w-56 rounded-md bg-menu px-2 py-1 text-[11px] text-danger shadow-lg",children:y}),k&&!y&&r.jsx("p",{role:"status","data-cloud-waking":!0,className:"absolute bottom-0 left-full z-40 ml-2 w-56 rounded-md bg-menu px-2 py-1 text-[11px] text-ink-secondary shadow-lg",children:k})]}):t?r.jsxs("div",{"data-workspace-switcher":"inline",className:"flex min-w-0",children:[r.jsxs("button",{type:"button","aria-label":O,"aria-haspopup":"menu","aria-expanded":g,"data-cloud-home-indicator":a||void 0,"data-tour":"server-switcher",title:_,onClick:I,className:n?"flex h-8 min-w-0 max-w-full items-center gap-1 overflow-hidden rounded-full bg-raised/50 pl-2.5 pr-1.5 text-left text-[13px] font-medium text-ink hover:bg-raised aria-expanded:bg-raised focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus":"flex h-7 min-w-0 max-w-full items-center gap-1.5 overflow-hidden rounded-md px-1.5 text-left text-[13px] font-medium text-ink hover:bg-control focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",style:{WebkitAppRegion:"no-drag"},children:[re(m?.color)?r.jsx(ae,{color:m?.color,size:16}):r.jsx(S,{size:n?15:14,"aria-hidden":"true","data-switcher-icon":!0,className:n?"hidden shrink-0 text-ink-secondary @max-[124px]/sidebar-top:block":"shrink-0 text-ink-secondary"}),r.jsx("span",{className:n?"min-w-0 truncate @max-[124px]/sidebar-top:hidden":"min-w-0 truncate @max-[96px]/sidebar-top:hidden",children:L}),r.jsx(_e,{size:n?12:11,"aria-hidden":"true",className:n?"shrink-0 text-ink-tertiary":"shrink-0 text-ink-secondary"})]}),y&&r.jsx("p",{role:"alert",className:"absolute right-2 top-full z-40 mt-1 w-56 max-w-[calc(100%-1rem)] rounded-md bg-menu px-2 py-1 text-[11px] text-danger shadow-lg",children:y}),k&&!y&&r.jsx("p",{role:"status","data-cloud-waking":!0,className:"absolute right-2 top-full z-40 mt-1 w-56 max-w-[calc(100%-1rem)] rounded-md bg-menu px-2 py-1 text-[11px] text-ink-secondary shadow-lg",children:k})]}):r.jsxs("div",{className:$("py-1.5",e?"px-2":"px-3"),children:[r.jsxs("button",{type:"button","aria-label":O,"aria-haspopup":"menu","aria-expanded":g,"data-cloud-home-indicator":a||void 0,"data-tour":"server-switcher",title:_,onClick:I,className:$("flex w-full items-center gap-2 rounded-lg py-2 text-left text-[13px] font-medium text-ink hover:bg-control focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",e?"justify-center px-1":"px-2"),style:{WebkitAppRegion:"no-drag"},children:[re(m?.color)?r.jsx(ae,{color:m?.color,size:20}):r.jsx(S,{size:16,className:"shrink-0 text-ink-secondary"}),!e&&r.jsxs(r.Fragment,{children:[r.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[L,a&&p&&r.jsx(Fe,{text:p})]}),r.jsx(_e,{size:13,className:"shrink-0 text-ink-secondary"})]})]}),y&&r.jsx("p",{role:"alert",className:"mt-1 text-[11px] text-danger",children:y}),k&&!y&&r.jsx("p",{role:"status","data-cloud-waking":!0,className:"mt-1 text-[11px] text-ink-secondary",children:k})]})}function Ln(e){const t=e&&typeof e=="object"?e.membership:void 0,n=t&&typeof t=="object"?t:{};let o=null;if(typeof n.peopleUrl=="string")try{new URL(n.peopleUrl).protocol==="https:"&&(o=n.peopleUrl)}catch{o=null}return{authority:n.authority==="portal"?"portal":"local",pairingCodes:n.pairingCodes!==!1,peopleUrl:o}}const _o=()=>({type:"toggleAppSettings",open:!0,section:"companion",phonePairing:!0});function Ao(e){const t=typeof window>"u"?void 0:window.ogb;return On({companion:!!t?.companion,remoteClient:t?.remoteClient?.active===!0,cloudHome:e})}function On(e){return e.cloudHome?"cloud":e.companion&&!e.remoteClient?"computer":"server"}const Rn={computer:"sidebar.menu.connectPhone.computer",cloud:"sidebar.menu.connectPhone.cloud",server:"sidebar.menu.connectPhone.server"};function Lo(e,t){const n=t?.session?.kind==="session"?t.session.team?.name:void 0;return n?{target:e,subtitleKey:"sidebar.menu.connectPhone.team",team:n}:e!=="computer"&&!(t&&t.pairingCodes&&et(t.session))?null:{target:e,subtitleKey:Rn[e]}}function Oo(e,t){if(!e)return[];const n={...e,id:"here"};return e.target,[n]}let Ue=null;function Ro(e=fetch){return Ue??=te(e).then(async t=>{if(!et(t))return{session:t,pairingCodes:!1};const n=await e("/api/config",{credentials:"same-origin"}).then(o=>o.ok?o.json():null).catch(()=>null);return{session:t,pairingCodes:Ln(n).pairingCodes}}),Ue}const $n="data-phone-pairing-action";function $o(e,t=n=>window.requestAnimationFrame(n)){return e?(t(()=>{e.scrollIntoView?.({block:"start"}),(e.querySelector(`[${$n}]:not([disabled])`)??e).focus({preventScroll:!0})}),!0):!1}function Ho(e){const t=new URL(e);return t.searchParams.get("desktop-settings")!=="phone"?null:(t.searchParams.delete("desktop-settings"),`${t.pathname}${t.search}${t.hash}`)}function ie(e){const t=new URLSearchParams(e);if(t.get("desktop-settings")==="phone")return"/?desktop-settings=phone";const n=t.get("next");return n&&/^\/(?!\/)/.test(n)&&!n.startsWith("/pair")&&!/[\\\s]/.test(n)?n:"/"}const Hn="23456789ABCDEFGHJKLMNPQRSTUVWXYZ",Dn=12,Mn="omb_pair_",zn=/^omb_pair_[A-Za-z0-9_-]{43}$/;function Bn(e){return e.toUpperCase().replace(/[^A-Z0-9]/g,"").replace(/0/g,"O").replace(/1/g,"I")}const Fn={emailCode:"serverError.pair.emailCode",oldCode:"serverError.pair.oldCode",scriptKey:"serverError.pair.scriptKey",notACode:"serverError.pair.notACode"};function Un(e){let t;try{t=new URL(e)}catch{return null}const n=new URLSearchParams(t.hash.replace(/^#/,""));return t.searchParams.get("token")??t.searchParams.get("code")??n.get("code")}function ht(e){let t=e.trim();if(!t)return{kind:"empty"};if(/^[a-z][a-z0-9+.-]*:\/\//i.test(t)){const a=Un(t);if(!a)return{kind:"wrong",problem:"notACode"};t=a.trim()}if(t.startsWith("omb_sess_"))return{kind:"wrong",problem:"scriptKey"};if(t.startsWith(Mn))return zn.test(t)?{kind:"credential",credential:t}:{kind:"wrong",problem:"notACode"};const n=t.replace(/[\s-]/g,"");if(/^\d{8}$/.test(n))return{kind:"wrong",problem:"emailCode"};if(/^\d{6}$/.test(n))return{kind:"wrong",problem:"oldCode"};const o=Bn(t);return o.length!==Dn||[...o].some(a=>!Hn.includes(a))?{kind:"wrong",problem:"notACode"}:{kind:"code",code:o}}const M="mt-1 w-full rounded-md border border-hairline/40 bg-inset px-3 py-2 text-[14px] text-ink outline-none focus:border-accent-border",We="mt-5 w-full rounded-md bg-accent px-4 py-2 text-[14px] font-medium text-accent-ink disabled:opacity-50",z="mt-4 block text-[12px] font-medium text-ink-secondary";function Wn(e,t=typeof window<"u"&&!!window.ogb?.workspaces){return!!e&&t}function Kn({mode:e,sent:t,email:n,cloudHome:o}){return e==="email"?t?s("pair.intro.emailSent",{email:n}):s("pair.intro.email"):o?s("pair.intro.cloud",{app:U(),open:s("cloudHome.connect"),section:s("settings.section.cloudAccount")}):s("pair.intro.code")}function Vn(e){const t=ht(e);return t.kind==="wrong"&&t.problem!=="notACode"?s(Fn[t.problem]):null}function Xn(e){const t=ht(e).kind;return t==="code"||t==="credential"}function Gn(e){return e.protocol==="http:"&&!Lt(e.hostname)}function Ke(e,t=Vt()){if(!e?.capabilities.cloudTeam||typeof t!="string")return null;try{const n=new URL(t),o=n.protocol==="http:"&&["127.0.0.1","localhost","[::1]"].includes(n.hostname);return(n.protocol==="https:"||o)&&!n.username&&!n.password&&!n.hash?n.href:null}catch{return null}}function Yn(e,t){return e?.capabilities.cloudTeam?e.label:e?.capabilities.cloudHome?s("pair.myCloud"):s(t==="email"?"pair.signInTo":"pair.connectTo",{name:e?.label??s("pair.thisLimixBot",{app:U()})})}function qn({team:e}){return r.jsx("main",{"data-team-left":!0,className:"flex min-h-screen items-center justify-center bg-app px-6 text-ink",children:r.jsx("p",{role:"status",className:"max-w-[420px] text-[16px]",children:s("homeLine.left",{name:e??s("pair.thisLimixBot",{app:U()})})})})}function V({initialCode:e,initialEmail:t=null,reason:n}){const[o,a]=u.useState(e??""),[i,c]=u.useState(tt()),[l,x]=u.useState(null),[f,w]=u.useState(null),[m,g]=u.useState(!1),[y,p]=u.useState(null),[k,I]=u.useState(()=>J()),[E,L]=u.useState(t&&!e?"email":"code"),[S,H]=u.useState(t??""),[_,O]=u.useState(""),[b,j]=u.useState(!1),[ne,bt]=u.useState(()=>Wn(e));u.useEffect(()=>{if(!ne||!e)return;let h=!0;return ce({code:e,label:i,attemptId:k}).then(C=>{if(h){if(C.ok){location.replace(ie(location.search));return}bt(!1),p(C.error)}}),()=>{h=!1}},[]),u.useEffect(()=>{fetch("/.well-known/openmausbot/environment").then(h=>h.ok?h.json():null).then(h=>{x(h)}).catch(()=>{x(null)}),te().then(w)},[]);const oe=Xt(f),gt=l?.capabilities.emailSignIn===!0,D=l?.capabilities.cloudHome===!0,yt=!D&&l?.capabilities.cloudTeam!==!0,Ne=Vn(o),Ee=typeof location<"u"&&typeof location.protocol=="string"?location:null;async function kt(h){h.preventDefault(),g(!0),p(null);const C=await ce({code:o,label:i,attemptId:k});if(g(!1),C.ok){location.replace(ie(location.search));return}p(C.error)}async function wt(h){h.preventDefault(),g(!0),p(null);const C=b?await en({email:S,code:_,label:i}):await Qt(S);if(g(!1),!C.ok){p(C.error);return}if(b){location.replace(ie(location.search));return}j(!0)}function Ce(h){L(h),p(null)}return r.jsxs("main",{className:"flex min-h-screen items-center justify-center bg-app px-6 text-ink",children:[r.jsx("div",{className:"absolute left-3 top-12 max-w-[280px]",children:r.jsx(_n,{})}),r.jsxs("div",{className:"w-full max-w-[420px]",children:[Ee&&Gn(Ee)?r.jsx("p",{role:"alert",className:"mb-4 rounded-md border border-warning/30 bg-warning/10 px-3 py-2 text-[13px] text-warning",children:s("pair.notEncrypted")}):null,ne?r.jsx("p",{role:"status",className:"text-[20px] font-semibold",children:D?s("pair.openingCloud"):s("pair.connectingTo",{name:l?.label??s("pair.thisLimixBot")})}):r.jsxs(r.Fragment,{children:[r.jsx("h1",{className:"text-[20px] font-semibold",children:Yn(l,E)}),r.jsxs("p",{className:"mt-1.5 text-[14px] leading-relaxed text-ink-secondary",children:[l&&!D?`${s("pair.version",{version:l.version,platform:l.platform})} `:"",Kn({mode:E,sent:b,email:S,cloudHome:D})]}),Le(n)&&!oe?r.jsx("p",{className:"mt-3 text-[13px] text-ink-secondary",children:Le(n)}):null,y&&D&&e?r.jsx("p",{className:"mt-3 text-[13px] text-ink-secondary",children:s("pair.expired",{app:U(),open:s("cloudHome.connect"),section:s("settings.section.cloudAccount")})}):null,!oe&&Ke(l)?r.jsxs("div",{"data-team-sign-in":!0,className:"mt-4 flex flex-col items-start gap-1.5",children:[r.jsx("a",{href:Ke(l),className:"rounded-md bg-accent px-4 py-2 text-[14px] font-medium text-accent-ink",children:s("pair.team.open",{team:l.label})}),r.jsx("p",{className:"text-[13px] text-ink-secondary",children:s("pair.team.openHint")})]}):null]}),ne?null:oe?r.jsxs("p",{className:"mt-4 text-[14px]",children:[s("pair.alreadyConnected")," ",r.jsx("a",{href:"/",className:"text-accent underline",children:s("pair.openApp")})]}):E==="email"?r.jsxs("form",{onSubmit:wt,children:[r.jsx("label",{className:z,htmlFor:"signin-email",children:s("cloudBuy.signIn.email")}),r.jsx("input",{id:"signin-email",type:"email",value:S,onChange:h=>{H(h.target.value),j(!1),O("")},autoComplete:"email",inputMode:"email",spellCheck:!1,className:M}),b?r.jsxs(r.Fragment,{children:[r.jsx("label",{className:z,htmlFor:"signin-code",children:s("pair.emailCode")}),r.jsx("input",{id:"signin-code",value:_,onChange:h=>O(h.target.value),placeholder:"12345678",autoComplete:"one-time-code",inputMode:"numeric",spellCheck:!1,className:`${M} font-mono text-[15px] tracking-[0.12em]`}),r.jsx("label",{className:z,htmlFor:"signin-label",children:s("pair.deviceLabel")}),r.jsx("input",{id:"signin-label",value:i,onChange:h=>c(h.target.value),maxLength:80,className:M})]}):null,y?r.jsx("p",{className:"mt-3 text-[13px] text-danger",children:y}):null,r.jsx("button",{type:"submit",disabled:m||!S.includes("@")||b&&_.replace(/\D/g,"").length<8,className:We,children:s(m?b?"pair.signingIn":"pair.sending":b?"pair.signIn":"cloudBuy.signIn.send")}),b?r.jsx("button",{type:"button",onClick:()=>j(!1),className:"mt-3 w-full text-[13px] text-ink-secondary underline",children:s("pair.resend")}):null,r.jsx("button",{type:"button",onClick:()=>Ce("code"),className:"mt-3 w-full text-[13px] text-ink-secondary underline",children:s("pair.useCode")})]}):r.jsxs("form",{onSubmit:kt,children:[r.jsx("label",{className:z,htmlFor:"pair-code",children:s("pair.code")}),r.jsx("input",{id:"pair-code",value:o,onChange:h=>{a(h.target.value),I(J())},placeholder:"XXXX-XXXX-XXXX","aria-describedby":e&&o===e?"pair-code-from-link":void 0,autoComplete:"one-time-code",autoCapitalize:"characters",spellCheck:!1,className:`${M} font-mono text-[15px] tracking-[0.12em]`}),e&&o===e?r.jsx("p",{id:"pair-code-from-link",className:"mt-1 text-[12px] text-ink-secondary",children:s("pair.fromLink")}):null,r.jsx("label",{className:z,htmlFor:"pair-label",children:s("pair.deviceLabel")}),r.jsx("input",{id:"pair-label",value:i,onChange:h=>c(h.target.value),maxLength:80,className:M}),Ne?r.jsx("p",{role:"alert",className:"mt-3 text-[13px] text-danger",children:Ne}):y?r.jsx("p",{className:"mt-3 text-[13px] text-danger",children:y}):null,r.jsx("button",{type:"submit",disabled:m||!Xn(o),className:We,children:s(m?"pair.connecting":"pair.connect")}),null,yt?r.jsxs("p",{className:"mt-3 text-[13px] text-ink-secondary",children:[s("pair.noCode")," ",r.jsx("code",{className:"select-all rounded bg-inset px-1.5 py-0.5 text-[12px] text-ink",children:"npx limixbot pair"})]}):null,gt?r.jsxs("p",{className:"mt-5 border-t border-hairline/40 pt-4 text-[13px] text-ink-secondary",children:[s("pair.invitedByEmail")," ",r.jsx("button",{type:"button",onClick:()=>Ce("email"),className:"text-accent underline",children:s("pair.useEmail")})]}):null]})]})]})}const Do="cloud-welcome-done",Jn="unauthorized: you are no longer in this team",Ve=[["reserving","cloudHome.step.reserving"],["storage","cloudHome.step.storage"],["starting","cloudHome.step.starting"],["checking","cloudHome.step.checking"]];function Zn({step:e}){const t=Ve.findIndex(([n])=>n===e);return r.jsx("ol",{"data-cloud-setup":e,className:"flex flex-col gap-1 text-[13px]",children:Ve.map(([n,o],a)=>r.jsx("li",{"aria-current":a===t?"step":void 0,className:a===t?"font-medium text-ink":a<t?"text-ink-secondary line-through decoration-ink-secondary/40":"text-ink-secondary",children:s(o)},n))})}const Qn={stopped:"cloudHome.stopped","payment-problem":"cloudHome.paymentProblem",failed:"cloudHome.failed"},Xe={host:"cloudHome.unreachableHost",no_answer:"cloudHome.unreachable"};function eo(e,t=Date.now()){const n=new Date(e).getFullYear()!==new Date(t).getFullYear();return new Intl.DateTimeFormat(Ot(),{day:"numeric",month:"long",...n?{year:"numeric"}:{}}).format(new Date(e))}function to(e,t=Date.now()){const n=e?.name??null,o=(a,i)=>n?s(i,{name:n}):s(a);return e?.screen==="setup"?{title:o("homeScreen.setup","homeScreen.setupNamed"),body:s(e.slow?"cloudHome.slow":"homeScreen.setupBody"),reason:null,action:null,busy:!0}:e?.screen==="offline"?{title:o("homeScreen.offline","homeScreen.offlineNamed"),body:s("homeScreen.offlineBack"),reason:e.cause&&Object.hasOwn(Xe,e.cause)?s(Xe[e.cause]):e.reason??null,action:"retry",busy:!1}:e?.screen==="signin"?{title:o("homeScreen.signIn","homeScreen.signInNamed"),body:s(e.other?"homeScreen.signInOther":"homeScreen.signInEnded"),reason:null,action:"sign-in",busy:!1}:e?.screen==="plan"&&e.member&&e.machine!=="failed"?{title:o("homeScreen.plan","homeScreen.planNamed"),body:s("cloudHome.stoppedMember"),reason:null,action:null,busy:!1}:e?.screen==="plan"?{title:o("homeScreen.plan","homeScreen.planNamed"),body:s(Qn[e.machine]??"cloudHome.failed"),reason:null,action:e.machine==="failed"?null:"manage",busy:!1}:e?.screen==="ended"?{title:o("cloudHome.ended","cloudHome.endedNamed"),body:e.deleteAt?s("cloudHome.endedFiles",{date:eo(e.deleteAt,t)}):null,reason:null,action:"buy",busy:!1}:e?.screen==="checkout"?{title:o("cloudHome.checkout","cloudHome.checkoutNamed"),body:null,reason:null,action:"continue",busy:!1}:e?.screen==="payment"?{title:o("cloudHome.payment","cloudHome.paymentNamed"),body:s("cloudHome.paymentBody"),reason:null,action:"card",busy:!1}:e?.screen==="waking"?{title:s("homeScreen.waking"),body:null,reason:null,action:null,busy:!0}:e?.screen==="moving"?{title:o("homeScreen.moving","homeScreen.movingNamed"),body:null,reason:null,action:null,busy:!0}:{title:o("homeScreen.opening","homeScreen.openingNamed"),body:null,reason:null,action:null,busy:!0}}const no={retry:"cloudHome.tryAgain",buy:"cloudHome.buyAgain",continue:"cloudHome.continue",card:"cloudHome.updateCard"};function oo({name:e,remove:t}){const[n,o]=u.useState(!1),[a,i]=u.useState(!1),[c,l]=u.useState(null),x=()=>{i(!0),l(null),t().then(f=>{i(!1),f!=="removed"&&f!=="gone"&&(o(!1),l(f==="refused"?"refused":"failed"))},()=>{i(!1),o(!1),l("failed")})};return r.jsxs("div",{"data-home-remove":!0,className:"flex flex-col items-start gap-2",children:[n?r.jsxs("div",{role:"alertdialog","aria-label":s("rail.remove"),className:"flex flex-col gap-2 rounded-xl border border-hairline/70 bg-card/70 px-4 py-3",children:[r.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:s("rail.removeAsk",{name:e})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{type:"button","data-home-remove-confirm":!0,className:"ui-button ui-button-primary",disabled:a,onClick:x,children:s("rail.removeYes")}),r.jsx("button",{type:"button",className:"ui-button",disabled:a,onClick:()=>o(!1),children:s("rail.removeNo")})]})]}):r.jsx("button",{type:"button","data-home-remove-ask":!0,className:"text-[13px] text-ink-secondary underline-offset-2 hover:text-ink hover:underline",onClick:()=>{l(null),o(!0)},children:s("rail.remove")}),c&&r.jsx("p",{role:"alert",className:"text-[13px] text-danger",children:s(c==="refused"?"rail.removeRefused":"rail.removeFailed")})]})}function ro({bridge:e,manage:t}){const[n,o]=u.useState(null),[a,i]=u.useState(!1);u.useEffect(()=>{let g=!0;const y=e.onState(k=>o(k)),p=()=>{e.retry().then(k=>{g&&o(k)}).catch(()=>{})};return e.state().then(k=>{g&&o(k)}).catch(()=>{}).then(p),window.addEventListener("online",p),window.addEventListener("focus",p),()=>{g=!1,y(),window.removeEventListener("online",p),window.removeEventListener("focus",p)}},[e]);const c=to(n),l=g=>{i(!1),g().catch(()=>i(!0))},x=window.ogb?.cloudAdd?.reopen,f={retry:()=>e.retry().then(g=>o(g)),...t?{manage:t,buy:t,card:t,continue:async()=>{x&&await x().catch(()=>!1)||await t()}}:{}},w=c.action&&c.action!=="sign-in"&&c.action!=="manage"?c.action:null,m=(n?.screen==="ended"||n?.screen==="payment")&&n.removable===!0&&typeof e.remove=="function";return r.jsx("main",{"data-home-screen":n?.screen??"opening",className:"flex min-h-screen items-center justify-center bg-app px-6 text-ink",style:{WebkitAppRegion:"drag"},children:r.jsxs("div",{className:"flex w-full max-w-[420px] flex-col items-start gap-3",style:{WebkitAppRegion:"no-drag"},children:[r.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[20px] font-semibold",children:[c.busy&&r.jsx("span",{"aria-hidden":"true",className:"size-3.5 shrink-0 animate-spin rounded-full border-2 border-hairline border-t-accent"}),c.title]}),c.body&&r.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:c.body}),n?.screen==="setup"&&r.jsx(Zn,{step:n.step??"reserving"}),c.reason&&r.jsx("p",{"data-home-reason":!0,className:"text-[13px] leading-relaxed text-ink-secondary",children:c.reason}),c.action==="sign-in"&&r.jsx("button",{type:"button",className:"ui-button ui-button-primary mt-2",onClick:()=>l(()=>e.signIn()),children:s("homeScreen.signInButton")}),c.action==="manage"&&t&&r.jsx("button",{type:"button",className:"ui-button mt-2",onClick:()=>l(t),children:s("cloudAccount.manageInBrowser")}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[n?.screen==="offline"&&e.openLocal&&r.jsx("button",{type:"button","data-home-action":"local",className:"ui-button ui-button-primary mt-2",onClick:()=>l(async()=>{if(!await e.openLocal())throw new Error}),children:s("homeScreen.useLocal")}),w&&f[w]&&r.jsx("button",{type:"button","data-home-action":w,className:w==="retry"?"ui-button mt-2":"ui-button ui-button-primary mt-2",onClick:()=>l(f[w]),children:s(no[w])})]}),m&&r.jsx(oo,{name:n.name??s("cloudSetup.myCloud"),remove:()=>e.remove()}),a&&r.jsx("p",{role:"alert",className:"text-[13px] text-danger",children:s("cloudAccount.actionFailed")})]})})}function ao({bridge:e,fallback:t}){const[n,o]=u.useState(!1);return u.useEffect(()=>{e.repair().catch(()=>o(!0))},[e]),n?r.jsx(r.Fragment,{children:t}):r.jsx("main",{"data-home-screen":"opening",className:"flex min-h-screen items-center justify-center bg-app px-6 text-ink",children:r.jsx("p",{role:"status",className:"w-full max-w-[420px] text-[20px] font-semibold",children:s("homeScreen.opening")})})}const je="omb.session-ended";let fe=!1,le=null;const he=new Set;function Mo(){fe||le||(le=te().then(e=>{if(e.kind==="unauthenticated"){fe=!0;try{sessionStorage.setItem(je,"1")}catch{}for(const t of he)t()}}).finally(()=>{le=null}))}function Ge(){return fe}function zo(){return u.useSyncExternalStore(e=>(he.add(e),()=>he.delete(e)),Ge,Ge)}function so(){try{return sessionStorage.getItem(je)==="1"}catch{return!1}}function io(){try{sessionStorage.removeItem(je)}catch{}}Rt();be($t());Ht(Dt());tn();Mt(zt());kn();const q=Bt(),lo=new Set(["/home","/pair","/desktop-viewer"]),xt=()=>Ze(()=>import("./App-DbfRrJPA.js").then(e=>e.ko),__vite__mapDeps([0,1,2,3,4,5])).catch(e=>({default:()=>{throw e}})),co=lo.has(location.pathname)?null:xt(),uo=()=>fetch("/.well-known/openmausbot/environment").then(e=>e.json()).then(e=>e.capabilities?.cloudTeam===!0&&typeof e.label=="string"?e.label:null,()=>null);async function mo(){const e=window.ogb?.home;if(location.pathname==="/home"&&e)return r.jsx(ro,{bridge:e,manage:window.ogb?.cloudPlan?.manage});if(location.pathname==="/pair"){const o=Yt();if(o){const a=await Jt(o);return await q,a?r.jsx(wn,{credential:o,owner:a.owner,team:a.team}):r.jsx(V,{initialCode:null,reason:s("pair.browser.signInFailed")})}return r.jsx(V,{initialCode:Gt(),initialEmail:qt()})}const t=await te();if(t.kind==="unauthenticated"){if(await q,t.error===Jn)return r.jsx(qn,{team:await uo()});const o=r.jsx(V,{initialCode:null,reason:so()?s("pair.sessionEnded"):t.error});return e?r.jsx(ao,{bridge:e,fallback:o}):o}if(io(),t.kind==="session"&&Kt(t.teamSignIn),t.kind==="loopback"&&t.trust==="service")return await q,r.jsx(V,{initialCode:null,reason:s("pair.serviceTrust")});if(location.pathname==="/desktop-viewer"){const{DesktopViewer:o}=await Ze(async()=>{const{DesktopViewer:a}=await import("./DesktopViewer-Rhj5Rg_E.js");return{DesktopViewer:a}},__vite__mapDeps([6,1,2,7,8,5,4,9]));return r.jsx(o,{})}const{default:n}=await(co??xt());return ke(),r.jsx(n,{})}document.title=U();Promise.all([Ft(),mo(),q]).then(([,e])=>{Ut.createRoot(document.getElementById("root")).render(r.jsx(u.StrictMode,{children:r.jsx(Wt,{children:e})}))});export{No as A,ve as B,Zn as C,Nn as D,So as E,jn as F,_n as G,Po as H,To as I,vn as J,ue as K,jo as L,Do as M,zo as N,V as O,Co as P,Ho as Q,Eo as S,rt as T,Ln as a,hn as b,gn as c,vo as d,wo as e,Ao as f,ko as g,Sn as h,et as i,$o as j,Oo as k,ke as l,fo as m,Mo as n,Cn as o,_o as p,Ro as q,te as r,yo as s,xo as t,bo as u,Lo as v,go as w,In as x,Io as y,ho as z};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as v,U as O,b9 as $,ba as C,bb as L,bc as N,h as j,bd as E,be as _,bf as R,bg as I,bh as x,bi as F,bj as J}from"./App-
|
|
1
|
+
import{j as v,U as O,b9 as $,ba as C,bb as L,bc as N,h as j,bd as E,be as _,bf as R,bg as I,bh as x,bi as F,bj as J}from"./App-DbfRrJPA.js";import{t as h,m as D}from"./styles-DnkNzLDs.js";import{b as G}from"./PlacesRail-fw4FbMbq.js";const te={profile:{},memory:{},skills:[],routines:[]},H=t=>({name:t.name,prompt:t.prompt,schedule:t.schedule,enabled:t.enabled,runOn:t.runOn,durationMinutes:t.durationMinutes,timeoutMinutes:t.timeoutMinutes,overlap:t.overlap,attachments:t.attachments});class z{constructor(e,a,o=v){this.changed=a,this.network=o,this.template=structuredClone(e),this.routines=e.routines.map(n=>this.routine({...n,botId:this.id}))}changed;network;id=`draft-${O()}`;template;consent={};routines;preset;role;avatarFile;avatarObjectUrl;get bot(){const{computer:e,cwd:a,toolScope:o,...n}=this.template.profile;return{id:this.id,threadId:this.id,name:"",title:"",description:"",soul:"",color:"green",notifications:!0,unread:!1,messages:[],modelSelection:{instanceId:"",model:""},...n,computer:e??void 0,cwd:a??void 0,toolScope:o??void 0}}patch(e){const{acknowledgeLocalAuto:a,acknowledgePeerScope:o,applyToAllThreads:n,keepThreadModels:r,autoApprove:i,...l}=e;a!==void 0&&(this.consent.acknowledgeLocalAuto=a),o!==void 0&&(this.consent.acknowledgePeerScope=o),i!==void 0&&l.approvalMode===void 0&&(l.approvalMode=i?"auto":"ask"),this.template.profile={...this.template.profile,...l},this.changed()}setModel(e){this.patch({modelSelection:e})}choosePreset(e){this.preset=e,this.changed()}chooseRole(e){this.role=e,this.changed()}setMemory(e,a){a===null?delete this.template.memory[e]:this.template.memory[e]=a,this.changed()}setRoutineEnabled(e,a){this.routines=this.routines.map(o=>o.id===e?{...o,enabled:a}:o),this.changed()}removeRoutine(e){this.routines=this.routines.filter(a=>a.id!==e),this.changed()}export(){return structuredClone({...this.template,routines:this.routines.map(H)})}uploadAvatar=async e=>{if(!["image/png","image/jpeg","image/gif","image/webp"].includes(e.type))throw new Error(h("newBot.avatar.invalidType"));if(e.size>10*1024*1024)throw new Error(h("newBot.avatar.tooLarge"));return this.avatarObjectUrl&&URL.revokeObjectURL(this.avatarObjectUrl),this.avatarFile=e,this.avatarObjectUrl=URL.createObjectURL(e),this.avatarObjectUrl};dispose(){this.avatarObjectUrl&&URL.revokeObjectURL(this.avatarObjectUrl)}routine(e,a){const{groupId:o,resultsThreadId:n,checks:r,access:i,deliver:l,modelSelection:c,schedule:s,...g}=e,p=s.type==="interval"?{...s,weekdays:s.weekdays??void 0,window:s.window??void 0,endsAt:s.endsAt??void 0}:s.type==="limit_reset"?{...s,repeat:s.repeat??"once",at:s.at??null}:s;return{id:a?.id??`draft-${O()}`,createdAt:a?.createdAt??Date.now(),updatedAt:Date.now(),nextRunAt:null,runOn:"maus",...a,...g,enabled:e.enabled??a?.enabled??!0,target:"bot",botId:this.id,timeoutMinutes:e.timeoutMinutes??void 0,durationMinutes:e.durationMinutes??a?.durationMinutes??30,schedule:p}}request=async(e,a)=>{const o=a?.method??"GET",n=typeof a?.body=="string"?JSON.parse(a.body):{},r=`/api/bots/${this.id}`;let i;if(e===r&&o==="PATCH")this.patch(n),i={bot:this.bot};else if(e===`${r}/soul`&&o==="GET")i={soul:this.bot.soul,revision:"draft",bytes:new TextEncoder().encode(this.bot.soul).length,limit:24e3,file:"",drift:!1};else if(e===`${r}/skills`&&o==="GET")i={skills:this.template.skills,staged:[]};else if(e===`${r}/skills`&&o==="POST"){const l=await this.network("/api/bot-defaults/skills/preview",{method:"POST",body:JSON.stringify(n)}),c=new Set(this.template.skills.map(s=>s.name));if(l.skills.some(s=>c.has(s.name)))throw new Error(h("newBot.skillExists"));this.template.skills.push(...l.skills),this.changed(),i={installed:l.skills}}else if(e.startsWith(`${r}/skills/`)){const l=decodeURIComponent(e.slice(`${r}/skills/`.length)),c=this.template.skills.find(s=>s.name===l);if(!c)throw new Error("No such draft skill");if(o==="GET")i={text:c.text};else if(o==="PATCH"&&typeof n.enabled=="boolean")c.enabled=n.enabled,this.changed(),i={ok:!0};else if(o==="DELETE")this.template.skills=this.template.skills.filter(s=>s!==c),this.changed(),i={ok:!0};else throw new Error("Unsupported draft skill operation")}else if(e===`${r}/avatar/generate`&&o==="POST"){const{name:l,title:c,description:s}=this.bot,{dataUrl:g}=await this.network("/api/bot-defaults/avatar",{method:"POST",body:JSON.stringify({profile:{name:l,title:c,description:s},prompt:n.prompt})}),p=await(await fetch(g)).blob(),f=await this.uploadAvatar(new File([p],"avatar.png",{type:p.type}));i={avatarUrl:f,bot:{...this.bot,avatarUrl:f,avatarCrop:"circle"}}}else if(e==="/api/routines"&&o==="POST"||e.startsWith("/api/routines/draft-")&&o==="PATCH"){if(n.target&&n.target!=="bot")throw new Error("A new bot's routine must target that bot");if(n.botId!==this.id)throw new Error("Routine belongs to another bot");const l=this.routines.find(s=>e===`/api/routines/${s.id}`);if(o==="PATCH"&&!l)throw new Error("No such draft routine");const c=this.routine(n,l);this.routines=[...this.routines.filter(s=>s.id!==c.id),c],this.changed(),i={routine:c}}else throw new Error("This operation requires a created bot");return i}}const W=new Set(["coder","agency-ai-engineer","agency-api-platform-engineer","agency-backend-architect","agency-code-reviewer","agency-codebase-onboarding-engineer","agency-data-engineer","agency-data-visualization-engineer","agency-desktop-app-engineer","agency-developer-tooling-engineer","agency-devops-automator","agency-dx-engineer","agency-frontend-developer","agency-i18n-engineer","agency-identity-access-engineer","agency-minimal-change-engineer","agency-mobile-release-engineer","agency-payments-billing-engineer","agency-platform-engineer","agency-rag-pipeline-engineer","agency-rapid-prototyper","agency-realtime-collaboration-engineer","agency-search-relevance-engineer","agency-software-architect","agency-sre","agency-test-automation-engineer"]);function Y(t){return typeof t=="string"&&W.has(t)}async function K(t){const e=t.export();if(e.profile.avatarUrl?.startsWith("blob:")){if(!t.avatarFile)throw new Error(h("newBot.avatar.chooseAgain"));const a=await j(t.avatarFile),o=a&&G(a.path);if(!o)throw new Error(h("newBot.avatar.storeFailed"));e.profile.avatarUrl=o}return e}async function Q(t,e=v,a=$,o=N(),n,r){const i=await K(t),{chiefOfStaff:l,managedSections:c,toolScope:s,modelSelection:g,...p}=i.profile;if(!p.name?.trim())throw new Error(h("newBot.nameRequired"));const f=t.preset,k=!f&&t.role?C(t.role):void 0,P=g?.instanceId&&g.model?{modelSelection:g,requireAvailableModel:!0}:{},S=await e("/api/bots",{method:"POST",body:JSON.stringify({name:p.name,title:p.title,description:p.description,...P,section:p.section,useDefaults:!1,...n!==void 0?{visibility:n}:{},...r?{reportsTo:r}:{},...!f&&Y(t.role)?{codingTemplate:t.role}:{},...!f&&t.role==="video-workflow"?{videoTemplate:!0}:{},...k?{industryTemplate:k.id,templateLocale:D()}:{},...Object.hasOwn(i.profile,"toolScope")?{settings:{toolScope:s}}:{},...f?{preset:f.id}:{}})});let u=S.bot;const b=[],y=[];try{const m=await a(u.id,{...p,...t.consent},new AbortController().signal,e,o,u);if(u={...u,...m},p.approvalMode==="full"||p.approvalMode==="custom"){if(m.approvalMode!==p.approvalMode)throw new Error(h("newBot.approvalNotGranted"));if((await L(u.id,u.threadId,{approvalMode:p.approvalMode,acknowledgeLocalAuto:t.consent.acknowledgeLocalAuto===!0},o,e)).approvalMode!==p.approvalMode)throw new Error(h("newBot.threadApprovalNotGranted"))}for(const[d,w]of Object.entries(i.memory))f?.notes.includes(d)||await e(`/api/bots/${u.id}/memory/file`,{method:"PUT",body:JSON.stringify({path:d,text:w})});for(const d of i.skills)f?.skills.includes(d.name)||await e(`/api/bots/${u.id}/skill-template`,{method:"POST",body:JSON.stringify(d)});for(const d of i.routines){const w=await e("/api/routines",{method:"POST",body:JSON.stringify({...d,botId:u.id,enabled:!1})});b.push({id:w.routine.id,enabled:d.enabled!==!1})}}catch(m){const d=[];for(const T of b)try{await e(`/api/routines/${T.id}`,{method:"DELETE"})}catch{d.push(`routine ${T.id}`)}try{await e(`/api/bots/${u.id}`,{method:"DELETE"})}catch{d.push(`bot ${u.name} (${u.id})`)}const w=m instanceof Error?m.message:String(m);throw new Error(d.length?`${w}. Cleanup failed for ${d.join(", ")}; remove them before retrying.`:w)}if(l)try{const m=await e(`/api/bots/${u.id}`,{method:"PATCH",body:JSON.stringify({chiefOfStaff:l,managedSections:c,acknowledgePeerScope:!0})});u={...u,...m.bot}}catch(m){y.push(h("newBot.warning.chiefOfStaff",{error:m instanceof Error?m.message:String(m)}))}for(const m of b.filter(d=>d.enabled))try{await e(`/api/routines/${m.id}`,{method:"PATCH",body:JSON.stringify({enabled:!0})})}catch(d){y.push(h("newBot.warning.routine",{error:d instanceof Error?d.message:String(d)}))}return{bot:u,warnings:y,...S.paused?{paused:!0}:{}}}function A(t,e){const a=structuredClone(t.defaults),o=a.profile.modelSelection;return(!o||o.instanceId===""&&o.model==="")&&(a.profile.modelSelection=t.modelSelection),e&&(a.profile.name=a.profile.name?.trim()||t.suggestedName),a}function M(t,e){const a=new Set(e.map(o=>o.name.trim().toLowerCase()));if(!a.has(t.trim().toLowerCase()))return t;for(let o=2;;o++)if(!a.has(`${t} ${o}`.toLowerCase()))return`${t} ${o}`}function U(t,e,a,o){if(t)return t;const n=a.filter(r=>!r.hidden&&(r.section?.trim()||"")===(e?.trim()||""));return J(n,o)?.email??o.me?.email??null}function B(t,e,a,{preserveSelection:o=!1,showThreads:n,source:r,role:i,paused:l}){R(r,i),t({type:"botAdded",bot:e,preserveSelection:o}),!o&&I()&&x(t,e,n),a.length&&t({type:"error",message:a.join(`
|
|
2
2
|
`)}),l&&F(e.id)}async function V(t,e,a,o){if(typeof window<"u"&&window.ogb?.remoteClient?.active){const{bot:c,paused:s}=await o("/api/bots",{method:"POST",body:JSON.stringify(t===void 0?{}:{section:t})});return{bot:c,warnings:[],startsOnAsk:!1,...s?{paused:s}:{}}}const n=A(await o("/api/bot-defaults"),!0);n.profile.name=M(n.profile.name,e),t!==void 0&&(n.profile.section=t);const r=new z(n,()=>{},o),i=r.bot.approvalMode==="auto"&&r.bot.computer==="local";i&&r.patch({approvalMode:"ask"});const l=a?U(null,r.bot.section,e,a)??void 0:void 0;try{return{...await Q(r,o,void 0,void 0,void 0,l),startsOnAsk:i}}finally{r.dispose()}}async function X(t,e,a,o,n=v){if(E()?.admin===!1)return;let r;try{r=await V(t.section,e,E(),n)}catch(i){if(_(i))return;const l=h("newBot.failed",{error:i instanceof Error?i.message:String(i)});t.onError?t.onError(l):a({type:"error",message:l});return}B(a,r.bot,r.warnings,{preserveSelection:t.preserveSelection,showThreads:o,source:"blank",paused:r.paused}),r.startsOnAsk&&a({type:"notice",notice:{kind:"note",botName:null,text:h("newBot.startsOnAsk",{name:r.bot.name})}}),t.onCreated?.(r.bot)}const oe=Object.freeze(Object.defineProperty({__proto__:null,announceNewBot:B,freeName:M,makeNewBot:X,reportsToFor:U,startingTemplate:A},Symbol.toStringTag,{value:"Module"}));export{z as B,te as E,B as a,Q as c,oe as n,K as p,U as r,A as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as l,I as b,J as d,g as h,h as w,s as p,K as L,M,f as x,N as O,O as P,Q as R,t as n}from"./styles-DnkNzLDs.js";import{p as C,P as N,a as j}from"./package-format-nQAkOC1F.js";import{m as B}from"./PlacesRail-fw4FbMbq.js";import{aZ as S,a_ as _,a$ as G,b0 as $}from"./App-B6W9JFXZ.js";const se=50*1024*1024,q="Bot profiles, instructions, sections, rooms, playbooks, routines, each bot's memory (MEMORY.md, topic notes and daily logs) and conversation text (all tasks and branches).",u=p().min(1).max(200),v=p().trim().min(1).max(200),I=w().finite().nonnegative(),F=h(_),A=l({role:d("bot"),text:p().max(2e6),textCode:h(["chat.notice.exportedGoal.working","chat.notice.exportedGoal.completed","chat.notice.exportedGoal.needs-input","chat.notice.exportedGoal.blocked","chat.notice.exportedGoal.limit-reached","chat.notice.exportedGoal.paused","chat.notice.exportedGoal.stopped","chat.notice.exportedGoal.failed"]),textParams:l({before:p().max(2e6),content:p().max(2e6)})}),K=l({id:u,role:h(["bot","user"]),text:A.shape.text,textCode:A.shape.textCode.optional(),textParams:A.shape.textParams.optional(),at:I,parentId:u.nullable(),replyToId:u.optional(),from:l({botId:u,name:v,color:p().max(40)}).optional(),peerPost:l({unattended:x().optional()}).optional(),serverCard:d(!0).optional()}),U=l({key:u,title:p().max(2e3),createdAt:I,titleFromFirstMessage:d(!0).optional(),outside:d(!0).optional(),openedBy:l({botId:u,name:v,at:I,kind:h(["pair","work"]).optional()}).optional(),closedBy:l({botId:u,name:v,at:I}).optional(),pinned:d(!0).optional(),turnTimeoutMinutes:w().int().min(1).max(1440).optional(),activeLeafId:u.nullable(),messages:b(K).max(1e5)}),T={key:u,name:v,section:p().max(200).optional(),activeTask:u,tasks:b(U).min(1).max(1e4)},V=l({key:u,name:v,summary:p().max(24e3),triggers:b(p().max(2e3)).max(100),instructions:p().max(2e5)}),Y=M("type",[l({type:d("once"),at:I}),l({type:d("daily"),time:p().regex(/^([01]\d|2[0-3]):[0-5]\d$/),weekdays:b(w().int().min(0).max(6)).min(1).max(7)}),l({type:d("interval"),everyMinutes:w().int().min(5).max(1440),anchorAt:w().int().min(0).max(864e13)})]),E=p().max(2e6),z=l({file:E,topics:b(l({name:p().regex(/^[\w][\w .-]{0,199}\.md$/),text:E})).max(1e3),logs:b(l({name:p().regex(/^\d{4}-\d{2}-\d{2}\.md$/),text:E})).max(1e4)}),D=P(p().regex($),l({tools:R([d("*"),b(p().regex(G)).min(1).max(500)])}));function H(r){if(!r||typeof r!="object"||Array.isArray(r))return r;const o=r,e=o.defaultResponder&&typeof o.defaultResponder=="object"?o.defaultResponder.kind:void 0;if(typeof e!="string"||["member","everyone","mentions","auto"].includes(e))return r;const m=Array.isArray(o.memberIds)&&typeof o.memberIds[0]=="string"?o.memberIds[0]:void 0;return{...o,defaultResponder:m?{kind:"member",botId:m}:{kind:"mentions"}}}const J=l({format:d("openmaus.backup"),version:d(1),name:v,exportedAt:I,warnings:b(p().max(2e3)).max(4e3).default([]),bots:b(l({...T,title:p().max(2e3),description:p().max(2e5),soul:p().refine(r=>new TextEncoder().encode(r).byteLength<=24e3,{error:"standing instructions must be at most 24000 bytes"}).optional(),color:F,mascotExpression:p().max(80).optional(),mascotBody:p().max(40).optional(),mascotFaceColor:B.optional(),chiefOfStaff:x(),hidden:x(),playbooks:b(V).max(200),connectorTools:D.optional(),toolScope:O(r=>r!==void 0&&S(r).ok,"Invalid tool selection").transform(r=>{const o=S(r);return o.ok?o.scope:r}).optional(),helperModel:x().optional(),memory:z.optional()})).min(1).max(200),groups:b(L(H,l({...T,memberIds:b(u).max(200),dm:x(),bulletin:p().max(2e5),defaultResponder:M("kind",[l({kind:d("member"),botId:u}),l({kind:d("everyone")}),l({kind:d("mentions")}),l({kind:d("auto"),fallbackBotId:u.optional()})])}))).max(2e3),routines:b(l({name:v,prompt:p().trim().min(1).max(2e5),target:h(["bot","room-goal"]),botId:u,groupId:u.optional(),runOn:h(["maus","cloud"]),schedule:Y,durationMinutes:w().finite().positive(),timeoutMinutes:w().int().min(5).max(240).optional(),checks:b(h(["calendar","mail","runs"])).max(3).optional(),access:d("read-and-draft").optional(),deliver:d("brief").optional()})).max(2e3)});function Q(r){const o=J.safeParse(r);if(!o.success){const a=o.error.issues[0];throw new Error(`Invalid backup: ${a.path.join(".")||"file"}: ${a.message}`)}const e=o.data,m=(a,f)=>{const i=new Set(a);if(i.size!==a.length)throw new Error(`Invalid backup: duplicate ${f}`);return i},s=m(e.bots.map(a=>a.key),"bot key"),t=m(e.groups.map(a=>a.key),"room key"),c=new Set;for(const a of e.bots){if(!a.chiefOfStaff)continue;const f=a.section?.trim()??"";if(c.has(f)||a.hidden)throw new Error("Invalid backup: a section must have at most one visible Chief of Staff");c.add(f)}for(const a of e.groups){if(a.memberIds.some(i=>!s.has(i)))throw new Error("Invalid backup: unknown room member");m(a.memberIds,"room member");const f=a.defaultResponder.kind==="member"?a.defaultResponder.botId:a.defaultResponder.kind==="auto"?a.defaultResponder.fallbackBotId:void 0;if(f!==void 0&&!a.memberIds.includes(f))throw new Error("Invalid backup: room responder is not a member");if(a.dm&&(a.memberIds.length!==2||a.tasks.length!==1))throw new Error("Invalid backup: invalid direct-message room")}for(const a of e.routines){if(!s.has(a.botId))throw new Error("Invalid backup: unknown routine bot");if(a.target==="room-goal"){if(a.runOn!=="maus")throw new Error("Invalid backup: room goals must run on this computer");const f=e.groups.find(i=>i.key===a.groupId);if(a.groupId!==void 0&&(!t.has(a.groupId)||!f||f.dm||!f.memberIds.includes(a.botId)))throw new Error("Invalid backup: unknown routine room or coordinator")}}for(const a of[...e.bots,...e.groups]){if(!m(a.tasks.map(i=>i.key),"task key").has(a.activeTask))throw new Error("Invalid backup: unknown active task");for(const i of a.tasks){const k=m(i.messages.map(y=>y.id),"message key"),g=new Set;for(const y of i.messages){if(y.parentId!==null&&!g.has(y.parentId))throw new Error("Invalid backup: invalid conversation branch");if(y.replyToId&&!k.has(y.replyToId))throw new Error("Invalid backup: unknown reply");g.add(y.id)}if(i.activeLeafId!==null&&!k.has(i.activeLeafId))throw new Error("Invalid backup: unknown conversation head")}}return e}function W(r){if(typeof r=="string"&&(r=X(r)),!r||typeof r!="object"||Array.isArray(r))throw new Error(n("teamImport.noTeam"));const o=r;if(o.format==="openmaus.backup"){const s=Q(r);return{manifest:s,kind:"backup",name:s.name,description:q,members:s.bots.map(t=>({name:t.name,title:t.title})),rooms:s.groups.length,playbooks:s.bots.reduce((t,c)=>t+c.playbooks.length,0),routines:s.routines.length,apps:[],conversations:[...s.bots,...s.groups].reduce((t,c)=>t+c.tasks.length,0),archivedBots:s.bots.filter(t=>t.hidden).length,warnings:s.warnings}}if(o.format==="openmaus.package")return re(o,r);if(o.format!=="openmaus.team")throw new Error(n("teamImport.unknownFormat"));if(o.version!==1&&o.version!==2)throw new Error(n("teamImport.teamVersion",{version:String(o.version)}));if(!o.team||typeof o.team!="object"||Array.isArray(o.team))throw new Error(n("teamImport.teamMissing"));const e=o.team;if(typeof e.name!="string"||!e.name.trim())throw new Error(n("teamImport.teamNoName"));if(!Array.isArray(e.members)||e.members.length===0)throw new Error(n("teamImport.teamNoMembers"));if(e.members.length>200)throw new Error(n("teamImport.teamTooMany"));const m=e.members.map((s,t)=>{if(!s||typeof s!="object"||Array.isArray(s))throw new Error(n("teamImport.memberInvalid",{number:t+1}));const c=s;if(typeof c.name!="string"||!c.name.trim())throw new Error(n("teamImport.memberNoName",{number:t+1}));return{name:c.name.trim(),title:typeof c.title=="string"?c.title.trim():""}});return{manifest:r,kind:"team",name:e.name.trim(),description:typeof e.description=="string"?e.description.trim():"",members:m,rooms:o.version===1&&e.room&&typeof e.room=="object"?1:0,playbooks:0,routines:0,apps:[]}}function X(r){const o=r.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);if(!o)throw new Error(n("teamImport.markdownNoFrontmatter"));let e;try{e=C(o[1])}catch{throw new Error(n("teamImport.markdownBadYaml"))}if(!e||typeof e!="object"||Array.isArray(e))throw new Error(n("teamImport.markdownNoBlueprint"));const{botmrr:m,...s}=e;if(m!==1)throw new Error(n("teamImport.markdownVersion"));return{format:"openmaus.package",version:1,package:s}}function Z(r,o){const e=r.package;if(!e.agents.length)return ee(r,o);const m=new Set(e.agents.flatMap(t=>t.skills??[])),s=e.team?.leader?e.agents.find(t=>t.key===e.team?.leader)?.name:void 0;return{manifest:o,kind:"package",version:2,name:e.name,teamName:e.team?.name??e.name,description:e.summary,members:e.agents.map(t=>({name:t.name,title:t.title??""})),...s?{chiefOfStaff:s}:{},...e.team?.brief?.trim()?{brief:e.team.brief}:{},pictures:e.agents.map(t=>t.appearance.avatar?`data:${t.appearance.avatar.mime};base64,${t.appearance.avatar.data}`:null),rooms:e.rooms?.length??0,playbooks:e.playbooks?.length??0,routines:e.routines?.length??0,apps:e.requirements.apps.map(t=>({label:t.label,optional:t.optional===!0})),skills:(e.skills?.entries??[]).filter(t=>m.has(t.name)).map(t=>t.name),offeredSkills:(e.skills?.entries??[]).filter(t=>!m.has(t.name)).map(t=>t.name),connections:(e.connections??[]).map(t=>({label:t.label,url:t.mcp.url,values:t.mcp.valueNames.length})),notes:e.agents.reduce((t,c)=>t+Object.keys(c.seed?.memory??{}).length,0),presets:(e.presets??[]).map(t=>t.name)}}function ee(r,o){const e=r.package;if(!e.presets?.length)throw new Error(n("teamImport.libraryEmpty"));return{manifest:o,kind:"package",version:2,library:!0,name:e.name,description:e.summary,members:[],rooms:0,playbooks:e.playbooks?.length??0,routines:0,apps:[],skills:[],offeredSkills:(e.skills?.entries??[]).filter(m=>!e.presets.some(s=>s.skills?.includes(m.name))).map(m=>m.name),presets:e.presets.map(m=>m.name)}}function re(r,o){if(typeof r.version=="number"&&r.version>N)throw new Error(n("teamImport.newer"));if(r.version===N)return Z(j(o),o);if(r.version!==1)throw new Error(n("teamImport.playbookVersion",{version:String(r.version)}));if(!r.package||typeof r.package!="object"||Array.isArray(r.package))throw new Error(n("teamImport.playbookMissing"));const e=r.package;if(typeof e.name!="string"||!e.name.trim())throw new Error(n("teamImport.playbookNoName"));if(!Array.isArray(e.agents)||e.agents.length===0)throw new Error(n("teamImport.playbookNoBots"));if(e.agents.length>200)throw new Error(n("teamImport.playbookTooMany"));const m=e.agents.map((i,k)=>{if(!i||typeof i!="object"||Array.isArray(i))throw new Error(n("teamImport.botInvalid",{number:k+1}));const g=i;if(typeof g.name!="string"||!g.name.trim())throw new Error(n("teamImport.botNoName",{number:k+1}));return{name:g.name.trim(),title:typeof g.title=="string"?g.title.trim():""}}),s=typeof e.chiefOfStaff=="string"?e.chiefOfStaff:void 0,t=s?e.agents.find(i=>i.key===s)?.name:void 0,c=e.requirements&&typeof e.requirements=="object"&&!Array.isArray(e.requirements)?e.requirements:{},a=Array.isArray(c.apps)?c.apps.flatMap(i=>{if(!i||typeof i!="object"||Array.isArray(i))return[];const k=i;return typeof k.label=="string"?[{label:k.label.trim(),optional:k.optional===!0}]:[]}):[],f=e.skills&&typeof e.skills=="object"&&!Array.isArray(e.skills)?e.skills.entries:void 0;return{manifest:o,kind:"package",version:1,name:e.name.trim(),description:typeof e.summary=="string"?e.summary.trim():"",members:m,...typeof t=="string"?{chiefOfStaff:t}:{},rooms:Array.isArray(e.rooms)?e.rooms.length:0,playbooks:Array.isArray(e.playbooks)?e.playbooks.length:0,routines:Array.isArray(e.routines)?e.routines.length:0,apps:a,skills:Array.isArray(f)?f.flatMap(i=>{if(!i||typeof i!="object"||Array.isArray(i))return[];const{name:k}=i;return typeof k=="string"&&k.trim()?[k.trim()]:[]}):[]}}function ie(r){return r.installed&&r.installed.status!=="removed"?"added":r.release?r.blob==="unsupported"?"updateApp":r.blob!=="ready"?"notReady":"add":"noRelease"}function me(r){return r.publisher.self?n("orgLibrary.fromSelf"):n("orgLibrary.from",{name:r.publisher.name})}function pe(r){return r.mode==="required"?n("orgLibrary.recommended",{name:r.publisher.name}):null}function le(r){const o=[];return r.installed?.status==="withdrawn"&&o.push(n("orgLibrary.withdrawn",{name:r.publisher.name})),r.installed?.status==="installed"&&r.release&&r.release.version!==r.installed.release&&o.push(n("orgLibrary.newerRelease",{version:r.release.version})),o}function ce(r){const o=[];return r.bots&&o.push(n("orgLibrary.bots",{count:r.bots})),r.skills&&o.push(n("orgLibrary.skills",{count:r.skills})),r.presets&&o.push(n("orgLibrary.presets",{count:r.presets})),r.rooms&&o.push(n("orgLibrary.rooms",{count:r.rooms})),r.routines&&o.push(n("orgLibrary.routines",{count:r.routines})),r.connections&&o.push(n("orgLibrary.connections",{count:r.connections})),o.join(" · ")}function de(r,o=[]){if(r?.source!=="org")return null;const e=r.publisher?.name??"",m=o.find(s=>s.installId===r.installId);return{line:e?n("orgLibrary.provenance",{name:r.name,release:r.release,publisher:e}):n("orgLibrary.provenanceFile",{name:r.name,release:r.release}),withdrawn:m?.status==="withdrawn"?n("orgLibrary.withdrawn",{name:m.publisher||e}):null}}function ue(r){if(r.package.agents.length)return W(r);const o=r.package;return{manifest:r,kind:"package",version:2,name:o.name,teamName:o.name,description:o.summary,members:[],rooms:0,playbooks:o.playbooks?.length??0,routines:0,apps:o.requirements.apps.map(e=>({label:e.label,optional:e.optional===!0})),skills:[],offeredSkills:(o.skills?.entries??[]).map(e=>e.name),connections:[],notes:0,presets:(o.presets??[]).map(e=>e.name)}}export{se as M,pe as a,le as b,me as c,ce as d,ue as e,ie as o,de as p,W as t};
|
|
1
|
+
import{o as l,I as b,J as d,g as h,h as w,s as p,K as L,M,f as x,N as O,O as P,Q as R,t as n}from"./styles-DnkNzLDs.js";import{p as C,P as N,a as j}from"./package-format-B8QbigkU.js";import{m as B}from"./PlacesRail-fw4FbMbq.js";import{aZ as S,a_ as _,a$ as G,b0 as $}from"./App-DbfRrJPA.js";const se=50*1024*1024,q="Bot profiles, instructions, sections, rooms, playbooks, routines, each bot's memory (MEMORY.md, topic notes and daily logs) and conversation text (all tasks and branches).",u=p().min(1).max(200),v=p().trim().min(1).max(200),I=w().finite().nonnegative(),F=h(_),A=l({role:d("bot"),text:p().max(2e6),textCode:h(["chat.notice.exportedGoal.working","chat.notice.exportedGoal.completed","chat.notice.exportedGoal.needs-input","chat.notice.exportedGoal.blocked","chat.notice.exportedGoal.limit-reached","chat.notice.exportedGoal.paused","chat.notice.exportedGoal.stopped","chat.notice.exportedGoal.failed"]),textParams:l({before:p().max(2e6),content:p().max(2e6)})}),K=l({id:u,role:h(["bot","user"]),text:A.shape.text,textCode:A.shape.textCode.optional(),textParams:A.shape.textParams.optional(),at:I,parentId:u.nullable(),replyToId:u.optional(),from:l({botId:u,name:v,color:p().max(40)}).optional(),peerPost:l({unattended:x().optional()}).optional(),serverCard:d(!0).optional()}),U=l({key:u,title:p().max(2e3),createdAt:I,titleFromFirstMessage:d(!0).optional(),outside:d(!0).optional(),openedBy:l({botId:u,name:v,at:I,kind:h(["pair","work"]).optional()}).optional(),closedBy:l({botId:u,name:v,at:I}).optional(),pinned:d(!0).optional(),turnTimeoutMinutes:w().int().min(1).max(1440).optional(),activeLeafId:u.nullable(),messages:b(K).max(1e5)}),T={key:u,name:v,section:p().max(200).optional(),activeTask:u,tasks:b(U).min(1).max(1e4)},V=l({key:u,name:v,summary:p().max(24e3),triggers:b(p().max(2e3)).max(100),instructions:p().max(2e5)}),Y=M("type",[l({type:d("once"),at:I}),l({type:d("daily"),time:p().regex(/^([01]\d|2[0-3]):[0-5]\d$/),weekdays:b(w().int().min(0).max(6)).min(1).max(7)}),l({type:d("interval"),everyMinutes:w().int().min(5).max(1440),anchorAt:w().int().min(0).max(864e13)})]),E=p().max(2e6),z=l({file:E,topics:b(l({name:p().regex(/^[\w][\w .-]{0,199}\.md$/),text:E})).max(1e3),logs:b(l({name:p().regex(/^\d{4}-\d{2}-\d{2}\.md$/),text:E})).max(1e4)}),D=P(p().regex($),l({tools:R([d("*"),b(p().regex(G)).min(1).max(500)])}));function H(r){if(!r||typeof r!="object"||Array.isArray(r))return r;const o=r,e=o.defaultResponder&&typeof o.defaultResponder=="object"?o.defaultResponder.kind:void 0;if(typeof e!="string"||["member","everyone","mentions","auto"].includes(e))return r;const m=Array.isArray(o.memberIds)&&typeof o.memberIds[0]=="string"?o.memberIds[0]:void 0;return{...o,defaultResponder:m?{kind:"member",botId:m}:{kind:"mentions"}}}const J=l({format:d("openmaus.backup"),version:d(1),name:v,exportedAt:I,warnings:b(p().max(2e3)).max(4e3).default([]),bots:b(l({...T,title:p().max(2e3),description:p().max(2e5),soul:p().refine(r=>new TextEncoder().encode(r).byteLength<=24e3,{error:"standing instructions must be at most 24000 bytes"}).optional(),color:F,mascotExpression:p().max(80).optional(),mascotBody:p().max(40).optional(),mascotFaceColor:B.optional(),chiefOfStaff:x(),hidden:x(),playbooks:b(V).max(200),connectorTools:D.optional(),toolScope:O(r=>r!==void 0&&S(r).ok,"Invalid tool selection").transform(r=>{const o=S(r);return o.ok?o.scope:r}).optional(),helperModel:x().optional(),memory:z.optional()})).min(1).max(200),groups:b(L(H,l({...T,memberIds:b(u).max(200),dm:x(),bulletin:p().max(2e5),defaultResponder:M("kind",[l({kind:d("member"),botId:u}),l({kind:d("everyone")}),l({kind:d("mentions")}),l({kind:d("auto"),fallbackBotId:u.optional()})])}))).max(2e3),routines:b(l({name:v,prompt:p().trim().min(1).max(2e5),target:h(["bot","room-goal"]),botId:u,groupId:u.optional(),runOn:h(["maus","cloud"]),schedule:Y,durationMinutes:w().finite().positive(),timeoutMinutes:w().int().min(5).max(240).optional(),checks:b(h(["calendar","mail","runs"])).max(3).optional(),access:d("read-and-draft").optional(),deliver:d("brief").optional()})).max(2e3)});function Q(r){const o=J.safeParse(r);if(!o.success){const a=o.error.issues[0];throw new Error(`Invalid backup: ${a.path.join(".")||"file"}: ${a.message}`)}const e=o.data,m=(a,f)=>{const i=new Set(a);if(i.size!==a.length)throw new Error(`Invalid backup: duplicate ${f}`);return i},s=m(e.bots.map(a=>a.key),"bot key"),t=m(e.groups.map(a=>a.key),"room key"),c=new Set;for(const a of e.bots){if(!a.chiefOfStaff)continue;const f=a.section?.trim()??"";if(c.has(f)||a.hidden)throw new Error("Invalid backup: a section must have at most one visible Chief of Staff");c.add(f)}for(const a of e.groups){if(a.memberIds.some(i=>!s.has(i)))throw new Error("Invalid backup: unknown room member");m(a.memberIds,"room member");const f=a.defaultResponder.kind==="member"?a.defaultResponder.botId:a.defaultResponder.kind==="auto"?a.defaultResponder.fallbackBotId:void 0;if(f!==void 0&&!a.memberIds.includes(f))throw new Error("Invalid backup: room responder is not a member");if(a.dm&&(a.memberIds.length!==2||a.tasks.length!==1))throw new Error("Invalid backup: invalid direct-message room")}for(const a of e.routines){if(!s.has(a.botId))throw new Error("Invalid backup: unknown routine bot");if(a.target==="room-goal"){if(a.runOn!=="maus")throw new Error("Invalid backup: room goals must run on this computer");const f=e.groups.find(i=>i.key===a.groupId);if(a.groupId!==void 0&&(!t.has(a.groupId)||!f||f.dm||!f.memberIds.includes(a.botId)))throw new Error("Invalid backup: unknown routine room or coordinator")}}for(const a of[...e.bots,...e.groups]){if(!m(a.tasks.map(i=>i.key),"task key").has(a.activeTask))throw new Error("Invalid backup: unknown active task");for(const i of a.tasks){const k=m(i.messages.map(y=>y.id),"message key"),g=new Set;for(const y of i.messages){if(y.parentId!==null&&!g.has(y.parentId))throw new Error("Invalid backup: invalid conversation branch");if(y.replyToId&&!k.has(y.replyToId))throw new Error("Invalid backup: unknown reply");g.add(y.id)}if(i.activeLeafId!==null&&!k.has(i.activeLeafId))throw new Error("Invalid backup: unknown conversation head")}}return e}function W(r){if(typeof r=="string"&&(r=X(r)),!r||typeof r!="object"||Array.isArray(r))throw new Error(n("teamImport.noTeam"));const o=r;if(o.format==="openmaus.backup"){const s=Q(r);return{manifest:s,kind:"backup",name:s.name,description:q,members:s.bots.map(t=>({name:t.name,title:t.title})),rooms:s.groups.length,playbooks:s.bots.reduce((t,c)=>t+c.playbooks.length,0),routines:s.routines.length,apps:[],conversations:[...s.bots,...s.groups].reduce((t,c)=>t+c.tasks.length,0),archivedBots:s.bots.filter(t=>t.hidden).length,warnings:s.warnings}}if(o.format==="openmaus.package")return re(o,r);if(o.format!=="openmaus.team")throw new Error(n("teamImport.unknownFormat"));if(o.version!==1&&o.version!==2)throw new Error(n("teamImport.teamVersion",{version:String(o.version)}));if(!o.team||typeof o.team!="object"||Array.isArray(o.team))throw new Error(n("teamImport.teamMissing"));const e=o.team;if(typeof e.name!="string"||!e.name.trim())throw new Error(n("teamImport.teamNoName"));if(!Array.isArray(e.members)||e.members.length===0)throw new Error(n("teamImport.teamNoMembers"));if(e.members.length>200)throw new Error(n("teamImport.teamTooMany"));const m=e.members.map((s,t)=>{if(!s||typeof s!="object"||Array.isArray(s))throw new Error(n("teamImport.memberInvalid",{number:t+1}));const c=s;if(typeof c.name!="string"||!c.name.trim())throw new Error(n("teamImport.memberNoName",{number:t+1}));return{name:c.name.trim(),title:typeof c.title=="string"?c.title.trim():""}});return{manifest:r,kind:"team",name:e.name.trim(),description:typeof e.description=="string"?e.description.trim():"",members:m,rooms:o.version===1&&e.room&&typeof e.room=="object"?1:0,playbooks:0,routines:0,apps:[]}}function X(r){const o=r.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);if(!o)throw new Error(n("teamImport.markdownNoFrontmatter"));let e;try{e=C(o[1])}catch{throw new Error(n("teamImport.markdownBadYaml"))}if(!e||typeof e!="object"||Array.isArray(e))throw new Error(n("teamImport.markdownNoBlueprint"));const{botmrr:m,...s}=e;if(m!==1)throw new Error(n("teamImport.markdownVersion"));return{format:"openmaus.package",version:1,package:s}}function Z(r,o){const e=r.package;if(!e.agents.length)return ee(r,o);const m=new Set(e.agents.flatMap(t=>t.skills??[])),s=e.team?.leader?e.agents.find(t=>t.key===e.team?.leader)?.name:void 0;return{manifest:o,kind:"package",version:2,name:e.name,teamName:e.team?.name??e.name,description:e.summary,members:e.agents.map(t=>({name:t.name,title:t.title??""})),...s?{chiefOfStaff:s}:{},...e.team?.brief?.trim()?{brief:e.team.brief}:{},pictures:e.agents.map(t=>t.appearance.avatar?`data:${t.appearance.avatar.mime};base64,${t.appearance.avatar.data}`:null),rooms:e.rooms?.length??0,playbooks:e.playbooks?.length??0,routines:e.routines?.length??0,apps:e.requirements.apps.map(t=>({label:t.label,optional:t.optional===!0})),skills:(e.skills?.entries??[]).filter(t=>m.has(t.name)).map(t=>t.name),offeredSkills:(e.skills?.entries??[]).filter(t=>!m.has(t.name)).map(t=>t.name),connections:(e.connections??[]).map(t=>({label:t.label,url:t.mcp.url,values:t.mcp.valueNames.length})),notes:e.agents.reduce((t,c)=>t+Object.keys(c.seed?.memory??{}).length,0),presets:(e.presets??[]).map(t=>t.name)}}function ee(r,o){const e=r.package;if(!e.presets?.length)throw new Error(n("teamImport.libraryEmpty"));return{manifest:o,kind:"package",version:2,library:!0,name:e.name,description:e.summary,members:[],rooms:0,playbooks:e.playbooks?.length??0,routines:0,apps:[],skills:[],offeredSkills:(e.skills?.entries??[]).filter(m=>!e.presets.some(s=>s.skills?.includes(m.name))).map(m=>m.name),presets:e.presets.map(m=>m.name)}}function re(r,o){if(typeof r.version=="number"&&r.version>N)throw new Error(n("teamImport.newer"));if(r.version===N)return Z(j(o),o);if(r.version!==1)throw new Error(n("teamImport.playbookVersion",{version:String(r.version)}));if(!r.package||typeof r.package!="object"||Array.isArray(r.package))throw new Error(n("teamImport.playbookMissing"));const e=r.package;if(typeof e.name!="string"||!e.name.trim())throw new Error(n("teamImport.playbookNoName"));if(!Array.isArray(e.agents)||e.agents.length===0)throw new Error(n("teamImport.playbookNoBots"));if(e.agents.length>200)throw new Error(n("teamImport.playbookTooMany"));const m=e.agents.map((i,k)=>{if(!i||typeof i!="object"||Array.isArray(i))throw new Error(n("teamImport.botInvalid",{number:k+1}));const g=i;if(typeof g.name!="string"||!g.name.trim())throw new Error(n("teamImport.botNoName",{number:k+1}));return{name:g.name.trim(),title:typeof g.title=="string"?g.title.trim():""}}),s=typeof e.chiefOfStaff=="string"?e.chiefOfStaff:void 0,t=s?e.agents.find(i=>i.key===s)?.name:void 0,c=e.requirements&&typeof e.requirements=="object"&&!Array.isArray(e.requirements)?e.requirements:{},a=Array.isArray(c.apps)?c.apps.flatMap(i=>{if(!i||typeof i!="object"||Array.isArray(i))return[];const k=i;return typeof k.label=="string"?[{label:k.label.trim(),optional:k.optional===!0}]:[]}):[],f=e.skills&&typeof e.skills=="object"&&!Array.isArray(e.skills)?e.skills.entries:void 0;return{manifest:o,kind:"package",version:1,name:e.name.trim(),description:typeof e.summary=="string"?e.summary.trim():"",members:m,...typeof t=="string"?{chiefOfStaff:t}:{},rooms:Array.isArray(e.rooms)?e.rooms.length:0,playbooks:Array.isArray(e.playbooks)?e.playbooks.length:0,routines:Array.isArray(e.routines)?e.routines.length:0,apps:a,skills:Array.isArray(f)?f.flatMap(i=>{if(!i||typeof i!="object"||Array.isArray(i))return[];const{name:k}=i;return typeof k=="string"&&k.trim()?[k.trim()]:[]}):[]}}function ie(r){return r.installed&&r.installed.status!=="removed"?"added":r.release?r.blob==="unsupported"?"updateApp":r.blob!=="ready"?"notReady":"add":"noRelease"}function me(r){return r.publisher.self?n("orgLibrary.fromSelf"):n("orgLibrary.from",{name:r.publisher.name})}function pe(r){return r.mode==="required"?n("orgLibrary.recommended",{name:r.publisher.name}):null}function le(r){const o=[];return r.installed?.status==="withdrawn"&&o.push(n("orgLibrary.withdrawn",{name:r.publisher.name})),r.installed?.status==="installed"&&r.release&&r.release.version!==r.installed.release&&o.push(n("orgLibrary.newerRelease",{version:r.release.version})),o}function ce(r){const o=[];return r.bots&&o.push(n("orgLibrary.bots",{count:r.bots})),r.skills&&o.push(n("orgLibrary.skills",{count:r.skills})),r.presets&&o.push(n("orgLibrary.presets",{count:r.presets})),r.rooms&&o.push(n("orgLibrary.rooms",{count:r.rooms})),r.routines&&o.push(n("orgLibrary.routines",{count:r.routines})),r.connections&&o.push(n("orgLibrary.connections",{count:r.connections})),o.join(" · ")}function de(r,o=[]){if(r?.source!=="org")return null;const e=r.publisher?.name??"",m=o.find(s=>s.installId===r.installId);return{line:e?n("orgLibrary.provenance",{name:r.name,release:r.release,publisher:e}):n("orgLibrary.provenanceFile",{name:r.name,release:r.release}),withdrawn:m?.status==="withdrawn"?n("orgLibrary.withdrawn",{name:m.publisher||e}):null}}function ue(r){if(r.package.agents.length)return W(r);const o=r.package;return{manifest:r,kind:"package",version:2,name:o.name,teamName:o.name,description:o.summary,members:[],rooms:0,playbooks:o.playbooks?.length??0,routines:0,apps:o.requirements.apps.map(e=>({label:e.label,optional:e.optional===!0})),skills:[],offeredSkills:(o.skills?.entries??[]).map(e=>e.name),connections:[],notes:0,presets:(o.presets??[]).map(e=>e.name)}}export{se as M,pe as a,le as b,me as c,ce as d,ue as e,ie as o,de as p,W as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a_ as as,b7 as cn,h6 as fn,B as un,b4 as hn,b6 as Ut,hl as ls}from"./App-
|
|
1
|
+
import{a_ as as,b7 as cn,h6 as fn,B as un,b4 as hn,b6 as Ut,hl as ls}from"./App-DbfRrJPA.js";import{o as $,I as T,J as q,g as X,h as V,f as oe,s as F,M as cs,Q as dn,aY as pn,aZ as mn,K as gn,O as yn}from"./styles-DnkNzLDs.js";const Ot=Symbol.for("yaml.alias"),pt=Symbol.for("yaml.document"),se=Symbol.for("yaml.map"),fs=Symbol.for("yaml.pair"),Q=Symbol.for("yaml.scalar"),be=Symbol.for("yaml.seq"),G=Symbol.for("yaml.node.type"),we=s=>!!s&&typeof s=="object"&&s[G]===Ot,Qe=s=>!!s&&typeof s=="object"&&s[G]===pt,Ce=s=>!!s&&typeof s=="object"&&s[G]===se,M=s=>!!s&&typeof s=="object"&&s[G]===fs,_=s=>!!s&&typeof s=="object"&&s[G]===Q,Me=s=>!!s&&typeof s=="object"&&s[G]===be;function v(s){if(s&&typeof s=="object")switch(s[G]){case se:case be:return!0}return!1}function C(s){if(s&&typeof s=="object")switch(s[G]){case Ot:case se:case Q:case be:return!0}return!1}const us=s=>(_(s)||v(s))&&!!s.anchor,ne=Symbol("break visit"),bn=Symbol("skip children"),Ie=Symbol("remove node");function ke(s,e){const t=wn(e);Qe(s)?ue(null,s.contents,t,Object.freeze([s]))===Ie&&(s.contents=null):ue(null,s,t,Object.freeze([]))}ke.BREAK=ne;ke.SKIP=bn;ke.REMOVE=Ie;function ue(s,e,t,n){const i=kn(s,e,t,n);if(C(i)||M(i))return Sn(s,n,i),ue(s,i,t,n);if(typeof i!="symbol"){if(v(e)){n=Object.freeze(n.concat(e));for(let r=0;r<e.items.length;++r){const o=ue(r,e.items[r],t,n);if(typeof o=="number")r=o-1;else{if(o===ne)return ne;o===Ie&&(e.items.splice(r,1),r-=1)}}}else if(M(e)){n=Object.freeze(n.concat(e));const r=ue("key",e.key,t,n);if(r===ne)return ne;r===Ie&&(e.key=null);const o=ue("value",e.value,t,n);if(o===ne)return ne;o===Ie&&(e.value=null)}}return i}function wn(s){return typeof s=="object"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}function kn(s,e,t,n){if(typeof t=="function")return t(s,e,n);if(Ce(e))return t.Map?.(s,e,n);if(Me(e))return t.Seq?.(s,e,n);if(M(e))return t.Pair?.(s,e,n);if(_(e))return t.Scalar?.(s,e,n);if(we(e))return t.Alias?.(s,e,n)}function Sn(s,e,t){const n=e[e.length-1];if(v(n))n.items[s]=t;else if(M(n))s==="key"?n.key=t:n.value=t;else if(Qe(n))n.contents=t;else{const i=we(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}const An={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Nn=s=>s.replace(/[!,[\]{}]/g,e=>An[e]);class D{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},D.defaultYaml,e),this.tags=Object.assign({},D.defaultTags,t)}clone(){const e=new D(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){const e=new D(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:D.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},D.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:D.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},D.defaultTags),this.atNextDocument=!1);const n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;const[r,o]=n;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;const[r]=n;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{const o=/^\d+\.\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,o),!1}}default:return t(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){const o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}const[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||t(`The ${e} tag has no suffix`);const r=this.tags[n];if(r)try{return r+decodeURIComponent(i)}catch(o){return t(String(o)),null}return n==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(const[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+Nn(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){const t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags);let i;if(e&&n.length>0&&C(e.contents)){const r={};ke(e.contents,(o,a)=>{C(a)&&a.tag&&(r[a.tag]=!0)}),i=Object.keys(r)}else i=[];for(const[r,o]of n)r==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(o)))&&t.push(`%TAG ${r} ${o}`);return t.join(`
|
|
2
2
|
`)}}D.defaultYaml={explicit:!1,version:"1.2"};D.defaultTags={"!!":"tag:yaml.org,2002:"};function hs(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){const t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function ds(s){const e=new Set;return ke(s,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function ps(s,e){for(let t=1;;++t){const n=`${s}${t}`;if(!e.has(n))return n}}function On(s,e){const t=[],n=new Map;let i=null;return{onAnchor:r=>{t.push(r),i??(i=ds(s));const o=ps(e,i);return i.add(o),o},setAnchors:()=>{for(const r of t){const o=n.get(r);if(typeof o=="object"&&o.anchor&&(_(o.node)||v(o.node)))o.node.anchor=o.anchor;else{const a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=r,a}}},sourceObjects:n}}function he(s,e,t,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,r=n.length;i<r;++i){const o=n[i],a=he(s,n,String(i),o);a===void 0?delete n[i]:a!==o&&(n[i]=a)}else if(n instanceof Map)for(const i of Array.from(n.keys())){const r=n.get(i),o=he(s,n,i,r);o===void 0?n.delete(i):o!==r&&n.set(i,o)}else if(n instanceof Set)for(const i of Array.from(n)){const r=he(s,n,i,i);r===void 0?n.delete(i):r!==i&&(n.delete(i),n.add(r))}else for(const[i,r]of Object.entries(n)){const o=he(s,n,i,r);o===void 0?delete n[i]:o!==r&&(n[i]=o)}return s.call(e,t,n)}function J(s,e,t){if(Array.isArray(s))return s.map((n,i)=>J(n,String(i),t));if(s&&typeof s.toJSON=="function"){if(!t||!us(s))return s.toJSON(e,t);const n={aliasCount:0,count:1,res:void 0};t.anchors.set(s,n),t.onCreate=r=>{n.res=r,delete t.onCreate};const i=s.toJSON(e,t);return t.onCreate&&t.onCreate(i),i}return typeof s=="bigint"&&!t?.keep?Number(s):s}class Et{constructor(e){Object.defineProperty(this,G,{value:e})}clone(){const e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:i,reviver:r}={}){if(!Qe(e))throw new TypeError("A document argument is required");const o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=J(this,"",o);if(typeof i=="function")for(const{count:c,res:l}of o.anchors.values())i(l,c);return typeof r=="function"?he(r,{"":a},"",a):a}}class $t extends Et{constructor(e){super(Ot),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){if(t?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],ke(e,{Node:(r,o)=>{(we(o)||us(o))&&n.push(o)}}),t&&(t.aliasResolveCache=n));let i;for(const r of n){if(r===this)break;r.anchor===this.source&&(i=r)}return i}toJSON(e,t){if(!t)return{source:this.source};const{anchors:n,doc:i,maxAliasCount:r}=t,o=this.resolve(i,t);if(!o){const c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=n.get(o);if(a||(J(o,null,t),a=n.get(o)),a?.res===void 0){const c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(r>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Fe(i,o,n)),a.count*a.aliasCount>r)){const c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,t,n){const i=`*${this.source}`;if(e){if(hs(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){const r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${i} `}return i}}function Fe(s,e,t){if(we(e)){const n=e.resolve(s),i=t&&n&&t.get(n);return i?i.count*i.aliasCount:0}else if(v(e)){let n=0;for(const i of e.items){const r=Fe(s,i,t);r>n&&(n=r)}return n}else if(M(e)){const n=Fe(s,e.key,t),i=Fe(s,e.value,t);return Math.max(n,i)}return 1}const ms=s=>!s||typeof s!="function"&&typeof s!="object";class O extends Et{constructor(e){super(Q),this.value=e}toJSON(e,t){return t?.keep?this.value:J(this.value,e,t)}toString(){return String(this.value)}}O.BLOCK_FOLDED="BLOCK_FOLDED";O.BLOCK_LITERAL="BLOCK_LITERAL";O.PLAIN="PLAIN";O.QUOTE_DOUBLE="QUOTE_DOUBLE";O.QUOTE_SINGLE="QUOTE_SINGLE";const En="tag:yaml.org,2002:";function $n(s,e,t){if(e){const n=t.filter(r=>r.tag===e),i=n.find(r=>!r.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return t.find(n=>n.identify?.(s)&&!n.format)}function _e(s,e,t){if(Qe(s)&&(s=s.contents),C(s))return s;if(M(s)){const f=t.schema[se].createNode?.(t.schema,null,t);return f.items.push(s),f}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt<"u"&&s instanceof BigInt)&&(s=s.valueOf());const{aliasDuplicateObjects:n,onAnchor:i,onTagObj:r,schema:o,sourceObjects:a}=t;let c;if(n&&s&&typeof s=="object"){if(c=a.get(s),c)return c.anchor??(c.anchor=i(s)),new $t(c.anchor);c={anchor:null,node:null},a.set(s,c)}e?.startsWith("!!")&&(e=En+e.slice(2));let l=$n(s,e,o.tags);if(!l){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){const f=new O(s);return c&&(c.node=f),f}l=s instanceof Map?o[se]:Symbol.iterator in Object(s)?o[be]:o[se]}r&&(r(l),delete t.onTagObj);const d=l?.createNode?l.createNode(t.schema,s,t):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(t.schema,s,t):new O(s);return e?d.tag=e:l.default||(d.tag=l.tag),c&&(c.node=d),d}function Ye(s,e,t){let n=t;for(let i=e.length-1;i>=0;--i){const r=e[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){const o=[];o[r]=n,n=o}else n=new Map([[r,n]])}return _e(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}const $e=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done;class gs extends Et{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>C(n)||M(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if($e(e))this.add(t);else{const[n,...i]=e,r=this.get(n,!0);if(v(r))r.addIn(i,t);else if(r===void 0&&this.schema)this.set(n,Ye(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){const[t,...n]=e;if(n.length===0)return this.delete(t);const i=this.get(t,!0);if(v(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){const[n,...i]=e,r=this.get(n,!0);return i.length===0?!t&&_(r)?r.value:r:v(r)?r.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!M(t))return!1;const n=t.value;return n==null||e&&_(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){const[t,...n]=e;if(n.length===0)return this.has(t);const i=this.get(t,!0);return v(i)?i.hasIn(n):!1}setIn(e,t){const[n,...i]=e;if(i.length===0)this.set(n,t);else{const r=this.get(n,!0);if(v(r))r.setIn(i,t);else if(r===void 0&&this.schema)this.set(n,Ye(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}}const Tn=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function z(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}const ie=(s,e,t)=>s.endsWith(`
|
|
3
3
|
`)?z(t,e):t.includes(`
|
|
4
4
|
`)?`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,j as e,t as n,a as B,X as _,p as K,i as y}from"./styles-DnkNzLDs.js";import{b as Q,r as Z,i as ee}from"./remote-desktop-DDRRx8uY.js";import{u as te,L as C,P as se}from"./PlacesRail-fw4FbMbq.js";import{u as ne,B as re}from"./BrowserPanel-C0NOYaOK.js";import{u as ae,k as ie,t as oe,G as le,m as ce,n as U,o as de,C as ue,j as b,A as pe,p as me,q as xe}from"./App-B6W9JFXZ.js";import{R as fe}from"./RoutinesPage-CFb9pR_B.js";import{M as F}from"./monitor-D-rHzZVy.js";import{C as he}from"./calendar-days-DMbqxmdo.js";import"./BrowserProfilesManager-48HNAHJm.js";import"./index-Bh1qTRXw.js";import"./SignedInSites-tgZ-kFN4.js";import"./minimize-LlGLn-cd.js";import"./file-up-DMaJmosg.js";import"./MenuMotion-xBTC4eOZ.js";import"./ProIntroduction-BO5ABFTi.js";function ge(t){if(typeof t!="string"||!t)throw new Error(n("remoteDesktop.noLink"));return t.startsWith("/vps-viewer/")?new URL(t,window.location.origin).toString():t}function be(t){if(t.schedule.type==="cron"||t.schedule.type==="limit_reset")return me(t.schedule);if(t.schedule.type==="once")return new Date(t.schedule.at).toLocaleString(y(),{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"});if(t.schedule.type==="interval"){const d=t.schedule.everyMinutes%60===0?n("routines.interval.hours",{hours:t.schedule.everyMinutes/60}):n("routines.interval.minutes",{minutes:t.schedule.everyMinutes});return n("remoteDesktop.startingAt",{cadence:d,date:new Date(t.schedule.anchorAt).toLocaleString(y(),{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})})}const r=t.schedule.weekdays,l=r.length===7?n("routines.repeat.daily"):r.join(",")==="1,2,3,4,5"?n("routines.repeat.weekdays"):r.map(xe).join(", "),[w,k]=t.schedule.time.split(":").map(Number);return`${l} · ${new Date(2e3,0,1,w,k).toLocaleTimeString(y(),{hour:"numeric",minute:"2-digit"})}`}function ye(t){if(t==null)return n("routines.pausedSchedule");const r=new Date(t),l=new Date;return`${r.toDateString()===l.toDateString()?n("routines.today"):r.toLocaleDateString(y(),{month:"short",day:"numeric"})}, ${r.toLocaleTimeString(y(),{hour:"numeric",minute:"2-digit"})}`}function Oe({bot:t}){const{state:r,dispatch:l}=ae(),{dragProps:w}=te(),k=ie(t.id),[d,I]=i.useState(!1),[v,j]=i.useState(null),[p,R]=i.useState(null),[M,D]=i.useState(!0),[H,m]=i.useState(!1),[P,E]=i.useState(!1),A=ne(),L=i.useRef(t.busy);i.useEffect(()=>{L.current=t.busy},[t.busy]);const[G,z]=i.useState(!1),[x,O]=i.useState(()=>oe(t.id)?"browser":"desktop"),[J,W]=i.useState(),u=r.computerControl[t.id]?.help??null,q=u?r.bots.find(s=>s.id===u.botId)?.name??t.name:t.name,c=r.signInFocus?.botId===t.id?r.signInFocus:void 0;i.useEffect(()=>{!c||c.consumed||(O(c.place==="browser"?"browser":"desktop"),c.place==="browser"&&W({url:c.url,site:c.site,nonce:c.requestId}),l({type:"signInFocusConsumed",requestId:c.requestId}))},[l,c]);const N=r.routines.filter(s=>s.botId===t.id).sort((s,a)=>Number(a.enabled)-Number(s.enabled)||(s.nextRunAt??1/0)-(a.nextRunAt??1/0)),f=r.routineRuns.find(s=>s.botId===t.id&&["queued","running","waiting"].includes(s.status)),X=!!(r.config?.box.configured&&Q(r.instances,t.modelSelection.instanceId)?.snapshot.state==="available");i.useEffect(()=>{R(null),D(!0),m(!1)},[t.id]),i.useEffect(()=>{const s=window.ogb?.desktopViewer;if(!s)return;let a=!0;s.currentState().then(o=>{a&&E(o.open&&o.contextId===t.id)}).catch(()=>{});const h=s.onState(o=>{(o.contextId===t.id||!o.open)&&E(o.open&&o.contextId===t.id)});return()=>{a=!1,h()}},[t.id]),i.useEffect(()=>{if(x!=="desktop"||!A||P||d)return;const s=new AbortController;let a=!1,h=-1/0,o=null,S=null;const $=async()=>{if(!(a||s.signal.aborted)&&!(Date.now()-h<(o??(L.current?4e3:3e4)))){a=!0,o=null;try{const g=Z(await b(`/api/bots/${t.id}/computer/screenshot`,{method:"POST",body:"{}",signal:AbortSignal.any([s.signal,AbortSignal.timeout(9e4)])}));!s.signal.aborted&&g?(R(g),m(!1),S=null):s.signal.aborted||m(!0)}catch(g){if(!s.signal.aborted)if(g instanceof pe&&ee(g)){o=1e3,S??=Date.now();const T=Date.now()-S>=1e4;m(T),D(!T)}else S=null,m(!0)}finally{!s.signal.aborted&&o===null&&D(!1),a=!1,h=Date.now()}}};$();const Y=window.setInterval($,1e3);return()=>{s.abort(),window.clearInterval(Y)}},[t.id,A,P,d,x]);const V=async()=>{I(!0),j(null);let s=!1;try{if(!window.ogb?.desktopViewer)throw new Error(n("remoteDesktop.viewerUnavailable"));await b(`/api/bots/${t.id}/computer/control`,{method:"POST",body:JSON.stringify({action:"take"})}),s=!0;const a=await b(`/api/bots/${t.id}/computer/join`,{method:"POST",body:"{}"});if(!await window.ogb.desktopViewer.open(ge(a.joinUrl),n("computer.viewerTitle",{name:t.name}),t.id))throw new Error(n("computer.err.openDesktop",{app:K()}))}catch(a){s&&await b(`/api/bots/${t.id}/computer/control`,{method:"POST",body:JSON.stringify({action:"release"})}).catch(()=>{}),await b(`/api/bots/${t.id}/computer/viewer-close`,{method:"POST",body:"{}"}).catch(()=>{}),j(a instanceof Error?a.message:String(a))}finally{I(!1)}};return e.jsxs("aside",{className:"relative z-20 flex h-full w-[400px] shrink-0 flex-col border-l border-hairline bg-panel",ref:k,"data-computer-panel":!0,children:[e.jsxs("div",{...w,className:"flex items-center justify-between border-b border-hairline px-5 py-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:n("remoteDesktop.title",{name:t.name})}),e.jsx("div",{className:"mt-0.5 text-[11px] text-ink-secondary",children:n(t.cloudBackend==="vps"?"botAccess.cloud.selfHostedVps":"remoteDesktop.cloudDesktop")})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"flex rounded-full bg-inset p-0.5","aria-label":n("computer.tabsAria"),children:["desktop","browser"].map(s=>e.jsxs("button",{type:"button",onClick:()=>O(s),"aria-pressed":x===s,className:B("flex items-center gap-1 rounded-full px-2.5 py-1 text-[12px]",x===s?"bg-card text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:[s==="desktop"?e.jsx(F,{size:12}):e.jsx(le,{size:12}),n(s==="desktop"?"remoteDesktop.desktop":"place.browser")]},s))}),e.jsx("button",{type:"button","data-computer-panel-close":!0,onClick:()=>{ce(k.current,t.id),l({type:"toggleComputer",open:!1})},className:"rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink","aria-label":n("remoteDesktop.close"),children:e.jsx(_,{size:18})})]})]}),x==="browser"?e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col px-4 pb-4 pt-1",children:[u?.place==="browser"&&e.jsx("div",{className:"-mt-2 mb-3",children:e.jsx(U,{help:u,askerName:q,onError:j})}),e.jsx(re,{bot:t,signIn:J}),v&&e.jsx("div",{role:"alert",className:"mt-2 rounded-lg border border-danger/30 bg-danger/10 px-3 py-2 text-[12px] text-danger",children:v}),e.jsx("p",{className:"mt-2 text-[11px] leading-relaxed text-ink-secondary",children:n("remoteDesktop.browserHint")})]}):e.jsxs("div",{className:"flex flex-1 flex-col items-center gap-4 overflow-y-auto px-6 py-5 text-center",children:[u&&u.place!=="browser"&&e.jsx("div",{className:"-mt-3 w-full",children:e.jsx(U,{help:u,askerName:q,onError:j})}),e.jsxs("button",{type:"button",onClick:()=>{V()},disabled:d||!p,className:"group relative flex aspect-video w-full items-center justify-center overflow-hidden rounded-xl border border-hairline bg-black disabled:cursor-default","aria-label":p?n("computer.openLiveDesktopAria",{name:t.name}):n("remoteDesktop.previewUnavailableLabel"),children:[p?e.jsx("img",{src:p,alt:n("remoteDesktop.previewAlt",{name:t.name}),className:"h-full w-full object-contain"}):M?e.jsx(C,{size:22,className:"animate-spin text-ink-secondary"}):e.jsxs("div",{className:"flex flex-col items-center gap-2 text-ink-secondary",children:[e.jsx(de,{size:24}),e.jsx("span",{className:"text-[11px]",children:n(H?"remoteDesktop.previewUnavailable":"remoteDesktop.previewWaiting")})]}),p&&e.jsx("span",{className:"absolute inset-x-0 bottom-0 bg-black/65 py-2 text-[11px] font-medium text-white opacity-0 transition-opacity group-hover:opacity-100",children:n("computer.openLiveDesktop")})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:n("remoteDesktop.openLive")}),e.jsx("p",{className:"mt-2 text-[12px] leading-relaxed text-ink-secondary",children:n("remoteDesktop.relayHint")})]}),e.jsxs("button",{type:"button",onClick:()=>{V()},disabled:d,className:"flex w-full items-center justify-center gap-2 rounded-lg bg-accent px-4 py-2.5 text-[13px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[d?e.jsx(C,{size:15,className:"animate-spin"}):e.jsx(F,{size:15}),n(d?"settings.updates.opening":"computer.takeControl")]}),v&&e.jsx("div",{role:"alert",className:"w-full rounded-lg border border-danger/30 bg-danger/10 px-3 py-2 text-left text-[12px] text-danger",children:v}),e.jsx("p",{className:"text-[11px] leading-relaxed text-ink-secondary",children:n("remoteDesktop.accessHint")}),e.jsxs("div",{className:"w-full rounded-xl bg-card p-4 text-left",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[15px] font-medium text-ink",children:[e.jsx(ue,{size:16,className:"text-accent"}),n("computer.routines.title")]}),N.length>0&&e.jsx("span",{className:"rounded-full bg-control px-2 py-0.5 text-[10px] font-medium text-ink-secondary",children:N.length})]}),f&&e.jsxs("button",{type:"button",onClick:()=>l({type:"showRoutines"}),className:"mt-3 flex w-full items-center gap-2 rounded-lg border border-accent/25 bg-accent/10 px-3 py-2 text-left text-[12px] text-accent hover:bg-accent/15",children:[e.jsx(C,{size:13,className:f.status==="queued"?"":"animate-spin"}),e.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[f.routineName," · ",n(f.status==="waiting"?"computer.routines.needsYou":f.status==="queued"?"computer.runStatus.queued":"computer.runStatus.running")]})]}),N.length>0&&e.jsx("div",{className:"mt-3 space-y-1.5",children:N.slice(0,3).map(s=>e.jsxs("button",{type:"button",onClick:()=>l({type:"showRoutines"}),className:"flex w-full items-center gap-2 rounded-lg bg-inset px-3 py-2 text-left hover:bg-control/60",children:[e.jsx("span",{className:B("size-1.5 shrink-0 rounded-full",s.enabled?"bg-success":"bg-ink-secondary/40")}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block truncate text-[13px] font-medium text-ink",children:s.name}),e.jsxs("span",{className:"block truncate text-[11px] text-ink-secondary",children:[be(s),s.runOn==="cloud"?` · ${n("remoteDesktop.runsOnVm")}`:""]})]}),e.jsx("span",{className:"shrink-0 text-[10px] text-ink-secondary",children:ye(s.nextRunAt)})]},s.id))}),e.jsxs("div",{className:"mt-3 flex gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>z(!0),className:"flex flex-1 items-center justify-center gap-1.5 rounded-lg bg-accent py-2 text-[13px] font-medium text-white hover:brightness-110",children:[e.jsx(se,{size:14}),n("computer.routines.create")]}),e.jsxs("button",{type:"button",onClick:()=>l({type:"showRoutines"}),className:"flex items-center justify-center gap-1.5 rounded-lg bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover",title:n("computer.routines.openTitle"),children:[e.jsx(he,{size:14}),n("computer.routines.schedules")]})]})]})]}),G&&e.jsx(fe,{bots:[t],lockedBotId:t.id,defaultRunOn:X?"cloud":"maus",onClose:()=>z(!1)})]})}export{Oe as RemoteDesktopPanel};
|
|
1
|
+
import{r as i,j as e,t as n,a as B,X as _,p as K,i as y}from"./styles-DnkNzLDs.js";import{b as Q,r as Z,i as ee}from"./remote-desktop-DDRRx8uY.js";import{u as te,L as C,P as se}from"./PlacesRail-fw4FbMbq.js";import{u as ne,B as re}from"./BrowserPanel-Dq80i975.js";import{u as ae,k as ie,t as oe,G as le,m as ce,n as U,o as de,C as ue,j as b,A as pe,p as me,q as xe}from"./App-DbfRrJPA.js";import{R as fe}from"./RoutinesPage-BcixjsUv.js";import{M as F}from"./monitor-D-rHzZVy.js";import{C as he}from"./calendar-days-DMbqxmdo.js";import"./BrowserProfilesManager-BiDKQm59.js";import"./index-DAHkvjY_.js";import"./SignedInSites-CZ0n7vLp.js";import"./minimize-LlGLn-cd.js";import"./file-up-DMaJmosg.js";import"./MenuMotion-xBTC4eOZ.js";import"./ProIntroduction-CSoN3fqJ.js";function ge(t){if(typeof t!="string"||!t)throw new Error(n("remoteDesktop.noLink"));return t.startsWith("/vps-viewer/")?new URL(t,window.location.origin).toString():t}function be(t){if(t.schedule.type==="cron"||t.schedule.type==="limit_reset")return me(t.schedule);if(t.schedule.type==="once")return new Date(t.schedule.at).toLocaleString(y(),{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"});if(t.schedule.type==="interval"){const d=t.schedule.everyMinutes%60===0?n("routines.interval.hours",{hours:t.schedule.everyMinutes/60}):n("routines.interval.minutes",{minutes:t.schedule.everyMinutes});return n("remoteDesktop.startingAt",{cadence:d,date:new Date(t.schedule.anchorAt).toLocaleString(y(),{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})})}const r=t.schedule.weekdays,l=r.length===7?n("routines.repeat.daily"):r.join(",")==="1,2,3,4,5"?n("routines.repeat.weekdays"):r.map(xe).join(", "),[w,k]=t.schedule.time.split(":").map(Number);return`${l} · ${new Date(2e3,0,1,w,k).toLocaleTimeString(y(),{hour:"numeric",minute:"2-digit"})}`}function ye(t){if(t==null)return n("routines.pausedSchedule");const r=new Date(t),l=new Date;return`${r.toDateString()===l.toDateString()?n("routines.today"):r.toLocaleDateString(y(),{month:"short",day:"numeric"})}, ${r.toLocaleTimeString(y(),{hour:"numeric",minute:"2-digit"})}`}function Oe({bot:t}){const{state:r,dispatch:l}=ae(),{dragProps:w}=te(),k=ie(t.id),[d,I]=i.useState(!1),[v,j]=i.useState(null),[p,R]=i.useState(null),[M,D]=i.useState(!0),[H,m]=i.useState(!1),[P,E]=i.useState(!1),A=ne(),L=i.useRef(t.busy);i.useEffect(()=>{L.current=t.busy},[t.busy]);const[G,z]=i.useState(!1),[x,O]=i.useState(()=>oe(t.id)?"browser":"desktop"),[J,W]=i.useState(),u=r.computerControl[t.id]?.help??null,q=u?r.bots.find(s=>s.id===u.botId)?.name??t.name:t.name,c=r.signInFocus?.botId===t.id?r.signInFocus:void 0;i.useEffect(()=>{!c||c.consumed||(O(c.place==="browser"?"browser":"desktop"),c.place==="browser"&&W({url:c.url,site:c.site,nonce:c.requestId}),l({type:"signInFocusConsumed",requestId:c.requestId}))},[l,c]);const N=r.routines.filter(s=>s.botId===t.id).sort((s,a)=>Number(a.enabled)-Number(s.enabled)||(s.nextRunAt??1/0)-(a.nextRunAt??1/0)),f=r.routineRuns.find(s=>s.botId===t.id&&["queued","running","waiting"].includes(s.status)),X=!!(r.config?.box.configured&&Q(r.instances,t.modelSelection.instanceId)?.snapshot.state==="available");i.useEffect(()=>{R(null),D(!0),m(!1)},[t.id]),i.useEffect(()=>{const s=window.ogb?.desktopViewer;if(!s)return;let a=!0;s.currentState().then(o=>{a&&E(o.open&&o.contextId===t.id)}).catch(()=>{});const h=s.onState(o=>{(o.contextId===t.id||!o.open)&&E(o.open&&o.contextId===t.id)});return()=>{a=!1,h()}},[t.id]),i.useEffect(()=>{if(x!=="desktop"||!A||P||d)return;const s=new AbortController;let a=!1,h=-1/0,o=null,S=null;const $=async()=>{if(!(a||s.signal.aborted)&&!(Date.now()-h<(o??(L.current?4e3:3e4)))){a=!0,o=null;try{const g=Z(await b(`/api/bots/${t.id}/computer/screenshot`,{method:"POST",body:"{}",signal:AbortSignal.any([s.signal,AbortSignal.timeout(9e4)])}));!s.signal.aborted&&g?(R(g),m(!1),S=null):s.signal.aborted||m(!0)}catch(g){if(!s.signal.aborted)if(g instanceof pe&&ee(g)){o=1e3,S??=Date.now();const T=Date.now()-S>=1e4;m(T),D(!T)}else S=null,m(!0)}finally{!s.signal.aborted&&o===null&&D(!1),a=!1,h=Date.now()}}};$();const Y=window.setInterval($,1e3);return()=>{s.abort(),window.clearInterval(Y)}},[t.id,A,P,d,x]);const V=async()=>{I(!0),j(null);let s=!1;try{if(!window.ogb?.desktopViewer)throw new Error(n("remoteDesktop.viewerUnavailable"));await b(`/api/bots/${t.id}/computer/control`,{method:"POST",body:JSON.stringify({action:"take"})}),s=!0;const a=await b(`/api/bots/${t.id}/computer/join`,{method:"POST",body:"{}"});if(!await window.ogb.desktopViewer.open(ge(a.joinUrl),n("computer.viewerTitle",{name:t.name}),t.id))throw new Error(n("computer.err.openDesktop",{app:K()}))}catch(a){s&&await b(`/api/bots/${t.id}/computer/control`,{method:"POST",body:JSON.stringify({action:"release"})}).catch(()=>{}),await b(`/api/bots/${t.id}/computer/viewer-close`,{method:"POST",body:"{}"}).catch(()=>{}),j(a instanceof Error?a.message:String(a))}finally{I(!1)}};return e.jsxs("aside",{className:"relative z-20 flex h-full w-[400px] shrink-0 flex-col border-l border-hairline bg-panel",ref:k,"data-computer-panel":!0,children:[e.jsxs("div",{...w,className:"flex items-center justify-between border-b border-hairline px-5 py-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:n("remoteDesktop.title",{name:t.name})}),e.jsx("div",{className:"mt-0.5 text-[11px] text-ink-secondary",children:n(t.cloudBackend==="vps"?"botAccess.cloud.selfHostedVps":"remoteDesktop.cloudDesktop")})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"flex rounded-full bg-inset p-0.5","aria-label":n("computer.tabsAria"),children:["desktop","browser"].map(s=>e.jsxs("button",{type:"button",onClick:()=>O(s),"aria-pressed":x===s,className:B("flex items-center gap-1 rounded-full px-2.5 py-1 text-[12px]",x===s?"bg-card text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:[s==="desktop"?e.jsx(F,{size:12}):e.jsx(le,{size:12}),n(s==="desktop"?"remoteDesktop.desktop":"place.browser")]},s))}),e.jsx("button",{type:"button","data-computer-panel-close":!0,onClick:()=>{ce(k.current,t.id),l({type:"toggleComputer",open:!1})},className:"rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink","aria-label":n("remoteDesktop.close"),children:e.jsx(_,{size:18})})]})]}),x==="browser"?e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col px-4 pb-4 pt-1",children:[u?.place==="browser"&&e.jsx("div",{className:"-mt-2 mb-3",children:e.jsx(U,{help:u,askerName:q,onError:j})}),e.jsx(re,{bot:t,signIn:J}),v&&e.jsx("div",{role:"alert",className:"mt-2 rounded-lg border border-danger/30 bg-danger/10 px-3 py-2 text-[12px] text-danger",children:v}),e.jsx("p",{className:"mt-2 text-[11px] leading-relaxed text-ink-secondary",children:n("remoteDesktop.browserHint")})]}):e.jsxs("div",{className:"flex flex-1 flex-col items-center gap-4 overflow-y-auto px-6 py-5 text-center",children:[u&&u.place!=="browser"&&e.jsx("div",{className:"-mt-3 w-full",children:e.jsx(U,{help:u,askerName:q,onError:j})}),e.jsxs("button",{type:"button",onClick:()=>{V()},disabled:d||!p,className:"group relative flex aspect-video w-full items-center justify-center overflow-hidden rounded-xl border border-hairline bg-black disabled:cursor-default","aria-label":p?n("computer.openLiveDesktopAria",{name:t.name}):n("remoteDesktop.previewUnavailableLabel"),children:[p?e.jsx("img",{src:p,alt:n("remoteDesktop.previewAlt",{name:t.name}),className:"h-full w-full object-contain"}):M?e.jsx(C,{size:22,className:"animate-spin text-ink-secondary"}):e.jsxs("div",{className:"flex flex-col items-center gap-2 text-ink-secondary",children:[e.jsx(de,{size:24}),e.jsx("span",{className:"text-[11px]",children:n(H?"remoteDesktop.previewUnavailable":"remoteDesktop.previewWaiting")})]}),p&&e.jsx("span",{className:"absolute inset-x-0 bottom-0 bg-black/65 py-2 text-[11px] font-medium text-white opacity-0 transition-opacity group-hover:opacity-100",children:n("computer.openLiveDesktop")})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:n("remoteDesktop.openLive")}),e.jsx("p",{className:"mt-2 text-[12px] leading-relaxed text-ink-secondary",children:n("remoteDesktop.relayHint")})]}),e.jsxs("button",{type:"button",onClick:()=>{V()},disabled:d,className:"flex w-full items-center justify-center gap-2 rounded-lg bg-accent px-4 py-2.5 text-[13px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[d?e.jsx(C,{size:15,className:"animate-spin"}):e.jsx(F,{size:15}),n(d?"settings.updates.opening":"computer.takeControl")]}),v&&e.jsx("div",{role:"alert",className:"w-full rounded-lg border border-danger/30 bg-danger/10 px-3 py-2 text-left text-[12px] text-danger",children:v}),e.jsx("p",{className:"text-[11px] leading-relaxed text-ink-secondary",children:n("remoteDesktop.accessHint")}),e.jsxs("div",{className:"w-full rounded-xl bg-card p-4 text-left",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[15px] font-medium text-ink",children:[e.jsx(ue,{size:16,className:"text-accent"}),n("computer.routines.title")]}),N.length>0&&e.jsx("span",{className:"rounded-full bg-control px-2 py-0.5 text-[10px] font-medium text-ink-secondary",children:N.length})]}),f&&e.jsxs("button",{type:"button",onClick:()=>l({type:"showRoutines"}),className:"mt-3 flex w-full items-center gap-2 rounded-lg border border-accent/25 bg-accent/10 px-3 py-2 text-left text-[12px] text-accent hover:bg-accent/15",children:[e.jsx(C,{size:13,className:f.status==="queued"?"":"animate-spin"}),e.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[f.routineName," · ",n(f.status==="waiting"?"computer.routines.needsYou":f.status==="queued"?"computer.runStatus.queued":"computer.runStatus.running")]})]}),N.length>0&&e.jsx("div",{className:"mt-3 space-y-1.5",children:N.slice(0,3).map(s=>e.jsxs("button",{type:"button",onClick:()=>l({type:"showRoutines"}),className:"flex w-full items-center gap-2 rounded-lg bg-inset px-3 py-2 text-left hover:bg-control/60",children:[e.jsx("span",{className:B("size-1.5 shrink-0 rounded-full",s.enabled?"bg-success":"bg-ink-secondary/40")}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block truncate text-[13px] font-medium text-ink",children:s.name}),e.jsxs("span",{className:"block truncate text-[11px] text-ink-secondary",children:[be(s),s.runOn==="cloud"?` · ${n("remoteDesktop.runsOnVm")}`:""]})]}),e.jsx("span",{className:"shrink-0 text-[10px] text-ink-secondary",children:ye(s.nextRunAt)})]},s.id))}),e.jsxs("div",{className:"mt-3 flex gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>z(!0),className:"flex flex-1 items-center justify-center gap-1.5 rounded-lg bg-accent py-2 text-[13px] font-medium text-white hover:brightness-110",children:[e.jsx(se,{size:14}),n("computer.routines.create")]}),e.jsxs("button",{type:"button",onClick:()=>l({type:"showRoutines"}),className:"flex items-center justify-center gap-1.5 rounded-lg bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover",title:n("computer.routines.openTitle"),children:[e.jsx(he,{size:14}),n("computer.routines.schedules")]})]})]})]}),G&&e.jsx(fe,{bots:[t],lockedBotId:t.id,defaultRunOn:X?"cloud":"maus",onClose:()=>z(!1)})]})}export{Oe as RemoteDesktopPanel};
|
package/dist/index.html
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
|
26
26
|
<link rel="manifest" href="/manifest.webmanifest" />
|
|
27
27
|
<title>Limix Bot</title>
|
|
28
|
-
<script type="module" crossorigin src="/assets/index-
|
|
28
|
+
<script type="module" crossorigin src="/assets/index-DAHkvjY_.js"></script>
|
|
29
29
|
<link rel="modulepreload" crossorigin href="/assets/styles-DnkNzLDs.js">
|
|
30
30
|
<link rel="stylesheet" crossorigin href="/assets/styles-Ck7XEMka.css">
|
|
31
31
|
</head>
|