@chibitek/chibi 0.1.213 → 0.1.214
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/{TerminalPanel-mkQO42zG.js → TerminalPanel-B9u1SPIJ.js} +1 -1
- package/dist/assets/{abnfDiagram-O67JEVCF-D_YvZb12.js → abnfDiagram-O67JEVCF-DLKHvswB.js} +1 -1
- package/dist/assets/{arc-u7NcCAzn.js → arc-CT_EkJME.js} +1 -1
- package/dist/assets/{architectureDiagram-NJMV4G6O-CvoIt_0y.js → architectureDiagram-NJMV4G6O-Cr57hSCz.js} +1 -1
- package/dist/assets/{blockDiagram-BEXU5L5S-B0Ry3uOJ.js → blockDiagram-BEXU5L5S-D0kXMYp9.js} +1 -1
- package/dist/assets/{c4Diagram-YGBWAQC7-DQQBHqDt.js → c4Diagram-YGBWAQC7-DO8ibxIl.js} +1 -1
- package/dist/assets/channel-D__zUWCH.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-B4IxGiPz.js → chunk-2Q5K7J3B-B1pfwUYG.js} +1 -1
- package/dist/assets/{chunk-3FUC2YCW-BxR5i6Mq.js → chunk-3FUC2YCW-IFY2H2h0.js} +2 -2
- package/dist/assets/{chunk-5VM5RSS4-CqmFQLrB.js → chunk-5VM5RSS4-CB6AI6WN.js} +1 -1
- package/dist/assets/{chunk-GTNCS2PH-C9lKwjYE.js → chunk-GTNCS2PH-DJ6HW3xW.js} +1 -1
- package/dist/assets/{chunk-GWA4HPMP-DKAnucqk.js → chunk-GWA4HPMP-GQsHzpVv.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-CE4DRhto.js → chunk-JWPE2WC7-bEk7MgMp.js} +1 -1
- package/dist/assets/{chunk-NETBCI7D-UziBzgi9.js → chunk-NETBCI7D-DMnkFbzc.js} +1 -1
- package/dist/assets/{chunk-WEXAMYUT-DVo_P12S.js → chunk-WEXAMYUT-DK1Y5Lqz.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-CBwStBk5.js → chunk-XXDRQBXY-tEYduUGA.js} +1 -1
- package/dist/assets/{classDiagram-v2-NBCMYWYE-D4xfjrAt.js → classDiagram-v2-NBCMYWYE-C359202A.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-DNpZWduJ.js → cose-bilkent-JH36ORCC-umDDzyA6.js} +1 -1
- package/dist/assets/{cynefin-OW5HDTMX-CMegK4fD.js → cynefin-OW5HDTMX-CLFzOwUQ.js} +1 -1
- package/dist/assets/{cynefinDiagram-VND7K2PF-BBRJHq6u.js → cynefinDiagram-VND7K2PF-Dgsmj170.js} +1 -1
- package/dist/assets/{dagre-6A5THRUB-BwneJkAI.js → dagre-6A5THRUB-BphzZtyp.js} +1 -1
- package/dist/assets/{diagram-22UHCM2B-p4tq7l1f.js → diagram-22UHCM2B-DWV7hLJ-.js} +1 -1
- package/dist/assets/{diagram-3UASUU5V-C8BCnB5c.js → diagram-3UASUU5V-AAFcIzJf.js} +1 -1
- package/dist/assets/{diagram-ATOU4E4O-Da-Fc2pA.js → diagram-ATOU4E4O-BAFFwIW2.js} +1 -1
- package/dist/assets/{diagram-CDSNMT55-CH7l4Als.js → diagram-CDSNMT55-B8YeBwQF.js} +1 -1
- package/dist/assets/{diagram-MLGK6HIB-xO-efOVl.js → diagram-MLGK6HIB-KQTiCQZy.js} +1 -1
- package/dist/assets/{diagram-MPIPVDR6-CjWQ4FpH.js → diagram-MPIPVDR6-B9GZxZY6.js} +1 -1
- package/dist/assets/{ebnfDiagram-ZINNZB2B-DbyEj47I.js → ebnfDiagram-ZINNZB2B-OdFJszg6.js} +1 -1
- package/dist/assets/{elk-276RUBZZ-B0uak8Gs.js → elk-276RUBZZ-3z1fNqtE.js} +1 -1
- package/dist/assets/{erDiagram-OPXOYQCR-DHYzl46p.js → erDiagram-OPXOYQCR-CFIdS8ci.js} +1 -1
- package/dist/assets/{flowDiagram-KWPJA3E3-CjUIIif9.js → flowDiagram-KWPJA3E3-BQz8RfCq.js} +1 -1
- package/dist/assets/{ganttDiagram-FUAMR5RP-CPjVOkNO.js → ganttDiagram-FUAMR5RP-BzjyIEHj.js} +1 -1
- package/dist/assets/{gitGraphDiagram-X574FWY7-DnI_xNjh.js → gitGraphDiagram-X574FWY7-BduA844K.js} +1 -1
- package/dist/assets/{index-kYL6p_po.js → index-B2iS4X_f.js} +1 -1
- package/dist/assets/{index-C8wABnWu.js → index-DZVhBXFS.js} +5 -5
- package/dist/assets/{infoDiagram-VRGFBTTK-SXQSkFFT.js → infoDiagram-VRGFBTTK-BM3By-gM.js} +1 -1
- package/dist/assets/{ishikawaDiagram-OU5B5YK6-DF3AQU1D.js → ishikawaDiagram-OU5B5YK6-DS_5pa-v.js} +1 -1
- package/dist/assets/{journeyDiagram-ZHPQQLJL-IWRv1Evh.js → journeyDiagram-ZHPQQLJL-CdCG3WIh.js} +1 -1
- package/dist/assets/{kanban-definition-PNTS6WVX-BKpuGZmD.js → kanban-definition-PNTS6WVX-Byg5UqYJ.js} +1 -1
- package/dist/assets/{linear-S9gqQWWc.js → linear-CDV6zgxP.js} +1 -1
- package/dist/assets/{mermaid.core-BHRIdye5.js → mermaid.core-D31FuzHj.js} +5 -5
- package/dist/assets/{mindmap-definition-NLK3R4M7-BTD52Pxv.js → mindmap-definition-NLK3R4M7-u5bkqwma.js} +1 -1
- package/dist/assets/{pegDiagram-GJSIUBJH-C91CNvYA.js → pegDiagram-GJSIUBJH-B8uahXqZ.js} +1 -1
- package/dist/assets/{pieDiagram-5QR66LMP-0aP3PVSg.js → pieDiagram-5QR66LMP-Beji3_Lb.js} +1 -1
- package/dist/assets/{quadrantDiagram-O4NWA36T-CN-CB1dj.js → quadrantDiagram-O4NWA36T-BpbLoL7d.js} +1 -1
- package/dist/assets/{railroadDiagram-XR7U4H2S-DUwKNVqn.js → railroadDiagram-XR7U4H2S-Bjm_Cslm.js} +1 -1
- package/dist/assets/{requirementDiagram-PLB6GJNP-BwiKCqXR.js → requirementDiagram-PLB6GJNP-CqN7iivm.js} +1 -1
- package/dist/assets/{sankeyDiagram-IPEJSGJF-DK2nk983.js → sankeyDiagram-IPEJSGJF-CuH1ynLe.js} +1 -1
- package/dist/assets/{sequenceDiagram-PO4LG4MO-DGQaL2CK.js → sequenceDiagram-PO4LG4MO-CFYrTC70.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-DjxAs07q.js → sizeCapture-INFHLROL-BdnwdU8-.js} +1 -1
- package/dist/assets/{stateDiagram-v2-GCMORJYK-DfhvmAHx.js → stateDiagram-v2-GCMORJYK-CHGgtFqA.js} +1 -1
- package/dist/assets/{swimlanes-2SLR337P-g4YraApj.js → swimlanes-2SLR337P--Q3opHe5.js} +1 -1
- package/dist/assets/swimlanesDiagram-TC7HE7FX-DoO8fttf.js +8 -0
- package/dist/assets/{timeline-definition-EJHVYXUP-Bh6Ow15M.js → timeline-definition-EJHVYXUP-C8xegRju.js} +1 -1
- package/dist/assets/{usecaseDiagram-POWQR4AR-wRtBj8_e.js → usecaseDiagram-POWQR4AR-Bt5PpgS7.js} +1 -1
- package/dist/assets/{vennDiagram-UO4OBE2U-D4QR4Odj.js → vennDiagram-UO4OBE2U-BVfuyLk-.js} +1 -1
- package/dist/assets/{wardleyDiagram-VNRHLVJA-DthL_SDi.js → wardleyDiagram-VNRHLVJA-DOcd0zsh.js} +1 -1
- package/dist/assets/{xychartDiagram-PMCCYNJV-CK-QrbHO.js → xychartDiagram-PMCCYNJV-CsX4ff0v.js} +1 -1
- package/dist/index.html +1 -1
- package/dist-server/index.js +12 -2
- package/dist-server/server/system-prompt.js +13 -2
- package/package.json +1 -1
- package/dist/assets/channel-BG3AR6Y6.js +0 -1
- package/dist/assets/swimlanesDiagram-TC7HE7FX-BnxrvDBt.js +0 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalPanel-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalPanel-B9u1SPIJ.js","assets/TerminalPanel-DFuMZ0ql.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))o(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const r of s.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&o(r)}).observe(document,{childList:!0,subtree:!0});function a(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function o(i){if(i.ep)return;i.ep=!0;const s=a(i);fetch(i.href,s)}})();var SDe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function j4(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Fk={exports:{}},Em={};var F8;function tW(){if(F8)return Em;F8=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function a(o,i,s){var r=null;if(s!==void 0&&(r=""+s),i.key!==void 0&&(r=""+i.key),"key"in i){s={};for(var c in i)c!=="key"&&(s[c]=i[c])}else s=i;return i=s.ref,{$$typeof:e,type:o,key:r,ref:i!==void 0?i:null,props:s}}return Em.Fragment=t,Em.jsx=a,Em.jsxs=a,Em}var q8;function nW(){return q8||(q8=1,Fk.exports=tW()),Fk.exports}var n=nW(),qk={exports:{}},Wt={};var U8;function aW(){if(U8)return Wt;U8=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),r=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),b=Symbol.iterator;function x(Y){return Y===null||typeof Y!="object"?null:(Y=b&&Y[b]||Y["@@iterator"],typeof Y=="function"?Y:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,w={};function N(Y,ae,F){this.props=Y,this.context=ae,this.refs=w,this.updater=F||v}N.prototype.isReactComponent={},N.prototype.setState=function(Y,ae){if(typeof Y!="object"&&typeof Y!="function"&&Y!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,Y,ae,"setState")},N.prototype.forceUpdate=function(Y){this.updater.enqueueForceUpdate(this,Y,"forceUpdate")};function C(){}C.prototype=N.prototype;function j(Y,ae,F){this.props=Y,this.context=ae,this.refs=w,this.updater=F||v}var M=j.prototype=new C;M.constructor=j,k(M,N.prototype),M.isPureReactComponent=!0;var E=Array.isArray;function A(){}var R={H:null,A:null,T:null,S:null},B=Object.prototype.hasOwnProperty;function O(Y,ae,F){var pe=F.ref;return{$$typeof:e,type:Y,key:ae,ref:pe!==void 0?pe:null,props:F}}function T(Y,ae){return O(Y.type,ae,Y.props)}function z(Y){return typeof Y=="object"&&Y!==null&&Y.$$typeof===e}function P(Y){var ae={"=":"=0",":":"=2"};return"$"+Y.replace(/[=:]/g,function(F){return ae[F]})}var L=/\/+/g;function G(Y,ae){return typeof Y=="object"&&Y!==null&&Y.key!=null?P(""+Y.key):ae.toString(36)}function H(Y){switch(Y.status){case"fulfilled":return Y.value;case"rejected":throw Y.reason;default:switch(typeof Y.status=="string"?Y.then(A,A):(Y.status="pending",Y.then(function(ae){Y.status==="pending"&&(Y.status="fulfilled",Y.value=ae)},function(ae){Y.status==="pending"&&(Y.status="rejected",Y.reason=ae)})),Y.status){case"fulfilled":return Y.value;case"rejected":throw Y.reason}}throw Y}function $(Y,ae,F,pe,ge){var Ne=typeof Y;(Ne==="undefined"||Ne==="boolean")&&(Y=null);var ee=!1;if(Y===null)ee=!0;else switch(Ne){case"bigint":case"string":case"number":ee=!0;break;case"object":switch(Y.$$typeof){case e:case t:ee=!0;break;case h:return ee=Y._init,$(ee(Y._payload),ae,F,pe,ge)}}if(ee)return ge=ge(Y),ee=pe===""?"."+G(Y,0):pe,E(ge)?(F="",ee!=null&&(F=ee.replace(L,"$&/")+"/"),$(ge,ae,F,"",function(ne){return ne})):ge!=null&&(z(ge)&&(ge=T(ge,F+(ge.key==null||Y&&Y.key===ge.key?"":(""+ge.key).replace(L,"$&/")+"/")+ee)),ae.push(ge)),1;ee=0;var X=pe===""?".":pe+":";if(E(Y))for(var oe=0;oe<Y.length;oe++)pe=Y[oe],Ne=X+G(pe,oe),ee+=$(pe,ae,F,Ne,ge);else if(oe=x(Y),typeof oe=="function")for(Y=oe.call(Y),oe=0;!(pe=Y.next()).done;)pe=pe.value,Ne=X+G(pe,oe++),ee+=$(pe,ae,F,Ne,ge);else if(Ne==="object"){if(typeof Y.then=="function")return $(H(Y),ae,F,pe,ge);throw ae=String(Y),Error("Objects are not valid as a React child (found: "+(ae==="[object Object]"?"object with keys {"+Object.keys(Y).join(", ")+"}":ae)+"). If you meant to render a collection of children, use an array instead.")}return ee}function U(Y,ae,F){if(Y==null)return Y;var pe=[],ge=0;return $(Y,pe,"","",function(Ne){return ae.call(F,Ne,ge++)}),pe}function Q(Y){if(Y._status===-1){var ae=Y._result;ae=ae(),ae.then(function(F){(Y._status===0||Y._status===-1)&&(Y._status=1,Y._result=F)},function(F){(Y._status===0||Y._status===-1)&&(Y._status=2,Y._result=F)}),Y._status===-1&&(Y._status=0,Y._result=ae)}if(Y._status===1)return Y._result.default;throw Y._result}var W=typeof reportError=="function"?reportError:function(Y){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var ae=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof Y=="object"&&Y!==null&&typeof Y.message=="string"?String(Y.message):String(Y),error:Y});if(!window.dispatchEvent(ae))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",Y);return}console.error(Y)},q={map:U,forEach:function(Y,ae,F){U(Y,function(){ae.apply(this,arguments)},F)},count:function(Y){var ae=0;return U(Y,function(){ae++}),ae},toArray:function(Y){return U(Y,function(ae){return ae})||[]},only:function(Y){if(!z(Y))throw Error("React.Children.only expected to receive a single React element child.");return Y}};return Wt.Activity=g,Wt.Children=q,Wt.Component=N,Wt.Fragment=a,Wt.Profiler=i,Wt.PureComponent=j,Wt.StrictMode=o,Wt.Suspense=d,Wt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=R,Wt.__COMPILER_RUNTIME={__proto__:null,c:function(Y){return R.H.useMemoCache(Y)}},Wt.cache=function(Y){return function(){return Y.apply(null,arguments)}},Wt.cacheSignal=function(){return null},Wt.cloneElement=function(Y,ae,F){if(Y==null)throw Error("The argument must be a React element, but you passed "+Y+".");var pe=k({},Y.props),ge=Y.key;if(ae!=null)for(Ne in ae.key!==void 0&&(ge=""+ae.key),ae)!B.call(ae,Ne)||Ne==="key"||Ne==="__self"||Ne==="__source"||Ne==="ref"&&ae.ref===void 0||(pe[Ne]=ae[Ne]);var Ne=arguments.length-2;if(Ne===1)pe.children=F;else if(1<Ne){for(var ee=Array(Ne),X=0;X<Ne;X++)ee[X]=arguments[X+2];pe.children=ee}return O(Y.type,ge,pe)},Wt.createContext=function(Y){return Y={$$typeof:r,_currentValue:Y,_currentValue2:Y,_threadCount:0,Provider:null,Consumer:null},Y.Provider=Y,Y.Consumer={$$typeof:s,_context:Y},Y},Wt.createElement=function(Y,ae,F){var pe,ge={},Ne=null;if(ae!=null)for(pe in ae.key!==void 0&&(Ne=""+ae.key),ae)B.call(ae,pe)&&pe!=="key"&&pe!=="__self"&&pe!=="__source"&&(ge[pe]=ae[pe]);var ee=arguments.length-2;if(ee===1)ge.children=F;else if(1<ee){for(var X=Array(ee),oe=0;oe<ee;oe++)X[oe]=arguments[oe+2];ge.children=X}if(Y&&Y.defaultProps)for(pe in ee=Y.defaultProps,ee)ge[pe]===void 0&&(ge[pe]=ee[pe]);return O(Y,Ne,ge)},Wt.createRef=function(){return{current:null}},Wt.forwardRef=function(Y){return{$$typeof:c,render:Y}},Wt.isValidElement=z,Wt.lazy=function(Y){return{$$typeof:h,_payload:{_status:-1,_result:Y},_init:Q}},Wt.memo=function(Y,ae){return{$$typeof:p,type:Y,compare:ae===void 0?null:ae}},Wt.startTransition=function(Y){var ae=R.T,F={};R.T=F;try{var pe=Y(),ge=R.S;ge!==null&&ge(F,pe),typeof pe=="object"&&pe!==null&&typeof pe.then=="function"&&pe.then(A,W)}catch(Ne){W(Ne)}finally{ae!==null&&F.types!==null&&(ae.types=F.types),R.T=ae}},Wt.unstable_useCacheRefresh=function(){return R.H.useCacheRefresh()},Wt.use=function(Y){return R.H.use(Y)},Wt.useActionState=function(Y,ae,F){return R.H.useActionState(Y,ae,F)},Wt.useCallback=function(Y,ae){return R.H.useCallback(Y,ae)},Wt.useContext=function(Y){return R.H.useContext(Y)},Wt.useDebugValue=function(){},Wt.useDeferredValue=function(Y,ae){return R.H.useDeferredValue(Y,ae)},Wt.useEffect=function(Y,ae){return R.H.useEffect(Y,ae)},Wt.useEffectEvent=function(Y){return R.H.useEffectEvent(Y)},Wt.useId=function(){return R.H.useId()},Wt.useImperativeHandle=function(Y,ae,F){return R.H.useImperativeHandle(Y,ae,F)},Wt.useInsertionEffect=function(Y,ae){return R.H.useInsertionEffect(Y,ae)},Wt.useLayoutEffect=function(Y,ae){return R.H.useLayoutEffect(Y,ae)},Wt.useMemo=function(Y,ae){return R.H.useMemo(Y,ae)},Wt.useOptimistic=function(Y,ae){return R.H.useOptimistic(Y,ae)},Wt.useReducer=function(Y,ae,F){return R.H.useReducer(Y,ae,F)},Wt.useRef=function(Y){return R.H.useRef(Y)},Wt.useState=function(Y){return R.H.useState(Y)},Wt.useSyncExternalStore=function(Y,ae,F){return R.H.useSyncExternalStore(Y,ae,F)},Wt.useTransition=function(){return R.H.useTransition()},Wt.version="19.2.8",Wt}var V8;function N4(){return V8||(V8=1,qk.exports=aW()),qk.exports}var f=N4();const ka=j4(f);var Uk={exports:{}},Rm={},Vk={exports:{}},Hk={};var H8;function oW(){return H8||(H8=1,(function(e){function t($,U){var Q=$.length;$.push(U);e:for(;0<Q;){var W=Q-1>>>1,q=$[W];if(0<i(q,U))$[W]=U,$[Q]=q,Q=W;else break e}}function a($){return $.length===0?null:$[0]}function o($){if($.length===0)return null;var U=$[0],Q=$.pop();if(Q!==U){$[0]=Q;e:for(var W=0,q=$.length,Y=q>>>1;W<Y;){var ae=2*(W+1)-1,F=$[ae],pe=ae+1,ge=$[pe];if(0>i(F,Q))pe<q&&0>i(ge,F)?($[W]=ge,$[pe]=Q,W=pe):($[W]=F,$[ae]=Q,W=ae);else if(pe<q&&0>i(ge,Q))$[W]=ge,$[pe]=Q,W=pe;else break e}}return U}function i($,U){var Q=$.sortIndex-U.sortIndex;return Q!==0?Q:$.id-U.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var r=Date,c=r.now();e.unstable_now=function(){return r.now()-c}}var d=[],p=[],h=1,g=null,b=3,x=!1,v=!1,k=!1,w=!1,N=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function M($){for(var U=a(p);U!==null;){if(U.callback===null)o(p);else if(U.startTime<=$)o(p),U.sortIndex=U.expirationTime,t(d,U);else break;U=a(p)}}function E($){if(k=!1,M($),!v)if(a(d)!==null)v=!0,A||(A=!0,P());else{var U=a(p);U!==null&&H(E,U.startTime-$)}}var A=!1,R=-1,B=5,O=-1;function T(){return w?!0:!(e.unstable_now()-O<B)}function z(){if(w=!1,A){var $=e.unstable_now();O=$;var U=!0;try{e:{v=!1,k&&(k=!1,C(R),R=-1),x=!0;var Q=b;try{t:{for(M($),g=a(d);g!==null&&!(g.expirationTime>$&&T());){var W=g.callback;if(typeof W=="function"){g.callback=null,b=g.priorityLevel;var q=W(g.expirationTime<=$);if($=e.unstable_now(),typeof q=="function"){g.callback=q,M($),U=!0;break t}g===a(d)&&o(d),M($)}else o(d);g=a(d)}if(g!==null)U=!0;else{var Y=a(p);Y!==null&&H(E,Y.startTime-$),U=!1}}break e}finally{g=null,b=Q,x=!1}U=void 0}}finally{U?P():A=!1}}}var P;if(typeof j=="function")P=function(){j(z)};else if(typeof MessageChannel<"u"){var L=new MessageChannel,G=L.port2;L.port1.onmessage=z,P=function(){G.postMessage(null)}}else P=function(){N(z,0)};function H($,U){R=N(function(){$(e.unstable_now())},U)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function($){$.callback=null},e.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):B=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function($){switch(b){case 1:case 2:case 3:var U=3;break;default:U=b}var Q=b;b=U;try{return $()}finally{b=Q}},e.unstable_requestPaint=function(){w=!0},e.unstable_runWithPriority=function($,U){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var Q=b;b=$;try{return U()}finally{b=Q}},e.unstable_scheduleCallback=function($,U,Q){var W=e.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?W+Q:W):Q=W,$){case 1:var q=-1;break;case 2:q=250;break;case 5:q=1073741823;break;case 4:q=1e4;break;default:q=5e3}return q=Q+q,$={id:h++,callback:U,priorityLevel:$,startTime:Q,expirationTime:q,sortIndex:-1},Q>W?($.sortIndex=Q,t(p,$),a(d)===null&&$===a(p)&&(k?(C(R),R=-1):k=!0,H(E,Q-W))):($.sortIndex=q,t(d,$),v||x||(v=!0,A||(A=!0,P()))),$},e.unstable_shouldYield=T,e.unstable_wrapCallback=function($){var U=b;return function(){var Q=b;b=U;try{return $.apply(this,arguments)}finally{b=Q}}}})(Hk)),Hk}var $8;function iW(){return $8||($8=1,Vk.exports=oW()),Vk.exports}var $k={exports:{}},yo={};var G8;function sW(){if(G8)return yo;G8=1;var e=N4();function t(d){var p="https://react.dev/errors/"+d;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)p+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+d+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(){}var o={d:{f:a,r:function(){throw Error(t(522))},D:a,C:a,L:a,m:a,X:a,S:a,M:a},p:0,findDOMNode:null},i=Symbol.for("react.portal");function s(d,p,h){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:g==null?null:""+g,children:d,containerInfo:p,implementation:h}}var r=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(d,p){if(d==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return yo.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,yo.createPortal=function(d,p){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(t(299));return s(d,p,null,h)},yo.flushSync=function(d){var p=r.T,h=o.p;try{if(r.T=null,o.p=2,d)return d()}finally{r.T=p,o.p=h,o.d.f()}},yo.preconnect=function(d,p){typeof d=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,o.d.C(d,p))},yo.prefetchDNS=function(d){typeof d=="string"&&o.d.D(d)},yo.preinit=function(d,p){if(typeof d=="string"&&p&&typeof p.as=="string"){var h=p.as,g=c(h,p.crossOrigin),b=typeof p.integrity=="string"?p.integrity:void 0,x=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;h==="style"?o.d.S(d,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:g,integrity:b,fetchPriority:x}):h==="script"&&o.d.X(d,{crossOrigin:g,integrity:b,fetchPriority:x,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},yo.preinitModule=function(d,p){if(typeof d=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var h=c(p.as,p.crossOrigin);o.d.M(d,{crossOrigin:h,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&o.d.M(d)},yo.preload=function(d,p){if(typeof d=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var h=p.as,g=c(h,p.crossOrigin);o.d.L(d,h,{crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},yo.preloadModule=function(d,p){if(typeof d=="string")if(p){var h=c(p.as,p.crossOrigin);o.d.m(d,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:h,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else o.d.m(d)},yo.requestFormReset=function(d){o.d.r(d)},yo.unstable_batchedUpdates=function(d,p){return d(p)},yo.useFormState=function(d,p,h){return r.H.useFormState(d,p,h)},yo.useFormStatus=function(){return r.H.useHostTransitionStatus()},yo.version="19.2.8",yo}var K8;function dE(){if(K8)return $k.exports;K8=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),$k.exports=sW(),$k.exports}var W8;function rW(){if(W8)return Rm;W8=1;var e=iW(),t=N4(),a=dE();function o(u){var m="https://react.dev/errors/"+u;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)m+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+u+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(u){return!(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)}function s(u){var m=u,y=u;if(u.alternate)for(;m.return;)m=m.return;else{u=m;do m=u,(m.flags&4098)!==0&&(y=m.return),u=m.return;while(u)}return m.tag===3?y:null}function r(u){if(u.tag===13){var m=u.memoizedState;if(m===null&&(u=u.alternate,u!==null&&(m=u.memoizedState)),m!==null)return m.dehydrated}return null}function c(u){if(u.tag===31){var m=u.memoizedState;if(m===null&&(u=u.alternate,u!==null&&(m=u.memoizedState)),m!==null)return m.dehydrated}return null}function d(u){if(s(u)!==u)throw Error(o(188))}function p(u){var m=u.alternate;if(!m){if(m=s(u),m===null)throw Error(o(188));return m!==u?null:u}for(var y=u,S=m;;){var I=y.return;if(I===null)break;var D=I.alternate;if(D===null){if(S=I.return,S!==null){y=S;continue}break}if(I.child===D.child){for(D=I.child;D;){if(D===y)return d(I),u;if(D===S)return d(I),m;D=D.sibling}throw Error(o(188))}if(y.return!==S.return)y=I,S=D;else{for(var J=!1,ie=I.child;ie;){if(ie===y){J=!0,y=I,S=D;break}if(ie===S){J=!0,S=I,y=D;break}ie=ie.sibling}if(!J){for(ie=D.child;ie;){if(ie===y){J=!0,y=D,S=I;break}if(ie===S){J=!0,S=D,y=I;break}ie=ie.sibling}if(!J)throw Error(o(189))}}if(y.alternate!==S)throw Error(o(190))}if(y.tag!==3)throw Error(o(188));return y.stateNode.current===y?u:m}function h(u){var m=u.tag;if(m===5||m===26||m===27||m===6)return u;for(u=u.child;u!==null;){if(m=h(u),m!==null)return m;u=u.sibling}return null}var g=Object.assign,b=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),j=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),O=Symbol.for("react.activity"),T=Symbol.for("react.memo_cache_sentinel"),z=Symbol.iterator;function P(u){return u===null||typeof u!="object"?null:(u=z&&u[z]||u["@@iterator"],typeof u=="function"?u:null)}var L=Symbol.for("react.client.reference");function G(u){if(u==null)return null;if(typeof u=="function")return u.$$typeof===L?null:u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case k:return"Fragment";case N:return"Profiler";case w:return"StrictMode";case E:return"Suspense";case A:return"SuspenseList";case O:return"Activity"}if(typeof u=="object")switch(u.$$typeof){case v:return"Portal";case j:return u.displayName||"Context";case C:return(u._context.displayName||"Context")+".Consumer";case M:var m=u.render;return u=u.displayName,u||(u=m.displayName||m.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case R:return m=u.displayName||null,m!==null?m:G(u.type)||"Memo";case B:m=u._payload,u=u._init;try{return G(u(m))}catch{}}return null}var H=Array.isArray,$=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q={pending:!1,data:null,method:null,action:null},W=[],q=-1;function Y(u){return{current:u}}function ae(u){0>q||(u.current=W[q],W[q]=null,q--)}function F(u,m){q++,W[q]=u.current,u.current=m}var pe=Y(null),ge=Y(null),Ne=Y(null),ee=Y(null);function X(u,m){switch(F(Ne,m),F(ge,u),F(pe,null),m.nodeType){case 9:case 11:u=(u=m.documentElement)&&(u=u.namespaceURI)?c8(u):0;break;default:if(u=m.tagName,m=m.namespaceURI)m=c8(m),u=d8(m,u);else switch(u){case"svg":u=1;break;case"math":u=2;break;default:u=0}}ae(pe),F(pe,u)}function oe(){ae(pe),ae(ge),ae(Ne)}function ne(u){u.memoizedState!==null&&F(ee,u);var m=pe.current,y=d8(m,u.type);m!==y&&(F(ge,u),F(pe,y))}function Ce(u){ge.current===u&&(ae(pe),ae(ge)),ee.current===u&&(ae(ee),Im._currentValue=Q)}var le,re;function xe(u){if(le===void 0)try{throw Error()}catch(y){var m=y.stack.trim().match(/\n( *(at )?)/);le=m&&m[1]||"",re=-1<y.stack.indexOf(`
|
|
3
3
|
at`)?" (<anonymous>)":-1<y.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
4
4
|
`+le+u+re}var Te=!1;function nt(u,m){if(!u||Te)return"";Te=!0;var y=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var S={DetermineComponentFrameRoot:function(){try{if(m){var Xe=function(){throw Error()};if(Object.defineProperty(Xe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Xe,[])}catch(He){var qe=He}Reflect.construct(u,[],Xe)}else{try{Xe.call()}catch(He){qe=He}u.call(Xe.prototype)}}else{try{throw Error()}catch(He){qe=He}(Xe=u())&&typeof Xe.catch=="function"&&Xe.catch(function(){})}}catch(He){if(He&&qe&&typeof He.stack=="string")return[He.stack,qe.stack]}return[null,null]}};S.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var I=Object.getOwnPropertyDescriptor(S.DetermineComponentFrameRoot,"name");I&&I.configurable&&Object.defineProperty(S.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var D=S.DetermineComponentFrameRoot(),J=D[0],ie=D[1];if(J&&ie){var ye=J.split(`
|
|
@@ -84,7 +84,7 @@ Mochii`,"dictation.apps.title":"Застосунки","dictation.apps.subtitle":
|
|
|
84
84
|
|
|
85
85
|
`)}x.write("payload.value = newResult;"),x.write("return payload;");const C=x.compile();return(j,M)=>C(b,j,M)};let s;const r=og,c=!kS.jitless,p=c&&Jne.value,h=t.catchall;let g;e._zod.parse=(b,x)=>{g??(g=o.value);const v=b.value;return r(v)?c&&p&&x?.async===!1&&x.jitless!==!0?(s||(s=i(t.shape)),b=s(b,x),h?$D([],v,b,x,g,e):b):a(b,x):(b.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),b)}});function K7(e,t,a,o){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const i=e.filter(s=>!Tu(s));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:a,errors:e.map(s=>s.issues.map(r=>md(r,o,pd())))}),t)}const GD=Qe("$ZodUnion",(e,t)=>{fa.init(e,t),Bn(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Bn(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Bn(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),Bn(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>SS(i.source)).join("|")})$`)}});const a=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,i)=>{if(a)return a(o,i);let s=!1;const r=[];for(const c of t.options){const d=c._zod.run({value:o.value,issues:[]},i);if(d instanceof Promise)r.push(d),s=!0;else{if(d.issues.length===0)return d;r.push(d)}}return s?Promise.all(r).then(c=>K7(c,o,e,i)):K7(r,o,e,i)}}),Loe=Qe("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,GD.init(e,t);const a=e._zod.parse;Bn(e._zod,"propValues",()=>{const i={};for(const s of t.options){const r=s._zod.propValues;if(!r||Object.keys(r).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[c,d]of Object.entries(r)){i[c]||(i[c]=new Set);for(const p of d)i[c].add(p)}}return i});const o=T0(()=>{const i=t.options,s=new Map;for(const r of i){const c=r._zod.propValues?.[t.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(const d of c){if(s.has(d))throw new Error(`Duplicate discriminator value "${String(d)}"`);s.set(d,r)}}return s});e._zod.parse=(i,s)=>{const r=i.value;if(!og(r))return i.issues.push({code:"invalid_type",expected:"object",input:r,inst:e}),i;const c=o.value.get(r?.[t.discriminator]);return c?c._zod.run(i,s):t.unionFallback||s.direction==="backward"?a(i,s):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()),input:r,path:[t.discriminator],inst:e}),i)}}),_oe=Qe("$ZodIntersection",(e,t)=>{fa.init(e,t),e._zod.parse=(a,o)=>{const i=a.value,s=t.left._zod.run({value:i,issues:[]},o),r=t.right._zod.run({value:i,issues:[]},o);return s instanceof Promise||r instanceof Promise?Promise.all([s,r]).then(([d,p])=>W7(a,d,p)):W7(a,s,r)}});function b3(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ig(e)&&ig(t)){const a=Object.keys(t),o=Object.keys(e).filter(s=>a.indexOf(s)!==-1),i={...e,...t};for(const s of o){const r=b3(e[s],t[s]);if(!r.valid)return{valid:!1,mergeErrorPath:[s,...r.mergeErrorPath]};i[s]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const a=[];for(let o=0;o<e.length;o++){const i=e[o],s=t[o],r=b3(i,s);if(!r.valid)return{valid:!1,mergeErrorPath:[o,...r.mergeErrorPath]};a.push(r.data)}return{valid:!0,data:a}}return{valid:!1,mergeErrorPath:[]}}function W7(e,t,a){const o=new Map;let i;for(const c of t.issues)if(c.code==="unrecognized_keys"){i??(i=c);for(const d of c.keys)o.has(d)||o.set(d,{}),o.get(d).l=!0}else e.issues.push(c);for(const c of a.issues)if(c.code==="unrecognized_keys")for(const d of c.keys)o.has(d)||o.set(d,{}),o.get(d).r=!0;else e.issues.push(c);const s=[...o].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(s.length&&i&&e.issues.push({...i,keys:s}),Tu(e))return e;const r=b3(t.value,a.value);if(!r.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}const Foe=Qe("$ZodEnum",(e,t)=>{fa.init(e,t);const a=ID(t.entries),o=new Set(a);e._zod.values=o,e._zod.pattern=new RegExp(`^(${a.filter(i=>Yne.has(typeof i)).map(i=>typeof i=="string"?np(i):i.toString()).join("|")})$`),e._zod.parse=(i,s)=>{const r=i.value;return o.has(r)||i.issues.push({code:"invalid_value",values:a,input:r,inst:e}),i}}),qoe=Qe("$ZodLiteral",(e,t)=>{if(fa.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const a=new Set(t.values);e._zod.values=a,e._zod.pattern=new RegExp(`^(${t.values.map(o=>typeof o=="string"?np(o):o?np(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,i)=>{const s=o.value;return a.has(s)||o.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),o}}),Uoe=Qe("$ZodTransform",(e,t)=>{fa.init(e,t),e._zod.optin="optional",e._zod.parse=(a,o)=>{if(o.direction==="backward")throw new MD(e.constructor.name);const i=t.transform(a.value,a);if(o.async)return(i instanceof Promise?i:Promise.resolve(i)).then(r=>(a.value=r,a.fallback=!0,a));if(i instanceof Promise)throw new Uu;return a.value=i,a.fallback=!0,a}});function J7(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const KD=Qe("$ZodOptional",(e,t)=>{fa.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Bn(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Bn(e._zod,"pattern",()=>{const a=t.innerType._zod.pattern;return a?new RegExp(`^(${SS(a.source)})?$`):void 0}),e._zod.parse=(a,o)=>{if(t.innerType._zod.optin==="optional"){const i=a.value,s=t.innerType._zod.run(a,o);return s instanceof Promise?s.then(r=>J7(r,i)):J7(s,i)}return a.value===void 0?a:t.innerType._zod.run(a,o)}}),Voe=Qe("$ZodExactOptional",(e,t)=>{KD.init(e,t),Bn(e._zod,"values",()=>t.innerType._zod.values),Bn(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(a,o)=>t.innerType._zod.run(a,o)}),Hoe=Qe("$ZodNullable",(e,t)=>{fa.init(e,t),Bn(e._zod,"optin",()=>t.innerType._zod.optin),Bn(e._zod,"optout",()=>t.innerType._zod.optout),Bn(e._zod,"pattern",()=>{const a=t.innerType._zod.pattern;return a?new RegExp(`^(${SS(a.source)}|null)$`):void 0}),Bn(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(a,o)=>a.value===null?a:t.innerType._zod.run(a,o)}),$oe=Qe("$ZodDefault",(e,t)=>{fa.init(e,t),e._zod.optin="optional",Bn(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(a,o)=>{if(o.direction==="backward")return t.innerType._zod.run(a,o);if(a.value===void 0)return a.value=t.defaultValue,a;const i=t.innerType._zod.run(a,o);return i instanceof Promise?i.then(s=>Y7(s,t)):Y7(i,t)}});function Y7(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Goe=Qe("$ZodPrefault",(e,t)=>{fa.init(e,t),e._zod.optin="optional",Bn(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(a,o)=>(o.direction==="backward"||a.value===void 0&&(a.value=t.defaultValue),t.innerType._zod.run(a,o))}),Koe=Qe("$ZodNonOptional",(e,t)=>{fa.init(e,t),Bn(e._zod,"values",()=>{const a=t.innerType._zod.values;return a?new Set([...a].filter(o=>o!==void 0)):void 0}),e._zod.parse=(a,o)=>{const i=t.innerType._zod.run(a,o);return i instanceof Promise?i.then(s=>Z7(s,e)):Z7(i,e)}});function Z7(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Woe=Qe("$ZodCatch",(e,t)=>{fa.init(e,t),e._zod.optin="optional",Bn(e._zod,"optout",()=>t.innerType._zod.optout),Bn(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(a,o)=>{if(o.direction==="backward")return t.innerType._zod.run(a,o);const i=t.innerType._zod.run(a,o);return i instanceof Promise?i.then(s=>(a.value=s.value,s.issues.length&&(a.value=t.catchValue({...a,error:{issues:s.issues.map(r=>md(r,o,pd()))},input:a.value}),a.issues=[],a.fallback=!0),a)):(a.value=i.value,i.issues.length&&(a.value=t.catchValue({...a,error:{issues:i.issues.map(s=>md(s,o,pd()))},input:a.value}),a.issues=[],a.fallback=!0),a)}}),Joe=Qe("$ZodPipe",(e,t)=>{fa.init(e,t),Bn(e._zod,"values",()=>t.in._zod.values),Bn(e._zod,"optin",()=>t.in._zod.optin),Bn(e._zod,"optout",()=>t.out._zod.optout),Bn(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(a,o)=>{if(o.direction==="backward"){const s=t.out._zod.run(a,o);return s instanceof Promise?s.then(r=>Sb(r,t.in,o)):Sb(s,t.in,o)}const i=t.in._zod.run(a,o);return i instanceof Promise?i.then(s=>Sb(s,t.out,o)):Sb(i,t.out,o)}});function Sb(e,t,a){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},a)}const Yoe=Qe("$ZodReadonly",(e,t)=>{fa.init(e,t),Bn(e._zod,"propValues",()=>t.innerType._zod.propValues),Bn(e._zod,"values",()=>t.innerType._zod.values),Bn(e._zod,"optin",()=>t.innerType?._zod?.optin),Bn(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(a,o)=>{if(o.direction==="backward")return t.innerType._zod.run(a,o);const i=t.innerType._zod.run(a,o);return i instanceof Promise?i.then(Q7):Q7(i)}});function Q7(e){return e.value=Object.freeze(e.value),e}const Zoe=Qe("$ZodCustom",(e,t)=>{ei.init(e,t),fa.init(e,t),e._zod.parse=(a,o)=>a,e._zod.check=a=>{const o=a.value,i=t.fn(o);if(i instanceof Promise)return i.then(s=>X7(s,a,o,e));X7(i,a,o,e)}});function X7(e,t,a,o){if(!e){const i={code:"custom",input:a,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(i.params=o._zod.def.params),t.issues.push(sg(i))}}var eM;class Qoe{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...a){const o=a[0];return this._map.set(t,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const a=this._map.get(t);return a&&typeof a=="object"&&"id"in a&&this._idmap.delete(a.id),this._map.delete(t),this}get(t){const a=t._zod.parent;if(a){const o={...this.get(a)??{}};delete o.id;const i={...o,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Xoe(){return new Qoe}(eM=globalThis).__zod_globalRegistry??(eM.__zod_globalRegistry=Xoe());const ph=globalThis.__zod_globalRegistry;function eie(e,t){return new e({type:"string",...Bt(t)})}function tie(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Bt(t)})}function tM(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Bt(t)})}function nie(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Bt(t)})}function aie(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Bt(t)})}function oie(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Bt(t)})}function iie(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Bt(t)})}function sie(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Bt(t)})}function rie(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Bt(t)})}function lie(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Bt(t)})}function cie(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Bt(t)})}function die(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Bt(t)})}function uie(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Bt(t)})}function pie(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Bt(t)})}function mie(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Bt(t)})}function hie(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Bt(t)})}function gie(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Bt(t)})}function fie(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Bt(t)})}function bie(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Bt(t)})}function yie(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Bt(t)})}function xie(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Bt(t)})}function vie(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Bt(t)})}function kie(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Bt(t)})}function wie(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Bt(t)})}function Sie(e,t){return new e({type:"string",format:"date",check:"string_format",...Bt(t)})}function Cie(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Bt(t)})}function jie(e,t){return new e({type:"string",format:"duration",check:"string_format",...Bt(t)})}function Nie(e,t){return new e({type:"number",checks:[],...Bt(t)})}function Aie(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Bt(t)})}function Mie(e,t){return new e({type:"boolean",...Bt(t)})}function Iie(e){return new e({type:"unknown"})}function Pie(e,t){return new e({type:"never",...Bt(t)})}function nM(e,t){return new FD({check:"less_than",...Bt(t),value:e,inclusive:!1})}function nw(e,t){return new FD({check:"less_than",...Bt(t),value:e,inclusive:!0})}function aM(e,t){return new qD({check:"greater_than",...Bt(t),value:e,inclusive:!1})}function aw(e,t){return new qD({check:"greater_than",...Bt(t),value:e,inclusive:!0})}function oM(e,t){return new Gae({check:"multiple_of",...Bt(t),value:e})}function WD(e,t){return new Wae({check:"max_length",...Bt(t),maximum:e})}function mx(e,t){return new Jae({check:"min_length",...Bt(t),minimum:e})}function JD(e,t){return new Yae({check:"length_equals",...Bt(t),length:e})}function Tie(e,t){return new Zae({check:"string_format",format:"regex",...Bt(t),pattern:e})}function Bie(e){return new Qae({check:"string_format",format:"lowercase",...Bt(e)})}function Eie(e){return new Xae({check:"string_format",format:"uppercase",...Bt(e)})}function Rie(e,t){return new eoe({check:"string_format",format:"includes",...Bt(t),includes:e})}function Die(e,t){return new toe({check:"string_format",format:"starts_with",...Bt(t),prefix:e})}function Oie(e,t){return new noe({check:"string_format",format:"ends_with",...Bt(t),suffix:e})}function jp(e){return new aoe({check:"overwrite",tx:e})}function zie(e){return jp(t=>t.normalize(e))}function Lie(){return jp(e=>e.trim())}function _ie(){return jp(e=>e.toLowerCase())}function Fie(){return jp(e=>e.toUpperCase())}function qie(){return jp(e=>Wne(e))}function Uie(e,t,a){return new e({type:"array",element:t,...Bt(a)})}function Vie(e,t,a){return new e({type:"custom",check:"custom",fn:t,...Bt(a)})}function Hie(e,t){const a=$ie(o=>(o.addIssue=i=>{if(typeof i=="string")o.issues.push(sg(i,o.value,a._zod.def));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=o.value),s.inst??(s.inst=a),s.continue??(s.continue=!a._zod.def.abort),o.issues.push(sg(s))}},e(o.value,o)),t);return a}function $ie(e,t){const a=new ei({check:"custom",...Bt(t)});return a._zod.check=e,a}function YD(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??ph,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function mo(e,t,a={path:[],schemaPath:[]}){var o;const i=e._zod.def,s=t.seen.get(e);if(s)return s.count++,a.schemaPath.includes(e)&&(s.cycle=a.path),s.schema;const r={schema:{},count:1,cycle:void 0,path:a.path};t.seen.set(e,r);const c=e._zod.toJSONSchema?.();if(c)r.schema=c;else{const h={...a,schemaPath:[...a.schemaPath,e],path:a.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,r.schema,h);else{const b=r.schema,x=t.processors[i.type];if(!x)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);x(e,t,b,h)}const g=e._zod.parent;g&&(r.ref||(r.ref=g),mo(g,t,h),t.seen.get(g).isParent=!0)}const d=t.metadataRegistry.get(e);return d&&Object.assign(r.schema,d),t.io==="input"&&Po(e)&&(delete r.schema.examples,delete r.schema.default),t.io==="input"&&"_prefault"in r.schema&&((o=r.schema).default??(o.default=r.schema._prefault)),delete r.schema._prefault,t.seen.get(e).schema}function ZD(e,t){const a=e.seen.get(t);if(!a)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=new Map;for(const r of e.seen.entries()){const c=e.metadataRegistry.get(r[0])?.id;if(c){const d=o.get(c);if(d&&d!==r[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(c,r[0])}}const i=r=>{const c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const g=e.external.registry.get(r[0])?.id,b=e.external.uri??(v=>v);if(g)return{ref:b(g)};const x=r[1].defId??r[1].schema.id??`schema${e.counter++}`;return r[1].defId=x,{defId:x,ref:`${b("__shared")}#/${c}/${x}`}}if(r[1]===a)return{ref:"#"};const p=`#/${c}/`,h=r[1].schema.id??`__schema${e.counter++}`;return{defId:h,ref:p+h}},s=r=>{if(r[1].schema.$ref)return;const c=r[1],{ref:d,defId:p}=i(r);c.def={...c.schema},p&&(c.defId=p);const h=c.schema;for(const g in h)delete h[g];h.$ref=d};if(e.cycles==="throw")for(const r of e.seen.entries()){const c=r[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
86
86
|
|
|
87
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const r of e.seen.entries()){const c=r[1];if(t===r[0]){s(r);continue}if(e.external){const p=e.external.registry.get(r[0])?.id;if(t!==r[0]&&p){s(r);continue}}if(e.metadataRegistry.get(r[0])?.id){s(r);continue}if(c.cycle){s(r);continue}if(c.count>1&&e.reused==="ref"){s(r);continue}}}function QD(e,t){const a=e.seen.get(t);if(!a)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=c=>{const d=e.seen.get(c);if(d.ref===null)return;const p=d.def??d.schema,h={...p},g=d.ref;if(d.ref=null,g){o(g);const x=e.seen.get(g),v=x.schema;if(v.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(v)):Object.assign(p,v),Object.assign(p,h),c._zod.parent===g)for(const w in p)w==="$ref"||w==="allOf"||w in h||delete p[w];if(v.$ref&&x.def)for(const w in p)w==="$ref"||w==="allOf"||w in x.def&&JSON.stringify(p[w])===JSON.stringify(x.def[w])&&delete p[w]}const b=c._zod.parent;if(b&&b!==g){o(b);const x=e.seen.get(b);if(x?.schema.$ref&&(p.$ref=x.schema.$ref,x.def))for(const v in p)v==="$ref"||v==="allOf"||v in x.def&&JSON.stringify(p[v])===JSON.stringify(x.def[v])&&delete p[v]}e.override({zodSchema:c,jsonSchema:p,path:d.path??[]})};for(const c of[...e.seen.entries()].reverse())o(c[0]);const i={};if(e.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(c)}Object.assign(i,a.def??a.schema);const s=e.metadataRegistry.get(t)?.id;s!==void 0&&i.id===s&&delete i.id;const r=e.external?.defs??{};for(const c of e.seen.entries()){const d=c[1];d.def&&d.defId&&(d.def.id===d.defId&&delete d.def.id,r[d.defId]=d.def)}e.external||Object.keys(r).length>0&&(e.target==="draft-2020-12"?i.$defs=r:i.definitions=r);try{const c=JSON.parse(JSON.stringify(i));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:hx(t,"input",e.processors),output:hx(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function Po(e,t){const a=t??{seen:new Set};if(a.seen.has(e))return!1;a.seen.add(e);const o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return Po(o.element,a);if(o.type==="set")return Po(o.valueType,a);if(o.type==="lazy")return Po(o.getter(),a);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return Po(o.innerType,a);if(o.type==="intersection")return Po(o.left,a)||Po(o.right,a);if(o.type==="record"||o.type==="map")return Po(o.keyType,a)||Po(o.valueType,a);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Po(o.in,a)||Po(o.out,a);if(o.type==="object"){for(const i in o.shape)if(Po(o.shape[i],a))return!0;return!1}if(o.type==="union"){for(const i of o.options)if(Po(i,a))return!0;return!1}if(o.type==="tuple"){for(const i of o.items)if(Po(i,a))return!0;return!!(o.rest&&Po(o.rest,a))}return!1}const Gie=(e,t={})=>a=>{const o=YD({...a,processors:t});return mo(e,o),ZD(o,e),QD(o,e)},hx=(e,t,a={})=>o=>{const{libraryOptions:i,target:s}=o??{},r=YD({...i??{},target:s,io:t,processors:a});return mo(e,r),ZD(r,e),QD(r,e)},Kie={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Wie=(e,t,a,o)=>{const i=a;i.type="string";const{minimum:s,maximum:r,format:c,patterns:d,contentEncoding:p}=e._zod.bag;if(typeof s=="number"&&(i.minLength=s),typeof r=="number"&&(i.maxLength=r),c&&(i.format=Kie[c]??c,i.format===""&&delete i.format,c==="time"&&delete i.format),p&&(i.contentEncoding=p),d&&d.size>0){const h=[...d];h.length===1?i.pattern=h[0].source:h.length>1&&(i.allOf=[...h.map(g=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))])}},Jie=(e,t,a,o)=>{const i=a,{minimum:s,maximum:r,format:c,multipleOf:d,exclusiveMaximum:p,exclusiveMinimum:h}=e._zod.bag;typeof c=="string"&&c.includes("int")?i.type="integer":i.type="number";const g=typeof h=="number"&&h>=(s??Number.NEGATIVE_INFINITY),b=typeof p=="number"&&p<=(r??Number.POSITIVE_INFINITY),x=t.target==="draft-04"||t.target==="openapi-3.0";g?x?(i.minimum=h,i.exclusiveMinimum=!0):i.exclusiveMinimum=h:typeof s=="number"&&(i.minimum=s),b?x?(i.maximum=p,i.exclusiveMaximum=!0):i.exclusiveMaximum=p:typeof r=="number"&&(i.maximum=r),typeof d=="number"&&(i.multipleOf=d)},Yie=(e,t,a,o)=>{a.type="boolean"},Zie=(e,t,a,o)=>{a.not={}},Qie=(e,t,a,o)=>{},Xie=(e,t,a,o)=>{const i=e._zod.def,s=ID(i.entries);s.every(r=>typeof r=="number")&&(a.type="number"),s.every(r=>typeof r=="string")&&(a.type="string"),a.enum=s},ese=(e,t,a,o)=>{const i=e._zod.def,s=[];for(const r of i.values)if(r===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof r=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(r))}else s.push(r);if(s.length!==0)if(s.length===1){const r=s[0];a.type=r===null?"null":typeof r,t.target==="draft-04"||t.target==="openapi-3.0"?a.enum=[r]:a.const=r}else s.every(r=>typeof r=="number")&&(a.type="number"),s.every(r=>typeof r=="string")&&(a.type="string"),s.every(r=>typeof r=="boolean")&&(a.type="boolean"),s.every(r=>r===null)&&(a.type="null"),a.enum=s},tse=(e,t,a,o)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},nse=(e,t,a,o)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},ase=(e,t,a,o)=>{const i=a,s=e._zod.def,{minimum:r,maximum:c}=e._zod.bag;typeof r=="number"&&(i.minItems=r),typeof c=="number"&&(i.maxItems=c),i.type="array",i.items=mo(s.element,t,{...o,path:[...o.path,"items"]})},ose=(e,t,a,o)=>{const i=a,s=e._zod.def;i.type="object",i.properties={};const r=s.shape;for(const p in r)i.properties[p]=mo(r[p],t,{...o,path:[...o.path,"properties",p]});const c=new Set(Object.keys(r)),d=new Set([...c].filter(p=>{const h=s.shape[p]._zod;return t.io==="input"?h.optin===void 0:h.optout===void 0}));d.size>0&&(i.required=Array.from(d)),s.catchall?._zod.def.type==="never"?i.additionalProperties=!1:s.catchall?s.catchall&&(i.additionalProperties=mo(s.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},ise=(e,t,a,o)=>{const i=e._zod.def,s=i.inclusive===!1,r=i.options.map((c,d)=>mo(c,t,{...o,path:[...o.path,s?"oneOf":"anyOf",d]}));s?a.oneOf=r:a.anyOf=r},sse=(e,t,a,o)=>{const i=e._zod.def,s=mo(i.left,t,{...o,path:[...o.path,"allOf",0]}),r=mo(i.right,t,{...o,path:[...o.path,"allOf",1]}),c=p=>"allOf"in p&&Object.keys(p).length===1,d=[...c(s)?s.allOf:[s],...c(r)?r.allOf:[r]];a.allOf=d},rse=(e,t,a,o)=>{const i=e._zod.def,s=mo(i.innerType,t,o),r=t.seen.get(e);t.target==="openapi-3.0"?(r.ref=i.innerType,a.nullable=!0):a.anyOf=[s,{type:"null"}]},lse=(e,t,a,o)=>{const i=e._zod.def;mo(i.innerType,t,o);const s=t.seen.get(e);s.ref=i.innerType},cse=(e,t,a,o)=>{const i=e._zod.def;mo(i.innerType,t,o);const s=t.seen.get(e);s.ref=i.innerType,a.default=JSON.parse(JSON.stringify(i.defaultValue))},dse=(e,t,a,o)=>{const i=e._zod.def;mo(i.innerType,t,o);const s=t.seen.get(e);s.ref=i.innerType,t.io==="input"&&(a._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},use=(e,t,a,o)=>{const i=e._zod.def;mo(i.innerType,t,o);const s=t.seen.get(e);s.ref=i.innerType;let r;try{r=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}a.default=r},pse=(e,t,a,o)=>{const i=e._zod.def,s=i.in._zod.traits.has("$ZodTransform"),r=t.io==="input"?s?i.out:i.in:i.out;mo(r,t,o);const c=t.seen.get(e);c.ref=r},mse=(e,t,a,o)=>{const i=e._zod.def;mo(i.innerType,t,o);const s=t.seen.get(e);s.ref=i.innerType,a.readOnly=!0},XD=(e,t,a,o)=>{const i=e._zod.def;mo(i.innerType,t,o);const s=t.seen.get(e);s.ref=i.innerType},hse=Qe("ZodISODateTime",(e,t)=>{boe.init(e,t),ca.init(e,t)});function gse(e){return wie(hse,e)}const fse=Qe("ZodISODate",(e,t)=>{yoe.init(e,t),ca.init(e,t)});function bse(e){return Sie(fse,e)}const yse=Qe("ZodISOTime",(e,t)=>{xoe.init(e,t),ca.init(e,t)});function xse(e){return Cie(yse,e)}const vse=Qe("ZodISODuration",(e,t)=>{voe.init(e,t),ca.init(e,t)});function kse(e){return jie(vse,e)}const wse=(e,t)=>{RD.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:a=>lae(e,a)},flatten:{value:a=>rae(e,a)},addIssue:{value:a=>{e.issues.push(a),e.message=JSON.stringify(e.issues,f3,2)}},addIssues:{value:a=>{e.issues.push(...a),e.message=JSON.stringify(e.issues,f3,2)}},isEmpty:{get(){return e.issues.length===0}}})},Yi=Qe("ZodError",wse,{Parent:Error}),Sse=jS(Yi),Cse=NS(Yi),jse=B0(Yi),Nse=E0(Yi),Ase=uae(Yi),Mse=pae(Yi),Ise=mae(Yi),Pse=hae(Yi),Tse=gae(Yi),Bse=fae(Yi),Ese=bae(Yi),Rse=yae(Yi),iM=new WeakMap;function Og(e,t,a){const o=Object.getPrototypeOf(e);let i=iM.get(o);if(i||(i=new Set,iM.set(o,i)),!i.has(t)){i.add(t);for(const s in a){const r=a[s];Object.defineProperty(o,s,{configurable:!0,enumerable:!1,get(){const c=r.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:c}),c},set(c){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:c})}})}}}const ba=Qe("ZodType",(e,t)=>(fa.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:hx(e,"input"),output:hx(e,"output")}}),e.toJSONSchema=Gie(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(a,o)=>Sse(e,a,o,{callee:e.parse}),e.safeParse=(a,o)=>jse(e,a,o),e.parseAsync=async(a,o)=>Cse(e,a,o,{callee:e.parseAsync}),e.safeParseAsync=async(a,o)=>Nse(e,a,o),e.spa=e.safeParseAsync,e.encode=(a,o)=>Ase(e,a,o),e.decode=(a,o)=>Mse(e,a,o),e.encodeAsync=async(a,o)=>Ise(e,a,o),e.decodeAsync=async(a,o)=>Pse(e,a,o),e.safeEncode=(a,o)=>Tse(e,a,o),e.safeDecode=(a,o)=>Bse(e,a,o),e.safeEncodeAsync=async(a,o)=>Ese(e,a,o),e.safeDecodeAsync=async(a,o)=>Rse(e,a,o),Og(e,"ZodType",{check(...a){const o=this.def;return this.clone(Zl(o,{checks:[...o.checks??[],...a.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...a){return this.check(...a)},clone(a,o){return Ql(this,a,o)},brand(){return this},register(a,o){return a.add(this,o),this},refine(a,o){return this.check(Nre(a,o))},superRefine(a,o){return this.check(Are(a,o))},overwrite(a){return this.check(jp(a))},optional(){return cM(this)},exactOptional(){return mre(this)},nullable(){return dM(this)},nullish(){return cM(dM(this))},nonoptional(a){return xre(this,a)},array(){return Qa(this)},or(a){return aO([this,a])},and(a){return lre(this,a)},transform(a){return uM(this,ure(a))},default(a){return fre(this,a)},prefault(a){return yre(this,a)},catch(a){return kre(this,a)},pipe(a){return uM(this,a)},readonly(){return Cre(this)},describe(a){const o=this.clone();return ph.add(o,{description:a}),o},meta(...a){if(a.length===0)return ph.get(this);const o=this.clone();return ph.add(o,a[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(a){return a(this)}}),Object.defineProperty(e,"description",{get(){return ph.get(e)?.description},configurable:!0}),e)),eO=Qe("_ZodString",(e,t)=>{AS.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(o,i,s)=>Wie(e,o,i);const a=e._zod.bag;e.format=a.format??null,e.minLength=a.minimum??null,e.maxLength=a.maximum??null,Og(e,"_ZodString",{regex(...o){return this.check(Tie(...o))},includes(...o){return this.check(Rie(...o))},startsWith(...o){return this.check(Die(...o))},endsWith(...o){return this.check(Oie(...o))},min(...o){return this.check(mx(...o))},max(...o){return this.check(WD(...o))},length(...o){return this.check(JD(...o))},nonempty(...o){return this.check(mx(1,...o))},lowercase(o){return this.check(Bie(o))},uppercase(o){return this.check(Eie(o))},trim(){return this.check(Lie())},normalize(...o){return this.check(zie(...o))},toLowerCase(){return this.check(_ie())},toUpperCase(){return this.check(Fie())},slugify(){return this.check(qie())}})}),Dse=Qe("ZodString",(e,t)=>{AS.init(e,t),eO.init(e,t),e.email=a=>e.check(tie(Ose,a)),e.url=a=>e.check(sie(zse,a)),e.jwt=a=>e.check(kie(Qse,a)),e.emoji=a=>e.check(rie(Lse,a)),e.guid=a=>e.check(tM(sM,a)),e.uuid=a=>e.check(nie(Cb,a)),e.uuidv4=a=>e.check(aie(Cb,a)),e.uuidv6=a=>e.check(oie(Cb,a)),e.uuidv7=a=>e.check(iie(Cb,a)),e.nanoid=a=>e.check(lie(_se,a)),e.guid=a=>e.check(tM(sM,a)),e.cuid=a=>e.check(cie(Fse,a)),e.cuid2=a=>e.check(die(qse,a)),e.ulid=a=>e.check(uie(Use,a)),e.base64=a=>e.check(yie(Jse,a)),e.base64url=a=>e.check(xie(Yse,a)),e.xid=a=>e.check(pie(Vse,a)),e.ksuid=a=>e.check(mie(Hse,a)),e.ipv4=a=>e.check(hie($se,a)),e.ipv6=a=>e.check(gie(Gse,a)),e.cidrv4=a=>e.check(fie(Kse,a)),e.cidrv6=a=>e.check(bie(Wse,a)),e.e164=a=>e.check(vie(Zse,a)),e.datetime=a=>e.check(gse(a)),e.date=a=>e.check(bse(a)),e.time=a=>e.check(xse(a)),e.duration=a=>e.check(kse(a))});function dn(e){return eie(Dse,e)}const ca=Qe("ZodStringFormat",(e,t)=>{aa.init(e,t),eO.init(e,t)}),Ose=Qe("ZodEmail",(e,t)=>{loe.init(e,t),ca.init(e,t)}),sM=Qe("ZodGUID",(e,t)=>{soe.init(e,t),ca.init(e,t)}),Cb=Qe("ZodUUID",(e,t)=>{roe.init(e,t),ca.init(e,t)}),zse=Qe("ZodURL",(e,t)=>{coe.init(e,t),ca.init(e,t)}),Lse=Qe("ZodEmoji",(e,t)=>{doe.init(e,t),ca.init(e,t)}),_se=Qe("ZodNanoID",(e,t)=>{uoe.init(e,t),ca.init(e,t)}),Fse=Qe("ZodCUID",(e,t)=>{poe.init(e,t),ca.init(e,t)}),qse=Qe("ZodCUID2",(e,t)=>{moe.init(e,t),ca.init(e,t)}),Use=Qe("ZodULID",(e,t)=>{hoe.init(e,t),ca.init(e,t)}),Vse=Qe("ZodXID",(e,t)=>{goe.init(e,t),ca.init(e,t)}),Hse=Qe("ZodKSUID",(e,t)=>{foe.init(e,t),ca.init(e,t)}),$se=Qe("ZodIPv4",(e,t)=>{koe.init(e,t),ca.init(e,t)}),Gse=Qe("ZodIPv6",(e,t)=>{woe.init(e,t),ca.init(e,t)}),Kse=Qe("ZodCIDRv4",(e,t)=>{Soe.init(e,t),ca.init(e,t)}),Wse=Qe("ZodCIDRv6",(e,t)=>{Coe.init(e,t),ca.init(e,t)}),Jse=Qe("ZodBase64",(e,t)=>{joe.init(e,t),ca.init(e,t)}),Yse=Qe("ZodBase64URL",(e,t)=>{Aoe.init(e,t),ca.init(e,t)}),Zse=Qe("ZodE164",(e,t)=>{Moe.init(e,t),ca.init(e,t)}),Qse=Qe("ZodJWT",(e,t)=>{Poe.init(e,t),ca.init(e,t)}),tO=Qe("ZodNumber",(e,t)=>{VD.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(o,i,s)=>Jie(e,o,i),Og(e,"ZodNumber",{gt(o,i){return this.check(aM(o,i))},gte(o,i){return this.check(aw(o,i))},min(o,i){return this.check(aw(o,i))},lt(o,i){return this.check(nM(o,i))},lte(o,i){return this.check(nw(o,i))},max(o,i){return this.check(nw(o,i))},int(o){return this.check(rM(o))},safe(o){return this.check(rM(o))},positive(o){return this.check(aM(0,o))},nonnegative(o){return this.check(aw(0,o))},negative(o){return this.check(nM(0,o))},nonpositive(o){return this.check(nw(0,o))},multipleOf(o,i){return this.check(oM(o,i))},step(o,i){return this.check(oM(o,i))},finite(){return this}});const a=e._zod.bag;e.minValue=Math.max(a.minimum??Number.NEGATIVE_INFINITY,a.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(a.maximum??Number.POSITIVE_INFINITY,a.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(a.format??"").includes("int")||Number.isSafeInteger(a.multipleOf??.5),e.isFinite=!0,e.format=a.format??null});function Ps(e){return Nie(tO,e)}const Xse=Qe("ZodNumberFormat",(e,t)=>{Toe.init(e,t),tO.init(e,t)});function rM(e){return Aie(Xse,e)}const ere=Qe("ZodBoolean",(e,t)=>{Boe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>Yie(e,a,o)});function _i(e){return Mie(ere,e)}const tre=Qe("ZodUnknown",(e,t)=>{Eoe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>Qie()});function lM(){return Iie(tre)}const nre=Qe("ZodNever",(e,t)=>{Roe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>Zie(e,a,o)});function are(e){return Pie(nre,e)}const ore=Qe("ZodArray",(e,t)=>{Doe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>ase(e,a,o,i),e.element=t.element,Og(e,"ZodArray",{min(a,o){return this.check(mx(a,o))},nonempty(a){return this.check(mx(1,a))},max(a,o){return this.check(WD(a,o))},length(a,o){return this.check(JD(a,o))},unwrap(){return this.element}})});function Qa(e,t){return Uie(ore,e,t)}const ire=Qe("ZodObject",(e,t)=>{zoe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>ose(e,a,o,i),Bn(e,"shape",()=>t.shape),Og(e,"ZodObject",{keyof(){return Yo(Object.keys(this._zod.def.shape))},catchall(a){return this.clone({...this._zod.def,catchall:a})},passthrough(){return this.clone({...this._zod.def,catchall:lM()})},loose(){return this.clone({...this._zod.def,catchall:lM()})},strict(){return this.clone({...this._zod.def,catchall:are()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(a){return tae(this,a)},safeExtend(a){return nae(this,a)},merge(a){return aae(this,a)},pick(a){return Xne(this,a)},omit(a){return eae(this,a)},partial(...a){return oae(oO,this,a[0])},required(...a){return iae(iO,this,a[0])}})});function zn(e,t){const a={type:"object",shape:e??{},...Bt(t)};return new ire(a)}const nO=Qe("ZodUnion",(e,t)=>{GD.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>ise(e,a,o,i),e.options=t.options});function aO(e,t){return new nO({type:"union",options:e,...Bt(t)})}const sre=Qe("ZodDiscriminatedUnion",(e,t)=>{nO.init(e,t),Loe.init(e,t)});function MS(e,t,a){return new sre({type:"union",options:t,discriminator:e,...Bt(a)})}const rre=Qe("ZodIntersection",(e,t)=>{_oe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>sse(e,a,o,i)});function lre(e,t){return new rre({type:"intersection",left:e,right:t})}const y3=Qe("ZodEnum",(e,t)=>{Foe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(o,i,s)=>Xie(e,o,i),e.enum=t.entries,e.options=Object.values(t.entries);const a=new Set(Object.keys(t.entries));e.extract=(o,i)=>{const s={};for(const r of o)if(a.has(r))s[r]=t.entries[r];else throw new Error(`Key ${r} not found in enum`);return new y3({...t,checks:[],...Bt(i),entries:s})},e.exclude=(o,i)=>{const s={...t.entries};for(const r of o)if(a.has(r))delete s[r];else throw new Error(`Key ${r} not found in enum`);return new y3({...t,checks:[],...Bt(i),entries:s})}});function Yo(e,t){const a=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new y3({type:"enum",entries:a,...Bt(t)})}const cre=Qe("ZodLiteral",(e,t)=>{qoe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>ese(e,a,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function vo(e,t){return new cre({type:"literal",values:Array.isArray(e)?e:[e],...Bt(t)})}const dre=Qe("ZodTransform",(e,t)=>{Uoe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>nse(e,a),e._zod.parse=(a,o)=>{if(o.direction==="backward")throw new MD(e.constructor.name);a.addIssue=s=>{if(typeof s=="string")a.issues.push(sg(s,a.value,t));else{const r=s;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=a.value),r.inst??(r.inst=e),a.issues.push(sg(r))}};const i=t.transform(a.value,a);return i instanceof Promise?i.then(s=>(a.value=s,a.fallback=!0,a)):(a.value=i,a.fallback=!0,a)}});function ure(e){return new dre({type:"transform",transform:e})}const oO=Qe("ZodOptional",(e,t)=>{KD.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>XD(e,a,o,i),e.unwrap=()=>e._zod.def.innerType});function cM(e){return new oO({type:"optional",innerType:e})}const pre=Qe("ZodExactOptional",(e,t)=>{Voe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>XD(e,a,o,i),e.unwrap=()=>e._zod.def.innerType});function mre(e){return new pre({type:"optional",innerType:e})}const hre=Qe("ZodNullable",(e,t)=>{Hoe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>rse(e,a,o,i),e.unwrap=()=>e._zod.def.innerType});function dM(e){return new hre({type:"nullable",innerType:e})}const gre=Qe("ZodDefault",(e,t)=>{$oe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>cse(e,a,o,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function fre(e,t){return new gre({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():TD(t)}})}const bre=Qe("ZodPrefault",(e,t)=>{Goe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>dse(e,a,o,i),e.unwrap=()=>e._zod.def.innerType});function yre(e,t){return new bre({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():TD(t)}})}const iO=Qe("ZodNonOptional",(e,t)=>{Koe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>lse(e,a,o,i),e.unwrap=()=>e._zod.def.innerType});function xre(e,t){return new iO({type:"nonoptional",innerType:e,...Bt(t)})}const vre=Qe("ZodCatch",(e,t)=>{Woe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>use(e,a,o,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function kre(e,t){return new vre({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const wre=Qe("ZodPipe",(e,t)=>{Joe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>pse(e,a,o,i),e.in=t.in,e.out=t.out});function uM(e,t){return new wre({type:"pipe",in:e,out:t})}const Sre=Qe("ZodReadonly",(e,t)=>{Yoe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>mse(e,a,o,i),e.unwrap=()=>e._zod.def.innerType});function Cre(e){return new Sre({type:"readonly",innerType:e})}const jre=Qe("ZodCustom",(e,t)=>{Zoe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>tse(e,a)});function Nre(e,t={}){return Vie(jre,e,t)}function Are(e,t){return Hie(e,t)}const sO=["cursor","blob","circle","squircle","capsule","drop","shield","hexagon","diamond","star","panes"],Mre=Yo(sO),Ire="cursor",IS={cursor:{id:"cursor",name:"Cursor",fit:"translate(68.1612 9.8302) scale(0.593918)",body:'<path fill="{{GRADIENT}}" d="M0 0 C1.12815992 0.94880479 2.25705591 1.89673511 3.38671875 2.84375 C5.57657936 4.68528228 7.75793952 6.53624249 9.93359375 8.39453125 C13.5602214 11.48647103 17.25022962 14.49819427 20.9453125 17.5078125 C25.41301487 21.15281776 29.86103386 24.8215994 34.31054688 28.48876953 C38.00933931 31.5370903 41.70951059 34.58367973 45.4140625 37.625 C52.50037463 43.44570076 59.55669812 49.29508834 66.54003906 55.23901367 C70.43289872 58.54377434 74.40406577 61.73568847 78.40625 64.90625 C82.05401433 67.85083084 85.6145398 70.89451533 89.18359375 73.93359375 C92.41424312 76.67774533 95.67698054 79.36747809 99 82 C103.47931906 85.54855146 107.83340036 89.22936876 112.18359375 92.93359375 C115.41424312 95.67774533 118.67698054 98.36747809 122 101 C125.9014198 104.09073517 129.71091352 107.27378506 133.5 110.5 C137.99002543 114.32092614 142.53350963 118.0537239 147.15234375 121.71875 C156.74255328 129.40144186 166.1812645 137.27326897 175.53833008 145.23754883 C179.4317456 148.54281661 183.40347641 151.73522157 187.40625 154.90625 C191.05401433 157.85083084 194.6145398 160.89451533 198.18359375 163.93359375 C201.41424312 166.67774533 204.67698054 169.36747809 208 172 C236.43637507 194.63776677 236.43637507 194.63776677 238.27050781 209.13867188 C239.19944445 221.27193361 237.57124038 231.13444436 230 241 C223.66050278 247.82715086 215.75482398 254.47140646 206.04764748 255.13307858 C205.3615811 255.13693349 204.67551472 255.1407884 203.96865845 255.14476013 C203.17563324 255.15165863 202.38260803 255.15855713 201.56555176 255.16566467 C200.27360901 255.16958473 200.27360901 255.16958473 198.95556641 255.17358398 C198.04112762 255.180271 197.12668884 255.18695801 196.18453979 255.19384766 C194.19843498 255.20789156 192.21231409 255.21978771 190.22618484 255.22979546 C187.07149762 255.24625057 183.91692738 255.26949556 180.76229858 255.29469299 C171.79227585 255.36530712 162.82220292 255.42526708 153.85205078 255.47680664 C148.36195434 255.5088283 142.87198905 255.55017011 137.38199997 255.59700203 C135.30028042 255.61289593 133.21853066 255.62527474 131.13676834 255.63390923 C104.46972494 255.74602279 80.75351522 259.19455182 60.52978516 278.41845703 C55.75259196 283.35727885 51.81217213 289.04473423 47.77441406 294.5859375 C44.62107661 298.87600364 41.36381878 303.08685058 38.125 307.3125 C32.82026548 314.26649347 27.55386673 321.24815866 22.3125 328.25 C21.07690581 329.89589556 19.84122979 331.5417297 18.60546875 333.1875 C16.22002164 336.36552908 13.84996009 339.55428087 11.48828125 342.75 C3.0450311 354.10095576 -5.25712203 365.22607871 -20 368 C-33.42903027 368.85957067 -44.2929604 367.90032788 -55 358.9140625 C-63.51513963 350.76480778 -67.79688328 340.99527428 -68.37686157 329.29350281 C-68.43541887 328.1487851 -68.49397617 327.00406738 -68.55430794 325.82466125 C-68.61453573 324.57243271 -68.67476353 323.32020416 -68.73681641 322.0300293 C-68.80423726 320.68369989 -68.87198477 319.33738681 -68.94003105 317.99108887 C-69.12569162 314.29881586 -69.30666938 310.60632592 -69.48688698 306.91378379 C-69.68142908 302.94481208 -69.88036562 298.97606035 -70.07873535 295.00727844 C-70.55465828 285.46711948 -71.02377004 275.92663022 -71.49235249 266.3861084 C-71.71278092 261.90166682 -71.93398876 257.41726373 -72.1552124 252.93286133 C-72.22122149 251.59460763 -72.22122149 251.59460763 -72.28856409 250.2293185 C-72.37783973 248.41936974 -72.46711776 246.6094211 -72.55639815 244.79947257 C-72.7821203 240.22326204 -73.00777832 235.64704836 -73.23336792 231.0708313 C-73.2783997 230.15734865 -73.32343148 229.24386601 -73.36982787 228.30270207 C-73.64581049 222.70253299 -73.92113412 217.10233189 -74.19602597 211.50210917 C-75.35713101 187.85146938 -76.54638525 164.20245932 -77.76320994 140.55462319 C-78.3174362 129.77404232 -78.86176258 118.9929594 -79.40472984 108.2118063 C-79.83986282 99.58021501 -80.28322749 90.94912395 -80.73695588 82.31848997 C-81.04621068 76.42094211 -81.34513355 70.52292566 -81.63612723 64.62444884 C-81.8031421 61.24551841 -81.97612174 57.86718776 -82.15861511 54.48903847 C-84.29931862 14.73242483 -84.29931862 14.73242483 -72.03125 -1.625 C-50.89854752 -24.96559677 -21.34867451 -18.24899383 0 0 Z "/>',clip:'<path d="M0 0 C1.12815992 0.94880479 2.25705591 1.89673511 3.38671875 2.84375 C5.57657936 4.68528228 7.75793952 6.53624249 9.93359375 8.39453125 C13.5602214 11.48647103 17.25022962 14.49819427 20.9453125 17.5078125 C25.41301487 21.15281776 29.86103386 24.8215994 34.31054688 28.48876953 C38.00933931 31.5370903 41.70951059 34.58367973 45.4140625 37.625 C52.50037463 43.44570076 59.55669812 49.29508834 66.54003906 55.23901367 C70.43289872 58.54377434 74.40406577 61.73568847 78.40625 64.90625 C82.05401433 67.85083084 85.6145398 70.89451533 89.18359375 73.93359375 C92.41424312 76.67774533 95.67698054 79.36747809 99 82 C103.47931906 85.54855146 107.83340036 89.22936876 112.18359375 92.93359375 C115.41424312 95.67774533 118.67698054 98.36747809 122 101 C125.9014198 104.09073517 129.71091352 107.27378506 133.5 110.5 C137.99002543 114.32092614 142.53350963 118.0537239 147.15234375 121.71875 C156.74255328 129.40144186 166.1812645 137.27326897 175.53833008 145.23754883 C179.4317456 148.54281661 183.40347641 151.73522157 187.40625 154.90625 C191.05401433 157.85083084 194.6145398 160.89451533 198.18359375 163.93359375 C201.41424312 166.67774533 204.67698054 169.36747809 208 172 C236.43637507 194.63776677 236.43637507 194.63776677 238.27050781 209.13867188 C239.19944445 221.27193361 237.57124038 231.13444436 230 241 C223.66050278 247.82715086 215.75482398 254.47140646 206.04764748 255.13307858 C205.3615811 255.13693349 204.67551472 255.1407884 203.96865845 255.14476013 C203.17563324 255.15165863 202.38260803 255.15855713 201.56555176 255.16566467 C200.27360901 255.16958473 200.27360901 255.16958473 198.95556641 255.17358398 C198.04112762 255.180271 197.12668884 255.18695801 196.18453979 255.19384766 C194.19843498 255.20789156 192.21231409 255.21978771 190.22618484 255.22979546 C187.07149762 255.24625057 183.91692738 255.26949556 180.76229858 255.29469299 C171.79227585 255.36530712 162.82220292 255.42526708 153.85205078 255.47680664 C148.36195434 255.5088283 142.87198905 255.55017011 137.38199997 255.59700203 C135.30028042 255.61289593 133.21853066 255.62527474 131.13676834 255.63390923 C104.46972494 255.74602279 80.75351522 259.19455182 60.52978516 278.41845703 C55.75259196 283.35727885 51.81217213 289.04473423 47.77441406 294.5859375 C44.62107661 298.87600364 41.36381878 303.08685058 38.125 307.3125 C32.82026548 314.26649347 27.55386673 321.24815866 22.3125 328.25 C21.07690581 329.89589556 19.84122979 331.5417297 18.60546875 333.1875 C16.22002164 336.36552908 13.84996009 339.55428087 11.48828125 342.75 C3.0450311 354.10095576 -5.25712203 365.22607871 -20 368 C-33.42903027 368.85957067 -44.2929604 367.90032788 -55 358.9140625 C-63.51513963 350.76480778 -67.79688328 340.99527428 -68.37686157 329.29350281 C-68.43541887 328.1487851 -68.49397617 327.00406738 -68.55430794 325.82466125 C-68.61453573 324.57243271 -68.67476353 323.32020416 -68.73681641 322.0300293 C-68.80423726 320.68369989 -68.87198477 319.33738681 -68.94003105 317.99108887 C-69.12569162 314.29881586 -69.30666938 310.60632592 -69.48688698 306.91378379 C-69.68142908 302.94481208 -69.88036562 298.97606035 -70.07873535 295.00727844 C-70.55465828 285.46711948 -71.02377004 275.92663022 -71.49235249 266.3861084 C-71.71278092 261.90166682 -71.93398876 257.41726373 -72.1552124 252.93286133 C-72.22122149 251.59460763 -72.22122149 251.59460763 -72.28856409 250.2293185 C-72.37783973 248.41936974 -72.46711776 246.6094211 -72.55639815 244.79947257 C-72.7821203 240.22326204 -73.00777832 235.64704836 -73.23336792 231.0708313 C-73.2783997 230.15734865 -73.32343148 229.24386601 -73.36982787 228.30270207 C-73.64581049 222.70253299 -73.92113412 217.10233189 -74.19602597 211.50210917 C-75.35713101 187.85146938 -76.54638525 164.20245932 -77.76320994 140.55462319 C-78.3174362 129.77404232 -78.86176258 118.9929594 -79.40472984 108.2118063 C-79.83986282 99.58021501 -80.28322749 90.94912395 -80.73695588 82.31848997 C-81.04621068 76.42094211 -81.34513355 70.52292566 -81.63612723 64.62444884 C-81.8031421 61.24551841 -81.97612174 57.86718776 -82.15861511 54.48903847 C-84.29931862 14.73242483 -84.29931862 14.73242483 -72.03125 -1.625 C-50.89854752 -24.96559677 -21.34867451 -18.24899383 0 0 Z "/>',anchor:{x:85.54,y:106.35,scale:.791}},blob:{id:"blob",name:"Blob",fit:"translate(-0.7217 2.9555) scale(1.134706)",body:'<path fill="{{GRADIENT}}" d="M198.91052 113.12915C198.30169 121.88191 196.37668 130.37605 193.1355 138.61157C189.89431 146.84709 185.49332 154.4026 179.93252 161.27809C174.37172 168.15358 167.99976 174.1053 160.81663 179.13325C153.6335 184.1612 145.98678 188.22176 137.87645 191.31491C129.76613 194.40806 121.42581 196.55178 112.85548 197.74609C104.28516 198.94039 95.66469 199.12755 86.99407 198.30758C78.32344 197.4876 69.86713 195.54477 61.62513 192.47909C53.38313 189.41341 45.74309 185.20915 38.70501 179.86633C31.66693 174.52351 25.60941 168.25632 20.53243 161.06476C15.45546 153.87319 11.54067 146.15559 8.78808 137.91195C6.03549 129.66831 4.37316 121.28874 3.80109 112.77325C3.22902 104.25775 3.5616 95.83136 4.79882 87.49409C6.03604 79.15682 8.08364 70.99969 10.94163 63.0227C13.79962 55.04571 17.53174 47.38891 22.13799 40.0523C26.74425 32.71568 32.30193 26.0276 38.81103 19.98806C45.32014 13.94852 52.65266 9.00619 60.80862 5.16109C68.96458 1.31599 77.53546 -1.10241 86.52128 -2.09412C95.50709 -3.08583 104.37427 -2.64309 113.12282 -0.76589C121.87137 1.11131 130.09712 4.12751 137.80007 8.28271C145.50302 12.43791 152.53652 17.35515 158.90058 23.03443C165.26463 28.7137 170.969 34.91856 176.01368 41.649C181.05836 48.37944 185.3953 55.56843 189.02451 63.21597C192.65372 70.86352 195.3609 78.90607 197.14605 87.34364C198.93119 95.78121 199.51935 104.37638 198.91052 113.12915Z"/>',clip:'<path d="M198.91052 113.12915C198.30169 121.88191 196.37668 130.37605 193.1355 138.61157C189.89431 146.84709 185.49332 154.4026 179.93252 161.27809C174.37172 168.15358 167.99976 174.1053 160.81663 179.13325C153.6335 184.1612 145.98678 188.22176 137.87645 191.31491C129.76613 194.40806 121.42581 196.55178 112.85548 197.74609C104.28516 198.94039 95.66469 199.12755 86.99407 198.30758C78.32344 197.4876 69.86713 195.54477 61.62513 192.47909C53.38313 189.41341 45.74309 185.20915 38.70501 179.86633C31.66693 174.52351 25.60941 168.25632 20.53243 161.06476C15.45546 153.87319 11.54067 146.15559 8.78808 137.91195C6.03549 129.66831 4.37316 121.28874 3.80109 112.77325C3.22902 104.25775 3.5616 95.83136 4.79882 87.49409C6.03604 79.15682 8.08364 70.99969 10.94163 63.0227C13.79962 55.04571 17.53174 47.38891 22.13799 40.0523C26.74425 32.71568 32.30193 26.0276 38.81103 19.98806C45.32014 13.94852 52.65266 9.00619 60.80862 5.16109C68.96458 1.31599 77.53546 -1.10241 86.52128 -2.09412C95.50709 -3.08583 104.37427 -2.64309 113.12282 -0.76589C121.87137 1.11131 130.09712 4.12751 137.80007 8.28271C145.50302 12.43791 152.53652 17.35515 158.90058 23.03443C165.26463 28.7137 170.969 34.91856 176.01368 41.649C181.05836 48.37944 185.3953 55.56843 189.02451 63.21597C192.65372 70.86352 195.3609 78.90607 197.14605 87.34364C198.93119 95.78121 199.51935 104.37638 198.91052 113.12915Z"/>',anchor:{x:111.22,y:116.58,scale:.791}},circle:{id:"circle",name:"Circle",fit:"translate(0 0) scale(1.142705)",body:'<path fill="{{GRADIENT}}" d="M200 100C200 155.22847 155.22847 200 100 200C44.77153 200 0 155.22847 0 100C0 44.77153 44.77153 0 100 0C155.22847 0 200 44.77153 200 100Z"/>',clip:'<path d="M200 100C200 155.22847 155.22847 200 100 200C44.77153 200 0 155.22847 0 100C0 44.77153 44.77153 0 100 0C155.22847 0 200 44.77153 200 100Z"/>',anchor:{x:113.82,y:110.27,scale:.791}},squircle:{id:"squircle",name:"Squircle",fit:"translate(0 0) scale(1.142705)",body:'<path fill="{{GRADIENT}}" d="M50 0C83.33333 0 116.66667 0 150 0C177.61424 0 200 22.38576 200 50C200 83.33333 200 116.66667 200 150C200 177.61424 177.61424 200 150 200C116.66667 200 83.33333 200 50 200C22.38576 200 0 177.61424 0 150C0 116.66667 0 83.33333 0 50C0 22.38576 22.38576 0 50 0Z"/>',clip:'<path d="M50 0C83.33333 0 116.66667 0 150 0C177.61424 0 200 22.38576 200 50C200 83.33333 200 116.66667 200 150C200 177.61424 177.61424 200 150 200C116.66667 200 83.33333 200 50 200C22.38576 200 0 177.61424 0 150C0 116.66667 0 83.33333 0 50C0 22.38576 22.38576 0 50 0Z"/>',anchor:{x:111.78,y:111.79,scale:.791}},capsule:{id:"capsule",name:"Capsule",fit:"translate(0 0) scale(1.142705)",body:'<path fill="{{GRADIENT}}" d="M100 0C141.42136 0 175 33.57864 175 75C175 91.66667 175 108.33333 175 125C175 166.42136 141.42136 200 100 200C58.57864 200 25 166.42136 25 125C25 108.33333 25 91.66667 25 75C25 33.57864 58.57864 0 100 0Z"/>',clip:'<path d="M100 0C141.42136 0 175 33.57864 175 75C175 91.66667 175 108.33333 175 125C175 166.42136 141.42136 200 100 200C58.57864 200 25 166.42136 25 125C25 108.33333 25 91.66667 25 75C25 33.57864 58.57864 0 100 0Z"/>',anchor:{x:113.82,y:131.68,scale:.791}},drop:{id:"drop",name:"Drop",fit:"translate(-3.5341 -3.5341) scale(1.178046)",body:'<path fill="{{GRADIENT}}" d="M100 3C160.84 78.2235 178 103.298 178 119C178 162.07821 143.07821 197 100 197C56.92179 197 22 162.07821 22 119C22 103.298 39.16 78.2235 100 3Z"/>',clip:'<path d="M100 3C160.84 78.2235 178 103.298 178 119C178 162.07821 143.07821 197 100 197C56.92179 197 22 162.07821 22 119C22 103.298 39.16 78.2235 100 3Z"/>',anchor:{x:112.47,y:138.8,scale:.791}},shield:{id:"shield",name:"Shield",fit:"translate(-12.1611 -24.3222) scale(1.264316)",body:'<path fill="{{GRADIENT}}" d="M57.25 38.475C85.75 12.825 114.25 12.825 142.75 38.475C153.89667 76.64167 165.04333 114.80833 176.19 152.975C188.73 184.325 179.325 200 147.975 200C115.99167 200 84.00833 200 52.025 200C20.675 200 11.27 184.325 23.81 152.975C34.95667 114.80833 46.10333 76.64167 57.25 38.475Z"/>',clip:'<path d="M57.25 38.475C85.75 12.825 114.25 12.825 142.75 38.475C153.89667 76.64167 165.04333 114.80833 176.19 152.975C188.73 184.325 179.325 200 147.975 200C115.99167 200 84.00833 200 52.025 200C20.675 200 11.27 184.325 23.81 152.975C34.95667 114.80833 46.10333 76.64167 57.25 38.475Z"/>',anchor:{x:112.38,y:170.61,scale:.791}},hexagon:{id:"hexagon",name:"Hexagon",fit:"translate(-4.1077 -4.1077) scale(1.183782)",body:'<path fill="{{GRADIENT}}" d="M94.90777 4.94C98.30259 2.98 101.69741 2.98 105.09223 4.94C129.98757 19.31333 154.88292 33.68667 179.77826 48.06C183.17308 50.02 184.87049 52.96 184.87049 56.88C184.87049 85.62667 184.87049 114.37333 184.87049 143.12C184.87049 147.04 183.17308 149.98 179.77826 151.94C154.88292 166.31333 129.98757 180.68667 105.09223 195.06C101.69741 197.02 98.30259 197.02 94.90777 195.06C70.01243 180.68667 45.11708 166.31333 20.22174 151.94C16.82692 149.98 15.12951 147.04 15.12951 143.12C15.12951 114.37333 15.12951 85.62667 15.12951 56.88C15.12951 52.96 16.82692 50.02 20.22174 48.06C45.11708 33.68667 70.01243 19.31333 94.90777 4.94Z"/>',clip:'<path d="M94.90777 4.94C98.30259 2.98 101.69741 2.98 105.09223 4.94C129.98757 19.31333 154.88292 33.68667 179.77826 48.06C183.17308 50.02 184.87049 52.96 184.87049 56.88C184.87049 85.62667 184.87049 114.37333 184.87049 143.12C184.87049 147.04 183.17308 149.98 179.77826 151.94C154.88292 166.31333 129.98757 180.68667 105.09223 195.06C101.69741 197.02 98.30259 197.02 94.90777 195.06C70.01243 180.68667 45.11708 166.31333 20.22174 151.94C16.82692 149.98 15.12951 147.04 15.12951 143.12C15.12951 114.37333 15.12951 85.62667 15.12951 56.88C15.12951 52.96 16.82692 50.02 20.22174 48.06C45.11708 33.68667 70.01243 19.31333 94.90777 4.94Z"/>',anchor:{x:112.26,y:110.7,scale:.791}},diamond:{id:"diamond",name:"Diamond",fit:"translate(-5.9383 -5.9383) scale(1.202088)",body:'<path fill="{{GRADIENT}}" d="M94.12 7.88C98.04 3.96 101.96 3.96 105.88 7.88C134.62667 36.62667 163.37333 65.37333 192.12 94.12C196.04 98.04 196.04 101.96 192.12 105.88C163.37333 134.62667 134.62667 163.37333 105.88 192.12C101.96 196.04 98.04 196.04 94.12 192.12C65.37333 163.37333 36.62667 134.62667 7.88 105.88C3.96 101.96 3.96 98.04 7.88 94.12C36.62667 65.37333 65.37333 36.62667 94.12 7.88Z"/>',clip:'<path d="M94.12 7.88C98.04 3.96 101.96 3.96 105.88 7.88C134.62667 36.62667 163.37333 65.37333 192.12 94.12C196.04 98.04 196.04 101.96 192.12 105.88C163.37333 134.62667 134.62667 163.37333 105.88 192.12C101.96 196.04 98.04 196.04 94.12 192.12C65.37333 163.37333 36.62667 134.62667 7.88 105.88C3.96 101.96 3.96 98.04 7.88 94.12C36.62667 65.37333 65.37333 36.62667 94.12 7.88Z"/>',anchor:{x:112.53,y:109.95,scale:.791}},star:{id:"star",name:"Star",fit:"translate(-8.3327 3.1407) scale(1.226032)",body:'<path fill="{{GRADIENT}}" d="M100 2C110.56054 20.13133 121.12108 38.26266 131.68163 56.39398C152.18893 60.83477 172.69623 65.27555 193.20354 69.71633C179.22301 85.3629 165.24248 101.00946 151.26195 116.65602C153.37562 137.5319 155.48929 158.40778 157.60295 179.28367C138.40197 170.82244 119.20098 162.36122 100 153.9C80.79902 162.36122 61.59803 170.82244 42.39705 179.28367C44.51071 158.40778 46.62438 137.5319 48.73805 116.65602C34.75752 101.00946 20.77699 85.3629 6.79646 69.71633C27.30377 65.27555 47.81107 60.83477 68.31837 56.39398C78.87892 38.26266 89.43946 20.13133 100 2Z"/>',clip:'<path d="M100 2C110.56054 20.13133 121.12108 38.26266 131.68163 56.39398C152.18893 60.83477 172.69623 65.27555 193.20354 69.71633C179.22301 85.3629 165.24248 101.00946 151.26195 116.65602C153.37562 137.5319 155.48929 158.40778 157.60295 179.28367C138.40197 170.82244 119.20098 162.36122 100 153.9C80.79902 162.36122 61.59803 170.82244 42.39705 179.28367C44.51071 158.40778 46.62438 137.5319 48.73805 116.65602C34.75752 101.00946 20.77699 85.3629 6.79646 69.71633C27.30377 65.27555 47.81107 60.83477 68.31837 56.39398C78.87892 38.26266 89.43946 20.13133 100 2Z"/>',anchor:{x:113.82,y:125.43,scale:.791}},panes:{id:"panes",name:"Panes",fit:"translate(-2.3321 -2.3321) scale(1.166026)",body:'<path fill="{{GRADIENT}}" d="M42 2C56 2 70 2 84 2C92 2 92 32 100 32C108 32 108 2 116 2C130 2 144 2 158 2C180.09139 2 198 19.90861 198 42C198 56 198 70 198 84C198 92 168 92 168 100C168 108 198 108 198 116C198 130 198 144 198 158C198 180.09139 180.09139 198 158 198C144 198 130 198 116 198C108 198 108 168 100 168C92 168 92 198 84 198C70 198 56 198 42 198C19.90861 198 2 180.09139 2 158C2 144 2 130 2 116C2 108 32 108 32 100C32 92 2 92 2 84C2 70 2 56 2 42C2 19.90861 19.90861 2 42 2Z"/>',clip:'<path d="M42 2C56 2 70 2 84 2C92 2 92 32 100 32C108 32 108 2 116 2C130 2 144 2 158 2C180.09139 2 198 19.90861 198 42C198 56 198 70 198 84C198 92 168 92 168 100C168 108 198 108 198 116C198 130 198 144 198 158C198 180.09139 180.09139 198 158 198C144 198 130 198 116 198C108 198 108 168 100 168C92 168 92 198 84 198C70 198 56 198 42 198C19.90861 198 2 180.09139 2 158C2 144 2 130 2 116C2 108 32 108 32 100C32 92 2 92 2 84C2 70 2 56 2 42C2 19.90861 19.90861 2 42 2Z"/>',anchor:{x:113.82,y:102.65,scale:.791}}};function Pre(e){return Mre.safeParse(e).data??Ire}const ap=228.541,pM=[120,122.5],mM={x:13.2,y:8.4},Tre=["130.36,45.98 132.71,46.19 134.98,46.81 137.11,47.83 138.97,49.28 140.47,51.09 141.68,53.12 142.73,55.23 143.76,57.36 144.78,59.49 145.79,61.62 146.79,63.76 147.76,65.91 148.71,68.07 149.63,70.25 150.52,72.43 151.37,74.63 151.99,76.91 152.1,79.26 151.64,81.57 150.59,83.68 149.04,85.45 147.1,86.78 144.9,87.62 142.56,87.93 140.22,87.71 137.98,86.99 135.93,85.82 134.17,84.24 132.78,82.34 131.69,80.25 130.77,78.08 129.87,75.89 128.94,73.72 128,71.56 127.03,69.4 126.05,67.26 125.05,65.12 124.03,62.99 122.93,60.9 121.87,58.79 121.03,56.59 120.72,54.26 121.1,51.93 122.15,49.83 123.75,48.1 125.76,46.89 128.01,46.19|176.61,37.08 178.72,37.59 180.7,38.48 182.52,39.65 184.2,41.03 185.71,42.59 187.03,44.31 188.2,46.14 189.26,48.03 190.27,49.96 191.26,51.89 192.23,53.84 193.16,55.8 194.05,57.78 194.92,59.77 195.74,61.78 196.53,63.8 197.27,65.84 197.97,67.9 198.47,70.01 198.63,72.18 198.4,74.33 197.58,76.33 195.95,77.72 193.83,78.08 191.71,77.65 189.76,76.69 188.03,75.38 186.53,73.82 185.28,72.05 184.25,70.13 183.4,68.14 182.63,66.11 181.87,64.07 181.07,62.05 180.25,60.04 179.39,58.05 178.49,56.07 177.57,54.1 176.61,52.15 175.62,50.22 174.59,48.31 173.53,46.41 172.54,44.48 171.86,42.42 171.76,40.26 172.62,38.3 174.45,37.19","86.14,124.79 89.16,124.92 92.06,125.76 94.68,127.27 96.86,129.36 98.48,131.92 99.51,134.76 100.12,137.73 100.56,140.72 101.01,143.72 101.52,146.71 102.06,149.69 102.62,152.67 103.2,155.64 103.81,158.61 104.44,161.57 105.11,164.52 105.81,167.47 106.49,170.42 106.72,173.44 106.01,176.37 104.37,178.9 102.03,180.81 99.26,181.99 96.27,182.46 93.25,182.25 90.34,181.43 87.65,180.04 85.32,178.11 83.51,175.7 82.37,172.9 81.66,169.96 80.98,167 80.32,164.05 79.69,161.08 79.08,158.12 78.5,155.14 77.94,152.16 77.4,149.18 76.89,146.2 76.4,143.21 75.93,140.21 75.56,137.21 75.7,134.19 76.6,131.3 78.22,128.76 80.47,126.74 83.18,125.4|147.23,112.87 150.24,113.13 153.07,114.19 155.53,115.94 157.46,118.26 158.73,121.01 159.53,123.93 160.21,126.88 160.88,129.84 161.52,132.8 162.15,135.76 162.74,138.73 163.32,141.71 163.87,144.69 164.39,147.67 164.9,150.66 165.39,153.65 165.8,156.65 165.76,159.67 164.98,162.59 163.56,165.26 161.61,167.58 159.23,169.45 156.52,170.77 153.57,171.46 150.55,171.4 147.67,170.52 145.19,168.79 143.45,166.33 142.57,163.44 142.08,160.45 141.61,157.46 141.11,154.47 140.59,151.48 140.04,148.5 139.47,145.53 138.87,142.56 138.25,139.59 137.6,136.63 136.94,133.68 136.25,130.72 135.59,127.77 135.47,124.75 136.07,121.78 137.34,119.04 139.19,116.65 141.53,114.74 144.26,113.44","104.84,104.08 109.39,104.89 113.63,106.73 117.32,109.5 120.25,113.08 122.22,117.25 123.15,121.77 122.92,126.39 121.86,130.89 120.61,135.35 119.37,139.81 118.15,144.27 116.94,148.74 115.74,153.21 114.56,157.69 113.39,162.17 112.24,166.65 111.13,171.15 110.04,175.65 108.89,180.13 106.98,184.33 103.8,187.67 99.75,189.87 95.25,190.93 90.63,190.93 86.11,189.97 81.86,188.16 78.05,185.54 74.89,182.18 72.62,178.16 71.54,173.67 71.94,169.08 73.01,164.57 74.13,160.08 75.26,155.59 76.42,151.11 77.59,146.63 78.77,142.15 79.97,137.68 81.18,133.22 82.41,128.75 83.65,124.29 84.87,119.83 86.33,115.43 88.67,111.46 91.9,108.15 95.83,105.72 100.23,104.35|174.26,115.55 178.59,116.54 182.37,118.86 185.31,122.2 187.23,126.21 188.12,130.57 188.06,135.02 187.52,139.44 186.86,143.85 186.11,148.25 185.25,152.62 184.3,156.98 183.24,161.31 182.07,165.61 180.79,169.88 179.39,174.12 177.89,178.31 176.27,182.47 174.47,186.55 172.17,190.35 169.21,193.68 165.73,196.46 161.84,198.64 157.66,200.16 153.27,200.91 148.83,200.69 144.65,199.19 141.47,196.14 140.18,191.91 140.82,187.53 142.46,183.38 144.16,179.26 145.73,175.09 147.18,170.87 148.51,166.62 149.73,162.33 150.84,158.01 151.84,153.67 152.74,149.3 153.54,144.91 154.24,140.51 154.85,136.1 155.58,131.7 156.93,127.46 159.15,123.6 162.12,120.29 165.73,117.68 169.84,116","44.72,103.35 47.95,103.93 51.04,105.05 53.93,106.62 56.58,108.57 58.97,110.83 61.09,113.35 62.93,116.07 64.5,118.97 65.79,121.99 66.8,125.13 67.52,128.34 67.94,131.6 68.08,134.89 67.9,138.17 67.4,141.42 66.56,144.6 65.33,147.66 63.71,150.52 61.69,153.11 59.3,155.36 56.54,157.16 53.51,158.42 50.29,159.07 47,159.09 43.76,158.5 40.67,157.39 37.78,155.82 35.13,153.87 32.75,151.6 30.63,149.09 28.78,146.36 27.21,143.47 25.92,140.44 24.92,137.31 24.2,134.1 23.77,130.84 23.64,127.55 23.81,124.27 24.31,121.01 25.16,117.84 26.38,114.78 28,111.92 30.02,109.33 32.42,107.08 35.17,105.28 38.21,104.02 41.43,103.37|114.62,83.64 118.31,83.88 121.94,84.6 125.44,85.77 128.77,87.38 131.86,89.4 134.67,91.81 137.13,94.56 139.2,97.62 140.85,100.93 142.05,104.42 142.79,108.05 143.05,111.73 142.83,115.42 142.13,119.05 140.95,122.55 139.34,125.88 137.3,128.96 134.88,131.75 132.11,134.2 129.05,136.27 125.75,137.93 122.25,139.13 118.63,139.86 114.94,140.1 111.25,139.86 107.63,139.14 104.12,137.97 100.8,136.36 97.7,134.34 94.9,131.93 92.44,129.18 90.36,126.12 88.72,122.81 87.51,119.31 86.78,115.69 86.52,112.01 86.74,108.32 87.44,104.69 88.61,101.18 90.23,97.86 92.27,94.78 94.69,91.99 97.45,89.54 100.51,87.47 103.82,85.81 107.31,84.61 110.94,83.88","90.44,99.25 93.11,99.26 95.74,99.79 98.37,100.3 101,100.82 103.64,101.33 106.27,101.85 108.9,102.37 111.53,102.89 114.16,103.41 116.79,103.94 119.42,104.47 122.06,105 124.69,105.53 127.32,106.06 129.94,106.6 132.57,107.14 135.2,107.68 137.65,108.73 139.5,110.65 140.44,113.14 140.36,115.81 139.35,118.28 137.48,120.18 135,121.14 132.32,121.11 129.7,120.56 127.08,120 124.45,119.46 121.82,118.93 119.19,118.4 116.56,117.87 113.93,117.35 111.29,116.83 108.66,116.32 106.02,115.82 103.39,115.31 100.76,114.79 98.12,114.28 95.49,113.75 92.86,113.22 90.23,112.68 87.77,111.66 85.93,109.74 85.01,107.24 85.06,104.57 86.07,102.1 87.96,100.22|156.6,112.56 158.91,112.66 161.18,113.15 163.45,113.64 165.72,114.13 167.99,114.62 170.26,115.12 172.53,115.62 174.8,116.12 177.07,116.62 179.34,117.13 181.6,117.64 183.87,118.15 186.14,118.67 188.4,119.18 190.67,119.7 192.94,120.2 195.12,120.96 196.7,122.63 197.45,124.82 197.53,127.14 197.07,129.41 196.08,131.51 194.49,133.18 192.33,133.97 190.04,133.68 187.79,133.09 185.52,132.57 183.26,132.05 180.99,131.54 178.72,131.03 176.45,130.53 174.18,130.03 171.91,129.54 169.64,129.05 167.37,128.56 165.1,128.07 162.83,127.58 160.56,127.08 158.29,126.57 156.02,126.05 153.9,125.14 152.26,123.51 151.32,121.4 151.08,119.1 151.53,116.82 152.65,114.8 154.41,113.31","79.94,130.44 83.08,130.57 86.11,131.41 88.89,132.89 91.27,134.94 93.15,137.46 94.39,140.35 95.11,143.42 95.65,146.52 96.2,149.62 96.78,152.72 97.39,155.81 98.04,158.89 98.72,161.97 99.43,165.04 100.18,168.1 100.97,171.15 101.81,174.18 102.64,177.22 103.01,180.34 102.35,183.4 100.66,186.04 98.19,187.98 95.28,189.16 92.17,189.6 89.03,189.37 85.99,188.56 83.16,187.2 80.63,185.33 78.55,182.97 77.05,180.21 76.1,177.21 75.28,174.17 74.5,171.11 73.74,168.06 73.02,164.99 72.33,161.92 71.68,158.83 71.06,155.75 70.47,152.65 69.91,149.55 69.37,146.45 68.97,143.32 69.12,140.18 70.04,137.18 71.7,134.51 74.03,132.41 76.86,131.04|168.95,136.28 171.31,136.97 172.99,138.76 173.66,141.13 173.36,143.58 172.24,145.79 170.45,147.49 168.22,148.58 165.89,149.43 163.57,150.31 161.24,151.18 158.9,152.02 156.56,152.85 154.21,153.65 151.85,154.44 149.48,155.2 147.11,155.94 144.73,156.65 142.34,157.34 139.95,158.01 137.55,158.66 135.14,159.27 132.73,159.86 130.31,160.43 127.84,160.54 125.53,159.69 123.77,157.96 122.89,155.66 123.09,153.21 124.36,151.09 126.34,149.61 128.69,148.83 131.1,148.24 133.51,147.62 135.91,146.98 138.31,146.32 140.7,145.65 143.08,144.95 145.46,144.23 147.83,143.49 150.2,142.73 152.56,141.95 154.91,141.15 157.25,140.32 159.59,139.48 161.92,138.61 164.24,137.72 166.54,136.78","119.79,105.35 121.94,105.42 124.03,105.87 126,106.72 127.77,107.93 129.27,109.47 130.45,111.26 131.29,113.23 131.73,115.33 131.79,117.47 131.53,119.6 131.11,121.71 130.66,123.81 130.27,125.92 129.88,128.03 129.49,130.14 129.07,132.25 128.62,134.35 127.96,136.39 126.96,138.29 125.62,139.96 123.99,141.36 122.13,142.43 120.11,143.15 118,143.5 115.85,143.45 113.75,143 111.79,142.15 110.03,140.93 108.54,139.38 107.36,137.59 106.53,135.61 106.1,133.51 106.07,131.37 106.35,129.24 106.77,127.14 107.22,125.04 107.64,122.93 108.05,120.82 108.45,118.71 108.84,116.6 109.25,114.49 109.86,112.44 110.83,110.52 112.16,108.84 113.78,107.44 115.65,106.38 117.67,105.68|174.73,114.1 176.71,114.59 178.5,115.55 180.04,116.88 181.27,118.5 182.17,120.33 182.71,122.29 182.9,124.32 182.82,126.36 182.56,128.38 182.23,130.39 181.89,132.4 181.53,134.41 181.16,136.41 180.75,138.41 180.3,140.4 179.82,142.38 179.18,144.31 178.28,146.15 177.14,147.83 175.74,149.31 174.11,150.53 172.29,151.44 170.32,151.97 168.29,152.07 166.29,151.69 164.45,150.83 162.87,149.54 161.66,147.91 160.83,146.06 160.38,144.07 160.29,142.04 160.53,140.01 160.98,138.02 161.43,136.03 161.84,134.04 162.24,132.04 162.62,130.03 162.93,128.02 163.24,126 163.6,124 164.11,122.03 164.91,120.15 165.99,118.43 167.35,116.91 168.94,115.64 170.74,114.69 172.7,114.15","105.72,72.58 108.82,72.78 111.75,73.82 114.27,75.64 116.39,77.92 118.42,80.29 120.45,82.66 122.47,85.03 124.48,87.41 126.49,89.8 128.48,92.2 130.47,94.6 132.45,97.01 134.43,99.42 136.4,101.83 138.37,104.25 140.3,106.7 141.85,109.39 142.65,112.4 142.63,115.51 141.8,118.5 140.21,121.17 137.95,123.31 135.17,124.7 132.11,125.26 129.02,124.98 126.12,123.86 123.67,121.94 121.61,119.6 119.66,117.17 117.69,114.75 115.73,112.33 113.75,109.92 111.77,107.52 109.77,105.12 107.77,102.73 105.76,100.34 103.75,97.96 101.72,95.59 99.68,93.23 97.63,90.89 95.91,88.3 94.95,85.34 94.92,82.24 95.84,79.27 97.56,76.68 99.9,74.63 102.67,73.22|176.73,63.75 179.52,64.43 182.02,65.85 184.15,67.78 185.85,70.1 187.08,72.7 187.76,75.5 187.76,78.37 187.23,81.2 186.58,84.01 185.89,86.8 185.16,89.59 184.39,92.36 183.59,95.13 182.76,97.89 181.88,100.64 180.98,103.37 180.02,106.09 179.03,108.79 177.99,111.48 176.9,114.15 175.5,116.66 173.51,118.72 171,120.11 168.18,120.66 165.34,120.29 162.75,119.04 160.62,117.12 159.02,114.73 158,112.04 157.63,109.19 157.98,106.34 158.83,103.59 159.86,100.9 160.87,98.2 161.85,95.49 162.79,92.76 163.7,90.03 164.57,87.29 165.41,84.53 166.21,81.76 166.98,78.99 167.7,76.2 168.38,73.4 169,70.58 169.79,67.82 171.41,65.46 173.88,64.03","64.12,83.43 66.69,84.08 68.9,85.53 70.57,87.6 71.56,90.05 71.86,92.69 71.53,95.32 70.55,97.78 69.06,99.99 67.36,102.03 65.64,104.06 63.95,106.11 62.28,108.18 60.63,110.27 59,112.38 57.41,114.5 55.84,116.65 54.29,118.82 52.78,121 51.31,123.22 49.86,125.45 48.42,127.69 46.67,129.68 44.36,130.96 41.73,131.22 39.22,130.38 37.16,128.72 35.64,126.55 34.65,124.08 34.2,121.46 34.29,118.81 34.94,116.24 36.12,113.86 37.54,111.61 39.04,109.41 40.54,107.21 42.06,105.03 43.61,102.87 45.18,100.73 46.79,98.6 48.41,96.5 50.07,94.42 51.74,92.35 53.45,90.31 55.17,88.28 56.94,86.3 59.04,84.67 61.48,83.65|104.23,93.09 106.97,93.77 109.4,95.24 111.32,97.31 112.59,99.85 113.4,102.57 114.13,105.32 114.87,108.06 115.62,110.8 116.37,113.54 117.14,116.28 117.9,119.02 118.67,121.75 119.45,124.49 120.23,127.22 121.03,129.95 121.83,132.68 122.6,135.41 122.98,138.22 122.57,141.02 121.34,143.57 119.44,145.67 117.05,147.19 114.34,148.04 111.51,148.14 108.77,147.45 106.33,146.01 104.38,143.96 103.07,141.44 102.21,138.73 101.43,136 100.65,133.27 99.87,130.53 99.09,127.8 98.32,125.06 97.55,122.33 96.79,119.59 96.04,116.85 95.28,114.11 94.53,111.37 93.79,108.62 93.05,105.88 92.73,103.07 93.18,100.27 94.42,97.72 96.32,95.62 98.7,94.08 101.4,93.21","108.14,135.9 111.13,136.06 114.08,136.56 116.95,137.39 119.71,138.55 122.31,140.03 124.71,141.81 126.86,143.89 128.73,146.23 130.27,148.8 131.44,151.55 132.22,154.44 132.56,157.41 132.47,160.4 131.93,163.34 130.96,166.17 129.6,168.83 127.87,171.28 125.83,173.46 123.51,175.35 120.96,176.91 118.23,178.13 115.36,179 112.42,179.52 109.43,179.7 106.44,179.54 103.49,179.04 100.62,178.21 97.86,177.06 95.26,175.58 92.86,173.79 90.71,171.71 88.84,169.37 87.3,166.81 86.13,164.06 85.35,161.17 85.01,158.2 85.11,155.21 85.64,152.26 86.61,149.43 87.97,146.77 89.7,144.33 91.74,142.14 94.06,140.25 96.61,138.69 99.34,137.47 102.21,136.6 105.15,136.08|175.67,128.81 177.16,128.85 178.62,129.14 180.01,129.67 181.28,130.44 182.41,131.42 183.36,132.57 184.12,133.85 184.68,135.23 185.05,136.68 185.24,138.15 185.27,139.64 185.13,141.13 184.85,142.59 184.42,144.02 183.85,145.4 183.15,146.72 182.33,147.96 181.38,149.11 180.32,150.16 179.15,151.08 177.88,151.87 176.53,152.49 175.1,152.91 173.62,153.11 172.13,153.07 170.67,152.78 169.28,152.24 168.01,151.47 166.88,150.49 165.93,149.35 165.18,148.06 164.61,146.68 164.24,145.24 164.05,143.76 164.02,142.27 164.16,140.78 164.44,139.32 164.87,137.89 165.44,136.51 166.14,135.2 166.96,133.95 167.91,132.8 168.97,131.75 170.14,130.83 171.4,130.04 172.76,129.43 174.19,129.01","103.39,78.25 106.56,78.38 109.59,79.28 112.29,80.94 114.43,83.28 115.86,86.1 116.52,89.2 116.32,92.37 115.62,95.46 114.86,98.55 114.1,101.63 113.36,104.72 112.63,107.81 111.91,110.91 111.2,114.01 110.51,117.1 109.82,120.21 109.16,123.31 108.52,126.42 107.84,129.53 106.8,132.52 105.04,135.16 102.66,137.25 99.81,138.63 96.7,139.2 93.54,138.96 90.53,137.95 87.87,136.24 85.71,133.92 84.21,131.13 83.48,128.05 83.5,124.88 84,121.74 84.7,118.64 85.4,115.54 86.08,112.44 86.77,109.34 87.48,106.24 88.19,103.15 88.92,100.05 89.66,96.96 90.41,93.88 91.18,90.8 91.95,87.71 93.1,84.76 94.95,82.19 97.4,80.19 100.28,78.86|161.99,91.57 165.07,92 167.9,93.28 170.32,95.23 172.22,97.69 173.49,100.53 174.05,103.59 173.93,106.7 173.45,109.78 172.9,112.85 172.33,115.91 171.71,118.97 171.06,122.02 170.38,125.06 169.66,128.09 168.91,131.12 168.13,134.14 167.33,137.15 166.5,140.16 165.58,143.14 164.33,145.98 162.5,148.5 160.15,150.53 157.38,151.95 154.34,152.61 151.24,152.43 148.32,151.38 145.83,149.52 143.99,147.01 142.95,144.08 142.73,140.98 143.25,137.91 144.09,134.91 144.94,131.91 145.76,128.9 146.54,125.89 147.29,122.86 148.01,119.83 148.69,116.79 149.34,113.74 149.95,110.68 150.54,107.62 151.09,104.55 151.6,101.47 152.44,98.48 154,95.79 156.21,93.6 158.94,92.12","47.23,91.05 51.61,92.47 55.26,95.29 57.96,99.03 59.7,103.31 60.56,107.85 61.28,112.42 62.11,116.97 63.06,121.51 64.11,126.01 65.28,130.49 66.56,134.94 67.95,139.35 69.44,143.73 71.05,148.07 72.77,152.37 74.62,156.61 76.52,160.83 78.06,165.19 78.52,169.78 77.62,174.3 75.2,178.22 71.44,180.86 66.96,181.91 62.36,181.55 57.99,180.06 54.03,177.68 50.59,174.58 47.77,170.92 45.62,166.83 43.74,162.6 41.96,158.33 40.29,154.01 38.72,149.66 37.27,145.26 35.93,140.83 34.69,136.37 33.56,131.88 32.55,127.37 31.65,122.83 30.85,118.27 30.2,113.69 30.08,109.07 30.85,104.51 32.49,100.19 35.01,96.32 38.44,93.24 42.64,91.35|108.93,73.38 113.76,73.6 118.38,75.01 122.49,77.56 125.82,81.07 128.1,85.34 129.65,89.93 131.04,94.58 132.43,99.22 133.82,103.87 135.22,108.51 136.6,113.16 137.99,117.81 139.36,122.46 140.73,127.11 142.13,131.76 143.51,136.41 144.82,141.08 145.51,145.86 144.91,150.66 143.09,155.14 140.17,158.99 136.38,162.01 132,164.05 127.26,165.03 122.42,164.86 117.79,163.48 113.67,160.95 110.36,157.43 108.17,153.11 106.72,148.49 105.36,143.83 103.99,139.18 102.62,134.53 101.24,129.88 99.87,125.23 98.48,120.58 97.09,115.93 95.7,111.29 94.29,106.64 92.89,102 91.49,97.36 90.81,92.57 91.38,87.77 93.14,83.26 96.02,79.37 99.79,76.34 104.18,74.32","102.86,129.56 106.39,129.96 109.85,130.76 113.21,131.94 116.4,133.5 119.39,135.42 122.13,137.69 124.56,140.28 126.64,143.16 128.33,146.29 129.59,149.61 130.37,153.08 130.66,156.62 130.43,160.16 129.68,163.63 128.42,166.96 126.7,170.07 124.54,172.89 122.02,175.39 119.18,177.52 116.07,179.25 112.76,180.54 109.31,181.4 105.78,181.82 102.23,181.83 98.7,181.42 95.24,180.62 91.88,179.44 88.69,177.88 85.7,175.96 82.96,173.69 80.53,171.1 78.45,168.22 76.76,165.1 75.5,161.77 74.72,158.31 74.44,154.77 74.67,151.22 75.41,147.75 76.67,144.42 78.39,141.32 80.55,138.49 83.07,135.99 85.91,133.86 89.02,132.14 92.33,130.84 95.78,129.99 99.31,129.56|180.44,141.06 183.61,141.1 186.72,141.68 189.66,142.86 192.28,144.63 194.43,146.96 196,149.71 197,152.72 197.48,155.86 197.51,159.03 197.15,162.18 196.43,165.27 195.38,168.26 194.07,171.15 192.52,173.92 190.74,176.55 188.77,179.03 186.6,181.35 184.25,183.48 181.74,185.41 179.06,187.12 176.23,188.56 173.28,189.71 170.21,190.52 167.07,190.95 163.9,190.91 160.78,190.33 157.84,189.15 155.22,187.37 153.08,185.04 151.51,182.29 150.51,179.28 150.03,176.15 150,172.98 150.36,169.83 151.07,166.74 152.12,163.74 153.43,160.85 154.99,158.09 156.76,155.46 158.74,152.98 160.91,150.66 163.25,148.53 165.77,146.59 168.45,144.89 171.27,143.45 174.23,142.3 177.29,141.48","86.02,131.33 88.42,131.69 90.54,132.87 92.12,134.71 93.03,136.97 93.17,139.39 92.41,141.69 90.78,143.48 88.59,144.52 86.19,144.97 83.78,145.34 81.37,145.72 78.96,146.09 76.54,146.45 74.13,146.81 71.72,147.16 69.3,147.5 66.88,147.84 64.47,148.16 62.05,148.47 59.62,148.76 57.2,149.03 54.77,149.27 52.34,149.49 49.91,149.68 47.53,149.28 45.52,147.92 44.04,145.99 43.12,143.74 42.85,141.32 43.44,138.97 45.04,137.17 47.33,136.4 49.76,136.2 52.19,135.96 54.62,135.7 57.04,135.43 59.46,135.15 61.89,134.85 64.31,134.54 66.72,134.22 69.14,133.89 71.56,133.54 73.97,133.19 76.38,132.83 78.79,132.45 81.2,132.06 83.61,131.67|153.42,116.84 155.92,117.69 157.78,119.56 158.72,122.03 158.73,124.68 157.84,127.18 156.08,129.15 153.71,130.33 151.13,131 148.55,131.65 145.98,132.32 143.4,132.98 140.82,133.63 138.23,134.27 135.65,134.9 133.06,135.53 130.47,136.15 127.88,136.76 125.29,137.36 122.69,137.94 120.09,138.51 117.49,139.06 114.88,139.59 112.27,140.1 109.62,140.12 107.17,139.14 105.28,137.29 104.18,134.88 104.06,132.23 105.03,129.78 106.92,127.93 109.35,126.87 111.96,126.34 114.57,125.8 117.17,125.24 119.77,124.67 122.37,124.09 124.96,123.5 127.56,122.9 130.15,122.29 132.74,121.68 135.32,121.05 137.91,120.41 140.49,119.76 143.07,119.11 145.65,118.44 148.22,117.76 150.78,117.03","83.36,65.84 86.61,66.42 89.57,67.88 92,70.12 93.67,72.97 94.46,76.17 94.31,79.47 93.61,82.71 92.8,85.92 92.02,89.14 91.27,92.36 90.56,95.6 89.88,98.84 89.23,102.09 88.62,105.34 88.03,108.61 87.51,111.88 87.01,115.15 86.5,118.42 85.65,121.62 84.11,124.54 81.9,126.99 79.13,128.79 75.98,129.8 72.68,129.91 69.47,129.13 66.6,127.49 64.24,125.18 62.49,122.38 61.42,119.25 61.08,115.97 61.36,112.67 61.87,109.4 62.45,106.13 63.01,102.87 63.61,99.61 64.24,96.36 64.9,93.11 65.6,89.87 66.33,86.64 67.09,83.42 67.89,80.2 68.73,77 69.89,73.9 71.7,71.14 74.1,68.86 76.93,67.16 80.07,66.12|119.49,99.16 121.99,99.28 124.44,99.82 126.9,100.34 129.36,100.86 131.81,101.38 134.27,101.91 136.72,102.44 139.17,102.98 141.62,103.52 144.08,104.07 146.52,104.62 148.97,105.18 151.42,105.74 153.86,106.31 156.31,106.89 158.75,107.47 161.2,108.02 163.49,109.03 165.16,110.87 165.95,113.24 165.87,115.74 164.94,118.05 163.17,119.8 160.79,120.55 158.31,120.29 155.88,119.65 153.44,119.06 150.99,118.49 148.55,117.92 146.1,117.36 143.65,116.81 141.2,116.26 138.75,115.73 136.29,115.2 133.84,114.67 131.38,114.15 128.93,113.62 126.47,113.1 124.02,112.57 121.56,112.04 119.11,111.5 116.81,110.53 115.08,108.73 114.22,106.39 114.29,103.9 115.28,101.61 117.12,99.93","168.71,85.67 170.73,86 172.64,86.75 174.37,87.85 175.88,89.24 177.11,90.88 178.04,92.71 178.71,94.65 179.21,96.64 179.64,98.65 180.05,100.66 180.45,102.67 180.83,104.69 181.18,106.71 181.5,108.74 181.77,110.78 181.88,112.82 181.71,114.87 181.22,116.86 180.41,118.74 179.27,120.45 177.83,121.91 176.12,123.03 174.2,123.74 172.16,123.99 170.13,123.75 168.21,123.04 166.49,121.93 165.03,120.48 163.88,118.79 163.02,116.93 162.49,114.95 162.17,112.92 161.85,110.89 161.51,108.87 161.14,106.84 160.77,104.83 160.37,102.81 159.96,100.8 159.52,98.79 159.24,96.76 159.3,94.71 159.71,92.7 160.48,90.8 161.58,89.08 163.01,87.61 164.73,86.49 166.67,85.83|206.57,78.24 208.3,78.8 209.77,79.87 210.99,81.22 212.01,82.73 212.85,84.34 213.53,86.03 214.08,87.77 214.54,89.54 214.95,91.31 215.34,93.09 215.7,94.88 216.04,96.67 216.36,98.46 216.64,100.26 216.89,102.07 217.11,103.88 217.25,105.7 217.26,107.52 217.1,109.33 216.75,111.12 216.16,112.84 215.3,114.44 214.04,115.75 212.34,116.35 210.58,115.96 209.11,114.89 207.97,113.48 207.1,111.88 206.44,110.18 205.97,108.42 205.62,106.63 205.35,104.83 205.11,103.02 204.85,101.22 204.55,99.42 204.22,97.63 203.87,95.84 203.49,94.05 203.09,92.28 202.67,90.5 202.32,88.71 202.1,86.91 202.1,85.08 202.32,83.28 202.77,81.51 203.54,79.86 204.82,78.59","39.78,104.3 42.64,105.01 45.03,106.74 46.73,109.15 47.75,111.93 48.35,114.83 48.81,117.76 49.31,120.68 49.87,123.6 50.48,126.5 51.15,129.39 51.86,132.27 52.63,135.13 53.44,137.98 54.3,140.82 55.19,143.65 56.13,146.46 57.1,149.26 58.1,152.05 58.86,154.92 58.96,157.87 58.18,160.72 56.43,163.09 53.84,164.48 50.9,164.62 48.08,163.75 45.58,162.16 43.51,160.05 41.89,157.57 40.67,154.87 39.67,152.08 38.73,149.26 37.81,146.44 36.94,143.61 36.11,140.76 35.34,137.9 34.61,135.03 33.92,132.14 33.28,129.24 32.7,126.34 32.16,123.42 31.67,120.5 31.23,117.57 31.14,114.61 31.65,111.69 32.74,108.94 34.47,106.54 36.89,104.86|108.97,125.73 111.9,126.2 114.63,127.37 117,129.16 118.84,131.49 119.99,134.23 120.32,137.18 119.85,140.11 118.59,142.8 116.78,145.16 114.84,147.42 112.89,149.67 110.93,151.92 108.97,154.16 107.01,156.39 105.03,158.62 103.05,160.85 101.07,163.06 99.07,165.28 97.09,167.5 95.09,169.71 93.05,171.88 90.69,173.67 87.89,174.66 84.93,174.81 82.02,174.22 79.31,173 76.92,171.24 74.99,168.98 73.7,166.3 73.26,163.37 73.74,160.45 75.2,157.86 77.17,155.63 79.18,153.43 81.18,151.23 83.17,149.02 85.16,146.8 87.14,144.58 89.11,142.35 91.08,140.11 93.04,137.87 95,135.63 96.95,133.38 98.89,131.12 100.87,128.89 103.25,127.12 106.02,126.04","115.43,87.59 118.19,88.24 120.69,89.59 122.69,91.59 124.03,94.09 124.63,96.87 124.41,99.7 123.7,102.45 122.9,105.18 122.12,107.92 121.34,110.65 120.57,113.39 119.79,116.13 119.02,118.87 118.25,121.61 117.48,124.35 116.72,127.09 115.97,129.83 115.23,132.58 114.45,135.32 113.3,137.91 111.49,140.09 109.13,141.65 106.41,142.48 103.58,142.56 100.82,141.91 98.33,140.54 96.33,138.53 94.99,136.03 94.38,133.26 94.57,130.43 95.25,127.67 96.02,124.93 96.79,122.19 97.55,119.45 98.31,116.7 99.08,113.96 99.85,111.22 100.62,108.49 101.4,105.75 102.18,103.01 102.95,100.27 103.74,97.54 104.51,94.8 105.68,92.21 107.5,90.04 109.88,88.5 112.59,87.67|155.37,78.64 158.04,79.15 160.48,80.37 162.53,82.16 164.33,84.22 166.1,86.3 167.85,88.4 169.58,90.51 171.29,92.64 172.98,94.78 174.65,96.94 176.3,99.12 177.92,101.32 179.51,103.54 181.06,105.79 182.57,108.07 184.03,110.37 185.2,112.83 185.77,115.5 185.73,118.23 185.07,120.87 183.8,123.28 181.94,125.26 179.57,126.6 176.89,127.03 174.24,126.43 171.99,124.92 170.26,122.8 168.75,120.53 167.22,118.27 165.66,116.03 164.07,113.81 162.45,111.6 160.82,109.41 159.16,107.25 157.47,105.1 155.76,102.97 154.03,100.85 152.28,98.76 150.51,96.68 148.74,94.6 147.29,92.29 146.49,89.69 146.36,86.97 146.94,84.31 148.23,81.91 150.19,80.02 152.66,78.89","92.71,76.24 95.76,76.59 98.73,77.35 101.56,78.53 104.21,80.08 106.63,81.96 108.78,84.16 110.61,86.62 112.09,89.31 113.19,92.17 113.91,95.15 114.24,98.2 114.18,101.27 113.73,104.31 112.9,107.26 111.7,110.09 110.15,112.73 108.28,115.17 106.12,117.35 103.71,119.24 101.08,120.83 98.27,122.07 95.33,122.95 92.3,123.44 89.23,123.51 86.18,123.17 83.21,122.41 80.38,121.23 77.73,119.69 75.31,117.8 73.16,115.61 71.33,113.14 69.86,110.45 68.75,107.59 68.02,104.61 67.7,101.56 67.76,98.49 68.22,95.46 69.05,92.5 70.25,89.68 71.8,87.03 73.67,84.59 75.83,82.41 78.24,80.52 80.87,78.93 83.67,77.69 86.61,76.81 89.64,76.32|157.73,102.08 159.31,102.13 160.86,102.42 162.35,102.95 163.74,103.69 165.01,104.62 166.15,105.72 167.13,106.95 167.96,108.29 168.63,109.72 169.13,111.22 169.45,112.76 169.59,114.34 169.55,115.91 169.31,117.47 168.88,118.99 168.28,120.45 167.52,121.83 166.58,123.1 165.48,124.23 164.25,125.22 162.89,126.02 161.43,126.63 159.91,127.02 158.34,127.2 156.76,127.14 155.21,126.85 153.73,126.33 152.33,125.59 151.06,124.65 149.93,123.56 148.94,122.33 148.11,120.99 147.44,119.56 146.95,118.06 146.62,116.51 146.48,114.94 146.52,113.37 146.76,111.8 147.18,110.28 147.78,108.83 148.56,107.45 149.5,106.18 150.59,105.05 151.83,104.07 153.18,103.26 154.64,102.65 156.17,102.26","57.98,112.03 61.01,112.26 63.82,113.41 66.22,115.27 68.09,117.67 69.36,120.44 70.14,123.39 70.64,126.39 71.07,129.41 71.58,132.42 72.15,135.41 72.76,138.4 73.4,141.38 74.09,144.35 74.82,147.31 75.59,150.26 76.42,153.2 77.3,156.12 78.16,159.04 78.68,162.04 78.42,165.07 77.28,167.88 75.25,170.13 72.54,171.49 69.52,171.87 66.51,171.44 63.69,170.32 61.16,168.61 59.03,166.44 57.38,163.89 56.23,161.06 55.34,158.15 54.53,155.21 53.73,152.27 52.97,149.31 52.25,146.35 51.57,143.38 50.93,140.4 50.34,137.41 49.78,134.41 49.26,131.4 48.78,128.39 48.37,125.37 48.37,122.33 49.06,119.36 50.44,116.65 52.47,114.39 55.04,112.78|117.45,101.46 120.57,101.84 123.48,103.02 125.99,104.91 127.97,107.35 129.25,110.23 130.05,113.27 130.76,116.34 131.46,119.41 132.15,122.49 132.85,125.56 133.55,128.63 134.24,131.71 134.93,134.78 135.61,137.86 136.32,140.93 137.01,144 137.66,147.09 137.87,150.22 137.25,153.3 135.83,156.1 133.73,158.45 131.15,160.23 128.22,161.38 125.11,161.83 121.98,161.5 119.05,160.37 116.52,158.51 114.57,156.05 113.37,153.14 112.64,150.08 111.95,147 111.27,143.93 110.58,140.85 109.89,137.78 109.2,134.7 108.51,131.63 107.81,128.56 107.12,125.48 106.42,122.41 105.71,119.34 105.02,116.27 104.83,113.13 105.42,110.04 106.79,107.22 108.84,104.83 111.41,103.02 114.33,101.87","113.75,120.08 118.16,120.78 122.31,122.43 125.98,124.96 128.94,128.29 131.02,132.23 132.12,136.56 132.1,141.02 131.16,145.38 129.94,149.68 128.69,153.98 127.44,158.27 126.19,162.56 124.92,166.85 123.64,171.14 122.35,175.42 121.05,179.69 119.76,183.97 118.46,188.25 117.05,192.49 114.84,196.36 111.47,199.27 107.42,201.12 103.04,201.99 98.58,201.97 94.18,201.19 89.97,199.7 86.1,197.48 82.8,194.48 80.41,190.72 79.31,186.41 79.87,182 81.24,177.74 82.57,173.47 83.88,169.2 85.19,164.92 86.48,160.64 87.75,156.36 89.02,152.07 90.28,147.78 91.53,143.49 92.77,139.19 93.97,134.88 95.5,130.69 97.93,126.95 101.16,123.87 105.02,121.64 109.3,120.36|181.19,127.71 185.4,128.03 189.23,129.79 192.19,132.8 194.06,136.59 194.87,140.74 194.76,144.98 194.21,149.18 193.55,153.37 192.79,157.55 191.91,161.69 190.91,165.82 189.8,169.91 188.57,173.97 187.22,177.99 185.72,181.96 184.07,185.87 182.26,189.7 180.26,193.44 177.85,196.92 174.93,199.99 171.62,202.64 168,204.85 164.13,206.59 160.07,207.78 155.86,208.24 151.69,207.6 148.31,205.16 147.33,201.11 148.48,197.06 150.4,193.28 152.24,189.46 153.93,185.56 155.48,181.61 156.89,177.62 158.17,173.57 159.32,169.49 160.35,165.38 161.26,161.23 162.06,157.07 162.7,152.87 163.29,148.67 164.12,144.52 165.46,140.5 167.49,136.78 170.16,133.49 173.37,130.73 177.08,128.7","52.43,111.88 55.76,112.3 59,113.21 62.08,114.57 64.96,116.3 67.61,118.36 70.01,120.71 72.16,123.3 74.02,126.1 75.61,129.06 76.9,132.17 77.89,135.38 78.56,138.68 78.89,142.02 78.86,145.39 78.45,148.72 77.63,151.98 76.39,155.11 74.74,158.03 72.67,160.68 70.2,162.96 67.38,164.79 64.28,166.08 61,166.78 57.64,166.91 54.3,166.49 51.07,165.57 47.99,164.22 45.11,162.49 42.46,160.42 40.05,158.07 37.91,155.48 36.04,152.68 34.46,149.72 33.16,146.62 32.17,143.4 31.51,140.11 31.18,136.76 31.21,133.4 31.62,130.06 32.44,126.8 33.67,123.68 35.33,120.75 37.4,118.1 39.86,115.82 42.68,114 45.79,112.71 49.07,112.01|126.89,95.19 130.56,95.44 134.16,96.17 137.64,97.36 140.94,98.99 143.98,101.06 146.73,103.5 149.13,106.29 151.14,109.37 152.72,112.69 153.86,116.19 154.54,119.8 154.74,123.47 154.45,127.14 153.67,130.74 152.43,134.2 150.76,137.48 148.69,140.51 146.25,143.27 143.48,145.69 140.43,147.75 137.14,149.39 133.66,150.59 130.06,151.32 126.39,151.56 122.72,151.31 119.11,150.59 115.63,149.4 112.34,147.76 109.29,145.7 106.54,143.26 104.14,140.47 102.13,137.39 100.55,134.07 99.41,130.57 98.73,126.96 98.53,123.28 98.83,119.62 99.6,116.02 100.84,112.56 102.51,109.28 104.59,106.25 107.03,103.49 109.79,101.07 112.84,99.01 116.13,97.36 119.61,96.16 123.22,95.43","72.34,79.33 74.93,79.64 77.52,79.94 80.12,80.25 82.71,80.57 85.3,80.91 87.88,81.26 90.47,81.63 93.05,82 95.63,82.39 98.21,82.79 100.79,83.21 103.37,83.63 105.94,84.07 108.51,84.52 111.09,84.92 113.65,85.44 115.99,86.56 117.75,88.47 118.68,90.89 118.57,93.48 117.47,95.83 115.57,97.6 113.16,98.56 110.56,98.58 108,98.1 105.43,97.64 102.85,97.19 100.28,96.76 97.7,96.33 95.12,95.93 92.54,95.53 89.96,95.14 87.38,94.77 84.79,94.4 82.2,94.06 79.62,93.72 77.02,93.41 74.43,93.11 71.84,92.81 69.24,92.5 66.78,91.69 64.99,89.83 64.25,87.35 64.5,84.76 65.58,82.39 67.38,80.53 69.74,79.45|136.83,90.25 139.33,90.71 141.8,91.34 144.28,91.93 146.75,92.53 149.22,93.14 151.69,93.77 154.15,94.4 156.62,95.05 159.08,95.71 161.53,96.38 163.98,97.07 166.43,97.76 168.88,98.47 171.32,99.2 173.75,99.94 176.19,100.67 178.49,101.74 180.18,103.62 181.12,105.98 181.31,108.51 180.69,110.96 179.21,113.01 176.98,114.19 174.46,114.13 172.02,113.41 169.58,112.66 167.14,111.93 164.7,111.22 162.25,110.52 159.8,109.84 157.34,109.17 154.88,108.52 152.42,107.88 149.95,107.26 147.48,106.64 145.01,106.03 142.54,105.42 140.06,104.81 137.59,104.21 135.12,103.61 132.78,102.62 130.96,100.86 129.93,98.55 129.77,96.02 130.49,93.59 132.06,91.61 134.31,90.46","107.05,116.19 110.26,116.71 113.26,118 115.85,119.97 117.92,122.49 119.29,125.45 120.04,128.63 120.54,131.86 121.04,135.09 121.54,138.31 122.06,141.54 122.59,144.77 123.12,147.99 123.67,151.21 124.22,154.43 124.8,157.65 125.4,160.86 125.95,164.08 126.04,167.34 125.2,170.49 123.53,173.28 121.14,175.49 118.26,177.02 115.11,177.87 111.85,178.04 108.63,177.56 105.58,176.41 102.87,174.58 100.72,172.14 99.35,169.18 98.61,166 98.04,162.78 97.47,159.57 96.91,156.35 96.36,153.13 95.83,149.9 95.3,146.68 94.78,143.45 94.27,140.22 93.76,137 93.26,133.77 92.82,130.53 92.96,127.27 93.87,124.15 95.55,121.35 97.88,119.07 100.68,117.41 103.79,116.44|189.21,121.96 191.36,122.71 192.8,124.5 193.41,126.73 193.32,129.04 192.59,131.23 191.22,133.09 189.28,134.34 187.12,135.19 184.95,136 182.78,136.83 180.61,137.63 178.43,138.43 176.24,139.2 174.05,139.95 171.85,140.69 169.64,141.4 167.43,142.09 165.21,142.76 162.98,143.42 160.75,144.05 158.51,144.66 156.27,145.25 154.02,145.81 151.72,145.98 149.57,145.18 148.01,143.49 147.25,141.31 147.31,139 148.16,136.86 149.7,135.14 151.74,134.05 153.97,133.43 156.21,132.84 158.45,132.22 160.68,131.59 162.91,130.93 165.13,130.26 167.34,129.58 169.55,128.87 171.76,128.15 173.95,127.41 176.15,126.65 178.33,125.87 180.51,125.08 182.68,124.26 184.84,123.41 186.98,122.53","98.62,121.53 100.72,121.6 102.78,122.03 104.72,122.83 106.49,123.97 108.01,125.42 109.24,127.12 110.15,129.02 110.66,131.05 110.78,133.15 110.62,135.25 110.34,137.33 110.04,139.42 109.76,141.5 109.49,143.59 109.21,145.68 108.92,147.76 108.6,149.84 108.08,151.88 107.18,153.78 105.92,155.45 104.34,156.83 102.51,157.86 100.51,158.52 98.43,158.81 96.33,158.72 94.28,158.27 92.33,157.47 90.57,156.33 89.03,154.89 87.78,153.21 86.85,151.32 86.29,149.3 86.13,147.2 86.28,145.11 86.57,143.02 86.9,140.94 87.2,138.86 87.49,136.78 87.79,134.69 88.08,132.61 88.4,130.53 88.96,128.5 89.88,126.61 91.15,124.94 92.73,123.56 94.56,122.52 96.54,121.84|155.31,127.29 157.36,127.43 159.33,127.99 161.14,128.96 162.7,130.29 163.95,131.92 164.84,133.77 165.35,135.75 165.49,137.8 165.35,139.85 165.07,141.89 164.79,143.92 164.53,145.96 164.26,148 163.97,150.04 163.65,152.06 163.27,154.09 162.7,156.06 161.83,157.92 160.68,159.62 159.29,161.13 157.69,162.41 155.9,163.42 153.97,164.1 151.94,164.41 149.89,164.32 147.9,163.82 146.06,162.92 144.47,161.62 143.24,159.98 142.41,158.1 142,156.09 142.01,154.04 142.32,152.01 142.64,149.98 142.96,147.95 143.25,145.92 143.51,143.88 143.73,141.83 143.97,139.79 144.27,137.76 144.74,135.76 145.53,133.87 146.62,132.13 147.98,130.59 149.57,129.28 151.35,128.27 153.28,127.58"],rO=Tre.map(e=>e.split("|").map(t=>t.split(" ").map(a=>{const[o,i]=a.split(",");return[Number(o),Number(i)]}))),gx=e=>{let t=0,a=0;for(const o of e)t+=o[0],a+=o[1];return[t/e.length,a/e.length]},Nh=rO.map(e=>{const t=gx(e[0]),a=gx(e[1]);return[(t[0]+a[0])/2-pM[0],(t[1]+a[1])/2-pM[1]]}),Py=rO.map((e,t)=>e.map(a=>a.map(o=>[o[0]-Nh[t][0],o[1]-Nh[t][1]]))),ow=Py.length,iw=[[14,3,20,0],[13,1,20,0],[25,14,13,0],[11,4,18,0],[16,-2,22,0],[15,-3,20,6],[12,2,20,0],[17,-7,18,0],[15,5,20,0],[12,3,20,0],[14,1,20,0],[23,12,13,0],[12,2,20,0],[16,-3,22,0],[15,-2,20,-6],[12,5,20,0],[16,-4,18,0],[20,11,18,0],[11,2,20,0],[17,8,20,0],[15,5,10,0],[12,4,18,0],[16,-3,22,0],[15,-5,20,7],[11,6,20,0]],Bre=7.5;function Ere(e,t){const a=gx(e[0]),o=gx(e[1]),i=Math.atan2(o[1]-a[1],o[0]-a[0]);let s=0;for(const c of e){let d=1/0,p=-1/0;for(const h of c)h[1]<d&&(d=h[1]),h[1]>p&&(p=h[1]);s=Math.max(s,(p-d)/2)}const r=s+t[2];return{x:(a[0]+o[0])/2-Math.sin(i)*r,y:(a[1]+o[1])/2+Math.cos(i)*r,angle:i+t[3]*Math.PI/180}}const{id:CDe,...Rre}=IS.cursor,Dre=Rre,Ore=["#9FE6B5","#3FAE6E","#1C7A4C"],zre=`-15 -15 ${ap+30} ${ap+30}`,jb=114.2705,Nb=105,Lre={sleeping:{pulse:[.028,4600],tilt:2},waking:{enter:[.92,700],pulse:[.03,2200]},idle:{pulse:[.014,3600]},listening:{bob:[2,2600],pulse:[.012,2600]},thinking:{sway:[1.6,3e3],pulse:[.01,3e3]},searching:{bob:[3,1400],sway:[2.2,1400]},working:{bob:[2.5,900],squash:.22},excited:{bob:[9,520],sway:[3,1040],squash:.35},surprised:{enter:[1.14,340],jitter:[.8,120]},suspicious:{sway:[2.4,2600],tilt:-3},angry:{jitter:[1.3,95],tilt:2},drowsy:{pulse:[.026,5e3],tilt:3},happy:{bob:[5,820],squash:.28},curious:{sway:[3.4,1900],tilt:-4},confused:{sway:[3,2200]},bored:{pulse:[.016,5200],tilt:2},proud:{bob:[1.6,2400],pulse:[.02,2400]},shy:{pulse:[.016,3e3],tilt:4},sad:{pulse:[.02,4600],tilt:3},laughing:{bob:[7,430],squash:.4},scared:{jitter:[2.2,75]},playful:{bob:[6,620],sway:[5,1240],squash:.3},celebrate:{bob:[10,480],sway:[4,960],squash:.35},orbit:{circle:[6,3200]},radar:{sway:[6,2400],pulse:[.012,2400]},progress:{pulse:[.022,1600]},spawning:{enter:[.02,820],pulse:[.014,3600]},humming:{pulse:[.016,2800]},loading:{sway:[2.2,1500],pulse:[.012,1500]},dictating:{bob:[2,2e3]},writing:{bob:[1.6,1100]},sending:{bob:[3,900]},receiving:{bob:[3,900]},uploading:{bob:[3,1e3]},notifying:{bob:[4,700],sway:[2.5,700]},alerting:{jitter:[2.6,85]},dragging:{tilt:-6,sway:[2,900]},bouncing:{bob:[12,560],squash:.45},"powering-down":{settle:.05,tilt:4}},_re=1400,x3=Math.PI*2,Ah=e=>{const t=Math.sin(e*127.1+311.7)*43758.5453;return t-Math.floor(t)},hM=["#F472B6","#C084FC","#818CF8","#38BDF8","#34D399","#FACC15","#FB7185"],gM=["#4ADE80","#34D399","#22D3EE","#60A5FA"],fM='<path fill="{{GRADIENT}}" d="M99 58 Q99 43 114.3 43 Q129.6 43 129.6 58 L123 150 Q122 161 114.3 161 Q106.6 161 105.6 150 Z"/><circle fill="{{GRADIENT}}" cx="114.3" cy="188" r="15"/>',Fre='<path fill="none" stroke="{{GRADIENT}}" stroke-width="19" stroke-linecap="round" d="M88 76 A27 27 0 1 1 114.3 112 L114.3 132"/><circle fill="{{GRADIENT}}" cx="114.3" cy="170" r="13"/>',qre={celebrate:{confetti:{count:16,period:1500,life:1300,origin:74,spread:54}},excited:{confetti:{count:9,period:2e3,life:1100,origin:72,spread:44}},laughing:{confetti:{count:7,period:2400,life:1e3,origin:70,spread:38}},orbit:{trails:{count:3,period:2600,radius:128}},radar:{trails:{count:2,period:2e3,radius:132}},progress:{trails:{count:3,period:1800,radius:124}},loading:{trails:{count:2,period:2200,radius:126}},uploading:{trails:{count:2,period:1700,radius:122}},sending:{trails:{count:2,period:1500,radius:120}},receiving:{trails:{count:2,period:1500,radius:120}},alerting:{glyph:{markup:fM,period:2600,hold:1100}},notifying:{glyph:{markup:fM,period:4200,hold:900}},confused:{glyph:{markup:Fre,period:5200,hold:1200}}},Ure="http://www.w3.org/2000/svg";function lO(e,t){for(;e.childNodes.length>t;)e.removeChild(e.lastChild);for(;e.childNodes.length<t;){const a=document.createElementNS(Ure,"path");a.setAttribute("stroke-linecap","round"),a.setAttribute("fill","none"),e.appendChild(a)}return Array.from(e.querySelectorAll(":scope > path"))}function Vre(e,t,a,o,i,s){const r=lO(e,t.count);for(let c=0;c<t.count;c++){const d=r[c],p=Ah(c+1),h=Ah(c+41),g=Ah(c+91),b=(a+g*t.period)%t.period/t.life*1;if(b>1){d.setAttribute("opacity","0");continue}const x=p*x3,v=t.spread*(.45+h*.55)*(1-(1-b)*(1-b)),k=(t.origin+v)*o,w=34*o*b*b,N=i+Math.cos(x)*k,C=s+Math.sin(x)*k+w,j=11+h*12,M=x+(g-.5)*5*b,E=N+Math.cos(M)*j,A=C+Math.sin(M)*j,R=(p-.5)*j*.7,B=(N+E)/2-Math.sin(M)*R,O=(C+A)/2+Math.cos(M)*R;d.setAttribute("d",`M${N.toFixed(1)} ${C.toFixed(1)} Q${B.toFixed(1)} ${O.toFixed(1)} ${E.toFixed(1)} ${A.toFixed(1)}`),d.setAttribute("stroke",hM[c%hM.length]),d.setAttribute("stroke-width",(4+h*2.4).toFixed(1)),d.setAttribute("opacity",(b<.12?b/.12:1-(b-.12)/.88).toFixed(3))}}function Hre(e,t,a,o,i,s){const r=lO(e,t.count),c=12;for(let d=0;d<t.count;d++){const p=r[d],h=Ah(d+3),g=Ah(d+29),b=d%2===0?1:-1,x=t.period*(.8+h*.5),v=t.radius*o*(.78+g*.4),k=b*(a/x)*x3+h*x3,w=.85+g*.7;let N="";for(let C=0;C<=c;C++){const j=C/c,M=k+w*j,E=v*(1+Math.sin(j*Math.PI)*.14),A=i+Math.cos(M)*E,R=s+Math.sin(M)*E*.78;N+=(C===0?"M":"L")+A.toFixed(1)+" "+R.toFixed(1)}p.setAttribute("d",N),p.setAttribute("stroke",gM[d%gM.length]),p.setAttribute("stroke-width",(5+h*3).toFixed(1)),p.setAttribute("opacity","0.85")}}function $re(e,t){const a=t%e.period,o=e.period-e.hold;if(a<o)return 0;const i=a-o,s=e.hold-i;return Math.max(0,Math.min(1,Math.min(i,s)/200))}function Gre(e){const t=qre[e.state],a=ap/2,o=e.strength;if(e.trails&&(t?.trails&&e.showEffects&&o>0?Hre(e.trails,t.trails,e.elapsed,o,a,a):e.trails.childNodes.length&&e.trails.replaceChildren()),e.confetti&&(t?.confetti&&e.showEffects&&o>0?Vre(e.confetti,t.confetti,e.elapsed,o,a,a):e.confetti.childNodes.length&&e.confetti.replaceChildren()),e.glyph&&e.bodyContent)if(t?.glyph&&e.showGlyphs){const i=$re(t.glyph,e.elapsed),s=t.glyph.markup.replace(/\{\{GRADIENT\}\}/g,e.paint);e.glyph.getAttribute("data-glyph")!==s&&(e.glyph.setAttribute("data-glyph",s),e.glyph.innerHTML=s),e.glyph.style.opacity=String(i);const r=.72+.28*i;e.glyph.setAttribute("transform",`translate(${a} ${a}) scale(${r.toFixed(3)}) translate(${-a} ${-a})`),e.bodyContent.style.opacity=String(1-i)}else e.glyph.getAttribute("data-glyph")&&(e.glyph.removeAttribute("data-glyph"),e.glyph.replaceChildren()),e.glyph.style.opacity="0",e.bodyContent.style.opacity="1"}const fx={sleeping:[22,13,4],waking:[13],idle:[6,0,8],listening:[1,10,19],thinking:[17,8,16,14,5],searching:[20,15,9,3,12,18],working:[10,7,16,11],excited:[2,17,21,3,11],surprised:[21,3],suspicious:[5,14,23],angry:[7,16],drowsy:[22,4,13],happy:[19,2,11,17],curious:[21,3,0,15],confused:[8,14,5],bored:[0,4,22],proud:[2,15,8],shy:[24,0,13],sad:[22,4,13],laughing:[2,11,17],scared:[21,3],playful:[2,17,11,8],celebrate:[2,8,17],orbit:[6,0,8],radar:[6,0,8],progress:[6,0,8],spawning:[3,0],humming:[6,0,8],loading:[6,0,8],dictating:[1,10,19],sending:[6,0,8],receiving:[19,0,8],uploading:[15,9,8],writing:[15,9],notifying:[21,3,0],alerting:[21,3],bouncing:[2,17],dragging:[3,15,0],"powering-down":[22,13]},Kre={sleeping:[6e3,1e4],waking:[800,800],idle:[9e3,16e3],listening:[2800,5e3],thinking:[2e3,3600],searching:[1e3,1800],working:[1800,3200],excited:[1100,2e3],surprised:[2500,4e3],suspicious:[2600,4500],angry:[2200,3800],drowsy:[4e3,8e3],happy:[2500,4500],curious:[1800,3200],confused:[2200,3800],bored:[3500,6e3],proud:[3500,6e3],shy:[3e3,5500],sad:[4e3,7e3],laughing:[1200,2400],scared:[900,1800],playful:[1500,3e3],celebrate:[1400,2600],orbit:[4e3,8e3],radar:[4e3,8e3],progress:[4e3,8e3],spawning:[1200,1200],humming:[5e3,9e3],loading:[6e3,1e4],dictating:[4e3,8e3],sending:[4e3,8e3],receiving:[4e3,8e3],uploading:[4e3,8e3],writing:[4e3,8e3],notifying:[1500,2600],alerting:[2e3,3600],bouncing:[3e3,6e3],dragging:[1600,3e3],"powering-down":[6e3,9e3]},Wre={sleeping:null,waking:null,idle:[6e3,14e3],listening:[3e3,7e3],thinking:[3500,7e3],searching:[1600,4e3],working:[2800,5500],excited:[2e3,4e3],surprised:[1800,3500],suspicious:[4500,8e3],angry:[3500,7e3],drowsy:null,happy:[2500,5e3],curious:[2500,5500],confused:[2800,5500],bored:[4e3,8e3],proud:[3500,7e3],shy:[3e3,6e3],sad:[4e3,8e3],laughing:[2500,5e3],scared:[1200,3e3],playful:[2e3,4500],celebrate:[2200,4500],orbit:null,radar:null,progress:null,spawning:null,humming:[4e3,8e3],loading:null,dictating:null,sending:null,receiving:null,uploading:null,writing:null,notifying:[2e3,4e3],alerting:null,bouncing:null,dragging:[2200,4500],"powering-down":null},Jre=e=>e in fx,Yre=Object.keys(fx).filter(Jre),ws=(e,t,a)=>Math.max(t,Math.min(a,e)),bM=()=>null,Zre=e=>"M"+e.map(t=>t[0].toFixed(2)+" "+t[1].toFixed(2)).join("L")+"Z",Qre=e=>e.map(t=>t.map(a=>[a[0],a[1]])),Xre=e=>{let t=0,a=0;for(const o of e)t+=o[0],a+=o[1];return[t/e.length,a/e.length]};function ele(e,t){const a=Math.cos(e.angle),o=Math.sin(e.angle),i=(d,p)=>[e.x+d*a-p*o,e.y+d*o+p*a],s=i(-t[0],0),r=i(0,t[1]),c=i(t[0],0);return"M"+s[0].toFixed(2)+" "+s[1].toFixed(2)+" Q"+r[0].toFixed(2)+" "+r[1].toFixed(2)+" "+c[0].toFixed(2)+" "+c[1].toFixed(2)}const tle=e=>`translate(${e.x} ${e.y}) scale(${e.scale}) translate(-120 ${-122.5})`,nle=e=>{const a=e-1;return 1+(1.7+1)*a*a*a+1.7*a*a},ale=e=>e<.5?2*e*e:1-2*(1-e)*(1-e);function ole(e,t,a){if(a<=0)return"";const o=ap/2,i=ap,s=(x,v=0)=>Math.sin(t/x*Math.PI*2+v);let r=0,c=0,d=e.tilt?e.tilt*a:0,p=1,h=1,g=1;if(e.bob){const[x,v]=e.bob,k=s(v);if(c-=x*a*k,e.squash){const w=e.squash*a*Math.max(0,-k);g=1-w*.5,h=1+w*.5}}if(e.circle){const[x,v]=e.circle;r+=x*a*s(v),c+=x*a*s(v,Math.PI/2)}if(e.sway){const[x,v]=e.sway;d+=x*a*s(v)}if(e.pulse){const[x,v]=e.pulse;p*=1+x*a*s(v)}if(e.jitter){const[x,v]=e.jitter;r+=x*a*s(v),c+=x*a*s(v*.63,1.1)}if(e.enter){const[x,v]=e.enter,k=t/v;p*=k>=1?1:x+(1-x)*nle(Math.max(k,0))}if(e.settle!==void 0){const x=Math.min(Math.max(t/_re,0),1);p*=1+(e.settle-1)*ale(x)*a}const b=[];return(r||c)&&b.push(`translate(${r.toFixed(2)} ${c.toFixed(2)})`),d&&b.push(`rotate(${d.toFixed(2)} ${o} ${o})`),p!==1&&b.push(`translate(${o} ${o}) scale(${p.toFixed(4)}) translate(${-o} ${-o})`),(h!==1||g!==1)&&b.push(`translate(${o} ${i}) scale(${h.toFixed(4)} ${g.toFixed(4)}) translate(${-o} ${-i})`),b.join(" ")}const ile=ka.forwardRef(function({state:t="idle",expression:a,size:o=160,gaze:i,turn:s=0,lookAround:r=.5,flip:c=!1,spring:d=7,eyeScale:p=1,showMouth:h=!0,mouthStroke:g=Bre,motion:b,effects:x=!0,glyphs:v=!0,autoBlink:k=!0,autoExpression:w=!0,paused:N=!1,silhouette:C=Dre,gradient:j=Ore,eyeColor:M="#ffffff",title:E,className:A,style:R},B){const O=f.useId(),T=f.useMemo(()=>"mascot"+O.replace(/[^a-zA-Z0-9]/g,""),[O]),z=f.useRef(null),P=f.useRef(null),L=f.useRef(null),G=f.useRef(null),H=f.useRef(null),$=f.useRef(null),U=f.useRef(null),Q=f.useRef(null),W=f.useMemo(()=>globalThis.window?.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1,[]),q=b??(W?0:1),Y=t,ae=f.useRef({current:Qre(Py[0]),target:Py[0],currentMouth:iw[0].slice(),targetMouth:iw[0],currentGaze:[...Nh[0]],targetGaze:[...Nh[0]],expression:0,morph:1,velocity:0,blinkStart:bM(),spinStart:bM(),spinDuration:900,last:0,stateStart:0,lastState:Y,lastBodyTransform:"",pausedPaint:"",props:{state:t,expression:a,gaze:i,turn:s,spring:d,eyeScale:p,paused:N,lookAround:r,motionStrength:q,effects:x,glyphs:v}});ae.current.props={state:t,expression:a,gaze:i,turn:s,spring:d,eyeScale:p,paused:N,lookAround:r,motionStrength:q,effects:x,glyphs:v};const F=oe=>{const ne=ae.current,Ce=(oe%ow+ow)%ow;Ce===ne.expression&&ne.morph>=1||(ne.current=yM(ne),ne.currentMouth=xM(ne),ne.currentGaze=vM(ne),ne.target=Py[Ce],ne.targetMouth=iw[Ce],ne.targetGaze=Nh[Ce],ne.expression=Ce,ne.morph=0,ne.velocity=0)};ka.useImperativeHandle(B,()=>({blink:()=>{ae.current.blinkStart=performance.now()},spin:(oe=900)=>{ae.current.spinDuration=oe,ae.current.spinStart=performance.now()},setExpression:F}),[]),f.useEffect(()=>{F(a??fx[t][0])},[t,a]),f.useEffect(()=>{if(!w||a!==void 0||N)return;let oe;const ne=()=>{const[Ce,le]=Kre[t];oe=setTimeout(()=>{const re=fx[t],xe=re.filter(Te=>Te!==ae.current.expression);F(xe.length?xe[Math.floor(Math.random()*xe.length)]:re[0]),ne()},Ce+Math.random()*(le-Ce))};return ne(),()=>clearTimeout(oe)},[t,w,a,N]),f.useEffect(()=>{const oe=Wre[t];if(!k||!oe||N)return;let ne;const Ce=()=>{ne=setTimeout(()=>{ae.current.blinkStart=performance.now(),Ce()},oe[0]+Math.random()*(oe[1]-oe[0]))};return Ce(),()=>clearTimeout(ne)},[t,k,N]),f.useEffect(()=>{let oe=0,ne;ae.current.last=performance.now();const Ce=(re,xe,Te)=>{const nt=re.props,be=vM(re),Ye=nt.lookAround??.35,ue=be[0]*Ye,we=be[1]*Ye,me=yM(re).map(st=>st.map(Ae=>[Ae[0]+ue,Ae[1]+we])),$e=ws(nt.gaze?.x??0,-1,1)*mM.x,Re=ws(nt.gaze?.y??0,-1,1)*mM.y,de=((nt.turn??0)+Te)*Math.PI/180,Ve=nt.eyeScale??1,ce=sle(re,xe);me.forEach((st,Ae)=>{const We=Ae===0?z.current:P.current;if(!We)return;const Ie=Xre(st),et=Math.asin(ws((Ie[0]-jb)/Nb,-1,1)),gt=et+de,yt=Math.cos(gt),Mt=Math.max(yt,.02)/Math.max(Math.cos(et),.02);We.setAttribute("d",Zre(st)),We.setAttribute("transform",`translate(${(jb+Nb*Math.sin(gt)+$e).toFixed(2)} ${(Ie[1]+Re).toFixed(2)}) scale(${ws(Mt*Ve,.02,2.4).toFixed(4)} ${ws(ce*Ve,.02,2.4).toFixed(4)}) translate(${(-Ie[0]).toFixed(2)} ${(-Ie[1]).toFixed(2)})`),We.style.opacity=yt>.02?"1":"0"});const Le=L.current;if(Le){const st=xM(re),Ae=Ere(me,st),We=Math.asin(ws((Ae.x-jb)/Nb,-1,1)),Ie=We+de,et=Math.cos(Ie),gt=Math.max(et,.02)/Math.max(Math.cos(We),.02);Le.setAttribute("d",ele(Ae,st)),Le.setAttribute("transform",`translate(${(jb+Nb*Math.sin(Ie)+$e).toFixed(2)} ${(Ae.y+Re).toFixed(2)}) scale(${ws(gt,.02,2.4).toFixed(4)} 1) translate(${(-Ae.x).toFixed(2)} ${(-Ae.y).toFixed(2)})`),Le.style.opacity=et>.02?"1":"0"}const tt=G.current;if(tt){nt.state!==re.lastState&&(re.lastState=nt.state,re.stateStart=xe);const st=ole(Lre[nt.state]??{},xe-re.stateStart,nt.motionStrength??1);st!==re.lastBodyTransform&&(re.lastBodyTransform=st,st?tt.setAttribute("transform",st):tt.removeAttribute("transform"))}Gre({trails:$.current,confetti:U.current,glyph:Q.current,bodyContent:H.current,state:nt.state,elapsed:xe-re.stateStart,strength:nt.motionStrength??1,paint:ge.current,showEffects:nt.effects!==!1,showGlyphs:nt.glyphs!==!1})},le=re=>{const xe=ae.current,Te=xe.props;if(Te.paused){xe.last=re;const ue=`${Te.state}|${Te.expression??""}|${ge.current}`;xe.pausedPaint!==ue&&(xe.pausedPaint=ue,Ce(xe,re,0)),ne=setTimeout(()=>{oe=requestAnimationFrame(le)},250);return}xe.pausedPaint="",oe=requestAnimationFrame(le);const nt=Math.min((re-xe.last)/1e3,.1);xe.last=re;const be=Te.spring??7;xe.velocity+=(-2*be*xe.velocity-be*be*(xe.morph-1))*nt,xe.morph+=xe.velocity*nt,Number.isFinite(xe.morph)||(xe.morph=1,xe.velocity=0);let Ye=0;if(xe.spinStart!==null){const ue=(re-xe.spinStart)/xe.spinDuration;ue>=1?xe.spinStart=null:Ye=360*ue}Ce(xe,re,Ye)};return oe=requestAnimationFrame(le),()=>{cancelAnimationFrame(oe),ne!==void 0&&clearTimeout(ne)}},[]);const pe=`url(#${T}-grad)`,ge=f.useRef(pe);ge.current=pe;const Ne=o.constructor===Number?`${o}px`:o,ee=E===void 0?`${C.name} mascot`:E,X=C.body.replace(/\{\{GRADIENT\}\}/g,`url(#${T}-grad)`);return n.jsxs("svg",{viewBox:zre,width:Ne,height:Ne,className:A,style:R,role:ee?"img":void 0,"aria-label":ee??void 0,"aria-hidden":ee?void 0:!0,children:[n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:`${T}-grad`,x1:"1",y1:"0",x2:"0",y2:"1",children:[n.jsx("stop",{offset:"0%",stopColor:j[0]}),n.jsx("stop",{offset:"55%",stopColor:j[1]}),n.jsx("stop",{offset:"100%",stopColor:j[2]})]}),n.jsx("clipPath",{id:`${T}-clip`,transform:C.fit||void 0,dangerouslySetInnerHTML:{__html:C.clip}})]}),n.jsxs("g",{transform:c?`translate(${ap} 0) scale(-1 1)`:void 0,children:[n.jsx("g",{ref:$}),n.jsxs("g",{ref:G,children:[n.jsxs("g",{ref:H,children:[n.jsx("g",{transform:C.fit||void 0,dangerouslySetInnerHTML:{__html:X}}),n.jsx("g",{clipPath:`url(#${T}-clip)`,children:n.jsxs("g",{transform:tle(C.anchor),children:[n.jsx("path",{ref:z,fill:M}),n.jsx("path",{ref:P,fill:M}),h&&n.jsx("path",{ref:L,fill:"none",stroke:M,strokeWidth:g,strokeLinecap:"round"})]})})]}),n.jsx("g",{ref:Q,style:{opacity:0}})]}),n.jsx("g",{ref:U})]})]})});function yM(e){const t=ws(e.morph,0,1);return e.current.map((a,o)=>a.map((i,s)=>[i[0]+(e.target[o][s][0]-i[0])*t,i[1]+(e.target[o][s][1]-i[1])*t]))}function xM(e){const t=ws(e.morph,0,1);return e.currentMouth.map((a,o)=>a+(e.targetMouth[o]-a)*t)}function vM(e){const t=ws(e.morph,0,1);return e.currentGaze.map((a,o)=>a+(e.targetGaze[o]-a)*t)}function sle(e,t){if(e.blinkStart===null)return 1;const a=(t-e.blinkStart)/320;return a>=1?(e.blinkStart=null,1):Math.max(a<.42?1-a/.42:(a-.42)/.58,.04)}function rle(e){return e.kind==="digest"||e.kind==="compaction"||e.kind==="session-divider"}function PS(e){if(e){for(let t=e.length-1;t>=0;t-=1)if(!rle(e[t]))return e[t]}}const lle=Yre,cO=["green","blue","red","orange","purple","cyan","pink","yellow","teal","coral"],hd={green:"#009957",blue:"#377FE6",red:"#D94B52",orange:"#E78531",purple:"#8057C8",cyan:"#0EA5C6",pink:"#D84F8B",yellow:"#D8A729",teal:"#01A492",coral:"#E5634E"},cle={deadpan:"idle",friendly:"happy",focused:"working",thinking:"thinking",excited:"excited",sleepy:"drowsy",surprised:"surprised",skeptical:"suspicious",worried:"scared",mischievous:"playful"},dle=new Set(lle);function Xl(e){return e?dle.has(e)?e:cle[e]??null:null}const ule=["idle","happy","curious","drowsy","working","thinking","listening","sleeping","suspicious","proud"];function D0(e){const t=Xl(e.mascotExpression);if(t)return t;const a=PS(e.messages);if(a?.kind==="activity"&&a.tool?.ok===!1)return"alerting";if(e.busy)return"working";if(e.unread)return"notifying";if(a?.kind==="options")return"curious";const o=`${e.name} ${e.title??""} ${e.description??""}`.toLowerCase(),i=s=>s.test(o);return i(/\b(code|coding|developer|development|engineer|engineering|build|debug|program|software)\b/)?"working":i(/\b(research|researcher|search|investigate|strategy|strategist|study|learn|knowledge)\b/)?"searching":i(/\b(marketing|growth|launch|campaign|social|sales|outreach|brand)\b/)?"excited":i(/\b(overnight|night|background|async|queue|batch|long-running)\b/)?"drowsy":i(/\b(monitor|monitoring|incident|alert|watch|status|uptime)\b/)?"radar":i(/\b(review|reviewer|audit|critic|critique|quality|qa|test|legal)\b/)?"suspicious":i(/\b(security|secure|compliance|risk|privacy|finance|financial)\b/)?"scared":i(/\b(design|designer|creative|brainstorm|art|illustration|music|story)\b/)?"playful":i(/\b(support|help|success|onboarding|coach|teacher|guide|welcome)\b/)?"happy":"idle"}const dO=["mascot","circle","rounded","square"],ple=Yo(dO),uO=dn().regex(/^\/api\/attachments\/[A-Za-z0-9-]+\.(?:png|jpg|gif|webp)$/,"must be a stored PNG, JPEG, GIF, or WebP attachment"),pO=Y4,mle=[pO];function TS(e){const t=e.replaceAll("\\","/").split("/").pop();if(!t)return null;const a=`/api/attachments/${t}`;return uO.safeParse(a).success?a:null}function hle(e){const t={avatarCrop:ple.safeParse(e.avatarCrop).data??"mascot"},a=uO.safeParse(e.avatarUrl);return a.success?t.avatarUrl=a.data:typeof e.avatarUrl=="string"&&mle.includes(e.avatarUrl)&&(t.avatarUrl=e.avatarUrl),t}const Mh=[{rotation:-18,color:"rgb(252 184 34)",period:4.6,phase:0},{rotation:46,color:"rgb(5 205 196)",period:5.4,phase:.33},{rotation:108,color:"rgb(247 75 32)",period:5,phase:.66}],Ab=50,sw=19,gle=2.75,Mb=60,mO="(prefers-reduced-motion: reduce)";function kM(){try{return globalThis.window?.matchMedia?.(mO).matches??!1}catch{return!1}}function fle(e){const t=globalThis.window?.matchMedia?.(mO);return t?(t.addEventListener?.("change",e),()=>t.removeEventListener?.("change",e)):()=>{}}function hO(){return f.useSyncExternalStore(fle,kM,kM)}function ble(e){return Mh.map(({period:t,phase:a})=>-((e/1e3/t+a)%1)*t)}function O0({size:e=100,className:t}){const a=hO(),[o]=f.useState(()=>ble(Date.now())),i=2.5*Math.min(1,e/100),s=6*Math.min(1,100/e);return n.jsxs("svg",{className:V("chibi-mark shrink-0 overflow-visible",t),width:e,height:e,viewBox:"-50 -50 100 100","aria-hidden":"true",focusable:"false","data-chibi-mark":a?"static":"animated",children:[!a&&Mh.map((r,c)=>n.jsxs("g",{className:"chibi-mark-orbit",transform:`rotate(${r.rotation})`,children:[n.jsx("ellipse",{rx:Ab,ry:sw,fill:"none",stroke:r.color,strokeOpacity:.3,strokeWidth:i,vectorEffect:"non-scaling-stroke"}),n.jsx("g",{transform:`scale(1 ${sw/Ab})`,children:n.jsx("g",{className:"chibi-mark-spin",style:{animationDuration:`${r.period}s`,animationDelay:`${o[c]}s`},children:n.jsx("g",{transform:`translate(${Ab} 0)`,children:n.jsx("g",{className:"chibi-mark-counter",style:{animationDuration:`${r.period}s`,animationDelay:`${o[c]}s`},children:n.jsx("g",{transform:`scale(1 ${Ab/sw})`,children:n.jsx("circle",{r:gle,fill:r.color,style:{filter:`drop-shadow(0 0 ${s}px color-mix(in srgb, ${r.color} 85%, transparent))`}})})})})})})]},r.rotation)),n.jsx("image",{href:Y4,x:-Mb/2,y:-Mb/2,width:Mb,height:Mb,preserveAspectRatio:"xMidYMid meet"})]})}const yle=new Set(["thinking","working","searching","loading","orbit","radar","progress","humming","receiving","uploading"]),xle=new Set(["writing","sending","dictating"]);function vle(e){return e?yle.has(e)?"thinking":xle.has(e)?"speaking":"idle":"idle"}function kle(){return globalThis.document?.documentElement?.dataset?.reducedMotion==="true"}const wle=24,Sle={idle:7,thinking:1.8,speaking:1.2};function Cle({provider:e,size:t,label:a,state:o,animated:i=!0}){const s=hO()||kle(),r=vle(o),c=t>=wle,d=c&&i&&!s,p=iD(e),h=c?Math.round(t*.74):t,g=Math.round(h*(p.kind==="official"?.6:.62)),b=r==="thinking"?Mh:Mh.slice(0,1),x=Sle[r];return n.jsxs("span",{role:"img","aria-label":a,"data-subscription-avatar":e,"data-provider-logo-kind":p.kind,"data-activity":r,"data-motion":d?"animated":"static",className:"provider-avatar relative flex shrink-0 items-center justify-center",style:{width:t,height:t},children:[c&&n.jsxs("svg",{className:"provider-ring pointer-events-none absolute inset-0 overflow-visible",width:t,height:t,viewBox:"-50 -50 100 100","aria-hidden":"true",focusable:"false",children:[n.jsx("circle",{className:d&&r==="speaking"?"provider-ring-track provider-ring-breathe":"provider-ring-track",r:46,fill:"none",stroke:"var(--color-accent)",strokeOpacity:r==="idle"?.22:.5,strokeWidth:r==="idle"?1.25:2,vectorEffect:"non-scaling-stroke",style:d&&r==="speaking"?{animationDuration:`${x}s`}:void 0}),b.map((v,k)=>n.jsx("g",{transform:`rotate(${Mh[0].rotation+k*120})`,children:n.jsx("g",{className:d?"provider-ring-spin":void 0,style:d?{animationDuration:`${x}s`}:void 0,children:n.jsx("circle",{cx:46,cy:0,r:r==="thinking"?4.2:3.6,fill:v.color,style:{filter:`drop-shadow(0 0 3px color-mix(in srgb, ${v.color} 80%, transparent))`}})})},v.rotation))]}),n.jsx("span",{className:"relative flex items-center justify-center rounded-full border border-hairline/60 bg-raised",style:{width:h,height:h},children:n.jsx(sD,{provider:e,size:g})})]})}const wM={forward:1,authored:.25},jle={arrive:{state:"spawning",spin:900},switch:{state:"waking",spin:620},customize:{state:"proud",blink:!0},alert:{state:"alerting"},thinking:{state:"thinking"},working:{state:"working"},launch:{state:"loading"},success:{state:"happy",blink:!0},celebrate:{state:"celebrate",spin:700},blink:{blink:!0},surprise:{state:"surprised",blink:!0},failure:{state:"sad"}},Nle=1400;function SM(e,t,a){const o=Number.parseInt(e.slice(1),16),i=Number.parseInt(t.slice(1),16),s=r=>{const c=o>>r&255,d=i>>r&255;return Math.round(c+(d-c)*a)};return`#${[s(16),s(8),s(0)].map(r=>r.toString(16).padStart(2,"0")).join("")}`}const Ale=e=>{const t=hd[e]??hd.green;return[SM(t,"#ffffff",.55),t,SM(t,"#000000",.42)]};function Mle({color:e,state:t="idle",expression:a,size:o=44,label:i,motion:s="none",motionKey:r=0,turn:c,gaze:d,spring:p,eyeScale:h,showMouth:g,mouthStroke:b,forward:x=!0,lookAround:v,trackPointer:k=!0,animated:w=!0,bodyId:N},C){const j=IS[Pre(N)],M=f.useRef(null);f.useImperativeHandle(C,()=>({blink:()=>M.current?.blink(),spin:P=>M.current?.spin(P),setExpression:P=>M.current?.setExpression(P)}));const[E,A]=f.useState(null);f.useEffect(()=>{if(s==="none"||!w)return;const P=jle[s];if(!P||(P.blink&&M.current?.blink(),P.spin&&M.current?.spin(P.spin),!P.state))return;A(P.state);const L=setTimeout(()=>A(null),Nle);return()=>clearTimeout(L)},[s,r,w]);const[R,B]=f.useState({x:0,y:0}),O=x?wM.forward:wM.authored,T=P=>{if(!k||!w)return;const L=P.currentTarget.getBoundingClientRect();B({x:Math.max(-1,Math.min(1,(P.clientX-L.left)/L.width*2-1))*O,y:Math.max(-1,Math.min(1,(P.clientY-L.top)/L.height*2-1))*O})},z=()=>B({x:0,y:0});return n.jsx("span",{className:"inline-flex shrink-0",onPointerMove:k&&w?T:void 0,onPointerLeave:k&&w?z:void 0,children:n.jsx(ile,{ref:M,state:E??t,expression:a,size:o,silhouette:j,gradient:Ale(e),title:i??null,lookAround:v??(x?0:1),gaze:{x:(d?.x??0)+R.x,y:(d?.y??0)+R.y},turn:c,spring:p,eyeScale:h,showMouth:g,mouthStroke:b,paused:!w})})}const ra=f.memo(f.forwardRef(Mle));function Ile(e){const{avatarCrop:t,hasUrl:a,imageFailed:o}=e;return!a||t==="mascot"||o?"gradientMascot":"flatImage"}function Zt({bot:e,size:t=44,label:a,...o}){const i=hle(e),[s,r]=f.useState(!1);if(f.useEffect(()=>r(!1),[i.avatarUrl]),i.avatarUrl===pO)return n.jsx("span",{role:"img","aria-label":a??e.name??"Chibi",className:"inline-flex shrink-0",children:n.jsx(O0,{size:t})});const c=Ile({avatarCrop:i.avatarCrop,hasUrl:!!i.avatarUrl,imageFailed:s});if(c!=="flatImage"&&e.subscription&&!e.mascotBody&&!i.avatarUrl)return n.jsx(Cle,{provider:e.subscription.provider,size:t,label:a??e.name??"",state:o.state,animated:o.animated??!0});if(c!=="flatImage")return n.jsx(ra,{bodyId:e.mascotBody??void 0,...o,color:e.color,size:t,label:a??e.name});const d=i.avatarCrop==="circle"?"50%":i.avatarCrop==="rounded"?"22%":"0";return n.jsx("img",{src:i.avatarUrl,alt:a??(e.name?`${e.name} avatar`:"Bot avatar"),width:t,height:t,draggable:!1,onError:()=>r(!0),className:"block shrink-0 bg-raised object-cover",style:{width:t,height:t,borderRadius:d}})}function gO({initials:e,size:t=32}){return n.jsx("div",{className:"flex shrink-0 items-center justify-center rounded-full bg-raised text-ink-secondary font-medium",style:{width:t,height:t,fontSize:t*.38},children:e})}function z0({className:e}){return n.jsxs("span",{"data-personal-badge":!0,title:l("personalBot.badgeHint"),className:V("inline-flex shrink-0 items-center gap-1 rounded-full bg-accent/15 px-1.5 py-px text-[10.5px] font-medium leading-4 text-accent",e),children:[n.jsx(H4,{size:10,"aria-hidden":!0}),l("personalBot.badge")]})}const Ib="rounded-2xl border border-hairline/40 bg-card/80 backdrop-blur-xl backdrop-saturate-150";function Ple(){const{dispatch:e}=ke(),{view:t}=gD(),a=typeof window<"u"&&window.ogb?.remoteClient?.active===!0;return gne(t,a)?n.jsxs("button",{type:"button","data-create-personal-bot":!0,title:l("personalBot.createHint"),"aria-describedby":"create-private-bot-hint",onClick:()=>e({type:"openBotInterview",launch:{mode:"personal"}}),className:"flex min-h-10 w-full items-center gap-3 rounded-xl px-3 py-2 text-left text-ink hover:bg-raised/50",children:[n.jsx(So,{size:20,className:"text-accent","aria-hidden":!0}),n.jsx("span",{className:"text-[14px]",children:l("personalBot.create")}),n.jsx("span",{id:"create-private-bot-hint",className:"sr-only",children:l("personalBot.createHint")})]}):null}function Tle(e){const t=e.availableAccounts??e.personalAccounts;return t<=0?l("personalBot.accounts.none"):l("personalBot.accounts.count",{count:String(t),subscriptions:String(e.subscriptionAccounts??0),personal:String(e.personalAccounts)})}function Ble(){const{view:e,reload:t}=gD(),{state:a,dispatch:o}=ke(),[i,s]=f.useState(!1),[r,c]=f.useState("");if(!e)return n.jsx(lt,{title:l("personalBot.title"),subtitle:l("personalBot.subtitle"),children:n.jsx("p",{className:"text-[12px] text-ink-secondary",children:l("personalBot.loading")})});const d=e.botId?a.bots.find(x=>x.id===e.botId):void 0,p=async()=>{s(!0),c("");try{await Z("/api/personal-bot/settings",{method:"PUT",body:JSON.stringify({useLocalModels:!e.useLocalModels})}),await t()}catch(x){c(x instanceof Error?x.message:String(x))}finally{s(!1)}},h=async()=>{s(!0),c("");try{await Z("/api/personal-bot/settings",{method:"PUT",body:JSON.stringify({chibiLink:!e.chibiLink})}),await t()}catch(x){c(x instanceof Error?x.message:String(x))}finally{s(!1)}},g=e.chibiLink&&e.chibiLinkAllowed,b=async()=>{s(!0),c("");try{await Z("/api/personal-bot/settings",{method:"PUT",body:JSON.stringify({readWorkMemory:!e.readWorkMemory})}),await t()}catch(x){c(x instanceof Error?x.message:String(x))}finally{s(!1)}};return n.jsxs("div",{className:"flex flex-col gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-[22px] font-semibold tracking-tight text-ink",children:l("personalBot.title")}),n.jsx("p",{className:"mt-2 max-w-lg text-[13px] leading-relaxed text-ink-secondary",children:l("personalBot.subtitle")})]}),e.allowed?d?n.jsxs("div",{className:V(Ib,"flex items-center gap-3 p-4"),children:[n.jsx(Zt,{bot:d,size:44}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"truncate text-[15px] font-medium text-ink",children:d.name}),n.jsx(z0,{})]}),n.jsx("p",{className:"mt-0.5 text-[12.5px] text-ink-secondary",children:l("personalBot.editHint")})]}),n.jsxs("div",{className:"flex shrink-0 flex-col gap-1.5 sm:flex-row",children:[n.jsx("button",{type:"button",onClick:()=>{o({type:"toggleAppSettings",open:!1}),o(la(d))},className:"rounded-lg bg-accent px-3 py-1.5 text-[13px] font-medium text-white",children:l("personalBot.open")}),n.jsx("button",{type:"button",onClick:()=>{o({type:"toggleAppSettings",open:!1}),o({type:"select",id:d.id}),o({type:"toggleSettings",open:!0,section:"identity"})},className:"rounded-lg bg-control px-3 py-1.5 text-[13px] text-ink hover:bg-raised-hover",children:l("personalBot.edit")})]})]}):n.jsxs("div",{className:V(Ib,"flex flex-col items-start gap-2 p-4"),children:[n.jsx("div",{className:"text-[15px] font-medium text-ink",children:l("personalBot.create")}),n.jsx("p",{className:"text-[12.5px] leading-relaxed text-ink-secondary",children:(e.availableAccounts??e.personalAccounts)===0?l("personalBot.form.noAccounts"):l("personalBot.interviewHint")}),n.jsxs("button",{type:"button","data-create-personal-bot-interview":!0,onClick:()=>o({type:"openBotInterview",launch:{mode:"personal"}}),className:"mt-1 flex items-center gap-1.5 rounded-lg bg-accent px-4 py-2 text-[13px] font-medium text-white",children:[n.jsx(So,{size:14,"aria-hidden":!0}),l("personalBot.startInterview")]})]}):n.jsxs("div",{className:V(Ib,"p-4"),children:[n.jsxs("div",{className:"flex items-center gap-2 text-[14px] font-medium text-ink",children:[n.jsx(Sd,{size:14,"aria-hidden":!0}),l("personalBot.disabled")]}),n.jsx("p",{className:"mt-1 text-[12.5px] leading-relaxed text-ink-secondary",children:l("personalBot.disabledHint")}),n.jsx("div",{className:"mt-2",children:n.jsx(Er,{})})]}),e.allowed&&n.jsxs(lt,{children:[n.jsx(Jt,{title:l("personalBot.local.title"),subtitle:l("personalBot.local.subtitle"),children:n.jsx(Tt,{checked:e.useLocalModels,disabled:i,"aria-label":l("personalBot.local.title"),onClick:()=>{p()}})}),n.jsx(Jt,{title:l("personalBot.workMemory.title"),subtitle:l("personalBot.workMemory.subtitle"),children:n.jsx(Tt,{checked:e.readWorkMemory,disabled:i,"aria-label":l("personalBot.workMemory.title"),onClick:()=>{b()}})}),n.jsx(Jt,{title:l("personalBot.chibiLink.title"),subtitle:l(e.chibiLinkAllowed?"personalBot.chibiLink.subtitle":"personalBot.chibiLink.managed"),children:e.chibiLinkAllowed?n.jsx(Tt,{checked:e.chibiLink,disabled:i,"aria-label":l("personalBot.chibiLink.title"),onClick:()=>{h()}}):n.jsxs("span",{className:"flex items-center gap-2","data-chibi-link-managed":!0,children:[n.jsx(Tt,{checked:!1,disabled:!0,"aria-label":l("personalBot.chibiLink.title")}),n.jsx(Er,{})]})}),n.jsx(Jt,{title:l("personalBot.accounts.title"),subtitle:Tle(e),children:n.jsx("button",{type:"button",onClick:()=>o({type:"toggleAppSettings",open:!0,section:"engines"}),className:"rounded-lg bg-control px-3 py-1.5 text-[13px] text-ink hover:bg-raised-hover",children:l("personalBot.accounts.open")})}),r&&n.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:r})]}),n.jsxs("div",{className:V(Ib,"p-4"),children:[n.jsx("div",{className:"text-[13px] font-medium text-ink",children:l("personalBot.rules.title")}),n.jsxs("ul",{className:"mt-2 flex list-disc flex-col gap-1 pl-5 text-[12.5px] leading-relaxed text-ink-secondary",children:[n.jsx("li",{children:l("personalBot.rules.private")}),n.jsx("li",{children:l("personalBot.rules.workMemory")}),n.jsx("li",{children:l("personalBot.rules.accounts")}),n.jsx("li",{children:l("personalBot.rules.company")}),n.jsx("li",{children:l("personalBot.rules.connections")}),n.jsx("li",{children:l(g?"personalBot.rules.chibiLink":"personalBot.rules.delegation")}),n.jsx("li",{children:l("personalBot.rules.resting")})]})]})]})}function fO({instanceId:e,owner:t,locked:a,onChanged:o}){const[i,s]=f.useState(!1),[r,c]=f.useState("");if(!t)return null;if(a)return n.jsxs("span",{"data-engine-owner":"company",className:"inline-flex items-center gap-1 rounded-full bg-control px-2 py-0.5 text-[11.5px] font-medium text-ink-secondary",title:l("owner.lockedHint"),children:[n.jsx(Sd,{size:11,"aria-hidden":!0}),l("owner.company")]});const d=async p=>{if(!(i||p===t)){s(!0),c("");try{await fD(e,p),await Promise.resolve(o?.()).catch(()=>{})}catch(h){c(h instanceof Error?h.message:String(h))}finally{s(!1)}}};return n.jsxs("span",{className:"inline-flex flex-col items-start gap-1",children:[n.jsx("span",{role:"radiogroup","aria-label":l("owner.label"),title:l("owner.hint"),"data-engine-owner":t,className:"inline-flex rounded-full border border-hairline/40 bg-inset/70 p-0.5 backdrop-blur-xl",children:["company","personal"].map(p=>n.jsx("button",{type:"button",role:"radio","aria-checked":t===p,disabled:i,onClick:()=>{d(p)},className:V("rounded-full px-2.5 py-0.5 text-[11.5px] font-medium transition-colors disabled:opacity-60",t===p?p==="personal"?"bg-accent text-white":"bg-raised text-ink":"text-ink-secondary hover:text-ink"),children:l(p==="company"?"owner.company":"owner.personal")},p))}),r&&n.jsx("span",{role:"alert",className:"text-[11.5px] text-danger",children:l("owner.failed",{error:r})})]})}function bO({instance:e}){const{refreshInstances:t}=ke();return n.jsx(fO,{instanceId:e.instanceId,owner:e.owner,locked:e.ownerLocked,onChanged:t})}function BS(e,t){return window.ogb?.setInstanceKey?window.ogb.setInstanceKey(e,t):Z(`/api/provider-accounts/${encodeURIComponent(e)}/key`,{method:"PUT",body:JSON.stringify({key:t})})}const CM="w-full rounded-lg border border-hairline/40 bg-inset px-3 py-2 text-[13px] text-ink placeholder:text-ink-secondary focus:border-hairline focus:outline-none disabled:opacity-50",ES=e=>e.trim().replace(/\/+$/,""),yO=(e,t)=>(!e?.url||new RegExp(e.url.pattern).test(ES(t.url)))&&(!e?.model?.required||t.model.trim()!==""),xO=(e,t)=>({...e?.url?{url:ES(t.url)}:{},...e?.model&&t.model.trim()?{model:t.model.trim()}:{}});function vO({ask:e,value:t,onChange:a,disabled:o}){if(!e)return null;const i=e.url&&t.url.trim()!==""&&!new RegExp(e.url.pattern).test(ES(t.url));return n.jsxs(n.Fragment,{children:[e.url&&n.jsxs("label",{className:"flex flex-col gap-1 text-[12px] text-ink-secondary",children:[l("accountSetup.address"),n.jsx("input",{value:t.url,onChange:s=>a({...t,url:s.target.value}),disabled:o,required:!0,placeholder:e.url.example,spellCheck:!1,"aria-invalid":i||void 0,className:CM}),n.jsx("span",{className:i?"text-danger":void 0,children:l(i?"accountSetup.badAddress":"accountSetup.addressHint",{example:e.url.example})})]}),e.model&&n.jsxs("label",{className:"flex flex-col gap-1 text-[12px] text-ink-secondary",children:[l("accountSetup.model"),n.jsx("input",{value:t.model,onChange:s=>a({...t,model:s.target.value}),disabled:o,required:e.model.required,placeholder:e.model.example,spellCheck:!1,className:CM}),n.jsx("span",{children:l(e.model.required?"accountSetup.modelHintRequired":"accountSetup.modelHint",{example:e.model.example})})]})]})}function RS({value:e,onChange:t,disabled:a}){return n.jsxs("fieldset",{className:"flex flex-col gap-1.5",disabled:a,children:[n.jsx("legend",{className:"mb-1 text-[12px] text-ink-secondary",children:l("owner.label")}),n.jsx("div",{role:"radiogroup","aria-label":l("owner.label"),className:"flex w-fit rounded-lg bg-inset p-0.5","data-owner-choice":!0,children:["company","personal"].map(o=>n.jsx("button",{type:"button",role:"radio","aria-checked":e===o,onClick:()=>t(o),"data-owner":o,className:V("rounded-md px-3 py-1 text-[12.5px]",e===o?"bg-raised font-medium text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:l(o==="company"?"owner.company":"owner.personal")},o))}),n.jsx("p",{className:"text-[11.5px] leading-relaxed text-ink-secondary",children:l(e==="personal"?"owner.addToggleHint":"owner.companyHint")})]})}const Ele="w-full rounded-lg border border-hairline/40 bg-inset px-3 py-2 text-[13px] text-ink placeholder:text-ink-secondary focus:border-hairline focus:outline-none disabled:opacity-50",Rle="rounded-lg border border-hairline/40 px-3 py-1.5 text-[12px] text-ink-secondary hover:bg-raised/50 hover:text-ink disabled:cursor-not-allowed disabled:opacity-50";function Dle({provider:e,onDone:t,onCancel:a}){const[o,i]=f.useState(""),[s,r]=f.useState("company"),[c,d]=f.useState(null),[p,h]=f.useState(!1),[g,b]=f.useState(!1),[x,v]=f.useState(null),k=f.useRef({name:o,owner:s,onDone:t});k.current={name:o,owner:s,onDone:t},f.useEffect(()=>{if(!c)return;let C=!1,j,M=Math.max(c.interval,1)*1e3;const E=async()=>{if(!C)try{const A=!!window.ogb?.setInstanceKey,R=await Z(`/api/provider-accounts/device/${encodeURIComponent(c.flowId)}`,{method:"POST",body:JSON.stringify({displayName:k.current.name.trim(),owner:k.current.owner,...A?{sealed:!0}:{}})});if(C)return;if(R.state==="pending"){R.interval&&(M=R.interval*1e3),j=setTimeout(()=>{E()},M);return}if(R.state==="failed"){d(null),v(R.error??l("copilotSignIn.failed"));return}R.instanceId&&R.key&&await BS(R.instanceId,R.key),await k.current.onDone()}catch(A){if(C)return;d(null),v(A instanceof Error?A.message:String(A))}};return j=setTimeout(()=>{E()},M),()=>{C=!0,j&&clearTimeout(j)}},[c]);const w=async()=>{if(!(p||!o.trim())){h(!0),v(null);try{const C=await Z("/api/provider-accounts/device",{method:"POST",body:JSON.stringify({provider:e.id})});d(C),window.open(C.verificationUri,"_blank","noopener,noreferrer")}catch(C){v(C instanceof Error?C.message:String(C))}finally{h(!1)}}},N=async()=>{if(c)try{await navigator.clipboard.writeText(c.userCode),b(!0)}catch{}};return n.jsxs("form",{className:"mt-3 flex flex-col gap-2 rounded-xl border border-hairline/40 p-3","data-device-sign-in":e.id,onSubmit:C=>{C.preventDefault(),w()},children:[c?n.jsxs("div",{className:"flex flex-col items-start gap-2",role:"status","aria-live":"polite",children:[n.jsx("p",{className:"text-[12px] text-ink-secondary",children:l("copilotSignIn.typeCode")}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("code",{className:"rounded-lg bg-inset px-3 py-1.5 font-mono text-[18px] font-semibold tracking-[0.2em] text-ink","data-device-code":!0,children:c.userCode}),n.jsx("button",{type:"button",onClick:()=>{N()},className:Rle,children:l(g?"copilotSignIn.copied":"copilotSignIn.copy")}),n.jsx("a",{href:c.verificationUri,target:"_blank",rel:"noopener noreferrer",className:"text-[12px] text-accent hover:underline",children:l("copilotSignIn.open")})]}),n.jsxs("p",{className:"flex items-center gap-1.5 text-[12px] text-ink-secondary",children:[n.jsx(je,{size:12,className:"animate-spin","aria-hidden":"true"}),l("copilotSignIn.waiting")]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"flex flex-col gap-1 text-[12px] text-ink-secondary",children:[l("providerAccounts.name"),n.jsx("input",{value:o,onChange:C=>i(C.target.value),maxLength:80,required:!0,disabled:p,placeholder:l("providerAccounts.namePlaceholder"),className:Ele})]}),n.jsx(RS,{value:s,onChange:r,disabled:p}),n.jsx("p",{className:"text-[12px] leading-relaxed text-ink-secondary",children:l("copilotSignIn.how")})]}),x&&n.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:x}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx("button",{type:"button",onClick:()=>{d(null),a()},className:"rounded-lg px-3 py-1.5 text-[12px] text-ink-secondary hover:bg-raised/50",children:l("common.cancel")}),!c&&n.jsxs("button",{type:"submit",disabled:p||!o.trim(),"data-device-start":!0,className:"flex items-center gap-1.5 rounded-lg bg-accent px-3 py-1.5 text-[12px] font-medium text-white hover:opacity-90 disabled:opacity-50",children:[p&&n.jsx(je,{size:13,className:"animate-spin"}),l("copilotSignIn.start")]})]})]})}const Ole="w-full rounded-lg border border-hairline/40 bg-inset px-3 py-2 text-[13px] text-ink placeholder:text-ink-secondary focus:border-hairline focus:outline-none disabled:opacity-50";function zle({provider:e,onDone:t,onCancel:a}){const[o,i]=f.useState(e.label),[s,r]=f.useState("company"),c=e.billing===void 0||e.billing==="free",[d,p]=f.useState(!c),[h,g]=f.useState({url:"",model:e.setup?.model?.example??""}),b=!!o.trim()&&d&&yO(e.setup,h),[x,v]=f.useState(!1),[k,w]=f.useState(null),N=async()=>{if(!(x||!b)){v(!0),w(null);try{await Z("/api/provider-accounts",{method:"POST",body:JSON.stringify({provider:e.id,displayName:o.trim(),owner:s,...xO(e.setup,h)})}),await t()}catch(C){w(C instanceof Error?C.message:String(C))}finally{v(!1)}}};return n.jsxs("form",{className:"mt-3 flex flex-col gap-3 rounded-xl border border-hairline/40 p-3",onSubmit:C=>{C.preventDefault(),N()},children:[n.jsxs("div",{role:"note",className:"flex gap-2 rounded-lg bg-inset p-2.5 text-[12px] leading-relaxed text-ink",children:[n.jsx(rd,{size:16,className:"mt-0.5 shrink-0 text-warning","aria-hidden":!0}),n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx("p",{className:"font-medium",children:l(c?"keyless.warningTitle":"keyless.gcloudTitle")}),n.jsx("p",{className:"text-ink-secondary",children:l(c?"keyless.warningBody":"keyless.gcloudBody")})]})]}),n.jsxs("label",{className:"flex flex-col gap-1 text-[12px] text-ink-secondary",children:[l("providerAccounts.name"),n.jsx("input",{value:o,onChange:C=>i(C.target.value),maxLength:80,required:!0,disabled:x,className:Ole})]}),n.jsx(vO,{ask:e.setup,value:h,onChange:g,disabled:x}),n.jsx(RS,{value:s,onChange:r,disabled:x}),c&&n.jsxs("label",{className:"flex items-start gap-2 text-[12px] text-ink",children:[n.jsx("input",{type:"checkbox",checked:d,onChange:C=>p(C.target.checked),disabled:x,className:"mt-0.5"}),l("keyless.accept")]}),k&&n.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:k}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx("button",{type:"button",onClick:a,disabled:x,className:"rounded-lg px-3 py-1.5 text-[12px] text-ink-secondary hover:bg-raised/50 disabled:opacity-50",children:l("common.cancel")}),n.jsxs("button",{type:"submit",disabled:x||!b,className:"flex items-center gap-1.5 rounded-lg bg-raised px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[x&&n.jsx(je,{size:13,className:"animate-spin"}),l("providerAccounts.add")]})]})]})}const v3="w-full rounded-lg border border-hairline/40 bg-inset px-3 py-2 text-[13px] text-ink placeholder:text-ink-secondary focus:border-hairline focus:outline-none disabled:opacity-50",Bu="rounded-lg border border-hairline/40 px-3 py-1.5 text-[12px] text-ink-secondary hover:bg-raised/50 hover:text-ink disabled:cursor-not-allowed disabled:opacity-50";async function DS(e,t,a,o,i={}){const s=e.kind==="apiKey",r=s&&!!window.ogb?.setInstanceKey,c=await Z("/api/provider-accounts",{method:"POST",body:JSON.stringify({provider:e.id,displayName:t,...o?{owner:o}:{},...i,...s&&!r?{key:a}:{}})});return r&&await BS(c.instanceId,a).catch(async d=>{throw await Z(`/api/provider-accounts/${encodeURIComponent(c.instanceId)}`,{method:"DELETE"}).catch(()=>{}),d}),c}function kO(e){return e.ok?l("providerAccounts.testOk"):e.reason==="rejected"?l("providerAccounts.testRejected"):e.reason==="unreachable"?l("providerAccounts.testUnreachable"):l("providerAccounts.testUnexpected")}function Lle({provider:e}){return e.icon?n.jsx(Rg,{preset:e.icon,size:18}):n.jsx(Nd,{driverKind:e.driver,size:18})}function wO(e){return e.provider.keyless?n.jsx(zle,{...e}):e.provider.deviceSignIn?n.jsx(Dle,{...e}):n.jsx(_le,{...e})}function _le({provider:e,onDone:t,onCancel:a}){const[o,i]=f.useState(""),[s,r]=f.useState(""),[c,d]=f.useState(null),[p,h]=f.useState(null),[g,b]=f.useState(null),[x,v]=f.useState("company"),[k,w]=f.useState({url:"",model:e.setup?.model?.required?"":e.setup?.model?.example??""}),N=e.kind==="apiKey",C=async()=>{if(!(!e.keyTest||!s.trim()||c)){d("test"),b(null);try{const M=await Z("/api/keys/test",{method:"POST",body:JSON.stringify({provider:e.keyTest.provider,key:s.trim(),...e.keyTest.url?{url:e.keyTest.url}:{}})});b(kO(M))}catch(M){b(M instanceof Error?M.message:String(M))}finally{d(null)}}},j=async()=>{if(!(c||!o.trim()||N&&!s.trim())){d("save"),h(null);try{await DS(e,o.trim(),s.trim(),x,xO(e.setup,k)),await t()}catch(M){h(Xo(M)?null:M instanceof Error?M.message:String(M))}finally{d(null)}}};return n.jsxs("form",{className:"mt-3 flex flex-col gap-2 rounded-xl border border-hairline/40 p-3",onSubmit:M=>{M.preventDefault(),j()},children:[n.jsxs("label",{className:"flex flex-col gap-1 text-[12px] text-ink-secondary",children:[l("providerAccounts.name"),n.jsx("input",{value:o,onChange:M=>i(M.target.value),maxLength:80,required:!0,disabled:c!==null,placeholder:l("providerAccounts.namePlaceholder"),className:v3})]}),N&&n.jsxs("label",{className:"flex flex-col gap-1 text-[12px] text-ink-secondary",children:[l("providerAccounts.key"),n.jsx("input",{type:"password",value:s,onChange:M=>{r(M.target.value),b(null)},autoComplete:"off",disabled:c!==null,placeholder:l("providerAccounts.keyPlaceholder"),className:v3})]}),n.jsx(vO,{ask:e.setup,value:k,onChange:w,disabled:c!==null}),N&&e.keyUrl&&n.jsx("a",{href:e.keyUrl,target:"_blank",rel:"noopener noreferrer",className:"w-fit text-[12px] text-accent hover:underline",children:l("providerAccounts.getKey",{provider:e.label})}),!N&&n.jsx("p",{className:"text-[12px] leading-relaxed text-ink-secondary",children:l("providerAccounts.signInHint")}),n.jsx(RS,{value:x,onChange:v,disabled:c!==null}),g&&n.jsx("p",{role:"status",className:"text-[12px] text-ink-secondary",children:g}),p&&n.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:p}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx("button",{type:"button",onClick:a,disabled:c!==null,className:"rounded-lg px-3 py-1.5 text-[12px] text-ink-secondary hover:bg-raised/50 disabled:opacity-50",children:l("common.cancel")}),N&&e.keyTest&&n.jsx("button",{type:"button",onClick:()=>{C()},disabled:c!==null||!s.trim(),className:Bu,children:l(c==="test"?"keys.testing":"keys.test")}),n.jsxs("button",{type:"submit",disabled:c!==null||!o.trim()||N&&!s.trim()||!yO(e.setup,k),className:"flex items-center gap-1.5 rounded-lg bg-raised px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[c==="save"&&n.jsx(je,{size:13,className:"animate-spin"}),l("providerAccounts.add")]})]})]})}function SO({provider:e,account:t,onChanged:a,extra:o}){const{state:i}=ke(),[s,r]=f.useState(null),[c,d]=f.useState(""),[p,h]=f.useState(!1),[g,b]=f.useState(!1),[x,v]=f.useState(null),[k,w]=f.useState(null),[N,C]=f.useState(!1),j=i.instances.find(P=>P.instanceId===t.instanceId),M=e.kind==="signIn"&&j!==void 0&&(j.snapshot.state!=="available"||j.authentication!==void 0||j.claudeAccount!==void 0||!t.signInCommand),E=i.bots.filter(P=>P.modelSelection.instanceId===t.instanceId).length,A=e.kind==="apiKey"?e.keyless?l(e.id==="vertexAi"?"keyless.usesGcloud":"keyless.noKeyNeeded"):t.keyConfigured?l("providerAccounts.keySaved"):l("providerAccounts.noKey"):t.signedIn===!0?l("providerAccounts.signedIn"):t.signedIn===!1?l("providerAccounts.notSignedIn"):t.available===!1?l("onboarding.engines.needsSetup"):l("providerAccounts.statusUnknown"),R=e.kind==="apiKey"?t.keyConfigured===!0:t.signedIn===!0,B=async P=>{if(!p){h(!0),v(null);try{await P(),r(null),d(""),await a()}catch(L){v(Xo(L)?null:L instanceof Error?L.message:String(L))}finally{h(!1)}}},O=()=>{const P=c.trim();P&&(s==="rename"?B(()=>Z(`/api/provider-accounts/${encodeURIComponent(t.instanceId)}`,{method:"PATCH",body:JSON.stringify({displayName:P})})):s==="key"&&B(()=>BS(t.instanceId,P)))},T=async()=>{if(!p){h(!0),w(null);try{const P=await Z(`/api/provider-accounts/${encodeURIComponent(t.instanceId)}/test`,{method:"POST",body:"{}"});w(kO(P))}catch(P){w(P instanceof Error?P.message:String(P))}finally{h(!1)}}},z=()=>{b(!1),B(async()=>{await Z(`/api/provider-accounts/${encodeURIComponent(t.instanceId)}`,{method:"DELETE"}),e.kind==="apiKey"&&window.ogb?.setInstanceKey&&await window.ogb.setInstanceKey(t.instanceId,"")})};return n.jsxs("li",{className:"border-t border-hairline/30 py-2.5 first:border-t-0",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1.5 text-[13px]",children:[n.jsx("span",{className:"min-w-0 break-words font-medium text-ink",children:t.displayName}),n.jsx("span",{className:V("text-[12px]",R?"text-success":"text-ink-secondary"),children:A}),n.jsx(fO,{instanceId:t.instanceId,owner:t.owner,locked:t.ownerLocked,onChanged:a}),n.jsx("span",{className:"flex-1"}),n.jsx("button",{type:"button",disabled:p,onClick:()=>{r(s==="rename"?null:"rename"),d(t.displayName)},className:Bu,children:l("providerAccounts.rename")}),e.kind==="apiKey"&&!e.keyless&&n.jsx("button",{type:"button",disabled:p,onClick:()=>{r(s==="key"?null:"key"),d("")},className:Bu,children:t.keyConfigured?l("providerAccounts.replaceKey"):l("providerAccounts.addKey")}),e.kind==="apiKey"&&e.keyTest&&t.keyConfigured&&n.jsx("button",{type:"button",disabled:p,onClick:()=>{T()},className:Bu,children:l("keys.test")}),t.removable&&n.jsx("button",{type:"button",disabled:p||E>0,onClick:()=>b(!0),className:V(Bu,"text-danger hover:text-danger"),children:l("providerAccounts.remove")})]}),t.removable&&E>0&&n.jsx("p",{className:"mt-1 text-[11.5px] text-ink-secondary",children:l("providerAccounts.assigned",{count:String(E)})}),s&&n.jsxs("form",{className:"mt-2 flex gap-2",onSubmit:P=>{P.preventDefault(),O()},children:[n.jsx("input",{type:s==="key"?"password":"text",value:c,onChange:P=>d(P.target.value),autoComplete:"off",maxLength:s==="rename"?80:4096,"aria-label":l(s==="rename"?"providerAccounts.name":"providerAccounts.key"),placeholder:s==="key"?l("providerAccounts.keyPlaceholder"):void 0,disabled:p,className:v3}),n.jsx("button",{type:"submit",disabled:p||!c.trim(),className:"flex w-[72px] shrink-0 items-center justify-center rounded-lg bg-control py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",children:p?n.jsx(je,{size:13,className:"animate-spin"}):l("common.save")})]}),t.signedIn!==!0&&M&&j&&(N?n.jsx("div",{className:"mt-2","data-account-sign-in":t.instanceId,children:n.jsx(Fr,{instance:j,unframed:!0})}):n.jsx("button",{type:"button",onClick:()=>C(!0),className:"mt-2 rounded-lg bg-accent px-3 py-1.5 text-[12.5px] font-medium text-white hover:opacity-90","data-account-sign-in-button":t.instanceId,children:l("subscriptions.signIn")})),e.kind==="signIn"&&t.signedIn!==!0&&!M&&t.signInCommand&&n.jsxs("div",{className:"mt-2 space-y-1.5",children:[n.jsx("p",{className:"text-[12px] leading-relaxed text-ink-secondary",children:l("providerAccounts.signInSteps")}),n.jsx(_c,{command:t.signInCommand,copyLabel:l("engineSetup.copyCommand")})]}),o,k&&n.jsx("p",{role:"status",className:"mt-1 text-[12px] text-ink-secondary",children:k}),x&&n.jsx("p",{role:"alert",className:"mt-1 text-[12px] text-danger",children:x}),n.jsx(na,{open:g,title:l("providerAccounts.removeTitle",{name:t.displayName}),body:e.kind==="apiKey"?l("providerAccounts.removeKeyHint"):l("providerAccounts.removeSignInHint"),confirmLabel:l("providerAccounts.remove"),tone:"neutral",onCancel:()=>b(!1),onConfirm:z})]})}function Fle({provider:e,onChanged:t}){const[a,o]=f.useState(!1),i=e.kind==="apiKey"?wD(e.id):void 0;return n.jsxs("div",{className:"rounded-2xl border border-hairline/50 bg-card px-4 py-3 sm:px-5",children:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-lg bg-control",children:n.jsx(Lle,{provider:e})}),n.jsx("span",{className:"min-w-0 flex-1 text-[14px] font-medium text-ink",children:e.label}),e.signupUrl&&n.jsx("a",{href:e.signupUrl,target:"_blank",rel:"noopener noreferrer",className:"shrink-0 text-[12px] text-accent hover:underline",children:l(e.kind==="signIn"?"providerAccounts.getSubscription":e.billing==="free"?"providerAccounts.signUpFree":"providerAccounts.getPlan")}),e.kind==="apiKey"&&e.keyUrl&&!e.deviceSignIn&&!e.keyless&&n.jsx("a",{href:e.keyUrl,target:"_blank",rel:"noopener noreferrer",className:"shrink-0 text-[12px] text-accent hover:underline",children:l(e.billing==="subscription"?"providerAccounts.getPlanKey":"providerAccounts.getApiKey")}),!a&&n.jsxs("button",{type:"button",onClick:()=>o(!0),className:V(Bu,"flex items-center gap-1.5"),children:[n.jsx(Sn,{size:13}),l("providerAccounts.add")]})]}),n.jsxs("p",{className:"mt-1.5 text-[12px] leading-relaxed text-ink-secondary",children:[vD(e.billing,e.deviceSignIn?"signIn":e.kind,e.id),e.billing==="subscription"&&g3(e.id)?` · ${g3(e.id)}`:""]}),(i||e.accounts.length>0)&&n.jsxs("ul",{className:"mt-2",children:[i&&n.jsx("li",{className:"py-2.5","data-main-key":i.section,children:n.jsx(Dg,{section:i.section,testProvider:i.test,mainKey:!0})}),e.accounts.map(s=>n.jsx(SO,{provider:e,account:s,onChanged:t},s.instanceId))]}),a&&n.jsx(wO,{provider:e,onCancel:()=>o(!1),onDone:async()=>{o(!1),await t()}})]})}function qle({providers:e,billing:t,onChanged:a}){return n.jsx(n.Fragment,{children:e.filter(o=>o.billing===t&&o.id!=="claude").map(o=>n.jsx(Fle,{provider:o,onChanged:a},o.id))})}function CO({billing:e}){const{refreshInstances:t}=ke(),[a,o]=f.useState(null),[i,s]=f.useState(null),r=f.useCallback(async()=>{try{const d=await Z("/api/provider-accounts");o(d.providers),s(null)}catch(d){s(d instanceof Error?d.message:String(d))}},[]);f.useEffect(()=>{r()},[r]);const c=f.useCallback(async()=>{await Promise.all([r(),Promise.resolve(t()).catch(()=>{})])},[r,t]);return n.jsxs("section",{className:"flex flex-col gap-3","aria-labelledby":`provider-accounts-${e}`,children:[n.jsxs("div",{children:[n.jsx("h2",{id:`provider-accounts-${e}`,className:"text-[16px] font-semibold text-ink",children:l(`providerAccounts.${e}Title`)}),n.jsx("p",{className:"mt-1 max-w-lg text-[12.5px] leading-relaxed text-ink-secondary",children:l(`providerAccounts.${e}Intro`)})]}),i&&n.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:i}),a===null&&!i&&n.jsx(je,{size:14,className:"animate-spin text-ink-secondary"}),a&&n.jsx(qle,{providers:a,billing:e,onChanged:c})]})}const Cr="w-full rounded-lg border border-hairline/40 bg-inset px-3 py-2.5 text-[15px] text-ink placeholder:text-ink-secondary focus:border-hairline focus:outline-none";function Ha(e){return{"--i":e}}function op({children:e,className:t,...a}){return n.jsx("button",{"data-primary":"",...a,className:V("w-full shrink-0 rounded-lg bg-accent py-2.5 text-[15px] font-medium text-white transition-[transform,opacity] duration-150 active:scale-[0.98] disabled:opacity-40",t),children:e})}function rg({children:e,className:t,...a}){return n.jsx("button",{...a,className:V("text-[12px] text-ink-secondary transition-colors hover:text-ink",t),children:e})}const Ule={claude:"claudeAgent",chatgpt:"codex",gemini:"antigravityAgent",grok:"grokAgent",cursor:"cursorAgent",museCode:"museCode",ollama:"ollamaCloud",kimi:"kimiAgent",qwen:"qwenAgent",opencodeGo:"opencodeGo"};function gd(e,t){return t&&k3.includes(e)?l(`setup.plan.${e}.chibitekName`):l(`setup.plan.${e}.name`)}const k3=sx;function Vle(e){const t=Ule[e];return t?n.jsx(Nd,{driverKind:t,size:26}):e==="apiKey"?n.jsx(Wh,{size:24,className:"text-ink-secondary","aria-hidden":"true"}):n.jsx(Ig,{size:24,className:"text-ink-secondary","aria-hidden":"true"})}function Hle({picks:e,chibitek:t,onToggle:a}){const o=Oee(e,t);return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.plans.intro")}),n.jsx("p",{className:"mt-1.5 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.plans.billing")}),t?n.jsxs(n.Fragment,{children:[n.jsx("h2",{className:"mt-4 text-[12px] font-semibold uppercase tracking-wide text-ink-secondary",children:l("setup.plans.chibitekTitle")}),n.jsx(rw,{plans:k3,picks:e,chibitek:!0,onToggle:a,label:l("setup.plans.chibitekTitle")}),n.jsx("p",{className:"mt-2 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.plans.chibitekNotSure",{email:Jc})}),n.jsx("h2",{className:"mt-5 text-[12px] font-semibold uppercase tracking-wide text-ink-secondary",children:l("setup.plans.otherTitle")}),n.jsx(rw,{plans:r3.filter(i=>!k3.includes(i)),picks:e,onToggle:a,label:l("setup.plans.otherTitle")})]}):n.jsx(rw,{plans:r3,picks:e,onToggle:a,label:l("setup.plans.groupLabel")}),n.jsxs("div",{className:"mt-4 rounded-xl border border-hairline/40 bg-card px-3.5 py-3","aria-live":"polite",children:[n.jsx("div",{className:"text-[11.5px] font-semibold uppercase tracking-wide text-ink-secondary",children:l("setup.plans.recommendedTitle")}),n.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink",children:o.kind==="askErick"?l("setup.plans.askErick",{email:Jc}):o.kind==="plan"&&o.plan==="gemini"?l("setup.plans.mainGemini"):o.kind==="startLocal"?l("setup.plans.startLocal"):o.localBackup?l("setup.plans.mainWithBackup",{plan:gd(o.plan,t)}):l("setup.plans.main",{plan:gd(o.plan,t)})})]}),n.jsxs(Ji,{children:[n.jsx("p",{children:l("setup.plans.what1")}),n.jsx("p",{children:l("setup.plans.what2")})]})]})}function rw({plans:e,picks:t,chibitek:a=!1,onToggle:o,label:i}){return n.jsx("div",{role:"group","aria-label":i,className:"mt-2 grid grid-cols-2 gap-2 sm:grid-cols-3",children:e.map(s=>{const r=t.includes(s);return n.jsxs("button",{type:"button",role:"checkbox","aria-checked":r,"aria-label":gd(s,a),"aria-describedby":`plan-detail-${s}`,"data-plan":s,onClick:()=>o(s),className:V("relative flex min-h-[92px] flex-col items-start gap-2 rounded-xl border p-3 text-left transition-[border-color,background-color,transform] active:scale-[0.98]",r?"border-accent bg-accent/10":"border-hairline/50 bg-card hover:bg-raised/40"),children:[n.jsx("span",{className:"flex size-9 items-center justify-center rounded-lg bg-inset",children:Vle(s)}),n.jsx("span",{className:"text-[13px] font-semibold leading-tight text-ink",children:gd(s,a)}),n.jsx("span",{id:`plan-detail-${s}`,className:"text-[11.5px] leading-snug text-ink-secondary",children:l(a?`setup.plan.${s}.chibitekDetail`:`setup.plan.${s}.detail`)}),r&&n.jsx("span",{className:"absolute right-2 top-2 flex size-5 items-center justify-center rounded-full bg-accent text-white","aria-hidden":"true",children:n.jsx(mt,{size:12,strokeWidth:3})})]},s)})})}function OS(e,t){const a=e.filter(o=>o.driverKind===t&&!o.managed&&!o.readOnly);return a.find(o=>!o.providerAccount)??a[0]}function $le(e){return e.loaded?e.instance?e.job?.kind==="engine-install"&&e.job.state==="running"?"installing":e.instance.snapshot.state!=="available"?e.job?.kind==="engine-install"&&e.job.state==="failed"?"installFailed":"notInstalled":e.instance.access!=="custom"&&e.instance.snapshot.authenticated===!1?"needsSignIn":e.test==="passed"?"tested":e.test==="failed"?"testFailed":"testing":e.checkFailed?"checkFailed":"unavailable":"checking"}const Gle={downloading:"setup.connect.phase.downloading",installing:"setup.connect.phase.installing",checking:"setup.connect.phase.checking"};function Kle({name:e,phase:t,job:a,terminalCommand:o,onInstall:i,onRetryTest:s,onRecheck:r,signIn:c,testDetail:d,startError:p,windows:h=!1,notOnWindows:g=!1}){return n.jsxs("div",{className:"mt-4 rounded-xl border border-hairline/40 bg-card p-3.5","data-phase":t,children:[t==="checking"&&n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[n.jsx(je,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.connect.checking",{name:e})]}),t==="checkFailed"&&n.jsx(Ra,{message:l("setup.connect.checkFailed",{name:e}),onRetry:r}),t==="unavailable"&&n.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:l("setup.connect.unavailable",{name:e})}),t==="notInstalled"&&g&&n.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:l("setup.connect.notOnWindows",{name:e})}),t==="notInstalled"&&!g&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:l(h?"setup.connect.installIntroWindows":"setup.connect.installIntro",{name:e})}),n.jsxs("button",{type:"button",onClick:i,className:V(Ka,"mt-3 w-full"),children:[n.jsx(ga,{size:14,"aria-hidden":"true"}),l("setup.connect.install",{name:e})]}),p&&n.jsx(Ra,{message:l("setup.error.failed"),detail:p,onRetry:i})]}),t==="installing"&&n.jsxs(n.Fragment,{children:[n.jsx(qi,{label:l(Gle[a?.phase??""]??"setup.connect.phase.installing",{name:e}),received:a?.phase==="downloading"?a.received:void 0,total:a?.phase==="downloading"?a.total:void 0}),n.jsx(jd,{detail:a?.detail})]}),t==="installFailed"&&n.jsxs(n.Fragment,{children:[n.jsx(Ra,{message:h&&a?.reason==="no-installer"?l("setup.error.noInstallerWindows"):zl(a),detail:a?.detail,onRetry:i}),o&&n.jsxs("details",{className:"mt-3 rounded-lg border border-hairline/40 bg-app px-2.5 py-2 text-[12px] text-ink-secondary",children:[n.jsx("summary",{className:"cursor-pointer select-none outline-none hover:text-ink focus-visible:text-ink",children:l(h?"setup.connect.terminalFallbackWindows":"setup.connect.terminalFallback")}),n.jsx("p",{className:"mt-2 leading-relaxed",children:l(h?"setup.connect.terminalFallbackHelpWindows":"setup.connect.terminalFallbackHelp")}),n.jsx(P0,{command:o,actionLabel:l(h?"engineSetup.openInstallWindows":"engineSetup.openInstall"),compact:!0})]})]}),t==="needsSignIn"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:l("setup.connect.signInIntro",{name:e})}),c]}),t==="testing"&&n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[n.jsx(je,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.connect.testing",{name:e})]}),t==="tested"&&n.jsx(ud,{children:l("setup.connect.tested",{name:e})}),t==="testFailed"&&n.jsx(Ra,{message:l("setup.connect.testFailed",{name:e}),detail:d,onRetry:s})]})}function Wle({name:e,job:t,startError:a,onStart:o,onCancel:i}){const[s,r]=f.useState(!1),c=t?.state==="running";return n.jsxs("div",{className:"mt-3",children:[!c&&n.jsxs("button",{type:"button",onClick:o,className:V(Ka,"w-full"),children:[n.jsx(Pr,{size:14,"aria-hidden":"true"}),t?.state==="failed"||t?.state==="cancelled"?l("setup.connect.signInAgain"):l("setup.connect.signIn",{name:e})]}),c&&!t.url&&n.jsx(qi,{label:l("setup.connect.signInStarting",{name:e})}),c&&t.url&&n.jsxs("div",{className:"space-y-2.5",children:[n.jsx("p",{className:"text-[12.5px] leading-relaxed text-ink-secondary",children:t.code?l("setup.connect.signInWithCode"):l("setup.connect.signInBrowser")}),t.code&&n.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg bg-inset px-3 py-2",children:[n.jsx("code",{dir:"ltr","aria-label":l("setup.connect.codeLabel"),className:"select-all font-mono text-[17px] tracking-[0.2em] text-ink",children:t.code}),n.jsxs("button",{type:"button",onClick:()=>{navigator.clipboard?.writeText(t.code).then(()=>r(!0)).catch(()=>{})},className:Ga,children:[n.jsx(Xa,{size:13,"aria-hidden":"true"}),l(s?"engineSetup.copied":"engineSetup.copy")]})]}),n.jsxs("button",{type:"button",onClick:()=>A0(t.url),className:V(Ka,"w-full"),children:[n.jsx(Mn,{size:14,"aria-hidden":"true"}),l("setup.connect.openSignIn")]}),n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[12px] text-ink-secondary",children:[n.jsx(je,{size:12,className:"animate-spin","aria-hidden":"true"}),l("setup.connect.waitingForSignIn")]}),n.jsx("button",{type:"button",onClick:i,className:"text-[12px] text-ink-secondary hover:text-ink",children:l("common.cancel")})]}),a&&n.jsx(Ra,{message:l("setup.error.failed"),detail:a}),t&&(t.state==="failed"||t.state==="cancelled")&&t.reason!==void 0&&n.jsx(Ra,{message:zl(t),detail:t.detail})]})}function Jle({instanceId:e,name:t,onSignedIn:a}){const{job:o,start:i,cancel:s,startError:r}=Br(c=>{c.state==="succeeded"&&a()});return n.jsx(Wle,{name:t,job:o,startError:r,onStart:()=>{i("engine-login",e)},onCancel:()=>{s()}})}function Yle({instanceId:e,chibitek:t,domain:a,onSkip:o}){const i=NO(e,a);return i.state==="failed"?n.jsx(AO,{chibitek:t,onRetry:()=>{i.start()},onContinueLocal:o}):n.jsx("div",{className:"mt-3",children:i.state==="waiting"?n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[n.jsx(je,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.google.geminiWaiting")]}):n.jsxs("button",{type:"button",onClick:()=>{i.start()},className:V(Ka,"w-full"),children:[n.jsx(Pr,{size:14,"aria-hidden":"true"}),a?l("setup.google.useDomain",{domain:a}):l("setup.connect.signIn",{name:"Gemini"})]})})}function Zle({plan:e,chibitek:t,domain:a,onTested:o,onSkip:i}){const{state:s,refreshInstances:r}=ke(),c=uS[e],[d,p]=f.useState(s.instances.length>0),[h,g]=f.useState(!1),[b,x]=f.useState("idle"),[v,k]=f.useState(null),w=OS(s.instances,c.driverKind),N=gd(e),C=f.useRef(o);C.current=o;const{job:j,start:M,startError:E}=Br(()=>{r().catch(()=>{})}),A=f.useCallback(()=>{g(!1),r().then(z=>g(!z),()=>g(!0)).finally(()=>p(!0))},[r]);f.useEffect(()=>{A()},[]);const R=f.useCallback(async()=>{if(w){x("running"),k(null);try{const z=await Z("/api/setup/engine-test",{method:"POST",body:JSON.stringify({instanceId:w.instanceId}),timeoutMs:6e4});x(z.ok?"passed":"failed"),k(z.detail??null),C.current(z.ok),z.ok||r().catch(()=>{})}catch(z){x("failed"),k(z instanceof Error?z.message:String(z)),C.current(!1)}}},[w,r]),B=$le({loaded:d,instance:w,job:j,test:b,checkFailed:h}),O=jD()==="win32";f.useEffect(()=>{B==="testing"&&b==="idle"&&R()},[B,b,R]);let T=null;return w&&B==="needsSignIn"&&(c.signIn==="claude"?T=n.jsx("div",{className:"mt-3",children:n.jsx(yD,{instanceId:w.instanceId})}):c.signIn==="codex"?T=n.jsx("div",{className:"mt-3",children:n.jsx(m3,{instanceId:w.instanceId})}):c.signIn==="meta"?T=n.jsx("div",{className:"mt-3",children:n.jsx(m3,{instanceId:w.instanceId,provider:"meta"})}):c.signIn==="cli"?T=n.jsx(Jle,{instanceId:w.instanceId,name:N,onSignedIn:()=>{r()}}):e==="gemini"?T=n.jsx(Yle,{instanceId:w.instanceId,chibitek:t,domain:a,onSkip:i}):T=n.jsx(Fr,{instance:w,unframed:!0,className:"mt-2"})),n.jsx(Kle,{name:N,phase:B,job:j,terminalCommand:j?.reason==="no-installer"||j?.state==="failed"?tp(w?.install):null,windows:O,notOnWindows:O&&!!w?.install?.command&&!tp(w?.install)&&!w?.install?.server&&!w?.install?.managed,onInstall:()=>w&&void M("engine-install",w.instanceId),onRecheck:()=>{p(!1),A()},startError:E,onRetryTest:()=>{x("idle"),r().catch(()=>{})},signIn:T,testDetail:v})}function jO({name:e,phase:t,value:a,onChange:o,onSave:i,keyUrl:s,signupUrl:r,error:c,job:d}){if(t==="tested")return n.jsx("div",{className:"mt-4 rounded-xl border border-hairline/40 bg-card p-3.5",children:n.jsx(ud,{children:l("setup.key.tested",{name:e})})});if(t==="checking")return n.jsxs("p",{role:"status",className:"mt-4 flex items-center gap-2 text-[13px] text-ink-secondary",children:[n.jsx(je,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.connect.checking",{name:e})]});if(t==="installing")return n.jsxs("div",{className:"mt-4 rounded-xl border border-hairline/40 bg-card p-3.5",children:[n.jsx(qi,{label:l("setup.connect.phase.installing",{name:e})}),n.jsx(jd,{detail:d?.detail})]});const p=t==="saving";return n.jsxs("form",{className:"mt-4 rounded-xl border border-hairline/40 bg-card p-3.5",onSubmit:h=>{h.preventDefault(),i()},children:[n.jsx("label",{htmlFor:"setup-plan-key",className:"text-[12px] font-medium text-ink-secondary",children:l("setup.key.label",{name:e})}),n.jsx("input",{id:"setup-plan-key",type:"password",autoComplete:"off",spellCheck:!1,value:a,disabled:p,onChange:h=>o(h.target.value),placeholder:l("setup.key.placeholder"),className:V("mt-1.5",Cr)}),n.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[s&&n.jsx(lx,{href:s,label:l("setup.key.getKey")}),r&&n.jsx(lx,{href:r,label:l("setup.key.noPlan")})]}),n.jsxs("button",{type:"submit",disabled:!a.trim()||p,className:V(Ka,"mt-3 w-full"),children:[p&&n.jsx(je,{size:14,className:"animate-spin","aria-hidden":"true"}),l(p?"setup.key.testing":"setup.key.save")]}),t==="rejected"&&n.jsx(Ra,{message:l("setup.key.rejected",{name:e})}),t==="unreachable"&&n.jsx(Ra,{message:l("setup.key.unreachable")}),t==="failed"&&n.jsx(Ra,{message:l("setup.key.failed"),detail:c??d?.detail})]})}function jM({plan:e,onTested:t}){const{refreshInstances:a}=ke(),o=uS[e],i=gd(e),[s,r]=f.useState(null),[c,d]=f.useState("checking"),[p,h]=f.useState(""),[g,b]=f.useState(null),x=f.useRef(t);x.current=t;const v=f.useCallback(async C=>{const j=await Z("/api/setup/engine-test",{method:"POST",body:JSON.stringify({instanceId:C}),timeoutMs:6e4});j.ok?(d("tested"),x.current(!0)):(b(j.detail??null),d("failed"))},[]),k=f.useRef(null),w=Br(C=>{a().catch(()=>{}),C.state==="succeeded"&&k.current?v(k.current).catch(()=>d("failed")):d("failed")});f.useEffect(()=>{let C=!0;return Z("/api/provider-accounts",{timeoutMs:1e4}).then(async({providers:j})=>{if(!C)return;const M=j.find(R=>R.id===o.provider)??null;r(M);const E=M?.accounts.find(R=>R.keyConfigured);if(!E){d("entering");return}const A=await Z(`/api/provider-accounts/${encodeURIComponent(E.instanceId)}/test`,{method:"POST",body:"{}"}).catch(()=>({ok:!1}));C&&(A.ok?(d("tested"),x.current(!0)):d("entering"))}).catch(()=>C&&d("entering")),()=>{C=!1}},[o.provider]);const N=async()=>{const C=p.trim();if(!(!C||!s)){d("saving"),b(null);try{if(s.keyTest){const M=await Z("/api/keys/test",{method:"POST",body:JSON.stringify({provider:s.keyTest.provider,key:C,...s.keyTest.url?{url:s.keyTest.url}:{}}),timeoutMs:3e4});if(!M.ok){d(M.reason==="rejected"?"rejected":M.reason==="unreachable"?"unreachable":"failed");return}}const j=await DS(s,s.label,C);if(h(""),await a().catch(()=>{}),k.current=j.instanceId,o.method==="engineAndKey"){d("installing"),await w.start("engine-install",j.instanceId);return}s.keyTest?(d("tested"),x.current(!0)):await v(j.instanceId)}catch(j){b(Xo(j)?null:j instanceof Error?j.message:String(j)),d(Xo(j)?"entering":"failed")}}};return n.jsx(jO,{name:i,phase:c,value:p,onChange:C=>{h(C),c!=="entering"&&c!=="saving"&&d("entering")},onSave:()=>{N()},keyUrl:s?.keyUrl,signupUrl:s?.signupUrl,error:g,job:w.job})}function Qle({plan:e,onTested:t,chibitek:a=!1,domain:o=null,onSkip:i}){const[s,r]=f.useState(null),c=gd(e),d=uS[e],{state:p,refreshInstances:h}=ke(),g=zee(e,a),[b,x]=f.useState(g.personal),v=f.useRef(!1),k=async C=>{const j=await Z("/api/instances").then(E=>E.instances,()=>p.instances),M=d.method==="engine"?OS(j,d.driverKind):j.filter(E=>E.providerAccount?.provider===d.provider).at(-1);M&&!M.ownerLocked&&await fD(M.instanceId,C?"personal":"company").catch(()=>{}),await Promise.resolve(h()).catch(()=>{})},w=C=>{v.current=C,C&&!(e==="ollama"&&s==="local")&&k(b),t(C)},N=()=>{const C=!b;x(C),v.current&&k(C)};return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l(`setup.plan.${e}.connect`)}),e==="ollama"?n.jsxs(n.Fragment,{children:[n.jsx("div",{role:"radiogroup","aria-label":l("setup.ollama.question"),className:"mt-4 grid grid-cols-2 gap-2",children:["cloud","local"].map(C=>n.jsxs("button",{type:"button",role:"radio","aria-checked":s===C,"aria-label":l(`setup.ollama.${C}`),onClick:()=>{r(C),C==="local"&&t(!0)},className:V("rounded-xl border px-3 py-2.5 text-left text-[13px] transition-colors",s===C?"border-accent bg-accent/10 text-ink":"border-hairline/50 bg-card text-ink-secondary hover:bg-raised/40"),children:[n.jsx("span",{className:"block font-semibold text-ink",children:l(`setup.ollama.${C}`)}),n.jsx("span",{className:"mt-0.5 block text-[11.5px]",children:l(`setup.ollama.${C}Detail`)})]},C))}),s==="cloud"&&n.jsx(jM,{plan:"ollama",onTested:w}),s==="local"&&n.jsx("p",{className:"mt-3 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.ollama.localNext")})]}):d.method==="engine"?n.jsx(Zle,{plan:e,chibitek:a,domain:o,onTested:w,onSkip:i}):n.jsx(jM,{plan:e,onTested:w}),!(e==="ollama"&&s!=="cloud")&&(g.fixed?n.jsx("p",{"data-plan-owner":"company",className:"mt-3 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.owner.company")}):n.jsxs("div",{"data-plan-owner":b?"personal":"company",className:"mt-3 flex items-start justify-between gap-3 rounded-xl border border-hairline/40 bg-card/80 px-3.5 py-3 backdrop-blur-xl",children:[n.jsxs("span",{className:"min-w-0",children:[n.jsx("span",{className:"block text-[13px] font-medium text-ink",children:l("setup.owner.toggle")}),n.jsx("span",{className:"mt-0.5 block text-[12px] leading-relaxed text-ink-secondary",children:l("setup.owner.toggleHint")})]}),n.jsx(Tt,{checked:b,"aria-label":l("setup.owner.toggle"),onClick:N})]})),n.jsx(Ji,{children:n.jsx("p",{children:l(`setup.plan.${e}.what`,{name:c})})})]})}const Xle="antigravityAgent";function NO(e,t){const{refreshInstances:a}=ke(),[o,i]=f.useState("idle"),s=f.useRef(null),r=()=>{s.current!==null&&window.clearInterval(s.current),s.current=null};f.useEffect(()=>r,[]);const c=f.useCallback(async()=>{if(!e)return;r(),i("waiting");const d=`/api/instances/${encodeURIComponent(e)}/auth`;try{const{auth:p}=await Z(`${d}/start`,{method:"POST",body:"{}",timeoutMs:12e4});if(p.phase==="succeeded"){await a().catch(()=>{});return}if(!p.flowId||!p.authorizationUrl)throw new Error("no sign-in page");A0(BR(p.authorizationUrl,t)),s.current=window.setInterval(()=>{a().catch(()=>{}),Z(`${d}/status?flowId=${encodeURIComponent(p.flowId)}`,{timeoutMs:1e4}).then(({auth:h})=>{(h.phase==="failed"||h.phase==="expired"||h.phase==="cancelled")&&(r(),i("failed"))}).catch(()=>{})},2e3)}catch{r(),i("failed")}},[e,t,a]);return{state:o,start:c,reset:()=>{r(),i("idle")}}}function AO({chibitek:e,onRetry:t,onContinueLocal:a}){return n.jsxs("div",{role:"alert",className:"mt-3 rounded-xl border border-warning/30 bg-warning/10 px-3 py-2.5",children:[n.jsxs("div",{className:"flex items-start gap-2 text-[12.5px] leading-relaxed text-ink",children:[n.jsx(Qn,{size:14,className:"mt-0.5 shrink-0 text-warning","aria-hidden":"true"}),n.jsx("span",{children:e?l("setup.google.geminiNotOnChibitek",{email:Jc}):l("setup.google.geminiNotOn")})]}),n.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[n.jsx("button",{type:"button",onClick:t,className:Ga,children:l("setup.tryAgain")}),a&&n.jsx("button",{type:"button",onClick:a,className:Ga,children:l("setup.google.continueLocal")})]})]})}function ece({stage:e,required:t,domain:a,accountEmail:o,geminiWorks:i,error:s,onStart:r,onRetryGemini:c,onSkipGemini:d,onUseOtherAccount:p,onSkip:h}){const g=a?l("setup.google.useDomain",{domain:a}):l("setup.google.useCompany");return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.google.intro")}),n.jsx("p",{className:"mt-1.5 text-[13px] font-medium text-ink",children:g}),t&&n.jsx("p",{className:"mt-1.5 text-[12.5px] text-ink-secondary",children:l("setup.google.required")}),n.jsxs("div",{className:"mt-4 rounded-xl border border-accent/40 bg-accent/5 p-3.5","data-stage":e,children:[e==="start"&&n.jsxs("button",{type:"button",onClick:r,className:V(Ka,"w-full"),children:[n.jsx(Pr,{size:14,"aria-hidden":"true"}),l("setup.google.button")]}),e==="installing"&&n.jsx(qi,{label:l("setup.google.installing")}),e==="geminiSignIn"&&n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink",children:[n.jsx(je,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.google.geminiWaiting")]}),e==="geminiOff"&&n.jsx(AO,{chibitek:!0,onRetry:c,onContinueLocal:d}),e==="account"&&n.jsxs(n.Fragment,{children:[n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink",children:[n.jsx(je,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.google.accountWaiting")]}),h&&n.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-[12.5px] text-ink-secondary",children:[n.jsx("span",{children:l("setup.google.stuckHint")}),n.jsx("button",{type:"button",onClick:h,className:Ga,"data-google-continue-without":!0,children:l("setup.google.continueWithout")})]})]}),e==="wrongDomain"&&n.jsxs("div",{role:"alert",className:"rounded-xl border border-danger/25 bg-danger/10 px-3 py-2.5",children:[n.jsx("p",{className:"text-[12.5px] leading-relaxed text-ink",children:l("setup.google.wrongDomain",{domain:a??"",email:o??""})}),n.jsx("button",{type:"button",onClick:p,className:V(Ga,"mt-2"),children:l("setup.google.useOther")})]}),e==="testing"&&n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[n.jsx(je,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.connect.testing",{name:"Gemini"})]}),e==="done"&&n.jsxs(n.Fragment,{children:[n.jsx(ud,{children:l("setup.google.done",{email:o??""})}),n.jsx("p",{className:"mt-1 text-[12.5px] text-ink-secondary",children:l(i?"setup.google.geminiReady":"setup.google.geminiLater")})]}),e==="failed"&&(h?n.jsxs("div",{role:"alert",className:"rounded-xl border border-warning/30 bg-warning/10 px-3 py-2.5","data-google-unavailable":!0,children:[n.jsxs("div",{className:"flex items-start gap-2 text-[12.5px] leading-relaxed text-ink",children:[n.jsx(Qn,{size:14,className:"mt-0.5 shrink-0 text-warning","aria-hidden":"true"}),n.jsx("span",{children:l("setup.google.unavailable")})]}),n.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[n.jsx("button",{type:"button",onClick:h,className:Ka,children:l("setup.continue")}),n.jsx("button",{type:"button",onClick:r,className:Ga,children:l("setup.tryAgain")})]})]}):n.jsx(Ra,{message:l("setup.error.failed"),detail:s,onRetry:r}))]}),n.jsx(Ji,{children:n.jsx("p",{children:l("setup.google.what")})})]})}function tce(e){return e?.snapshot.state==="available"&&e.snapshot.authenticated!==!1}function nce({required:e,domain:t,onDone:a,onSkip:o}){const{state:i,refreshInstances:s}=ke(),r=OS(i.instances,Xle),[c,d]=f.useState("start"),[p,h]=f.useState(null),[g,b]=f.useState(null),[x,v]=f.useState(!1),k=NO(r?.instanceId,t),w=Br(E=>{s().catch(()=>{}),E.state==="succeeded"?d("geminiSignIn"):d("geminiOff")}),N=f.useRef(null);f.useEffect(()=>()=>{N.current!==null&&window.clearInterval(N.current)},[]),f.useEffect(()=>{if(c==="geminiSignIn"){if(tce(r)){v(!0),d("account");return}k.state==="idle"&&k.start(),k.state==="failed"&&d("geminiOff")}},[c,r,k]);const C=f.useCallback(async()=>{b(null);try{const E=await Z("/api/accounts/connect",{method:"POST",body:JSON.stringify({provider:"google"})});E.url&&A0(BR(E.url,t)),N.current!==null&&window.clearInterval(N.current),N.current=window.setInterval(()=>{Z(`/api/accounts/connect/${encodeURIComponent(E.id)}`).then(A=>{if(!(A.state==="waiting"||A.state==="finishing")){if(N.current!==null&&window.clearInterval(N.current),N.current=null,A.state!=="connected"){b(A.error??A.state),d("failed");return}h(A.email??null),TR(A.email,t)?d("testing"):d("wrongDomain")}}).catch(A=>{N.current!==null&&window.clearInterval(N.current),b(A instanceof Error?A.message:String(A)),d("failed")})},2e3)}catch(E){b(E instanceof Error?E.message:String(E)),d("failed")}},[t]);f.useEffect(()=>{c==="account"&&C()},[c]),f.useEffect(()=>{if(c==="testing"){if(!x||!r){d("done"),a(!1);return}Z("/api/setup/engine-test",{method:"POST",body:JSON.stringify({instanceId:r.instanceId}),timeoutMs:6e4}).then(E=>{v(E.ok),d("done"),a(E.ok)}).catch(()=>{v(!1),d("done"),a(!1)})}},[c]);const j=()=>{if(b(null),k.reset(),!r){d("account");return}if(r.snapshot.state!=="available"){d("installing"),w.start("engine-install",r.instanceId);return}d("geminiSignIn")},M=async()=>{const A=(await Z("/api/accounts").catch(()=>null))?.providers.find(R=>R.id==="google")?.accounts.find(R=>R.email===p);A&&await Z(`/api/accounts/${encodeURIComponent(A.id)}`,{method:"DELETE"}).catch(()=>{}),h(null),d("account")};return n.jsx(ece,{stage:c,required:e,domain:t,accountEmail:p,geminiWorks:x,error:g,onStart:j,onRetryGemini:()=>{k.reset(),d(r?.snapshot.state==="available"?"geminiSignIn":"installing"),r&&r.snapshot.state!=="available"&&w.start("engine-install",r.instanceId)},onSkipGemini:()=>{v(!1),d("account")},onUseOtherAccount:()=>{M()},onSkip:o&&(()=>{N.current!==null&&window.clearInterval(N.current),N.current=null,o()})})}const MO=["appleCalendar","appleReminders","appleContacts","icloudDrive"],lw="apple:this-mac",Pb={gmail:"https://www.googleapis.com/auth/gmail.readonly",gmailSend:"https://www.googleapis.com/auth/gmail.compose",calendar:"https://www.googleapis.com/auth/calendar.events",drive:"https://www.googleapis.com/auth/drive.readonly"},ace=["openid","email","profile"],wc={mailReadWrite:"Mail.ReadWrite",mailSend:"Mail.Send",calendars:"Calendars.ReadWrite",files:"Files.Read.All"},oce={google:{id:"google",label:"Google",authorizeUrl:"https://accounts.google.com/o/oauth2/v2/auth",tokenUrl:"https://oauth2.googleapis.com/token",redirectHost:"127.0.0.1",scopes:ace,incremental:!0,authorizeParams:{access_type:"offline",prompt:"consent select_account",include_granted_scopes:"true"},clientIdEnv:"ATOMIC_GOOGLE_OAUTH_CLIENT_ID",clientSecretEnv:"ATOMIC_GOOGLE_OAUTH_CLIENT_SECRET",families:{gmail:Pb.gmail,gmailSend:Pb.gmailSend,calendar:Pb.calendar,drive:Pb.drive}},microsoft:{id:"microsoft",label:"Microsoft",authorizeUrl:"https://login.microsoftonline.com/common/oauth2/v2.0/authorize",tokenUrl:"https://login.microsoftonline.com/common/oauth2/v2.0/token",redirectHost:"localhost",scopes:["offline_access","openid","profile","email","User.Read",wc.mailReadWrite,wc.mailSend,wc.calendars,wc.files],incremental:!1,authorizeParams:{prompt:"select_account",response_mode:"query"},clientIdEnv:"ATOMIC_MICROSOFT_OAUTH_CLIENT_ID",families:{outlook:wc.mailReadWrite,outlookCalendar:wc.calendars,onedrive:wc.files}}};function IO(e){if(e==="apple")return[...MO];const t=oce[e];return t.incremental?Object.keys(t.families):[]}const ice="Atomic",zg="https://github.com/chibitek/atomic",NM="/handbook/atomic-handbook.html",sce=`${zg}/blob/main/docs/approval-levels.md`,rce=`${zg}/issues`,lce=`${zg}/releases`,cce=`${zg}/blob/main/LICENSE`;function zS(){return"0.1.213"}const dce={darwin:"macOS",win32:"Windows",linux:"Linux"};function uce(e){return(e&&dce[e])??null}async function _l(e){if(window.ogb?.openExternal){await window.ogb.openExternal(e);return}window.open(e,"_blank","noopener,noreferrer")}function pce({provider:e,onChanged:t,personalIds:a,onPersonal:o}){const[i,s]=f.useState(!1),[r,c]=f.useState(null),[d,p]=f.useState(null),[h,g]=f.useState(!1),b=async k=>{if(!i){s(!0),c(null);try{await k(),await t()}catch(w){c(w instanceof Error?w.message:String(w))}finally{s(!1)}}},x=k=>{b(()=>Z("/api/accounts/apple/families",{method:"POST",body:JSON.stringify({family:k}),timeoutMs:31e4}))},v=()=>{p(null),b(()=>Z(`/api/accounts/${encodeURIComponent(lw)}`,{method:"DELETE"}))};return n.jsxs(lt,{title:l("accounts.apple.title"),subtitle:l("accounts.apple.subtitle"),children:[n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("p",{className:"text-[12px] leading-relaxed text-ink-secondary",children:l("accounts.apple.intro")}),e.accounts.length>0?n.jsx("div",{className:"divide-y divide-hairline/40 overflow-hidden rounded-lg border border-hairline/40",children:e.accounts.map(k=>n.jsx(RO,{account:k,busy:i,onReconnect:()=>{},onRemove:()=>p(k),onTurnOn:x,personal:a?.includes(k.id),onPersonal:o&&(w=>w?o(k.id,!0):g(!0))},k.id))}):n.jsx(BO,{account:{id:lw,provider:"apple",email:"",addedAt:0,status:"ok",missing:[...MO]},busy:i,onTurnOn:x}),i&&n.jsxs("div",{role:"status",className:"flex items-center gap-3 rounded-lg bg-inset px-3 py-2.5 text-[12.5px] text-ink",children:[n.jsx(je,{size:14,className:"animate-spin text-ink-secondary"}),n.jsx("span",{className:"min-w-0 flex-1",children:l("accounts.apple.waiting")})]}),r&&n.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:r})]}),n.jsx(na,{open:d!==null,title:l("accounts.removeTitle",{email:d?.email??""}),body:l("accounts.removeBody"),confirmLabel:l("accounts.remove"),tone:"neutral",onCancel:()=>p(null),onConfirm:v}),n.jsx(na,{open:h,title:l("accounts.apple.personalOffTitle"),body:l("accounts.apple.personalOffBody"),confirmLabel:l("accounts.apple.personalOff"),tone:"neutral",onCancel:()=>g(!1),onConfirm:()=>{g(!1),o?.(lw,!1)}})]})}const mce=2e3,PO={google:{title:"accounts.google.title",subtitle:"accounts.google.subtitle",badge:"G",badgeClass:"bg-[#4285F4]"},microsoft:{title:"accounts.microsoft.title",subtitle:"accounts.microsoft.subtitle",badge:"M",badgeClass:"bg-[#0078D4]"},apple:{title:"accounts.apple.title",subtitle:"accounts.apple.subtitle",badge:"A",badgeClass:"bg-[#1d1d1f]"}},TO={gmail:"accounts.family.gmail",gmailSend:"accounts.family.gmailSend",calendar:"accounts.family.calendar",drive:"accounts.family.drive",outlook:"accounts.family.outlook",outlookCalendar:"accounts.family.outlookCalendar",onedrive:"accounts.family.onedrive",appleCalendar:"accounts.family.appleCalendar",appleReminders:"accounts.family.appleReminders",appleContacts:"accounts.family.appleContacts",icloudDrive:"accounts.family.icloudDrive"},hce={gmail:"accounts.why.gmail",gmailSend:"accounts.why.gmailSend",calendar:"accounts.why.calendar",drive:"accounts.why.drive",appleCalendar:"accounts.why.appleCalendar",appleReminders:"accounts.why.appleReminders",appleContacts:"accounts.why.appleContacts",icloudDrive:"accounts.why.icloudDrive"};function BO({account:e,busy:t,onTurnOn:a}){const o=IO(e.provider);if(!o.length)return null;const i=new Set(e.missing??[]);return n.jsx("ul",{className:"mt-2 flex flex-col gap-1.5","data-account-families":!0,children:o.map(s=>{const r=!i.has(s),c=hce[s];return n.jsxs("li",{className:"flex items-start gap-2 text-[11.5px] leading-relaxed",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"text-ink",children:l(TO[s])}),c&&n.jsxs("span",{className:"text-ink-secondary",children:[" · ",l(c)]})]}),r?n.jsx("span",{className:"shrink-0 text-success",children:l("accounts.familyOn")}):n.jsx("button",{type:"button",onClick:()=>a(s),disabled:t||e.status!=="ok",className:"shrink-0 text-accent hover:underline disabled:no-underline disabled:opacity-50","data-account-turn-on":s,children:l("accounts.turnOn")})]},s)})})}function LS(){const[e,t]=f.useState(null),[a,o]=f.useState(null),i=f.useCallback(async()=>{try{t(await Z("/api/accounts",{timeoutMs:3e4})),o(null)}catch(s){o(s instanceof Error?s.message:String(s))}},[]);return f.useEffect(()=>{i();const s=()=>{i()};return window.addEventListener("focus",s),()=>window.removeEventListener("focus",s)},[i]),{status:e,error:a,refresh:i}}function EO({provider:e}){const t=PO[e];return n.jsx("span",{"aria-hidden":!0,className:V("flex size-6 shrink-0 items-center justify-center rounded-full text-[11px] font-semibold text-white",t.badgeClass),children:t.badge})}function RO({account:e,busy:t,onReconnect:a,onTurnOn:o,onRemove:i,personal:s,onPersonal:r}){const c=new Date(e.addedAt).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}),d=IO(e.provider).length>0,p=d?[]:e.missing??[];return n.jsxs("div",{className:"flex items-start gap-3 px-3 py-2.5",children:[n.jsx(EO,{provider:e.provider}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-[13px] text-ink",children:e.email}),n.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 text-[11.5px] text-ink-secondary",children:[n.jsx("span",{children:l("accounts.connectedOn",{date:c})}),n.jsx("span",{className:e.status==="ok"?"text-success":"text-warning",children:e.status==="ok"?l("accounts.status.ok"):l("accounts.status.reauth")})]}),p.length?n.jsx("div",{className:"mt-1 text-[11.5px] leading-relaxed text-warning",children:l("accounts.missing",{services:p.map(h=>l(TO[h])).join(", ")})}):null,d&&n.jsx(BO,{account:e,busy:t,onTurnOn:o})]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-2 text-[12px]",children:[r&&n.jsxs("label",{className:"flex items-center gap-1.5 text-ink-secondary",title:l("owner.connectionHint"),children:[n.jsx("span",{children:l("owner.personal")}),n.jsx(Tt,{checked:!!s,disabled:t,"aria-label":l("owner.connectionToggle",{name:e.email}),onClick:()=>r(!s)})]}),(e.status==="reauth"||p.length>0)&&n.jsx("button",{type:"button",onClick:a,disabled:t,className:"text-ink-secondary hover:text-ink disabled:opacity-50",children:l("accounts.signInAgain")}),n.jsx("button",{type:"button",onClick:i,disabled:t,className:"text-danger hover:underline disabled:no-underline disabled:opacity-50",children:l("accounts.remove")})]})]})}function DO({provider:e,storageReady:t,onChanged:a,personalIds:o,onPersonal:i,onGiveUp:s}){const r=PO[e.id],[c,d]=f.useState(null),[p,h]=f.useState(null),[g,b]=f.useState(null),[x,v]=f.useState(!1),[k,w]=f.useState(null),[N,C]=f.useState(!1),j=f.useRef(null),M=()=>{j.current!==null&&window.clearInterval(j.current),j.current=null};f.useEffect(()=>M,[]);const E=O=>{M(),j.current=window.setInterval(()=>{Z(`/api/accounts/connect/${O}`).then(async T=>{T.state==="waiting"||T.state==="finishing"||(M(),d(null),T.state==="connected"?(b(l("accounts.connected",{email:T.email??""})),await a()):s&&T.state!=="cancelled"?h(l(e.id==="microsoft"?"setup.accounts.microsoftUnavailable":"setup.accounts.googleUnavailable")):T.state==="expired"?h(l("accounts.expired")):T.state==="failed"&&h(T.error??l("accounts.failed")))}).catch(T=>{M(),d(null),h(T instanceof Error?T.message:String(T))})},mce)},A=async O=>{if(!(x||c)){v(!0),h(null),b(null);try{const T=await Z("/api/accounts/connect",{method:"POST",body:JSON.stringify({provider:e.id,...O})});d(T),E(T.id),T.url&&await _l(T.url)}catch(T){h(T instanceof Error?T.message:String(T))}finally{v(!1)}}},R=async()=>{const O=c;M(),d(null),O&&await Z(`/api/accounts/connect/${O.id}`,{method:"DELETE"}).catch(()=>{})},B=async()=>{const O=k;if(w(null),!(!O||N)){C(!0),h(null),b(null);try{await Z(`/api/accounts/${encodeURIComponent(O.id)}`,{method:"DELETE"}),await a()}catch(T){h(T instanceof Error?T.message:String(T))}finally{C(!1)}}};return n.jsxs(lt,{title:l(r.title),subtitle:l(r.subtitle),children:[n.jsxs("div",{className:"flex flex-col gap-3",children:[e.configured?n.jsxs(n.Fragment,{children:[e.accounts.length>0&&n.jsx("div",{className:"divide-y divide-hairline/40 overflow-hidden rounded-lg border border-hairline/40",children:e.accounts.map(O=>n.jsx(RO,{account:O,busy:N||!!c,onReconnect:()=>{A()},onRemove:()=>w(O),onTurnOn:T=>{A({families:[T],accountId:O.id})},personal:o?.includes(O.id),onPersonal:i&&(T=>i(O.id,T))},O.id))}),c?n.jsxs("div",{role:"status",className:"flex flex-wrap items-center gap-3 rounded-lg bg-inset px-3 py-2.5 text-[12.5px] text-ink",children:[n.jsx(je,{size:14,className:"animate-spin text-ink-secondary"}),n.jsx("span",{className:"min-w-0 flex-1",children:l("accounts.waiting",{provider:e.label})}),c.url&&n.jsx("button",{type:"button",onClick:()=>{_l(c.url)},className:"text-ink-secondary hover:text-ink",children:l("accounts.openAgain")}),n.jsx("button",{type:"button",onClick:()=>{R()},className:"rounded-lg px-2 py-1 text-ink-secondary hover:bg-raised/50 hover:text-ink",children:l("common.cancel")}),s&&n.jsx("button",{type:"button",onClick:()=>{R(),s()},className:"rounded-lg px-2 py-1 font-medium text-ink hover:bg-raised/50","data-account-continue-without":!0,children:l("setup.google.continueWithout")})]}):n.jsxs("button",{type:"button",onClick:()=>{A()},disabled:x||N||!t,className:"flex w-fit items-center gap-1.5 rounded-lg bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[x?n.jsx(je,{size:14,className:"animate-spin"}):n.jsx(Sn,{size:14}),e.accounts.length?l("accounts.connectAnother"):l("accounts.connect")]})]}):n.jsx("div",{className:"rounded-lg bg-inset px-3 py-2 text-[12.5px] text-ink-secondary",children:l("accounts.notConfigured")}),g&&n.jsx("p",{role:"status",className:"text-[12px] text-success",children:g}),p&&(s?n.jsxs("div",{role:"alert",className:"flex flex-wrap items-center gap-2 rounded-lg bg-warning/10 px-3 py-2 text-[12.5px] text-ink","data-account-unavailable":!0,children:[n.jsx("span",{className:"min-w-0 flex-1",children:p}),n.jsx("button",{type:"button",onClick:s,className:"rounded-lg bg-accent px-3 py-1.5 text-[12.5px] font-medium text-white",children:l("setup.continue")})]}):n.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:p}))]}),n.jsx(na,{open:k!==null,title:l("accounts.removeTitle",{email:k?.email??""}),body:l("accounts.removeBody"),confirmLabel:l("accounts.remove"),tone:"neutral",onCancel:()=>w(null),onConfirm:()=>{B()}})]})}function gce(){const{dispatch:e}=ke();return n.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border border-hairline/40 px-3 py-2 text-[12.5px] leading-relaxed text-ink-secondary","data-not-the-ai":!0,children:[n.jsx("span",{className:"min-w-0 flex-1 basis-60",children:l("accounts.notTheAi")}),n.jsx("button",{type:"button",onClick:()=>e({type:"toggleAppSettings",open:!0,section:"engines"}),className:"shrink-0 font-medium text-accent hover:underline",children:l("accounts.openSubscriptions")})]})}function fce(){const{status:e,error:t,refresh:a}=LS(),o=M0(),[i,s]=f.useState(""),r=(d,p)=>{s(""),o.set("accounts",d,p).catch(h=>s(h instanceof Error?h.message:String(h)))};if(!e)return t?n.jsx("p",{role:"alert",className:"text-[12.5px] text-danger",children:t}):n.jsx("p",{className:"text-[12.5px] text-ink-secondary",children:l("accounts.loading")});const c=e.storage!=="unavailable";return n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:l("accounts.intro")}),n.jsx(gce,{}),!c&&n.jsx("div",{role:"alert",className:"rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-[12.5px] text-warning",children:l("accounts.storageUnavailable")}),n.jsx("p",{className:"text-[12px] leading-relaxed text-ink-secondary",children:l("owner.connectionsIntro")}),i&&n.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:l("owner.failed",{error:i})}),e.providers.map(d=>d.id==="apple"?n.jsx(pce,{provider:d,onChanged:a,personalIds:o.connections.accounts,onPersonal:r},d.id):n.jsx(DO,{provider:d,storageReady:c,onChanged:a,personalIds:o.connections.accounts,onPersonal:r},d.id))]})}function bce({onConnected:e,onSkip:t,sameAsGemini:a=!1,domain:o=null}){const{status:i,error:s,refresh:r}=LS(),c=i&&{...i,providers:i.providers.filter(b=>b.id!=="apple")},d=(b,x)=>b!=="google"||TR(x,o),p=c?.providers.some(b=>b.accounts.some(x=>d(b.id,x.email)))??!1,h=c?.providers.flatMap(b=>b.accounts.filter(x=>!d(b.id,x.email)))??[];f.useEffect(()=>{p&&e()},[p]);const g=c?.storage!=="unavailable";return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.accounts.intro")}),a&&n.jsx("p",{className:"mt-1.5 text-[13px] font-medium leading-relaxed text-ink",children:o?l("setup.accounts.sameAccountDomain",{domain:o}):l("setup.accounts.sameAccount")}),n.jsx("p",{className:"mt-1.5 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.accounts.perBot")}),h.length>0&&o&&n.jsx("p",{role:"alert",className:"mt-3 rounded-xl border border-danger/25 bg-danger/10 px-3 py-2.5 text-[12.5px] leading-relaxed text-ink",children:l("setup.google.wrongDomain",{domain:o,email:h[0].email})}),n.jsxs("div",{className:"mt-4 flex flex-col gap-3",children:[!c&&(s?n.jsx("p",{role:"alert",className:"text-[12.5px] text-danger",children:l("setup.accounts.loadFailed")}):n.jsx("p",{className:"text-[12.5px] text-ink-secondary",children:l("accounts.loading")})),c?.providers.map(b=>n.jsx(DO,{provider:b,storageReady:g,onChanged:r,onGiveUp:t},b.id))]}),t&&n.jsx("p",{className:"mt-3 text-[12.5px] text-ink-secondary",children:l("setup.accounts.optional")}),n.jsx(Ji,{children:n.jsx("p",{children:l("setup.accounts.what")})})]})}function yce(e){return e.filter(t=>t.kind==="apiKey"&&t.billing==="payPerUse")}function xce({onSaved:e}){const{refreshInstances:t}=ke(),[a,o]=f.useState([]),[i,s]=f.useState(null),[r,c]=f.useState(""),[d,p]=f.useState("entering"),[h,g]=f.useState(null),[b,x]=f.useState([]);f.useEffect(()=>{Z("/api/provider-accounts",{timeoutMs:1e4}).then(({providers:w})=>{const N=yce(w);o(N),x(N.filter(C=>C.accounts.some(j=>j.keyConfigured)).map(C=>C.id))}).catch(()=>o([]))},[]);const v=a.find(w=>w.id===i)??null,k=async()=>{const w=r.trim();if(!(!v||!w)){p("saving"),g(null);try{if(v.keyTest){const N=await Z("/api/keys/test",{method:"POST",body:JSON.stringify({provider:v.keyTest.provider,key:w,...v.keyTest.url?{url:v.keyTest.url}:{}}),timeoutMs:3e4});if(!N.ok){p(N.reason==="rejected"?"rejected":N.reason==="unreachable"?"unreachable":"failed");return}}await DS(v,v.label,w),c(""),x(N=>[...new Set([...N,v.id])]),p("tested"),e(),await t().catch(()=>{})}catch(N){g(Xo(N)?null:N instanceof Error?N.message:String(N)),p(Xo(N)?"entering":"failed")}}};return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.apiKeys.intro")}),n.jsx("p",{className:"mt-1.5 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.apiKeys.costs")}),n.jsx("div",{role:"radiogroup","aria-label":l("setup.apiKeys.pick"),className:"mt-4 grid grid-cols-2 gap-2 sm:grid-cols-3",children:a.map(w=>n.jsxs("button",{type:"button",role:"radio","aria-checked":i===w.id,onClick:()=>{s(w.id),c(""),p("entering")},className:V("flex items-center gap-2 rounded-xl border px-3 py-2.5 text-left text-[13px] transition-colors",i===w.id?"border-accent bg-accent/10 text-ink":"border-hairline/50 bg-card text-ink-secondary hover:bg-raised/40"),children:[w.icon?n.jsx(Rg,{preset:w.icon,size:18}):n.jsx(Nd,{driverKind:w.driver,size:18}),n.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-ink",children:w.label}),b.includes(w.id)&&n.jsx("span",{className:"text-[11px] text-success",children:l("setup.apiKeys.saved")})]},w.id))}),v&&n.jsx(jO,{name:v.label,phase:d,value:r,onChange:w=>{c(w),d!=="saving"&&p("entering")},onSave:()=>{k()},keyUrl:v.keyUrl,error:h}),n.jsxs(Ji,{children:[n.jsx("p",{children:l("setup.apiKeys.what1")}),n.jsx("p",{children:l("setup.apiKeys.what2")})]})]})}const AM="atomic-engine";function vce(e,t,a=null){return e?t?t.snapshot.state==="available"?"ready":a?.kind==="engine-install"&&a.state==="running"?"installing":a?.kind==="engine-install"&&a.state==="failed"?"installFailed":t.install?.managed?"installable":"notInstalled":"absent":"checking"}function kce({phase:e,chibitek:t,checking:a,onCheck:o,onInstall:i,job:s,downloadBytes:r}){return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.atomicEngine.intro")}),n.jsxs("div",{className:"mt-4 rounded-xl border border-hairline/40 bg-card p-3.5","data-phase":e,children:[e==="checking"&&n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[n.jsx(je,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.atomicEngine.checking")]}),e==="ready"&&n.jsx(ud,{children:l("setup.atomicEngine.ready")}),e==="installable"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:l("setup.atomicEngine.installIntro",{size:u3(r??0)})}),n.jsxs("button",{type:"button",onClick:i,className:V(Ka,"mt-3 w-full"),children:[n.jsx(ga,{size:14,"aria-hidden":"true"}),l("setup.atomicEngine.install")]})]}),e==="installing"&&n.jsxs(n.Fragment,{children:[n.jsx(qi,{label:l("setup.atomicEngine.installing")}),n.jsx(jd,{detail:s?.detail})]}),e==="installFailed"&&n.jsx(Ra,{message:zl(s),detail:s?.detail,onRetry:i}),(e==="notInstalled"||e==="absent")&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"inline-flex rounded-full bg-raised px-2 py-0.5 text-[11px] font-medium text-ink-secondary",children:l("setup.optional")}),n.jsx("p",{className:"mt-2 text-[13px] leading-relaxed text-ink",children:l("setup.atomicEngine.notYet")}),n.jsx("p",{className:"mt-1.5 text-[12.5px] leading-relaxed text-ink-secondary",children:l(t?"setup.atomicEngine.askChibitek":"setup.atomicEngine.others")}),e==="notInstalled"&&n.jsxs("button",{type:"button",onClick:o,disabled:a,className:`${Ga} mt-3`,children:[n.jsx(vn,{size:13,className:a?"animate-spin":"","aria-hidden":"true"}),l(a?"common.checking":"common.checkAgain")]})]})]}),n.jsx(Ji,{children:n.jsx("p",{children:l("setup.atomicEngine.what")})})]})}function wce({chibitek:e,onReady:t}){const{state:a,refreshInstances:o}=ke(),[i,s]=f.useState(a.instances.length>0),[r,c]=f.useState(!1),{job:d,start:p}=Br(()=>{o().catch(()=>{})}),h=a.instances.find(x=>x.instanceId===AM),g=vce(i,h,d),b=()=>{c(!0),o().catch(()=>{}).finally(()=>{c(!1),s(!0)})};return f.useEffect(b,[]),f.useEffect(()=>{g==="ready"&&t()},[g]),n.jsx(kce,{phase:g,chibitek:e,checking:r,onCheck:b,onInstall:()=>{p("engine-install",AM)},job:d,downloadBytes:h?.install?.managed?.downloadBytes})}function Sce({chibi:e,connected:t,items:a}){const o=a.filter(i=>i.status!=="done");return n.jsxs("div",{className:"flex flex-col",children:[n.jsxs("div",{className:"rounded-xl border border-hairline/40 bg-card px-3.5 py-3",children:[n.jsx("div",{className:"text-[11.5px] font-semibold uppercase tracking-wide text-ink-secondary",children:l("setup.chibi.connectedTitle")}),t.length?n.jsx("ul",{className:"mt-1.5 space-y-1",children:t.map(i=>n.jsxs("li",{className:"flex items-center gap-2 text-[13px] text-ink",children:[n.jsx(cs,{size:14,className:"shrink-0 text-success","aria-hidden":"true"}),i]},i))}):n.jsx("p",{className:"mt-1.5 text-[13px] leading-relaxed text-ink",children:l("setup.chibi.nothingConnected")}),o.length>0&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"mt-3 text-[11.5px] font-semibold uppercase tracking-wide text-ink-secondary",children:l("setup.chibi.laterTitle")}),n.jsx("ul",{className:"mt-1.5 space-y-1",children:o.map(i=>n.jsxs("li",{className:"flex items-center gap-2 text-[12.5px] text-ink-secondary",children:[i.status==="skipped"?n.jsx(bE,{size:13,"aria-hidden":"true"}):n.jsx(fE,{size:13,"aria-hidden":"true"}),dx(i.screen)]},i.key))}),n.jsx("p",{className:"mt-2 text-[12px] text-ink-secondary",children:l("setup.chibi.laterHint")})]})]}),n.jsxs("div",{className:"mt-4 flex items-center gap-4 rounded-xl border border-hairline/40 bg-card p-3.5",children:[e&&n.jsx(Zt,{bot:e,state:"happy",size:56}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-[14px] font-semibold text-ink",children:l("setup.chibi.meet")}),n.jsx("p",{className:"mt-0.5 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.chibi.intro")})]})]})]})}function Cce({podman:e,wantsLocal:t,download:a,machine:o,onChooseLocal:i,onLater:s,onDownload:r,onCheck:c,onStart:d}){return t?e?e.platform!=="darwin"||!["arm64","x64"].includes(e.arch)?n.jsx("p",{className:"mt-4 rounded-xl border border-hairline/40 bg-card p-3.5 text-[13px] leading-relaxed text-ink",children:l("setup.computers.unsupported")}):n.jsxs("div",{className:"mt-4 rounded-xl border border-hairline/40 bg-card p-3.5","data-podman":e.installed?e.running?"running":"installed":"missing",children:[!e.installed&&a?.state!=="running"&&a?.state!=="succeeded"&&a?.state!=="failed"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:l("setup.computers.podmanIntro")}),n.jsxs("button",{type:"button",onClick:r,className:V(Ka,"mt-3 w-full"),children:[n.jsx(ga,{size:14,"aria-hidden":"true"}),l("setup.computers.download")]}),n.jsx("p",{className:"mt-1.5 text-center text-[11px] text-ink-secondary",children:l("setup.computers.downloadNote")})]}),a?.state==="running"&&n.jsxs(n.Fragment,{children:[n.jsx(qi,{label:l(a.phase==="downloading"?"setup.computers.phase.downloading":a.phase==="verifying"?"setup.computers.phase.verifying":"setup.computers.phase.opening"),received:a.received,total:a.total}),n.jsx(jd,{detail:a.detail})]}),!e.installed&&a?.state==="succeeded"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:l("setup.computers.finishInstaller")}),n.jsxs("button",{type:"button",onClick:c,className:V(Ga,"mt-3"),children:[n.jsx(vn,{size:13,"aria-hidden":"true"}),l("setup.computers.installedCheck")]}),n.jsx("button",{type:"button",onClick:r,className:V(Ga,"mt-3 ml-2"),children:l("setup.computers.reopenInstaller")})]}),!e.installed&&a?.state==="failed"&&n.jsx(Ra,{message:zl(a),detail:a.detail,onRetry:r}),e.installed&&!e.running&&o?.state!=="running"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:l("setup.computers.startIntro")}),n.jsx("button",{type:"button",onClick:d,className:V(Ka,"mt-3 w-full"),children:l("setup.computers.start")}),o?.state==="failed"&&n.jsx(Ra,{message:zl(o),detail:o.detail,onRetry:d})]}),o?.state==="running"&&n.jsx(qi,{label:l("setup.computers.starting")}),e.installed&&e.running&&n.jsx(ud,{children:l("setup.computers.ready")})]}):n.jsx(qi,{label:l("setup.computers.checking")}):n.jsxs("div",{className:"mt-4 grid gap-2 sm:grid-cols-2",children:[n.jsxs("button",{type:"button","data-primary":"",onClick:s,"aria-label":l("setup.computers.later"),"aria-describedby":"computers-later-detail",className:"flex flex-col items-start gap-1.5 rounded-xl border border-accent bg-accent/10 p-3.5 text-left",children:[n.jsx(_s,{size:18,className:"text-ink-secondary","aria-hidden":"true"}),n.jsx("span",{className:"text-[13.5px] font-semibold text-ink",children:l("setup.computers.later")}),n.jsx("span",{id:"computers-later-detail",className:"text-[12px] leading-snug text-ink-secondary",children:l("setup.computers.laterDetail")})]}),n.jsxs("button",{type:"button",onClick:i,"aria-label":l("setup.computers.local"),"aria-describedby":"computers-local-detail",className:"flex flex-col items-start gap-1.5 rounded-xl border border-hairline/50 bg-card p-3.5 text-left hover:bg-raised/40",children:[n.jsx(Ea,{size:18,className:"text-ink-secondary","aria-hidden":"true"}),n.jsx("span",{className:"text-[13.5px] font-semibold text-ink",children:l("setup.computers.local")}),n.jsx("span",{id:"computers-local-detail",className:"text-[12px] leading-snug text-ink-secondary",children:l("setup.computers.localDetail")})]})]})}function OO({onReady:e,onLater:t=()=>{},localOnly:a=!1}){const[o,i]=f.useState(a),[s,r]=f.useState(null),[c,d]=f.useState(null),p=f.useCallback(async()=>{r(null);try{const b=await Z("/api/setup/machine",{timeoutMs:15e3});d({platform:b.platform,arch:b.arch,...b.podman})}catch(b){d(null),r(b instanceof Error?b.message:l("setup.computers.checkFailed"))}},[]),h=Br(()=>{p()}),g=Br(()=>{p()});return f.useEffect(()=>{o&&p()},[o,p]),f.useEffect(()=>{c?.installed&&c.running&&e()},[c?.installed,c?.running]),n.jsxs("div",{className:"flex flex-col",children:[!a&&n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.computers.intro")}),s?n.jsx(Ra,{message:l("setup.computers.checkFailed"),detail:s,onRetry:()=>{p()}}):n.jsx(Cce,{podman:c,wantsLocal:o,download:h.job,machine:g.job,onChooseLocal:()=>i(!0),onLater:t,onDownload:()=>{h.start("podman-download")},onCheck:()=>{p()},onStart:()=>{g.start("podman-machine")}}),h.startError&&n.jsx(Ra,{message:l("setup.computers.downloadFailed"),detail:h.startError,onRetry:()=>{h.start("podman-download")}}),g.startError&&n.jsx(Ra,{message:l("setup.computers.startFailed"),detail:g.startError,onRetry:()=>{g.start("podman-machine")}}),!a&&n.jsx(Ji,{children:n.jsx("p",{children:l("setup.computers.what")})})]})}const jce=[{tag:"gemma4:e4b",label:"Gemma 4",sizeGb:6.6,note:"Google's model. Atomic's pick for Macs with 16 GB or more."},{tag:"gemma4:e2b-it-qat",label:"Gemma 4 (small)",sizeGb:4.3,note:"A lighter Gemma 4 for light tasks on 8 GB Macs."},{tag:"qwen3:4b",label:"Qwen 3 (4B)",sizeGb:2.5,note:"Small and quick. Good for simple tasks."},{tag:"qwen3:8b",label:"Qwen 3 (8B)",sizeGb:5.2,note:"A good everyday model for most Macs."},{tag:"llama3.1:8b",label:"Llama 3.1 (8B)",sizeGb:4.9,note:"Meta's general model. Steady with tools."},{tag:"granite3.3:8b",label:"Granite 3.3 (8B)",sizeGb:4.9,note:"IBM's business-focused model."},{tag:"qwen3:14b",label:"Qwen 3 (14B)",sizeGb:9.3,note:"Noticeably smarter. Needs 16 GB or more."},{tag:"gpt-oss:20b",label:"gpt-oss (20B)",sizeGb:14,note:"OpenAI's open model. Strong reasoning."},{tag:"devstral:24b",label:"Devstral (24B)",sizeGb:14,note:"Mistral's model for coding work."},{tag:"mistral-small3.2:24b",label:"Mistral Small 3.2 (24B)",sizeGb:15,note:"Mistral's general model."},{tag:"qwen3-coder:30b",label:"Qwen 3 Coder (30B)",sizeGb:19,note:"Built for coding and tools. Fast for its size."},{tag:"qwen3:32b",label:"Qwen 3 (32B)",sizeGb:20,note:"Qwen's largest dense model."},{tag:"gpt-oss:120b",label:"gpt-oss (120B)",sizeGb:65,note:"OpenAI's large open model. Needs 96 GB or more."}],w3=1024**3;function Nce(e,t){return!(t>0)||e*1.25+6*w3<=t?"fits":e+3*w3<=t?"tight":"tooBig"}function Ace(e){return Math.round(e.sizeGb*w3)}const Mce=/^[a-z0-9][a-z0-9._/-]*(?::[a-z0-9][a-z0-9._-]*)?$/i;function Ice(e){return typeof e=="string"&&e.length<=200&&Mce.test(e)&&!e.includes("..")&&!e.includes("//")}function Pce(e){return e.enabled?e.custom?"settings.localModels.memory.statusCustom":e.applied?"settings.localModels.memory.statusOn":"settings.localModels.memory.statusFailed":"settings.localModels.memory.statusOff"}function Tce(){const e=typeof window<"u"?window.ogb?.ollamaMemory:void 0,[t,a]=f.useState(null),[o,i]=f.useState(!1);if(f.useEffect(()=>{if(!e)return;let r=!1;return e.state().then(c=>{r||a(c)}).catch(()=>{}),()=>{r=!0}},[e]),!e||!t?.supported)return null;const s=Pce(t);return n.jsx("div",{className:"mt-4 border-t border-hairline/30 pt-1",children:n.jsx(Jt,{title:l("settings.localModels.memory.title"),subtitle:l("settings.localModels.memory.subtitle"),message:n.jsx("span",{className:s==="settings.localModels.memory.statusFailed"?"text-danger":"text-ink-secondary",children:l(s)}),children:n.jsx(Tt,{checked:t.enabled,disabled:o,"aria-label":l("settings.localModels.memory.title"),onClick:()=>{i(!0),e.set(!t.enabled).then(a).catch(()=>{}).finally(()=>i(!1))},className:"disabled:cursor-wait disabled:opacity-50"})})})}function Bce({state:e,onDone:t}){const{job:a,start:o}=Br(t);return a?.state==="running"?n.jsx("div",{className:"basis-full",children:n.jsx(qi,{label:l(a.kind==="ollama-start"?"setup.localAi.phase.starting":"setup.localAi.phase.installing"),received:a.received,total:a.total})}):n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:()=>{o(e==="missing"?"ollama-install":"ollama-start")},className:"text-[12px] font-medium text-accent hover:underline",children:l(e==="missing"?"setup.localAi.installOllama":"setup.localAi.openOllama")}),a?.state==="failed"&&n.jsx("div",{className:"basis-full",children:n.jsx(Ra,{message:zl(a),detail:a.detail})})]})}const S3=1024**3,ip="rounded-lg border border-hairline/40 px-3 py-1.5 text-[12px] text-ink-secondary hover:bg-raised/50 hover:text-ink disabled:cursor-not-allowed disabled:opacity-50",Ece="min-w-0 flex-1 rounded-lg border border-hairline/40 bg-inset px-3 py-2 text-[13px] text-ink placeholder:text-ink-secondary focus:border-hairline focus:outline-none disabled:opacity-50";function bx(e){return e>=S3?`${(e/S3).toFixed(1)} GB`:`${Math.max(1,Math.round(e/1024**2))} MB`}function Rce(e){const t=e.modifiedAt?new Date(e.modifiedAt):null;return[e.parameterSize,e.quantization,e.family,e.cloud?void 0:bx(e.sizeBytes),t&&!Number.isNaN(t.getTime())?t.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}):void 0].filter(Boolean).join(" · ")}function Dce(e){return e.total?Math.min(100,Math.round((e.completed??0)/e.total*100)):null}const Oce={fits:"settings.localModels.fit.fits",tight:"settings.localModels.fit.tight",tooBig:"settings.localModels.fit.tooBig"};function zce(e,t){const a=[];for(const o of t){if(o.snapshot.state!=="available"||o.policy||o.readOnly)continue;const i=o.models.options.find(s=>s.id===`ollama::${e}`||s.id===`local_ollama::${e}`);i&&a.push({instance:o,modelId:i.id})}return a}async function zO(e,t){const a=e.getReader(),o=new TextDecoder;let i="";for(;;){const{value:s,done:r}=await a.read();i+=r?`${o.decode()}
|
|
87
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const r of e.seen.entries()){const c=r[1];if(t===r[0]){s(r);continue}if(e.external){const p=e.external.registry.get(r[0])?.id;if(t!==r[0]&&p){s(r);continue}}if(e.metadataRegistry.get(r[0])?.id){s(r);continue}if(c.cycle){s(r);continue}if(c.count>1&&e.reused==="ref"){s(r);continue}}}function QD(e,t){const a=e.seen.get(t);if(!a)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=c=>{const d=e.seen.get(c);if(d.ref===null)return;const p=d.def??d.schema,h={...p},g=d.ref;if(d.ref=null,g){o(g);const x=e.seen.get(g),v=x.schema;if(v.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(v)):Object.assign(p,v),Object.assign(p,h),c._zod.parent===g)for(const w in p)w==="$ref"||w==="allOf"||w in h||delete p[w];if(v.$ref&&x.def)for(const w in p)w==="$ref"||w==="allOf"||w in x.def&&JSON.stringify(p[w])===JSON.stringify(x.def[w])&&delete p[w]}const b=c._zod.parent;if(b&&b!==g){o(b);const x=e.seen.get(b);if(x?.schema.$ref&&(p.$ref=x.schema.$ref,x.def))for(const v in p)v==="$ref"||v==="allOf"||v in x.def&&JSON.stringify(p[v])===JSON.stringify(x.def[v])&&delete p[v]}e.override({zodSchema:c,jsonSchema:p,path:d.path??[]})};for(const c of[...e.seen.entries()].reverse())o(c[0]);const i={};if(e.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(c)}Object.assign(i,a.def??a.schema);const s=e.metadataRegistry.get(t)?.id;s!==void 0&&i.id===s&&delete i.id;const r=e.external?.defs??{};for(const c of e.seen.entries()){const d=c[1];d.def&&d.defId&&(d.def.id===d.defId&&delete d.def.id,r[d.defId]=d.def)}e.external||Object.keys(r).length>0&&(e.target==="draft-2020-12"?i.$defs=r:i.definitions=r);try{const c=JSON.parse(JSON.stringify(i));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:hx(t,"input",e.processors),output:hx(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function Po(e,t){const a=t??{seen:new Set};if(a.seen.has(e))return!1;a.seen.add(e);const o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return Po(o.element,a);if(o.type==="set")return Po(o.valueType,a);if(o.type==="lazy")return Po(o.getter(),a);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return Po(o.innerType,a);if(o.type==="intersection")return Po(o.left,a)||Po(o.right,a);if(o.type==="record"||o.type==="map")return Po(o.keyType,a)||Po(o.valueType,a);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Po(o.in,a)||Po(o.out,a);if(o.type==="object"){for(const i in o.shape)if(Po(o.shape[i],a))return!0;return!1}if(o.type==="union"){for(const i of o.options)if(Po(i,a))return!0;return!1}if(o.type==="tuple"){for(const i of o.items)if(Po(i,a))return!0;return!!(o.rest&&Po(o.rest,a))}return!1}const Gie=(e,t={})=>a=>{const o=YD({...a,processors:t});return mo(e,o),ZD(o,e),QD(o,e)},hx=(e,t,a={})=>o=>{const{libraryOptions:i,target:s}=o??{},r=YD({...i??{},target:s,io:t,processors:a});return mo(e,r),ZD(r,e),QD(r,e)},Kie={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Wie=(e,t,a,o)=>{const i=a;i.type="string";const{minimum:s,maximum:r,format:c,patterns:d,contentEncoding:p}=e._zod.bag;if(typeof s=="number"&&(i.minLength=s),typeof r=="number"&&(i.maxLength=r),c&&(i.format=Kie[c]??c,i.format===""&&delete i.format,c==="time"&&delete i.format),p&&(i.contentEncoding=p),d&&d.size>0){const h=[...d];h.length===1?i.pattern=h[0].source:h.length>1&&(i.allOf=[...h.map(g=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))])}},Jie=(e,t,a,o)=>{const i=a,{minimum:s,maximum:r,format:c,multipleOf:d,exclusiveMaximum:p,exclusiveMinimum:h}=e._zod.bag;typeof c=="string"&&c.includes("int")?i.type="integer":i.type="number";const g=typeof h=="number"&&h>=(s??Number.NEGATIVE_INFINITY),b=typeof p=="number"&&p<=(r??Number.POSITIVE_INFINITY),x=t.target==="draft-04"||t.target==="openapi-3.0";g?x?(i.minimum=h,i.exclusiveMinimum=!0):i.exclusiveMinimum=h:typeof s=="number"&&(i.minimum=s),b?x?(i.maximum=p,i.exclusiveMaximum=!0):i.exclusiveMaximum=p:typeof r=="number"&&(i.maximum=r),typeof d=="number"&&(i.multipleOf=d)},Yie=(e,t,a,o)=>{a.type="boolean"},Zie=(e,t,a,o)=>{a.not={}},Qie=(e,t,a,o)=>{},Xie=(e,t,a,o)=>{const i=e._zod.def,s=ID(i.entries);s.every(r=>typeof r=="number")&&(a.type="number"),s.every(r=>typeof r=="string")&&(a.type="string"),a.enum=s},ese=(e,t,a,o)=>{const i=e._zod.def,s=[];for(const r of i.values)if(r===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof r=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(r))}else s.push(r);if(s.length!==0)if(s.length===1){const r=s[0];a.type=r===null?"null":typeof r,t.target==="draft-04"||t.target==="openapi-3.0"?a.enum=[r]:a.const=r}else s.every(r=>typeof r=="number")&&(a.type="number"),s.every(r=>typeof r=="string")&&(a.type="string"),s.every(r=>typeof r=="boolean")&&(a.type="boolean"),s.every(r=>r===null)&&(a.type="null"),a.enum=s},tse=(e,t,a,o)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},nse=(e,t,a,o)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},ase=(e,t,a,o)=>{const i=a,s=e._zod.def,{minimum:r,maximum:c}=e._zod.bag;typeof r=="number"&&(i.minItems=r),typeof c=="number"&&(i.maxItems=c),i.type="array",i.items=mo(s.element,t,{...o,path:[...o.path,"items"]})},ose=(e,t,a,o)=>{const i=a,s=e._zod.def;i.type="object",i.properties={};const r=s.shape;for(const p in r)i.properties[p]=mo(r[p],t,{...o,path:[...o.path,"properties",p]});const c=new Set(Object.keys(r)),d=new Set([...c].filter(p=>{const h=s.shape[p]._zod;return t.io==="input"?h.optin===void 0:h.optout===void 0}));d.size>0&&(i.required=Array.from(d)),s.catchall?._zod.def.type==="never"?i.additionalProperties=!1:s.catchall?s.catchall&&(i.additionalProperties=mo(s.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},ise=(e,t,a,o)=>{const i=e._zod.def,s=i.inclusive===!1,r=i.options.map((c,d)=>mo(c,t,{...o,path:[...o.path,s?"oneOf":"anyOf",d]}));s?a.oneOf=r:a.anyOf=r},sse=(e,t,a,o)=>{const i=e._zod.def,s=mo(i.left,t,{...o,path:[...o.path,"allOf",0]}),r=mo(i.right,t,{...o,path:[...o.path,"allOf",1]}),c=p=>"allOf"in p&&Object.keys(p).length===1,d=[...c(s)?s.allOf:[s],...c(r)?r.allOf:[r]];a.allOf=d},rse=(e,t,a,o)=>{const i=e._zod.def,s=mo(i.innerType,t,o),r=t.seen.get(e);t.target==="openapi-3.0"?(r.ref=i.innerType,a.nullable=!0):a.anyOf=[s,{type:"null"}]},lse=(e,t,a,o)=>{const i=e._zod.def;mo(i.innerType,t,o);const s=t.seen.get(e);s.ref=i.innerType},cse=(e,t,a,o)=>{const i=e._zod.def;mo(i.innerType,t,o);const s=t.seen.get(e);s.ref=i.innerType,a.default=JSON.parse(JSON.stringify(i.defaultValue))},dse=(e,t,a,o)=>{const i=e._zod.def;mo(i.innerType,t,o);const s=t.seen.get(e);s.ref=i.innerType,t.io==="input"&&(a._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},use=(e,t,a,o)=>{const i=e._zod.def;mo(i.innerType,t,o);const s=t.seen.get(e);s.ref=i.innerType;let r;try{r=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}a.default=r},pse=(e,t,a,o)=>{const i=e._zod.def,s=i.in._zod.traits.has("$ZodTransform"),r=t.io==="input"?s?i.out:i.in:i.out;mo(r,t,o);const c=t.seen.get(e);c.ref=r},mse=(e,t,a,o)=>{const i=e._zod.def;mo(i.innerType,t,o);const s=t.seen.get(e);s.ref=i.innerType,a.readOnly=!0},XD=(e,t,a,o)=>{const i=e._zod.def;mo(i.innerType,t,o);const s=t.seen.get(e);s.ref=i.innerType},hse=Qe("ZodISODateTime",(e,t)=>{boe.init(e,t),ca.init(e,t)});function gse(e){return wie(hse,e)}const fse=Qe("ZodISODate",(e,t)=>{yoe.init(e,t),ca.init(e,t)});function bse(e){return Sie(fse,e)}const yse=Qe("ZodISOTime",(e,t)=>{xoe.init(e,t),ca.init(e,t)});function xse(e){return Cie(yse,e)}const vse=Qe("ZodISODuration",(e,t)=>{voe.init(e,t),ca.init(e,t)});function kse(e){return jie(vse,e)}const wse=(e,t)=>{RD.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:a=>lae(e,a)},flatten:{value:a=>rae(e,a)},addIssue:{value:a=>{e.issues.push(a),e.message=JSON.stringify(e.issues,f3,2)}},addIssues:{value:a=>{e.issues.push(...a),e.message=JSON.stringify(e.issues,f3,2)}},isEmpty:{get(){return e.issues.length===0}}})},Yi=Qe("ZodError",wse,{Parent:Error}),Sse=jS(Yi),Cse=NS(Yi),jse=B0(Yi),Nse=E0(Yi),Ase=uae(Yi),Mse=pae(Yi),Ise=mae(Yi),Pse=hae(Yi),Tse=gae(Yi),Bse=fae(Yi),Ese=bae(Yi),Rse=yae(Yi),iM=new WeakMap;function Og(e,t,a){const o=Object.getPrototypeOf(e);let i=iM.get(o);if(i||(i=new Set,iM.set(o,i)),!i.has(t)){i.add(t);for(const s in a){const r=a[s];Object.defineProperty(o,s,{configurable:!0,enumerable:!1,get(){const c=r.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:c}),c},set(c){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:c})}})}}}const ba=Qe("ZodType",(e,t)=>(fa.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:hx(e,"input"),output:hx(e,"output")}}),e.toJSONSchema=Gie(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(a,o)=>Sse(e,a,o,{callee:e.parse}),e.safeParse=(a,o)=>jse(e,a,o),e.parseAsync=async(a,o)=>Cse(e,a,o,{callee:e.parseAsync}),e.safeParseAsync=async(a,o)=>Nse(e,a,o),e.spa=e.safeParseAsync,e.encode=(a,o)=>Ase(e,a,o),e.decode=(a,o)=>Mse(e,a,o),e.encodeAsync=async(a,o)=>Ise(e,a,o),e.decodeAsync=async(a,o)=>Pse(e,a,o),e.safeEncode=(a,o)=>Tse(e,a,o),e.safeDecode=(a,o)=>Bse(e,a,o),e.safeEncodeAsync=async(a,o)=>Ese(e,a,o),e.safeDecodeAsync=async(a,o)=>Rse(e,a,o),Og(e,"ZodType",{check(...a){const o=this.def;return this.clone(Zl(o,{checks:[...o.checks??[],...a.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...a){return this.check(...a)},clone(a,o){return Ql(this,a,o)},brand(){return this},register(a,o){return a.add(this,o),this},refine(a,o){return this.check(Nre(a,o))},superRefine(a,o){return this.check(Are(a,o))},overwrite(a){return this.check(jp(a))},optional(){return cM(this)},exactOptional(){return mre(this)},nullable(){return dM(this)},nullish(){return cM(dM(this))},nonoptional(a){return xre(this,a)},array(){return Qa(this)},or(a){return aO([this,a])},and(a){return lre(this,a)},transform(a){return uM(this,ure(a))},default(a){return fre(this,a)},prefault(a){return yre(this,a)},catch(a){return kre(this,a)},pipe(a){return uM(this,a)},readonly(){return Cre(this)},describe(a){const o=this.clone();return ph.add(o,{description:a}),o},meta(...a){if(a.length===0)return ph.get(this);const o=this.clone();return ph.add(o,a[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(a){return a(this)}}),Object.defineProperty(e,"description",{get(){return ph.get(e)?.description},configurable:!0}),e)),eO=Qe("_ZodString",(e,t)=>{AS.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(o,i,s)=>Wie(e,o,i);const a=e._zod.bag;e.format=a.format??null,e.minLength=a.minimum??null,e.maxLength=a.maximum??null,Og(e,"_ZodString",{regex(...o){return this.check(Tie(...o))},includes(...o){return this.check(Rie(...o))},startsWith(...o){return this.check(Die(...o))},endsWith(...o){return this.check(Oie(...o))},min(...o){return this.check(mx(...o))},max(...o){return this.check(WD(...o))},length(...o){return this.check(JD(...o))},nonempty(...o){return this.check(mx(1,...o))},lowercase(o){return this.check(Bie(o))},uppercase(o){return this.check(Eie(o))},trim(){return this.check(Lie())},normalize(...o){return this.check(zie(...o))},toLowerCase(){return this.check(_ie())},toUpperCase(){return this.check(Fie())},slugify(){return this.check(qie())}})}),Dse=Qe("ZodString",(e,t)=>{AS.init(e,t),eO.init(e,t),e.email=a=>e.check(tie(Ose,a)),e.url=a=>e.check(sie(zse,a)),e.jwt=a=>e.check(kie(Qse,a)),e.emoji=a=>e.check(rie(Lse,a)),e.guid=a=>e.check(tM(sM,a)),e.uuid=a=>e.check(nie(Cb,a)),e.uuidv4=a=>e.check(aie(Cb,a)),e.uuidv6=a=>e.check(oie(Cb,a)),e.uuidv7=a=>e.check(iie(Cb,a)),e.nanoid=a=>e.check(lie(_se,a)),e.guid=a=>e.check(tM(sM,a)),e.cuid=a=>e.check(cie(Fse,a)),e.cuid2=a=>e.check(die(qse,a)),e.ulid=a=>e.check(uie(Use,a)),e.base64=a=>e.check(yie(Jse,a)),e.base64url=a=>e.check(xie(Yse,a)),e.xid=a=>e.check(pie(Vse,a)),e.ksuid=a=>e.check(mie(Hse,a)),e.ipv4=a=>e.check(hie($se,a)),e.ipv6=a=>e.check(gie(Gse,a)),e.cidrv4=a=>e.check(fie(Kse,a)),e.cidrv6=a=>e.check(bie(Wse,a)),e.e164=a=>e.check(vie(Zse,a)),e.datetime=a=>e.check(gse(a)),e.date=a=>e.check(bse(a)),e.time=a=>e.check(xse(a)),e.duration=a=>e.check(kse(a))});function dn(e){return eie(Dse,e)}const ca=Qe("ZodStringFormat",(e,t)=>{aa.init(e,t),eO.init(e,t)}),Ose=Qe("ZodEmail",(e,t)=>{loe.init(e,t),ca.init(e,t)}),sM=Qe("ZodGUID",(e,t)=>{soe.init(e,t),ca.init(e,t)}),Cb=Qe("ZodUUID",(e,t)=>{roe.init(e,t),ca.init(e,t)}),zse=Qe("ZodURL",(e,t)=>{coe.init(e,t),ca.init(e,t)}),Lse=Qe("ZodEmoji",(e,t)=>{doe.init(e,t),ca.init(e,t)}),_se=Qe("ZodNanoID",(e,t)=>{uoe.init(e,t),ca.init(e,t)}),Fse=Qe("ZodCUID",(e,t)=>{poe.init(e,t),ca.init(e,t)}),qse=Qe("ZodCUID2",(e,t)=>{moe.init(e,t),ca.init(e,t)}),Use=Qe("ZodULID",(e,t)=>{hoe.init(e,t),ca.init(e,t)}),Vse=Qe("ZodXID",(e,t)=>{goe.init(e,t),ca.init(e,t)}),Hse=Qe("ZodKSUID",(e,t)=>{foe.init(e,t),ca.init(e,t)}),$se=Qe("ZodIPv4",(e,t)=>{koe.init(e,t),ca.init(e,t)}),Gse=Qe("ZodIPv6",(e,t)=>{woe.init(e,t),ca.init(e,t)}),Kse=Qe("ZodCIDRv4",(e,t)=>{Soe.init(e,t),ca.init(e,t)}),Wse=Qe("ZodCIDRv6",(e,t)=>{Coe.init(e,t),ca.init(e,t)}),Jse=Qe("ZodBase64",(e,t)=>{joe.init(e,t),ca.init(e,t)}),Yse=Qe("ZodBase64URL",(e,t)=>{Aoe.init(e,t),ca.init(e,t)}),Zse=Qe("ZodE164",(e,t)=>{Moe.init(e,t),ca.init(e,t)}),Qse=Qe("ZodJWT",(e,t)=>{Poe.init(e,t),ca.init(e,t)}),tO=Qe("ZodNumber",(e,t)=>{VD.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(o,i,s)=>Jie(e,o,i),Og(e,"ZodNumber",{gt(o,i){return this.check(aM(o,i))},gte(o,i){return this.check(aw(o,i))},min(o,i){return this.check(aw(o,i))},lt(o,i){return this.check(nM(o,i))},lte(o,i){return this.check(nw(o,i))},max(o,i){return this.check(nw(o,i))},int(o){return this.check(rM(o))},safe(o){return this.check(rM(o))},positive(o){return this.check(aM(0,o))},nonnegative(o){return this.check(aw(0,o))},negative(o){return this.check(nM(0,o))},nonpositive(o){return this.check(nw(0,o))},multipleOf(o,i){return this.check(oM(o,i))},step(o,i){return this.check(oM(o,i))},finite(){return this}});const a=e._zod.bag;e.minValue=Math.max(a.minimum??Number.NEGATIVE_INFINITY,a.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(a.maximum??Number.POSITIVE_INFINITY,a.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(a.format??"").includes("int")||Number.isSafeInteger(a.multipleOf??.5),e.isFinite=!0,e.format=a.format??null});function Ps(e){return Nie(tO,e)}const Xse=Qe("ZodNumberFormat",(e,t)=>{Toe.init(e,t),tO.init(e,t)});function rM(e){return Aie(Xse,e)}const ere=Qe("ZodBoolean",(e,t)=>{Boe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>Yie(e,a,o)});function _i(e){return Mie(ere,e)}const tre=Qe("ZodUnknown",(e,t)=>{Eoe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>Qie()});function lM(){return Iie(tre)}const nre=Qe("ZodNever",(e,t)=>{Roe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>Zie(e,a,o)});function are(e){return Pie(nre,e)}const ore=Qe("ZodArray",(e,t)=>{Doe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>ase(e,a,o,i),e.element=t.element,Og(e,"ZodArray",{min(a,o){return this.check(mx(a,o))},nonempty(a){return this.check(mx(1,a))},max(a,o){return this.check(WD(a,o))},length(a,o){return this.check(JD(a,o))},unwrap(){return this.element}})});function Qa(e,t){return Uie(ore,e,t)}const ire=Qe("ZodObject",(e,t)=>{zoe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>ose(e,a,o,i),Bn(e,"shape",()=>t.shape),Og(e,"ZodObject",{keyof(){return Yo(Object.keys(this._zod.def.shape))},catchall(a){return this.clone({...this._zod.def,catchall:a})},passthrough(){return this.clone({...this._zod.def,catchall:lM()})},loose(){return this.clone({...this._zod.def,catchall:lM()})},strict(){return this.clone({...this._zod.def,catchall:are()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(a){return tae(this,a)},safeExtend(a){return nae(this,a)},merge(a){return aae(this,a)},pick(a){return Xne(this,a)},omit(a){return eae(this,a)},partial(...a){return oae(oO,this,a[0])},required(...a){return iae(iO,this,a[0])}})});function zn(e,t){const a={type:"object",shape:e??{},...Bt(t)};return new ire(a)}const nO=Qe("ZodUnion",(e,t)=>{GD.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>ise(e,a,o,i),e.options=t.options});function aO(e,t){return new nO({type:"union",options:e,...Bt(t)})}const sre=Qe("ZodDiscriminatedUnion",(e,t)=>{nO.init(e,t),Loe.init(e,t)});function MS(e,t,a){return new sre({type:"union",options:t,discriminator:e,...Bt(a)})}const rre=Qe("ZodIntersection",(e,t)=>{_oe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>sse(e,a,o,i)});function lre(e,t){return new rre({type:"intersection",left:e,right:t})}const y3=Qe("ZodEnum",(e,t)=>{Foe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(o,i,s)=>Xie(e,o,i),e.enum=t.entries,e.options=Object.values(t.entries);const a=new Set(Object.keys(t.entries));e.extract=(o,i)=>{const s={};for(const r of o)if(a.has(r))s[r]=t.entries[r];else throw new Error(`Key ${r} not found in enum`);return new y3({...t,checks:[],...Bt(i),entries:s})},e.exclude=(o,i)=>{const s={...t.entries};for(const r of o)if(a.has(r))delete s[r];else throw new Error(`Key ${r} not found in enum`);return new y3({...t,checks:[],...Bt(i),entries:s})}});function Yo(e,t){const a=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new y3({type:"enum",entries:a,...Bt(t)})}const cre=Qe("ZodLiteral",(e,t)=>{qoe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>ese(e,a,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function vo(e,t){return new cre({type:"literal",values:Array.isArray(e)?e:[e],...Bt(t)})}const dre=Qe("ZodTransform",(e,t)=>{Uoe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>nse(e,a),e._zod.parse=(a,o)=>{if(o.direction==="backward")throw new MD(e.constructor.name);a.addIssue=s=>{if(typeof s=="string")a.issues.push(sg(s,a.value,t));else{const r=s;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=a.value),r.inst??(r.inst=e),a.issues.push(sg(r))}};const i=t.transform(a.value,a);return i instanceof Promise?i.then(s=>(a.value=s,a.fallback=!0,a)):(a.value=i,a.fallback=!0,a)}});function ure(e){return new dre({type:"transform",transform:e})}const oO=Qe("ZodOptional",(e,t)=>{KD.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>XD(e,a,o,i),e.unwrap=()=>e._zod.def.innerType});function cM(e){return new oO({type:"optional",innerType:e})}const pre=Qe("ZodExactOptional",(e,t)=>{Voe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>XD(e,a,o,i),e.unwrap=()=>e._zod.def.innerType});function mre(e){return new pre({type:"optional",innerType:e})}const hre=Qe("ZodNullable",(e,t)=>{Hoe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>rse(e,a,o,i),e.unwrap=()=>e._zod.def.innerType});function dM(e){return new hre({type:"nullable",innerType:e})}const gre=Qe("ZodDefault",(e,t)=>{$oe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>cse(e,a,o,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function fre(e,t){return new gre({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():TD(t)}})}const bre=Qe("ZodPrefault",(e,t)=>{Goe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>dse(e,a,o,i),e.unwrap=()=>e._zod.def.innerType});function yre(e,t){return new bre({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():TD(t)}})}const iO=Qe("ZodNonOptional",(e,t)=>{Koe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>lse(e,a,o,i),e.unwrap=()=>e._zod.def.innerType});function xre(e,t){return new iO({type:"nonoptional",innerType:e,...Bt(t)})}const vre=Qe("ZodCatch",(e,t)=>{Woe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>use(e,a,o,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function kre(e,t){return new vre({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const wre=Qe("ZodPipe",(e,t)=>{Joe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>pse(e,a,o,i),e.in=t.in,e.out=t.out});function uM(e,t){return new wre({type:"pipe",in:e,out:t})}const Sre=Qe("ZodReadonly",(e,t)=>{Yoe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>mse(e,a,o,i),e.unwrap=()=>e._zod.def.innerType});function Cre(e){return new Sre({type:"readonly",innerType:e})}const jre=Qe("ZodCustom",(e,t)=>{Zoe.init(e,t),ba.init(e,t),e._zod.processJSONSchema=(a,o,i)=>tse(e,a)});function Nre(e,t={}){return Vie(jre,e,t)}function Are(e,t){return Hie(e,t)}const sO=["cursor","blob","circle","squircle","capsule","drop","shield","hexagon","diamond","star","panes"],Mre=Yo(sO),Ire="cursor",IS={cursor:{id:"cursor",name:"Cursor",fit:"translate(68.1612 9.8302) scale(0.593918)",body:'<path fill="{{GRADIENT}}" d="M0 0 C1.12815992 0.94880479 2.25705591 1.89673511 3.38671875 2.84375 C5.57657936 4.68528228 7.75793952 6.53624249 9.93359375 8.39453125 C13.5602214 11.48647103 17.25022962 14.49819427 20.9453125 17.5078125 C25.41301487 21.15281776 29.86103386 24.8215994 34.31054688 28.48876953 C38.00933931 31.5370903 41.70951059 34.58367973 45.4140625 37.625 C52.50037463 43.44570076 59.55669812 49.29508834 66.54003906 55.23901367 C70.43289872 58.54377434 74.40406577 61.73568847 78.40625 64.90625 C82.05401433 67.85083084 85.6145398 70.89451533 89.18359375 73.93359375 C92.41424312 76.67774533 95.67698054 79.36747809 99 82 C103.47931906 85.54855146 107.83340036 89.22936876 112.18359375 92.93359375 C115.41424312 95.67774533 118.67698054 98.36747809 122 101 C125.9014198 104.09073517 129.71091352 107.27378506 133.5 110.5 C137.99002543 114.32092614 142.53350963 118.0537239 147.15234375 121.71875 C156.74255328 129.40144186 166.1812645 137.27326897 175.53833008 145.23754883 C179.4317456 148.54281661 183.40347641 151.73522157 187.40625 154.90625 C191.05401433 157.85083084 194.6145398 160.89451533 198.18359375 163.93359375 C201.41424312 166.67774533 204.67698054 169.36747809 208 172 C236.43637507 194.63776677 236.43637507 194.63776677 238.27050781 209.13867188 C239.19944445 221.27193361 237.57124038 231.13444436 230 241 C223.66050278 247.82715086 215.75482398 254.47140646 206.04764748 255.13307858 C205.3615811 255.13693349 204.67551472 255.1407884 203.96865845 255.14476013 C203.17563324 255.15165863 202.38260803 255.15855713 201.56555176 255.16566467 C200.27360901 255.16958473 200.27360901 255.16958473 198.95556641 255.17358398 C198.04112762 255.180271 197.12668884 255.18695801 196.18453979 255.19384766 C194.19843498 255.20789156 192.21231409 255.21978771 190.22618484 255.22979546 C187.07149762 255.24625057 183.91692738 255.26949556 180.76229858 255.29469299 C171.79227585 255.36530712 162.82220292 255.42526708 153.85205078 255.47680664 C148.36195434 255.5088283 142.87198905 255.55017011 137.38199997 255.59700203 C135.30028042 255.61289593 133.21853066 255.62527474 131.13676834 255.63390923 C104.46972494 255.74602279 80.75351522 259.19455182 60.52978516 278.41845703 C55.75259196 283.35727885 51.81217213 289.04473423 47.77441406 294.5859375 C44.62107661 298.87600364 41.36381878 303.08685058 38.125 307.3125 C32.82026548 314.26649347 27.55386673 321.24815866 22.3125 328.25 C21.07690581 329.89589556 19.84122979 331.5417297 18.60546875 333.1875 C16.22002164 336.36552908 13.84996009 339.55428087 11.48828125 342.75 C3.0450311 354.10095576 -5.25712203 365.22607871 -20 368 C-33.42903027 368.85957067 -44.2929604 367.90032788 -55 358.9140625 C-63.51513963 350.76480778 -67.79688328 340.99527428 -68.37686157 329.29350281 C-68.43541887 328.1487851 -68.49397617 327.00406738 -68.55430794 325.82466125 C-68.61453573 324.57243271 -68.67476353 323.32020416 -68.73681641 322.0300293 C-68.80423726 320.68369989 -68.87198477 319.33738681 -68.94003105 317.99108887 C-69.12569162 314.29881586 -69.30666938 310.60632592 -69.48688698 306.91378379 C-69.68142908 302.94481208 -69.88036562 298.97606035 -70.07873535 295.00727844 C-70.55465828 285.46711948 -71.02377004 275.92663022 -71.49235249 266.3861084 C-71.71278092 261.90166682 -71.93398876 257.41726373 -72.1552124 252.93286133 C-72.22122149 251.59460763 -72.22122149 251.59460763 -72.28856409 250.2293185 C-72.37783973 248.41936974 -72.46711776 246.6094211 -72.55639815 244.79947257 C-72.7821203 240.22326204 -73.00777832 235.64704836 -73.23336792 231.0708313 C-73.2783997 230.15734865 -73.32343148 229.24386601 -73.36982787 228.30270207 C-73.64581049 222.70253299 -73.92113412 217.10233189 -74.19602597 211.50210917 C-75.35713101 187.85146938 -76.54638525 164.20245932 -77.76320994 140.55462319 C-78.3174362 129.77404232 -78.86176258 118.9929594 -79.40472984 108.2118063 C-79.83986282 99.58021501 -80.28322749 90.94912395 -80.73695588 82.31848997 C-81.04621068 76.42094211 -81.34513355 70.52292566 -81.63612723 64.62444884 C-81.8031421 61.24551841 -81.97612174 57.86718776 -82.15861511 54.48903847 C-84.29931862 14.73242483 -84.29931862 14.73242483 -72.03125 -1.625 C-50.89854752 -24.96559677 -21.34867451 -18.24899383 0 0 Z "/>',clip:'<path d="M0 0 C1.12815992 0.94880479 2.25705591 1.89673511 3.38671875 2.84375 C5.57657936 4.68528228 7.75793952 6.53624249 9.93359375 8.39453125 C13.5602214 11.48647103 17.25022962 14.49819427 20.9453125 17.5078125 C25.41301487 21.15281776 29.86103386 24.8215994 34.31054688 28.48876953 C38.00933931 31.5370903 41.70951059 34.58367973 45.4140625 37.625 C52.50037463 43.44570076 59.55669812 49.29508834 66.54003906 55.23901367 C70.43289872 58.54377434 74.40406577 61.73568847 78.40625 64.90625 C82.05401433 67.85083084 85.6145398 70.89451533 89.18359375 73.93359375 C92.41424312 76.67774533 95.67698054 79.36747809 99 82 C103.47931906 85.54855146 107.83340036 89.22936876 112.18359375 92.93359375 C115.41424312 95.67774533 118.67698054 98.36747809 122 101 C125.9014198 104.09073517 129.71091352 107.27378506 133.5 110.5 C137.99002543 114.32092614 142.53350963 118.0537239 147.15234375 121.71875 C156.74255328 129.40144186 166.1812645 137.27326897 175.53833008 145.23754883 C179.4317456 148.54281661 183.40347641 151.73522157 187.40625 154.90625 C191.05401433 157.85083084 194.6145398 160.89451533 198.18359375 163.93359375 C201.41424312 166.67774533 204.67698054 169.36747809 208 172 C236.43637507 194.63776677 236.43637507 194.63776677 238.27050781 209.13867188 C239.19944445 221.27193361 237.57124038 231.13444436 230 241 C223.66050278 247.82715086 215.75482398 254.47140646 206.04764748 255.13307858 C205.3615811 255.13693349 204.67551472 255.1407884 203.96865845 255.14476013 C203.17563324 255.15165863 202.38260803 255.15855713 201.56555176 255.16566467 C200.27360901 255.16958473 200.27360901 255.16958473 198.95556641 255.17358398 C198.04112762 255.180271 197.12668884 255.18695801 196.18453979 255.19384766 C194.19843498 255.20789156 192.21231409 255.21978771 190.22618484 255.22979546 C187.07149762 255.24625057 183.91692738 255.26949556 180.76229858 255.29469299 C171.79227585 255.36530712 162.82220292 255.42526708 153.85205078 255.47680664 C148.36195434 255.5088283 142.87198905 255.55017011 137.38199997 255.59700203 C135.30028042 255.61289593 133.21853066 255.62527474 131.13676834 255.63390923 C104.46972494 255.74602279 80.75351522 259.19455182 60.52978516 278.41845703 C55.75259196 283.35727885 51.81217213 289.04473423 47.77441406 294.5859375 C44.62107661 298.87600364 41.36381878 303.08685058 38.125 307.3125 C32.82026548 314.26649347 27.55386673 321.24815866 22.3125 328.25 C21.07690581 329.89589556 19.84122979 331.5417297 18.60546875 333.1875 C16.22002164 336.36552908 13.84996009 339.55428087 11.48828125 342.75 C3.0450311 354.10095576 -5.25712203 365.22607871 -20 368 C-33.42903027 368.85957067 -44.2929604 367.90032788 -55 358.9140625 C-63.51513963 350.76480778 -67.79688328 340.99527428 -68.37686157 329.29350281 C-68.43541887 328.1487851 -68.49397617 327.00406738 -68.55430794 325.82466125 C-68.61453573 324.57243271 -68.67476353 323.32020416 -68.73681641 322.0300293 C-68.80423726 320.68369989 -68.87198477 319.33738681 -68.94003105 317.99108887 C-69.12569162 314.29881586 -69.30666938 310.60632592 -69.48688698 306.91378379 C-69.68142908 302.94481208 -69.88036562 298.97606035 -70.07873535 295.00727844 C-70.55465828 285.46711948 -71.02377004 275.92663022 -71.49235249 266.3861084 C-71.71278092 261.90166682 -71.93398876 257.41726373 -72.1552124 252.93286133 C-72.22122149 251.59460763 -72.22122149 251.59460763 -72.28856409 250.2293185 C-72.37783973 248.41936974 -72.46711776 246.6094211 -72.55639815 244.79947257 C-72.7821203 240.22326204 -73.00777832 235.64704836 -73.23336792 231.0708313 C-73.2783997 230.15734865 -73.32343148 229.24386601 -73.36982787 228.30270207 C-73.64581049 222.70253299 -73.92113412 217.10233189 -74.19602597 211.50210917 C-75.35713101 187.85146938 -76.54638525 164.20245932 -77.76320994 140.55462319 C-78.3174362 129.77404232 -78.86176258 118.9929594 -79.40472984 108.2118063 C-79.83986282 99.58021501 -80.28322749 90.94912395 -80.73695588 82.31848997 C-81.04621068 76.42094211 -81.34513355 70.52292566 -81.63612723 64.62444884 C-81.8031421 61.24551841 -81.97612174 57.86718776 -82.15861511 54.48903847 C-84.29931862 14.73242483 -84.29931862 14.73242483 -72.03125 -1.625 C-50.89854752 -24.96559677 -21.34867451 -18.24899383 0 0 Z "/>',anchor:{x:85.54,y:106.35,scale:.791}},blob:{id:"blob",name:"Blob",fit:"translate(-0.7217 2.9555) scale(1.134706)",body:'<path fill="{{GRADIENT}}" d="M198.91052 113.12915C198.30169 121.88191 196.37668 130.37605 193.1355 138.61157C189.89431 146.84709 185.49332 154.4026 179.93252 161.27809C174.37172 168.15358 167.99976 174.1053 160.81663 179.13325C153.6335 184.1612 145.98678 188.22176 137.87645 191.31491C129.76613 194.40806 121.42581 196.55178 112.85548 197.74609C104.28516 198.94039 95.66469 199.12755 86.99407 198.30758C78.32344 197.4876 69.86713 195.54477 61.62513 192.47909C53.38313 189.41341 45.74309 185.20915 38.70501 179.86633C31.66693 174.52351 25.60941 168.25632 20.53243 161.06476C15.45546 153.87319 11.54067 146.15559 8.78808 137.91195C6.03549 129.66831 4.37316 121.28874 3.80109 112.77325C3.22902 104.25775 3.5616 95.83136 4.79882 87.49409C6.03604 79.15682 8.08364 70.99969 10.94163 63.0227C13.79962 55.04571 17.53174 47.38891 22.13799 40.0523C26.74425 32.71568 32.30193 26.0276 38.81103 19.98806C45.32014 13.94852 52.65266 9.00619 60.80862 5.16109C68.96458 1.31599 77.53546 -1.10241 86.52128 -2.09412C95.50709 -3.08583 104.37427 -2.64309 113.12282 -0.76589C121.87137 1.11131 130.09712 4.12751 137.80007 8.28271C145.50302 12.43791 152.53652 17.35515 158.90058 23.03443C165.26463 28.7137 170.969 34.91856 176.01368 41.649C181.05836 48.37944 185.3953 55.56843 189.02451 63.21597C192.65372 70.86352 195.3609 78.90607 197.14605 87.34364C198.93119 95.78121 199.51935 104.37638 198.91052 113.12915Z"/>',clip:'<path d="M198.91052 113.12915C198.30169 121.88191 196.37668 130.37605 193.1355 138.61157C189.89431 146.84709 185.49332 154.4026 179.93252 161.27809C174.37172 168.15358 167.99976 174.1053 160.81663 179.13325C153.6335 184.1612 145.98678 188.22176 137.87645 191.31491C129.76613 194.40806 121.42581 196.55178 112.85548 197.74609C104.28516 198.94039 95.66469 199.12755 86.99407 198.30758C78.32344 197.4876 69.86713 195.54477 61.62513 192.47909C53.38313 189.41341 45.74309 185.20915 38.70501 179.86633C31.66693 174.52351 25.60941 168.25632 20.53243 161.06476C15.45546 153.87319 11.54067 146.15559 8.78808 137.91195C6.03549 129.66831 4.37316 121.28874 3.80109 112.77325C3.22902 104.25775 3.5616 95.83136 4.79882 87.49409C6.03604 79.15682 8.08364 70.99969 10.94163 63.0227C13.79962 55.04571 17.53174 47.38891 22.13799 40.0523C26.74425 32.71568 32.30193 26.0276 38.81103 19.98806C45.32014 13.94852 52.65266 9.00619 60.80862 5.16109C68.96458 1.31599 77.53546 -1.10241 86.52128 -2.09412C95.50709 -3.08583 104.37427 -2.64309 113.12282 -0.76589C121.87137 1.11131 130.09712 4.12751 137.80007 8.28271C145.50302 12.43791 152.53652 17.35515 158.90058 23.03443C165.26463 28.7137 170.969 34.91856 176.01368 41.649C181.05836 48.37944 185.3953 55.56843 189.02451 63.21597C192.65372 70.86352 195.3609 78.90607 197.14605 87.34364C198.93119 95.78121 199.51935 104.37638 198.91052 113.12915Z"/>',anchor:{x:111.22,y:116.58,scale:.791}},circle:{id:"circle",name:"Circle",fit:"translate(0 0) scale(1.142705)",body:'<path fill="{{GRADIENT}}" d="M200 100C200 155.22847 155.22847 200 100 200C44.77153 200 0 155.22847 0 100C0 44.77153 44.77153 0 100 0C155.22847 0 200 44.77153 200 100Z"/>',clip:'<path d="M200 100C200 155.22847 155.22847 200 100 200C44.77153 200 0 155.22847 0 100C0 44.77153 44.77153 0 100 0C155.22847 0 200 44.77153 200 100Z"/>',anchor:{x:113.82,y:110.27,scale:.791}},squircle:{id:"squircle",name:"Squircle",fit:"translate(0 0) scale(1.142705)",body:'<path fill="{{GRADIENT}}" d="M50 0C83.33333 0 116.66667 0 150 0C177.61424 0 200 22.38576 200 50C200 83.33333 200 116.66667 200 150C200 177.61424 177.61424 200 150 200C116.66667 200 83.33333 200 50 200C22.38576 200 0 177.61424 0 150C0 116.66667 0 83.33333 0 50C0 22.38576 22.38576 0 50 0Z"/>',clip:'<path d="M50 0C83.33333 0 116.66667 0 150 0C177.61424 0 200 22.38576 200 50C200 83.33333 200 116.66667 200 150C200 177.61424 177.61424 200 150 200C116.66667 200 83.33333 200 50 200C22.38576 200 0 177.61424 0 150C0 116.66667 0 83.33333 0 50C0 22.38576 22.38576 0 50 0Z"/>',anchor:{x:111.78,y:111.79,scale:.791}},capsule:{id:"capsule",name:"Capsule",fit:"translate(0 0) scale(1.142705)",body:'<path fill="{{GRADIENT}}" d="M100 0C141.42136 0 175 33.57864 175 75C175 91.66667 175 108.33333 175 125C175 166.42136 141.42136 200 100 200C58.57864 200 25 166.42136 25 125C25 108.33333 25 91.66667 25 75C25 33.57864 58.57864 0 100 0Z"/>',clip:'<path d="M100 0C141.42136 0 175 33.57864 175 75C175 91.66667 175 108.33333 175 125C175 166.42136 141.42136 200 100 200C58.57864 200 25 166.42136 25 125C25 108.33333 25 91.66667 25 75C25 33.57864 58.57864 0 100 0Z"/>',anchor:{x:113.82,y:131.68,scale:.791}},drop:{id:"drop",name:"Drop",fit:"translate(-3.5341 -3.5341) scale(1.178046)",body:'<path fill="{{GRADIENT}}" d="M100 3C160.84 78.2235 178 103.298 178 119C178 162.07821 143.07821 197 100 197C56.92179 197 22 162.07821 22 119C22 103.298 39.16 78.2235 100 3Z"/>',clip:'<path d="M100 3C160.84 78.2235 178 103.298 178 119C178 162.07821 143.07821 197 100 197C56.92179 197 22 162.07821 22 119C22 103.298 39.16 78.2235 100 3Z"/>',anchor:{x:112.47,y:138.8,scale:.791}},shield:{id:"shield",name:"Shield",fit:"translate(-12.1611 -24.3222) scale(1.264316)",body:'<path fill="{{GRADIENT}}" d="M57.25 38.475C85.75 12.825 114.25 12.825 142.75 38.475C153.89667 76.64167 165.04333 114.80833 176.19 152.975C188.73 184.325 179.325 200 147.975 200C115.99167 200 84.00833 200 52.025 200C20.675 200 11.27 184.325 23.81 152.975C34.95667 114.80833 46.10333 76.64167 57.25 38.475Z"/>',clip:'<path d="M57.25 38.475C85.75 12.825 114.25 12.825 142.75 38.475C153.89667 76.64167 165.04333 114.80833 176.19 152.975C188.73 184.325 179.325 200 147.975 200C115.99167 200 84.00833 200 52.025 200C20.675 200 11.27 184.325 23.81 152.975C34.95667 114.80833 46.10333 76.64167 57.25 38.475Z"/>',anchor:{x:112.38,y:170.61,scale:.791}},hexagon:{id:"hexagon",name:"Hexagon",fit:"translate(-4.1077 -4.1077) scale(1.183782)",body:'<path fill="{{GRADIENT}}" d="M94.90777 4.94C98.30259 2.98 101.69741 2.98 105.09223 4.94C129.98757 19.31333 154.88292 33.68667 179.77826 48.06C183.17308 50.02 184.87049 52.96 184.87049 56.88C184.87049 85.62667 184.87049 114.37333 184.87049 143.12C184.87049 147.04 183.17308 149.98 179.77826 151.94C154.88292 166.31333 129.98757 180.68667 105.09223 195.06C101.69741 197.02 98.30259 197.02 94.90777 195.06C70.01243 180.68667 45.11708 166.31333 20.22174 151.94C16.82692 149.98 15.12951 147.04 15.12951 143.12C15.12951 114.37333 15.12951 85.62667 15.12951 56.88C15.12951 52.96 16.82692 50.02 20.22174 48.06C45.11708 33.68667 70.01243 19.31333 94.90777 4.94Z"/>',clip:'<path d="M94.90777 4.94C98.30259 2.98 101.69741 2.98 105.09223 4.94C129.98757 19.31333 154.88292 33.68667 179.77826 48.06C183.17308 50.02 184.87049 52.96 184.87049 56.88C184.87049 85.62667 184.87049 114.37333 184.87049 143.12C184.87049 147.04 183.17308 149.98 179.77826 151.94C154.88292 166.31333 129.98757 180.68667 105.09223 195.06C101.69741 197.02 98.30259 197.02 94.90777 195.06C70.01243 180.68667 45.11708 166.31333 20.22174 151.94C16.82692 149.98 15.12951 147.04 15.12951 143.12C15.12951 114.37333 15.12951 85.62667 15.12951 56.88C15.12951 52.96 16.82692 50.02 20.22174 48.06C45.11708 33.68667 70.01243 19.31333 94.90777 4.94Z"/>',anchor:{x:112.26,y:110.7,scale:.791}},diamond:{id:"diamond",name:"Diamond",fit:"translate(-5.9383 -5.9383) scale(1.202088)",body:'<path fill="{{GRADIENT}}" d="M94.12 7.88C98.04 3.96 101.96 3.96 105.88 7.88C134.62667 36.62667 163.37333 65.37333 192.12 94.12C196.04 98.04 196.04 101.96 192.12 105.88C163.37333 134.62667 134.62667 163.37333 105.88 192.12C101.96 196.04 98.04 196.04 94.12 192.12C65.37333 163.37333 36.62667 134.62667 7.88 105.88C3.96 101.96 3.96 98.04 7.88 94.12C36.62667 65.37333 65.37333 36.62667 94.12 7.88Z"/>',clip:'<path d="M94.12 7.88C98.04 3.96 101.96 3.96 105.88 7.88C134.62667 36.62667 163.37333 65.37333 192.12 94.12C196.04 98.04 196.04 101.96 192.12 105.88C163.37333 134.62667 134.62667 163.37333 105.88 192.12C101.96 196.04 98.04 196.04 94.12 192.12C65.37333 163.37333 36.62667 134.62667 7.88 105.88C3.96 101.96 3.96 98.04 7.88 94.12C36.62667 65.37333 65.37333 36.62667 94.12 7.88Z"/>',anchor:{x:112.53,y:109.95,scale:.791}},star:{id:"star",name:"Star",fit:"translate(-8.3327 3.1407) scale(1.226032)",body:'<path fill="{{GRADIENT}}" d="M100 2C110.56054 20.13133 121.12108 38.26266 131.68163 56.39398C152.18893 60.83477 172.69623 65.27555 193.20354 69.71633C179.22301 85.3629 165.24248 101.00946 151.26195 116.65602C153.37562 137.5319 155.48929 158.40778 157.60295 179.28367C138.40197 170.82244 119.20098 162.36122 100 153.9C80.79902 162.36122 61.59803 170.82244 42.39705 179.28367C44.51071 158.40778 46.62438 137.5319 48.73805 116.65602C34.75752 101.00946 20.77699 85.3629 6.79646 69.71633C27.30377 65.27555 47.81107 60.83477 68.31837 56.39398C78.87892 38.26266 89.43946 20.13133 100 2Z"/>',clip:'<path d="M100 2C110.56054 20.13133 121.12108 38.26266 131.68163 56.39398C152.18893 60.83477 172.69623 65.27555 193.20354 69.71633C179.22301 85.3629 165.24248 101.00946 151.26195 116.65602C153.37562 137.5319 155.48929 158.40778 157.60295 179.28367C138.40197 170.82244 119.20098 162.36122 100 153.9C80.79902 162.36122 61.59803 170.82244 42.39705 179.28367C44.51071 158.40778 46.62438 137.5319 48.73805 116.65602C34.75752 101.00946 20.77699 85.3629 6.79646 69.71633C27.30377 65.27555 47.81107 60.83477 68.31837 56.39398C78.87892 38.26266 89.43946 20.13133 100 2Z"/>',anchor:{x:113.82,y:125.43,scale:.791}},panes:{id:"panes",name:"Panes",fit:"translate(-2.3321 -2.3321) scale(1.166026)",body:'<path fill="{{GRADIENT}}" d="M42 2C56 2 70 2 84 2C92 2 92 32 100 32C108 32 108 2 116 2C130 2 144 2 158 2C180.09139 2 198 19.90861 198 42C198 56 198 70 198 84C198 92 168 92 168 100C168 108 198 108 198 116C198 130 198 144 198 158C198 180.09139 180.09139 198 158 198C144 198 130 198 116 198C108 198 108 168 100 168C92 168 92 198 84 198C70 198 56 198 42 198C19.90861 198 2 180.09139 2 158C2 144 2 130 2 116C2 108 32 108 32 100C32 92 2 92 2 84C2 70 2 56 2 42C2 19.90861 19.90861 2 42 2Z"/>',clip:'<path d="M42 2C56 2 70 2 84 2C92 2 92 32 100 32C108 32 108 2 116 2C130 2 144 2 158 2C180.09139 2 198 19.90861 198 42C198 56 198 70 198 84C198 92 168 92 168 100C168 108 198 108 198 116C198 130 198 144 198 158C198 180.09139 180.09139 198 158 198C144 198 130 198 116 198C108 198 108 168 100 168C92 168 92 198 84 198C70 198 56 198 42 198C19.90861 198 2 180.09139 2 158C2 144 2 130 2 116C2 108 32 108 32 100C32 92 2 92 2 84C2 70 2 56 2 42C2 19.90861 19.90861 2 42 2Z"/>',anchor:{x:113.82,y:102.65,scale:.791}}};function Pre(e){return Mre.safeParse(e).data??Ire}const ap=228.541,pM=[120,122.5],mM={x:13.2,y:8.4},Tre=["130.36,45.98 132.71,46.19 134.98,46.81 137.11,47.83 138.97,49.28 140.47,51.09 141.68,53.12 142.73,55.23 143.76,57.36 144.78,59.49 145.79,61.62 146.79,63.76 147.76,65.91 148.71,68.07 149.63,70.25 150.52,72.43 151.37,74.63 151.99,76.91 152.1,79.26 151.64,81.57 150.59,83.68 149.04,85.45 147.1,86.78 144.9,87.62 142.56,87.93 140.22,87.71 137.98,86.99 135.93,85.82 134.17,84.24 132.78,82.34 131.69,80.25 130.77,78.08 129.87,75.89 128.94,73.72 128,71.56 127.03,69.4 126.05,67.26 125.05,65.12 124.03,62.99 122.93,60.9 121.87,58.79 121.03,56.59 120.72,54.26 121.1,51.93 122.15,49.83 123.75,48.1 125.76,46.89 128.01,46.19|176.61,37.08 178.72,37.59 180.7,38.48 182.52,39.65 184.2,41.03 185.71,42.59 187.03,44.31 188.2,46.14 189.26,48.03 190.27,49.96 191.26,51.89 192.23,53.84 193.16,55.8 194.05,57.78 194.92,59.77 195.74,61.78 196.53,63.8 197.27,65.84 197.97,67.9 198.47,70.01 198.63,72.18 198.4,74.33 197.58,76.33 195.95,77.72 193.83,78.08 191.71,77.65 189.76,76.69 188.03,75.38 186.53,73.82 185.28,72.05 184.25,70.13 183.4,68.14 182.63,66.11 181.87,64.07 181.07,62.05 180.25,60.04 179.39,58.05 178.49,56.07 177.57,54.1 176.61,52.15 175.62,50.22 174.59,48.31 173.53,46.41 172.54,44.48 171.86,42.42 171.76,40.26 172.62,38.3 174.45,37.19","86.14,124.79 89.16,124.92 92.06,125.76 94.68,127.27 96.86,129.36 98.48,131.92 99.51,134.76 100.12,137.73 100.56,140.72 101.01,143.72 101.52,146.71 102.06,149.69 102.62,152.67 103.2,155.64 103.81,158.61 104.44,161.57 105.11,164.52 105.81,167.47 106.49,170.42 106.72,173.44 106.01,176.37 104.37,178.9 102.03,180.81 99.26,181.99 96.27,182.46 93.25,182.25 90.34,181.43 87.65,180.04 85.32,178.11 83.51,175.7 82.37,172.9 81.66,169.96 80.98,167 80.32,164.05 79.69,161.08 79.08,158.12 78.5,155.14 77.94,152.16 77.4,149.18 76.89,146.2 76.4,143.21 75.93,140.21 75.56,137.21 75.7,134.19 76.6,131.3 78.22,128.76 80.47,126.74 83.18,125.4|147.23,112.87 150.24,113.13 153.07,114.19 155.53,115.94 157.46,118.26 158.73,121.01 159.53,123.93 160.21,126.88 160.88,129.84 161.52,132.8 162.15,135.76 162.74,138.73 163.32,141.71 163.87,144.69 164.39,147.67 164.9,150.66 165.39,153.65 165.8,156.65 165.76,159.67 164.98,162.59 163.56,165.26 161.61,167.58 159.23,169.45 156.52,170.77 153.57,171.46 150.55,171.4 147.67,170.52 145.19,168.79 143.45,166.33 142.57,163.44 142.08,160.45 141.61,157.46 141.11,154.47 140.59,151.48 140.04,148.5 139.47,145.53 138.87,142.56 138.25,139.59 137.6,136.63 136.94,133.68 136.25,130.72 135.59,127.77 135.47,124.75 136.07,121.78 137.34,119.04 139.19,116.65 141.53,114.74 144.26,113.44","104.84,104.08 109.39,104.89 113.63,106.73 117.32,109.5 120.25,113.08 122.22,117.25 123.15,121.77 122.92,126.39 121.86,130.89 120.61,135.35 119.37,139.81 118.15,144.27 116.94,148.74 115.74,153.21 114.56,157.69 113.39,162.17 112.24,166.65 111.13,171.15 110.04,175.65 108.89,180.13 106.98,184.33 103.8,187.67 99.75,189.87 95.25,190.93 90.63,190.93 86.11,189.97 81.86,188.16 78.05,185.54 74.89,182.18 72.62,178.16 71.54,173.67 71.94,169.08 73.01,164.57 74.13,160.08 75.26,155.59 76.42,151.11 77.59,146.63 78.77,142.15 79.97,137.68 81.18,133.22 82.41,128.75 83.65,124.29 84.87,119.83 86.33,115.43 88.67,111.46 91.9,108.15 95.83,105.72 100.23,104.35|174.26,115.55 178.59,116.54 182.37,118.86 185.31,122.2 187.23,126.21 188.12,130.57 188.06,135.02 187.52,139.44 186.86,143.85 186.11,148.25 185.25,152.62 184.3,156.98 183.24,161.31 182.07,165.61 180.79,169.88 179.39,174.12 177.89,178.31 176.27,182.47 174.47,186.55 172.17,190.35 169.21,193.68 165.73,196.46 161.84,198.64 157.66,200.16 153.27,200.91 148.83,200.69 144.65,199.19 141.47,196.14 140.18,191.91 140.82,187.53 142.46,183.38 144.16,179.26 145.73,175.09 147.18,170.87 148.51,166.62 149.73,162.33 150.84,158.01 151.84,153.67 152.74,149.3 153.54,144.91 154.24,140.51 154.85,136.1 155.58,131.7 156.93,127.46 159.15,123.6 162.12,120.29 165.73,117.68 169.84,116","44.72,103.35 47.95,103.93 51.04,105.05 53.93,106.62 56.58,108.57 58.97,110.83 61.09,113.35 62.93,116.07 64.5,118.97 65.79,121.99 66.8,125.13 67.52,128.34 67.94,131.6 68.08,134.89 67.9,138.17 67.4,141.42 66.56,144.6 65.33,147.66 63.71,150.52 61.69,153.11 59.3,155.36 56.54,157.16 53.51,158.42 50.29,159.07 47,159.09 43.76,158.5 40.67,157.39 37.78,155.82 35.13,153.87 32.75,151.6 30.63,149.09 28.78,146.36 27.21,143.47 25.92,140.44 24.92,137.31 24.2,134.1 23.77,130.84 23.64,127.55 23.81,124.27 24.31,121.01 25.16,117.84 26.38,114.78 28,111.92 30.02,109.33 32.42,107.08 35.17,105.28 38.21,104.02 41.43,103.37|114.62,83.64 118.31,83.88 121.94,84.6 125.44,85.77 128.77,87.38 131.86,89.4 134.67,91.81 137.13,94.56 139.2,97.62 140.85,100.93 142.05,104.42 142.79,108.05 143.05,111.73 142.83,115.42 142.13,119.05 140.95,122.55 139.34,125.88 137.3,128.96 134.88,131.75 132.11,134.2 129.05,136.27 125.75,137.93 122.25,139.13 118.63,139.86 114.94,140.1 111.25,139.86 107.63,139.14 104.12,137.97 100.8,136.36 97.7,134.34 94.9,131.93 92.44,129.18 90.36,126.12 88.72,122.81 87.51,119.31 86.78,115.69 86.52,112.01 86.74,108.32 87.44,104.69 88.61,101.18 90.23,97.86 92.27,94.78 94.69,91.99 97.45,89.54 100.51,87.47 103.82,85.81 107.31,84.61 110.94,83.88","90.44,99.25 93.11,99.26 95.74,99.79 98.37,100.3 101,100.82 103.64,101.33 106.27,101.85 108.9,102.37 111.53,102.89 114.16,103.41 116.79,103.94 119.42,104.47 122.06,105 124.69,105.53 127.32,106.06 129.94,106.6 132.57,107.14 135.2,107.68 137.65,108.73 139.5,110.65 140.44,113.14 140.36,115.81 139.35,118.28 137.48,120.18 135,121.14 132.32,121.11 129.7,120.56 127.08,120 124.45,119.46 121.82,118.93 119.19,118.4 116.56,117.87 113.93,117.35 111.29,116.83 108.66,116.32 106.02,115.82 103.39,115.31 100.76,114.79 98.12,114.28 95.49,113.75 92.86,113.22 90.23,112.68 87.77,111.66 85.93,109.74 85.01,107.24 85.06,104.57 86.07,102.1 87.96,100.22|156.6,112.56 158.91,112.66 161.18,113.15 163.45,113.64 165.72,114.13 167.99,114.62 170.26,115.12 172.53,115.62 174.8,116.12 177.07,116.62 179.34,117.13 181.6,117.64 183.87,118.15 186.14,118.67 188.4,119.18 190.67,119.7 192.94,120.2 195.12,120.96 196.7,122.63 197.45,124.82 197.53,127.14 197.07,129.41 196.08,131.51 194.49,133.18 192.33,133.97 190.04,133.68 187.79,133.09 185.52,132.57 183.26,132.05 180.99,131.54 178.72,131.03 176.45,130.53 174.18,130.03 171.91,129.54 169.64,129.05 167.37,128.56 165.1,128.07 162.83,127.58 160.56,127.08 158.29,126.57 156.02,126.05 153.9,125.14 152.26,123.51 151.32,121.4 151.08,119.1 151.53,116.82 152.65,114.8 154.41,113.31","79.94,130.44 83.08,130.57 86.11,131.41 88.89,132.89 91.27,134.94 93.15,137.46 94.39,140.35 95.11,143.42 95.65,146.52 96.2,149.62 96.78,152.72 97.39,155.81 98.04,158.89 98.72,161.97 99.43,165.04 100.18,168.1 100.97,171.15 101.81,174.18 102.64,177.22 103.01,180.34 102.35,183.4 100.66,186.04 98.19,187.98 95.28,189.16 92.17,189.6 89.03,189.37 85.99,188.56 83.16,187.2 80.63,185.33 78.55,182.97 77.05,180.21 76.1,177.21 75.28,174.17 74.5,171.11 73.74,168.06 73.02,164.99 72.33,161.92 71.68,158.83 71.06,155.75 70.47,152.65 69.91,149.55 69.37,146.45 68.97,143.32 69.12,140.18 70.04,137.18 71.7,134.51 74.03,132.41 76.86,131.04|168.95,136.28 171.31,136.97 172.99,138.76 173.66,141.13 173.36,143.58 172.24,145.79 170.45,147.49 168.22,148.58 165.89,149.43 163.57,150.31 161.24,151.18 158.9,152.02 156.56,152.85 154.21,153.65 151.85,154.44 149.48,155.2 147.11,155.94 144.73,156.65 142.34,157.34 139.95,158.01 137.55,158.66 135.14,159.27 132.73,159.86 130.31,160.43 127.84,160.54 125.53,159.69 123.77,157.96 122.89,155.66 123.09,153.21 124.36,151.09 126.34,149.61 128.69,148.83 131.1,148.24 133.51,147.62 135.91,146.98 138.31,146.32 140.7,145.65 143.08,144.95 145.46,144.23 147.83,143.49 150.2,142.73 152.56,141.95 154.91,141.15 157.25,140.32 159.59,139.48 161.92,138.61 164.24,137.72 166.54,136.78","119.79,105.35 121.94,105.42 124.03,105.87 126,106.72 127.77,107.93 129.27,109.47 130.45,111.26 131.29,113.23 131.73,115.33 131.79,117.47 131.53,119.6 131.11,121.71 130.66,123.81 130.27,125.92 129.88,128.03 129.49,130.14 129.07,132.25 128.62,134.35 127.96,136.39 126.96,138.29 125.62,139.96 123.99,141.36 122.13,142.43 120.11,143.15 118,143.5 115.85,143.45 113.75,143 111.79,142.15 110.03,140.93 108.54,139.38 107.36,137.59 106.53,135.61 106.1,133.51 106.07,131.37 106.35,129.24 106.77,127.14 107.22,125.04 107.64,122.93 108.05,120.82 108.45,118.71 108.84,116.6 109.25,114.49 109.86,112.44 110.83,110.52 112.16,108.84 113.78,107.44 115.65,106.38 117.67,105.68|174.73,114.1 176.71,114.59 178.5,115.55 180.04,116.88 181.27,118.5 182.17,120.33 182.71,122.29 182.9,124.32 182.82,126.36 182.56,128.38 182.23,130.39 181.89,132.4 181.53,134.41 181.16,136.41 180.75,138.41 180.3,140.4 179.82,142.38 179.18,144.31 178.28,146.15 177.14,147.83 175.74,149.31 174.11,150.53 172.29,151.44 170.32,151.97 168.29,152.07 166.29,151.69 164.45,150.83 162.87,149.54 161.66,147.91 160.83,146.06 160.38,144.07 160.29,142.04 160.53,140.01 160.98,138.02 161.43,136.03 161.84,134.04 162.24,132.04 162.62,130.03 162.93,128.02 163.24,126 163.6,124 164.11,122.03 164.91,120.15 165.99,118.43 167.35,116.91 168.94,115.64 170.74,114.69 172.7,114.15","105.72,72.58 108.82,72.78 111.75,73.82 114.27,75.64 116.39,77.92 118.42,80.29 120.45,82.66 122.47,85.03 124.48,87.41 126.49,89.8 128.48,92.2 130.47,94.6 132.45,97.01 134.43,99.42 136.4,101.83 138.37,104.25 140.3,106.7 141.85,109.39 142.65,112.4 142.63,115.51 141.8,118.5 140.21,121.17 137.95,123.31 135.17,124.7 132.11,125.26 129.02,124.98 126.12,123.86 123.67,121.94 121.61,119.6 119.66,117.17 117.69,114.75 115.73,112.33 113.75,109.92 111.77,107.52 109.77,105.12 107.77,102.73 105.76,100.34 103.75,97.96 101.72,95.59 99.68,93.23 97.63,90.89 95.91,88.3 94.95,85.34 94.92,82.24 95.84,79.27 97.56,76.68 99.9,74.63 102.67,73.22|176.73,63.75 179.52,64.43 182.02,65.85 184.15,67.78 185.85,70.1 187.08,72.7 187.76,75.5 187.76,78.37 187.23,81.2 186.58,84.01 185.89,86.8 185.16,89.59 184.39,92.36 183.59,95.13 182.76,97.89 181.88,100.64 180.98,103.37 180.02,106.09 179.03,108.79 177.99,111.48 176.9,114.15 175.5,116.66 173.51,118.72 171,120.11 168.18,120.66 165.34,120.29 162.75,119.04 160.62,117.12 159.02,114.73 158,112.04 157.63,109.19 157.98,106.34 158.83,103.59 159.86,100.9 160.87,98.2 161.85,95.49 162.79,92.76 163.7,90.03 164.57,87.29 165.41,84.53 166.21,81.76 166.98,78.99 167.7,76.2 168.38,73.4 169,70.58 169.79,67.82 171.41,65.46 173.88,64.03","64.12,83.43 66.69,84.08 68.9,85.53 70.57,87.6 71.56,90.05 71.86,92.69 71.53,95.32 70.55,97.78 69.06,99.99 67.36,102.03 65.64,104.06 63.95,106.11 62.28,108.18 60.63,110.27 59,112.38 57.41,114.5 55.84,116.65 54.29,118.82 52.78,121 51.31,123.22 49.86,125.45 48.42,127.69 46.67,129.68 44.36,130.96 41.73,131.22 39.22,130.38 37.16,128.72 35.64,126.55 34.65,124.08 34.2,121.46 34.29,118.81 34.94,116.24 36.12,113.86 37.54,111.61 39.04,109.41 40.54,107.21 42.06,105.03 43.61,102.87 45.18,100.73 46.79,98.6 48.41,96.5 50.07,94.42 51.74,92.35 53.45,90.31 55.17,88.28 56.94,86.3 59.04,84.67 61.48,83.65|104.23,93.09 106.97,93.77 109.4,95.24 111.32,97.31 112.59,99.85 113.4,102.57 114.13,105.32 114.87,108.06 115.62,110.8 116.37,113.54 117.14,116.28 117.9,119.02 118.67,121.75 119.45,124.49 120.23,127.22 121.03,129.95 121.83,132.68 122.6,135.41 122.98,138.22 122.57,141.02 121.34,143.57 119.44,145.67 117.05,147.19 114.34,148.04 111.51,148.14 108.77,147.45 106.33,146.01 104.38,143.96 103.07,141.44 102.21,138.73 101.43,136 100.65,133.27 99.87,130.53 99.09,127.8 98.32,125.06 97.55,122.33 96.79,119.59 96.04,116.85 95.28,114.11 94.53,111.37 93.79,108.62 93.05,105.88 92.73,103.07 93.18,100.27 94.42,97.72 96.32,95.62 98.7,94.08 101.4,93.21","108.14,135.9 111.13,136.06 114.08,136.56 116.95,137.39 119.71,138.55 122.31,140.03 124.71,141.81 126.86,143.89 128.73,146.23 130.27,148.8 131.44,151.55 132.22,154.44 132.56,157.41 132.47,160.4 131.93,163.34 130.96,166.17 129.6,168.83 127.87,171.28 125.83,173.46 123.51,175.35 120.96,176.91 118.23,178.13 115.36,179 112.42,179.52 109.43,179.7 106.44,179.54 103.49,179.04 100.62,178.21 97.86,177.06 95.26,175.58 92.86,173.79 90.71,171.71 88.84,169.37 87.3,166.81 86.13,164.06 85.35,161.17 85.01,158.2 85.11,155.21 85.64,152.26 86.61,149.43 87.97,146.77 89.7,144.33 91.74,142.14 94.06,140.25 96.61,138.69 99.34,137.47 102.21,136.6 105.15,136.08|175.67,128.81 177.16,128.85 178.62,129.14 180.01,129.67 181.28,130.44 182.41,131.42 183.36,132.57 184.12,133.85 184.68,135.23 185.05,136.68 185.24,138.15 185.27,139.64 185.13,141.13 184.85,142.59 184.42,144.02 183.85,145.4 183.15,146.72 182.33,147.96 181.38,149.11 180.32,150.16 179.15,151.08 177.88,151.87 176.53,152.49 175.1,152.91 173.62,153.11 172.13,153.07 170.67,152.78 169.28,152.24 168.01,151.47 166.88,150.49 165.93,149.35 165.18,148.06 164.61,146.68 164.24,145.24 164.05,143.76 164.02,142.27 164.16,140.78 164.44,139.32 164.87,137.89 165.44,136.51 166.14,135.2 166.96,133.95 167.91,132.8 168.97,131.75 170.14,130.83 171.4,130.04 172.76,129.43 174.19,129.01","103.39,78.25 106.56,78.38 109.59,79.28 112.29,80.94 114.43,83.28 115.86,86.1 116.52,89.2 116.32,92.37 115.62,95.46 114.86,98.55 114.1,101.63 113.36,104.72 112.63,107.81 111.91,110.91 111.2,114.01 110.51,117.1 109.82,120.21 109.16,123.31 108.52,126.42 107.84,129.53 106.8,132.52 105.04,135.16 102.66,137.25 99.81,138.63 96.7,139.2 93.54,138.96 90.53,137.95 87.87,136.24 85.71,133.92 84.21,131.13 83.48,128.05 83.5,124.88 84,121.74 84.7,118.64 85.4,115.54 86.08,112.44 86.77,109.34 87.48,106.24 88.19,103.15 88.92,100.05 89.66,96.96 90.41,93.88 91.18,90.8 91.95,87.71 93.1,84.76 94.95,82.19 97.4,80.19 100.28,78.86|161.99,91.57 165.07,92 167.9,93.28 170.32,95.23 172.22,97.69 173.49,100.53 174.05,103.59 173.93,106.7 173.45,109.78 172.9,112.85 172.33,115.91 171.71,118.97 171.06,122.02 170.38,125.06 169.66,128.09 168.91,131.12 168.13,134.14 167.33,137.15 166.5,140.16 165.58,143.14 164.33,145.98 162.5,148.5 160.15,150.53 157.38,151.95 154.34,152.61 151.24,152.43 148.32,151.38 145.83,149.52 143.99,147.01 142.95,144.08 142.73,140.98 143.25,137.91 144.09,134.91 144.94,131.91 145.76,128.9 146.54,125.89 147.29,122.86 148.01,119.83 148.69,116.79 149.34,113.74 149.95,110.68 150.54,107.62 151.09,104.55 151.6,101.47 152.44,98.48 154,95.79 156.21,93.6 158.94,92.12","47.23,91.05 51.61,92.47 55.26,95.29 57.96,99.03 59.7,103.31 60.56,107.85 61.28,112.42 62.11,116.97 63.06,121.51 64.11,126.01 65.28,130.49 66.56,134.94 67.95,139.35 69.44,143.73 71.05,148.07 72.77,152.37 74.62,156.61 76.52,160.83 78.06,165.19 78.52,169.78 77.62,174.3 75.2,178.22 71.44,180.86 66.96,181.91 62.36,181.55 57.99,180.06 54.03,177.68 50.59,174.58 47.77,170.92 45.62,166.83 43.74,162.6 41.96,158.33 40.29,154.01 38.72,149.66 37.27,145.26 35.93,140.83 34.69,136.37 33.56,131.88 32.55,127.37 31.65,122.83 30.85,118.27 30.2,113.69 30.08,109.07 30.85,104.51 32.49,100.19 35.01,96.32 38.44,93.24 42.64,91.35|108.93,73.38 113.76,73.6 118.38,75.01 122.49,77.56 125.82,81.07 128.1,85.34 129.65,89.93 131.04,94.58 132.43,99.22 133.82,103.87 135.22,108.51 136.6,113.16 137.99,117.81 139.36,122.46 140.73,127.11 142.13,131.76 143.51,136.41 144.82,141.08 145.51,145.86 144.91,150.66 143.09,155.14 140.17,158.99 136.38,162.01 132,164.05 127.26,165.03 122.42,164.86 117.79,163.48 113.67,160.95 110.36,157.43 108.17,153.11 106.72,148.49 105.36,143.83 103.99,139.18 102.62,134.53 101.24,129.88 99.87,125.23 98.48,120.58 97.09,115.93 95.7,111.29 94.29,106.64 92.89,102 91.49,97.36 90.81,92.57 91.38,87.77 93.14,83.26 96.02,79.37 99.79,76.34 104.18,74.32","102.86,129.56 106.39,129.96 109.85,130.76 113.21,131.94 116.4,133.5 119.39,135.42 122.13,137.69 124.56,140.28 126.64,143.16 128.33,146.29 129.59,149.61 130.37,153.08 130.66,156.62 130.43,160.16 129.68,163.63 128.42,166.96 126.7,170.07 124.54,172.89 122.02,175.39 119.18,177.52 116.07,179.25 112.76,180.54 109.31,181.4 105.78,181.82 102.23,181.83 98.7,181.42 95.24,180.62 91.88,179.44 88.69,177.88 85.7,175.96 82.96,173.69 80.53,171.1 78.45,168.22 76.76,165.1 75.5,161.77 74.72,158.31 74.44,154.77 74.67,151.22 75.41,147.75 76.67,144.42 78.39,141.32 80.55,138.49 83.07,135.99 85.91,133.86 89.02,132.14 92.33,130.84 95.78,129.99 99.31,129.56|180.44,141.06 183.61,141.1 186.72,141.68 189.66,142.86 192.28,144.63 194.43,146.96 196,149.71 197,152.72 197.48,155.86 197.51,159.03 197.15,162.18 196.43,165.27 195.38,168.26 194.07,171.15 192.52,173.92 190.74,176.55 188.77,179.03 186.6,181.35 184.25,183.48 181.74,185.41 179.06,187.12 176.23,188.56 173.28,189.71 170.21,190.52 167.07,190.95 163.9,190.91 160.78,190.33 157.84,189.15 155.22,187.37 153.08,185.04 151.51,182.29 150.51,179.28 150.03,176.15 150,172.98 150.36,169.83 151.07,166.74 152.12,163.74 153.43,160.85 154.99,158.09 156.76,155.46 158.74,152.98 160.91,150.66 163.25,148.53 165.77,146.59 168.45,144.89 171.27,143.45 174.23,142.3 177.29,141.48","86.02,131.33 88.42,131.69 90.54,132.87 92.12,134.71 93.03,136.97 93.17,139.39 92.41,141.69 90.78,143.48 88.59,144.52 86.19,144.97 83.78,145.34 81.37,145.72 78.96,146.09 76.54,146.45 74.13,146.81 71.72,147.16 69.3,147.5 66.88,147.84 64.47,148.16 62.05,148.47 59.62,148.76 57.2,149.03 54.77,149.27 52.34,149.49 49.91,149.68 47.53,149.28 45.52,147.92 44.04,145.99 43.12,143.74 42.85,141.32 43.44,138.97 45.04,137.17 47.33,136.4 49.76,136.2 52.19,135.96 54.62,135.7 57.04,135.43 59.46,135.15 61.89,134.85 64.31,134.54 66.72,134.22 69.14,133.89 71.56,133.54 73.97,133.19 76.38,132.83 78.79,132.45 81.2,132.06 83.61,131.67|153.42,116.84 155.92,117.69 157.78,119.56 158.72,122.03 158.73,124.68 157.84,127.18 156.08,129.15 153.71,130.33 151.13,131 148.55,131.65 145.98,132.32 143.4,132.98 140.82,133.63 138.23,134.27 135.65,134.9 133.06,135.53 130.47,136.15 127.88,136.76 125.29,137.36 122.69,137.94 120.09,138.51 117.49,139.06 114.88,139.59 112.27,140.1 109.62,140.12 107.17,139.14 105.28,137.29 104.18,134.88 104.06,132.23 105.03,129.78 106.92,127.93 109.35,126.87 111.96,126.34 114.57,125.8 117.17,125.24 119.77,124.67 122.37,124.09 124.96,123.5 127.56,122.9 130.15,122.29 132.74,121.68 135.32,121.05 137.91,120.41 140.49,119.76 143.07,119.11 145.65,118.44 148.22,117.76 150.78,117.03","83.36,65.84 86.61,66.42 89.57,67.88 92,70.12 93.67,72.97 94.46,76.17 94.31,79.47 93.61,82.71 92.8,85.92 92.02,89.14 91.27,92.36 90.56,95.6 89.88,98.84 89.23,102.09 88.62,105.34 88.03,108.61 87.51,111.88 87.01,115.15 86.5,118.42 85.65,121.62 84.11,124.54 81.9,126.99 79.13,128.79 75.98,129.8 72.68,129.91 69.47,129.13 66.6,127.49 64.24,125.18 62.49,122.38 61.42,119.25 61.08,115.97 61.36,112.67 61.87,109.4 62.45,106.13 63.01,102.87 63.61,99.61 64.24,96.36 64.9,93.11 65.6,89.87 66.33,86.64 67.09,83.42 67.89,80.2 68.73,77 69.89,73.9 71.7,71.14 74.1,68.86 76.93,67.16 80.07,66.12|119.49,99.16 121.99,99.28 124.44,99.82 126.9,100.34 129.36,100.86 131.81,101.38 134.27,101.91 136.72,102.44 139.17,102.98 141.62,103.52 144.08,104.07 146.52,104.62 148.97,105.18 151.42,105.74 153.86,106.31 156.31,106.89 158.75,107.47 161.2,108.02 163.49,109.03 165.16,110.87 165.95,113.24 165.87,115.74 164.94,118.05 163.17,119.8 160.79,120.55 158.31,120.29 155.88,119.65 153.44,119.06 150.99,118.49 148.55,117.92 146.1,117.36 143.65,116.81 141.2,116.26 138.75,115.73 136.29,115.2 133.84,114.67 131.38,114.15 128.93,113.62 126.47,113.1 124.02,112.57 121.56,112.04 119.11,111.5 116.81,110.53 115.08,108.73 114.22,106.39 114.29,103.9 115.28,101.61 117.12,99.93","168.71,85.67 170.73,86 172.64,86.75 174.37,87.85 175.88,89.24 177.11,90.88 178.04,92.71 178.71,94.65 179.21,96.64 179.64,98.65 180.05,100.66 180.45,102.67 180.83,104.69 181.18,106.71 181.5,108.74 181.77,110.78 181.88,112.82 181.71,114.87 181.22,116.86 180.41,118.74 179.27,120.45 177.83,121.91 176.12,123.03 174.2,123.74 172.16,123.99 170.13,123.75 168.21,123.04 166.49,121.93 165.03,120.48 163.88,118.79 163.02,116.93 162.49,114.95 162.17,112.92 161.85,110.89 161.51,108.87 161.14,106.84 160.77,104.83 160.37,102.81 159.96,100.8 159.52,98.79 159.24,96.76 159.3,94.71 159.71,92.7 160.48,90.8 161.58,89.08 163.01,87.61 164.73,86.49 166.67,85.83|206.57,78.24 208.3,78.8 209.77,79.87 210.99,81.22 212.01,82.73 212.85,84.34 213.53,86.03 214.08,87.77 214.54,89.54 214.95,91.31 215.34,93.09 215.7,94.88 216.04,96.67 216.36,98.46 216.64,100.26 216.89,102.07 217.11,103.88 217.25,105.7 217.26,107.52 217.1,109.33 216.75,111.12 216.16,112.84 215.3,114.44 214.04,115.75 212.34,116.35 210.58,115.96 209.11,114.89 207.97,113.48 207.1,111.88 206.44,110.18 205.97,108.42 205.62,106.63 205.35,104.83 205.11,103.02 204.85,101.22 204.55,99.42 204.22,97.63 203.87,95.84 203.49,94.05 203.09,92.28 202.67,90.5 202.32,88.71 202.1,86.91 202.1,85.08 202.32,83.28 202.77,81.51 203.54,79.86 204.82,78.59","39.78,104.3 42.64,105.01 45.03,106.74 46.73,109.15 47.75,111.93 48.35,114.83 48.81,117.76 49.31,120.68 49.87,123.6 50.48,126.5 51.15,129.39 51.86,132.27 52.63,135.13 53.44,137.98 54.3,140.82 55.19,143.65 56.13,146.46 57.1,149.26 58.1,152.05 58.86,154.92 58.96,157.87 58.18,160.72 56.43,163.09 53.84,164.48 50.9,164.62 48.08,163.75 45.58,162.16 43.51,160.05 41.89,157.57 40.67,154.87 39.67,152.08 38.73,149.26 37.81,146.44 36.94,143.61 36.11,140.76 35.34,137.9 34.61,135.03 33.92,132.14 33.28,129.24 32.7,126.34 32.16,123.42 31.67,120.5 31.23,117.57 31.14,114.61 31.65,111.69 32.74,108.94 34.47,106.54 36.89,104.86|108.97,125.73 111.9,126.2 114.63,127.37 117,129.16 118.84,131.49 119.99,134.23 120.32,137.18 119.85,140.11 118.59,142.8 116.78,145.16 114.84,147.42 112.89,149.67 110.93,151.92 108.97,154.16 107.01,156.39 105.03,158.62 103.05,160.85 101.07,163.06 99.07,165.28 97.09,167.5 95.09,169.71 93.05,171.88 90.69,173.67 87.89,174.66 84.93,174.81 82.02,174.22 79.31,173 76.92,171.24 74.99,168.98 73.7,166.3 73.26,163.37 73.74,160.45 75.2,157.86 77.17,155.63 79.18,153.43 81.18,151.23 83.17,149.02 85.16,146.8 87.14,144.58 89.11,142.35 91.08,140.11 93.04,137.87 95,135.63 96.95,133.38 98.89,131.12 100.87,128.89 103.25,127.12 106.02,126.04","115.43,87.59 118.19,88.24 120.69,89.59 122.69,91.59 124.03,94.09 124.63,96.87 124.41,99.7 123.7,102.45 122.9,105.18 122.12,107.92 121.34,110.65 120.57,113.39 119.79,116.13 119.02,118.87 118.25,121.61 117.48,124.35 116.72,127.09 115.97,129.83 115.23,132.58 114.45,135.32 113.3,137.91 111.49,140.09 109.13,141.65 106.41,142.48 103.58,142.56 100.82,141.91 98.33,140.54 96.33,138.53 94.99,136.03 94.38,133.26 94.57,130.43 95.25,127.67 96.02,124.93 96.79,122.19 97.55,119.45 98.31,116.7 99.08,113.96 99.85,111.22 100.62,108.49 101.4,105.75 102.18,103.01 102.95,100.27 103.74,97.54 104.51,94.8 105.68,92.21 107.5,90.04 109.88,88.5 112.59,87.67|155.37,78.64 158.04,79.15 160.48,80.37 162.53,82.16 164.33,84.22 166.1,86.3 167.85,88.4 169.58,90.51 171.29,92.64 172.98,94.78 174.65,96.94 176.3,99.12 177.92,101.32 179.51,103.54 181.06,105.79 182.57,108.07 184.03,110.37 185.2,112.83 185.77,115.5 185.73,118.23 185.07,120.87 183.8,123.28 181.94,125.26 179.57,126.6 176.89,127.03 174.24,126.43 171.99,124.92 170.26,122.8 168.75,120.53 167.22,118.27 165.66,116.03 164.07,113.81 162.45,111.6 160.82,109.41 159.16,107.25 157.47,105.1 155.76,102.97 154.03,100.85 152.28,98.76 150.51,96.68 148.74,94.6 147.29,92.29 146.49,89.69 146.36,86.97 146.94,84.31 148.23,81.91 150.19,80.02 152.66,78.89","92.71,76.24 95.76,76.59 98.73,77.35 101.56,78.53 104.21,80.08 106.63,81.96 108.78,84.16 110.61,86.62 112.09,89.31 113.19,92.17 113.91,95.15 114.24,98.2 114.18,101.27 113.73,104.31 112.9,107.26 111.7,110.09 110.15,112.73 108.28,115.17 106.12,117.35 103.71,119.24 101.08,120.83 98.27,122.07 95.33,122.95 92.3,123.44 89.23,123.51 86.18,123.17 83.21,122.41 80.38,121.23 77.73,119.69 75.31,117.8 73.16,115.61 71.33,113.14 69.86,110.45 68.75,107.59 68.02,104.61 67.7,101.56 67.76,98.49 68.22,95.46 69.05,92.5 70.25,89.68 71.8,87.03 73.67,84.59 75.83,82.41 78.24,80.52 80.87,78.93 83.67,77.69 86.61,76.81 89.64,76.32|157.73,102.08 159.31,102.13 160.86,102.42 162.35,102.95 163.74,103.69 165.01,104.62 166.15,105.72 167.13,106.95 167.96,108.29 168.63,109.72 169.13,111.22 169.45,112.76 169.59,114.34 169.55,115.91 169.31,117.47 168.88,118.99 168.28,120.45 167.52,121.83 166.58,123.1 165.48,124.23 164.25,125.22 162.89,126.02 161.43,126.63 159.91,127.02 158.34,127.2 156.76,127.14 155.21,126.85 153.73,126.33 152.33,125.59 151.06,124.65 149.93,123.56 148.94,122.33 148.11,120.99 147.44,119.56 146.95,118.06 146.62,116.51 146.48,114.94 146.52,113.37 146.76,111.8 147.18,110.28 147.78,108.83 148.56,107.45 149.5,106.18 150.59,105.05 151.83,104.07 153.18,103.26 154.64,102.65 156.17,102.26","57.98,112.03 61.01,112.26 63.82,113.41 66.22,115.27 68.09,117.67 69.36,120.44 70.14,123.39 70.64,126.39 71.07,129.41 71.58,132.42 72.15,135.41 72.76,138.4 73.4,141.38 74.09,144.35 74.82,147.31 75.59,150.26 76.42,153.2 77.3,156.12 78.16,159.04 78.68,162.04 78.42,165.07 77.28,167.88 75.25,170.13 72.54,171.49 69.52,171.87 66.51,171.44 63.69,170.32 61.16,168.61 59.03,166.44 57.38,163.89 56.23,161.06 55.34,158.15 54.53,155.21 53.73,152.27 52.97,149.31 52.25,146.35 51.57,143.38 50.93,140.4 50.34,137.41 49.78,134.41 49.26,131.4 48.78,128.39 48.37,125.37 48.37,122.33 49.06,119.36 50.44,116.65 52.47,114.39 55.04,112.78|117.45,101.46 120.57,101.84 123.48,103.02 125.99,104.91 127.97,107.35 129.25,110.23 130.05,113.27 130.76,116.34 131.46,119.41 132.15,122.49 132.85,125.56 133.55,128.63 134.24,131.71 134.93,134.78 135.61,137.86 136.32,140.93 137.01,144 137.66,147.09 137.87,150.22 137.25,153.3 135.83,156.1 133.73,158.45 131.15,160.23 128.22,161.38 125.11,161.83 121.98,161.5 119.05,160.37 116.52,158.51 114.57,156.05 113.37,153.14 112.64,150.08 111.95,147 111.27,143.93 110.58,140.85 109.89,137.78 109.2,134.7 108.51,131.63 107.81,128.56 107.12,125.48 106.42,122.41 105.71,119.34 105.02,116.27 104.83,113.13 105.42,110.04 106.79,107.22 108.84,104.83 111.41,103.02 114.33,101.87","113.75,120.08 118.16,120.78 122.31,122.43 125.98,124.96 128.94,128.29 131.02,132.23 132.12,136.56 132.1,141.02 131.16,145.38 129.94,149.68 128.69,153.98 127.44,158.27 126.19,162.56 124.92,166.85 123.64,171.14 122.35,175.42 121.05,179.69 119.76,183.97 118.46,188.25 117.05,192.49 114.84,196.36 111.47,199.27 107.42,201.12 103.04,201.99 98.58,201.97 94.18,201.19 89.97,199.7 86.1,197.48 82.8,194.48 80.41,190.72 79.31,186.41 79.87,182 81.24,177.74 82.57,173.47 83.88,169.2 85.19,164.92 86.48,160.64 87.75,156.36 89.02,152.07 90.28,147.78 91.53,143.49 92.77,139.19 93.97,134.88 95.5,130.69 97.93,126.95 101.16,123.87 105.02,121.64 109.3,120.36|181.19,127.71 185.4,128.03 189.23,129.79 192.19,132.8 194.06,136.59 194.87,140.74 194.76,144.98 194.21,149.18 193.55,153.37 192.79,157.55 191.91,161.69 190.91,165.82 189.8,169.91 188.57,173.97 187.22,177.99 185.72,181.96 184.07,185.87 182.26,189.7 180.26,193.44 177.85,196.92 174.93,199.99 171.62,202.64 168,204.85 164.13,206.59 160.07,207.78 155.86,208.24 151.69,207.6 148.31,205.16 147.33,201.11 148.48,197.06 150.4,193.28 152.24,189.46 153.93,185.56 155.48,181.61 156.89,177.62 158.17,173.57 159.32,169.49 160.35,165.38 161.26,161.23 162.06,157.07 162.7,152.87 163.29,148.67 164.12,144.52 165.46,140.5 167.49,136.78 170.16,133.49 173.37,130.73 177.08,128.7","52.43,111.88 55.76,112.3 59,113.21 62.08,114.57 64.96,116.3 67.61,118.36 70.01,120.71 72.16,123.3 74.02,126.1 75.61,129.06 76.9,132.17 77.89,135.38 78.56,138.68 78.89,142.02 78.86,145.39 78.45,148.72 77.63,151.98 76.39,155.11 74.74,158.03 72.67,160.68 70.2,162.96 67.38,164.79 64.28,166.08 61,166.78 57.64,166.91 54.3,166.49 51.07,165.57 47.99,164.22 45.11,162.49 42.46,160.42 40.05,158.07 37.91,155.48 36.04,152.68 34.46,149.72 33.16,146.62 32.17,143.4 31.51,140.11 31.18,136.76 31.21,133.4 31.62,130.06 32.44,126.8 33.67,123.68 35.33,120.75 37.4,118.1 39.86,115.82 42.68,114 45.79,112.71 49.07,112.01|126.89,95.19 130.56,95.44 134.16,96.17 137.64,97.36 140.94,98.99 143.98,101.06 146.73,103.5 149.13,106.29 151.14,109.37 152.72,112.69 153.86,116.19 154.54,119.8 154.74,123.47 154.45,127.14 153.67,130.74 152.43,134.2 150.76,137.48 148.69,140.51 146.25,143.27 143.48,145.69 140.43,147.75 137.14,149.39 133.66,150.59 130.06,151.32 126.39,151.56 122.72,151.31 119.11,150.59 115.63,149.4 112.34,147.76 109.29,145.7 106.54,143.26 104.14,140.47 102.13,137.39 100.55,134.07 99.41,130.57 98.73,126.96 98.53,123.28 98.83,119.62 99.6,116.02 100.84,112.56 102.51,109.28 104.59,106.25 107.03,103.49 109.79,101.07 112.84,99.01 116.13,97.36 119.61,96.16 123.22,95.43","72.34,79.33 74.93,79.64 77.52,79.94 80.12,80.25 82.71,80.57 85.3,80.91 87.88,81.26 90.47,81.63 93.05,82 95.63,82.39 98.21,82.79 100.79,83.21 103.37,83.63 105.94,84.07 108.51,84.52 111.09,84.92 113.65,85.44 115.99,86.56 117.75,88.47 118.68,90.89 118.57,93.48 117.47,95.83 115.57,97.6 113.16,98.56 110.56,98.58 108,98.1 105.43,97.64 102.85,97.19 100.28,96.76 97.7,96.33 95.12,95.93 92.54,95.53 89.96,95.14 87.38,94.77 84.79,94.4 82.2,94.06 79.62,93.72 77.02,93.41 74.43,93.11 71.84,92.81 69.24,92.5 66.78,91.69 64.99,89.83 64.25,87.35 64.5,84.76 65.58,82.39 67.38,80.53 69.74,79.45|136.83,90.25 139.33,90.71 141.8,91.34 144.28,91.93 146.75,92.53 149.22,93.14 151.69,93.77 154.15,94.4 156.62,95.05 159.08,95.71 161.53,96.38 163.98,97.07 166.43,97.76 168.88,98.47 171.32,99.2 173.75,99.94 176.19,100.67 178.49,101.74 180.18,103.62 181.12,105.98 181.31,108.51 180.69,110.96 179.21,113.01 176.98,114.19 174.46,114.13 172.02,113.41 169.58,112.66 167.14,111.93 164.7,111.22 162.25,110.52 159.8,109.84 157.34,109.17 154.88,108.52 152.42,107.88 149.95,107.26 147.48,106.64 145.01,106.03 142.54,105.42 140.06,104.81 137.59,104.21 135.12,103.61 132.78,102.62 130.96,100.86 129.93,98.55 129.77,96.02 130.49,93.59 132.06,91.61 134.31,90.46","107.05,116.19 110.26,116.71 113.26,118 115.85,119.97 117.92,122.49 119.29,125.45 120.04,128.63 120.54,131.86 121.04,135.09 121.54,138.31 122.06,141.54 122.59,144.77 123.12,147.99 123.67,151.21 124.22,154.43 124.8,157.65 125.4,160.86 125.95,164.08 126.04,167.34 125.2,170.49 123.53,173.28 121.14,175.49 118.26,177.02 115.11,177.87 111.85,178.04 108.63,177.56 105.58,176.41 102.87,174.58 100.72,172.14 99.35,169.18 98.61,166 98.04,162.78 97.47,159.57 96.91,156.35 96.36,153.13 95.83,149.9 95.3,146.68 94.78,143.45 94.27,140.22 93.76,137 93.26,133.77 92.82,130.53 92.96,127.27 93.87,124.15 95.55,121.35 97.88,119.07 100.68,117.41 103.79,116.44|189.21,121.96 191.36,122.71 192.8,124.5 193.41,126.73 193.32,129.04 192.59,131.23 191.22,133.09 189.28,134.34 187.12,135.19 184.95,136 182.78,136.83 180.61,137.63 178.43,138.43 176.24,139.2 174.05,139.95 171.85,140.69 169.64,141.4 167.43,142.09 165.21,142.76 162.98,143.42 160.75,144.05 158.51,144.66 156.27,145.25 154.02,145.81 151.72,145.98 149.57,145.18 148.01,143.49 147.25,141.31 147.31,139 148.16,136.86 149.7,135.14 151.74,134.05 153.97,133.43 156.21,132.84 158.45,132.22 160.68,131.59 162.91,130.93 165.13,130.26 167.34,129.58 169.55,128.87 171.76,128.15 173.95,127.41 176.15,126.65 178.33,125.87 180.51,125.08 182.68,124.26 184.84,123.41 186.98,122.53","98.62,121.53 100.72,121.6 102.78,122.03 104.72,122.83 106.49,123.97 108.01,125.42 109.24,127.12 110.15,129.02 110.66,131.05 110.78,133.15 110.62,135.25 110.34,137.33 110.04,139.42 109.76,141.5 109.49,143.59 109.21,145.68 108.92,147.76 108.6,149.84 108.08,151.88 107.18,153.78 105.92,155.45 104.34,156.83 102.51,157.86 100.51,158.52 98.43,158.81 96.33,158.72 94.28,158.27 92.33,157.47 90.57,156.33 89.03,154.89 87.78,153.21 86.85,151.32 86.29,149.3 86.13,147.2 86.28,145.11 86.57,143.02 86.9,140.94 87.2,138.86 87.49,136.78 87.79,134.69 88.08,132.61 88.4,130.53 88.96,128.5 89.88,126.61 91.15,124.94 92.73,123.56 94.56,122.52 96.54,121.84|155.31,127.29 157.36,127.43 159.33,127.99 161.14,128.96 162.7,130.29 163.95,131.92 164.84,133.77 165.35,135.75 165.49,137.8 165.35,139.85 165.07,141.89 164.79,143.92 164.53,145.96 164.26,148 163.97,150.04 163.65,152.06 163.27,154.09 162.7,156.06 161.83,157.92 160.68,159.62 159.29,161.13 157.69,162.41 155.9,163.42 153.97,164.1 151.94,164.41 149.89,164.32 147.9,163.82 146.06,162.92 144.47,161.62 143.24,159.98 142.41,158.1 142,156.09 142.01,154.04 142.32,152.01 142.64,149.98 142.96,147.95 143.25,145.92 143.51,143.88 143.73,141.83 143.97,139.79 144.27,137.76 144.74,135.76 145.53,133.87 146.62,132.13 147.98,130.59 149.57,129.28 151.35,128.27 153.28,127.58"],rO=Tre.map(e=>e.split("|").map(t=>t.split(" ").map(a=>{const[o,i]=a.split(",");return[Number(o),Number(i)]}))),gx=e=>{let t=0,a=0;for(const o of e)t+=o[0],a+=o[1];return[t/e.length,a/e.length]},Nh=rO.map(e=>{const t=gx(e[0]),a=gx(e[1]);return[(t[0]+a[0])/2-pM[0],(t[1]+a[1])/2-pM[1]]}),Py=rO.map((e,t)=>e.map(a=>a.map(o=>[o[0]-Nh[t][0],o[1]-Nh[t][1]]))),ow=Py.length,iw=[[14,3,20,0],[13,1,20,0],[25,14,13,0],[11,4,18,0],[16,-2,22,0],[15,-3,20,6],[12,2,20,0],[17,-7,18,0],[15,5,20,0],[12,3,20,0],[14,1,20,0],[23,12,13,0],[12,2,20,0],[16,-3,22,0],[15,-2,20,-6],[12,5,20,0],[16,-4,18,0],[20,11,18,0],[11,2,20,0],[17,8,20,0],[15,5,10,0],[12,4,18,0],[16,-3,22,0],[15,-5,20,7],[11,6,20,0]],Bre=7.5;function Ere(e,t){const a=gx(e[0]),o=gx(e[1]),i=Math.atan2(o[1]-a[1],o[0]-a[0]);let s=0;for(const c of e){let d=1/0,p=-1/0;for(const h of c)h[1]<d&&(d=h[1]),h[1]>p&&(p=h[1]);s=Math.max(s,(p-d)/2)}const r=s+t[2];return{x:(a[0]+o[0])/2-Math.sin(i)*r,y:(a[1]+o[1])/2+Math.cos(i)*r,angle:i+t[3]*Math.PI/180}}const{id:CDe,...Rre}=IS.cursor,Dre=Rre,Ore=["#9FE6B5","#3FAE6E","#1C7A4C"],zre=`-15 -15 ${ap+30} ${ap+30}`,jb=114.2705,Nb=105,Lre={sleeping:{pulse:[.028,4600],tilt:2},waking:{enter:[.92,700],pulse:[.03,2200]},idle:{pulse:[.014,3600]},listening:{bob:[2,2600],pulse:[.012,2600]},thinking:{sway:[1.6,3e3],pulse:[.01,3e3]},searching:{bob:[3,1400],sway:[2.2,1400]},working:{bob:[2.5,900],squash:.22},excited:{bob:[9,520],sway:[3,1040],squash:.35},surprised:{enter:[1.14,340],jitter:[.8,120]},suspicious:{sway:[2.4,2600],tilt:-3},angry:{jitter:[1.3,95],tilt:2},drowsy:{pulse:[.026,5e3],tilt:3},happy:{bob:[5,820],squash:.28},curious:{sway:[3.4,1900],tilt:-4},confused:{sway:[3,2200]},bored:{pulse:[.016,5200],tilt:2},proud:{bob:[1.6,2400],pulse:[.02,2400]},shy:{pulse:[.016,3e3],tilt:4},sad:{pulse:[.02,4600],tilt:3},laughing:{bob:[7,430],squash:.4},scared:{jitter:[2.2,75]},playful:{bob:[6,620],sway:[5,1240],squash:.3},celebrate:{bob:[10,480],sway:[4,960],squash:.35},orbit:{circle:[6,3200]},radar:{sway:[6,2400],pulse:[.012,2400]},progress:{pulse:[.022,1600]},spawning:{enter:[.02,820],pulse:[.014,3600]},humming:{pulse:[.016,2800]},loading:{sway:[2.2,1500],pulse:[.012,1500]},dictating:{bob:[2,2e3]},writing:{bob:[1.6,1100]},sending:{bob:[3,900]},receiving:{bob:[3,900]},uploading:{bob:[3,1e3]},notifying:{bob:[4,700],sway:[2.5,700]},alerting:{jitter:[2.6,85]},dragging:{tilt:-6,sway:[2,900]},bouncing:{bob:[12,560],squash:.45},"powering-down":{settle:.05,tilt:4}},_re=1400,x3=Math.PI*2,Ah=e=>{const t=Math.sin(e*127.1+311.7)*43758.5453;return t-Math.floor(t)},hM=["#F472B6","#C084FC","#818CF8","#38BDF8","#34D399","#FACC15","#FB7185"],gM=["#4ADE80","#34D399","#22D3EE","#60A5FA"],fM='<path fill="{{GRADIENT}}" d="M99 58 Q99 43 114.3 43 Q129.6 43 129.6 58 L123 150 Q122 161 114.3 161 Q106.6 161 105.6 150 Z"/><circle fill="{{GRADIENT}}" cx="114.3" cy="188" r="15"/>',Fre='<path fill="none" stroke="{{GRADIENT}}" stroke-width="19" stroke-linecap="round" d="M88 76 A27 27 0 1 1 114.3 112 L114.3 132"/><circle fill="{{GRADIENT}}" cx="114.3" cy="170" r="13"/>',qre={celebrate:{confetti:{count:16,period:1500,life:1300,origin:74,spread:54}},excited:{confetti:{count:9,period:2e3,life:1100,origin:72,spread:44}},laughing:{confetti:{count:7,period:2400,life:1e3,origin:70,spread:38}},orbit:{trails:{count:3,period:2600,radius:128}},radar:{trails:{count:2,period:2e3,radius:132}},progress:{trails:{count:3,period:1800,radius:124}},loading:{trails:{count:2,period:2200,radius:126}},uploading:{trails:{count:2,period:1700,radius:122}},sending:{trails:{count:2,period:1500,radius:120}},receiving:{trails:{count:2,period:1500,radius:120}},alerting:{glyph:{markup:fM,period:2600,hold:1100}},notifying:{glyph:{markup:fM,period:4200,hold:900}},confused:{glyph:{markup:Fre,period:5200,hold:1200}}},Ure="http://www.w3.org/2000/svg";function lO(e,t){for(;e.childNodes.length>t;)e.removeChild(e.lastChild);for(;e.childNodes.length<t;){const a=document.createElementNS(Ure,"path");a.setAttribute("stroke-linecap","round"),a.setAttribute("fill","none"),e.appendChild(a)}return Array.from(e.querySelectorAll(":scope > path"))}function Vre(e,t,a,o,i,s){const r=lO(e,t.count);for(let c=0;c<t.count;c++){const d=r[c],p=Ah(c+1),h=Ah(c+41),g=Ah(c+91),b=(a+g*t.period)%t.period/t.life*1;if(b>1){d.setAttribute("opacity","0");continue}const x=p*x3,v=t.spread*(.45+h*.55)*(1-(1-b)*(1-b)),k=(t.origin+v)*o,w=34*o*b*b,N=i+Math.cos(x)*k,C=s+Math.sin(x)*k+w,j=11+h*12,M=x+(g-.5)*5*b,E=N+Math.cos(M)*j,A=C+Math.sin(M)*j,R=(p-.5)*j*.7,B=(N+E)/2-Math.sin(M)*R,O=(C+A)/2+Math.cos(M)*R;d.setAttribute("d",`M${N.toFixed(1)} ${C.toFixed(1)} Q${B.toFixed(1)} ${O.toFixed(1)} ${E.toFixed(1)} ${A.toFixed(1)}`),d.setAttribute("stroke",hM[c%hM.length]),d.setAttribute("stroke-width",(4+h*2.4).toFixed(1)),d.setAttribute("opacity",(b<.12?b/.12:1-(b-.12)/.88).toFixed(3))}}function Hre(e,t,a,o,i,s){const r=lO(e,t.count),c=12;for(let d=0;d<t.count;d++){const p=r[d],h=Ah(d+3),g=Ah(d+29),b=d%2===0?1:-1,x=t.period*(.8+h*.5),v=t.radius*o*(.78+g*.4),k=b*(a/x)*x3+h*x3,w=.85+g*.7;let N="";for(let C=0;C<=c;C++){const j=C/c,M=k+w*j,E=v*(1+Math.sin(j*Math.PI)*.14),A=i+Math.cos(M)*E,R=s+Math.sin(M)*E*.78;N+=(C===0?"M":"L")+A.toFixed(1)+" "+R.toFixed(1)}p.setAttribute("d",N),p.setAttribute("stroke",gM[d%gM.length]),p.setAttribute("stroke-width",(5+h*3).toFixed(1)),p.setAttribute("opacity","0.85")}}function $re(e,t){const a=t%e.period,o=e.period-e.hold;if(a<o)return 0;const i=a-o,s=e.hold-i;return Math.max(0,Math.min(1,Math.min(i,s)/200))}function Gre(e){const t=qre[e.state],a=ap/2,o=e.strength;if(e.trails&&(t?.trails&&e.showEffects&&o>0?Hre(e.trails,t.trails,e.elapsed,o,a,a):e.trails.childNodes.length&&e.trails.replaceChildren()),e.confetti&&(t?.confetti&&e.showEffects&&o>0?Vre(e.confetti,t.confetti,e.elapsed,o,a,a):e.confetti.childNodes.length&&e.confetti.replaceChildren()),e.glyph&&e.bodyContent)if(t?.glyph&&e.showGlyphs){const i=$re(t.glyph,e.elapsed),s=t.glyph.markup.replace(/\{\{GRADIENT\}\}/g,e.paint);e.glyph.getAttribute("data-glyph")!==s&&(e.glyph.setAttribute("data-glyph",s),e.glyph.innerHTML=s),e.glyph.style.opacity=String(i);const r=.72+.28*i;e.glyph.setAttribute("transform",`translate(${a} ${a}) scale(${r.toFixed(3)}) translate(${-a} ${-a})`),e.bodyContent.style.opacity=String(1-i)}else e.glyph.getAttribute("data-glyph")&&(e.glyph.removeAttribute("data-glyph"),e.glyph.replaceChildren()),e.glyph.style.opacity="0",e.bodyContent.style.opacity="1"}const fx={sleeping:[22,13,4],waking:[13],idle:[6,0,8],listening:[1,10,19],thinking:[17,8,16,14,5],searching:[20,15,9,3,12,18],working:[10,7,16,11],excited:[2,17,21,3,11],surprised:[21,3],suspicious:[5,14,23],angry:[7,16],drowsy:[22,4,13],happy:[19,2,11,17],curious:[21,3,0,15],confused:[8,14,5],bored:[0,4,22],proud:[2,15,8],shy:[24,0,13],sad:[22,4,13],laughing:[2,11,17],scared:[21,3],playful:[2,17,11,8],celebrate:[2,8,17],orbit:[6,0,8],radar:[6,0,8],progress:[6,0,8],spawning:[3,0],humming:[6,0,8],loading:[6,0,8],dictating:[1,10,19],sending:[6,0,8],receiving:[19,0,8],uploading:[15,9,8],writing:[15,9],notifying:[21,3,0],alerting:[21,3],bouncing:[2,17],dragging:[3,15,0],"powering-down":[22,13]},Kre={sleeping:[6e3,1e4],waking:[800,800],idle:[9e3,16e3],listening:[2800,5e3],thinking:[2e3,3600],searching:[1e3,1800],working:[1800,3200],excited:[1100,2e3],surprised:[2500,4e3],suspicious:[2600,4500],angry:[2200,3800],drowsy:[4e3,8e3],happy:[2500,4500],curious:[1800,3200],confused:[2200,3800],bored:[3500,6e3],proud:[3500,6e3],shy:[3e3,5500],sad:[4e3,7e3],laughing:[1200,2400],scared:[900,1800],playful:[1500,3e3],celebrate:[1400,2600],orbit:[4e3,8e3],radar:[4e3,8e3],progress:[4e3,8e3],spawning:[1200,1200],humming:[5e3,9e3],loading:[6e3,1e4],dictating:[4e3,8e3],sending:[4e3,8e3],receiving:[4e3,8e3],uploading:[4e3,8e3],writing:[4e3,8e3],notifying:[1500,2600],alerting:[2e3,3600],bouncing:[3e3,6e3],dragging:[1600,3e3],"powering-down":[6e3,9e3]},Wre={sleeping:null,waking:null,idle:[6e3,14e3],listening:[3e3,7e3],thinking:[3500,7e3],searching:[1600,4e3],working:[2800,5500],excited:[2e3,4e3],surprised:[1800,3500],suspicious:[4500,8e3],angry:[3500,7e3],drowsy:null,happy:[2500,5e3],curious:[2500,5500],confused:[2800,5500],bored:[4e3,8e3],proud:[3500,7e3],shy:[3e3,6e3],sad:[4e3,8e3],laughing:[2500,5e3],scared:[1200,3e3],playful:[2e3,4500],celebrate:[2200,4500],orbit:null,radar:null,progress:null,spawning:null,humming:[4e3,8e3],loading:null,dictating:null,sending:null,receiving:null,uploading:null,writing:null,notifying:[2e3,4e3],alerting:null,bouncing:null,dragging:[2200,4500],"powering-down":null},Jre=e=>e in fx,Yre=Object.keys(fx).filter(Jre),ws=(e,t,a)=>Math.max(t,Math.min(a,e)),bM=()=>null,Zre=e=>"M"+e.map(t=>t[0].toFixed(2)+" "+t[1].toFixed(2)).join("L")+"Z",Qre=e=>e.map(t=>t.map(a=>[a[0],a[1]])),Xre=e=>{let t=0,a=0;for(const o of e)t+=o[0],a+=o[1];return[t/e.length,a/e.length]};function ele(e,t){const a=Math.cos(e.angle),o=Math.sin(e.angle),i=(d,p)=>[e.x+d*a-p*o,e.y+d*o+p*a],s=i(-t[0],0),r=i(0,t[1]),c=i(t[0],0);return"M"+s[0].toFixed(2)+" "+s[1].toFixed(2)+" Q"+r[0].toFixed(2)+" "+r[1].toFixed(2)+" "+c[0].toFixed(2)+" "+c[1].toFixed(2)}const tle=e=>`translate(${e.x} ${e.y}) scale(${e.scale}) translate(-120 ${-122.5})`,nle=e=>{const a=e-1;return 1+(1.7+1)*a*a*a+1.7*a*a},ale=e=>e<.5?2*e*e:1-2*(1-e)*(1-e);function ole(e,t,a){if(a<=0)return"";const o=ap/2,i=ap,s=(x,v=0)=>Math.sin(t/x*Math.PI*2+v);let r=0,c=0,d=e.tilt?e.tilt*a:0,p=1,h=1,g=1;if(e.bob){const[x,v]=e.bob,k=s(v);if(c-=x*a*k,e.squash){const w=e.squash*a*Math.max(0,-k);g=1-w*.5,h=1+w*.5}}if(e.circle){const[x,v]=e.circle;r+=x*a*s(v),c+=x*a*s(v,Math.PI/2)}if(e.sway){const[x,v]=e.sway;d+=x*a*s(v)}if(e.pulse){const[x,v]=e.pulse;p*=1+x*a*s(v)}if(e.jitter){const[x,v]=e.jitter;r+=x*a*s(v),c+=x*a*s(v*.63,1.1)}if(e.enter){const[x,v]=e.enter,k=t/v;p*=k>=1?1:x+(1-x)*nle(Math.max(k,0))}if(e.settle!==void 0){const x=Math.min(Math.max(t/_re,0),1);p*=1+(e.settle-1)*ale(x)*a}const b=[];return(r||c)&&b.push(`translate(${r.toFixed(2)} ${c.toFixed(2)})`),d&&b.push(`rotate(${d.toFixed(2)} ${o} ${o})`),p!==1&&b.push(`translate(${o} ${o}) scale(${p.toFixed(4)}) translate(${-o} ${-o})`),(h!==1||g!==1)&&b.push(`translate(${o} ${i}) scale(${h.toFixed(4)} ${g.toFixed(4)}) translate(${-o} ${-i})`),b.join(" ")}const ile=ka.forwardRef(function({state:t="idle",expression:a,size:o=160,gaze:i,turn:s=0,lookAround:r=.5,flip:c=!1,spring:d=7,eyeScale:p=1,showMouth:h=!0,mouthStroke:g=Bre,motion:b,effects:x=!0,glyphs:v=!0,autoBlink:k=!0,autoExpression:w=!0,paused:N=!1,silhouette:C=Dre,gradient:j=Ore,eyeColor:M="#ffffff",title:E,className:A,style:R},B){const O=f.useId(),T=f.useMemo(()=>"mascot"+O.replace(/[^a-zA-Z0-9]/g,""),[O]),z=f.useRef(null),P=f.useRef(null),L=f.useRef(null),G=f.useRef(null),H=f.useRef(null),$=f.useRef(null),U=f.useRef(null),Q=f.useRef(null),W=f.useMemo(()=>globalThis.window?.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1,[]),q=b??(W?0:1),Y=t,ae=f.useRef({current:Qre(Py[0]),target:Py[0],currentMouth:iw[0].slice(),targetMouth:iw[0],currentGaze:[...Nh[0]],targetGaze:[...Nh[0]],expression:0,morph:1,velocity:0,blinkStart:bM(),spinStart:bM(),spinDuration:900,last:0,stateStart:0,lastState:Y,lastBodyTransform:"",pausedPaint:"",props:{state:t,expression:a,gaze:i,turn:s,spring:d,eyeScale:p,paused:N,lookAround:r,motionStrength:q,effects:x,glyphs:v}});ae.current.props={state:t,expression:a,gaze:i,turn:s,spring:d,eyeScale:p,paused:N,lookAround:r,motionStrength:q,effects:x,glyphs:v};const F=oe=>{const ne=ae.current,Ce=(oe%ow+ow)%ow;Ce===ne.expression&&ne.morph>=1||(ne.current=yM(ne),ne.currentMouth=xM(ne),ne.currentGaze=vM(ne),ne.target=Py[Ce],ne.targetMouth=iw[Ce],ne.targetGaze=Nh[Ce],ne.expression=Ce,ne.morph=0,ne.velocity=0)};ka.useImperativeHandle(B,()=>({blink:()=>{ae.current.blinkStart=performance.now()},spin:(oe=900)=>{ae.current.spinDuration=oe,ae.current.spinStart=performance.now()},setExpression:F}),[]),f.useEffect(()=>{F(a??fx[t][0])},[t,a]),f.useEffect(()=>{if(!w||a!==void 0||N)return;let oe;const ne=()=>{const[Ce,le]=Kre[t];oe=setTimeout(()=>{const re=fx[t],xe=re.filter(Te=>Te!==ae.current.expression);F(xe.length?xe[Math.floor(Math.random()*xe.length)]:re[0]),ne()},Ce+Math.random()*(le-Ce))};return ne(),()=>clearTimeout(oe)},[t,w,a,N]),f.useEffect(()=>{const oe=Wre[t];if(!k||!oe||N)return;let ne;const Ce=()=>{ne=setTimeout(()=>{ae.current.blinkStart=performance.now(),Ce()},oe[0]+Math.random()*(oe[1]-oe[0]))};return Ce(),()=>clearTimeout(ne)},[t,k,N]),f.useEffect(()=>{let oe=0,ne;ae.current.last=performance.now();const Ce=(re,xe,Te)=>{const nt=re.props,be=vM(re),Ye=nt.lookAround??.35,ue=be[0]*Ye,we=be[1]*Ye,me=yM(re).map(st=>st.map(Ae=>[Ae[0]+ue,Ae[1]+we])),$e=ws(nt.gaze?.x??0,-1,1)*mM.x,Re=ws(nt.gaze?.y??0,-1,1)*mM.y,de=((nt.turn??0)+Te)*Math.PI/180,Ve=nt.eyeScale??1,ce=sle(re,xe);me.forEach((st,Ae)=>{const We=Ae===0?z.current:P.current;if(!We)return;const Ie=Xre(st),et=Math.asin(ws((Ie[0]-jb)/Nb,-1,1)),gt=et+de,yt=Math.cos(gt),Mt=Math.max(yt,.02)/Math.max(Math.cos(et),.02);We.setAttribute("d",Zre(st)),We.setAttribute("transform",`translate(${(jb+Nb*Math.sin(gt)+$e).toFixed(2)} ${(Ie[1]+Re).toFixed(2)}) scale(${ws(Mt*Ve,.02,2.4).toFixed(4)} ${ws(ce*Ve,.02,2.4).toFixed(4)}) translate(${(-Ie[0]).toFixed(2)} ${(-Ie[1]).toFixed(2)})`),We.style.opacity=yt>.02?"1":"0"});const Le=L.current;if(Le){const st=xM(re),Ae=Ere(me,st),We=Math.asin(ws((Ae.x-jb)/Nb,-1,1)),Ie=We+de,et=Math.cos(Ie),gt=Math.max(et,.02)/Math.max(Math.cos(We),.02);Le.setAttribute("d",ele(Ae,st)),Le.setAttribute("transform",`translate(${(jb+Nb*Math.sin(Ie)+$e).toFixed(2)} ${(Ae.y+Re).toFixed(2)}) scale(${ws(gt,.02,2.4).toFixed(4)} 1) translate(${(-Ae.x).toFixed(2)} ${(-Ae.y).toFixed(2)})`),Le.style.opacity=et>.02?"1":"0"}const tt=G.current;if(tt){nt.state!==re.lastState&&(re.lastState=nt.state,re.stateStart=xe);const st=ole(Lre[nt.state]??{},xe-re.stateStart,nt.motionStrength??1);st!==re.lastBodyTransform&&(re.lastBodyTransform=st,st?tt.setAttribute("transform",st):tt.removeAttribute("transform"))}Gre({trails:$.current,confetti:U.current,glyph:Q.current,bodyContent:H.current,state:nt.state,elapsed:xe-re.stateStart,strength:nt.motionStrength??1,paint:ge.current,showEffects:nt.effects!==!1,showGlyphs:nt.glyphs!==!1})},le=re=>{const xe=ae.current,Te=xe.props;if(Te.paused){xe.last=re;const ue=`${Te.state}|${Te.expression??""}|${ge.current}`;xe.pausedPaint!==ue&&(xe.pausedPaint=ue,Ce(xe,re,0)),ne=setTimeout(()=>{oe=requestAnimationFrame(le)},250);return}xe.pausedPaint="",oe=requestAnimationFrame(le);const nt=Math.min((re-xe.last)/1e3,.1);xe.last=re;const be=Te.spring??7;xe.velocity+=(-2*be*xe.velocity-be*be*(xe.morph-1))*nt,xe.morph+=xe.velocity*nt,Number.isFinite(xe.morph)||(xe.morph=1,xe.velocity=0);let Ye=0;if(xe.spinStart!==null){const ue=(re-xe.spinStart)/xe.spinDuration;ue>=1?xe.spinStart=null:Ye=360*ue}Ce(xe,re,Ye)};return oe=requestAnimationFrame(le),()=>{cancelAnimationFrame(oe),ne!==void 0&&clearTimeout(ne)}},[]);const pe=`url(#${T}-grad)`,ge=f.useRef(pe);ge.current=pe;const Ne=o.constructor===Number?`${o}px`:o,ee=E===void 0?`${C.name} mascot`:E,X=C.body.replace(/\{\{GRADIENT\}\}/g,`url(#${T}-grad)`);return n.jsxs("svg",{viewBox:zre,width:Ne,height:Ne,className:A,style:R,role:ee?"img":void 0,"aria-label":ee??void 0,"aria-hidden":ee?void 0:!0,children:[n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:`${T}-grad`,x1:"1",y1:"0",x2:"0",y2:"1",children:[n.jsx("stop",{offset:"0%",stopColor:j[0]}),n.jsx("stop",{offset:"55%",stopColor:j[1]}),n.jsx("stop",{offset:"100%",stopColor:j[2]})]}),n.jsx("clipPath",{id:`${T}-clip`,transform:C.fit||void 0,dangerouslySetInnerHTML:{__html:C.clip}})]}),n.jsxs("g",{transform:c?`translate(${ap} 0) scale(-1 1)`:void 0,children:[n.jsx("g",{ref:$}),n.jsxs("g",{ref:G,children:[n.jsxs("g",{ref:H,children:[n.jsx("g",{transform:C.fit||void 0,dangerouslySetInnerHTML:{__html:X}}),n.jsx("g",{clipPath:`url(#${T}-clip)`,children:n.jsxs("g",{transform:tle(C.anchor),children:[n.jsx("path",{ref:z,fill:M}),n.jsx("path",{ref:P,fill:M}),h&&n.jsx("path",{ref:L,fill:"none",stroke:M,strokeWidth:g,strokeLinecap:"round"})]})})]}),n.jsx("g",{ref:Q,style:{opacity:0}})]}),n.jsx("g",{ref:U})]})]})});function yM(e){const t=ws(e.morph,0,1);return e.current.map((a,o)=>a.map((i,s)=>[i[0]+(e.target[o][s][0]-i[0])*t,i[1]+(e.target[o][s][1]-i[1])*t]))}function xM(e){const t=ws(e.morph,0,1);return e.currentMouth.map((a,o)=>a+(e.targetMouth[o]-a)*t)}function vM(e){const t=ws(e.morph,0,1);return e.currentGaze.map((a,o)=>a+(e.targetGaze[o]-a)*t)}function sle(e,t){if(e.blinkStart===null)return 1;const a=(t-e.blinkStart)/320;return a>=1?(e.blinkStart=null,1):Math.max(a<.42?1-a/.42:(a-.42)/.58,.04)}function rle(e){return e.kind==="digest"||e.kind==="compaction"||e.kind==="session-divider"}function PS(e){if(e){for(let t=e.length-1;t>=0;t-=1)if(!rle(e[t]))return e[t]}}const lle=Yre,cO=["green","blue","red","orange","purple","cyan","pink","yellow","teal","coral"],hd={green:"#009957",blue:"#377FE6",red:"#D94B52",orange:"#E78531",purple:"#8057C8",cyan:"#0EA5C6",pink:"#D84F8B",yellow:"#D8A729",teal:"#01A492",coral:"#E5634E"},cle={deadpan:"idle",friendly:"happy",focused:"working",thinking:"thinking",excited:"excited",sleepy:"drowsy",surprised:"surprised",skeptical:"suspicious",worried:"scared",mischievous:"playful"},dle=new Set(lle);function Xl(e){return e?dle.has(e)?e:cle[e]??null:null}const ule=["idle","happy","curious","drowsy","working","thinking","listening","sleeping","suspicious","proud"];function D0(e){const t=Xl(e.mascotExpression);if(t)return t;const a=PS(e.messages);if(a?.kind==="activity"&&a.tool?.ok===!1)return"alerting";if(e.busy)return"working";if(e.unread)return"notifying";if(a?.kind==="options")return"curious";const o=`${e.name} ${e.title??""} ${e.description??""}`.toLowerCase(),i=s=>s.test(o);return i(/\b(code|coding|developer|development|engineer|engineering|build|debug|program|software)\b/)?"working":i(/\b(research|researcher|search|investigate|strategy|strategist|study|learn|knowledge)\b/)?"searching":i(/\b(marketing|growth|launch|campaign|social|sales|outreach|brand)\b/)?"excited":i(/\b(overnight|night|background|async|queue|batch|long-running)\b/)?"drowsy":i(/\b(monitor|monitoring|incident|alert|watch|status|uptime)\b/)?"radar":i(/\b(review|reviewer|audit|critic|critique|quality|qa|test|legal)\b/)?"suspicious":i(/\b(security|secure|compliance|risk|privacy|finance|financial)\b/)?"scared":i(/\b(design|designer|creative|brainstorm|art|illustration|music|story)\b/)?"playful":i(/\b(support|help|success|onboarding|coach|teacher|guide|welcome)\b/)?"happy":"idle"}const dO=["mascot","circle","rounded","square"],ple=Yo(dO),uO=dn().regex(/^\/api\/attachments\/[A-Za-z0-9-]+\.(?:png|jpg|gif|webp)$/,"must be a stored PNG, JPEG, GIF, or WebP attachment"),pO=Y4,mle=[pO];function TS(e){const t=e.replaceAll("\\","/").split("/").pop();if(!t)return null;const a=`/api/attachments/${t}`;return uO.safeParse(a).success?a:null}function hle(e){const t={avatarCrop:ple.safeParse(e.avatarCrop).data??"mascot"},a=uO.safeParse(e.avatarUrl);return a.success?t.avatarUrl=a.data:typeof e.avatarUrl=="string"&&mle.includes(e.avatarUrl)&&(t.avatarUrl=e.avatarUrl),t}const Mh=[{rotation:-18,color:"rgb(252 184 34)",period:4.6,phase:0},{rotation:46,color:"rgb(5 205 196)",period:5.4,phase:.33},{rotation:108,color:"rgb(247 75 32)",period:5,phase:.66}],Ab=50,sw=19,gle=2.75,Mb=60,mO="(prefers-reduced-motion: reduce)";function kM(){try{return globalThis.window?.matchMedia?.(mO).matches??!1}catch{return!1}}function fle(e){const t=globalThis.window?.matchMedia?.(mO);return t?(t.addEventListener?.("change",e),()=>t.removeEventListener?.("change",e)):()=>{}}function hO(){return f.useSyncExternalStore(fle,kM,kM)}function ble(e){return Mh.map(({period:t,phase:a})=>-((e/1e3/t+a)%1)*t)}function O0({size:e=100,className:t}){const a=hO(),[o]=f.useState(()=>ble(Date.now())),i=2.5*Math.min(1,e/100),s=6*Math.min(1,100/e);return n.jsxs("svg",{className:V("chibi-mark shrink-0 overflow-visible",t),width:e,height:e,viewBox:"-50 -50 100 100","aria-hidden":"true",focusable:"false","data-chibi-mark":a?"static":"animated",children:[!a&&Mh.map((r,c)=>n.jsxs("g",{className:"chibi-mark-orbit",transform:`rotate(${r.rotation})`,children:[n.jsx("ellipse",{rx:Ab,ry:sw,fill:"none",stroke:r.color,strokeOpacity:.3,strokeWidth:i,vectorEffect:"non-scaling-stroke"}),n.jsx("g",{transform:`scale(1 ${sw/Ab})`,children:n.jsx("g",{className:"chibi-mark-spin",style:{animationDuration:`${r.period}s`,animationDelay:`${o[c]}s`},children:n.jsx("g",{transform:`translate(${Ab} 0)`,children:n.jsx("g",{className:"chibi-mark-counter",style:{animationDuration:`${r.period}s`,animationDelay:`${o[c]}s`},children:n.jsx("g",{transform:`scale(1 ${Ab/sw})`,children:n.jsx("circle",{r:gle,fill:r.color,style:{filter:`drop-shadow(0 0 ${s}px color-mix(in srgb, ${r.color} 85%, transparent))`}})})})})})})]},r.rotation)),n.jsx("image",{href:Y4,x:-Mb/2,y:-Mb/2,width:Mb,height:Mb,preserveAspectRatio:"xMidYMid meet"})]})}const yle=new Set(["thinking","working","searching","loading","orbit","radar","progress","humming","receiving","uploading"]),xle=new Set(["writing","sending","dictating"]);function vle(e){return e?yle.has(e)?"thinking":xle.has(e)?"speaking":"idle":"idle"}function kle(){return globalThis.document?.documentElement?.dataset?.reducedMotion==="true"}const wle=24,Sle={idle:7,thinking:1.8,speaking:1.2};function Cle({provider:e,size:t,label:a,state:o,animated:i=!0}){const s=hO()||kle(),r=vle(o),c=t>=wle,d=c&&i&&!s,p=iD(e),h=c?Math.round(t*.74):t,g=Math.round(h*(p.kind==="official"?.6:.62)),b=r==="thinking"?Mh:Mh.slice(0,1),x=Sle[r];return n.jsxs("span",{role:"img","aria-label":a,"data-subscription-avatar":e,"data-provider-logo-kind":p.kind,"data-activity":r,"data-motion":d?"animated":"static",className:"provider-avatar relative flex shrink-0 items-center justify-center",style:{width:t,height:t},children:[c&&n.jsxs("svg",{className:"provider-ring pointer-events-none absolute inset-0 overflow-visible",width:t,height:t,viewBox:"-50 -50 100 100","aria-hidden":"true",focusable:"false",children:[n.jsx("circle",{className:d&&r==="speaking"?"provider-ring-track provider-ring-breathe":"provider-ring-track",r:46,fill:"none",stroke:"var(--color-accent)",strokeOpacity:r==="idle"?.22:.5,strokeWidth:r==="idle"?1.25:2,vectorEffect:"non-scaling-stroke",style:d&&r==="speaking"?{animationDuration:`${x}s`}:void 0}),b.map((v,k)=>n.jsx("g",{transform:`rotate(${Mh[0].rotation+k*120})`,children:n.jsx("g",{className:d?"provider-ring-spin":void 0,style:d?{animationDuration:`${x}s`}:void 0,children:n.jsx("circle",{cx:46,cy:0,r:r==="thinking"?4.2:3.6,fill:v.color,style:{filter:`drop-shadow(0 0 3px color-mix(in srgb, ${v.color} 80%, transparent))`}})})},v.rotation))]}),n.jsx("span",{className:"relative flex items-center justify-center rounded-full border border-hairline/60 bg-raised",style:{width:h,height:h},children:n.jsx(sD,{provider:e,size:g})})]})}const wM={forward:1,authored:.25},jle={arrive:{state:"spawning",spin:900},switch:{state:"waking",spin:620},customize:{state:"proud",blink:!0},alert:{state:"alerting"},thinking:{state:"thinking"},working:{state:"working"},launch:{state:"loading"},success:{state:"happy",blink:!0},celebrate:{state:"celebrate",spin:700},blink:{blink:!0},surprise:{state:"surprised",blink:!0},failure:{state:"sad"}},Nle=1400;function SM(e,t,a){const o=Number.parseInt(e.slice(1),16),i=Number.parseInt(t.slice(1),16),s=r=>{const c=o>>r&255,d=i>>r&255;return Math.round(c+(d-c)*a)};return`#${[s(16),s(8),s(0)].map(r=>r.toString(16).padStart(2,"0")).join("")}`}const Ale=e=>{const t=hd[e]??hd.green;return[SM(t,"#ffffff",.55),t,SM(t,"#000000",.42)]};function Mle({color:e,state:t="idle",expression:a,size:o=44,label:i,motion:s="none",motionKey:r=0,turn:c,gaze:d,spring:p,eyeScale:h,showMouth:g,mouthStroke:b,forward:x=!0,lookAround:v,trackPointer:k=!0,animated:w=!0,bodyId:N},C){const j=IS[Pre(N)],M=f.useRef(null);f.useImperativeHandle(C,()=>({blink:()=>M.current?.blink(),spin:P=>M.current?.spin(P),setExpression:P=>M.current?.setExpression(P)}));const[E,A]=f.useState(null);f.useEffect(()=>{if(s==="none"||!w)return;const P=jle[s];if(!P||(P.blink&&M.current?.blink(),P.spin&&M.current?.spin(P.spin),!P.state))return;A(P.state);const L=setTimeout(()=>A(null),Nle);return()=>clearTimeout(L)},[s,r,w]);const[R,B]=f.useState({x:0,y:0}),O=x?wM.forward:wM.authored,T=P=>{if(!k||!w)return;const L=P.currentTarget.getBoundingClientRect();B({x:Math.max(-1,Math.min(1,(P.clientX-L.left)/L.width*2-1))*O,y:Math.max(-1,Math.min(1,(P.clientY-L.top)/L.height*2-1))*O})},z=()=>B({x:0,y:0});return n.jsx("span",{className:"inline-flex shrink-0",onPointerMove:k&&w?T:void 0,onPointerLeave:k&&w?z:void 0,children:n.jsx(ile,{ref:M,state:E??t,expression:a,size:o,silhouette:j,gradient:Ale(e),title:i??null,lookAround:v??(x?0:1),gaze:{x:(d?.x??0)+R.x,y:(d?.y??0)+R.y},turn:c,spring:p,eyeScale:h,showMouth:g,mouthStroke:b,paused:!w})})}const ra=f.memo(f.forwardRef(Mle));function Ile(e){const{avatarCrop:t,hasUrl:a,imageFailed:o}=e;return!a||t==="mascot"||o?"gradientMascot":"flatImage"}function Zt({bot:e,size:t=44,label:a,...o}){const i=hle(e),[s,r]=f.useState(!1);if(f.useEffect(()=>r(!1),[i.avatarUrl]),i.avatarUrl===pO)return n.jsx("span",{role:"img","aria-label":a??e.name??"Chibi",className:"inline-flex shrink-0",children:n.jsx(O0,{size:t})});const c=Ile({avatarCrop:i.avatarCrop,hasUrl:!!i.avatarUrl,imageFailed:s});if(c!=="flatImage"&&e.subscription&&!e.mascotBody&&!i.avatarUrl)return n.jsx(Cle,{provider:e.subscription.provider,size:t,label:a??e.name??"",state:o.state,animated:o.animated??!0});if(c!=="flatImage")return n.jsx(ra,{bodyId:e.mascotBody??void 0,...o,color:e.color,size:t,label:a??e.name});const d=i.avatarCrop==="circle"?"50%":i.avatarCrop==="rounded"?"22%":"0";return n.jsx("img",{src:i.avatarUrl,alt:a??(e.name?`${e.name} avatar`:"Bot avatar"),width:t,height:t,draggable:!1,onError:()=>r(!0),className:"block shrink-0 bg-raised object-cover",style:{width:t,height:t,borderRadius:d}})}function gO({initials:e,size:t=32}){return n.jsx("div",{className:"flex shrink-0 items-center justify-center rounded-full bg-raised text-ink-secondary font-medium",style:{width:t,height:t,fontSize:t*.38},children:e})}function z0({className:e}){return n.jsxs("span",{"data-personal-badge":!0,title:l("personalBot.badgeHint"),className:V("inline-flex shrink-0 items-center gap-1 rounded-full bg-accent/15 px-1.5 py-px text-[10.5px] font-medium leading-4 text-accent",e),children:[n.jsx(H4,{size:10,"aria-hidden":!0}),l("personalBot.badge")]})}const Ib="rounded-2xl border border-hairline/40 bg-card/80 backdrop-blur-xl backdrop-saturate-150";function Ple(){const{dispatch:e}=ke(),{view:t}=gD(),a=typeof window<"u"&&window.ogb?.remoteClient?.active===!0;return gne(t,a)?n.jsxs("button",{type:"button","data-create-personal-bot":!0,title:l("personalBot.createHint"),"aria-describedby":"create-private-bot-hint",onClick:()=>e({type:"openBotInterview",launch:{mode:"personal"}}),className:"flex min-h-10 w-full items-center gap-3 rounded-xl px-3 py-2 text-left text-ink hover:bg-raised/50",children:[n.jsx(So,{size:20,className:"text-accent","aria-hidden":!0}),n.jsx("span",{className:"text-[14px]",children:l("personalBot.create")}),n.jsx("span",{id:"create-private-bot-hint",className:"sr-only",children:l("personalBot.createHint")})]}):null}function Tle(e){const t=e.availableAccounts??e.personalAccounts;return t<=0?l("personalBot.accounts.none"):l("personalBot.accounts.count",{count:String(t),subscriptions:String(e.subscriptionAccounts??0),personal:String(e.personalAccounts)})}function Ble(){const{view:e,reload:t}=gD(),{state:a,dispatch:o}=ke(),[i,s]=f.useState(!1),[r,c]=f.useState("");if(!e)return n.jsx(lt,{title:l("personalBot.title"),subtitle:l("personalBot.subtitle"),children:n.jsx("p",{className:"text-[12px] text-ink-secondary",children:l("personalBot.loading")})});const d=e.botId?a.bots.find(x=>x.id===e.botId):void 0,p=async()=>{s(!0),c("");try{await Z("/api/personal-bot/settings",{method:"PUT",body:JSON.stringify({useLocalModels:!e.useLocalModels})}),await t()}catch(x){c(x instanceof Error?x.message:String(x))}finally{s(!1)}},h=async()=>{s(!0),c("");try{await Z("/api/personal-bot/settings",{method:"PUT",body:JSON.stringify({chibiLink:!e.chibiLink})}),await t()}catch(x){c(x instanceof Error?x.message:String(x))}finally{s(!1)}},g=e.chibiLink&&e.chibiLinkAllowed,b=async()=>{s(!0),c("");try{await Z("/api/personal-bot/settings",{method:"PUT",body:JSON.stringify({readWorkMemory:!e.readWorkMemory})}),await t()}catch(x){c(x instanceof Error?x.message:String(x))}finally{s(!1)}};return n.jsxs("div",{className:"flex flex-col gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-[22px] font-semibold tracking-tight text-ink",children:l("personalBot.title")}),n.jsx("p",{className:"mt-2 max-w-lg text-[13px] leading-relaxed text-ink-secondary",children:l("personalBot.subtitle")})]}),e.allowed?d?n.jsxs("div",{className:V(Ib,"flex items-center gap-3 p-4"),children:[n.jsx(Zt,{bot:d,size:44}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"truncate text-[15px] font-medium text-ink",children:d.name}),n.jsx(z0,{})]}),n.jsx("p",{className:"mt-0.5 text-[12.5px] text-ink-secondary",children:l("personalBot.editHint")})]}),n.jsxs("div",{className:"flex shrink-0 flex-col gap-1.5 sm:flex-row",children:[n.jsx("button",{type:"button",onClick:()=>{o({type:"toggleAppSettings",open:!1}),o(la(d))},className:"rounded-lg bg-accent px-3 py-1.5 text-[13px] font-medium text-white",children:l("personalBot.open")}),n.jsx("button",{type:"button",onClick:()=>{o({type:"toggleAppSettings",open:!1}),o({type:"select",id:d.id}),o({type:"toggleSettings",open:!0,section:"identity"})},className:"rounded-lg bg-control px-3 py-1.5 text-[13px] text-ink hover:bg-raised-hover",children:l("personalBot.edit")})]})]}):n.jsxs("div",{className:V(Ib,"flex flex-col items-start gap-2 p-4"),children:[n.jsx("div",{className:"text-[15px] font-medium text-ink",children:l("personalBot.create")}),n.jsx("p",{className:"text-[12.5px] leading-relaxed text-ink-secondary",children:(e.availableAccounts??e.personalAccounts)===0?l("personalBot.form.noAccounts"):l("personalBot.interviewHint")}),n.jsxs("button",{type:"button","data-create-personal-bot-interview":!0,onClick:()=>o({type:"openBotInterview",launch:{mode:"personal"}}),className:"mt-1 flex items-center gap-1.5 rounded-lg bg-accent px-4 py-2 text-[13px] font-medium text-white",children:[n.jsx(So,{size:14,"aria-hidden":!0}),l("personalBot.startInterview")]})]}):n.jsxs("div",{className:V(Ib,"p-4"),children:[n.jsxs("div",{className:"flex items-center gap-2 text-[14px] font-medium text-ink",children:[n.jsx(Sd,{size:14,"aria-hidden":!0}),l("personalBot.disabled")]}),n.jsx("p",{className:"mt-1 text-[12.5px] leading-relaxed text-ink-secondary",children:l("personalBot.disabledHint")}),n.jsx("div",{className:"mt-2",children:n.jsx(Er,{})})]}),e.allowed&&n.jsxs(lt,{children:[n.jsx(Jt,{title:l("personalBot.local.title"),subtitle:l("personalBot.local.subtitle"),children:n.jsx(Tt,{checked:e.useLocalModels,disabled:i,"aria-label":l("personalBot.local.title"),onClick:()=>{p()}})}),n.jsx(Jt,{title:l("personalBot.workMemory.title"),subtitle:l("personalBot.workMemory.subtitle"),children:n.jsx(Tt,{checked:e.readWorkMemory,disabled:i,"aria-label":l("personalBot.workMemory.title"),onClick:()=>{b()}})}),n.jsx(Jt,{title:l("personalBot.chibiLink.title"),subtitle:l(e.chibiLinkAllowed?"personalBot.chibiLink.subtitle":"personalBot.chibiLink.managed"),children:e.chibiLinkAllowed?n.jsx(Tt,{checked:e.chibiLink,disabled:i,"aria-label":l("personalBot.chibiLink.title"),onClick:()=>{h()}}):n.jsxs("span",{className:"flex items-center gap-2","data-chibi-link-managed":!0,children:[n.jsx(Tt,{checked:!1,disabled:!0,"aria-label":l("personalBot.chibiLink.title")}),n.jsx(Er,{})]})}),n.jsx(Jt,{title:l("personalBot.accounts.title"),subtitle:Tle(e),children:n.jsx("button",{type:"button",onClick:()=>o({type:"toggleAppSettings",open:!0,section:"engines"}),className:"rounded-lg bg-control px-3 py-1.5 text-[13px] text-ink hover:bg-raised-hover",children:l("personalBot.accounts.open")})}),r&&n.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:r})]}),n.jsxs("div",{className:V(Ib,"p-4"),children:[n.jsx("div",{className:"text-[13px] font-medium text-ink",children:l("personalBot.rules.title")}),n.jsxs("ul",{className:"mt-2 flex list-disc flex-col gap-1 pl-5 text-[12.5px] leading-relaxed text-ink-secondary",children:[n.jsx("li",{children:l("personalBot.rules.private")}),n.jsx("li",{children:l("personalBot.rules.workMemory")}),n.jsx("li",{children:l("personalBot.rules.accounts")}),n.jsx("li",{children:l("personalBot.rules.company")}),n.jsx("li",{children:l("personalBot.rules.connections")}),n.jsx("li",{children:l(g?"personalBot.rules.chibiLink":"personalBot.rules.delegation")}),n.jsx("li",{children:l("personalBot.rules.resting")})]})]})]})}function fO({instanceId:e,owner:t,locked:a,onChanged:o}){const[i,s]=f.useState(!1),[r,c]=f.useState("");if(!t)return null;if(a)return n.jsxs("span",{"data-engine-owner":"company",className:"inline-flex items-center gap-1 rounded-full bg-control px-2 py-0.5 text-[11.5px] font-medium text-ink-secondary",title:l("owner.lockedHint"),children:[n.jsx(Sd,{size:11,"aria-hidden":!0}),l("owner.company")]});const d=async p=>{if(!(i||p===t)){s(!0),c("");try{await fD(e,p),await Promise.resolve(o?.()).catch(()=>{})}catch(h){c(h instanceof Error?h.message:String(h))}finally{s(!1)}}};return n.jsxs("span",{className:"inline-flex flex-col items-start gap-1",children:[n.jsx("span",{role:"radiogroup","aria-label":l("owner.label"),title:l("owner.hint"),"data-engine-owner":t,className:"inline-flex rounded-full border border-hairline/40 bg-inset/70 p-0.5 backdrop-blur-xl",children:["company","personal"].map(p=>n.jsx("button",{type:"button",role:"radio","aria-checked":t===p,disabled:i,onClick:()=>{d(p)},className:V("rounded-full px-2.5 py-0.5 text-[11.5px] font-medium transition-colors disabled:opacity-60",t===p?p==="personal"?"bg-accent text-white":"bg-raised text-ink":"text-ink-secondary hover:text-ink"),children:l(p==="company"?"owner.company":"owner.personal")},p))}),r&&n.jsx("span",{role:"alert",className:"text-[11.5px] text-danger",children:l("owner.failed",{error:r})})]})}function bO({instance:e}){const{refreshInstances:t}=ke();return n.jsx(fO,{instanceId:e.instanceId,owner:e.owner,locked:e.ownerLocked,onChanged:t})}function BS(e,t){return window.ogb?.setInstanceKey?window.ogb.setInstanceKey(e,t):Z(`/api/provider-accounts/${encodeURIComponent(e)}/key`,{method:"PUT",body:JSON.stringify({key:t})})}const CM="w-full rounded-lg border border-hairline/40 bg-inset px-3 py-2 text-[13px] text-ink placeholder:text-ink-secondary focus:border-hairline focus:outline-none disabled:opacity-50",ES=e=>e.trim().replace(/\/+$/,""),yO=(e,t)=>(!e?.url||new RegExp(e.url.pattern).test(ES(t.url)))&&(!e?.model?.required||t.model.trim()!==""),xO=(e,t)=>({...e?.url?{url:ES(t.url)}:{},...e?.model&&t.model.trim()?{model:t.model.trim()}:{}});function vO({ask:e,value:t,onChange:a,disabled:o}){if(!e)return null;const i=e.url&&t.url.trim()!==""&&!new RegExp(e.url.pattern).test(ES(t.url));return n.jsxs(n.Fragment,{children:[e.url&&n.jsxs("label",{className:"flex flex-col gap-1 text-[12px] text-ink-secondary",children:[l("accountSetup.address"),n.jsx("input",{value:t.url,onChange:s=>a({...t,url:s.target.value}),disabled:o,required:!0,placeholder:e.url.example,spellCheck:!1,"aria-invalid":i||void 0,className:CM}),n.jsx("span",{className:i?"text-danger":void 0,children:l(i?"accountSetup.badAddress":"accountSetup.addressHint",{example:e.url.example})})]}),e.model&&n.jsxs("label",{className:"flex flex-col gap-1 text-[12px] text-ink-secondary",children:[l("accountSetup.model"),n.jsx("input",{value:t.model,onChange:s=>a({...t,model:s.target.value}),disabled:o,required:e.model.required,placeholder:e.model.example,spellCheck:!1,className:CM}),n.jsx("span",{children:l(e.model.required?"accountSetup.modelHintRequired":"accountSetup.modelHint",{example:e.model.example})})]})]})}function RS({value:e,onChange:t,disabled:a}){return n.jsxs("fieldset",{className:"flex flex-col gap-1.5",disabled:a,children:[n.jsx("legend",{className:"mb-1 text-[12px] text-ink-secondary",children:l("owner.label")}),n.jsx("div",{role:"radiogroup","aria-label":l("owner.label"),className:"flex w-fit rounded-lg bg-inset p-0.5","data-owner-choice":!0,children:["company","personal"].map(o=>n.jsx("button",{type:"button",role:"radio","aria-checked":e===o,onClick:()=>t(o),"data-owner":o,className:V("rounded-md px-3 py-1 text-[12.5px]",e===o?"bg-raised font-medium text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:l(o==="company"?"owner.company":"owner.personal")},o))}),n.jsx("p",{className:"text-[11.5px] leading-relaxed text-ink-secondary",children:l(e==="personal"?"owner.addToggleHint":"owner.companyHint")})]})}const Ele="w-full rounded-lg border border-hairline/40 bg-inset px-3 py-2 text-[13px] text-ink placeholder:text-ink-secondary focus:border-hairline focus:outline-none disabled:opacity-50",Rle="rounded-lg border border-hairline/40 px-3 py-1.5 text-[12px] text-ink-secondary hover:bg-raised/50 hover:text-ink disabled:cursor-not-allowed disabled:opacity-50";function Dle({provider:e,onDone:t,onCancel:a}){const[o,i]=f.useState(""),[s,r]=f.useState("company"),[c,d]=f.useState(null),[p,h]=f.useState(!1),[g,b]=f.useState(!1),[x,v]=f.useState(null),k=f.useRef({name:o,owner:s,onDone:t});k.current={name:o,owner:s,onDone:t},f.useEffect(()=>{if(!c)return;let C=!1,j,M=Math.max(c.interval,1)*1e3;const E=async()=>{if(!C)try{const A=!!window.ogb?.setInstanceKey,R=await Z(`/api/provider-accounts/device/${encodeURIComponent(c.flowId)}`,{method:"POST",body:JSON.stringify({displayName:k.current.name.trim(),owner:k.current.owner,...A?{sealed:!0}:{}})});if(C)return;if(R.state==="pending"){R.interval&&(M=R.interval*1e3),j=setTimeout(()=>{E()},M);return}if(R.state==="failed"){d(null),v(R.error??l("copilotSignIn.failed"));return}R.instanceId&&R.key&&await BS(R.instanceId,R.key),await k.current.onDone()}catch(A){if(C)return;d(null),v(A instanceof Error?A.message:String(A))}};return j=setTimeout(()=>{E()},M),()=>{C=!0,j&&clearTimeout(j)}},[c]);const w=async()=>{if(!(p||!o.trim())){h(!0),v(null);try{const C=await Z("/api/provider-accounts/device",{method:"POST",body:JSON.stringify({provider:e.id})});d(C),window.open(C.verificationUri,"_blank","noopener,noreferrer")}catch(C){v(C instanceof Error?C.message:String(C))}finally{h(!1)}}},N=async()=>{if(c)try{await navigator.clipboard.writeText(c.userCode),b(!0)}catch{}};return n.jsxs("form",{className:"mt-3 flex flex-col gap-2 rounded-xl border border-hairline/40 p-3","data-device-sign-in":e.id,onSubmit:C=>{C.preventDefault(),w()},children:[c?n.jsxs("div",{className:"flex flex-col items-start gap-2",role:"status","aria-live":"polite",children:[n.jsx("p",{className:"text-[12px] text-ink-secondary",children:l("copilotSignIn.typeCode")}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("code",{className:"rounded-lg bg-inset px-3 py-1.5 font-mono text-[18px] font-semibold tracking-[0.2em] text-ink","data-device-code":!0,children:c.userCode}),n.jsx("button",{type:"button",onClick:()=>{N()},className:Rle,children:l(g?"copilotSignIn.copied":"copilotSignIn.copy")}),n.jsx("a",{href:c.verificationUri,target:"_blank",rel:"noopener noreferrer",className:"text-[12px] text-accent hover:underline",children:l("copilotSignIn.open")})]}),n.jsxs("p",{className:"flex items-center gap-1.5 text-[12px] text-ink-secondary",children:[n.jsx(je,{size:12,className:"animate-spin","aria-hidden":"true"}),l("copilotSignIn.waiting")]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"flex flex-col gap-1 text-[12px] text-ink-secondary",children:[l("providerAccounts.name"),n.jsx("input",{value:o,onChange:C=>i(C.target.value),maxLength:80,required:!0,disabled:p,placeholder:l("providerAccounts.namePlaceholder"),className:Ele})]}),n.jsx(RS,{value:s,onChange:r,disabled:p}),n.jsx("p",{className:"text-[12px] leading-relaxed text-ink-secondary",children:l("copilotSignIn.how")})]}),x&&n.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:x}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx("button",{type:"button",onClick:()=>{d(null),a()},className:"rounded-lg px-3 py-1.5 text-[12px] text-ink-secondary hover:bg-raised/50",children:l("common.cancel")}),!c&&n.jsxs("button",{type:"submit",disabled:p||!o.trim(),"data-device-start":!0,className:"flex items-center gap-1.5 rounded-lg bg-accent px-3 py-1.5 text-[12px] font-medium text-white hover:opacity-90 disabled:opacity-50",children:[p&&n.jsx(je,{size:13,className:"animate-spin"}),l("copilotSignIn.start")]})]})]})}const Ole="w-full rounded-lg border border-hairline/40 bg-inset px-3 py-2 text-[13px] text-ink placeholder:text-ink-secondary focus:border-hairline focus:outline-none disabled:opacity-50";function zle({provider:e,onDone:t,onCancel:a}){const[o,i]=f.useState(e.label),[s,r]=f.useState("company"),c=e.billing===void 0||e.billing==="free",[d,p]=f.useState(!c),[h,g]=f.useState({url:"",model:e.setup?.model?.example??""}),b=!!o.trim()&&d&&yO(e.setup,h),[x,v]=f.useState(!1),[k,w]=f.useState(null),N=async()=>{if(!(x||!b)){v(!0),w(null);try{await Z("/api/provider-accounts",{method:"POST",body:JSON.stringify({provider:e.id,displayName:o.trim(),owner:s,...xO(e.setup,h)})}),await t()}catch(C){w(C instanceof Error?C.message:String(C))}finally{v(!1)}}};return n.jsxs("form",{className:"mt-3 flex flex-col gap-3 rounded-xl border border-hairline/40 p-3",onSubmit:C=>{C.preventDefault(),N()},children:[n.jsxs("div",{role:"note",className:"flex gap-2 rounded-lg bg-inset p-2.5 text-[12px] leading-relaxed text-ink",children:[n.jsx(rd,{size:16,className:"mt-0.5 shrink-0 text-warning","aria-hidden":!0}),n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx("p",{className:"font-medium",children:l(c?"keyless.warningTitle":"keyless.gcloudTitle")}),n.jsx("p",{className:"text-ink-secondary",children:l(c?"keyless.warningBody":"keyless.gcloudBody")})]})]}),n.jsxs("label",{className:"flex flex-col gap-1 text-[12px] text-ink-secondary",children:[l("providerAccounts.name"),n.jsx("input",{value:o,onChange:C=>i(C.target.value),maxLength:80,required:!0,disabled:x,className:Ole})]}),n.jsx(vO,{ask:e.setup,value:h,onChange:g,disabled:x}),n.jsx(RS,{value:s,onChange:r,disabled:x}),c&&n.jsxs("label",{className:"flex items-start gap-2 text-[12px] text-ink",children:[n.jsx("input",{type:"checkbox",checked:d,onChange:C=>p(C.target.checked),disabled:x,className:"mt-0.5"}),l("keyless.accept")]}),k&&n.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:k}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx("button",{type:"button",onClick:a,disabled:x,className:"rounded-lg px-3 py-1.5 text-[12px] text-ink-secondary hover:bg-raised/50 disabled:opacity-50",children:l("common.cancel")}),n.jsxs("button",{type:"submit",disabled:x||!b,className:"flex items-center gap-1.5 rounded-lg bg-raised px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[x&&n.jsx(je,{size:13,className:"animate-spin"}),l("providerAccounts.add")]})]})]})}const v3="w-full rounded-lg border border-hairline/40 bg-inset px-3 py-2 text-[13px] text-ink placeholder:text-ink-secondary focus:border-hairline focus:outline-none disabled:opacity-50",Bu="rounded-lg border border-hairline/40 px-3 py-1.5 text-[12px] text-ink-secondary hover:bg-raised/50 hover:text-ink disabled:cursor-not-allowed disabled:opacity-50";async function DS(e,t,a,o,i={}){const s=e.kind==="apiKey",r=s&&!!window.ogb?.setInstanceKey,c=await Z("/api/provider-accounts",{method:"POST",body:JSON.stringify({provider:e.id,displayName:t,...o?{owner:o}:{},...i,...s&&!r?{key:a}:{}})});return r&&await BS(c.instanceId,a).catch(async d=>{throw await Z(`/api/provider-accounts/${encodeURIComponent(c.instanceId)}`,{method:"DELETE"}).catch(()=>{}),d}),c}function kO(e){return e.ok?l("providerAccounts.testOk"):e.reason==="rejected"?l("providerAccounts.testRejected"):e.reason==="unreachable"?l("providerAccounts.testUnreachable"):l("providerAccounts.testUnexpected")}function Lle({provider:e}){return e.icon?n.jsx(Rg,{preset:e.icon,size:18}):n.jsx(Nd,{driverKind:e.driver,size:18})}function wO(e){return e.provider.keyless?n.jsx(zle,{...e}):e.provider.deviceSignIn?n.jsx(Dle,{...e}):n.jsx(_le,{...e})}function _le({provider:e,onDone:t,onCancel:a}){const[o,i]=f.useState(""),[s,r]=f.useState(""),[c,d]=f.useState(null),[p,h]=f.useState(null),[g,b]=f.useState(null),[x,v]=f.useState("company"),[k,w]=f.useState({url:"",model:e.setup?.model?.required?"":e.setup?.model?.example??""}),N=e.kind==="apiKey",C=async()=>{if(!(!e.keyTest||!s.trim()||c)){d("test"),b(null);try{const M=await Z("/api/keys/test",{method:"POST",body:JSON.stringify({provider:e.keyTest.provider,key:s.trim(),...e.keyTest.url?{url:e.keyTest.url}:{}})});b(kO(M))}catch(M){b(M instanceof Error?M.message:String(M))}finally{d(null)}}},j=async()=>{if(!(c||!o.trim()||N&&!s.trim())){d("save"),h(null);try{await DS(e,o.trim(),s.trim(),x,xO(e.setup,k)),await t()}catch(M){h(Xo(M)?null:M instanceof Error?M.message:String(M))}finally{d(null)}}};return n.jsxs("form",{className:"mt-3 flex flex-col gap-2 rounded-xl border border-hairline/40 p-3",onSubmit:M=>{M.preventDefault(),j()},children:[n.jsxs("label",{className:"flex flex-col gap-1 text-[12px] text-ink-secondary",children:[l("providerAccounts.name"),n.jsx("input",{value:o,onChange:M=>i(M.target.value),maxLength:80,required:!0,disabled:c!==null,placeholder:l("providerAccounts.namePlaceholder"),className:v3})]}),N&&n.jsxs("label",{className:"flex flex-col gap-1 text-[12px] text-ink-secondary",children:[l("providerAccounts.key"),n.jsx("input",{type:"password",value:s,onChange:M=>{r(M.target.value),b(null)},autoComplete:"off",disabled:c!==null,placeholder:l("providerAccounts.keyPlaceholder"),className:v3})]}),n.jsx(vO,{ask:e.setup,value:k,onChange:w,disabled:c!==null}),N&&e.keyUrl&&n.jsx("a",{href:e.keyUrl,target:"_blank",rel:"noopener noreferrer",className:"w-fit text-[12px] text-accent hover:underline",children:l("providerAccounts.getKey",{provider:e.label})}),!N&&n.jsx("p",{className:"text-[12px] leading-relaxed text-ink-secondary",children:l("providerAccounts.signInHint")}),n.jsx(RS,{value:x,onChange:v,disabled:c!==null}),g&&n.jsx("p",{role:"status",className:"text-[12px] text-ink-secondary",children:g}),p&&n.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:p}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx("button",{type:"button",onClick:a,disabled:c!==null,className:"rounded-lg px-3 py-1.5 text-[12px] text-ink-secondary hover:bg-raised/50 disabled:opacity-50",children:l("common.cancel")}),N&&e.keyTest&&n.jsx("button",{type:"button",onClick:()=>{C()},disabled:c!==null||!s.trim(),className:Bu,children:l(c==="test"?"keys.testing":"keys.test")}),n.jsxs("button",{type:"submit",disabled:c!==null||!o.trim()||N&&!s.trim()||!yO(e.setup,k),className:"flex items-center gap-1.5 rounded-lg bg-raised px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[c==="save"&&n.jsx(je,{size:13,className:"animate-spin"}),l("providerAccounts.add")]})]})]})}function SO({provider:e,account:t,onChanged:a,extra:o}){const{state:i}=ke(),[s,r]=f.useState(null),[c,d]=f.useState(""),[p,h]=f.useState(!1),[g,b]=f.useState(!1),[x,v]=f.useState(null),[k,w]=f.useState(null),[N,C]=f.useState(!1),j=i.instances.find(P=>P.instanceId===t.instanceId),M=e.kind==="signIn"&&j!==void 0&&(j.snapshot.state!=="available"||j.authentication!==void 0||j.claudeAccount!==void 0||!t.signInCommand),E=i.bots.filter(P=>P.modelSelection.instanceId===t.instanceId).length,A=e.kind==="apiKey"?e.keyless?l(e.id==="vertexAi"?"keyless.usesGcloud":"keyless.noKeyNeeded"):t.keyConfigured?l("providerAccounts.keySaved"):l("providerAccounts.noKey"):t.signedIn===!0?l("providerAccounts.signedIn"):t.signedIn===!1?l("providerAccounts.notSignedIn"):t.available===!1?l("onboarding.engines.needsSetup"):l("providerAccounts.statusUnknown"),R=e.kind==="apiKey"?t.keyConfigured===!0:t.signedIn===!0,B=async P=>{if(!p){h(!0),v(null);try{await P(),r(null),d(""),await a()}catch(L){v(Xo(L)?null:L instanceof Error?L.message:String(L))}finally{h(!1)}}},O=()=>{const P=c.trim();P&&(s==="rename"?B(()=>Z(`/api/provider-accounts/${encodeURIComponent(t.instanceId)}`,{method:"PATCH",body:JSON.stringify({displayName:P})})):s==="key"&&B(()=>BS(t.instanceId,P)))},T=async()=>{if(!p){h(!0),w(null);try{const P=await Z(`/api/provider-accounts/${encodeURIComponent(t.instanceId)}/test`,{method:"POST",body:"{}"});w(kO(P))}catch(P){w(P instanceof Error?P.message:String(P))}finally{h(!1)}}},z=()=>{b(!1),B(async()=>{await Z(`/api/provider-accounts/${encodeURIComponent(t.instanceId)}`,{method:"DELETE"}),e.kind==="apiKey"&&window.ogb?.setInstanceKey&&await window.ogb.setInstanceKey(t.instanceId,"")})};return n.jsxs("li",{className:"border-t border-hairline/30 py-2.5 first:border-t-0",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1.5 text-[13px]",children:[n.jsx("span",{className:"min-w-0 break-words font-medium text-ink",children:t.displayName}),n.jsx("span",{className:V("text-[12px]",R?"text-success":"text-ink-secondary"),children:A}),n.jsx(fO,{instanceId:t.instanceId,owner:t.owner,locked:t.ownerLocked,onChanged:a}),n.jsx("span",{className:"flex-1"}),n.jsx("button",{type:"button",disabled:p,onClick:()=>{r(s==="rename"?null:"rename"),d(t.displayName)},className:Bu,children:l("providerAccounts.rename")}),e.kind==="apiKey"&&!e.keyless&&n.jsx("button",{type:"button",disabled:p,onClick:()=>{r(s==="key"?null:"key"),d("")},className:Bu,children:t.keyConfigured?l("providerAccounts.replaceKey"):l("providerAccounts.addKey")}),e.kind==="apiKey"&&e.keyTest&&t.keyConfigured&&n.jsx("button",{type:"button",disabled:p,onClick:()=>{T()},className:Bu,children:l("keys.test")}),t.removable&&n.jsx("button",{type:"button",disabled:p||E>0,onClick:()=>b(!0),className:V(Bu,"text-danger hover:text-danger"),children:l("providerAccounts.remove")})]}),t.removable&&E>0&&n.jsx("p",{className:"mt-1 text-[11.5px] text-ink-secondary",children:l("providerAccounts.assigned",{count:String(E)})}),s&&n.jsxs("form",{className:"mt-2 flex gap-2",onSubmit:P=>{P.preventDefault(),O()},children:[n.jsx("input",{type:s==="key"?"password":"text",value:c,onChange:P=>d(P.target.value),autoComplete:"off",maxLength:s==="rename"?80:4096,"aria-label":l(s==="rename"?"providerAccounts.name":"providerAccounts.key"),placeholder:s==="key"?l("providerAccounts.keyPlaceholder"):void 0,disabled:p,className:v3}),n.jsx("button",{type:"submit",disabled:p||!c.trim(),className:"flex w-[72px] shrink-0 items-center justify-center rounded-lg bg-control py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",children:p?n.jsx(je,{size:13,className:"animate-spin"}):l("common.save")})]}),t.signedIn!==!0&&M&&j&&(N?n.jsx("div",{className:"mt-2","data-account-sign-in":t.instanceId,children:n.jsx(Fr,{instance:j,unframed:!0})}):n.jsx("button",{type:"button",onClick:()=>C(!0),className:"mt-2 rounded-lg bg-accent px-3 py-1.5 text-[12.5px] font-medium text-white hover:opacity-90","data-account-sign-in-button":t.instanceId,children:l("subscriptions.signIn")})),e.kind==="signIn"&&t.signedIn!==!0&&!M&&t.signInCommand&&n.jsxs("div",{className:"mt-2 space-y-1.5",children:[n.jsx("p",{className:"text-[12px] leading-relaxed text-ink-secondary",children:l("providerAccounts.signInSteps")}),n.jsx(_c,{command:t.signInCommand,copyLabel:l("engineSetup.copyCommand")})]}),o,k&&n.jsx("p",{role:"status",className:"mt-1 text-[12px] text-ink-secondary",children:k}),x&&n.jsx("p",{role:"alert",className:"mt-1 text-[12px] text-danger",children:x}),n.jsx(na,{open:g,title:l("providerAccounts.removeTitle",{name:t.displayName}),body:e.kind==="apiKey"?l("providerAccounts.removeKeyHint"):l("providerAccounts.removeSignInHint"),confirmLabel:l("providerAccounts.remove"),tone:"neutral",onCancel:()=>b(!1),onConfirm:z})]})}function Fle({provider:e,onChanged:t}){const[a,o]=f.useState(!1),i=e.kind==="apiKey"?wD(e.id):void 0;return n.jsxs("div",{className:"rounded-2xl border border-hairline/50 bg-card px-4 py-3 sm:px-5",children:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-lg bg-control",children:n.jsx(Lle,{provider:e})}),n.jsx("span",{className:"min-w-0 flex-1 text-[14px] font-medium text-ink",children:e.label}),e.signupUrl&&n.jsx("a",{href:e.signupUrl,target:"_blank",rel:"noopener noreferrer",className:"shrink-0 text-[12px] text-accent hover:underline",children:l(e.kind==="signIn"?"providerAccounts.getSubscription":e.billing==="free"?"providerAccounts.signUpFree":"providerAccounts.getPlan")}),e.kind==="apiKey"&&e.keyUrl&&!e.deviceSignIn&&!e.keyless&&n.jsx("a",{href:e.keyUrl,target:"_blank",rel:"noopener noreferrer",className:"shrink-0 text-[12px] text-accent hover:underline",children:l(e.billing==="subscription"?"providerAccounts.getPlanKey":"providerAccounts.getApiKey")}),!a&&n.jsxs("button",{type:"button",onClick:()=>o(!0),className:V(Bu,"flex items-center gap-1.5"),children:[n.jsx(Sn,{size:13}),l("providerAccounts.add")]})]}),n.jsxs("p",{className:"mt-1.5 text-[12px] leading-relaxed text-ink-secondary",children:[vD(e.billing,e.deviceSignIn?"signIn":e.kind,e.id),e.billing==="subscription"&&g3(e.id)?` · ${g3(e.id)}`:""]}),(i||e.accounts.length>0)&&n.jsxs("ul",{className:"mt-2",children:[i&&n.jsx("li",{className:"py-2.5","data-main-key":i.section,children:n.jsx(Dg,{section:i.section,testProvider:i.test,mainKey:!0})}),e.accounts.map(s=>n.jsx(SO,{provider:e,account:s,onChanged:t},s.instanceId))]}),a&&n.jsx(wO,{provider:e,onCancel:()=>o(!1),onDone:async()=>{o(!1),await t()}})]})}function qle({providers:e,billing:t,onChanged:a}){return n.jsx(n.Fragment,{children:e.filter(o=>o.billing===t&&o.id!=="claude").map(o=>n.jsx(Fle,{provider:o,onChanged:a},o.id))})}function CO({billing:e}){const{refreshInstances:t}=ke(),[a,o]=f.useState(null),[i,s]=f.useState(null),r=f.useCallback(async()=>{try{const d=await Z("/api/provider-accounts");o(d.providers),s(null)}catch(d){s(d instanceof Error?d.message:String(d))}},[]);f.useEffect(()=>{r()},[r]);const c=f.useCallback(async()=>{await Promise.all([r(),Promise.resolve(t()).catch(()=>{})])},[r,t]);return n.jsxs("section",{className:"flex flex-col gap-3","aria-labelledby":`provider-accounts-${e}`,children:[n.jsxs("div",{children:[n.jsx("h2",{id:`provider-accounts-${e}`,className:"text-[16px] font-semibold text-ink",children:l(`providerAccounts.${e}Title`)}),n.jsx("p",{className:"mt-1 max-w-lg text-[12.5px] leading-relaxed text-ink-secondary",children:l(`providerAccounts.${e}Intro`)})]}),i&&n.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:i}),a===null&&!i&&n.jsx(je,{size:14,className:"animate-spin text-ink-secondary"}),a&&n.jsx(qle,{providers:a,billing:e,onChanged:c})]})}const Cr="w-full rounded-lg border border-hairline/40 bg-inset px-3 py-2.5 text-[15px] text-ink placeholder:text-ink-secondary focus:border-hairline focus:outline-none";function Ha(e){return{"--i":e}}function op({children:e,className:t,...a}){return n.jsx("button",{"data-primary":"",...a,className:V("w-full shrink-0 rounded-lg bg-accent py-2.5 text-[15px] font-medium text-white transition-[transform,opacity] duration-150 active:scale-[0.98] disabled:opacity-40",t),children:e})}function rg({children:e,className:t,...a}){return n.jsx("button",{...a,className:V("text-[12px] text-ink-secondary transition-colors hover:text-ink",t),children:e})}const Ule={claude:"claudeAgent",chatgpt:"codex",gemini:"antigravityAgent",grok:"grokAgent",cursor:"cursorAgent",museCode:"museCode",ollama:"ollamaCloud",kimi:"kimiAgent",qwen:"qwenAgent",opencodeGo:"opencodeGo"};function gd(e,t){return t&&k3.includes(e)?l(`setup.plan.${e}.chibitekName`):l(`setup.plan.${e}.name`)}const k3=sx;function Vle(e){const t=Ule[e];return t?n.jsx(Nd,{driverKind:t,size:26}):e==="apiKey"?n.jsx(Wh,{size:24,className:"text-ink-secondary","aria-hidden":"true"}):n.jsx(Ig,{size:24,className:"text-ink-secondary","aria-hidden":"true"})}function Hle({picks:e,chibitek:t,onToggle:a}){const o=Oee(e,t);return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.plans.intro")}),n.jsx("p",{className:"mt-1.5 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.plans.billing")}),t?n.jsxs(n.Fragment,{children:[n.jsx("h2",{className:"mt-4 text-[12px] font-semibold uppercase tracking-wide text-ink-secondary",children:l("setup.plans.chibitekTitle")}),n.jsx(rw,{plans:k3,picks:e,chibitek:!0,onToggle:a,label:l("setup.plans.chibitekTitle")}),n.jsx("p",{className:"mt-2 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.plans.chibitekNotSure",{email:Jc})}),n.jsx("h2",{className:"mt-5 text-[12px] font-semibold uppercase tracking-wide text-ink-secondary",children:l("setup.plans.otherTitle")}),n.jsx(rw,{plans:r3.filter(i=>!k3.includes(i)),picks:e,onToggle:a,label:l("setup.plans.otherTitle")})]}):n.jsx(rw,{plans:r3,picks:e,onToggle:a,label:l("setup.plans.groupLabel")}),n.jsxs("div",{className:"mt-4 rounded-xl border border-hairline/40 bg-card px-3.5 py-3","aria-live":"polite",children:[n.jsx("div",{className:"text-[11.5px] font-semibold uppercase tracking-wide text-ink-secondary",children:l("setup.plans.recommendedTitle")}),n.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink",children:o.kind==="askErick"?l("setup.plans.askErick",{email:Jc}):o.kind==="plan"&&o.plan==="gemini"?l("setup.plans.mainGemini"):o.kind==="startLocal"?l("setup.plans.startLocal"):o.localBackup?l("setup.plans.mainWithBackup",{plan:gd(o.plan,t)}):l("setup.plans.main",{plan:gd(o.plan,t)})})]}),n.jsxs(Ji,{children:[n.jsx("p",{children:l("setup.plans.what1")}),n.jsx("p",{children:l("setup.plans.what2")})]})]})}function rw({plans:e,picks:t,chibitek:a=!1,onToggle:o,label:i}){return n.jsx("div",{role:"group","aria-label":i,className:"mt-2 grid grid-cols-2 gap-2 sm:grid-cols-3",children:e.map(s=>{const r=t.includes(s);return n.jsxs("button",{type:"button",role:"checkbox","aria-checked":r,"aria-label":gd(s,a),"aria-describedby":`plan-detail-${s}`,"data-plan":s,onClick:()=>o(s),className:V("relative flex min-h-[92px] flex-col items-start gap-2 rounded-xl border p-3 text-left transition-[border-color,background-color,transform] active:scale-[0.98]",r?"border-accent bg-accent/10":"border-hairline/50 bg-card hover:bg-raised/40"),children:[n.jsx("span",{className:"flex size-9 items-center justify-center rounded-lg bg-inset",children:Vle(s)}),n.jsx("span",{className:"text-[13px] font-semibold leading-tight text-ink",children:gd(s,a)}),n.jsx("span",{id:`plan-detail-${s}`,className:"text-[11.5px] leading-snug text-ink-secondary",children:l(a?`setup.plan.${s}.chibitekDetail`:`setup.plan.${s}.detail`)}),r&&n.jsx("span",{className:"absolute right-2 top-2 flex size-5 items-center justify-center rounded-full bg-accent text-white","aria-hidden":"true",children:n.jsx(mt,{size:12,strokeWidth:3})})]},s)})})}function OS(e,t){const a=e.filter(o=>o.driverKind===t&&!o.managed&&!o.readOnly);return a.find(o=>!o.providerAccount)??a[0]}function $le(e){return e.loaded?e.instance?e.job?.kind==="engine-install"&&e.job.state==="running"?"installing":e.instance.snapshot.state!=="available"?e.job?.kind==="engine-install"&&e.job.state==="failed"?"installFailed":"notInstalled":e.instance.access!=="custom"&&e.instance.snapshot.authenticated===!1?"needsSignIn":e.test==="passed"?"tested":e.test==="failed"?"testFailed":"testing":e.checkFailed?"checkFailed":"unavailable":"checking"}const Gle={downloading:"setup.connect.phase.downloading",installing:"setup.connect.phase.installing",checking:"setup.connect.phase.checking"};function Kle({name:e,phase:t,job:a,terminalCommand:o,onInstall:i,onRetryTest:s,onRecheck:r,signIn:c,testDetail:d,startError:p,windows:h=!1,notOnWindows:g=!1}){return n.jsxs("div",{className:"mt-4 rounded-xl border border-hairline/40 bg-card p-3.5","data-phase":t,children:[t==="checking"&&n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[n.jsx(je,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.connect.checking",{name:e})]}),t==="checkFailed"&&n.jsx(Ra,{message:l("setup.connect.checkFailed",{name:e}),onRetry:r}),t==="unavailable"&&n.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:l("setup.connect.unavailable",{name:e})}),t==="notInstalled"&&g&&n.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:l("setup.connect.notOnWindows",{name:e})}),t==="notInstalled"&&!g&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:l(h?"setup.connect.installIntroWindows":"setup.connect.installIntro",{name:e})}),n.jsxs("button",{type:"button",onClick:i,className:V(Ka,"mt-3 w-full"),children:[n.jsx(ga,{size:14,"aria-hidden":"true"}),l("setup.connect.install",{name:e})]}),p&&n.jsx(Ra,{message:l("setup.error.failed"),detail:p,onRetry:i})]}),t==="installing"&&n.jsxs(n.Fragment,{children:[n.jsx(qi,{label:l(Gle[a?.phase??""]??"setup.connect.phase.installing",{name:e}),received:a?.phase==="downloading"?a.received:void 0,total:a?.phase==="downloading"?a.total:void 0}),n.jsx(jd,{detail:a?.detail})]}),t==="installFailed"&&n.jsxs(n.Fragment,{children:[n.jsx(Ra,{message:h&&a?.reason==="no-installer"?l("setup.error.noInstallerWindows"):zl(a),detail:a?.detail,onRetry:i}),o&&n.jsxs("details",{className:"mt-3 rounded-lg border border-hairline/40 bg-app px-2.5 py-2 text-[12px] text-ink-secondary",children:[n.jsx("summary",{className:"cursor-pointer select-none outline-none hover:text-ink focus-visible:text-ink",children:l(h?"setup.connect.terminalFallbackWindows":"setup.connect.terminalFallback")}),n.jsx("p",{className:"mt-2 leading-relaxed",children:l(h?"setup.connect.terminalFallbackHelpWindows":"setup.connect.terminalFallbackHelp")}),n.jsx(P0,{command:o,actionLabel:l(h?"engineSetup.openInstallWindows":"engineSetup.openInstall"),compact:!0})]})]}),t==="needsSignIn"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:l("setup.connect.signInIntro",{name:e})}),c]}),t==="testing"&&n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[n.jsx(je,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.connect.testing",{name:e})]}),t==="tested"&&n.jsx(ud,{children:l("setup.connect.tested",{name:e})}),t==="testFailed"&&n.jsx(Ra,{message:l("setup.connect.testFailed",{name:e}),detail:d,onRetry:s})]})}function Wle({name:e,job:t,startError:a,onStart:o,onCancel:i}){const[s,r]=f.useState(!1),c=t?.state==="running";return n.jsxs("div",{className:"mt-3",children:[!c&&n.jsxs("button",{type:"button",onClick:o,className:V(Ka,"w-full"),children:[n.jsx(Pr,{size:14,"aria-hidden":"true"}),t?.state==="failed"||t?.state==="cancelled"?l("setup.connect.signInAgain"):l("setup.connect.signIn",{name:e})]}),c&&!t.url&&n.jsx(qi,{label:l("setup.connect.signInStarting",{name:e})}),c&&t.url&&n.jsxs("div",{className:"space-y-2.5",children:[n.jsx("p",{className:"text-[12.5px] leading-relaxed text-ink-secondary",children:t.code?l("setup.connect.signInWithCode"):l("setup.connect.signInBrowser")}),t.code&&n.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg bg-inset px-3 py-2",children:[n.jsx("code",{dir:"ltr","aria-label":l("setup.connect.codeLabel"),className:"select-all font-mono text-[17px] tracking-[0.2em] text-ink",children:t.code}),n.jsxs("button",{type:"button",onClick:()=>{navigator.clipboard?.writeText(t.code).then(()=>r(!0)).catch(()=>{})},className:Ga,children:[n.jsx(Xa,{size:13,"aria-hidden":"true"}),l(s?"engineSetup.copied":"engineSetup.copy")]})]}),n.jsxs("button",{type:"button",onClick:()=>A0(t.url),className:V(Ka,"w-full"),children:[n.jsx(Mn,{size:14,"aria-hidden":"true"}),l("setup.connect.openSignIn")]}),n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[12px] text-ink-secondary",children:[n.jsx(je,{size:12,className:"animate-spin","aria-hidden":"true"}),l("setup.connect.waitingForSignIn")]}),n.jsx("button",{type:"button",onClick:i,className:"text-[12px] text-ink-secondary hover:text-ink",children:l("common.cancel")})]}),a&&n.jsx(Ra,{message:l("setup.error.failed"),detail:a}),t&&(t.state==="failed"||t.state==="cancelled")&&t.reason!==void 0&&n.jsx(Ra,{message:zl(t),detail:t.detail})]})}function Jle({instanceId:e,name:t,onSignedIn:a}){const{job:o,start:i,cancel:s,startError:r}=Br(c=>{c.state==="succeeded"&&a()});return n.jsx(Wle,{name:t,job:o,startError:r,onStart:()=>{i("engine-login",e)},onCancel:()=>{s()}})}function Yle({instanceId:e,chibitek:t,domain:a,onSkip:o}){const i=NO(e,a);return i.state==="failed"?n.jsx(AO,{chibitek:t,onRetry:()=>{i.start()},onContinueLocal:o}):n.jsx("div",{className:"mt-3",children:i.state==="waiting"?n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[n.jsx(je,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.google.geminiWaiting")]}):n.jsxs("button",{type:"button",onClick:()=>{i.start()},className:V(Ka,"w-full"),children:[n.jsx(Pr,{size:14,"aria-hidden":"true"}),a?l("setup.google.useDomain",{domain:a}):l("setup.connect.signIn",{name:"Gemini"})]})})}function Zle({plan:e,chibitek:t,domain:a,onTested:o,onSkip:i}){const{state:s,refreshInstances:r}=ke(),c=uS[e],[d,p]=f.useState(s.instances.length>0),[h,g]=f.useState(!1),[b,x]=f.useState("idle"),[v,k]=f.useState(null),w=OS(s.instances,c.driverKind),N=gd(e),C=f.useRef(o);C.current=o;const{job:j,start:M,startError:E}=Br(()=>{r().catch(()=>{})}),A=f.useCallback(()=>{g(!1),r().then(z=>g(!z),()=>g(!0)).finally(()=>p(!0))},[r]);f.useEffect(()=>{A()},[]);const R=f.useCallback(async()=>{if(w){x("running"),k(null);try{const z=await Z("/api/setup/engine-test",{method:"POST",body:JSON.stringify({instanceId:w.instanceId}),timeoutMs:6e4});x(z.ok?"passed":"failed"),k(z.detail??null),C.current(z.ok),z.ok||r().catch(()=>{})}catch(z){x("failed"),k(z instanceof Error?z.message:String(z)),C.current(!1)}}},[w,r]),B=$le({loaded:d,instance:w,job:j,test:b,checkFailed:h}),O=jD()==="win32";f.useEffect(()=>{B==="testing"&&b==="idle"&&R()},[B,b,R]);let T=null;return w&&B==="needsSignIn"&&(c.signIn==="claude"?T=n.jsx("div",{className:"mt-3",children:n.jsx(yD,{instanceId:w.instanceId})}):c.signIn==="codex"?T=n.jsx("div",{className:"mt-3",children:n.jsx(m3,{instanceId:w.instanceId})}):c.signIn==="meta"?T=n.jsx("div",{className:"mt-3",children:n.jsx(m3,{instanceId:w.instanceId,provider:"meta"})}):c.signIn==="cli"?T=n.jsx(Jle,{instanceId:w.instanceId,name:N,onSignedIn:()=>{r()}}):e==="gemini"?T=n.jsx(Yle,{instanceId:w.instanceId,chibitek:t,domain:a,onSkip:i}):T=n.jsx(Fr,{instance:w,unframed:!0,className:"mt-2"})),n.jsx(Kle,{name:N,phase:B,job:j,terminalCommand:j?.reason==="no-installer"||j?.state==="failed"?tp(w?.install):null,windows:O,notOnWindows:O&&!!w?.install?.command&&!tp(w?.install)&&!w?.install?.server&&!w?.install?.managed,onInstall:()=>w&&void M("engine-install",w.instanceId),onRecheck:()=>{p(!1),A()},startError:E,onRetryTest:()=>{x("idle"),r().catch(()=>{})},signIn:T,testDetail:v})}function jO({name:e,phase:t,value:a,onChange:o,onSave:i,keyUrl:s,signupUrl:r,error:c,job:d}){if(t==="tested")return n.jsx("div",{className:"mt-4 rounded-xl border border-hairline/40 bg-card p-3.5",children:n.jsx(ud,{children:l("setup.key.tested",{name:e})})});if(t==="checking")return n.jsxs("p",{role:"status",className:"mt-4 flex items-center gap-2 text-[13px] text-ink-secondary",children:[n.jsx(je,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.connect.checking",{name:e})]});if(t==="installing")return n.jsxs("div",{className:"mt-4 rounded-xl border border-hairline/40 bg-card p-3.5",children:[n.jsx(qi,{label:l("setup.connect.phase.installing",{name:e})}),n.jsx(jd,{detail:d?.detail})]});const p=t==="saving";return n.jsxs("form",{className:"mt-4 rounded-xl border border-hairline/40 bg-card p-3.5",onSubmit:h=>{h.preventDefault(),i()},children:[n.jsx("label",{htmlFor:"setup-plan-key",className:"text-[12px] font-medium text-ink-secondary",children:l("setup.key.label",{name:e})}),n.jsx("input",{id:"setup-plan-key",type:"password",autoComplete:"off",spellCheck:!1,value:a,disabled:p,onChange:h=>o(h.target.value),placeholder:l("setup.key.placeholder"),className:V("mt-1.5",Cr)}),n.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[s&&n.jsx(lx,{href:s,label:l("setup.key.getKey")}),r&&n.jsx(lx,{href:r,label:l("setup.key.noPlan")})]}),n.jsxs("button",{type:"submit",disabled:!a.trim()||p,className:V(Ka,"mt-3 w-full"),children:[p&&n.jsx(je,{size:14,className:"animate-spin","aria-hidden":"true"}),l(p?"setup.key.testing":"setup.key.save")]}),t==="rejected"&&n.jsx(Ra,{message:l("setup.key.rejected",{name:e})}),t==="unreachable"&&n.jsx(Ra,{message:l("setup.key.unreachable")}),t==="failed"&&n.jsx(Ra,{message:l("setup.key.failed"),detail:c??d?.detail})]})}function jM({plan:e,onTested:t}){const{refreshInstances:a}=ke(),o=uS[e],i=gd(e),[s,r]=f.useState(null),[c,d]=f.useState("checking"),[p,h]=f.useState(""),[g,b]=f.useState(null),x=f.useRef(t);x.current=t;const v=f.useCallback(async C=>{const j=await Z("/api/setup/engine-test",{method:"POST",body:JSON.stringify({instanceId:C}),timeoutMs:6e4});j.ok?(d("tested"),x.current(!0)):(b(j.detail??null),d("failed"))},[]),k=f.useRef(null),w=Br(C=>{a().catch(()=>{}),C.state==="succeeded"&&k.current?v(k.current).catch(()=>d("failed")):d("failed")});f.useEffect(()=>{let C=!0;return Z("/api/provider-accounts",{timeoutMs:1e4}).then(async({providers:j})=>{if(!C)return;const M=j.find(R=>R.id===o.provider)??null;r(M);const E=M?.accounts.find(R=>R.keyConfigured);if(!E){d("entering");return}const A=await Z(`/api/provider-accounts/${encodeURIComponent(E.instanceId)}/test`,{method:"POST",body:"{}"}).catch(()=>({ok:!1}));C&&(A.ok?(d("tested"),x.current(!0)):d("entering"))}).catch(()=>C&&d("entering")),()=>{C=!1}},[o.provider]);const N=async()=>{const C=p.trim();if(!(!C||!s)){d("saving"),b(null);try{if(s.keyTest){const M=await Z("/api/keys/test",{method:"POST",body:JSON.stringify({provider:s.keyTest.provider,key:C,...s.keyTest.url?{url:s.keyTest.url}:{}}),timeoutMs:3e4});if(!M.ok){d(M.reason==="rejected"?"rejected":M.reason==="unreachable"?"unreachable":"failed");return}}const j=await DS(s,s.label,C);if(h(""),await a().catch(()=>{}),k.current=j.instanceId,o.method==="engineAndKey"){d("installing"),await w.start("engine-install",j.instanceId);return}s.keyTest?(d("tested"),x.current(!0)):await v(j.instanceId)}catch(j){b(Xo(j)?null:j instanceof Error?j.message:String(j)),d(Xo(j)?"entering":"failed")}}};return n.jsx(jO,{name:i,phase:c,value:p,onChange:C=>{h(C),c!=="entering"&&c!=="saving"&&d("entering")},onSave:()=>{N()},keyUrl:s?.keyUrl,signupUrl:s?.signupUrl,error:g,job:w.job})}function Qle({plan:e,onTested:t,chibitek:a=!1,domain:o=null,onSkip:i}){const[s,r]=f.useState(null),c=gd(e),d=uS[e],{state:p,refreshInstances:h}=ke(),g=zee(e,a),[b,x]=f.useState(g.personal),v=f.useRef(!1),k=async C=>{const j=await Z("/api/instances").then(E=>E.instances,()=>p.instances),M=d.method==="engine"?OS(j,d.driverKind):j.filter(E=>E.providerAccount?.provider===d.provider).at(-1);M&&!M.ownerLocked&&await fD(M.instanceId,C?"personal":"company").catch(()=>{}),await Promise.resolve(h()).catch(()=>{})},w=C=>{v.current=C,C&&!(e==="ollama"&&s==="local")&&k(b),t(C)},N=()=>{const C=!b;x(C),v.current&&k(C)};return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l(`setup.plan.${e}.connect`)}),e==="ollama"?n.jsxs(n.Fragment,{children:[n.jsx("div",{role:"radiogroup","aria-label":l("setup.ollama.question"),className:"mt-4 grid grid-cols-2 gap-2",children:["cloud","local"].map(C=>n.jsxs("button",{type:"button",role:"radio","aria-checked":s===C,"aria-label":l(`setup.ollama.${C}`),onClick:()=>{r(C),C==="local"&&t(!0)},className:V("rounded-xl border px-3 py-2.5 text-left text-[13px] transition-colors",s===C?"border-accent bg-accent/10 text-ink":"border-hairline/50 bg-card text-ink-secondary hover:bg-raised/40"),children:[n.jsx("span",{className:"block font-semibold text-ink",children:l(`setup.ollama.${C}`)}),n.jsx("span",{className:"mt-0.5 block text-[11.5px]",children:l(`setup.ollama.${C}Detail`)})]},C))}),s==="cloud"&&n.jsx(jM,{plan:"ollama",onTested:w}),s==="local"&&n.jsx("p",{className:"mt-3 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.ollama.localNext")})]}):d.method==="engine"?n.jsx(Zle,{plan:e,chibitek:a,domain:o,onTested:w,onSkip:i}):n.jsx(jM,{plan:e,onTested:w}),!(e==="ollama"&&s!=="cloud")&&(g.fixed?n.jsx("p",{"data-plan-owner":"company",className:"mt-3 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.owner.company")}):n.jsxs("div",{"data-plan-owner":b?"personal":"company",className:"mt-3 flex items-start justify-between gap-3 rounded-xl border border-hairline/40 bg-card/80 px-3.5 py-3 backdrop-blur-xl",children:[n.jsxs("span",{className:"min-w-0",children:[n.jsx("span",{className:"block text-[13px] font-medium text-ink",children:l("setup.owner.toggle")}),n.jsx("span",{className:"mt-0.5 block text-[12px] leading-relaxed text-ink-secondary",children:l("setup.owner.toggleHint")})]}),n.jsx(Tt,{checked:b,"aria-label":l("setup.owner.toggle"),onClick:N})]})),n.jsx(Ji,{children:n.jsx("p",{children:l(`setup.plan.${e}.what`,{name:c})})})]})}const Xle="antigravityAgent";function NO(e,t){const{refreshInstances:a}=ke(),[o,i]=f.useState("idle"),s=f.useRef(null),r=()=>{s.current!==null&&window.clearInterval(s.current),s.current=null};f.useEffect(()=>r,[]);const c=f.useCallback(async()=>{if(!e)return;r(),i("waiting");const d=`/api/instances/${encodeURIComponent(e)}/auth`;try{const{auth:p}=await Z(`${d}/start`,{method:"POST",body:"{}",timeoutMs:12e4});if(p.phase==="succeeded"){await a().catch(()=>{});return}if(!p.flowId||!p.authorizationUrl)throw new Error("no sign-in page");A0(BR(p.authorizationUrl,t)),s.current=window.setInterval(()=>{a().catch(()=>{}),Z(`${d}/status?flowId=${encodeURIComponent(p.flowId)}`,{timeoutMs:1e4}).then(({auth:h})=>{(h.phase==="failed"||h.phase==="expired"||h.phase==="cancelled")&&(r(),i("failed"))}).catch(()=>{})},2e3)}catch{r(),i("failed")}},[e,t,a]);return{state:o,start:c,reset:()=>{r(),i("idle")}}}function AO({chibitek:e,onRetry:t,onContinueLocal:a}){return n.jsxs("div",{role:"alert",className:"mt-3 rounded-xl border border-warning/30 bg-warning/10 px-3 py-2.5",children:[n.jsxs("div",{className:"flex items-start gap-2 text-[12.5px] leading-relaxed text-ink",children:[n.jsx(Qn,{size:14,className:"mt-0.5 shrink-0 text-warning","aria-hidden":"true"}),n.jsx("span",{children:e?l("setup.google.geminiNotOnChibitek",{email:Jc}):l("setup.google.geminiNotOn")})]}),n.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[n.jsx("button",{type:"button",onClick:t,className:Ga,children:l("setup.tryAgain")}),a&&n.jsx("button",{type:"button",onClick:a,className:Ga,children:l("setup.google.continueLocal")})]})]})}function ece({stage:e,required:t,domain:a,accountEmail:o,geminiWorks:i,error:s,onStart:r,onRetryGemini:c,onSkipGemini:d,onUseOtherAccount:p,onSkip:h}){const g=a?l("setup.google.useDomain",{domain:a}):l("setup.google.useCompany");return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.google.intro")}),n.jsx("p",{className:"mt-1.5 text-[13px] font-medium text-ink",children:g}),t&&n.jsx("p",{className:"mt-1.5 text-[12.5px] text-ink-secondary",children:l("setup.google.required")}),n.jsxs("div",{className:"mt-4 rounded-xl border border-accent/40 bg-accent/5 p-3.5","data-stage":e,children:[e==="start"&&n.jsxs("button",{type:"button",onClick:r,className:V(Ka,"w-full"),children:[n.jsx(Pr,{size:14,"aria-hidden":"true"}),l("setup.google.button")]}),e==="installing"&&n.jsx(qi,{label:l("setup.google.installing")}),e==="geminiSignIn"&&n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink",children:[n.jsx(je,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.google.geminiWaiting")]}),e==="geminiOff"&&n.jsx(AO,{chibitek:!0,onRetry:c,onContinueLocal:d}),e==="account"&&n.jsxs(n.Fragment,{children:[n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink",children:[n.jsx(je,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.google.accountWaiting")]}),h&&n.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-[12.5px] text-ink-secondary",children:[n.jsx("span",{children:l("setup.google.stuckHint")}),n.jsx("button",{type:"button",onClick:h,className:Ga,"data-google-continue-without":!0,children:l("setup.google.continueWithout")})]})]}),e==="wrongDomain"&&n.jsxs("div",{role:"alert",className:"rounded-xl border border-danger/25 bg-danger/10 px-3 py-2.5",children:[n.jsx("p",{className:"text-[12.5px] leading-relaxed text-ink",children:l("setup.google.wrongDomain",{domain:a??"",email:o??""})}),n.jsx("button",{type:"button",onClick:p,className:V(Ga,"mt-2"),children:l("setup.google.useOther")})]}),e==="testing"&&n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[n.jsx(je,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.connect.testing",{name:"Gemini"})]}),e==="done"&&n.jsxs(n.Fragment,{children:[n.jsx(ud,{children:l("setup.google.done",{email:o??""})}),n.jsx("p",{className:"mt-1 text-[12.5px] text-ink-secondary",children:l(i?"setup.google.geminiReady":"setup.google.geminiLater")})]}),e==="failed"&&(h?n.jsxs("div",{role:"alert",className:"rounded-xl border border-warning/30 bg-warning/10 px-3 py-2.5","data-google-unavailable":!0,children:[n.jsxs("div",{className:"flex items-start gap-2 text-[12.5px] leading-relaxed text-ink",children:[n.jsx(Qn,{size:14,className:"mt-0.5 shrink-0 text-warning","aria-hidden":"true"}),n.jsx("span",{children:l("setup.google.unavailable")})]}),n.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[n.jsx("button",{type:"button",onClick:h,className:Ka,children:l("setup.continue")}),n.jsx("button",{type:"button",onClick:r,className:Ga,children:l("setup.tryAgain")})]})]}):n.jsx(Ra,{message:l("setup.error.failed"),detail:s,onRetry:r}))]}),n.jsx(Ji,{children:n.jsx("p",{children:l("setup.google.what")})})]})}function tce(e){return e?.snapshot.state==="available"&&e.snapshot.authenticated!==!1}function nce({required:e,domain:t,onDone:a,onSkip:o}){const{state:i,refreshInstances:s}=ke(),r=OS(i.instances,Xle),[c,d]=f.useState("start"),[p,h]=f.useState(null),[g,b]=f.useState(null),[x,v]=f.useState(!1),k=NO(r?.instanceId,t),w=Br(E=>{s().catch(()=>{}),E.state==="succeeded"?d("geminiSignIn"):d("geminiOff")}),N=f.useRef(null);f.useEffect(()=>()=>{N.current!==null&&window.clearInterval(N.current)},[]),f.useEffect(()=>{if(c==="geminiSignIn"){if(tce(r)){v(!0),d("account");return}k.state==="idle"&&k.start(),k.state==="failed"&&d("geminiOff")}},[c,r,k]);const C=f.useCallback(async()=>{b(null);try{const E=await Z("/api/accounts/connect",{method:"POST",body:JSON.stringify({provider:"google"})});E.url&&A0(BR(E.url,t)),N.current!==null&&window.clearInterval(N.current),N.current=window.setInterval(()=>{Z(`/api/accounts/connect/${encodeURIComponent(E.id)}`).then(A=>{if(!(A.state==="waiting"||A.state==="finishing")){if(N.current!==null&&window.clearInterval(N.current),N.current=null,A.state!=="connected"){b(A.error??A.state),d("failed");return}h(A.email??null),TR(A.email,t)?d("testing"):d("wrongDomain")}}).catch(A=>{N.current!==null&&window.clearInterval(N.current),b(A instanceof Error?A.message:String(A)),d("failed")})},2e3)}catch(E){b(E instanceof Error?E.message:String(E)),d("failed")}},[t]);f.useEffect(()=>{c==="account"&&C()},[c]),f.useEffect(()=>{if(c==="testing"){if(!x||!r){d("done"),a(!1);return}Z("/api/setup/engine-test",{method:"POST",body:JSON.stringify({instanceId:r.instanceId}),timeoutMs:6e4}).then(E=>{v(E.ok),d("done"),a(E.ok)}).catch(()=>{v(!1),d("done"),a(!1)})}},[c]);const j=()=>{if(b(null),k.reset(),!r){d("account");return}if(r.snapshot.state!=="available"){d("installing"),w.start("engine-install",r.instanceId);return}d("geminiSignIn")},M=async()=>{const A=(await Z("/api/accounts").catch(()=>null))?.providers.find(R=>R.id==="google")?.accounts.find(R=>R.email===p);A&&await Z(`/api/accounts/${encodeURIComponent(A.id)}`,{method:"DELETE"}).catch(()=>{}),h(null),d("account")};return n.jsx(ece,{stage:c,required:e,domain:t,accountEmail:p,geminiWorks:x,error:g,onStart:j,onRetryGemini:()=>{k.reset(),d(r?.snapshot.state==="available"?"geminiSignIn":"installing"),r&&r.snapshot.state!=="available"&&w.start("engine-install",r.instanceId)},onSkipGemini:()=>{v(!1),d("account")},onUseOtherAccount:()=>{M()},onSkip:o&&(()=>{N.current!==null&&window.clearInterval(N.current),N.current=null,o()})})}const MO=["appleCalendar","appleReminders","appleContacts","icloudDrive"],lw="apple:this-mac",Pb={gmail:"https://www.googleapis.com/auth/gmail.readonly",gmailSend:"https://www.googleapis.com/auth/gmail.compose",calendar:"https://www.googleapis.com/auth/calendar.events",drive:"https://www.googleapis.com/auth/drive.readonly"},ace=["openid","email","profile"],wc={mailReadWrite:"Mail.ReadWrite",mailSend:"Mail.Send",calendars:"Calendars.ReadWrite",files:"Files.Read.All"},oce={google:{id:"google",label:"Google",authorizeUrl:"https://accounts.google.com/o/oauth2/v2/auth",tokenUrl:"https://oauth2.googleapis.com/token",redirectHost:"127.0.0.1",scopes:ace,incremental:!0,authorizeParams:{access_type:"offline",prompt:"consent select_account",include_granted_scopes:"true"},clientIdEnv:"ATOMIC_GOOGLE_OAUTH_CLIENT_ID",clientSecretEnv:"ATOMIC_GOOGLE_OAUTH_CLIENT_SECRET",families:{gmail:Pb.gmail,gmailSend:Pb.gmailSend,calendar:Pb.calendar,drive:Pb.drive}},microsoft:{id:"microsoft",label:"Microsoft",authorizeUrl:"https://login.microsoftonline.com/common/oauth2/v2.0/authorize",tokenUrl:"https://login.microsoftonline.com/common/oauth2/v2.0/token",redirectHost:"localhost",scopes:["offline_access","openid","profile","email","User.Read",wc.mailReadWrite,wc.mailSend,wc.calendars,wc.files],incremental:!1,authorizeParams:{prompt:"select_account",response_mode:"query"},clientIdEnv:"ATOMIC_MICROSOFT_OAUTH_CLIENT_ID",families:{outlook:wc.mailReadWrite,outlookCalendar:wc.calendars,onedrive:wc.files}}};function IO(e){if(e==="apple")return[...MO];const t=oce[e];return t.incremental?Object.keys(t.families):[]}const ice="Atomic",zg="https://github.com/chibitek/atomic",NM="/handbook/atomic-handbook.html",sce=`${zg}/blob/main/docs/approval-levels.md`,rce=`${zg}/issues`,lce=`${zg}/releases`,cce=`${zg}/blob/main/LICENSE`;function zS(){return"0.1.214"}const dce={darwin:"macOS",win32:"Windows",linux:"Linux"};function uce(e){return(e&&dce[e])??null}async function _l(e){if(window.ogb?.openExternal){await window.ogb.openExternal(e);return}window.open(e,"_blank","noopener,noreferrer")}function pce({provider:e,onChanged:t,personalIds:a,onPersonal:o}){const[i,s]=f.useState(!1),[r,c]=f.useState(null),[d,p]=f.useState(null),[h,g]=f.useState(!1),b=async k=>{if(!i){s(!0),c(null);try{await k(),await t()}catch(w){c(w instanceof Error?w.message:String(w))}finally{s(!1)}}},x=k=>{b(()=>Z("/api/accounts/apple/families",{method:"POST",body:JSON.stringify({family:k}),timeoutMs:31e4}))},v=()=>{p(null),b(()=>Z(`/api/accounts/${encodeURIComponent(lw)}`,{method:"DELETE"}))};return n.jsxs(lt,{title:l("accounts.apple.title"),subtitle:l("accounts.apple.subtitle"),children:[n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("p",{className:"text-[12px] leading-relaxed text-ink-secondary",children:l("accounts.apple.intro")}),e.accounts.length>0?n.jsx("div",{className:"divide-y divide-hairline/40 overflow-hidden rounded-lg border border-hairline/40",children:e.accounts.map(k=>n.jsx(RO,{account:k,busy:i,onReconnect:()=>{},onRemove:()=>p(k),onTurnOn:x,personal:a?.includes(k.id),onPersonal:o&&(w=>w?o(k.id,!0):g(!0))},k.id))}):n.jsx(BO,{account:{id:lw,provider:"apple",email:"",addedAt:0,status:"ok",missing:[...MO]},busy:i,onTurnOn:x}),i&&n.jsxs("div",{role:"status",className:"flex items-center gap-3 rounded-lg bg-inset px-3 py-2.5 text-[12.5px] text-ink",children:[n.jsx(je,{size:14,className:"animate-spin text-ink-secondary"}),n.jsx("span",{className:"min-w-0 flex-1",children:l("accounts.apple.waiting")})]}),r&&n.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:r})]}),n.jsx(na,{open:d!==null,title:l("accounts.removeTitle",{email:d?.email??""}),body:l("accounts.removeBody"),confirmLabel:l("accounts.remove"),tone:"neutral",onCancel:()=>p(null),onConfirm:v}),n.jsx(na,{open:h,title:l("accounts.apple.personalOffTitle"),body:l("accounts.apple.personalOffBody"),confirmLabel:l("accounts.apple.personalOff"),tone:"neutral",onCancel:()=>g(!1),onConfirm:()=>{g(!1),o?.(lw,!1)}})]})}const mce=2e3,PO={google:{title:"accounts.google.title",subtitle:"accounts.google.subtitle",badge:"G",badgeClass:"bg-[#4285F4]"},microsoft:{title:"accounts.microsoft.title",subtitle:"accounts.microsoft.subtitle",badge:"M",badgeClass:"bg-[#0078D4]"},apple:{title:"accounts.apple.title",subtitle:"accounts.apple.subtitle",badge:"A",badgeClass:"bg-[#1d1d1f]"}},TO={gmail:"accounts.family.gmail",gmailSend:"accounts.family.gmailSend",calendar:"accounts.family.calendar",drive:"accounts.family.drive",outlook:"accounts.family.outlook",outlookCalendar:"accounts.family.outlookCalendar",onedrive:"accounts.family.onedrive",appleCalendar:"accounts.family.appleCalendar",appleReminders:"accounts.family.appleReminders",appleContacts:"accounts.family.appleContacts",icloudDrive:"accounts.family.icloudDrive"},hce={gmail:"accounts.why.gmail",gmailSend:"accounts.why.gmailSend",calendar:"accounts.why.calendar",drive:"accounts.why.drive",appleCalendar:"accounts.why.appleCalendar",appleReminders:"accounts.why.appleReminders",appleContacts:"accounts.why.appleContacts",icloudDrive:"accounts.why.icloudDrive"};function BO({account:e,busy:t,onTurnOn:a}){const o=IO(e.provider);if(!o.length)return null;const i=new Set(e.missing??[]);return n.jsx("ul",{className:"mt-2 flex flex-col gap-1.5","data-account-families":!0,children:o.map(s=>{const r=!i.has(s),c=hce[s];return n.jsxs("li",{className:"flex items-start gap-2 text-[11.5px] leading-relaxed",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"text-ink",children:l(TO[s])}),c&&n.jsxs("span",{className:"text-ink-secondary",children:[" · ",l(c)]})]}),r?n.jsx("span",{className:"shrink-0 text-success",children:l("accounts.familyOn")}):n.jsx("button",{type:"button",onClick:()=>a(s),disabled:t||e.status!=="ok",className:"shrink-0 text-accent hover:underline disabled:no-underline disabled:opacity-50","data-account-turn-on":s,children:l("accounts.turnOn")})]},s)})})}function LS(){const[e,t]=f.useState(null),[a,o]=f.useState(null),i=f.useCallback(async()=>{try{t(await Z("/api/accounts",{timeoutMs:3e4})),o(null)}catch(s){o(s instanceof Error?s.message:String(s))}},[]);return f.useEffect(()=>{i();const s=()=>{i()};return window.addEventListener("focus",s),()=>window.removeEventListener("focus",s)},[i]),{status:e,error:a,refresh:i}}function EO({provider:e}){const t=PO[e];return n.jsx("span",{"aria-hidden":!0,className:V("flex size-6 shrink-0 items-center justify-center rounded-full text-[11px] font-semibold text-white",t.badgeClass),children:t.badge})}function RO({account:e,busy:t,onReconnect:a,onTurnOn:o,onRemove:i,personal:s,onPersonal:r}){const c=new Date(e.addedAt).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}),d=IO(e.provider).length>0,p=d?[]:e.missing??[];return n.jsxs("div",{className:"flex items-start gap-3 px-3 py-2.5",children:[n.jsx(EO,{provider:e.provider}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-[13px] text-ink",children:e.email}),n.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 text-[11.5px] text-ink-secondary",children:[n.jsx("span",{children:l("accounts.connectedOn",{date:c})}),n.jsx("span",{className:e.status==="ok"?"text-success":"text-warning",children:e.status==="ok"?l("accounts.status.ok"):l("accounts.status.reauth")})]}),p.length?n.jsx("div",{className:"mt-1 text-[11.5px] leading-relaxed text-warning",children:l("accounts.missing",{services:p.map(h=>l(TO[h])).join(", ")})}):null,d&&n.jsx(BO,{account:e,busy:t,onTurnOn:o})]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-2 text-[12px]",children:[r&&n.jsxs("label",{className:"flex items-center gap-1.5 text-ink-secondary",title:l("owner.connectionHint"),children:[n.jsx("span",{children:l("owner.personal")}),n.jsx(Tt,{checked:!!s,disabled:t,"aria-label":l("owner.connectionToggle",{name:e.email}),onClick:()=>r(!s)})]}),(e.status==="reauth"||p.length>0)&&n.jsx("button",{type:"button",onClick:a,disabled:t,className:"text-ink-secondary hover:text-ink disabled:opacity-50",children:l("accounts.signInAgain")}),n.jsx("button",{type:"button",onClick:i,disabled:t,className:"text-danger hover:underline disabled:no-underline disabled:opacity-50",children:l("accounts.remove")})]})]})}function DO({provider:e,storageReady:t,onChanged:a,personalIds:o,onPersonal:i,onGiveUp:s}){const r=PO[e.id],[c,d]=f.useState(null),[p,h]=f.useState(null),[g,b]=f.useState(null),[x,v]=f.useState(!1),[k,w]=f.useState(null),[N,C]=f.useState(!1),j=f.useRef(null),M=()=>{j.current!==null&&window.clearInterval(j.current),j.current=null};f.useEffect(()=>M,[]);const E=O=>{M(),j.current=window.setInterval(()=>{Z(`/api/accounts/connect/${O}`).then(async T=>{T.state==="waiting"||T.state==="finishing"||(M(),d(null),T.state==="connected"?(b(l("accounts.connected",{email:T.email??""})),await a()):s&&T.state!=="cancelled"?h(l(e.id==="microsoft"?"setup.accounts.microsoftUnavailable":"setup.accounts.googleUnavailable")):T.state==="expired"?h(l("accounts.expired")):T.state==="failed"&&h(T.error??l("accounts.failed")))}).catch(T=>{M(),d(null),h(T instanceof Error?T.message:String(T))})},mce)},A=async O=>{if(!(x||c)){v(!0),h(null),b(null);try{const T=await Z("/api/accounts/connect",{method:"POST",body:JSON.stringify({provider:e.id,...O})});d(T),E(T.id),T.url&&await _l(T.url)}catch(T){h(T instanceof Error?T.message:String(T))}finally{v(!1)}}},R=async()=>{const O=c;M(),d(null),O&&await Z(`/api/accounts/connect/${O.id}`,{method:"DELETE"}).catch(()=>{})},B=async()=>{const O=k;if(w(null),!(!O||N)){C(!0),h(null),b(null);try{await Z(`/api/accounts/${encodeURIComponent(O.id)}`,{method:"DELETE"}),await a()}catch(T){h(T instanceof Error?T.message:String(T))}finally{C(!1)}}};return n.jsxs(lt,{title:l(r.title),subtitle:l(r.subtitle),children:[n.jsxs("div",{className:"flex flex-col gap-3",children:[e.configured?n.jsxs(n.Fragment,{children:[e.accounts.length>0&&n.jsx("div",{className:"divide-y divide-hairline/40 overflow-hidden rounded-lg border border-hairline/40",children:e.accounts.map(O=>n.jsx(RO,{account:O,busy:N||!!c,onReconnect:()=>{A()},onRemove:()=>w(O),onTurnOn:T=>{A({families:[T],accountId:O.id})},personal:o?.includes(O.id),onPersonal:i&&(T=>i(O.id,T))},O.id))}),c?n.jsxs("div",{role:"status",className:"flex flex-wrap items-center gap-3 rounded-lg bg-inset px-3 py-2.5 text-[12.5px] text-ink",children:[n.jsx(je,{size:14,className:"animate-spin text-ink-secondary"}),n.jsx("span",{className:"min-w-0 flex-1",children:l("accounts.waiting",{provider:e.label})}),c.url&&n.jsx("button",{type:"button",onClick:()=>{_l(c.url)},className:"text-ink-secondary hover:text-ink",children:l("accounts.openAgain")}),n.jsx("button",{type:"button",onClick:()=>{R()},className:"rounded-lg px-2 py-1 text-ink-secondary hover:bg-raised/50 hover:text-ink",children:l("common.cancel")}),s&&n.jsx("button",{type:"button",onClick:()=>{R(),s()},className:"rounded-lg px-2 py-1 font-medium text-ink hover:bg-raised/50","data-account-continue-without":!0,children:l("setup.google.continueWithout")})]}):n.jsxs("button",{type:"button",onClick:()=>{A()},disabled:x||N||!t,className:"flex w-fit items-center gap-1.5 rounded-lg bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[x?n.jsx(je,{size:14,className:"animate-spin"}):n.jsx(Sn,{size:14}),e.accounts.length?l("accounts.connectAnother"):l("accounts.connect")]})]}):n.jsx("div",{className:"rounded-lg bg-inset px-3 py-2 text-[12.5px] text-ink-secondary",children:l("accounts.notConfigured")}),g&&n.jsx("p",{role:"status",className:"text-[12px] text-success",children:g}),p&&(s?n.jsxs("div",{role:"alert",className:"flex flex-wrap items-center gap-2 rounded-lg bg-warning/10 px-3 py-2 text-[12.5px] text-ink","data-account-unavailable":!0,children:[n.jsx("span",{className:"min-w-0 flex-1",children:p}),n.jsx("button",{type:"button",onClick:s,className:"rounded-lg bg-accent px-3 py-1.5 text-[12.5px] font-medium text-white",children:l("setup.continue")})]}):n.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:p}))]}),n.jsx(na,{open:k!==null,title:l("accounts.removeTitle",{email:k?.email??""}),body:l("accounts.removeBody"),confirmLabel:l("accounts.remove"),tone:"neutral",onCancel:()=>w(null),onConfirm:()=>{B()}})]})}function gce(){const{dispatch:e}=ke();return n.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border border-hairline/40 px-3 py-2 text-[12.5px] leading-relaxed text-ink-secondary","data-not-the-ai":!0,children:[n.jsx("span",{className:"min-w-0 flex-1 basis-60",children:l("accounts.notTheAi")}),n.jsx("button",{type:"button",onClick:()=>e({type:"toggleAppSettings",open:!0,section:"engines"}),className:"shrink-0 font-medium text-accent hover:underline",children:l("accounts.openSubscriptions")})]})}function fce(){const{status:e,error:t,refresh:a}=LS(),o=M0(),[i,s]=f.useState(""),r=(d,p)=>{s(""),o.set("accounts",d,p).catch(h=>s(h instanceof Error?h.message:String(h)))};if(!e)return t?n.jsx("p",{role:"alert",className:"text-[12.5px] text-danger",children:t}):n.jsx("p",{className:"text-[12.5px] text-ink-secondary",children:l("accounts.loading")});const c=e.storage!=="unavailable";return n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:l("accounts.intro")}),n.jsx(gce,{}),!c&&n.jsx("div",{role:"alert",className:"rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-[12.5px] text-warning",children:l("accounts.storageUnavailable")}),n.jsx("p",{className:"text-[12px] leading-relaxed text-ink-secondary",children:l("owner.connectionsIntro")}),i&&n.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:l("owner.failed",{error:i})}),e.providers.map(d=>d.id==="apple"?n.jsx(pce,{provider:d,onChanged:a,personalIds:o.connections.accounts,onPersonal:r},d.id):n.jsx(DO,{provider:d,storageReady:c,onChanged:a,personalIds:o.connections.accounts,onPersonal:r},d.id))]})}function bce({onConnected:e,onSkip:t,sameAsGemini:a=!1,domain:o=null}){const{status:i,error:s,refresh:r}=LS(),c=i&&{...i,providers:i.providers.filter(b=>b.id!=="apple")},d=(b,x)=>b!=="google"||TR(x,o),p=c?.providers.some(b=>b.accounts.some(x=>d(b.id,x.email)))??!1,h=c?.providers.flatMap(b=>b.accounts.filter(x=>!d(b.id,x.email)))??[];f.useEffect(()=>{p&&e()},[p]);const g=c?.storage!=="unavailable";return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.accounts.intro")}),a&&n.jsx("p",{className:"mt-1.5 text-[13px] font-medium leading-relaxed text-ink",children:o?l("setup.accounts.sameAccountDomain",{domain:o}):l("setup.accounts.sameAccount")}),n.jsx("p",{className:"mt-1.5 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.accounts.perBot")}),h.length>0&&o&&n.jsx("p",{role:"alert",className:"mt-3 rounded-xl border border-danger/25 bg-danger/10 px-3 py-2.5 text-[12.5px] leading-relaxed text-ink",children:l("setup.google.wrongDomain",{domain:o,email:h[0].email})}),n.jsxs("div",{className:"mt-4 flex flex-col gap-3",children:[!c&&(s?n.jsx("p",{role:"alert",className:"text-[12.5px] text-danger",children:l("setup.accounts.loadFailed")}):n.jsx("p",{className:"text-[12.5px] text-ink-secondary",children:l("accounts.loading")})),c?.providers.map(b=>n.jsx(DO,{provider:b,storageReady:g,onChanged:r,onGiveUp:t},b.id))]}),t&&n.jsx("p",{className:"mt-3 text-[12.5px] text-ink-secondary",children:l("setup.accounts.optional")}),n.jsx(Ji,{children:n.jsx("p",{children:l("setup.accounts.what")})})]})}function yce(e){return e.filter(t=>t.kind==="apiKey"&&t.billing==="payPerUse")}function xce({onSaved:e}){const{refreshInstances:t}=ke(),[a,o]=f.useState([]),[i,s]=f.useState(null),[r,c]=f.useState(""),[d,p]=f.useState("entering"),[h,g]=f.useState(null),[b,x]=f.useState([]);f.useEffect(()=>{Z("/api/provider-accounts",{timeoutMs:1e4}).then(({providers:w})=>{const N=yce(w);o(N),x(N.filter(C=>C.accounts.some(j=>j.keyConfigured)).map(C=>C.id))}).catch(()=>o([]))},[]);const v=a.find(w=>w.id===i)??null,k=async()=>{const w=r.trim();if(!(!v||!w)){p("saving"),g(null);try{if(v.keyTest){const N=await Z("/api/keys/test",{method:"POST",body:JSON.stringify({provider:v.keyTest.provider,key:w,...v.keyTest.url?{url:v.keyTest.url}:{}}),timeoutMs:3e4});if(!N.ok){p(N.reason==="rejected"?"rejected":N.reason==="unreachable"?"unreachable":"failed");return}}await DS(v,v.label,w),c(""),x(N=>[...new Set([...N,v.id])]),p("tested"),e(),await t().catch(()=>{})}catch(N){g(Xo(N)?null:N instanceof Error?N.message:String(N)),p(Xo(N)?"entering":"failed")}}};return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.apiKeys.intro")}),n.jsx("p",{className:"mt-1.5 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.apiKeys.costs")}),n.jsx("div",{role:"radiogroup","aria-label":l("setup.apiKeys.pick"),className:"mt-4 grid grid-cols-2 gap-2 sm:grid-cols-3",children:a.map(w=>n.jsxs("button",{type:"button",role:"radio","aria-checked":i===w.id,onClick:()=>{s(w.id),c(""),p("entering")},className:V("flex items-center gap-2 rounded-xl border px-3 py-2.5 text-left text-[13px] transition-colors",i===w.id?"border-accent bg-accent/10 text-ink":"border-hairline/50 bg-card text-ink-secondary hover:bg-raised/40"),children:[w.icon?n.jsx(Rg,{preset:w.icon,size:18}):n.jsx(Nd,{driverKind:w.driver,size:18}),n.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-ink",children:w.label}),b.includes(w.id)&&n.jsx("span",{className:"text-[11px] text-success",children:l("setup.apiKeys.saved")})]},w.id))}),v&&n.jsx(jO,{name:v.label,phase:d,value:r,onChange:w=>{c(w),d!=="saving"&&p("entering")},onSave:()=>{k()},keyUrl:v.keyUrl,error:h}),n.jsxs(Ji,{children:[n.jsx("p",{children:l("setup.apiKeys.what1")}),n.jsx("p",{children:l("setup.apiKeys.what2")})]})]})}const AM="atomic-engine";function vce(e,t,a=null){return e?t?t.snapshot.state==="available"?"ready":a?.kind==="engine-install"&&a.state==="running"?"installing":a?.kind==="engine-install"&&a.state==="failed"?"installFailed":t.install?.managed?"installable":"notInstalled":"absent":"checking"}function kce({phase:e,chibitek:t,checking:a,onCheck:o,onInstall:i,job:s,downloadBytes:r}){return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.atomicEngine.intro")}),n.jsxs("div",{className:"mt-4 rounded-xl border border-hairline/40 bg-card p-3.5","data-phase":e,children:[e==="checking"&&n.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[n.jsx(je,{size:14,className:"animate-spin","aria-hidden":"true"}),l("setup.atomicEngine.checking")]}),e==="ready"&&n.jsx(ud,{children:l("setup.atomicEngine.ready")}),e==="installable"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:l("setup.atomicEngine.installIntro",{size:u3(r??0)})}),n.jsxs("button",{type:"button",onClick:i,className:V(Ka,"mt-3 w-full"),children:[n.jsx(ga,{size:14,"aria-hidden":"true"}),l("setup.atomicEngine.install")]})]}),e==="installing"&&n.jsxs(n.Fragment,{children:[n.jsx(qi,{label:l("setup.atomicEngine.installing")}),n.jsx(jd,{detail:s?.detail})]}),e==="installFailed"&&n.jsx(Ra,{message:zl(s),detail:s?.detail,onRetry:i}),(e==="notInstalled"||e==="absent")&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"inline-flex rounded-full bg-raised px-2 py-0.5 text-[11px] font-medium text-ink-secondary",children:l("setup.optional")}),n.jsx("p",{className:"mt-2 text-[13px] leading-relaxed text-ink",children:l("setup.atomicEngine.notYet")}),n.jsx("p",{className:"mt-1.5 text-[12.5px] leading-relaxed text-ink-secondary",children:l(t?"setup.atomicEngine.askChibitek":"setup.atomicEngine.others")}),e==="notInstalled"&&n.jsxs("button",{type:"button",onClick:o,disabled:a,className:`${Ga} mt-3`,children:[n.jsx(vn,{size:13,className:a?"animate-spin":"","aria-hidden":"true"}),l(a?"common.checking":"common.checkAgain")]})]})]}),n.jsx(Ji,{children:n.jsx("p",{children:l("setup.atomicEngine.what")})})]})}function wce({chibitek:e,onReady:t}){const{state:a,refreshInstances:o}=ke(),[i,s]=f.useState(a.instances.length>0),[r,c]=f.useState(!1),{job:d,start:p}=Br(()=>{o().catch(()=>{})}),h=a.instances.find(x=>x.instanceId===AM),g=vce(i,h,d),b=()=>{c(!0),o().catch(()=>{}).finally(()=>{c(!1),s(!0)})};return f.useEffect(b,[]),f.useEffect(()=>{g==="ready"&&t()},[g]),n.jsx(kce,{phase:g,chibitek:e,checking:r,onCheck:b,onInstall:()=>{p("engine-install",AM)},job:d,downloadBytes:h?.install?.managed?.downloadBytes})}function Sce({chibi:e,connected:t,items:a}){const o=a.filter(i=>i.status!=="done");return n.jsxs("div",{className:"flex flex-col",children:[n.jsxs("div",{className:"rounded-xl border border-hairline/40 bg-card px-3.5 py-3",children:[n.jsx("div",{className:"text-[11.5px] font-semibold uppercase tracking-wide text-ink-secondary",children:l("setup.chibi.connectedTitle")}),t.length?n.jsx("ul",{className:"mt-1.5 space-y-1",children:t.map(i=>n.jsxs("li",{className:"flex items-center gap-2 text-[13px] text-ink",children:[n.jsx(cs,{size:14,className:"shrink-0 text-success","aria-hidden":"true"}),i]},i))}):n.jsx("p",{className:"mt-1.5 text-[13px] leading-relaxed text-ink",children:l("setup.chibi.nothingConnected")}),o.length>0&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"mt-3 text-[11.5px] font-semibold uppercase tracking-wide text-ink-secondary",children:l("setup.chibi.laterTitle")}),n.jsx("ul",{className:"mt-1.5 space-y-1",children:o.map(i=>n.jsxs("li",{className:"flex items-center gap-2 text-[12.5px] text-ink-secondary",children:[i.status==="skipped"?n.jsx(bE,{size:13,"aria-hidden":"true"}):n.jsx(fE,{size:13,"aria-hidden":"true"}),dx(i.screen)]},i.key))}),n.jsx("p",{className:"mt-2 text-[12px] text-ink-secondary",children:l("setup.chibi.laterHint")})]})]}),n.jsxs("div",{className:"mt-4 flex items-center gap-4 rounded-xl border border-hairline/40 bg-card p-3.5",children:[e&&n.jsx(Zt,{bot:e,state:"happy",size:56}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-[14px] font-semibold text-ink",children:l("setup.chibi.meet")}),n.jsx("p",{className:"mt-0.5 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.chibi.intro")})]})]})]})}function Cce({podman:e,wantsLocal:t,download:a,machine:o,onChooseLocal:i,onLater:s,onDownload:r,onCheck:c,onStart:d}){return t?e?e.platform!=="darwin"||!["arm64","x64"].includes(e.arch)?n.jsx("p",{className:"mt-4 rounded-xl border border-hairline/40 bg-card p-3.5 text-[13px] leading-relaxed text-ink",children:l("setup.computers.unsupported")}):n.jsxs("div",{className:"mt-4 rounded-xl border border-hairline/40 bg-card p-3.5","data-podman":e.installed?e.running?"running":"installed":"missing",children:[!e.installed&&a?.state!=="running"&&a?.state!=="succeeded"&&a?.state!=="failed"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:l("setup.computers.podmanIntro")}),n.jsxs("button",{type:"button",onClick:r,className:V(Ka,"mt-3 w-full"),children:[n.jsx(ga,{size:14,"aria-hidden":"true"}),l("setup.computers.download")]}),n.jsx("p",{className:"mt-1.5 text-center text-[11px] text-ink-secondary",children:l("setup.computers.downloadNote")})]}),a?.state==="running"&&n.jsxs(n.Fragment,{children:[n.jsx(qi,{label:l(a.phase==="downloading"?"setup.computers.phase.downloading":a.phase==="verifying"?"setup.computers.phase.verifying":"setup.computers.phase.opening"),received:a.received,total:a.total}),n.jsx(jd,{detail:a.detail})]}),!e.installed&&a?.state==="succeeded"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:l("setup.computers.finishInstaller")}),n.jsxs("button",{type:"button",onClick:c,className:V(Ga,"mt-3"),children:[n.jsx(vn,{size:13,"aria-hidden":"true"}),l("setup.computers.installedCheck")]}),n.jsx("button",{type:"button",onClick:r,className:V(Ga,"mt-3 ml-2"),children:l("setup.computers.reopenInstaller")})]}),!e.installed&&a?.state==="failed"&&n.jsx(Ra,{message:zl(a),detail:a.detail,onRetry:r}),e.installed&&!e.running&&o?.state!=="running"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:l("setup.computers.startIntro")}),n.jsx("button",{type:"button",onClick:d,className:V(Ka,"mt-3 w-full"),children:l("setup.computers.start")}),o?.state==="failed"&&n.jsx(Ra,{message:zl(o),detail:o.detail,onRetry:d})]}),o?.state==="running"&&n.jsx(qi,{label:l("setup.computers.starting")}),e.installed&&e.running&&n.jsx(ud,{children:l("setup.computers.ready")})]}):n.jsx(qi,{label:l("setup.computers.checking")}):n.jsxs("div",{className:"mt-4 grid gap-2 sm:grid-cols-2",children:[n.jsxs("button",{type:"button","data-primary":"",onClick:s,"aria-label":l("setup.computers.later"),"aria-describedby":"computers-later-detail",className:"flex flex-col items-start gap-1.5 rounded-xl border border-accent bg-accent/10 p-3.5 text-left",children:[n.jsx(_s,{size:18,className:"text-ink-secondary","aria-hidden":"true"}),n.jsx("span",{className:"text-[13.5px] font-semibold text-ink",children:l("setup.computers.later")}),n.jsx("span",{id:"computers-later-detail",className:"text-[12px] leading-snug text-ink-secondary",children:l("setup.computers.laterDetail")})]}),n.jsxs("button",{type:"button",onClick:i,"aria-label":l("setup.computers.local"),"aria-describedby":"computers-local-detail",className:"flex flex-col items-start gap-1.5 rounded-xl border border-hairline/50 bg-card p-3.5 text-left hover:bg-raised/40",children:[n.jsx(Ea,{size:18,className:"text-ink-secondary","aria-hidden":"true"}),n.jsx("span",{className:"text-[13.5px] font-semibold text-ink",children:l("setup.computers.local")}),n.jsx("span",{id:"computers-local-detail",className:"text-[12px] leading-snug text-ink-secondary",children:l("setup.computers.localDetail")})]})]})}function OO({onReady:e,onLater:t=()=>{},localOnly:a=!1}){const[o,i]=f.useState(a),[s,r]=f.useState(null),[c,d]=f.useState(null),p=f.useCallback(async()=>{r(null);try{const b=await Z("/api/setup/machine",{timeoutMs:15e3});d({platform:b.platform,arch:b.arch,...b.podman})}catch(b){d(null),r(b instanceof Error?b.message:l("setup.computers.checkFailed"))}},[]),h=Br(()=>{p()}),g=Br(()=>{p()});return f.useEffect(()=>{o&&p()},[o,p]),f.useEffect(()=>{c?.installed&&c.running&&e()},[c?.installed,c?.running]),n.jsxs("div",{className:"flex flex-col",children:[!a&&n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.computers.intro")}),s?n.jsx(Ra,{message:l("setup.computers.checkFailed"),detail:s,onRetry:()=>{p()}}):n.jsx(Cce,{podman:c,wantsLocal:o,download:h.job,machine:g.job,onChooseLocal:()=>i(!0),onLater:t,onDownload:()=>{h.start("podman-download")},onCheck:()=>{p()},onStart:()=>{g.start("podman-machine")}}),h.startError&&n.jsx(Ra,{message:l("setup.computers.downloadFailed"),detail:h.startError,onRetry:()=>{h.start("podman-download")}}),g.startError&&n.jsx(Ra,{message:l("setup.computers.startFailed"),detail:g.startError,onRetry:()=>{g.start("podman-machine")}}),!a&&n.jsx(Ji,{children:n.jsx("p",{children:l("setup.computers.what")})})]})}const jce=[{tag:"gemma4:e4b",label:"Gemma 4",sizeGb:6.6,note:"Google's model. Atomic's pick for Macs with 16 GB or more."},{tag:"gemma4:e2b-it-qat",label:"Gemma 4 (small)",sizeGb:4.3,note:"A lighter Gemma 4 for light tasks on 8 GB Macs."},{tag:"qwen3:4b",label:"Qwen 3 (4B)",sizeGb:2.5,note:"Small and quick. Good for simple tasks."},{tag:"qwen3:8b",label:"Qwen 3 (8B)",sizeGb:5.2,note:"A good everyday model for most Macs."},{tag:"llama3.1:8b",label:"Llama 3.1 (8B)",sizeGb:4.9,note:"Meta's general model. Steady with tools."},{tag:"granite3.3:8b",label:"Granite 3.3 (8B)",sizeGb:4.9,note:"IBM's business-focused model."},{tag:"qwen3:14b",label:"Qwen 3 (14B)",sizeGb:9.3,note:"Noticeably smarter. Needs 16 GB or more."},{tag:"gpt-oss:20b",label:"gpt-oss (20B)",sizeGb:14,note:"OpenAI's open model. Strong reasoning."},{tag:"devstral:24b",label:"Devstral (24B)",sizeGb:14,note:"Mistral's model for coding work."},{tag:"mistral-small3.2:24b",label:"Mistral Small 3.2 (24B)",sizeGb:15,note:"Mistral's general model."},{tag:"qwen3-coder:30b",label:"Qwen 3 Coder (30B)",sizeGb:19,note:"Built for coding and tools. Fast for its size."},{tag:"qwen3:32b",label:"Qwen 3 (32B)",sizeGb:20,note:"Qwen's largest dense model."},{tag:"gpt-oss:120b",label:"gpt-oss (120B)",sizeGb:65,note:"OpenAI's large open model. Needs 96 GB or more."}],w3=1024**3;function Nce(e,t){return!(t>0)||e*1.25+6*w3<=t?"fits":e+3*w3<=t?"tight":"tooBig"}function Ace(e){return Math.round(e.sizeGb*w3)}const Mce=/^[a-z0-9][a-z0-9._/-]*(?::[a-z0-9][a-z0-9._-]*)?$/i;function Ice(e){return typeof e=="string"&&e.length<=200&&Mce.test(e)&&!e.includes("..")&&!e.includes("//")}function Pce(e){return e.enabled?e.custom?"settings.localModels.memory.statusCustom":e.applied?"settings.localModels.memory.statusOn":"settings.localModels.memory.statusFailed":"settings.localModels.memory.statusOff"}function Tce(){const e=typeof window<"u"?window.ogb?.ollamaMemory:void 0,[t,a]=f.useState(null),[o,i]=f.useState(!1);if(f.useEffect(()=>{if(!e)return;let r=!1;return e.state().then(c=>{r||a(c)}).catch(()=>{}),()=>{r=!0}},[e]),!e||!t?.supported)return null;const s=Pce(t);return n.jsx("div",{className:"mt-4 border-t border-hairline/30 pt-1",children:n.jsx(Jt,{title:l("settings.localModels.memory.title"),subtitle:l("settings.localModels.memory.subtitle"),message:n.jsx("span",{className:s==="settings.localModels.memory.statusFailed"?"text-danger":"text-ink-secondary",children:l(s)}),children:n.jsx(Tt,{checked:t.enabled,disabled:o,"aria-label":l("settings.localModels.memory.title"),onClick:()=>{i(!0),e.set(!t.enabled).then(a).catch(()=>{}).finally(()=>i(!1))},className:"disabled:cursor-wait disabled:opacity-50"})})})}function Bce({state:e,onDone:t}){const{job:a,start:o}=Br(t);return a?.state==="running"?n.jsx("div",{className:"basis-full",children:n.jsx(qi,{label:l(a.kind==="ollama-start"?"setup.localAi.phase.starting":"setup.localAi.phase.installing"),received:a.received,total:a.total})}):n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:()=>{o(e==="missing"?"ollama-install":"ollama-start")},className:"text-[12px] font-medium text-accent hover:underline",children:l(e==="missing"?"setup.localAi.installOllama":"setup.localAi.openOllama")}),a?.state==="failed"&&n.jsx("div",{className:"basis-full",children:n.jsx(Ra,{message:zl(a),detail:a.detail})})]})}const S3=1024**3,ip="rounded-lg border border-hairline/40 px-3 py-1.5 text-[12px] text-ink-secondary hover:bg-raised/50 hover:text-ink disabled:cursor-not-allowed disabled:opacity-50",Ece="min-w-0 flex-1 rounded-lg border border-hairline/40 bg-inset px-3 py-2 text-[13px] text-ink placeholder:text-ink-secondary focus:border-hairline focus:outline-none disabled:opacity-50";function bx(e){return e>=S3?`${(e/S3).toFixed(1)} GB`:`${Math.max(1,Math.round(e/1024**2))} MB`}function Rce(e){const t=e.modifiedAt?new Date(e.modifiedAt):null;return[e.parameterSize,e.quantization,e.family,e.cloud?void 0:bx(e.sizeBytes),t&&!Number.isNaN(t.getTime())?t.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}):void 0].filter(Boolean).join(" · ")}function Dce(e){return e.total?Math.min(100,Math.round((e.completed??0)/e.total*100)):null}const Oce={fits:"settings.localModels.fit.fits",tight:"settings.localModels.fit.tight",tooBig:"settings.localModels.fit.tooBig"};function zce(e,t){const a=[];for(const o of t){if(o.snapshot.state!=="available"||o.policy||o.readOnly)continue;const i=o.models.options.find(s=>s.id===`ollama::${e}`||s.id===`local_ollama::${e}`);i&&a.push({instance:o,modelId:i.id})}return a}async function zO(e,t){const a=e.getReader(),o=new TextDecoder;let i="";for(;;){const{value:s,done:r}=await a.read();i+=r?`${o.decode()}
|
|
88
88
|
`:o.decode(s,{stream:!0});let c=i.indexOf(`
|
|
89
89
|
`);for(;c>=0;){const d=i.slice(0,c).trim();if(i=i.slice(c+1),d)try{t(JSON.parse(d))}catch{}c=i.indexOf(`
|
|
90
90
|
`)}if(r)return}}function Lce({model:e}){const{state:t,dispatch:a}=ke(),[o,i]=f.useState(!1),[s,r]=f.useState(""),[c,d]=f.useState(""),[p,h]=f.useState(null),g=zce(e.name,t.instances),b=t.bots;if(!o)return n.jsx("button",{type:"button",onClick:()=>{i(!0),h(null)},className:ip,children:l("settings.localModels.useForBot")});const x=g.find(k=>k.instance.instanceId===c)??g[0],v=b.find(k=>k.id===s)??b[0];return n.jsxs("div",{className:"mt-2 flex w-full flex-col gap-2 rounded-xl border border-hairline/40 p-3",children:[g.length===0||b.length===0?n.jsx("p",{className:"text-[12px] leading-relaxed text-ink-secondary",children:b.length===0?l("settings.localModels.useNoBots"):l("settings.localModels.useNoEngine")}):n.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[12px] text-ink-secondary",children:[n.jsxs("label",{className:"flex items-center gap-1.5",children:[l("settings.localModels.useBot"),n.jsx("select",{value:v?.id??"",onChange:k=>r(k.target.value),className:"rounded-lg border border-hairline/40 bg-inset px-2 py-1.5 text-[12px] text-ink",children:b.map(k=>n.jsx("option",{value:k.id,children:k.name},k.id))})]}),n.jsxs("label",{className:"flex items-center gap-1.5",children:[l("settings.localModels.useEngine"),n.jsx("select",{value:x?.instance.instanceId??"",onChange:k=>d(k.target.value),className:"rounded-lg border border-hairline/40 bg-inset px-2 py-1.5 text-[12px] text-ink",children:g.map(k=>n.jsx("option",{value:k.instance.instanceId,children:k.instance.displayName},k.instance.instanceId))})]}),n.jsx("button",{type:"button",disabled:!v||!x,onClick:()=>{!v||!x||(a({type:"setModel",botId:v.id,selection:{instanceId:x.instance.instanceId,model:x.modelId}}),h(l("settings.localModels.useDone",{bot:v.name,model:e.name})))},className:"rounded-lg bg-raised px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover disabled:opacity-50",children:l("settings.localModels.useConfirm")})]}),p&&n.jsx("p",{role:"status",className:"text-[12px] text-success",children:p}),n.jsx("button",{type:"button",onClick:()=>i(!1),className:"w-fit text-[12px] text-ink-secondary hover:text-ink",children:l("common.close")})]})}function _ce({model:e,onRemove:t,busy:a}){const o=e.usedBy.map(i=>i.name).join(", ");return n.jsxs("li",{className:"border-t border-hairline/30 py-2.5 first:border-t-0","data-local-model":e.name,children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1.5",children:[n.jsx("span",{className:"min-w-0 break-all font-mono text-[13px] text-ink",children:e.name}),e.cloud&&n.jsx("span",{className:"rounded bg-control px-1.5 py-0.5 text-[10.5px] font-medium text-ink-secondary",children:l("settings.localModels.cloud")}),n.jsx("span",{className:"flex-1"}),n.jsx(Lce,{model:e}),n.jsx("button",{type:"button",onClick:t,disabled:a||e.usedBy.length>0,title:e.usedBy.length?l("settings.localModels.removeInUse"):void 0,className:V(ip,"text-danger hover:text-danger"),children:l("settings.localModels.remove")})]}),n.jsx("p",{className:"mt-0.5 text-[12px] text-ink-secondary",children:Rce(e)}),n.jsx("p",{className:"mt-0.5 text-[12px] text-ink-secondary",children:o?l("settings.localModels.usedBy",{names:o}):l("settings.localModels.unused")})]})}function Fce({pull:e,onCancel:t}){const a=Dce(e),o=!e.done&&!e.error;return n.jsxs("div",{className:"mt-3 rounded-xl border border-hairline/40 p-3","aria-live":"polite",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[12.5px] text-ink",children:[o&&n.jsx(je,{size:13,className:"animate-spin text-ink-secondary"}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.done?l("settings.localModels.pullDone",{name:e.name}):e.error?l("settings.localModels.pullFailed",{name:e.name}):l("settings.localModels.pulling",{name:e.name})}),o&&n.jsx("button",{type:"button",onClick:t,className:ip,children:l("common.cancel")})]}),o&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"mt-2 h-1.5 overflow-hidden rounded-full bg-control",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":a??void 0,"aria-label":l("settings.localModels.pulling",{name:e.name}),children:n.jsx("div",{className:"h-full rounded-full bg-accent transition-[width] motion-reduce:transition-none",style:{width:`${a??0}%`}})}),n.jsx("p",{className:"mt-1 text-[11.5px] text-ink-secondary",children:a===null?e.status:l("settings.localModels.pullProgress",{percent:String(a),done:bx(e.completed??0),total:bx(e.total??0)})})]}),e.error&&n.jsx("p",{role:"alert",className:"mt-1 text-[12px] text-danger",children:e.error})]})}function qce({listing:e,pulling:t,onPull:a}){const[o,i]=f.useState(""),s=new Set(e.ollama.models.map(c=>c.name)),r=Ice(o.trim());return n.jsxs("div",{className:"mt-3 rounded-xl border border-hairline/40 p-3",children:[n.jsx("p",{className:"text-[12px] leading-relaxed text-ink-secondary",children:e.memoryBytes>0?l("settings.localModels.getIntroMemory",{memory:`${Math.round(e.memoryBytes/S3)} GB`}):l("settings.localModels.getIntro")}),n.jsx("ul",{className:"mt-2",children:jce.map(c=>{const d=Nce(Ace(c),e.memoryBytes),p=s.has(c.tag);return n.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 border-t border-hairline/30 py-2 first:border-t-0","data-suggested-model":c.tag,children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"text-[13px] text-ink",children:[c.label," ",n.jsx("span",{className:"font-mono text-[12px] text-ink-secondary",children:c.tag})]}),n.jsxs("div",{className:"text-[12px] text-ink-secondary",children:[l("settings.localModels.about",{size:`${c.sizeGb} GB`})," · ",c.note]})]}),n.jsx("span",{className:V("text-[11.5px]",d==="fits"?"text-success":d==="tight"?"text-warning":"text-danger"),children:l(Oce[d])}),n.jsx("button",{type:"button",disabled:t||p,onClick:()=>a(c.tag),className:V(ip,"flex items-center gap-1.5"),children:p?l("settings.localModels.installed"):n.jsxs(n.Fragment,{children:[n.jsx(ga,{size:12}),l("settings.localModels.download")]})})]},c.tag)})}),n.jsxs("form",{className:"mt-3 flex gap-2",onSubmit:c=>{c.preventDefault(),!(!r||t)&&(a(o.trim()),i(""))},children:[n.jsx("input",{value:o,onChange:c=>i(c.target.value),placeholder:l("settings.localModels.customPlaceholder"),"aria-label":l("settings.localModels.customLabel"),autoComplete:"off",spellCheck:!1,disabled:t,className:Ece}),n.jsxs("button",{type:"submit",disabled:t||!r,className:V(ip,"flex shrink-0 items-center gap-1.5"),children:[n.jsx(ga,{size:12}),l("settings.localModels.download")]})]}),n.jsxs("a",{href:"https://ollama.com/search?c=tools",target:"_blank",rel:"noopener noreferrer",className:"mt-2 inline-flex items-center gap-1 text-[12px] text-accent hover:underline",children:[l("settings.localModels.browseOllama"),n.jsx(Mn,{size:11,"aria-hidden":"true"})]})]})}function Uce({listing:e,loadError:t,pull:a,removing:o,onRefresh:i,onPull:s,onCancelPull:r,onRemove:c}){const[d,p]=f.useState(!1),h=e?.ollama,g=!!(a&&!a.done&&!a.error);return n.jsxs(lt,{title:l("settings.localModels.title"),subtitle:l("settings.localModels.subtitle"),children:[n.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2 text-[12.5px]",children:[n.jsx("span",{className:V("size-1.5 rounded-full",h?.state==="running"?"bg-success":"bg-raised-hover")}),n.jsx("span",{className:"min-w-0 flex-1 text-ink-secondary",children:e?h?.state==="running"?h.version?l("settings.localModels.runningVersion",{version:h.version}):l("settings.localModels.running"):h?.state==="stopped"?l("settings.localModels.stopped"):l("settings.localModels.missing"):t??l("settings.localModels.checking")}),(h?.state==="missing"||h?.state==="stopped")&&n.jsx(Bce,{state:h.state,onDone:i}),n.jsx("button",{type:"button",onClick:i,className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised hover:text-ink","aria-label":l("settings.localModels.refresh"),title:l("settings.localModels.refresh"),children:n.jsx(vn,{size:14})})]}),h?.error&&n.jsx("p",{role:"alert",className:"mt-1 text-[12px] text-danger",children:h.error}),h?.state==="running"&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"mt-3 text-[11.5px] font-medium uppercase tracking-wide text-ink-secondary",children:l("settings.localModels.installedTitle")}),h.models.length===0?n.jsx("p",{className:"mt-1 text-[12.5px] text-ink-secondary",children:l("settings.localModels.none")}):n.jsx("ul",{className:"mt-1",children:h.models.map(b=>n.jsx(_ce,{model:b,busy:o===b.name,onRemove:()=>c(b)},b.name))}),a&&n.jsx(Fce,{pull:a,onCancel:r}),n.jsxs("button",{type:"button",onClick:()=>p(!d),"aria-expanded":d,className:V(ip,"mt-3 flex items-center gap-1.5"),children:[n.jsx(ga,{size:13}),l("settings.localModels.getModels")]}),d&&e&&n.jsx(qce,{listing:e,pulling:g,onPull:s})]}),e&&e.others.length>0&&n.jsxs("div",{className:"mt-4",children:[n.jsx("div",{className:"text-[11.5px] font-medium uppercase tracking-wide text-ink-secondary",children:l("settings.localModels.othersTitle")}),e.others.map(b=>n.jsxs("p",{className:"mt-1 text-[12.5px] text-ink-secondary",children:[n.jsx("span",{className:"font-medium text-ink",children:b.label}),": ",b.models.join(", ")]},b.label))]}),n.jsx(Tce,{})]})}function Vce(){const{refreshInstances:e}=ke(),[t,a]=f.useState(null),[o,i]=f.useState(null),[s,r]=f.useState(null),[c,d]=f.useState(null),[p,h]=f.useState(null),[g,b]=f.useState(null),x=f.useRef(null),v=f.useCallback(async()=>{try{a(await Z("/api/local-models")),i(null)}catch(N){i(N instanceof Error?N.message:String(N))}},[]);f.useEffect(()=>{v()},[v]),f.useEffect(()=>()=>x.current?.abort(),[]);const k=async N=>{if(x.current)return;const C=new AbortController;x.current=C,r({name:N,status:""});try{const j=await fetch("/api/local-models/pull",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:N}),signal:C.signal});if(!j.ok||!j.body){const E=await j.json().catch(()=>({}));throw new Error(E.error??`${j.status} ${j.statusText}`)}let M={name:N,status:""};await zO(j.body,E=>{M={name:N,status:typeof E.status=="string"?E.status:M.status,total:typeof E.total=="number"?E.total:M.total,completed:typeof E.completed=="number"?E.completed:M.completed,...typeof E.error=="string"?{error:E.error}:{},...E.done===!0?{done:!0}:{}},r(M)}),!M.done&&!M.error&&r({...M,error:l("settings.localModels.pullStopped")}),M.done&&await Promise.all([v(),Promise.resolve(e()).catch(()=>{})])}catch(j){C.signal.aborted?r(null):r({name:N,status:"",error:j instanceof Error?j.message:String(j)})}finally{x.current=null}},w=async N=>{h(null),d(N.name),b(null);try{await Z(`/api/local-models?name=${encodeURIComponent(N.name)}`,{method:"DELETE"}),await Promise.all([v(),Promise.resolve(e()).catch(()=>{})])}catch(C){b(C instanceof Error?C.message:String(C))}finally{d(null)}};return n.jsxs(n.Fragment,{children:[n.jsx(Uce,{listing:t,loadError:o,pull:s,removing:c,onRefresh:()=>{v()},onPull:N=>{k(N)},onCancelPull:()=>x.current?.abort(),onRemove:N=>h(N)}),g&&n.jsx("p",{role:"alert",className:"-mt-2 px-1 text-[12px] text-danger",children:g}),n.jsx(na,{open:p!==null,title:l("settings.localModels.removeTitle",{name:p?.name??""}),body:p?.cloud?l("settings.localModels.removeCloudBody"):l("settings.localModels.removeBody",{size:bx(p?.sizeBytes??0)}),confirmLabel:l("settings.localModels.remove"),onCancel:()=>h(null),onConfirm:()=>{p&&w(p)}})]})}function Hce({machine:e,backupFor:t=null,appleIntelligence:a=!1,installed:o,tools:i,ollamaJob:s,pull:r,onInstallOllama:c,onStartOllama:d,onCheck:p,onDownload:h,onCancelDownload:g}){if(!e)return n.jsx(qi,{label:l("setup.localAi.checking")});const b=n.jsxs(n.Fragment,{children:[t&&n.jsx("p",{className:"mt-3 text-[13px] leading-relaxed text-ink",children:l("setup.localAi.backupFor",{plan:t})}),a&&e.platform==="darwin"&&n.jsx("p",{className:"mt-2 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.localAi.appleIntelligence")})]}),x=e.localModel,v=Math.round(e.memoryBytes/1024**3);if(x.kind==="none")return n.jsxs(n.Fragment,{children:[b,n.jsxs("div",{className:"mt-4 rounded-xl border border-hairline/40 bg-card p-3.5",children:[n.jsx("span",{className:"inline-flex rounded-full bg-raised px-2 py-0.5 text-[11px] font-medium text-ink-secondary",children:l("setup.optional")}),n.jsx("p",{className:"mt-2 text-[13px] leading-relaxed text-ink",children:x.reason==="intel"?l("setup.localAi.intel"):l("setup.localAi.lowMemory",{gb:v})})]})]});const k=s?.state==="running",w=x.model,N=r&&r.error===void 0&&!r.cancelled&&!(r.total&&r.received===r.total);return n.jsxs(n.Fragment,{children:[b,n.jsxs("div",{className:"mt-4 space-y-3",children:[n.jsxs("div",{className:"rounded-xl border border-hairline/40 bg-card p-3.5","data-ollama":e.ollama,children:[n.jsx("div",{className:"text-[12px] font-semibold uppercase tracking-wide text-ink-secondary",children:l("setup.localAi.ollamaTitle")}),e.ollama==="running"&&n.jsx(ud,{children:l("setup.localAi.ollamaReady")}),e.ollama==="stopped"&&s?.state!=="running"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"mt-1.5 text-[13px] leading-relaxed text-ink",children:l("setup.localAi.ollamaStopped")}),n.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[n.jsx("button",{type:"button",onClick:d,className:Ka,children:l("setup.localAi.openOllama")}),n.jsxs("button",{type:"button",onClick:p,className:Ga,children:[n.jsx(vn,{size:13,"aria-hidden":"true"}),l("common.checkAgain")]})]}),s?.kind==="ollama-start"&&s.state==="failed"&&n.jsx(Ra,{message:zl(s),detail:s.detail,onRetry:d})]}),e.ollama==="missing"&&!k&&s?.state!=="failed"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"mt-1.5 text-[13px] leading-relaxed text-ink",children:l("setup.localAi.ollamaMissing")}),n.jsxs("button",{type:"button",onClick:c,className:V(Ka,"mt-3 w-full"),children:[n.jsx(ga,{size:14,"aria-hidden":"true"}),l("setup.localAi.installOllama")]}),n.jsx("p",{className:"mt-1.5 text-center text-[11px] text-ink-secondary",children:l("setup.localAi.installOllamaNote")})]}),k&&n.jsxs(n.Fragment,{children:[n.jsx(qi,{label:l(s.kind==="ollama-start"?"setup.localAi.phase.starting":s.phase==="downloading"?"setup.localAi.phase.downloading":s.phase==="verifying"?"setup.localAi.phase.verifying":s.phase==="starting"?"setup.localAi.phase.starting":"setup.localAi.phase.installing"),received:s.received,total:s.total}),n.jsx(jd,{detail:s.detail})]}),e.ollama==="missing"&&s?.state==="failed"&&n.jsx(Ra,{message:zl(s),detail:s.detail,onRetry:c})]}),n.jsxs("div",{className:V("rounded-xl border border-hairline/40 bg-card p-3.5",e.ollama!=="running"&&"opacity-60"),"data-model":w.tag,children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-inset text-ink-secondary",children:n.jsx(vE,{size:18,"aria-hidden":"true"})}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("p",{className:"text-[13.5px] font-semibold text-ink",children:x.kind==="default"?l("setup.localAi.recommendDefault",{gb:v}):l("setup.localAi.recommendOptional",{gb:v})}),n.jsx("p",{className:"mt-0.5 text-[12.5px] leading-relaxed text-ink-secondary",children:l(x.kind==="default"?"setup.localAi.modelLine":"setup.localAi.modelLineLight",{name:w.label,size:String(w.sizeGb)})})]})]}),o?n.jsxs(n.Fragment,{children:[n.jsx(ud,{children:l("setup.localAi.modelReady",{name:w.label})}),i===!1&&n.jsx("p",{className:"mt-1.5 text-[12px] text-ink-secondary",children:l("setup.localAi.chatOnly")})]}):N?n.jsxs(n.Fragment,{children:[n.jsx(qi,{label:l("setup.localAi.downloadingModel",{name:w.label}),received:r.received,total:r.total}),n.jsx("button",{type:"button",onClick:g,className:V(Ga,"mt-2"),children:l("common.cancel")})]}):n.jsxs(n.Fragment,{children:[n.jsxs("button",{type:"button",disabled:e.ollama!=="running",onClick:h,className:V(x.kind==="default"?Ka:Ga,"mt-3 w-full"),children:[n.jsx(ga,{size:14,"aria-hidden":"true"}),l("setup.localAi.download",{name:w.label,size:String(w.sizeGb)})]}),r?.cancelled&&n.jsx("p",{className:"mt-1.5 text-[12px] text-ink-secondary",children:l("setup.localAi.cancelled")}),r?.error&&n.jsx(Ra,{message:l("setup.localAi.pullFailed"),detail:r.error,onRetry:h})]})]})]})]})}function $ce({onReady:e,backupFor:t=null}){const{state:a,refreshInstances:o}=ke(),i=a.instances.some(j=>j.driverKind==="appleIntelligence"&&j.snapshot.state==="available"),[s,r]=f.useState(null),[c,d]=f.useState(null),[p,h]=f.useState(null),[g,b]=f.useState(null),x=f.useRef(null),v=f.useCallback(async()=>{const[j,M]=await Promise.all([Z("/api/setup/machine",{timeoutMs:15e3}).catch(()=>null),Z("/api/local-models",{timeoutMs:15e3}).catch(()=>null)]);j&&r(j),d(M)},[]);f.useEffect(()=>(v(),()=>x.current?.abort()),[v]);const k=Br(()=>{v()}),w=s&&s.localModel.kind!=="none"?s.localModel.model.tag:null,N=!!(w&&c?.ollama.models.some(j=>j.name===w));f.useEffect(()=>{!N||!w||(e(),Z(`/api/setup/model-capabilities?name=${encodeURIComponent(w)}`,{timeoutMs:1e4}).then(j=>h(j.tools)).catch(()=>h(null)))},[N,w]);const C=async()=>{if(!w)return;x.current?.abort();const j=new AbortController;x.current=j,b({});try{const M=await fetch("/api/local-models/pull",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:w}),signal:j.signal});if(!M.ok||!M.body){const A=await M.json().catch(()=>({}));b({error:A.error??`${M.status}`});return}let E;await zO(M.body,A=>{typeof A.error=="string"?E=A.error:typeof A.total=="number"&&b({total:A.total,received:typeof A.completed=="number"?A.completed:0})}),E?b({error:E}):(b(null),await v(),await o().catch(()=>{}))}catch(M){j.signal.aborted?b({cancelled:!0}):b({error:M instanceof Error?M.message:String(M)})}};return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.localAi.intro")}),n.jsx(Hce,{backupFor:t,appleIntelligence:i,machine:s&&c?{...s,ollama:c.ollama.state}:s,installed:N,tools:p,ollamaJob:k.job,pull:g,onInstallOllama:()=>{k.start("ollama-install")},onStartOllama:()=>{k.start("ollama-start")},onCheck:()=>{v()},onDownload:()=>{C()},onCancelDownload:()=>x.current?.abort()}),n.jsxs(Ji,{children:[n.jsx("p",{children:l("setup.localAi.what1")}),n.jsx("p",{children:l("setup.localAi.what2")})]})]})}function MM(e){return e==="granted"?"granted":e==="denied"||e==="restricted"?"denied":e==="not-determined"?"not-determined":"unknown"}function IM({pane:e}){const t=l(e==="mic"?"setup.permissions.pictureMic":"setup.permissions.pictureScreen");return n.jsxs("figure",{className:"mt-3",children:[n.jsxs("svg",{viewBox:"0 0 320 150",role:"img","aria-label":t,className:"w-full rounded-lg border border-hairline/40 bg-app",children:[n.jsx("rect",{x:"0",y:"0",width:"320",height:"150",rx:"8",className:"fill-panel"}),n.jsx("rect",{x:"0",y:"0",width:"92",height:"150",rx:"8",className:"fill-inset"}),n.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"#ff5f57"}),n.jsx("circle",{cx:"23",cy:"12",r:"3.5",fill:"#febc2e"}),n.jsx("circle",{cx:"34",cy:"12",r:"3.5",fill:"#28c840"}),n.jsx("text",{x:"10",y:"40",fontSize:"8",className:"fill-ink-secondary",children:l("setup.permissions.pictureGeneral")}),n.jsx("rect",{x:"6",y:"52",width:"80",height:"16",rx:"4",className:"fill-accent",opacity:"0.18"}),n.jsx("text",{x:"10",y:"63",fontSize:"8",fontWeight:"600",className:"fill-ink",children:l("setup.permissions.picturePrivacy")}),n.jsx("text",{x:"10",y:"84",fontSize:"8",className:"fill-ink-secondary",children:l("setup.permissions.pictureNotifications")}),n.jsx("text",{x:"104",y:"24",fontSize:"10",fontWeight:"700",className:"fill-ink",children:l(e==="mic"?"setup.permissions.mic":"setup.permissions.screen")}),[0,1,2].map(a=>n.jsxs("g",{transform:`translate(104 ${40+a*30})`,children:[n.jsx("rect",{width:"204",height:"24",rx:"5",className:a===1?"fill-accent":"fill-inset",opacity:a===1?.12:1}),n.jsx("rect",{x:"8",y:"6",width:"12",height:"12",rx:"3",className:a===1?"fill-accent":"fill-hairline"}),n.jsx("text",{x:"26",y:"16",fontSize:"8.5",fontWeight:a===1?700:400,className:"fill-ink",children:a===1?"Atomic":a===0?"Notes":"Zoom"}),n.jsx("rect",{x:"172",y:"6",width:"22",height:"12",rx:"6",fill:a===1?"#34c759":"#8e8e93",opacity:a===1?1:.4}),n.jsx("circle",{cx:a===1?188:178,cy:"12",r:"5",fill:"#fff"})]},a)),n.jsx("circle",{cx:"287",cy:"82",r:"15",fill:"none",stroke:"#ff3b30",strokeWidth:"2"})]}),n.jsx("figcaption",{className:"mt-1.5 text-[11.5px] leading-relaxed text-ink-secondary",children:l(e==="mic"?"setup.permissions.captionMic":"setup.permissions.captionScreen")})]})}function Gce({mic:e,why:t,onWhy:a,onAllowMic:o,onOpenSettings:i,screenOpened:s}){return n.jsxs("div",{className:"mt-4 flex flex-col gap-3",children:[n.jsxs("div",{className:"rounded-xl border border-hairline/40 bg-card p-3.5","data-permission":"mic","data-status":e,children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(Tg,{size:18,className:"mt-0.5 shrink-0 text-ink-secondary","aria-hidden":"true"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[14px] font-semibold text-ink",children:[l("setup.permissions.mic"),e==="granted"&&n.jsx(mt,{size:15,className:"text-success","aria-label":l("setup.permissions.on")})]}),n.jsx("p",{className:"mt-0.5 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.permissions.micWhy")})]})]}),e!=="granted"&&t!=="mic"&&e!=="denied"&&n.jsx("button",{type:"button",onClick:()=>a("mic"),className:V(Ga,"mt-3"),children:l("setup.permissions.turnOn")}),t==="mic"&&e==="not-determined"&&n.jsxs("div",{className:"mt-3 rounded-lg bg-inset p-3",children:[n.jsx("p",{className:"text-[12.5px] leading-relaxed text-ink",children:l("setup.permissions.micBeforeAsk")}),n.jsx("button",{type:"button",onClick:o,className:V(Ka,"mt-2.5"),children:l("setup.permissions.askMac")})]}),(e==="denied"||t==="mic"&&e==="unknown")&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"mt-3 text-[12.5px] leading-relaxed text-ink",children:l("setup.permissions.micDenied")}),n.jsx(IM,{pane:"mic"}),n.jsxs("button",{type:"button",onClick:()=>i("mic"),className:V(Ka,"mt-2.5"),children:[n.jsx(Yh,{size:14,"aria-hidden":"true"}),l("setup.permissions.openSettings")]})]})]}),n.jsxs("div",{className:"rounded-xl border border-hairline/40 bg-card p-3.5","data-permission":"screen",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(GY,{size:18,className:"mt-0.5 shrink-0 text-ink-secondary","aria-hidden":"true"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-[14px] font-semibold text-ink",children:l("setup.permissions.screen")}),n.jsx("p",{className:"mt-0.5 text-[12.5px] leading-relaxed text-ink-secondary",children:l("setup.permissions.screenWhy")})]})]}),t!=="screen"?n.jsx("button",{type:"button",onClick:()=>a("screen"),className:V(Ga,"mt-3"),children:l("setup.permissions.turnOn")}):n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"mt-3 text-[12.5px] leading-relaxed text-ink",children:l("setup.permissions.screenHow")}),n.jsx(IM,{pane:"screen"}),n.jsxs("button",{type:"button",onClick:()=>i("screen"),className:V(Ka,"mt-2.5"),children:[n.jsx(Yh,{size:14,"aria-hidden":"true"}),l("setup.permissions.openSettings")]}),s&&n.jsx("p",{role:"status",className:"mt-2 text-[12px] text-ink-secondary",children:l("setup.permissions.screenAfter")})]})]})]})}function Kce({onGranted:e}){const[t,a]=f.useState("unknown"),[o,i]=f.useState(null),[s,r]=f.useState(!1);return f.useEffect(()=>{const c=()=>window.ogb?.permStatus?.().then(p=>a(MM(p.mic))).catch(()=>{});c();const d=window.setInterval(c,2e3);return()=>window.clearInterval(d)},[]),f.useEffect(()=>{t==="granted"&&e()},[t]),n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.permissions.intro")}),n.jsx(Gce,{mic:t,why:o,onWhy:i,onAllowMic:()=>{window.ogb?.permRequestMic?.().then(()=>window.ogb?.permStatus?.().then(c=>a(MM(c.mic))))},onOpenSettings:c=>{window.ogb?.permOpenSettings?.(c),c==="screen"&&r(!0)},screenOpened:s}),n.jsx(Ji,{children:n.jsx("p",{children:l("setup.permissions.what")})})]})}function Wce({className:e}){return n.jsxs("div",{className:V("relative",e),"aria-hidden":"true",children:[n.jsx("div",{className:"absolute inset-x-6 bottom-2 top-6 rounded-[40px] bg-accent/20 blur-2xl"}),n.jsx("div",{className:"relative mx-auto w-[168px] rounded-[30px] border border-hairline/60 bg-panel p-[6px] shadow-[0_28px_60px_-24px_rgba(0,0,0,0.6),0_1px_0_rgba(255,255,255,0.06)_inset]",children:n.jsxs("div",{className:"overflow-hidden rounded-[24px] bg-app",children:[n.jsxs("div",{className:"relative flex h-7 items-center justify-between px-4 text-[8px] font-medium tabular-nums text-ink",children:[n.jsx("span",{children:"9:41"}),n.jsx("span",{className:"absolute left-1/2 top-1.5 h-3.5 w-12 -translate-x-1/2 rounded-full bg-panel"}),n.jsx("span",{className:"flex items-center gap-0.5",children:n.jsx("span",{className:"h-1.5 w-2.5 rounded-[2px] border border-ink/70"})})]}),n.jsxs("div",{className:"flex items-center gap-1.5 border-b border-hairline/40 px-3 py-1.5",children:[n.jsx(ra,{color:"green",state:"happy",size:16,animated:!1,trackPointer:!1}),n.jsx("span",{className:"text-[9.5px] font-semibold text-ink",children:"Chibi"}),n.jsx("span",{className:"ml-auto size-1.5 rounded-full bg-success"})]}),n.jsxs("div",{className:"flex flex-col gap-1.5 px-2.5 py-2.5",children:[n.jsx("div",{className:"max-w-[112px] self-end rounded-xl rounded-br-sm bg-bubble-user px-2 py-1.5 text-[8.5px] leading-snug text-ink",children:"Book the 3 pm slot"}),n.jsx("div",{className:"max-w-[124px] rounded-xl rounded-tl-sm bg-card px-2 py-1.5 text-[8.5px] leading-snug text-ink",children:"Found it. Confirm the booking?"}),n.jsxs("div",{className:"rounded-lg border border-hairline/50 bg-card p-2",children:[n.jsx("div",{className:"text-[8px] font-medium text-ink",children:"Run: book-slot"}),n.jsx("div",{className:"mt-0.5 text-[7.5px] text-ink-secondary",children:"clinic.example · 3:00 pm"}),n.jsxs("div",{className:"mt-1.5 flex gap-1",children:[n.jsxs("span",{className:"flex flex-1 items-center justify-center gap-0.5 rounded-md bg-accent py-1 text-[8px] font-semibold text-white",children:[n.jsx(mt,{size:8,strokeWidth:3})," Allow"]}),n.jsxs("span",{className:"flex flex-1 items-center justify-center gap-0.5 rounded-md bg-raised py-1 text-[8px] font-medium text-ink",children:[n.jsx(jt,{size:8,strokeWidth:3})," Deny"]})]})]})]}),n.jsxs("div",{className:"mx-2.5 mb-2.5 rounded-full border border-hairline/40 bg-inset px-2.5 py-1.5 text-[8px] text-ink-secondary",children:["Message ",Wa().name==="Atomic"?"Chibi":Wa().name]})]})})]})}var Jce=Object.defineProperty,yx=Object.getOwnPropertySymbols,LO=Object.prototype.hasOwnProperty,_O=Object.prototype.propertyIsEnumerable,PM=(e,t,a)=>t in e?Jce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,C3=(e,t)=>{for(var a in t||(t={}))LO.call(t,a)&&PM(e,a,t[a]);if(yx)for(var a of yx(t))_O.call(t,a)&&PM(e,a,t[a]);return e},j3=(e,t)=>{var a={};for(var o in e)LO.call(e,o)&&t.indexOf(o)<0&&(a[o]=e[o]);if(e!=null&&yx)for(var o of yx(e))t.indexOf(o)<0&&_O.call(e,o)&&(a[o]=e[o]);return a};var fd;(e=>{const t=class cn{constructor(d,p,h,g){if(this.version=d,this.errorCorrectionLevel=p,this.modules=[],this.isFunction=[],d<cn.MIN_VERSION||d>cn.MAX_VERSION)throw new RangeError("Version value out of range");if(g<-1||g>7)throw new RangeError("Mask value out of range");this.size=d*4+17;let b=[];for(let v=0;v<this.size;v++)b.push(!1);for(let v=0;v<this.size;v++)this.modules.push(b.slice()),this.isFunction.push(b.slice());this.drawFunctionPatterns();const x=this.addEccAndInterleave(h);if(this.drawCodewords(x),g==-1){let v=1e9;for(let k=0;k<8;k++){this.applyMask(k),this.drawFormatBits(k);const w=this.getPenaltyScore();w<v&&(g=k,v=w),this.applyMask(k)}}i(0<=g&&g<=7),this.mask=g,this.applyMask(g),this.drawFormatBits(g),this.isFunction=[]}static encodeText(d,p){const h=e.QrSegment.makeSegments(d);return cn.encodeSegments(h,p)}static encodeBinary(d,p){const h=e.QrSegment.makeBytes(d);return cn.encodeSegments([h],p)}static encodeSegments(d,p,h=1,g=40,b=-1,x=!0){if(!(cn.MIN_VERSION<=h&&h<=g&&g<=cn.MAX_VERSION)||b<-1||b>7)throw new RangeError("Invalid value");let v,k;for(v=h;;v++){const j=cn.getNumDataCodewords(v,p)*8,M=r.getTotalBits(d,v);if(M<=j){k=M;break}if(v>=g)throw new RangeError("Data too long")}for(const j of[cn.Ecc.MEDIUM,cn.Ecc.QUARTILE,cn.Ecc.HIGH])x&&k<=cn.getNumDataCodewords(v,j)*8&&(p=j);let w=[];for(const j of d){a(j.mode.modeBits,4,w),a(j.numChars,j.mode.numCharCountBits(v),w);for(const M of j.getData())w.push(M)}i(w.length==k);const N=cn.getNumDataCodewords(v,p)*8;i(w.length<=N),a(0,Math.min(4,N-w.length),w),a(0,(8-w.length%8)%8,w),i(w.length%8==0);for(let j=236;w.length<N;j^=253)a(j,8,w);let C=[];for(;C.length*8<w.length;)C.push(0);return w.forEach((j,M)=>C[M>>>3]|=j<<7-(M&7)),new cn(v,p,C,b)}getModule(d,p){return 0<=d&&d<this.size&&0<=p&&p<this.size&&this.modules[p][d]}getModules(){return this.modules}drawFunctionPatterns(){for(let h=0;h<this.size;h++)this.setFunctionModule(6,h,h%2==0),this.setFunctionModule(h,6,h%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const d=this.getAlignmentPatternPositions(),p=d.length;for(let h=0;h<p;h++)for(let g=0;g<p;g++)h==0&&g==0||h==0&&g==p-1||h==p-1&&g==0||this.drawAlignmentPattern(d[h],d[g]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(d){const p=this.errorCorrectionLevel.formatBits<<3|d;let h=p;for(let b=0;b<10;b++)h=h<<1^(h>>>9)*1335;const g=(p<<10|h)^21522;i(g>>>15==0);for(let b=0;b<=5;b++)this.setFunctionModule(8,b,o(g,b));this.setFunctionModule(8,7,o(g,6)),this.setFunctionModule(8,8,o(g,7)),this.setFunctionModule(7,8,o(g,8));for(let b=9;b<15;b++)this.setFunctionModule(14-b,8,o(g,b));for(let b=0;b<8;b++)this.setFunctionModule(this.size-1-b,8,o(g,b));for(let b=8;b<15;b++)this.setFunctionModule(8,this.size-15+b,o(g,b));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let d=this.version;for(let h=0;h<12;h++)d=d<<1^(d>>>11)*7973;const p=this.version<<12|d;i(p>>>18==0);for(let h=0;h<18;h++){const g=o(p,h),b=this.size-11+h%3,x=Math.floor(h/3);this.setFunctionModule(b,x,g),this.setFunctionModule(x,b,g)}}drawFinderPattern(d,p){for(let h=-4;h<=4;h++)for(let g=-4;g<=4;g++){const b=Math.max(Math.abs(g),Math.abs(h)),x=d+g,v=p+h;0<=x&&x<this.size&&0<=v&&v<this.size&&this.setFunctionModule(x,v,b!=2&&b!=4)}}drawAlignmentPattern(d,p){for(let h=-2;h<=2;h++)for(let g=-2;g<=2;g++)this.setFunctionModule(d+g,p+h,Math.max(Math.abs(g),Math.abs(h))!=1)}setFunctionModule(d,p,h){this.modules[p][d]=h,this.isFunction[p][d]=!0}addEccAndInterleave(d){const p=this.version,h=this.errorCorrectionLevel;if(d.length!=cn.getNumDataCodewords(p,h))throw new RangeError("Invalid argument");const g=cn.NUM_ERROR_CORRECTION_BLOCKS[h.ordinal][p],b=cn.ECC_CODEWORDS_PER_BLOCK[h.ordinal][p],x=Math.floor(cn.getNumRawDataModules(p)/8),v=g-x%g,k=Math.floor(x/g);let w=[];const N=cn.reedSolomonComputeDivisor(b);for(let j=0,M=0;j<g;j++){let E=d.slice(M,M+k-b+(j<v?0:1));M+=E.length;const A=cn.reedSolomonComputeRemainder(E,N);j<v&&E.push(0),w.push(E.concat(A))}let C=[];for(let j=0;j<w[0].length;j++)w.forEach((M,E)=>{(j!=k-b||E>=v)&&C.push(M[j])});return i(C.length==x),C}drawCodewords(d){if(d.length!=Math.floor(cn.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let p=0;for(let h=this.size-1;h>=1;h-=2){h==6&&(h=5);for(let g=0;g<this.size;g++)for(let b=0;b<2;b++){const x=h-b,k=(h+1&2)==0?this.size-1-g:g;!this.isFunction[k][x]&&p<d.length*8&&(this.modules[k][x]=o(d[p>>>3],7-(p&7)),p++)}}i(p==d.length*8)}applyMask(d){if(d<0||d>7)throw new RangeError("Mask value out of range");for(let p=0;p<this.size;p++)for(let h=0;h<this.size;h++){let g;switch(d){case 0:g=(h+p)%2==0;break;case 1:g=p%2==0;break;case 2:g=h%3==0;break;case 3:g=(h+p)%3==0;break;case 4:g=(Math.floor(h/3)+Math.floor(p/2))%2==0;break;case 5:g=h*p%2+h*p%3==0;break;case 6:g=(h*p%2+h*p%3)%2==0;break;case 7:g=((h+p)%2+h*p%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[p][h]&&g&&(this.modules[p][h]=!this.modules[p][h])}}getPenaltyScore(){let d=0;for(let b=0;b<this.size;b++){let x=!1,v=0,k=[0,0,0,0,0,0,0];for(let w=0;w<this.size;w++)this.modules[b][w]==x?(v++,v==5?d+=cn.PENALTY_N1:v>5&&d++):(this.finderPenaltyAddHistory(v,k),x||(d+=this.finderPenaltyCountPatterns(k)*cn.PENALTY_N3),x=this.modules[b][w],v=1);d+=this.finderPenaltyTerminateAndCount(x,v,k)*cn.PENALTY_N3}for(let b=0;b<this.size;b++){let x=!1,v=0,k=[0,0,0,0,0,0,0];for(let w=0;w<this.size;w++)this.modules[w][b]==x?(v++,v==5?d+=cn.PENALTY_N1:v>5&&d++):(this.finderPenaltyAddHistory(v,k),x||(d+=this.finderPenaltyCountPatterns(k)*cn.PENALTY_N3),x=this.modules[w][b],v=1);d+=this.finderPenaltyTerminateAndCount(x,v,k)*cn.PENALTY_N3}for(let b=0;b<this.size-1;b++)for(let x=0;x<this.size-1;x++){const v=this.modules[b][x];v==this.modules[b][x+1]&&v==this.modules[b+1][x]&&v==this.modules[b+1][x+1]&&(d+=cn.PENALTY_N2)}let p=0;for(const b of this.modules)p=b.reduce((x,v)=>x+(v?1:0),p);const h=this.size*this.size,g=Math.ceil(Math.abs(p*20-h*10)/h)-1;return i(0<=g&&g<=9),d+=g*cn.PENALTY_N4,i(0<=d&&d<=2568888),d}getAlignmentPatternPositions(){if(this.version==1)return[];{const d=Math.floor(this.version/7)+2,p=this.version==32?26:Math.ceil((this.version*4+4)/(d*2-2))*2;let h=[6];for(let g=this.size-7;h.length<d;g-=p)h.splice(1,0,g);return h}}static getNumRawDataModules(d){if(d<cn.MIN_VERSION||d>cn.MAX_VERSION)throw new RangeError("Version number out of range");let p=(16*d+128)*d+64;if(d>=2){const h=Math.floor(d/7)+2;p-=(25*h-10)*h-55,d>=7&&(p-=36)}return i(208<=p&&p<=29648),p}static getNumDataCodewords(d,p){return Math.floor(cn.getNumRawDataModules(d)/8)-cn.ECC_CODEWORDS_PER_BLOCK[p.ordinal][d]*cn.NUM_ERROR_CORRECTION_BLOCKS[p.ordinal][d]}static reedSolomonComputeDivisor(d){if(d<1||d>255)throw new RangeError("Degree out of range");let p=[];for(let g=0;g<d-1;g++)p.push(0);p.push(1);let h=1;for(let g=0;g<d;g++){for(let b=0;b<p.length;b++)p[b]=cn.reedSolomonMultiply(p[b],h),b+1<p.length&&(p[b]^=p[b+1]);h=cn.reedSolomonMultiply(h,2)}return p}static reedSolomonComputeRemainder(d,p){let h=p.map(g=>0);for(const g of d){const b=g^h.shift();h.push(0),p.forEach((x,v)=>h[v]^=cn.reedSolomonMultiply(x,b))}return h}static reedSolomonMultiply(d,p){if(d>>>8||p>>>8)throw new RangeError("Byte out of range");let h=0;for(let g=7;g>=0;g--)h=h<<1^(h>>>7)*285,h^=(p>>>g&1)*d;return i(h>>>8==0),h}finderPenaltyCountPatterns(d){const p=d[1];i(p<=this.size*3);const h=p>0&&d[2]==p&&d[3]==p*3&&d[4]==p&&d[5]==p;return(h&&d[0]>=p*4&&d[6]>=p?1:0)+(h&&d[6]>=p*4&&d[0]>=p?1:0)}finderPenaltyTerminateAndCount(d,p,h){return d&&(this.finderPenaltyAddHistory(p,h),p=0),p+=this.size,this.finderPenaltyAddHistory(p,h),this.finderPenaltyCountPatterns(h)}finderPenaltyAddHistory(d,p){p[0]==0&&(d+=this.size),p.pop(),p.unshift(d)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function a(c,d,p){if(d<0||d>31||c>>>d)throw new RangeError("Value out of range");for(let h=d-1;h>=0;h--)p.push(c>>>h&1)}function o(c,d){return(c>>>d&1)!=0}function i(c){if(!c)throw new Error("Assertion error")}const s=class ha{constructor(d,p,h){if(this.mode=d,this.numChars=p,this.bitData=h,p<0)throw new RangeError("Invalid argument");this.bitData=h.slice()}static makeBytes(d){let p=[];for(const h of d)a(h,8,p);return new ha(ha.Mode.BYTE,d.length,p)}static makeNumeric(d){if(!ha.isNumeric(d))throw new RangeError("String contains non-numeric characters");let p=[];for(let h=0;h<d.length;){const g=Math.min(d.length-h,3);a(parseInt(d.substring(h,h+g),10),g*3+1,p),h+=g}return new ha(ha.Mode.NUMERIC,d.length,p)}static makeAlphanumeric(d){if(!ha.isAlphanumeric(d))throw new RangeError("String contains unencodable characters in alphanumeric mode");let p=[],h;for(h=0;h+2<=d.length;h+=2){let g=ha.ALPHANUMERIC_CHARSET.indexOf(d.charAt(h))*45;g+=ha.ALPHANUMERIC_CHARSET.indexOf(d.charAt(h+1)),a(g,11,p)}return h<d.length&&a(ha.ALPHANUMERIC_CHARSET.indexOf(d.charAt(h)),6,p),new ha(ha.Mode.ALPHANUMERIC,d.length,p)}static makeSegments(d){return d==""?[]:ha.isNumeric(d)?[ha.makeNumeric(d)]:ha.isAlphanumeric(d)?[ha.makeAlphanumeric(d)]:[ha.makeBytes(ha.toUtf8ByteArray(d))]}static makeEci(d){let p=[];if(d<0)throw new RangeError("ECI assignment value out of range");if(d<128)a(d,8,p);else if(d<16384)a(2,2,p),a(d,14,p);else if(d<1e6)a(6,3,p),a(d,21,p);else throw new RangeError("ECI assignment value out of range");return new ha(ha.Mode.ECI,0,p)}static isNumeric(d){return ha.NUMERIC_REGEX.test(d)}static isAlphanumeric(d){return ha.ALPHANUMERIC_REGEX.test(d)}getData(){return this.bitData.slice()}static getTotalBits(d,p){let h=0;for(const g of d){const b=g.mode.numCharCountBits(p);if(g.numChars>=1<<b)return 1/0;h+=4+b+g.bitData.length}return h}static toUtf8ByteArray(d){d=encodeURI(d);let p=[];for(let h=0;h<d.length;h++)d.charAt(h)!="%"?p.push(d.charCodeAt(h)):(p.push(parseInt(d.substring(h+1,h+3),16)),h+=2);return p}};s.NUMERIC_REGEX=/^[0-9]*$/,s.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,s.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let r=s;e.QrSegment=s})(fd||(fd={}));(e=>{(t=>{const a=class{constructor(i,s){this.ordinal=i,this.formatBits=s}};a.LOW=new a(0,1),a.MEDIUM=new a(1,0),a.QUARTILE=new a(2,3),a.HIGH=new a(3,2),t.Ecc=a})(e.QrCode||(e.QrCode={}))})(fd||(fd={}));(e=>{(t=>{const a=class{constructor(i,s){this.modeBits=i,this.numBitsCharCount=s}numCharCountBits(i){return this.numBitsCharCount[Math.floor((i+7)/17)]}};a.NUMERIC=new a(1,[10,12,14]),a.ALPHANUMERIC=new a(2,[9,11,13]),a.BYTE=new a(4,[8,16,16]),a.KANJI=new a(8,[8,10,12]),a.ECI=new a(7,[0,0,0]),t.Mode=a})(e.QrSegment||(e.QrSegment={}))})(fd||(fd={}));var Eu=fd;var Yce={L:Eu.QrCode.Ecc.LOW,M:Eu.QrCode.Ecc.MEDIUM,Q:Eu.QrCode.Ecc.QUARTILE,H:Eu.QrCode.Ecc.HIGH},FO=128,qO="L",UO="#FFFFFF",VO="#000000",HO=!1,$O=1,Zce=4,Qce=0,Xce=.1;function GO(e,t=0){const a=[];return e.forEach(function(o,i){let s=null;o.forEach(function(r,c){if(!r&&s!==null){a.push(`M${s+t} ${i+t}h${c-s}v1H${s+t}z`),s=null;return}if(c===o.length-1){if(!r)return;s===null?a.push(`M${c+t},${i+t} h1v1H${c+t}z`):a.push(`M${s+t},${i+t} h${c+1-s}v1H${s+t}z`);return}r&&s===null&&(s=c)})}),a.join("")}function KO(e,t){return e.slice().map((a,o)=>o<t.y||o>=t.y+t.h?a:a.map((i,s)=>s<t.x||s>=t.x+t.w?i:!1))}function ede(e,t,a,o){if(o==null)return null;const i=e.length+a*2,s=Math.floor(t*Xce),r=i/t,c=(o.width||s)*r,d=(o.height||s)*r,p=o.x==null?e.length/2-c/2:o.x*r,h=o.y==null?e.length/2-d/2:o.y*r,g=o.opacity==null?1:o.opacity;let b=null;if(o.excavate){let v=Math.floor(p),k=Math.floor(h),w=Math.ceil(c+p-v),N=Math.ceil(d+h-k);b={x:v,y:k,w,h:N}}const x=o.crossOrigin;return{x:p,y:h,h:d,w:c,excavation:b,opacity:g,crossOrigin:x}}function tde(e,t){return t!=null?Math.max(Math.floor(t),0):e?Zce:Qce}function WO({value:e,level:t,minVersion:a,includeMargin:o,marginSize:i,imageSettings:s,size:r,boostLevel:c}){let d=ka.useMemo(()=>{const v=(Array.isArray(e)?e:[e]).reduce((k,w)=>(k.push(...Eu.QrSegment.makeSegments(w)),k),[]);return Eu.QrCode.encodeSegments(v,Yce[t],a,void 0,void 0,c)},[e,t,a,c]);const{cells:p,margin:h,numCells:g,calculatedImageSettings:b}=ka.useMemo(()=>{let x=d.getModules();const v=tde(o,i),k=x.length+v*2,w=ede(x,r,v,s);return{cells:x,margin:v,numCells:k,calculatedImageSettings:w}},[d,r,s,o,i]);return{qrcode:d,margin:h,cells:p,numCells:g,calculatedImageSettings:b}}var nde=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),ade=ka.forwardRef(function(t,a){const o=t,{value:i,size:s=FO,level:r=qO,bgColor:c=UO,fgColor:d=VO,includeMargin:p=HO,minVersion:h=$O,boostLevel:g,marginSize:b,imageSettings:x}=o,k=j3(o,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:w}=k,N=j3(k,["style"]),C=x?.src,j=ka.useRef(null),M=ka.useRef(null),E=ka.useCallback(G=>{j.current=G,typeof a=="function"?a(G):a&&(a.current=G)},[a]),[A,R]=ka.useState(!1),{margin:B,cells:O,numCells:T,calculatedImageSettings:z}=WO({value:i,level:r,minVersion:h,boostLevel:g,includeMargin:p,marginSize:b,imageSettings:x,size:s});ka.useEffect(()=>{if(j.current!=null){const G=j.current,H=G.getContext("2d");if(!H)return;let $=O;const U=M.current,Q=z!=null&&U!==null&&U.complete&&U.naturalHeight!==0&&U.naturalWidth!==0;Q&&z.excavation!=null&&($=KO(O,z.excavation));const W=window.devicePixelRatio||1;G.height=G.width=s*W;const q=s/T*W;H.scale(q,q),H.fillStyle=c,H.fillRect(0,0,T,T),H.fillStyle=d,nde?H.fill(new Path2D(GO($,B))):O.forEach(function(Y,ae){Y.forEach(function(F,pe){F&&H.fillRect(pe+B,ae+B,1,1)})}),z&&(H.globalAlpha=z.opacity),Q&&H.drawImage(U,z.x+B,z.y+B,z.w,z.h)}}),ka.useEffect(()=>{R(!1)},[C]);const P=C3({height:s,width:s},w);let L=null;return C!=null&&(L=ka.createElement("img",{src:C,key:C,style:{display:"none"},onLoad:()=>{R(!0)},ref:M,crossOrigin:z?.crossOrigin})),ka.createElement(ka.Fragment,null,ka.createElement("canvas",C3({style:P,height:s,width:s,ref:E,role:"img"},N)),L)});ade.displayName="QRCodeCanvas";var _S=ka.forwardRef(function(t,a){const o=t,{value:i,size:s=FO,level:r=qO,bgColor:c=UO,fgColor:d=VO,includeMargin:p=HO,minVersion:h=$O,boostLevel:g,title:b,marginSize:x,imageSettings:v}=o,k=j3(o,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:w,cells:N,numCells:C,calculatedImageSettings:j}=WO({value:i,level:r,minVersion:h,boostLevel:g,includeMargin:p,marginSize:x,imageSettings:v,size:s});let M=N,E=null;v!=null&&j!=null&&(j.excavation!=null&&(M=KO(N,j.excavation)),E=ka.createElement("image",{href:v.src,height:j.h,width:j.w,x:j.x+w,y:j.y+w,preserveAspectRatio:"none",opacity:j.opacity,crossOrigin:j.crossOrigin}));const A=GO(M,w);return ka.createElement("svg",C3({height:s,width:s,viewBox:`0 0 ${C} ${C}`,ref:a,role:"img"},k),!!b&&ka.createElement("title",null,b),ka.createElement("path",{fill:c,d:`M0,0 h${C}v${C}H0z`,shapeRendering:"crispEdges"}),ka.createElement("path",{fill:d,d:A,shapeRendering:"crispEdges"}),E)});_S.displayName="QRCodeSVG";function JO(e){const t=e?.trim().split(".")??[];if(t.length!==4||!t.every(i=>/^\d{1,3}$/.test(i)&&Number(i)<=255))return!1;const[a,o]=t.map(Number);return a===100&&o>=64&&o<=127}function N3(e){return/^chibi:\/\/pair\?\S+$/i.test(e?.trim()??"")}const YO=8,ode=new Set(["hosted","tailnet","lan","bonjour"]);function Fc(e){const t=new Set,a=[];for(const o of e??[])if(!(!o||!ode.has(o.kind)||!Number.isInteger(o.priority)||o.priority<0||o.priority>1e6))try{const i=new URL(o.url),s=o.kind==="hosted"?"https:":"http:",r=i.port?Number(i.port):null,c=i.hostname.toLowerCase().replace(/\.$/,"");if(i.protocol!==s||o.kind==="tailnet"&&!c.endsWith(".ts.net")||r!==null&&(!Number.isInteger(r)||r<1||r>65535)||i.username||i.password||i.pathname!=="/"||i.search||i.hash||t.has(i.origin))continue;t.add(i.origin),a.push({url:i.origin,kind:o.kind,priority:o.priority})}catch{}return a.sort((o,i)=>o.priority-i.priority).slice(0,YO)}const cw=e=>{const t=new Set,a=[];for(const o of e){const i=o.trim();!i||t.has(i)||(t.add(i),a.push(i))}return a},TM=(e,t)=>`http://${e.includes(":")&&!e.startsWith("[")?`[${e}]`:e}:${t}`;function Ty(e,t){if(t==="automatic"){const g=Fc(e.endpoints).filter(w=>w.kind==="hosted"),b=g[0]??null;if(!b)return null;const x=new URL(b.url),v=x.hostname,k=x.port?Number(x.port):443;return{address:v,port:k,hosts:cw([v,...g.map(w=>new URL(w.url).hostname)]),endpoints:g}}const a=Fc(e.endpoints);if(t==="tailscale"){let g=a.find(N=>N.kind==="tailnet")??null;if(!g&&e.tailnetName?.trim()&&(g=Fc([{url:TM(e.tailnetName.trim(),e.port),kind:"tailnet",priority:0}])[0]??null),!g)return null;const b=new URL(g.url),x=b.hostname,v=b.port?Number(b.port):80,k=a.filter(N=>N.url!==g.url&&["hosted","tailnet"].includes(N.kind)),w=[g,...k].map((N,C)=>({...N,priority:C*100}));return{address:x,port:v,hosts:cw([x,...(e.hosts??[]).filter(N=>N.trim().toLowerCase().replace(/\.$/,"").endsWith(".ts.net"))]),endpoints:w}}let o=a.find(g=>g.kind==="lan")??(e.discovery?.advertising?a.find(g=>g.kind==="bonjour"):null)??null;if(!o){const g=e.lan?.trim()||(e.discovery?.advertising?e.hosts?.find(b=>b.trim().toLowerCase().endsWith(".local")):null);if(!g)return null;o=Fc([{url:TM(g.trim(),e.port),kind:g.trim().toLowerCase().endsWith(".local")?"bonjour":"lan",priority:0}])[0]??null}if(!o)return null;const i=new URL(o.url),s=i.hostname,r=i.port?Number(i.port):80,c=a.filter(g=>g.url!==o.url&&g.kind==="hosted"),d=a.filter(g=>g.url!==o.url&&g.kind==="tailnet"),p=a.filter(g=>g.url!==o.url&&!["hosted","tailnet"].includes(g.kind)),h=[o,...c,...d,...p].map((g,b)=>({...g,priority:b*100}));return{address:s,port:r,hosts:cw([s,...(e.hosts??[]).filter(g=>!g.trim().toLowerCase().replace(/\.$/,"").endsWith(".ts.net"))]),endpoints:h}}function ide(e,t){const a=Ty(e,t);if(!a)return null;const o=Fc(a.endpoints),i=o[0]??null,s=t==="local"?null:t==="tailscale"?o.find(r=>r.kind==="tailnet")??null:i?.kind==="hosted"?i:null;return t!=="local"&&!s?null:{route:{...a,endpoints:o},protectedEndpoint:s}}function sde(e,t){return t.protectedEndpoint?Fc(e.endpoints).some(a=>a.kind===t.protectedEndpoint?.kind&&a.url===t.protectedEndpoint.url):!0}function rde(e){const t=new TextEncoder().encode(JSON.stringify(e));let a="";for(const o of t)a+=String.fromCharCode(o);return btoa(a).replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}function lde(e){if(!e||!/^[A-Za-z0-9_-]{87}$/.test(e))return null;try{const t=e.replaceAll("-","+").replaceAll("_","/")+"=",a=atob(t);if(a.length!==65||a.charCodeAt(0)!==4)return null;let o="";for(let i=0;i<a.length;i+=1)o+=a[i];return btoa(o).replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")===e?e:null}catch{return null}}function cde({address:e,port:t,code:a,token:o,name:i,hosts:s,endpoints:r,secretPublicKey:c,tailnetAddress:d}){const p=e.trim();if(!p||!/^\d{6}$/.test(a)||!/^omb_pair_[A-Za-z0-9_-]{43}$/.test(o)||!Number.isInteger(t)||t<1||t>65535)return null;const h=p.includes(":")&&!p.startsWith("[")?`[${p}]`:p,g=new URL("chibi://pair");g.searchParams.set("address",`${h}:${t}`),g.searchParams.set("token",o),g.searchParams.set("code",a),i?.trim()&&g.searchParams.set("name",i.trim());const b=(s??[]).map(k=>k.trim()).filter(k=>k&&!/[\s/?#,[\]]/.test(k)).slice(0,YO);b.length&&g.searchParams.set("hosts",b.join(","));const x=Fc(r);x.length&&g.searchParams.set("endpoints",rde(x));const v=lde(c);return v&&g.searchParams.set("secretKey",v),d&&JO(d)&&g.searchParams.set("tailnetAddress",d.trim()),g.toString().replace(/\+/g,"%20")}const A3={active:!1,localFallback:!1,tailscaleFallback:!1,baselineDeviceIds:[],pairingAttempted:!1,pairedDeviceName:null,skipped:!1};function dde(e,t){switch(t.type){case"start":case"resume":return{active:!0,localFallback:!1,tailscaleFallback:!1,baselineDeviceIds:[...t.deviceIds],pairingAttempted:!1,pairedDeviceName:null,skipped:!1};case"use-local":return{...e,active:!0,localFallback:!0,tailscaleFallback:!1,pairingAttempted:!1};case"use-tailscale":return{...e,active:!0,localFallback:!1,tailscaleFallback:!0,pairingAttempted:!1};case"pairing-opened":return{...e,baselineDeviceIds:[...t.deviceIds],pairingAttempted:!0};case"paired":return{...e,active:!0,pairedDeviceName:t.deviceName};case"skip":return{...A3,skipped:!0};case"reset":return A3}}const ude=3e4;function pde(e,t){return e.pairedDeviceName?"success":e.active?t.pairingOpen||e.pairingAttempted?"qr":t.provisioningTimedOut?"sign-in":e.localFallback||e.tailscaleFallback?"verifying":t.accountStatus==="signed-out"||t.accountStatus==="unavailable"||t.accountStatus==="error"?"sign-in":(t.accountBusy||t.provisioning,"verifying"):"intro"}async function mde(e,t,a){let o=await(t?a.read():a.start());return t&&!o.enabled&&(a.shouldContinue?.()??!0)&&(o=await a.start()),e==="tailscale"&&o.enabled&&!o.error&&(a.shouldContinue?.()??!0)&&(o=await a.refreshTailscale()),o}const hde=(e,t)=>t?.endpoints?.some(a=>a.kind==="hosted")?"hosted-ready":!e?.available||e.status==="signed-out"||e.status==="error"?"local-only":e.status==="ready"&&!t?.enabled?"hosted-startable":"hosted-connecting";function dw(e,t,a){if(a)return"open";switch(hde(e,t)){case"hosted-ready":return"open";case"hosted-startable":return"start";case"hosted-connecting":return"wait";case"local-only":return"account-required"}}function gde(e,t){const a=new Set(e);return t.find(o=>!a.has(o.id))??null}function fde(e,t){return!e.active||!e.pairingAttempted||e.pairedDeviceName?null:gde(e.baselineDeviceIds,t)}function Tb(e){return e?e.map(t=>t.id):null}function bde(e,t){return e.active&&t.provisioning&&!t.provisioningTimedOut}function yde(e,t){return e.generation===t?!1:(e.generation=t,!0)}function du(e,t){return e.generation!==t?!1:(e.generation=null,!0)}function xde(e,t){return e.active?.generation===t.generation||e.pending?.generation===t.generation?"duplicate":e.active?(e.pending=t,"queued"):(e.active=t,"start")}function vde(e,t){if(e.active?.generation!==t)return null;const a=e.pending;return e.active=a,e.pending=null,a}function Lm(e,t){e.pending?.generation===t&&(e.pending=null)}const kde="Device pairing did not open. Open Advanced & troubleshooting, confirm Remote access is on, then try again.";function wde(e,t=null,a=Date.now()){const o=ZO(e);if(o)return o;const i=e.pairing;return!i||i.token===t||!/^omb_pair_[A-Za-z0-9_-]{43}$/.test(i.token)||!/^\d{6}$/.test(i.code??"")||!Number.isFinite(i.expiresAt)||(i.expiresAt??0)<=a?kde:null}async function Bb(e,t,a,o){const i=e.pairing?.token;if(!i||!o())return!1;let s;try{s=await t()}catch{return!1}if(!o()||s.pairing?.token!==i)return!1;try{return await a(),!0}catch{return!1}}async function Sde(e,t,a){const o=await e();return a()?o:(await t(o).catch(()=>{}),null)}function Cde(e,t,a={set:(o,i)=>setTimeout(o,i),clear:o=>clearTimeout(o)}){let o=!1,i=null;const s=()=>{o||(i=a.set(()=>{Promise.resolve().then(e).catch(()=>{}).finally(s)},t))};return s(),()=>{o=!0,i!==null&&a.clear(i)}}const jde="Remote access could not start. Open Advanced & troubleshooting, then try turning Remote access on again.";function ZO(e){return e.enabled&&!e.error?null:e.error?.trim()||jde}const BM=/\bReference:\s*([0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})\.?/i,Nde=/^Error invoking remote method ['"][^'"\r\n]+['"]:\s*(?:Error:\s*)?/i,Ade=[/^Enter a valid email address\.$/,/^The secure connection request (?:was not accepted|was not allowed)\./,/^That code (?:is not valid|expired)\./,/^Your sign-in expired\./,/^Atomic could not reach its secure connection service\./,/^Too many attempts were made\./,/^This computer was reconnected too often\./,/^This account has reached its computer limit\./,/^This computer is already connected\./,/^The secure connection (?:is still being prepared|service could not finish setup|is still being removed)\./,/^Secure access is not available right now\./,/^The secure connection service (?:had a problem|returned an unexpected response)\./,/^The secure connection request could not be completed\./];function uu(e,t){const a=e instanceof Error?e.message:"",o=a.replace(Nde,"").replace(/^Error:\s*/i,"").trim(),i=o.match(BM)?.[1]??"",s=o.replace(BM,"").trim(),c=!(/remote method ['"]companion-account:request-code['"]/i.test(a)&&s.startsWith("The secure connection request was not allowed."))&&Ade.some(d=>d.test(s))?s:t;return i?l("phone.error.reference",{message:c,reference:i}):c}const Mde=e=>e.length<=3?"…":e.length<10?`${e.slice(0,3)}…`:e.length<17?`${e.slice(0,4)}…${e.slice(-3)}`:`${e.slice(0,10)}…${e.slice(-6)}`;function xx({label:e,value:t}){const[a,o]=f.useState(!1),[i,s]=f.useState(!1),r=f.useRef(null);f.useEffect(()=>()=>{r.current!==null&&window.clearTimeout(r.current)},[]);const c=async()=>{try{await navigator.clipboard.writeText(t),s(!0),r.current!==null&&window.clearTimeout(r.current),r.current=window.setTimeout(()=>s(!1),1200)}catch{}};return n.jsxs("div",{className:"flex items-center gap-3 rounded-lg bg-inset px-3 py-2",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-ink-secondary",children:e}),n.jsx("div",{className:"mt-0.5 truncate font-mono text-[11.5px] text-ink",children:a?t:Mde(t)})]}),n.jsx("button",{onClick:()=>o(d=>!d),className:"shrink-0 rounded px-2 py-1 text-[11px] text-ink-secondary hover:bg-control hover:text-ink",children:a?"Hide":"Reveal"}),n.jsx("button",{onClick:()=>{c()},"aria-label":`Copy ${e}`,className:"shrink-0 rounded p-1.5 text-ink-secondary hover:bg-control hover:text-ink",children:i?n.jsx(mt,{size:13,className:"text-success"}):n.jsx(Xa,{size:13})})]})}function Ide(e,t,a){const o=[];t&&JO(t)&&o.push(`${t.trim()}:${a}`);const i=e?.trim().replace(/\.$/,"");return i&&i.toLowerCase().endsWith(".ts.net")&&o.push(`${i}:${a}`),o}function Pde({link:e,addresses:t}){const[a,o]=f.useState(!1),i=f.useRef(null);f.useEffect(()=>()=>{i.current!==null&&window.clearTimeout(i.current)},[]);const s=async()=>{try{await navigator.clipboard.writeText(e),o(!0),i.current!==null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>o(!1),2e3)}catch{o(!1)}};return n.jsxs("div",{"data-desktop-pairing-link":!0,className:"mt-4 w-full max-w-[390px] rounded-xl border border-hairline/40 px-3 py-3 text-left",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[13px] font-medium text-ink",children:[n.jsx(Ol,{size:15,className:"shrink-0 text-ink-secondary"})," ",l("remote.desktopLink.title")]}),n.jsx("p",{className:"mt-1 text-[11.5px] leading-relaxed text-ink-secondary",children:l("remote.desktopLink.detail")}),n.jsx("code",{className:"mt-2 block max-h-16 select-all overflow-y-auto break-all rounded-lg bg-inset px-2 py-1.5 font-mono text-[11px] text-ink",children:e}),n.jsxs("button",{type:"button",onClick:()=>{s()},className:"mt-2 flex items-center gap-1.5 rounded-lg bg-accent px-3 py-1.5 text-[12.5px] font-medium text-white hover:brightness-110",children:[a?n.jsx(mt,{size:13}):n.jsx(Xa,{size:13}),l(a?"remote.serverPairing.copied":"remote.serverPairing.copyLink")]}),t.length>0&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"mt-3 text-[11.5px] leading-relaxed text-ink-secondary",children:l("remote.desktopLink.manual")}),n.jsx("div",{className:"mt-1.5 flex flex-col gap-1.5",children:t.map(r=>n.jsx(xx,{label:l("phone.code.address"),value:r},r))})]})]})}const EM=()=>l("phone.error.directUnavailable"),RM=()=>l("phone.error.protectedUnavailable"),Rc=()=>globalThis.ogb?.companion??null,_m=()=>globalThis.ogb?.companionAccount??null,Tde=async(e,t)=>{const[a,o]=await Promise.allSettled([e?Promise.resolve().then(()=>e.state()):Promise.resolve(null),t?Promise.resolve().then(()=>t.state()):Promise.resolve(null)]);return{companion:a.status==="fulfilled"?a.value:null,account:o.status==="fulfilled"?o.value:null}},as=async(e,t)=>{e.current+=1;try{return await t()}finally{e.current+=1}},Bde=(e,t)=>e.current===t,Ede=(e,t)=>!e&&!!t.email,QO=(e,t)=>t||(e?.status==="signed-out"?e.message??null:null),Rde=(e,t)=>e?t?"details":"direct":"hidden";function XO(e=""){const[t,a]=f.useState(null),[o,i]=f.useState(null),[s,r]=f.useState(e),[c,d]=f.useState(""),[p,h]=f.useState(!1),[g,b]=f.useState(!1),[x,v]=f.useState(!1),[k,w]=f.useState(!1),[N,C]=f.useState(!1),[j,M]=f.useState(!1),[E,A]=f.useState(null),[R,B]=f.useState(null),[O,T]=f.useState(()=>Date.now()),[z,P]=f.useReducer(dde,A3),L=f.useRef(!1),G=f.useRef({generation:null}),H=f.useRef({active:null,pending:null}),$=f.useRef(async()=>{}),U=f.useRef(null),[Q,W]=f.useState(null),q=f.useRef(0),Y=f.useRef(!0),ae=f.useRef(0),F=f.useRef(null),pe=f.useCallback(Re=>{U.current=Re,W(Re)},[]);f.useEffect(()=>(Y.current=!0,()=>{Y.current=!1,q.current+=1}),[]);const ge=f.useCallback(()=>{if(F.current)return F.current;const Re=ae.current,de=(async()=>{const Ve=await Tde(Rc(),_m());Y.current&&(Ve.companion&&Bde(ae,Re)&&a(Ve.companion),Ve.account&&(i(Ve.account),Ede(L.current,Ve.account)&&r(Ve.account.email??"")))})().finally(()=>{F.current===de&&(F.current=null)});return F.current=de,de},[]);f.useEffect(()=>{ge()},[ge]),f.useEffect(()=>{!L.current&&e&&r(e)},[e]);const Ne=f.useCallback(async Re=>{const de=Rc();if(de){b(!0),A(null);try{const Ve=await as(ae,()=>Re(de));Y.current&&a(Ve)}catch(Ve){Y.current&&A(uu(Ve,l("phone.error.remoteUpdate")))}finally{Y.current&&b(!1)}}},[]),ee=f.useCallback(async Re=>{const de=_m();if(de){w(!0),B(null);try{const Ve=await as(ae,()=>Re(de));if(!Y.current)return;i(Ve),await ge()}catch(Ve){Y.current&&B(uu(Ve,l("phone.error.secureUpdate")))}finally{Y.current&&w(!1)}}},[ge]),X=f.useCallback(async({routeMode:Re,accountOverride:de,generation:Ve})=>{const ce=()=>{du(G.current,Ve)&&Y.current&&v(!1);const We=vde(H.current,Ve);We&&$.current(We)},Le=()=>Y.current&&q.current===Ve;if(!Le()){ce();return}const tt=Rc();if(!tt){Y.current&&q.current===Ve&&A(l("phone.error.desktopOnly")),ce();return}const st=()=>{const We=U.current;return!We||We.generation===Ve},Ae=U.current;Ae&&Ae.generation!==Ve&&(pe(null),a(We=>We?.pairing?.token===Ae.token?{...We,pairing:null}:We)),A(null);try{const We=await mde(Re,!!t?.enabled,{read:()=>tt.state(),start:()=>as(ae,()=>tt.start()),refreshTailscale:()=>as(ae,()=>tt.refreshTailscale()),shouldContinue:Le});if(!Le())return;a(We);const Ie=ZO(We);if(Ie){C(!1),A(Ie),P({type:"reset"});return}const et=Re!=="automatic",gt=dw(de??o,We,et);if(gt!=="open"){C(gt==="wait"||gt==="start");return}if(et&&!Ty(We,Re)){C(!1),A(Re==="tailscale"?l("phone.error.tailscaleUnavailable"):EM()),P({type:"reset"});return}const yt=await Sde(()=>as(ae,()=>tt.pairing(!0)),_n=>Bb(_n,()=>tt.state(),()=>as(ae,()=>tt.pairing(!1,_n.pairing?.token)),st),Le);if(!yt)return;const Mt=yt.pairing,an=wde(yt,We.pairing?.token??null),pn=an?null:ide(yt,Re);if(an||!pn||!Mt){if(await Bb(yt,()=>tt.state(),()=>as(ae,()=>tt.pairing(!1,yt.pairing?.token)),Le),!Le())return;pe(null),a({...yt,pairing:null}),C(!1),A(an??(Re==="local"?EM():Re==="tailscale"?l("phone.error.tailscaleUnavailable"):RM())),P({type:"reset"});return}pe({...pn,generation:Ve,token:Mt.token}),a(yt),C(!1),M(!1),P({type:"pairing-opened",deviceIds:yt.devices.map(_n=>_n.id)})}catch(We){if(!Le())return;pe(null),C(!1),A(uu(We,l("phone.error.pairingPrepare"))),P({type:"reset"})}finally{ce()}},[o,pe,t]);f.useLayoutEffect(()=>{$.current=X},[X]);const oe=f.useCallback((Re,de,Ve=q.current)=>{const ce={routeMode:Re,accountOverride:de,generation:Ve},Le=xde(H.current,ce);Le!=="duplicate"&&(yde(G.current,Ve),v(!0),Le==="start"&&$.current(ce))},[]),ne=f.useCallback(()=>{const Re=Tb(t?.devices??null);if(!Re)return;const de=++q.current;P({type:"start",deviceIds:Re}),A(null),B(null),M(!1),(dw(o,t,!1)==="open"||o?.available&&(o.status==="ready"||o.status==="connecting"))&&(C(!0),oe("automatic",o,de))},[o,oe,t]),Ce=f.useCallback(()=>{const Re=Tb(t?.devices??null);if(!Re)return;z.active||P({type:"start",deviceIds:Re});const de=++q.current;P({type:"use-local"}),C(!0),M(!1),B(null),oe("local",void 0,de)},[z.active,oe,t?.devices]),le=f.useCallback(()=>{const Re=Tb(t?.devices??null);if(!Re)return;z.active||P({type:"start",deviceIds:Re});const de=++q.current;P({type:"use-tailscale"}),C(!0),M(!1),B(null),oe("tailscale",void 0,de)},[z.active,oe,t?.devices]),re=f.useCallback(()=>{Ne(Re=>Re.refreshTailscale())},[Ne]),xe=f.useCallback(()=>{const Re=_m(),de=s.trim().toLowerCase();if(!Re||!de)return;const Ve=q.current;w(!0),B(null),Re.requestCode(de).then(ce=>{!Y.current||q.current!==Ve||(i(ce),h(!0))}).catch(ce=>{!Y.current||q.current!==Ve||B(uu(ce,l("phone.error.sendCode")))}).finally(()=>{Y.current&&q.current===Ve&&w(!1)})},[s]),Te=f.useCallback(()=>{const Re=_m(),de=s.trim().toLowerCase();if(!Re||c.length!==8)return;const Ve=q.current;w(!0),C(!0),M(!1),B(null),as(ae,()=>Re.verifyCode(de,c)).then(async ce=>{!Y.current||q.current!==Ve||(i(ce),d(""),h(!1),await oe("automatic",ce,Ve))}).catch(ce=>{!Y.current||q.current!==Ve||(C(!1),B(uu(ce,l("phone.error.verifyCode"))))}).finally(()=>{Y.current&&q.current===Ve&&w(!1)})},[c,s,oe]),nt=f.useCallback(()=>{const Re=_m();if(!Re)return;const de=z.active?Tb(t?.devices??null):null,Ve=++q.current;de&&P({type:"start",deviceIds:de}),w(!0),C(!0),M(!1),B(null),as(ae,()=>Re.retry()).then(async ce=>{!Y.current||q.current!==Ve||(i(ce),z.active?await oe("automatic",ce,Ve):(await ge(),Y.current&&q.current===Ve&&C(!1)))}).catch(ce=>{!Y.current||q.current!==Ve||(C(!1),B(uu(ce,l("phone.error.restore"))))}).finally(()=>{Y.current&&q.current===Ve&&w(!1)})},[z.active,ge,oe,t?.devices]),be=pde(z,{accountStatus:o?.available?o.status:"unavailable",accountBusy:k,provisioning:N,provisioningTimedOut:j,pairingOpen:!!(t?.pairing&&Q?.token===t.pairing.token)});f.useEffect(()=>{!z.active||z.localFallback||z.tailscaleFallback||!o||o.available&&o.status!=="signed-out"&&o.status!=="error"||C(!1)},[o,z.active,z.localFallback,z.tailscaleFallback]),f.useEffect(()=>{if(!bde(z,{provisioning:N,provisioningTimedOut:j}))return;const Re=window.setTimeout(()=>{const de=q.current;q.current+=1,Lm(H.current,de),du(G.current,de),v(!1),w(!1),C(!1),M(!0)},ude);return()=>window.clearTimeout(Re)},[z,N,j]),f.useEffect(()=>{const Re=Q;if(!Re||!t)return;if(!t.pairing){pe(null);return}const de=t.pairing.token===Re.token,Ve=sde(t,Re);if(de&&Ve)return;const ce=Rc();q.current===Re.generation&&(q.current+=1),Lm(H.current,Re.generation),du(G.current,Re.generation),v(!1),pe(null),a(Le=>Le&&{...Le,pairing:null}),C(!1),M(!1),A(de?RM():l("phone.error.codeChanged")),P({type:"reset"}),de&&ce&&Bb(t,()=>ce.state(),()=>as(ae,()=>ce.pairing(!1,t.pairing?.token)),()=>{const Le=U.current;return!Le||Le.generation===Re.generation})},[Q,pe,t]),f.useEffect(()=>{if(!t)return;const Re=fde(z,t.devices);Re&&P({type:"paired",deviceName:Re.name})},[z,t]),f.useEffect(()=>{!z.active||z.localFallback||z.tailscaleFallback||z.pairingAttempted||j||!t||dw(o,t,!1)!=="open"||oe("automatic")},[o,z.active,z.localFallback,z.pairingAttempted,z.tailscaleFallback,oe,j,t]);const Ye=z.active||!!t?.pairing;f.useEffect(()=>Cde(()=>(T(Date.now()),ge()),Ye?1e3:1e4),[ge,Ye]);const ue=z.localFallback?"local":z.tailscaleFallback?"tailscale":"automatic",we=f.useMemo(()=>t?t.pairing?Q?.token===t.pairing.token?Q.route:null:Ty(t,ue):null,[ue,Q,t]),me=f.useMemo(()=>!t?.pairing||!we?null:cde({...we,code:t.pairing.code,token:t.pairing.token,name:t.discovery?.name,secretPublicKey:t.secretPublicKey,tailnetAddress:we.endpoints?.some(Re=>Re.kind==="tailnet")?t.tailscale:void 0}),[we,t]),$e=f.useCallback(()=>{const Re=q.current;q.current+=1,Lm(H.current,Re),du(G.current,Re),v(!1);const de=t,Ve=Rc();pe(null),a(ce=>ce&&{...ce,pairing:null}),Ve&&de?.pairing&&Bb(de,()=>Ve.state(),()=>as(ae,()=>Ve.pairing(!1,de.pairing?.token)),()=>U.current===null),C(!1),w(!1),M(!1),h(!1),d(""),P({type:"reset"})},[pe,t]);return{state:t,account:o,phase:be,email:s,code:c,codeSent:p,busy:g||x,accountBusy:k,error:E,accountError:R,pairingLink:me,secondsLeft:t?.pairing?Math.max(0,Math.round((t.pairing.expiresAt-O)/1e3)):0,address:we?.address,pairingPort:we?.port??t?.port??8810,hostedReady:!!t?.endpoints?.some(Re=>Re.kind==="hosted"),localFallback:z.localFallback,tailscaleFallback:z.tailscaleFallback,tailscaleAvailable:!!(t&&Ty(t,"tailscale")),pairingExpired:z.pairingAttempted&&!t?.pairing,setupTimedOut:j,setEmail:Re=>{L.current=!0,r(Re)},setCode:Re=>d(Re.replaceAll(/\D/g,"").slice(0,8)),changeEmail:()=>{d(""),h(!1),B(null)},start:ne,useLocal:Ce,useTailscale:le,refreshTailscale:re,requestCode:xe,verifyCode:Te,retryAccount:nt,cancel:$e,refreshCode:()=>{const Re=++q.current;oe(ue,void 0,Re)},finish:()=>{const Re=q.current;q.current+=1,Lm(H.current,Re),du(G.current,Re),v(!1),pe(null),M(!1),P({type:"reset"})},skip:()=>{const Re=q.current;q.current+=1,Lm(H.current,Re),du(G.current,Re),v(!1),pe(null),P({type:"skip"})},act:Ne,accountAct:ee}}function Dde(){const e=[{Icon:ld,title:l("phone.value.chats"),detail:l("phone.value.chatsDetail")},{Icon:mt,title:l("phone.value.approvals"),detail:l("phone.value.approvalsDetail")},{Icon:Os,title:l("phone.value.private"),detail:l("phone.value.privateDetail")}];return n.jsx("div",{className:"mt-5 grid w-full gap-2 sm:grid-cols-3",children:e.map(({Icon:t,title:a,detail:o})=>n.jsxs("div",{className:"rounded-xl bg-inset px-3 py-3 text-left",children:[n.jsx(t,{size:16,className:"text-accent"}),n.jsx("div",{className:"mt-2 text-[13px] font-medium text-ink",children:a}),n.jsx("div",{className:"mt-0.5 text-[11.5px] leading-relaxed text-ink-secondary",children:o})]},a))})}function ez({controller:e,variant:t,onSkip:a,onComplete:o,compactHeader:i=!1}){const s=e,r=QO(s.account,s.accountError),c=/^\S+@\S+\.\S+$/.test(s.email.trim()),d=Rde(!!s.state?.pairing,s.pairingLink);if(s.phase==="intro"&&i){const p=[{Icon:ld,title:l("phone.value.chats"),detail:l("phone.value.chatsDetail")},{Icon:mt,title:l("phone.value.approvals"),detail:l("phone.value.approvalsDetail")},{Icon:Os,title:l("phone.value.private"),detail:l("phone.value.privateDetail")}];return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("p",{className:"mt-1 text-[13.5px] leading-relaxed text-ink-secondary",children:l("phone.intro.detail")}),n.jsxs("div",{className:"mt-4 grid grid-cols-[200px_1fr] items-center gap-6",children:[n.jsx(Wce,{}),n.jsx("ul",{className:"flex flex-col gap-3.5",children:p.map(({Icon:h,title:g,detail:b})=>n.jsxs("li",{className:"flex items-start gap-3",children:[n.jsx("span",{className:"mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-lg bg-accent/12 text-accent",children:n.jsx(h,{size:14})}),n.jsxs("span",{children:[n.jsx("span",{className:"block text-[13.5px] font-medium text-ink",children:g}),n.jsx("span",{className:"block text-[12px] leading-relaxed text-ink-secondary",children:b})]})]},g))})]}),n.jsx("button",{onClick:s.start,disabled:!s.state||s.busy||s.accountBusy,className:"mt-5 w-full rounded-lg bg-accent py-2.5 text-[14px] font-medium text-white hover:opacity-90 disabled:cursor-wait disabled:opacity-40",children:l("phone.intro.setUp")}),s.error&&n.jsx("p",{role:"alert",className:"mt-3 text-[12.5px] text-danger",children:s.error}),n.jsx("button",{onClick:()=>{s.skip(),a?.()},className:"mt-3 self-center text-[12.5px] text-ink-secondary hover:text-ink",children:l("phone.intro.notNow")}),n.jsx("p",{className:"mt-1.5 self-center text-[11.5px] text-ink-secondary",children:l("phone.intro.resume")})]})}if(s.phase==="intro")return n.jsxs("div",{className:i?"flex flex-col items-start":"flex flex-col items-center text-center",children:[!i&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex size-14 items-center justify-center rounded-2xl bg-accent/12 text-accent",children:n.jsx(ld,{size:26})}),n.jsx("h2",{className:"mt-4 text-[19px] font-semibold text-ink",children:l("phone.intro.title",{app:Wa().name})})]}),n.jsx("p",{className:i?"mt-1 text-[13.5px] leading-relaxed text-ink-secondary":"mt-1.5 max-w-[460px] text-[13.5px] leading-relaxed text-ink-secondary",children:l("phone.intro.detail")}),n.jsx(Dde,{}),n.jsx("button",{onClick:s.start,disabled:!s.state||s.busy||s.accountBusy,className:i?"mt-5 w-full rounded-lg bg-accent py-2.5 text-[14px] font-medium text-white hover:opacity-90 disabled:cursor-wait disabled:opacity-40":"mt-5 w-full max-w-[320px] rounded-lg bg-accent py-2.5 text-[14px] font-medium text-white hover:opacity-90 disabled:cursor-wait disabled:opacity-40",children:t==="settings"?s.state?.devices.length?l("phone.intro.pairAnother"):l("phone.intro.pair"):l("phone.intro.setUp")}),s.error&&n.jsx("p",{role:"alert",className:"mt-3 max-w-[390px] text-[12.5px] text-danger",children:s.error}),t==="onboarding"&&n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>{s.skip(),a?.()},className:i?"mt-3 self-center text-[12.5px] text-ink-secondary hover:text-ink":"mt-2.5 text-[12.5px] text-ink-secondary hover:text-ink",children:l("phone.intro.notNow")}),n.jsx("p",{className:i?"mt-2 self-center text-[11.5px] text-ink-secondary":"mt-2 text-[11.5px] text-ink-secondary",children:l("phone.intro.resume")})]})]});if(s.phase==="sign-in"){const p=!s.account?.available,h=s.account?.status==="error"||s.setupTimedOut;return n.jsxs("div",{className:"mx-auto flex w-full max-w-[430px] flex-col",children:[n.jsxs("button",{onClick:s.cancel,className:"mb-4 flex w-fit items-center gap-1.5 text-[12px] text-ink-secondary hover:text-ink",children:[n.jsx(Gl,{size:13})," ",l("phone.back")]}),n.jsx("div",{className:"flex size-11 items-center justify-center rounded-xl bg-accent/12 text-accent",children:n.jsx(IE,{size:20})}),n.jsx("h2",{className:"mt-3 text-[18px] font-semibold text-ink",children:l(p||h?"phone.signIn.attention":"phone.signIn.title")}),n.jsx("p",{role:s.setupTimedOut?"alert":void 0,className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:p?l("phone.signIn.unavailable"):s.setupTimedOut?l("phone.signIn.timedOut"):h?s.account?.message??l("phone.signIn.failed"):l("phone.signIn.emailPrompt")}),!p&&!h&&n.jsxs("div",{className:"mt-5 flex flex-col gap-3",children:[n.jsxs("label",{className:"flex flex-col gap-1.5",children:[n.jsx("span",{className:"text-[12px] font-medium text-ink-secondary",children:l("phone.signIn.email")}),n.jsx("input",{autoFocus:!0,autoComplete:"email",inputMode:"email",value:s.email,disabled:s.accountBusy||s.codeSent,onChange:g=>s.setEmail(g.target.value),onKeyDown:g=>{g.key==="Enter"&&!s.codeSent&&c&&s.requestCode()},placeholder:"you@example.com",className:"rounded-lg border border-hairline/50 bg-inset px-3 py-2.5 text-[14px] text-ink outline-none placeholder:text-ink-secondary/60 focus:border-accent disabled:opacity-50"})]}),s.codeSent&&n.jsxs("label",{className:"flex flex-col gap-1.5",children:[n.jsx("span",{className:"text-[12px] font-medium text-ink-secondary",children:l("phone.signIn.code")}),n.jsx("input",{autoFocus:!0,autoComplete:"one-time-code",inputMode:"numeric",value:s.code,disabled:s.accountBusy,onChange:g=>s.setCode(g.target.value),onKeyDown:g=>{g.key==="Enter"&&s.code.length===8&&s.verifyCode()},placeholder:"12345678",className:"rounded-lg border border-hairline/50 bg-inset px-3 py-2.5 font-mono text-[16px] tracking-[0.18em] text-ink outline-none placeholder:tracking-normal placeholder:text-ink-secondary/60 focus:border-accent disabled:opacity-50"})]}),n.jsx("button",{disabled:s.accountBusy||!s.codeSent&&!c||s.codeSent&&s.code.length!==8,onClick:s.codeSent?s.verifyCode:s.requestCode,className:"rounded-lg bg-accent py-2.5 text-[14px] font-medium text-white hover:opacity-90 disabled:opacity-40",children:s.accountBusy?l("phone.signIn.working"):s.codeSent?l("phone.signIn.verify"):l("phone.signIn.sendCode")}),s.codeSent&&n.jsx("button",{disabled:s.accountBusy,onClick:s.changeEmail,className:"text-[12px] text-ink-secondary hover:text-ink disabled:opacity-40",children:l("phone.signIn.otherEmail")}),s.codeSent&&!r&&n.jsx("p",{className:"text-[11.5px] text-ink-secondary",children:l("phone.signIn.expires")})]}),(p||h)&&!s.account?.unconfigured&&n.jsx("button",{disabled:s.accountBusy,onClick:s.retryAccount,className:"mt-5 rounded-lg bg-accent py-2.5 text-[14px] font-medium text-white disabled:opacity-40",children:s.accountBusy?l("remote.account.retrying"):l("phone.signIn.retry")}),r&&n.jsx("p",{role:"alert",className:"mt-3 text-[12.5px] text-danger",children:r}),n.jsxs("div",{className:"my-4 flex items-center gap-3 text-[11px] text-ink-secondary",children:[n.jsx("span",{className:"h-px flex-1 bg-hairline/40"})," ",l("phone.signIn.or")," ",n.jsx("span",{className:"h-px flex-1 bg-hairline/40"})]}),t==="onboarding"&&s.tailscaleAvailable&&n.jsxs(n.Fragment,{children:[n.jsxs("button",{disabled:s.busy||s.accountBusy,onClick:s.useTailscale,className:"flex items-center justify-center gap-2 rounded-lg border border-hairline/50 py-2.5 text-[13px] text-ink hover:bg-control disabled:opacity-40",children:[n.jsx(Os,{size:15})," ",l("remote.pairOverTailscale")]}),n.jsx("p",{className:"mt-2 text-center text-[11px] leading-relaxed text-ink-secondary",children:l("phone.signIn.tailnetNote")})]}),n.jsxs("button",{disabled:s.busy||s.accountBusy,onClick:s.useLocal,className:`${t==="onboarding"&&s.tailscaleAvailable?"mt-3":""} flex items-center justify-center gap-2 rounded-lg border border-hairline/50 py-2.5 text-[13px] text-ink hover:bg-control disabled:opacity-40`,children:[n.jsx(_E,{size:15})," ",l("phone.signIn.wifiInstead")]}),n.jsx("p",{className:"mt-2 text-center text-[11px] leading-relaxed text-ink-secondary",children:l("phone.signIn.wifiNote")})]})}return s.phase==="verifying"?n.jsxs("div",{className:"flex flex-col items-center py-8 text-center",children:[n.jsx("div",{className:"flex size-14 items-center justify-center rounded-2xl bg-accent/12 text-accent",children:n.jsx(je,{size:25,className:"animate-spin"})}),n.jsx("h2",{className:"mt-4 text-[18px] font-semibold text-ink",children:s.localFallback?l("phone.verifying.local"):s.tailscaleFallback?l("phone.verifying.tailscale"):l("phone.verifying.secure")}),n.jsx("p",{className:"mt-1.5 max-w-[360px] text-[13px] leading-relaxed text-ink-secondary",children:s.localFallback?l("phone.verifying.localDetail"):s.tailscaleFallback?l("phone.verifying.tailscaleDetail"):l("phone.verifying.secureDetail")}),(s.error||s.accountError)&&n.jsx("p",{role:"alert",className:"mt-3 max-w-[380px] text-[12.5px] text-danger",children:s.error??s.accountError}),n.jsx("button",{onClick:s.cancel,className:"mt-5 text-[12px] text-ink-secondary hover:text-ink",children:l("common.cancel")})]}):s.phase==="success"?n.jsxs("div",{className:"flex flex-col items-center py-6 text-center",children:[n.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-success/15 text-success",children:n.jsx(mt,{size:28})}),n.jsx("h2",{className:"mt-4 text-[19px] font-semibold text-ink",children:l("phone.success.title")}),n.jsx("p",{className:"mt-1.5 text-[13px] text-ink-secondary",children:l("phone.success.detail")}),n.jsx("button",{onClick:()=>{s.finish(),o?.()},className:"mt-5 w-full max-w-[280px] rounded-lg bg-accent py-2.5 text-[14px] font-medium text-white",children:t==="onboarding"?l("phone.success.start",{app:Wa().name}):l("phone.success.done")})]}):n.jsxs("div",{className:"flex flex-col items-center text-center",children:[n.jsx("div",{className:"flex size-12 items-center justify-center rounded-xl bg-white text-black",children:n.jsx(kZ,{size:23})}),n.jsx("h2",{className:"mt-3 text-[18px] font-semibold text-ink",children:s.pairingExpired?l("phone.code.expired"):l("phone.code.title")}),n.jsx("p",{className:"mt-1 text-[13px] text-ink-secondary",children:s.pairingExpired?l("phone.code.expiredDetail"):l("phone.code.detail")}),!s.pairingExpired&&s.pairingLink&&n.jsx("div",{className:"mt-4 rounded-2xl bg-white p-3.5","aria-label":l("phone.code.qrAria"),children:n.jsx(_S,{value:s.pairingLink,size:180,level:"M",bgColor:"#ffffff",fgColor:"#111111"})}),!s.pairingExpired&&d==="direct"&&s.state?.pairing&&n.jsxs("div",{className:"mt-4 w-full max-w-[320px] rounded-xl bg-inset px-4 py-3 text-[12.5px] text-ink-secondary",children:[n.jsx("div",{children:l("phone.code.manualIntro")}),n.jsx("div",{className:"mt-2 font-mono text-[22px] tracking-[0.25em] text-ink",children:s.state.pairing.code})]}),!s.pairingExpired&&d==="details"&&s.state?.pairing&&n.jsx("p",{className:"mt-3 text-[11.5px] text-ink-secondary",children:l("phone.code.expiresIn",{seconds:s.secondsLeft})}),!s.pairingExpired&&t==="settings"&&s.tailscaleFallback&&s.pairingLink&&n.jsx(Pde,{link:s.pairingLink,addresses:Ide(s.state?.tailnetName,s.state?.tailscale,s.pairingPort)}),s.pairingExpired&&n.jsx("button",{onClick:s.refreshCode,className:"mt-5 rounded-lg bg-accent px-5 py-2.5 text-[14px] font-medium text-white",children:l("phone.code.createNew")}),!s.pairingExpired&&s.state?.pairing&&n.jsxs("details",{className:"mt-4 w-full max-w-[390px] rounded-lg border border-hairline/40 px-3 py-2 text-left",children:[n.jsx("summary",{className:"cursor-pointer text-[12px] text-ink-secondary",children:l("phone.code.trouble")}),n.jsxs("div",{className:"mt-3 text-[12px] text-ink-secondary",children:[l("phone.code.manual"),n.jsx("div",{className:"mt-1 font-mono text-[22px] tracking-[0.25em] text-ink",children:s.state.pairing.code}),s.address&&n.jsx("div",{className:"mt-3",children:n.jsx(xx,{label:l("phone.code.address"),value:`${s.address}:${s.pairingPort}`})})]})]}),n.jsx("button",{onClick:s.cancel,className:"mt-4 text-[12px] text-ink-secondary hover:text-ink",children:l("common.cancel")})]})}function tz({profileEmail:e,variant:t,onSkip:a,onComplete:o,compactHeader:i}){const s=XO(e);return n.jsx(ez,{controller:s,variant:t,onSkip:a,onComplete:o,compactHeader:i})}const Ode="https://apps.apple.com/us/app/tailscale/id1470499037",zde="https://apps.apple.com/us/app/tailscale/id1475387142";function Lde(){return n.jsxs("div",{className:"mt-3 rounded-xl border border-hairline/40 bg-card px-3.5 py-3",children:[n.jsx("p",{className:"text-[12.5px] leading-relaxed text-ink",children:l("setup.phone.tailscale")}),n.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[n.jsx(lx,{href:Ode,label:l("setup.phone.tailscaleIphone")}),n.jsx(lx,{href:zde,label:l("setup.phone.tailscaleMac")})]})]})}function _de({onPaired:e,onSkip:t}){const{state:a}=ke();return n.jsxs("div",{className:"flex min-h-0 flex-col",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.phone.intro")}),n.jsx(Lde,{}),n.jsx("div",{className:"mt-3 min-h-0",children:n.jsx(tz,{variant:"onboarding",compactHeader:!0,profileEmail:a.config?.profile?.email??"",onSkip:t,onComplete:e})}),n.jsx(Ji,{children:n.jsx("p",{children:l("setup.phone.what")})})]})}function Fde({name:e,chibitek:t,identity:a={},onName:o,onChibitek:i}){return n.jsxs("div",{className:"flex flex-col",children:[a.companyLogo?n.jsx("img",{src:a.companyLogo,alt:a.company??"",className:"mb-3 h-24 max-w-[260px] self-center object-contain"}):n.jsx(O0,{size:96,className:"mb-3 self-center"}),a.company&&n.jsx("p",{className:"mb-2 text-[15px] font-medium text-ink",children:l("setup.welcome.team",{company:a.company})}),n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.welcome.intro")}),n.jsx("label",{htmlFor:"setup-name",className:"mt-5 text-[12px] font-medium text-ink-secondary",children:l("setup.welcome.nameLabel")}),n.jsx("input",{id:"setup-name",autoFocus:!0,type:"text",value:e,maxLength:80,autoComplete:"name",onChange:s=>o(s.target.value),placeholder:l("onboarding.name"),className:V("mt-1.5",Cr)}),a.chibitek===void 0&&n.jsxs("fieldset",{className:"mt-5",children:[n.jsx("legend",{className:"text-[12px] font-medium text-ink-secondary",children:l("setup.welcome.chibitekQuestion")}),n.jsx("div",{role:"radiogroup","aria-label":l("setup.welcome.chibitekQuestion"),className:"mt-2 grid grid-cols-2 gap-2",children:[!0,!1].map(s=>n.jsx("button",{type:"button",role:"radio","aria-checked":t===s,onClick:()=>i(s),className:V("rounded-xl border px-3 py-2.5 text-[13.5px] font-medium transition-colors",t===s?"border-accent bg-accent/10 text-ink":"border-hairline/50 bg-card text-ink-secondary hover:bg-raised/50 hover:text-ink"),children:l(s?"setup.welcome.yes":"setup.welcome.no")},String(s)))}),t&&n.jsx("p",{className:"mt-2 text-[12px] text-ink-secondary",children:l("setup.welcome.chibitekYes")})]}),n.jsx(Ji,{children:n.jsx("p",{children:l("setup.welcome.what")})})]})}const qde=[{id:"service-desk",name:"Service Desk"},{id:"development",name:"Development"},{id:"back-office",name:"Back Office"},{id:"creative",name:"Creative"},{id:"sales-and-marketing",name:"Sales and Marketing"}],Ude="min-h-[72px] resize-y";function Vde({answers:e,chibitek:t,company:a,onChange:o}){const i=r=>c=>o({...e,[r]:c}),s=(r,c,d,p=!1)=>{const h=`paw-${r}`;return n.jsxs("div",{className:"mt-4 flex flex-col",children:[n.jsx("label",{htmlFor:h,className:"text-[12px] font-medium text-ink-secondary",children:c}),p?n.jsx("textarea",{id:h,rows:3,maxLength:2e3,value:e[r]??"",placeholder:d,onChange:g=>i(r)(g.target.value),className:V("mt-1.5",Cr,Ude)}):n.jsx("input",{id:h,type:"text",maxLength:120,value:e[r]??"",placeholder:d,onChange:g=>i(r)(g.target.value),className:V("mt-1.5",Cr)})]})};return n.jsxs("div",{className:"flex flex-col","data-testid":"paw-interview",children:[n.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:l("setup.about.intro")}),s("role",a?l("setup.about.roleAt",{company:a}):l("setup.about.role"),l("setup.about.roleHint")),t?n.jsxs("div",{className:"mt-4 flex flex-col",children:[n.jsx("label",{htmlFor:"paw-department",className:"text-[12px] font-medium text-ink-secondary",children:l("setup.about.department")}),n.jsxs("select",{id:"paw-department",value:e.department??"",onChange:r=>i("department")(r.target.value),className:V("mt-1.5",Cr),children:[n.jsx("option",{value:"",children:l("setup.about.departmentPick")}),qde.map(r=>n.jsx("option",{value:r.id,children:r.name},r.id))]})]}):n.jsxs(n.Fragment,{children:[s("department",l("setup.about.department"),l("setup.about.departmentHint")),!a&&s("company",l("setup.about.company"),l("setup.about.companyHint"))]}),s("goals",l("setup.about.goals"),l("setup.about.goalsHint"),!0),s("workingStyle",l("setup.about.style"),l("setup.about.styleHint"),!0),n.jsxs(Ji,{children:[n.jsx("p",{children:l("setup.about.what")}),n.jsx("p",{children:l("paw.about")})]})]})}const Hde={profile:{},memory:{},skills:[],routines:[]},$de=e=>({name:e.name,prompt:e.prompt,schedule:e.schedule,enabled:e.enabled,runOn:e.runOn,durationMinutes:e.durationMinutes,timeoutMinutes:e.timeoutMinutes,overlap:e.overlap,attachments:e.attachments});class DM{constructor(t,a,o=Z){this.changed=a,this.network=o,this.template=structuredClone(t),this.template.profile.approvalMode??=this.template.profile.computer==="local"?"ask":"auto",this.routines=t.routines.map(i=>this.routine({...i,botId:this.id}))}changed;network;id=`draft-${crypto.randomUUID()}`;template;consent={};routines;avatarFile;avatarObjectUrl;get bot(){const{computer:t,cwd:a,peers:o,...i}=this.template.profile;return{id:this.id,threadId:this.id,name:"",title:"",description:"",soul:"",color:"green",notifications:!0,unread:!1,messages:[],modelSelection:{instanceId:"",model:""},...i,computer:t??void 0,cwd:a??void 0,peers:o??void 0}}patch(t){const{confirmFullAccess:a,acknowledgeLocalAuto:o,acknowledgePeerScope:i,applyToAllThreads:s,autoApprove:r,...c}=t;a!==void 0&&(this.consent.confirmFullAccess=a),o!==void 0&&(this.consent.acknowledgeLocalAuto=o),i!==void 0&&(this.consent.acknowledgePeerScope=i),r!==void 0&&c.approvalMode===void 0&&(c.approvalMode=r?"auto":"ask"),this.template.profile={...this.template.profile,...c},this.changed()}modelChosen=!1;setModel(t){this.modelChosen=!0,this.patch({modelSelection:t})}setMemory(t,a){a===null?delete this.template.memory[t]:this.template.memory[t]=a,this.changed()}setRoutineEnabled(t,a){this.routines=this.routines.map(o=>o.id===t?{...o,enabled:a}:o),this.changed()}removeRoutine(t){this.routines=this.routines.filter(a=>a.id!==t),this.changed()}export(){return structuredClone({...this.template,routines:this.routines.map($de)})}uploadAvatar=async t=>{if(!["image/png","image/jpeg","image/gif","image/webp"].includes(t.type))throw new Error("Choose a PNG, JPEG, GIF, or WebP image");if(t.size>10*1024*1024)throw new Error("Choose an image smaller than 10 MiB");return this.avatarObjectUrl&&URL.revokeObjectURL(this.avatarObjectUrl),this.avatarFile=t,this.avatarObjectUrl=URL.createObjectURL(t),this.avatarObjectUrl};dispose(){this.avatarObjectUrl&&URL.revokeObjectURL(this.avatarObjectUrl)}routine(t,a){const{groupId:o,resultsThreadId:i,schedule:s,...r}=t,c=s.type==="interval"?{...s,weekdays:s.weekdays??void 0,window:s.window??void 0,endsAt:s.endsAt??void 0}:s;return{id:a?.id??`draft-${crypto.randomUUID()}`,createdAt:a?.createdAt??Date.now(),updatedAt:Date.now(),nextRunAt:null,runOn:"maus",...a,...r,enabled:t.enabled??a?.enabled??!0,target:"bot",botId:this.id,timeoutMinutes:t.timeoutMinutes??void 0,durationMinutes:t.durationMinutes??a?.durationMinutes??30,schedule:c}}request=async(t,a)=>{const o=a?.method??"GET",i=typeof a?.body=="string"?JSON.parse(a.body):{},s=`/api/bots/${this.id}`;let r;if(t===s&&o==="PATCH")this.patch(i),r={bot:this.bot};else if(t===`${s}/soul`&&o==="GET")r={soul:this.bot.soul,revision:"draft",bytes:new TextEncoder().encode(this.bot.soul).length,limit:24e3,file:"",drift:!1};else if(t===`${s}/skills`&&o==="GET")r={skills:this.template.skills,staged:[]};else if(t===`${s}/skills`&&o==="POST"){const c=await this.network("/api/bot-defaults/skills/preview",{method:"POST",body:JSON.stringify(i)}),d=new Set(this.template.skills.map(p=>p.name));if(c.skills.some(p=>d.has(p.name)))throw new Error("A skill with this name is already in the draft");this.template.skills.push(...c.skills),this.changed(),r={installed:c.skills}}else if(t.startsWith(`${s}/skills/`)){const c=decodeURIComponent(t.slice(`${s}/skills/`.length)),d=this.template.skills.find(p=>p.name===c);if(!d)throw new Error("No such draft skill");if(o==="GET")r={text:d.text};else if(o==="PATCH"&&typeof i.enabled=="boolean")d.enabled=i.enabled,this.changed(),r={ok:!0};else if(o==="DELETE")this.template.skills=this.template.skills.filter(p=>p!==d),this.changed(),r={ok:!0};else throw new Error("Unsupported draft skill operation")}else if(t===`${s}/avatar/generate`&&o==="POST"){const{name:c,title:d,description:p}=this.bot,{dataUrl:h}=await this.network("/api/bot-defaults/avatar",{method:"POST",body:JSON.stringify({profile:{name:c,title:d,description:p},prompt:i.prompt,source:i.source})}),g=await(await fetch(h)).blob(),b=await this.uploadAvatar(new File([g],"avatar.png",{type:g.type}));r={avatarUrl:b,bot:{...this.bot,avatarUrl:b,avatarCrop:"circle"}}}else if(t==="/api/routines"&&o==="POST"||t.startsWith("/api/routines/draft-")&&o==="PATCH"){if(i.target&&i.target!=="bot")throw new Error("A new bot's routine must target that bot");if(i.botId!==this.id)throw new Error("Routine belongs to another bot");const c=this.routines.find(p=>t===`/api/routines/${p.id}`);if(o==="PATCH"&&!c)throw new Error("No such draft routine");const d=this.routine(i,c);this.routines=[...this.routines.filter(p=>p.id!==d.id),d],this.changed(),r={routine:d}}else throw new Error("This operation requires a created bot");return r}}function Gde(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.id!="string"||!Kde(t.size)?!1:t.kind==="paste"?typeof t.text=="string"&&typeof t.lines=="number"&&Number.isInteger(t.lines)&&t.lines>=1:t.kind==="file"?typeof t.path=="string"&&t.path.length>0&&typeof t.name=="string":t.kind==="image"?typeof t.path=="string"&&t.path.length>0&&typeof t.name=="string"&&typeof t.mime=="string"&&t.mime.startsWith("image/"):!1}function Kde(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0}const Wde=900,Jde=12;function Yde(e){return e.length>=Wde||nz(e)>=Jde}function nz(e){return e.split(`
|
|
@@ -545,7 +545,7 @@ l0,-`+(a+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
|
|
|
545
545
|
`.repeat(p)||" "),p=-1,d.push(h))}return d.join("")}function yV(e,t,a){return e.type==="element"?p6e(e,t,a):e.type==="text"?a.whitespace==="normal"?xV(e,a):m6e(e):[]}function p6e(e,t,a){const o=vV(e,a),i=e.children||[];let s=-1,r=[];if(d6e(e))return r;let c,d;for(Z5(e)||dT(e)&&sT(t,e,dT)?d=`
|
|
546
546
|
`:c6e(e)?(c=2,d=2):bV(e)&&(c=1,d=1);++s<i.length;)r=r.concat(yV(i[s],e,{whitespace:o,breakBefore:s?void 0:c,breakAfter:s<i.length-1?Z5(i[s+1]):d}));return cT(e)&&sT(t,e,cT)&&r.push(" "),c&&r.unshift(c),d&&r.push(d),r}function xV(e,t){const a=String(e.value),o=[],i=[];let s=0;for(;s<=a.length;){rT.lastIndex=s;const d=rT.exec(a),p=d&&"index"in d?d.index:a.length;o.push(h6e(a.slice(s,p).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),s===0?t.breakBefore:!0,p===a.length?t.breakAfter:!0)),s=p+1}let r=-1,c;for(;++r<o.length;)o[r].charCodeAt(o[r].length-1)===8203||r<o.length-1&&o[r+1].charCodeAt(0)===8203?(i.push(o[r]),c=void 0):o[r]?(typeof c=="number"&&i.push(c),i.push(o[r]),c=0):(r===0||r===o.length-1)&&i.push(0);return i}function m6e(e){return[String(e.value)]}function h6e(e,t,a){const o=[];let i=0,s;for(;i<e.length;){lT.lastIndex=i;const r=lT.exec(e);s=r?r.index:e.length,!i&&!s&&r&&!t&&o.push(""),i!==s&&o.push(e.slice(i,s)),i=r?s+r[0].length:s}return i!==s&&!a&&o.push(""),o.join(" ")}function vV(e,t){if(e.type==="element"){const a=e.properties||{};switch(e.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return a.wrap?"pre-wrap":"pre";case"td":case"th":return a.noWrap?"nowrap":t.whitespace;case"textarea":return"pre-wrap"}}return t.whitespace}function g6e(e){return!!(e.properties||{}).hidden}function f6e(e){return e.tagName==="td"||e.tagName==="th"}function b6e(e){return e.tagName==="dialog"&&!(e.properties||{}).open}const y6e={},x6e=[];function v6e(e){const t=e||y6e;return function(a,o){pj(a,"element",function(i,s){const r=Array.isArray(i.properties.className)?i.properties.className:x6e,c=r.includes("language-math"),d=r.includes("math-display"),p=r.includes("math-inline");let h=d;if(!c&&!d&&!p)return;let g=s[s.length-1],b=i;if(i.tagName==="code"&&c&&g&&g.type==="element"&&g.tagName==="pre"&&(b=g,g=s[s.length-2],h=!0),!g)return;const x=u6e(b,{whitespace:"pre"});let v;try{v=J5.renderToString(x,{...t,displayMode:h,throwOnError:!0})}catch(w){const N=w,C=N.name.toLowerCase();o.message("Could not render math with KaTeX",{ancestors:[...s,i],cause:N,place:i.position,ruleId:C,source:"rehype-katex"});try{v=J5.renderToString(x,{...t,displayMode:h,strict:"ignore",throwOnError:!1})}catch{v=[{type:"element",tagName:"span",properties:{className:["katex-error"],style:"color:"+(t.errorColor||"#cc0000"),title:String(w)},children:[{type:"text",value:x}]}]}}typeof v=="string"&&(v=a6e(v).children);const k=g.children.indexOf(b);return g.children.splice(k,1,...v),Fq})}}const uT={js:"JavaScript",javascript:"JavaScript",jsx:"JavaScript (JSX)",ts:"TypeScript",typescript:"TypeScript",tsx:"TypeScript (TSX)",node:"Node.js",html:"HTML",htm:"HTML",css:"CSS",scss:"SCSS",sass:"Sass",less:"Less",json:"JSON",jsonc:"JSON",json5:"JSON5",xml:"XML",svg:"SVG",md:"Markdown",markdown:"Markdown",mdx:"MDX",yaml:"YAML",yml:"YAML",toml:"TOML",sh:"Bash",bash:"Bash",zsh:"Bash",shell:"Shell",ps1:"PowerShell",powershell:"PowerShell",fish:"Fish",c:"C",cpp:"C++","c++":"C++",cc:"C++",cxx:"C++",cs:"C#",csharp:"C#","c#":"C#",rs:"Rust",rust:"Rust",go:"Go",golang:"Go",py:"Python",python:"Python",rb:"Ruby",ruby:"Ruby",php:"PHP",java:"Java",kt:"Kotlin",kotlin:"Kotlin",swift:"Swift",dart:"Dart",r:"R",lua:"Lua",sql:"SQL",graphql:"GraphQL",gql:"GraphQL",proto:"Protobuf",protobuf:"Protobuf",docker:"Dockerfile",dockerfile:"Dockerfile",makefile:"Makefile",make:"Makefile",diff:"Diff",wasm:"WebAssembly"};function k6e(e){if(!e||!e.trim())return"Code";const t=e.trim().toLowerCase();return Object.prototype.hasOwnProperty.call(uT,t)?uT[t]??t:t.charAt(0).toUpperCase()+t.slice(1)}function w6e(e){return e?e.split(/\r\n|\r|\n/).length:0}function S6e(e){return e===1?"1 line":`${e} lines`}const pT={js:"js",javascript:"js",jsx:"jsx",ts:"ts",typescript:"ts",tsx:"tsx",node:"js",html:"html",htm:"html",css:"css",scss:"scss",sass:"sass",less:"less",json:"json",jsonc:"json",json5:"json5",xml:"xml",svg:"svg",md:"md",markdown:"md",mdx:"mdx",yaml:"yaml",yml:"yaml",toml:"toml",sh:"sh",bash:"sh",zsh:"zsh",shell:"sh",ps1:"ps1",powershell:"ps1",fish:"fish",c:"c",cpp:"cpp","c++":"cpp",cc:"cpp",cxx:"cpp",cs:"cs",csharp:"cs","c#":"cs",rs:"rs",rust:"rs",go:"go",golang:"go",py:"py",python:"py",rb:"rb",ruby:"rb",php:"php",java:"java",kt:"kt",kotlin:"kt",swift:"swift",dart:"dart",r:"r",lua:"lua",sql:"sql",graphql:"graphql",gql:"graphql",proto:"proto",protobuf:"proto",docker:"dockerfile",dockerfile:"dockerfile",makefile:"makefile",make:"makefile",diff:"diff",wasm:"wasm"};function C6e(e){if(!e||!e.trim())return"txt";const t=e.trim().toLowerCase();return Object.prototype.hasOwnProperty.call(pT,t)?pT[t]??"txt":/^[a-z0-9_-]{1,8}$/.test(t)?t:"txt"}function j6e(e){const t=C6e(e);return t==="dockerfile"||t==="makefile"?t:`snippet.${t}`}function N6e(e,t){if(typeof document>"u"||typeof URL>"u")return;const a=new Blob([t],{type:"text/plain;charset=utf-8"}),o=URL.createObjectURL(a),i=document.createElement("a");i.href=o,i.download=e;try{document.body.appendChild(i),i.click()}finally{i.remove(),setTimeout(()=>URL.revokeObjectURL(o),1e3)}}const A6e=/^:?-+:?$/,kV=/\|(?:\s*:?-+:?\s*\|)+/;function vd(e){const t=e.trim().split("|");return t[0]?.trim()===""&&t.shift(),t.at(-1)?.trim()===""&&t.pop(),t.map(a=>a.trim())}const $y=e=>`| ${e.join(" | ")} |`;function C2(e){if(!e.includes("|"))return!1;const t=vd(e);return t.length>0&&t.every(a=>A6e.test(a))}const j2=e=>vd(e).length>=2&&e.includes("|");function wV(e,t){const a=vd(e);return $y(Array.from({length:t},(o,i)=>a[i]??"---"))}function M6e(e){if(!/^ {0,3}\|/.test(e))return null;const t=kV.exec(e);if(!t)return null;const a=e.slice(0,t.index),o=e.slice(t.index+t[0].length),i=vd(a);if(i.length<2||!a.trimEnd().endsWith("|")||o.trim()!==""&&!o.trimStart().startsWith("|"))return null;const s=[$y(i),wV(t[0],i.length)];let r=[],c=!1;for(const d of vd(o))c&&(c=!1,d==="")||(r.push(d),r.length===i.length&&(s.push($y(r)),r=[],c=!0));if(r.length>0){for(;r.length<i.length;)r.push("");s.push($y(r))}return s}function I6e(e){const t=e.split(`
|
|
547
547
|
`),a=[];let o=!1;for(const[i,s]of t.entries()){if(o&&s.includes("|")){a.push(s);continue}if(o=!1,kV.exec(s)&&!C2(s)&&!C2(t[i+1]??"")){const c=M6e(s);if(c){a.length>0&&a.at(-1)?.trim()!==""&&!j2(a.at(-1)??"")&&a.push(""),a.push(...c);continue}}if(C2(s)){const c=a.at(-1)??"";if(j2(c)){o=!0;const d=a.at(-2);d!==void 0&&d.trim()!==""&&!j2(d)&&a.splice(a.length-1,0,"");const p=vd(c).length;if(vd(s).length!==p){a.push(wV(s,p));continue}}}a.push(s)}return a.join(`
|
|
548
|
-
`)}function P6e(e){if(!e.includes("|"))return e;const t=[];let a=0;for(const o of rj(e).children){if(o.type!=="paragraph")continue;const i=o.position?.start.offset,s=o.position?.end.offset;if(i===void 0||s===void 0)continue;const r=e.slice(i,s);/[`\\]/.test(r)||(t.push(e.slice(a,i),I6e(r)),a=s)}return t.push(e.slice(a)),t.join("")}const SV=new WeakSet,T6e=/^[A-Za-z]:(?:[\\/]|$)/,B6e=new Set(["\\","(",")","<",">"]);function mT(){this.buffer(),SV.add(this.stack[this.stack.length-1])}function E6e(e){const t=this.stack.pop(),a=this.sliceSerialize(e),o=SV.has(this.stack[this.stack.length-1])&&T6e.test(t.value)&&!B6e.has(a);t.value+=o?`\\${a}`:a,t.position.end={line:e.end.line,column:e.end.column,offset:e.end.offset}}const CV={enter:{resourceDestinationString:mT,definitionDestinationString:mT},exit:{characterEscapeValue:E6e}},Dj=Object.freeze([{id:"github",name:"GitHub",description:"Read code, issues and pull requests in your repositories.",category:"dev",url:"https://api.githubcopilot.com/mcp/",transport:"http"},{id:"notion",name:"Notion",description:"Search, read and write pages in your Notion workspace.",category:"productivity",url:"https://mcp.notion.com/mcp",transport:"http"},{id:"linear",name:"Linear",description:"Find, create and update Linear issues and projects.",category:"productivity",url:"https://mcp.linear.app/mcp",transport:"http"},{id:"atlassian",name:"Atlassian",description:"Work with Jira issues and Confluence pages.",category:"productivity",url:"https://mcp.atlassian.com/v2/mcp",transport:"http",aliases:["jira","confluence"]},{id:"asana",name:"Asana",description:"See and update tasks and projects in Asana.",category:"productivity",url:"https://mcp.asana.com/v2/mcp",transport:"http"},{id:"sentry",name:"Sentry",description:"Look into errors and issues from your Sentry projects.",category:"dev",url:"https://mcp.sentry.dev/mcp",transport:"http"},{id:"vercel",name:"Vercel",description:"Check deployments, logs and projects on Vercel.",category:"dev",url:"https://mcp.vercel.com",transport:"http"},{id:"supabase",name:"Supabase",description:"Manage Supabase projects, tables and edge functions.",category:"data",url:"https://mcp.supabase.com/mcp",transport:"http"},{id:"cloudflare",name:"Cloudflare Docs",description:"Search Cloudflare's developer documentation. No sign-in.",category:"dev",url:"https://docs.mcp.cloudflare.com/mcp",transport:"http"},{id:"huggingface",name:"Hugging Face",description:"Search models, datasets, Spaces and papers.",category:"data",url:"https://huggingface.co/mcp",transport:"http"},{id:"canva",name:"Canva",description:"Find, create and export Canva designs.",category:"design",url:"https://mcp.canva.com/mcp",transport:"http"},{id:"webflow",name:"Webflow",description:"Edit Webflow sites, pages and CMS content.",category:"design",url:"https://mcp.webflow.com/mcp",transport:"http"},{id:"hubspot",name:"HubSpot",description:"Look up contacts, companies and deals in HubSpot.",category:"data",url:"https://mcp.hubspot.com/",transport:"http"},{id:"stripe",name:"Stripe",description:"Look up customers, payments and invoices in Stripe.",category:"payments",url:"https://mcp.stripe.com",transport:"http"},{id:"paypal",name:"PayPal",description:"Work with PayPal invoices, orders and transactions.",category:"payments",url:"https://mcp.paypal.com/mcp",transport:"http"},{id:"dropbox",name:"Dropbox",description:"Search, organize and share files in your Dropbox.",category:"productivity",url:"https://mcp.dropbox.com/mcp",transport:"http"},{id:"granola",name:"Granola",description:"Search your Granola meeting notes and transcripts.",category:"productivity",url:"https://mcp.granola.ai/mcp",transport:"http",aliases:["granola ai"]},{id:"square",name:"Square",description:"See Square payments, orders, catalog and customers.",category:"payments",url:"https://mcp.squareup.com/sse",transport:"sse"},{id:"pax8",name:"Pax8",description:"Look up Pax8 products, subscriptions and client companies.",category:"msp",url:"https://mcp.pax8.com/v1/mcp",transport:"http",aliases:["pax 8"]},{id:"huntress",name:"Huntress",description:"Review Huntress agents, incidents, signals and reports.",category:"security",url:"https://api.huntress.io/v1/mcp",transport:"http"},{id:"jumpcloud",name:"JumpCloud",description:"Look up JumpCloud users, devices and groups as an administrator.",category:"security",url:"https://mcp.jumpcloud.com/v1",transport:"http",aliases:["jump cloud"]},{id:"vanta",name:"Vanta",description:"Check compliance tests, controls and vendor risk in Vanta.",category:"security",url:"https://mcp.vanta.com/mcp",transport:"http"},{id:"semgrep",name:"Semgrep",description:"Scan code for security issues with Semgrep.",category:"security",url:"https://mcp.semgrep.ai/mcp",transport:"http"},{id:"socket",name:"Socket",description:"Check open source packages for supply chain risk. No sign-in.",category:"security",url:"https://mcp.socket.dev/",transport:"http",aliases:["socket.dev"]},{id:"zapier",name:"Zapier",description:"Run actions in the apps you have connected to your Zapier account.",category:"productivity",url:"https://mcp.zapier.com/api/v1/connect",transport:"http",aliases:["zaps"]},{id:"monday",name:"monday.com",description:"See and update boards, items and updates in monday.com.",category:"productivity",url:"https://mcp.monday.com/mcp",transport:"http",aliases:["monday"]},{id:"clickup",name:"ClickUp",description:"Find, create and update ClickUp tasks and docs.",category:"productivity",url:"https://mcp.clickup.com/mcp",transport:"http",aliases:["click up"]},{id:"calendly",name:"Calendly",description:"See Calendly event types, bookings and availability.",category:"productivity",url:"https://mcp.calendly.com",transport:"http"},{id:"fireflies",name:"Fireflies",description:"Search Fireflies meeting transcripts and summaries.",category:"productivity",url:"https://api.fireflies.ai/mcp",transport:"http",aliases:["fireflies.ai"]},{id:"otter",name:"Otter",description:"Search Otter meeting notes and transcripts.",category:"productivity",url:"https://mcp.otter.ai/mcp",transport:"http",aliases:["otter.ai","otter ai"]},{id:"todoist",name:"Todoist",description:"Add, find and complete tasks in Todoist.",category:"productivity",url:"https://ai.todoist.net/mcp",transport:"http"},{id:"jotform",name:"Jotform",description:"Build Jotform forms and read their submissions.",category:"productivity",url:"https://mcp.jotform.com/",transport:"http"},{id:"egnyte",name:"Egnyte",description:"Search and read files stored in Egnyte.",category:"productivity",url:"https://mcp-server.egnyte.com/mcp",transport:"http"},{id:"intercom",name:"Intercom",description:"Search Intercom conversations, contacts and tickets.",category:"crm",url:"https://mcp.intercom.com/mcp",transport:"http"},{id:"pipedrive",name:"Pipedrive",description:"Work with deals, contacts and activities in Pipedrive.",category:"crm",url:"https://mcp.pipedrive.ai/mcp",transport:"http"},{id:"apollo",name:"Apollo.io",description:"Find and enrich people and companies in Apollo.",category:"crm",url:"https://mcp.apollo.io/mcp",transport:"http",aliases:["apollo"]},{id:"attio",name:"Attio",description:"Look up and update records and lists in Attio.",category:"crm",url:"https://mcp.attio.com/mcp",transport:"http"},{id:"close",name:"Close",description:"Work with leads, contacts and opportunities in Close.",category:"crm",url:"https://mcp.close.com/mcp",transport:"http",aliases:["close crm","close.com"]},{id:"zoominfo",name:"ZoomInfo",description:"Search ZoomInfo company and contact data.",category:"crm",url:"https://mcp.zoominfo.com/mcp",transport:"http",aliases:["zoom info"]},{id:"gong",name:"Gong",description:"Search Gong calls, deals and conversation insights.",category:"crm",url:"https://mcp.gong.io/mcp",transport:"http"},{id:"klaviyo",name:"Klaviyo",description:"See Klaviyo campaigns, flows, lists and results.",category:"crm",url:"https://mcp.klaviyo.com/mcp",transport:"http"},{id:"ramp",name:"Ramp",description:"Look up Ramp card transactions, bills and spend.",category:"finance",url:"https://mcp.ramp.com/mcp",transport:"http"},{id:"mercury",name:"Mercury",description:"See Mercury bank accounts, balances and transactions.",category:"finance",url:"https://mcp.mercury.com/mcp",transport:"http"},{id:"brex",name:"Brex",description:"See Brex expenses, cards and spend.",category:"finance",url:"https://api.brex.com/mcp",transport:"http"},{id:"expensify",name:"Expensify",description:"Work with Expensify expense reports and expenses.",category:"finance",url:"https://mcp.expensify.com/mcp/",transport:"http"},{id:"paddle",name:"Paddle",description:"Look up Paddle products, subscriptions and transactions.",category:"payments",url:"https://mcp.paddle.com/mcp",transport:"http"},{id:"miro",name:"Miro",description:"Read and create boards, diagrams and sticky notes in Miro.",category:"design",url:"https://mcp.miro.com/",transport:"http"},{id:"gamma",name:"Gamma",description:"Create presentations, documents and web pages with Gamma.",category:"design",url:"https://mcp.gamma.app/mcp",transport:"http"},{id:"wix",name:"Wix",description:"Manage Wix sites, content and business apps.",category:"design",url:"https://mcp.wix.com/mcp",transport:"http"},{id:"heygen",name:"HeyGen",description:"Create AI avatar videos with HeyGen.",category:"design",url:"https://mcp.heygen.com/mcp/v1/",transport:"http",aliases:["hey gen"]},{id:"squarespace",name:"Squarespace Domains",description:"Check which domain names are free to register. No sign-in.",category:"design",url:"https://mcp.squarespace.com/mcp",transport:"http",aliases:["squarespace"]},{id:"airtable",name:"Airtable",description:"Read and update records in your Airtable bases.",category:"data",url:"https://mcp.airtable.com/mcp",transport:"http"},{id:"posthog",name:"PostHog",description:"Query product analytics, feature flags and errors in PostHog.",category:"data",url:"https://mcp.posthog.com/mcp",transport:"http",aliases:["post hog"]},{id:"perplexity",name:"Perplexity",description:"Search the web with Perplexity and get cited answers.",category:"data",url:"https://api.perplexity.ai/mcp",transport:"http"},{id:"exa",name:"Exa",description:"Search the web and read pages with Exa. No sign-in.",category:"data",url:"https://mcp.exa.ai/mcp",transport:"http",aliases:["exa search","exa ai"]},{id:"tavily",name:"Tavily",description:"Search the web and pull content from pages with Tavily.",category:"data",url:"https://mcp.tavily.com/mcp/",transport:"http"},{id:"microsoft-learn",name:"Microsoft Learn",description:"Search Microsoft's official docs and code samples. No sign-in.",category:"dev",url:"https://learn.microsoft.com/api/mcp",transport:"http",aliases:["microsoft docs","azure docs","intune docs","ms learn"]},{id:"cloudflare-api",name:"Cloudflare",description:"Manage Cloudflare accounts, DNS, Workers and more.",category:"dev",url:"https://mcp.cloudflare.com/mcp",transport:"http",aliases:["cloudflare api"]},{id:"gitlab",name:"GitLab",description:"Work with GitLab issues, merge requests and pipelines.",category:"dev",url:"https://gitlab.com/api/v4/mcp",transport:"http",aliases:["git lab"]},{id:"netlify",name:"Netlify",description:"Deploy and manage Netlify sites and projects.",category:"dev",url:"https://netlify-mcp.netlify.app/mcp",transport:"http"},{id:"railway",name:"Railway",description:"Check Railway projects, deployments and logs.",category:"dev",url:"https://mcp.railway.com",transport:"http"},{id:"neon",name:"Neon",description:"Manage Neon Postgres projects, branches and queries.",category:"dev",url:"https://mcp.neon.tech/mcp",transport:"http",aliases:["neon postgres"]},{id:"prisma",name:"Prisma",description:"Manage Prisma Postgres databases.",category:"dev",url:"https://mcp.prisma.io/mcp",transport:"http"},{id:"postman",name:"Postman",description:"Work with Postman collections, APIs and workspaces.",category:"dev",url:"https://mcp.postman.com/mcp",transport:"http"},{id:"datadog",name:"Datadog",description:"Search Datadog logs, metrics, monitors and incidents.",category:"dev",url:"https://mcp.datadoghq.com/api/unstable/mcp-server/mcp",transport:"http"},{id:"grafana",name:"Grafana Cloud",description:"Query dashboards, metrics and logs in Grafana Cloud.",category:"dev",url:"https://mcp.grafana.com/mcp",transport:"http",aliases:["grafana"]},{id:"honeycomb",name:"Honeycomb",description:"Query traces and events in Honeycomb.",category:"dev",url:"https://mcp.honeycomb.io/mcp",transport:"http"},{id:"buildkite",name:"Buildkite",description:"Check Buildkite pipelines, builds and jobs.",category:"dev",url:"https://mcp.buildkite.com/mcp",transport:"http"},{id:"sanity",name:"Sanity",description:"Query and edit content in Sanity.",category:"dev",url:"https://mcp.sanity.io",transport:"http"},{id:"resend",name:"Resend",description:"Send email and manage domains and audiences in Resend.",category:"dev",url:"https://mcp.resend.com/mcp",transport:"http"},{id:"stytch",name:"Stytch",description:"Manage Stytch projects and sign-in settings.",category:"dev",url:"https://mcp.stytch.dev/mcp",transport:"http"}]);function R6e(e){return Dj.find(t=>t.id===e)}function Oj(e){return`/mcp-icons/${e}.svg`}function hT(e){return e.toLowerCase().replace(/[^\p{L}\p{N}.]+/gu," ").replace(/\s+/g," ").trim()}function Tv(e,t){const a=hT(e);if(a.length<2)return!1;const o=` ${a} `;return t.some(i=>{const s=hT(i);return s?s===a||o.includes(` ${s} `)?!0:a.length>=3&&` ${s} `.includes(o):!1})}const D6e=Object.freeze([{provider:"apple",name:"Apple (iCloud)",names:["apple","icloud","icloud drive","apple calendar","apple reminders","reminders","apple contacts"],description:"This Mac's Calendar, Reminders, Contacts and iCloud Drive, read-only, through the accounts built into Atomic.",platform:"darwin"}]);function O6e(e,t){return D6e.filter(a=>(!a.platform||a.platform===t)&&Tv(e,a.names))}function z6e(e){return Dj.filter(t=>Tv(e,[t.id,t.name,...t.aliases??[]]))}function L6e(e){return qz.filter(t=>Tv(e,[t.id,t.name,...t.aliases]))}const _6e=Object.freeze([{name:"QuickBooks",claude:"quickbooks"},{name:"Granola",featured:"granola"},{name:"Gmail",claude:"gmail"},{name:"Google Calendar",claude:"google-calendar"},{name:"Google Drive",claude:"google-drive"},{name:"Microsoft 365",claude:"microsoft-365"},{name:"Slack",claude:"slack"},{name:"Zoom",claude:"zoom"},{name:"Docusign",claude:"docusign"},{name:"HubSpot",featured:"hubspot"},{name:"Stripe",featured:"stripe"},{name:"Canva",featured:"canva"},{name:"Notion",featured:"notion"},{name:"Asana",featured:"asana"}]);function F6e(e){const t=e.featured?R6e(e.featured):void 0;if(t)return{kind:"direct",server:t};const a=e.claude?Xpe(e.claude):void 0;return a?{kind:"claude",connector:a}:{kind:"none"}}function q6e(e=Z){const[t,a]=f.useState(null);return f.useEffect(()=>{let o=!0;return e("/api/marketplace/claude-connectors").then(i=>o&&a(i)).catch(()=>o&&a("error")),()=>{o=!1}},[e]),t}function U6e(e,t){return!t||t==="error"?[]:t.engines.filter(a=>a.connectors.some(o=>o.state==="connected"&&Tv(o.name.replace(/^claude\.ai\s+/i,""),[e.name,...e.aliases])))}function jV({connector:e,data:t}){return U6e(e,t).length?n.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-success/10 px-2 py-0.5 text-[10.5px] font-medium text-success","data-testid":"connected-via-claude",children:[n.jsx(mt,{size:11})," ",l("mcpMarket.claude.connected")]}):null}function zj({label:e}){return n.jsxs("button",{type:"button",onClick:()=>{_l(Fz)},className:"inline-flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5 text-[12.5px] font-medium text-ink hover:bg-raised-hover",children:[n.jsx(Mn,{size:13})," ",e??l("mcpMarket.claude.open")]})}function V6e({name:e}){return n.jsxs("button",{type:"button",onClick:()=>Gg("idea",l("feedback.connectionIdea",{name:e})),"aria-label":l("mcpMarket.suggestAria",{name:e}),className:"inline-flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5 text-[12.5px] font-medium text-ink hover:bg-raised-hover",children:[n.jsx(O4,{size:13})," ",l("mcpMarket.suggest")]})}function H6e({connector:e,data:t,highlight:a=!1}){return n.jsxs("div",{className:V("flex flex-col rounded-2xl border bg-card/80 p-4",a?"border-accent/60":"border-hairline/50"),"data-testid":"claude-connector","data-connector":e.id,children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(xp,{name:e.name}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-[14px] font-semibold text-ink",children:e.name}),n.jsxs("div",{className:"mt-1 flex flex-wrap gap-1.5",children:[n.jsx("span",{className:"inline-block rounded-full bg-raised px-2 py-0.5 text-[10.5px] font-medium text-ink-secondary",children:l("mcpMarket.path.claude")}),n.jsx(jV,{connector:e,data:t})]})]})]}),n.jsx("p",{className:"mt-2.5 flex-1 text-[12.5px] leading-snug text-ink-secondary",children:e.description}),n.jsx("div",{className:"mt-3",children:n.jsx(zj,{})})]})}function $6e({account:e}){const{dispatch:t}=ke();return n.jsxs("div",{className:"flex flex-col rounded-2xl border border-accent/40 bg-card/80 p-4","data-testid":"marketplace-account-tile",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(xp,{name:e.name,className:"size-9"}),n.jsx("div",{className:"min-w-0 flex-1 text-[14px] font-medium text-ink",children:e.name})]}),n.jsx("p",{className:"mt-2 text-[12.5px] text-ink-secondary",children:e.description}),n.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:l("mcpMarket.best.account")}),n.jsx("button",{type:"button",className:"ui-button mt-3 self-start",onClick:()=>t({type:"toggleAppSettings",open:!0,section:"accounts"}),children:l("mcpMarket.best.openAccounts")})]})}function G6e({query:e,data:t,renderFeatured:a}){const o=e.trim();if(!o)return null;const i=O6e(o,Zi()?"darwin":"win32"),s=z6e(o),r=s.length?[]:L6e(o);return n.jsxs("section",{"aria-labelledby":"mcp-best-title",className:"mb-9","data-testid":"marketplace-best-match",children:[n.jsx("h3",{id:"mcp-best-title",className:"text-[15px] font-semibold text-ink",children:l("mcpMarket.best.title",{query:o})}),i.length||s.length||r.length?n.jsxs("div",{className:"mt-4 grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[i.map(c=>n.jsx($6e,{account:c},c.provider)),s.map(c=>n.jsx("div",{className:"contents",children:a(c)},c.id)),r.map(c=>n.jsx(H6e,{connector:c,data:t,highlight:!0},c.id))]}):n.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3 rounded-2xl border border-hairline/50 bg-raised/35 px-4 py-3",children:[n.jsx("p",{className:"min-w-0 flex-1 text-[12.5px] text-ink-secondary",children:l("mcpMarket.best.none",{query:o})}),n.jsx(V6e,{name:o})]})]})}function K6e({data:e,renderAdd:t}){return n.jsxs("section",{"aria-labelledby":"mcp-recommended-title",className:"mb-9","data-testid":"marketplace-recommended",children:[n.jsx("h3",{id:"mcp-recommended-title",className:"text-[15px] font-semibold text-ink",children:l("mcpMarket.recommended.title")}),n.jsx("p",{className:"mt-1 max-w-[640px] text-[12.5px] leading-relaxed text-ink-secondary",children:l("mcpMarket.recommended.subtitle")}),n.jsx("ul",{className:"mt-4 grid grid-cols-1 gap-2 md:grid-cols-2",children:_6e.map(a=>{const o=F6e(a);return o.kind==="none"?null:n.jsxs("li",{className:"flex items-center gap-3 rounded-xl border border-hairline/40 bg-card/70 px-3 py-2.5","data-path":o.kind,children:[n.jsx(xp,{src:o.kind==="direct"?Oj(o.server.id):void 0,name:a.name,className:"size-8"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-[13.5px] font-medium text-ink",children:a.name}),n.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-1.5 text-[11px] text-ink-secondary",children:[l(o.kind==="direct"?"mcpMarket.path.direct":"mcpMarket.path.claude"),o.kind==="claude"&&n.jsx(jV,{connector:o.connector,data:e})]})]}),n.jsx("div",{className:"shrink-0",children:o.kind==="direct"?t(o.server):n.jsx(zj,{label:l("mcpMarket.claude.turnOn")})})]},a.name)})})]})}const W6e=e=>e==="personal"?"mcpMarket.claude.owner.personal":"mcpMarket.claude.owner.company";function J6e({data:e,claudeSwitch:t}){return n.jsxs("section",{"aria-labelledby":"mcp-claude-title",className:"mt-9","data-testid":"marketplace-claude",children:[n.jsx("h3",{id:"mcp-claude-title",className:"text-[15px] font-semibold text-ink",children:l("mcpMarket.claude.title")}),n.jsx("p",{className:"mt-1 max-w-[640px] text-[12.5px] leading-relaxed text-ink-secondary",children:l("mcpMarket.claude.subtitle")}),n.jsx("div",{className:"mt-3",children:n.jsx(zj,{})}),t,n.jsx("div",{className:"mt-4","aria-live":"polite",children:e===null?n.jsxs("div",{className:"flex items-center gap-2 text-[12.5px] text-ink-secondary",children:[n.jsx(je,{size:13,className:"animate-spin"})," ",l("mcpMarket.claude.loading")]}):e==="error"?null:e.engines.length===0?n.jsx("p",{className:"text-[12.5px] text-ink-secondary",children:l("mcpMarket.claude.noEngine")}):n.jsx("div",{className:"flex flex-col gap-3",children:e.engines.map(a=>{const o=l("mcpMarket.claude.engine",{engine:a.displayName,owner:l(W6e(a.owner))}),i=a.connectors.filter(s=>s.state==="connected");return n.jsxs("div",{className:"rounded-xl border border-hairline/40 bg-card/70 px-3 py-2.5","data-testid":"claude-engine",children:[n.jsx("div",{className:"text-[13px] font-medium text-ink",children:o}),n.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:a.state==="api-key"?l("mcpMarket.claude.apiKey",{engine:a.displayName}):a.state==="signed-out"?l("mcpMarket.claude.signedOut",{engine:a.displayName}):a.state==="error"?l("mcpMarket.claude.error",{engine:a.displayName}):i.length===0?l("mcpMarket.claude.none"):i.map(s=>s.name.replace(/^claude\.ai\s+/i,"")).join(", ")})]},a.instanceId)})})})]})}async function Y6e(e,t=Z,a=!1){try{const o=await t("/api/mcp/registry/add",{method:"POST",body:JSON.stringify({id:e,...a?{overrideThreatScan:!0}:{}})});return o.threatScan&&o.threatScan.verdict!=="clean"?{kind:"added",name:o.added,threatScan:o.threatScan}:{kind:"added",name:o.added}}catch(o){const i=F0(o),s=o instanceof Error?o.message:String(o);return i?{kind:"blocked",error:s,threatScan:i}:{kind:"error",error:s}}}function Z6e(e,t){const a=s=>s.replace(/\/+$/,"").toLowerCase(),o=new Set(t.urls.map(a));return e.find(s=>s.url&&o.has(a(s.url))?!0:(s.args??[]).some(r=>o.has(a(r))||t.packages.some(c=>r===c||r.startsWith(`${c}@`)||r.startsWith(`${c}==`))))?.name}function Q6e(e){let t=0;for(const a of e)t=t*31+a.charCodeAt(0)|0;return`hsl(${Math.abs(t)%360} 55% 45%)`}function xp({src:e,name:t,className:a="size-11"}){const[o,i]=f.useState(!1);return e&&!o?n.jsx("img",{src:e,alt:"",loading:"lazy",className:V("shrink-0 rounded-xl object-contain",a),onError:()=>i(!0)}):n.jsx("div",{"aria-hidden":"true",className:V("flex shrink-0 items-center justify-center rounded-xl text-[16px] font-semibold text-white",a),style:{backgroundColor:Q6e(t)},children:(t.trim()[0]??"?").toUpperCase()})}function X6e({state:e,onAddAnyway:t}){return n.jsxs(n.Fragment,{children:[n.jsx("p",{role:"alert",className:"mt-2 text-[11.5px] text-danger",children:e.error}),e.threatScan&&n.jsx(Fl,{result:e.threatScan}),e.threatScan&&t&&n.jsx("button",{type:"button",onClick:t,className:"mt-2 rounded-lg bg-danger px-3 py-1.5 text-[12px] font-semibold text-white",children:l("threatScan.addAnyway")})]})}function eNe({onOpenMcp:e}){return n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsxs("span",{role:"status",className:"flex items-center gap-1 text-[12px] font-medium text-success",children:[n.jsx(mt,{size:13})," ",l("mcpMarket.added")]}),n.jsx("button",{type:"button",onClick:e,className:"rounded-full bg-accent px-3 py-1.5 text-[12px] font-medium text-accent-ink hover:opacity-90",children:l("mcpMarket.openMcp")})]})}function NV({name:e,busy:t,onClick:a,large:o=!1}){return n.jsx("button",{type:"button",disabled:t,onClick:a,"aria-label":l("mcpMarket.addAria",{name:e}),className:V("flex items-center justify-center gap-1.5 rounded-full bg-accent font-medium text-accent-ink transition-opacity hover:opacity-90 disabled:opacity-50",o?"min-w-[92px] px-4 py-2 text-[13px]":"min-w-[76px] px-3 py-1.5 text-[12.5px]"),children:t?n.jsx(je,{size:14,className:"animate-spin"}):n.jsxs(n.Fragment,{children:[n.jsx(Sn,{size:14}),l("mcpMarket.add")]})})}function tNe({server:e,state:t,onAdd:a,onOpenMcp:o,onAddAnyway:i}){return n.jsxs("div",{className:"flex flex-col rounded-2xl border border-hairline/50 bg-card/80 p-4 shadow-sm shadow-black/5 backdrop-blur-sm transition-colors hover:border-hairline",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(xp,{src:Oj(e.id),name:e.name}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-[14px] font-semibold text-ink",children:e.name}),n.jsx("span",{className:"mt-1 inline-block rounded-full bg-raised px-2 py-0.5 text-[10.5px] font-medium text-ink-secondary",children:l(`mcpMarket.category.${e.category}`)})]})]}),n.jsx("p",{className:"mt-2.5 min-h-[34px] flex-1 text-[12.5px] leading-snug text-ink-secondary",children:e.description}),n.jsxs("div",{className:"mt-3",children:[t.phase==="added"?n.jsx(eNe,{onOpenMcp:o}):n.jsx(NV,{name:e.name,busy:t.phase==="adding",onClick:a,large:!0}),t.phase==="error"&&n.jsx(X6e,{state:t,onAddAnyway:i}),t.phase==="added"&&t.threatScan&&n.jsx(Fl,{result:t.threatScan,compact:!0})]})]})}function nNe({query:e,onQueryChange:t,onOpenMcp:a,request:o=Z,claudeSwitch:i}){const[s,r]=f.useState({}),[c,d]=f.useState([]),p=q6e(o),h=f.useCallback((w,N)=>r(C=>({...C,[w]:N})),[]);f.useEffect(()=>{let w=!0;return o("/api/mcp/servers").then(N=>w&&d(N.servers??[])).catch(()=>{}),()=>{w=!1}},[o]);const g=f.useRef(new Set),b=async(w,N=!1)=>{const C=`featured:${w.id}`;h(C,{phase:"adding"});const j=await Y6e(C,o,N);j.kind==="added"?(g.current.delete(C),h(C,j.threatScan?{phase:"added",name:j.name,threatScan:j.threatScan}:{phase:"added",name:j.name}),d(M=>[...M,{name:j.name}])):j.kind==="blocked"?(g.current.add(C),h(C,{phase:"error",error:j.error,threatScan:j.threatScan})):h(C,{phase:"error",error:j.error||w.name})},x=w=>{const N=s[`featured:${w.id}`];if(N&&N.phase!=="idle")return N;const C=Z6e(c,{urls:[w.url],packages:[]});return C?{phase:"added",name:C}:{phase:"idle"}},v=w=>n.jsx(tNe,{server:w,state:x(w),onAdd:()=>{b(w)},onOpenMcp:a,onAddAnyway:()=>g.current.has(`featured:${w.id}`)&&void b(w,!0)},w.id),k=w=>{const N=x(w);return N.phase==="added"?n.jsxs("span",{className:"inline-flex items-center gap-1 text-[12px] font-medium text-success",children:[n.jsx(mt,{size:13}),l("mcpMarket.addedShort")]}):n.jsx(NV,{name:w.name,busy:N.phase==="adding",onClick:()=>{b(w)}})};return n.jsxs("div",{children:[n.jsxs("label",{className:"mb-6 flex h-11 w-full items-center gap-2.5 rounded-xl border border-hairline/50 bg-raised/70 px-3.5 sm:max-w-[480px]",children:[n.jsx(La,{size:17,className:"shrink-0 text-ink-secondary"}),n.jsx("input",{type:"search",value:e,onChange:w=>t(w.target.value),placeholder:l("mcpMarket.search.officialPlaceholder"),"aria-label":l("mcpMarket.search.officialPlaceholder"),className:"min-w-0 flex-1 bg-transparent text-[14px] text-ink placeholder:text-ink-secondary focus:outline-none"})]}),n.jsx(G6e,{query:e,data:p,renderFeatured:v}),n.jsx(K6e,{data:p,renderAdd:k}),n.jsxs("section",{"aria-labelledby":"mcp-featured-title",children:[n.jsx("h3",{id:"mcp-featured-title",className:"text-[15px] font-semibold text-ink",children:l("mcpMarket.featured.title")}),n.jsx("p",{className:"mt-1 max-w-[640px] text-[12.5px] leading-relaxed text-ink-secondary",children:l("mcpMarket.featured.subtitle")}),n.jsx("div",{className:"mt-4 grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:Dj.map(v)})]}),n.jsx(J6e,{data:p,claudeSwitch:i}),n.jsxs("p",{className:"mt-8 max-w-[640px] text-[12px] leading-relaxed text-ink-secondary","data-testid":"marketplace-official-note",children:[l("mcpMarket.officialOnly")," ",n.jsx("button",{type:"button",className:"font-medium text-accent underline-offset-2 hover:underline",onClick:a,children:l("mcpMarket.officialOnlyLink")})]})]})}function AV({message:e}){const{dispatch:t}=ke(),a=e.marketplace;if(!a)return null;const o=()=>t(a.source==="account"?{type:"toggleAppSettings",open:!0,section:"accounts"}:{type:"openMarketplace",query:a.query,...a.serverId?{serverId:a.serverId}:{}}),i=a.source==="featured"&&a.serverId?.startsWith("featured:")?a.serverId.slice(9):void 0;return a.source==="none"?n.jsx("div",{className:"w-[min(30rem,100%)] rounded-2xl border border-hairline/50 bg-card px-4 py-3.5","data-testid":"marketplace-card","data-source":"none",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-xl bg-raised text-ink-secondary",children:n.jsx(O4,{size:17})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-[14px] font-medium text-ink",children:l("chat.marketplace.none",{name:a.name})}),n.jsx("p",{className:"mt-0.5 text-[12.5px] leading-relaxed text-ink-secondary",children:l("chat.marketplace.noneHint")}),n.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[n.jsx("button",{type:"button",className:"rounded-lg bg-accent px-3 py-1.5 text-[12.5px] font-medium text-white hover:opacity-90",onClick:()=>Gg("idea",l("feedback.connectionIdea",{name:a.name})),children:l("chat.marketplace.suggest")}),n.jsx("button",{type:"button",className:"ui-button",onClick:o,children:l("chat.marketplace.open")})]})]})]})}):n.jsx("div",{className:"w-[min(30rem,100%)] rounded-2xl border border-hairline/50 bg-card px-4 py-3.5","data-testid":"marketplace-card","data-source":a.source,children:n.jsxs("div",{className:"flex items-start gap-3",children:[i?n.jsx(xp,{src:Oj(i),name:a.name,className:"size-9"}):n.jsx(xp,{name:a.name,className:"size-9"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-[14px] font-medium text-ink",children:a.name}),n.jsx("p",{className:"mt-0.5 text-[12.5px] leading-relaxed text-ink-secondary",children:a.source==="account"?l("chat.marketplace.accountHint"):a.source==="claude"?l("chat.marketplace.claudeHint"):l("chat.marketplace.directHint")}),n.jsx("button",{type:"button",className:"mt-3 rounded-lg bg-accent px-3 py-1.5 text-[12.5px] font-medium text-white hover:opacity-90",onClick:o,children:a.source==="account"?l("chat.marketplace.connectAccount",{name:a.name}):a.source==="claude"?l("chat.marketplace.connectClaude",{name:a.name}):l("chat.marketplace.connect",{name:a.name})})]})]})})}function aNe({query:e,serverId:t,children:a}){const{dispatch:o}=ke();return n.jsxs("button",{type:"button",onClick:()=>o({type:"openMarketplace",query:e,...t?{serverId:t}:{}}),className:"inline-flex items-center gap-1 rounded-md bg-accent/10 px-1.5 py-0.5 align-baseline text-[13.5px] font-medium text-accent hover:bg-accent/15","data-testid":"marketplace-link",children:[n.jsx(v0,{size:13,"aria-hidden":"true"}),a??l("chat.marketplace.open")]})}const oNe="chibi://marketplace";function Lj(e){return e.trim().toLowerCase().startsWith(oNe)}function iNe(e){if(!Lj(e))return null;let t;try{t=new URL(e.trim())}catch{return null}if(t.hostname.toLowerCase()!=="marketplace"||t.pathname&&t.pathname!=="/")return null;const a=(t.searchParams.get("q")??"").replace(/\s+/g," ").trim().slice(0,80),o=(t.searchParams.get("server")??"").trim().slice(0,300);return{query:a,...o?{serverId:o}:{}}}const ah=new Map,sNe=200,oh=new Map,rNe=50;let gT=0;const MV=250,IV=e=>{let t=2166136261;for(let a=0;a<e.length;a++)t^=e.charCodeAt(a),t=Math.imul(t,16777619);return(t>>>0).toString(36)},PV=/^[a-zA-Z]:[\\/]/,fT=e=>e.startsWith("/")||PV.test(e)?e:null,wg=e=>{if(!e)return null;if(/^file:\/\//i.test(e))try{const a=new URL(e);if(a.username||a.password||a.port||a.search||a.hash)return null;const o=decodeURIComponent(a.pathname);return a.hostname&&a.hostname!=="localhost"?`//${a.hostname}${o}`:/^\/[a-z]:[\\/]/i.test(o)?o.slice(1):fT(o)}catch{return null}if(e.startsWith("\\\\"))return e;if(e.startsWith("//"))return null;const t=fT(e);return t||(e.startsWith("#")||/^[a-z][a-z\d+.-]*:/i.test(e)?null:e)};function lNe(e){if(GL(e)||Lj(e))return e;const t=/^[a-zA-Z]:%5C/i.test(e)?e.replace(/%5C/gi,"\\"):e;return/^file:\/\//i.test(t)||PV.test(t)||t.startsWith("\\\\")?wg(t)?t:"":Uq(e)}function cNe(){const e=this.data();(e.fromMarkdownExtensions??=[]).push(CV)}function dNe(){return e=>{const t=a=>{a.children&&(a.children=a.children.map(o=>{if(o?.type==="link"&&o.children?.length===1&&o.children[0]?.type==="image"){const i=o.children[0];return{...i,data:{...i.data,hProperties:{...i.data?.hProperties,"data-open-url":o.url}}}}return t(o),o}))};t(e)}}const uNe=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF\u{10800}-\u{10FFF}\u{1E800}-\u{1EFFF}]/u;function pNe(e){const t=new RegExp("\\p{Letter}","u").exec(e);return t&&uNe.test(t[0])?"rtl":"ltr"}function TV(e){return e?e.type==="text"?e.value??"":e.tagName==="code"||e.tagName==="pre"?"":(e.children??[]).map(TV).join(""):""}function is(e){return pNe(TV(e))}function mNe({code:e,lang:t,streaming:a}){const[o,i]=f.useState(null),[s,r]=f.useState(!1),[c,d]=f.useState(!1),p=f.useRef(null);f.useEffect(()=>()=>{p.current!==null&&clearTimeout(p.current)},[]),f.useEffect(()=>{const v=`${t}:${IV(e)}`,k=ah.get(v);if(k)return i(k);let w=!0,N;const C=()=>{QC(()=>import("./index-kYL6p_po.js"),[]).then(j=>j.codeToHtml(e,{lang:t||"text",themes:{light:"github-light-default",dark:"github-dark-default"},defaultColor:"light-dark()"})).then(j=>{if(w){if(ah.size>=sNe){const M=ah.keys().next().value;M&&ah.delete(M)}ah.set(v,j),i(j)}}).catch(()=>{})};return a?(i(null),N=setTimeout(C,MV)):C(),()=>{w=!1,N!==void 0&&clearTimeout(N)}},[e,t,a]);const h=()=>{navigator.clipboard?.writeText&&navigator.clipboard.writeText(e).then(()=>{r(!0),p.current!==null&&clearTimeout(p.current),p.current=setTimeout(()=>r(!1),1500)}).catch(()=>{})},g=()=>{const v=j6e(t);N6e(v,e)},b=k6e(t),x=w6e(e);return n.jsxs("div",{dir:"ltr",className:"my-2 overflow-hidden rounded-lg border border-hairline/40 bg-inset",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-hairline/30 bg-raised/30 px-3 py-1.5 text-xs",children:[n.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[n.jsx("span",{title:b,className:"min-w-0 truncate rounded border border-hairline/40 bg-raised px-1.5 py-0.5 text-[11px] font-medium tracking-wide text-ink select-none",children:b}),x>0&&n.jsx("span",{className:"shrink-0 whitespace-nowrap text-[11px] text-ink-secondary select-none",children:S6e(x)})]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1 whitespace-nowrap",children:[n.jsxs("button",{type:"button",onClick:()=>d(v=>!v),className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] transition-colors ${c?"bg-accent/15 text-accent font-medium":"text-ink-secondary hover:bg-raised hover:text-ink"}`,title:c?"Disable line wrapping":"Wrap long lines","aria-label":c?"Disable line wrapping":"Wrap long lines","aria-pressed":c,children:[n.jsx(FE,{size:12,"aria-hidden":"true"}),n.jsx("span",{className:"hidden sm:inline",children:c?"Unwrap":"Wrap"})]}),n.jsxs("button",{type:"button",onClick:g,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] text-ink-secondary hover:bg-raised hover:text-ink transition-colors",title:"Download snippet as file","aria-label":"Download snippet as file",children:[n.jsx(ga,{size:12,"aria-hidden":"true"}),n.jsx("span",{className:"hidden sm:inline",children:"Save"})]}),n.jsx("button",{type:"button",onClick:h,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] text-ink-secondary hover:bg-raised hover:text-ink transition-colors",title:s?"Copied to clipboard":"Copy code","aria-label":s?"Code copied to clipboard":"Copy code to clipboard",children:s?n.jsxs(n.Fragment,{children:[n.jsx(mt,{size:12,className:"text-success","aria-hidden":"true"}),n.jsx("span",{className:"text-success font-medium hidden sm:inline",children:"Copied!"})]}):n.jsxs(n.Fragment,{children:[n.jsx(Xa,{size:12,"aria-hidden":"true"}),n.jsx("span",{className:"hidden sm:inline",children:"Copy"})]})})]})]}),o?n.jsx("div",{className:`text-[13px] leading-relaxed [&_pre]:!bg-transparent [&_pre]:m-0 [&_pre]:p-3 ${c?"whitespace-pre-wrap break-words overflow-x-hidden [&_pre]:!whitespace-pre-wrap [&_pre]:!break-words [&_code]:!whitespace-pre-wrap [&_code]:!break-words":"overflow-x-auto"}`,dangerouslySetInnerHTML:{__html:o}}):n.jsx("pre",{className:`p-3 text-[13px] leading-relaxed text-ink ${c?"whitespace-pre-wrap break-words overflow-x-hidden":"overflow-x-auto"}`,children:e})]})}function hNe(e){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"}}const gNe='"Inter", -apple-system, BlinkMacSystemFont, "SF UI Text", "Segoe UI", system-ui, sans-serif';function fNe({code:e,streaming:t}){const a=f.useRef(null),[o,i]=f.useState(0),[s,r]=f.useState(null),[c,d]=f.useState(null),[p,h]=f.useState(!1),[g,b]=f.useState(!1),x=f.useRef(null);f.useEffect(()=>{if(typeof MutationObserver>"u"||typeof document>"u")return;const k=new MutationObserver(()=>i(w=>w+1));return k.observe(document.documentElement,{subtree:!0,attributeFilter:["data-skin"]}),()=>k.disconnect()},[]),f.useEffect(()=>{const k=hNe(a.current),w=`${k}:${IV(e)}`,N=oh.get(w);if(N){r(N),d(null);return}let C=!0,j;const M=()=>{QC(()=>import("./mermaid.core-BHRIdye5.js").then(E=>E.bz),[]).then(E=>(gT+=1,E.default.initialize({startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,theme:k==="light"?"default":"dark",fontFamily:gNe}),E.default.render(`omb-mermaid-${gT}`,e))).then(E=>{if(C){if(oh.size>=rNe){const A=oh.keys().next().value;A&&oh.delete(A)}oh.set(w,E.svg),r(E.svg),d(null)}}).catch(E=>{if(!C||t)return;const A=E instanceof Error?E.message:String(E);d(A.length>300?`${A.slice(0,300)}…`:A)})};return t?(r(null),d(null),j=setTimeout(M,MV)):M(),()=>{C=!1,j!==void 0&&clearTimeout(j)}},[e,t,o]),f.useEffect(()=>()=>{x.current!==null&&clearTimeout(x.current)},[]);const v=()=>{navigator.clipboard?.writeText&&navigator.clipboard.writeText(e).then(()=>{b(!0),x.current!==null&&clearTimeout(x.current),x.current=setTimeout(()=>b(!1),1500)}).catch(()=>{})};return n.jsxs("div",{ref:a,dir:"ltr",className:"my-2 overflow-hidden rounded-lg border border-hairline/40 bg-inset",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-hairline/30 bg-raised/30 px-3 py-1.5 text-xs",children:[n.jsx("span",{title:"Mermaid diagram",className:"min-w-0 truncate rounded border border-hairline/40 bg-raised px-1.5 py-0.5 text-[11px] font-medium tracking-wide text-ink select-none",children:"Mermaid diagram"}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1 whitespace-nowrap",children:[n.jsxs("button",{type:"button",onClick:()=>h(k=>!k),className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] transition-colors ${p?"bg-accent/15 text-accent font-medium":"text-ink-secondary hover:bg-raised hover:text-ink"}`,title:p?"Hide diagram source":"Show diagram source","aria-label":p?"Hide diagram source":"Show diagram source","aria-pressed":p,children:[n.jsx(FE,{size:12,"aria-hidden":"true"}),n.jsx("span",{className:"hidden sm:inline",children:p?"Hide source":"Show source"})]}),n.jsx("button",{type:"button",onClick:v,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] text-ink-secondary hover:bg-raised hover:text-ink transition-colors",title:g?"Copied to clipboard":"Copy diagram source","aria-label":g?"Diagram source copied to clipboard":"Copy diagram source to clipboard",children:g?n.jsxs(n.Fragment,{children:[n.jsx(mt,{size:12,className:"text-success","aria-hidden":"true"}),n.jsx("span",{className:"text-success font-medium hidden sm:inline",children:"Copied!"})]}):n.jsxs(n.Fragment,{children:[n.jsx(Xa,{size:12,"aria-hidden":"true"}),n.jsx("span",{className:"hidden sm:inline",children:"Copy"})]})})]})]}),c&&n.jsxs("p",{role:"alert",className:"px-3 pt-2 text-[12px] text-danger",children:["Diagram could not be rendered: ",c]}),s&&n.jsx("div",{className:"overflow-x-auto p-3 [&_svg]:!max-w-full",dangerouslySetInnerHTML:{__html:s}}),(p||!s||c)&&n.jsx("pre",{className:"overflow-x-auto p-3 text-[13px] leading-relaxed text-ink",children:e})]})}function bNe({filePath:e,children:t,message:a}){const o=fL(e,void 0,a);if(!a)return n.jsx("span",{title:"Unavailable legacy file reference",className:"break-words text-ink-secondary",children:t});const i=o.state==="saving"?"Saving…":o.state==="saved"?"Saved":o.state==="failed"?"Retry":null;return n.jsxs("span",{dir:"ltr",className:"inline-flex flex-wrap items-center gap-x-1.5 [unicode-bidi:isolate]",children:[n.jsxs("button",{type:"button",onClick:()=>{o.save()},disabled:o.state==="saving",title:"Save a copy",className:"inline-flex items-center gap-1 break-words text-start text-accent underline decoration-accent/40 hover:decoration-accent disabled:cursor-wait",children:[t,o.state==="saving"?n.jsx(je,{size:12,className:"shrink-0 animate-spin","aria-hidden":"true"}):o.state==="saved"?n.jsx(mt,{size:12,className:"shrink-0 text-success","aria-hidden":"true"}):o.state==="failed"?n.jsx(Fs,{size:12,className:"shrink-0","aria-hidden":"true"}):n.jsx(ga,{size:12,className:"shrink-0","aria-hidden":"true"})]}),i&&n.jsx("span",{role:o.state==="failed"?"alert":"status",title:o.state==="saved"?o.savedTo:void 0,className:`text-[12px] ${o.state==="saved"?"text-success":o.state==="failed"?"text-danger":"text-ink-secondary"}`,children:o.state==="failed"?o.reason:i})]})}function yNe(e,t){const a=t?.trim();if(a)return a;try{const i=decodeURIComponent(new URL(e,"https://openmausbot.invalid").pathname).split(/[\\/]/).filter(Boolean).at(-1)?.trim();if(i)return i}catch{}return"Image"}function xNe(e){try{const t=new URL(e.startsWith("//")?`https:${e}`:e);return t.protocol==="https:"||t.protocol==="http:"?t.toString():void 0}catch{return}}function vNe({children:e}){const[t,a]=f.useState(!1);return t?n.jsxs("span",{className:"mx-px inline rounded px-1 py-px text-[13px] leading-relaxed text-ink underline decoration-dotted decoration-hairline underline-offset-2",children:[e,n.jsx("button",{type:"button","aria-label":"Hide spoiler",title:"Hide spoiler",onClick:()=>a(!1),className:"ms-1 rounded px-0.5 text-[11px] text-ink-secondary hover:text-ink",children:"Hide"})]}):n.jsxs("span",{className:"relative mx-px inline-block rounded px-1 py-px",children:[n.jsx("span",{"aria-hidden":"true",className:"pointer-events-none select-none bg-raised text-transparent [&_*]:!text-transparent [&_a]:!no-underline",children:e}),n.jsx("button",{type:"button","aria-label":"Reveal spoiler",title:"Reveal spoiler",onClick:()=>a(!0),className:"absolute inset-0 rounded bg-raised/90"})]})}const Q5=[],kNe="![";function wNe(e,t){const a=/(^|\r?\n)((?: {0,3}>[ \t]?)* {0,3})(?:(`{3,})([^`\r\n]*)|(~{3,})([^\r\n]*))(?:\r?\n|$)/g;let o=0,i="",s;for(;(s=a.exec(e))!==null;){const r=s[3]??s[5],c=r[0],d=new RegExp(`(^|\\r?\\n)(?: {0,3}>[ \\t]?)* {0,3}${c}{${r.length},}[ \\t]*(?=\\r?\\n|$)`,"g");d.lastIndex=a.lastIndex;const p=d.exec(e),h=p===null?e.length:p.index+p[0].length;i+=e.slice(o,s.index),i+=t(e.slice(s.index,h)),o=h,a.lastIndex=h}return i+e.slice(o)}function SNe(e){const t=[],a=s=>{const r=`\0OMB_CODE_${t.length}\0`;return t.push(s),r};let i=wNe(e,a).replace(/(`+)[\s\S]*?\1/g,a).replace(/\\\[([\s\S]*?)\\\]/g,(s,r)=>`$$
|
|
548
|
+
`)}function P6e(e){if(!e.includes("|"))return e;const t=[];let a=0;for(const o of rj(e).children){if(o.type!=="paragraph")continue;const i=o.position?.start.offset,s=o.position?.end.offset;if(i===void 0||s===void 0)continue;const r=e.slice(i,s);/[`\\]/.test(r)||(t.push(e.slice(a,i),I6e(r)),a=s)}return t.push(e.slice(a)),t.join("")}const SV=new WeakSet,T6e=/^[A-Za-z]:(?:[\\/]|$)/,B6e=new Set(["\\","(",")","<",">"]);function mT(){this.buffer(),SV.add(this.stack[this.stack.length-1])}function E6e(e){const t=this.stack.pop(),a=this.sliceSerialize(e),o=SV.has(this.stack[this.stack.length-1])&&T6e.test(t.value)&&!B6e.has(a);t.value+=o?`\\${a}`:a,t.position.end={line:e.end.line,column:e.end.column,offset:e.end.offset}}const CV={enter:{resourceDestinationString:mT,definitionDestinationString:mT},exit:{characterEscapeValue:E6e}},Dj=Object.freeze([{id:"github",name:"GitHub",description:"Read code, issues and pull requests in your repositories.",category:"dev",url:"https://api.githubcopilot.com/mcp/",transport:"http"},{id:"notion",name:"Notion",description:"Search, read and write pages in your Notion workspace.",category:"productivity",url:"https://mcp.notion.com/mcp",transport:"http"},{id:"linear",name:"Linear",description:"Find, create and update Linear issues and projects.",category:"productivity",url:"https://mcp.linear.app/mcp",transport:"http"},{id:"atlassian",name:"Atlassian",description:"Work with Jira issues and Confluence pages.",category:"productivity",url:"https://mcp.atlassian.com/v2/mcp",transport:"http",aliases:["jira","confluence"]},{id:"asana",name:"Asana",description:"See and update tasks and projects in Asana.",category:"productivity",url:"https://mcp.asana.com/v2/mcp",transport:"http"},{id:"sentry",name:"Sentry",description:"Look into errors and issues from your Sentry projects.",category:"dev",url:"https://mcp.sentry.dev/mcp",transport:"http"},{id:"vercel",name:"Vercel",description:"Check deployments, logs and projects on Vercel.",category:"dev",url:"https://mcp.vercel.com",transport:"http"},{id:"supabase",name:"Supabase",description:"Manage Supabase projects, tables and edge functions.",category:"data",url:"https://mcp.supabase.com/mcp",transport:"http"},{id:"cloudflare",name:"Cloudflare Docs",description:"Search Cloudflare's developer documentation. No sign-in.",category:"dev",url:"https://docs.mcp.cloudflare.com/mcp",transport:"http"},{id:"huggingface",name:"Hugging Face",description:"Search models, datasets, Spaces and papers.",category:"data",url:"https://huggingface.co/mcp",transport:"http"},{id:"canva",name:"Canva",description:"Find, create and export Canva designs.",category:"design",url:"https://mcp.canva.com/mcp",transport:"http"},{id:"webflow",name:"Webflow",description:"Edit Webflow sites, pages and CMS content.",category:"design",url:"https://mcp.webflow.com/mcp",transport:"http"},{id:"hubspot",name:"HubSpot",description:"Look up contacts, companies and deals in HubSpot.",category:"data",url:"https://mcp.hubspot.com/",transport:"http"},{id:"stripe",name:"Stripe",description:"Look up customers, payments and invoices in Stripe.",category:"payments",url:"https://mcp.stripe.com",transport:"http"},{id:"paypal",name:"PayPal",description:"Work with PayPal invoices, orders and transactions.",category:"payments",url:"https://mcp.paypal.com/mcp",transport:"http"},{id:"dropbox",name:"Dropbox",description:"Search, organize and share files in your Dropbox.",category:"productivity",url:"https://mcp.dropbox.com/mcp",transport:"http"},{id:"granola",name:"Granola",description:"Search your Granola meeting notes and transcripts.",category:"productivity",url:"https://mcp.granola.ai/mcp",transport:"http",aliases:["granola ai"]},{id:"square",name:"Square",description:"See Square payments, orders, catalog and customers.",category:"payments",url:"https://mcp.squareup.com/sse",transport:"sse"},{id:"pax8",name:"Pax8",description:"Look up Pax8 products, subscriptions and client companies.",category:"msp",url:"https://mcp.pax8.com/v1/mcp",transport:"http",aliases:["pax 8"]},{id:"huntress",name:"Huntress",description:"Review Huntress agents, incidents, signals and reports.",category:"security",url:"https://api.huntress.io/v1/mcp",transport:"http"},{id:"jumpcloud",name:"JumpCloud",description:"Look up JumpCloud users, devices and groups as an administrator.",category:"security",url:"https://mcp.jumpcloud.com/v1",transport:"http",aliases:["jump cloud"]},{id:"vanta",name:"Vanta",description:"Check compliance tests, controls and vendor risk in Vanta.",category:"security",url:"https://mcp.vanta.com/mcp",transport:"http"},{id:"semgrep",name:"Semgrep",description:"Scan code for security issues with Semgrep.",category:"security",url:"https://mcp.semgrep.ai/mcp",transport:"http"},{id:"socket",name:"Socket",description:"Check open source packages for supply chain risk. No sign-in.",category:"security",url:"https://mcp.socket.dev/",transport:"http",aliases:["socket.dev"]},{id:"zapier",name:"Zapier",description:"Run actions in the apps you have connected to your Zapier account.",category:"productivity",url:"https://mcp.zapier.com/api/v1/connect",transport:"http",aliases:["zaps"]},{id:"monday",name:"monday.com",description:"See and update boards, items and updates in monday.com.",category:"productivity",url:"https://mcp.monday.com/mcp",transport:"http",aliases:["monday"]},{id:"clickup",name:"ClickUp",description:"Find, create and update ClickUp tasks and docs.",category:"productivity",url:"https://mcp.clickup.com/mcp",transport:"http",aliases:["click up"]},{id:"calendly",name:"Calendly",description:"See Calendly event types, bookings and availability.",category:"productivity",url:"https://mcp.calendly.com",transport:"http"},{id:"fireflies",name:"Fireflies",description:"Search Fireflies meeting transcripts and summaries.",category:"productivity",url:"https://api.fireflies.ai/mcp",transport:"http",aliases:["fireflies.ai"]},{id:"otter",name:"Otter",description:"Search Otter meeting notes and transcripts.",category:"productivity",url:"https://mcp.otter.ai/mcp",transport:"http",aliases:["otter.ai","otter ai"]},{id:"todoist",name:"Todoist",description:"Add, find and complete tasks in Todoist.",category:"productivity",url:"https://ai.todoist.net/mcp",transport:"http"},{id:"jotform",name:"Jotform",description:"Build Jotform forms and read their submissions.",category:"productivity",url:"https://mcp.jotform.com/",transport:"http"},{id:"egnyte",name:"Egnyte",description:"Search and read files stored in Egnyte.",category:"productivity",url:"https://mcp-server.egnyte.com/mcp",transport:"http"},{id:"intercom",name:"Intercom",description:"Search Intercom conversations, contacts and tickets.",category:"crm",url:"https://mcp.intercom.com/mcp",transport:"http"},{id:"pipedrive",name:"Pipedrive",description:"Work with deals, contacts and activities in Pipedrive.",category:"crm",url:"https://mcp.pipedrive.ai/mcp",transport:"http"},{id:"apollo",name:"Apollo.io",description:"Find and enrich people and companies in Apollo.",category:"crm",url:"https://mcp.apollo.io/mcp",transport:"http",aliases:["apollo"]},{id:"attio",name:"Attio",description:"Look up and update records and lists in Attio.",category:"crm",url:"https://mcp.attio.com/mcp",transport:"http"},{id:"close",name:"Close",description:"Work with leads, contacts and opportunities in Close.",category:"crm",url:"https://mcp.close.com/mcp",transport:"http",aliases:["close crm","close.com"]},{id:"zoominfo",name:"ZoomInfo",description:"Search ZoomInfo company and contact data.",category:"crm",url:"https://mcp.zoominfo.com/mcp",transport:"http",aliases:["zoom info"]},{id:"gong",name:"Gong",description:"Search Gong calls, deals and conversation insights.",category:"crm",url:"https://mcp.gong.io/mcp",transport:"http"},{id:"klaviyo",name:"Klaviyo",description:"See Klaviyo campaigns, flows, lists and results.",category:"crm",url:"https://mcp.klaviyo.com/mcp",transport:"http"},{id:"ramp",name:"Ramp",description:"Look up Ramp card transactions, bills and spend.",category:"finance",url:"https://mcp.ramp.com/mcp",transport:"http"},{id:"mercury",name:"Mercury",description:"See Mercury bank accounts, balances and transactions.",category:"finance",url:"https://mcp.mercury.com/mcp",transport:"http"},{id:"brex",name:"Brex",description:"See Brex expenses, cards and spend.",category:"finance",url:"https://api.brex.com/mcp",transport:"http"},{id:"expensify",name:"Expensify",description:"Work with Expensify expense reports and expenses.",category:"finance",url:"https://mcp.expensify.com/mcp/",transport:"http"},{id:"paddle",name:"Paddle",description:"Look up Paddle products, subscriptions and transactions.",category:"payments",url:"https://mcp.paddle.com/mcp",transport:"http"},{id:"miro",name:"Miro",description:"Read and create boards, diagrams and sticky notes in Miro.",category:"design",url:"https://mcp.miro.com/",transport:"http"},{id:"gamma",name:"Gamma",description:"Create presentations, documents and web pages with Gamma.",category:"design",url:"https://mcp.gamma.app/mcp",transport:"http"},{id:"wix",name:"Wix",description:"Manage Wix sites, content and business apps.",category:"design",url:"https://mcp.wix.com/mcp",transport:"http"},{id:"heygen",name:"HeyGen",description:"Create AI avatar videos with HeyGen.",category:"design",url:"https://mcp.heygen.com/mcp/v1/",transport:"http",aliases:["hey gen"]},{id:"squarespace",name:"Squarespace Domains",description:"Check which domain names are free to register. No sign-in.",category:"design",url:"https://mcp.squarespace.com/mcp",transport:"http",aliases:["squarespace"]},{id:"airtable",name:"Airtable",description:"Read and update records in your Airtable bases.",category:"data",url:"https://mcp.airtable.com/mcp",transport:"http"},{id:"posthog",name:"PostHog",description:"Query product analytics, feature flags and errors in PostHog.",category:"data",url:"https://mcp.posthog.com/mcp",transport:"http",aliases:["post hog"]},{id:"perplexity",name:"Perplexity",description:"Search the web with Perplexity and get cited answers.",category:"data",url:"https://api.perplexity.ai/mcp",transport:"http"},{id:"exa",name:"Exa",description:"Search the web and read pages with Exa. No sign-in.",category:"data",url:"https://mcp.exa.ai/mcp",transport:"http",aliases:["exa search","exa ai"]},{id:"tavily",name:"Tavily",description:"Search the web and pull content from pages with Tavily.",category:"data",url:"https://mcp.tavily.com/mcp/",transport:"http"},{id:"microsoft-learn",name:"Microsoft Learn",description:"Search Microsoft's official docs and code samples. No sign-in.",category:"dev",url:"https://learn.microsoft.com/api/mcp",transport:"http",aliases:["microsoft docs","azure docs","intune docs","ms learn"]},{id:"cloudflare-api",name:"Cloudflare",description:"Manage Cloudflare accounts, DNS, Workers and more.",category:"dev",url:"https://mcp.cloudflare.com/mcp",transport:"http",aliases:["cloudflare api"]},{id:"gitlab",name:"GitLab",description:"Work with GitLab issues, merge requests and pipelines.",category:"dev",url:"https://gitlab.com/api/v4/mcp",transport:"http",aliases:["git lab"]},{id:"netlify",name:"Netlify",description:"Deploy and manage Netlify sites and projects.",category:"dev",url:"https://netlify-mcp.netlify.app/mcp",transport:"http"},{id:"railway",name:"Railway",description:"Check Railway projects, deployments and logs.",category:"dev",url:"https://mcp.railway.com",transport:"http"},{id:"neon",name:"Neon",description:"Manage Neon Postgres projects, branches and queries.",category:"dev",url:"https://mcp.neon.tech/mcp",transport:"http",aliases:["neon postgres"]},{id:"prisma",name:"Prisma",description:"Manage Prisma Postgres databases.",category:"dev",url:"https://mcp.prisma.io/mcp",transport:"http"},{id:"postman",name:"Postman",description:"Work with Postman collections, APIs and workspaces.",category:"dev",url:"https://mcp.postman.com/mcp",transport:"http"},{id:"datadog",name:"Datadog",description:"Search Datadog logs, metrics, monitors and incidents.",category:"dev",url:"https://mcp.datadoghq.com/api/unstable/mcp-server/mcp",transport:"http"},{id:"grafana",name:"Grafana Cloud",description:"Query dashboards, metrics and logs in Grafana Cloud.",category:"dev",url:"https://mcp.grafana.com/mcp",transport:"http",aliases:["grafana"]},{id:"honeycomb",name:"Honeycomb",description:"Query traces and events in Honeycomb.",category:"dev",url:"https://mcp.honeycomb.io/mcp",transport:"http"},{id:"buildkite",name:"Buildkite",description:"Check Buildkite pipelines, builds and jobs.",category:"dev",url:"https://mcp.buildkite.com/mcp",transport:"http"},{id:"sanity",name:"Sanity",description:"Query and edit content in Sanity.",category:"dev",url:"https://mcp.sanity.io",transport:"http"},{id:"resend",name:"Resend",description:"Send email and manage domains and audiences in Resend.",category:"dev",url:"https://mcp.resend.com/mcp",transport:"http"},{id:"stytch",name:"Stytch",description:"Manage Stytch projects and sign-in settings.",category:"dev",url:"https://mcp.stytch.dev/mcp",transport:"http"}]);function R6e(e){return Dj.find(t=>t.id===e)}function Oj(e){return`/mcp-icons/${e}.svg`}function hT(e){return e.toLowerCase().replace(/[^\p{L}\p{N}.]+/gu," ").replace(/\s+/g," ").trim()}function Tv(e,t){const a=hT(e);if(a.length<2)return!1;const o=` ${a} `;return t.some(i=>{const s=hT(i);return s?s===a||o.includes(` ${s} `)?!0:a.length>=3&&` ${s} `.includes(o):!1})}const D6e=Object.freeze([{provider:"apple",name:"Apple (iCloud)",names:["apple","icloud","icloud drive","apple calendar","apple reminders","reminders","apple contacts"],description:"This Mac's Calendar, Reminders, Contacts and iCloud Drive, read-only, through the accounts built into Atomic.",platform:"darwin"}]);function O6e(e,t){return D6e.filter(a=>(!a.platform||a.platform===t)&&Tv(e,a.names))}function z6e(e){return Dj.filter(t=>Tv(e,[t.id,t.name,...t.aliases??[]]))}function L6e(e){return qz.filter(t=>Tv(e,[t.id,t.name,...t.aliases]))}const _6e=Object.freeze([{name:"QuickBooks",claude:"quickbooks"},{name:"Granola",featured:"granola"},{name:"Gmail",claude:"gmail"},{name:"Google Calendar",claude:"google-calendar"},{name:"Google Drive",claude:"google-drive"},{name:"Microsoft 365",claude:"microsoft-365"},{name:"Slack",claude:"slack"},{name:"Zoom",claude:"zoom"},{name:"Docusign",claude:"docusign"},{name:"HubSpot",featured:"hubspot"},{name:"Stripe",featured:"stripe"},{name:"Canva",featured:"canva"},{name:"Notion",featured:"notion"},{name:"Asana",featured:"asana"}]);function F6e(e){const t=e.featured?R6e(e.featured):void 0;if(t)return{kind:"direct",server:t};const a=e.claude?Xpe(e.claude):void 0;return a?{kind:"claude",connector:a}:{kind:"none"}}function q6e(e=Z){const[t,a]=f.useState(null);return f.useEffect(()=>{let o=!0;return e("/api/marketplace/claude-connectors").then(i=>o&&a(i)).catch(()=>o&&a("error")),()=>{o=!1}},[e]),t}function U6e(e,t){return!t||t==="error"?[]:t.engines.filter(a=>a.connectors.some(o=>o.state==="connected"&&Tv(o.name.replace(/^claude\.ai\s+/i,""),[e.name,...e.aliases])))}function jV({connector:e,data:t}){return U6e(e,t).length?n.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-success/10 px-2 py-0.5 text-[10.5px] font-medium text-success","data-testid":"connected-via-claude",children:[n.jsx(mt,{size:11})," ",l("mcpMarket.claude.connected")]}):null}function zj({label:e}){return n.jsxs("button",{type:"button",onClick:()=>{_l(Fz)},className:"inline-flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5 text-[12.5px] font-medium text-ink hover:bg-raised-hover",children:[n.jsx(Mn,{size:13})," ",e??l("mcpMarket.claude.open")]})}function V6e({name:e}){return n.jsxs("button",{type:"button",onClick:()=>Gg("idea",l("feedback.connectionIdea",{name:e})),"aria-label":l("mcpMarket.suggestAria",{name:e}),className:"inline-flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5 text-[12.5px] font-medium text-ink hover:bg-raised-hover",children:[n.jsx(O4,{size:13})," ",l("mcpMarket.suggest")]})}function H6e({connector:e,data:t,highlight:a=!1}){return n.jsxs("div",{className:V("flex flex-col rounded-2xl border bg-card/80 p-4",a?"border-accent/60":"border-hairline/50"),"data-testid":"claude-connector","data-connector":e.id,children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(xp,{name:e.name}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-[14px] font-semibold text-ink",children:e.name}),n.jsxs("div",{className:"mt-1 flex flex-wrap gap-1.5",children:[n.jsx("span",{className:"inline-block rounded-full bg-raised px-2 py-0.5 text-[10.5px] font-medium text-ink-secondary",children:l("mcpMarket.path.claude")}),n.jsx(jV,{connector:e,data:t})]})]})]}),n.jsx("p",{className:"mt-2.5 flex-1 text-[12.5px] leading-snug text-ink-secondary",children:e.description}),n.jsx("div",{className:"mt-3",children:n.jsx(zj,{})})]})}function $6e({account:e}){const{dispatch:t}=ke();return n.jsxs("div",{className:"flex flex-col rounded-2xl border border-accent/40 bg-card/80 p-4","data-testid":"marketplace-account-tile",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(xp,{name:e.name,className:"size-9"}),n.jsx("div",{className:"min-w-0 flex-1 text-[14px] font-medium text-ink",children:e.name})]}),n.jsx("p",{className:"mt-2 text-[12.5px] text-ink-secondary",children:e.description}),n.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:l("mcpMarket.best.account")}),n.jsx("button",{type:"button",className:"ui-button mt-3 self-start",onClick:()=>t({type:"toggleAppSettings",open:!0,section:"accounts"}),children:l("mcpMarket.best.openAccounts")})]})}function G6e({query:e,data:t,renderFeatured:a}){const o=e.trim();if(!o)return null;const i=O6e(o,Zi()?"darwin":"win32"),s=z6e(o),r=s.length?[]:L6e(o);return n.jsxs("section",{"aria-labelledby":"mcp-best-title",className:"mb-9","data-testid":"marketplace-best-match",children:[n.jsx("h3",{id:"mcp-best-title",className:"text-[15px] font-semibold text-ink",children:l("mcpMarket.best.title",{query:o})}),i.length||s.length||r.length?n.jsxs("div",{className:"mt-4 grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[i.map(c=>n.jsx($6e,{account:c},c.provider)),s.map(c=>n.jsx("div",{className:"contents",children:a(c)},c.id)),r.map(c=>n.jsx(H6e,{connector:c,data:t,highlight:!0},c.id))]}):n.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3 rounded-2xl border border-hairline/50 bg-raised/35 px-4 py-3",children:[n.jsx("p",{className:"min-w-0 flex-1 text-[12.5px] text-ink-secondary",children:l("mcpMarket.best.none",{query:o})}),n.jsx(V6e,{name:o})]})]})}function K6e({data:e,renderAdd:t}){return n.jsxs("section",{"aria-labelledby":"mcp-recommended-title",className:"mb-9","data-testid":"marketplace-recommended",children:[n.jsx("h3",{id:"mcp-recommended-title",className:"text-[15px] font-semibold text-ink",children:l("mcpMarket.recommended.title")}),n.jsx("p",{className:"mt-1 max-w-[640px] text-[12.5px] leading-relaxed text-ink-secondary",children:l("mcpMarket.recommended.subtitle")}),n.jsx("ul",{className:"mt-4 grid grid-cols-1 gap-2 md:grid-cols-2",children:_6e.map(a=>{const o=F6e(a);return o.kind==="none"?null:n.jsxs("li",{className:"flex items-center gap-3 rounded-xl border border-hairline/40 bg-card/70 px-3 py-2.5","data-path":o.kind,children:[n.jsx(xp,{src:o.kind==="direct"?Oj(o.server.id):void 0,name:a.name,className:"size-8"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-[13.5px] font-medium text-ink",children:a.name}),n.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-1.5 text-[11px] text-ink-secondary",children:[l(o.kind==="direct"?"mcpMarket.path.direct":"mcpMarket.path.claude"),o.kind==="claude"&&n.jsx(jV,{connector:o.connector,data:e})]})]}),n.jsx("div",{className:"shrink-0",children:o.kind==="direct"?t(o.server):n.jsx(zj,{label:l("mcpMarket.claude.turnOn")})})]},a.name)})})]})}const W6e=e=>e==="personal"?"mcpMarket.claude.owner.personal":"mcpMarket.claude.owner.company";function J6e({data:e,claudeSwitch:t}){return n.jsxs("section",{"aria-labelledby":"mcp-claude-title",className:"mt-9","data-testid":"marketplace-claude",children:[n.jsx("h3",{id:"mcp-claude-title",className:"text-[15px] font-semibold text-ink",children:l("mcpMarket.claude.title")}),n.jsx("p",{className:"mt-1 max-w-[640px] text-[12.5px] leading-relaxed text-ink-secondary",children:l("mcpMarket.claude.subtitle")}),n.jsx("div",{className:"mt-3",children:n.jsx(zj,{})}),t,n.jsx("div",{className:"mt-4","aria-live":"polite",children:e===null?n.jsxs("div",{className:"flex items-center gap-2 text-[12.5px] text-ink-secondary",children:[n.jsx(je,{size:13,className:"animate-spin"})," ",l("mcpMarket.claude.loading")]}):e==="error"?null:e.engines.length===0?n.jsx("p",{className:"text-[12.5px] text-ink-secondary",children:l("mcpMarket.claude.noEngine")}):n.jsx("div",{className:"flex flex-col gap-3",children:e.engines.map(a=>{const o=l("mcpMarket.claude.engine",{engine:a.displayName,owner:l(W6e(a.owner))}),i=a.connectors.filter(s=>s.state==="connected");return n.jsxs("div",{className:"rounded-xl border border-hairline/40 bg-card/70 px-3 py-2.5","data-testid":"claude-engine",children:[n.jsx("div",{className:"text-[13px] font-medium text-ink",children:o}),n.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:a.state==="api-key"?l("mcpMarket.claude.apiKey",{engine:a.displayName}):a.state==="signed-out"?l("mcpMarket.claude.signedOut",{engine:a.displayName}):a.state==="error"?l("mcpMarket.claude.error",{engine:a.displayName}):i.length===0?l("mcpMarket.claude.none"):i.map(s=>s.name.replace(/^claude\.ai\s+/i,"")).join(", ")})]},a.instanceId)})})})]})}async function Y6e(e,t=Z,a=!1){try{const o=await t("/api/mcp/registry/add",{method:"POST",body:JSON.stringify({id:e,...a?{overrideThreatScan:!0}:{}})});return o.threatScan&&o.threatScan.verdict!=="clean"?{kind:"added",name:o.added,threatScan:o.threatScan}:{kind:"added",name:o.added}}catch(o){const i=F0(o),s=o instanceof Error?o.message:String(o);return i?{kind:"blocked",error:s,threatScan:i}:{kind:"error",error:s}}}function Z6e(e,t){const a=s=>s.replace(/\/+$/,"").toLowerCase(),o=new Set(t.urls.map(a));return e.find(s=>s.url&&o.has(a(s.url))?!0:(s.args??[]).some(r=>o.has(a(r))||t.packages.some(c=>r===c||r.startsWith(`${c}@`)||r.startsWith(`${c}==`))))?.name}function Q6e(e){let t=0;for(const a of e)t=t*31+a.charCodeAt(0)|0;return`hsl(${Math.abs(t)%360} 55% 45%)`}function xp({src:e,name:t,className:a="size-11"}){const[o,i]=f.useState(!1);return e&&!o?n.jsx("img",{src:e,alt:"",loading:"lazy",className:V("shrink-0 rounded-xl object-contain",a),onError:()=>i(!0)}):n.jsx("div",{"aria-hidden":"true",className:V("flex shrink-0 items-center justify-center rounded-xl text-[16px] font-semibold text-white",a),style:{backgroundColor:Q6e(t)},children:(t.trim()[0]??"?").toUpperCase()})}function X6e({state:e,onAddAnyway:t}){return n.jsxs(n.Fragment,{children:[n.jsx("p",{role:"alert",className:"mt-2 text-[11.5px] text-danger",children:e.error}),e.threatScan&&n.jsx(Fl,{result:e.threatScan}),e.threatScan&&t&&n.jsx("button",{type:"button",onClick:t,className:"mt-2 rounded-lg bg-danger px-3 py-1.5 text-[12px] font-semibold text-white",children:l("threatScan.addAnyway")})]})}function eNe({onOpenMcp:e}){return n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsxs("span",{role:"status",className:"flex items-center gap-1 text-[12px] font-medium text-success",children:[n.jsx(mt,{size:13})," ",l("mcpMarket.added")]}),n.jsx("button",{type:"button",onClick:e,className:"rounded-full bg-accent px-3 py-1.5 text-[12px] font-medium text-accent-ink hover:opacity-90",children:l("mcpMarket.openMcp")})]})}function NV({name:e,busy:t,onClick:a,large:o=!1}){return n.jsx("button",{type:"button",disabled:t,onClick:a,"aria-label":l("mcpMarket.addAria",{name:e}),className:V("flex items-center justify-center gap-1.5 rounded-full bg-accent font-medium text-accent-ink transition-opacity hover:opacity-90 disabled:opacity-50",o?"min-w-[92px] px-4 py-2 text-[13px]":"min-w-[76px] px-3 py-1.5 text-[12.5px]"),children:t?n.jsx(je,{size:14,className:"animate-spin"}):n.jsxs(n.Fragment,{children:[n.jsx(Sn,{size:14}),l("mcpMarket.add")]})})}function tNe({server:e,state:t,onAdd:a,onOpenMcp:o,onAddAnyway:i}){return n.jsxs("div",{className:"flex flex-col rounded-2xl border border-hairline/50 bg-card/80 p-4 shadow-sm shadow-black/5 backdrop-blur-sm transition-colors hover:border-hairline",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(xp,{src:Oj(e.id),name:e.name}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-[14px] font-semibold text-ink",children:e.name}),n.jsx("span",{className:"mt-1 inline-block rounded-full bg-raised px-2 py-0.5 text-[10.5px] font-medium text-ink-secondary",children:l(`mcpMarket.category.${e.category}`)})]})]}),n.jsx("p",{className:"mt-2.5 min-h-[34px] flex-1 text-[12.5px] leading-snug text-ink-secondary",children:e.description}),n.jsxs("div",{className:"mt-3",children:[t.phase==="added"?n.jsx(eNe,{onOpenMcp:o}):n.jsx(NV,{name:e.name,busy:t.phase==="adding",onClick:a,large:!0}),t.phase==="error"&&n.jsx(X6e,{state:t,onAddAnyway:i}),t.phase==="added"&&t.threatScan&&n.jsx(Fl,{result:t.threatScan,compact:!0})]})]})}function nNe({query:e,onQueryChange:t,onOpenMcp:a,request:o=Z,claudeSwitch:i}){const[s,r]=f.useState({}),[c,d]=f.useState([]),p=q6e(o),h=f.useCallback((w,N)=>r(C=>({...C,[w]:N})),[]);f.useEffect(()=>{let w=!0;return o("/api/mcp/servers").then(N=>w&&d(N.servers??[])).catch(()=>{}),()=>{w=!1}},[o]);const g=f.useRef(new Set),b=async(w,N=!1)=>{const C=`featured:${w.id}`;h(C,{phase:"adding"});const j=await Y6e(C,o,N);j.kind==="added"?(g.current.delete(C),h(C,j.threatScan?{phase:"added",name:j.name,threatScan:j.threatScan}:{phase:"added",name:j.name}),d(M=>[...M,{name:j.name}])):j.kind==="blocked"?(g.current.add(C),h(C,{phase:"error",error:j.error,threatScan:j.threatScan})):h(C,{phase:"error",error:j.error||w.name})},x=w=>{const N=s[`featured:${w.id}`];if(N&&N.phase!=="idle")return N;const C=Z6e(c,{urls:[w.url],packages:[]});return C?{phase:"added",name:C}:{phase:"idle"}},v=w=>n.jsx(tNe,{server:w,state:x(w),onAdd:()=>{b(w)},onOpenMcp:a,onAddAnyway:()=>g.current.has(`featured:${w.id}`)&&void b(w,!0)},w.id),k=w=>{const N=x(w);return N.phase==="added"?n.jsxs("span",{className:"inline-flex items-center gap-1 text-[12px] font-medium text-success",children:[n.jsx(mt,{size:13}),l("mcpMarket.addedShort")]}):n.jsx(NV,{name:w.name,busy:N.phase==="adding",onClick:()=>{b(w)}})};return n.jsxs("div",{children:[n.jsxs("label",{className:"mb-6 flex h-11 w-full items-center gap-2.5 rounded-xl border border-hairline/50 bg-raised/70 px-3.5 sm:max-w-[480px]",children:[n.jsx(La,{size:17,className:"shrink-0 text-ink-secondary"}),n.jsx("input",{type:"search",value:e,onChange:w=>t(w.target.value),placeholder:l("mcpMarket.search.officialPlaceholder"),"aria-label":l("mcpMarket.search.officialPlaceholder"),className:"min-w-0 flex-1 bg-transparent text-[14px] text-ink placeholder:text-ink-secondary focus:outline-none"})]}),n.jsx(G6e,{query:e,data:p,renderFeatured:v}),n.jsx(K6e,{data:p,renderAdd:k}),n.jsxs("section",{"aria-labelledby":"mcp-featured-title",children:[n.jsx("h3",{id:"mcp-featured-title",className:"text-[15px] font-semibold text-ink",children:l("mcpMarket.featured.title")}),n.jsx("p",{className:"mt-1 max-w-[640px] text-[12.5px] leading-relaxed text-ink-secondary",children:l("mcpMarket.featured.subtitle")}),n.jsx("div",{className:"mt-4 grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:Dj.map(v)})]}),n.jsx(J6e,{data:p,claudeSwitch:i}),n.jsxs("p",{className:"mt-8 max-w-[640px] text-[12px] leading-relaxed text-ink-secondary","data-testid":"marketplace-official-note",children:[l("mcpMarket.officialOnly")," ",n.jsx("button",{type:"button",className:"font-medium text-accent underline-offset-2 hover:underline",onClick:a,children:l("mcpMarket.officialOnlyLink")})]})]})}function AV({message:e}){const{dispatch:t}=ke(),a=e.marketplace;if(!a)return null;const o=()=>t(a.source==="account"?{type:"toggleAppSettings",open:!0,section:"accounts"}:{type:"openMarketplace",query:a.query,...a.serverId?{serverId:a.serverId}:{}}),i=a.source==="featured"&&a.serverId?.startsWith("featured:")?a.serverId.slice(9):void 0;return a.source==="none"?n.jsx("div",{className:"w-[min(30rem,100%)] rounded-2xl border border-hairline/50 bg-card px-4 py-3.5","data-testid":"marketplace-card","data-source":"none",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-xl bg-raised text-ink-secondary",children:n.jsx(O4,{size:17})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-[14px] font-medium text-ink",children:l("chat.marketplace.none",{name:a.name})}),n.jsx("p",{className:"mt-0.5 text-[12.5px] leading-relaxed text-ink-secondary",children:l("chat.marketplace.noneHint")}),n.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[n.jsx("button",{type:"button",className:"rounded-lg bg-accent px-3 py-1.5 text-[12.5px] font-medium text-white hover:opacity-90",onClick:()=>Gg("idea",l("feedback.connectionIdea",{name:a.name})),children:l("chat.marketplace.suggest")}),n.jsx("button",{type:"button",className:"ui-button",onClick:o,children:l("chat.marketplace.open")})]})]})]})}):n.jsx("div",{className:"w-[min(30rem,100%)] rounded-2xl border border-hairline/50 bg-card px-4 py-3.5","data-testid":"marketplace-card","data-source":a.source,children:n.jsxs("div",{className:"flex items-start gap-3",children:[i?n.jsx(xp,{src:Oj(i),name:a.name,className:"size-9"}):n.jsx(xp,{name:a.name,className:"size-9"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-[14px] font-medium text-ink",children:a.name}),n.jsx("p",{className:"mt-0.5 text-[12.5px] leading-relaxed text-ink-secondary",children:a.source==="account"?l("chat.marketplace.accountHint"):a.source==="claude"?l("chat.marketplace.claudeHint"):l("chat.marketplace.directHint")}),n.jsx("button",{type:"button",className:"mt-3 rounded-lg bg-accent px-3 py-1.5 text-[12.5px] font-medium text-white hover:opacity-90",onClick:o,children:a.source==="account"?l("chat.marketplace.connectAccount",{name:a.name}):a.source==="claude"?l("chat.marketplace.connectClaude",{name:a.name}):l("chat.marketplace.connect",{name:a.name})})]})]})})}function aNe({query:e,serverId:t,children:a}){const{dispatch:o}=ke();return n.jsxs("button",{type:"button",onClick:()=>o({type:"openMarketplace",query:e,...t?{serverId:t}:{}}),className:"inline-flex items-center gap-1 rounded-md bg-accent/10 px-1.5 py-0.5 align-baseline text-[13.5px] font-medium text-accent hover:bg-accent/15","data-testid":"marketplace-link",children:[n.jsx(v0,{size:13,"aria-hidden":"true"}),a??l("chat.marketplace.open")]})}const oNe="chibi://marketplace";function Lj(e){return e.trim().toLowerCase().startsWith(oNe)}function iNe(e){if(!Lj(e))return null;let t;try{t=new URL(e.trim())}catch{return null}if(t.hostname.toLowerCase()!=="marketplace"||t.pathname&&t.pathname!=="/")return null;const a=(t.searchParams.get("q")??"").replace(/\s+/g," ").trim().slice(0,80),o=(t.searchParams.get("server")??"").trim().slice(0,300);return{query:a,...o?{serverId:o}:{}}}const ah=new Map,sNe=200,oh=new Map,rNe=50;let gT=0;const MV=250,IV=e=>{let t=2166136261;for(let a=0;a<e.length;a++)t^=e.charCodeAt(a),t=Math.imul(t,16777619);return(t>>>0).toString(36)},PV=/^[a-zA-Z]:[\\/]/,fT=e=>e.startsWith("/")||PV.test(e)?e:null,wg=e=>{if(!e)return null;if(/^file:\/\//i.test(e))try{const a=new URL(e);if(a.username||a.password||a.port||a.search||a.hash)return null;const o=decodeURIComponent(a.pathname);return a.hostname&&a.hostname!=="localhost"?`//${a.hostname}${o}`:/^\/[a-z]:[\\/]/i.test(o)?o.slice(1):fT(o)}catch{return null}if(e.startsWith("\\\\"))return e;if(e.startsWith("//"))return null;const t=fT(e);return t||(e.startsWith("#")||/^[a-z][a-z\d+.-]*:/i.test(e)?null:e)};function lNe(e){if(GL(e)||Lj(e))return e;const t=/^[a-zA-Z]:%5C/i.test(e)?e.replace(/%5C/gi,"\\"):e;return/^file:\/\//i.test(t)||PV.test(t)||t.startsWith("\\\\")?wg(t)?t:"":Uq(e)}function cNe(){const e=this.data();(e.fromMarkdownExtensions??=[]).push(CV)}function dNe(){return e=>{const t=a=>{a.children&&(a.children=a.children.map(o=>{if(o?.type==="link"&&o.children?.length===1&&o.children[0]?.type==="image"){const i=o.children[0];return{...i,data:{...i.data,hProperties:{...i.data?.hProperties,"data-open-url":o.url}}}}return t(o),o}))};t(e)}}const uNe=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF\u{10800}-\u{10FFF}\u{1E800}-\u{1EFFF}]/u;function pNe(e){const t=new RegExp("\\p{Letter}","u").exec(e);return t&&uNe.test(t[0])?"rtl":"ltr"}function TV(e){return e?e.type==="text"?e.value??"":e.tagName==="code"||e.tagName==="pre"?"":(e.children??[]).map(TV).join(""):""}function is(e){return pNe(TV(e))}function mNe({code:e,lang:t,streaming:a}){const[o,i]=f.useState(null),[s,r]=f.useState(!1),[c,d]=f.useState(!1),p=f.useRef(null);f.useEffect(()=>()=>{p.current!==null&&clearTimeout(p.current)},[]),f.useEffect(()=>{const v=`${t}:${IV(e)}`,k=ah.get(v);if(k)return i(k);let w=!0,N;const C=()=>{QC(()=>import("./index-B2iS4X_f.js"),[]).then(j=>j.codeToHtml(e,{lang:t||"text",themes:{light:"github-light-default",dark:"github-dark-default"},defaultColor:"light-dark()"})).then(j=>{if(w){if(ah.size>=sNe){const M=ah.keys().next().value;M&&ah.delete(M)}ah.set(v,j),i(j)}}).catch(()=>{})};return a?(i(null),N=setTimeout(C,MV)):C(),()=>{w=!1,N!==void 0&&clearTimeout(N)}},[e,t,a]);const h=()=>{navigator.clipboard?.writeText&&navigator.clipboard.writeText(e).then(()=>{r(!0),p.current!==null&&clearTimeout(p.current),p.current=setTimeout(()=>r(!1),1500)}).catch(()=>{})},g=()=>{const v=j6e(t);N6e(v,e)},b=k6e(t),x=w6e(e);return n.jsxs("div",{dir:"ltr",className:"my-2 overflow-hidden rounded-lg border border-hairline/40 bg-inset",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-hairline/30 bg-raised/30 px-3 py-1.5 text-xs",children:[n.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[n.jsx("span",{title:b,className:"min-w-0 truncate rounded border border-hairline/40 bg-raised px-1.5 py-0.5 text-[11px] font-medium tracking-wide text-ink select-none",children:b}),x>0&&n.jsx("span",{className:"shrink-0 whitespace-nowrap text-[11px] text-ink-secondary select-none",children:S6e(x)})]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1 whitespace-nowrap",children:[n.jsxs("button",{type:"button",onClick:()=>d(v=>!v),className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] transition-colors ${c?"bg-accent/15 text-accent font-medium":"text-ink-secondary hover:bg-raised hover:text-ink"}`,title:c?"Disable line wrapping":"Wrap long lines","aria-label":c?"Disable line wrapping":"Wrap long lines","aria-pressed":c,children:[n.jsx(FE,{size:12,"aria-hidden":"true"}),n.jsx("span",{className:"hidden sm:inline",children:c?"Unwrap":"Wrap"})]}),n.jsxs("button",{type:"button",onClick:g,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] text-ink-secondary hover:bg-raised hover:text-ink transition-colors",title:"Download snippet as file","aria-label":"Download snippet as file",children:[n.jsx(ga,{size:12,"aria-hidden":"true"}),n.jsx("span",{className:"hidden sm:inline",children:"Save"})]}),n.jsx("button",{type:"button",onClick:h,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] text-ink-secondary hover:bg-raised hover:text-ink transition-colors",title:s?"Copied to clipboard":"Copy code","aria-label":s?"Code copied to clipboard":"Copy code to clipboard",children:s?n.jsxs(n.Fragment,{children:[n.jsx(mt,{size:12,className:"text-success","aria-hidden":"true"}),n.jsx("span",{className:"text-success font-medium hidden sm:inline",children:"Copied!"})]}):n.jsxs(n.Fragment,{children:[n.jsx(Xa,{size:12,"aria-hidden":"true"}),n.jsx("span",{className:"hidden sm:inline",children:"Copy"})]})})]})]}),o?n.jsx("div",{className:`text-[13px] leading-relaxed [&_pre]:!bg-transparent [&_pre]:m-0 [&_pre]:p-3 ${c?"whitespace-pre-wrap break-words overflow-x-hidden [&_pre]:!whitespace-pre-wrap [&_pre]:!break-words [&_code]:!whitespace-pre-wrap [&_code]:!break-words":"overflow-x-auto"}`,dangerouslySetInnerHTML:{__html:o}}):n.jsx("pre",{className:`p-3 text-[13px] leading-relaxed text-ink ${c?"whitespace-pre-wrap break-words overflow-x-hidden":"overflow-x-auto"}`,children:e})]})}function hNe(e){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"}}const gNe='"Inter", -apple-system, BlinkMacSystemFont, "SF UI Text", "Segoe UI", system-ui, sans-serif';function fNe({code:e,streaming:t}){const a=f.useRef(null),[o,i]=f.useState(0),[s,r]=f.useState(null),[c,d]=f.useState(null),[p,h]=f.useState(!1),[g,b]=f.useState(!1),x=f.useRef(null);f.useEffect(()=>{if(typeof MutationObserver>"u"||typeof document>"u")return;const k=new MutationObserver(()=>i(w=>w+1));return k.observe(document.documentElement,{subtree:!0,attributeFilter:["data-skin"]}),()=>k.disconnect()},[]),f.useEffect(()=>{const k=hNe(a.current),w=`${k}:${IV(e)}`,N=oh.get(w);if(N){r(N),d(null);return}let C=!0,j;const M=()=>{QC(()=>import("./mermaid.core-D31FuzHj.js").then(E=>E.bz),[]).then(E=>(gT+=1,E.default.initialize({startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,theme:k==="light"?"default":"dark",fontFamily:gNe}),E.default.render(`omb-mermaid-${gT}`,e))).then(E=>{if(C){if(oh.size>=rNe){const A=oh.keys().next().value;A&&oh.delete(A)}oh.set(w,E.svg),r(E.svg),d(null)}}).catch(E=>{if(!C||t)return;const A=E instanceof Error?E.message:String(E);d(A.length>300?`${A.slice(0,300)}…`:A)})};return t?(r(null),d(null),j=setTimeout(M,MV)):M(),()=>{C=!1,j!==void 0&&clearTimeout(j)}},[e,t,o]),f.useEffect(()=>()=>{x.current!==null&&clearTimeout(x.current)},[]);const v=()=>{navigator.clipboard?.writeText&&navigator.clipboard.writeText(e).then(()=>{b(!0),x.current!==null&&clearTimeout(x.current),x.current=setTimeout(()=>b(!1),1500)}).catch(()=>{})};return n.jsxs("div",{ref:a,dir:"ltr",className:"my-2 overflow-hidden rounded-lg border border-hairline/40 bg-inset",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-hairline/30 bg-raised/30 px-3 py-1.5 text-xs",children:[n.jsx("span",{title:"Mermaid diagram",className:"min-w-0 truncate rounded border border-hairline/40 bg-raised px-1.5 py-0.5 text-[11px] font-medium tracking-wide text-ink select-none",children:"Mermaid diagram"}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1 whitespace-nowrap",children:[n.jsxs("button",{type:"button",onClick:()=>h(k=>!k),className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] transition-colors ${p?"bg-accent/15 text-accent font-medium":"text-ink-secondary hover:bg-raised hover:text-ink"}`,title:p?"Hide diagram source":"Show diagram source","aria-label":p?"Hide diagram source":"Show diagram source","aria-pressed":p,children:[n.jsx(FE,{size:12,"aria-hidden":"true"}),n.jsx("span",{className:"hidden sm:inline",children:p?"Hide source":"Show source"})]}),n.jsx("button",{type:"button",onClick:v,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] text-ink-secondary hover:bg-raised hover:text-ink transition-colors",title:g?"Copied to clipboard":"Copy diagram source","aria-label":g?"Diagram source copied to clipboard":"Copy diagram source to clipboard",children:g?n.jsxs(n.Fragment,{children:[n.jsx(mt,{size:12,className:"text-success","aria-hidden":"true"}),n.jsx("span",{className:"text-success font-medium hidden sm:inline",children:"Copied!"})]}):n.jsxs(n.Fragment,{children:[n.jsx(Xa,{size:12,"aria-hidden":"true"}),n.jsx("span",{className:"hidden sm:inline",children:"Copy"})]})})]})]}),c&&n.jsxs("p",{role:"alert",className:"px-3 pt-2 text-[12px] text-danger",children:["Diagram could not be rendered: ",c]}),s&&n.jsx("div",{className:"overflow-x-auto p-3 [&_svg]:!max-w-full",dangerouslySetInnerHTML:{__html:s}}),(p||!s||c)&&n.jsx("pre",{className:"overflow-x-auto p-3 text-[13px] leading-relaxed text-ink",children:e})]})}function bNe({filePath:e,children:t,message:a}){const o=fL(e,void 0,a);if(!a)return n.jsx("span",{title:"Unavailable legacy file reference",className:"break-words text-ink-secondary",children:t});const i=o.state==="saving"?"Saving…":o.state==="saved"?"Saved":o.state==="failed"?"Retry":null;return n.jsxs("span",{dir:"ltr",className:"inline-flex flex-wrap items-center gap-x-1.5 [unicode-bidi:isolate]",children:[n.jsxs("button",{type:"button",onClick:()=>{o.save()},disabled:o.state==="saving",title:"Save a copy",className:"inline-flex items-center gap-1 break-words text-start text-accent underline decoration-accent/40 hover:decoration-accent disabled:cursor-wait",children:[t,o.state==="saving"?n.jsx(je,{size:12,className:"shrink-0 animate-spin","aria-hidden":"true"}):o.state==="saved"?n.jsx(mt,{size:12,className:"shrink-0 text-success","aria-hidden":"true"}):o.state==="failed"?n.jsx(Fs,{size:12,className:"shrink-0","aria-hidden":"true"}):n.jsx(ga,{size:12,className:"shrink-0","aria-hidden":"true"})]}),i&&n.jsx("span",{role:o.state==="failed"?"alert":"status",title:o.state==="saved"?o.savedTo:void 0,className:`text-[12px] ${o.state==="saved"?"text-success":o.state==="failed"?"text-danger":"text-ink-secondary"}`,children:o.state==="failed"?o.reason:i})]})}function yNe(e,t){const a=t?.trim();if(a)return a;try{const i=decodeURIComponent(new URL(e,"https://openmausbot.invalid").pathname).split(/[\\/]/).filter(Boolean).at(-1)?.trim();if(i)return i}catch{}return"Image"}function xNe(e){try{const t=new URL(e.startsWith("//")?`https:${e}`:e);return t.protocol==="https:"||t.protocol==="http:"?t.toString():void 0}catch{return}}function vNe({children:e}){const[t,a]=f.useState(!1);return t?n.jsxs("span",{className:"mx-px inline rounded px-1 py-px text-[13px] leading-relaxed text-ink underline decoration-dotted decoration-hairline underline-offset-2",children:[e,n.jsx("button",{type:"button","aria-label":"Hide spoiler",title:"Hide spoiler",onClick:()=>a(!1),className:"ms-1 rounded px-0.5 text-[11px] text-ink-secondary hover:text-ink",children:"Hide"})]}):n.jsxs("span",{className:"relative mx-px inline-block rounded px-1 py-px",children:[n.jsx("span",{"aria-hidden":"true",className:"pointer-events-none select-none bg-raised text-transparent [&_*]:!text-transparent [&_a]:!no-underline",children:e}),n.jsx("button",{type:"button","aria-label":"Reveal spoiler",title:"Reveal spoiler",onClick:()=>a(!0),className:"absolute inset-0 rounded bg-raised/90"})]})}const Q5=[],kNe="![";function wNe(e,t){const a=/(^|\r?\n)((?: {0,3}>[ \t]?)* {0,3})(?:(`{3,})([^`\r\n]*)|(~{3,})([^\r\n]*))(?:\r?\n|$)/g;let o=0,i="",s;for(;(s=a.exec(e))!==null;){const r=s[3]??s[5],c=r[0],d=new RegExp(`(^|\\r?\\n)(?: {0,3}>[ \\t]?)* {0,3}${c}{${r.length},}[ \\t]*(?=\\r?\\n|$)`,"g");d.lastIndex=a.lastIndex;const p=d.exec(e),h=p===null?e.length:p.index+p[0].length;i+=e.slice(o,s.index),i+=t(e.slice(s.index,h)),o=h,a.lastIndex=h}return i+e.slice(o)}function SNe(e){const t=[],a=s=>{const r=`\0OMB_CODE_${t.length}\0`;return t.push(s),r};let i=wNe(e,a).replace(/(`+)[\s\S]*?\1/g,a).replace(/\\\[([\s\S]*?)\\\]/g,(s,r)=>`$$
|
|
549
549
|
${r}
|
|
550
550
|
$$`).replace(/\\\(([\s\S]*?)\\\)/g,(s,r)=>`$${r}$`).replace(/\$\$[ \t]*([^\n][\s\S]*?)[ \t]*\$\$/g,(s,r)=>`$$
|
|
551
551
|
${r}
|
|
@@ -580,7 +580,7 @@ ${t}`:t,attachments:ad(a,e),channelMode:Sh(a,e)})}function vH(e,t){if(t.length==
|
|
|
580
580
|
"docs": { "type": "http", "url": "https://mcp.example.com/mcp", "headers": { "Authorization": "Bearer …" } }
|
|
581
581
|
}
|
|
582
582
|
}`,className:"mt-3 w-full resize-y rounded-lg border border-hairline/60 bg-raised px-3 py-2.5 font-mono text-[12px] leading-relaxed text-ink outline-none focus:border-accent"}),n.jsxs("div",{className:"mt-3 flex items-center justify-end gap-2",children:[n.jsx("button",{type:"button",disabled:g==="import",onClick:()=>{M(!1),A("")},className:"rounded-lg px-3 py-2 text-[12.5px] text-ink-secondary hover:text-ink",children:l("common.cancel")}),n.jsx("button",{type:"button",disabled:g!==null||!E.trim(),onClick:()=>{$()},className:"rounded-lg bg-accent px-3 py-2 text-[12.5px] font-medium text-accent-ink disabled:opacity-40",children:l("mcp.importAction")})]})]}),n.jsx("div",{className:"mt-4 rounded-xl border border-hairline/50 bg-raised/35 px-4 py-3 text-[12px] leading-relaxed text-ink-secondary",children:l("mcp.trustNotice")}),x&&n.jsx("div",{role:"alert",className:"mt-3 rounded-lg bg-danger/10 px-3 py-2 text-[12px] text-danger",children:typeof x=="string"?x:l(x.key,x.params)}),R&&n.jsxs("div",{"data-threat-notice":!0,children:[R.scans.map(ee=>n.jsx(Fl,{result:ee},ee.target)),R.blocked&&R.anyway&&n.jsx("button",{type:"button",disabled:g!==null,onClick:()=>{R.anyway.run()},className:"mt-2 rounded-lg bg-danger px-3 py-1.5 text-[12px] font-semibold text-white disabled:opacity-40",children:l(R.anyway.label)})]}),k&&n.jsx("div",{role:"status",className:"mt-3 rounded-lg bg-success/10 px-3 py-2 text-[12px] text-success",children:l(k.key,{...k.params,...k.stateKey?{state:l(k.stateKey)}:{}})}),c&&n.jsxs("div",{className:"mt-4 rounded-2xl border border-hairline/60 bg-card p-4 sm:p-5",children:[n.jsx("div",{className:"text-[14px] font-medium text-ink",children:c==="new"?l("mcp.editorNew"):l("mcp.editorEdit",{name:c})}),c==="new"&&n.jsx("div",{className:"mt-3 inline-flex rounded-lg bg-raised p-0.5",role:"radiogroup","aria-label":l("mcp.field.type"),children:["stdio","remote"].map(ee=>n.jsx("button",{type:"button",role:"radio","aria-checked":p.transport===ee,onClick:()=>h(X=>({...X,transport:ee})),className:V("rounded-md px-3 py-1.5 text-[12px] font-medium transition-colors",p.transport===ee?"bg-card text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:l(ee==="stdio"?"mcp.transport.stdio":"mcp.transport.remote")},ee))}),n.jsxs("div",{className:"mt-4 grid gap-4 sm:grid-cols-2",children:[n.jsxs("label",{className:"block",children:[n.jsx("span",{className:"text-[12px] font-medium text-ink-secondary",children:l("mcp.field.name")}),n.jsx("input",{autoFocus:c==="new",disabled:c!=="new",value:p.name,maxLength:32,onChange:ee=>h(X=>({...X,name:ee.target.value.toLowerCase()})),placeholder:"github",className:"mt-1.5 w-full rounded-lg border border-hairline/60 bg-raised px-3 py-2.5 text-[13px] text-ink outline-none focus:border-accent disabled:opacity-60"})]}),p.transport==="remote"?n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"block",children:[n.jsx("span",{className:"text-[12px] font-medium text-ink-secondary",children:l("mcp.field.url")}),n.jsx("input",{autoFocus:c!=="new",value:p.url,onChange:ee=>h(X=>({...X,url:ee.target.value})),placeholder:"https://mcp.example.com/mcp",className:"mt-1.5 w-full rounded-lg border border-hairline/60 bg-raised px-3 py-2.5 text-[13px] text-ink outline-none focus:border-accent"})]}),n.jsxs("label",{className:"block",children:[n.jsx("span",{className:"text-[12px] font-medium text-ink-secondary",children:l("mcp.field.type")}),n.jsxs("select",{value:p.type,onChange:ee=>h(X=>({...X,type:ee.target.value==="sse"?"sse":"http"})),className:"mt-1.5 w-full rounded-lg border border-hairline/60 bg-raised px-3 py-2.5 text-[13px] text-ink outline-none focus:border-accent",children:[n.jsx("option",{value:"http",children:l("mcp.type.http")}),n.jsx("option",{value:"sse",children:l("mcp.type.sse")})]})]}),n.jsxs("label",{className:"block sm:col-span-2",children:[n.jsx("span",{className:"text-[12px] font-medium text-ink-secondary",children:l("mcp.field.headers")}),n.jsx("textarea",{value:p.headers,onChange:ee=>h(X=>({...X,headers:ee.target.value})),placeholder:"Authorization: Bearer …",rows:4,className:"mt-1.5 w-full resize-y rounded-lg border border-hairline/60 bg-raised px-3 py-2.5 font-mono text-[12px] text-ink outline-none focus:border-accent"}),n.jsx("span",{className:"mt-1.5 block text-[11px] text-ink-secondary",children:l("mcp.headersHint")})]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"block",children:[n.jsx("span",{className:"text-[12px] font-medium text-ink-secondary",children:l("mcp.field.command")}),n.jsx("input",{autoFocus:c!=="new",value:p.command,onChange:ee=>h(X=>({...X,command:ee.target.value})),placeholder:"npx",className:"mt-1.5 w-full rounded-lg border border-hairline/60 bg-raised px-3 py-2.5 text-[13px] text-ink outline-none focus:border-accent"})]}),n.jsxs("label",{className:"block",children:[n.jsx("span",{className:"text-[12px] font-medium text-ink-secondary",children:l("mcp.field.args")}),n.jsx("textarea",{value:p.args,onChange:ee=>h(X=>({...X,args:ee.target.value})),placeholder:`-y
|
|
583
|
-
@modelcontextprotocol/server-github`,rows:5,className:"mt-1.5 w-full resize-y rounded-lg border border-hairline/60 bg-raised px-3 py-2.5 font-mono text-[12px] text-ink outline-none focus:border-accent"})]}),n.jsxs("label",{className:"block",children:[n.jsx("span",{className:"text-[12px] font-medium text-ink-secondary",children:l("mcp.field.env")}),n.jsx("textarea",{value:p.env,onChange:ee=>h(X=>({...X,env:ee.target.value})),placeholder:"GITHUB_TOKEN=…",rows:5,className:"mt-1.5 w-full resize-y rounded-lg border border-hairline/60 bg-raised px-3 py-2.5 font-mono text-[12px] text-ink outline-none focus:border-accent"}),c!=="new"&&n.jsx("span",{className:"mt-1.5 block text-[11px] text-ink-secondary",children:l("mcp.envHint")})]})]})]}),n.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[n.jsx("button",{type:"button",onClick:W,className:"rounded-lg px-3 py-2 text-[12.5px] text-ink-secondary hover:bg-raised",children:l("mcp.cancel")}),n.jsxs("button",{type:"button",disabled:g!==null,onClick:()=>{Y()},className:"flex items-center gap-1.5 rounded-lg bg-accent px-3.5 py-2 text-[12.5px] font-medium text-white disabled:opacity-50",children:[g==="save"&&n.jsx(je,{size:13,className:"animate-spin"})," ",l("mcp.save")]})]})]}),s===null?n.jsxs("div",{className:"flex items-center justify-center gap-2 py-24 text-[13px] text-ink-secondary",children:[n.jsx(je,{size:14,className:"animate-spin"})," ",l("mcp.loading")]}):s.length===0&&!c?n.jsxs("div",{className:"mt-5 flex min-h-64 flex-col items-center justify-center rounded-2xl border border-dashed border-hairline/60 text-center",children:[n.jsx("div",{className:"flex size-11 items-center justify-center rounded-xl bg-raised text-ink-secondary",children:n.jsx(t7,{size:21})}),n.jsx("div",{className:"mt-3 text-[14px] font-medium text-ink",children:l("mcp.empty.title")}),n.jsx("div",{className:"mt-1 max-w-sm text-[12.5px] text-ink-secondary",children:l("mcp.empty.desc")})]}):n.jsxs("div",{className:"mt-5 space-y-3",children:[O&&O!=="os"&&s.some(ee=>(Bc(ee)?ee.headerKeys:ee.envKeys).length>0)&&n.jsx("div",{role:"status",className:"rounded-xl bg-warning/10 px-3.5 py-2.5 text-[12px] leading-relaxed text-warning","data-mcp-secret-storage":O,children:l(O==="unavailable"?"mcp.secure.unavailable":O==="insecure"?"mcp.secure.insecure":"mcp.secure.plaintext")}),s.map(ee=>{const X=N[ee.name];return n.jsxs("div",{className:"rounded-2xl border border-hairline/50 bg-card px-4 py-4 sm:px-5",children:[n.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[n.jsx("div",{className:V("flex size-10 shrink-0 items-center justify-center rounded-xl",ee.enabled?"bg-success/10 text-success":"bg-raised text-ink-secondary"),children:Bc(ee)?n.jsx(Sr,{size:19}):n.jsx(t7,{size:19})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"truncate text-[14px] font-medium text-ink",children:ee.name}),n.jsx("span",{className:V("rounded-full px-2 py-0.5 text-[10.5px]",ee.enabled?"bg-success/10 text-success":"bg-raised text-ink-secondary"),children:l(ee.enabled?"mcp.badge.on":"mcp.badge.off")}),ee.managedBy&&n.jsx("span",{className:"rounded-full bg-raised px-2 py-0.5 text-[10.5px] text-ink-secondary",children:l("policy.managedBy",{organization:ee.managedBy})}),ee.auth?n.jsx("span",{className:"rounded-full bg-warning/10 px-2 py-0.5 text-[10.5px] text-warning","data-mcp-needs-reconnect":!0,children:l("mcp.auth.badge")}):ee.chibitekSignIn&&n.jsx("span",{className:"truncate rounded-full bg-success/10 px-2 py-0.5 text-[10.5px] text-success","data-mcp-chibitek-signin":!0,children:l("mcp.chibitek.badge",{name:ee.chibitekSignIn.name})}),!ee.managedBy&&n.jsxs("label",{className:"ml-auto flex shrink-0 items-center gap-1.5 text-[11.5px] text-ink-secondary",title:l("owner.connectionHint"),children:[n.jsx("span",{children:l("owner.personal")}),n.jsx(Tt,{checked:a.connections.mcpServers.includes(ee.name),disabled:g!==null,"aria-label":l("owner.connectionToggle",{name:ee.name}),onClick:()=>{a.set("mcpServers",ee.name,!a.connections.mcpServers.includes(ee.name)).catch(oe=>v(oe instanceof Error?oe.message:String(oe)))}})]})]}),ee.managedBy&&n.jsx("div",{className:"mt-1 text-[11.5px] text-ink-secondary",children:l("policy.mcpBlocked",{organization:ee.managedBy})}),ee.auth&&(()=>{const oe=V9e(ee.auth);return n.jsx("div",{role:"status",className:"mt-1 text-[11.5px] leading-relaxed text-ink-secondary","data-mcp-auth":!0,children:l(oe.key,oe.params)})})(),ee.unavailable&&n.jsx("div",{role:"status",className:"mt-1 text-[11.5px] leading-relaxed text-ink-secondary","data-mcp-unavailable":!0,children:ee.unavailable}),n.jsx("div",{className:"mt-1 truncate font-mono text-[11.5px] text-ink-secondary",children:Bc(ee)?ee.url:[ee.command,...ee.args].join(" ")}),Bc(ee)?ee.headerKeys.length>0&&n.jsx("div",{className:"mt-1 truncate text-[11px] text-ink-secondary",children:l("mcp.headersSaved",{keys:ee.headerKeys.join(", ")})}):ee.envKeys.length>0&&n.jsx("div",{className:"mt-1 truncate text-[11px] text-ink-secondary",children:l("mcp.secretsSaved",{keys:ee.envKeys.join(", ")})}),ee.secureKeys&&ee.secureKeys.length>0&&n.jsx("div",{className:"mt-1 truncate text-[11px] text-success","data-mcp-secure-keys":!0,children:l("mcp.secure.stored",{keys:ee.secureKeys.join(", ")})}),ee.needsFix==="missing-secret"&&n.jsx("div",{role:"status",className:"mt-1 text-[11.5px] leading-relaxed text-warning","data-mcp-needs-fix":"missing-secret",children:l("mcp.secure.missing")}),ee.needsFix==="token-argument"&&ee.parkedArgs?.[0]&&n.jsxs("div",{className:"mt-2 rounded-lg bg-warning/10 px-3 py-2.5","data-mcp-needs-fix":"token-argument",children:[n.jsx("div",{className:"text-[11.5px] leading-relaxed text-warning",children:l("mcp.secure.argFix",{argument:`#${ee.parkedArgs[0]}`})}),n.jsxs("div",{className:"mt-2 flex gap-2",children:[n.jsx("input",{value:z[ee.name]??"",onChange:oe=>P(ne=>({...ne,[ee.name]:oe.target.value})),placeholder:"API_KEY","aria-label":l("mcp.secure.argFixAria",{name:ee.name}),className:"min-w-0 flex-1 rounded-lg border border-hairline/60 bg-raised px-2.5 py-1.5 font-mono text-[12px] text-ink outline-none focus:border-accent"}),n.jsxs("button",{type:"button",disabled:g!==null,onClick:()=>{Q(ee,ee.parkedArgs[0])},className:"flex shrink-0 items-center gap-1.5 rounded-lg bg-accent px-3 py-1.5 text-[12px] font-medium text-white disabled:opacity-50",children:[g===`fix:${ee.name}`&&n.jsx(je,{size:13,className:"animate-spin"})," ",l("mcp.secure.argFixButton")]})]})]})]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[ee.auth&&n.jsxs("button",{type:"button",disabled:g!==null,onClick:()=>{ge(ee)},className:"flex items-center gap-1.5 rounded-lg bg-warning/10 px-2.5 py-2 text-[12px] text-warning hover:bg-warning/15 disabled:opacity-40","aria-label":l("mcp.reconnectAria",{name:ee.name}),title:l("mcp.reconnectHint"),children:[g===`reconnect:${ee.name}`?n.jsx(je,{size:14,className:"animate-spin"}):n.jsx(gZ,{size:14})," ",l("mcp.reconnect")]}),n.jsxs("button",{type:"button",disabled:g!==null,onClick:()=>{pe(ee)},className:"flex items-center gap-1.5 rounded-lg px-2.5 py-2 text-[12px] text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-40",children:[g===`test:${ee.name}`?n.jsx(je,{size:14,className:"animate-spin"}):n.jsx(SE,{size:14})," ",l("mcp.test")]}),n.jsxs("button",{type:"button",disabled:g!==null,onClick:()=>{ae(ee)},className:"flex items-center gap-1.5 rounded-lg px-2.5 py-2 text-[12px] text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-40","aria-label":l("mcp.toggleAria",{name:ee.name,state:l(ee.enabled?"mcp.state.off":"mcp.state.on")}),children:[g===`toggle:${ee.name}`?n.jsx(je,{size:14,className:"animate-spin"}):n.jsx(QW,{size:14})," ",l(ee.enabled?"mcp.turnOff":"mcp.turnOn")]}),n.jsx("button",{type:"button",disabled:g!==null,onClick:()=>{d(ee.name),h(Y9e(ee)),v(null),w(null)},className:"rounded-lg p-2 text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-40","aria-label":l("mcp.editAria",{name:ee.name}),children:n.jsx($i,{size:14})}),n.jsx("button",{type:"button",disabled:g!==null,onClick:()=>{Ne(ee)},className:"rounded-lg p-2 text-ink-secondary hover:bg-danger/10 hover:text-danger disabled:opacity-40","aria-label":l("mcp.removeAria",{name:ee.name}),children:n.jsx(xn,{size:14})})]})]}),n.jsxs("div",{className:"mt-3 flex items-start justify-between gap-4 border-t border-hairline/30 pt-3",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-[12.5px] font-medium text-ink",children:l("mcp.readOnly.title")}),n.jsx("p",{className:"mt-0.5 text-[11.5px] leading-relaxed text-ink-secondary",children:l("mcp.readOnly.desc")})]}),n.jsx(Tt,{checked:ee.autoAllowReadOnly!==!1,"aria-label":l("mcp.readOnly.aria",{name:ee.name}),disabled:g!==null,onClick:()=>{F(ee)},className:"mt-0.5 shrink-0 disabled:cursor-wait disabled:opacity-50"})]}),X&&n.jsx("div",{role:"status",className:V("mt-3 rounded-lg px-3 py-2 text-[12px]",X.ok?"bg-success/10 text-success":"bg-danger/10 text-danger"),children:X.ok?n.jsxs("span",{className:"flex items-start gap-2",children:[n.jsx(cs,{size:14,className:"mt-px shrink-0"})," ",n.jsxs("span",{children:[l("mcp.probe.connected")," ",J9e(X.tools),ee.autoAllowReadOnly!==!1&&YT(X.tools).length>0&&n.jsx("span",{className:"block text-ink-secondary",children:l("mcp.probe.readOnly",{names:YT(X.tools).join(", ")})})]})]}):X.error}),X?.threatScan&&n.jsx(Fl,{result:X.threatScan})]},ee.name)})]})]})})}function u$(){const{state:e,dispatch:t}=ke(),a=upe(e.config),[o,i]=f.useState(!1),[s,r]=f.useState(!1),c=async()=>{if(!o){i(!0),r(!1);try{const d=await Z("/api/config",{method:"PATCH",body:JSON.stringify({features:{claudeUserMcp:!a}})});t({type:"configStatus",config:d})}catch{r(!0)}finally{i(!1)}}};return n.jsxs("div",{className:"mt-4 flex items-start justify-between gap-4 rounded-2xl border border-hairline/50 bg-card px-4 py-4 sm:px-5",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-[14px] font-medium text-ink",children:l("mcp.claude.title")}),n.jsx("p",{className:"mt-1 text-[12px] leading-relaxed text-ink-secondary",children:l("mcp.claude.desc")}),s&&n.jsx("p",{role:"alert",className:"mt-1 text-[12px] text-danger",children:l("mcp.claude.error")})]}),n.jsx(Tt,{checked:a,"aria-label":l("mcp.claude.aria"),disabled:o,onClick:()=>{c()},className:"mt-0.5 shrink-0 disabled:cursor-wait disabled:opacity-50"})]})}function p$({onOpenMcp:e,embedded:t=!1}){const{state:a,dispatch:o}=ke(),[i,s]=f.useState(()=>a.marketplaceSearch?.query??""),r=a.marketplaceSearch?.nonce;return f.useEffect(()=>{r!==void 0&&s(a.marketplaceSearch?.query??"")},[r]),n.jsxs("div",{className:t?"min-w-0":"min-h-0 flex-1 overflow-y-auto px-6 pb-7 pt-5 sm:px-8",children:[n.jsxs("p",{className:"mb-5 text-[12.5px] leading-relaxed text-ink-secondary","data-marketplace-note":!0,children:[l("mcpMarket.addonsNoteMarketplace")," ",n.jsx("button",{type:"button",className:"font-medium text-accent underline-offset-2 hover:underline",onClick:()=>o({type:"toggleAppSettings",open:!0,section:"addons"}),children:l("mcpMarket.addonsLink")})]}),n.jsx(nNe,{query:i,onQueryChange:s,onOpenMcp:e,claudeSwitch:n.jsx(u$,{})})]})}function Z9e(){const{state:e,dispatch:t}=ke(),a=f.useRef(null),o=e.pluginsSurface,i=()=>t({type:"togglePlugins",open:!1});return f.useEffect(()=>{const s=document.activeElement instanceof HTMLElement?document.activeElement:null,r=a.current,c=()=>Array.from(r?.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')??[]);(r?.querySelector("input")??c()[0]??r)?.focus();const d=p=>{if(p.key==="Escape"){p.preventDefault(),t({type:"togglePlugins",open:!1});return}if(p.key!=="Tab"||!r)return;const h=c();if(h.length===0){p.preventDefault(),r.focus();return}const g=h[0],b=h.at(-1);p.shiftKey&&(document.activeElement===g||!r.contains(document.activeElement))?(p.preventDefault(),b.focus()):!p.shiftKey&&document.activeElement===b&&(p.preventDefault(),g.focus())};return window.addEventListener("keydown",d),()=>{window.removeEventListener("keydown",d),s?.focus()}},[t]),n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/55 p-4 backdrop-blur-[2px] sm:p-6",onMouseDown:s=>s.target===s.currentTarget&&i(),children:n.jsxs("div",{ref:a,"data-tour":"apps-panel",role:"dialog","aria-modal":"true","aria-labelledby":"plugins-title",tabIndex:-1,className:"animate-pop-in flex h-[min(780px,calc(100dvh-2rem))] w-full max-w-[1040px] flex-col overflow-hidden rounded-[24px] border border-hairline/50 bg-panel shadow-2xl shadow-black/50",children:[n.jsxs("header",{className:"flex items-start justify-between gap-4 px-6 pb-3 pt-6 sm:px-8 sm:pt-7",children:[n.jsxs("div",{children:[n.jsx("h2",{id:"plugins-title",className:"text-[22px] font-semibold tracking-[-0.01em] text-ink",children:l("connectors.title")}),n.jsx("p",{className:"mt-1 text-[13px] text-ink-secondary",children:l("connectors.subtitle")})]}),n.jsx("button",{"data-tour":"apps-close",onClick:i,"aria-label":l("connectors.closeAria"),className:"rounded-lg p-2 text-ink-secondary hover:bg-raised hover:text-ink",children:n.jsx(jt,{size:21})})]}),n.jsx("div",{className:"border-b border-hairline/40 px-6 sm:px-8",children:n.jsx("div",{className:"flex gap-6",role:"tablist","aria-label":l("connectors.typeAria"),children:["apps","mcp"].map(s=>n.jsx("button",{type:"button",role:"tab","aria-selected":o===s,onClick:()=>t({type:"togglePlugins",open:!0,surface:s}),className:V("border-b-2 px-0.5 pb-3 pt-1 text-[13.5px] font-medium transition-colors",o===s?"border-accent text-ink":"border-transparent text-ink-secondary hover:text-ink"),children:l(s==="apps"?"connectors.tab.marketplace":"connectors.tab.mcp")},s))})}),o==="apps"?n.jsx(p$,{onOpenMcp:()=>t({type:"togglePlugins",open:!0,surface:"mcp"})}):n.jsx(d$,{})]})})}function Dv(){const[e,t]=f.useState(()=>document.visibilityState==="visible");return f.useEffect(()=>{const a=()=>t(document.visibilityState==="visible");return document.addEventListener("visibilitychange",a),()=>document.removeEventListener("visibilitychange",a)},[]),e}function Q9e({src:e,name:t,error:a,starting:o,opening:i,disabled:s,refreshing:r=!1,retry:c=0,onOpen:d,onRetry:p}){const[h,g]=f.useState(null),[b,x]=f.useState(null);f.useEffect(()=>{x(null)},[c]);const v=!!(e&&h===e&&b!==e),k=a??(e&&b===e?l("computer.preview.imageFailed"):null);return n.jsxs("div",{className:"relative h-full w-full","aria-busy":!k&&(!v||i||r),children:[e&&n.jsxs("button",{type:"button",onClick:d,disabled:s||o||i||!v,className:"group absolute inset-0 flex h-full w-full items-center justify-center disabled:cursor-wait","aria-label":l("computer.openLiveDesktopAria",{name:t}),title:l("computer.openLiveDesktop"),children:[n.jsx("img",{src:e,alt:l("computer.screenOf",{name:t}),onLoad:()=>{g(e),x(null)},onError:()=>x(e),className:`h-full w-full object-contain transition group-hover:brightness-75 ${v?"":"invisible"}`},c),v&&n.jsxs("span",{className:"absolute right-2 top-2 flex items-center gap-1 rounded-md bg-black/70 px-2 py-1 text-[11px] font-medium text-white",children:[i?n.jsx(je,{size:12,className:"animate-spin"}):n.jsx(y0,{size:12}),l(i?"computer.preview.connecting":"computer.open")]})]}),!v&&!k&&n.jsxs("div",{role:"status",className:"absolute inset-0 flex flex-col items-center justify-center gap-2 px-6 text-center text-[12px] text-ink-secondary",children:[n.jsx(je,{size:18,className:"animate-spin"}),l(o?"computer.phase.starting":"computer.preview.connectingScreen")]}),v&&r&&!k&&n.jsxs("div",{role:"status",className:"absolute bottom-2 left-2 flex items-center gap-1 rounded-md bg-black/70 px-2 py-1 text-[11px] text-white",children:[n.jsx(je,{size:12,className:"animate-spin"}),l("computer.preview.connectingScreen")]}),k&&n.jsxs("div",{role:"alert",className:`absolute inset-x-0 flex flex-col items-center justify-center gap-2 bg-card/95 p-4 text-center text-[12px] text-ink-secondary ${v?"bottom-0":"inset-y-0"}`,children:[!v&&n.jsx(Ea,{size:22}),n.jsxs("span",{children:[l(v?"computer.preview.paused":"computer.preview.cantConnect")," ",k]}),n.jsx("button",{type:"button",onClick:()=>p(!v),className:"rounded-md bg-control px-3 py-1.5 text-ink hover:bg-control-hover",children:l("computer.preview.retry")})]})]})}const X9e={available:!1,devices:[]};function eIe(){const e=window.ogb?.androidDevice,[t,a]=f.useState(X9e),o=Dv();return f.useEffect(()=>{if(!e||!o)return;let i=!0;const s=async()=>{try{const c=await e.status();i&&a(c)}catch(c){i&&a({available:!1,devices:[],reasonCode:"adb-failed",message:c instanceof Error?c.message:String(c)})}};s();const r=window.setInterval(()=>{s()},2e3);return()=>{i=!1,window.clearInterval(r)}},[e,o]),t}function gy(e){return e.model==="Android device"?e.serial:e.model}function tIe({status:e}){const t=window.ogb?.androidDevice,a=Dv(),o=e.devices.filter(R=>R.state==="device"),[i,s]=f.useState(o[0]?.serial??e.devices[0]?.serial??""),[r,c]=f.useState(null),[d,p]=f.useState({width:0,height:0}),[h,g]=f.useState(null),b=f.useRef(null),x=f.useRef(null),v=f.useRef({x:0,y:0,timer:null}),k=e.devices.find(R=>R.serial===i)??e.devices[0],w=k?.serial,N=k?.state;f.useEffect(()=>{!k&&e.devices[0]&&s(e.devices[0].serial),k&&!e.devices.some(R=>R.serial===k.serial)&&s(e.devices[0]?.serial??"")},[k,e.devices]),f.useEffect(()=>{if(!t||!w||N!=="device"||!a){if(!a)return;c(null);return}let R=!0,B=null;const O=async()=>{try{const T=await t.frame(w);R&&(c(T.dataUrl),g(null))}catch(T){R&&g(T instanceof Error?T.message:String(T))}finally{R&&(B=window.setTimeout(()=>{O()},850))}};return O(),()=>{R=!1,B!==null&&window.clearTimeout(B)}},[t,w,N,a]),f.useEffect(()=>()=>{v.current.timer&&clearTimeout(v.current.timer)},[]);const C=R=>{!t||!k||k.state!=="device"||t.input(k.serial,R).catch(B=>{g(B instanceof Error?B.message:String(B))})},j=(R,B=!1)=>{if(!b.current||!d.width||!d.height)return null;const T=R.currentTarget.getBoundingClientRect(),z=Math.min(T.width/d.width,T.height/d.height),P=d.width*z,L=d.height*z,G=T.left+(T.width-P)/2,H=T.top+(T.height-L)/2,$=(R.clientX-G)/P,U=(R.clientY-H)/L;return B?{x:Math.max(0,Math.min(1,$)),y:Math.max(0,Math.min(1,U))}:$>=0&&$<=1&&U>=0&&U<=1?{x:$,y:U}:null},M=R=>{if(R.metaKey||R.ctrlKey||R.altKey)return;const B={ArrowDown:"down",ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",Backspace:"delete",Delete:"delete",Enter:"enter",Escape:"back",Tab:"tab"};B[R.key]?(R.preventDefault(),C({type:"key",key:B[R.key]})):/^[A-Za-z0-9 _.,@-]$/.test(R.key)&&(R.preventDefault(),C({type:"text",text:R.key}))},E=R=>{if(!d.width||!d.height)return;R.preventDefault();const B=v.current;B.x+=R.deltaX,B.y+=R.deltaY,B.timer&&clearTimeout(B.timer),B.timer=setTimeout(()=>{const O=Math.abs(B.x)>Math.abs(B.y),T=O?B.x:B.y;if(B.x=0,B.y=0,B.timer=null,Math.abs(T)<2)return;const z=Math.max(.18,Math.min(.45,Math.abs(T)/500)),P=T>0?-1:1,L=O?{x:.5,y:.5}:{x:.5,y:.65},G=O?{x:L.x+P*z,y:L.y}:{x:L.x,y:L.y+P*z};C({type:"swipe",fromX:L.x,fromY:L.y,toX:G.x,toY:G.y,durationMs:260,width:d.width,height:d.height})},80)};if(!k)return null;const A=k.state==="device";return n.jsxs("div",{className:"space-y-3 pb-5",children:[n.jsxs("div",{className:"rounded-xl bg-card p-4",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 text-[15px] font-medium text-ink",children:[n.jsx(ld,{size:16,className:"text-success"})," ",gy(k)]}),n.jsx("div",{className:"mt-1 text-[12px] leading-relaxed text-ink-secondary",children:l("computer.android.usbSubtitle")})]}),n.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-[11px] text-success",children:[n.jsx(Os,{size:12})," ",l("computer.android.usb")]})]}),e.devices.length>1&&n.jsx("select",{value:k.serial,onChange:R=>s(R.target.value),className:"mt-3 w-full rounded-lg border border-hairline/40 bg-inset px-3 py-2 text-[12px] text-ink",children:e.devices.map(R=>n.jsxs("option",{value:R.serial,children:[gy(R)," · ",R.state]},R.serial))})]}),A?n.jsxs(n.Fragment,{children:[n.jsx("div",{role:"application","aria-label":l("computer.android.screenAria",{name:gy(k)}),tabIndex:0,onKeyDown:M,onWheel:E,onPointerDown:R=>{const B=j(R);B&&(R.currentTarget.setPointerCapture(R.pointerId),x.current={point:B,at:performance.now()})},onPointerUp:R=>{const B=x.current,O=j(R,!0);if(x.current=null,!B||!O)return;Math.hypot(O.x-B.point.x,O.y-B.point.y)<.012?C({type:"tap",...O,...d}):C({type:"swipe",fromX:B.point.x,fromY:B.point.y,toX:O.x,toY:O.y,durationMs:performance.now()-B.at,...d}),R.currentTarget.focus()},onPointerCancel:()=>{x.current=null},className:"mx-auto flex h-[520px] w-full touch-none cursor-pointer items-center justify-center overflow-hidden overscroll-none rounded-[28px] bg-black outline-none ring-1 ring-white/10 focus:ring-2 focus:ring-accent",children:r?n.jsx("img",{ref:b,src:r,alt:l("computer.android.screenAlt",{name:gy(k)}),draggable:!1,onLoad:R=>{p({width:R.currentTarget.naturalWidth,height:R.currentTarget.naturalHeight})},className:"pointer-events-none h-full w-full select-none object-contain"}):n.jsx(je,{size:20,className:"animate-spin text-ink-secondary"})}),n.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[n.jsxs("button",{onClick:()=>C({type:"key",key:"back"}),className:"flex items-center justify-center gap-1.5 rounded-lg bg-raised py-2 text-[12px] text-ink hover:bg-raised-hover",children:[n.jsx(Gl,{size:13})," ",l("computer.android.back")]}),n.jsxs("button",{onClick:()=>C({type:"key",key:"home"}),className:"flex items-center justify-center gap-1.5 rounded-lg bg-raised py-2 text-[12px] text-ink hover:bg-raised-hover",children:[n.jsx(Gh,{size:12})," ",l("computer.android.home")]}),n.jsxs("button",{onClick:()=>C({type:"key",key:"recent"}),className:"flex items-center justify-center gap-1.5 rounded-lg bg-raised py-2 text-[12px] text-ink hover:bg-raised-hover",children:[n.jsx(Fs,{size:13})," ",l("computer.android.recent")]})]}),n.jsx("div",{className:"text-center text-[11px] leading-relaxed text-ink-secondary",children:l("computer.android.hint")})]}):n.jsx("div",{className:"rounded-xl border border-warning/25 bg-warning/10 p-4 text-[12px] leading-relaxed text-warning",children:k.state==="unauthorized"?l("computer.android.unauthorized"):l("computer.android.badState",{state:k.state})}),h&&n.jsx("div",{className:"rounded-lg border border-danger/30 bg-danger/10 px-3 py-2 text-[12px] text-danger",children:h}),n.jsxs("div",{className:"rounded-xl bg-card p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[13px] font-medium text-ink",children:[n.jsx(pQ,{size:15,className:"text-accent"})," ",l("computer.android.setupTitle")]}),n.jsxs("ol",{className:"mt-2 list-decimal space-y-1.5 pl-4 text-[11.5px] leading-relaxed text-ink-secondary",children:[n.jsx("li",{children:l("computer.android.step1")}),n.jsx("li",{children:l("computer.android.step2").split(/(\{buildNumber\}|\{usbDebugging\})/).map((R,B)=>R==="{buildNumber}"||R==="{usbDebugging}"?n.jsx("span",{className:"text-ink",children:l(R==="{buildNumber}"?"computer.android.buildNumber":"computer.android.usbDebugging")},B):R)}),n.jsxs("li",{children:[l("computer.android.step3a")," ",n.jsx("span",{className:"text-ink",children:l("computer.android.allowUsbDebugging")})," ",l("computer.android.step3b")]})]}),n.jsx("div",{className:"mt-2 text-[11px] leading-relaxed text-ink-secondary",children:l("computer.android.agentNote")}),n.jsx("div",{className:"mt-2 rounded-lg bg-inset px-3 py-2 text-[11px] leading-relaxed text-ink-secondary",children:l("computer.android.harnessNote")})]})]})}function ZT(e){return e.map(({id:t,name:a})=>({id:t,name:a}))}function nIe(e,t){return{browserProfiles:ZT(t),expectedBrowserProfiles:ZT(e)}}function aIe(){return`profile-${crypto.randomUUID().replaceAll("-","")}`}function QT(e,t){const a=e.filter(i=>i.browserProfile===t&&i.busy);if(!a.length)return null;const o=a.map(i=>i.name).join(", ");return a.length===1?l("settings.profiles.busyOne",{names:o}):l("settings.profiles.busyMany",{names:o})}function m$({bot:e,onProfileChanged:t,disabled:a=!1}){const{state:o,dispatch:i,flushBotPatches:s}=ke(),r=o.config?.browserProfiles??[],c=o.bots??[],d=e?c.find(G=>G.id===e.id)??e:void 0,[p,h]=f.useState(null),[g,b]=f.useState(!1),[x,v]=f.useState(""),[k,w]=f.useState(null),[N,C]=f.useState(""),j=f.useId(),M=g||a||p!==!0;f.useEffect(()=>{let G=!0;return Np().then(H=>{G&&h(qS(H))}),()=>{G=!1}},[]);const E=async G=>{if(C(G instanceof Error?G.message:l("settings.profiles.saveError")),G instanceof Qo&&G.status===409)try{const H=await Z("/api/config");i({type:"configStatus",config:H})}catch{C(l("settings.profiles.refreshError"))}G instanceof Qo&&(G.status===401||G.status===403)&&h(!1)},A=async G=>{try{const H=await Z("/api/config",{method:"PATCH",body:JSON.stringify(nIe(r,G))});return i({type:"configStatus",config:H}),!0}catch(H){return await E(H),!1}},R=async()=>{if(!(M||!x.trim()||r.length>=20)){b(!0),C("");try{await A([...r,{id:aIe(),name:x.trim()}])&&v("")}finally{b(!1)}}},B=async()=>{if(!(M||!k?.name.trim())){if(!r.some(G=>G.id===k.id)){C(l("settings.profiles.removed"));return}b(!0),C("");try{await A(r.map(G=>G.id===k.id?{...G,name:k.name.trim()}:G))&&w(null)}finally{b(!1)}}},O=async G=>{if(M)return;const H=QT(c,G.id);if(H)return C(H);const $=c.filter(Q=>Q.browserProfile===G.id),U=$.length?` ${l("settings.profiles.deleteUsers",{names:$.map(Q=>Q.name).join(", ")})}`:"";if(window.confirm(l("settings.profiles.confirm",{name:G.name,bots:U}))){b(!0),C("");try{await A(r.filter(Q=>Q.id!==G.id))&&(k?.id===G.id&&w(null),d?.browserProfile===G.id&&t?.())}finally{b(!1)}}},T=async G=>{if(!(M||!d||d.busy||G===(d.browserProfile??""))){b(!0),C("");try{await s(d.id);const H=await Z(`/api/bots/${encodeURIComponent(d.id)}`,{method:"PATCH",body:JSON.stringify({browserProfile:G||null})});i({type:"botPatched",bot:H.bot}),t?.()}catch(H){await E(H)}finally{b(!1)}}};if(p===!1)return n.jsx("p",{className:"text-[12px] text-ink-secondary",children:l("settings.profiles.ownerOnly")});const z="min-w-0 flex-1 rounded-md border border-hairline/40 bg-inset px-2.5 py-2 text-[13px] text-ink outline-none focus:border-accent disabled:opacity-50",P="shrink-0 rounded-md bg-control px-2.5 py-2 text-[12px] text-ink hover:bg-control-hover disabled:opacity-50",L=d?.browserProfile??"";return n.jsxs("div",{className:"flex min-w-0 flex-col gap-3","aria-busy":g,children:[d&&n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx("label",{htmlFor:`${j}-profile`,className:"text-[12px] font-medium text-ink",children:l("settings.profiles.browserSession")}),n.jsxs("select",{id:`${j}-profile`,value:L,disabled:M||d.busy,onChange:G=>{T(G.target.value)},className:z,children:[n.jsx("option",{value:"",children:l("settings.profiles.own")}),r.map(G=>n.jsx("option",{value:G.id,children:G.name},G.id)),n.jsx("option",{value:"guest",children:l("settings.profiles.temporary")}),L&&L!=="guest"&&!r.some(G=>G.id===L)?n.jsx("option",{value:L,disabled:!0,children:l("settings.profiles.removed")}):null]}),n.jsx("p",{className:"text-[11px] leading-relaxed text-ink-secondary",children:d.busy?l("settings.profiles.stopToSwitch"):l(L==="guest"?"settings.profiles.temporaryHint":"settings.profiles.sharedHint")})]}),n.jsxs("details",{open:!d,className:"min-w-0",children:[n.jsx("summary",{className:"cursor-pointer text-[12px] font-medium text-ink-secondary hover:text-ink",children:l("settings.profiles.manage")}),n.jsxs("div",{className:"mt-3 flex flex-col gap-3",children:[n.jsxs("form",{className:"flex flex-wrap gap-2",onSubmit:G=>{G.preventDefault(),R()},children:[n.jsx("label",{htmlFor:`${j}-new`,className:"sr-only",children:l("settings.profiles.newName")}),n.jsx("input",{id:`${j}-new`,value:x,onChange:G=>v(G.target.value),maxLength:40,required:!0,disabled:M||r.length>=20,placeholder:l("settings.profiles.newName"),className:z}),n.jsxs("button",{type:"submit",disabled:M||!x.trim()||r.length>=20,className:`${P} flex items-center gap-1`,children:[n.jsx(Sn,{size:13}),l("settings.profiles.create")]})]}),r.length>=20&&n.jsx("p",{className:"text-[11px] text-ink-secondary",children:l("settings.profiles.limit")}),!r.length&&n.jsx("p",{className:"text-[12px] text-ink-secondary",children:l("settings.profiles.sharedEmpty")}),n.jsx("div",{className:"divide-y divide-hairline/30",children:r.map(G=>{const H=c.filter(U=>U.browserProfile===G.id).map(U=>U.name),$=QT(c,G.id);return n.jsxs("div",{className:"flex flex-col gap-1 py-2",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[n.jsx(Sr,{size:14,className:"shrink-0 text-ink-secondary"}),k?.id===G.id?n.jsxs("form",{className:"flex min-w-0 flex-1 flex-wrap gap-2",onSubmit:U=>{U.preventDefault(),B()},children:[n.jsx("input",{autoFocus:!0,value:k.name,onChange:U=>w({id:G.id,name:U.target.value}),maxLength:40,required:!0,disabled:M,className:z,"aria-label":l("settings.profiles.nameAria")}),n.jsx("button",{type:"submit",disabled:M||!k.name.trim(),className:P,children:l("common.save")}),n.jsx("button",{type:"button",disabled:g,onClick:()=>w(null),className:P,children:l("common.cancel")})]}):n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",disabled:M,onClick:()=>{w({id:G.id,name:G.name}),C("")},className:"min-w-0 flex-1 truncate text-left text-[13px] font-medium text-ink hover:underline disabled:opacity-50",title:l("settings.profiles.rename"),children:G.name}),n.jsxs("button",{type:"button",onClick:()=>{O(G)},disabled:M||!!$,title:$??l("settings.profiles.deleteTitle"),"aria-label":`${l("common.delete")} ${G.name}`,className:"flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-[12px] text-ink-secondary hover:bg-control hover:text-danger disabled:opacity-50",children:[n.jsx(xn,{size:13}),l("common.delete")]})]})]}),n.jsx("p",{className:"break-words pl-6 text-[11px] text-ink-secondary",children:H.length?l("settings.profiles.usedBy",{names:H.join(", ")}):l("settings.profiles.notInUse")})]},G.id)})})]})]}),N&&n.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:N})]})}const ku=e=>Number(e.altKey)+Number(e.ctrlKey)*2+Number(e.metaKey)*4+Number(e.shiftKey)*8;function oIe(e,t,a,o,i,s,r,c=!1){if(![e.width,e.height,t,a,o,i].every(x=>Number.isFinite(x)&&x>0)||![s,r].every(Number.isFinite))return null;const d=Math.min(e.width/t,e.height/a),p=t*d,h=a*d,g=s-e.left-(e.width-p)/2,b=r-e.top-(e.height-h)/2;return!c&&(g<0||b<0||g>=p||b>=h)?null:{x:Math.max(0,Math.min(o-1,g*o/p)),y:Math.max(0,Math.min(i-1,b*i/h))}}function iIe(e){const t=new Map;return{send(a){const i=a.type==="input_keyboard"?`key:${a.code||a.key}`:`mouse:${a.button}`;if((a.eventType==="keyDown"||a.eventType==="mousePressed")&&t.set(i,{...a}),(a.eventType==="keyUp"||a.eventType==="mouseReleased")&&t.delete(i),a.eventType==="mouseMoved")for(const s of t.values())s.type==="input_mouse"&&(s.x=a.x,s.y=a.y);e(a)},release(){const a=[...t.values()].reverse();t.clear();for(const{text:o,...i}of a)e({...i,eventType:i.type==="input_keyboard"?"keyUp":"mouseReleased",modifiers:0})}}}function sIe({frame:e,width:t,height:a,driving:o,input:i,acknowledge:s,onDecodeError:r,onReturnToToolbar:c}){const d=f.useRef(null),p=f.useRef(""),h=f.useRef(-1),g=e.metadata?.deviceWidth??t,b=e.metadata?.deviceHeight??a,x=`data:image/${e.format==="png"?"png":"jpeg"};base64,${e.data}`,v=f.useMemo(()=>iIe(i),[i]),k=v.send;f.useLayoutEffect(()=>(o||v.release(),v.release),[o,v]),f.useEffect(()=>(window.addEventListener("blur",v.release),()=>window.removeEventListener("blur",v.release)),[v]);const w=()=>{if(d.current?.complete&&d.current.naturalWidth>0&&d.current.currentSrc===x){if(d.current.currentSrc===p.current&&e.seq===h.current)return;p.current=d.current.currentSrc,h.current=e.seq,s(e.seq)}};f.useEffect(()=>{const C=requestAnimationFrame(w);return()=>cancelAnimationFrame(C)},[e]);const N=(C,j,M=!1)=>{const E=d.current;return!E?.complete||E.currentSrc!==x?null:oIe(E.getBoundingClientRect(),E.naturalWidth,E.naturalHeight,g,b,C,j,M)};return f.useEffect(()=>{const C=d.current;if(!C||!o)return;const j=M=>{M.preventDefault();const E=N(M.clientX,M.clientY);if(!E)return;const A=M.deltaMode===1?16:M.deltaMode===2?b:1,R=B=>Math.max(-1e4,Math.min(1e4,B*A));k({type:"input_mouse",eventType:"mouseWheel",...E,deltaX:R(M.deltaX),deltaY:R(M.deltaY),modifiers:ku(M)})};return C.addEventListener("wheel",j,{passive:!1}),()=>C.removeEventListener("wheel",j)},[o,k,g,b,x]),n.jsx(n.Fragment,{children:n.jsx("img",{ref:d,src:x,alt:"Live bot browser",draggable:!1,tabIndex:o?0:-1,title:o?"Shift+Escape returns to the browser address bar.":void 0,"aria-description":o?"Keyboard input goes to the remote page. Press Shift+Escape to return to the browser address bar.":void 0,"aria-keyshortcuts":o?"Shift+Escape":void 0,className:`block h-full w-full object-contain select-none outline-none focus:ring-2 focus:ring-inset focus:ring-accent ${o?"cursor-default touch-none":"cursor-not-allowed"}`,onLoad:w,onError:r,onBlur:v.release,onContextMenu:C=>{o&&C.preventDefault()},onPointerDown:C=>{if(!o)return;const j=N(C.clientX,C.clientY);j&&(C.preventDefault(),C.currentTarget.focus(),C.currentTarget.setPointerCapture(C.pointerId),k({type:"input_mouse",eventType:"mousePressed",...j,button:C.button===2?"right":C.button===1?"middle":"left",clickCount:Math.min(3,C.detail||1),modifiers:ku(C)}))},onPointerUp:C=>{if(!o)return;C.preventDefault();const j=N(C.clientX,C.clientY,C.currentTarget.hasPointerCapture(C.pointerId));if(!j){v.release();return}k({type:"input_mouse",eventType:"mouseReleased",...j,button:C.button===2?"right":C.button===1?"middle":"left",clickCount:Math.min(3,C.detail||1),modifiers:ku(C)})},onPointerCancel:v.release,onPointerMove:C=>{if(!o)return;const j=N(C.clientX,C.clientY,C.currentTarget.hasPointerCapture(C.pointerId));j&&k({type:"input_mouse",eventType:"mouseMoved",...j,button:C.buttons&1?"left":C.buttons&2?"right":C.buttons&4?"middle":"none",modifiers:ku(C)})},onKeyDown:C=>{if(!(!o||C.nativeEvent.isComposing)){if(C.key==="Escape"&&C.shiftKey){C.preventDefault(),C.stopPropagation(),v.release(),c();return}(C.metaKey||C.ctrlKey)&&C.key.toLowerCase()==="v"||(C.preventDefault(),k({type:"input_keyboard",eventType:"keyDown",key:C.key,code:C.code,windowsVirtualKeyCode:C.keyCode,modifiers:ku(C),...C.key.length===1&&!C.metaKey&&!C.ctrlKey&&!C.altKey?{text:C.key}:{}}))}},onKeyUp:C=>{if(!(!o||(C.metaKey||C.ctrlKey)&&C.key.toLowerCase()==="v")){if(C.key==="Escape"&&C.shiftKey){C.preventDefault(),C.stopPropagation();return}C.preventDefault(),k({type:"input_keyboard",eventType:"keyUp",key:C.key,code:C.code,windowsVirtualKeyCode:C.keyCode,modifiers:ku(C)})}},onPaste:C=>{o&&(C.preventDefault(),k({type:"input_keyboard",eventType:"char",text:C.clipboardData.getData("text/plain").slice(0,4096)}))}})})}const fy=e=>e.type==="input_mouse"&&["mouseMoved","mouseWheel"].includes(String(e.eventType)),O2=e=>e.type==="input_mouse"&&e.eventType==="mouseReleased"||e.type==="input_keyboard"&&e.eventType==="keyUp",by=e=>typeof e=="number"&&Number.isFinite(e)?e:0,XT=e=>Math.max(-1e4,Math.min(1e4,e));function rIe(e,t){let a=[],o=null,i=0,s=!1;const r=d=>{a=a.filter(O2),s||(s=!0,t(d))},c=()=>{if(o||!a.length)return;const d=i;o=(async()=>{for(;d===i&&a.length;){const p=a.shift();try{await e(p)}catch(h){d===i&&r(h)}}})().finally(()=>{o=null,c()})};return{enqueue(d){if(s&&!O2(d))return;const p=a.at(-1);if(p&&fy(d)&&p.type===d.type&&p.eventType===d.eventType&&p.modifiers===d.modifiers&&p.button===d.button){a[a.length-1]=d.eventType==="mouseWheel"?{...d,deltaX:XT(by(p.deltaX)+by(d.deltaX)),deltaY:XT(by(p.deltaY)+by(d.deltaY))}:{...d};return}if(a.length>=32){if(fy(d))return;const h=a.findIndex(fy);if(h>=0)a.splice(h,1);else if(r(new Error("Browser input stopped because the connection is too slow. Release control and reconnect before typing again.")),!O2(d)||a.length>=32)return}a.push({...d}),c()},async drain(){for(a=a.filter(d=>!fy(d));o||a.length;)c(),await o},clear(){i++,a=[],s=!1},stopped(){return s}}}const ss="rounded-md p-1.5 text-ink-secondary hover:bg-inset hover:text-ink disabled:opacity-40 disabled:cursor-not-allowed",lIe=[1e3,2e3,4e3,8e3,15e3],eB="Connection interrupted. Reconnecting the browser view…";function cIe({bot:e}){const{state:t}=ke(),[a,o]=f.useState(0),[i,s]=f.useState(null),[r,c]=f.useState([]),[d,p]=f.useState(""),[h,g]=f.useState(!1),[b,x]=f.useState({held:!1,controlling:!1,owned:!1}),[v,k]=f.useState(!1),[w,N]=f.useState(""),[C,j]=f.useState(!1),[M,E]=f.useState(!1),[A,R]=f.useState({width:1280,height:720}),B=f.useRef(""),O=f.useRef(0),T=f.useRef(null),z=f.useRef(null),P=f.useRef(null),L=f.useRef(null),G=f.useRef(null),H=f.useRef(null),$=f.useRef(""),U=f.useRef(!1),Q=f.useRef(0),W=f.useRef(""),q=e.browserProfile==="guest"?"Temporary browser":t.config?.browserProfiles?.find(ee=>ee.id===e.browserProfile)?.name??`${e.name}’s own browser`;f.useEffect(()=>{C?L.current?.showModal():L.current?.close()},[C]),f.useEffect(()=>{M?G.current?.showModal():G.current?.close()},[M]);const Y=f.useCallback(async(ee,X=B.current)=>{if(!X)throw new Error("Open the browser connection first.");return Z(`/api/bots/${encodeURIComponent(e.id)}/browser/action`,{method:"POST",body:JSON.stringify({...ee,viewerId:X}),timeoutMs:12e4})},[e.id]),ae=f.useCallback(ee=>{H.current?.enqueue(ee)},[]),F=f.useCallback(()=>{O.current++,Q.current=0,B.current="",H.current?.clear(),H.current=null,T.current=null,o(ee=>ee+1)},[]);f.useEffect(()=>{const ee=++O.current,X=()=>O.current===ee,oe=JSON.stringify([e.id,e.browserProfile]);W.current!==oe&&(W.current=oe,Q.current=0);let ne=!1,Ce;B.current="",T.current=null,$.current="",U.current=!1,s(null),c([]),p(""),g(!1),N(""),x({held:!1,controlling:!1,owned:!1}),k(!1);const le=new EventSource(`/api/bots/${encodeURIComponent(e.id)}/browser/live`),re=(xe,Te)=>le.addEventListener(xe,nt=>{if(!(ne||!X()))try{Te(JSON.parse(nt.data))}catch{}});return re("ready",xe=>{if(typeof xe.viewerId!="string"||!xe.viewerId)return;const Te=xe.viewerId;B.current=Te,H.current=rIe(async nt=>{X()&&B.current===Te&&await Y(nt,Te)},nt=>{!X()||B.current!==Te||($.current=nt instanceof Error?nt.message:String(nt),N($.current))}),g(!0)}),re("heartbeat",()=>{Q.current=0}),re("frame",xe=>{B.current&&s({...xe,viewerId:B.current,generation:ee})}),re("tabs",xe=>{if(!Array.isArray(xe.tabs))return;c(xe.tabs);const Te=xe.tabs.find(nt=>nt.active);Te&&!U.current&&p(Te.url==="about:blank"?"":Te.url)}),re("url",xe=>{typeof xe.url=="string"&&!U.current&&p(xe.url==="about:blank"?"":xe.url)}),re("status",xe=>{xe.viewportWidth>0&&xe.viewportHeight>0&&R({width:xe.viewportWidth,height:xe.viewportHeight})}),re("control",xe=>{x(xe),xe.held&&!xe.controlling&&(s(null),c([]),p(""))}),le.addEventListener("error",xe=>{if(ne||!X())return;ne=!0;let Te="Browser connection ended. Reconnect to continue watching.",nt=!(xe instanceof MessageEvent);if(xe instanceof MessageEvent)try{const Ye=JSON.parse(xe.data);Te=Ye.message||Te,nt=Ye.retryable===!0}catch{}const be=nt?lIe[Q.current]:void 0;be!==void 0&&(Q.current++,Te=eB,Ce=setTimeout(()=>{X()&&(O.current++,o(Ye=>Ye+1))},be)),N(Te),g(!1),s(null),x({held:!1,controlling:!1,owned:!1}),B.current="",H.current?.clear(),H.current=null,le.close()}),()=>{ne=!0,clearTimeout(Ce),X()&&(O.current++,B.current="",T.current=null,H.current?.clear(),H.current=null),le.close()}},[e.id,e.browserProfile,a,Y]);const pe=async ee=>{if(T.current!==null)return;const X=B.current,oe=O.current,ne=H.current;T.current=oe,k(!0),N("");try{if(await ne?.drain(),O.current!==oe||B.current!==X)return;await Y(ee,X),H.current?.stopped()&&O.current===oe&&N($.current),O.current===oe&&ee.type==="restart"&&F()}catch(Ce){O.current===oe&&N(Ce instanceof Error?Ce.message:String(Ce))}finally{O.current===oe&&T.current===oe&&(T.current=null,k(!1))}},ge=b.controlling&&h&&!v,Ne=w===eB;return n.jsxs("div",{ref:z,className:"flex min-h-0 flex-1 flex-col overflow-hidden rounded-2xl border border-hairline/40 bg-card text-ink",children:[n.jsxs("div",{className:"flex min-h-12 items-center gap-1 px-2 pt-1.5",children:[n.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:[r.length?r.map(ee=>n.jsxs("div",{className:`flex max-w-52 shrink-0 items-center gap-1 rounded-xl px-1 text-[12px] ${ee.active?"bg-inset text-ink":"text-ink-secondary"}`,children:[n.jsx(Sr,{size:13,className:"ml-1.5 shrink-0 opacity-60"}),n.jsx("button",{className:"truncate px-1 py-2 text-left disabled:cursor-default",disabled:!ge,onClick:()=>{pe({type:"tab-select",tabId:ee.tabId})},title:ee.title||ee.url,children:ee.title||"New tab"}),n.jsx("button",{className:ss,"aria-label":`Close ${ee.title||"tab"}`,disabled:!ge,onClick:()=>{pe({type:"tab-close",tabId:ee.tabId})},children:n.jsx(jt,{size:13})})]},ee.tabId)):n.jsxs("div",{className:"flex items-center gap-2 rounded-xl bg-inset px-3 py-2 text-[12px] text-ink-secondary",children:[n.jsx(Sr,{size:13}),"New tab"]}),n.jsx("button",{className:`${ss} shrink-0`,disabled:!ge,"aria-label":"New tab",title:"New tab",onClick:()=>{pe({type:"tab-new"})},children:n.jsx(Sn,{size:17})})]}),n.jsx("button",{className:ss,title:"Full screen","aria-label":"Full screen",onClick:()=>{z.current?.requestFullscreen().catch(()=>N("Full screen is unavailable in this browser."))},children:n.jsx(y0,{size:16})}),n.jsx("button",{className:`${ss} rounded-xl bg-inset p-2`,title:`Browser profile: ${q}`,"aria-label":"Browser profiles","aria-expanded":C,onClick:()=>j(!0),children:n.jsx(H4,{size:16})})]}),n.jsxs("form",{className:"flex h-12 items-center gap-1 border-b border-hairline/40 px-2",onSubmit:ee=>{ee.preventDefault(),ge&&d.trim()&&pe({type:"navigate",url:/^https?:\/\//i.test(d.trim())?d.trim():`https://${d.trim()}`})},children:[n.jsxs("div",{className:"flex shrink-0 items-center",children:[n.jsx("button",{type:"button",className:ss,disabled:!ge,"aria-label":"Back",onClick:()=>{pe({type:"back"})},children:n.jsx(Gl,{size:17})}),n.jsx("button",{type:"button",className:ss,disabled:!ge,"aria-label":"Forward",onClick:()=>{pe({type:"forward"})},children:n.jsx(Mg,{size:17})}),n.jsx("button",{type:"button",className:ss,disabled:!ge,"aria-label":"Reload page",onClick:()=>{pe({type:"reload"})},children:n.jsx(Z2,{size:17})})]}),n.jsx("input",{ref:P,"aria-label":"Browser address",readOnly:!ge,value:d,onChange:ee=>p(ee.target.value),onFocus:ee=>{U.current=!0,ge&&ee.target.select()},onBlur:()=>{U.current=!1},placeholder:h?"about:blank":"Connecting…",spellCheck:!1,className:"mx-1 min-w-0 flex-1 rounded-lg bg-transparent px-2 py-1.5 text-center text-[12px] outline-none placeholder:text-ink-secondary focus:bg-inset focus:text-left"}),n.jsxs("button",{type:"button",disabled:!h||v||b.held&&!b.owned,onClick:()=>{pe({type:b.owned?"release":"take"})},title:b.owned?"Return to bot — browser tools are paused while you control this profile":b.held?"This profile is controlled in another window":"Take control to click, type, or sign in","aria-label":b.owned?"Return to bot":"Take control","aria-pressed":b.owned,className:`${ss} flex shrink-0 items-center gap-1.5 whitespace-nowrap text-[11px] sm:text-[12px] ${b.owned?"bg-accent/15 text-accent":""}`,children:[v?n.jsx(je,{size:16,className:"animate-spin"}):n.jsx(Li,{size:16,className:"hidden sm:block"}),n.jsx("span",{children:b.owned?"Return to bot":"Take control"})]}),n.jsxs("details",{className:"relative shrink-0",children:[n.jsx("summary",{className:`${ss} list-none cursor-pointer [&::-webkit-details-marker]:hidden`,"aria-label":"Browser menu",title:"Browser menu",children:n.jsx(NJ,{size:17})}),n.jsxs("div",{className:"absolute right-0 top-full z-20 mt-2 flex w-44 flex-col rounded-xl border border-hairline/50 bg-card p-1.5 text-[12px] shadow-xl",children:[n.jsx("button",{type:"button",className:"rounded-md px-3 py-2 text-left hover:bg-inset disabled:opacity-40",disabled:!ge,onClick:ee=>{ee.currentTarget.closest("details")?.removeAttribute("open"),E(!0)},children:"Type or paste text…"}),n.jsx("button",{type:"button",className:"rounded-md px-3 py-2 text-left hover:bg-inset",onClick:ee=>{ee.currentTarget.closest("details")?.removeAttribute("open"),F()},children:"Reconnect view"}),n.jsx("button",{type:"button",className:"rounded-md px-3 py-2 text-left hover:bg-inset disabled:opacity-40",disabled:!h||v,onClick:ee=>{ee.currentTarget.closest("details")?.removeAttribute("open"),window.confirm("Restart this profile’s browser? Open tabs will close. Saved logins are kept. Stop any bots using it first.")&&pe({type:"restart"})},children:"Restart browser…"})]})]})]}),w&&n.jsxs("div",{role:Ne?"status":"alert",className:`flex items-center justify-between gap-2 border-b border-hairline/30 px-3 py-2 text-[12px] ${Ne?"text-ink-secondary":"text-danger"}`,children:[n.jsx("span",{children:w}),!h&&n.jsx("button",{className:"shrink-0 underline",onClick:F,children:"Reconnect"})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden bg-inset/40",children:i?n.jsx(sIe,{frame:i,...A,driving:ge,input:ae,onReturnToToolbar:()=>P.current?.focus(),acknowledge:ee=>{O.current===i.generation&&B.current===i.viewerId&&Y({type:"ack",seq:ee},i.viewerId).catch(()=>{})},onDecodeError:()=>{O.current===i.generation&&B.current===i.viewerId&&N("A browser frame could not be decoded. Close and reopen the panel to reconnect.")}}):n.jsxs("div",{className:"flex min-h-64 flex-col items-center justify-center gap-3 p-6 text-center text-[13px] text-ink-secondary",children:[h&&b.held?n.jsx(Li,{size:24}):w&&!Ne?n.jsx(Sr,{size:24}):n.jsx(je,{size:24,className:"animate-spin"}),n.jsx("span",{children:b.held?"Live view paused for human control":Ne?"Reconnecting…":w?"Browser disconnected":"Opening the live browser…"})]})}),n.jsxs("dialog",{ref:L,onClose:()=>j(!1),onClick:ee=>{ee.target===ee.currentTarget&&j(!1)},className:"m-auto w-[min(420px,calc(100%-32px))] max-h-[80vh] overflow-auto rounded-2xl border border-hairline/50 bg-card p-5 text-ink shadow-2xl backdrop:bg-black/40",children:[n.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[n.jsx("h2",{className:"text-[15px] font-medium",children:"Browser profiles"}),n.jsx("button",{className:ss,"aria-label":"Close browser profiles",onClick:()=>j(!1),children:n.jsx(jt,{size:16})})]}),n.jsx(m$,{bot:e,disabled:v||b.held,onProfileChanged:()=>{j(!1),F()}})]}),n.jsxs("dialog",{ref:G,onClose:()=>E(!1),className:"m-auto w-[min(420px,calc(100%-32px))] rounded-2xl border border-hairline/50 bg-card p-5 text-ink shadow-2xl backdrop:bg-black/40",children:[n.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[n.jsx("h2",{className:"text-[14px] font-medium",children:"Type into the selected page field"}),n.jsx("button",{className:ss,"aria-label":"Close typing",onClick:()=>E(!1),children:n.jsx(jt,{size:16})})]}),n.jsxs("form",{className:"flex flex-col gap-3",onSubmit:ee=>{ee.preventDefault();const X=ee.currentTarget.elements.namedItem("pageText");ge&&X.value&&(ae({type:"input_keyboard",eventType:"char",text:X.value}),X.value="",E(!1))},children:[n.jsx("input",{name:"pageText","aria-label":"Text for the page",autoComplete:"off",maxLength:4096,placeholder:"Type or paste text",className:"rounded-lg bg-inset px-3 py-2 text-[13px] outline-none focus:ring-1 focus:ring-accent"}),n.jsx("button",{disabled:!ge,className:"self-end rounded-lg bg-accent px-4 py-2 text-[12px] text-accent-ink disabled:opacity-40",children:"Type"})]})]})]})}function dIe({bot:e}){const{state:t}=ke(),a=t.config?.browserEngine,[o,i]=f.useState(!1),[s,r]=f.useState(null),[c,d]=f.useState(null);f.useEffect(()=>{let g=!0;return Z("/api/auth/session").then(b=>{g&&d(b.scopes.includes("admin"))}).catch(()=>{g&&d(!1)}),()=>{g=!1}},[]);const p=o||a?.installing===!0,h=async()=>{r(null),i(!0);try{await Z("/api/browser-engine/install",{method:"POST"})}catch(g){r(g instanceof Error?g.message:String(g))}finally{i(!1)}};return c===!1?n.jsx("div",{className:"p-5 text-[13px] text-ink-secondary",children:"Only workspace administrators can view or control saved browser sessions."}):e.browser===!1?n.jsx("div",{className:"p-5 text-[13px] text-ink-secondary",children:"Enable the browser in this bot’s profile to use it."}):a?.kind==="engine"&&!p&&!a.installError?c===null?n.jsx("div",{className:"p-5 text-[13px] text-ink-secondary",children:"Loading browser…"}):n.jsx(cIe,{bot:e},e.id):n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col items-start justify-center gap-3 rounded-xl bg-card p-5",children:[n.jsx("div",{className:"text-[15px] font-medium text-ink",children:a?.kind==="engine"?"Browser installation incomplete":"Browser engine not installed"}),n.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:a?.kind==="engine"?"agent-browser is installed, but Chrome setup has not finished. Retry the browser installation.":_g(t.config)}),a?.installable||a?.kind==="engine"?n.jsx("button",{type:"button",onClick:()=>{h()},disabled:p||c!==!0,className:"rounded-lg bg-accent px-3 py-1.5 text-[13px] font-medium text-accent-ink disabled:opacity-60",children:p?"Installing… (a one-time download of about 160 MB)":a?.kind==="engine"?"Retry browser installation":"Install the browser engine"}):null,(a?.installError||s)&&n.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:s??a?.installError})]})}const uIe=f.lazy(()=>QC(()=>import("./TerminalPanel-mkQO42zG.js"),__vite__mapDeps([0,1])).then(e=>({default:e.TerminalPanel})));function pIe({active:e,onClick:t}){return n.jsxs("button",{type:"button",onClick:t,"aria-pressed":e,className:V("flex items-center gap-1.5 border-l border-hairline/40 px-2.5 py-1 text-[12.5px]",e?"bg-control text-ink":"text-ink-secondary hover:text-ink"),children:[n.jsx(oQ,{size:13}),l("computer.tab.terminal")]})}function mIe({bot:e}){const{state:t}=ke();return n.jsx(f.Suspense,{fallback:null,children:n.jsx(uIe,{bot:e,localEnabled:Sz(t.config)})})}async function p4(e){const{action:t,syncNativeBrowser:a,requestControl:o,setNativeBrowserControl:i}=e;if(t==="dismiss-help")return o(t);if(t==="take"&&a&&!await i(!0))throw new Error("Atomic could not pause this bot's browser safely");const s=await o(t);if(s.held!==(t==="take"))throw new Error(`Atomic could not ${t==="take"?"confirm":"release"} computer control`);if(t==="release"&&a&&!await i(!1))throw new Error("The computer was released, but the browser remains paused for safety");return s}function Zy(e){for(const t of e?.getTracks()??[])t.stop()}function hIe(e){const t=e instanceof DOMException?e.name:"";return t==="NotAllowedError"||t==="AbortError"?{ok:!1,phase:"cancelled",messageKey:"computer.screen.cancelled"}:t==="NotFoundError"||t==="NotReadableError"||t==="NotSupportedError"||t==="SecurityError"?{ok:!1,phase:"unavailable",messageKey:"computer.screen.unavailableNow"}:{ok:!1,phase:"error",messageKey:"computer.screen.error"}}async function gIe({beginIntent:e,getDisplayMedia:t}){try{if(!e())return{ok:!1,phase:"unavailable",messageKey:"computer.screen.unavailableWindow"};const a=await t({video:!0,audio:!1});return a.getVideoTracks().length===0?(Zy(a),{ok:!1,phase:"unavailable",messageKey:"computer.screen.noVideoTrack"}):{ok:!0,stream:a}}catch(a){return hIe(a)}}const sh={idle:"computer.screen.idle",ended:"computer.screen.ended",unavailable:"computer.screen.unavailable"};function fIe(){const{capabilities:e,ready:t}=ya(),a=e.screenPreview,o=e.host.platform==="linux",[i,s]=f.useState("idle"),[r,c]=f.useState(sh.idle),[d,p]=f.useState(""),h=f.useRef(null),g=f.useRef(null),b=f.useRef(0),x=f.useCallback((N,C)=>{b.current+=1;const j=g.current;g.current=null,h.current&&(h.current.srcObject=null),Zy(j),s(N),c(C)},[]);f.useEffect(()=>()=>{b.current+=1;const N=g.current;g.current=null,Zy(N)},[]);const v=async()=>{if(!a.available||!window.ogb?.beginScreenPreviewIntent||!navigator.mediaDevices?.getDisplayMedia){s("unavailable"),c(sh.unavailable);return}x("requesting","computer.screen.waiting");const N=b.current,C=await gIe({beginIntent:()=>window.ogb.beginScreenPreviewIntent(),getDisplayMedia:A=>navigator.mediaDevices.getDisplayMedia(A)});if(N!==b.current){C.ok&&Zy(C.stream);return}if(!C.ok){s(C.phase),c(C.messageKey);return}const j=C.stream,M=j.getVideoTracks()[0];g.current=j,p(M.label),M.addEventListener("ended",()=>{g.current===j&&x("ended",sh.ended)},{once:!0});const E=h.current;if(!E){x("error","computer.screen.displayFailed");return}E.srcObject=j;try{await E.play()}catch{N===b.current&&g.current===j&&x("error","computer.screen.displayFailed");return}N!==b.current||g.current!==j||(s("streaming"),c("computer.screen.active"))};if(!o)return null;const k=d||l("computer.screen.selected"),w=i==="cancelled"||i==="ended"||i==="unavailable"||i==="error";return n.jsxs("section",{className:"mt-4 rounded-xl bg-card p-4","aria-labelledby":"local-preview-title",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{children:[n.jsx("div",{id:"local-preview-title",className:"text-[15px] font-medium text-ink",children:l("computer.screen.title")}),n.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:l("computer.screen.subtitle")})]}),n.jsx("span",{className:"shrink-0 rounded-full bg-raised px-2 py-1 text-[10px] font-medium text-ink-secondary",children:l("computer.screen.badge")})]}),n.jsxs("div",{className:"relative mt-3 flex aspect-[16/10] items-center justify-center overflow-hidden rounded-lg bg-panel",children:[n.jsx("video",{ref:h,autoPlay:!0,muted:!0,playsInline:!0,"aria-label":l("computer.screen.videoAria"),className:i==="streaming"?"h-full w-full object-contain":"hidden"}),i!=="streaming"&&n.jsxs("div",{className:"flex flex-col items-center gap-2 px-6 text-center text-ink-secondary",children:[i==="requesting"?n.jsx(je,{size:18,className:"animate-spin"}):n.jsx(Ea,{size:22}),n.jsx("span",{className:"text-[12px]","aria-live":"polite",children:l(t?a.available?r:sh.unavailable:"computer.screen.checking")})]})]}),i==="streaming"&&n.jsxs("div",{className:"mt-2 flex items-center justify-between gap-3 text-[11px] text-ink-secondary",children:[n.jsx("span",{className:"truncate",title:k,children:a.interaction==="portal-picker"?k:l("vm.dest.local")}),n.jsxs("span",{className:"flex items-center gap-1.5 text-success",children:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-success"})," ",l("computer.screen.sharing")]})]}),n.jsxs("button",{type:"button",disabled:i==="requesting"||!a.available&&i!=="streaming",onClick:i==="streaming"?()=>x("idle",sh.idle):()=>{v()},className:"mt-3 flex w-full items-center justify-center gap-2 rounded-lg bg-raised py-2 text-[13px] text-ink hover:bg-raised-hover disabled:cursor-not-allowed disabled:opacity-50",children:[i==="requesting"?n.jsx(je,{size:14,className:"animate-spin"}):i==="streaming"?n.jsx(Wl,{size:13}):w?n.jsx(Fs,{size:14}):n.jsx(Ea,{size:14}),i==="requesting"?l("computer.screen.choosing"):i==="streaming"?l("computer.screen.stop"):w?l("computer.linux.tryAgain"):a.interaction==="portal-picker"?l("computer.screen.choose"):l("computer.screen.start")]})]})}const bIe="https://github.com/chibitek/atomic/blob/main/docs/linux-desktop.md#enable-local-control";function yIe(){const{capabilities:e}=ya(),t=e.localComputer,[a,o]=f.useState(null),[i,s]=f.useState(null);if(e.host.platform!=="linux")return null;const r=a!==null||t.status==="checking"||t.status==="starting",c=t.available,d=t.reasonCode==="linux-wayland-seat-safety-blocked",p=e.host.session==="wayland",h=t.driverSource==="bundled",g=async b=>{if(window.ogb?.localControl){o(b),s(null);try{if((b==="disable"||b==="retry")&&!(await fetch("/api/local-computer/interrupt",{method:"POST"})).ok){s({key:"computer.linux.stopFailed"});return}await window.ogb.localControl[b]()}catch(x){s(x instanceof Error?x.message:String(x))}finally{o(null)}}};return n.jsxs("section",{className:"mt-4 rounded-xl bg-card p-4","aria-labelledby":"linux-local-control-title",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{children:[n.jsxs("div",{id:"linux-local-control-title",className:"flex items-center gap-2 text-[15px] font-medium text-ink",children:[n.jsx(HY,{size:16,className:c?"text-success":"text-ink-secondary"}),l("computer.linux.title")]}),n.jsx("div",{className:"mt-1 text-[12px] leading-relaxed text-ink-secondary",children:l("computer.linux.meta",{session:p?"Wayland":"Xorg"})})]}),n.jsx("span",{className:V("shrink-0 rounded-full px-2 py-1 text-[10px] font-medium",c?"bg-success/10 text-success":d?"bg-danger/10 text-danger":t.enabled?"bg-warning/10 text-warning":"bg-raised text-ink-secondary"),children:c?l("computer.linux.ready"):d?l("computer.linux.waylandBadge"):t.enabled?l("vm.state.attention"):l("vm.dest.off")})]}),d?n.jsx("div",{className:"mt-3 rounded-lg border border-danger/20 bg-danger/5 p-3",children:n.jsxs("div",{className:"flex gap-2 text-[12px] leading-relaxed text-ink-secondary",children:[n.jsx(Qn,{size:15,className:"mt-0.5 shrink-0 text-danger"}),n.jsxs("span",{children:[l("computer.linux.waylandBefore")," ",n.jsx("strong",{className:"font-medium text-ink",children:l("computer.linux.waylandXorg")})," ",l("computer.linux.waylandAfter")]})]})}):t.enabled?n.jsxs("div",{className:"mt-3 rounded-lg bg-panel p-3 text-[12px] text-ink-secondary",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[c?n.jsx(cs,{size:15,className:"mt-0.5 shrink-0 text-success"}):r?n.jsx(je,{size:15,className:"mt-0.5 shrink-0 animate-spin"}):n.jsx(Qn,{size:15,className:"mt-0.5 shrink-0 text-warning"}),n.jsx("span",{"aria-live":"polite",children:c?l("computer.linux.readyMsg"):t.message??l("computer.linux.checking")})]}),t.driverPath&&n.jsxs("div",{className:"mt-2 break-all font-mono text-[10px] text-ink-secondary/80",title:t.driverPath,children:[h?l("computer.linux.bundledDriver"):t.driverPath,t.driverVersion?` · ${t.driverVersion}`:""]})]}):n.jsx("div",{className:"mt-3 rounded-lg border border-warning/20 bg-warning/5 p-3",children:n.jsxs("div",{className:"flex gap-2 text-[12px] leading-relaxed text-ink-secondary",children:[n.jsx(Qn,{size:15,className:"mt-0.5 shrink-0 text-warning"}),n.jsxs("span",{children:[l("computer.linux.enableBefore")," ",n.jsx("strong",{className:"font-medium text-ink",children:l("vm.dest.local")})," ",l("computer.linux.enableAfter"),p&&` ${l("computer.linux.waylandInput")}`]})]})}),i&&n.jsx("div",{className:"mt-2 text-[12px] text-danger",children:typeof i=="string"?i:l(i.key)}),!d&&n.jsx("div",{className:"mt-3 flex gap-2",children:t.enabled?n.jsxs(n.Fragment,{children:[!c&&n.jsxs("button",{type:"button",disabled:r,onClick:()=>{g("retry")},className:"flex flex-1 items-center justify-center gap-2 rounded-lg bg-raised py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[a==="retry"?n.jsx(je,{size:14,className:"animate-spin"}):n.jsx(Fs,{size:14}),l("computer.linux.tryAgain")]}),n.jsxs("button",{type:"button",disabled:a!==null,onClick:()=>{g("disable")},className:"flex flex-1 items-center justify-center gap-2 rounded-lg bg-raised py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[a==="disable"?n.jsx(je,{size:14,className:"animate-spin"}):n.jsx(_u,{size:14}),l("computer.linux.disable")]})]}):n.jsxs("button",{type:"button",disabled:r,onClick:()=>{g("enable")},className:"flex flex-1 items-center justify-center gap-2 rounded-lg bg-accent py-2 text-[13px] font-medium text-white hover:opacity-90 disabled:opacity-50",children:[a==="enable"?n.jsx(je,{size:14,className:"animate-spin"}):n.jsx(_u,{size:14}),l("computer.linux.enable")]})}),n.jsxs("button",{type:"button",onClick:()=>window.open(bIe,"_blank","noopener,noreferrer"),className:"mt-2 flex w-full items-center justify-center gap-1.5 rounded-lg py-1.5 text-[11px] text-ink-secondary hover:bg-raised hover:text-ink",children:[e.host.packaged?l("computer.linux.guide"):l("computer.linux.driverSetup")," ",n.jsx(Mn,{size:11})]})]})}function h$(){const{capabilities:e}=ya(),t=e.localComputer.available?null:e.localComputer.message,a=QF(fg(t)),[o,i]=f.useState(!1),[s,r]=f.useState(!1),[c,d]=f.useState(null),p=async()=>{i(!0),d(null);try{await window.ogb?.localControl?.retry()}catch(g){d(g instanceof Error?g.message:String(g))}finally{i(!1)}},h=async()=>{d(null),r(!0);try{await window.ogb?.permOpenSettings?.("accessibility"),await window.ogb?.permOpenSettings?.("screen")}catch(g){r(!1),d(g instanceof Error?g.message:String(g))}};return f.useEffect(()=>{if(!s)return;let g=!1;const b=()=>{g||document.visibilityState==="visible"&&(g=!0,r(!1),p())};return window.addEventListener("focus",b),document.addEventListener("visibilitychange",b),()=>{window.removeEventListener("focus",b),document.removeEventListener("visibilitychange",b)}},[s]),e.host.platform!=="darwin"||e.localComputer.reasonCode==="remote-server"||e.localComputer.available?null:n.jsx("section",{className:"mt-4 rounded-xl border border-warning/25 bg-warning/10 p-4",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(UZ,{size:16,className:"mt-0.5 shrink-0 text-warning"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-[14px] font-medium text-ink",children:"Allow control of this computer"}),n.jsx("p",{className:"mt-1 text-[12.5px] leading-relaxed text-ink-secondary",children:a??l("computer.mac.permission.generic")}),t&&n.jsxs("details",{className:"mt-2 text-[12px] text-ink-secondary",children:[n.jsx("summary",{className:"cursor-pointer",children:l("computer.mac.permission.driverDetail")}),n.jsx("p",{className:"mt-1 break-words",children:t})]}),c&&n.jsxs("div",{className:"mt-2 flex gap-1.5 text-[12px] text-danger",children:[n.jsx(Qn,{size:13,className:"mt-0.5 shrink-0"}),n.jsx("span",{children:c})]}),n.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[a&&t&&n.jsx(XF,{reason:t}),!a&&n.jsx("button",{type:"button",onClick:()=>{h()},disabled:o,className:"inline-flex items-center gap-1.5 rounded-lg bg-accent px-3 py-1.5 text-[12.5px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:"Open System Settings"}),n.jsxs("button",{type:"button",onClick:()=>{p()},disabled:o,className:"inline-flex items-center gap-1.5 rounded-lg border border-hairline/50 px-3 py-1.5 text-[12.5px] font-medium text-ink hover:bg-raised disabled:opacity-50",children:[o&&n.jsx(je,{size:13,className:"animate-spin"}),"Retry"]})]})]})]})})}const xIe="omb-computer-panel-view";function g$(e){return`${xIe}:${e}`}function tB(e,t=localStorage){try{const a=t.getItem(g$(e));if(a==="android"||a==="browser"||a==="routines"||a==="terminal")return a}catch{}return"computer"}function nB(e,t,a=localStorage){try{a.setItem(g$(e),t)}catch{}}class Ta extends Error{constructor(t,a,o){super(t),this.key=t,this.problem=a,this.fallbackKey=o}key;problem;fallbackKey}function aB(e){return e instanceof Ta?l(e.key,e.fallbackKey?{problem:e.problem??l(e.fallbackKey)}:void 0):e instanceof Error?e.message:e}const oB=zn({held:_i().optional().default(!1),helpReason:dn().nullable().optional().default(null)}).passthrough(),f$="omb-computer-panel-width",Qy=360,Xy=960,vIe=400,iB=40;function kIe(){try{const e=Number(localStorage.getItem(f$));if(Number.isFinite(e)&&e>=Qy&&e<=Xy)return e}catch{}return vIe}function wIe({bot:e,onOpenVmWorkspace:t}){const{padClass:a}=Ap(),[o,i]=f.useState(kIe),s=f.useRef(null),r=Ee=>{try{localStorage.setItem(f$,String(Ee))}catch{}},c=Ee=>{s.current={x:Ee.clientX,width:o},Ee.currentTarget.setPointerCapture(Ee.pointerId)},d=Ee=>{if(!s.current)return;const ct=Math.min(Xy,Math.max(Qy,s.current.width+(s.current.x-Ee.clientX)));i(ct)},p=Ee=>{s.current&&(s.current=null,Ee.currentTarget.releasePointerCapture(Ee.pointerId),r(o))},h=Ee=>{i(ct=>{const vt=Math.min(Xy,Math.max(Qy,ct+Ee));return r(vt),vt})},g=f.useRef(null),[b,x]=f.useState(null);f.useEffect(()=>{const Ee=g.current?.closest("aside");if(!Ee)return;const ct=()=>x(Ee.offsetWidth);ct();const vt=new ResizeObserver(ct);return vt.observe(Ee),()=>vt.disconnect()},[]);const v=Ee=>{if(Ee.ctrlKey||Ee.metaKey||Ee.altKey)return;const ct=Ee.key==="ArrowLeft"?iB:Ee.key==="ArrowRight"?-iB:null;ct===null||b===null||(Ee.preventDefault(),h(ct))},{state:k,dispatch:w,flushBotPatches:N}=ke(),C=e.tasks?.find(Ee=>Ee.threadId===e.threadId),j=Fj(e,C),M=_r(e),E=`${e.id}:${e.threadId}:${j}:${e.cloudBackend??"box"}:${M.modelSelection.instanceId}`,[A,R]=f.useState(null),B=A?.key===E,O=j!=="auto"||B,T={...M,computer:j==="auto"?B?A.surface:void 0:j},z=`${T.id}:${T.threadId}:${T.computer}:${T.cloudBackend??"box"}`,P=f.useRef(z);P.current=z;const L=f.useRef(null);f.useEffect(()=>()=>L.current?.abort(),[z]);const G=!!T.busy,H=f.useCallback(Ee=>`/api/bots/${e.id}/${Ee}?threadId=${encodeURIComponent(e.threadId)}`,[e.id,e.threadId]),$=e.computer==="cloud"&&j==="cloud",U=e.computer==="vm",{capabilities:Q,ready:W}=ya(),q=Q.localComputer.available,Y=Q.host.platform==="linux",ae=HS(k.instances,T),F=$S({capabilities:Q,providerSupportsLocal:ae}),[pe,ge]=f.useState(null),Ne=Nz({capabilities:Q,providerSupportsLocal:ae}),[ee,X]=f.useState("checking"),[oe,ne]=f.useState(null),[Ce,le]=f.useState(null),[re,xe]=f.useState(null),Te=T.cloudBackend??"box",nt=!!(oe&&oe.botId===T.id&&oe.computer===e.computer&&oe.cloudBackend===Te&&oe.section===(T.section?.trim()??"")),be=!!(Ce&&Ce.botId===T.id&&Ce.threadId===T.threadId&&Ce.computer===T.computer&&Ce.cloudBackend===Te),Ye=be&&j==="auto"&&Te==="box"&&re?.botId===T.id&&re.section===(T.section?.trim()??"")?re:null,ue=be&&fpe({computer:T.computer,cloudBackend:Te,phase:ee,botId:T.id,resolvedBotId:Ce?.botId??null,resolvedComputer:Ce?.computer??null,resolvedCloudBackend:Ce?.cloudBackend??null}),we=f.useCallback(Ee=>{le(null),xe(null),X("checking"),w({type:"updateBot",botId:T.id,patch:Ee})},[T.id,w]);f.useEffect(()=>{let Ee=!0;return ne(null),N(T.id).then(ct=>{Ee&&(ct&&!bpe({computer:e.computer,cloudBackend:Te,persistedBot:ct})||ct&&(ct.section?.trim()??"")!==(T.section?.trim()??"")||ne({botId:T.id,computer:e.computer,cloudBackend:Te,section:T.section?.trim()??""}))}),()=>{Ee=!1}},[T.id,e.computer,T.section,Te,N]);const[me,$e]=f.useState(null),[Re,de]=f.useState(null),[Ve,ce]=f.useState(null),[Le,tt]=f.useState(!1),[st,Ae]=f.useState(0),[We,Ie]=f.useState(null),[et,gt]=f.useState(null),[yt,Mt]=f.useState(null),[an,pn]=f.useState(null),[_n,da]=f.useState(null),[Lt,Dt]=f.useState(null),[bn,En]=f.useState(!1),[Ge,ot]=f.useState(!1),[_e,Fe]=f.useState(null),Ft=aB(_e),[Ue,qt]=f.useState(()=>tB(T.id)),tn=eIe(),ze=tn.devices.length>0,[ft,Kt]=[q0(k.config),VS(k.config)],Ht=Yc(k.config)&&T.browser!==!1&&(ft||k.config?.browserEngine?.installable===!0),[nn,Fn]=f.useState(0);f.useEffect(()=>{if(j!=="auto"||!nt)return;const Ee=new AbortController;return R(null),Z(H("computer"),{signal:Ee.signal}).then(ct=>{if(Ee.signal.aborted)return;const vt=ct.surface;R({key:E,surface:vt==="cloud"||vt==="vm"||vt==="local"||vt==="browser"||vt==="off"?vt:void 0})}).catch(ct=>{Ee.signal.aborted||(Fe(ct instanceof Error?ct:String(ct)),X("error"))}),()=>Ee.abort()},[E,j,nt,H,nn]);const mn=f.useRef(0),Nt=k.instances.find(Ee=>Ee.instanceId===T.modelSelection.instanceId),Kn=Yc(k.config)&&ft&&Nt?.capabilities?.browserMcp===!0&&Nt.driverKind!=="boxAgent",ji=ft?Yc(k.config)?l("computer.err.browserEngine"):l("computer.err.browserOff"):_g(k.config),jo=Ee=>{qt(Ee),nB(T.id,Ee)},No=f.useRef(null);f.useEffect(()=>{const Ee=No.current;Ee===z&&!(T.computer==="browser"&&Ht)||(No.current=z,qt(T.computer==="browser"&&Ht?"browser":Ee===null?tB(T.id):"computer"))},[z,T.id,T.computer,Ht]),f.useEffect(()=>{let Ee=!0;const ct=window.ogb?.desktopViewer;ct?.currentState&&ct.currentState().then(kt=>{Ee&&ot(kt.open&&kt.contextId===T.id)}).catch(()=>{});const vt=ct?.onState(kt=>{kt.contextId===T.id&&ot(kt.open)});return()=>{Ee=!1,vt?.()}},[T.id]),f.useEffect(()=>{(!ze&&Ue==="android"||!Ht&&Ue==="browser"||!Kt&&Ue==="terminal")&&(qt("computer"),nB(T.id,"computer"))},[ze,T.id,Ht,Kt,Ue]),f.useEffect(()=>{mn.current=0},[T.id,T.computer]);const ni=!!(Nt?.snapshot.state==="available"&&Nt.capabilities?.computerMcp&&Nt.driverKind!=="boxAgent"),oi=!!(Nt?.capabilities?.computerMcp===!0&&Nt?.driverKind!=="boxAgent"),eo=Te==="vps"?oi:!!lg(k.instances,T.modelSelection.instanceId),go=k.routines.filter(Ee=>Ee.botId===T.id).sort((Ee,ct)=>Number(ct.enabled)-Number(Ee.enabled)||(Ee.nextRunAt??1/0)-(ct.nextRunAt??1/0)),ii=!!(k.config?.box.configured&&lg(k.instances,T.modelSelection.instanceId)?.snapshot.state==="available"),to=k.routineRuns.find(Ee=>Ee.botId===T.id&&["queued","running","waiting"].includes(Ee.status));f.useEffect(()=>{if(Ue!=="computer")return;let Ee=!0,ct;if(le(null),xe(null),X("checking"),de(null),ce(null),Ie(null),gt(null),Mt(null),pn(null),da(null),Fe(null),!(!nt||!O)){if(T.computer===void 0){X("auto-unavailable");return}if(T.computer==="off"){X("off");return}if(T.computer==="browser"){X("browser");return}if(T.computer==="local"){ae||Fe(new Ta("computer.err.localEngine")),X(W&&q&&ae?"local":"local-unavailable"),le({botId:T.id,threadId:T.threadId,computer:T.computer,cloudBackend:Te});return}if(T.computer==="vm"){if(!ni){Fe(new Ta("computer.err.vmEngine")),X("vm-unavailable");return}let vt;return Z(H("local-computer")).then(kt=>{if(!Ee)return;const Ot=kt;le({botId:T.id,threadId:T.threadId,computer:T.computer,cloudBackend:Te}),Mt(Ot);const Na=String(Ot.viewer_url??"");if(Na.startsWith("http")&>(Na),Ot.ready)mn.current=0,X("vm");else if(Ot.container==="running"&&Ot.imageMatches&&Ot.managed&&Ot.network==="loopback"&&Ot.security==="hardened"&&Ot.persistence==="durable"&&!Ot.desktopReady&&mn.current<15)mn.current+=1,Fe(null),X("checking"),vt=window.setTimeout(()=>Fn(si=>si+1),2e3);else{const si=Ot.mode==="per-bot"&&Ot.container==="missing"&&Ot.image&&Ot.create_supported;Fe(si?null:new Ta("computer.err.vmOpenSettings",Ot.problem,"computer.err.vmNotReady")),X("vm-unavailable")}}).catch(kt=>{Ee&&(Fe(kt.message),X("vm-unavailable"))}),()=>{Ee=!1,vt!==void 0&&window.clearTimeout(vt)}}if(T.computer==="cloud"&&!eo){Fe(new Ta("computer.err.cloudEngine")),X("error");return}if(!(T.computer!=="cloud"&&!W)){if(Te==="vps"){if(!oi){Fe(new Ta("computer.err.vpsEngine")),X("error");return}return Z(H("computer")).then(vt=>{if(!Ee)return;const kt=vt;if(pn(kt),le({botId:T.id,threadId:T.threadId,computer:T.computer,cloudBackend:Te}),!kt.configured){Fe(new Ta("computer.err.vpsAlias")),X("vps-unconfigured");return}if(kt.ready){$e(kt.container??null),X("ready");return}if(kt.managed&&kt.container!=="missing"&&!kt.imageMatches){Fe(kt.problem),X("vps-incompatible");return}if($)return X("starting"),Z(`/api/bots/${T.id}/computer/provision`,{method:"POST"}).then(Ot=>{Ee&&($e(Ot.container??null),Ot.ready?(le({botId:T.id,threadId:T.threadId,computer:T.computer,cloudBackend:Te}),X("ready")):(Fe(Ot.problem??new Ta("computer.err.vpsNotReady")),X("error")))});$e(kt.container??null),Fe(T.autoStartVps?new Ta("computer.err.vpsAuto",kt.problem,"computer.err.vpsNoContainer"):new Ta("computer.err.vpsManual",kt.problem,"computer.err.vpsNoContainer")),X(kt.container==="stopped"?"vps-stopped":"vps-unconfigured")}).catch(vt=>{Ee&&(Fe(vt.message),X("error"))}),()=>{Ee=!1}}return Z(H("computer")).then(vt=>{if(!Ee)return;const kt=gpe({computer:$?"cloud":void 0,configured:!!vt.configured,boxState:typeof vt.box?.state=="string"?vt.box.state:null,canUseCloud:eo,autoLocal:!1,teamComputer:typeof vt.teamComputer?.id=="string"&&typeof vt.teamComputer?.name=="string",busy:e.busy});if(le({botId:T.id,threadId:T.threadId,computer:T.computer,cloudBackend:Te}),!vt.configured&&T.computer==="cloud"&&!vt.teamComputer){X("unconfigured");return}if(kt==="team-box"){xe({id:vt.teamComputer.id,name:vt.teamComputer.name,botId:T.id,section:T.section?.trim()??""}),$e(typeof vt.box?.state=="string"?vt.box.state:vt.configured?"missing":"unavailable"),Fe(typeof vt.problem=="string"?vt.problem:null),X("team-box");return}if(kt==="attach-ready-box"||T.computer==="cloud"&&kt==="show-ready-box"){$e(typeof vt.box?.state=="string"?vt.box.state:null),X("ready");return}if(kt!=="ensure-box"){(kt==="show-ready-box"||kt==="show-sleeping-box"||kt==="show-pending-box")&&$e(typeof vt.box?.state=="string"?vt.box.state:null),X(kt);return}return X("starting"),Z(`/api/bots/${T.id}/computer/provision`,{method:"POST"}).then(Ot=>{Ee&&($e(Ot.state??null),le({botId:T.id,threadId:T.threadId,computer:T.computer,cloudBackend:Te}),X("ready"))})}).catch(vt=>{if(Ee){if(Ghe(vt)){X("busy-box");return}if(J3({status:Number(vt?.status??0),message:String(vt?.message??"")})){Fe(null),X("checking"),ct=window.setTimeout(()=>Fn(kt=>kt+1),2e3);return}Fe(vt.message),X("error")}}),()=>{Ee=!1,ct!==void 0&&window.clearTimeout(ct)}}}},[T.id,T.threadId,T.computer,T.section,T.autoStartVps,Te,nn,W,F,Y,ae,Nt?.driverKind,ni,eo,oi,k.config?.vps?.sshAlias,Ue,nt,O,$,H]),f.useEffect(()=>{if(ee!=="busy-box")return;let Ee=!0;const ct=()=>{if(!e.busy&&$){Fn(kt=>kt+1);return}Z(H("computer")).then(kt=>{if(!Ee)return;const Ot=typeof kt.box?.state=="string"?kt.box.state:null;mpe(Ot)&&($e(Ot),X("ready"))}).catch(()=>{})},vt=window.setInterval(ct,5e3);return()=>{Ee=!1,window.clearInterval(vt)}},[ee,H,e.busy,$]);const In=Dv(),Je=k.screens[T.id],Rt=Je?.threadId===T.threadId||!Je?.threadId&&(e.tasks?.length??0)<=1?Je:void 0,Ut=f.useRef({frame:Rt,at:0}),$n=f.useRef(T.busy);f.useEffect(()=>{$n.current=T.busy},[T.busy]),f.useEffect(()=>{if(!ue){Ut.current={frame:Rt,at:0};return}Ut.current.frame!==Rt&&(Ut.current={frame:Rt,at:0},ue&&Rt&&(Ut.current.at=Date.now(),de(Rt),ce(null),tt(!1)))},[Rt,ue]),f.useEffect(()=>{if(Ue!=="computer"||!ue||Ge||!In||Lt||bn)return;let Ee=!1,ct=-1/0,vt=null,kt=null;const Ot=new AbortController;ce(null),tt(!0);const Na=async()=>{if(Ee||Ot.signal.aborted||Date.now()-ct<(vt??($n.current?4e3:3e4))||$n.current&&Date.now()-Ut.current.at<1e4)return;Ee=!0,vt=null;const Fa=Date.now();try{const{png:oo,format:Gr}=await Z(H("computer/screenshot"),{method:"POST",signal:AbortSignal.any([Ot.signal,AbortSignal.timeout(9e4)])});if(!Ot.signal.aborted&&Ut.current.at<=Fa){if(typeof oo!="string"||!oo.trim())throw new Ta("computer.err.emptyFrame");de({png:oo,mime:Gr==="jpeg"?"image/jpeg":"image/png"}),ce(null),tt(!1),kt=null}}catch(oo){if(!Ot.signal.aborted&&Ut.current.at<=Fa)if(oo instanceof Qo&&J3(oo)){vt=1e3,kt??=Date.now();const Gr=Date.now()-kt>=1e4;ce(Gr?oo:null),tt(!Gr)}else kt=null,tt(!1),ce(oo instanceof Error&&oo.name==="TimeoutError"?new Ta("computer.err.frameTimeout"):oo instanceof Error?oo:new Ta("computer.err.screenUnavailable"))}finally{Ee=!1,ct=Date.now()}};Na();const si=setInterval(Na,1e3);return()=>{Ot.abort(),clearInterval(si)}},[Ue,ue,H,Te,Ge,In,Lt,bn,st]),f.useEffect(()=>{if(Ue!=="computer"||ee!=="vm"||!be||Ge||!In)return;const Ee=new AbortController;let ct=!1,vt=-1/0,kt=null,Ot=!0;const Na=async()=>{if(!(ct||Ee.signal.aborted)&&!(Date.now()-vt<(kt??(T.busy?3e3:3e4)))){ct=!0,kt=null;try{const{image:Fa}=await Z(H("local-computer/screenshot"),{method:"POST",signal:Ee.signal});!Ee.signal.aborted&&typeof Fa=="string"&&(Ie(Fa),ce(null))}catch(Fa){Ee.signal.aborted||(kt=5e3,Ot?Fe(Fa instanceof Error?Fa.message:String(Fa)):ce(Fa instanceof Error?Fa:new Ta("computer.err.screenUnavailable")))}finally{ct=!1,Ot=!1,vt=Date.now()}}};Na();const si=window.setInterval(()=>{Na()},T.busy?3e3:3e4);return()=>{Ee.abort(),window.clearInterval(si)}},[Ue,ee,be,H,Ge,In,T.busy,Fe,ce,Ie]);const[Wn,fo]=f.useState(null);f.useEffect(()=>{if(e.computer!=="vm"||!ni||!nt){fo(null);return}let Ee=!0;return Z(`/api/bots/${e.id}/local-computer`).then(ct=>{Ee&&fo(ct)}).catch(()=>{Ee&&fo(null)}),()=>{Ee=!1}},[e.id,e.computer,ni,nt]);const[ps,ms]=f.useState(0);f.useEffect(()=>{if(Ue!=="computer"||ee!=="local"||!be||!window.ogb||Y||!In)return;let Ee=!0;ms(0);const ct=async()=>{try{const kt=await window.ogb.screenFrame();Ee&&kt?da(kt):Ee&&ms(Ot=>Ot+1)}catch{Ee&&ms(kt=>kt+1)}};ct();const vt=setInterval(ct,T.busy?3e3:3e4);return()=>{Ee=!1,clearInterval(vt)}},[Ue,ee,be,Y,In,T.busy,T.id,T.threadId]);const ve=be?ee==="vm"?We:ee==="local"&&!Y?_n:ue||T.computer==="cloud"&&ee==="starting"?Re&&`data:${Re.mime};base64,${Re.png}`:null:null,ht=!!(ve&&(ee==="vm"&&et||ue)),At=k.computerControl[T.id]??{held:!1,helpReason:null};f.useEffect(()=>{let Ee=!0;return Z(`/api/bots/${T.id}/computer/control`).then(ct=>{if(!Ee)return;const vt=oB.parse(ct);w({type:"computerControl",botId:T.id,held:vt.held===!0,helpReason:vt.helpReason})}).catch(()=>{}),()=>{Ee=!1}},[T.id]);const hn=f.useCallback(async Ee=>{const ct=oB.parse(await Z(`/api/bots/${T.id}/computer/control`,{method:"POST",body:JSON.stringify({action:Ee})}));return w({type:"computerControl",botId:T.id,held:ct.held===!0,helpReason:ct.helpReason}),ct},[T.id,w]),Qi=f.useCallback(async()=>!0,[]),$s=f.useCallback(async Ee=>p4({action:Ee,syncNativeBrowser:Ue!=="browser",requestControl:hn,setNativeBrowserControl:Qi}),[Ue,hn,Qi]),bo=f.useCallback(async Ee=>{En(!0),Fe(null);try{return await $s(Ee),!0}catch(ct){return Fe(ct instanceof Error?ct.message:String(ct)),!1}finally{En(!1)}},[$s]),no=async()=>{const Ee=new AbortController;L.current=Ee;const ct=()=>!Ee.signal.aborted&&P.current===z;Dt("join"),En(!0),Fe(null);let vt=!1,kt=null;!window.ogb?.desktopViewer&&!window.ogb?.openExternal&&(kt=window.open("","_blank"),kt&&(kt.opener=null));try{if(At.held||(await $s("take"),vt=!0),!ct())throw new DOMException("The selected conversation changed","AbortError");let Ot=et;if(ue){const Na=await Z(H("computer/join"),{method:"POST",signal:Ee.signal});Ot=Na.joinUrl?.constructor===String?String(Na.joinUrl):null}if(!ct())throw new DOMException("The selected conversation changed","AbortError");if(!Ot)throw new Ta("computer.err.noDesktopLink");if(window.ogb?.desktopViewer){if(!await window.ogb.desktopViewer.open(Ot,l("computer.viewerTitle",{name:T.name}),T.id))throw new Ta("computer.err.openDesktop")}else if(kt)kt.location.replace(Ot);else if(window.ogb?.openExternal){if(!await window.ogb.openExternal(Ot))throw new Ta("computer.err.openDesktopLink")}else if(!window.open(Ot,"_blank","noopener"))throw new Ta("computer.err.popupBlocked")}catch(Ot){kt?.close(),vt&&await $s("release").catch(()=>{}),ue&&Te==="vps"&&await Z(H("computer/viewer-close"),{method:"POST",body:"{}"}).catch(()=>{}),ct()&&Fe(Ot instanceof Error?Ot:String(Ot))}finally{L.current===Ee&&(L.current=null,Dt(null),En(!1))}},Gs=Ee=>{Dt(Ee),Fe(null),Z(`/api/bots/${T.id}/computer/${Ee}`,{method:"POST"}).then(ct=>{Ee==="provision"&&($e(ct.container??null),ct.ready?(T.computer==="cloud"&&le({botId:T.id,threadId:T.threadId,computer:T.computer,cloudBackend:Te}),X("ready")):(Fe(ct.problem??new Ta("computer.err.vpsNotReady")),X("error"))),Ee==="sleep"&&(le(null),$e(Te==="vps"?"stopped":"archived"),X(Te==="vps"?"vps-stopped":"show-sleeping-box"))}).catch(ct=>{Fe(ct.message)}).finally(()=>Dt(null))},oc=async Ee=>{if(!((Ee==="vm-recreate"||Ee==="vm-delete")&&!window.confirm(Ee==="vm-delete"?l("computer.confirm.deleteVm",{name:T.name}):l("computer.confirm.replaceVm",{name:T.name})))){Dt(Ee),Fe(null),Mt(null),mn.current=0;try{if(Ee!=="vm-create"&&await Z(`/api/bots/${T.id}/local-computer/remove`,{method:"POST",body:"{}"}),Ee!=="vm-delete"){const ct=await Z(`/api/bots/${T.id}/local-computer/run`,{method:"POST",body:"{}"});Mt(ct),fo(ct),j==="vm"&&X(ct.ready?"vm":"checking")}else Mt(ct=>ct&&{...ct,container:"missing",ready:!1}),fo(ct=>ct&&{...ct,container:"missing",ready:!1}),j==="vm"&&X("vm-unavailable")}catch(ct){Fe(ct instanceof Error?ct.message:String(ct)),j==="vm"&&X("vm-unavailable")}finally{Dt(null),Fn(ct=>ct+1)}}},ao=async()=>{if(window.confirm(l("computer.confirm.replaceVps",{name:T.name}))){Dt("vps-replace"),Fe(null);try{await Z(`/api/bots/${T.id}/computer/remove`,{method:"POST",body:"{}"});const Ee=await Z(`/api/bots/${T.id}/computer/provision`,{method:"POST",body:"{}"});pn(Ee),$e(Ee.container??null),Ee.ready&&T.computer==="cloud"&&le({botId:T.id,threadId:T.threadId,computer:T.computer,cloudBackend:Te}),X(Ee.ready?"ready":"error"),Ee.ready||Fe(Ee.problem??new Ta("computer.err.vpsReplaceNotReady"))}catch(Ee){Fe(Ee instanceof Error?Ee.message:String(Ee)),X("error")}finally{Dt(null),Fn(Ee=>Ee+1)}}},Xi=()=>{window.sessionStorage.setItem("openmausbot.settings.section","computer"),w({type:"toggleAppSettings",open:!0})},Hp=()=>{w({type:"toggleAppSettings",open:!0,section:"connections"})},$p={checking:l("computer.phase.checking"),starting:l("computer.phase.starting"),"busy-box":l("computer.phase.busyBox"),unconfigured:l("computer.phase.unconfigured"),"auto-unavailable":l("computer.phase.autoUnavailable"),"team-box":"This bot uses a shared team computer. Open Team map to view or manage it.","show-ready-box":l("computer.phase.showReadyBox"),"show-sleeping-box":l("computer.phase.showSleepingBox"),"show-pending-box":l("computer.phase.showPendingBox"),"vps-unconfigured":l("computer.phase.vpsUnconfigured"),"vps-incompatible":l("computer.phase.vpsIncompatible"),"vps-stopped":l("computer.phase.vpsStopped"),"local-unavailable":Ne??l("computer.phase.localUnavailable"),"vm-unavailable":l("computer.phase.vmUnavailable"),browser:l("computer.phase.browser"),off:l("computer.phase.off"),error:l("computer.phase.error")};return n.jsxs(n.Fragment,{children:[n.jsxs("aside",{className:"animate-panel-in relative flex h-full shrink-0 flex-col border-l border-hairline/40 bg-panel",style:{width:o},children:[n.jsx("div",{ref:g,role:"separator","aria-orientation":"vertical","aria-label":l("computer.resizeAria"),"aria-valuemin":Qy,"aria-valuemax":Xy,"aria-valuenow":b??void 0,tabIndex:0,onKeyDown:v,onPointerDown:c,onPointerMove:d,onPointerUp:p,onPointerCancel:p,className:"absolute inset-y-0 left-0 z-10 w-1.5 cursor-col-resize hover:bg-accent/40 focus-visible:bg-accent/60"}),n.jsxs("div",{className:V("flex items-center justify-between px-4 py-3",a),children:[n.jsx("button",{onClick:()=>{w({type:"toggleComputer",open:!1}),w({type:"toggleSettings",open:!0,section:"access"})},className:"rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink",title:l("computer.botSettings"),children:n.jsx(Yh,{size:18})}),n.jsxs("div",{className:"mx-2 flex min-w-0 flex-wrap overflow-hidden rounded-lg border border-hairline/40","data-tour":"computer-tabs","aria-label":"Bot panel view",children:[n.jsxs("button",{onClick:()=>jo("computer"),"aria-pressed":Ue==="computer",className:V("flex items-center gap-1.5 px-2.5 py-1 text-[12.5px]",Ue==="computer"?"bg-control text-ink":"text-ink-secondary hover:text-ink"),children:[n.jsx(Ea,{size:13})," ",l("computer.tab.computer"),G&&HV(j)&&n.jsx("span",{className:"size-1.5 animate-pulse rounded-full bg-success",role:"img","aria-label":l("place.live"),"data-testid":"computer-tab-live"})]}),n.jsxs("button",{type:"button",onClick:()=>jo("routines"),"aria-pressed":Ue==="routines",className:V("flex items-center gap-1.5 border-l border-hairline/40 px-2.5 py-1 text-[12.5px]",Ue==="routines"?"bg-control text-ink":"text-ink-secondary hover:text-ink"),children:[n.jsx(Zu,{size:13}),l("computer.tab.routines")]}),ze&&n.jsxs("button",{onClick:()=>jo("android"),"aria-pressed":Ue==="android",className:V("flex items-center gap-1.5 border-l border-hairline/40 px-2.5 py-1 text-[12.5px]",Ue==="android"?"bg-control text-ink":"text-ink-secondary hover:text-ink"),children:[n.jsx(ld,{size:13})," ",l("computer.tab.android")]}),Ht&&n.jsxs("button",{"data-tour":"computer-browser",onClick:()=>{Fe(null),jo("browser")},"aria-pressed":Ue==="browser",className:V("flex items-center gap-1.5 border-l border-hairline/40 px-2.5 py-1 text-[12.5px]",Ue==="browser"?"bg-control text-ink":"text-ink-secondary hover:text-ink"),children:[n.jsx(Sr,{size:13})," ",l("computer.tab.browser"),G&&j==="browser"&&n.jsx("span",{className:"size-1.5 animate-pulse rounded-full bg-success",role:"img","aria-label":l("place.live"),"data-testid":"browser-tab-live"})]}),Kt&&n.jsx(pIe,{active:Ue==="terminal",onClick:()=>jo("terminal")})]}),n.jsx("button",{onClick:()=>w({type:"toggleComputer",open:!1}),className:"rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink",children:n.jsx(jt,{size:18})})]}),Ue==="routines"?n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 pb-4",children:n.jsx(r$,{bot:T,routines:go,runs:k.routineRuns,defaultRunOn:ii?"cloud":"maus"},T.id)}):Ue==="browser"&&Ht?n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col px-4 pb-4",children:[n.jsx(dIe,{bot:T}),Ft&&n.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:Ft})]}):Ue==="terminal"&&Kt?n.jsx(mIe,{bot:T},T.id):Ue==="android"&&ze?n.jsx("div",{className:"flex-1 overflow-y-auto px-4 pt-2",children:n.jsx(tIe,{status:tn})}):n.jsxs("div",{className:"flex-1 overflow-y-auto px-5 pb-5",children:[n.jsxs("div",{className:"mb-1.5 mt-2 flex items-center justify-between text-[13px] text-ink-secondary",children:[n.jsx("span",{children:l("computer.screenOf",{name:T.name})}),Ye&&n.jsx("span",{className:"text-[11px]",children:"Team default"}),ee==="local"&&n.jsx("span",{className:"text-[11px]",children:l("computer.badge.local")}),ee==="vm"&&n.jsx("span",{className:"text-[11px]",children:l("vm.dest.vm")}),(ee==="show-ready-box"||ee==="show-sleeping-box"||ee==="show-pending-box")&&n.jsx("span",{className:"text-[11px]",children:l("computer.badge.autoBox")}),be&&T.computer==="cloud"&&Te==="vps"&&(ee==="ready"||ee==="starting")&&n.jsx("span",{className:"text-[11px]",children:l("computer.badge.vps")})]}),n.jsx("div",{className:"relative flex aspect-[16/10] w-full items-center justify-center overflow-hidden rounded-xl bg-card",children:ue||T.computer==="cloud"&&ee==="starting"?n.jsx(Q9e,{src:ve,name:T.name,error:aB(Ve),refreshing:Le,retry:st,starting:ee==="starting",opening:Lt==="join",disabled:bn,onOpen:()=>{no()},onRetry:Ee=>{Ut.current.at=0,Ee&&de(null),ce(null),tt(!0),Ae(ct=>ct+1)}},`${T.id}:${T.threadId}:${T.computer}:${Te}`):ve&&ht?n.jsxs("button",{type:"button",onClick:()=>{no()},disabled:bn||Lt==="join",className:"group relative flex h-full w-full cursor-pointer items-center justify-center focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-wait","aria-label":l("computer.openLiveDesktopAria",{name:T.name}),title:l("computer.openLiveDesktop"),children:[n.jsx("img",{src:ve,alt:l("computer.screenOf",{name:T.name}),className:"h-full w-full object-contain transition group-hover:brightness-75 group-focus-visible:brightness-75"}),n.jsxs("span",{className:"pointer-events-none absolute right-2 top-2 flex items-center gap-1 rounded-md bg-black/70 px-2 py-1 text-[11px] font-medium text-white opacity-80 shadow-sm transition group-hover:opacity-100 group-focus-visible:opacity-100",children:[Lt==="join"?n.jsx(je,{size:12,className:"animate-spin"}):n.jsx(y0,{size:12}),l("computer.open")]})]}):ve?n.jsx("img",{src:ve,alt:l("computer.screenOf",{name:T.name}),className:"h-full w-full object-contain",title:ee==="vm"?l("computer.watchOnly"):void 0}):n.jsxs("div",{className:"flex flex-col items-center gap-2 px-6 text-center text-ink-secondary",children:[ee==="checking"||ee==="starting"||ee==="busy-box"||ee==="vm"||ee==="local"&&!Y?n.jsx(je,{size:18,className:"animate-spin"}):ee==="off"?n.jsx(_u,{size:22}):n.jsx(Ea,{size:22}),n.jsx("span",{className:"text-[12px]",children:Ye?`${Ye.name} · ${me??"unavailable"}`:ue?l("computer.waitingFrame"):ee==="ready"?l("computer.autoChooseCloudOpen"):ee==="vm"?l("computer.capturingVm"):ee==="local"?Y?l("computer.linuxReady"):ps>=3?l("computer.needsScreenPerm"):l("computer.capturingLocal"):$p[ee]}),Ye&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[12px]",children:"Shared files and signed-in accounts. Auto uses this Box, not a private computer."}),n.jsx("button",{type:"button",onClick:()=>w({type:"showTeamMap"}),className:"mt-1 rounded-lg bg-control px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover",children:"Open Team map"}),n.jsx("button",{type:"button",onClick:()=>Fn(Ee=>Ee+1),className:"text-[11px] text-ink-secondary hover:text-ink",children:"Refresh shared computer status"})]}),ee==="local"&&!Y&&ps>=3&&n.jsx("button",{onClick:()=>window.ogb?.permOpenSettings?.("screen"),className:"mt-1 rounded-lg bg-control px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover",children:l("computer.openSettings")}),ee==="browser"&&Ht&&n.jsx("button",{onClick:()=>jo("browser"),className:"mt-1 rounded-lg bg-control px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover",children:l("computer.openBrowserTab")}),(ee==="show-ready-box"||ee==="show-sleeping-box"||ee==="show-pending-box")&&n.jsx("button",{type:"button",onClick:()=>we({computer:"cloud"}),className:"mt-1 rounded-lg bg-control px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover",children:l(ee==="show-sleeping-box"?"computer.chooseCloudWake":ee==="show-ready-box"?"computer.chooseCloudOpen":"computer.chooseCloudManage")}),ee==="vm-unavailable"&&(U&&yt?.mode==="per-bot"&&yt.image&&yt.create_supported?n.jsxs("button",{onClick:()=>{oc(yt.container==="missing"?"vm-create":"vm-recreate")},disabled:Lt!==null,className:"mt-1 rounded-lg bg-accent px-3 py-1.5 text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[(Lt==="vm-create"||Lt==="vm-recreate")&&n.jsx(je,{size:13,className:"mr-1.5 inline animate-spin"}),yt.container==="missing"?l("computer.createVm",{name:T.name}):l("computer.replaceVm",{name:T.name})]}):n.jsx("button",{onClick:Xi,className:"mt-1 rounded-lg bg-control px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover",children:l("computer.openVmSetup")})),be&&(ee==="vps-unconfigured"||ee==="vps-stopped")&&n.jsx("button",{onClick:Hp,className:"mt-1 rounded-lg bg-control px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover",children:l("computer.openVpsSettings")}),be&&(ee==="vps-stopped"||ee==="vps-unconfigured"&&an?.configured)&&$&&n.jsxs("button",{onClick:()=>Gs("provision"),disabled:Lt==="provision",className:"mt-1 rounded-lg bg-control px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[Lt==="provision"&&n.jsx(je,{size:13,className:"mr-1.5 inline animate-spin"}),l(ee==="vps-stopped"?"computer.startVps":"computer.prepareVps")]}),be&&ee==="vps-incompatible"&&an?.managed&&$&&n.jsxs("button",{onClick:()=>{ao()},disabled:Lt==="vps-replace",className:"mt-1 rounded-lg bg-accent px-3 py-1.5 text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[Lt==="vps-replace"&&n.jsx(je,{size:13,className:"mr-1.5 inline animate-spin"}),l("computer.replaceVps")]})]})}),Ft&&n.jsx("div",{className:"mt-2 rounded-lg border border-danger/30 bg-danger/10 px-3 py-2 text-[12px] text-danger",children:Ft}),e.computer==="vm"&&j!=="vm"&&Wn?.mode==="per-bot"&&Wn.container==="missing"&&Wn.image&&Wn.create_supported&&n.jsxs("div",{className:"mt-3 rounded-xl border border-accent/20 bg-accent/5 p-4",children:[n.jsx("div",{className:"text-[13px] font-medium text-ink",children:l("computer.createVm",{name:T.name})}),n.jsx("div",{className:"mt-1 text-[12px] leading-5 text-ink-secondary",children:l("vm.setup.perBotHint")}),C?.surface&&n.jsxs("div",{className:"mt-1 text-[11.5px] text-ink-secondary",children:[l("place.pinnedNote",{place:l(td(C.surface))})," — start a new conversation to use this desktop, or create it here."]}),n.jsxs("button",{type:"button",onClick:()=>{oc("vm-create")},disabled:Lt!==null,className:"mt-2 rounded-lg bg-accent px-3 py-1.5 text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[(Lt==="vm-create"||Lt==="vm-recreate")&&n.jsx(je,{size:13,className:"mr-1.5 inline animate-spin"}),l("computer.createVm",{name:T.name})]})]}),e.computer==="vm"&&j!=="vm"&&Wn?.mode==="per-bot"&&Wn.container!=="missing"&&n.jsxs("div",{className:"mt-3 rounded-xl border border-hairline/40 bg-card p-4",children:[n.jsx("div",{className:"text-[13px] text-ink-secondary",children:l("computer.hint.vm")}),n.jsx("div",{className:"mt-1 text-[11.5px] text-ink-secondary",children:C?.surface?l("place.pinnedNote",{place:l(td(C.surface))}):l("computer.hint.vm")}),n.jsx("button",{type:"button",onClick:Xi,className:"mt-1 block font-medium text-accent hover:underline",children:l("computer.vmSettingsLink")})]}),ee==="unconfigured"&&n.jsxs("div",{className:"mt-3 rounded-xl bg-card p-4",children:[n.jsx("div",{className:"mb-3 text-[13px] text-ink-secondary",children:l("computer.addBoxKey")}),n.jsx(Dg,{section:"box",onSaved:Ee=>Ee&&Fn(ct=>ct+1)})]}),ee==="vps-unconfigured"&&n.jsxs("div",{className:"mt-3 rounded-xl bg-card p-4",children:[n.jsx("div",{className:"mb-3 text-[13px] text-ink-secondary",children:l("computer.vpsAliasHint")}),n.jsx("button",{onClick:Hp,className:"rounded-lg bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover",children:l("computer.openVpsSettings")})]}),ee==="vm"&&yt?.mode==="per-bot"&&window.ogb?.desktopWorkspace&&t&&n.jsxs("button",{type:"button",onClick:()=>t(T.id),disabled:Lt!==null,className:"mt-3 flex w-full items-center justify-center gap-2 rounded-lg border border-accent/30 bg-accent/10 py-2 text-[13px] font-medium text-ink hover:bg-accent/15 disabled:opacity-50",title:l("computer.twoDesktopsTitle"),children:[n.jsx(bJ,{size:14}),l("computer.twoDesktops")]}),(ue||ee==="vm"||Ye)&&At.helpReason&&!At.held&&n.jsxs("div",{className:"mt-3 rounded-xl border border-warning/25 bg-warning/10 p-4",children:[n.jsxs("div",{className:"text-[13px] leading-relaxed text-warning",children:[n.jsx("b",{children:T.name})," ",l("computer.askedHands")," ",At.helpReason]}),n.jsxs("div",{className:"mt-2 flex gap-2",children:[n.jsxs("button",{onClick:()=>ee==="vm"||ue?void no():bo("take"),disabled:bn||Lt==="join",className:"flex flex-1 items-center justify-center gap-2 rounded-lg bg-accent py-2 text-[13px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[Lt==="join"?n.jsx(je,{size:14,className:"animate-spin"}):n.jsx(Li,{size:14}),l("computer.takeControl")]}),n.jsx("button",{onClick:()=>bo("dismiss-help"),disabled:bn,className:"rounded-lg bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",children:l("computer.dismiss")})]})]}),(ue||ee==="vm"||Ye)&&At.held&&n.jsxs("div",{className:"mt-3 rounded-xl border border-accent/25 bg-accent/10 p-4",children:[n.jsxs("div",{className:"text-[13px] leading-relaxed text-ink",children:[l("computer.youHaveWheel"),ue&&` ${l("computer.useOpenDesktop")}`,ee==="vm"&&` ${l("computer.useOpenDesktopVm")}`]}),n.jsxs("button",{onClick:()=>{bo("release"),window.ogb?.desktopViewer?.close(T.id)},disabled:bn,className:"mt-2 flex w-full items-center justify-center gap-2 rounded-lg bg-accent py-2 text-[13px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[n.jsx(Li,{size:14}),l("computer.handBack")]})]}),ee==="vm"&&et&&At.held&&n.jsxs("button",{onClick:()=>{no()},disabled:Lt==="join",className:"mt-3 flex w-full items-center justify-center gap-2 rounded-lg bg-control py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",title:l("computer.openVmDesktopTitle"),children:[Lt==="join"?n.jsx(je,{size:14,className:"animate-spin"}):n.jsx(Ea,{size:14}),l("computer.openLiveDesktop")]}),ee==="vm"&&!At.held&&!At.helpReason&&n.jsxs("button",{onClick:()=>{no()},disabled:bn||Lt==="join"||!et,className:"mt-3 flex w-full items-center justify-center gap-2 rounded-lg bg-control py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",title:l("computer.takeControlVmTitle"),children:[Lt==="join"?n.jsx(je,{size:14,className:"animate-spin"}):n.jsx(Li,{size:14}),l("computer.takeControl")]}),U&&ee==="vm"&&yt?.mode==="per-bot"&&n.jsxs("button",{onClick:()=>{oc("vm-delete")},disabled:Lt!==null||e.busy,className:"mt-2 flex w-full items-center justify-center gap-2 rounded-lg border border-danger/30 py-2 text-[13px] text-danger hover:bg-danger/10 disabled:opacity-50",title:e.busy?l("computer.deleteVmBlocked"):l("computer.deleteVmTitle",{name:T.name}),children:[Lt==="vm-delete"?n.jsx(je,{size:14,className:"animate-spin"}):n.jsx(_u,{size:14}),l("computer.deleteVm")]}),ue&&n.jsxs("div",{className:"mt-3 flex gap-2",children:[!At.held&&!At.helpReason&&n.jsxs("button",{onClick:()=>{no()},disabled:bn||Lt==="join",className:"flex flex-1 items-center justify-center gap-2 rounded-lg bg-control py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",title:l("computer.takeControlTitle"),children:[Lt==="join"?n.jsx(je,{size:14,className:"animate-spin"}):n.jsx(Li,{size:14}),l("computer.takeControl")]}),At.held&&n.jsxs("button",{onClick:()=>{no()},disabled:Lt==="join",className:"flex flex-1 items-center justify-center gap-2 rounded-lg bg-control py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[Lt==="join"?n.jsx(je,{size:14,className:"animate-spin"}):n.jsx(Ea,{size:14}),l("computer.openLiveDesktop")]}),$&&(Te==="vps"||me!=="archived")&&n.jsxs("button",{onClick:()=>Gs("sleep"),disabled:Lt==="sleep"||e.busy,className:"flex flex-1 items-center justify-center gap-2 rounded-lg bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",title:l("computer.sleepTitle"),children:[Lt==="sleep"?n.jsx(je,{size:14,className:"animate-spin"}):n.jsx(BE,{size:14}),l("vm.cloud.sleep")]})]}),ee!=="team-box"&&(T.computer!==void 0||be)&&n.jsxs(n.Fragment,{children:[n.jsx(fIe,{}),n.jsx(yIe,{}),n.jsx(h$,{})]}),n.jsxs("div",{className:"mt-4 rounded-xl bg-card p-4",children:[n.jsx("div",{className:"text-[15px] font-medium text-ink",children:l("computer.worksOn")}),n.jsx("p",{className:"mt-1 text-[12px] leading-5 text-ink-secondary",children:l("computer.worksOnHint")}),n.jsx("div",{role:"group","aria-label":l("computer.destinationAria"),className:"mt-3 grid auto-rows-fr grid-cols-2 gap-2",children:[[null,"vm.dest.auto","computer.dest.autoDesc",So],["cloud","vm.dest.cloud","computer.dest.cloudDesc",_s],["vm","vm.dest.vm","computer.dest.vmDesc",$h],["local","vm.dest.local","computer.dest.localDesc",Ea],["browser","vm.dest.browser","computer.dest.browserDesc",Sr],["off","vm.dest.off","computer.dest.offDesc",_u]].map(([Ee,ct,vt,kt])=>{const Ot=Ee===null?!e.computer:e.computer===Ee,Na=k.config?.managedPolicy,si=Ee==="local"?"thisComputer":Ee==="vm"?"localVm":Ee==="cloud"?e.cloudBackend==="vps"?"vps":"box":null,Fa=Na&&si&&!Na.computers[si]?l("policy.managedBy",{organization:Na.organizationName}):void 0,oo=!!Fa||Ee==="cloud"&&!eo||Ee==="vm"&&!ni||Ee==="local"&&!F||Ee==="browser"&&!Kn,Gr=Fa??(Ee==="vm"&&!ni?l("computer.unavailableVm"):Ee==="cloud"&&!eo?l("computer.unavailableCloud"):Ee==="local"&&!F?Ne??l("computer.unavailableLocal"):Ee==="browser"?Kn?l("computer.browserOnlyTitle"):ji:void 0);return n.jsxs("button",{disabled:oo,title:Gr,onClick:()=>{Ee===null&&e.computer===void 0||Ee===e.computer||(Ee==="local"&&Jo(e)==="auto"?ge(T.id):Ee==="browser"?we({computer:Ee,browser:!0}):Ee==="cloud"&&!k.config?.box.configured&&e.cloudBackend!=="vps"?we({computer:Ee,cloudBackend:"vps"}):we({computer:Ee}))},type:"button","aria-pressed":Ot,className:V("min-w-0 rounded-lg border px-2.5 py-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-card",Ot?"border-accent/60 bg-accent/10 text-ink":"border-hairline/50 bg-panel/30 text-ink-secondary",oo?"cursor-not-allowed":"hover:border-accent/40 hover:bg-control/60"),children:[n.jsxs("span",{className:"flex items-center gap-2 text-[12px] font-medium leading-4",children:[Ot?n.jsx(mt,{size:14,className:"shrink-0 text-accent"}):n.jsx(kt,{size:14,className:"shrink-0 text-ink-secondary"}),n.jsx("span",{children:l(ct)})]}),n.jsx("span",{className:"mt-1.5 block text-[11px] leading-4 text-ink-secondary",children:Fa??l(oo?"computer.unavailableHere":vt)})]},Ee??"auto")})}),C?.surface&&n.jsx("p",{className:"mt-2 text-[11.5px] leading-5 text-ink-secondary","data-testid":"place-pinned-note",children:l("place.pinnedNote",{place:l(td(C.surface))})}),e.computer==="cloud"&&n.jsx(n.Fragment,{children:n.jsx(Pz,{compact:!0,value:Te,vpsSupported:oi,boxAvailable:!!k.config?.box.configured,onChange:Ee=>we({cloudBackend:Ee})})}),e.computer!=="cloud"&&n.jsx("div",{className:"mt-3 border-t border-hairline/40 pt-3 text-[11.5px] leading-5 text-ink-secondary","aria-live":"polite",children:e.computer?e.computer==="vm"?n.jsxs(n.Fragment,{children:[l("computer.hint.vm"),n.jsx("button",{type:"button",onClick:Xi,className:"mt-1 block font-medium text-accent hover:underline",children:l("computer.vmSettingsLink")})]}):e.computer==="local"?l("computer.hint.local"):e.computer==="browser"?l("computer.hint.browser"):l("computer.hint.off"):Ye?`Auto uses ${Ye.name}, shared with this team's other Auto bots. Choosing another destination overrides the team default.`:Te==="vps"&&T.autoStartVps?l("computer.hint.vpsAuto"):l(F&&!Y?"computer.hint.autoLocal":"computer.hint.autoCloud")})]}),n.jsxs("button",{type:"button",onClick:()=>jo("routines"),className:"mt-4 flex w-full items-start gap-3 rounded-xl bg-card p-4 text-left hover:bg-raised",children:[n.jsx(Zu,{size:17,className:"mt-0.5 shrink-0 text-accent"}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsxs("span",{className:"block text-[14px] font-medium text-ink",children:[l("computer.tab.routines")," ",n.jsx("span",{className:"ml-1 text-[11px] text-ink-secondary",children:go.length})]}),n.jsx("span",{className:V("mt-1 block truncate text-[11.5px]",to?oC(to):"text-ink-secondary"),children:to?`${to.routineName} · ${cp(to)}`:l("computer.routines.openTitle")})]}),n.jsx("span",{className:"text-ink-secondary","aria-hidden":"true",children:"→"})]})]})]}),n.jsx(Fg,{open:pe!==null,onCancel:()=>ge(null),onConfirm:()=>{const Ee=pe;ge(null),Ee&&(Ee===T.id&&(le(null),X("checking")),w({type:"updateBot",botId:Ee,patch:{computer:"local",acknowledgeLocalAuto:!0}}))}})]})}function SIe(e){if(typeof e!="string"||!e)throw new Error("The host did not return a live desktop link");return e.startsWith("/vps-viewer/")?new URL(e,window.location.origin).toString():e}function CIe(e){if(e.schedule.type==="cron")return qg(e.schedule);if(e.schedule.type==="once")return new Date(e.schedule.at).toLocaleString([],{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"});if(e.schedule.type==="interval")return`${e.schedule.everyMinutes%60===0?`Every ${e.schedule.everyMinutes/60} hr`:`Every ${e.schedule.everyMinutes} min`} · starting ${new Date(e.schedule.anchorAt).toLocaleString([],{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}`;const t=e.schedule.weekdays,a=t.length===7?"Every day":t.join(",")==="1,2,3,4,5"?"Weekdays":t.map(s=>["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][s]).join(", "),[o,i]=e.schedule.time.split(":").map(Number);return`${a} · ${new Date(2e3,0,1,o,i).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}`}function jIe(e){if(e==null)return"Paused";const t=new Date(e),a=new Date;return`${t.toDateString()===a.toDateString()?"Today":t.toLocaleDateString([],{month:"short",day:"numeric"})}, ${t.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}`}function NIe({bot:e}){const{state:t,dispatch:a}=ke(),{padClass:o}=Ap(),[i,s]=f.useState(!1),[r,c]=f.useState(null),[d,p]=f.useState(null),[h,g]=f.useState(!0),[b,x]=f.useState(!1),[v,k]=f.useState(!1),w=Dv(),N=f.useRef(e.busy);f.useEffect(()=>{N.current=e.busy},[e.busy]);const[C,j]=f.useState(!1),M=t.routines.filter(B=>B.botId===e.id).sort((B,O)=>Number(O.enabled)-Number(B.enabled)||(B.nextRunAt??1/0)-(O.nextRunAt??1/0)),E=t.routineRuns.find(B=>B.botId===e.id&&["queued","running","waiting"].includes(B.status)),A=!!(t.config?.box.configured&&lg(t.instances,e.modelSelection.instanceId)?.snapshot.state==="available");f.useEffect(()=>{p(null),g(!0),x(!1)},[e.id]),f.useEffect(()=>{const B=window.ogb?.desktopViewer;if(!B)return;let O=!0;B.currentState().then(z=>{O&&k(z.open&&z.contextId===e.id)}).catch(()=>{});const T=B.onState(z=>{(z.contextId===e.id||!z.open)&&k(z.open&&z.contextId===e.id)});return()=>{O=!1,T()}},[e.id]),f.useEffect(()=>{if(!w||v||i)return;const B=new AbortController;let O=!1,T=-1/0,z=null,P=null;const L=async()=>{if(!(O||B.signal.aborted)&&!(Date.now()-T<(z??(N.current?4e3:3e4)))){O=!0,z=null;try{const H=Khe(await Z(`/api/bots/${e.id}/computer/screenshot`,{method:"POST",body:"{}",signal:AbortSignal.any([B.signal,AbortSignal.timeout(9e4)])}));!B.signal.aborted&&H?(p(H),x(!1),P=null):B.signal.aborted||x(!0)}catch(H){if(!B.signal.aborted)if(H instanceof Qo&&J3(H)){z=1e3,P??=Date.now();const $=Date.now()-P>=1e4;x($),g(!$)}else P=null,x(!0)}finally{!B.signal.aborted&&z===null&&g(!1),O=!1,T=Date.now()}}};L();const G=window.setInterval(L,1e3);return()=>{B.abort(),window.clearInterval(G)}},[e.id,w,v,i]);const R=async()=>{s(!0),c(null);let B=!1;try{if(!window.ogb?.desktopViewer)throw new Error("The desktop viewer is unavailable in this build");await Z(`/api/bots/${e.id}/computer/control`,{method:"POST",body:JSON.stringify({action:"take"})}),B=!0;const O=await Z(`/api/bots/${e.id}/computer/join`,{method:"POST",body:"{}"});if(!await window.ogb.desktopViewer.open(SIe(O.joinUrl),`${e.name}'s live desktop`,e.id))throw new Error("Atomic could not open the live desktop")}catch(O){B&&await Z(`/api/bots/${e.id}/computer/control`,{method:"POST",body:JSON.stringify({action:"release"})}).catch(()=>{}),await Z(`/api/bots/${e.id}/computer/viewer-close`,{method:"POST",body:"{}"}).catch(()=>{}),c(O instanceof Error?O.message:String(O))}finally{s(!1)}};return n.jsxs("aside",{className:"relative z-20 flex h-full w-[400px] shrink-0 flex-col border-l border-hairline bg-panel",children:[n.jsxs("div",{className:V("flex items-center justify-between border-b border-hairline px-5 py-4",o),children:[n.jsxs("div",{children:[n.jsxs("div",{className:"text-[14px] font-medium text-ink",children:[e.name,"'s computer"]}),n.jsx("div",{className:"mt-0.5 text-[11px] text-ink-secondary",children:e.cloudBackend==="vps"?"Self-hosted VPS":"Cloud desktop"})]}),n.jsx("button",{type:"button",onClick:()=>a({type:"toggleComputer",open:!1}),className:"rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink","aria-label":"Close computer panel",children:n.jsx(jt,{size:18})})]}),n.jsxs("div",{className:"flex flex-1 flex-col items-center gap-4 overflow-y-auto px-6 py-5 text-center",children:[n.jsxs("button",{type:"button",onClick:()=>{R()},disabled:i||!d,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":d?`Open ${e.name}'s live desktop`:"VPS preview unavailable",children:[d?n.jsx("img",{src:d,alt:`${e.name}'s VPS desktop preview`,className:"h-full w-full object-contain"}):h?n.jsx(je,{size:22,className:"animate-spin text-ink-secondary"}):n.jsxs("div",{className:"flex flex-col items-center gap-2 text-ink-secondary",children:[n.jsx(Kh,{size:24}),n.jsx("span",{className:"text-[11px]",children:b?"Preview unavailable":"Waiting for preview"})]}),d&&n.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:"Open live desktop"})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[14px] font-medium text-ink",children:"Open the live desktop"}),n.jsx("p",{className:"mt-2 text-[12px] leading-relaxed text-ink-secondary",children:"The host creates a temporary, encrypted viewer relay. VPS SSH and VNC credentials stay on the host computer."})]}),n.jsxs("button",{type:"button",onClick:()=>{R()},disabled:i,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:[i?n.jsx(je,{size:15,className:"animate-spin"}):n.jsx(Ea,{size:15}),i?"Opening…":"Take control"]}),r&&n.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:r}),n.jsx("p",{className:"text-[11px] leading-relaxed text-ink-tertiary",children:"The host must enable cloud desktop access for this paired device in Settings → Remote access."}),n.jsxs("div",{className:"w-full rounded-xl bg-card p-4 text-left",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[15px] font-medium text-ink",children:[n.jsx(Zu,{size:16,className:"text-accent"}),"Scheduled tasks"]}),M.length>0&&n.jsx("span",{className:"rounded-full bg-control px-2 py-0.5 text-[10px] font-medium text-ink-secondary",children:M.length})]}),E&&n.jsxs("button",{type:"button",onClick:()=>a({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:[n.jsx(je,{size:13,className:E.status==="queued"?"":"animate-spin"}),n.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[E.routineName," · ",E.status==="waiting"?"needs you":E.status]})]}),M.length>0&&n.jsx("div",{className:"mt-3 space-y-1.5",children:M.slice(0,3).map(B=>n.jsxs("button",{type:"button",onClick:()=>a({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:[n.jsx("span",{className:V("size-1.5 shrink-0 rounded-full",B.enabled?"bg-success":"bg-ink-secondary/40")}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate text-[12.5px] font-medium text-ink",children:B.name}),n.jsxs("span",{className:"block truncate text-[10.5px] text-ink-secondary",children:[CIe(B),B.runOn==="cloud"?" · runs on VM":""]})]}),n.jsx("span",{className:"shrink-0 text-[10px] text-ink-secondary",children:jIe(B.nextRunAt)})]},B.id))}),n.jsxs("div",{className:"mt-3 flex gap-2",children:[n.jsxs("button",{type:"button",onClick:()=>j(!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:[n.jsx(Sn,{size:14}),"Create schedule"]}),n.jsxs("button",{type:"button",onClick:()=>a({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:"Open schedules",children:[n.jsx(Qu,{size:14}),"Schedules"]})]})]})]}),C&&n.jsx(lC,{bots:[e],lockedBotId:e.id,defaultRunOn:A?"cloud":"maus",onClose:()=>j(!1)})]})}const AIe={usage_limited:"usage limit",auth_failed:"sign-in failed",stalled:"not responding",rate_limited:"rate limited",request_rejected:"request refused",provider_error:"provider error"},Iu=(e,t=120)=>e.length>t?`${e.slice(0,t-1)}…`:e,Pu=e=>e.replace(/\s+/g," ").trim(),sB=119;function rB(e,t){const a=e?{...e}:{text:"",pendingSpace:!1,overflow:!1};if(a.overflow)return a;for(const o of t){if(/\s/.test(o)){a.text&&(a.pendingSpace=!0);continue}if(a.pendingSpace){if(a.text.length>=sB){a.overflow=!0;break}a.text+=" ",a.pendingSpace=!1}if(a.text.length>=sB){a.overflow=!0;break}a.text+=o}return a}const lB=e=>`${e.text}${e.overflow?"…":""}`;function MIe(e){switch(e.type){case"session.started":return{summary:`session ${e.sessionId??"(none)"}${e.model?` · ${e.model}`:""}`,tone:"plain"};case"session.model-fallback":return{summary:`model fallback · ${e.requested} refused, running ${e.model} · ${e.reason}`,tone:"boundary"};case"session.exited":return{summary:`session exited${e.reason?` · ${e.reason}`:""}`,tone:"plain"};case"turn.started":return{summary:`turn started${e.turnId?` · ${e.turnId.slice(0,8)}`:""}`,tone:"boundary"};case"turn.retrying":return{summary:`retrying (${e.reason}) · attempt ${e.attempt} · ${Math.round(e.delayMs/1e3)}s`,tone:"plain"};case"turn.engine_failover":return{summary:`engine switched (${AIe[e.reason]??e.reason}) · ${e.from.label} → ${e.to.label}${e.toClass?` (${e.toClass}${e.droppedClass?", another class":""})`:""}`,tone:"boundary"};case"turn.answer_check":{const t=[`answer check (Jev) · ${e.decision}`];return typeof e.probability=="number"&&t.push(`p=${e.probability.toFixed(2)} vs ${e.threshold.toFixed(2)}`),e.reason&&t.push(e.reason),e.rerunTo&&t.push(`re-run on ${e.rerunTo.label}`),e.latencyMs&&t.push(`${e.latencyMs} ms`),e.costUsd&&t.push(`$${e.costUsd.toFixed(6)}`),{summary:t.join(" · "),tone:e.decision==="rerun"?"boundary":"plain"}}case"turn.completed":{const t=[e.ok?"turn ok":"turn failed"];return e.stopReason&&t.push(e.stopReason),typeof e.cost=="number"&&t.push(`$${e.cost.toFixed(4)}`),e.denials?.length&&t.push(`${e.denials.length} denied`),{summary:t.join(" · "),tone:e.ok?"boundary":"error"}}case"turn.wait_started":return{summary:`waiting for computer — ${e.holder?`${e.holder.name}${e.holder.task?` (${e.holder.task})`:""}`:"holder unknown"}`,tone:"plain"};case"turn.wait_ended":{const t=Math.round(e.waitedMs/1e3),a=e.waitedMs<1e3?"under a second":`${t}s`;return e.outcome==="acquired"?{summary:`computer acquired after ${a}`,tone:"boundary"}:e.outcome==="gave_up"?{summary:`computer wait gave up after ${a}`,tone:"error"}:{summary:`computer wait stopped after ${a}`,tone:"plain"}}case"item.started":return{summary:`${e.itemType}${e.title?`: ${Iu(Pu(e.title))}`:" started"}`,tone:"plain"};case"item.updated":return{summary:`${e.itemType} updated${typeof e.tokens=="number"?` · ${e.tokens} tok`:""}`,tone:"plain"};case"item.completed":return e.itemType==="assistant_text"?{summary:`assistant: ${Iu(Pu(e.text))}`,tone:"plain"}:e.itemType==="assistant_image"?{summary:"assistant image generated",tone:"plain"}:{summary:`tool ${e.ok?"ok":"failed"}`,tone:e.ok?"plain":"error"};case"content.delta":return{summary:`${e.streamKind}: ${Iu(Pu(e.delta))}`,tone:"plain"};case"request.opened":return{summary:`${e.requestType}: ${e.tool} — ${Iu(Pu(e.summary))}`,tone:"plain"};case"request.resolved":return{summary:`resolved ${e.behavior} · ${e.source}`,tone:"plain"};case"thread.token-usage.updated":return{summary:`tokens in ${e.input} · out ${e.output}`,tone:"plain"};case"runtime.error":return{summary:`${e.setup?"setup: ":""}${Iu(Pu(e.message))}`,tone:"error"};default:return{summary:e.type,tone:"plain"}}}function IIe(e){const t=e.msg;if(!t||typeof t!="object")return String(e.msg);const a=typeof t.method=="string"?t.method:void 0,o=typeof t.type=="string"?t.type:void 0,i=t.id!==void 0?` #${String(t.id)}`:"";if(a)return`${a}${i}`;if(typeof t.event=="string"){const s=t.result?.status;return typeof s=="string"?`${t.event} · ${s}`:t.event}if(o){const s=t.message,r=typeof s?.role=="string"?` · ${s.role}`:"",c=typeof t.subtype=="string"?` · ${t.subtype}`:"";return`${o}${c}${r}`}return t.result!==void 0?`result${i}`:t.error!==void 0?`error${i}`:Iu(Pu(JSON.stringify(t)))}function PIe(e){const t=[];for(const[a,o]of e.entries()){if(o.kind==="native"){t.push({key:`n${a}`,kind:"native",at:o.at,tag:o.data.dir==="out"?"→ out":"← in",summary:`${o.data.source} · ${IIe(o.data)}`,tone:"plain",data:o.data,count:1});continue}const i=o.data,s=t.at(-1);if(i.type==="content.delta"&&s?.kind==="runtime"&&s.tag==="content.delta"&&s.data[0]?.type==="content.delta"&&s.data[0].streamKind===i.streamKind){const h=s.data;h.push(i),s.count=h.length,s.preview=rB(s.preview,i.delta),s.summary=`${i.streamKind}: ${lB(s.preview)}`;continue}const{summary:r,tone:c}=MIe(i),d=i.type==="content.delta"?rB(void 0,i.delta):void 0,p=i.type==="content.delta"?i.streamKind:void 0;t.push({key:i.eventId||`r${a}`,kind:"runtime",at:o.at,tag:i.type,summary:d&&p?`${p}: ${lB(d)}`:r,tone:c,data:i.type==="content.delta"?[i]:i,count:1,preview:d})}return t}function TIe(e){const t=new Date(e);if(Number.isNaN(t.getTime()))return"--:--:--";const a=String(t.getHours()).padStart(2,"0"),o=String(t.getMinutes()).padStart(2,"0"),i=String(t.getSeconds()).padStart(2,"0"),s=String(t.getMilliseconds()).padStart(3,"0");return`${a}:${o}:${i}.${s}`}const BIe=/^«redacted \d+ chars»$/,Ac=e=>BIe.test(e)?e:`«redacted ${e.length} chars»`,EIe=[/\bom[dg]_[A-Za-z0-9_-]{43}(?![A-Za-z0-9_-])/g,/\bsk-(?:ant-|proj-|live-|test-)?[A-Za-z0-9_-]{16,}/g,/\bxai-[A-Za-z0-9_-]{20,}/g,/\bgsk_[A-Za-z0-9]{40,}/g,/\bhf_[A-Za-z0-9]{30,}/g,/\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{20,}/g,/\bgithub_pat_[A-Za-z0-9_]{20,}/g,/\bxox[abposr]-[A-Za-z0-9-]{20,}/g,/\bAKIA[0-9A-Z]{16}\b/g,/\bAIza[0-9A-Za-z_-]{30,}/g,/\bnpm_[A-Za-z0-9]{20,}/g,/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g],RIe=/(\bBearer\s+)([A-Za-z0-9._~+/=-]{12,})/g,DIe=/(-----BEGIN [A-Z ]*PRIVATE KEY-----)([\s\S]*?)(-----END [A-Z ]*PRIVATE KEY-----)/g,OIe=/\b((?:[A-Za-z0-9_-]*_)?(?:api[_-]?key|apikey|secret|token|password|passwd|authorization|auth[_-]?token|access[_-]?key|private[_-]?key)s?)(["']?\s*[=:]\s*)(["']?)([A-Za-z0-9._~+/=-]{8,})\3/gi,zIe=/\b([A-Za-z][A-Za-z0-9_-]*[_-]key)s?(=)(["']?)([A-Za-z0-9._~+/=-]+)\3/gi,LIe=/(--(?:token|password|passwd|api-key|apikey|secret|access-key|auth-token)(?:=|\s+))(["']?)(?!-)([A-Za-z0-9._~+/=-]+)\2/gi,_Ie=/(\b[a-z][a-z0-9+.-]*:\/\/[^\s/:@'"]+:)([^\s/@'"«»]+)(@)/gi;function m4(e){if(!e||e.length<8)return e;let t=e;t=t.replace(DIe,(a,o,i,s)=>`${o}
|
|
583
|
+
@modelcontextprotocol/server-github`,rows:5,className:"mt-1.5 w-full resize-y rounded-lg border border-hairline/60 bg-raised px-3 py-2.5 font-mono text-[12px] text-ink outline-none focus:border-accent"})]}),n.jsxs("label",{className:"block",children:[n.jsx("span",{className:"text-[12px] font-medium text-ink-secondary",children:l("mcp.field.env")}),n.jsx("textarea",{value:p.env,onChange:ee=>h(X=>({...X,env:ee.target.value})),placeholder:"GITHUB_TOKEN=…",rows:5,className:"mt-1.5 w-full resize-y rounded-lg border border-hairline/60 bg-raised px-3 py-2.5 font-mono text-[12px] text-ink outline-none focus:border-accent"}),c!=="new"&&n.jsx("span",{className:"mt-1.5 block text-[11px] text-ink-secondary",children:l("mcp.envHint")})]})]})]}),n.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[n.jsx("button",{type:"button",onClick:W,className:"rounded-lg px-3 py-2 text-[12.5px] text-ink-secondary hover:bg-raised",children:l("mcp.cancel")}),n.jsxs("button",{type:"button",disabled:g!==null,onClick:()=>{Y()},className:"flex items-center gap-1.5 rounded-lg bg-accent px-3.5 py-2 text-[12.5px] font-medium text-white disabled:opacity-50",children:[g==="save"&&n.jsx(je,{size:13,className:"animate-spin"})," ",l("mcp.save")]})]})]}),s===null?n.jsxs("div",{className:"flex items-center justify-center gap-2 py-24 text-[13px] text-ink-secondary",children:[n.jsx(je,{size:14,className:"animate-spin"})," ",l("mcp.loading")]}):s.length===0&&!c?n.jsxs("div",{className:"mt-5 flex min-h-64 flex-col items-center justify-center rounded-2xl border border-dashed border-hairline/60 text-center",children:[n.jsx("div",{className:"flex size-11 items-center justify-center rounded-xl bg-raised text-ink-secondary",children:n.jsx(t7,{size:21})}),n.jsx("div",{className:"mt-3 text-[14px] font-medium text-ink",children:l("mcp.empty.title")}),n.jsx("div",{className:"mt-1 max-w-sm text-[12.5px] text-ink-secondary",children:l("mcp.empty.desc")})]}):n.jsxs("div",{className:"mt-5 space-y-3",children:[O&&O!=="os"&&s.some(ee=>(Bc(ee)?ee.headerKeys:ee.envKeys).length>0)&&n.jsx("div",{role:"status",className:"rounded-xl bg-warning/10 px-3.5 py-2.5 text-[12px] leading-relaxed text-warning","data-mcp-secret-storage":O,children:l(O==="unavailable"?"mcp.secure.unavailable":O==="insecure"?"mcp.secure.insecure":"mcp.secure.plaintext")}),s.map(ee=>{const X=N[ee.name];return n.jsxs("div",{className:"rounded-2xl border border-hairline/50 bg-card px-4 py-4 sm:px-5",children:[n.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[n.jsx("div",{className:V("flex size-10 shrink-0 items-center justify-center rounded-xl",ee.enabled?"bg-success/10 text-success":"bg-raised text-ink-secondary"),children:Bc(ee)?n.jsx(Sr,{size:19}):n.jsx(t7,{size:19})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"truncate text-[14px] font-medium text-ink",children:ee.name}),n.jsx("span",{className:V("rounded-full px-2 py-0.5 text-[10.5px]",ee.enabled?"bg-success/10 text-success":"bg-raised text-ink-secondary"),children:l(ee.enabled?"mcp.badge.on":"mcp.badge.off")}),ee.managedBy&&n.jsx("span",{className:"rounded-full bg-raised px-2 py-0.5 text-[10.5px] text-ink-secondary",children:l("policy.managedBy",{organization:ee.managedBy})}),ee.auth?n.jsx("span",{className:"rounded-full bg-warning/10 px-2 py-0.5 text-[10.5px] text-warning","data-mcp-needs-reconnect":!0,children:l("mcp.auth.badge")}):ee.chibitekSignIn&&n.jsx("span",{className:"truncate rounded-full bg-success/10 px-2 py-0.5 text-[10.5px] text-success","data-mcp-chibitek-signin":!0,children:l("mcp.chibitek.badge",{name:ee.chibitekSignIn.name})}),!ee.managedBy&&n.jsxs("label",{className:"ml-auto flex shrink-0 items-center gap-1.5 text-[11.5px] text-ink-secondary",title:l("owner.connectionHint"),children:[n.jsx("span",{children:l("owner.personal")}),n.jsx(Tt,{checked:a.connections.mcpServers.includes(ee.name),disabled:g!==null,"aria-label":l("owner.connectionToggle",{name:ee.name}),onClick:()=>{a.set("mcpServers",ee.name,!a.connections.mcpServers.includes(ee.name)).catch(oe=>v(oe instanceof Error?oe.message:String(oe)))}})]})]}),ee.managedBy&&n.jsx("div",{className:"mt-1 text-[11.5px] text-ink-secondary",children:l("policy.mcpBlocked",{organization:ee.managedBy})}),ee.auth&&(()=>{const oe=V9e(ee.auth);return n.jsx("div",{role:"status",className:"mt-1 text-[11.5px] leading-relaxed text-ink-secondary","data-mcp-auth":!0,children:l(oe.key,oe.params)})})(),ee.unavailable&&n.jsx("div",{role:"status",className:"mt-1 text-[11.5px] leading-relaxed text-ink-secondary","data-mcp-unavailable":!0,children:ee.unavailable}),n.jsx("div",{className:"mt-1 truncate font-mono text-[11.5px] text-ink-secondary",children:Bc(ee)?ee.url:[ee.command,...ee.args].join(" ")}),Bc(ee)?ee.headerKeys.length>0&&n.jsx("div",{className:"mt-1 truncate text-[11px] text-ink-secondary",children:l("mcp.headersSaved",{keys:ee.headerKeys.join(", ")})}):ee.envKeys.length>0&&n.jsx("div",{className:"mt-1 truncate text-[11px] text-ink-secondary",children:l("mcp.secretsSaved",{keys:ee.envKeys.join(", ")})}),ee.secureKeys&&ee.secureKeys.length>0&&n.jsx("div",{className:"mt-1 truncate text-[11px] text-success","data-mcp-secure-keys":!0,children:l("mcp.secure.stored",{keys:ee.secureKeys.join(", ")})}),ee.needsFix==="missing-secret"&&n.jsx("div",{role:"status",className:"mt-1 text-[11.5px] leading-relaxed text-warning","data-mcp-needs-fix":"missing-secret",children:l("mcp.secure.missing")}),ee.needsFix==="token-argument"&&ee.parkedArgs?.[0]&&n.jsxs("div",{className:"mt-2 rounded-lg bg-warning/10 px-3 py-2.5","data-mcp-needs-fix":"token-argument",children:[n.jsx("div",{className:"text-[11.5px] leading-relaxed text-warning",children:l("mcp.secure.argFix",{argument:`#${ee.parkedArgs[0]}`})}),n.jsxs("div",{className:"mt-2 flex gap-2",children:[n.jsx("input",{value:z[ee.name]??"",onChange:oe=>P(ne=>({...ne,[ee.name]:oe.target.value})),placeholder:"API_KEY","aria-label":l("mcp.secure.argFixAria",{name:ee.name}),className:"min-w-0 flex-1 rounded-lg border border-hairline/60 bg-raised px-2.5 py-1.5 font-mono text-[12px] text-ink outline-none focus:border-accent"}),n.jsxs("button",{type:"button",disabled:g!==null,onClick:()=>{Q(ee,ee.parkedArgs[0])},className:"flex shrink-0 items-center gap-1.5 rounded-lg bg-accent px-3 py-1.5 text-[12px] font-medium text-white disabled:opacity-50",children:[g===`fix:${ee.name}`&&n.jsx(je,{size:13,className:"animate-spin"})," ",l("mcp.secure.argFixButton")]})]})]})]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[ee.auth&&n.jsxs("button",{type:"button",disabled:g!==null,onClick:()=>{ge(ee)},className:"flex items-center gap-1.5 rounded-lg bg-warning/10 px-2.5 py-2 text-[12px] text-warning hover:bg-warning/15 disabled:opacity-40","aria-label":l("mcp.reconnectAria",{name:ee.name}),title:l("mcp.reconnectHint"),children:[g===`reconnect:${ee.name}`?n.jsx(je,{size:14,className:"animate-spin"}):n.jsx(gZ,{size:14})," ",l("mcp.reconnect")]}),n.jsxs("button",{type:"button",disabled:g!==null,onClick:()=>{pe(ee)},className:"flex items-center gap-1.5 rounded-lg px-2.5 py-2 text-[12px] text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-40",children:[g===`test:${ee.name}`?n.jsx(je,{size:14,className:"animate-spin"}):n.jsx(SE,{size:14})," ",l("mcp.test")]}),n.jsxs("button",{type:"button",disabled:g!==null,onClick:()=>{ae(ee)},className:"flex items-center gap-1.5 rounded-lg px-2.5 py-2 text-[12px] text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-40","aria-label":l("mcp.toggleAria",{name:ee.name,state:l(ee.enabled?"mcp.state.off":"mcp.state.on")}),children:[g===`toggle:${ee.name}`?n.jsx(je,{size:14,className:"animate-spin"}):n.jsx(QW,{size:14})," ",l(ee.enabled?"mcp.turnOff":"mcp.turnOn")]}),n.jsx("button",{type:"button",disabled:g!==null,onClick:()=>{d(ee.name),h(Y9e(ee)),v(null),w(null)},className:"rounded-lg p-2 text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-40","aria-label":l("mcp.editAria",{name:ee.name}),children:n.jsx($i,{size:14})}),n.jsx("button",{type:"button",disabled:g!==null,onClick:()=>{Ne(ee)},className:"rounded-lg p-2 text-ink-secondary hover:bg-danger/10 hover:text-danger disabled:opacity-40","aria-label":l("mcp.removeAria",{name:ee.name}),children:n.jsx(xn,{size:14})})]})]}),n.jsxs("div",{className:"mt-3 flex items-start justify-between gap-4 border-t border-hairline/30 pt-3",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-[12.5px] font-medium text-ink",children:l("mcp.readOnly.title")}),n.jsx("p",{className:"mt-0.5 text-[11.5px] leading-relaxed text-ink-secondary",children:l("mcp.readOnly.desc")})]}),n.jsx(Tt,{checked:ee.autoAllowReadOnly!==!1,"aria-label":l("mcp.readOnly.aria",{name:ee.name}),disabled:g!==null,onClick:()=>{F(ee)},className:"mt-0.5 shrink-0 disabled:cursor-wait disabled:opacity-50"})]}),X&&n.jsx("div",{role:"status",className:V("mt-3 rounded-lg px-3 py-2 text-[12px]",X.ok?"bg-success/10 text-success":"bg-danger/10 text-danger"),children:X.ok?n.jsxs("span",{className:"flex items-start gap-2",children:[n.jsx(cs,{size:14,className:"mt-px shrink-0"})," ",n.jsxs("span",{children:[l("mcp.probe.connected")," ",J9e(X.tools),ee.autoAllowReadOnly!==!1&&YT(X.tools).length>0&&n.jsx("span",{className:"block text-ink-secondary",children:l("mcp.probe.readOnly",{names:YT(X.tools).join(", ")})})]})]}):X.error}),X?.threatScan&&n.jsx(Fl,{result:X.threatScan})]},ee.name)})]})]})})}function u$(){const{state:e,dispatch:t}=ke(),a=upe(e.config),[o,i]=f.useState(!1),[s,r]=f.useState(!1),c=async()=>{if(!o){i(!0),r(!1);try{const d=await Z("/api/config",{method:"PATCH",body:JSON.stringify({features:{claudeUserMcp:!a}})});t({type:"configStatus",config:d})}catch{r(!0)}finally{i(!1)}}};return n.jsxs("div",{className:"mt-4 flex items-start justify-between gap-4 rounded-2xl border border-hairline/50 bg-card px-4 py-4 sm:px-5",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-[14px] font-medium text-ink",children:l("mcp.claude.title")}),n.jsx("p",{className:"mt-1 text-[12px] leading-relaxed text-ink-secondary",children:l("mcp.claude.desc")}),s&&n.jsx("p",{role:"alert",className:"mt-1 text-[12px] text-danger",children:l("mcp.claude.error")})]}),n.jsx(Tt,{checked:a,"aria-label":l("mcp.claude.aria"),disabled:o,onClick:()=>{c()},className:"mt-0.5 shrink-0 disabled:cursor-wait disabled:opacity-50"})]})}function p$({onOpenMcp:e,embedded:t=!1}){const{state:a,dispatch:o}=ke(),[i,s]=f.useState(()=>a.marketplaceSearch?.query??""),r=a.marketplaceSearch?.nonce;return f.useEffect(()=>{r!==void 0&&s(a.marketplaceSearch?.query??"")},[r]),n.jsxs("div",{className:t?"min-w-0":"min-h-0 flex-1 overflow-y-auto px-6 pb-7 pt-5 sm:px-8",children:[n.jsxs("p",{className:"mb-5 text-[12.5px] leading-relaxed text-ink-secondary","data-marketplace-note":!0,children:[l("mcpMarket.addonsNoteMarketplace")," ",n.jsx("button",{type:"button",className:"font-medium text-accent underline-offset-2 hover:underline",onClick:()=>o({type:"toggleAppSettings",open:!0,section:"addons"}),children:l("mcpMarket.addonsLink")})]}),n.jsx(nNe,{query:i,onQueryChange:s,onOpenMcp:e,claudeSwitch:n.jsx(u$,{})})]})}function Z9e(){const{state:e,dispatch:t}=ke(),a=f.useRef(null),o=e.pluginsSurface,i=()=>t({type:"togglePlugins",open:!1});return f.useEffect(()=>{const s=document.activeElement instanceof HTMLElement?document.activeElement:null,r=a.current,c=()=>Array.from(r?.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')??[]);(r?.querySelector("input")??c()[0]??r)?.focus();const d=p=>{if(p.key==="Escape"){p.preventDefault(),t({type:"togglePlugins",open:!1});return}if(p.key!=="Tab"||!r)return;const h=c();if(h.length===0){p.preventDefault(),r.focus();return}const g=h[0],b=h.at(-1);p.shiftKey&&(document.activeElement===g||!r.contains(document.activeElement))?(p.preventDefault(),b.focus()):!p.shiftKey&&document.activeElement===b&&(p.preventDefault(),g.focus())};return window.addEventListener("keydown",d),()=>{window.removeEventListener("keydown",d),s?.focus()}},[t]),n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/55 p-4 backdrop-blur-[2px] sm:p-6",onMouseDown:s=>s.target===s.currentTarget&&i(),children:n.jsxs("div",{ref:a,"data-tour":"apps-panel",role:"dialog","aria-modal":"true","aria-labelledby":"plugins-title",tabIndex:-1,className:"animate-pop-in flex h-[min(780px,calc(100dvh-2rem))] w-full max-w-[1040px] flex-col overflow-hidden rounded-[24px] border border-hairline/50 bg-panel shadow-2xl shadow-black/50",children:[n.jsxs("header",{className:"flex items-start justify-between gap-4 px-6 pb-3 pt-6 sm:px-8 sm:pt-7",children:[n.jsxs("div",{children:[n.jsx("h2",{id:"plugins-title",className:"text-[22px] font-semibold tracking-[-0.01em] text-ink",children:l("connectors.title")}),n.jsx("p",{className:"mt-1 text-[13px] text-ink-secondary",children:l("connectors.subtitle")})]}),n.jsx("button",{"data-tour":"apps-close",onClick:i,"aria-label":l("connectors.closeAria"),className:"rounded-lg p-2 text-ink-secondary hover:bg-raised hover:text-ink",children:n.jsx(jt,{size:21})})]}),n.jsx("div",{className:"border-b border-hairline/40 px-6 sm:px-8",children:n.jsx("div",{className:"flex gap-6",role:"tablist","aria-label":l("connectors.typeAria"),children:["apps","mcp"].map(s=>n.jsx("button",{type:"button",role:"tab","aria-selected":o===s,onClick:()=>t({type:"togglePlugins",open:!0,surface:s}),className:V("border-b-2 px-0.5 pb-3 pt-1 text-[13.5px] font-medium transition-colors",o===s?"border-accent text-ink":"border-transparent text-ink-secondary hover:text-ink"),children:l(s==="apps"?"connectors.tab.marketplace":"connectors.tab.mcp")},s))})}),o==="apps"?n.jsx(p$,{onOpenMcp:()=>t({type:"togglePlugins",open:!0,surface:"mcp"})}):n.jsx(d$,{})]})})}function Dv(){const[e,t]=f.useState(()=>document.visibilityState==="visible");return f.useEffect(()=>{const a=()=>t(document.visibilityState==="visible");return document.addEventListener("visibilitychange",a),()=>document.removeEventListener("visibilitychange",a)},[]),e}function Q9e({src:e,name:t,error:a,starting:o,opening:i,disabled:s,refreshing:r=!1,retry:c=0,onOpen:d,onRetry:p}){const[h,g]=f.useState(null),[b,x]=f.useState(null);f.useEffect(()=>{x(null)},[c]);const v=!!(e&&h===e&&b!==e),k=a??(e&&b===e?l("computer.preview.imageFailed"):null);return n.jsxs("div",{className:"relative h-full w-full","aria-busy":!k&&(!v||i||r),children:[e&&n.jsxs("button",{type:"button",onClick:d,disabled:s||o||i||!v,className:"group absolute inset-0 flex h-full w-full items-center justify-center disabled:cursor-wait","aria-label":l("computer.openLiveDesktopAria",{name:t}),title:l("computer.openLiveDesktop"),children:[n.jsx("img",{src:e,alt:l("computer.screenOf",{name:t}),onLoad:()=>{g(e),x(null)},onError:()=>x(e),className:`h-full w-full object-contain transition group-hover:brightness-75 ${v?"":"invisible"}`},c),v&&n.jsxs("span",{className:"absolute right-2 top-2 flex items-center gap-1 rounded-md bg-black/70 px-2 py-1 text-[11px] font-medium text-white",children:[i?n.jsx(je,{size:12,className:"animate-spin"}):n.jsx(y0,{size:12}),l(i?"computer.preview.connecting":"computer.open")]})]}),!v&&!k&&n.jsxs("div",{role:"status",className:"absolute inset-0 flex flex-col items-center justify-center gap-2 px-6 text-center text-[12px] text-ink-secondary",children:[n.jsx(je,{size:18,className:"animate-spin"}),l(o?"computer.phase.starting":"computer.preview.connectingScreen")]}),v&&r&&!k&&n.jsxs("div",{role:"status",className:"absolute bottom-2 left-2 flex items-center gap-1 rounded-md bg-black/70 px-2 py-1 text-[11px] text-white",children:[n.jsx(je,{size:12,className:"animate-spin"}),l("computer.preview.connectingScreen")]}),k&&n.jsxs("div",{role:"alert",className:`absolute inset-x-0 flex flex-col items-center justify-center gap-2 bg-card/95 p-4 text-center text-[12px] text-ink-secondary ${v?"bottom-0":"inset-y-0"}`,children:[!v&&n.jsx(Ea,{size:22}),n.jsxs("span",{children:[l(v?"computer.preview.paused":"computer.preview.cantConnect")," ",k]}),n.jsx("button",{type:"button",onClick:()=>p(!v),className:"rounded-md bg-control px-3 py-1.5 text-ink hover:bg-control-hover",children:l("computer.preview.retry")})]})]})}const X9e={available:!1,devices:[]};function eIe(){const e=window.ogb?.androidDevice,[t,a]=f.useState(X9e),o=Dv();return f.useEffect(()=>{if(!e||!o)return;let i=!0;const s=async()=>{try{const c=await e.status();i&&a(c)}catch(c){i&&a({available:!1,devices:[],reasonCode:"adb-failed",message:c instanceof Error?c.message:String(c)})}};s();const r=window.setInterval(()=>{s()},2e3);return()=>{i=!1,window.clearInterval(r)}},[e,o]),t}function gy(e){return e.model==="Android device"?e.serial:e.model}function tIe({status:e}){const t=window.ogb?.androidDevice,a=Dv(),o=e.devices.filter(R=>R.state==="device"),[i,s]=f.useState(o[0]?.serial??e.devices[0]?.serial??""),[r,c]=f.useState(null),[d,p]=f.useState({width:0,height:0}),[h,g]=f.useState(null),b=f.useRef(null),x=f.useRef(null),v=f.useRef({x:0,y:0,timer:null}),k=e.devices.find(R=>R.serial===i)??e.devices[0],w=k?.serial,N=k?.state;f.useEffect(()=>{!k&&e.devices[0]&&s(e.devices[0].serial),k&&!e.devices.some(R=>R.serial===k.serial)&&s(e.devices[0]?.serial??"")},[k,e.devices]),f.useEffect(()=>{if(!t||!w||N!=="device"||!a){if(!a)return;c(null);return}let R=!0,B=null;const O=async()=>{try{const T=await t.frame(w);R&&(c(T.dataUrl),g(null))}catch(T){R&&g(T instanceof Error?T.message:String(T))}finally{R&&(B=window.setTimeout(()=>{O()},850))}};return O(),()=>{R=!1,B!==null&&window.clearTimeout(B)}},[t,w,N,a]),f.useEffect(()=>()=>{v.current.timer&&clearTimeout(v.current.timer)},[]);const C=R=>{!t||!k||k.state!=="device"||t.input(k.serial,R).catch(B=>{g(B instanceof Error?B.message:String(B))})},j=(R,B=!1)=>{if(!b.current||!d.width||!d.height)return null;const T=R.currentTarget.getBoundingClientRect(),z=Math.min(T.width/d.width,T.height/d.height),P=d.width*z,L=d.height*z,G=T.left+(T.width-P)/2,H=T.top+(T.height-L)/2,$=(R.clientX-G)/P,U=(R.clientY-H)/L;return B?{x:Math.max(0,Math.min(1,$)),y:Math.max(0,Math.min(1,U))}:$>=0&&$<=1&&U>=0&&U<=1?{x:$,y:U}:null},M=R=>{if(R.metaKey||R.ctrlKey||R.altKey)return;const B={ArrowDown:"down",ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",Backspace:"delete",Delete:"delete",Enter:"enter",Escape:"back",Tab:"tab"};B[R.key]?(R.preventDefault(),C({type:"key",key:B[R.key]})):/^[A-Za-z0-9 _.,@-]$/.test(R.key)&&(R.preventDefault(),C({type:"text",text:R.key}))},E=R=>{if(!d.width||!d.height)return;R.preventDefault();const B=v.current;B.x+=R.deltaX,B.y+=R.deltaY,B.timer&&clearTimeout(B.timer),B.timer=setTimeout(()=>{const O=Math.abs(B.x)>Math.abs(B.y),T=O?B.x:B.y;if(B.x=0,B.y=0,B.timer=null,Math.abs(T)<2)return;const z=Math.max(.18,Math.min(.45,Math.abs(T)/500)),P=T>0?-1:1,L=O?{x:.5,y:.5}:{x:.5,y:.65},G=O?{x:L.x+P*z,y:L.y}:{x:L.x,y:L.y+P*z};C({type:"swipe",fromX:L.x,fromY:L.y,toX:G.x,toY:G.y,durationMs:260,width:d.width,height:d.height})},80)};if(!k)return null;const A=k.state==="device";return n.jsxs("div",{className:"space-y-3 pb-5",children:[n.jsxs("div",{className:"rounded-xl bg-card p-4",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 text-[15px] font-medium text-ink",children:[n.jsx(ld,{size:16,className:"text-success"})," ",gy(k)]}),n.jsx("div",{className:"mt-1 text-[12px] leading-relaxed text-ink-secondary",children:l("computer.android.usbSubtitle")})]}),n.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-[11px] text-success",children:[n.jsx(Os,{size:12})," ",l("computer.android.usb")]})]}),e.devices.length>1&&n.jsx("select",{value:k.serial,onChange:R=>s(R.target.value),className:"mt-3 w-full rounded-lg border border-hairline/40 bg-inset px-3 py-2 text-[12px] text-ink",children:e.devices.map(R=>n.jsxs("option",{value:R.serial,children:[gy(R)," · ",R.state]},R.serial))})]}),A?n.jsxs(n.Fragment,{children:[n.jsx("div",{role:"application","aria-label":l("computer.android.screenAria",{name:gy(k)}),tabIndex:0,onKeyDown:M,onWheel:E,onPointerDown:R=>{const B=j(R);B&&(R.currentTarget.setPointerCapture(R.pointerId),x.current={point:B,at:performance.now()})},onPointerUp:R=>{const B=x.current,O=j(R,!0);if(x.current=null,!B||!O)return;Math.hypot(O.x-B.point.x,O.y-B.point.y)<.012?C({type:"tap",...O,...d}):C({type:"swipe",fromX:B.point.x,fromY:B.point.y,toX:O.x,toY:O.y,durationMs:performance.now()-B.at,...d}),R.currentTarget.focus()},onPointerCancel:()=>{x.current=null},className:"mx-auto flex h-[520px] w-full touch-none cursor-pointer items-center justify-center overflow-hidden overscroll-none rounded-[28px] bg-black outline-none ring-1 ring-white/10 focus:ring-2 focus:ring-accent",children:r?n.jsx("img",{ref:b,src:r,alt:l("computer.android.screenAlt",{name:gy(k)}),draggable:!1,onLoad:R=>{p({width:R.currentTarget.naturalWidth,height:R.currentTarget.naturalHeight})},className:"pointer-events-none h-full w-full select-none object-contain"}):n.jsx(je,{size:20,className:"animate-spin text-ink-secondary"})}),n.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[n.jsxs("button",{onClick:()=>C({type:"key",key:"back"}),className:"flex items-center justify-center gap-1.5 rounded-lg bg-raised py-2 text-[12px] text-ink hover:bg-raised-hover",children:[n.jsx(Gl,{size:13})," ",l("computer.android.back")]}),n.jsxs("button",{onClick:()=>C({type:"key",key:"home"}),className:"flex items-center justify-center gap-1.5 rounded-lg bg-raised py-2 text-[12px] text-ink hover:bg-raised-hover",children:[n.jsx(Gh,{size:12})," ",l("computer.android.home")]}),n.jsxs("button",{onClick:()=>C({type:"key",key:"recent"}),className:"flex items-center justify-center gap-1.5 rounded-lg bg-raised py-2 text-[12px] text-ink hover:bg-raised-hover",children:[n.jsx(Fs,{size:13})," ",l("computer.android.recent")]})]}),n.jsx("div",{className:"text-center text-[11px] leading-relaxed text-ink-secondary",children:l("computer.android.hint")})]}):n.jsx("div",{className:"rounded-xl border border-warning/25 bg-warning/10 p-4 text-[12px] leading-relaxed text-warning",children:k.state==="unauthorized"?l("computer.android.unauthorized"):l("computer.android.badState",{state:k.state})}),h&&n.jsx("div",{className:"rounded-lg border border-danger/30 bg-danger/10 px-3 py-2 text-[12px] text-danger",children:h}),n.jsxs("div",{className:"rounded-xl bg-card p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[13px] font-medium text-ink",children:[n.jsx(pQ,{size:15,className:"text-accent"})," ",l("computer.android.setupTitle")]}),n.jsxs("ol",{className:"mt-2 list-decimal space-y-1.5 pl-4 text-[11.5px] leading-relaxed text-ink-secondary",children:[n.jsx("li",{children:l("computer.android.step1")}),n.jsx("li",{children:l("computer.android.step2").split(/(\{buildNumber\}|\{usbDebugging\})/).map((R,B)=>R==="{buildNumber}"||R==="{usbDebugging}"?n.jsx("span",{className:"text-ink",children:l(R==="{buildNumber}"?"computer.android.buildNumber":"computer.android.usbDebugging")},B):R)}),n.jsxs("li",{children:[l("computer.android.step3a")," ",n.jsx("span",{className:"text-ink",children:l("computer.android.allowUsbDebugging")})," ",l("computer.android.step3b")]})]}),n.jsx("div",{className:"mt-2 text-[11px] leading-relaxed text-ink-secondary",children:l("computer.android.agentNote")}),n.jsx("div",{className:"mt-2 rounded-lg bg-inset px-3 py-2 text-[11px] leading-relaxed text-ink-secondary",children:l("computer.android.harnessNote")})]})]})}function ZT(e){return e.map(({id:t,name:a})=>({id:t,name:a}))}function nIe(e,t){return{browserProfiles:ZT(t),expectedBrowserProfiles:ZT(e)}}function aIe(){return`profile-${crypto.randomUUID().replaceAll("-","")}`}function QT(e,t){const a=e.filter(i=>i.browserProfile===t&&i.busy);if(!a.length)return null;const o=a.map(i=>i.name).join(", ");return a.length===1?l("settings.profiles.busyOne",{names:o}):l("settings.profiles.busyMany",{names:o})}function m$({bot:e,onProfileChanged:t,disabled:a=!1}){const{state:o,dispatch:i,flushBotPatches:s}=ke(),r=o.config?.browserProfiles??[],c=o.bots??[],d=e?c.find(G=>G.id===e.id)??e:void 0,[p,h]=f.useState(null),[g,b]=f.useState(!1),[x,v]=f.useState(""),[k,w]=f.useState(null),[N,C]=f.useState(""),j=f.useId(),M=g||a||p!==!0;f.useEffect(()=>{let G=!0;return Np().then(H=>{G&&h(qS(H))}),()=>{G=!1}},[]);const E=async G=>{if(C(G instanceof Error?G.message:l("settings.profiles.saveError")),G instanceof Qo&&G.status===409)try{const H=await Z("/api/config");i({type:"configStatus",config:H})}catch{C(l("settings.profiles.refreshError"))}G instanceof Qo&&(G.status===401||G.status===403)&&h(!1)},A=async G=>{try{const H=await Z("/api/config",{method:"PATCH",body:JSON.stringify(nIe(r,G))});return i({type:"configStatus",config:H}),!0}catch(H){return await E(H),!1}},R=async()=>{if(!(M||!x.trim()||r.length>=20)){b(!0),C("");try{await A([...r,{id:aIe(),name:x.trim()}])&&v("")}finally{b(!1)}}},B=async()=>{if(!(M||!k?.name.trim())){if(!r.some(G=>G.id===k.id)){C(l("settings.profiles.removed"));return}b(!0),C("");try{await A(r.map(G=>G.id===k.id?{...G,name:k.name.trim()}:G))&&w(null)}finally{b(!1)}}},O=async G=>{if(M)return;const H=QT(c,G.id);if(H)return C(H);const $=c.filter(Q=>Q.browserProfile===G.id),U=$.length?` ${l("settings.profiles.deleteUsers",{names:$.map(Q=>Q.name).join(", ")})}`:"";if(window.confirm(l("settings.profiles.confirm",{name:G.name,bots:U}))){b(!0),C("");try{await A(r.filter(Q=>Q.id!==G.id))&&(k?.id===G.id&&w(null),d?.browserProfile===G.id&&t?.())}finally{b(!1)}}},T=async G=>{if(!(M||!d||d.busy||G===(d.browserProfile??""))){b(!0),C("");try{await s(d.id);const H=await Z(`/api/bots/${encodeURIComponent(d.id)}`,{method:"PATCH",body:JSON.stringify({browserProfile:G||null})});i({type:"botPatched",bot:H.bot}),t?.()}catch(H){await E(H)}finally{b(!1)}}};if(p===!1)return n.jsx("p",{className:"text-[12px] text-ink-secondary",children:l("settings.profiles.ownerOnly")});const z="min-w-0 flex-1 rounded-md border border-hairline/40 bg-inset px-2.5 py-2 text-[13px] text-ink outline-none focus:border-accent disabled:opacity-50",P="shrink-0 rounded-md bg-control px-2.5 py-2 text-[12px] text-ink hover:bg-control-hover disabled:opacity-50",L=d?.browserProfile??"";return n.jsxs("div",{className:"flex min-w-0 flex-col gap-3","aria-busy":g,children:[d&&n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx("label",{htmlFor:`${j}-profile`,className:"text-[12px] font-medium text-ink",children:l("settings.profiles.browserSession")}),n.jsxs("select",{id:`${j}-profile`,value:L,disabled:M||d.busy,onChange:G=>{T(G.target.value)},className:z,children:[n.jsx("option",{value:"",children:l("settings.profiles.own")}),r.map(G=>n.jsx("option",{value:G.id,children:G.name},G.id)),n.jsx("option",{value:"guest",children:l("settings.profiles.temporary")}),L&&L!=="guest"&&!r.some(G=>G.id===L)?n.jsx("option",{value:L,disabled:!0,children:l("settings.profiles.removed")}):null]}),n.jsx("p",{className:"text-[11px] leading-relaxed text-ink-secondary",children:d.busy?l("settings.profiles.stopToSwitch"):l(L==="guest"?"settings.profiles.temporaryHint":"settings.profiles.sharedHint")})]}),n.jsxs("details",{open:!d,className:"min-w-0",children:[n.jsx("summary",{className:"cursor-pointer text-[12px] font-medium text-ink-secondary hover:text-ink",children:l("settings.profiles.manage")}),n.jsxs("div",{className:"mt-3 flex flex-col gap-3",children:[n.jsxs("form",{className:"flex flex-wrap gap-2",onSubmit:G=>{G.preventDefault(),R()},children:[n.jsx("label",{htmlFor:`${j}-new`,className:"sr-only",children:l("settings.profiles.newName")}),n.jsx("input",{id:`${j}-new`,value:x,onChange:G=>v(G.target.value),maxLength:40,required:!0,disabled:M||r.length>=20,placeholder:l("settings.profiles.newName"),className:z}),n.jsxs("button",{type:"submit",disabled:M||!x.trim()||r.length>=20,className:`${P} flex items-center gap-1`,children:[n.jsx(Sn,{size:13}),l("settings.profiles.create")]})]}),r.length>=20&&n.jsx("p",{className:"text-[11px] text-ink-secondary",children:l("settings.profiles.limit")}),!r.length&&n.jsx("p",{className:"text-[12px] text-ink-secondary",children:l("settings.profiles.sharedEmpty")}),n.jsx("div",{className:"divide-y divide-hairline/30",children:r.map(G=>{const H=c.filter(U=>U.browserProfile===G.id).map(U=>U.name),$=QT(c,G.id);return n.jsxs("div",{className:"flex flex-col gap-1 py-2",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[n.jsx(Sr,{size:14,className:"shrink-0 text-ink-secondary"}),k?.id===G.id?n.jsxs("form",{className:"flex min-w-0 flex-1 flex-wrap gap-2",onSubmit:U=>{U.preventDefault(),B()},children:[n.jsx("input",{autoFocus:!0,value:k.name,onChange:U=>w({id:G.id,name:U.target.value}),maxLength:40,required:!0,disabled:M,className:z,"aria-label":l("settings.profiles.nameAria")}),n.jsx("button",{type:"submit",disabled:M||!k.name.trim(),className:P,children:l("common.save")}),n.jsx("button",{type:"button",disabled:g,onClick:()=>w(null),className:P,children:l("common.cancel")})]}):n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",disabled:M,onClick:()=>{w({id:G.id,name:G.name}),C("")},className:"min-w-0 flex-1 truncate text-left text-[13px] font-medium text-ink hover:underline disabled:opacity-50",title:l("settings.profiles.rename"),children:G.name}),n.jsxs("button",{type:"button",onClick:()=>{O(G)},disabled:M||!!$,title:$??l("settings.profiles.deleteTitle"),"aria-label":`${l("common.delete")} ${G.name}`,className:"flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-[12px] text-ink-secondary hover:bg-control hover:text-danger disabled:opacity-50",children:[n.jsx(xn,{size:13}),l("common.delete")]})]})]}),n.jsx("p",{className:"break-words pl-6 text-[11px] text-ink-secondary",children:H.length?l("settings.profiles.usedBy",{names:H.join(", ")}):l("settings.profiles.notInUse")})]},G.id)})})]})]}),N&&n.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:N})]})}const ku=e=>Number(e.altKey)+Number(e.ctrlKey)*2+Number(e.metaKey)*4+Number(e.shiftKey)*8;function oIe(e,t,a,o,i,s,r,c=!1){if(![e.width,e.height,t,a,o,i].every(x=>Number.isFinite(x)&&x>0)||![s,r].every(Number.isFinite))return null;const d=Math.min(e.width/t,e.height/a),p=t*d,h=a*d,g=s-e.left-(e.width-p)/2,b=r-e.top-(e.height-h)/2;return!c&&(g<0||b<0||g>=p||b>=h)?null:{x:Math.max(0,Math.min(o-1,g*o/p)),y:Math.max(0,Math.min(i-1,b*i/h))}}function iIe(e){const t=new Map;return{send(a){const i=a.type==="input_keyboard"?`key:${a.code||a.key}`:`mouse:${a.button}`;if((a.eventType==="keyDown"||a.eventType==="mousePressed")&&t.set(i,{...a}),(a.eventType==="keyUp"||a.eventType==="mouseReleased")&&t.delete(i),a.eventType==="mouseMoved")for(const s of t.values())s.type==="input_mouse"&&(s.x=a.x,s.y=a.y);e(a)},release(){const a=[...t.values()].reverse();t.clear();for(const{text:o,...i}of a)e({...i,eventType:i.type==="input_keyboard"?"keyUp":"mouseReleased",modifiers:0})}}}function sIe({frame:e,width:t,height:a,driving:o,input:i,acknowledge:s,onDecodeError:r,onReturnToToolbar:c}){const d=f.useRef(null),p=f.useRef(""),h=f.useRef(-1),g=e.metadata?.deviceWidth??t,b=e.metadata?.deviceHeight??a,x=`data:image/${e.format==="png"?"png":"jpeg"};base64,${e.data}`,v=f.useMemo(()=>iIe(i),[i]),k=v.send;f.useLayoutEffect(()=>(o||v.release(),v.release),[o,v]),f.useEffect(()=>(window.addEventListener("blur",v.release),()=>window.removeEventListener("blur",v.release)),[v]);const w=()=>{if(d.current?.complete&&d.current.naturalWidth>0&&d.current.currentSrc===x){if(d.current.currentSrc===p.current&&e.seq===h.current)return;p.current=d.current.currentSrc,h.current=e.seq,s(e.seq)}};f.useEffect(()=>{const C=requestAnimationFrame(w);return()=>cancelAnimationFrame(C)},[e]);const N=(C,j,M=!1)=>{const E=d.current;return!E?.complete||E.currentSrc!==x?null:oIe(E.getBoundingClientRect(),E.naturalWidth,E.naturalHeight,g,b,C,j,M)};return f.useEffect(()=>{const C=d.current;if(!C||!o)return;const j=M=>{M.preventDefault();const E=N(M.clientX,M.clientY);if(!E)return;const A=M.deltaMode===1?16:M.deltaMode===2?b:1,R=B=>Math.max(-1e4,Math.min(1e4,B*A));k({type:"input_mouse",eventType:"mouseWheel",...E,deltaX:R(M.deltaX),deltaY:R(M.deltaY),modifiers:ku(M)})};return C.addEventListener("wheel",j,{passive:!1}),()=>C.removeEventListener("wheel",j)},[o,k,g,b,x]),n.jsx(n.Fragment,{children:n.jsx("img",{ref:d,src:x,alt:"Live bot browser",draggable:!1,tabIndex:o?0:-1,title:o?"Shift+Escape returns to the browser address bar.":void 0,"aria-description":o?"Keyboard input goes to the remote page. Press Shift+Escape to return to the browser address bar.":void 0,"aria-keyshortcuts":o?"Shift+Escape":void 0,className:`block h-full w-full object-contain select-none outline-none focus:ring-2 focus:ring-inset focus:ring-accent ${o?"cursor-default touch-none":"cursor-not-allowed"}`,onLoad:w,onError:r,onBlur:v.release,onContextMenu:C=>{o&&C.preventDefault()},onPointerDown:C=>{if(!o)return;const j=N(C.clientX,C.clientY);j&&(C.preventDefault(),C.currentTarget.focus(),C.currentTarget.setPointerCapture(C.pointerId),k({type:"input_mouse",eventType:"mousePressed",...j,button:C.button===2?"right":C.button===1?"middle":"left",clickCount:Math.min(3,C.detail||1),modifiers:ku(C)}))},onPointerUp:C=>{if(!o)return;C.preventDefault();const j=N(C.clientX,C.clientY,C.currentTarget.hasPointerCapture(C.pointerId));if(!j){v.release();return}k({type:"input_mouse",eventType:"mouseReleased",...j,button:C.button===2?"right":C.button===1?"middle":"left",clickCount:Math.min(3,C.detail||1),modifiers:ku(C)})},onPointerCancel:v.release,onPointerMove:C=>{if(!o)return;const j=N(C.clientX,C.clientY,C.currentTarget.hasPointerCapture(C.pointerId));j&&k({type:"input_mouse",eventType:"mouseMoved",...j,button:C.buttons&1?"left":C.buttons&2?"right":C.buttons&4?"middle":"none",modifiers:ku(C)})},onKeyDown:C=>{if(!(!o||C.nativeEvent.isComposing)){if(C.key==="Escape"&&C.shiftKey){C.preventDefault(),C.stopPropagation(),v.release(),c();return}(C.metaKey||C.ctrlKey)&&C.key.toLowerCase()==="v"||(C.preventDefault(),k({type:"input_keyboard",eventType:"keyDown",key:C.key,code:C.code,windowsVirtualKeyCode:C.keyCode,modifiers:ku(C),...C.key.length===1&&!C.metaKey&&!C.ctrlKey&&!C.altKey?{text:C.key}:{}}))}},onKeyUp:C=>{if(!(!o||(C.metaKey||C.ctrlKey)&&C.key.toLowerCase()==="v")){if(C.key==="Escape"&&C.shiftKey){C.preventDefault(),C.stopPropagation();return}C.preventDefault(),k({type:"input_keyboard",eventType:"keyUp",key:C.key,code:C.code,windowsVirtualKeyCode:C.keyCode,modifiers:ku(C)})}},onPaste:C=>{o&&(C.preventDefault(),k({type:"input_keyboard",eventType:"char",text:C.clipboardData.getData("text/plain").slice(0,4096)}))}})})}const fy=e=>e.type==="input_mouse"&&["mouseMoved","mouseWheel"].includes(String(e.eventType)),O2=e=>e.type==="input_mouse"&&e.eventType==="mouseReleased"||e.type==="input_keyboard"&&e.eventType==="keyUp",by=e=>typeof e=="number"&&Number.isFinite(e)?e:0,XT=e=>Math.max(-1e4,Math.min(1e4,e));function rIe(e,t){let a=[],o=null,i=0,s=!1;const r=d=>{a=a.filter(O2),s||(s=!0,t(d))},c=()=>{if(o||!a.length)return;const d=i;o=(async()=>{for(;d===i&&a.length;){const p=a.shift();try{await e(p)}catch(h){d===i&&r(h)}}})().finally(()=>{o=null,c()})};return{enqueue(d){if(s&&!O2(d))return;const p=a.at(-1);if(p&&fy(d)&&p.type===d.type&&p.eventType===d.eventType&&p.modifiers===d.modifiers&&p.button===d.button){a[a.length-1]=d.eventType==="mouseWheel"?{...d,deltaX:XT(by(p.deltaX)+by(d.deltaX)),deltaY:XT(by(p.deltaY)+by(d.deltaY))}:{...d};return}if(a.length>=32){if(fy(d))return;const h=a.findIndex(fy);if(h>=0)a.splice(h,1);else if(r(new Error("Browser input stopped because the connection is too slow. Release control and reconnect before typing again.")),!O2(d)||a.length>=32)return}a.push({...d}),c()},async drain(){for(a=a.filter(d=>!fy(d));o||a.length;)c(),await o},clear(){i++,a=[],s=!1},stopped(){return s}}}const ss="rounded-md p-1.5 text-ink-secondary hover:bg-inset hover:text-ink disabled:opacity-40 disabled:cursor-not-allowed",lIe=[1e3,2e3,4e3,8e3,15e3],eB="Connection interrupted. Reconnecting the browser view…";function cIe({bot:e}){const{state:t}=ke(),[a,o]=f.useState(0),[i,s]=f.useState(null),[r,c]=f.useState([]),[d,p]=f.useState(""),[h,g]=f.useState(!1),[b,x]=f.useState({held:!1,controlling:!1,owned:!1}),[v,k]=f.useState(!1),[w,N]=f.useState(""),[C,j]=f.useState(!1),[M,E]=f.useState(!1),[A,R]=f.useState({width:1280,height:720}),B=f.useRef(""),O=f.useRef(0),T=f.useRef(null),z=f.useRef(null),P=f.useRef(null),L=f.useRef(null),G=f.useRef(null),H=f.useRef(null),$=f.useRef(""),U=f.useRef(!1),Q=f.useRef(0),W=f.useRef(""),q=e.browserProfile==="guest"?"Temporary browser":t.config?.browserProfiles?.find(ee=>ee.id===e.browserProfile)?.name??`${e.name}’s own browser`;f.useEffect(()=>{C?L.current?.showModal():L.current?.close()},[C]),f.useEffect(()=>{M?G.current?.showModal():G.current?.close()},[M]);const Y=f.useCallback(async(ee,X=B.current)=>{if(!X)throw new Error("Open the browser connection first.");return Z(`/api/bots/${encodeURIComponent(e.id)}/browser/action`,{method:"POST",body:JSON.stringify({...ee,viewerId:X}),timeoutMs:12e4})},[e.id]),ae=f.useCallback(ee=>{H.current?.enqueue(ee)},[]),F=f.useCallback(()=>{O.current++,Q.current=0,B.current="",H.current?.clear(),H.current=null,T.current=null,o(ee=>ee+1)},[]);f.useEffect(()=>{const ee=++O.current,X=()=>O.current===ee,oe=JSON.stringify([e.id,e.browserProfile]);W.current!==oe&&(W.current=oe,Q.current=0);let ne=!1,Ce;B.current="",T.current=null,$.current="",U.current=!1,s(null),c([]),p(""),g(!1),N(""),x({held:!1,controlling:!1,owned:!1}),k(!1);const le=new EventSource(`/api/bots/${encodeURIComponent(e.id)}/browser/live`),re=(xe,Te)=>le.addEventListener(xe,nt=>{if(!(ne||!X()))try{Te(JSON.parse(nt.data))}catch{}});return re("ready",xe=>{if(typeof xe.viewerId!="string"||!xe.viewerId)return;const Te=xe.viewerId;B.current=Te,H.current=rIe(async nt=>{X()&&B.current===Te&&await Y(nt,Te)},nt=>{!X()||B.current!==Te||($.current=nt instanceof Error?nt.message:String(nt),N($.current))}),g(!0)}),re("heartbeat",()=>{Q.current=0}),re("frame",xe=>{B.current&&s({...xe,viewerId:B.current,generation:ee})}),re("tabs",xe=>{if(!Array.isArray(xe.tabs))return;c(xe.tabs);const Te=xe.tabs.find(nt=>nt.active);Te&&!U.current&&p(Te.url==="about:blank"?"":Te.url)}),re("url",xe=>{typeof xe.url=="string"&&!U.current&&p(xe.url==="about:blank"?"":xe.url)}),re("status",xe=>{xe.viewportWidth>0&&xe.viewportHeight>0&&R({width:xe.viewportWidth,height:xe.viewportHeight})}),re("control",xe=>{x(xe),xe.held&&!xe.controlling&&(s(null),c([]),p(""))}),le.addEventListener("error",xe=>{if(ne||!X())return;ne=!0;let Te="Browser connection ended. Reconnect to continue watching.",nt=!(xe instanceof MessageEvent);if(xe instanceof MessageEvent)try{const Ye=JSON.parse(xe.data);Te=Ye.message||Te,nt=Ye.retryable===!0}catch{}const be=nt?lIe[Q.current]:void 0;be!==void 0&&(Q.current++,Te=eB,Ce=setTimeout(()=>{X()&&(O.current++,o(Ye=>Ye+1))},be)),N(Te),g(!1),s(null),x({held:!1,controlling:!1,owned:!1}),B.current="",H.current?.clear(),H.current=null,le.close()}),()=>{ne=!0,clearTimeout(Ce),X()&&(O.current++,B.current="",T.current=null,H.current?.clear(),H.current=null),le.close()}},[e.id,e.browserProfile,a,Y]);const pe=async ee=>{if(T.current!==null)return;const X=B.current,oe=O.current,ne=H.current;T.current=oe,k(!0),N("");try{if(await ne?.drain(),O.current!==oe||B.current!==X)return;await Y(ee,X),H.current?.stopped()&&O.current===oe&&N($.current),O.current===oe&&ee.type==="restart"&&F()}catch(Ce){O.current===oe&&N(Ce instanceof Error?Ce.message:String(Ce))}finally{O.current===oe&&T.current===oe&&(T.current=null,k(!1))}},ge=b.controlling&&h&&!v,Ne=w===eB;return n.jsxs("div",{ref:z,className:"flex min-h-0 flex-1 flex-col overflow-hidden rounded-2xl border border-hairline/40 bg-card text-ink",children:[n.jsxs("div",{className:"flex min-h-12 items-center gap-1 px-2 pt-1.5",children:[n.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:[r.length?r.map(ee=>n.jsxs("div",{className:`flex max-w-52 shrink-0 items-center gap-1 rounded-xl px-1 text-[12px] ${ee.active?"bg-inset text-ink":"text-ink-secondary"}`,children:[n.jsx(Sr,{size:13,className:"ml-1.5 shrink-0 opacity-60"}),n.jsx("button",{className:"truncate px-1 py-2 text-left disabled:cursor-default",disabled:!ge,onClick:()=>{pe({type:"tab-select",tabId:ee.tabId})},title:ee.title||ee.url,children:ee.title||"New tab"}),n.jsx("button",{className:ss,"aria-label":`Close ${ee.title||"tab"}`,disabled:!ge,onClick:()=>{pe({type:"tab-close",tabId:ee.tabId})},children:n.jsx(jt,{size:13})})]},ee.tabId)):n.jsxs("div",{className:"flex items-center gap-2 rounded-xl bg-inset px-3 py-2 text-[12px] text-ink-secondary",children:[n.jsx(Sr,{size:13}),"New tab"]}),n.jsx("button",{className:`${ss} shrink-0`,disabled:!ge,"aria-label":"New tab",title:"New tab",onClick:()=>{pe({type:"tab-new"})},children:n.jsx(Sn,{size:17})})]}),n.jsx("button",{className:ss,title:"Full screen","aria-label":"Full screen",onClick:()=>{z.current?.requestFullscreen().catch(()=>N("Full screen is unavailable in this browser."))},children:n.jsx(y0,{size:16})}),n.jsx("button",{className:`${ss} rounded-xl bg-inset p-2`,title:`Browser profile: ${q}`,"aria-label":"Browser profiles","aria-expanded":C,onClick:()=>j(!0),children:n.jsx(H4,{size:16})})]}),n.jsxs("form",{className:"flex h-12 items-center gap-1 border-b border-hairline/40 px-2",onSubmit:ee=>{ee.preventDefault(),ge&&d.trim()&&pe({type:"navigate",url:/^https?:\/\//i.test(d.trim())?d.trim():`https://${d.trim()}`})},children:[n.jsxs("div",{className:"flex shrink-0 items-center",children:[n.jsx("button",{type:"button",className:ss,disabled:!ge,"aria-label":"Back",onClick:()=>{pe({type:"back"})},children:n.jsx(Gl,{size:17})}),n.jsx("button",{type:"button",className:ss,disabled:!ge,"aria-label":"Forward",onClick:()=>{pe({type:"forward"})},children:n.jsx(Mg,{size:17})}),n.jsx("button",{type:"button",className:ss,disabled:!ge,"aria-label":"Reload page",onClick:()=>{pe({type:"reload"})},children:n.jsx(Z2,{size:17})})]}),n.jsx("input",{ref:P,"aria-label":"Browser address",readOnly:!ge,value:d,onChange:ee=>p(ee.target.value),onFocus:ee=>{U.current=!0,ge&&ee.target.select()},onBlur:()=>{U.current=!1},placeholder:h?"about:blank":"Connecting…",spellCheck:!1,className:"mx-1 min-w-0 flex-1 rounded-lg bg-transparent px-2 py-1.5 text-center text-[12px] outline-none placeholder:text-ink-secondary focus:bg-inset focus:text-left"}),n.jsxs("button",{type:"button",disabled:!h||v||b.held&&!b.owned,onClick:()=>{pe({type:b.owned?"release":"take"})},title:b.owned?"Return to bot — browser tools are paused while you control this profile":b.held?"This profile is controlled in another window":"Take control to click, type, or sign in","aria-label":b.owned?"Return to bot":"Take control","aria-pressed":b.owned,className:`${ss} flex shrink-0 items-center gap-1.5 whitespace-nowrap text-[11px] sm:text-[12px] ${b.owned?"bg-accent/15 text-accent":""}`,children:[v?n.jsx(je,{size:16,className:"animate-spin"}):n.jsx(Li,{size:16,className:"hidden sm:block"}),n.jsx("span",{children:b.owned?"Return to bot":"Take control"})]}),n.jsxs("details",{className:"relative shrink-0",children:[n.jsx("summary",{className:`${ss} list-none cursor-pointer [&::-webkit-details-marker]:hidden`,"aria-label":"Browser menu",title:"Browser menu",children:n.jsx(NJ,{size:17})}),n.jsxs("div",{className:"absolute right-0 top-full z-20 mt-2 flex w-44 flex-col rounded-xl border border-hairline/50 bg-card p-1.5 text-[12px] shadow-xl",children:[n.jsx("button",{type:"button",className:"rounded-md px-3 py-2 text-left hover:bg-inset disabled:opacity-40",disabled:!ge,onClick:ee=>{ee.currentTarget.closest("details")?.removeAttribute("open"),E(!0)},children:"Type or paste text…"}),n.jsx("button",{type:"button",className:"rounded-md px-3 py-2 text-left hover:bg-inset",onClick:ee=>{ee.currentTarget.closest("details")?.removeAttribute("open"),F()},children:"Reconnect view"}),n.jsx("button",{type:"button",className:"rounded-md px-3 py-2 text-left hover:bg-inset disabled:opacity-40",disabled:!h||v,onClick:ee=>{ee.currentTarget.closest("details")?.removeAttribute("open"),window.confirm("Restart this profile’s browser? Open tabs will close. Saved logins are kept. Stop any bots using it first.")&&pe({type:"restart"})},children:"Restart browser…"})]})]})]}),w&&n.jsxs("div",{role:Ne?"status":"alert",className:`flex items-center justify-between gap-2 border-b border-hairline/30 px-3 py-2 text-[12px] ${Ne?"text-ink-secondary":"text-danger"}`,children:[n.jsx("span",{children:w}),!h&&n.jsx("button",{className:"shrink-0 underline",onClick:F,children:"Reconnect"})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden bg-inset/40",children:i?n.jsx(sIe,{frame:i,...A,driving:ge,input:ae,onReturnToToolbar:()=>P.current?.focus(),acknowledge:ee=>{O.current===i.generation&&B.current===i.viewerId&&Y({type:"ack",seq:ee},i.viewerId).catch(()=>{})},onDecodeError:()=>{O.current===i.generation&&B.current===i.viewerId&&N("A browser frame could not be decoded. Close and reopen the panel to reconnect.")}}):n.jsxs("div",{className:"flex min-h-64 flex-col items-center justify-center gap-3 p-6 text-center text-[13px] text-ink-secondary",children:[h&&b.held?n.jsx(Li,{size:24}):w&&!Ne?n.jsx(Sr,{size:24}):n.jsx(je,{size:24,className:"animate-spin"}),n.jsx("span",{children:b.held?"Live view paused for human control":Ne?"Reconnecting…":w?"Browser disconnected":"Opening the live browser…"})]})}),n.jsxs("dialog",{ref:L,onClose:()=>j(!1),onClick:ee=>{ee.target===ee.currentTarget&&j(!1)},className:"m-auto w-[min(420px,calc(100%-32px))] max-h-[80vh] overflow-auto rounded-2xl border border-hairline/50 bg-card p-5 text-ink shadow-2xl backdrop:bg-black/40",children:[n.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[n.jsx("h2",{className:"text-[15px] font-medium",children:"Browser profiles"}),n.jsx("button",{className:ss,"aria-label":"Close browser profiles",onClick:()=>j(!1),children:n.jsx(jt,{size:16})})]}),n.jsx(m$,{bot:e,disabled:v||b.held,onProfileChanged:()=>{j(!1),F()}})]}),n.jsxs("dialog",{ref:G,onClose:()=>E(!1),className:"m-auto w-[min(420px,calc(100%-32px))] rounded-2xl border border-hairline/50 bg-card p-5 text-ink shadow-2xl backdrop:bg-black/40",children:[n.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[n.jsx("h2",{className:"text-[14px] font-medium",children:"Type into the selected page field"}),n.jsx("button",{className:ss,"aria-label":"Close typing",onClick:()=>E(!1),children:n.jsx(jt,{size:16})})]}),n.jsxs("form",{className:"flex flex-col gap-3",onSubmit:ee=>{ee.preventDefault();const X=ee.currentTarget.elements.namedItem("pageText");ge&&X.value&&(ae({type:"input_keyboard",eventType:"char",text:X.value}),X.value="",E(!1))},children:[n.jsx("input",{name:"pageText","aria-label":"Text for the page",autoComplete:"off",maxLength:4096,placeholder:"Type or paste text",className:"rounded-lg bg-inset px-3 py-2 text-[13px] outline-none focus:ring-1 focus:ring-accent"}),n.jsx("button",{disabled:!ge,className:"self-end rounded-lg bg-accent px-4 py-2 text-[12px] text-accent-ink disabled:opacity-40",children:"Type"})]})]})]})}function dIe({bot:e}){const{state:t}=ke(),a=t.config?.browserEngine,[o,i]=f.useState(!1),[s,r]=f.useState(null),[c,d]=f.useState(null);f.useEffect(()=>{let g=!0;return Z("/api/auth/session").then(b=>{g&&d(b.scopes.includes("admin"))}).catch(()=>{g&&d(!1)}),()=>{g=!1}},[]);const p=o||a?.installing===!0,h=async()=>{r(null),i(!0);try{await Z("/api/browser-engine/install",{method:"POST"})}catch(g){r(g instanceof Error?g.message:String(g))}finally{i(!1)}};return c===!1?n.jsx("div",{className:"p-5 text-[13px] text-ink-secondary",children:"Only workspace administrators can view or control saved browser sessions."}):e.browser===!1?n.jsx("div",{className:"p-5 text-[13px] text-ink-secondary",children:"Enable the browser in this bot’s profile to use it."}):a?.kind==="engine"&&!p&&!a.installError?c===null?n.jsx("div",{className:"p-5 text-[13px] text-ink-secondary",children:"Loading browser…"}):n.jsx(cIe,{bot:e},e.id):n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col items-start justify-center gap-3 rounded-xl bg-card p-5",children:[n.jsx("div",{className:"text-[15px] font-medium text-ink",children:a?.kind==="engine"?"Browser installation incomplete":"Browser engine not installed"}),n.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:a?.kind==="engine"?"agent-browser is installed, but Chrome setup has not finished. Retry the browser installation.":_g(t.config)}),a?.installable||a?.kind==="engine"?n.jsx("button",{type:"button",onClick:()=>{h()},disabled:p||c!==!0,className:"rounded-lg bg-accent px-3 py-1.5 text-[13px] font-medium text-accent-ink disabled:opacity-60",children:p?"Installing… (a one-time download of about 160 MB)":a?.kind==="engine"?"Retry browser installation":"Install the browser engine"}):null,(a?.installError||s)&&n.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:s??a?.installError})]})}const uIe=f.lazy(()=>QC(()=>import("./TerminalPanel-B9u1SPIJ.js"),__vite__mapDeps([0,1])).then(e=>({default:e.TerminalPanel})));function pIe({active:e,onClick:t}){return n.jsxs("button",{type:"button",onClick:t,"aria-pressed":e,className:V("flex items-center gap-1.5 border-l border-hairline/40 px-2.5 py-1 text-[12.5px]",e?"bg-control text-ink":"text-ink-secondary hover:text-ink"),children:[n.jsx(oQ,{size:13}),l("computer.tab.terminal")]})}function mIe({bot:e}){const{state:t}=ke();return n.jsx(f.Suspense,{fallback:null,children:n.jsx(uIe,{bot:e,localEnabled:Sz(t.config)})})}async function p4(e){const{action:t,syncNativeBrowser:a,requestControl:o,setNativeBrowserControl:i}=e;if(t==="dismiss-help")return o(t);if(t==="take"&&a&&!await i(!0))throw new Error("Atomic could not pause this bot's browser safely");const s=await o(t);if(s.held!==(t==="take"))throw new Error(`Atomic could not ${t==="take"?"confirm":"release"} computer control`);if(t==="release"&&a&&!await i(!1))throw new Error("The computer was released, but the browser remains paused for safety");return s}function Zy(e){for(const t of e?.getTracks()??[])t.stop()}function hIe(e){const t=e instanceof DOMException?e.name:"";return t==="NotAllowedError"||t==="AbortError"?{ok:!1,phase:"cancelled",messageKey:"computer.screen.cancelled"}:t==="NotFoundError"||t==="NotReadableError"||t==="NotSupportedError"||t==="SecurityError"?{ok:!1,phase:"unavailable",messageKey:"computer.screen.unavailableNow"}:{ok:!1,phase:"error",messageKey:"computer.screen.error"}}async function gIe({beginIntent:e,getDisplayMedia:t}){try{if(!e())return{ok:!1,phase:"unavailable",messageKey:"computer.screen.unavailableWindow"};const a=await t({video:!0,audio:!1});return a.getVideoTracks().length===0?(Zy(a),{ok:!1,phase:"unavailable",messageKey:"computer.screen.noVideoTrack"}):{ok:!0,stream:a}}catch(a){return hIe(a)}}const sh={idle:"computer.screen.idle",ended:"computer.screen.ended",unavailable:"computer.screen.unavailable"};function fIe(){const{capabilities:e,ready:t}=ya(),a=e.screenPreview,o=e.host.platform==="linux",[i,s]=f.useState("idle"),[r,c]=f.useState(sh.idle),[d,p]=f.useState(""),h=f.useRef(null),g=f.useRef(null),b=f.useRef(0),x=f.useCallback((N,C)=>{b.current+=1;const j=g.current;g.current=null,h.current&&(h.current.srcObject=null),Zy(j),s(N),c(C)},[]);f.useEffect(()=>()=>{b.current+=1;const N=g.current;g.current=null,Zy(N)},[]);const v=async()=>{if(!a.available||!window.ogb?.beginScreenPreviewIntent||!navigator.mediaDevices?.getDisplayMedia){s("unavailable"),c(sh.unavailable);return}x("requesting","computer.screen.waiting");const N=b.current,C=await gIe({beginIntent:()=>window.ogb.beginScreenPreviewIntent(),getDisplayMedia:A=>navigator.mediaDevices.getDisplayMedia(A)});if(N!==b.current){C.ok&&Zy(C.stream);return}if(!C.ok){s(C.phase),c(C.messageKey);return}const j=C.stream,M=j.getVideoTracks()[0];g.current=j,p(M.label),M.addEventListener("ended",()=>{g.current===j&&x("ended",sh.ended)},{once:!0});const E=h.current;if(!E){x("error","computer.screen.displayFailed");return}E.srcObject=j;try{await E.play()}catch{N===b.current&&g.current===j&&x("error","computer.screen.displayFailed");return}N!==b.current||g.current!==j||(s("streaming"),c("computer.screen.active"))};if(!o)return null;const k=d||l("computer.screen.selected"),w=i==="cancelled"||i==="ended"||i==="unavailable"||i==="error";return n.jsxs("section",{className:"mt-4 rounded-xl bg-card p-4","aria-labelledby":"local-preview-title",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{children:[n.jsx("div",{id:"local-preview-title",className:"text-[15px] font-medium text-ink",children:l("computer.screen.title")}),n.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:l("computer.screen.subtitle")})]}),n.jsx("span",{className:"shrink-0 rounded-full bg-raised px-2 py-1 text-[10px] font-medium text-ink-secondary",children:l("computer.screen.badge")})]}),n.jsxs("div",{className:"relative mt-3 flex aspect-[16/10] items-center justify-center overflow-hidden rounded-lg bg-panel",children:[n.jsx("video",{ref:h,autoPlay:!0,muted:!0,playsInline:!0,"aria-label":l("computer.screen.videoAria"),className:i==="streaming"?"h-full w-full object-contain":"hidden"}),i!=="streaming"&&n.jsxs("div",{className:"flex flex-col items-center gap-2 px-6 text-center text-ink-secondary",children:[i==="requesting"?n.jsx(je,{size:18,className:"animate-spin"}):n.jsx(Ea,{size:22}),n.jsx("span",{className:"text-[12px]","aria-live":"polite",children:l(t?a.available?r:sh.unavailable:"computer.screen.checking")})]})]}),i==="streaming"&&n.jsxs("div",{className:"mt-2 flex items-center justify-between gap-3 text-[11px] text-ink-secondary",children:[n.jsx("span",{className:"truncate",title:k,children:a.interaction==="portal-picker"?k:l("vm.dest.local")}),n.jsxs("span",{className:"flex items-center gap-1.5 text-success",children:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-success"})," ",l("computer.screen.sharing")]})]}),n.jsxs("button",{type:"button",disabled:i==="requesting"||!a.available&&i!=="streaming",onClick:i==="streaming"?()=>x("idle",sh.idle):()=>{v()},className:"mt-3 flex w-full items-center justify-center gap-2 rounded-lg bg-raised py-2 text-[13px] text-ink hover:bg-raised-hover disabled:cursor-not-allowed disabled:opacity-50",children:[i==="requesting"?n.jsx(je,{size:14,className:"animate-spin"}):i==="streaming"?n.jsx(Wl,{size:13}):w?n.jsx(Fs,{size:14}):n.jsx(Ea,{size:14}),i==="requesting"?l("computer.screen.choosing"):i==="streaming"?l("computer.screen.stop"):w?l("computer.linux.tryAgain"):a.interaction==="portal-picker"?l("computer.screen.choose"):l("computer.screen.start")]})]})}const bIe="https://github.com/chibitek/atomic/blob/main/docs/linux-desktop.md#enable-local-control";function yIe(){const{capabilities:e}=ya(),t=e.localComputer,[a,o]=f.useState(null),[i,s]=f.useState(null);if(e.host.platform!=="linux")return null;const r=a!==null||t.status==="checking"||t.status==="starting",c=t.available,d=t.reasonCode==="linux-wayland-seat-safety-blocked",p=e.host.session==="wayland",h=t.driverSource==="bundled",g=async b=>{if(window.ogb?.localControl){o(b),s(null);try{if((b==="disable"||b==="retry")&&!(await fetch("/api/local-computer/interrupt",{method:"POST"})).ok){s({key:"computer.linux.stopFailed"});return}await window.ogb.localControl[b]()}catch(x){s(x instanceof Error?x.message:String(x))}finally{o(null)}}};return n.jsxs("section",{className:"mt-4 rounded-xl bg-card p-4","aria-labelledby":"linux-local-control-title",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{children:[n.jsxs("div",{id:"linux-local-control-title",className:"flex items-center gap-2 text-[15px] font-medium text-ink",children:[n.jsx(HY,{size:16,className:c?"text-success":"text-ink-secondary"}),l("computer.linux.title")]}),n.jsx("div",{className:"mt-1 text-[12px] leading-relaxed text-ink-secondary",children:l("computer.linux.meta",{session:p?"Wayland":"Xorg"})})]}),n.jsx("span",{className:V("shrink-0 rounded-full px-2 py-1 text-[10px] font-medium",c?"bg-success/10 text-success":d?"bg-danger/10 text-danger":t.enabled?"bg-warning/10 text-warning":"bg-raised text-ink-secondary"),children:c?l("computer.linux.ready"):d?l("computer.linux.waylandBadge"):t.enabled?l("vm.state.attention"):l("vm.dest.off")})]}),d?n.jsx("div",{className:"mt-3 rounded-lg border border-danger/20 bg-danger/5 p-3",children:n.jsxs("div",{className:"flex gap-2 text-[12px] leading-relaxed text-ink-secondary",children:[n.jsx(Qn,{size:15,className:"mt-0.5 shrink-0 text-danger"}),n.jsxs("span",{children:[l("computer.linux.waylandBefore")," ",n.jsx("strong",{className:"font-medium text-ink",children:l("computer.linux.waylandXorg")})," ",l("computer.linux.waylandAfter")]})]})}):t.enabled?n.jsxs("div",{className:"mt-3 rounded-lg bg-panel p-3 text-[12px] text-ink-secondary",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[c?n.jsx(cs,{size:15,className:"mt-0.5 shrink-0 text-success"}):r?n.jsx(je,{size:15,className:"mt-0.5 shrink-0 animate-spin"}):n.jsx(Qn,{size:15,className:"mt-0.5 shrink-0 text-warning"}),n.jsx("span",{"aria-live":"polite",children:c?l("computer.linux.readyMsg"):t.message??l("computer.linux.checking")})]}),t.driverPath&&n.jsxs("div",{className:"mt-2 break-all font-mono text-[10px] text-ink-secondary/80",title:t.driverPath,children:[h?l("computer.linux.bundledDriver"):t.driverPath,t.driverVersion?` · ${t.driverVersion}`:""]})]}):n.jsx("div",{className:"mt-3 rounded-lg border border-warning/20 bg-warning/5 p-3",children:n.jsxs("div",{className:"flex gap-2 text-[12px] leading-relaxed text-ink-secondary",children:[n.jsx(Qn,{size:15,className:"mt-0.5 shrink-0 text-warning"}),n.jsxs("span",{children:[l("computer.linux.enableBefore")," ",n.jsx("strong",{className:"font-medium text-ink",children:l("vm.dest.local")})," ",l("computer.linux.enableAfter"),p&&` ${l("computer.linux.waylandInput")}`]})]})}),i&&n.jsx("div",{className:"mt-2 text-[12px] text-danger",children:typeof i=="string"?i:l(i.key)}),!d&&n.jsx("div",{className:"mt-3 flex gap-2",children:t.enabled?n.jsxs(n.Fragment,{children:[!c&&n.jsxs("button",{type:"button",disabled:r,onClick:()=>{g("retry")},className:"flex flex-1 items-center justify-center gap-2 rounded-lg bg-raised py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[a==="retry"?n.jsx(je,{size:14,className:"animate-spin"}):n.jsx(Fs,{size:14}),l("computer.linux.tryAgain")]}),n.jsxs("button",{type:"button",disabled:a!==null,onClick:()=>{g("disable")},className:"flex flex-1 items-center justify-center gap-2 rounded-lg bg-raised py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[a==="disable"?n.jsx(je,{size:14,className:"animate-spin"}):n.jsx(_u,{size:14}),l("computer.linux.disable")]})]}):n.jsxs("button",{type:"button",disabled:r,onClick:()=>{g("enable")},className:"flex flex-1 items-center justify-center gap-2 rounded-lg bg-accent py-2 text-[13px] font-medium text-white hover:opacity-90 disabled:opacity-50",children:[a==="enable"?n.jsx(je,{size:14,className:"animate-spin"}):n.jsx(_u,{size:14}),l("computer.linux.enable")]})}),n.jsxs("button",{type:"button",onClick:()=>window.open(bIe,"_blank","noopener,noreferrer"),className:"mt-2 flex w-full items-center justify-center gap-1.5 rounded-lg py-1.5 text-[11px] text-ink-secondary hover:bg-raised hover:text-ink",children:[e.host.packaged?l("computer.linux.guide"):l("computer.linux.driverSetup")," ",n.jsx(Mn,{size:11})]})]})}function h$(){const{capabilities:e}=ya(),t=e.localComputer.available?null:e.localComputer.message,a=QF(fg(t)),[o,i]=f.useState(!1),[s,r]=f.useState(!1),[c,d]=f.useState(null),p=async()=>{i(!0),d(null);try{await window.ogb?.localControl?.retry()}catch(g){d(g instanceof Error?g.message:String(g))}finally{i(!1)}},h=async()=>{d(null),r(!0);try{await window.ogb?.permOpenSettings?.("accessibility"),await window.ogb?.permOpenSettings?.("screen")}catch(g){r(!1),d(g instanceof Error?g.message:String(g))}};return f.useEffect(()=>{if(!s)return;let g=!1;const b=()=>{g||document.visibilityState==="visible"&&(g=!0,r(!1),p())};return window.addEventListener("focus",b),document.addEventListener("visibilitychange",b),()=>{window.removeEventListener("focus",b),document.removeEventListener("visibilitychange",b)}},[s]),e.host.platform!=="darwin"||e.localComputer.reasonCode==="remote-server"||e.localComputer.available?null:n.jsx("section",{className:"mt-4 rounded-xl border border-warning/25 bg-warning/10 p-4",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(UZ,{size:16,className:"mt-0.5 shrink-0 text-warning"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-[14px] font-medium text-ink",children:"Allow control of this computer"}),n.jsx("p",{className:"mt-1 text-[12.5px] leading-relaxed text-ink-secondary",children:a??l("computer.mac.permission.generic")}),t&&n.jsxs("details",{className:"mt-2 text-[12px] text-ink-secondary",children:[n.jsx("summary",{className:"cursor-pointer",children:l("computer.mac.permission.driverDetail")}),n.jsx("p",{className:"mt-1 break-words",children:t})]}),c&&n.jsxs("div",{className:"mt-2 flex gap-1.5 text-[12px] text-danger",children:[n.jsx(Qn,{size:13,className:"mt-0.5 shrink-0"}),n.jsx("span",{children:c})]}),n.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[a&&t&&n.jsx(XF,{reason:t}),!a&&n.jsx("button",{type:"button",onClick:()=>{h()},disabled:o,className:"inline-flex items-center gap-1.5 rounded-lg bg-accent px-3 py-1.5 text-[12.5px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:"Open System Settings"}),n.jsxs("button",{type:"button",onClick:()=>{p()},disabled:o,className:"inline-flex items-center gap-1.5 rounded-lg border border-hairline/50 px-3 py-1.5 text-[12.5px] font-medium text-ink hover:bg-raised disabled:opacity-50",children:[o&&n.jsx(je,{size:13,className:"animate-spin"}),"Retry"]})]})]})]})})}const xIe="omb-computer-panel-view";function g$(e){return`${xIe}:${e}`}function tB(e,t=localStorage){try{const a=t.getItem(g$(e));if(a==="android"||a==="browser"||a==="routines"||a==="terminal")return a}catch{}return"computer"}function nB(e,t,a=localStorage){try{a.setItem(g$(e),t)}catch{}}class Ta extends Error{constructor(t,a,o){super(t),this.key=t,this.problem=a,this.fallbackKey=o}key;problem;fallbackKey}function aB(e){return e instanceof Ta?l(e.key,e.fallbackKey?{problem:e.problem??l(e.fallbackKey)}:void 0):e instanceof Error?e.message:e}const oB=zn({held:_i().optional().default(!1),helpReason:dn().nullable().optional().default(null)}).passthrough(),f$="omb-computer-panel-width",Qy=360,Xy=960,vIe=400,iB=40;function kIe(){try{const e=Number(localStorage.getItem(f$));if(Number.isFinite(e)&&e>=Qy&&e<=Xy)return e}catch{}return vIe}function wIe({bot:e,onOpenVmWorkspace:t}){const{padClass:a}=Ap(),[o,i]=f.useState(kIe),s=f.useRef(null),r=Ee=>{try{localStorage.setItem(f$,String(Ee))}catch{}},c=Ee=>{s.current={x:Ee.clientX,width:o},Ee.currentTarget.setPointerCapture(Ee.pointerId)},d=Ee=>{if(!s.current)return;const ct=Math.min(Xy,Math.max(Qy,s.current.width+(s.current.x-Ee.clientX)));i(ct)},p=Ee=>{s.current&&(s.current=null,Ee.currentTarget.releasePointerCapture(Ee.pointerId),r(o))},h=Ee=>{i(ct=>{const vt=Math.min(Xy,Math.max(Qy,ct+Ee));return r(vt),vt})},g=f.useRef(null),[b,x]=f.useState(null);f.useEffect(()=>{const Ee=g.current?.closest("aside");if(!Ee)return;const ct=()=>x(Ee.offsetWidth);ct();const vt=new ResizeObserver(ct);return vt.observe(Ee),()=>vt.disconnect()},[]);const v=Ee=>{if(Ee.ctrlKey||Ee.metaKey||Ee.altKey)return;const ct=Ee.key==="ArrowLeft"?iB:Ee.key==="ArrowRight"?-iB:null;ct===null||b===null||(Ee.preventDefault(),h(ct))},{state:k,dispatch:w,flushBotPatches:N}=ke(),C=e.tasks?.find(Ee=>Ee.threadId===e.threadId),j=Fj(e,C),M=_r(e),E=`${e.id}:${e.threadId}:${j}:${e.cloudBackend??"box"}:${M.modelSelection.instanceId}`,[A,R]=f.useState(null),B=A?.key===E,O=j!=="auto"||B,T={...M,computer:j==="auto"?B?A.surface:void 0:j},z=`${T.id}:${T.threadId}:${T.computer}:${T.cloudBackend??"box"}`,P=f.useRef(z);P.current=z;const L=f.useRef(null);f.useEffect(()=>()=>L.current?.abort(),[z]);const G=!!T.busy,H=f.useCallback(Ee=>`/api/bots/${e.id}/${Ee}?threadId=${encodeURIComponent(e.threadId)}`,[e.id,e.threadId]),$=e.computer==="cloud"&&j==="cloud",U=e.computer==="vm",{capabilities:Q,ready:W}=ya(),q=Q.localComputer.available,Y=Q.host.platform==="linux",ae=HS(k.instances,T),F=$S({capabilities:Q,providerSupportsLocal:ae}),[pe,ge]=f.useState(null),Ne=Nz({capabilities:Q,providerSupportsLocal:ae}),[ee,X]=f.useState("checking"),[oe,ne]=f.useState(null),[Ce,le]=f.useState(null),[re,xe]=f.useState(null),Te=T.cloudBackend??"box",nt=!!(oe&&oe.botId===T.id&&oe.computer===e.computer&&oe.cloudBackend===Te&&oe.section===(T.section?.trim()??"")),be=!!(Ce&&Ce.botId===T.id&&Ce.threadId===T.threadId&&Ce.computer===T.computer&&Ce.cloudBackend===Te),Ye=be&&j==="auto"&&Te==="box"&&re?.botId===T.id&&re.section===(T.section?.trim()??"")?re:null,ue=be&&fpe({computer:T.computer,cloudBackend:Te,phase:ee,botId:T.id,resolvedBotId:Ce?.botId??null,resolvedComputer:Ce?.computer??null,resolvedCloudBackend:Ce?.cloudBackend??null}),we=f.useCallback(Ee=>{le(null),xe(null),X("checking"),w({type:"updateBot",botId:T.id,patch:Ee})},[T.id,w]);f.useEffect(()=>{let Ee=!0;return ne(null),N(T.id).then(ct=>{Ee&&(ct&&!bpe({computer:e.computer,cloudBackend:Te,persistedBot:ct})||ct&&(ct.section?.trim()??"")!==(T.section?.trim()??"")||ne({botId:T.id,computer:e.computer,cloudBackend:Te,section:T.section?.trim()??""}))}),()=>{Ee=!1}},[T.id,e.computer,T.section,Te,N]);const[me,$e]=f.useState(null),[Re,de]=f.useState(null),[Ve,ce]=f.useState(null),[Le,tt]=f.useState(!1),[st,Ae]=f.useState(0),[We,Ie]=f.useState(null),[et,gt]=f.useState(null),[yt,Mt]=f.useState(null),[an,pn]=f.useState(null),[_n,da]=f.useState(null),[Lt,Dt]=f.useState(null),[bn,En]=f.useState(!1),[Ge,ot]=f.useState(!1),[_e,Fe]=f.useState(null),Ft=aB(_e),[Ue,qt]=f.useState(()=>tB(T.id)),tn=eIe(),ze=tn.devices.length>0,[ft,Kt]=[q0(k.config),VS(k.config)],Ht=Yc(k.config)&&T.browser!==!1&&(ft||k.config?.browserEngine?.installable===!0),[nn,Fn]=f.useState(0);f.useEffect(()=>{if(j!=="auto"||!nt)return;const Ee=new AbortController;return R(null),Z(H("computer"),{signal:Ee.signal}).then(ct=>{if(Ee.signal.aborted)return;const vt=ct.surface;R({key:E,surface:vt==="cloud"||vt==="vm"||vt==="local"||vt==="browser"||vt==="off"?vt:void 0})}).catch(ct=>{Ee.signal.aborted||(Fe(ct instanceof Error?ct:String(ct)),X("error"))}),()=>Ee.abort()},[E,j,nt,H,nn]);const mn=f.useRef(0),Nt=k.instances.find(Ee=>Ee.instanceId===T.modelSelection.instanceId),Kn=Yc(k.config)&&ft&&Nt?.capabilities?.browserMcp===!0&&Nt.driverKind!=="boxAgent",ji=ft?Yc(k.config)?l("computer.err.browserEngine"):l("computer.err.browserOff"):_g(k.config),jo=Ee=>{qt(Ee),nB(T.id,Ee)},No=f.useRef(null);f.useEffect(()=>{const Ee=No.current;Ee===z&&!(T.computer==="browser"&&Ht)||(No.current=z,qt(T.computer==="browser"&&Ht?"browser":Ee===null?tB(T.id):"computer"))},[z,T.id,T.computer,Ht]),f.useEffect(()=>{let Ee=!0;const ct=window.ogb?.desktopViewer;ct?.currentState&&ct.currentState().then(kt=>{Ee&&ot(kt.open&&kt.contextId===T.id)}).catch(()=>{});const vt=ct?.onState(kt=>{kt.contextId===T.id&&ot(kt.open)});return()=>{Ee=!1,vt?.()}},[T.id]),f.useEffect(()=>{(!ze&&Ue==="android"||!Ht&&Ue==="browser"||!Kt&&Ue==="terminal")&&(qt("computer"),nB(T.id,"computer"))},[ze,T.id,Ht,Kt,Ue]),f.useEffect(()=>{mn.current=0},[T.id,T.computer]);const ni=!!(Nt?.snapshot.state==="available"&&Nt.capabilities?.computerMcp&&Nt.driverKind!=="boxAgent"),oi=!!(Nt?.capabilities?.computerMcp===!0&&Nt?.driverKind!=="boxAgent"),eo=Te==="vps"?oi:!!lg(k.instances,T.modelSelection.instanceId),go=k.routines.filter(Ee=>Ee.botId===T.id).sort((Ee,ct)=>Number(ct.enabled)-Number(Ee.enabled)||(Ee.nextRunAt??1/0)-(ct.nextRunAt??1/0)),ii=!!(k.config?.box.configured&&lg(k.instances,T.modelSelection.instanceId)?.snapshot.state==="available"),to=k.routineRuns.find(Ee=>Ee.botId===T.id&&["queued","running","waiting"].includes(Ee.status));f.useEffect(()=>{if(Ue!=="computer")return;let Ee=!0,ct;if(le(null),xe(null),X("checking"),de(null),ce(null),Ie(null),gt(null),Mt(null),pn(null),da(null),Fe(null),!(!nt||!O)){if(T.computer===void 0){X("auto-unavailable");return}if(T.computer==="off"){X("off");return}if(T.computer==="browser"){X("browser");return}if(T.computer==="local"){ae||Fe(new Ta("computer.err.localEngine")),X(W&&q&&ae?"local":"local-unavailable"),le({botId:T.id,threadId:T.threadId,computer:T.computer,cloudBackend:Te});return}if(T.computer==="vm"){if(!ni){Fe(new Ta("computer.err.vmEngine")),X("vm-unavailable");return}let vt;return Z(H("local-computer")).then(kt=>{if(!Ee)return;const Ot=kt;le({botId:T.id,threadId:T.threadId,computer:T.computer,cloudBackend:Te}),Mt(Ot);const Na=String(Ot.viewer_url??"");if(Na.startsWith("http")&>(Na),Ot.ready)mn.current=0,X("vm");else if(Ot.container==="running"&&Ot.imageMatches&&Ot.managed&&Ot.network==="loopback"&&Ot.security==="hardened"&&Ot.persistence==="durable"&&!Ot.desktopReady&&mn.current<15)mn.current+=1,Fe(null),X("checking"),vt=window.setTimeout(()=>Fn(si=>si+1),2e3);else{const si=Ot.mode==="per-bot"&&Ot.container==="missing"&&Ot.image&&Ot.create_supported;Fe(si?null:new Ta("computer.err.vmOpenSettings",Ot.problem,"computer.err.vmNotReady")),X("vm-unavailable")}}).catch(kt=>{Ee&&(Fe(kt.message),X("vm-unavailable"))}),()=>{Ee=!1,vt!==void 0&&window.clearTimeout(vt)}}if(T.computer==="cloud"&&!eo){Fe(new Ta("computer.err.cloudEngine")),X("error");return}if(!(T.computer!=="cloud"&&!W)){if(Te==="vps"){if(!oi){Fe(new Ta("computer.err.vpsEngine")),X("error");return}return Z(H("computer")).then(vt=>{if(!Ee)return;const kt=vt;if(pn(kt),le({botId:T.id,threadId:T.threadId,computer:T.computer,cloudBackend:Te}),!kt.configured){Fe(new Ta("computer.err.vpsAlias")),X("vps-unconfigured");return}if(kt.ready){$e(kt.container??null),X("ready");return}if(kt.managed&&kt.container!=="missing"&&!kt.imageMatches){Fe(kt.problem),X("vps-incompatible");return}if($)return X("starting"),Z(`/api/bots/${T.id}/computer/provision`,{method:"POST"}).then(Ot=>{Ee&&($e(Ot.container??null),Ot.ready?(le({botId:T.id,threadId:T.threadId,computer:T.computer,cloudBackend:Te}),X("ready")):(Fe(Ot.problem??new Ta("computer.err.vpsNotReady")),X("error")))});$e(kt.container??null),Fe(T.autoStartVps?new Ta("computer.err.vpsAuto",kt.problem,"computer.err.vpsNoContainer"):new Ta("computer.err.vpsManual",kt.problem,"computer.err.vpsNoContainer")),X(kt.container==="stopped"?"vps-stopped":"vps-unconfigured")}).catch(vt=>{Ee&&(Fe(vt.message),X("error"))}),()=>{Ee=!1}}return Z(H("computer")).then(vt=>{if(!Ee)return;const kt=gpe({computer:$?"cloud":void 0,configured:!!vt.configured,boxState:typeof vt.box?.state=="string"?vt.box.state:null,canUseCloud:eo,autoLocal:!1,teamComputer:typeof vt.teamComputer?.id=="string"&&typeof vt.teamComputer?.name=="string",busy:e.busy});if(le({botId:T.id,threadId:T.threadId,computer:T.computer,cloudBackend:Te}),!vt.configured&&T.computer==="cloud"&&!vt.teamComputer){X("unconfigured");return}if(kt==="team-box"){xe({id:vt.teamComputer.id,name:vt.teamComputer.name,botId:T.id,section:T.section?.trim()??""}),$e(typeof vt.box?.state=="string"?vt.box.state:vt.configured?"missing":"unavailable"),Fe(typeof vt.problem=="string"?vt.problem:null),X("team-box");return}if(kt==="attach-ready-box"||T.computer==="cloud"&&kt==="show-ready-box"){$e(typeof vt.box?.state=="string"?vt.box.state:null),X("ready");return}if(kt!=="ensure-box"){(kt==="show-ready-box"||kt==="show-sleeping-box"||kt==="show-pending-box")&&$e(typeof vt.box?.state=="string"?vt.box.state:null),X(kt);return}return X("starting"),Z(`/api/bots/${T.id}/computer/provision`,{method:"POST"}).then(Ot=>{Ee&&($e(Ot.state??null),le({botId:T.id,threadId:T.threadId,computer:T.computer,cloudBackend:Te}),X("ready"))})}).catch(vt=>{if(Ee){if(Ghe(vt)){X("busy-box");return}if(J3({status:Number(vt?.status??0),message:String(vt?.message??"")})){Fe(null),X("checking"),ct=window.setTimeout(()=>Fn(kt=>kt+1),2e3);return}Fe(vt.message),X("error")}}),()=>{Ee=!1,ct!==void 0&&window.clearTimeout(ct)}}}},[T.id,T.threadId,T.computer,T.section,T.autoStartVps,Te,nn,W,F,Y,ae,Nt?.driverKind,ni,eo,oi,k.config?.vps?.sshAlias,Ue,nt,O,$,H]),f.useEffect(()=>{if(ee!=="busy-box")return;let Ee=!0;const ct=()=>{if(!e.busy&&$){Fn(kt=>kt+1);return}Z(H("computer")).then(kt=>{if(!Ee)return;const Ot=typeof kt.box?.state=="string"?kt.box.state:null;mpe(Ot)&&($e(Ot),X("ready"))}).catch(()=>{})},vt=window.setInterval(ct,5e3);return()=>{Ee=!1,window.clearInterval(vt)}},[ee,H,e.busy,$]);const In=Dv(),Je=k.screens[T.id],Rt=Je?.threadId===T.threadId||!Je?.threadId&&(e.tasks?.length??0)<=1?Je:void 0,Ut=f.useRef({frame:Rt,at:0}),$n=f.useRef(T.busy);f.useEffect(()=>{$n.current=T.busy},[T.busy]),f.useEffect(()=>{if(!ue){Ut.current={frame:Rt,at:0};return}Ut.current.frame!==Rt&&(Ut.current={frame:Rt,at:0},ue&&Rt&&(Ut.current.at=Date.now(),de(Rt),ce(null),tt(!1)))},[Rt,ue]),f.useEffect(()=>{if(Ue!=="computer"||!ue||Ge||!In||Lt||bn)return;let Ee=!1,ct=-1/0,vt=null,kt=null;const Ot=new AbortController;ce(null),tt(!0);const Na=async()=>{if(Ee||Ot.signal.aborted||Date.now()-ct<(vt??($n.current?4e3:3e4))||$n.current&&Date.now()-Ut.current.at<1e4)return;Ee=!0,vt=null;const Fa=Date.now();try{const{png:oo,format:Gr}=await Z(H("computer/screenshot"),{method:"POST",signal:AbortSignal.any([Ot.signal,AbortSignal.timeout(9e4)])});if(!Ot.signal.aborted&&Ut.current.at<=Fa){if(typeof oo!="string"||!oo.trim())throw new Ta("computer.err.emptyFrame");de({png:oo,mime:Gr==="jpeg"?"image/jpeg":"image/png"}),ce(null),tt(!1),kt=null}}catch(oo){if(!Ot.signal.aborted&&Ut.current.at<=Fa)if(oo instanceof Qo&&J3(oo)){vt=1e3,kt??=Date.now();const Gr=Date.now()-kt>=1e4;ce(Gr?oo:null),tt(!Gr)}else kt=null,tt(!1),ce(oo instanceof Error&&oo.name==="TimeoutError"?new Ta("computer.err.frameTimeout"):oo instanceof Error?oo:new Ta("computer.err.screenUnavailable"))}finally{Ee=!1,ct=Date.now()}};Na();const si=setInterval(Na,1e3);return()=>{Ot.abort(),clearInterval(si)}},[Ue,ue,H,Te,Ge,In,Lt,bn,st]),f.useEffect(()=>{if(Ue!=="computer"||ee!=="vm"||!be||Ge||!In)return;const Ee=new AbortController;let ct=!1,vt=-1/0,kt=null,Ot=!0;const Na=async()=>{if(!(ct||Ee.signal.aborted)&&!(Date.now()-vt<(kt??(T.busy?3e3:3e4)))){ct=!0,kt=null;try{const{image:Fa}=await Z(H("local-computer/screenshot"),{method:"POST",signal:Ee.signal});!Ee.signal.aborted&&typeof Fa=="string"&&(Ie(Fa),ce(null))}catch(Fa){Ee.signal.aborted||(kt=5e3,Ot?Fe(Fa instanceof Error?Fa.message:String(Fa)):ce(Fa instanceof Error?Fa:new Ta("computer.err.screenUnavailable")))}finally{ct=!1,Ot=!1,vt=Date.now()}}};Na();const si=window.setInterval(()=>{Na()},T.busy?3e3:3e4);return()=>{Ee.abort(),window.clearInterval(si)}},[Ue,ee,be,H,Ge,In,T.busy,Fe,ce,Ie]);const[Wn,fo]=f.useState(null);f.useEffect(()=>{if(e.computer!=="vm"||!ni||!nt){fo(null);return}let Ee=!0;return Z(`/api/bots/${e.id}/local-computer`).then(ct=>{Ee&&fo(ct)}).catch(()=>{Ee&&fo(null)}),()=>{Ee=!1}},[e.id,e.computer,ni,nt]);const[ps,ms]=f.useState(0);f.useEffect(()=>{if(Ue!=="computer"||ee!=="local"||!be||!window.ogb||Y||!In)return;let Ee=!0;ms(0);const ct=async()=>{try{const kt=await window.ogb.screenFrame();Ee&&kt?da(kt):Ee&&ms(Ot=>Ot+1)}catch{Ee&&ms(kt=>kt+1)}};ct();const vt=setInterval(ct,T.busy?3e3:3e4);return()=>{Ee=!1,clearInterval(vt)}},[Ue,ee,be,Y,In,T.busy,T.id,T.threadId]);const ve=be?ee==="vm"?We:ee==="local"&&!Y?_n:ue||T.computer==="cloud"&&ee==="starting"?Re&&`data:${Re.mime};base64,${Re.png}`:null:null,ht=!!(ve&&(ee==="vm"&&et||ue)),At=k.computerControl[T.id]??{held:!1,helpReason:null};f.useEffect(()=>{let Ee=!0;return Z(`/api/bots/${T.id}/computer/control`).then(ct=>{if(!Ee)return;const vt=oB.parse(ct);w({type:"computerControl",botId:T.id,held:vt.held===!0,helpReason:vt.helpReason})}).catch(()=>{}),()=>{Ee=!1}},[T.id]);const hn=f.useCallback(async Ee=>{const ct=oB.parse(await Z(`/api/bots/${T.id}/computer/control`,{method:"POST",body:JSON.stringify({action:Ee})}));return w({type:"computerControl",botId:T.id,held:ct.held===!0,helpReason:ct.helpReason}),ct},[T.id,w]),Qi=f.useCallback(async()=>!0,[]),$s=f.useCallback(async Ee=>p4({action:Ee,syncNativeBrowser:Ue!=="browser",requestControl:hn,setNativeBrowserControl:Qi}),[Ue,hn,Qi]),bo=f.useCallback(async Ee=>{En(!0),Fe(null);try{return await $s(Ee),!0}catch(ct){return Fe(ct instanceof Error?ct.message:String(ct)),!1}finally{En(!1)}},[$s]),no=async()=>{const Ee=new AbortController;L.current=Ee;const ct=()=>!Ee.signal.aborted&&P.current===z;Dt("join"),En(!0),Fe(null);let vt=!1,kt=null;!window.ogb?.desktopViewer&&!window.ogb?.openExternal&&(kt=window.open("","_blank"),kt&&(kt.opener=null));try{if(At.held||(await $s("take"),vt=!0),!ct())throw new DOMException("The selected conversation changed","AbortError");let Ot=et;if(ue){const Na=await Z(H("computer/join"),{method:"POST",signal:Ee.signal});Ot=Na.joinUrl?.constructor===String?String(Na.joinUrl):null}if(!ct())throw new DOMException("The selected conversation changed","AbortError");if(!Ot)throw new Ta("computer.err.noDesktopLink");if(window.ogb?.desktopViewer){if(!await window.ogb.desktopViewer.open(Ot,l("computer.viewerTitle",{name:T.name}),T.id))throw new Ta("computer.err.openDesktop")}else if(kt)kt.location.replace(Ot);else if(window.ogb?.openExternal){if(!await window.ogb.openExternal(Ot))throw new Ta("computer.err.openDesktopLink")}else if(!window.open(Ot,"_blank","noopener"))throw new Ta("computer.err.popupBlocked")}catch(Ot){kt?.close(),vt&&await $s("release").catch(()=>{}),ue&&Te==="vps"&&await Z(H("computer/viewer-close"),{method:"POST",body:"{}"}).catch(()=>{}),ct()&&Fe(Ot instanceof Error?Ot:String(Ot))}finally{L.current===Ee&&(L.current=null,Dt(null),En(!1))}},Gs=Ee=>{Dt(Ee),Fe(null),Z(`/api/bots/${T.id}/computer/${Ee}`,{method:"POST"}).then(ct=>{Ee==="provision"&&($e(ct.container??null),ct.ready?(T.computer==="cloud"&&le({botId:T.id,threadId:T.threadId,computer:T.computer,cloudBackend:Te}),X("ready")):(Fe(ct.problem??new Ta("computer.err.vpsNotReady")),X("error"))),Ee==="sleep"&&(le(null),$e(Te==="vps"?"stopped":"archived"),X(Te==="vps"?"vps-stopped":"show-sleeping-box"))}).catch(ct=>{Fe(ct.message)}).finally(()=>Dt(null))},oc=async Ee=>{if(!((Ee==="vm-recreate"||Ee==="vm-delete")&&!window.confirm(Ee==="vm-delete"?l("computer.confirm.deleteVm",{name:T.name}):l("computer.confirm.replaceVm",{name:T.name})))){Dt(Ee),Fe(null),Mt(null),mn.current=0;try{if(Ee!=="vm-create"&&await Z(`/api/bots/${T.id}/local-computer/remove`,{method:"POST",body:"{}"}),Ee!=="vm-delete"){const ct=await Z(`/api/bots/${T.id}/local-computer/run`,{method:"POST",body:"{}"});Mt(ct),fo(ct),j==="vm"&&X(ct.ready?"vm":"checking")}else Mt(ct=>ct&&{...ct,container:"missing",ready:!1}),fo(ct=>ct&&{...ct,container:"missing",ready:!1}),j==="vm"&&X("vm-unavailable")}catch(ct){Fe(ct instanceof Error?ct.message:String(ct)),j==="vm"&&X("vm-unavailable")}finally{Dt(null),Fn(ct=>ct+1)}}},ao=async()=>{if(window.confirm(l("computer.confirm.replaceVps",{name:T.name}))){Dt("vps-replace"),Fe(null);try{await Z(`/api/bots/${T.id}/computer/remove`,{method:"POST",body:"{}"});const Ee=await Z(`/api/bots/${T.id}/computer/provision`,{method:"POST",body:"{}"});pn(Ee),$e(Ee.container??null),Ee.ready&&T.computer==="cloud"&&le({botId:T.id,threadId:T.threadId,computer:T.computer,cloudBackend:Te}),X(Ee.ready?"ready":"error"),Ee.ready||Fe(Ee.problem??new Ta("computer.err.vpsReplaceNotReady"))}catch(Ee){Fe(Ee instanceof Error?Ee.message:String(Ee)),X("error")}finally{Dt(null),Fn(Ee=>Ee+1)}}},Xi=()=>{window.sessionStorage.setItem("openmausbot.settings.section","computer"),w({type:"toggleAppSettings",open:!0})},Hp=()=>{w({type:"toggleAppSettings",open:!0,section:"connections"})},$p={checking:l("computer.phase.checking"),starting:l("computer.phase.starting"),"busy-box":l("computer.phase.busyBox"),unconfigured:l("computer.phase.unconfigured"),"auto-unavailable":l("computer.phase.autoUnavailable"),"team-box":"This bot uses a shared team computer. Open Team map to view or manage it.","show-ready-box":l("computer.phase.showReadyBox"),"show-sleeping-box":l("computer.phase.showSleepingBox"),"show-pending-box":l("computer.phase.showPendingBox"),"vps-unconfigured":l("computer.phase.vpsUnconfigured"),"vps-incompatible":l("computer.phase.vpsIncompatible"),"vps-stopped":l("computer.phase.vpsStopped"),"local-unavailable":Ne??l("computer.phase.localUnavailable"),"vm-unavailable":l("computer.phase.vmUnavailable"),browser:l("computer.phase.browser"),off:l("computer.phase.off"),error:l("computer.phase.error")};return n.jsxs(n.Fragment,{children:[n.jsxs("aside",{className:"animate-panel-in relative flex h-full shrink-0 flex-col border-l border-hairline/40 bg-panel",style:{width:o},children:[n.jsx("div",{ref:g,role:"separator","aria-orientation":"vertical","aria-label":l("computer.resizeAria"),"aria-valuemin":Qy,"aria-valuemax":Xy,"aria-valuenow":b??void 0,tabIndex:0,onKeyDown:v,onPointerDown:c,onPointerMove:d,onPointerUp:p,onPointerCancel:p,className:"absolute inset-y-0 left-0 z-10 w-1.5 cursor-col-resize hover:bg-accent/40 focus-visible:bg-accent/60"}),n.jsxs("div",{className:V("flex items-center justify-between px-4 py-3",a),children:[n.jsx("button",{onClick:()=>{w({type:"toggleComputer",open:!1}),w({type:"toggleSettings",open:!0,section:"access"})},className:"rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink",title:l("computer.botSettings"),children:n.jsx(Yh,{size:18})}),n.jsxs("div",{className:"mx-2 flex min-w-0 flex-wrap overflow-hidden rounded-lg border border-hairline/40","data-tour":"computer-tabs","aria-label":"Bot panel view",children:[n.jsxs("button",{onClick:()=>jo("computer"),"aria-pressed":Ue==="computer",className:V("flex items-center gap-1.5 px-2.5 py-1 text-[12.5px]",Ue==="computer"?"bg-control text-ink":"text-ink-secondary hover:text-ink"),children:[n.jsx(Ea,{size:13})," ",l("computer.tab.computer"),G&&HV(j)&&n.jsx("span",{className:"size-1.5 animate-pulse rounded-full bg-success",role:"img","aria-label":l("place.live"),"data-testid":"computer-tab-live"})]}),n.jsxs("button",{type:"button",onClick:()=>jo("routines"),"aria-pressed":Ue==="routines",className:V("flex items-center gap-1.5 border-l border-hairline/40 px-2.5 py-1 text-[12.5px]",Ue==="routines"?"bg-control text-ink":"text-ink-secondary hover:text-ink"),children:[n.jsx(Zu,{size:13}),l("computer.tab.routines")]}),ze&&n.jsxs("button",{onClick:()=>jo("android"),"aria-pressed":Ue==="android",className:V("flex items-center gap-1.5 border-l border-hairline/40 px-2.5 py-1 text-[12.5px]",Ue==="android"?"bg-control text-ink":"text-ink-secondary hover:text-ink"),children:[n.jsx(ld,{size:13})," ",l("computer.tab.android")]}),Ht&&n.jsxs("button",{"data-tour":"computer-browser",onClick:()=>{Fe(null),jo("browser")},"aria-pressed":Ue==="browser",className:V("flex items-center gap-1.5 border-l border-hairline/40 px-2.5 py-1 text-[12.5px]",Ue==="browser"?"bg-control text-ink":"text-ink-secondary hover:text-ink"),children:[n.jsx(Sr,{size:13})," ",l("computer.tab.browser"),G&&j==="browser"&&n.jsx("span",{className:"size-1.5 animate-pulse rounded-full bg-success",role:"img","aria-label":l("place.live"),"data-testid":"browser-tab-live"})]}),Kt&&n.jsx(pIe,{active:Ue==="terminal",onClick:()=>jo("terminal")})]}),n.jsx("button",{onClick:()=>w({type:"toggleComputer",open:!1}),className:"rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink",children:n.jsx(jt,{size:18})})]}),Ue==="routines"?n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 pb-4",children:n.jsx(r$,{bot:T,routines:go,runs:k.routineRuns,defaultRunOn:ii?"cloud":"maus"},T.id)}):Ue==="browser"&&Ht?n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col px-4 pb-4",children:[n.jsx(dIe,{bot:T}),Ft&&n.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:Ft})]}):Ue==="terminal"&&Kt?n.jsx(mIe,{bot:T},T.id):Ue==="android"&&ze?n.jsx("div",{className:"flex-1 overflow-y-auto px-4 pt-2",children:n.jsx(tIe,{status:tn})}):n.jsxs("div",{className:"flex-1 overflow-y-auto px-5 pb-5",children:[n.jsxs("div",{className:"mb-1.5 mt-2 flex items-center justify-between text-[13px] text-ink-secondary",children:[n.jsx("span",{children:l("computer.screenOf",{name:T.name})}),Ye&&n.jsx("span",{className:"text-[11px]",children:"Team default"}),ee==="local"&&n.jsx("span",{className:"text-[11px]",children:l("computer.badge.local")}),ee==="vm"&&n.jsx("span",{className:"text-[11px]",children:l("vm.dest.vm")}),(ee==="show-ready-box"||ee==="show-sleeping-box"||ee==="show-pending-box")&&n.jsx("span",{className:"text-[11px]",children:l("computer.badge.autoBox")}),be&&T.computer==="cloud"&&Te==="vps"&&(ee==="ready"||ee==="starting")&&n.jsx("span",{className:"text-[11px]",children:l("computer.badge.vps")})]}),n.jsx("div",{className:"relative flex aspect-[16/10] w-full items-center justify-center overflow-hidden rounded-xl bg-card",children:ue||T.computer==="cloud"&&ee==="starting"?n.jsx(Q9e,{src:ve,name:T.name,error:aB(Ve),refreshing:Le,retry:st,starting:ee==="starting",opening:Lt==="join",disabled:bn,onOpen:()=>{no()},onRetry:Ee=>{Ut.current.at=0,Ee&&de(null),ce(null),tt(!0),Ae(ct=>ct+1)}},`${T.id}:${T.threadId}:${T.computer}:${Te}`):ve&&ht?n.jsxs("button",{type:"button",onClick:()=>{no()},disabled:bn||Lt==="join",className:"group relative flex h-full w-full cursor-pointer items-center justify-center focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-wait","aria-label":l("computer.openLiveDesktopAria",{name:T.name}),title:l("computer.openLiveDesktop"),children:[n.jsx("img",{src:ve,alt:l("computer.screenOf",{name:T.name}),className:"h-full w-full object-contain transition group-hover:brightness-75 group-focus-visible:brightness-75"}),n.jsxs("span",{className:"pointer-events-none absolute right-2 top-2 flex items-center gap-1 rounded-md bg-black/70 px-2 py-1 text-[11px] font-medium text-white opacity-80 shadow-sm transition group-hover:opacity-100 group-focus-visible:opacity-100",children:[Lt==="join"?n.jsx(je,{size:12,className:"animate-spin"}):n.jsx(y0,{size:12}),l("computer.open")]})]}):ve?n.jsx("img",{src:ve,alt:l("computer.screenOf",{name:T.name}),className:"h-full w-full object-contain",title:ee==="vm"?l("computer.watchOnly"):void 0}):n.jsxs("div",{className:"flex flex-col items-center gap-2 px-6 text-center text-ink-secondary",children:[ee==="checking"||ee==="starting"||ee==="busy-box"||ee==="vm"||ee==="local"&&!Y?n.jsx(je,{size:18,className:"animate-spin"}):ee==="off"?n.jsx(_u,{size:22}):n.jsx(Ea,{size:22}),n.jsx("span",{className:"text-[12px]",children:Ye?`${Ye.name} · ${me??"unavailable"}`:ue?l("computer.waitingFrame"):ee==="ready"?l("computer.autoChooseCloudOpen"):ee==="vm"?l("computer.capturingVm"):ee==="local"?Y?l("computer.linuxReady"):ps>=3?l("computer.needsScreenPerm"):l("computer.capturingLocal"):$p[ee]}),Ye&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[12px]",children:"Shared files and signed-in accounts. Auto uses this Box, not a private computer."}),n.jsx("button",{type:"button",onClick:()=>w({type:"showTeamMap"}),className:"mt-1 rounded-lg bg-control px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover",children:"Open Team map"}),n.jsx("button",{type:"button",onClick:()=>Fn(Ee=>Ee+1),className:"text-[11px] text-ink-secondary hover:text-ink",children:"Refresh shared computer status"})]}),ee==="local"&&!Y&&ps>=3&&n.jsx("button",{onClick:()=>window.ogb?.permOpenSettings?.("screen"),className:"mt-1 rounded-lg bg-control px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover",children:l("computer.openSettings")}),ee==="browser"&&Ht&&n.jsx("button",{onClick:()=>jo("browser"),className:"mt-1 rounded-lg bg-control px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover",children:l("computer.openBrowserTab")}),(ee==="show-ready-box"||ee==="show-sleeping-box"||ee==="show-pending-box")&&n.jsx("button",{type:"button",onClick:()=>we({computer:"cloud"}),className:"mt-1 rounded-lg bg-control px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover",children:l(ee==="show-sleeping-box"?"computer.chooseCloudWake":ee==="show-ready-box"?"computer.chooseCloudOpen":"computer.chooseCloudManage")}),ee==="vm-unavailable"&&(U&&yt?.mode==="per-bot"&&yt.image&&yt.create_supported?n.jsxs("button",{onClick:()=>{oc(yt.container==="missing"?"vm-create":"vm-recreate")},disabled:Lt!==null,className:"mt-1 rounded-lg bg-accent px-3 py-1.5 text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[(Lt==="vm-create"||Lt==="vm-recreate")&&n.jsx(je,{size:13,className:"mr-1.5 inline animate-spin"}),yt.container==="missing"?l("computer.createVm",{name:T.name}):l("computer.replaceVm",{name:T.name})]}):n.jsx("button",{onClick:Xi,className:"mt-1 rounded-lg bg-control px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover",children:l("computer.openVmSetup")})),be&&(ee==="vps-unconfigured"||ee==="vps-stopped")&&n.jsx("button",{onClick:Hp,className:"mt-1 rounded-lg bg-control px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover",children:l("computer.openVpsSettings")}),be&&(ee==="vps-stopped"||ee==="vps-unconfigured"&&an?.configured)&&$&&n.jsxs("button",{onClick:()=>Gs("provision"),disabled:Lt==="provision",className:"mt-1 rounded-lg bg-control px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[Lt==="provision"&&n.jsx(je,{size:13,className:"mr-1.5 inline animate-spin"}),l(ee==="vps-stopped"?"computer.startVps":"computer.prepareVps")]}),be&&ee==="vps-incompatible"&&an?.managed&&$&&n.jsxs("button",{onClick:()=>{ao()},disabled:Lt==="vps-replace",className:"mt-1 rounded-lg bg-accent px-3 py-1.5 text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[Lt==="vps-replace"&&n.jsx(je,{size:13,className:"mr-1.5 inline animate-spin"}),l("computer.replaceVps")]})]})}),Ft&&n.jsx("div",{className:"mt-2 rounded-lg border border-danger/30 bg-danger/10 px-3 py-2 text-[12px] text-danger",children:Ft}),e.computer==="vm"&&j!=="vm"&&Wn?.mode==="per-bot"&&Wn.container==="missing"&&Wn.image&&Wn.create_supported&&n.jsxs("div",{className:"mt-3 rounded-xl border border-accent/20 bg-accent/5 p-4",children:[n.jsx("div",{className:"text-[13px] font-medium text-ink",children:l("computer.createVm",{name:T.name})}),n.jsx("div",{className:"mt-1 text-[12px] leading-5 text-ink-secondary",children:l("vm.setup.perBotHint")}),C?.surface&&n.jsxs("div",{className:"mt-1 text-[11.5px] text-ink-secondary",children:[l("place.pinnedNote",{place:l(td(C.surface))})," — start a new conversation to use this desktop, or create it here."]}),n.jsxs("button",{type:"button",onClick:()=>{oc("vm-create")},disabled:Lt!==null,className:"mt-2 rounded-lg bg-accent px-3 py-1.5 text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[(Lt==="vm-create"||Lt==="vm-recreate")&&n.jsx(je,{size:13,className:"mr-1.5 inline animate-spin"}),l("computer.createVm",{name:T.name})]})]}),e.computer==="vm"&&j!=="vm"&&Wn?.mode==="per-bot"&&Wn.container!=="missing"&&n.jsxs("div",{className:"mt-3 rounded-xl border border-hairline/40 bg-card p-4",children:[n.jsx("div",{className:"text-[13px] text-ink-secondary",children:l("computer.hint.vm")}),n.jsx("div",{className:"mt-1 text-[11.5px] text-ink-secondary",children:C?.surface?l("place.pinnedNote",{place:l(td(C.surface))}):l("computer.hint.vm")}),n.jsx("button",{type:"button",onClick:Xi,className:"mt-1 block font-medium text-accent hover:underline",children:l("computer.vmSettingsLink")})]}),ee==="unconfigured"&&n.jsxs("div",{className:"mt-3 rounded-xl bg-card p-4",children:[n.jsx("div",{className:"mb-3 text-[13px] text-ink-secondary",children:l("computer.addBoxKey")}),n.jsx(Dg,{section:"box",onSaved:Ee=>Ee&&Fn(ct=>ct+1)})]}),ee==="vps-unconfigured"&&n.jsxs("div",{className:"mt-3 rounded-xl bg-card p-4",children:[n.jsx("div",{className:"mb-3 text-[13px] text-ink-secondary",children:l("computer.vpsAliasHint")}),n.jsx("button",{onClick:Hp,className:"rounded-lg bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover",children:l("computer.openVpsSettings")})]}),ee==="vm"&&yt?.mode==="per-bot"&&window.ogb?.desktopWorkspace&&t&&n.jsxs("button",{type:"button",onClick:()=>t(T.id),disabled:Lt!==null,className:"mt-3 flex w-full items-center justify-center gap-2 rounded-lg border border-accent/30 bg-accent/10 py-2 text-[13px] font-medium text-ink hover:bg-accent/15 disabled:opacity-50",title:l("computer.twoDesktopsTitle"),children:[n.jsx(bJ,{size:14}),l("computer.twoDesktops")]}),(ue||ee==="vm"||Ye)&&At.helpReason&&!At.held&&n.jsxs("div",{className:"mt-3 rounded-xl border border-warning/25 bg-warning/10 p-4",children:[n.jsxs("div",{className:"text-[13px] leading-relaxed text-warning",children:[n.jsx("b",{children:T.name})," ",l("computer.askedHands")," ",At.helpReason]}),n.jsxs("div",{className:"mt-2 flex gap-2",children:[n.jsxs("button",{onClick:()=>ee==="vm"||ue?void no():bo("take"),disabled:bn||Lt==="join",className:"flex flex-1 items-center justify-center gap-2 rounded-lg bg-accent py-2 text-[13px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[Lt==="join"?n.jsx(je,{size:14,className:"animate-spin"}):n.jsx(Li,{size:14}),l("computer.takeControl")]}),n.jsx("button",{onClick:()=>bo("dismiss-help"),disabled:bn,className:"rounded-lg bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",children:l("computer.dismiss")})]})]}),(ue||ee==="vm"||Ye)&&At.held&&n.jsxs("div",{className:"mt-3 rounded-xl border border-accent/25 bg-accent/10 p-4",children:[n.jsxs("div",{className:"text-[13px] leading-relaxed text-ink",children:[l("computer.youHaveWheel"),ue&&` ${l("computer.useOpenDesktop")}`,ee==="vm"&&` ${l("computer.useOpenDesktopVm")}`]}),n.jsxs("button",{onClick:()=>{bo("release"),window.ogb?.desktopViewer?.close(T.id)},disabled:bn,className:"mt-2 flex w-full items-center justify-center gap-2 rounded-lg bg-accent py-2 text-[13px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[n.jsx(Li,{size:14}),l("computer.handBack")]})]}),ee==="vm"&&et&&At.held&&n.jsxs("button",{onClick:()=>{no()},disabled:Lt==="join",className:"mt-3 flex w-full items-center justify-center gap-2 rounded-lg bg-control py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",title:l("computer.openVmDesktopTitle"),children:[Lt==="join"?n.jsx(je,{size:14,className:"animate-spin"}):n.jsx(Ea,{size:14}),l("computer.openLiveDesktop")]}),ee==="vm"&&!At.held&&!At.helpReason&&n.jsxs("button",{onClick:()=>{no()},disabled:bn||Lt==="join"||!et,className:"mt-3 flex w-full items-center justify-center gap-2 rounded-lg bg-control py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",title:l("computer.takeControlVmTitle"),children:[Lt==="join"?n.jsx(je,{size:14,className:"animate-spin"}):n.jsx(Li,{size:14}),l("computer.takeControl")]}),U&&ee==="vm"&&yt?.mode==="per-bot"&&n.jsxs("button",{onClick:()=>{oc("vm-delete")},disabled:Lt!==null||e.busy,className:"mt-2 flex w-full items-center justify-center gap-2 rounded-lg border border-danger/30 py-2 text-[13px] text-danger hover:bg-danger/10 disabled:opacity-50",title:e.busy?l("computer.deleteVmBlocked"):l("computer.deleteVmTitle",{name:T.name}),children:[Lt==="vm-delete"?n.jsx(je,{size:14,className:"animate-spin"}):n.jsx(_u,{size:14}),l("computer.deleteVm")]}),ue&&n.jsxs("div",{className:"mt-3 flex gap-2",children:[!At.held&&!At.helpReason&&n.jsxs("button",{onClick:()=>{no()},disabled:bn||Lt==="join",className:"flex flex-1 items-center justify-center gap-2 rounded-lg bg-control py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",title:l("computer.takeControlTitle"),children:[Lt==="join"?n.jsx(je,{size:14,className:"animate-spin"}):n.jsx(Li,{size:14}),l("computer.takeControl")]}),At.held&&n.jsxs("button",{onClick:()=>{no()},disabled:Lt==="join",className:"flex flex-1 items-center justify-center gap-2 rounded-lg bg-control py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[Lt==="join"?n.jsx(je,{size:14,className:"animate-spin"}):n.jsx(Ea,{size:14}),l("computer.openLiveDesktop")]}),$&&(Te==="vps"||me!=="archived")&&n.jsxs("button",{onClick:()=>Gs("sleep"),disabled:Lt==="sleep"||e.busy,className:"flex flex-1 items-center justify-center gap-2 rounded-lg bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",title:l("computer.sleepTitle"),children:[Lt==="sleep"?n.jsx(je,{size:14,className:"animate-spin"}):n.jsx(BE,{size:14}),l("vm.cloud.sleep")]})]}),ee!=="team-box"&&(T.computer!==void 0||be)&&n.jsxs(n.Fragment,{children:[n.jsx(fIe,{}),n.jsx(yIe,{}),n.jsx(h$,{})]}),n.jsxs("div",{className:"mt-4 rounded-xl bg-card p-4",children:[n.jsx("div",{className:"text-[15px] font-medium text-ink",children:l("computer.worksOn")}),n.jsx("p",{className:"mt-1 text-[12px] leading-5 text-ink-secondary",children:l("computer.worksOnHint")}),n.jsx("div",{role:"group","aria-label":l("computer.destinationAria"),className:"mt-3 grid auto-rows-fr grid-cols-2 gap-2",children:[[null,"vm.dest.auto","computer.dest.autoDesc",So],["cloud","vm.dest.cloud","computer.dest.cloudDesc",_s],["vm","vm.dest.vm","computer.dest.vmDesc",$h],["local","vm.dest.local","computer.dest.localDesc",Ea],["browser","vm.dest.browser","computer.dest.browserDesc",Sr],["off","vm.dest.off","computer.dest.offDesc",_u]].map(([Ee,ct,vt,kt])=>{const Ot=Ee===null?!e.computer:e.computer===Ee,Na=k.config?.managedPolicy,si=Ee==="local"?"thisComputer":Ee==="vm"?"localVm":Ee==="cloud"?e.cloudBackend==="vps"?"vps":"box":null,Fa=Na&&si&&!Na.computers[si]?l("policy.managedBy",{organization:Na.organizationName}):void 0,oo=!!Fa||Ee==="cloud"&&!eo||Ee==="vm"&&!ni||Ee==="local"&&!F||Ee==="browser"&&!Kn,Gr=Fa??(Ee==="vm"&&!ni?l("computer.unavailableVm"):Ee==="cloud"&&!eo?l("computer.unavailableCloud"):Ee==="local"&&!F?Ne??l("computer.unavailableLocal"):Ee==="browser"?Kn?l("computer.browserOnlyTitle"):ji:void 0);return n.jsxs("button",{disabled:oo,title:Gr,onClick:()=>{Ee===null&&e.computer===void 0||Ee===e.computer||(Ee==="local"&&Jo(e)==="auto"?ge(T.id):Ee==="browser"?we({computer:Ee,browser:!0}):Ee==="cloud"&&!k.config?.box.configured&&e.cloudBackend!=="vps"?we({computer:Ee,cloudBackend:"vps"}):we({computer:Ee}))},type:"button","aria-pressed":Ot,className:V("min-w-0 rounded-lg border px-2.5 py-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-card",Ot?"border-accent/60 bg-accent/10 text-ink":"border-hairline/50 bg-panel/30 text-ink-secondary",oo?"cursor-not-allowed":"hover:border-accent/40 hover:bg-control/60"),children:[n.jsxs("span",{className:"flex items-center gap-2 text-[12px] font-medium leading-4",children:[Ot?n.jsx(mt,{size:14,className:"shrink-0 text-accent"}):n.jsx(kt,{size:14,className:"shrink-0 text-ink-secondary"}),n.jsx("span",{children:l(ct)})]}),n.jsx("span",{className:"mt-1.5 block text-[11px] leading-4 text-ink-secondary",children:Fa??l(oo?"computer.unavailableHere":vt)})]},Ee??"auto")})}),C?.surface&&n.jsx("p",{className:"mt-2 text-[11.5px] leading-5 text-ink-secondary","data-testid":"place-pinned-note",children:l("place.pinnedNote",{place:l(td(C.surface))})}),e.computer==="cloud"&&n.jsx(n.Fragment,{children:n.jsx(Pz,{compact:!0,value:Te,vpsSupported:oi,boxAvailable:!!k.config?.box.configured,onChange:Ee=>we({cloudBackend:Ee})})}),e.computer!=="cloud"&&n.jsx("div",{className:"mt-3 border-t border-hairline/40 pt-3 text-[11.5px] leading-5 text-ink-secondary","aria-live":"polite",children:e.computer?e.computer==="vm"?n.jsxs(n.Fragment,{children:[l("computer.hint.vm"),n.jsx("button",{type:"button",onClick:Xi,className:"mt-1 block font-medium text-accent hover:underline",children:l("computer.vmSettingsLink")})]}):e.computer==="local"?l("computer.hint.local"):e.computer==="browser"?l("computer.hint.browser"):l("computer.hint.off"):Ye?`Auto uses ${Ye.name}, shared with this team's other Auto bots. Choosing another destination overrides the team default.`:Te==="vps"&&T.autoStartVps?l("computer.hint.vpsAuto"):l(F&&!Y?"computer.hint.autoLocal":"computer.hint.autoCloud")})]}),n.jsxs("button",{type:"button",onClick:()=>jo("routines"),className:"mt-4 flex w-full items-start gap-3 rounded-xl bg-card p-4 text-left hover:bg-raised",children:[n.jsx(Zu,{size:17,className:"mt-0.5 shrink-0 text-accent"}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsxs("span",{className:"block text-[14px] font-medium text-ink",children:[l("computer.tab.routines")," ",n.jsx("span",{className:"ml-1 text-[11px] text-ink-secondary",children:go.length})]}),n.jsx("span",{className:V("mt-1 block truncate text-[11.5px]",to?oC(to):"text-ink-secondary"),children:to?`${to.routineName} · ${cp(to)}`:l("computer.routines.openTitle")})]}),n.jsx("span",{className:"text-ink-secondary","aria-hidden":"true",children:"→"})]})]})]}),n.jsx(Fg,{open:pe!==null,onCancel:()=>ge(null),onConfirm:()=>{const Ee=pe;ge(null),Ee&&(Ee===T.id&&(le(null),X("checking")),w({type:"updateBot",botId:Ee,patch:{computer:"local",acknowledgeLocalAuto:!0}}))}})]})}function SIe(e){if(typeof e!="string"||!e)throw new Error("The host did not return a live desktop link");return e.startsWith("/vps-viewer/")?new URL(e,window.location.origin).toString():e}function CIe(e){if(e.schedule.type==="cron")return qg(e.schedule);if(e.schedule.type==="once")return new Date(e.schedule.at).toLocaleString([],{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"});if(e.schedule.type==="interval")return`${e.schedule.everyMinutes%60===0?`Every ${e.schedule.everyMinutes/60} hr`:`Every ${e.schedule.everyMinutes} min`} · starting ${new Date(e.schedule.anchorAt).toLocaleString([],{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}`;const t=e.schedule.weekdays,a=t.length===7?"Every day":t.join(",")==="1,2,3,4,5"?"Weekdays":t.map(s=>["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][s]).join(", "),[o,i]=e.schedule.time.split(":").map(Number);return`${a} · ${new Date(2e3,0,1,o,i).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}`}function jIe(e){if(e==null)return"Paused";const t=new Date(e),a=new Date;return`${t.toDateString()===a.toDateString()?"Today":t.toLocaleDateString([],{month:"short",day:"numeric"})}, ${t.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}`}function NIe({bot:e}){const{state:t,dispatch:a}=ke(),{padClass:o}=Ap(),[i,s]=f.useState(!1),[r,c]=f.useState(null),[d,p]=f.useState(null),[h,g]=f.useState(!0),[b,x]=f.useState(!1),[v,k]=f.useState(!1),w=Dv(),N=f.useRef(e.busy);f.useEffect(()=>{N.current=e.busy},[e.busy]);const[C,j]=f.useState(!1),M=t.routines.filter(B=>B.botId===e.id).sort((B,O)=>Number(O.enabled)-Number(B.enabled)||(B.nextRunAt??1/0)-(O.nextRunAt??1/0)),E=t.routineRuns.find(B=>B.botId===e.id&&["queued","running","waiting"].includes(B.status)),A=!!(t.config?.box.configured&&lg(t.instances,e.modelSelection.instanceId)?.snapshot.state==="available");f.useEffect(()=>{p(null),g(!0),x(!1)},[e.id]),f.useEffect(()=>{const B=window.ogb?.desktopViewer;if(!B)return;let O=!0;B.currentState().then(z=>{O&&k(z.open&&z.contextId===e.id)}).catch(()=>{});const T=B.onState(z=>{(z.contextId===e.id||!z.open)&&k(z.open&&z.contextId===e.id)});return()=>{O=!1,T()}},[e.id]),f.useEffect(()=>{if(!w||v||i)return;const B=new AbortController;let O=!1,T=-1/0,z=null,P=null;const L=async()=>{if(!(O||B.signal.aborted)&&!(Date.now()-T<(z??(N.current?4e3:3e4)))){O=!0,z=null;try{const H=Khe(await Z(`/api/bots/${e.id}/computer/screenshot`,{method:"POST",body:"{}",signal:AbortSignal.any([B.signal,AbortSignal.timeout(9e4)])}));!B.signal.aborted&&H?(p(H),x(!1),P=null):B.signal.aborted||x(!0)}catch(H){if(!B.signal.aborted)if(H instanceof Qo&&J3(H)){z=1e3,P??=Date.now();const $=Date.now()-P>=1e4;x($),g(!$)}else P=null,x(!0)}finally{!B.signal.aborted&&z===null&&g(!1),O=!1,T=Date.now()}}};L();const G=window.setInterval(L,1e3);return()=>{B.abort(),window.clearInterval(G)}},[e.id,w,v,i]);const R=async()=>{s(!0),c(null);let B=!1;try{if(!window.ogb?.desktopViewer)throw new Error("The desktop viewer is unavailable in this build");await Z(`/api/bots/${e.id}/computer/control`,{method:"POST",body:JSON.stringify({action:"take"})}),B=!0;const O=await Z(`/api/bots/${e.id}/computer/join`,{method:"POST",body:"{}"});if(!await window.ogb.desktopViewer.open(SIe(O.joinUrl),`${e.name}'s live desktop`,e.id))throw new Error("Atomic could not open the live desktop")}catch(O){B&&await Z(`/api/bots/${e.id}/computer/control`,{method:"POST",body:JSON.stringify({action:"release"})}).catch(()=>{}),await Z(`/api/bots/${e.id}/computer/viewer-close`,{method:"POST",body:"{}"}).catch(()=>{}),c(O instanceof Error?O.message:String(O))}finally{s(!1)}};return n.jsxs("aside",{className:"relative z-20 flex h-full w-[400px] shrink-0 flex-col border-l border-hairline bg-panel",children:[n.jsxs("div",{className:V("flex items-center justify-between border-b border-hairline px-5 py-4",o),children:[n.jsxs("div",{children:[n.jsxs("div",{className:"text-[14px] font-medium text-ink",children:[e.name,"'s computer"]}),n.jsx("div",{className:"mt-0.5 text-[11px] text-ink-secondary",children:e.cloudBackend==="vps"?"Self-hosted VPS":"Cloud desktop"})]}),n.jsx("button",{type:"button",onClick:()=>a({type:"toggleComputer",open:!1}),className:"rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink","aria-label":"Close computer panel",children:n.jsx(jt,{size:18})})]}),n.jsxs("div",{className:"flex flex-1 flex-col items-center gap-4 overflow-y-auto px-6 py-5 text-center",children:[n.jsxs("button",{type:"button",onClick:()=>{R()},disabled:i||!d,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":d?`Open ${e.name}'s live desktop`:"VPS preview unavailable",children:[d?n.jsx("img",{src:d,alt:`${e.name}'s VPS desktop preview`,className:"h-full w-full object-contain"}):h?n.jsx(je,{size:22,className:"animate-spin text-ink-secondary"}):n.jsxs("div",{className:"flex flex-col items-center gap-2 text-ink-secondary",children:[n.jsx(Kh,{size:24}),n.jsx("span",{className:"text-[11px]",children:b?"Preview unavailable":"Waiting for preview"})]}),d&&n.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:"Open live desktop"})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[14px] font-medium text-ink",children:"Open the live desktop"}),n.jsx("p",{className:"mt-2 text-[12px] leading-relaxed text-ink-secondary",children:"The host creates a temporary, encrypted viewer relay. VPS SSH and VNC credentials stay on the host computer."})]}),n.jsxs("button",{type:"button",onClick:()=>{R()},disabled:i,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:[i?n.jsx(je,{size:15,className:"animate-spin"}):n.jsx(Ea,{size:15}),i?"Opening…":"Take control"]}),r&&n.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:r}),n.jsx("p",{className:"text-[11px] leading-relaxed text-ink-tertiary",children:"The host must enable cloud desktop access for this paired device in Settings → Remote access."}),n.jsxs("div",{className:"w-full rounded-xl bg-card p-4 text-left",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[15px] font-medium text-ink",children:[n.jsx(Zu,{size:16,className:"text-accent"}),"Scheduled tasks"]}),M.length>0&&n.jsx("span",{className:"rounded-full bg-control px-2 py-0.5 text-[10px] font-medium text-ink-secondary",children:M.length})]}),E&&n.jsxs("button",{type:"button",onClick:()=>a({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:[n.jsx(je,{size:13,className:E.status==="queued"?"":"animate-spin"}),n.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[E.routineName," · ",E.status==="waiting"?"needs you":E.status]})]}),M.length>0&&n.jsx("div",{className:"mt-3 space-y-1.5",children:M.slice(0,3).map(B=>n.jsxs("button",{type:"button",onClick:()=>a({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:[n.jsx("span",{className:V("size-1.5 shrink-0 rounded-full",B.enabled?"bg-success":"bg-ink-secondary/40")}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate text-[12.5px] font-medium text-ink",children:B.name}),n.jsxs("span",{className:"block truncate text-[10.5px] text-ink-secondary",children:[CIe(B),B.runOn==="cloud"?" · runs on VM":""]})]}),n.jsx("span",{className:"shrink-0 text-[10px] text-ink-secondary",children:jIe(B.nextRunAt)})]},B.id))}),n.jsxs("div",{className:"mt-3 flex gap-2",children:[n.jsxs("button",{type:"button",onClick:()=>j(!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:[n.jsx(Sn,{size:14}),"Create schedule"]}),n.jsxs("button",{type:"button",onClick:()=>a({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:"Open schedules",children:[n.jsx(Qu,{size:14}),"Schedules"]})]})]})]}),C&&n.jsx(lC,{bots:[e],lockedBotId:e.id,defaultRunOn:A?"cloud":"maus",onClose:()=>j(!1)})]})}const AIe={usage_limited:"usage limit",auth_failed:"sign-in failed",stalled:"not responding",rate_limited:"rate limited",request_rejected:"request refused",provider_error:"provider error"},Iu=(e,t=120)=>e.length>t?`${e.slice(0,t-1)}…`:e,Pu=e=>e.replace(/\s+/g," ").trim(),sB=119;function rB(e,t){const a=e?{...e}:{text:"",pendingSpace:!1,overflow:!1};if(a.overflow)return a;for(const o of t){if(/\s/.test(o)){a.text&&(a.pendingSpace=!0);continue}if(a.pendingSpace){if(a.text.length>=sB){a.overflow=!0;break}a.text+=" ",a.pendingSpace=!1}if(a.text.length>=sB){a.overflow=!0;break}a.text+=o}return a}const lB=e=>`${e.text}${e.overflow?"…":""}`;function MIe(e){switch(e.type){case"session.started":return{summary:`session ${e.sessionId??"(none)"}${e.model?` · ${e.model}`:""}`,tone:"plain"};case"session.model-fallback":return{summary:`model fallback · ${e.requested} refused, running ${e.model} · ${e.reason}`,tone:"boundary"};case"session.exited":return{summary:`session exited${e.reason?` · ${e.reason}`:""}`,tone:"plain"};case"turn.started":return{summary:`turn started${e.turnId?` · ${e.turnId.slice(0,8)}`:""}`,tone:"boundary"};case"turn.retrying":return{summary:`retrying (${e.reason}) · attempt ${e.attempt} · ${Math.round(e.delayMs/1e3)}s`,tone:"plain"};case"turn.engine_failover":return{summary:`engine switched (${AIe[e.reason]??e.reason}) · ${e.from.label} → ${e.to.label}${e.toClass?` (${e.toClass}${e.droppedClass?", another class":""})`:""}`,tone:"boundary"};case"turn.answer_check":{const t=[`answer check (Jev) · ${e.decision}`];return typeof e.probability=="number"&&t.push(`p=${e.probability.toFixed(2)} vs ${e.threshold.toFixed(2)}`),e.reason&&t.push(e.reason),e.rerunTo&&t.push(`re-run on ${e.rerunTo.label}`),e.latencyMs&&t.push(`${e.latencyMs} ms`),e.costUsd&&t.push(`$${e.costUsd.toFixed(6)}`),{summary:t.join(" · "),tone:e.decision==="rerun"?"boundary":"plain"}}case"turn.completed":{const t=[e.ok?"turn ok":"turn failed"];return e.stopReason&&t.push(e.stopReason),typeof e.cost=="number"&&t.push(`$${e.cost.toFixed(4)}`),e.denials?.length&&t.push(`${e.denials.length} denied`),{summary:t.join(" · "),tone:e.ok?"boundary":"error"}}case"turn.wait_started":return{summary:`waiting for computer — ${e.holder?`${e.holder.name}${e.holder.task?` (${e.holder.task})`:""}`:"holder unknown"}`,tone:"plain"};case"turn.wait_ended":{const t=Math.round(e.waitedMs/1e3),a=e.waitedMs<1e3?"under a second":`${t}s`;return e.outcome==="acquired"?{summary:`computer acquired after ${a}`,tone:"boundary"}:e.outcome==="gave_up"?{summary:`computer wait gave up after ${a}`,tone:"error"}:{summary:`computer wait stopped after ${a}`,tone:"plain"}}case"item.started":return{summary:`${e.itemType}${e.title?`: ${Iu(Pu(e.title))}`:" started"}`,tone:"plain"};case"item.updated":return{summary:`${e.itemType} updated${typeof e.tokens=="number"?` · ${e.tokens} tok`:""}`,tone:"plain"};case"item.completed":return e.itemType==="assistant_text"?{summary:`assistant: ${Iu(Pu(e.text))}`,tone:"plain"}:e.itemType==="assistant_image"?{summary:"assistant image generated",tone:"plain"}:{summary:`tool ${e.ok?"ok":"failed"}`,tone:e.ok?"plain":"error"};case"content.delta":return{summary:`${e.streamKind}: ${Iu(Pu(e.delta))}`,tone:"plain"};case"request.opened":return{summary:`${e.requestType}: ${e.tool} — ${Iu(Pu(e.summary))}`,tone:"plain"};case"request.resolved":return{summary:`resolved ${e.behavior} · ${e.source}`,tone:"plain"};case"thread.token-usage.updated":return{summary:`tokens in ${e.input} · out ${e.output}`,tone:"plain"};case"runtime.error":return{summary:`${e.setup?"setup: ":""}${Iu(Pu(e.message))}`,tone:"error"};default:return{summary:e.type,tone:"plain"}}}function IIe(e){const t=e.msg;if(!t||typeof t!="object")return String(e.msg);const a=typeof t.method=="string"?t.method:void 0,o=typeof t.type=="string"?t.type:void 0,i=t.id!==void 0?` #${String(t.id)}`:"";if(a)return`${a}${i}`;if(typeof t.event=="string"){const s=t.result?.status;return typeof s=="string"?`${t.event} · ${s}`:t.event}if(o){const s=t.message,r=typeof s?.role=="string"?` · ${s.role}`:"",c=typeof t.subtype=="string"?` · ${t.subtype}`:"";return`${o}${c}${r}`}return t.result!==void 0?`result${i}`:t.error!==void 0?`error${i}`:Iu(Pu(JSON.stringify(t)))}function PIe(e){const t=[];for(const[a,o]of e.entries()){if(o.kind==="native"){t.push({key:`n${a}`,kind:"native",at:o.at,tag:o.data.dir==="out"?"→ out":"← in",summary:`${o.data.source} · ${IIe(o.data)}`,tone:"plain",data:o.data,count:1});continue}const i=o.data,s=t.at(-1);if(i.type==="content.delta"&&s?.kind==="runtime"&&s.tag==="content.delta"&&s.data[0]?.type==="content.delta"&&s.data[0].streamKind===i.streamKind){const h=s.data;h.push(i),s.count=h.length,s.preview=rB(s.preview,i.delta),s.summary=`${i.streamKind}: ${lB(s.preview)}`;continue}const{summary:r,tone:c}=MIe(i),d=i.type==="content.delta"?rB(void 0,i.delta):void 0,p=i.type==="content.delta"?i.streamKind:void 0;t.push({key:i.eventId||`r${a}`,kind:"runtime",at:o.at,tag:i.type,summary:d&&p?`${p}: ${lB(d)}`:r,tone:c,data:i.type==="content.delta"?[i]:i,count:1,preview:d})}return t}function TIe(e){const t=new Date(e);if(Number.isNaN(t.getTime()))return"--:--:--";const a=String(t.getHours()).padStart(2,"0"),o=String(t.getMinutes()).padStart(2,"0"),i=String(t.getSeconds()).padStart(2,"0"),s=String(t.getMilliseconds()).padStart(3,"0");return`${a}:${o}:${i}.${s}`}const BIe=/^«redacted \d+ chars»$/,Ac=e=>BIe.test(e)?e:`«redacted ${e.length} chars»`,EIe=[/\bom[dg]_[A-Za-z0-9_-]{43}(?![A-Za-z0-9_-])/g,/\bsk-(?:ant-|proj-|live-|test-)?[A-Za-z0-9_-]{16,}/g,/\bxai-[A-Za-z0-9_-]{20,}/g,/\bgsk_[A-Za-z0-9]{40,}/g,/\bhf_[A-Za-z0-9]{30,}/g,/\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{20,}/g,/\bgithub_pat_[A-Za-z0-9_]{20,}/g,/\bxox[abposr]-[A-Za-z0-9-]{20,}/g,/\bAKIA[0-9A-Z]{16}\b/g,/\bAIza[0-9A-Za-z_-]{30,}/g,/\bnpm_[A-Za-z0-9]{20,}/g,/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g],RIe=/(\bBearer\s+)([A-Za-z0-9._~+/=-]{12,})/g,DIe=/(-----BEGIN [A-Z ]*PRIVATE KEY-----)([\s\S]*?)(-----END [A-Z ]*PRIVATE KEY-----)/g,OIe=/\b((?:[A-Za-z0-9_-]*_)?(?:api[_-]?key|apikey|secret|token|password|passwd|authorization|auth[_-]?token|access[_-]?key|private[_-]?key)s?)(["']?\s*[=:]\s*)(["']?)([A-Za-z0-9._~+/=-]{8,})\3/gi,zIe=/\b([A-Za-z][A-Za-z0-9_-]*[_-]key)s?(=)(["']?)([A-Za-z0-9._~+/=-]+)\3/gi,LIe=/(--(?:token|password|passwd|api-key|apikey|secret|access-key|auth-token)(?:=|\s+))(["']?)(?!-)([A-Za-z0-9._~+/=-]+)\2/gi,_Ie=/(\b[a-z][a-z0-9+.-]*:\/\/[^\s/:@'"]+:)([^\s/@'"«»]+)(@)/gi;function m4(e){if(!e||e.length<8)return e;let t=e;t=t.replace(DIe,(a,o,i,s)=>`${o}
|
|
584
584
|
${Ac(i.trim())}
|
|
585
585
|
${s}`);for(const a of EIe)t=t.replace(a,o=>Ac(o));return t=t.replace(RIe,(a,o,i)=>`${o}${Ac(i)}`),t=t.replace(OIe,(a,o,i,s,r)=>`${o}${i}${s}${Ac(r)}${s}`),t=t.replace(zIe,(a,o,i,s,r)=>`${o}${i}${s}${Ac(r)}${s}`),t=t.replace(LIe,(a,o,i,s)=>`${o}${i}${Ac(s)}${i}`),t=t.replace(_Ie,(a,o,i,s)=>`${o}${Ac(i)}${s}`),t}function FIe(e){const t=[];let a=!1;for(const o of e)if(o.kind==="text"&&o.role==="user"&&o.text?.trim())t.push({id:o.id,at:o.at,label:a?"User input":"Task started",state:"observed",kind:"task"}),a=!0;else if(o.kind==="activity"&&o.tool){const i=o.tool.ok===!1||o.tool.name.startsWith("error:");t.push({id:o.id,at:o.at,label:m4(i?o.tool.name.replace(/^error:\s*/i,""):o.tool.name),...o.tool.summary?{command:m4(o.tool.summary)}:{},state:i?"failed":o.tool.ok===!0?"complete":"running",kind:"tool"})}else o.kind==="screen"?t.push({id:o.id,at:o.at,label:"Screen observed",state:"observed",kind:"screen"}):o.kind==="text"&&o.role==="bot"&&o.text?.trim()&&t.push({id:o.id,at:o.at,label:"Response recorded",state:"complete",kind:"result"});return t}function qIe(e){return m4(e.map(t=>`[${new Date(t.at).toISOString()}] ${t.state} · ${t.label}${t.command?`
|
|
586
586
|
${t.command}`:""}`).join(`
|
|
@@ -603,7 +603,7 @@ ${s}`);for(const a of EIe)t=t.replace(a,o=>Ac(o));return t=t.replace(RIe,(a,o,i)
|
|
|
603
603
|
`&&r++,a.push(o),t.push(a),a=[],o=""):o+=c}return(o||a.length)&&(a.push(o),t.push(a)),t.filter(r=>r.some(c=>c.trim()))}const QBe={url:["url","login_uri","website","web site","uri","login url"],username:["username","login_username","user name","login","user","login name","email","e-mail"],password:["password","login_password","pwd","pass"],name:["name","title","account"],type:["type"],token:["token","api token","api_token","api key","api_key","apikey","access token","access_token","credential","secret","key"],header:["header","header name"],prefix:["prefix","scheme"],group:["vault","folder","grouping","collections","collection","category","tags"]};function XBe(e,t){const a=e.map(o=>o.trim().toLowerCase());for(const o of QBe[t]){const i=a.indexOf(o);if(i>=0)return i}return-1}const eEe=e=>e.split(/[,;]/).map(t=>t.trim()).filter(Boolean);function tEe(e){const[t,...a]=ZBe(e),o=t?XBe(t,"group"):-1;if(o<0)return[];const i=new Map;for(const s of a)for(const r of eEe(s[o]??""))i.set(r,(i.get(r)??0)+1);return[...i].map(([s,r])=>({name:s,count:r})).sort((s,r)=>s.name.localeCompare(r.name))}const nEe=["all","login","card","contact","apiKey"],wl="rounded-lg bg-control px-3 py-2 text-sm text-ink focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent disabled:opacity-50";function aEe(){const{state:e}=ke(),[t,a]=f.useState([]),[o,i]=f.useState("all"),[s,r]=f.useState(""),[c,d]=f.useState(""),[p,h]=f.useState(!1),[g,b]=f.useState(!1),[x,v]=f.useState(null),[k,w]=f.useState(null),[N,C]=f.useState(""),[j,M]=f.useState(null),E=f.useRef(0),A=f.useCallback(async()=>{const P=++E.current;try{const L=await Z("/api/vault",{timeoutMs:15e3});if(P!==E.current)return;a(L.items),h(!0),d("")}catch(L){P===E.current&&(d(L instanceof Error?L.message:l("vault.error")),h(!1))}},[]);f.useEffect(()=>(A(),()=>{E.current++}),[A]);async function R(){if(!(!k||g)){b(!0);try{await Z(`/api/vault/${k.id}`,{method:"DELETE",timeoutMs:15e3}),w(null),await A()}catch{d(l("vault.error"))}finally{b(!1)}}}async function B(){if(!g){b(!0),C(""),d("");try{const P=await Z("/api/vault/allow-all-bots",{method:"POST",timeoutMs:15e3});C(l("vault.allowedAllBots",{count:P.changed})),await A()}catch(P){d(P instanceof Error?P.message:l("vault.error"))}finally{b(!1)}}}async function O(P){if(!P||g)return;const L=await P.text(),G=tEe(L);G.length?(C(""),d(""),M({csv:L,groups:G,group:""})):await T(L,"")}async function T(P,L){b(!0),C(""),d("");try{const G=await Z("/api/vault/import",{method:"POST",body:JSON.stringify({csv:P,group:L}),timeoutMs:6e4});M(null),C(l("vault.imported",{added:G.added,duplicates:G.duplicates,skipped:G.skipped})+(G.needAddress?` ${l("vault.importedNeedAddress",{count:G.needAddress})}`:"")),await A()}catch(G){d(G instanceof Error?G.message:l("vault.error"))}finally{b(!1)}}if(x)return n.jsx(YBe,{item:typeof x=="string"?void 0:x,kind:typeof x=="string"?x:x.kind,bots:e.bots,onCancel:()=>v(null),onSaved:()=>{v(null),A()}});const z=t.filter(P=>(o==="all"||P.kind===o)&&[P.label,P.username??"",P.hints,...P.origins].join(" ").toLocaleLowerCase().includes(s.toLocaleLowerCase()));return n.jsxs("div",{className:"flex flex-col gap-4","aria-busy":g,children:[n.jsxs(lt,{title:l("vault.title"),subtitle:l("vault.description"),children:[c&&n.jsx("p",{role:"alert",className:"mb-3 text-sm text-danger",children:c}),n.jsxs("div",{className:"flex flex-wrap gap-2",children:[["login","card","contact","apiKey"].map(P=>n.jsx("button",{type:"button",className:wl,disabled:!p||g,onClick:()=>v(P),children:l(`vault.add.${P}`)},P)),n.jsxs("label",{className:`${wl} cursor-pointer has-[:disabled]:opacity-50`,children:[l("vault.importCsv"),n.jsx("input",{type:"file",accept:".csv,text/csv",className:"sr-only",disabled:!p||g,onChange:P=>{O(P.target.files?.[0]),P.target.value=""}})]}),n.jsx("button",{type:"button",className:wl,disabled:!p||g||!t.some(P=>!P.allBots&&(P.kind==="login"||P.kind==="apiKey")),onClick:()=>{B()},children:l("vault.allowAllBots")}),n.jsx("button",{type:"button",className:wl,onClick:()=>{A()},children:l("vault.refresh")})]}),n.jsx("p",{className:"mt-2 text-xs text-ink-secondary",children:l("vault.importHelp")}),j&&n.jsxs("div",{className:"mt-3 flex flex-wrap items-end gap-2",children:[n.jsxs("label",{className:"flex flex-col gap-1 text-sm text-ink-secondary",children:[l("vault.importGroup"),n.jsxs("select",{value:j.group,onChange:P=>M({...j,group:P.target.value}),className:"rounded-lg border border-hairline bg-field px-3 py-2 text-ink",children:[n.jsx("option",{value:"",children:l("vault.importGroupAll")}),j.groups.map(P=>n.jsxs("option",{value:P.name,children:[P.name," (",P.count,")"]},P.name))]})]}),n.jsx("button",{type:"button",className:wl,disabled:g,onClick:()=>{T(j.csv,j.group)},children:l("vault.importCsv")}),n.jsx("button",{type:"button",className:wl,disabled:g,onClick:()=>M(null),children:l("vault.importCancel")})]}),N&&n.jsx("p",{role:"status",className:"mt-2 text-sm text-ink",children:N}),!p&&!c&&n.jsx("p",{role:"status",className:"mt-3 text-sm text-ink-secondary",children:l("vault.loading")}),p&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"my-4 flex flex-wrap gap-2",role:"group","aria-label":l("vault.categories"),children:nEe.map(P=>n.jsxs("button",{type:"button",className:wl,"aria-pressed":o===P,onClick:()=>i(P),children:[l(`vault.category.${P}`)," ",t.filter(L=>P==="all"||L.kind===P).length]},P))}),n.jsxs("label",{className:"flex flex-col gap-1 text-sm text-ink-secondary",children:[l("vault.search"),n.jsx("input",{type:"search",value:s,onChange:P=>r(P.target.value),className:"rounded-lg border border-hairline bg-field px-3 py-2 text-ink"})]}),!z.length&&n.jsx("p",{role:"status",className:"py-8 text-center text-sm text-ink-secondary",children:t.length?l("vault.noMatches"):l("vault.empty")}),n.jsx("ul",{className:"mt-3 divide-y divide-hairline",children:z.map(P=>n.jsxs("li",{className:"flex flex-wrap items-center gap-2 py-3",children:[n.jsxs("button",{type:"button",onClick:()=>v(P),className:"min-w-0 flex-1 rounded-lg p-2 text-left text-ink hover:bg-control focus-visible:outline focus-visible:outline-accent",children:[n.jsx("span",{className:"block truncate font-medium",children:P.label}),n.jsx("span",{className:"block truncate text-xs text-ink-secondary",children:P.username??(P.lastFour?`•••• ${P.lastFour}`:l(`vault.category.${P.kind}`))}),P.kind==="apiKey"&&n.jsx("span",{className:"block text-xs text-ink-secondary",children:l("vault.secretStored")}),P.kind==="apiKey"&&!P.origins.length&&n.jsx("span",{className:"block truncate text-xs text-danger",children:l("vault.needsAddress")})]}),n.jsx("button",{type:"button",className:wl,onClick:()=>w(P),"aria-label":`${l("vault.remove")} ${P.label}`,children:l("vault.remove")})]},P.id))})]})]}),n.jsx("p",{className:"text-xs leading-relaxed text-ink-secondary",children:l("vault.privacy")}),n.jsx(na,{open:k!==null,title:l("vault.remove"),body:l("vault.removeBody"),confirmLabel:l("vault.remove"),onCancel:()=>w(null),onConfirm:()=>{R()},pending:g})]})}function oEe(){const e=window.ogb?.clipboardSettings,[t,a]=f.useState(null),[o,i]=f.useState(""),[s,r]=f.useState(""),[c,d]=f.useState(!1);f.useEffect(()=>{let h=!0;return e?.get().then(g=>{h&&(a(g),i(g.excludedApps.join(", ")))}).catch(()=>{h&&r("Clipboard history is unavailable. It requires the Mac or Windows desktop app and an unlocked operating-system keychain.")}),()=>{h=!1}},[e]);const p="rounded-lg border border-hairline bg-inset px-3 py-2 text-ink";return n.jsxs(lt,{title:"Clipboard",subtitle:"Private clipboard history on this Mac or Windows PC. Open the picker with Command+Shift+V on Mac or Control+Shift+V on Windows.",children:[!e&&n.jsx("p",{children:"Clipboard settings are available in the Mac and Windows desktop apps."}),s&&n.jsx("p",{role:"status",className:"mb-3 text-sm",children:s}),t&&n.jsx("form",{className:"flex flex-col gap-4",onSubmit:async h=>{h.preventDefault(),d(!0),r("");try{const g=await e.save({...t,excludedApps:o.split(",").map(b=>b.trim()).filter(Boolean)});a(g),i(g.excludedApps.join(", ")),r("Clipboard settings saved.")}catch{r("Settings could not be saved. Your edits are kept; try again.")}finally{d(!1)}},children:n.jsxs("fieldset",{disabled:c,className:"flex flex-col gap-4",children:[n.jsxs("label",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"checkbox",checked:!t.paused,onChange:h=>a({...t,paused:!h.target.checked})}),"Capture clipboard history"]}),n.jsxs("label",{className:"flex flex-col gap-1",children:["Keep unpinned clips for (days)",n.jsx("input",{className:p,type:"number",required:!0,min:1,max:365,value:t.retentionDays,onChange:h=>a({...t,retentionDays:Number(h.target.value)})})]}),n.jsxs("label",{className:"flex flex-col gap-1",children:["Storage limit (MB)",n.jsx("input",{className:p,type:"number",required:!0,min:1,max:512,value:Math.round(t.maxBytes/1048576),onChange:h=>a({...t,maxBytes:Number(h.target.value)*1048576})})]}),n.jsxs("label",{className:"flex flex-col gap-1",children:["Excluded apps",n.jsx("input",{className:p,value:o,onChange:h=>i(h.target.value),"aria-describedby":"clipboard-excluded-help"})]}),n.jsx("p",{id:"clipboard-excluded-help",className:"text-sm text-ink-secondary",children:"Comma-separated Mac bundle identifiers or Windows process names. Password managers and protected copies are always excluded."}),n.jsx("p",{className:"text-sm text-ink-secondary",children:"Pinned clips stay until you delete them. Reducing retention or the storage limit removes older unpinned clips when you save. Nexus sync and bot access remain off."}),n.jsx("button",{type:"submit",className:"ui-button self-start",children:c?"Saving…":"Save settings"})]})})]})}const q2="Mod+D";function iEe(e=$j){try{return e()||zr}catch{return zr}}function jh(e){return e?.platform==="win32"?"win32":"darwin"}function sEe(e,t="darwin"){return Vj(e,t!=="win32")}function yr(e,t="darwin"){return nd(e,t!=="win32")}function rEe(e,t="darwin"){switch(/\((\w+)\)/.exec(e)?.[1]){case"needsControlOrOption":return"dictation.shortcut.needsControlOrOption";case"reserved":return t==="win32"?"dictation.shortcut.reservedWindows":"dictation.shortcut.reserved";case"altGr":return"dictation.shortcut.altGr";default:return"dictation.shortcut.invalid"}}const lEe=["listening","listeningHipaa","transcribing","correcting","cancelled","tooShort","nothingHeard","busy","micDenied","accessibilityDenied","inputMonitoringDenied","secureField","appDisabled","engineDownload","engineDownloading","engineUnsupported","engineFailed","pasteFailed","correctSkipped","pausedOtherApp","pausedHeldText","undone"];function cEe(){return Object.fromEntries(lEe.map(e=>[e,l(`dictation.hud.${e}`)]))}function U$(){window.ogb?.dictation?.setStrings(cEe()).catch(()=>{})}function dEe(e){const t=jh(e);if(e.support!=="ok")return{key:t==="win32"&&e.support==="not-built"?"dictation.support.windowsNotBuilt":`dictation.support.${e.support}`,tone:"off"};const a=e.settings;if(!a?.enabled)return{key:"dictation.status.off",tone:"off"};if(!e.connected||!e.status)return{key:"dictation.status.starting",tone:"busy"};const{permissions:o,engine:i,hotkey:s}=e.status;return t==="win32"?o.microphone==="denied"?{key:"dictation.status.needsMicrophoneWindows",tone:"warn"}:s.error==="taken"?{key:"dictation.status.shortcutTakenWindows",tone:"warn"}:s.error?{key:"dictation.status.shortcutFailed",tone:"warn"}:i.unsupported?{key:"dictation.status.windowsSpeechMissing",tone:"warn"}:s.passThrough&&e.status.phase!=="recording"?{key:"dictation.status.passThrough",tone:"off",params:{shortcut:yr(a.shortcut,t)}}:e.status.phase==="recording"?{key:"dictation.status.listening",tone:"ok"}:{key:"dictation.status.readyWindows",tone:"ok",params:{shortcut:yr(a.shortcut,t)}}:o.microphone!=="granted"?{key:"dictation.status.needsMicrophone",tone:"warn"}:o.accessibility!=="granted"?{key:"dictation.status.needsAccessibility",tone:"warn"}:a.trigger==="rightOption"&&o.inputMonitoring!=="granted"?{key:"dictation.status.needsInputMonitoring",tone:"warn"}:s.error==="taken"?{key:"dictation.status.shortcutTaken",tone:"warn"}:s.error?{key:"dictation.status.shortcutFailed",tone:"warn"}:s.passThrough&&e.status.phase!=="recording"?{key:"dictation.status.passThrough",tone:"off",params:{shortcut:yr(a.shortcut)}}:i.downloading?{key:"dictation.status.downloading",tone:"busy",params:{percent:Math.round(i.downloading.fraction*100)}}:i.unsupported?{key:"dictation.status.engineUnsupported",tone:"warn"}:i.needsDownload?{key:"dictation.status.needsDownload",tone:"warn"}:e.status.phase==="recording"?{key:"dictation.status.listening",tone:"ok"}:a.trigger==="rightOption"?{key:"dictation.status.readyHold",tone:"ok"}:{key:"dictation.status.ready",tone:"ok",params:{shortcut:yr(a.shortcut)}}}const uEe=["microphone-denied","microphone-failed","accessibility-denied","paste-failed","secure-field","app-disabled","engine-failed","engine-missing","engine-unsupported","engine-downloading","download-failed","held-on-clipboard"];function pEe(e){return uEe.includes(e)?`dictation.error.${e}`:"dictation.error.unknown"}function mEe(e){return`dictation.shortcut.conflict.${e}`}const V$="w-full rounded-lg border border-hairline/40 bg-inset px-3 py-2 text-[13px] text-ink placeholder:text-ink-secondary focus:border-hairline focus:outline-none disabled:opacity-50";function hEe(){const e=typeof window<"u"?window.ogb?.dictation:void 0,[t,a]=f.useState(null);return f.useEffect(()=>{if(!e)return;let o=!0;const i=()=>e.state().then(c=>{o&&a(c)}).catch(()=>{});i(),U$();const s=e.onState(c=>a(c)),r=window.setInterval(i,4e3);return()=>{o=!1,s(),window.clearInterval(r)}},[e]),{bridge:e,state:t,setState:a}}function gEe(){const{bridge:e,state:t,setState:a}=hEe(),[o,i]=f.useState(null),s=t?.settings??null,r=async c=>{if(!e)return!1;i(null);try{return a(await e.set(c)),!0}catch(d){const p=d instanceof Error?d.message:String(d);return i("shortcut"in c?l(rEe(p,jh(t))):p.replace(/^Error invoking remote method '[^']*':\s*(?:Error:\s*)?/,"")),!1}};return n.jsxs(n.Fragment,{children:[n.jsx(CEe,{onChange:()=>{e?.state().then(a).catch(()=>{})}}),e?t?n.jsxs(n.Fragment,{children:[n.jsxs(lt,{title:l("dictation.title"),subtitle:l("dictation.subtitle"),children:[n.jsx(Jt,{title:l("dictation.enable.title"),subtitle:l("dictation.enable.subtitle"),message:n.jsx(fEe,{state:t}),children:n.jsx(Tt,{checked:s?.enabled===!0,disabled:t.support!=="ok","aria-label":l("dictation.enable.title"),onClick:()=>{r({enabled:!s?.enabled})}})}),o&&n.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:o})]}),t.support==="ok"&&s?.enabled&&n.jsxs(n.Fragment,{children:[jh(t)==="win32"?n.jsx(vEe,{state:t}):n.jsx(bEe,{state:t}),n.jsx(yEe,{settings:s,conflicts:t.conflicts??[],change:r,platform:jh(t)}),jh(t)==="win32"?n.jsx(kEe,{state:t}):n.jsx(xEe,{state:t,change:r}),n.jsx(wEe,{state:t,change:r}),n.jsx(SEe,{settings:s,change:r})]})]}):null:n.jsx(lt,{title:l("dictation.title"),subtitle:l("dictation.support.platform")})]})}function fEe({state:e}){const t=dEe(e),a=t.tone==="ok"?"text-success":t.tone==="warn"?"text-danger":"text-ink-secondary",o=e.lastError?.code;return n.jsxs("div",{className:"space-y-1",children:[n.jsx("p",{role:"status",className:a,children:l(t.key,t.params)}),o&&e.settings?.enabled&&n.jsx("p",{className:"text-ink-secondary",children:l("dictation.lastError",{problem:l(pEe(o))})})]})}const $B={microphone:{title:"dictation.permission.microphone",why:"dictation.permission.microphoneWhy"},accessibility:{title:"dictation.permission.accessibility",why:"dictation.permission.accessibilityWhy"},inputMonitoring:{title:"dictation.permission.inputMonitoring",why:"dictation.permission.inputMonitoringWhy"}};function bEe({state:e}){const t=window.ogb?.dictation,a=e.settings?.trigger==="rightOption"?["microphone","accessibility","inputMonitoring"]:["microphone","accessibility"];return n.jsx(lt,{title:l("dictation.permissions.title"),subtitle:l("dictation.permissions.subtitle"),children:a.map(o=>{const i=e.status?.permissions?.[o],s=i==="granted";return n.jsx(Jt,{title:l($B[o].title),subtitle:l($B[o].why),message:n.jsx("span",{className:s?"text-success":"text-ink-secondary",children:l(s?"dictation.permission.granted":i==="denied"?"dictation.permission.denied":"dictation.permission.notAsked")}),children:!s&&n.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[n.jsx("button",{type:"button",className:"ui-button",onClick:()=>{t?.requestPermission(o).catch(()=>{})},children:l("dictation.permission.allow")}),n.jsx("button",{type:"button",className:"ui-button",onClick:()=>{t?.openPrivacySettings(o)},children:l("dictation.permission.openSettings")})]})},o)})})}function yEe({settings:e,conflicts:t,change:a,platform:o}){const[i,s]=f.useState(!1);f.useEffect(()=>{if(!i)return;const c=d=>{if(d.preventDefault(),d.stopPropagation(),d.key==="Escape")return s(!1);const p=sEe(d,o);p&&(s(!1),a({shortcut:p,trigger:"chord"}))};return window.addEventListener("keydown",c,!0),()=>window.removeEventListener("keydown",c,!0)},[i,a,o]);const r=(c,d,p)=>n.jsxs("label",{className:V("flex cursor-pointer gap-3 rounded-lg p-3",e.trigger===c?"bg-control":"hover:bg-control/50"),children:[n.jsx("input",{type:"radio",name:"dictation-trigger",className:"mt-1",checked:e.trigger===c,onChange:()=>{a({trigger:c})}}),n.jsxs("span",{className:"min-w-0",children:[n.jsx("span",{className:"block text-[14px] font-medium text-ink",children:d}),n.jsx("span",{className:"mt-0.5 block text-[12px] leading-relaxed text-ink-secondary",children:p})]})]});return n.jsx(lt,{title:l("dictation.shortcut.title"),subtitle:l("dictation.shortcut.subtitle",{inApp:yr(iEe(),o)}),children:n.jsxs("div",{className:"space-y-2",children:[r("chord",l("dictation.shortcut.chord",{shortcut:yr(e.shortcut,o)}),l(o==="win32"?"dictation.shortcut.chordWhyWindows":"dictation.shortcut.chordWhy")),e.trigger==="chord"&&n.jsxs("div",{className:"flex items-center gap-2 pl-9",children:[n.jsxs("button",{type:"button",className:"ui-button",onClick:()=>s(!i),"aria-pressed":i,children:[n.jsx(R4,{size:13,"aria-hidden":!0}),l(i?"dictation.shortcut.recording":"dictation.shortcut.change")]}),e.shortcut!==q2&&n.jsx("button",{type:"button",className:"ui-button",onClick:()=>{a({shortcut:q2})},children:l("dictation.shortcut.reset",{shortcut:yr(q2,o)})})]}),e.trigger==="chord"&&t.length>0&&n.jsxs("div",{className:"ml-9 rounded-lg border border-hairline/40 p-3",children:[n.jsx("p",{className:"text-[13px] font-medium text-ink",children:l("dictation.shortcut.conflictsTitle",{shortcut:yr(e.shortcut,o)})}),n.jsx("p",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:l("dictation.shortcut.conflictsWhy",{shortcut:yr(e.shortcut,o)})}),n.jsx("div",{className:"mt-2 space-y-1",children:t.map(c=>{const d=!e.disabledApps.includes(c.bundleId);return n.jsx(Jt,{title:c.name,subtitle:l(mEe(c.action)),children:n.jsx(Tt,{checked:d,"aria-label":l("dictation.apps.toggle",{app:c.name}),onClick:()=>{a({appEnabled:{bundleId:c.bundleId,enabled:!d}})}})},c.bundleId)})})]}),o!=="win32"&&r("rightOption",l("dictation.shortcut.rightOption"),l("dictation.shortcut.rightOptionWhy"))]})})}function xEe({state:e,change:t}){const a=e.settings,o=e.status?.engine??{},i=window.ogb?.dictation,s=r=>{const c=o[r];return o.downloading?.engine===r?l("dictation.engine.downloading",{percent:Math.round(o.downloading.fraction*100)}):c?.supported?l(c.installed?"dictation.engine.ready":"dictation.engine.notDownloaded"):l(r==="apple"?"dictation.engine.appleUnsupported":"dictation.engine.parakeetUnsupported")};return n.jsxs(lt,{title:l("dictation.engine.title"),subtitle:l("dictation.engine.subtitle"),children:[n.jsx(Jt,{title:l("dictation.engine.choice"),children:n.jsxs("select",{className:V$,value:a.engine,"aria-label":l("dictation.engine.choice"),onChange:r=>{t({engine:r.target.value})},children:[n.jsx("option",{value:"auto",children:l("dictation.engine.auto")}),n.jsx("option",{value:"apple",children:l("dictation.engine.apple")}),n.jsx("option",{value:"parakeet",children:l("dictation.engine.parakeet")})]})}),n.jsx(Jt,{title:l("dictation.engine.apple"),subtitle:l("dictation.engine.appleWhy"),message:n.jsx("span",{className:"text-ink-secondary",children:s("apple")}),children:o.active==="apple"&&n.jsx("span",{className:"text-[12px] text-success",children:l("dictation.engine.inUse")})}),n.jsx(Jt,{title:l("dictation.engine.parakeet"),subtitle:l("dictation.engine.parakeetWhy"),message:n.jsx("span",{className:"text-ink-secondary",children:s("parakeet")}),children:o.active==="parakeet"?n.jsx("span",{className:"text-[12px] text-success",children:l("dictation.engine.inUse")}):o.parakeet?.supported&&!o.parakeet.installed&&!o.downloading?n.jsx("button",{type:"button",className:"ui-button",onClick:()=>{i?.downloadEngine("parakeet").catch(()=>{})},children:l("dictation.engine.download")}):null})]})}function vEe({state:e}){const t=window.ogb?.dictation,a=e.status?.permissions?.microphone==="denied";return n.jsx(lt,{title:l("dictation.permissions.title"),children:n.jsx(Jt,{title:l("dictation.permission.microphone"),subtitle:l("dictation.permission.microphoneWhyWindows"),message:n.jsx("span",{className:a?"text-danger":"text-success",children:l(a?"dictation.permission.windowsBlocked":"dictation.permission.windowsOk")}),children:n.jsx("button",{type:"button",className:"ui-button",onClick:()=>{t?.openPrivacySettings("microphone")},children:l("dictation.permission.openWindowsSettings")})})})}function kEe({state:e}){const t=window.ogb?.dictation,a=e.status?.engine?.windows?.languages??[],o=e.status?.engine?.unsupported===!0;return n.jsx(lt,{title:l("dictation.engine.title"),children:n.jsx(Jt,{title:l("dictation.engine.windows"),subtitle:l("dictation.engine.windowsWhy"),message:n.jsx("span",{className:o?"text-danger":"text-ink-secondary",children:o?l("dictation.engine.windowsMissing"):a.length?l("dictation.engine.windowsLanguages",{languages:a.join(", ")}):null}),children:n.jsx("button",{type:"button",className:"ui-button",onClick:()=>{t?.downloadEngine("windows").catch(()=>{})},children:l("dictation.engine.windowsAddLanguage")})})})}function wEe({state:e,change:t}){const a=e.settings,o=e.hipaa?.enabled===!0,[i,s]=f.useState(null),r=i??a.vocabulary.join(`
|
|
604
604
|
`);return n.jsxs(lt,{title:l("dictation.correct.title"),subtitle:l("dictation.correct.subtitle"),children:[n.jsx(Jt,{title:l("dictation.correct.enable"),subtitle:l("dictation.correct.enableWhy"),children:n.jsx(Tt,{checked:a.autoCorrect,"aria-label":l("dictation.correct.enable"),onClick:()=>{t({autoCorrect:!a.autoCorrect})}})}),n.jsx(Jt,{title:l("dictation.correct.subscriptions"),subtitle:l(o?"dictation.correct.subscriptionsHipaa":"dictation.correct.subscriptionsWhy"),children:n.jsx(Tt,{checked:a.useSubscriptions&&!o,disabled:o||!a.autoCorrect,"aria-label":l("dictation.correct.subscriptions"),onClick:()=>{t({useSubscriptions:!a.useSubscriptions})}})}),n.jsxs("div",{className:"border-t border-hairline/40 pt-4",children:[n.jsx("label",{className:"block text-[14px] font-medium text-ink",htmlFor:"dictation-words",children:l("dictation.words.title")}),n.jsx("p",{className:"mt-1 text-[12px] leading-relaxed text-ink-secondary",children:l("dictation.words.subtitle")}),n.jsx("textarea",{id:"dictation-words",className:`${V$} mt-2 h-24 resize-y font-mono text-[12px]`,value:r,placeholder:l("dictation.words.placeholder"),onChange:c=>s(c.target.value),onBlur:async()=>{if(i===null)return;const c=i;await t({vocabulary:c.split(`
|
|
605
605
|
`).map(p=>p.trim()).filter(Boolean)})&&s(p=>p===c?null:p)}})]})]})}function SEe({settings:e,change:t}){return n.jsx(lt,{title:l("dictation.apps.title"),subtitle:l("dictation.apps.subtitle"),children:e.recentApps.length===0?n.jsx("p",{className:"text-[13px] text-ink-secondary",children:l("dictation.apps.empty")}):e.recentApps.map(a=>{const o=!e.disabledApps.includes(a.bundleId);return n.jsx(Jt,{title:a.name,subtitle:a.bundleId,children:n.jsx(Tt,{checked:o,"aria-label":l("dictation.apps.toggle",{app:a.name}),onClick:()=>{t({appEnabled:{bundleId:a.bundleId,enabled:!o}})}})},a.bundleId)})})}function CEe({onChange:e}){const t=ec(),[a,o]=f.useState(null),[i,s]=f.useState(null);if(f.useEffect(()=>{let d=!0;return Z("/api/hipaa").then(p=>{d&&o(p)}).catch(()=>{}),()=>{d=!1}},[]),!a)return null;const r=async()=>{s(null);try{o(await Z("/api/hipaa",{method:"PUT",body:JSON.stringify({enabled:!a.enabled})})),e()}catch(d){s(d instanceof Error?d.message:String(d))}},c=a.source==="mdm"?null:a.source==="environment"?l("dictation.hipaa.environment"):t===!1?l("dictation.hipaa.adminOnly"):null;return n.jsx(lt,{children:n.jsx(Jt,{title:l("dictation.hipaa.title"),subtitle:n.jsxs("span",{className:"inline-flex items-start gap-1.5",children:[n.jsx(Os,{size:13,className:"mt-0.5 shrink-0","aria-hidden":!0}),l("dictation.hipaa.subtitle")]}),message:c||i?n.jsx("span",{className:i?"text-danger":"text-ink-secondary",children:i??c}):void 0,children:n.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.source==="mdm"&&n.jsx(Er,{}),n.jsx(Tt,{checked:a.enabled,disabled:a.locked||t!==!0,"aria-label":l("dictation.hipaa.title"),onClick:()=>{r()}})]})})})}const jEe=[{id:"publicTranscript",title:"watch.settings.publicTranscript.title",subtitle:"watch.settings.publicTranscript.subtitle"},{id:"allowAppClient",title:"watch.settings.appClient.title",subtitle:"watch.settings.appClient.subtitle"},{id:"onDeviceSpeech",title:"watch.settings.onDevice.title",subtitle:"watch.settings.onDevice.subtitle"}];function NEe(e,t,a){return e.managed[t]!==void 0?null:e.remote[t]===!1?"watch.settings.remoteOff":e.hipaa&&t!=="onDeviceSpeech"?"watch.settings.hipaa":t==="allowAppClient"&&!e.effective.publicTranscript?"watch.settings.needsPage":a===!1?"watch.settings.adminOnly":null}function AEe(){const e=ec(),[t,a]=f.useState(null),[o,i]=f.useState(null);if(f.useEffect(()=>{let r=!0;return Z("/api/watch-along/settings").then(c=>{r&&a(c)}).catch(()=>{}),()=>{r=!1}},[]),!t?.access.allowed)return null;const s=async r=>{i(null);try{a(await Z("/api/watch-along/settings",{method:"PUT",body:JSON.stringify({[r]:!t.effective[r]})}))}catch(c){i(c instanceof Error?c.message:String(c))}};return n.jsxs(lt,{title:l("settings.section.watchAlong"),subtitle:l("watch.settings.intro"),children:[jEe.map(({id:r,title:c,subtitle:d})=>{const p=t.managed[r]!==void 0,h=NEe(t,r,e),g=p||t.remote[r]===!1||t.hipaa&&r!=="onDeviceSpeech"||r==="allowAppClient"&&!t.effective.publicTranscript;return n.jsx(Jt,{title:l(c),subtitle:l(d),message:h?n.jsx("span",{className:"text-ink-secondary",children:l(h)}):void 0,children:n.jsxs("div",{className:"flex items-center justify-end gap-2",children:[p&&n.jsx(Er,{}),n.jsx(Tt,{checked:t.effective[r],disabled:g||e!==!0,"aria-label":l(c),onClick:()=>{s(r)}})]})},r)}),o&&n.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:o})]})}const MEe=.7,IEe=1.6,GB=.1,H$="atomic.appZoom",v4="atomic.settingsZoom",$$="atomic.settingsSize",k4="atomic:settings-zoom";function w4(e){return Number.isFinite(e)?Math.min(IEe,Math.max(MEe,Math.round(e*10)/10)):1}function PEe(e,t){return t==="reset"?1:w4(w4(e)+(t==="in"?GB:-GB))}function p0(e){try{const t=globalThis.localStorage?.getItem(e);return w4(t==null?1:Number(t))}catch{return 1}}function G$(e,t){try{globalThis.localStorage?.setItem(e,t)}catch{}}function TEe(e,t,a){const o=t?v4:H$,i=PEe(p0(o),e);return G$(o,String(i)),(t?a.settings:a.app)(i),i}function BEe(){try{const e=globalThis.localStorage?.getItem($$);if(!e)return null;const t=JSON.parse(e),a=Number(t.w),o=Number(t.h);return Number.isFinite(a)&&Number.isFinite(o)&&a>=320&&o>=280?{w:Math.round(a),h:Math.round(o)}:null}catch{return null}}function EEe(e){if(!e)return()=>{};const t=()=>{e.style.zoom=String(p0(v4))};t(),window.addEventListener(k4,t),e.style.resize="both",e.style.minWidth="320px",e.style.minHeight="280px";const a=BEe();a&&(e.style.width=`${a.w}px`,e.style.height=`${a.h}px`,e.style.maxWidth="calc(100vw - 24px)",e.style.maxHeight="calc(100dvh - 24px)");const o=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>{if(window.innerWidth<640)return;const i=e.getBoundingClientRect(),s=p0(v4);G$($$,JSON.stringify({w:Math.round(i.width/s),h:Math.round(i.height/s)}))});return o?.observe(e),()=>{window.removeEventListener(k4,t),o?.disconnect()}}function REe(){const{state:e,dispatch:t}=ke(),[a,o]=f.useState(e.config?.profile?.name??""),[i,s]=f.useState(e.config?.profile?.email??"");f.useEffect(()=>{o(e.config?.profile?.name??""),s(e.config?.profile?.email??"")},[e.config?.profile?.name,e.config?.profile?.email]);const r=()=>{fetch("/api/config",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({profile:{name:a.trim(),email:i.trim().toLowerCase()}})}).then(d=>{if(!d.ok)throw new Error("Profile save failed");return d.json()}).then(d=>{d.profile&&t({type:"profileSaved",profile:{name:d.profile.name,email:d.profile.email}})}).catch(()=>{})},c="w-full rounded-lg border border-hairline/40 bg-inset px-3 py-2 text-[14px] text-ink placeholder:text-ink-secondary focus:border-hairline focus:outline-none";return n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("input",{"aria-label":l("settings.profile.name"),value:a,onChange:d=>o(d.target.value),onBlur:r,placeholder:l("settings.profile.name"),className:c}),n.jsx("input",{type:"email","aria-label":l("phone.signIn.email"),value:i,onChange:d=>s(d.target.value),onBlur:r,placeholder:"you@example.com",className:c}),n.jsx(SBe,{})]})}function DEe({channel:e}){return n.jsxs(n.Fragment,{children:[n.jsx(Jt,{title:l("settings.updates.title"),subtitle:l("settings.updates.managed"),children:n.jsx(Er,{})}),e&&n.jsx(K$,{channel:e==="beta"?"beta":"latest",managedChannel:e})]})}function OEe(){const e=zC();if(!window.ogb?.updater)return null;const t=window.ogb.updater;if(e?.updatesManaged)return n.jsx(DEe,{channel:e.managedChannel??null});const a=e?.status==="checking"?l("settings.updates.checking"):e?.status==="available"?l("settings.updates.available",{version:e.version??""}):e?.status==="downloading"?e.percent==null?l("settings.updates.startingDownload"):l("settings.updates.downloading",{percent:Math.round(e.percent)}):e?.status==="preparing"?l("settings.updates.preparing"):e?.status==="downloaded"?e.installMode==="handoff"?l("settings.updates.readyInstall",{version:e.version??""}):l("settings.updates.ready",{version:e.version??""}):e?.status==="installing"?e.message||(e.installMode==="handoff"?l("settings.updates.openingTerminal"):l("settings.updates.restarting")):e?.status==="handed-off"?l("settings.updates.handedOff"):e?.status==="error"?l("settings.updates.failed",{message:e.message??l("settings.updates.unknownError")}):l("settings.updates.latest"),o=e?.appVersion?l("settings.updates.versionChannel",{version:e.appVersion,channel:l(e.channel==="beta"?"settings.updates.channel.beta":"settings.updates.channel.latest")}):"";return n.jsxs(n.Fragment,{children:[n.jsx(Jt,{title:l("settings.updates.title"),subtitle:o?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"block",children:o}),a]}):a,children:n.jsx("button",{onClick:()=>{if(e?.status==="available")return void t.download();if(e?.status==="downloaded")return void t.install();t.check()},disabled:e?.status==="checking"||e?.status==="downloading"||e?.status==="preparing"||e?.status==="installing"||e?.retryable===!1,className:"ui-button",children:e?.retryable===!1?l("settings.updates.quitReopen"):e?.status==="available"?l("settings.updates.download"):e?.status==="downloaded"?e.installMode==="handoff"?l("settings.updates.install"):l("settings.updates.restart"):e?.status==="preparing"?l("settings.updates.preparingShort"):e?.status==="installing"?e.installMode==="handoff"?l("settings.updates.opening"):l("settings.updates.restartingShort"):l("settings.updates.check")})}),t.setAutoUpdate&&n.jsx(TTe,{enabled:e?.autoUpdate!==!1,handOff:e?.installMode==="handoff"}),e?.channelsAvailable&&t.setChannel&&n.jsx(K$,{channel:e.channel??"latest",managedChannel:e.managedChannel??null})]})}function K$({channel:e,managedChannel:t=null}){const[a,o]=f.useState(!1),[i,s]=f.useState(""),r=e==="beta";if(t)return n.jsx(Jt,{title:l("settings.updates.early.title"),subtitle:l(typeof window<"u"&&window.ogb?.platform&&window.ogb.platform!=="darwin"?"settings.updates.early.managedComputer":"settings.updates.early.managed",{channel:l(t==="beta"?"settings.updates.channelBeta":"settings.updates.channelStable")}),children:n.jsx(Er,{})});const c=()=>{o(!0),s(""),window.ogb?.updater?.setChannel?.(r?"latest":"beta").catch(()=>s(l("settings.updates.early.failed"))).finally(()=>o(!1))};return n.jsx(Jt,{title:l("settings.updates.early.title"),subtitle:l("settings.updates.early.subtitle"),message:i?n.jsx("p",{role:"alert",className:"text-danger",children:i}):null,children:n.jsx(Tt,{checked:r,disabled:a,"aria-label":l("settings.updates.early.title"),onClick:c})})}function zEe(){const{state:e,dispatch:t}=ke(),a=e.config?.newBots?.effort??"",[o,i]=f.useState(!1),[s,r]=f.useState(""),c=async d=>{if(!o){i(!0),r("");try{const p=await Z("/api/config",{method:"PATCH",body:JSON.stringify({newBots:{effort:DTe(d)?d:null}})});t({type:"configStatus",config:p})}catch(p){r(p instanceof Error?p.message:l("settings.newBotEffort.error"))}finally{i(!1)}}};return n.jsx(Jt,{title:l("settings.newBotEffort.title"),subtitle:l("settings.newBotEffort.subtitle"),message:s?n.jsx("p",{role:"alert",className:"text-danger",children:s}):null,children:n.jsxs("select",{value:a,disabled:o,"aria-label":l("settings.newBotEffort.aria"),onChange:d=>{c(d.target.value)},className:"min-h-8 w-full max-w-[240px] rounded-lg border border-hairline/40 bg-inset px-2.5 py-1.5 text-[13px] text-ink focus:border-focus disabled:cursor-wait disabled:opacity-50",children:[n.jsx("option",{value:"",children:l("settings.newBotEffort.default")}),P$.map(d=>n.jsx("option",{value:d,children:Tl(d)},d))]})})}function LEe(){const{state:e,dispatch:t}=ke(),[a,o]=f.useState(!1),[i,s]=f.useState(!1);return n.jsxs("div",{children:[n.jsx("button",{disabled:a,onClick:()=>{o(!0),s(!1),Z("/api/config",{method:"PUT",body:JSON.stringify({onboarding:{...e.config?.onboarding?.completedAt?{}:lS().onboarding,hintsSeen:Fbe(e.config?.onboarding)}}),signal:AbortSignal.timeout(1e4)}).then(r=>{t({type:"configStatus",config:r}),t({type:"toggleTour",open:!0})}).catch(()=>s(!0)).finally(()=>o(!1))},className:"ui-button",children:l("settings.welcome.appTour")}),i&&n.jsx("p",{role:"alert",className:"mt-2 text-[13px] text-danger",children:l("onboarding.tour.error")})]})}function _Ee(){const{dispatch:e}=ke();return n.jsx(Jt,{title:l("settings.welcome.title"),subtitle:l("settings.welcome.subtitle"),children:n.jsxs("div",{className:"flex flex-wrap gap-2",children:[n.jsx(LEe,{}),n.jsx("button",{onClick:()=>e({type:"toggleWelcome",open:!0}),className:"ui-button",children:l("settings.welcome.replay")})]})})}function FEe(){const{state:e,dispatch:t}=ke(),a=e.config?.language??"",[o,i]=f.useState(!1),[s,r]=f.useState(""),c=async d=>{if(!o){i(!0),r("");try{const p=await Z("/api/config",{method:"PATCH",body:JSON.stringify({language:d})});t({type:"configStatus",config:p})}catch(p){r(p instanceof Error?p.message:l("settings.language.error"))}finally{i(!1)}}};return n.jsx(Jt,{title:l("settings.language.title"),subtitle:l("settings.language.subtitle"),message:s?n.jsx("p",{role:"alert",className:"text-danger",children:s}):null,children:n.jsxs("select",{value:a,disabled:o,"aria-label":l("settings.language.aria"),onChange:d=>{c(d.target.value)},className:"min-h-8 w-full max-w-[240px] rounded-lg border border-hairline/40 bg-inset px-2.5 py-1.5 text-[13px] text-ink focus:border-focus disabled:cursor-wait disabled:opacity-50",children:[n.jsx("option",{value:"",children:l("settings.language.system")}),oX.map(({code:d,label:p})=>n.jsx("option",{value:d,children:p},d))]})})}function qEe(){const e=qr();return n.jsx(Jt,{title:l("settings.threadDisplay.title"),subtitle:l("settings.threadDisplay.subtitle"),children:n.jsx(Tt,{checked:e,"aria-label":l("settings.threadDisplay.show"),onClick:()=>zve(!e)})})}function UEe(){const{state:e,dispatch:t}=ke(),a=US(e.config),[o,i]=f.useState(!1),[s,r]=f.useState(""),c=async()=>{if(!o){i(!0),r("");try{const d=await Z("/api/config",{method:"PATCH",body:JSON.stringify({features:{showToolCalls:!a}})});t({type:"configStatus",config:d})}catch(d){r(d instanceof Error?d.message:l("settings.toolCalls.error"))}finally{i(!1)}}};return n.jsx(Jt,{title:l("settings.toolCalls.title"),subtitle:n.jsxs(n.Fragment,{children:[l("settings.toolCalls.subtitle")," ",l("settings.toolCalls.detail")]}),message:s?n.jsx("p",{role:"alert",className:"text-danger",children:s}):null,children:n.jsx(Tt,{checked:a,"aria-label":l("settings.toolCalls.aria"),disabled:o,onClick:()=>{c()},className:"disabled:cursor-wait disabled:opacity-50"})})}function VEe({remoteActive:e}){const{state:t,dispatch:a}=ke(),o=Vu(t.config),i=t.config?.godMode?.available!==!1,s=!e&&!!window.ogb?.approvals?.setGodMode,[r,c]=f.useState(!1),[d,p]=f.useState(!1),[h,g]=f.useState(""),b=async v=>{if(!d){c(!1),p(!0),g("");try{a({type:"configStatus",config:await nee(v)})}catch(k){g(k instanceof Error?k.message:l("settings.godMode.error"))}finally{p(!1)}}},x=l(i?!o&&!s?"settings.godMode.desktopOnly":o?"settings.godMode.on":"settings.godMode.off":"settings.godMode.unavailable");return n.jsxs(lt,{title:l("settings.godMode.title"),subtitle:l("settings.godMode.subtitle"),children:[n.jsxs("div",{className:"flex items-center justify-between gap-4",children:[n.jsx("div",{className:V("min-w-0 text-[12px] leading-relaxed",o?"text-danger":"text-ink-secondary"),children:x}),n.jsx(Tt,{checked:o,"aria-label":l("settings.godMode.aria"),disabled:d||!o&&(!i||!s),onClick:()=>o?void b(!1):c(!0),className:V("disabled:cursor-not-allowed disabled:opacity-50",o&&"bg-danger")})]}),h?n.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:h}):null,n.jsx(H0,{open:r,scope:"workspace",onCancel:()=>c(!1),onConfirm:()=>{b(!0)}})]})}function HEe(){const{state:e,dispatch:t}=ke(),a=U0(e.config),o=Yc(e.config),i=q0(e.config),s=e.config?.browserEngine?.installable===!0,r=window.ogb?.platform==="win32"&&!i&&!s,[c,d]=f.useState(null),[p,h]=f.useState(""),g=async(b,x)=>{if(!c){d(b),h("");try{const v=await Z("/api/config",{method:"PATCH",body:JSON.stringify({features:{[b]:x}})});t({type:"configStatus",config:v})}catch(v){h(v instanceof Error?v.message:l("settings.experimental.error"))}finally{d(null)}}};return n.jsxs(lt,{title:l("settings.experimental.title"),subtitle:l("settings.experimental.subtitle"),children:[n.jsxs("div",{className:"flex items-center justify-between gap-4",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-[14px] font-medium text-ink",children:l("settings.experimental.skillAuthoring")}),n.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:l("settings.experimental.skillAuthoringDetail")})]}),n.jsx(Tt,{checked:a,"aria-label":l("settings.experimental.skillAuthoringAria"),disabled:c!==null,onClick:()=>{g("skillAuthoring",!a)},className:"disabled:cursor-wait disabled:opacity-50"})]}),n.jsxs("div",{className:"mt-4 flex items-center justify-between gap-4 border-t border-hairline/30 pt-4",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-[14px] font-medium text-ink",children:l("settings.experimental.browser")}),n.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:i?l(o?"settings.experimental.browserOn":"settings.experimental.browserOff"):r?l("settings.experimental.browserWindows"):_g(e.config)})]}),n.jsx(Tt,{checked:o,"aria-label":l("settings.experimental.browserAria"),disabled:c!==null||!o&&!i&&!s,onClick:()=>{g("browser",!o)},className:"disabled:cursor-wait disabled:opacity-50"})]}),n.jsx(JIe,{saving:c!==null,toggle:g}),p?n.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:p}):null]})}function $Ee(){const{state:e}=ke(),t=e.config?.browserProfiles??[];return!Yc(e.config)&&t.length===0?null:n.jsx(lt,{title:l("settings.profiles.title"),subtitle:l("settings.profiles.sharedSubtitle"),children:n.jsx(m$,{})})}function GEe(){const[e,t]=f.useState(!1),[a,o]=f.useState(null),i=async()=>{if(!(!window.ogb?.exportDiagnostics||e)){t(!0),o(null);try{const s=await window.ogb.exportDiagnostics();s&&o({kind:"success",message:l("settings.diagnostics.saved",{path:s})})}catch(s){o({kind:"error",message:s instanceof Error?s.message:String(s)})}finally{t(!1)}}};return n.jsx(Jt,{title:l("settings.diagnostics.title"),subtitle:l("settings.diagnostics.subtitle"),message:a?n.jsx("p",{role:a.kind==="error"?"alert":"status",className:V("break-all",a.kind==="error"?"text-danger":"text-success"),children:a.message}):null,children:n.jsx("button",{onClick:()=>{i()},disabled:e,"aria-label":l("settings.diagnostics.aria"),className:"ui-button",children:l(e?"settings.diagnostics.exporting":"settings.diagnostics.export")})})}function KEe(){return OC()?n.jsx(Jt,{title:l("settings.feedback.title"),subtitle:l("settings.feedback.subtitle"),children:n.jsx("button",{onClick:()=>Gg("idea"),className:"ui-button",children:l("settings.feedback.button")})}):null}const KB={general:$4,marketplace:v0,personalBot:H4,ai:So,devices:zE,projects:b0,admin:xE,experimental:SE},WEe=new Set(["companion","appearance","desktopWorkspaces","marketplace","mcpServers"]);function JEe(){return n.jsxs(n.Fragment,{children:[n.jsx(lt,{title:l("settings.aiProviders.keysTitle"),subtitle:l("settings.aiProviders.keysSubtitle"),children:n.jsxs("div",{className:"flex flex-col gap-4",children:[n.jsx("div",{className:"text-[11.5px] font-medium uppercase tracking-wide text-ink-secondary",children:l("keys.providers.title")}),n.jsx("p",{className:"-mt-3 text-[12px] leading-relaxed text-ink-secondary",children:l("keys.providers.subtitle")}),n.jsx(Pne,{billing:"payPerUse"})]})}),n.jsx(xPe,{})]})}function WB(e){const t=jg.find(a=>a.id===e.id);return t&&t.tabs.length>1?e.tabs[0].labelKey:e.labelKey}function YEe(){const{state:e,dispatch:t}=ke(),a=window.ogb?.remoteClient?.active===!0,o=f.useRef(null),[i,s]=f.useState("");f.useEffect(()=>window.ogb?.environments?.onOpenSettings?.(()=>s("")),[]),f.useEffect(()=>window.ogb?.onOpenAppSettings?.(()=>s("")),[]);const r=i.trim().toLowerCase(),c=ec(),d=M=>t({type:"toggleAppSettings",open:!0,section:M}),p=M=>{if(a&&!WEe.has(M))return!1;switch(M){case"desktopWorkspaces":return!!window.ogb?.environments;case"organization":return!!window.ogb?.organization&&!a;case"workspaces":return B$(e.config);case"people":return!window.ogb;case"assistants":return!!window.ogb;case"activity":return!window.ogb&&c===!0;case"setup":return c!==!1;case"personalBot":return c!==!1;case"memory":return c!==!1;case"watchAlong":return e.config?.watchAlong?.access===!0;default:return!0}},h=jg.map(M=>({...M,tabs:M.tabs.filter(E=>p(E.id))})).filter(M=>M.tabs.length>0),g=h.map(M=>({...M,tabs:M.tabs.filter(E=>RTe(M,E,r,l))})).filter(M=>M.tabs.length>0),b=s6(e.appSettingsSection),x=h.find(M=>M.id===ETe(b).id),v=h.some(M=>M.tabs.some(E=>E.id===b))?b:x?.tabs[0]?.id??(a?"companion":h[0]?.tabs[0]?.id??"general"),k=h.find(M=>M.tabs.some(E=>E.id===v))??h[0],w=k?KB[k.id]:$4,N=g.flatMap(M=>M.tabs),C=r&&!N.some(M=>M.id===v)?N[0]?.id:void 0,j=k?.id==="ai"||k?.id==="marketplace";return f.useEffect(()=>{C&&t({type:"toggleAppSettings",open:!0,section:C})},[t,C]),f.useEffect(()=>{const M=document.activeElement instanceof HTMLElement?document.activeElement:null,E=o.current,A=EEe(E),R=E?.querySelector("[data-settings-search]");R?.checkVisibility()?R.focus():E?.focus();const B=O=>{if(O.defaultPrevented||E&&[...E.querySelectorAll('[role="dialog"], [role="alertdialog"]')].some(G=>G.getClientRects().length))return;if(O.key==="Escape"){O.preventDefault(),t({type:"toggleAppSettings",open:!1});return}if(O.key!=="Tab"||!E)return;const T=Array.from(E.querySelectorAll('button:not([disabled]), a[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])')).filter(G=>G.checkVisibility()&&G.tabIndex!==-1);if(T.length===0){O.preventDefault(),E.focus();return}const z=T[0],P=T[T.length-1],L=document.activeElement;O.shiftKey&&(L===z||!E.contains(L))?(O.preventDefault(),P.focus()):!O.shiftKey&&L===P&&(O.preventDefault(),z.focus())};return window.addEventListener("keydown",B),()=>{window.removeEventListener("keydown",B),A(),M?.focus()}},[t]),n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-3 sm:p-6",onMouseDown:M=>M.target===M.currentTarget&&t({type:"toggleAppSettings",open:!1}),children:n.jsxs("div",{ref:o,role:"dialog","aria-modal":"true","aria-labelledby":"app-settings-title",tabIndex:-1,className:V("flex max-h-[calc(100dvh-24px)] w-full overflow-hidden rounded-2xl border border-hairline/50 bg-panel shadow-2xl outline-none",j?"h-[720px] max-w-[1040px]":"h-[600px] max-w-[880px]"),children:[n.jsx("span",{id:"app-settings-title",className:"sr-only",children:l("settings.title")}),n.jsxs("nav",{"aria-label":l("settings.title"),className:"hidden min-h-0 w-[200px] shrink-0 flex-col gap-1 overflow-y-auto border-r border-hairline/40 bg-app/30 p-3 backdrop-blur-xl sm:flex",children:[n.jsx("div",{className:"shrink-0 px-2 py-3 text-[15px] font-semibold text-ink",children:l("settings.title")}),n.jsxs("div",{className:"mb-2 mt-1 flex min-h-8 shrink-0 items-center gap-2 rounded-lg border border-transparent bg-control/70 px-2.5 py-2 focus-within:border-focus",children:[n.jsx(La,{size:14,className:"shrink-0 text-ink-secondary"}),n.jsx("input",{"data-settings-search":!0,value:i,onChange:M=>s(M.target.value),onKeyDown:M=>{M.key==="Escape"&&(M.stopPropagation(),i?s(""):t({type:"toggleAppSettings",open:!1}))},placeholder:l("settings.search"),"aria-label":l("settings.searchAria"),className:"w-full bg-transparent text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"})]}),g.length===0&&n.jsx("div",{className:"px-2.5 py-4 text-[12.5px] leading-relaxed text-ink-secondary",children:l("settings.noMatch",{query:i.trim()})}),g.map(M=>{const E=KB[M.id],A=M.id===k?.id,R=M.id==="marketplace",B=!!r&&h.find(O=>O.id===M.id).tabs.length>1;return n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsxs("button",{"data-settings-group":M.id,onClick:()=>d(M.tabs[0].id),"aria-current":A?"page":void 0,className:V("flex min-h-9 items-center gap-2.5 rounded-lg px-2.5 py-2 text-left text-[13px] transition-colors motion-reduce:transition-none",A?"bg-control text-ink":"text-ink-secondary hover:bg-control/50 hover:text-ink",R&&!A&&"text-ink"),children:[n.jsx(E,{size:15,className:V("shrink-0",R&&"text-accent")}),n.jsx("span",{className:"min-w-0 flex-1 leading-snug",children:l(M.labelKey)})]}),B&&M.tabs.map(O=>n.jsx("button",{onClick:()=>d(O.id),"aria-current":v===O.id?"true":void 0,className:V("ml-7 rounded-md px-2 py-1 text-left text-[12px] transition-colors motion-reduce:transition-none",v===O.id?"bg-control/70 text-ink":"text-ink-secondary hover:text-ink"),children:l(O.labelKey)},O.id))]},M.id)})]}),n.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[n.jsxs("div",{className:"flex shrink-0 flex-col gap-3 border-b border-hairline/30 px-3 py-3 sm:px-5",children:[n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsx("select",{"aria-label":l("settings.title"),value:v,onChange:M=>{s(""),d(M.target.value)},className:"min-w-0 flex-1 rounded-lg bg-control px-3 py-2 text-[14px] text-ink sm:hidden",children:h.map(M=>M.tabs.length===1?n.jsx("option",{value:M.tabs[0].id,children:l(WB(M))},M.id):n.jsx("optgroup",{label:l(M.labelKey),children:M.tabs.map(E=>n.jsx("option",{value:E.id,children:l(E.labelKey)},E.id))},M.id))}),n.jsxs("span",{className:"hidden min-w-0 items-center gap-2 text-[15px] font-semibold text-ink sm:flex",children:[n.jsx(w,{size:16,className:V("shrink-0",k?.id==="marketplace"?"text-accent":"text-ink-secondary")}),n.jsx("span",{className:"truncate",children:k?l(k.tabs.length===1?WB(k):k.labelKey):null})]}),n.jsx("button",{onClick:()=>t({type:"toggleAppSettings",open:!1}),"aria-label":l("settings.close"),title:`${l("settings.close")} (${vF("close-panel")})`,className:"ui-icon-button shrink-0",children:n.jsx(jt,{size:18})})]}),k&&k.tabs.length>1&&n.jsx("div",{className:"hidden sm:block",children:n.jsx(bne,{label:l(k.labelKey),tabs:k.tabs.map(M=>({id:M.id,label:l(M.labelKey)})),value:v,onChange:d})})]}),n.jsxs("div",{role:k&&k.tabs.length>1?"tabpanel":void 0,"aria-label":jB(v)?l(jB(v).labelKey):void 0,"data-settings-tab":v,"data-tour":v==="marketplace"?"apps-panel":void 0,className:"flex flex-1 flex-col gap-4 overflow-y-auto px-3 py-4 sm:px-5 sm:pb-5",children:[n.jsx(WTe,{config:e.config}),v==="general"&&n.jsxs(n.Fragment,{children:[n.jsx(VEe,{remoteActive:a}),n.jsx(lt,{title:l("settings.profile.title"),subtitle:l("settings.profile.sharedSubtitle"),children:n.jsx(REe,{})}),!a&&n.jsx(jBe,{}),n.jsx(WIe,{}),n.jsx(KIe,{}),n.jsx(MBe,{}),n.jsx(PBe,{}),n.jsxs("div",{children:[n.jsx(FEe,{}),n.jsx(wPe,{}),!a&&n.jsx(_Ee,{}),n.jsx(OEe,{}),n.jsx(GEe,{}),n.jsx(KEe,{})]})]}),v==="appearance"&&n.jsxs(n.Fragment,{children:[n.jsx(lt,{title:l("settings.skin.title"),subtitle:l("settings.skin.subtitle"),children:n.jsx(iBe,{})}),n.jsxs("div",{children:[n.jsx(qEe,{}),!a&&n.jsx(UEe,{})]})]}),v==="botDefaults"&&n.jsxs(n.Fragment,{children:[n.jsx(bBe,{}),n.jsxs("div",{children:[n.jsx(zEe,{}),n.jsx(xfe,{})]}),n.jsx(lt,{title:l("settings.roomTurns.title"),subtitle:l("settings.roomTurns.subtitle"),children:n.jsx(rBe,{})}),n.jsx(IBe,{}),n.jsx(EBe,{})]}),v==="setup"&&n.jsx(GBe,{}),v==="clipboard"&&n.jsx(oEe,{}),v==="dictation"&&n.jsx(gEe,{}),v==="voice"&&n.jsx(xBe,{}),v==="watchAlong"&&n.jsx(AEe,{}),v==="marketplace"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:l("settings.marketplace.intro")}),n.jsx(p$,{embedded:!0,onOpenMcp:()=>d("mcpServers")})]}),v==="mcpServers"&&n.jsx(d$,{embedded:!0}),v==="addons"&&n.jsx(Bhe,{}),v==="personalBot"&&n.jsx(Ble,{}),v==="memory"&&n.jsx(kBe,{}),v==="engines"&&n.jsxs(n.Fragment,{children:[n.jsx(bPe,{}),n.jsx(Vce,{})]}),v==="connections"&&n.jsx(JEe,{}),v==="freeModels"&&n.jsx(CO,{billing:"free"}),v==="engineTiers"&&n.jsx(khe,{}),v==="accounts"&&n.jsx(fce,{}),v==="vault"&&n.jsx(aEe,{}),v==="assistants"&&n.jsx(tTe,{}),v==="companion"&&n.jsxs(n.Fragment,{children:[n.jsx(kTe,{}),!a&&n.jsx(xTe,{}),n.jsx(HPe,{phonePairingBelow:!a}),!a&&n.jsx(XPe,{profileEmail:e.config?.profile?.email})]}),v==="computer"&&n.jsxs(n.Fragment,{children:[n.jsx(lt,{title:l("settings.computers.hosted"),subtitle:l("settings.computers.hostedSubtitle"),children:n.jsxs("div",{className:"flex flex-col gap-4",children:[n.jsx(Dg,{section:"box"}),n.jsx(Tne,{})]})}),n.jsx(qPe,{})]}),v==="repos"&&n.jsx(Mpe,{}),v==="desktopWorkspaces"&&n.jsx(STe,{}),v==="backups"&&n.jsxs(n.Fragment,{children:[n.jsx(OBe,{}),n.jsx(qBe,{})]}),v==="usage"&&n.jsx(GTe,{}),v==="people"&&n.jsx(lTe,{}),v==="activity"&&n.jsx(hTe,{}),v==="workspaces"&&n.jsx(XTe,{}),v==="organization"&&window.ogb?.organization&&!a&&n.jsx(PTe,{}),v==="experimental"&&n.jsxs(n.Fragment,{children:[n.jsx(HEe,{}),n.jsx($Ee,{})]})]})]})]})})}const JB="flex flex-1 items-center justify-center gap-1.5 rounded-lg bg-accent py-1.5 text-[13px] font-medium text-white transition-colors disabled:cursor-default disabled:bg-control disabled:text-ink-secondary";function YB(e){return e?/cannot find .*\.yml|404/i.test(e)?"No update has been published for this platform yet.":/ENOTFOUND|ECONNREFUSED|ETIMEDOUT|net::/i.test(e)?"Couldn't reach the update server.":e.split(`
|
|
606
|
-
`)[0].slice(0,140):"Something went wrong."}function ZEe({state:e,onOpen:t}){return n.jsxs("button",{type:"button",onClick:t,"data-update-reminder":!0,className:"animate-panel-in fixed bottom-4 left-4 z-50 flex items-center gap-1.5 rounded-full border border-accent/40 bg-panel px-3 py-1.5 text-[12.5px] font-medium text-accent shadow-lg shadow-black/30 hover:bg-control",children:[n.jsx(So,{size:13}),e.status==="downloaded"?`Restart to update${e.version?` to ${e.version}`:""}`:`Update available${e.version?`: ${e.version}`:""}`]})}function QEe(){const e=zC(),[t,a]=f.useState(null),[o,i]=f.useState(null),s=e?.status;if(f.useEffect(()=>i(null),[s]),!e||e.status==="idle"||e.status==="checking")return null;const r=`${e.status}:${e.version??""}`;if(t===r)return e.status!=="available"&&e.status!=="downloaded"?null:n.jsx(ZEe,{state:e,onOpen:()=>a(null)});const c=window.ogb.updater,d=e.status==="installing",p=e.status==="preparing",h=e.status==="downloading"||p||d,g=e.installMode==="handoff",b=e.status==="available"?`${Wa().name} ${e.version} is available`:e.status==="downloading"?`Downloading ${e.version??"update"}…`:p?"Preparing update…":e.status==="downloaded"?`${e.version} is ready`:d?g?"Opening a terminal…":"Restarting to update…":e.status==="handed-off"?"Finish in a terminal":"Update failed",x=e.status==="available"?"A newer version is ready to download.":e.status==="downloading"?e.percent==null?"Starting download…":`${Math.round(e.percent)}%`:p?"Download complete. macOS is preparing the update.":e.status==="downloaded"?g?"Copy the install command and open a terminal.":"Restart to finish updating.":d?g?"Copying the command…":e.message||`${Wa().name} will reopen in a moment.`:e.status==="handed-off"?e.terminalOpened?"Command copied — paste it in the terminal that opened.":"Command copied — paste it in a terminal to finish.":e.retryable===!1?`${YB(e.message?.split(" Quit and reopen ")[0])} Quit and reopen ${Wa().name} before trying the update again.`:YB(e.message);return n.jsxs("div",{className:"animate-panel-in fixed bottom-4 left-4 z-50 w-[300px] rounded-xl border border-hairline/40 bg-panel p-3.5 shadow-2xl shadow-black/50",children:[n.jsxs("div",{className:"flex items-start gap-2.5",children:[n.jsx("span",{className:"mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-full bg-accent/15 text-accent",children:n.jsx(So,{size:14})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-[13.5px] font-semibold text-ink",children:b}),n.jsx("div",{className:"mt-0.5 text-[12.5px] text-ink-secondary",title:x,children:x})]}),!h&&n.jsx("button",{onClick:()=>a(r),className:"shrink-0 rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink",title:"Dismiss",children:n.jsx(jt,{size:14})})]}),e.status==="handed-off"&&e.command&&n.jsx("code",{className:"mt-2.5 block overflow-x-auto rounded-lg bg-control px-2 py-1.5 font-mono text-[11.5px] whitespace-pre text-ink-secondary",children:e.command}),e.status==="downloading"&&n.jsx("div",{className:"mt-2.5 h-1 overflow-hidden rounded-full bg-control",children:n.jsx("div",{className:V("h-full rounded-full bg-accent transition-[width]",e.percent==null&&"w-1/4 animate-pulse"),style:e.percent==null?void 0:{width:`${Math.min(100,Math.max(0,e.percent))}%`}})}),(p||d)&&n.jsx("div",{className:"mt-2.5 flex gap-2",children:n.jsxs("button",{disabled:!0,className:"flex flex-1 items-center justify-center gap-1.5 rounded-lg bg-control py-1.5 text-[13px] font-medium text-ink-secondary",children:[n.jsx(je,{size:13,className:"animate-spin"})," ",p?"Preparing…":g?"Opening…":"Restarting…"]})}),!h&&n.jsxs("div",{className:"mt-2.5 flex gap-2",children:[e.status==="available"&&n.jsx("button",{onClick:()=>{i("download"),c.download()},disabled:o!==null,className:JB,children:o==="download"?n.jsxs(n.Fragment,{children:[n.jsx(je,{size:13,className:"animate-spin"})," Starting…"]}):n.jsxs(n.Fragment,{children:[n.jsx(mE,{size:13})," Download"]})}),e.status==="downloaded"&&n.jsx("button",{onClick:()=>{i("install"),c.install()},disabled:o!==null,className:JB,children:o==="install"?n.jsxs(n.Fragment,{children:[n.jsx(je,{size:13,className:"animate-spin"})," ",g?"Opening…":"Restarting…"]}):g?n.jsxs(n.Fragment,{children:[n.jsx(QY,{size:13})," Install"]}):n.jsxs(n.Fragment,{children:[n.jsx(vn,{size:13})," Restart to update"]})}),e.status==="error"&&e.retryable!==!1&&n.jsx("button",{onClick:()=>{i("check"),c.check()},disabled:o!==null,className:"flex flex-1 items-center justify-center gap-1.5 rounded-lg bg-control py-1.5 text-[13px] text-ink hover:bg-raised-hover disabled:text-ink-secondary disabled:hover:bg-control",children:o==="check"?n.jsxs(n.Fragment,{children:[n.jsx(je,{size:13,className:"animate-spin"})," Checking…"]}):"Try again"}),n.jsx("button",{onClick:()=>a(r),disabled:o!==null,className:"rounded-lg px-3 py-1.5 text-[13px] text-ink-secondary hover:bg-control hover:text-ink disabled:opacity-50 disabled:hover:bg-transparent",children:e.status==="handed-off"||e.retryable===!1?"Dismiss":"Later"})]})]})}const XEe=JSON.parse(`[{"version":"0.1.213","fixed":["Repeated reads or edits of the same file now reuse the approval you gave for that operation during the session.","Session approvals for a simple command in a selected directory now work across repeated calls.","The run summary now explains which commands it counts, separately from file actions and permission prompts.","Unanswered permission requests now keep waiting instead of timing out and telling the bot to skip the work.","A task can switch computers more than once, reconnecting its tools while keeping the original request."],"improved":["New bots default to automatic review for routine work. Explicit manual preferences and computer-control consent are preserved."],"added":["Pause and Resume for supported Claude conversations hold pending permission requests and the next request. Stop still ends the turn; Pause does not freeze a response already being generated."]},{"version":"0.1.212","improved":["Free models now work the same as your other models. A turn that falls back to a free model keeps your full memory and context and can use the same tools, and a bot marked as handling client data can fall back to a free model like any other. The warnings on the Free models card stay, so you decide before you turn it on. Free models are still off by default and are only used after your subscriptions."]},{"version":"0.1.211","added":["GOD MODE run: with GOD MODE on, start a run above the composer (or type /godmode) and Atomic works non stop on one goal until it is done or the time is up (2 hours by default, up to 8). It shows a countdown, a Stop button and a log of everything it approved for you.","During a run Atomic does not stop to ask: it approves every tool, keeps going on pay-per-use keys, may move a bot to another engine when its own is blocked, answers the bot's questions for you, and turns a failed attempt into the next one."],"changed":["GOD MODE has hard limits it never crosses on its own: moving money or buying anything, deleting data outside the task, production deploys, force pushes, and local Postgres databases. Outside a run the card waits for you with the reason; during a run the bot is told no and finishes the rest."],"fixed":["A bot no longer keeps running on a local model its engine cannot use. Atomic Engine and Hermes stop offering local models that are too small for them, and a model the engine refused is replaced once instead of warning on every turn."]},{"version":"0.1.210","fixed":["You can add GitHub and other official servers when 20 servers are already configured. Atomic now supports up to 500 saved servers; each engine still uses its own supported number per conversation."]},{"version":"0.1.209","fixed":["Hermes now runs only your Nous Research subscription. OpenAI Codex, OpenCode, OpenRouter, DeepInfra, Hugging Face and local Ollama models run on Atomic's own engines and are no longer routed through Hermes."]},{"version":"0.1.208","added":["New AI providers in Settings > AI & accounts: GitHub Copilot (sign in with GitHub), OpenRouter, Hugging Face, DeepSeek, Together, Fireworks, the paid tiers of Groq and Cerebras, AWS Bedrock, Azure OpenAI and Google Vertex AI.","Pollinations, a free model that needs no key or sign-up, can be added by hand under Free. It is off by default, comes last among free models and is never used for client data, because prompts sent to it may be stored.","A workspace time zone setting: daily routines and the monthly spend cap now follow your time zone instead of the server's."],"improved":["Model classes: Claude Fable 5.2 and 13 more current models are graded, and every spelling of a model (5.1 or 5-1, with or without an effort or speed setting) shares one class. A newer version of a model Atomic already knows takes that model's class until it is graded.","Model classes: scores from Artificial Analysis's newer index are converted before grading, so frontier models no longer drop a class or two. Turns now try your subscriptions first, then free models, then pay-per-use, and Settings says which order is used inside a class.","An engine that keeps failing the same way is rested for longer, up to 2 hours, so turns stop landing on it.","Slow actions such as saving keys, engine sign-in, refreshing models and the Nexus import get a longer time limit, and other requests time out after 30 seconds instead of waiting forever.","Intel Macs get their own Atomic Engine package."],"fixed":["A turn no longer stops after two engines fail. Atomic keeps moving to the next engine until one answers or none is left.","A limit on one model, such as Claude's Fable limit, now rests only that model. The same account's other models keep running.","Choosing Keep going for pay-per-use keys now holds until a subscription actually answers a turn. It used to be forgotten seconds later.","Editing a ladder or a class in Settings no longer resets what happens when a connection runs out, or whether free models are allowed.","Hermes no longer fails every turn with an internal error when more than 16 MCP servers are enabled.","Atomic Engine (Auto) is no longer stopped as not responding while it is moving to its next account.","A local model on Atomic Engine now runs on your computer after a restart instead of failing.","Mistral Vibe runs when it is installed and signed in, Kimi reports its real error, and a model that only accepts text is no longer sent screenshots.","Security: the desktop app now asks for its own confirmation before GOD MODE, Full or Custom access is turned on, and before any page saves or removes a provider key. The app's pages run under a strict content security policy, and local processes need a credential to read desktop data.","Browser, phone, accounts, computer and agent tools keep working after a session's first turn.","Model gateway calls stop when you disconnect or after 3 minutes of silence, and calls over your spend cap are refused before they reach the provider.","Routines no longer freeze the scheduler when one start hangs, and a tick that arrives during a slow pass runs when it ends."]},{"version":"0.1.207","fixed":["Account, phone and browser tools no longer fail with \\"this turn's tool access has expired\\" after a session's first turn: each tool connection now picks up the current turn's access token on every call.","Separate computers for separate bots: the Computer panel now shows Create when a bot is set to Local VM even while you view a conversation pinned to another computer, and App Settings no longer shows the shared podman command while in per-bot mode.","Setup failures such as a missing engine, a signed-out account or an install step no longer spend a failover try, the turn's capped stop line shows one entry per held event, and setup waits keep one log entry.","Claude's 5-hour limit wording and the Hermes gateway-unreachable error are now classified correctly and no longer force a failover."]},{"version":"0.1.206","added":["Settings > Import has a new Command-line tools source. It reads the skill folders of Claude Code, Codex, Gemini CLI and Grok CLI and brings each skill into Atomic once, on Chibi, your Primary Bot. Nothing in those tools' folders is changed or removed, a skill found in two tools is offered a single time, and any secret inside a skill is masked on the way in.","Reverse engineering ships with Atomic: the REA skill and its vetted, pinned helper server are bundled, off by default. An Administrator switches the server on in Settings > Marketplace > MCP servers and adds it to a bot's allowed servers."],"improved":["Model details name the engine that actually answered after a failover, and a turn placed on a stand-in because its pinned engine was resting, signed out or not installed now counts toward the fallback total.","iPhone and iPad: Team Rooms invite links from auth.chibitek.com open in Atomic instead of Safari."],"fixed":["iPhone and iPad: linking a repository to a conversation, browsing your GitHub repositories and cloning one now work through the paired Mac."]},{"version":"0.1.205","added":["Apple account on your Mac: Settings > Accounts now offers Apple Calendar, Apple Reminders, Apple Contacts and iCloud Drive, read-only, for your Private Bot. Turn on each part you want; macOS asks for permission the first time. Needs macOS 14 or later.","Asking a bot to connect iCloud, Apple Calendar, Reminders or Apple Contacts now finds that built-in account instead of saying it is not in the Marketplace. The card, and the Marketplace page, open Settings > Accounts."],"improved":["iPhone and iPad: a bot's card for an account built into Atomic says to turn it on in Settings > Accounts on your Mac, where that permission lives."]},{"version":"0.1.204","improved":["Automatic updates now finish on their own. With Install updates automatically on, Atomic downloads a new version in the background and restarts into it once the computer has sat idle for a few minutes, so nobody has to open the app or click Restart.","iPhone and iPad: queued messages show a Steer button so you can redirect a bot that is already working, the composer stays compact while you type, and a long press on any message opens Reply, Mark as Unread, Copy and Select Text."]},{"version":"0.1.203","improved":["Attention badges stop at 10+ on Mac, iPhone, iPad and the Home Screen widgets, and count only what needs you: waiting approvals and questions, and finished results you have not looked at. Idle conversations stay out of the bell.","Opening a thread, or replying in it, counts its finished result as reviewed, so Ready for you no longer piles up with results you have already read.","A finished result left unreviewed for 30 days is archived, never deleted; unarchive the thread to bring it back."]},{"version":"0.1.202","added":["When Nexus offers to bring in what your AI already knows about you, Atomic shows that offer once, on Mac and on iPhone and iPad, after checking your Chibitek sign-in. Yes hands it to your Private Bot to import; Not now declines. An expired sign-in shows a single Sign in again instead."]},{"version":"0.1.201","improved":["Signing in to Atomic with your Chibitek account now connects Nexus and Mochii for you: any that are missing are added and signed in with that same account, with no Settings step and no separate browser sign-in. Settings shows them as signed in with Chibitek."],"fixed":["When Nexus or Mochii turn down an expired Chibitek sign-in, Atomic now renews it and tries again right away instead of pausing Nexus memory for up to 30 minutes."]},{"version":"0.1.200","added":["Link repos from the conversation on Mac and iPhone: the folder chip (Mac) and Add to conversation > Repos (iPhone and iPad) offer your registered repos, git folders under ~/repos and your GitHub repos, which clone into ~/repos in the background."],"improved":["Every bot now follows a pinned facts rule: it checks the PAW workspace, Nexus memory and the connected systems of record before the open web, and leaves out a fact it cannot source instead of filling the gap."],"fixed":["Company bots keep their tool access for the whole conversation. The 0.1.199 notes announced this fix, but the agents proxy change was not in that build. The proxy now reads its per-turn token from a file, so pooled Atomic Engine and Hermes sessions no longer fail teammate hand-offs, Nexus memory and Mochii with \\"this turn's tool access has expired\\".","Mode for this bot works from an iPhone or iPad paired through the desktop app. The picker no longer greys out with \\"Mode controls require an Administrator pairing\\"; the paired device owns its selection and it survives a restart. On iPad the open chat is tinted in the roster.","The desktop app reopens the workspace you chose last, including This computer, instead of restoring a paired remote computer on every launch.","On iPhone, a refused Nexus or Mochii sign-in is renewed once in the background, then a single Sign in again notice is shown instead of the same error on every turn."]},{"version":"0.1.199","fixed":["Company bots keep their tools for the whole conversation. The Atomic Engine now reconnects a server whose sign-in details changed between turns, so teammate hand-offs, Nexus memory and Mochii no longer fail with \\"this turn's tool access has expired\\" and the Mochii tools no longer disappear from a bot mid-session.","On iPhone, voice mode speaks replies from This iPhone again."]},{"version":"0.1.198","improved":["Chat scrolling stays smooth in long conversations: message versions are grouped once and reused instead of rebuilt on every update.","On iPhone and iPad, Channels, invite links and multi-bot Team Rooms are available, and the Terminal keeps its output on screen while you type."],"fixed":["\\"Always allow this session\\" on a permission card now covers every command with the same program and subcommand, such as every git status, instead of only the exact text. Commands that chain or redirect still ask one at a time.","Connected Google and Microsoft accounts now work in every company bot without a per-bot Access step. Bot Settings > Access still restricts a bot, and a Personal account stays with the Private Bot.","Cmd+Shift+V is held only while Capture clipboard history is on, so Paste and Match Style works system-wide again when capture is off.","Sidebar header menus open into the window instead of past its left edge.","Pasting more than four images into one message is refused as it happens, with the limit named, instead of failing after Send.","Relaunching Atomic revives a hung or crashed window instead of doing nothing."]},{"version":"0.1.197","fixed":["Local VM setup on Intel and Apple silicon Macs now uses Podman, with guided installation, startup and retry controls.","New Podman desktops use separate folders and an available local port. Older Docker and Colima desktops and files stay untouched.","Desktop workspace labels, the workspace menu and Connected workspaces name the computer hosting Atomic. A paired remote host shows as remote, and the label is derived again at every startup."]},{"version":"0.1.196","added":["Open a Terminal on a bot's computer from your paired iPhone: the Local VM, the VPS or This Mac. Turn it on per phone with Allow terminal in Settings > Remote access.","chibi terminal opens the same shell from a terminal on a chibi serve computer."],"fixed":["A shell on This computer no longer closes right away for a bot that has never run."]},{"version":"0.1.195","added":["Channels has its own sidebar tab for invited conversations with people and their primary Chibi.","Each Chibi joins with a verified identity tied to its owner and Atomic installation."],"fixed":["Changing an invitation link clears the old preview before joining.","Channels keep private conversation history and capability-sharing settings out of the room."]},{"version":"0.1.194","added":["A running or paused goal stays pinned above the composer with its status, time elapsed and turn count. Pause, resume or stop it from the bar."],"fixed":["Goal updates in a chat show as a goal card instead of an empty message."]},{"version":"0.1.193","added":["The model picker has one Atomic Engine (Auto) choice. It picks a model for each class and uses your subscriptions first.","Settings has Allow free models. Atomic asks before turning it on, and bots with client data never use free models.","Local model servers such as Ollama, LM Studio, oMLX, EXO and Unsloth join Atomic Engine's automatic chain after your subscriptions and before any pay-per-use key.","Claude Code and Codex can choose Atomic Engine with the atomic/auto model."],"changed":["Chibi and new bots start on Atomic Engine (Auto). Chibi's model resets to it once after this update.","A Nous API key counts as your Nous subscription, not pay per use.","Plans with included monthly credit, such as Ollama Team's $1,000, use that credit before any overage."],"fixed":["Vault no longer adds a leftover Bearer prefix to API keys that use a custom header such as xi-api-key, so ElevenLabs and similar services accept the saved key."]},{"version":"0.1.192","fixed":["Vault shows when an API key is saved and hidden. Replace API key changes it deliberately; blank edits keep the saved key, and failed saves leave the original intact.","Vault selects the correct API key header for ElevenLabs and HeyGen automatically. Choose a custom header and prefix when a service needs different settings."]},{"version":"0.1.191","added":["The Computer panel now has a Terminal tab. It opens a shell inside a bot's Local VM or VPS, so you can work there without leaving Atomic. Start the Local VM or VPS from the Computer tab first. You can turn the tab off in Settings > Experimental.","The Terminal tab can also open a shell on this computer, as you, in the bot's working folder. This is off until you turn on Terminal on this computer in Settings > Experimental. On Windows the terminal is a basic line console for now, without colours or arrow keys.","On iPhone and iPad, the computer screen and This Mac screen can go full screen. In full screen you keep the typing row and the shortcut keys while you are in control.","On iPhone and iPad, a two-finger tap on a computer's screen is a right-click, and a shortcut bar adds Command, Option, Control and Shift keys that stay held for the next key.","On iPhone and iPad, voice mode now follows CarPlay, Bluetooth and AirPods instead of always using the speaker.","In Settings > AI & accounts > Classes & failover, a step can now be a model on Any subscription. Atomic then uses that model through whichever of your subscriptions has it and still has usage."],"changed":["The order Atomic builds for each class now puts the top-ranked models that run in a full agent app first, whichever provider they come from, and takes one model from each provider in turn. Claude and ChatGPT no longer hold the first places by default. Chibi still starts on Claude Sonnet 5.5.","There is now one skill that sets up your Personal AI Workspace (PAW). It asks what kind of work you do, offers starter shapes for common roles, and can point your other AI tools at the same folder. The older ICM workspace builder is gone, and its commands now open this one.","Chibi now hears about every time a bot's turn moves to another engine, whatever the cause, not only sign-in failures. Repeats for the same engine and cause are held back for an hour, so one bad provider is one report."],"fixed":["With GOD MODE on, a chat could only use the kind of AI app it last ran on. If that one needed a sign-in, the turn stopped with an error even though your other accounts were ready. A turn can now start on, or move to, any of them.","An account that needs a sign-in, or whose key has expired, no longer uses up one of a turn's two tries. Atomic skips it and carries on with the next one.","Nexus memory no longer stays shut for half an hour after a brief network drop. Old failures are forgotten, and the message now says how long the wait is.","When Hermes Agent gives up after its retries and writes the failure as an ordinary reply, Atomic now moves the turn to the next engine instead of showing that text as the answer."]},{"version":"0.1.190","added":["Your bots can use the logins and API keys in Settings > Vault without choosing bots for each one. New and imported items are open to all your bots, each only on its own website. One button on the Vault page opens the items you saved before, and you can still limit any item to chosen bots or keep it private.","The Vault import now takes API keys as well as logins, including keys saved under a name alone with no website. Well-known services such as ElevenLabs, OpenAI, GitHub, Vercel and Supabase get their address filled in. Any other key is saved and marked as needing an address before bots can use it.","Every bot now refuses text written for an AI that it finds in a web page, file or code, and tells you where it was and what it tried to do. Pages read with the built-in browser are also checked automatically.","Where Hermes is installed, you can sign in to your Nous Research account from Settings > AI & accounts."],"changed":["Chibi now starts the same way on every computer: Automatic, in the Plata class, on Claude Sonnet 5.5. This update resets Chibi to that once, including any model you had pinned and any changes to the Orchestrator's order. Without a Claude account, Chibi uses the closest-rated model you have.","The bots Atomic makes for each AI subscription (Claude, ChatGPT, Gemini, Grok and the others) now run only their own provider's models. When that provider is out of usage the bot stops and offers a handoff, instead of continuing on another provider.","In Settings > AI & accounts > Classes & failover, a provider now uses one account unless you choose Any account for it.","A Nous Research API key now appears with the pay-per-use keys, because Nous bills keys per use. Signing in through Hermes uses your Nous subscription."]},{"version":"0.1.189","added":["Bots can now sign in to websites with a login saved in Settings > Vault. Tick the bots allowed to use the login. In the built-in browser, Atomic types the username and password into the site's sign-in page itself, only on that login's website, so the bot never sees the password."]},{"version":"0.1.188","added":["Settings > Vault can now hold API keys. Choose New API key, enter the key, the header it is sent in and the web addresses it may go to, then tick the bots allowed to use it. Atomic makes the request and adds the key itself, so the bot never sees it."]},{"version":"0.1.187","fixed":["After a tool is denied or fails, the turn stays on the same engine instead of moving to another one.","A Claude account that also hosts local models is listed once in the model picker.","Desktop viewer passwords for a Local VM or VPS are no longer passed on the Docker command line.","Team room presence stays fresh after the first heartbeat, and a room message updates the chat list preview right away.","The previous-bot shortcut opens the last bot you used, and New thread in VS Code opens a fresh chat.","A calendar call keeps its next run when an edit leaves the schedule alone, and Atomic stays responsive while scripts launch."]},{"version":"0.1.186","fixed":["A stopped Local VM now starts again with its disk and files, from the Start button in Settings or by itself the next time a bot needs it. Atomic no longer asks you to remove and recreate it."]},{"version":"0.1.185","fixed":["Claude no longer stops with \\"needs sign-in\\" because of an old Anthropic command-line login left on the computer. Atomic now uses only Claude's own sign-in.","When no engine can work on this computer, the stop message also names the engines that are signed out or unavailable, so you can see which one to sign in to.","A model your plan does not include now pauses only that model, not every Claude model."]},{"version":"0.1.184","fixed":["Workspace backup metadata limit raised to 64 MB, and disposable Antigravity tool catalogs are excluded so large workspaces back up cleanly.","Selective category restore in Settings lets you restore specific parts of your workspace without overwriting existing local data."]},{"version":"0.1.183","fixed":["Nous Research now connects with your Nous portal API key. Setup no longer tries to install Hermes.","Z.ai GLM Coding Plan now connects with your plan key directly, without Hermes.","Workspace backups skip build output inside task folders (git history, Xcode build data and archives, dist and release folders), so large workspaces stay under the backup file limit."]},{"version":"0.1.182","fixed":["Full backups can run while bots, approvals, sign-ins and computer actions are active. Restore still waits for work to finish before replacing workspace data.","Fixed a Mac network socket error that could interrupt backups and other requests."]},{"version":"0.1.181","fixed":["Full workspace backups no longer stop when a file changes while it is being copied. Growing logs and replaced files are captured without cancelling the backup."],"improved":["Backups record a warning when a file keeps changing or disappears before it can be captured. Encryption and restore integrity checks remain in place."]},{"version":"0.1.180","added":["Settings > Classes & failover now has a preference for when a subscription runs out: ask before switching, move to another plan then ask before a paid key (the default), or keep going.","On iPhone Duo, a slim shortcut column fills the space below the status indicators: All chats, Needs you, Tasks, Computer for paired bots, New chat and Search."],"improved":["When a plan is used up, Atomic can move the chat to the next approved connection. A brief rate-limit wait is not treated as the plan running out, so the chat stays put after the usual retries.","A new turn no longer silently uses a pay-per-use key when every subscription is resting. Atomic asks first, unless you already chose Keep going.","Wide iPhone and iPad windows show your chat list beside the open conversation. Needs you shows only items waiting for your answer or approval."]},{"version":"0.1.179","fixed":["When an engine fails, Atomic now moves the chat to a genuinely different engine instead of retrying another copy of the same one with the same key, so a broken key no longer stops every turn.","An OpenRouter key that has been revoked or deleted is now recognized as a dead key. Atomic stops using it until you save a new one, and keeps your chats running on another engine meanwhile."]},{"version":"0.1.178","added":["Settings > Updates has an Install updates automatically switch, on by default. Atomic downloads updates as it finds them and installs them the next time you quit. Turn it off to check only.","Settings > Vault holds up to 3,000 items, and a password manager import can take just one vault, folder or tag. Pick the file, choose what to bring in, then import.","Settings > Engines has a Free tab that lists the free models, each with a link to sign up with the provider."],"improved":["Turning on free models in Auto now shows a clear warning first. Free turns are labeled in the chat header, are reported to your Chief of Staff, and never reach Nexus or PAW.","On iPhone, Home shows the device you're working in as its title. Tap it to switch devices, rename one or add a new one."],"fixed":["Turning off Include free models in Auto works again.","On iPhone, tapping a bot, a pinned bot or Settings on Home opens it again.","On Linux without a system keyring, Atomic refuses to store secrets instead of saving them where other apps could read them."]},{"version":"0.1.177","added":["You can attach any kind of file to a message, on the Mac, iPhone, iPad, Android, Windows and Linux. HTML and Markdown files go in as readable documents, and other files such as zips travel with the message as downloads."]},{"version":"0.1.176","added":["On iPhone and iPad, the model menu in a chat now has Choose a model. It lists every provider your subscriptions and API keys give you, with each provider's models and reasoning effort, and pins your pick to that thread."],"fixed":["On iPhone and iPad, the model menu in a chat no longer jumps back to the top while you scroll it. The model classes and the modes now open as their own short lists."]},{"version":"0.1.175","added":["Settings > Vault can import the logins you export from a password manager as a CSV file. Exports from Chrome, Edge, Safari, Firefox, 1Password, Bitwarden, LastPass, Dashlane, Proton Pass, NordPass and RoboForm all work.","About me now stays in step across Atomic, your PAW workspace and Nexus. A change in one place reaches the others, and if two places disagree, Settings > About me lets you pick which version to keep."],"fixed":["Dictation in the chat box works again after you use system-wide dictation. Since 0.1.174 the system-wide dictation kept the microphone in its echo-cancelling mode, so the chat box heard almost nothing.","When dictation hears nothing, Atomic now says so instead of asking you to check your Microphone and Speech Recognition permissions. A refused microphone is named as soon as dictation starts."]},{"version":"0.1.174","added":["Bots can now read, change and cancel existing Google and Outlook calendar events: title, description, location, time, guests and room, for one occurrence, this and following, or a whole recurring series. Changes that email guests ask for your approval first."],"fixed":["Claude no longer fails on every message on Macs with an older Claude Code. Atomic was passing it an option that only newer versions understand.","Dictation no longer types words you did not say. The microphone now filters out sound from your own speakers, such as Atomic reading aloud, a call or a video.","A dictation started with the shortcut now stops on its own after 20 seconds of silence, and after 10 minutes at most, so a take left running cannot pick up the room.","Words heard while you were in another app are no longer typed in a burst when you come back. They go on the clipboard, so you can paste them if they are yours.","Auto-correct can no longer add words to your dictation, and words the speech engine is unsure of are left out."]},{"version":"0.1.173","added":["Back up and restore your whole Atomic setup to another Mac (Settings), encrypted by default.","When you control This Mac from an iPhone or iPad, taps, touch and hold, drags and scrolls now reach the Mac. This is the desktop side of phone pointer control.","Settings > Engines and tiers can include free models in Auto. It is off by default, free models are tried only after your subscriptions and keys, and a bot marked as handling client data never uses them.","On iPhone and iPad, Atomic opens on the device you used last, either the iPhone or a computer. If that computer is no longer paired, it opens on the iPhone.","On iPhone and iPad, Home shows an icon for the iPhone and each connected computer. Tap one to switch to it, or touch and hold it to rename it. Names are saved on the phone only."],"fixed":["A task handed to a teammate whose working folder is busy now waits in the queue instead of failing right away.","New installs: Chibi logs every feature request you mention as a Mochii task. Existing Chibis keep their own instructions."]},{"version":"0.1.172","added":["On iPhone and iPad, touch and hold a link in a bot's reply to open it in your default browser or copy it. A normal tap works as before.","On iPhone and iPad, touch and hold a word in a bot's reply to select just that part, drag the handles to expand it, then copy, look up or share it.","On iPhone and iPad, pinch to zoom a computer screen from 1x to 8x, drag to pan, and double-tap to zoom in or back out. It works on a bot's computer and on This Mac.","On iPhone and iPad, when you are controlling This Mac, a tap clicks instantly, touch and hold right-clicks, touch and hold then drag moves things, and swiping scrolls. The Mac must run a desktop Atomic update that includes phone pointer control.","On iPhone and iPad, type / in a bot chat and pick /goal to give the bot an objective it keeps working on until it is done. /goal status, pause, resume and stop control it."],"fixed":["On iPhone and iPad, the mode menu works again: Ask, Auto edits, God Mode and Plan can be read and changed from a paired phone. Changes still need an Administrator's paired device, and every mode above Ask asks you to confirm.","On iPhone and iPad, a bot's question with three or more answers, or long ones, shows each answer as its own full-width button instead of squeezing them into one row (TestFlight build 69).","Tools from Atomic Engine no longer go missing when two copies of its tool lookup start at once.","The Linux downloads list shows a new release right away instead of an older cached copy."]},{"version":"0.1.171","added":["On iPhone and iPad, open a bot's computer view and tap Control this Mac to watch this Mac's screen. Take control, confirmed with Face ID, lets you tap, scroll and type on the Mac while the bot's computer use is paused.","/skills and /skill commands in the composer list a bot's skills and run one on a task.","On iPhone and iPad, skills and remote MCP servers can be added, edited and removed for chats that run on the phone. Servers that need a sign-in open it in the browser, and every tool call asks for approval with Face ID or passcode.","Chat links to saved deliverables in shared folders open from any conversation you can see. Settings > General sets which folders are shared."],"improved":["On iPhone and iPad, typing and streaming replies no longer redraw the whole chat, so the composer stays steady and the app feels faster.","On iPhone and iPad, AI & accounts is in Settings and works without pairing a computer. Provider sign-up links go to the right pages.","From a paired iPhone or iPad you can pin and unpin bots and rooms and add Marketplace apps. A phone can only change the pin on a bot or room, nothing else."],"fixed":["Subscription bots fall back to the next model in the same class when the top model is resting after a usage limit, instead of reporting nothing ready.","On iPhone and iPad, mode controls reload after a reconnect, offer a retry, and say why they are unavailable.","On iPhone and iPad, the workspace opens even when one saved item cannot be read, and its + menu offers New thread."]},{"version":"0.1.170","added":["Plan mode keeps a bot to reading and planning until you approve the plan. It is enforced for Claude, Atomic Engine and the shared chat tools, and it holds through reconnects.","On iPhone and iPad, you can choose each bot's work mode from the model picker."],"improved":["The Most Current button takes you to the newest message in a conversation.","The bot list on iPhone and iPad loads faster."],"fixed":["Unread indicators clear when an open conversation is restored after a reload or reconnect. Pending approvals still require your response.","On iPhone and iPad, every approval prompt asks for Face ID or Touch ID before your answer is sent."]},{"version":"0.1.169","improved":["Desktop conversations show the active approval mode as a readable label beside its icon. Select the label to review or change the conversation’s permission level."]},{"version":"0.1.168","added":["Offline Atomic handbook with platform differences, setup, dictation, backups and troubleshooting. Open Help Center or About on desktop, or Settings on mobile."],"improved":["Desktop update safeguards retain dictation preferences and refuse to overwrite unreadable settings. Stopped Local VM disks are kept; existing images still require manual recovery before recreation.","Desktop clipboard picker shows a compact recent list and a full preview before pasting. Settings below the list opens Clipboard in the main Settings popup."],"fixed":["Desktop dictation Names and words no longer loses unsaved text when status refreshes. Failed saves keep your draft for retry."]},{"version":"0.1.167","fixed":["Windows: the helper that lets bots use your computer is now signed by Chibitek Inc. too, so every program Atomic installs carries Chibitek's or its maker's signature. 0.1.164 to 0.1.166 were never released."]},{"version":"0.1.166","added":["Early access: Atomic can connect to Addigy's hosted MCP server. When a bot asks Addigy to change something, you get a card to confirm or decline first. Signing in to Addigy this way has not been verified yet."]},{"version":"0.1.165","fixed":["Windows: the uninstaller is signed by Chibitek Inc. again. 0.1.164 was never released."],"improved":["iPhone and iPad build 57: the on-device model can stay loaded between messages, with a setting for where it runs. Speed gains have not been measured on an iPhone yet.","iPhone and iPad build 56: desktop conversation updates are grouped into 50 ms batches to reduce redraws. Notification pictures no longer hold up streaming replies.","The desktop companion compresses startup snapshots with gzip. This requires a desktop build containing the latency fix; the iPhone update alone does not enable compression."]},{"version":"0.1.164","added":["Early access: bots can ask you to enter a key for a secure MCP connection, such as Addigy, on a protected card. The key is saved in Atomic's encrypted store and never appears in chat. Signing in to Addigy this way has not been verified yet."],"fixed":["The Vault opens again after you restart Atomic.","Windows: every program in the installer, including the one that builds the uninstaller, is signed by Chibitek Inc. before it runs."],"improved":["Setup welcomes you by name with your company's logo when you sign in with Chibitek.","Bots on different teams now message each other through their team's Chief of Staff."]},{"version":"0.1.163","fixed":["Dictation on iPhone, iPad and Mac keeps earlier sentences and avoids repeating completed phrases. On iPhone and iPad, listening continues when the recognizer starts a new session. Please test a two-minute dictation with pauses and intentional repeated phrases."],"improved":["Windows: Qwen is turned off for now while its installer is unreliable from here. It still works on macOS and Linux, and any Qwen setup you saved is kept."]},{"version":"0.1.162","added":["Clipboard history on macOS and Windows.","Setup asks what you do and suggests starter bots that fit your work.","Each routine now has a private Mochii task that stays in sync."],"fixed":["Mac dictation keeps earlier lines instead of starting over, and stops listening when you send."]},{"version":"0.1.161","fixed":["Recover from an Antigravity checkpoint error on your next message while keeping your conversation history. Failed requests are not automatically repeated."]},{"version":"0.1.160","added":["Model details shows which model actually answered each turn, with history and counts."],"improved":["Attachments no longer stop at 512 MB. Uploads are refused only when your disk is nearly full, and nothing is deleted automatically."]},{"version":"0.1.159","added":["React to messages on iPhone with emoji, including skin-tone choices.","Choose the Panes mascot body."],"improved":["Expand the iPhone message composer into a half-height sheet.","Generate bot avatars with an eligible signed-in Codex subscription, without entering an API key.","API image generation is an explicit choice. A failed subscription never silently switches to API billing."]},{"version":"0.1.158","added":["When a company subscription bot's provider can't answer, that one conversation keeps going on the same class from another provider for up to 50 turns, with a handoff you can download or pass to another bot.","Vault in Settings keeps saved logins, cards and contacts encrypted on this computer, with search, categories and add, edit and remove.","Dictate into Brain dump.","A quiet banner says when a turn switched engines and when the first one resets. You can turn it off in Settings."],"improved":["A turn tries at most two engines, then stops with one plain line saying what to fix.","Local VM uses only Colima on the Mac and never opens Docker Desktop."],"fixed":["The terminal app picks a free port when its usual one is busy."]},{"version":"0.1.157","added":["Personal goals with pause, resume, completion criteria and token limits, available in chat and the chibi CLI.","Open-model setup on Windows and Linux, with Ollama Cloud models in the picker.","iPhone shows what changed after an update.","Import a Markdown skill file with the file picker, then review and enable it."],"fixed":["Waiting bots no longer look selected when another conversation is open.","Expired Claude sign-ins use an eligible fallback instead of stopping at the final error."]},{"version":"0.1.156","added":["Brain dump: paste a list of tasks, press Sort into tasks, and each line gets a suggested bot from your own roster. Nothing is sent until you press Send on a row.","Personal goals: type /goal followed by an objective in a one-to-one chat and the bot keeps working across turns until it's done, needs you, or hits a limit. /goal status, pause, resume and stop control it; the same commands work from the terminal."],"improved":["Default model ladders and class floors are tuned for better results out of the box.","The Settings dialog can be resized and remembers its size. View > Zoom now scales just the Settings dialog while it's open, and the whole window otherwise.","An approval request now goes to whichever device you're actually using (desktop or phone), and Face ID or your passcode is required to approve it on iPhone and iPad, so work doesn't stall waiting for a Mac you've stepped away from."],"fixed":["The sidebar no longer highlights the wrong bot's conversation."]},{"version":"0.1.155","improved":["A bot keeps working when one of its tools is down. If a tool server (an MCP server) will not start, times out or stops during a turn, Atomic leaves only that server's tools out, tells the bot in one line which server is missing, and tries it again on a later turn. The rest of the turn runs as normal.","When a tool server fails, Chibi gets one quiet Team incident naming the server, the same way a model fallback is reported. Raw startup errors never reach your chat."],"fixed":["On the Codex engine, a custom tool server that tried to set a protected environment variable used to end the whole turn. Atomic now skips just that server and logs it once."]},{"version":"0.1.154","added":["Pinned bots can be put in any order: drag them in the sidebar (or use Alt with the arrow keys, or Move left / Move right in a tile's menu). On iPhone and iPad 1.0.1 (50), long-press a pinned bot to move it.","Connect one Atomic desktop to another over Tailscale. On the other computer, open Settings > Devices & remote access > Remote access > Pair over Tailscale and copy the link; paste it on this computer under Connect to another computer."],"improved":["Accounts marked Personal and your subscriptions can now be used by company bots as well as your Private Bot. Company or Personal only says who owns the account.","Your Private Bot works through Chibi: it hands work for other bots to Chibi and never creates bots itself.","Atomic's bots use only Chibitek Nexus, PAW and Omi for memory. Other memory add-ons for Hermes stay switched off."],"fixed":["Claude accounts that have no sign-in of their own no longer show as signed in. They used to borrow an old, expired Anthropic login, which made bots answer \\"Login expired\\". Sign in to each account you want to use.","When Hermes answers \\"Login expired\\", the turn now moves to the next engine in the bot's class.","A chat pinned to an Ollama model no longer jumps to another Claude account when one account hits its limit.","The Private Bot's subscription list no longer says \\"None yet\\" when you have subscriptions."]},{"version":"0.1.153","added":["Team Rooms are on. Sign in with Chibitek in Settings > General > Basics, then open Tools > Team Rooms to start a room or join one with a link."],"improved":["One broken MCP server no longer stops a bot. Atomic sets that server aside for a while and the bot keeps working with its other tools; Settings shows which server is failing."],"fixed":["When Claude says \\"Login expired\\", or answers with a connection error, the turn now moves to the next engine in the bot's class instead of showing that message as the reply.","When a provider cannot be reached, API engines, Muse Code and Apple Intelligence now hand the turn to the next engine instead of stopping.","Marking a \\"Ready for you\\" result as reviewed now works from the iPhone app. Before, the phone showed a \\"no route\\" error.","Bots that Atomic runs now use only Atomic's own memory, not memory left over from other tools on the same Mac.","Pairing help in Settings now points to Remote access instead of a command that could not be installed."]},{"version":"0.1.152","added":["Sign in with Chibitek in Settings > General > Basics. It signs you in through your browser with your Chibitek Google or Microsoft account, and Team Rooms use it to know who you are."],"fixed":["\\"Always allow this session\\" on a Claude bot now really lasts for the session. Atomic remembers it and stops asking again for the same tool, instead of showing the same permission card on the next request."]},{"version":"0.1.151","added":["Mistral Vibe is now a subscription. Le Chat Pro and Team are now Mistral's Vibe Pro and Team plans. In Settings > AI & accounts > Subscriptions, install Mistral Vibe and choose Sign in with Mistral to approve on Mistral's own page. A Mistral bot is created that uses only your Vibe plan, and Mistral Vibe joins your failover ladders. It works on Mac and Linux; on Windows, install Vibe with Mistral's instructions first.","The MiniMax M Plan (formerly the Coding Plan) is now a subscription. Paste your M Plan key (it starts with sk-cp-) on the MiniMax card in Settings > AI & accounts > Subscriptions. A MiniMax bot is created, MiniMax M3.1 Flash is added, and your plan joins your failover ladders as a subscription instead of a pay-per-use key.","The Z.ai GLM Coding Plan is now a subscription, through Hermes Agent. Z.ai lets the plan run only in the tools it lists, and Hermes is one of them. Run Hermes setup, choose Z.AI / GLM and paste your plan key. A Z.ai GLM bot is created that uses only GLM 5.3 and GLM 5.3 Flash, and those models count as part of your plan, not pay per use."],"improved":["The Perplexity card now says plainly why Pro and Max cannot be used here: they include no API credits, and the Perplexity API is billed separately.","Mistral now shows Mistral's own full-colour logo.","Atomic on ARM Linux (such as the NVIDIA DGX Spark) now gets updates from Settings > Updates. Download the update, then run the install command Atomic opens a terminal for."]},{"version":"0.1.150","added":["Watch-Along: watch a YouTube video inside Atomic with Chibi commenting as it plays. Paste a single YouTube link in a message box and choose Watch along, or use Watch a video in the sidebar's compose menu or the command palette. For now it is offered only on computers enrolled in Chibitek's organization."],"improved":["Bots in a team room now switch engines quietly when one fails. A resting or signed-out engine is skipped, and a provider error (such as an expired API key) moves the turn to the next engine instead of showing in the room."],"fixed":["On Windows, Atomic no longer jumps back to the front after you minimize it. A tool that started Atomic's program to run a script was being treated as a second launch of Atomic, which brought the window forward and stopped the script from running.","iPhone and iPad 1.0.1 (47): when a DNS filter or DNS profile (Scout DNS, for example) looks up your computer's Tailscale name through public DNS, Atomic now says so and tells you which domain to forward to Tailscale, instead of saying Phone access looks off."]},{"version":"0.1.149","improved":["The Development pack's Chibitek Developer Playbook is updated to v2026.10.23.1, with current guidance on build runners and releases."],"fixed":["Windows release checks now include the Meta Muse Code command-line tool, so Windows builds that ship Muse Code pass their checks."]},{"version":"0.1.148","added":["Meta Muse Code is now a subscription. In Settings > AI & accounts > Subscriptions, install Muse Code with Meta's installer and choose Sign in with Meta to approve with your own Meta account. A Muse Code bot is created, and Muse Code joins your failover ladders after Claude and ChatGPT. It works on Mac, Windows and Linux; on iPhone and iPad you can see its status and start the sign-in on your paired computer. Meta's use of your content for training is turned off.","Meta Muse Code and the Meta Muse API key now show Meta's official logo."]},{"version":"0.1.147","fixed":["A Hermes signed in to Nous Portal now shows as signed in under Settings > AI & accounts > Subscriptions even when another provider is your Hermes default. Atomic reads Hermes's own sign-in record instead of only its default provider."],"improved":["The Nous Research bot can use any model on your Nous Portal plan, not only Nous's own Hermes models. It starts on your Hermes default when that runs through Nous, and its model menu lists only Nous models."]},{"version":"0.1.146","improved":["MCP server secrets (API keys, tokens and Authorization headers) are now kept in your computer's secure store, the Keychain on Mac and Windows' built-in encryption on Windows, instead of in plain text in Atomic's settings file. Each server gets its secrets only when it starts. Secrets already in your settings move over automatically when you update. If a server had a token typed into its command, Settings > Marketplace > MCP servers asks which setting name it reads, then passes the token that way."]},{"version":"0.1.145","added":["Nous Research is now its own subscription. A Hermes signed in to Nous Portal shows as Nous Research in Settings > AI & accounts > Subscriptions, and gets its own bot that uses only Nous's models."],"improved":["Provider menus are organized into Subscriptions, Flat plans, API keys, On this computer and Atomic, with plain names and no duplicates. Two accounts of one provider are labelled Company and Personal, and Atomic asks you to name them when there are more. Each provider's model menu now lists only the models that provider hosts.","Bots now put all your AI subscriptions to work. In Settings > AI & accounts > Classes & failover, each tier's automatic ladder keeps Claude or ChatGPT in the first two places (Chibi still starts on Claude), then takes one model from each of your other plans in turn (Gemini, Grok, Kimi, Qwen, Cursor, Ollama Cloud, OpenCode Go and the rest) before more Claude or ChatGPT models. Pay-per-use API keys stay last, and a ladder you edited yourself is kept as you set it."]},{"version":"0.1.144","added":["Ready for you lists conversations across your bots on desktop and iPhone. Waiting decisions and new completed responses appear first. Opening a completed response saves its review status across paired devices without clearing a newer response or an unanswered approval."],"improved":["Chibi check-ins now show short, actionable cards with large Open and Dismiss buttons on iPhone and desktop. Three items appear first, with Show more for the rest. Internal bot failures stay with the Chief of Staff; unfinished work reaches you only after two failed retries. Quiet hours and delivery history prevent repeated interruptions."]},{"version":"0.1.143","improved":["iPhone and iPad 1.0.1 (38): local model downloads show received-byte progress during each file transfer, with the active download and Cancel control above the model list. Keep Atomic open until completion; cancelling restarts the download next time."],"added":["Claude Sonnet 5.5 and Haiku 5.5 are now available when choosing a Claude bot model, including Chief of Staff team setup."],"fixed":["A model the engine no longer offers (for example Grok 4.6 after the grok CLI retired it) no longer stops the run. The turn continues on the engine's default model, the thread shows one quiet line saying so, and your Chief of Staff gets an incident asking you to change the model setting. The Grok picker now lists what the installed CLI offers.","Any bot can now hand work or a question up to Chibi, and to the Chief of Staff that manages its team, from its own conversation, even across sections. Before, the roster listed Chibi but the handoff was refused with \\"Room work cannot cross the sender's section boundary\\". Handoffs between specialists keep their section rules, and rooms keep theirs."]},{"version":"0.1.142","added":["Windows: dictate into any app with Ctrl+D (rebindable in Settings > General > Dictation), the same as Cmd+D on the Mac.","iPhone and iPad: Atomic's dictation now comes to the mobile app."],"fixed":["Settings has a Voice tab again, under General. It opens on Chibi's spoken-reply voice, and you can switch to any other bot. Each bot's own settings still have the same picker under Voice & alerts."]},{"version":"0.1.141","improved":["Settings > AI & accounts now opens on Subscriptions, with a card and a Sign in button for every AI plan: Claude, ChatGPT, Google Gemini, Grok, Cursor, Kimi, Qwen, OpenCode Go, Ollama Cloud (including Team) and Factory Droid. Microsoft Copilot, GitHub Copilot, Meta AI, Mistral Le Chat, Perplexity, MiniMax and Z.ai GLM are listed too, each with a plain reason it cannot be used yet.","You can add more than one account for a plan and mark each one Company or Personal, for example your company Google Workspace and your personal Google account for Gemini. Each account gets its own bot, and Personal accounts are used only by your Private Bot."],"fixed":["Stopping dictation in the chat box now waits for the final recognized words instead of cancelling them. Escape still cancels recording. Known issue: live-microphone dictation can listen without producing words; a fix is planned for 0.1.142.","Google sign-in now requests Gmail, Calendar and Drive together. Permissions you approve turn on automatically, without a second Turn on step. After updating, reconnect your Google account once in Settings > Accounts.","Bots use Google and Microsoft through Atomic Accounts, with your account-access settings respected. Bots without access explain what is missing. Settings refreshes when you return and shows sign-in status separately from mail, calendar and file permissions.","Signing in to Gemini with a Google account is now easy to find: it is the Google Gemini card under Subscriptions, not hidden inside the Antigravity engine. Connecting Gmail, Calendar and Drive stays under Google & Microsoft, and each place links to the other."]},{"version":"0.1.140","added":["Chibi can now reach and manage every company bot in every team, including bots you add later, as if it were each team's Chief: it can hand them work, fix their setup, manage their rooms and retry their stuck work. Your Private Bot, personal subscription bots and bots hidden from you stay out of its reach.","When you approve something in Chibi's conversation, the bots Chibi hands that work to can do the same thing without asking you again, for a limited time. Questions, credentials, spending and destructive actions still always ask you, and a bot saying you approved something never counts."],"fixed":["On Windows, Claude bots no longer stop with \\"Failed to refresh OAuth token\\" when several of them renew their sign-in at once, a Claude engine that fails to start is tried again before it is reported, and Chibi's check-ins say what went wrong in plain words.","Chibi no longer fails every message with \\"Internal error: Bad Request\\". Your own messages in Chibi's Primary Bot sweeps conversation now run on the model you picked (Plata by default) instead of the cheapest free one, connected apps such as Vercel and this computer no longer make Gemini refuse the whole request, and if a model refuses a request without saying why, the message moves to the next model."]},{"version":"0.1.139","improved":["Opening a bot now takes you back to the conversation you used most recently with it, on your iPhone and on the desktop.","Atomic now starts Colima or Docker Desktop for your Local VM when it is installed but stopped, and a Local VM that simply stopped is replaced on its next use without asking."],"fixed":["Auto conversations no longer stop with \\"Start docker first\\" when the Local VM they last used is unavailable. They continue on the next available place and say where they moved.","Codex no longer fails with \\"invalid transport\\" because of MCP servers in your own Codex settings.","On iPhone, the model class menu and the pay-per-use choices work again."]},{"version":"0.1.138","improved":["Atomic for Windows is now signed by Chibitek Inc., so Windows no longer blocks the download or the installer."],"fixed":["On Windows, Kimi, Grok, Cursor and Qwen no longer show as not installed right after Atomic installs them, while Windows is still scanning the new program."]},{"version":"0.1.137","improved":["Chibi now runs on Claude by default, at the Plata class. It uses another provider only when every Claude account is busy or out of usage."],"fixed":["A click on the model chip at the top of a chat now always offers the model classes, even when the current model has no class.","The specific-model picker now shows the latest suggested models immediately. Search still refines the list, while update, effort and local-model controls follow after the model choices instead of hiding them."]},{"version":"0.1.136","improved":["Settings > Classes & failover now lets you drag providers into order or jump one directly to any position. Provider and model choices are separate, every configured provider remains available, and Save order confirms when the change is stored.","The Orchestrator now defaults to the latest Sonnet model on the company Claude subscription, with the usual automatic fallback when Claude is unavailable."],"fixed":["iPhone and iPad now load the model-class menu even when the current model has not been graded on the phone yet, so class choices can be changed and saved from mobile.","When a bot's model needs you to sign in again or runs out of usage, Atomic now moves it only to a model that can work on the bot's computer, instead of failing every message. If none is free, the message says which models were skipped and why."]},{"version":"0.1.135","improved":["Pick a model class for a bot, or for one thread, right from the model chip at the top of a chat. A click offers Automatic and the four classes, Mezcal, Plata, Reposado and Añejo, each with the model it would run on now. Atomic then picks the best ready model in that class and falls back as usual.","To choose a specific provider and model, Command-click the chip on a Mac (Ctrl-click on Windows), or choose Choose a specific model at the bottom of the class menu. That view now has Save as default, which makes the thread's model the bot's default, and Reset to default, which puts the thread and the bot back on Automatic."]},{"version":"0.1.134","added":["Settings > Marketplace > MCP servers lists 53 more apps, each connecting through the vendor's own MCP server, including QuickBooks, HubSpot, Stripe, Atlassian, Notion, Canva, Monday.com and Zapier."],"improved":["Composio has been removed. Connect apps with the vendor's own MCP server in Settings, Marketplace, MCP servers.","Settings > Marketplace now has three tabs: Discover, MCP servers and Add-ons. The Connected apps tab is gone, and bots that need an app point you to the vendor's own MCP server."]},{"version":"0.1.133","added":["Your Private Bot and Chibi can now talk to each other. Ask your Private Bot to check something with Chibi, or ask Chibi to ask your Private Bot. Chibi never sees your private chats or memories: your Private Bot decides what to tell it. No other bot can reach your Private Bot.","Settings > Private Bot has a new switch, Let my Private Bot and Chibi talk. It is on by default; turn it off to keep them apart as before. Your organization can also keep them apart on its Macs."]},{"version":"0.1.132","fixed":["When you ask your Private Bot to share a chat with Chibi, it now points you to Share with Chibi in the chat's menu instead of searching for a Chief of Staff it cannot reach."]},{"version":"0.1.131","added":["Share with Chibi: open the menu on any of your Private Bot's threads and choose Share with Chibi. Chibi gets a new thread with a readable copy of that one conversation. The original stays private, and so do your other private chats and your private memory."]},{"version":"0.1.130","added":["Atomic now opens on your Chief of Staff: the first time you open it, in every new window, and when the bot or room you had open is deleted. New conversation lists the Chief of Staff first."],"fixed":["On a Mac, the Local VM keeps its saved workspace after Docker Desktop restarts, instead of asking you to recreate it on every message."]},{"version":"0.1.129","added":["Dictate in any app on your Mac: press Command+D and talk, and Atomic types into the app in front. Turn it on in Settings > General > Dictation. You can pick another shortcut, and Settings tells you when another app already uses it.","Apps that use Command+D in their own menus, such as Bookmark in Safari or Duplicate in Finder, are listed under the shortcut with a switch for each. Switch an app off and its own Command+D works there while dictation stays on everywhere else.","New subscription bots start on each company's newest flagship model at medium effort when your account offers it: Claude Opus 5.5, ChatGPT GPT-6 Astra, Gemini 3.8 Flash, Grok 4.7 and Kimi K3. Your own model choices are never replaced.","iPhone and iPad: Settings > Frontier models shows each AI's default model, whether it is signed in on your computer, and what each company allows on a phone. Settings > PAW lets you check your PAW, edit About me, run the setup interview and suggest changes through your paired computer.","Mochii and Nexus are now on by default on Mac, Windows and Linux, signed in through Chibitek. If you removed one before, it stays removed.","Spec to Ship and the house writing check now run as part of Atomic's own checks, so specs, plans and reviews are held to the same rules every time."],"improved":["Settings > AI & accounts: the Open button now takes you straight to the right key field. Key-only AI cards now have a masked key field with Save and Test, and keys are kept in Atomic's secure store, backed by the Keychain on a Mac. Choose Company or Personal and each key is saved separately.","Atomic finds each AI's command line tool on its own, and you can point it at another copy if you need to.","On a Mac, Open install in Terminal now opens Terminal and runs the install command for you. Ollama Cloud has a key field and a Get a key link instead of a Terminal button."],"fixed":["Messages that pointed to Settings > AI providers now name the real place: Settings > AI & accounts > Subscriptions or API keys.","The model picker returns to the official model list once it loads, instead of staying on the placeholder list."]},{"version":"0.1.128","added":["iPhone and iPad: local chat, downloadable models, model selection, and download and removal controls on supported devices.","Provider bots use their official logos on desktop, iPhone and iPad."],"improved":["Private Bots can use company models when personal accounts are unavailable, with confirmation before premium model costs.","Nexus work summaries retain safe task and output links while excluding credential-bearing links."],"fixed":["Windows setup now selects the declared automatic installers for Grok, Cursor, Kimi and Qwen, without relying on the wording of a terminal command.","Supported Windows provider installers run in the background with progress in Atomic. Setup checks availability after installation; sign-in remains interactive when needed."]},{"version":"0.1.127","added":["A bot for every AI account you sign in to: sign in to Claude, ChatGPT, Gemini, Grok, Kimi, Qwen or Cursor (in setup or Settings > AI & accounts) and Atomic adds a bot named after it, such as \\"Claude\\", \\"Claude (Personal)\\" or \\"ChatGPT\\", wearing that company's icon. It uses only that account and that company's models, picking the best one for the job unless you choose another. Two accounts of the same AI get two bots. Rename, hide or delete them like any bot; a deleted one is not made again.","When a subscription bot's account is out of usage, it moves to your other account of the same AI without a word. If none is free, it says when it will be back and offers to hand your request to Chibi. It never switches to a different AI on its own.","Bots made from a Personal account follow the Private Bot's rules: they run only on your own account, stay off Chibi's team and never see company connections. Your organization can turn off making these bots with the SubscriptionBots setting.","A bot's Access settings now list the apps turned on in its Claude account, each marked Connected via Claude, with an On/Off for that bot. Bots on another AI say why they have none.","Chibi says hello in your code editor and your terminal. The Atomic panel in VS Code (and Cursor, Windsurf and Antigravity) opens with Chibi, a short greeting, a What's new card for the latest release that you can close, and quick tips such as /bot to switch bots and Send Selection to Bot. In the terminal, chibi start, setup and login show Chibi with your version, who you are signed in as and a tip. Add --quiet to skip it; it never shows when the output goes to a file or another program, and NO_COLOR shows it in plain text.","The window Atomic shows while it opens now has Chibi's animated mark on Windows, Mac and Linux, and the iPhone app shows it while your workspace first loads. With Reduce Motion on, Chibi stays still.","Your Personal Bot is now your Private Bot. In the sidebar it reads Create your Private Bot; hold the pointer over it to see what that means: your company can't read it, and nothing you say there is shared with your work bots.","Private Bot chats stay private. Chibi, your work bots, connected assistants and Administrators never see its conversations, memories or files, and they are never mentioned anywhere else. Usage, activity and exports that others can see leave it out, and backups kept by your company do not include it.","Your Private Bot can read your work memories to help you, read only. Turn this off in Settings > Private Bot.","If you attach or paste something into your Private Bot that looks like a company document (from a company drive or shared folder, Mochii or Nexus, marked confidential, or with your company's name), Chibi asks first: keep it private, move it to Chibi or another work bot, or cancel. This check runs on your computer; nothing is sent anywhere to decide.","Your Private Bot now saves to your Nexus as private memory: only it can read it, and every save and lookup is signed with a key that stays on your computer. Chibi, your work bots, your company and Administrators never see it.","New bots set themselves up: + New bot, Create your Private Bot, and asking Chibi for a new bot all open a short interview. It asks one simple question at a time (what it should help with, its name, which clients or projects, which connected tools, when to check in with a morning brief, wrap-up or weekly review, and how it should talk), then shows a plain summary with Create and Change. Atomic writes the bot's instructions, picks its icon and AI, connects its tools and creates its routines, then opens it. Nothing to fill in or paste into Settings. Every question can be skipped, and an interview closed halfway picks up where you left off.","Chibi no longer answers \\"set up a bot for me\\" with instructions to copy. It shows a Set up your new bot card in the chat, already filled in with what you told it."],"fixed":["Fixed: the Reticle web-app testing connection could fail before starting because Atomic supplied an environment setting reserved for its own runtime.","Fixed: setup could leave you stuck when Google refused the sign-in (for example \\"Atomic has not completed the Google verification process\\") or the browser was closed. The Google and Accounts steps now always have Continue without it, and a refused sign-in says plainly that you can continue and connect it later.","Fixed: Mochii and Nexus connect as you, so they show your own company's tasks and memory, and when Nexus is not turned on for your company yet, Settings and the new-bot interview show its own calm note (your organization's memory space is being set up) instead of an error, and bots stop trying to reach it until it is ready.","Fixed: Chibi no longer passes on technical messages such as a tool that timed out on connect. It mentions a tool only when your request needs it, in one plain sentence, and offers to try again or help you connect it."],"improved":["Subscription bots now wear each company's official logo (Claude, ChatGPT, Gemini, Grok, Qwen and Cursor) inside a Chibitek ring: a particle drifts round it while the bot rests, three race round while it thinks, and the ring pulses while it replies. The logo itself never moves or changes colour. With Reduce Motion on, the ring stays still. Kimi shows a plain K, because Moonshot allows its logo only in editorial and non-commercial use. The same logos appear in setup and Settings, on the Mac, on Windows and on iPhone.","Mac dictation now types as you talk: each sentence or phrase is typed when you finish it or pause for about a second, instead of everything at the end. If you talk without stopping, Atomic types what it has every 15 to 20 seconds.","While you talk, the words being recognized show in a small bubble next to your cursor. They are only typed once they are final and cleaned up, and a sentence that has been typed is never changed again.","Auto-correct now looks at the one or two sentences before each new one, so a phrase is corrected as part of its sentence.","Press Command+Z while dictating, or right after, to remove just the last sentence. Saying \\"scratch that\\" on its own does the same.","If you switch to another app while dictating, Atomic pauses typing and says so. Go back and it carries on; nothing is ever typed into the wrong app.","Connected apps no longer take new apps. Apps you connected before keep working, and you can sign one in again if it expires or disconnect it, under Settings > Marketplace > Connected apps. New apps connect in the Marketplace through each company's official connector, and bots point you there instead of offering a connection card."]},{"version":"0.1.126","added":["Team Rooms (coming soon; off until Chibitek sign-in arrives in Atomic): share a bot conversation or start a New Team Room, then invite people from your company or other companies with a link (7 days and 10 uses by default; only the room owner makes links and can turn them off). Everyone brings their own bots with Add my bot, except their Private Bot. A bot answers only when someone @mentions it, runs on its owner's computer and subscriptions, and asks its owner before anything that commits them. A room with other companies shows a banner, and each bot shares nothing from its owner's memories, accounts or files there unless the owner turns it on for that room. Your iPhone reads and replies in rooms through your computer.","Ask any bot to connect an app, like \\"connect my QuickBooks\\", and it now checks the Marketplace for you. If the app is there, it gives you a Connect button that opens Settings > Marketplace with that app selected. If it isn't there yet, it says so and offers a button to send it to Chibitek as an idea. Bots no longer suggest building a connection themselves.","Marketplace: \\"Recommended for your business\\" lists the apps most companies connect first and that you can connect today (QuickBooks, Granola, Gmail, Google Calendar and Drive, Microsoft 365, Slack, Zoom, Docusign, HubSpot, Stripe, Canva, Notion and Asana), each with the best way to connect it.","The Marketplace now lists only official connections: servers run by the company behind each app, and their official connectors in your Claude account. Servers made by other people or independent developers are no longer offered, and bots never suggest them, because Atomic can't tell where they send your data. You can still add a server you trust by hand under MCP servers.","Marketplace: \\"Through your Claude account\\" shows the apps you turned on at claude.ai (such as QuickBooks, which only connects that way) and marks them Connected via Claude. Turn on \\"Also use my Claude Code MCP servers\\" there and your bots on Claude can use them.","Marketplace: Granola and Dropbox are now featured, using their official servers.","Atomic Engine, Chibitek's own AI engine, now installs from Atomic on Windows and on Macs, Apple silicon and Intel: one click in setup or in Settings > Engines. Atomic downloads it, checks it against its published checksum, and starts it once before using it. No terminal needed.","Mac: dictate in any app. Turn it on in Settings > General > Dictation, then press Control+Option+Space in Mail, Slack, your browser or any other app, talk, and press it again. Your words are typed where your cursor is. You can also hold Right Option while you talk instead.","Dictation turns your voice into text on your Mac only: Apple's speech recognition on macOS 26 and later, or Parakeet on macOS 14 and 15. It removes \\"um\\" and \\"uh\\", understands \\"comma\\" and \\"new line\\", and Auto-correct fixes spelling and grammar with Apple Intelligence on your Mac without changing your words. Using your AI subscriptions for Auto-correct is optional and off by default.","Settings > General > Dictation explains each permission (Microphone, Accessibility, and Input Monitoring only for Right Option), lets you change the shortcut, download the speech model, add names Atomic should spell your way, and switch dictation off for single apps.","HIPAA mode: an Administrator can turn it on for the whole workspace in Settings > General > Dictation, and organizations can set it with the HipaaMode MDM key. In HIPAA mode nothing you dictate or type leaves your Mac.","Setup: when a step fails, Save diagnostics sits next to Get help. The file now includes what setup did on this computer: every AI app check that failed or was slow, each install with its output, and each sign-in, with passwords and keys removed. Settings > General > Export Diagnostics saves the same file.","Atomic now saves your work to Nexus, so Chibi remembers you on every device and in every Chibitek app. After every bot reply it saves a short summary: what you asked, what was done, decisions, next steps, and links to pull requests and Mochii tasks.","Handoffs, reports and briefs your bots write are saved to Nexus too, and so are the images, audio and video your bots make or you attach.","Every saved item says where it came from: the app (Mac, Windows, iPhone, VS Code, the command line or Slack), the bot, the conversation and the time.","When you start a conversation, your bot gets a short note of your recent work and files from Nexus. Bots can also search Nexus and open a saved file when you ask about earlier work.","Settings > Memory: Always save to Nexus is on by default. Choose whether to save media and the largest file to save, see what Nexus remembers, and forget any item.","Your Personal Bot never saves to or reads from the company's Nexus. Its memory stays on your computer, unless you mark your own Nexus connection Personal.","Company-managed computers: your organization can keep Always save to Nexus on, and can turn on HIPAA mode so nothing marked as patient data is saved.","A bot's Memory settings are new. Memory saved to Nexus shows who you are connected as and what the bot remembers about you and your work, with search, edit and forget. When a bot's memory can't go to Nexus (not connected, HIPAA, or your Personal Bot), it says plainly that it is kept on this computer.","Workspace knowledge (PAW) in a bot's Memory settings shows which layers it reads (your organization, your department and you) and how fresh they are, with Open PAW and Suggest a change. A suggestion goes to the file's owner for approval in Mochii."],"improved":["Windows: Atomic now follows Early updates unless you or your organisation chose otherwise, so Windows computers keep getting updates before the first stable Windows release.","Signing in with Google now shares only your name and email. Gmail, Calendar and Drive each stay off until you turn them on in Settings > Accounts, and Google asks about each one on its own, with a plain note on what it lets bots do. Reading mail and writing drafts are separate, and Atomic no longer asks for permission to change or delete email. Accounts you already connected keep working.","Setup: the Google step can always be skipped. If Google shows an error page or you choose not to allow something, Atomic carries on and you can connect later.","Setup: installing an AI app shows what it is doing: the download with its size for Gemini, then unpacking and the first start, and npm's latest lines under Show details.","Checking which AI apps are installed can no longer hold up the list. Each app gets a time limit; one that does not answer shows as not ready, with the reason, while the others carry on.","When an AI app is installed but does not start, setup says what Atomic ran and what happened (not found, the exit code with its error, or no answer in time), instead of \\"CLI not found\\".","Nothing that looks like a password or key is ever uploaded: a file that contains one stays on your computer, and a summary has it hidden.","If you are offline or Nexus can't be reached, saves wait on your computer and are sent when it is back, each one exactly once.","A bot's notes file on this computer is now its offline copy and is saved to Nexus too. The file, its size meter and Open in Obsidian moved under Advanced, so you no longer see folder paths unless you look for them."],"fixed":["Fixed: on Windows, installing a new Atomic could leave the old one installed beside it (one \\"for everyone\\", one \\"only for me\\"). The installer now updates the copy that is already there, and removes any other copy of Atomic it finds, keeping your workspace and settings.","Fixed: on Windows, Atomic flashed a console window when it started, and another when the computer-control helper was checked.","Fixed: on Windows, installing Gemini (Antigravity) could fail at the end with \\"EPERM: operation not permitted, rename\\". Atomic now moves the download into place before starting it for the first time, waits out the antivirus scan, and never leaves a half-installed copy. Atomic Engine installs the same way.","Fixed: when a bot was set to an AI that is not installed on this computer, its next chat now runs on your next AI that is ready instead of failing. An AI that is set up wrongly still says so, instead of being swapped silently.","Fixed: on Windows, setup could stay on ChatGPT (Codex) without ever finishing its check, and installing it could fail with no useful message. A check that does not answer now stops the whole program it started, including the codex.exe helper that kept running and blocked the next install, and the install checks that Codex really starts before saying it is done.","Fixed: on Windows, installing Gemini or ChatGPT flashed black console windows. Programs that AI apps start through Atomic's own Node.js are now started hidden.","Fixed: setup could spin forever if Atomic restarted or stopped answering during an install. It now says so and offers Try again."]},{"version":"0.1.125","added":["Send feedback from inside Atomic: Help > Send Feedback or Report a Bug, Settings > General > Basics, the profile menu, or the small Feedback button next to the version in the sidebar. Pick Bug or Idea, describe it, and choose whether to attach a screenshot of the window and diagnostics (passwords, keys and tokens are removed first). It goes straight to the Chibitek team; a person reviews every bug before it is fixed. On iPhone: Settings > Send Feedback.","Windows: Grok can now be installed on Windows. Setup shows its Windows install line for PowerShell.","Press Command-D (Ctrl+D on Windows) to dictate into the chat box, like in Claude and ChatGPT. Press it again or Esc to stop; your words stay in the box to edit or send. The mic button shows it is listening the whole time.","Settings > General > Basics > Dictation shortcut lets you pick a different shortcut: click it, press the keys you want, or reset to Command-D. Atomic refuses shortcuts the system or Atomic already uses."],"improved":["Your iPhone reconnects to your Mac by itself as soon as its network changes, for example when you leave Wi-Fi, switch to cellular, or Tailscale on the iPhone turns back on. It no longer waits out a retry timer first.","When your iPhone can't reach your Mac, it now says why: Tailscale on this iPhone isn't connected (open Tailscale and turn it on), your Mac isn't answering over Tailscale (asleep, offline, or Atomic isn't running), or this iPhone needs to be paired again.","Settings > Remote access on the Mac shows, under Tailscale pairing: this Mac's Tailscale name and IP, whether it answers on its Tailscale name, and when your phone was last seen.","Windows: setup now says PowerShell and Enter, not Terminal and Return, and says when an AI is not available on Windows yet instead of offering an install that cannot work.","Windows: Atomic finds Cursor, Kimi, Qwen and Hermes right after you install them, without restarting Atomic.","Windows: Atomic Engine is not available on Windows yet, so Windows no longer offers it in setup or picks it for Chibi.","Settings is simpler: eight items with tabs instead of a long list. Marketplace is now in Settings, second from the top, with everything you can add in one place: featured tools, the MCP Registry search, connected apps, MCP servers and add-ons. Tools > Marketplace opens it.","Settings > General now has Basics, Appearance, Bots & threads, and Setup, so you can rerun setup steps from there. AI providers, Accounts and Connected assistants are together under AI & accounts; Remote access and Computers under Devices & remote access; Repos, Connected workspaces and Backups under Workspaces & repos.","Searching Settings also finds settings inside tabs, and lists the matching tabs under each item.","When dictation is missing Microphone or Speech Recognition access, the message now has an Open System Settings button that goes straight to the right privacy page."],"fixed":["Fixed: renaming your Mac in Tailscale broke remote access from your iPhone until Atomic was restarted. Atomic now notices the new name within a minute, and the iPhone finds the Mac under its new name by itself.","Fixed: on Windows, connecting ChatGPT (Codex) failed with \\"spawn EINVAL\\". Atomic now starts every AI and tool it installs on Windows the right way, including on a PC without Node.js: Claude Code, Codex, OpenCode, Pi, MiniMax, Gemini, Grok, Cursor, Kimi, Qwen, Droid and Hermes.","Fixed: on Windows, connecting Claude Code to Atomic and MCP servers started with npx could fail the same way.","Fixed: a chat could fail with \\"\`atomic acp\` isn't installed\\" when its bot was set to an AI that is not on this computer. The turn now runs on your next AI that is ready, such as Claude, and the bot keeps its setting for when that AI is installed."]},{"version":"0.1.124","added":["PAW (Personal AI Workspace): Atomic now creates one folder for your AI context by itself, in your home folder under workspace/PAW (on Mac and Windows). Your company's files, your department's files and your own notes live there, and every bot reads only what a job needs.","Setup asks a few plain questions about you (your role, department, company, goals and how you like to work) and saves them as your About me in PAW. Chibitek staff join their department: Service Desk, Development, Back Office, Creative, or Sales and Marketing.","Settings > General > PAW shows where your PAW is, your department, how many files each layer has, when it last synced, and has Edit about me.","Company and department files are locked. If you or a bot change one, Atomic puts the original back and sends the change to its owner as a PAW change request in Mochii.","Chibi's regular check now tells the owner about company files nobody has reviewed in 90 days. This check is free.","Your Personal Bot reads only your own personal notes in PAW; company bots never see them."],"improved":["The old \\"Set up your AI context\\" form is gone. You never pick a folder or build one by hand. An existing ICM folder still works and bots still read it, after PAW.","Company-managed computers: your organization can choose the PAW template new installs start from."],"fixed":["Fixed: when one of your AI subscriptions runs out partway through a turn, even when the provider calls it a rate limit, the bot now finishes the turn on your next subscription without showing an error, and goes back to its usual AI as soon as that subscription has room again."]},{"version":"0.1.123","fixed":["Fixed: setup could not install Claude, Codex or OpenCode on a computer without Node.js (the copy of npm inside Atomic was incomplete). Atomic now ships npm as one checked archive and unpacks it on first use.","Fixed: Check for updates no longer says the update files are missing when there is simply nothing newer yet."]},{"version":"0.1.122","added":["The animated Chibi logo now also appears on the Mac while Atomic starts, on the first setup screen, and while Chibi is thinking.","Atomic for Windows, for Chibitek in-house testing. It is not signed yet, so Windows asks before the first install: choose More info, then Run anyway.","The Windows installer asks who Atomic is for: Only for me (no administrator needed) or Anyone who uses this computer. IT can also install it for everyone on a PC with Datto RMM.","Windows has the same update rings as the Mac: Early updates (internal testers) in Settings > General > Updates gets new Windows builds first. Your organization can set the ring, or manage updates for you, the same way it can on a Mac.","Your Personal Bot: one bot that is only yours. Create it from the sidebar or Settings > Personal Bot, and give it its own name, persona and icon, including a picture. You can change them any time.","Every AI account in Settings > AI providers is now marked Company or Personal. Accounts you already had stay Company, so nothing changes for your company bots. Mark an account you pay for yourself as Personal.","Your Personal Bot runs only on your Personal accounts and never on company AI. Company bots never use your Personal accounts.","When your personal subscriptions are resting, your Personal Bot stops and tells you when they are back. It can use free local AI on this Mac if you turn that on, and your own pay-per-use key only after you say yes.","Your Personal Bot starts with no company connections. Mark your own Google or Microsoft accounts and MCP servers as Personal to give them to it; company bots can't see or use them.","Chibi and company bots can't hand your Personal Bot work, and it can't hand them work. It carries a small Personal badge, and so do its conversations. Your iPhone shows it with the badge too; create it on your Mac.","The setup wizard asks once whether a plan you connect is your own. Chibitek company plans are always Company.","Company-managed Macs: your organization can turn the Personal Bot off. An existing one is then hidden, not deleted."],"improved":["On Windows, setup only shows what applies there: free local AI points you to ollama.com to install Ollama, and the Mac-only steps (macOS permissions and the Podman computer) are left out.","On Windows, Settings > Add-ons says RTK is not on Windows yet, instead of saying this copy is missing it. Apple Intelligence and dictation stay Mac-only and do not appear on Windows.","Usage reports can leave out your Personal Bot's usage, so company reports show only company work."]},{"version":"0.1.121","added":["Chibi is now your Primary Bot. It works on its own: it checks your team every 30 minutes, when Atomic starts and when your Mac wakes, and fixes what it can, like retrying a run that crashed or a routine that failed.","Chibi checks in only when it needs you: one short message in its main conversation, with links to the threads waiting on you. It never repeats itself about the same thing and stays quiet from 10 PM to 7 AM.","The check is free. Chibi only uses a model when something needs unblocking, and then on your cheapest plan, never pay-per-use unless you chose Keep going.","Settings > General > Primary Bot (Chibi): turn it on or off, choose how often it checks, set quiet hours, run a check now, and see what recent checks found and cost.","Move into Chibi: a bot you used as your go-to can move into Chibi from its menu. Its instructions, memory, skills, routines and conversations come along, Chibi keeps its own name and look, and the old bot is archived, not deleted. Importing from Grok Bot does the same for its Primary Bot.","Company-managed Macs: your organization can decide how Atomic updates through its device management (Addigy). When it manages updates, Atomic stops updating itself and Settings > Updates says \\"Updates are managed by your organization\\". It can also set your update channel, shown as Managed by your organization.","Settings > General > Updates shows your version and update channel, and has a new Early updates (internal testers) switch. It is off for everyone; testers who turn it on get new versions before they reach the rest of Chibitek.","A new setup wizard walks you through everything Atomic needs, one step at a time, with no Terminal: your name, which AI plans you have, connecting each one, free local AI, API keys, Google and Microsoft accounts, a computer for your bots, permissions, your iPhone, and meeting Chibi.","Atomic now installs Claude Code, Codex and OpenCode for you with one click, even on a Mac that has never had Node.js.","Grok, Cursor, Kimi and Qwen install from inside Atomic, and Grok, Cursor and Kimi sign in from inside Atomic: the sign-in page opens in your browser, with the code to type when there is one.","Free local AI: Atomic can install Ollama for you and recommends one model sized to your Mac, Gemma 4 on Apple silicon Macs with 16 GB or more, with the size shown before it downloads.","A computer for your bots: Atomic can download Podman's official installer, open it for you, and start the separate computer, with no command line.","Settings > Setup lists every setup step as done, skipped or not done, with Continue to pick up where you left off.","Chibi says hello in your first chat with three easy things to try."],"improved":["If you already use Atomic, a small Finish setting up Atomic card offers the new setup instead of a full-screen welcome.","The Ollama Cloud and Mistral setup cards now say they only need an API key and take you to AI providers, instead of showing a command."],"fixed":["Fixed: on a brand-new install, What's new no longer opens on top of the welcome.","Fixed: while Atomic starts, the window now says Starting Atomic instead of a developer command.","Fixed: the guided tour no longer waits invisibly when no AI plan is set up; it offers to set one up."]},{"version":"0.1.120","fixed":["Fixed: phone pairing over Tailscale now recovers automatically if Tailscale wasn't fully signed in when the app started, and refreshes when the Mac wakes from sleep."]},{"version":"0.1.118","added":["Settings > AI providers > Local models now lists the models Ollama has on this computer, with their size and which bots use them, and can give a model to a bot.","Get models suggests local models that can use tools, says which fit your computer's memory, and downloads any model with a progress bar you can cancel. Remove deletes one you no longer need.","New add-on: RTK shortens long command output (tests, builds, git, logs) before a bot reads it, so bots use fewer tokens. It is on for Engineering bots, and approvals still show the exact command the bot wrote.","New add-on: GitHub threat review. Before Atomic installs a skill, an MCP server or an add-on, it scans the code for backdoors, hidden instructions and supply-chain tricks, and stops the install when it finds clear signs of harm. You see what it found and can still go ahead. The scan runs inside Atomic and uses no AI tokens.","Bots have a new threat_scan tool that checks a folder, a GitHub repository or an npm package before they install or run it. A bot reads the full threat review only when a scan finds something worth a closer look, or when you ask for a deep review.","When a Claude bot clones a repository, Atomic scans it right away and tells the bot only if something turned up.","New add-on: Reticle lets bots check that a web or Electron app they changed really works. It is off until you turn it on, and Atomic installs it on your Mac the first time.","New add-on: a reviewed library of UI design skills bots can load for design and front-end work, following Apple's design guidelines and Liquid Glass first. Off until you turn it on.","Settings > Add-ons has a new option, Scan skills before install (SkillSpector). It is off, and scanning itself arrives in a later update.","When every subscription has hit its limit, Atomic keeps your bots working on your pay-per-use API keys and tells you once, with when a subscription is back. You can keep going, use your local models for free, or pause pay-per-use until then.","Settings > Engines and tiers now shows when each engine hit its limit, the reset time the provider gave in your own time zone, and when it came back."],"improved":["Greyed-out switches in a bot's Access settings now say why, with a link to fix it.","\\"Connected apps\\" is now \\"More apps\\"; Gmail, Calendar, Drive and Outlook come from Google and Microsoft accounts.","Chibi is always your Chief of Staff; its name and look are fixed so Atomic stays recognizable.","The MCP Marketplace is back in plain sight: Tools > Marketplace in the sidebar always opens it, and Settings > Add-ons links to it.","Ollama Cloud and OpenCode Go keys now appear once, as the Main key inside each provider's card, instead of a second row further down.","Atomic now uses your flat-price plans before anything billed per use: Claude, ChatGPT, Grok and Cursor first, then Ollama Cloud, then other plans like the Qwen Coding Plan, Kimi and OpenCode Go.","Switching a bot to another engine when one runs out now happens quietly, with no message in the chat.","An engine that runs out is not tried again until the time its provider said it resets.","Local models from Ollama can be given to any bot in Settings. When a bot cannot use one, it is shown greyed out with the reason."],"fixed":["Fixed: a bot could fail to save to its memory with an \\"unauthorized\\" error after its settings changed mid-conversation.","The Plugins window no longer reopens on MCP servers after you visited that tab, which hid the Marketplace.","Fixed: when a provider was out of credits, a bot could post the provider's billing error as its reply. The turn now finishes on the next engine instead.","Fixed: a model billed per use (like DeepInfra through Atomic Engine) could be picked ahead of a flat-price plan that offers the same model.","Fixed: Atomic Engine showed None for local models even when Ollama had models installed."]},{"version":"0.1.117","added":["In the iPhone app, a new animated Chibi logo plays while the app connects to your computer."]},{"version":"0.1.116","added":["Add-ons like Ponytail now work with every AI engine, not just Claude, and you can switch each one on or off (Settings > Add-ons), for all bots or per bot.","Settings > Add-ons tells you when a newer version of an add-on is out. Atomic includes it in a later update after it has been reviewed; nothing installs by itself."],"improved":["Every AI provider in Settings now links to where you get it: Get a subscription for Claude, ChatGPT and Grok, and Get an API key or See plans for the others.","Settings > AI providers now separates Subscriptions (flat monthly plans, including plans that use a key like the Qwen Coding Plan) from API keys (billed per use).","Each bot now shows a short summary of what it can do.","Opening a bot takes you straight to its latest conversation; older ones are under History."]},{"version":"0.1.115","added":["Add your Qwen Coding Plan as an AI provider account (Settings > Engines > AI provider accounts). Bots can then run on its flat-price models, like Qwen 3.7 Plus, GLM-5 and Kimi K2.5."]},{"version":"0.1.114","added":["Local models can use less memory in long chats. Turn on \\"Use less memory for long chats\\" in Settings > AI providers, then quit Ollama and open it again. Long conversations fit on your Mac with answers that stay practically the same."]},{"version":"0.1.113","added":["Connect Xcode as a code editor (Settings > Connected assistants > Code editors), so Xcode's Claude, Codex and Gemini agents can work with your Atomic team."],"fixed":["Saving a backup no longer fails on project folders your bots worked in. Reinstallable folders like node_modules are left out; reinstall them in each project after restoring."],"improved":["The Atomic iPhone app now shows this computer by its own name, so two computers are easy to tell apart."]},{"version":"0.1.112","added":["Google's Antigravity IDE is now a code editor you can connect (Settings > Connected assistants > Code editors), separate from the older Antigravity app."],"fixed":["Each code editor row now says which editor to restart, instead of always naming Claude Code."]},{"version":"0.1.111","added":["Stop a bot from your code editor: the Atomic extension for VS Code and Cursor shows a Stop button while a bot works, and stops only that chat.","Send images from your code editor and see the images in its chats: paste, drop or pick up to 4 per message."],"improved":["Every bot's past conversations are one click away: a History button in the chat header, and an empty chat now lists recent conversations, including work Chibi handed over.","Chats started from a code editor are recognized in your history, so the editor lists them as its own."]},{"version":"0.1.110","added":["Connect as many Google and Microsoft accounts as you like (Settings > Accounts). Bots can read and draft email, check and add calendar events, and find files in Gmail, Google Calendar, Drive, Outlook and OneDrive, only for the accounts you tick in each bot's Access settings.","Add more than one account per AI provider (Settings > Engines): two Perplexity keys, a second ChatGPT or Grok sign-in, and so on. Each account is its own engine, so a bot can use a specific one, and work moves to your other account when one runs out.","Perplexity is now an AI provider."],"fixed":["An extra Claude subscription account no longer switches to pay-as-you-go billing when an Anthropic API key is also saved."]},{"version":"0.1.109","fixed":["Apple Intelligence now actually ships in the Mac app. Earlier updates left out the small helper it needs, so it showed as unavailable."]},{"version":"0.1.108","added":["Import your Hermes agents: each Hermes profile becomes an Atomic bot with its instructions, memory, skills, scheduled jobs and MCP servers (Team library > Import)."]},{"version":"0.1.107","added":["Apple Intelligence runs on this Mac as a free, private Añejo engine, and writes thread titles without using your subscriptions.","Each bot now opens to one ongoing conversation, like Grok Bot. When the model starts a fresh session, a quiet divider marks it and earlier messages stay above. Separate threads are still there in the ⋯ menu."]},{"version":"0.1.106","improved":["Bots named after an engine run on it by default: Codex on ChatGPT models, Grok on Grok, Claude on Claude, and so on. Existing Codex and Grok bots were moved once; change them any time."]},{"version":"0.1.105","added":["Connect Atomic to VS Code, Cursor, Windsurf, Antigravity and OpenCode in one click (Settings > Connected assistants > Code editors). Each editor's AI chat can then ask Chibi or any bot for work, and each editor gets its own access you can disconnect."],"fixed":["Notifications on your iPhone now show the bot's avatar, or Chibi's mascot when the bot has no avatar, instead of the generic system icon."]},{"version":"0.1.104","added":["This \\"What's new\\" window, shown the first time you open Atomic after an update.","When an update is available, closing its pop-up leaves an \\"Update available\\" button in the bottom-left corner until you install it."],"fixed":["The iPhone pairing screen shows your computer's name with spaces instead of plus signs."]},{"version":"0.1.103","added":["Chibi's assignments now count as real work orders for the rest of the team.","For high-stakes steps (deploys, merges to main, new cloud resources, secrets), Chibi can attach your own message, and Atomic shows it to the specialist stamped as verified."],"improved":["Every bot can report back and escalate to the Chief of Staff that manages its team.","After an update, the Local VM's desktop image rebuilds itself instead of asking you to prepare it again."],"fixed":["Specialists no longer refuse work you already approved in your conversation with Chibi."]},{"version":"0.1.102","added":["A free Marketplace in Plugins: 16 featured services with their own icons, and search across the public MCP Registry. No paid key needed.","Saved backups in Settings > Backups: everything in ~/atomic_backup with Show in Finder, and Import for full backups.","Settings > AI providers brings subscriptions, API keys, and classes and failover together in one place."],"improved":["Settings > Computers now holds cloud computers and your own servers next to the Local VM.","Remote access sends you to Tailscale pairing when this computer has no public web address."],"fixed":["Downloading an update no longer crashes the app on networks that block the newer web protocol (QUIC)."]},{"version":"0.1.101","improved":["The Local VM keeps Firefox signed in with its history when its desktop is replaced.","Browser logins and history on each Local VM are backed up every hour to ~/atomic_backup, keeping the two latest copies."],"fixed":["The macOS menu says Settings…, matching the window it opens."]},{"version":"0.1.100","improved":["Every model your engines offer now gets a class (Mezcal, Plata, Reposado or Añejo), so the chat header never shows a model name."]},{"version":"0.1.99","added":["A new sidebar with one row per bot, and its threads inside the chat."],"improved":["The model chip shows only the class and effort, such as \\"Mezcal (Med)\\". Click it to see the model."]}]`),eRe=XEe;function U2(e,t){const a=s=>s.split(/[.+-]/).map(r=>Number.parseInt(r,10)||0),o=a(e),i=a(t);for(let s=0;s<Math.max(o.length,i.length);s++){const r=(o[s]??0)-(i[s]??0);if(r!==0)return r}return 0}function ZB(e,t,a=eRe){return a.filter(o=>U2(o.version,e)>0&&U2(o.version,t)<=0).sort((o,i)=>U2(i.version,o.version))}const W$="atomic.whatsNew.lastSeen";function tRe(){try{return localStorage.getItem(W$)}catch{return null}}function QB(e){try{localStorage.setItem(W$,e)}catch{}}function nRe(e,t,a={}){return t===null?a.firstRun?[]:ZB("0",e).filter(o=>o.version===e):ZB(t,e)}function aRe(e){const t=e?.onboarding;return!t?.completedAt&&!t?.setup?.deferredAt&&!Object.keys(t?.setup?.steps??{}).length}function V2({icon:e,title:t,items:a}){return a?.length?n.jsxs("div",{className:"mt-3",children:[n.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-semibold uppercase tracking-wide text-ink-secondary",children:[e,t]}),n.jsx("ul",{className:"mt-1.5 flex list-disc flex-col gap-1 pl-5 text-[13px] leading-relaxed text-ink",children:a.map(o=>n.jsx("li",{children:o},o))})]}):null}function oRe({initialNotes:e}){const t=zS(),[a,o]=f.useState(()=>e??[]),{state:i}=ke(),s=i.config,r=f.useRef(!1);f.useEffect(()=>{if(e||!window.ogb||!s||r.current)return;r.current=!0;const h=nRe(t,tRe(),{firstRun:aRe(s)});h.length?o(h):QB(t)},[t,e,s]);const c=f.useRef(null),d=a.length>0;if(f.useLayoutEffect(()=>{const h=c.current;if(!(!d||!h))return h.showModal(),()=>h.close()},[d]),!d)return null;const p=()=>{QB(t),o([])};return n.jsx("dialog",{ref:c,"aria-labelledby":"whats-new-title",onCancel:h=>{h.preventDefault(),p()},onKeyDown:h=>h.stopPropagation(),onMouseDown:h=>h.target===h.currentTarget&&p(),className:"animate-panel-in m-auto w-[min(520px,calc(100%-32px))] max-h-[80vh] overflow-hidden rounded-2xl border border-hairline/50 bg-panel p-0 text-ink shadow-2xl shadow-black/50 backdrop:bg-black/40",children:n.jsxs("div",{className:"flex max-h-[80vh] flex-col",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-hairline/30 px-5 py-4",children:[n.jsxs("div",{children:[n.jsx("h2",{id:"whats-new-title",className:"text-[16px] font-semibold text-ink",children:l("whatsNew.title",{app:Wa().name})}),n.jsx("p",{className:"mt-0.5 text-[12.5px] text-ink-secondary",children:l("whatsNew.subtitle",{version:t})})]}),n.jsx("button",{type:"button",onClick:p,className:"rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink","aria-label":l("whatsNew.close"),children:n.jsx(jt,{size:15})})]}),n.jsx("div",{className:"min-h-0 overflow-y-auto px-5 pb-4",children:a.map(h=>n.jsxs("section",{className:"border-b border-hairline/20 py-3 last:border-b-0",children:[n.jsx("h3",{className:"text-[13.5px] font-semibold text-ink",children:l("whatsNew.version",{version:h.version})}),n.jsx(V2,{icon:n.jsx(So,{size:13}),title:l("whatsNew.added"),items:h.added}),n.jsx(V2,{icon:n.jsx(G4,{size:13}),title:l("whatsNew.improved"),items:h.improved}),n.jsx(V2,{icon:n.jsx(f0,{size:13}),title:l("whatsNew.fixed"),items:h.fixed})]},h.version))}),n.jsx("div",{className:"flex justify-end border-t border-hairline/30 px-5 py-3",children:n.jsx("button",{type:"button",onClick:p,className:"rounded-lg bg-accent px-4 py-1.5 text-[13px] font-medium text-white",children:l("whatsNew.gotIt")})})]})})}function iRe(){const[e,t]=f.useState(!1),[a,o]=f.useState("idea"),[i,s]=f.useState(""),[r,c]=f.useState(""),[d,p]=f.useState(null),[h,g]=f.useState(!0),[b,x]=f.useState(!0),[v,k]=f.useState("editing"),[w,N]=f.useState(null),C=f.useRef(!1),{state:j}=ke(),M=j.bots.find(z=>z.id===j.selectedId)?.personal===!0,E=f.useRef(M);E.current=M;const A=f.useRef(null),R=f.useCallback(async(z,P="")=>{if(C.current)return;C.current=!0;let L=null;try{L=await window.ogb?.captureFeedbackScreenshot?.()??null}catch{L=null}o(z),P&&s(P),p(L),g(!!L&&!E.current),x(z==="bug"),k("editing"),N(null),t(!0),C.current=!1},[]);f.useEffect(()=>{const z=L=>{const G=L.detail;R(sI(G),kve(G))};window.addEventListener(m5,z);const P=window.ogb?.onOpenFeedback?.(L=>{R(sI(L))});return()=>{window.removeEventListener(m5,z),P?.()}},[R]),f.useEffect(()=>{e&&v==="editing"&&A.current?.focus()},[e,v]);const B=f.useCallback(()=>{v!=="sending"&&(t(!1),v==="sent"&&(s(""),c("")))},[v]);if(f.useEffect(()=>{if(!e)return;const z=P=>{P.key==="Escape"&&B()};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[e,B]),!e)return null;const O=async()=>{if(!(v!=="editing"||i.trim().length<3||!window.ogb?.submitFeedback)){k("sending"),N(null);try{await window.ogb.submitFeedback({type:a,description:i,email:r.trim()||void 0,includeScreenshot:h&&!!d,screenshotDataUrl:h?d:null,includeDiagnostics:b}),k("sent")}catch(z){N(l("feedback.error",{message:z instanceof Error?z.message:String(z)})),k("editing")}}},T=[{id:"bug",label:l("feedback.kind.bug"),icon:n.jsx(f0,{size:14})},{id:"idea",label:l("feedback.kind.idea"),icon:n.jsx(O4,{size:14})}];return n.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 p-4",onClick:B,children:n.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"feedback-title",onClick:z=>z.stopPropagation(),className:"animate-panel-in flex max-h-[85vh] w-full max-w-[520px] flex-col rounded-2xl border border-hairline/50 bg-panel shadow-2xl shadow-black/50",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-hairline/30 px-5 py-4",children:[n.jsxs("div",{children:[n.jsx("h2",{id:"feedback-title",className:"text-[16px] font-semibold text-ink",children:l("feedback.title")}),n.jsx("p",{className:"mt-0.5 text-[12.5px] text-ink-secondary",children:l("feedback.subtitle")})]}),n.jsx("button",{type:"button",onClick:B,className:"rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink","aria-label":l("feedback.close"),children:n.jsx(jt,{size:15})})]}),v==="sent"?n.jsxs("div",{className:"px-5 py-6",role:"status",children:[n.jsx("p",{className:"text-[14px] font-semibold text-ink",children:l("feedback.sent.title")}),n.jsx("p",{className:"mt-1 text-[13px] text-ink-secondary",children:l("feedback.sent.body")})]}):n.jsxs("div",{className:"flex min-h-0 flex-col gap-3 overflow-y-auto px-5 py-4",children:[n.jsx("div",{role:"radiogroup","aria-label":l("feedback.kind.label"),className:"flex gap-2",children:T.map(z=>n.jsxs("button",{type:"button",role:"radio","aria-checked":a===z.id,onClick:()=>{o(z.id),z.id==="bug"&&x(!0)},className:V("flex items-center gap-1.5 rounded-lg border px-3 py-1.5 text-[13px]",a===z.id?"border-accent bg-accent/15 text-ink":"border-hairline/50 text-ink-secondary hover:bg-raised/50"),children:[z.icon,z.label]},z.id))}),n.jsxs("label",{className:"flex flex-col gap-1 text-[13px] text-ink",children:[l(a==="bug"?"feedback.description.bug":"feedback.description.idea"),n.jsx("textarea",{ref:A,value:i,onChange:z=>s(z.target.value),rows:6,maxLength:8e3,placeholder:l(a==="bug"?"feedback.placeholder.bug":"feedback.placeholder.idea"),className:"min-h-[120px] w-full resize-y rounded-lg border border-hairline/40 bg-inset px-3 py-2 text-[13px] text-ink focus:border-hairline focus:outline-none"})]}),n.jsxs("label",{className:"flex flex-col gap-1 text-[13px] text-ink",children:[l("feedback.email.label"),n.jsx("input",{type:"email",value:r,onChange:z=>c(z.target.value),autoComplete:"email",className:"w-full rounded-lg border border-hairline/40 bg-inset px-3 py-1.5 text-[13px] text-ink focus:border-hairline focus:outline-none"}),n.jsx("span",{className:"text-[12px] text-ink-secondary",children:l("feedback.email.hint")})]}),n.jsxs("label",{className:V("flex items-start gap-2 text-[13px]",d?"text-ink":"text-ink-secondary"),children:[n.jsx("input",{type:"checkbox",className:"mt-0.5",checked:h&&!!d,disabled:!d,onChange:z=>g(z.target.checked)}),n.jsxs("span",{className:"flex flex-col gap-1.5",children:[l(d?"feedback.screenshot.label":"feedback.screenshot.unavailable"),d&&h&&n.jsx("img",{src:d,alt:l("feedback.screenshot.alt"),className:"max-h-28 w-auto self-start rounded-md border border-hairline/50"})]})]}),n.jsxs("label",{className:"flex items-start gap-2 text-[13px] text-ink",children:[n.jsx("input",{type:"checkbox",className:"mt-0.5",checked:b,onChange:z=>x(z.target.checked)}),n.jsxs("span",{className:"flex flex-col",children:[l("feedback.diagnostics.label"),n.jsx("span",{className:"text-[12px] text-ink-secondary",children:l("feedback.diagnostics.hint")})]})]}),w&&n.jsx("p",{role:"alert",className:"text-[12.5px] text-danger",children:w})]}),n.jsx("div",{className:"flex justify-end gap-2 border-t border-hairline/30 px-5 py-3",children:v==="sent"?n.jsx("button",{type:"button",onClick:B,className:"rounded-lg bg-accent px-4 py-1.5 text-[13px] font-medium text-white",children:l("feedback.close")}):n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:B,disabled:v==="sending",className:"ui-button",children:l("feedback.cancel")}),n.jsx("button",{type:"button",onClick:()=>{O()},disabled:v==="sending"||i.trim().length<3,className:"rounded-lg bg-accent px-4 py-1.5 text-[13px] font-medium text-white disabled:opacity-50",children:l(v==="sending"?"feedback.sending":"feedback.send")})]})})]})})}function sRe({episode:e,busy:t,error:a,onKeepGoing:o,onChoose:i}){const s=f.useRef(null);f.useEffect(()=>{const c=document.activeElement instanceof HTMLElement?document.activeElement:null;return s.current?.focus(),()=>c?.focus()},[]);const r="flex items-center justify-center gap-1.5 rounded-lg bg-control px-3 py-1.5 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50";return n.jsxs("div",{role:"dialog","aria-modal":"false","aria-labelledby":"pay-per-use-title","aria-describedby":"pay-per-use-body","data-pay-per-use-notice":!0,onKeyDown:c=>{c.key==="Escape"&&!t&&(c.stopPropagation(),o())},className:"animate-panel-in fixed bottom-4 right-4 z-50 w-[340px] max-w-[calc(100vw-32px)] rounded-2xl border border-hairline/40 bg-panel/85 p-4 shadow-2xl shadow-black/40 backdrop-blur-xl backdrop-saturate-150",children:[n.jsxs("div",{className:"flex items-start gap-2.5",children:[n.jsx("span",{className:"mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-full bg-accent/15 text-accent","aria-hidden":!0,children:n.jsx(Wh,{size:14})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("h2",{id:"pay-per-use-title",className:"text-[13.5px] font-semibold text-ink",children:ox(e).title}),n.jsx("p",{id:"pay-per-use-body",className:"mt-1 text-[12.5px] leading-relaxed text-ink-secondary",children:fX(e)})]})]}),a&&n.jsx("p",{role:"alert",className:"mt-2 text-[12.5px] text-danger",children:l("payPerUse.failed",{error:a})}),n.jsxs("div",{className:"mt-3 flex flex-col gap-1.5",children:[n.jsx("button",{ref:s,type:"button",disabled:t!==null,onClick:o,className:"rounded-lg bg-accent px-3 py-1.5 text-[13px] font-medium text-white disabled:opacity-50",children:ox(e).keepGoing}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsxs("button",{type:"button",disabled:t!==null,onClick:()=>i("local"),className:`${r} flex-1`,children:[t==="local"&&n.jsx(je,{size:13,className:"animate-spin","aria-hidden":!0}),l("payPerUse.useLocal")]}),n.jsxs("button",{type:"button",disabled:t!==null,onClick:()=>i("pause"),className:`${r} flex-1`,children:[t==="pause"&&n.jsx(je,{size:13,className:"animate-spin","aria-hidden":!0}),bX(e)]})]})]})]})}function rRe(){const{state:e,dispatch:t}=ke(),a=e.payPerUseNotice,[o,i]=f.useState(null),[s,r]=f.useState(null);if(f.useEffect(()=>{i(null),r(null)},[a?.id]),!a)return null;const c=async d=>{i(d),r(null);try{await Z(`${ox(a).base}/${d==="local"?"local":"pause"}`,{method:"POST"}),t({type:"dismissPayPerUse"})}catch(p){r(p instanceof Error?p.message:String(p)),i(null)}};return n.jsx(sRe,{episode:a,busy:o,error:s,onKeepGoing:()=>{t({type:"dismissPayPerUse"}),Z(`${ox(a).base}/keep-going`,{method:"POST"}).catch(()=>{})},onChoose:d=>{c(d)}},a.id)}function lRe({onGotIt:e,onSettings:t}){const a=f.useRef(null);return f.useEffect(()=>{const o=document.activeElement instanceof HTMLElement?document.activeElement:null;return a.current?.focus(),()=>o?.focus()},[]),n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/30 p-4","data-primary-bot-intro":!0,children:n.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"primary-bot-intro-title","aria-describedby":"primary-bot-intro-body",onKeyDown:o=>{o.key==="Escape"&&(o.stopPropagation(),e())},className:"animate-panel-in w-full max-w-[380px] rounded-3xl border border-white/15 bg-panel/70 p-6 text-center shadow-2xl shadow-black/40 backdrop-blur-2xl backdrop-saturate-150",children:[n.jsxs("div",{className:"relative mx-auto size-[72px]",children:[n.jsx("img",{src:Y4,alt:J4,className:"size-[72px] rounded-full object-cover ring-1 ring-white/20"}),n.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 flex size-6 items-center justify-center rounded-full bg-accent text-white shadow-md ring-2 ring-panel","aria-hidden":!0,children:n.jsx(XZ,{size:13,fill:"currentColor"})})]}),n.jsx("h2",{id:"primary-bot-intro-title",className:"mt-4 text-[17px] font-semibold text-ink",children:l("primaryBot.intro.title")}),n.jsx("p",{id:"primary-bot-intro-body",className:"mt-2 text-[13.5px] leading-relaxed text-ink-secondary",children:l("primaryBot.intro.body")}),n.jsxs("div",{className:"mt-5 flex gap-2",children:[n.jsx("button",{type:"button",onClick:t,className:"flex-1 rounded-xl bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover",children:l("primaryBot.intro.settings")}),n.jsx("button",{ref:a,type:"button",onClick:e,className:"flex-1 rounded-xl bg-accent px-3 py-2 text-[13px] font-medium text-white",children:l("primaryBot.intro.gotIt")})]})]})})}function cRe(){const{state:e,dispatch:t}=ke(),a=ec()===!0,[o,i]=f.useState(cBe),[s,r]=f.useState(null);f.useEffect(()=>{if(!a||o||!window.ogb)return;let g=!0;return Z("/api/primary-bot").then(b=>{g&&r(b.introSeenAt)}).catch(()=>{}),()=>{g=!1}},[a,o]);const c=window.ogb?.remoteClient?.active===!0,d=!!window.ogb&&!c,p=!!e.config&&!e.welcomeOpen&&!e.tourOpen&&!rS(e.config,{remoteClient:c,legacyDone:sS()});if(!d||s===null||!uBe({seenLocally:o,serverSeenAt:s,canManage:a,welcomeDone:p}))return null;const h=()=>{dBe(),i(!0),Z("/api/primary-bot/intro",{method:"POST"}).catch(()=>{})};return n.jsx(lRe,{onGotIt:h,onSettings:()=>{h(),t({type:"toggleAppSettings",open:!0,section:"general"})}})}function dRe(e){const t=e.split(/\n{2,}/),a=t[t.length-1]??"",o=/\[[^\]]+\]\**\s+\[[^\]]+\]\s*$/.test(a);return{paragraphs:o?t.slice(0,-1):t,choices:o?a:null}}function uRe(e){return e.split(/(\*\*[^*]+\*\*)/).filter(Boolean).map(t=>t.startsWith("**")&&t.endsWith("**")?{text:t.slice(2,-2),bold:!0}:{text:t,bold:!1})}const pRe=e=>e!==null&&e.status!=="hidden",mRe="rounded-xl bg-accent px-3 py-2 text-[13px] font-medium text-white disabled:opacity-50",XB="rounded-xl bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50";function hRe({state:e,busy:t,stiki:a,onYes:o,onNotNow:i,onDismissSignIn:s,onSignIn:r,onCancelSignIn:c}){if(e.status==="hidden")return null;if(e.status==="signIn")return n.jsxs("section",{"aria-label":l("nexusImport.label"),"data-nexus-import-offer":"sign-in",className:"fixed bottom-4 right-4 z-40 w-[min(420px,calc(100vw-2rem))] space-y-2 rounded-2xl border border-white/15 bg-panel/80 p-4 shadow-2xl backdrop-blur-2xl",children:[n.jsx("p",{className:"text-[13.5px] leading-relaxed text-ink",children:l(e.reason==="expired"?"nexusImport.signInAgain":"nexusImport.signIn")}),a?n.jsx(z$,{state:a,busy:t,onSignIn:r,onCancel:c,onSignOut:()=>{}}):n.jsx("p",{className:"text-[12.5px] text-ink-secondary",children:l("nexusImport.signInOnComputer")}),n.jsx("button",{type:"button",onClick:s,disabled:t,className:XB,children:l("nexusImport.notNow")})]});const{paragraphs:d,choices:p}=dRe(e.consentCopy),h=/\[([^\]]+)\]/.exec(p??"")?.[1]??l("nexusImport.yes"),g=/\]\s+\[([^\]]+)\]/.exec(p??"")?.[1]??l("nexusImport.notNow");return n.jsxs("section",{"aria-label":l("nexusImport.label"),"data-nexus-import-offer":"offer",className:"fixed bottom-4 right-4 z-40 w-[min(420px,calc(100vw-2rem))] rounded-2xl border border-white/15 bg-panel/80 p-4 shadow-2xl backdrop-blur-2xl",children:[d.map((b,x)=>n.jsx("p",{className:"mb-2 text-[13.5px] leading-relaxed text-ink",children:uRe(b).map((v,k)=>v.bold?n.jsx("strong",{children:v.text},k):n.jsx("span",{children:v.text},k))},x)),n.jsxs("div",{className:"mt-3 flex gap-2",children:[n.jsx("button",{type:"button",onClick:o,disabled:t,className:mRe,children:h}),n.jsx("button",{type:"button",onClick:i,disabled:t,className:XB,children:g})]})]})}function gRe(){const{state:e}=ke(),t=window.ogb?.remoteClient?.active?void 0:window.ogb?.stiki,[a,o]=f.useState(null),[i,s]=f.useState(null),[r,c]=f.useState(!1),d=f.useRef(!1),p=f.useRef(null),h=f.useCallback(async()=>{if(!d.current){d.current=!0;try{o(await Z("/api/nexus-memory/import-offer"))}catch{o(null)}finally{d.current=!1}}},[]);if(f.useEffect(()=>{h()},[h]),f.useEffect(()=>{if(!t)return;let b=!0;const x=k=>{if(!b||!k)return;s(k);const w=k.status==="signedIn";p.current===!1&&w&&h(),p.current=w},v=t.onState(x);return t.state().then(x).catch(()=>{}),()=>{b=!1,v()}},[t,h]),!pRe(a))return null;const g=async b=>{c(!0);try{if(b==="import"&&a.status==="offer"){const x=a.botId??e.bots[0]?.id;await Z("/api/nexus-memory/import-offer",{method:"POST",body:JSON.stringify({answer:"import"})}),x&&await Z(`/api/bots/${x}/messages`,{method:"POST",body:JSON.stringify({text:a.message})})}else await Z("/api/nexus-memory/import-offer",{method:"POST",body:JSON.stringify({answer:"decline"})})}catch{}finally{o(null),c(!1)}};return n.jsx(hRe,{state:a,busy:r,stiki:t?i:null,onYes:()=>{g("import")},onNotNow:()=>{g("decline")},onDismissSignIn:()=>o(null),onSignIn:b=>{c(!0),t?.signIn(b).then(s).catch(()=>{}).finally(()=>c(!1))},onCancelSignIn:()=>{t?.cancel().then(s).catch(()=>{})}})}function fRe({visible:e}){const[t,a]=f.useState(!1);if(f.useEffect(()=>{const r=window.ogb?.windowControls;if(!r)return;let c=!0;r.state().then(({maximized:p})=>{c&&a(p)});const d=r.onMaximizedChanged(p=>a(p));return()=>{c=!1,d()}},[]),!e)return null;const o=window.ogb?.windowControls,i={WebkitAppRegion:"no-drag"},s=V("flex h-[26px] w-11 items-center justify-center text-ink-secondary","hover:bg-raised hover:text-ink active:bg-raised/60");return n.jsxs("div",{"aria-hidden":!0,style:i,className:"absolute right-0 top-0 z-40 flex items-stretch",children:[n.jsx("button",{type:"button","aria-label":l("window.minimize"),title:l("window.minimize"),className:s,onClick:()=>{o?.minimize()},children:n.jsx(TE,{size:14})}),n.jsx("button",{type:"button","aria-label":l(t?"window.restore":"window.maximize"),title:l(t?"window.restore":"window.maximize"),className:s,onClick:()=>{o?.toggleMaximize()},children:t?n.jsx(Xa,{size:11}):n.jsx(Wl,{size:11})}),n.jsx("button",{type:"button","aria-label":l("window.close"),title:l("window.close"),className:V(s,"hover:bg-danger/25 hover:text-danger"),onClick:()=>{o?.close()},children:n.jsx(jt,{size:15})})]})}function bRe(){const{state:e,refreshInstances:t}=ke(),a=window.ogb?.remoteClient?.active===!0,[o,i]=f.useState(!1),s=async()=>{i(!0);try{await t()}finally{i(!1)}};if(a)return n.jsx("main",{className:"flex h-full min-w-0 flex-1 items-center justify-center bg-app px-6",children:n.jsxs("div",{className:"max-w-[520px] rounded-2xl border border-hairline/40 bg-card p-6 text-center",children:[n.jsx("h1",{className:"text-[20px] font-semibold text-ink",children:"The host needs an agent engine"}),n.jsx("p",{className:"mt-2 text-[13.5px] leading-relaxed text-ink-secondary",children:"Configure Claude, ACP, or another supported engine in Atomic on the host computer, then return here."}),n.jsx("button",{onClick:()=>{s()},disabled:o,className:"mt-5 rounded-lg bg-raised px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-60",children:o?"Checking…":"Check again"})]})});const r=e.instances.filter(c=>c.install).sort((c,d)=>{const p=tp(c.install)?0:1,h=tp(d.install)?0:1;return p-h});return n.jsx("main",{className:"flex h-full min-w-0 flex-1 flex-col overflow-y-auto bg-app",children:n.jsxs("div",{className:"mx-auto w-full max-w-[560px] px-6 py-12",children:[n.jsx("h1",{className:"text-[20px] font-semibold text-ink",children:l("noEngines.title")}),n.jsx("p",{className:"mt-1.5 text-[13.5px] leading-relaxed text-ink-secondary",children:l("noEngines.intro",{app:Wa().name})}),n.jsx("div",{className:"mt-6 flex flex-col gap-2.5",children:(()=>{const{subscription:c,custom:d}=Vz(r),p=h=>n.jsxs("div",{className:"rounded-xl border border-hairline/40 bg-card p-3.5",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[14px] font-medium text-ink",children:[n.jsx(Ll,{instance:h,size:16}),h.displayName]}),n.jsx(Fr,{instance:h,intent:h.access==="custom"?"inject":"cloud",className:"mt-0.5"})]},h.instanceId);return n.jsxs(n.Fragment,{children:[c.length>0&&n.jsx(rp,{className:"px-1",children:l("engines.cloud")}),c.map(p),d.length>0&&n.jsx(rp,{className:"px-1 pt-1",children:l("engines.local")}),d.map(p)]})})()}),n.jsxs("button",{onClick:s,disabled:o,className:"mt-6 flex items-center gap-2 rounded-lg bg-raised px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-60",children:[o?n.jsx(je,{size:14,className:"animate-spin"}):n.jsx(vn,{size:14}),l(o?"common.checking":"common.checkAgain")]})]})})}function eE(e,t){const a=t.trim().toLowerCase();if(!a)return[...e];const o=[],i=[];for(const s of e){const r=s.name.toLowerCase();r.startsWith(a)?o.push(s):r.includes(a)&&i.push(s)}return[...o,...i]}const yRe=["watch","video","youtube"];function xRe({onOpenChange:e}){const{state:t,dispatch:a}=ke(),o=dv(),[i,s]=f.useState(!1),[r,c]=f.useState(""),[d,p]=f.useState([]),[h,g]=f.useState(0),b=f.useRef(null);f.useEffect(()=>{const T=z=>{(z.metaKey||z.ctrlKey)&&z.key.toLowerCase()==="k"&&!z.shiftKey&&!z.altKey&&(z.preventDefault(),s(P=>!P))};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[]),f.useEffect(()=>{i&&(c(""),p([]),g(0))},[i]),f.useEffect(()=>{e?.(i)},[e,i]);const x=r.trim().toLowerCase();if(f.useEffect(()=>{if(!i||!x){p([]);return}p([]);let T=!0;const z=setTimeout(()=>{Z(`/api/search?q=${encodeURIComponent(x)}&limit=12`).then(P=>T&&p(P.hits??[])).catch(()=>T&&p([]))},150);return()=>{T=!1,clearTimeout(z)}},[i,x]),f.useEffect(()=>g(0),[x]),f.useEffect(()=>{b.current?.scrollIntoView({block:"nearest"})},[h,d]),!i)return null;const v=eE(t.bots.filter(T=>!T.hidden),x),k=eE(t.groups,x),w=o?DF(r):null,N=o?w?{kind:"watch",video:w}:x.length>=3&&yRe.some(T=>T.startsWith(x)||x.startsWith(T))?{kind:"watch",video:null}:null:null,C=[...N?[N]:[],...v.map(T=>({kind:"bot",bot:T})),...k.map(T=>({kind:"room",group:T})),...x?d.map(T=>({kind:"message",hit:T})):[]],j=C.length?Math.min(h,C.length-1):0,M=async T=>{if(T.kind==="watch")T.video?await $C(a,T.video).catch(z=>a({type:"error",message:z instanceof Error?z.message:String(z)})):OF();else if(T.kind==="message"){const z=T.hit;try{await fC(z,t,a)}catch(P){a({type:"error",message:P instanceof Error?P.message:String(P)})}}else a(T.kind==="bot"?la(T.bot):{type:"select",id:T.group.id});s(!1)},E=T=>{if(T.key==="Escape")T.preventDefault(),T.stopPropagation(),s(!1);else if(T.key==="ArrowDown")T.preventDefault(),g(C.length?(j+1)%C.length:0);else if(T.key==="ArrowUp")T.preventDefault(),g(C.length?(j-1+C.length)%C.length:0);else if(T.key==="Enter"){T.preventDefault();const z=C[j];z&&M(z)}},A=N?1:0,R=A+v.length,B=A+v.length+k.length,O=(T,z,P,L,G=!1)=>n.jsx("button",{ref:z===j?b:void 0,onClick:P,onMouseMove:()=>g(z),className:V("flex w-full items-center gap-3 rounded-xl px-3 py-2 text-left",G&&"flex-col items-stretch gap-0.5",z===j?"bg-raised":"hover:bg-raised/50"),children:L},T);return n.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center bg-black/50 p-6 pt-[14vh]",onMouseDown:T=>T.target===T.currentTarget&&s(!1),onKeyDown:E,children:n.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Command palette",className:"flex max-h-[min(480px,70vh)] w-full max-w-[560px] flex-col overflow-hidden rounded-xl border border-hairline/50 bg-card shadow-2xl shadow-black/60",children:[n.jsxs("div",{className:"flex items-center gap-3 border-b border-hairline/40 px-4 py-3",children:[n.jsx(La,{size:16,className:"shrink-0 text-ink-secondary"}),n.jsx("input",{autoFocus:!0,value:r,onChange:T=>c(T.target.value),placeholder:"Search bots, channels, messages…",className:"w-full bg-transparent text-[14px] text-ink placeholder:text-ink-secondary focus:outline-none"}),n.jsx("kbd",{className:"shrink-0 rounded-md border border-hairline/40 px-1.5 py-0.5 text-[11px] text-ink-secondary",children:"esc"})]}),n.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-2",children:[C.length===0&&n.jsx("div",{className:"px-3 py-6 text-center text-[13px] text-ink-secondary",children:x?`Nothing matches “${r}”`:"Nothing to switch to yet"}),v.length>0&&n.jsx("div",{className:"px-3 pb-1 pt-1.5 text-[11px] font-medium uppercase tracking-[0.08em] text-ink-secondary",children:"Bots"}),N&&O("watch",0,()=>{M(N)},n.jsxs(n.Fragment,{children:[n.jsx(T4,{size:16,className:"shrink-0 text-ink-secondary"}),n.jsx("span",{className:"truncate text-[14px] text-ink",children:l(w?"watch.entry.paletteLink":"watch.entry.menu")})]})),v.map((T,z)=>O(`bot:${T.id}`,A+z,()=>{M({kind:"bot",bot:T})},n.jsxs(n.Fragment,{children:[n.jsx(I4,{size:16,className:"shrink-0 text-ink-secondary"}),n.jsx("span",{className:"truncate text-[14px] text-ink",children:T.name}),T.title&&n.jsx("span",{className:"min-w-0 truncate text-[12.5px] text-ink-secondary",children:T.title})]}))),k.length>0&&n.jsx("div",{className:"px-3 pb-1 pt-2 text-[11px] font-medium uppercase tracking-[0.08em] text-ink-secondary",children:"Groups"}),k.map((T,z)=>O(`room:${T.id}`,R+z,()=>{M({kind:"room",group:T})},n.jsxs(n.Fragment,{children:[n.jsx(ki,{size:16,className:"shrink-0 text-ink-secondary"}),n.jsx("span",{className:"truncate text-[14px] text-ink",children:T.name})]}))),x&&d.length>0&&n.jsx("div",{className:"px-3 pb-1 pt-2 text-[11px] font-medium uppercase tracking-[0.08em] text-ink-secondary",children:"Messages"}),x&&d.map((T,z)=>{const P=T.snippet.slice(0,T.matchStart),L=T.snippet.slice(T.matchStart,T.matchStart+T.matchLength),G=T.snippet.slice(T.matchStart+T.matchLength);return O(`msg:${T.threadId}:${T.messageId}`,B+z,()=>{M({kind:"message",hit:T})},n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"flex items-center gap-2 truncate text-[13px] font-medium text-ink",children:[n.jsx(_4,{size:13,className:"shrink-0 text-ink-secondary"}),T.name,T.task?n.jsxs("span",{className:"font-normal text-ink-secondary",children:[" · ",T.task]}):null]}),n.jsxs("span",{className:"line-clamp-2 text-[12.5px] text-ink-secondary",children:[P,n.jsx("mark",{className:"rounded-sm bg-accent/25 px-0.5 text-ink",children:L}),G]})]}),!0)})]})]})})}function vRe({item:e,isMac:t}){const a=Bv(),o=e.id==="dictation"?XV(a,t):QS(e,t);return n.jsxs("div",{className:"flex items-center justify-between gap-4 py-1.5",children:[n.jsx("span",{className:"text-[13px] text-ink",children:e.description}),n.jsx("div",{className:"flex shrink-0 items-center gap-1",children:o.map((i,s)=>n.jsx("kbd",{className:"inline-flex min-w-[22px] items-center justify-center rounded-md border border-hairline/60 bg-control px-1.5 py-0.5 font-mono text-[11.5px] font-semibold text-ink shadow-xs",children:i},s))})]})}function kRe({open:e,onClose:t}){const[a,o]=f.useState(""),i=f.useRef(null),s=f.useRef(null),r=Zi();if(f.useLayoutEffect(()=>{const d=i.current;if(!(!e||!d))return o(""),d.showModal(),s.current?.focus(),()=>d.close()},[e]),!e)return null;const c=Tme(Zz,a,r);return n.jsx("dialog",{ref:i,"aria-labelledby":"shortcuts-dialog-title",className:"m-auto w-[min(500px,calc(100%-32px))] max-h-[85vh] overflow-hidden rounded-2xl border border-hairline/50 bg-panel p-0 text-ink shadow-2xl backdrop:bg-black/60 backdrop:backdrop-blur-xs",onCancel:d=>{d.preventDefault(),t()},onKeyDown:d=>d.stopPropagation(),onMouseDown:d=>d.target===d.currentTarget&&t(),children:n.jsxs("div",{className:"flex max-h-[85vh] flex-col",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-hairline/40 px-5 py-4",children:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-accent/15 text-accent",children:n.jsx(R4,{size:18})}),n.jsxs("div",{children:[n.jsx("h2",{id:"shortcuts-dialog-title",className:"text-[16px] font-semibold text-ink",children:"Keyboard Shortcuts"}),n.jsx("p",{className:"text-[12px] text-ink-secondary",children:"Quick commands and navigation"})]})]}),n.jsx("button",{type:"button",onClick:t,"aria-label":"Close keyboard shortcuts",className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised hover:text-ink",children:n.jsx(jt,{size:18})})]}),n.jsx("div",{className:"border-b border-hairline/30 px-5 py-2.5",children:n.jsxs("div",{className:"flex items-center gap-2 rounded-xl border border-hairline/40 bg-inset px-3 py-1.5 focus-within:border-accent/60",children:[n.jsx(La,{size:14,className:"shrink-0 text-ink-secondary"}),n.jsx("input",{ref:s,value:a,onChange:d=>o(d.target.value),placeholder:"Search shortcuts…","aria-label":"Search shortcuts",className:"w-full bg-transparent text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"})]})}),n.jsx("div",{className:"flex-1 overflow-y-auto px-5 py-3 space-y-4",children:c.length===0?n.jsxs("div",{className:"py-8 text-center text-[13px] text-ink-secondary",children:["No shortcuts found for “",a,"”"]}):c.map(d=>n.jsxs("div",{className:"space-y-1",children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider text-ink-secondary/70",children:d.category}),n.jsx("div",{className:"divide-y divide-hairline/20 rounded-xl bg-card/40 px-3 py-1 border border-hairline/30",children:d.items.map(p=>n.jsx(vRe,{item:p,isMac:r},p.id))})]},d.category))}),n.jsxs("div",{className:"flex items-center justify-between border-t border-hairline/40 bg-card/30 px-5 py-2.5 text-[11.5px] text-ink-secondary",children:[n.jsxs("span",{children:["Press ",n.jsx("kbd",{className:"rounded bg-control px-1 py-0.5 font-mono text-[10.5px]",children:"?"})," when not typing to open"]}),n.jsx("button",{type:"button",onClick:t,className:"rounded-lg bg-raised px-3 py-1 font-medium text-ink hover:brightness-110",children:"Done"})]})]})})}function wRe(e,t){const a=(o,i)=>o.left<i.right&&o.right>i.left&&o.top<i.bottom&&o.bottom>i.top;return t.some(o=>o.visible&&o.rect.width>0&&o.rect.height>0&&(o.explicit||o.zIndex!==null&&o.zIndex>=10)&&e.some(i=>a(o.rect,i)))}async function SRe(e,t,a,o){t&&t!==a&&(await e.setInteractive(null),await e.release(t));const i=await e.take(a);if(!i.held)throw new Error("The Local VM control hold was not acquired");if(i.owned!==!0)return{status:"held-elsewhere",botId:a,snapshot:i};try{await e.setInteractive(o)}catch(s){throw await e.setInteractive(null).catch(()=>{}),await e.release(a).catch(()=>{}),s}return{status:"controlled",botId:a,snapshot:i}}async function H2(e,t){return t?(await e.setInteractive(null).catch(()=>{}),e.release(t)):null}function J$(e){return e.filter(t=>t.computer==="vm"&&t.hidden!==!0).map(t=>t.id)}function CRe(e,t){const a=J$(e),o=a.includes(t)?t:a[0]??null;return[o,a.find(i=>i!==o)??null]}function jRe(e,t,a){const o=[...e],i=t===0?1:0;return a&&o[i]===a&&(o[i]=o[t]),o[t]=a,o}function NRe(e,t){const a=J$(t),o=new Set(a),i=[null,null];for(const s of[0,1]){const r=e[s];r&&o.delete(r)&&(i[s]=r)}for(const s of[0,1]){if(i[s])continue;const r=[...o][0];r&&(i[s]=r,o.delete(r))}return i}const ARe=zn({mode:Yo(["shared","per-bot"]).optional(),max_instances:Ps().int().positive().optional(),container:Yo(["running","stopped","missing"]).optional(),network:Yo(["loopback","unsafe","unknown"]).optional(),security:Yo(["hardened","unsafe","unknown"]).optional(),persistence:Yo(["durable","unsafe","unknown"]).optional(),desktopReady:_i().optional(),ready:_i().optional(),viewer_url:dn().min(1).optional()});function Y$(e){const t=ARe.safeParse(e);return t.success?t.data:null}function S4(e){const t=Y$(e),a=t?.mode??"unknown",o=t?.container??"unknown",i=t?.network??"unknown",s=t?.security??"unknown",r=t?.persistence??"unknown",c=t?.max_instances??0,d=t?.desktopReady===!0,p=!!(t?.ready===!0&&o==="running"&&i==="loopback"&&s==="hardened"&&r==="durable"&&d);return{mode:a,maxInstances:c,container:o,network:i,security:s,persistence:r,desktopReady:d,ready:p}}function MRe(e){const t=Y$(e);return!t||!S4(e).ready?null:t.viewer_url??null}const C4=["local-vm-workspace:left","local-vm-workspace:right"],Z$=zn({held:_i(),helpReason:dn().nullable(),owned:_i().optional(),acquired:_i().optional(),released:_i().optional()});async function tE(e,t,a){const o=await Z(`/api/bots/${e}/computer/control`,{method:"POST",body:JSON.stringify({action:t,controlLeaseId:a})}),i=Z$.safeParse(o);if(!i.success)throw new Error("invalid-control-snapshot");return i.data}async function IRe(e){const t=Z$.safeParse(await Z(`/api/bots/${e}/computer/control`));if(!t.success)throw new Error("invalid-control-snapshot");return t.data}function nE(e,t){fetch(`/api/bots/${e}/computer/control`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"release",controlLeaseId:t}),keepalive:!0}).then(async a=>{a.ok}).catch(()=>{})}async function aE(e,t){return!0}function $2(e,t,a){e({type:"computerControl",botId:t,held:a.held,helpReason:a.helpReason})}function oE(e){const t=e.current?.getBoundingClientRect();return!t||t.width<1||t.height<1?null:{x:Math.round(t.left),y:Math.round(t.top),width:Math.round(t.width),height:Math.round(t.height)}}const PRe=['[aria-modal="true"]','[role="dialog"]','[role="menu"]',"[popover]","[data-native-view-overlay]",".fixed",".absolute"].join(",");function TRe(){const e=[...document.querySelectorAll("[data-native-view-host]")],t=e.map(o=>o.getBoundingClientRect()).filter(o=>o.width>0&&o.height>0);if(t.length===0)return!1;const a=[...document.querySelectorAll(PRe)].filter(o=>!e.some(i=>o===i||o.contains(i)||i.contains(o))).map(o=>{const i=window.getComputedStyle(o),s=o.matches('[aria-modal="true"], [role="dialog"], [role="menu"], [popover], [data-native-view-overlay]'),r=Number.parseInt(i.zIndex,10);return{rect:o.getBoundingClientRect(),explicit:s,visible:i.display!=="none"&&i.visibility!=="hidden"&&Number(i.opacity)!==0,zIndex:Number.isFinite(r)?r:null}});return wRe(t,a)}function BRe(e){const[t,a]=f.useState(!1);return f.useEffect(()=>{let o=0;const i=()=>a(TRe()),s=()=>{o||(o=requestAnimationFrame(()=>{o=0,i()}))};i();const r=new MutationObserver(s);r.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["class","style","aria-hidden","aria-modal","role","open","popover"]});const c=new ResizeObserver(s);c.observe(document.body);for(const p of document.querySelectorAll("[data-native-view-host]"))c.observe(p);const d=["toggle","animationstart","animationend","transitionstart","transitionend"];for(const p of d)document.addEventListener(p,s,!0);return window.addEventListener("resize",s),window.addEventListener("scroll",s,!0),()=>{o&&cancelAnimationFrame(o),r.disconnect(),c.disconnect();for(const p of d)document.removeEventListener(p,s,!0);window.removeEventListener("resize",s),window.removeEventListener("scroll",s,!0)}},[]),e||t}function ERe(e,t){return e?e.container==="missing"?"VM not created":e.container==="stopped"?"VM stopped":e.ready?t==="error"?"Viewer unavailable":t!=="ready"?"Connecting viewer":"Live · watch-only":"VM unavailable":"Checking VM"}function RRe({index:e,bot:t,bots:a,otherBotId:o,obscured:i,active:s,heldElsewhere:r,controlPending:c,onSelect:d,onTake:p,onRelease:h,onOpenComputer:g}){const b=C4[e],x=t?.id??null,v=t?.name??"Local VM",k=f.useRef(null),w=f.useRef(Promise.resolve()),N=f.useRef(i),[C,j]=f.useState(0),[M,E]=f.useState(null),[A,R]=f.useState({contextId:b,open:!1,status:"closed",interactive:!1}),[B,O]=f.useState(null),T=f.useCallback(async H=>{if(x)try{const $=await Z(`/api/bots/${x}/local-computer`,{signal:H});H?.aborted||E(S4($))}catch{}},[x]),z=f.useRef(T);f.useEffect(()=>{z.current=T},[T]),f.useEffect(()=>{N.current=i},[i]),f.useEffect(()=>window.ogb?.desktopWorkspace?.onState($=>{$.contextId===b&&(R($),($.status==="error"||$.status==="closed")&&z.current())}),[b]),f.useEffect(()=>{const H=window.ogb?.desktopWorkspace;let $=!0;const U=new AbortController;E(null),O(null),R({contextId:b,open:!1,status:"closed",interactive:!1});const Q=async()=>{if(H&&await H.close(b).catch(()=>{}),!(!$||!x)){if(!H){O("The two-desktop workspace requires the Atomic desktop app.");return}try{const W=await Z(`/api/bots/${x}/local-computer`,{signal:U.signal});if(!$)return;const q=S4(W);E(q);const Y=MRe(W);if(!q.ready||!Y||(await new Promise(pe=>{let ge=!1;const Ne=()=>{ge||(ge=!0,pe())},ee=setTimeout(Ne,100);requestAnimationFrame(()=>{clearTimeout(ee),Ne()})}),!$))return;const ae=oE(k);if(!ae)throw new Error("layout-unavailable");const F=await H.open({contextId:b,url:Y,title:`${v}'s Local VM`,bounds:ae});if(!$){await H.close(b).catch(()=>{});return}R(F),await H.layout([{contextId:b,bounds:ae,visible:!N.current&&F.open}])}catch(W){if(!$||U.signal.aborted)return;O(W instanceof Error&&W.message==="layout-unavailable"?"The viewer area is not laid out yet. Retry after resizing the window.":"Atomic could not connect this Local VM viewer.")}}};return w.current=w.current.catch(()=>{}).then(Q),()=>{$=!1,U.abort(),H&&(w.current=w.current.catch(()=>{}).then(()=>H.close(b).then(()=>{}).catch(()=>{})))}},[x,v,b,C]),f.useEffect(()=>{if(!x)return;const H=new AbortController,$=window.setInterval(()=>{T(H.signal)},3e4);return()=>{H.abort(),window.clearInterval($)}},[x,T]);const P=f.useCallback(()=>{const H=window.ogb?.desktopWorkspace,$=oE(k);!H||!$||!A.open||H.layout([{contextId:b,bounds:$,visible:!i}]).catch(()=>O("Atomic could not position this Local VM viewer."))},[b,A.open,i]);f.useEffect(()=>{const H=k.current;if(!H)return;const $=new ResizeObserver(P);$.observe(H),window.addEventListener("resize",P);const U=requestAnimationFrame(P);return()=>{cancelAnimationFrame(U),$.disconnect(),window.removeEventListener("resize",P)}},[P]);const L=ERe(M,A.status),G=!!(t&&M?.ready&&A.status==="ready"&&A.open);return n.jsxs("section",{className:V("flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl border bg-panel",s?"border-accent/80 shadow-[0_0_0_1px_rgb(var(--accent)/0.35)]":"border-hairline/50"),children:[n.jsxs("div",{className:"flex min-h-[68px] items-center gap-3 border-b border-hairline/40 px-3 py-2.5",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("label",{className:"sr-only",htmlFor:`local-vm-slot-${e}`,children:["Local VM for pane ",e+1]}),n.jsxs("select",{id:`local-vm-slot-${e}`,value:t?.id??"",onChange:H=>d(H.target.value||null),disabled:c,className:"w-full truncate rounded-lg border border-hairline/50 bg-card px-2.5 py-1.5 text-[13px] font-medium text-ink outline-none focus:border-accent/70",children:[n.jsx("option",{value:"",children:"Choose a Local VM bot"}),a.map(H=>n.jsx("option",{value:H.id,disabled:H.id===o,children:H.name},H.id))]}),n.jsxs("div",{className:"mt-1 flex items-center gap-1.5 text-[11px] text-ink-secondary",children:[n.jsx("span",{className:V("h-1.5 w-1.5 rounded-full",s?"bg-accent":A.status==="ready"?"bg-success":A.status==="error"?"bg-danger":"bg-ink-secondary/50")}),s?"You have control":r?"Control held elsewhere":L]})]}),t&&s?n.jsxs("button",{type:"button",onClick:h,disabled:c,className:"flex shrink-0 items-center gap-1.5 rounded-lg bg-accent px-2.5 py-2 text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[c?n.jsx(je,{size:13,className:"animate-spin"}):n.jsx(Li,{size:13}),"Hand back"]}):t?n.jsxs("button",{type:"button",onClick:()=>p(t.id),disabled:!G||c||r,className:"flex shrink-0 items-center gap-1.5 rounded-lg bg-raised px-2.5 py-2 text-[12px] text-ink hover:bg-raised-hover disabled:opacity-45",title:"Pause only this bot and enable keyboard and pointer input in this pane",children:[c?n.jsx(je,{size:13,className:"animate-spin"}):n.jsx(Li,{size:13}),r?"Held elsewhere":"Take control"]}):null]}),n.jsx("div",{ref:k,"data-native-view-host":!0,className:"relative min-h-0 flex-1 bg-[#070707]",children:n.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-6 text-center",children:t?!M&&!B?n.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-ink-secondary",children:[n.jsx(je,{size:15,className:"animate-spin"})," Checking ",t.name,"'s VM…"]}):M?.ready&&A.status!=="error"&&!B?n.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-ink-secondary",children:[n.jsx(je,{size:15,className:"animate-spin"})," Connecting live view…"]}):n.jsxs("div",{className:"flex max-w-[300px] flex-col items-center gap-3 text-ink-secondary",children:[n.jsx(Qn,{size:21,className:"text-warning"}),n.jsx("div",{className:"text-[12px] leading-relaxed",children:B??(M?.container==="missing"?`${t.name}'s Local VM has not been created.`:M?.container==="stopped"?`${t.name}'s Local VM is stopped.`:`${t.name}'s Local VM is not ready for a live view.`)}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs("button",{type:"button",onClick:()=>j(H=>H+1),className:"flex items-center gap-1.5 rounded-lg bg-raised px-3 py-2 text-[12px] text-ink hover:bg-raised-hover",children:[n.jsx(vn,{size:13})," Retry status"]}),n.jsx("button",{type:"button",onClick:()=>g(t.id),className:"rounded-lg bg-raised px-3 py-2 text-[12px] text-ink hover:bg-raised-hover",children:"Open Computer"})]})]}):n.jsxs("div",{className:"flex max-w-[260px] flex-col items-center gap-2 text-ink-secondary",children:[n.jsx(Ea,{size:22}),n.jsx("span",{className:"text-[12px]",children:"Choose another bot configured for a Local VM."})]})})})]})}function DRe({primaryBotId:e,overlayOpen:t,onClose:a,onOpenComputer:o}){const{state:i,dispatch:s}=ke(),r=f.useMemo(()=>i.bots.filter(L=>L.computer==="vm"&&!L.hidden),[i.bots]),[c,d]=f.useState(()=>CRe(i.bots,e)),p=f.useRef(c),[h,g]=f.useState(null),b=f.useRef(null),x=f.useRef(null),v=x.current??crypto.randomUUID();x.current=v;const k=f.useRef(!1),w=f.useRef(!0),[N,C]=f.useState(!1),[j,M]=f.useState(null),E=BRe(t);f.useEffect(()=>{p.current=c},[c]);const A=f.useMemo(()=>({async take(L){const G=await p4({action:"take",syncNativeBrowser:!0,requestControl:H=>tE(L,H,v),setNativeBrowserControl:H=>aE()});return $2(s,L,G),G.held&&G.owned===!0?b.current=L:b.current===L&&(b.current=null),G},async release(L){const G=await p4({action:"release",syncNativeBrowser:!0,requestControl:H=>tE(L,H,v),setNativeBrowserControl:H=>aE()});return $2(s,L,G),b.current===L&&(b.current=null),G},async setInteractive(L){const G=window.ogb?.desktopWorkspace;if(!G)throw new Error("The desktop workspace bridge is unavailable");return G.setInteractive(L)}}),[v,s]);f.useEffect(()=>{d(L=>{const G=NRe(L,i.bots);return G[0]===L[0]&&G[1]===L[1]?L:G})},[i.bots]),f.useEffect(()=>{let L=!0;return(async()=>{for(const H of c)if(H)try{const $=await IRe(H);L&&$2(s,H,$)}catch{}})(),()=>{L=!1}},[s,c]),f.useEffect(()=>{const L=b.current;!L||c.includes(L)||H2(A,L).then(()=>{g(null)}).catch(()=>{M("The removed pane could not hand control back safely.")})},[A,c]),f.useEffect(()=>(w.current=!0,()=>{w.current=!1;const L=b.current,G=window.ogb?.desktopWorkspace;if(!G){L&&nE(L,v);return}G.setInteractive(null).catch(()=>{}).then(()=>(L&&nE(L,v),G.close())).catch(()=>{})}),[v]);const R=f.useCallback(L=>{const G=p.current.indexOf(L);return G<0?null:C4[G]},[]),B=f.useCallback(async()=>{const L=b.current;if(!L)return!0;if(k.current)return!1;k.current=!0,C(!0),M(null);try{return await H2(A,L),g(null),!0}catch{return M("Atomic could not hand control back. The workspace stayed open."),!1}finally{k.current=!1,C(!1)}},[A]),O=f.useCallback(async L=>{if(k.current||b.current===L)return;const G=window.ogb?.desktopWorkspace,H=R(L);if(!(!G||!H)){k.current=!0,C(!0),M(null);try{const $={...A,async setInteractive(Q){if(Q&&R(L)!==Q)throw new Error("The Local VM pane changed during control acquisition");return A.setInteractive(Q)}},U=await SRe($,b.current,L,H);if(g(null),U.status==="held-elsewhere"){M("This VM is already controlled in another viewer. Hand it back there first.");return}if(!w.current){await H2(A,L).catch(()=>{});return}g(L)}catch{g(b.current),M("Control could not switch safely. Any remaining hold stayed paused.")}finally{k.current=!1,C(!1)}}},[R,A]),T=f.useCallback(async(L,G)=>{if(k.current)return;const H=p.current[L];H!==G&&(H&&b.current===H&&!await B()||d($=>jRe($,L,G)))},[B]),z=f.useCallback(async()=>{b.current&&!await B()||a()},[B,a]),P=f.useCallback(async L=>{b.current&&!await B()||o(L)},[B,o]);return n.jsxs("main",{className:"flex h-full min-w-0 flex-1 flex-col bg-app",children:[n.jsxs("header",{className:"flex min-h-[60px] items-center gap-3 border-b border-hairline/40 px-5 py-3",children:[n.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-accent/15 text-accent",children:n.jsx(Ea,{size:18})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("h1",{className:"truncate text-[14px] font-semibold text-ink",children:"Local VM workspace"}),n.jsx("p",{className:"truncate text-[11.5px] text-ink-secondary",children:"Two live desktops · one active controller · watch-only by default"})]}),n.jsx("button",{type:"button",onClick:()=>{z()},disabled:N,className:"rounded-md p-1.5 text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-50","aria-label":"Close Local VM workspace",children:n.jsx(jt,{size:18})})]}),j&&n.jsxs("div",{className:"mx-3 mt-3 flex items-center gap-2 rounded-lg border border-danger/30 bg-danger/10 px-3 py-2 text-[12px] text-danger",children:[n.jsx(Qn,{size:14,className:"shrink-0"})," ",j]}),n.jsx("div",{className:"grid min-h-0 flex-1 grid-cols-2 gap-3 p-3",children:[0,1].map(L=>{const G=c[L],H=r.find($=>$.id===G)??null;return n.jsx(RRe,{index:L,bot:H,bots:r,otherBotId:c[L===0?1:0],obscured:E,active:!!(H&&h===H.id),heldElsewhere:!!(H&&i.computerControl[H.id]?.held&&h!==H.id),controlPending:N,onSelect:$=>{T(L,$)},onTake:$=>{O($)},onRelease:()=>{B()},onOpenComputer:$=>{P($)}},C4[L])})})]})}const ORe={collaborations:[],queued:[],running:[]};function zRe(e,t=[]){const a=new Map;for(const o of e){if(o.hidden)continue;const i=o.section?.trim()||"";a.set(i,[...a.get(i)??[],o])}for(const o of t){const i=o.trim();i&&!a.has(i)&&a.set(i,[])}return[...a].map(([o,i])=>({key:o,name:o||"General",chiefs:i.filter(s=>s.chiefOfStaff),members:i.filter(s=>!s.chiefOfStaff)}))}function LRe(e,t){const a=new Set(e.filter(s=>!s.hidden).map(s=>s.id)),o=new Map,i=(s,r)=>[s,r].sort().join(":");for(const s of t.collaborations){const[r,c]=s.botIds;!a.has(r)||!a.has(c)||o.set(i(r,c),{sourceBotId:r,targetBotId:c,state:"connected",groupId:s.groupId,lastAt:s.lastAt})}for(const s of t.queued)!a.has(s.sourceBotId)||!a.has(s.targetBotId)||o.set(i(s.sourceBotId,s.targetBotId),{sourceBotId:s.sourceBotId,targetBotId:s.targetBotId,state:"queued",reason:s.reason});for(const s of t.running)!a.has(s.sourceBotId)||!a.has(s.targetBotId)||o.set(i(s.sourceBotId,s.targetBotId),{sourceBotId:s.sourceBotId,targetBotId:s.targetBotId,state:"running",groupId:s.groupId});return[...o.values()].sort((s,r)=>{const c={running:0,queued:1,connected:2};return c[s.state]-c[r.state]||(r.lastAt??0)-(s.lastAt??0)})}function _Re(e){return e.activity==="waiting-on-you"?{label:"Waiting for you",tone:"warning"}:e.activity==="dead"||e.activity==="no-signal"?{label:"No signal",tone:"danger"}:e.busy||e.activity==="working"?{label:"Working",tone:"success"}:{label:"Ready",tone:"idle"}}const FRe=236,qRe=126,iE=16,sE=20,URe=64,G2="application/x-omb-computer";function rh(e,t=[]){const a=new Map(t.map((o,i)=>[o,i]));return[...e].sort((o,i)=>(a.get(o.id)??1/0)-(a.get(i.id)??1/0))}function VRe(e,t,a){const o=e.map(s=>s.id);if(!o.includes(t))return o;const i=o.filter(s=>s!==t);return i.splice(Math.max(0,Math.min(i.length,a)),0,t),i}function HRe(e){try{const t=JSON.parse(e??"null");return t===null||typeof t!="object"||Array.isArray(t)?{}:Object.fromEntries(Object.entries(t).flatMap(([a,o])=>Array.isArray(o)?[[a,[...new Set(o.filter(i=>typeof i=="string"&&i.length>0))]]]:[]))}catch{return{}}}function $Re(e){const t=e.chiefs.length>0&&e.members.length>0,a=t?Math.max(e.chiefs.length,e.members.length):Math.max(1,e.chiefs.length+e.members.length);return{width:FRe*(t?2:1)+sE*2+(t?40:0),height:URe+sE+a*(qRe+iE)-iE}}function GRe(e,t){const a=e.map($Re),o=Math.max(0,...a.filter((s,r)=>r%2===0).map(s=>s.width));let i=40;return e.map((s,r)=>{r>0&&r%2===0&&(i+=Math.max(a[r-2].height,a[r-1].height)+56);const c=Object.hasOwn(t,s.key)?t[s.key]:void 0;return{key:s.key,x:c?.x??(r%2===0?40:40+o+56),y:c?.y??i,...a[r]}})}function KRe(e,t,a){if(!e.length)return{x:0,y:0,scale:1};const o=Math.min(...e.map(d=>d.x)),i=Math.min(...e.map(d=>d.y)),s=Math.max(...e.map(d=>d.x+d.width))-o,r=Math.max(...e.map(d=>d.y+d.height))-i,c=Math.max(.3,Math.min(1,(t-80)/s,(a-80)/r));return{x:(t-s*c)/2-o*c,y:(a-r*c)/2-i*c,scale:c}}function rE(e,t,a){const o=t/e.scale;return{x:a.x-(a.x-e.x)*o,y:a.y-(a.y-e.y)*o,scale:t}}function WRe(e){try{const t=JSON.parse(e??"null");return t===null||typeof t!="object"||Array.isArray(t)?{}:Object.fromEntries(Object.entries(t).flatMap(([a,o])=>{if(o===null||typeof o!="object"||Array.isArray(o))return[];const{x:i,y:s}=o;return typeof i=="number"&&Number.isFinite(i)&&Math.abs(i)<1e5&&typeof s=="number"&&Number.isFinite(s)&&Math.abs(s)<1e5?[[a,{x:i,y:s}]]:[]}))}catch{return{}}}const Vh="flex size-9 shrink-0 items-center justify-center rounded-lg text-ink-secondary hover:bg-control hover:text-ink focus-visible:outline-2 focus-visible:outline-accent",Ny="flex w-full items-center gap-2 rounded-lg px-3 py-2.5 text-left text-[12px] text-ink-secondary hover:bg-control hover:text-ink";function JRe({bot:e,selected:t,moving:a,connected:o,onComputer:i,onArrange:s}){const{state:r,dispatch:c}=ke(),d=_Re(e),p=r.instances.find(g=>g.instanceId===e.modelSelection.instanceId),h=p?.models.options.find(g=>g.id===e.modelSelection.model)?.label??e.modelSelection.model;return n.jsxs("article",{className:V("relative h-[126px] w-[236px] shrink-0 rounded-xl border bg-card shadow-sm transition-colors",t?"border-accent/60 ring-1 ring-accent/15":o?"border-accent/40":"border-hairline/50 hover:border-ink-secondary/40",a&&"opacity-35"),children:[n.jsxs("button",{"data-bot-id":e.id,"aria-label":l("canvas.editBot",{name:e.name}),onClick:()=>c({type:"toggleSettings",botId:e.id,section:"identity",open:!0}),title:s?l("canvas.reorderHint"):void 0,onKeyDown:g=>{!s||!g.altKey||g.key!=="ArrowUp"&&g.key!=="ArrowDown"||(g.preventDefault(),g.stopPropagation(),s(e,g.key==="ArrowUp"?-1:1))},className:"flex h-[82px] w-full cursor-grab items-center gap-3 rounded-t-xl px-4 text-left active:cursor-grabbing focus-visible:outline-2 focus-visible:outline-accent",children:[n.jsx(Zt,{bot:e,size:38,motion:"none",motionKey:0,animated:!1}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"truncate text-[14px] font-semibold",children:e.name}),e.chiefOfStaff&&n.jsx(wp,{size:12,className:"shrink-0 text-warning","aria-label":l("chat.chiefOfStaff")})]}),n.jsx("span",{className:"mt-1 block truncate text-[11px] text-ink-secondary",children:e.title||(e.chiefOfStaff?l("chat.chiefOfStaff"):l("canvas.bot"))})]})]}),n.jsxs("div",{className:"flex h-[43px] items-center gap-1 border-t border-hairline/30 px-2",children:[n.jsx("button",{className:V(Vh,"size-8"),"aria-label":l("canvas.openBotChat",{name:e.name}),title:l("canvas.openChat"),onClick:()=>c(la(e)),children:n.jsx(EY,{size:13})}),d.tone!=="idle"&&n.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] text-ink-secondary",title:d.label,children:[n.jsx("span",{className:V("size-1.5 rounded-full",d.tone==="success"?"bg-success":d.tone==="warning"?"bg-warning":d.tone==="danger"?"bg-danger":"bg-ink-secondary/35")}),d.label]}),t&&i&&n.jsx("button",{className:V(Vh,"size-8"),"aria-label":l("canvas.botComputer",{name:e.name}),title:l("computer.tab.computer"),onClick:()=>i(e),children:n.jsx(Ea,{size:13})}),n.jsxs("button",{"aria-label":l("canvas.changeModel",{name:e.name}),title:`${l("canvas.defaultModel")}: ${h}`,onClick:()=>c({type:"toggleSettings",botId:e.id,section:"model",open:!0}),className:"ml-auto flex h-8 min-w-0 max-w-[130px] items-center gap-1.5 rounded-md px-2 text-[10px] text-ink-secondary hover:bg-control hover:text-ink focus-visible:outline-2 focus-visible:outline-accent",children:[n.jsx("span",{className:"flex size-3.5 shrink-0 items-center justify-center",children:p?n.jsx(Ll,{instance:p,size:13}):n.jsx(Nd,{driverKind:"",size:13})}),n.jsx("span",{className:"truncate",children:h||l("canvas.defaultModel")})]})]})]})}function YRe({sections:e,canManage:t,onMove:a,onInstructions:o,onEditTeam:i,onDeleteTeam:s,onComputer:r,onComputerDrop:c,onTeamComputer:d,teamComputers:p={},connectedBotIds:h=[]}){const{state:g}=ke(),b=f.useRef(null),x=f.useRef(null),v=f.useRef(!1),k=f.useRef(!1),w=f.useRef(null),[N,C]=f.useState({}),[j,M]=f.useState({}),[E,A]=f.useState({x:40,y:40,scale:1}),[R,B]=f.useState(null),[O,T]=f.useState(null),[z,P]=f.useState(null),[L,G]=f.useState(null),[H,$]=f.useState(null),[U,Q]=f.useState(""),[W,q]=f.useState(!1),[Y,ae]=f.useState(null),F=f.useMemo(()=>GRe(e,N),[e,N]),pe=f.useRef({view:E,positions:N,tiles:F,selectedId:g.selectedId,settingsOpen:g.settingsOpen});pe.current={view:E,positions:N,tiles:F,selectedId:g.selectedId,settingsOpen:g.settingsOpen},f.useEffect(()=>{let ue=!0;return Z("/.well-known/openmausbot/environment",{signal:AbortSignal.timeout(5e3)}).then(we=>{if(!(!ue||typeof we.environmentId!="string")){w.current=`omb-team-canvas:${we.environmentId}`;try{const me=WRe(localStorage.getItem(w.current));C($e=>({...me,...$e})),M(HRe(localStorage.getItem(`${w.current}:bot-order`)))}catch{}}}).catch(()=>{}).finally(()=>{ue&&q(!0)}),()=>{ue=!1}},[]);const ge=ue=>{if(C(ue),!!w.current)try{localStorage.setItem(w.current,JSON.stringify(Object.fromEntries(e.filter(we=>Object.hasOwn(ue,we.key)).map(we=>[we.key,ue[we.key]]))))}catch{}},Ne=ue=>Object.hasOwn(j,ue)?j[ue]:[],ee=(ue,we,me,$e)=>{const Re={...j,[ue.key]:[...VRe(we,me.id,$e),...rh(me.chiefOfStaff?ue.members:ue.chiefs,Ne(ue.key)).map(de=>de.id)]};if(M(Re),w.current)try{localStorage.setItem(`${w.current}:bot-order`,JSON.stringify(Re))}catch{}Q(l("canvas.arrangedBot",{name:me.name,team:ue.name}))},X=(ue,we)=>{const me=e.find(Re=>Re.key===(ue.section?.trim()??""));if(!me)return;const $e=rh(ue.chiefOfStaff?me.chiefs:me.members,Ne(me.key));ee(me,$e,ue,$e.findIndex(Re=>Re.id===ue.id)+we)},oe=f.useCallback(()=>{const ue=b.current?.getBoundingClientRect();ue&&A(KRe(pe.current.tiles,ue.width,ue.height))},[]);f.useEffect(()=>{const ue=b.current;if(!ue)return;let we=null;const me=new ResizeObserver(()=>{const $e=ue.getBoundingClientRect();if(!we)oe();else{const Re=pe.current.settingsOpen?[...ue.querySelectorAll("[data-bot-id]")].find(ce=>ce.dataset.botId===pe.current.selectedId)?.getBoundingClientRect():void 0,de=Re?$e.width/2-(Re.left-$e.left+Re.width/2):($e.width-we.width)/2,Ve=Re?$e.height/2-(Re.top-$e.top+Re.height/2):($e.height-we.height)/2;A(ce=>({...ce,x:ce.x+de,y:ce.y+Ve}))}we={width:$e.width,height:$e.height}});return me.observe(ue),()=>me.disconnect()},[oe]);const ne=JSON.stringify(F.map(({key:ue,width:we,height:me})=>[ue,we,me]));f.useEffect(()=>{oe()},[oe,ne,W]),f.useEffect(()=>{const ue=b.current?.querySelector("details[open]"),we=b.current?.getBoundingClientRect();ue&&we&&ae(ue.getBoundingClientRect().bottom>we.bottom-210*E.scale?ue.closest("[data-team-key]")?.dataset.teamKey??null:null)},[E,ne]),f.useEffect(()=>{const ue=b.current;if(!ue)return;const we=me=>{if(me.target.closest("details[open]")||(me.preventDefault(),x.current))return;const $e=pe.current.view,Re=ue.getBoundingClientRect();if(me.ctrlKey||me.metaKey){const de=Math.min(1.5,Math.max(.3,$e.scale*Math.exp(-me.deltaY*.006)));A(rE($e,de,{x:me.clientX-Re.left,y:me.clientY-Re.top}))}else{const de=me.deltaMode===1?16:me.deltaMode===2?Re.height:1;A({...$e,x:$e.x-me.deltaX*de,y:$e.y-me.deltaY*de})}};return ue.addEventListener("wheel",we,{passive:!1}),()=>ue.removeEventListener("wheel",we)},[]);const Ce=ue=>{if(ue.button!==0||!ue.isPrimary||x.current)return;const we=ue.target,me=we.closest("[data-bot-id]")?.dataset.botId,$e=we.closest("[data-arrange-team]")?.dataset.arrangeTeam,Re=me?e.flatMap(ce=>[...ce.chiefs,...ce.members]).find(ce=>ce.id===me):void 0;if(!Re&&$e===void 0&&we.closest("button, details, a, input, [data-team-key]")||Re&&(H||!W)||$e!==void 0&&!W)return;const de={id:ue.pointerId,start:{x:ue.clientX,y:ue.clientY},view:E,positions:N,moved:!1},Ve=$e===void 0?void 0:F.find(ce=>ce.key===$e);x.current=Re?{...de,kind:"bot",bot:Re}:Ve?{...de,kind:"team",key:Ve.key,origin:Ve}:{...de,kind:"pan"},v.current=!1},le=(ue,we)=>{const me=document.elementFromPoint(ue,we)?.closest("[data-team-key]");return me&&b.current?.contains(me)?me.dataset.teamKey??null:null},re=(ue,we)=>{const me=e.find(ce=>ce.key===(ue.section?.trim()??""));if(!me)return null;const $e=rh(ue.chiefOfStaff?me.chiefs:me.members,Ne(me.key)),Re=$e.filter(ce=>ce.id!==ue.id),de=[...b.current?.querySelectorAll("[data-bot-id]")??[]],Ve=Re.findIndex(ce=>{const Le=de.find(tt=>tt.dataset.botId===ce.id)?.closest("article")?.getBoundingClientRect();return Le?we<Le.top+Le.height/2:!1});return{section:me,lane:$e,remaining:Re,index:Ve<0?Re.length:Ve}},xe=ue=>{const we=x.current;if(!we||we.id!==ue.pointerId)return;if(ue.buttons===0){Te(ue,!0);return}const me=ue.clientX-we.start.x,$e=ue.clientY-we.start.y;if(!(!we.moved&&Math.hypot(me,$e)<5)&&(we.moved=!0,ue.currentTarget.setPointerCapture(ue.pointerId),we.kind==="pan"&&A({...we.view,x:we.view.x+me,y:we.view.y+$e}),we.kind==="team"&&C({...we.positions,[we.key]:{x:we.origin.x+me/E.scale,y:we.origin.y+$e/E.scale}}),we.kind==="bot")){const Re=ue.currentTarget.getBoundingClientRect();B({bot:we.bot,point:{x:ue.clientX-Re.left,y:ue.clientY-Re.top}});const de=le(ue.clientX,ue.clientY),Ve=de===(we.bot.section?.trim()??"");T(Ve||t?de:null);const ce=Ve?re(we.bot,ue.clientY):null,Le=ce?.remaining[ce.index]??ce?.remaining.at(-1);G(ce&&Le?{botId:Le.id,after:ce.index===ce.remaining.length}:null)}},Te=(ue,we=!1)=>{const me=x.current;if(!(!me||ue&&me.id!==ue.pointerId)){if(x.current=null,v.current=me.moved,window.setTimeout(()=>{v.current=!1},0),B(null),T(null),G(null),b.current?.hasPointerCapture(me.id)&&b.current.releasePointerCapture(me.id),we){C(me.positions),A(me.view);return}if(me.moved&&(me.kind==="team"&&ue&&ge({...me.positions,[me.key]:{x:me.origin.x+(ue.clientX-me.start.x)/me.view.scale,y:me.origin.y+(ue.clientY-me.start.y)/me.view.scale}}),me.kind==="bot"&&ue)){const $e=le(ue.clientX,ue.clientY);if($e===null)return;if($e===(me.bot.section?.trim()??"")){const Re=re(me.bot,ue.clientY);Re&&ee(Re.section,Re.lane,me.bot,Re.index);return}if(!t)return;$(me.bot.id),Q(l("canvas.reviewMove",{name:me.bot.name,team:$e||l("settings.section.general")})),a(me.bot,$e).then(Re=>{Q(Re===!1?l("canvas.moveCancelled"):l("canvas.moved",{name:me.bot.name,team:$e||l("settings.section.general")}))}).catch(Re=>{Q(Re instanceof Error?Re.message:String(Re))}).finally(()=>$(null))}}},nt=ue=>{const we=b.current?.getBoundingClientRect();we&&A(rE(E,Math.max(.3,Math.min(1.5,E.scale*ue)),{x:we.width/2,y:we.height/2}))},be=e.find(ue=>ue.key===O),Ye=z!==null?l("canvas.assignComputer",{team:e.find(ue=>ue.key===z)?.name??z}):R&&be?(R.bot.section?.trim()??"")===be.key?l("canvas.arrangeBot",{name:R.bot.name,team:be.name}):l("canvas.moveBot",{name:R.bot.name,team:be.name}):null;return n.jsxs("div",{ref:b,role:"region","aria-label":l("canvas.region"),tabIndex:0,"data-team-canvas":!0,className:"relative min-h-0 flex-1 touch-none overflow-clip outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40",style:{backgroundImage:"radial-gradient(circle, color-mix(in srgb, var(--color-ink-secondary) 18%, transparent) 1px, transparent 1px)",backgroundSize:`${24*E.scale}px ${24*E.scale}px`,backgroundPosition:`${E.x}px ${E.y}px`},onPointerDown:Ce,onPointerMove:xe,onPointerUp:ue=>Te(ue),onPointerCancel:ue=>Te(ue,!0),onDragOver:ue=>{if(!t||!c||!ue.dataTransfer.types.includes(G2))return;const we=ue.target.closest("[data-team-key]"),me=we&&ue.currentTarget.contains(we)?we.dataset.teamKey??null:null;P(me),me!==null&&(ue.preventDefault(),ue.dataTransfer.dropEffect="link")},onDragLeave:ue=>{(!(ue.relatedTarget instanceof Node)||!ue.currentTarget.contains(ue.relatedTarget))&&P(null)},onDrop:ue=>{if(P(null),!t||!c||!ue.dataTransfer.types.includes(G2))return;const we=ue.target.closest("[data-team-key]"),me=we&&ue.currentTarget.contains(we)?we.dataset.teamKey:void 0,$e=ue.dataTransfer.getData(G2);me===void 0||!e.some(Re=>Re.key===me)||!$e||(ue.preventDefault(),c($e,me))},onDragEnd:()=>P(null),onPointerDownCapture:ue=>{k.current=!1,ue.target.closest("details")||ue.currentTarget.querySelectorAll("details[open]").forEach(we=>we.removeAttribute("open"))},onKeyDownCapture:ue=>{ue.key==="Tab"&&(k.current=!0)},onPointerLeave:()=>{x.current&&!x.current.moved&&Te(void 0,!0)},onLostPointerCapture:()=>{x.current&&Te(void 0,!0)},onFocusCapture:ue=>{if(!k.current||!(ue.target instanceof HTMLElement)||!ue.target.closest("[data-canvas-world]"))return;const we=ue.currentTarget.getBoundingClientRect(),me=ue.target.getBoundingClientRect(),$e=me.left<we.left+16?we.left+16-me.left:me.right>we.right-16?we.right-16-me.right:0,Re=me.top<we.top+16?we.top+16-me.top:me.bottom>we.bottom-70?we.bottom-70-me.bottom:0;($e||Re)&&A(de=>({...de,x:de.x+$e,y:de.y+Re}))},onClickCapture:ue=>{v.current&&(v.current=!1,ue.preventDefault(),ue.stopPropagation())},onKeyDown:ue=>{if(ue.key==="Escape"&&(Te(void 0,!0),ue.currentTarget.querySelectorAll("details[open]").forEach($e=>{$e.querySelector("summary")?.focus({preventScroll:!0}),$e.removeAttribute("open")})),ue.target!==ue.currentTarget)return;const me={ArrowLeft:{x:60,y:0},ArrowRight:{x:-60,y:0},ArrowUp:{x:0,y:60},ArrowDown:{x:0,y:-60}}[ue.key];me&&(ue.preventDefault(),A({...E,x:E.x+me.x,y:E.y+me.y})),(ue.key==="+"||ue.key==="=")&&(ue.preventDefault(),nt(1.2)),ue.key==="-"&&(ue.preventDefault(),nt(1/1.2)),ue.key==="0"&&(ue.preventDefault(),oe())},children:[n.jsx("div",{"data-canvas-world":!0,className:"absolute left-0 top-0 origin-top-left",style:{transform:`translate(${E.x}px, ${E.y}px) scale(${E.scale})`},children:e.map((ue,we)=>{const me=F[we],$e=ue.chiefs.length>0&&ue.members.length>0,Re=z===ue.key||R&&O===ue.key&&(R.bot.section?.trim()??"")!==ue.key,de=Object.hasOwn(p,ue.key)?p[ue.key]:void 0,Ve=ce=>n.jsxs("div",{className:"relative",children:[L?.botId===ce.id&&n.jsx("div",{className:V("pointer-events-none absolute inset-x-1 h-0.5 rounded bg-accent",L.after?"-bottom-[9px]":"-top-[9px]")}),n.jsx(JRe,{bot:ce,selected:g.selectedId===ce.id&&g.settingsOpen,moving:R?.bot.id===ce.id||H===ce.id,connected:h.includes(ce.id),onComputer:r,onArrange:W?X:void 0})]},ce.id);return n.jsxs("section",{"data-team-key":ue.key,"aria-label":l("canvas.teamRegion",{name:ue.name}),className:V("absolute rounded-2xl border bg-panel/90 shadow-sm has-[details[open]]:z-20 data-[computer-dropping=true]:border-accent data-[computer-dropping=true]:ring-2 data-[computer-dropping=true]:ring-accent/25",Re?"border-accent ring-2 ring-accent/25":"border-hairline/50"),style:{left:me.x,top:me.y,width:me.width,height:me.height},children:[n.jsxs("header",{className:"flex h-16 items-center gap-2 px-5",children:[n.jsx("button",{"data-arrange-team":ue.key,disabled:!W,"aria-label":l("canvas.arrange",{name:ue.name}),title:l("canvas.arrangeHint"),className:"min-w-0 flex-1 cursor-grab rounded-md py-2 text-left active:cursor-grabbing focus-visible:outline-2 focus-visible:outline-accent",onKeyDown:ce=>{const Le={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[ce.key];if(!Le)return;ce.preventDefault(),ce.stopPropagation();const tt=ce.shiftKey?40:10;ge({...N,[ue.key]:{x:me.x+Le[0]*tt,y:me.y+Le[1]*tt}})},children:n.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:ue.name})}),de&&n.jsxs("button",{"aria-label":l("canvas.teamComputer",{team:ue.name,name:de.name}),title:`${de.name}${de.state?` · ${de.state}`:""}`,disabled:!d,onClick:()=>d?.(ue.key),className:"flex min-w-0 max-w-[120px] shrink items-center gap-1.5 rounded-md px-1.5 py-2 text-[10px] text-ink-secondary hover:bg-control hover:text-ink focus-visible:outline-2 focus-visible:outline-accent disabled:pointer-events-none",children:[n.jsx(Ea,{size:12,className:"shrink-0"}),n.jsx("span",{className:"truncate",children:de.name})]}),n.jsx("span",{className:"text-[11px] tabular-nums text-ink-secondary",children:ue.chiefs.length+ue.members.length}),t&&n.jsxs("details",{className:"relative",onToggle:ce=>{if(ce.currentTarget.open){const Le=b.current?.getBoundingClientRect();ae(Le&&ce.currentTarget.getBoundingClientRect().bottom>Le.bottom-210*E.scale?ue.key:null),b.current?.querySelectorAll("details[open]").forEach(tt=>{tt!==ce.currentTarget&&tt.removeAttribute("open")})}},children:[n.jsx("summary",{"aria-label":l("canvas.manageTeam",{name:ue.name}),className:V(Vh,"cursor-pointer list-none [&::-webkit-details-marker]:hidden"),children:n.jsx(Kl,{size:17})}),n.jsxs("div",{className:V("absolute right-0 z-30 w-[220px] rounded-xl border border-hairline bg-panel p-1.5 shadow-xl",Y===ue.key?"bottom-10":"top-10"),onClick:ce=>{const Le=ce.currentTarget.closest("details");Le?.querySelector("summary")?.focus(),Le?.removeAttribute("open")},children:[n.jsxs("button",{className:Ny,onClick:()=>i(ue.key),"aria-label":l("team.moveTo",{name:ue.name}),children:[n.jsx(ki,{size:14}),l("team.moveTo",{name:ue.name})]}),n.jsxs("button",{className:Ny,onClick:()=>o(ue.key,ue.name),"aria-label":l("team.instructionsEdit",{name:ue.name}),children:[n.jsx(Rs,{size:14}),l("team.instructions")]}),ue.key&&n.jsxs("button",{className:Ny,onClick:()=>i(ue.key,!0),"aria-label":l("team.renameAria",{name:ue.name}),children:[n.jsx($i,{size:14}),l("team.rename")]}),ue.key&&n.jsxs("button",{className:V(Ny,"hover:text-danger"),onClick:()=>s(ue.key),"aria-label":l("team.deleteAria",{name:ue.name}),children:[n.jsx(xn,{size:14}),l("team.delete")]})]})]})]}),Re&&n.jsx("div",{className:"pointer-events-none absolute -top-7 left-2 z-30 max-w-[calc(100%-16px)] truncate rounded-md bg-accent px-2 py-1 text-[10px] text-white shadow-sm",children:Ye}),n.jsxs("div",{className:"flex items-center px-5 pb-5",children:[ue.chiefs.length>0&&n.jsx("div",{className:"flex flex-col gap-4",children:rh(ue.chiefs,Ne(ue.key)).map(Ve)}),$e&&n.jsx("div",{className:"flex w-10 shrink-0 justify-center text-ink-secondary/35","aria-hidden":"true",children:n.jsx(Mg,{size:22,strokeWidth:1})}),ue.members.length>0&&n.jsx("div",{className:"flex flex-col gap-4",children:rh(ue.members,Ne(ue.key)).map(Ve)}),ue.chiefs.length+ue.members.length===0&&n.jsx("p",{className:"flex h-[126px] w-[236px] items-center justify-center rounded-xl border border-dashed border-hairline/70 px-6 text-center text-[12px] leading-relaxed text-ink-secondary",children:l("canvas.dropHere")})]})]},ue.key)})}),R&&n.jsxs("div",{className:"pointer-events-none absolute z-40 rounded-xl border border-accent/40 bg-card px-4 py-3 text-[13px] shadow-lg",style:{left:R.point.x+16,top:R.point.y+16},children:[n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Zt,{bot:R.bot,size:24,animated:!1}),R.bot.name]}),Ye&&n.jsx("p",{className:"mt-1 text-[10px] text-ink-secondary",children:Ye})]}),n.jsxs("div",{className:"pointer-events-none absolute inset-x-5 bottom-5 flex items-end justify-between gap-3",children:[n.jsxs("div",{className:"min-w-0 rounded-lg bg-app/90 px-2 py-1.5 text-[11px] text-ink-secondary",children:[n.jsx("p",{className:"max-sm:hidden",children:l("canvas.hint")}),n.jsx("p",{role:"status","aria-live":"polite",className:"max-w-[440px]",children:Ye??U})]}),n.jsxs("div",{className:"pointer-events-auto flex shrink-0 items-center gap-0.5 rounded-xl border border-hairline/60 bg-panel p-1 shadow-sm",children:[n.jsx("button",{className:Vh,"aria-label":l("canvas.zoomOut"),onClick:()=>nt(1/1.2),children:n.jsx(TE,{size:15})}),n.jsxs("button",{className:"min-w-12 rounded-md px-1 py-2 text-[11px] tabular-nums text-ink-secondary hover:bg-control","aria-label":l("canvas.fit"),title:l("canvas.fitHint"),onClick:oe,children:[Math.round(E.scale*100),"%"]}),n.jsx("button",{className:Vh,"aria-label":l("canvas.zoomIn"),onClick:()=>nt(1.2),children:n.jsx(Sn,{size:15})})]})]})]})}const vs="rounded-lg px-3 py-2 text-[12px] text-ink-secondary hover:bg-control hover:text-ink disabled:opacity-40",lE="w-full rounded-lg border border-hairline/60 bg-inset px-3 py-2 text-[12px] text-ink outline-none focus:border-accent";function ZRe({open:e,createRequest:t,drop:a,sections:o,onClose:i,onDropHandled:s,onChange:r}){const{dispatch:c}=ke(),[d,p]=f.useState(null),[h,g]=f.useState(!1),[b,x]=f.useState(""),[v,k]=f.useState(""),[w,N]=f.useState(null),[C,j]=f.useState(!1),[M,E]=f.useState(""),A=f.useRef(crypto.randomUUID()),R=f.useRef(null),B=f.useRef(null),O=f.useRef(null),T=f.useRef(!1),z=f.useRef(!0),P=f.useRef(null),L=f.useRef(r);L.current=r;const[G,H]=f.useState(null),[$,U]=f.useState(null),[Q,W]=f.useState(null),q=f.useRef(crypto.randomUUID()),Y=f.useRef(null),ae=f.useRef(null),F=f.useRef(null),pe=f.useRef(null),[ge,Ne]=f.useState(null),ee=f.useCallback(()=>{const be=F.current;F.current=null,pe.current?.removeAttribute("data-computer-dropping"),pe.current=null,be?.handle.hasPointerCapture(be.id)&&be.handle.releasePointerCapture(be.id),Ne(null)},[]);f.useEffect(()=>(e||ee(),()=>{pe.current?.removeAttribute("data-computer-dropping")}),[e,ee]),f.useEffect(()=>{Y.current=Q},[Q]),f.useEffect(()=>()=>{const be=Y.current;be&&fetch(`/api/team-computers/${encodeURIComponent(be)}/control`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"release",controlLeaseId:q.current}),keepalive:!0}).catch(()=>{})},[]);const X=f.useCallback((be,Ye)=>{if(!(T.current||be.section===Ye)){if(be.section!==null&&Ye!==null){x(`Unassign ${be.name} from ${be.section||"General"} before moving it to another team. Its files and signed-in accounts stay on the computer.`);return}x(""),H({computer:be,section:Ye})}},[]),oe=(be,Ye)=>{const ue=ae.current?.parentElement?.querySelector("[data-team-canvas]"),we=document.elementFromPoint(be,Ye)?.closest("[data-team-key]");return we&&ue?.contains(we)&&o.some(me=>me.key===we.dataset.teamKey)?we:null},ne=be=>{const Ye=F.current;if(!Ye||be.pointerId!==Ye.id)return;if(be.buttons===0){ee();return}if(!Ye.moved&&Math.hypot(be.clientX-Ye.x,be.clientY-Ye.y)<5)return;Ye.moved=!0,be.currentTarget.setPointerCapture(be.pointerId);const ue=oe(be.clientX,be.clientY);pe.current!==ue&&(pe.current?.removeAttribute("data-computer-dropping"),ue?.setAttribute("data-computer-dropping","true"),pe.current=ue);const we=ue?o.find(me=>me.key===ue.dataset.teamKey):null;Ne({name:Ye.computer.name,x:be.clientX,y:be.clientY,hint:we?Ye.computer.section!==null&&Ye.computer.section!==we.key?"Unassign before moving to another team":`Assign to ${we.name}`:"Drop onto a team"})},Ce=be=>{const Ye=F.current;if(!Ye||Ye.id!==be.pointerId)return;const ue=Ye.moved?oe(be.clientX,be.clientY)?.dataset.teamKey:void 0;ee(),ue!==void 0&&X(Ye.computer,ue)},le=f.useCallback(async()=>{P.current?.abort();const be=new AbortController;P.current=be,g(!0);try{const Ye=await Z("/api/team-computers",{signal:AbortSignal.any([be.signal,AbortSignal.timeout(3e4)])});if(be.signal.aborted||!z.current)return;p(Ye),k(""),L.current(Ye.computers)}catch(Ye){!be.signal.aborted&&z.current&&k(Ye instanceof Error?Ye.message:String(Ye))}finally{!be.signal.aborted&&z.current&&g(!1)}},[]);f.useEffect(()=>(z.current=!0,le(),()=>{z.current=!1,P.current?.abort()}),[le]),f.useEffect(()=>{if(!e)return;le();const be=window.setInterval(()=>{!T.current&&document.visibilityState==="visible"&&le()},2e4);return()=>window.clearInterval(be)},[e,le]),f.useEffect(()=>{t>0&&j(!0)},[t]),f.useEffect(()=>{if(!e)return;const be=document.activeElement instanceof HTMLElement?document.activeElement:null;return O.current?.focus(),()=>{be?.isConnected&&be.focus()}},[e]),f.useEffect(()=>{e&&C&&B.current?.focus()},[e,C]),f.useEffect(()=>{if(!a)return;const be=d?.computers.find(Ye=>Ye.id===a.id);be&&X(be,a.section),s()},[a,d,s,X]);const re=async(be,Ye,ue,we)=>{if(!T.current){T.current=!0,N(be),x(""),P.current?.abort();try{const me=await Ye();z.current&&ue?.(me)}catch(me){z.current&&(x(me instanceof Error?me.message:String(me)),we?.())}finally{T.current=!1,z.current&&(N(null),await le())}}},xe=f.useCallback(()=>H(null),[]),Te=(be,Ye,ue={})=>Z(`/api/team-computers/${encodeURIComponent(be)}/${Ye}`,{method:"POST",body:JSON.stringify(ue)}),nt=()=>{i(),c({type:"toggleAppSettings",open:!0,section:"computer"})};return n.jsxs(n.Fragment,{children:[e&&n.jsxs("aside",{ref:ae,"aria-label":"Team computers",onKeyDown:be=>{be.key==="Escape"&&!G&&(be.stopPropagation(),F.current?ee():i())},className:"flex w-[300px] max-w-[90vw] shrink-0 flex-col border-l border-hairline/50 bg-panel max-sm:absolute max-sm:inset-y-0 max-sm:right-0 max-sm:z-30 max-sm:shadow-xl",children:[n.jsxs("header",{className:"flex items-center gap-2 border-b border-hairline/40 px-4 py-3",children:[n.jsx(Ea,{size:16,className:"text-ink-secondary"}),n.jsx("h2",{className:"flex-1 text-[13px] font-semibold",children:"Computers"}),n.jsx("button",{"aria-label":"Refresh computers",className:vs,disabled:h||w!==null,onClick:()=>{x(""),le()},children:n.jsx(vn,{size:14,className:h?"animate-spin":""})}),n.jsx("button",{ref:O,"aria-label":"Close computers",className:vs,onClick:i,children:n.jsx(jt,{size:15})})]}),n.jsxs("div",{className:"min-h-0 flex-1 space-y-3 overflow-y-auto p-4",children:[n.jsx("p",{className:"text-[12px] leading-relaxed text-ink-secondary",children:"Drag a computer onto a team, or choose its team below. Bots on Auto will use it."}),(b||v||d?.problem)&&n.jsx("p",{role:"alert",className:"rounded-lg bg-danger/10 p-3 text-[12px] text-danger",children:b||v||d?.problem}),d&&!d.configured&&n.jsxs("div",{className:"rounded-xl border border-hairline/50 p-3 text-[12px]",children:[n.jsx("p",{className:"text-ink-secondary",children:"Connect your Box account before creating a cloud computer."}),n.jsx("button",{className:`${vs} mt-2 border border-hairline/50`,onClick:nt,children:"Connect Box"})]}),C?n.jsxs("form",{className:"space-y-3 rounded-xl border border-hairline/60 bg-card p-3",onSubmit:be=>{be.preventDefault();const Ye=R.current??M.trim();!Ye||!d?.configured||(R.current=Ye,re("create",()=>Z("/api/team-computers",{method:"POST",body:JSON.stringify({name:Ye,requestId:A.current,acknowledgeCost:!0})}),()=>{E(""),j(!1),A.current=crypto.randomUUID(),R.current=null},()=>{R.current=null}))},children:[n.jsx("label",{className:"block text-[12px] font-medium",htmlFor:"canvas-computer-name",children:"New Box computer"}),n.jsx("input",{ref:B,id:"canvas-computer-name",className:lE,value:M,maxLength:60,placeholder:"e.g. Engineering desktop",disabled:w!==null||R.current!==null,onChange:be=>E(be.target.value)}),n.jsx("p",{className:"text-[11px] leading-relaxed text-ink-secondary",children:"Creates a cloud machine in your connected boat.dev account. Your Box plan and usage charges apply. It stays unassigned until you choose a team."}),n.jsxs("div",{className:"flex justify-end gap-1",children:[n.jsx("button",{type:"button",className:vs,disabled:w!==null,onClick:()=>j(!1),children:"Cancel"}),n.jsxs("button",{type:"submit",className:"flex items-center gap-2 rounded-lg bg-accent px-3 py-2 text-[12px] font-medium text-white disabled:opacity-40",disabled:!d?.configured||!M.trim()||w!==null,children:[w==="create"&&n.jsx(je,{size:13,className:"animate-spin"}),"Create Box"]})]})]}):n.jsxs("button",{className:"flex w-full items-center justify-center gap-2 rounded-xl border border-dashed border-hairline/60 px-3 py-3 text-[12px] text-ink-secondary hover:bg-control hover:text-ink",disabled:w!==null,onClick:()=>j(!0),children:[n.jsx(Sn,{size:14})," New Box computer"]}),d?.computers.map(be=>{const Ye=["idle","ready","running"].includes(be.state),ue=["init","provisioning","provisioned","cloning","starting"].includes(be.state),we=Q===be.id,me=be.held||we;return n.jsxs("article",{"data-computer-id":be.id,className:"rounded-xl border border-hairline/60 bg-card p-3",children:[n.jsxs("div",{"data-computer-drag-id":be.id,role:"group",tabIndex:-1,"aria-label":`Drag ${be.name} to a team`,onPointerDown:$e=>{T.current||F.current||$e.button!==0||!$e.isPrimary||($e.currentTarget.focus({preventScroll:!0}),F.current={id:$e.pointerId,x:$e.clientX,y:$e.clientY,moved:!1,computer:be,handle:$e.currentTarget},$e.currentTarget.setPointerCapture($e.pointerId))},onPointerMove:ne,onPointerUp:Ce,onPointerCancel:ee,onLostPointerCapture:()=>{F.current&&ee()},className:"flex touch-none select-none cursor-grab items-center gap-2.5 rounded-lg py-1 outline-none active:cursor-grabbing",children:[n.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-control text-ink-secondary",children:n.jsx($h,{size:18})}),n.jsxs("span",{className:"min-w-0",children:[n.jsx("span",{className:"block truncate text-[13px] font-medium",children:be.name}),n.jsxs("span",{className:"block text-[11px] text-ink-secondary",children:["Box · ",w===be.id?"Updating…":be.state]})]})]}),be.problem&&n.jsx("p",{className:"mt-2 text-[11px] text-danger",children:be.problem}),n.jsxs("label",{className:"sr-only",htmlFor:`computer-team-${be.id}`,children:["Team for ",be.name]}),n.jsxs("select",{id:`computer-team-${be.id}`,className:`${lE} mt-3`,disabled:w!==null,value:be.section===null?"unassigned":`team:${be.section}`,onChange:$e=>X(be,$e.target.value==="unassigned"?null:$e.target.value.slice(5)),children:[n.jsx("option",{value:"unassigned",children:"Not assigned"}),o.filter($e=>be.section===null||$e.key===be.section).map($e=>n.jsx("option",{value:`team:${$e.key}`,children:$e.name},$e.key))]}),be.section!==null&&n.jsx("p",{className:"mt-1.5 text-[10px] text-ink-secondary",children:"Unassign to move to another team."}),n.jsxs("div",{className:"mt-2 flex flex-wrap gap-1",children:[!Ye&&!ue&&n.jsx("button",{className:vs,title:"Starts this Box; your provider's usage charges apply",disabled:w!==null||me,onClick:()=>{re(be.id,()=>Te(be.id,"provision",{acknowledgeCost:!0}))},children:"Start / retry"}),Ye&&!me&&n.jsx("button",{className:vs,disabled:w!==null,onClick:()=>{re(be.id,()=>Te(be.id,"sleep"))},children:"Sleep"}),Ye&&n.jsxs("button",{className:`${vs} flex items-center gap-1.5`,title:"Pauses bot control while you use the desktop",disabled:w!==null,onClick:()=>{re(be.id,async()=>(await Te(be.id,"control",{action:"take",controlLeaseId:q.current}),W(be.id),Te(be.id,"join")),$e=>{typeof $e.joinUrl=="string"&&$e.joinUrl.startsWith("https://")&&U({id:be.id,url:$e.joinUrl})})},children:["Open desktop ",n.jsx(Mn,{size:11})]}),we&&n.jsx("button",{className:`${vs} text-accent`,disabled:w!==null,onClick:()=>{re(be.id,()=>Te(be.id,"control",{action:"release",controlLeaseId:q.current}),()=>{W(null),U(null)})},children:"Return to bots"}),be.held&&!we&&n.jsx("button",{className:vs,disabled:!0,title:"Another viewer has paused bot control on this desktop",children:"In use"})]}),$?.id===be.id&&n.jsx("a",{href:$.url,target:"_blank",rel:"noopener noreferrer",className:"mt-2 block rounded-lg px-3 py-2 text-[12px] text-accent hover:bg-control",children:"Open secure desktop ↗"})]},be.id)})]}),n.jsx("footer",{className:"border-t border-hairline/40 p-3",children:n.jsx("button",{className:`${vs} w-full text-left`,onClick:nt,children:"Local VM and other computers…"})})]}),ge&&ta.createPortal(n.jsxs("div",{role:"status",className:"pointer-events-none fixed z-[70] rounded-xl border border-accent/40 bg-card px-4 py-3 text-[12px] text-ink shadow-xl",style:{left:ge.x+14,top:ge.y+14},children:[n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx($h,{size:15}),ge.name]}),n.jsx("p",{className:"mt-1 text-[10px] text-ink-secondary",children:ge.hint})]}),document.body),n.jsx(na,{open:G!==null,tone:"neutral",title:G?.section===null?`Unassign ${G?.computer.name??"computer"}?`:`Assign ${G?.computer.name??"computer"} to ${G?.section||"General"}?`,body:G?.section===null?"This removes the team default. It does not stop or delete the machine, its files, or its logins. Review the bots' Auto routing before their next task.":"Bots on Auto in this team will share this computer's files and signed-in accounts. Explicit bot computer settings stay unchanged. Only one bot can use the desktop at a time. This does not move the OMB server or enable 24/7 hosting.",confirmLabel:G?.section===null?"Unassign computer":"Assign computer",onCancel:xe,onConfirm:()=>{const be=G;be&&(H(null),U(null),re(be.computer.id,()=>Z(`/api/team-computers/${encodeURIComponent(be.computer.id)}`,{method:"PATCH",body:JSON.stringify({section:be.section,acknowledgeSharedAccess:!0})})))}})]})}function QRe({edge:e,bots:t}){const{dispatch:a}=ke(),o=t.find(r=>r.id===e.sourceBotId),i=t.find(r=>r.id===e.targetBotId);if(!o||!i)return null;const s=e.state!=="connected";return n.jsxs("button",{onClick:()=>a(e.groupId?{type:"select",id:e.groupId}:la(i)),className:"flex w-full items-center gap-3 rounded-xl border border-hairline/40 bg-card px-3 py-2.5 text-left transition hover:bg-raised/50",children:[n.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[n.jsx("span",{className:"truncate text-[13px] font-medium text-ink",children:o.name}),n.jsx(Mg,{size:13,className:V("shrink-0",s?"text-accent":"text-ink-secondary")}),n.jsx("span",{className:"truncate text-[13px] font-medium text-ink",children:i.name})]}),e.reason&&n.jsx("span",{className:"max-w-[220px] truncate text-[11.5px] text-ink-secondary",children:e.reason}),n.jsx("span",{className:V("rounded-full px-2 py-0.5 text-[10.5px] font-medium",e.state==="running"?"bg-success/15 text-success":e.state==="queued"?"bg-warning/15 text-warning":"bg-control text-ink-secondary"),children:e.state==="running"?"Running":e.state==="queued"?"Queued":e.lastAt?Ms(e.lastAt):"Connected"})]})}function XRe({section:e,label:t,onClose:a}){const o=f.useRef(null),i=f.useRef(null),s=f.useRef(a),r=f.useRef(!1),c=f.useRef(!1),[d,p]=f.useState(""),[h,g]=f.useState(""),[b,x]=f.useState(24e3),[v,k]=f.useState(null),[w,N]=f.useState(!0),[C,j]=f.useState(!1),[M,E]=f.useState(null),A=d!==h,R=f.useMemo(()=>new TextEncoder().encode(d).byteLength,[d]);s.current=a,r.current=C,c.current=A;const B=f.useCallback(()=>{r.current||c.current&&!window.confirm(l("team.instructionsDiscard"))||s.current()},[]);f.useEffect(()=>{const T=document.activeElement instanceof HTMLElement?document.activeElement:null;o.current?.focus();const z=P=>{if(P.key==="Escape"&&!r.current){P.preventDefault(),B();return}if(P.key!=="Tab")return;const L=o.current;if(!L)return;const G=[...L.querySelectorAll('button:not([disabled]), textarea:not([disabled]), input:not([disabled]), [href], [tabindex]:not([tabindex="-1"])')];if(G.length===0){P.preventDefault(),L.focus();return}const H=G[0],$=G[G.length-1];P.shiftKey&&document.activeElement===H?(P.preventDefault(),$.focus()):!P.shiftKey&&document.activeElement===$&&(P.preventDefault(),H.focus())};return window.addEventListener("keydown",z),()=>{window.removeEventListener("keydown",z),T?.focus()}},[B]),f.useEffect(()=>{let T=!1;return N(!0),E(null),Z(`/api/section-context?section=${encodeURIComponent(e)}`).then(z=>{T||(p(z.text),g(z.text),k(z.updatedAt),x(z.maxBytes),window.setTimeout(()=>i.current?.focus(),0))}).catch(z=>{T||E(z instanceof Error?z.message:String(z))}).finally(()=>{T||N(!1)}),()=>{T=!0}},[e]);const O=async()=>{if(!(R>b)){j(!0),E(null);try{const T=await Z(`/api/section-context?section=${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify({text:d})});g(T.text),p(T.text),k(T.updatedAt),x(T.maxBytes)}catch(T){E(T instanceof Error?T.message:String(T))}finally{j(!1)}}};return ta.createPortal(n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/55 p-4 backdrop-blur-[2px] sm:p-6",onMouseDown:T=>T.target===T.currentTarget&&B(),children:n.jsxs("div",{ref:o,role:"dialog","aria-modal":"true","aria-labelledby":"section-context-title",tabIndex:-1,className:"animate-pop-in flex max-h-[min(680px,calc(100dvh-2rem))] w-full max-w-[680px] flex-col overflow-hidden rounded-[24px] border border-hairline/50 bg-panel shadow-2xl shadow-black/50 outline-none",children:[n.jsxs("header",{className:"flex items-start justify-between gap-4 border-b border-hairline/40 px-6 pb-4 pt-6 sm:px-8 sm:pt-7",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Rs,{size:19,className:"text-accent"}),n.jsx("h2",{id:"section-context-title",className:"text-[20px] font-semibold tracking-[-0.01em] text-ink",children:l("team.instructionsTitle",{name:t})})]}),n.jsx("p",{className:"mt-1.5 max-w-[520px] text-[12.5px] leading-relaxed text-ink-secondary",children:l("team.instructionsHint")})]}),n.jsx("button",{onClick:B,disabled:C,"aria-label":l("team.instructionsClose"),className:"flex size-9 shrink-0 items-center justify-center rounded-lg text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-40",children:n.jsx(jt,{size:19})})]}),n.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 py-5 sm:px-8",children:[w?n.jsx("div",{className:"flex min-h-[260px] items-center justify-center text-ink-secondary",children:n.jsx(je,{size:20,className:"animate-spin","aria-label":l("team.instructionsLoading")})}):n.jsxs(n.Fragment,{children:[n.jsx("textarea",{ref:i,value:d,onChange:T=>p(T.target.value),placeholder:`Goals
|
|
606
|
+
`)[0].slice(0,140):"Something went wrong."}function ZEe({state:e,onOpen:t}){return n.jsxs("button",{type:"button",onClick:t,"data-update-reminder":!0,className:"animate-panel-in fixed bottom-4 left-4 z-50 flex items-center gap-1.5 rounded-full border border-accent/40 bg-panel px-3 py-1.5 text-[12.5px] font-medium text-accent shadow-lg shadow-black/30 hover:bg-control",children:[n.jsx(So,{size:13}),e.status==="downloaded"?`Restart to update${e.version?` to ${e.version}`:""}`:`Update available${e.version?`: ${e.version}`:""}`]})}function QEe(){const e=zC(),[t,a]=f.useState(null),[o,i]=f.useState(null),s=e?.status;if(f.useEffect(()=>i(null),[s]),!e||e.status==="idle"||e.status==="checking")return null;const r=`${e.status}:${e.version??""}`;if(t===r)return e.status!=="available"&&e.status!=="downloaded"?null:n.jsx(ZEe,{state:e,onOpen:()=>a(null)});const c=window.ogb.updater,d=e.status==="installing",p=e.status==="preparing",h=e.status==="downloading"||p||d,g=e.installMode==="handoff",b=e.status==="available"?`${Wa().name} ${e.version} is available`:e.status==="downloading"?`Downloading ${e.version??"update"}…`:p?"Preparing update…":e.status==="downloaded"?`${e.version} is ready`:d?g?"Opening a terminal…":"Restarting to update…":e.status==="handed-off"?"Finish in a terminal":"Update failed",x=e.status==="available"?"A newer version is ready to download.":e.status==="downloading"?e.percent==null?"Starting download…":`${Math.round(e.percent)}%`:p?"Download complete. macOS is preparing the update.":e.status==="downloaded"?g?"Copy the install command and open a terminal.":"Restart to finish updating.":d?g?"Copying the command…":e.message||`${Wa().name} will reopen in a moment.`:e.status==="handed-off"?e.terminalOpened?"Command copied — paste it in the terminal that opened.":"Command copied — paste it in a terminal to finish.":e.retryable===!1?`${YB(e.message?.split(" Quit and reopen ")[0])} Quit and reopen ${Wa().name} before trying the update again.`:YB(e.message);return n.jsxs("div",{className:"animate-panel-in fixed bottom-4 left-4 z-50 w-[300px] rounded-xl border border-hairline/40 bg-panel p-3.5 shadow-2xl shadow-black/50",children:[n.jsxs("div",{className:"flex items-start gap-2.5",children:[n.jsx("span",{className:"mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-full bg-accent/15 text-accent",children:n.jsx(So,{size:14})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-[13.5px] font-semibold text-ink",children:b}),n.jsx("div",{className:"mt-0.5 text-[12.5px] text-ink-secondary",title:x,children:x})]}),!h&&n.jsx("button",{onClick:()=>a(r),className:"shrink-0 rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink",title:"Dismiss",children:n.jsx(jt,{size:14})})]}),e.status==="handed-off"&&e.command&&n.jsx("code",{className:"mt-2.5 block overflow-x-auto rounded-lg bg-control px-2 py-1.5 font-mono text-[11.5px] whitespace-pre text-ink-secondary",children:e.command}),e.status==="downloading"&&n.jsx("div",{className:"mt-2.5 h-1 overflow-hidden rounded-full bg-control",children:n.jsx("div",{className:V("h-full rounded-full bg-accent transition-[width]",e.percent==null&&"w-1/4 animate-pulse"),style:e.percent==null?void 0:{width:`${Math.min(100,Math.max(0,e.percent))}%`}})}),(p||d)&&n.jsx("div",{className:"mt-2.5 flex gap-2",children:n.jsxs("button",{disabled:!0,className:"flex flex-1 items-center justify-center gap-1.5 rounded-lg bg-control py-1.5 text-[13px] font-medium text-ink-secondary",children:[n.jsx(je,{size:13,className:"animate-spin"})," ",p?"Preparing…":g?"Opening…":"Restarting…"]})}),!h&&n.jsxs("div",{className:"mt-2.5 flex gap-2",children:[e.status==="available"&&n.jsx("button",{onClick:()=>{i("download"),c.download()},disabled:o!==null,className:JB,children:o==="download"?n.jsxs(n.Fragment,{children:[n.jsx(je,{size:13,className:"animate-spin"})," Starting…"]}):n.jsxs(n.Fragment,{children:[n.jsx(mE,{size:13})," Download"]})}),e.status==="downloaded"&&n.jsx("button",{onClick:()=>{i("install"),c.install()},disabled:o!==null,className:JB,children:o==="install"?n.jsxs(n.Fragment,{children:[n.jsx(je,{size:13,className:"animate-spin"})," ",g?"Opening…":"Restarting…"]}):g?n.jsxs(n.Fragment,{children:[n.jsx(QY,{size:13})," Install"]}):n.jsxs(n.Fragment,{children:[n.jsx(vn,{size:13})," Restart to update"]})}),e.status==="error"&&e.retryable!==!1&&n.jsx("button",{onClick:()=>{i("check"),c.check()},disabled:o!==null,className:"flex flex-1 items-center justify-center gap-1.5 rounded-lg bg-control py-1.5 text-[13px] text-ink hover:bg-raised-hover disabled:text-ink-secondary disabled:hover:bg-control",children:o==="check"?n.jsxs(n.Fragment,{children:[n.jsx(je,{size:13,className:"animate-spin"})," Checking…"]}):"Try again"}),n.jsx("button",{onClick:()=>a(r),disabled:o!==null,className:"rounded-lg px-3 py-1.5 text-[13px] text-ink-secondary hover:bg-control hover:text-ink disabled:opacity-50 disabled:hover:bg-transparent",children:e.status==="handed-off"||e.retryable===!1?"Dismiss":"Later"})]})]})}const XEe=JSON.parse(`[{"version":"0.1.214","improved":["Existing and new bots now receive shared guidance to work in small increments, check actual results, and adapt the remaining plan as requirements and data change.","Bots are guided to continue routine work within existing authorization and ask for input at meaningful decisions. Explicit approval settings remain in effect."],"fixed":["Shared instructions now treat your reported experience as evidence and distinguish it from causes that still need investigation."]},{"version":"0.1.213","fixed":["Repeated reads or edits of the same file now reuse the approval you gave for that operation during the session.","Session approvals for a simple command in a selected directory now work across repeated calls.","The run summary now explains which commands it counts, separately from file actions and permission prompts.","Unanswered permission requests now keep waiting instead of timing out and telling the bot to skip the work.","A task can switch computers more than once, reconnecting its tools while keeping the original request."],"improved":["New bots default to automatic review for routine work. Explicit manual preferences and computer-control consent are preserved."],"added":["Pause and Resume for supported Claude conversations hold pending permission requests and the next request. Stop still ends the turn; Pause does not freeze a response already being generated."]},{"version":"0.1.212","improved":["Free models now work the same as your other models. A turn that falls back to a free model keeps your full memory and context and can use the same tools, and a bot marked as handling client data can fall back to a free model like any other. The warnings on the Free models card stay, so you decide before you turn it on. Free models are still off by default and are only used after your subscriptions."]},{"version":"0.1.211","added":["GOD MODE run: with GOD MODE on, start a run above the composer (or type /godmode) and Atomic works non stop on one goal until it is done or the time is up (2 hours by default, up to 8). It shows a countdown, a Stop button and a log of everything it approved for you.","During a run Atomic does not stop to ask: it approves every tool, keeps going on pay-per-use keys, may move a bot to another engine when its own is blocked, answers the bot's questions for you, and turns a failed attempt into the next one."],"changed":["GOD MODE has hard limits it never crosses on its own: moving money or buying anything, deleting data outside the task, production deploys, force pushes, and local Postgres databases. Outside a run the card waits for you with the reason; during a run the bot is told no and finishes the rest."],"fixed":["A bot no longer keeps running on a local model its engine cannot use. Atomic Engine and Hermes stop offering local models that are too small for them, and a model the engine refused is replaced once instead of warning on every turn."]},{"version":"0.1.210","fixed":["You can add GitHub and other official servers when 20 servers are already configured. Atomic now supports up to 500 saved servers; each engine still uses its own supported number per conversation."]},{"version":"0.1.209","fixed":["Hermes now runs only your Nous Research subscription. OpenAI Codex, OpenCode, OpenRouter, DeepInfra, Hugging Face and local Ollama models run on Atomic's own engines and are no longer routed through Hermes."]},{"version":"0.1.208","added":["New AI providers in Settings > AI & accounts: GitHub Copilot (sign in with GitHub), OpenRouter, Hugging Face, DeepSeek, Together, Fireworks, the paid tiers of Groq and Cerebras, AWS Bedrock, Azure OpenAI and Google Vertex AI.","Pollinations, a free model that needs no key or sign-up, can be added by hand under Free. It is off by default, comes last among free models and is never used for client data, because prompts sent to it may be stored.","A workspace time zone setting: daily routines and the monthly spend cap now follow your time zone instead of the server's."],"improved":["Model classes: Claude Fable 5.2 and 13 more current models are graded, and every spelling of a model (5.1 or 5-1, with or without an effort or speed setting) shares one class. A newer version of a model Atomic already knows takes that model's class until it is graded.","Model classes: scores from Artificial Analysis's newer index are converted before grading, so frontier models no longer drop a class or two. Turns now try your subscriptions first, then free models, then pay-per-use, and Settings says which order is used inside a class.","An engine that keeps failing the same way is rested for longer, up to 2 hours, so turns stop landing on it.","Slow actions such as saving keys, engine sign-in, refreshing models and the Nexus import get a longer time limit, and other requests time out after 30 seconds instead of waiting forever.","Intel Macs get their own Atomic Engine package."],"fixed":["A turn no longer stops after two engines fail. Atomic keeps moving to the next engine until one answers or none is left.","A limit on one model, such as Claude's Fable limit, now rests only that model. The same account's other models keep running.","Choosing Keep going for pay-per-use keys now holds until a subscription actually answers a turn. It used to be forgotten seconds later.","Editing a ladder or a class in Settings no longer resets what happens when a connection runs out, or whether free models are allowed.","Hermes no longer fails every turn with an internal error when more than 16 MCP servers are enabled.","Atomic Engine (Auto) is no longer stopped as not responding while it is moving to its next account.","A local model on Atomic Engine now runs on your computer after a restart instead of failing.","Mistral Vibe runs when it is installed and signed in, Kimi reports its real error, and a model that only accepts text is no longer sent screenshots.","Security: the desktop app now asks for its own confirmation before GOD MODE, Full or Custom access is turned on, and before any page saves or removes a provider key. The app's pages run under a strict content security policy, and local processes need a credential to read desktop data.","Browser, phone, accounts, computer and agent tools keep working after a session's first turn.","Model gateway calls stop when you disconnect or after 3 minutes of silence, and calls over your spend cap are refused before they reach the provider.","Routines no longer freeze the scheduler when one start hangs, and a tick that arrives during a slow pass runs when it ends."]},{"version":"0.1.207","fixed":["Account, phone and browser tools no longer fail with \\"this turn's tool access has expired\\" after a session's first turn: each tool connection now picks up the current turn's access token on every call.","Separate computers for separate bots: the Computer panel now shows Create when a bot is set to Local VM even while you view a conversation pinned to another computer, and App Settings no longer shows the shared podman command while in per-bot mode.","Setup failures such as a missing engine, a signed-out account or an install step no longer spend a failover try, the turn's capped stop line shows one entry per held event, and setup waits keep one log entry.","Claude's 5-hour limit wording and the Hermes gateway-unreachable error are now classified correctly and no longer force a failover."]},{"version":"0.1.206","added":["Settings > Import has a new Command-line tools source. It reads the skill folders of Claude Code, Codex, Gemini CLI and Grok CLI and brings each skill into Atomic once, on Chibi, your Primary Bot. Nothing in those tools' folders is changed or removed, a skill found in two tools is offered a single time, and any secret inside a skill is masked on the way in.","Reverse engineering ships with Atomic: the REA skill and its vetted, pinned helper server are bundled, off by default. An Administrator switches the server on in Settings > Marketplace > MCP servers and adds it to a bot's allowed servers."],"improved":["Model details name the engine that actually answered after a failover, and a turn placed on a stand-in because its pinned engine was resting, signed out or not installed now counts toward the fallback total.","iPhone and iPad: Team Rooms invite links from auth.chibitek.com open in Atomic instead of Safari."],"fixed":["iPhone and iPad: linking a repository to a conversation, browsing your GitHub repositories and cloning one now work through the paired Mac."]},{"version":"0.1.205","added":["Apple account on your Mac: Settings > Accounts now offers Apple Calendar, Apple Reminders, Apple Contacts and iCloud Drive, read-only, for your Private Bot. Turn on each part you want; macOS asks for permission the first time. Needs macOS 14 or later.","Asking a bot to connect iCloud, Apple Calendar, Reminders or Apple Contacts now finds that built-in account instead of saying it is not in the Marketplace. The card, and the Marketplace page, open Settings > Accounts."],"improved":["iPhone and iPad: a bot's card for an account built into Atomic says to turn it on in Settings > Accounts on your Mac, where that permission lives."]},{"version":"0.1.204","improved":["Automatic updates now finish on their own. With Install updates automatically on, Atomic downloads a new version in the background and restarts into it once the computer has sat idle for a few minutes, so nobody has to open the app or click Restart.","iPhone and iPad: queued messages show a Steer button so you can redirect a bot that is already working, the composer stays compact while you type, and a long press on any message opens Reply, Mark as Unread, Copy and Select Text."]},{"version":"0.1.203","improved":["Attention badges stop at 10+ on Mac, iPhone, iPad and the Home Screen widgets, and count only what needs you: waiting approvals and questions, and finished results you have not looked at. Idle conversations stay out of the bell.","Opening a thread, or replying in it, counts its finished result as reviewed, so Ready for you no longer piles up with results you have already read.","A finished result left unreviewed for 30 days is archived, never deleted; unarchive the thread to bring it back."]},{"version":"0.1.202","added":["When Nexus offers to bring in what your AI already knows about you, Atomic shows that offer once, on Mac and on iPhone and iPad, after checking your Chibitek sign-in. Yes hands it to your Private Bot to import; Not now declines. An expired sign-in shows a single Sign in again instead."]},{"version":"0.1.201","improved":["Signing in to Atomic with your Chibitek account now connects Nexus and Mochii for you: any that are missing are added and signed in with that same account, with no Settings step and no separate browser sign-in. Settings shows them as signed in with Chibitek."],"fixed":["When Nexus or Mochii turn down an expired Chibitek sign-in, Atomic now renews it and tries again right away instead of pausing Nexus memory for up to 30 minutes."]},{"version":"0.1.200","added":["Link repos from the conversation on Mac and iPhone: the folder chip (Mac) and Add to conversation > Repos (iPhone and iPad) offer your registered repos, git folders under ~/repos and your GitHub repos, which clone into ~/repos in the background."],"improved":["Every bot now follows a pinned facts rule: it checks the PAW workspace, Nexus memory and the connected systems of record before the open web, and leaves out a fact it cannot source instead of filling the gap."],"fixed":["Company bots keep their tool access for the whole conversation. The 0.1.199 notes announced this fix, but the agents proxy change was not in that build. The proxy now reads its per-turn token from a file, so pooled Atomic Engine and Hermes sessions no longer fail teammate hand-offs, Nexus memory and Mochii with \\"this turn's tool access has expired\\".","Mode for this bot works from an iPhone or iPad paired through the desktop app. The picker no longer greys out with \\"Mode controls require an Administrator pairing\\"; the paired device owns its selection and it survives a restart. On iPad the open chat is tinted in the roster.","The desktop app reopens the workspace you chose last, including This computer, instead of restoring a paired remote computer on every launch.","On iPhone, a refused Nexus or Mochii sign-in is renewed once in the background, then a single Sign in again notice is shown instead of the same error on every turn."]},{"version":"0.1.199","fixed":["Company bots keep their tools for the whole conversation. The Atomic Engine now reconnects a server whose sign-in details changed between turns, so teammate hand-offs, Nexus memory and Mochii no longer fail with \\"this turn's tool access has expired\\" and the Mochii tools no longer disappear from a bot mid-session.","On iPhone, voice mode speaks replies from This iPhone again."]},{"version":"0.1.198","improved":["Chat scrolling stays smooth in long conversations: message versions are grouped once and reused instead of rebuilt on every update.","On iPhone and iPad, Channels, invite links and multi-bot Team Rooms are available, and the Terminal keeps its output on screen while you type."],"fixed":["\\"Always allow this session\\" on a permission card now covers every command with the same program and subcommand, such as every git status, instead of only the exact text. Commands that chain or redirect still ask one at a time.","Connected Google and Microsoft accounts now work in every company bot without a per-bot Access step. Bot Settings > Access still restricts a bot, and a Personal account stays with the Private Bot.","Cmd+Shift+V is held only while Capture clipboard history is on, so Paste and Match Style works system-wide again when capture is off.","Sidebar header menus open into the window instead of past its left edge.","Pasting more than four images into one message is refused as it happens, with the limit named, instead of failing after Send.","Relaunching Atomic revives a hung or crashed window instead of doing nothing."]},{"version":"0.1.197","fixed":["Local VM setup on Intel and Apple silicon Macs now uses Podman, with guided installation, startup and retry controls.","New Podman desktops use separate folders and an available local port. Older Docker and Colima desktops and files stay untouched.","Desktop workspace labels, the workspace menu and Connected workspaces name the computer hosting Atomic. A paired remote host shows as remote, and the label is derived again at every startup."]},{"version":"0.1.196","added":["Open a Terminal on a bot's computer from your paired iPhone: the Local VM, the VPS or This Mac. Turn it on per phone with Allow terminal in Settings > Remote access.","chibi terminal opens the same shell from a terminal on a chibi serve computer."],"fixed":["A shell on This computer no longer closes right away for a bot that has never run."]},{"version":"0.1.195","added":["Channels has its own sidebar tab for invited conversations with people and their primary Chibi.","Each Chibi joins with a verified identity tied to its owner and Atomic installation."],"fixed":["Changing an invitation link clears the old preview before joining.","Channels keep private conversation history and capability-sharing settings out of the room."]},{"version":"0.1.194","added":["A running or paused goal stays pinned above the composer with its status, time elapsed and turn count. Pause, resume or stop it from the bar."],"fixed":["Goal updates in a chat show as a goal card instead of an empty message."]},{"version":"0.1.193","added":["The model picker has one Atomic Engine (Auto) choice. It picks a model for each class and uses your subscriptions first.","Settings has Allow free models. Atomic asks before turning it on, and bots with client data never use free models.","Local model servers such as Ollama, LM Studio, oMLX, EXO and Unsloth join Atomic Engine's automatic chain after your subscriptions and before any pay-per-use key.","Claude Code and Codex can choose Atomic Engine with the atomic/auto model."],"changed":["Chibi and new bots start on Atomic Engine (Auto). Chibi's model resets to it once after this update.","A Nous API key counts as your Nous subscription, not pay per use.","Plans with included monthly credit, such as Ollama Team's $1,000, use that credit before any overage."],"fixed":["Vault no longer adds a leftover Bearer prefix to API keys that use a custom header such as xi-api-key, so ElevenLabs and similar services accept the saved key."]},{"version":"0.1.192","fixed":["Vault shows when an API key is saved and hidden. Replace API key changes it deliberately; blank edits keep the saved key, and failed saves leave the original intact.","Vault selects the correct API key header for ElevenLabs and HeyGen automatically. Choose a custom header and prefix when a service needs different settings."]},{"version":"0.1.191","added":["The Computer panel now has a Terminal tab. It opens a shell inside a bot's Local VM or VPS, so you can work there without leaving Atomic. Start the Local VM or VPS from the Computer tab first. You can turn the tab off in Settings > Experimental.","The Terminal tab can also open a shell on this computer, as you, in the bot's working folder. This is off until you turn on Terminal on this computer in Settings > Experimental. On Windows the terminal is a basic line console for now, without colours or arrow keys.","On iPhone and iPad, the computer screen and This Mac screen can go full screen. In full screen you keep the typing row and the shortcut keys while you are in control.","On iPhone and iPad, a two-finger tap on a computer's screen is a right-click, and a shortcut bar adds Command, Option, Control and Shift keys that stay held for the next key.","On iPhone and iPad, voice mode now follows CarPlay, Bluetooth and AirPods instead of always using the speaker.","In Settings > AI & accounts > Classes & failover, a step can now be a model on Any subscription. Atomic then uses that model through whichever of your subscriptions has it and still has usage."],"changed":["The order Atomic builds for each class now puts the top-ranked models that run in a full agent app first, whichever provider they come from, and takes one model from each provider in turn. Claude and ChatGPT no longer hold the first places by default. Chibi still starts on Claude Sonnet 5.5.","There is now one skill that sets up your Personal AI Workspace (PAW). It asks what kind of work you do, offers starter shapes for common roles, and can point your other AI tools at the same folder. The older ICM workspace builder is gone, and its commands now open this one.","Chibi now hears about every time a bot's turn moves to another engine, whatever the cause, not only sign-in failures. Repeats for the same engine and cause are held back for an hour, so one bad provider is one report."],"fixed":["With GOD MODE on, a chat could only use the kind of AI app it last ran on. If that one needed a sign-in, the turn stopped with an error even though your other accounts were ready. A turn can now start on, or move to, any of them.","An account that needs a sign-in, or whose key has expired, no longer uses up one of a turn's two tries. Atomic skips it and carries on with the next one.","Nexus memory no longer stays shut for half an hour after a brief network drop. Old failures are forgotten, and the message now says how long the wait is.","When Hermes Agent gives up after its retries and writes the failure as an ordinary reply, Atomic now moves the turn to the next engine instead of showing that text as the answer."]},{"version":"0.1.190","added":["Your bots can use the logins and API keys in Settings > Vault without choosing bots for each one. New and imported items are open to all your bots, each only on its own website. One button on the Vault page opens the items you saved before, and you can still limit any item to chosen bots or keep it private.","The Vault import now takes API keys as well as logins, including keys saved under a name alone with no website. Well-known services such as ElevenLabs, OpenAI, GitHub, Vercel and Supabase get their address filled in. Any other key is saved and marked as needing an address before bots can use it.","Every bot now refuses text written for an AI that it finds in a web page, file or code, and tells you where it was and what it tried to do. Pages read with the built-in browser are also checked automatically.","Where Hermes is installed, you can sign in to your Nous Research account from Settings > AI & accounts."],"changed":["Chibi now starts the same way on every computer: Automatic, in the Plata class, on Claude Sonnet 5.5. This update resets Chibi to that once, including any model you had pinned and any changes to the Orchestrator's order. Without a Claude account, Chibi uses the closest-rated model you have.","The bots Atomic makes for each AI subscription (Claude, ChatGPT, Gemini, Grok and the others) now run only their own provider's models. When that provider is out of usage the bot stops and offers a handoff, instead of continuing on another provider.","In Settings > AI & accounts > Classes & failover, a provider now uses one account unless you choose Any account for it.","A Nous Research API key now appears with the pay-per-use keys, because Nous bills keys per use. Signing in through Hermes uses your Nous subscription."]},{"version":"0.1.189","added":["Bots can now sign in to websites with a login saved in Settings > Vault. Tick the bots allowed to use the login. In the built-in browser, Atomic types the username and password into the site's sign-in page itself, only on that login's website, so the bot never sees the password."]},{"version":"0.1.188","added":["Settings > Vault can now hold API keys. Choose New API key, enter the key, the header it is sent in and the web addresses it may go to, then tick the bots allowed to use it. Atomic makes the request and adds the key itself, so the bot never sees it."]},{"version":"0.1.187","fixed":["After a tool is denied or fails, the turn stays on the same engine instead of moving to another one.","A Claude account that also hosts local models is listed once in the model picker.","Desktop viewer passwords for a Local VM or VPS are no longer passed on the Docker command line.","Team room presence stays fresh after the first heartbeat, and a room message updates the chat list preview right away.","The previous-bot shortcut opens the last bot you used, and New thread in VS Code opens a fresh chat.","A calendar call keeps its next run when an edit leaves the schedule alone, and Atomic stays responsive while scripts launch."]},{"version":"0.1.186","fixed":["A stopped Local VM now starts again with its disk and files, from the Start button in Settings or by itself the next time a bot needs it. Atomic no longer asks you to remove and recreate it."]},{"version":"0.1.185","fixed":["Claude no longer stops with \\"needs sign-in\\" because of an old Anthropic command-line login left on the computer. Atomic now uses only Claude's own sign-in.","When no engine can work on this computer, the stop message also names the engines that are signed out or unavailable, so you can see which one to sign in to.","A model your plan does not include now pauses only that model, not every Claude model."]},{"version":"0.1.184","fixed":["Workspace backup metadata limit raised to 64 MB, and disposable Antigravity tool catalogs are excluded so large workspaces back up cleanly.","Selective category restore in Settings lets you restore specific parts of your workspace without overwriting existing local data."]},{"version":"0.1.183","fixed":["Nous Research now connects with your Nous portal API key. Setup no longer tries to install Hermes.","Z.ai GLM Coding Plan now connects with your plan key directly, without Hermes.","Workspace backups skip build output inside task folders (git history, Xcode build data and archives, dist and release folders), so large workspaces stay under the backup file limit."]},{"version":"0.1.182","fixed":["Full backups can run while bots, approvals, sign-ins and computer actions are active. Restore still waits for work to finish before replacing workspace data.","Fixed a Mac network socket error that could interrupt backups and other requests."]},{"version":"0.1.181","fixed":["Full workspace backups no longer stop when a file changes while it is being copied. Growing logs and replaced files are captured without cancelling the backup."],"improved":["Backups record a warning when a file keeps changing or disappears before it can be captured. Encryption and restore integrity checks remain in place."]},{"version":"0.1.180","added":["Settings > Classes & failover now has a preference for when a subscription runs out: ask before switching, move to another plan then ask before a paid key (the default), or keep going.","On iPhone Duo, a slim shortcut column fills the space below the status indicators: All chats, Needs you, Tasks, Computer for paired bots, New chat and Search."],"improved":["When a plan is used up, Atomic can move the chat to the next approved connection. A brief rate-limit wait is not treated as the plan running out, so the chat stays put after the usual retries.","A new turn no longer silently uses a pay-per-use key when every subscription is resting. Atomic asks first, unless you already chose Keep going.","Wide iPhone and iPad windows show your chat list beside the open conversation. Needs you shows only items waiting for your answer or approval."]},{"version":"0.1.179","fixed":["When an engine fails, Atomic now moves the chat to a genuinely different engine instead of retrying another copy of the same one with the same key, so a broken key no longer stops every turn.","An OpenRouter key that has been revoked or deleted is now recognized as a dead key. Atomic stops using it until you save a new one, and keeps your chats running on another engine meanwhile."]},{"version":"0.1.178","added":["Settings > Updates has an Install updates automatically switch, on by default. Atomic downloads updates as it finds them and installs them the next time you quit. Turn it off to check only.","Settings > Vault holds up to 3,000 items, and a password manager import can take just one vault, folder or tag. Pick the file, choose what to bring in, then import.","Settings > Engines has a Free tab that lists the free models, each with a link to sign up with the provider."],"improved":["Turning on free models in Auto now shows a clear warning first. Free turns are labeled in the chat header, are reported to your Chief of Staff, and never reach Nexus or PAW.","On iPhone, Home shows the device you're working in as its title. Tap it to switch devices, rename one or add a new one."],"fixed":["Turning off Include free models in Auto works again.","On iPhone, tapping a bot, a pinned bot or Settings on Home opens it again.","On Linux without a system keyring, Atomic refuses to store secrets instead of saving them where other apps could read them."]},{"version":"0.1.177","added":["You can attach any kind of file to a message, on the Mac, iPhone, iPad, Android, Windows and Linux. HTML and Markdown files go in as readable documents, and other files such as zips travel with the message as downloads."]},{"version":"0.1.176","added":["On iPhone and iPad, the model menu in a chat now has Choose a model. It lists every provider your subscriptions and API keys give you, with each provider's models and reasoning effort, and pins your pick to that thread."],"fixed":["On iPhone and iPad, the model menu in a chat no longer jumps back to the top while you scroll it. The model classes and the modes now open as their own short lists."]},{"version":"0.1.175","added":["Settings > Vault can import the logins you export from a password manager as a CSV file. Exports from Chrome, Edge, Safari, Firefox, 1Password, Bitwarden, LastPass, Dashlane, Proton Pass, NordPass and RoboForm all work.","About me now stays in step across Atomic, your PAW workspace and Nexus. A change in one place reaches the others, and if two places disagree, Settings > About me lets you pick which version to keep."],"fixed":["Dictation in the chat box works again after you use system-wide dictation. Since 0.1.174 the system-wide dictation kept the microphone in its echo-cancelling mode, so the chat box heard almost nothing.","When dictation hears nothing, Atomic now says so instead of asking you to check your Microphone and Speech Recognition permissions. A refused microphone is named as soon as dictation starts."]},{"version":"0.1.174","added":["Bots can now read, change and cancel existing Google and Outlook calendar events: title, description, location, time, guests and room, for one occurrence, this and following, or a whole recurring series. Changes that email guests ask for your approval first."],"fixed":["Claude no longer fails on every message on Macs with an older Claude Code. Atomic was passing it an option that only newer versions understand.","Dictation no longer types words you did not say. The microphone now filters out sound from your own speakers, such as Atomic reading aloud, a call or a video.","A dictation started with the shortcut now stops on its own after 20 seconds of silence, and after 10 minutes at most, so a take left running cannot pick up the room.","Words heard while you were in another app are no longer typed in a burst when you come back. They go on the clipboard, so you can paste them if they are yours.","Auto-correct can no longer add words to your dictation, and words the speech engine is unsure of are left out."]},{"version":"0.1.173","added":["Back up and restore your whole Atomic setup to another Mac (Settings), encrypted by default.","When you control This Mac from an iPhone or iPad, taps, touch and hold, drags and scrolls now reach the Mac. This is the desktop side of phone pointer control.","Settings > Engines and tiers can include free models in Auto. It is off by default, free models are tried only after your subscriptions and keys, and a bot marked as handling client data never uses them.","On iPhone and iPad, Atomic opens on the device you used last, either the iPhone or a computer. If that computer is no longer paired, it opens on the iPhone.","On iPhone and iPad, Home shows an icon for the iPhone and each connected computer. Tap one to switch to it, or touch and hold it to rename it. Names are saved on the phone only."],"fixed":["A task handed to a teammate whose working folder is busy now waits in the queue instead of failing right away.","New installs: Chibi logs every feature request you mention as a Mochii task. Existing Chibis keep their own instructions."]},{"version":"0.1.172","added":["On iPhone and iPad, touch and hold a link in a bot's reply to open it in your default browser or copy it. A normal tap works as before.","On iPhone and iPad, touch and hold a word in a bot's reply to select just that part, drag the handles to expand it, then copy, look up or share it.","On iPhone and iPad, pinch to zoom a computer screen from 1x to 8x, drag to pan, and double-tap to zoom in or back out. It works on a bot's computer and on This Mac.","On iPhone and iPad, when you are controlling This Mac, a tap clicks instantly, touch and hold right-clicks, touch and hold then drag moves things, and swiping scrolls. The Mac must run a desktop Atomic update that includes phone pointer control.","On iPhone and iPad, type / in a bot chat and pick /goal to give the bot an objective it keeps working on until it is done. /goal status, pause, resume and stop control it."],"fixed":["On iPhone and iPad, the mode menu works again: Ask, Auto edits, God Mode and Plan can be read and changed from a paired phone. Changes still need an Administrator's paired device, and every mode above Ask asks you to confirm.","On iPhone and iPad, a bot's question with three or more answers, or long ones, shows each answer as its own full-width button instead of squeezing them into one row (TestFlight build 69).","Tools from Atomic Engine no longer go missing when two copies of its tool lookup start at once.","The Linux downloads list shows a new release right away instead of an older cached copy."]},{"version":"0.1.171","added":["On iPhone and iPad, open a bot's computer view and tap Control this Mac to watch this Mac's screen. Take control, confirmed with Face ID, lets you tap, scroll and type on the Mac while the bot's computer use is paused.","/skills and /skill commands in the composer list a bot's skills and run one on a task.","On iPhone and iPad, skills and remote MCP servers can be added, edited and removed for chats that run on the phone. Servers that need a sign-in open it in the browser, and every tool call asks for approval with Face ID or passcode.","Chat links to saved deliverables in shared folders open from any conversation you can see. Settings > General sets which folders are shared."],"improved":["On iPhone and iPad, typing and streaming replies no longer redraw the whole chat, so the composer stays steady and the app feels faster.","On iPhone and iPad, AI & accounts is in Settings and works without pairing a computer. Provider sign-up links go to the right pages.","From a paired iPhone or iPad you can pin and unpin bots and rooms and add Marketplace apps. A phone can only change the pin on a bot or room, nothing else."],"fixed":["Subscription bots fall back to the next model in the same class when the top model is resting after a usage limit, instead of reporting nothing ready.","On iPhone and iPad, mode controls reload after a reconnect, offer a retry, and say why they are unavailable.","On iPhone and iPad, the workspace opens even when one saved item cannot be read, and its + menu offers New thread."]},{"version":"0.1.170","added":["Plan mode keeps a bot to reading and planning until you approve the plan. It is enforced for Claude, Atomic Engine and the shared chat tools, and it holds through reconnects.","On iPhone and iPad, you can choose each bot's work mode from the model picker."],"improved":["The Most Current button takes you to the newest message in a conversation.","The bot list on iPhone and iPad loads faster."],"fixed":["Unread indicators clear when an open conversation is restored after a reload or reconnect. Pending approvals still require your response.","On iPhone and iPad, every approval prompt asks for Face ID or Touch ID before your answer is sent."]},{"version":"0.1.169","improved":["Desktop conversations show the active approval mode as a readable label beside its icon. Select the label to review or change the conversation’s permission level."]},{"version":"0.1.168","added":["Offline Atomic handbook with platform differences, setup, dictation, backups and troubleshooting. Open Help Center or About on desktop, or Settings on mobile."],"improved":["Desktop update safeguards retain dictation preferences and refuse to overwrite unreadable settings. Stopped Local VM disks are kept; existing images still require manual recovery before recreation.","Desktop clipboard picker shows a compact recent list and a full preview before pasting. Settings below the list opens Clipboard in the main Settings popup."],"fixed":["Desktop dictation Names and words no longer loses unsaved text when status refreshes. Failed saves keep your draft for retry."]},{"version":"0.1.167","fixed":["Windows: the helper that lets bots use your computer is now signed by Chibitek Inc. too, so every program Atomic installs carries Chibitek's or its maker's signature. 0.1.164 to 0.1.166 were never released."]},{"version":"0.1.166","added":["Early access: Atomic can connect to Addigy's hosted MCP server. When a bot asks Addigy to change something, you get a card to confirm or decline first. Signing in to Addigy this way has not been verified yet."]},{"version":"0.1.165","fixed":["Windows: the uninstaller is signed by Chibitek Inc. again. 0.1.164 was never released."],"improved":["iPhone and iPad build 57: the on-device model can stay loaded between messages, with a setting for where it runs. Speed gains have not been measured on an iPhone yet.","iPhone and iPad build 56: desktop conversation updates are grouped into 50 ms batches to reduce redraws. Notification pictures no longer hold up streaming replies.","The desktop companion compresses startup snapshots with gzip. This requires a desktop build containing the latency fix; the iPhone update alone does not enable compression."]},{"version":"0.1.164","added":["Early access: bots can ask you to enter a key for a secure MCP connection, such as Addigy, on a protected card. The key is saved in Atomic's encrypted store and never appears in chat. Signing in to Addigy this way has not been verified yet."],"fixed":["The Vault opens again after you restart Atomic.","Windows: every program in the installer, including the one that builds the uninstaller, is signed by Chibitek Inc. before it runs."],"improved":["Setup welcomes you by name with your company's logo when you sign in with Chibitek.","Bots on different teams now message each other through their team's Chief of Staff."]},{"version":"0.1.163","fixed":["Dictation on iPhone, iPad and Mac keeps earlier sentences and avoids repeating completed phrases. On iPhone and iPad, listening continues when the recognizer starts a new session. Please test a two-minute dictation with pauses and intentional repeated phrases."],"improved":["Windows: Qwen is turned off for now while its installer is unreliable from here. It still works on macOS and Linux, and any Qwen setup you saved is kept."]},{"version":"0.1.162","added":["Clipboard history on macOS and Windows.","Setup asks what you do and suggests starter bots that fit your work.","Each routine now has a private Mochii task that stays in sync."],"fixed":["Mac dictation keeps earlier lines instead of starting over, and stops listening when you send."]},{"version":"0.1.161","fixed":["Recover from an Antigravity checkpoint error on your next message while keeping your conversation history. Failed requests are not automatically repeated."]},{"version":"0.1.160","added":["Model details shows which model actually answered each turn, with history and counts."],"improved":["Attachments no longer stop at 512 MB. Uploads are refused only when your disk is nearly full, and nothing is deleted automatically."]},{"version":"0.1.159","added":["React to messages on iPhone with emoji, including skin-tone choices.","Choose the Panes mascot body."],"improved":["Expand the iPhone message composer into a half-height sheet.","Generate bot avatars with an eligible signed-in Codex subscription, without entering an API key.","API image generation is an explicit choice. A failed subscription never silently switches to API billing."]},{"version":"0.1.158","added":["When a company subscription bot's provider can't answer, that one conversation keeps going on the same class from another provider for up to 50 turns, with a handoff you can download or pass to another bot.","Vault in Settings keeps saved logins, cards and contacts encrypted on this computer, with search, categories and add, edit and remove.","Dictate into Brain dump.","A quiet banner says when a turn switched engines and when the first one resets. You can turn it off in Settings."],"improved":["A turn tries at most two engines, then stops with one plain line saying what to fix.","Local VM uses only Colima on the Mac and never opens Docker Desktop."],"fixed":["The terminal app picks a free port when its usual one is busy."]},{"version":"0.1.157","added":["Personal goals with pause, resume, completion criteria and token limits, available in chat and the chibi CLI.","Open-model setup on Windows and Linux, with Ollama Cloud models in the picker.","iPhone shows what changed after an update.","Import a Markdown skill file with the file picker, then review and enable it."],"fixed":["Waiting bots no longer look selected when another conversation is open.","Expired Claude sign-ins use an eligible fallback instead of stopping at the final error."]},{"version":"0.1.156","added":["Brain dump: paste a list of tasks, press Sort into tasks, and each line gets a suggested bot from your own roster. Nothing is sent until you press Send on a row.","Personal goals: type /goal followed by an objective in a one-to-one chat and the bot keeps working across turns until it's done, needs you, or hits a limit. /goal status, pause, resume and stop control it; the same commands work from the terminal."],"improved":["Default model ladders and class floors are tuned for better results out of the box.","The Settings dialog can be resized and remembers its size. View > Zoom now scales just the Settings dialog while it's open, and the whole window otherwise.","An approval request now goes to whichever device you're actually using (desktop or phone), and Face ID or your passcode is required to approve it on iPhone and iPad, so work doesn't stall waiting for a Mac you've stepped away from."],"fixed":["The sidebar no longer highlights the wrong bot's conversation."]},{"version":"0.1.155","improved":["A bot keeps working when one of its tools is down. If a tool server (an MCP server) will not start, times out or stops during a turn, Atomic leaves only that server's tools out, tells the bot in one line which server is missing, and tries it again on a later turn. The rest of the turn runs as normal.","When a tool server fails, Chibi gets one quiet Team incident naming the server, the same way a model fallback is reported. Raw startup errors never reach your chat."],"fixed":["On the Codex engine, a custom tool server that tried to set a protected environment variable used to end the whole turn. Atomic now skips just that server and logs it once."]},{"version":"0.1.154","added":["Pinned bots can be put in any order: drag them in the sidebar (or use Alt with the arrow keys, or Move left / Move right in a tile's menu). On iPhone and iPad 1.0.1 (50), long-press a pinned bot to move it.","Connect one Atomic desktop to another over Tailscale. On the other computer, open Settings > Devices & remote access > Remote access > Pair over Tailscale and copy the link; paste it on this computer under Connect to another computer."],"improved":["Accounts marked Personal and your subscriptions can now be used by company bots as well as your Private Bot. Company or Personal only says who owns the account.","Your Private Bot works through Chibi: it hands work for other bots to Chibi and never creates bots itself.","Atomic's bots use only Chibitek Nexus, PAW and Omi for memory. Other memory add-ons for Hermes stay switched off."],"fixed":["Claude accounts that have no sign-in of their own no longer show as signed in. They used to borrow an old, expired Anthropic login, which made bots answer \\"Login expired\\". Sign in to each account you want to use.","When Hermes answers \\"Login expired\\", the turn now moves to the next engine in the bot's class.","A chat pinned to an Ollama model no longer jumps to another Claude account when one account hits its limit.","The Private Bot's subscription list no longer says \\"None yet\\" when you have subscriptions."]},{"version":"0.1.153","added":["Team Rooms are on. Sign in with Chibitek in Settings > General > Basics, then open Tools > Team Rooms to start a room or join one with a link."],"improved":["One broken MCP server no longer stops a bot. Atomic sets that server aside for a while and the bot keeps working with its other tools; Settings shows which server is failing."],"fixed":["When Claude says \\"Login expired\\", or answers with a connection error, the turn now moves to the next engine in the bot's class instead of showing that message as the reply.","When a provider cannot be reached, API engines, Muse Code and Apple Intelligence now hand the turn to the next engine instead of stopping.","Marking a \\"Ready for you\\" result as reviewed now works from the iPhone app. Before, the phone showed a \\"no route\\" error.","Bots that Atomic runs now use only Atomic's own memory, not memory left over from other tools on the same Mac.","Pairing help in Settings now points to Remote access instead of a command that could not be installed."]},{"version":"0.1.152","added":["Sign in with Chibitek in Settings > General > Basics. It signs you in through your browser with your Chibitek Google or Microsoft account, and Team Rooms use it to know who you are."],"fixed":["\\"Always allow this session\\" on a Claude bot now really lasts for the session. Atomic remembers it and stops asking again for the same tool, instead of showing the same permission card on the next request."]},{"version":"0.1.151","added":["Mistral Vibe is now a subscription. Le Chat Pro and Team are now Mistral's Vibe Pro and Team plans. In Settings > AI & accounts > Subscriptions, install Mistral Vibe and choose Sign in with Mistral to approve on Mistral's own page. A Mistral bot is created that uses only your Vibe plan, and Mistral Vibe joins your failover ladders. It works on Mac and Linux; on Windows, install Vibe with Mistral's instructions first.","The MiniMax M Plan (formerly the Coding Plan) is now a subscription. Paste your M Plan key (it starts with sk-cp-) on the MiniMax card in Settings > AI & accounts > Subscriptions. A MiniMax bot is created, MiniMax M3.1 Flash is added, and your plan joins your failover ladders as a subscription instead of a pay-per-use key.","The Z.ai GLM Coding Plan is now a subscription, through Hermes Agent. Z.ai lets the plan run only in the tools it lists, and Hermes is one of them. Run Hermes setup, choose Z.AI / GLM and paste your plan key. A Z.ai GLM bot is created that uses only GLM 5.3 and GLM 5.3 Flash, and those models count as part of your plan, not pay per use."],"improved":["The Perplexity card now says plainly why Pro and Max cannot be used here: they include no API credits, and the Perplexity API is billed separately.","Mistral now shows Mistral's own full-colour logo.","Atomic on ARM Linux (such as the NVIDIA DGX Spark) now gets updates from Settings > Updates. Download the update, then run the install command Atomic opens a terminal for."]},{"version":"0.1.150","added":["Watch-Along: watch a YouTube video inside Atomic with Chibi commenting as it plays. Paste a single YouTube link in a message box and choose Watch along, or use Watch a video in the sidebar's compose menu or the command palette. For now it is offered only on computers enrolled in Chibitek's organization."],"improved":["Bots in a team room now switch engines quietly when one fails. A resting or signed-out engine is skipped, and a provider error (such as an expired API key) moves the turn to the next engine instead of showing in the room."],"fixed":["On Windows, Atomic no longer jumps back to the front after you minimize it. A tool that started Atomic's program to run a script was being treated as a second launch of Atomic, which brought the window forward and stopped the script from running.","iPhone and iPad 1.0.1 (47): when a DNS filter or DNS profile (Scout DNS, for example) looks up your computer's Tailscale name through public DNS, Atomic now says so and tells you which domain to forward to Tailscale, instead of saying Phone access looks off."]},{"version":"0.1.149","improved":["The Development pack's Chibitek Developer Playbook is updated to v2026.10.23.1, with current guidance on build runners and releases."],"fixed":["Windows release checks now include the Meta Muse Code command-line tool, so Windows builds that ship Muse Code pass their checks."]},{"version":"0.1.148","added":["Meta Muse Code is now a subscription. In Settings > AI & accounts > Subscriptions, install Muse Code with Meta's installer and choose Sign in with Meta to approve with your own Meta account. A Muse Code bot is created, and Muse Code joins your failover ladders after Claude and ChatGPT. It works on Mac, Windows and Linux; on iPhone and iPad you can see its status and start the sign-in on your paired computer. Meta's use of your content for training is turned off.","Meta Muse Code and the Meta Muse API key now show Meta's official logo."]},{"version":"0.1.147","fixed":["A Hermes signed in to Nous Portal now shows as signed in under Settings > AI & accounts > Subscriptions even when another provider is your Hermes default. Atomic reads Hermes's own sign-in record instead of only its default provider."],"improved":["The Nous Research bot can use any model on your Nous Portal plan, not only Nous's own Hermes models. It starts on your Hermes default when that runs through Nous, and its model menu lists only Nous models."]},{"version":"0.1.146","improved":["MCP server secrets (API keys, tokens and Authorization headers) are now kept in your computer's secure store, the Keychain on Mac and Windows' built-in encryption on Windows, instead of in plain text in Atomic's settings file. Each server gets its secrets only when it starts. Secrets already in your settings move over automatically when you update. If a server had a token typed into its command, Settings > Marketplace > MCP servers asks which setting name it reads, then passes the token that way."]},{"version":"0.1.145","added":["Nous Research is now its own subscription. A Hermes signed in to Nous Portal shows as Nous Research in Settings > AI & accounts > Subscriptions, and gets its own bot that uses only Nous's models."],"improved":["Provider menus are organized into Subscriptions, Flat plans, API keys, On this computer and Atomic, with plain names and no duplicates. Two accounts of one provider are labelled Company and Personal, and Atomic asks you to name them when there are more. Each provider's model menu now lists only the models that provider hosts.","Bots now put all your AI subscriptions to work. In Settings > AI & accounts > Classes & failover, each tier's automatic ladder keeps Claude or ChatGPT in the first two places (Chibi still starts on Claude), then takes one model from each of your other plans in turn (Gemini, Grok, Kimi, Qwen, Cursor, Ollama Cloud, OpenCode Go and the rest) before more Claude or ChatGPT models. Pay-per-use API keys stay last, and a ladder you edited yourself is kept as you set it."]},{"version":"0.1.144","added":["Ready for you lists conversations across your bots on desktop and iPhone. Waiting decisions and new completed responses appear first. Opening a completed response saves its review status across paired devices without clearing a newer response or an unanswered approval."],"improved":["Chibi check-ins now show short, actionable cards with large Open and Dismiss buttons on iPhone and desktop. Three items appear first, with Show more for the rest. Internal bot failures stay with the Chief of Staff; unfinished work reaches you only after two failed retries. Quiet hours and delivery history prevent repeated interruptions."]},{"version":"0.1.143","improved":["iPhone and iPad 1.0.1 (38): local model downloads show received-byte progress during each file transfer, with the active download and Cancel control above the model list. Keep Atomic open until completion; cancelling restarts the download next time."],"added":["Claude Sonnet 5.5 and Haiku 5.5 are now available when choosing a Claude bot model, including Chief of Staff team setup."],"fixed":["A model the engine no longer offers (for example Grok 4.6 after the grok CLI retired it) no longer stops the run. The turn continues on the engine's default model, the thread shows one quiet line saying so, and your Chief of Staff gets an incident asking you to change the model setting. The Grok picker now lists what the installed CLI offers.","Any bot can now hand work or a question up to Chibi, and to the Chief of Staff that manages its team, from its own conversation, even across sections. Before, the roster listed Chibi but the handoff was refused with \\"Room work cannot cross the sender's section boundary\\". Handoffs between specialists keep their section rules, and rooms keep theirs."]},{"version":"0.1.142","added":["Windows: dictate into any app with Ctrl+D (rebindable in Settings > General > Dictation), the same as Cmd+D on the Mac.","iPhone and iPad: Atomic's dictation now comes to the mobile app."],"fixed":["Settings has a Voice tab again, under General. It opens on Chibi's spoken-reply voice, and you can switch to any other bot. Each bot's own settings still have the same picker under Voice & alerts."]},{"version":"0.1.141","improved":["Settings > AI & accounts now opens on Subscriptions, with a card and a Sign in button for every AI plan: Claude, ChatGPT, Google Gemini, Grok, Cursor, Kimi, Qwen, OpenCode Go, Ollama Cloud (including Team) and Factory Droid. Microsoft Copilot, GitHub Copilot, Meta AI, Mistral Le Chat, Perplexity, MiniMax and Z.ai GLM are listed too, each with a plain reason it cannot be used yet.","You can add more than one account for a plan and mark each one Company or Personal, for example your company Google Workspace and your personal Google account for Gemini. Each account gets its own bot, and Personal accounts are used only by your Private Bot."],"fixed":["Stopping dictation in the chat box now waits for the final recognized words instead of cancelling them. Escape still cancels recording. Known issue: live-microphone dictation can listen without producing words; a fix is planned for 0.1.142.","Google sign-in now requests Gmail, Calendar and Drive together. Permissions you approve turn on automatically, without a second Turn on step. After updating, reconnect your Google account once in Settings > Accounts.","Bots use Google and Microsoft through Atomic Accounts, with your account-access settings respected. Bots without access explain what is missing. Settings refreshes when you return and shows sign-in status separately from mail, calendar and file permissions.","Signing in to Gemini with a Google account is now easy to find: it is the Google Gemini card under Subscriptions, not hidden inside the Antigravity engine. Connecting Gmail, Calendar and Drive stays under Google & Microsoft, and each place links to the other."]},{"version":"0.1.140","added":["Chibi can now reach and manage every company bot in every team, including bots you add later, as if it were each team's Chief: it can hand them work, fix their setup, manage their rooms and retry their stuck work. Your Private Bot, personal subscription bots and bots hidden from you stay out of its reach.","When you approve something in Chibi's conversation, the bots Chibi hands that work to can do the same thing without asking you again, for a limited time. Questions, credentials, spending and destructive actions still always ask you, and a bot saying you approved something never counts."],"fixed":["On Windows, Claude bots no longer stop with \\"Failed to refresh OAuth token\\" when several of them renew their sign-in at once, a Claude engine that fails to start is tried again before it is reported, and Chibi's check-ins say what went wrong in plain words.","Chibi no longer fails every message with \\"Internal error: Bad Request\\". Your own messages in Chibi's Primary Bot sweeps conversation now run on the model you picked (Plata by default) instead of the cheapest free one, connected apps such as Vercel and this computer no longer make Gemini refuse the whole request, and if a model refuses a request without saying why, the message moves to the next model."]},{"version":"0.1.139","improved":["Opening a bot now takes you back to the conversation you used most recently with it, on your iPhone and on the desktop.","Atomic now starts Colima or Docker Desktop for your Local VM when it is installed but stopped, and a Local VM that simply stopped is replaced on its next use without asking."],"fixed":["Auto conversations no longer stop with \\"Start docker first\\" when the Local VM they last used is unavailable. They continue on the next available place and say where they moved.","Codex no longer fails with \\"invalid transport\\" because of MCP servers in your own Codex settings.","On iPhone, the model class menu and the pay-per-use choices work again."]},{"version":"0.1.138","improved":["Atomic for Windows is now signed by Chibitek Inc., so Windows no longer blocks the download or the installer."],"fixed":["On Windows, Kimi, Grok, Cursor and Qwen no longer show as not installed right after Atomic installs them, while Windows is still scanning the new program."]},{"version":"0.1.137","improved":["Chibi now runs on Claude by default, at the Plata class. It uses another provider only when every Claude account is busy or out of usage."],"fixed":["A click on the model chip at the top of a chat now always offers the model classes, even when the current model has no class.","The specific-model picker now shows the latest suggested models immediately. Search still refines the list, while update, effort and local-model controls follow after the model choices instead of hiding them."]},{"version":"0.1.136","improved":["Settings > Classes & failover now lets you drag providers into order or jump one directly to any position. Provider and model choices are separate, every configured provider remains available, and Save order confirms when the change is stored.","The Orchestrator now defaults to the latest Sonnet model on the company Claude subscription, with the usual automatic fallback when Claude is unavailable."],"fixed":["iPhone and iPad now load the model-class menu even when the current model has not been graded on the phone yet, so class choices can be changed and saved from mobile.","When a bot's model needs you to sign in again or runs out of usage, Atomic now moves it only to a model that can work on the bot's computer, instead of failing every message. If none is free, the message says which models were skipped and why."]},{"version":"0.1.135","improved":["Pick a model class for a bot, or for one thread, right from the model chip at the top of a chat. A click offers Automatic and the four classes, Mezcal, Plata, Reposado and Añejo, each with the model it would run on now. Atomic then picks the best ready model in that class and falls back as usual.","To choose a specific provider and model, Command-click the chip on a Mac (Ctrl-click on Windows), or choose Choose a specific model at the bottom of the class menu. That view now has Save as default, which makes the thread's model the bot's default, and Reset to default, which puts the thread and the bot back on Automatic."]},{"version":"0.1.134","added":["Settings > Marketplace > MCP servers lists 53 more apps, each connecting through the vendor's own MCP server, including QuickBooks, HubSpot, Stripe, Atlassian, Notion, Canva, Monday.com and Zapier."],"improved":["Composio has been removed. Connect apps with the vendor's own MCP server in Settings, Marketplace, MCP servers.","Settings > Marketplace now has three tabs: Discover, MCP servers and Add-ons. The Connected apps tab is gone, and bots that need an app point you to the vendor's own MCP server."]},{"version":"0.1.133","added":["Your Private Bot and Chibi can now talk to each other. Ask your Private Bot to check something with Chibi, or ask Chibi to ask your Private Bot. Chibi never sees your private chats or memories: your Private Bot decides what to tell it. No other bot can reach your Private Bot.","Settings > Private Bot has a new switch, Let my Private Bot and Chibi talk. It is on by default; turn it off to keep them apart as before. Your organization can also keep them apart on its Macs."]},{"version":"0.1.132","fixed":["When you ask your Private Bot to share a chat with Chibi, it now points you to Share with Chibi in the chat's menu instead of searching for a Chief of Staff it cannot reach."]},{"version":"0.1.131","added":["Share with Chibi: open the menu on any of your Private Bot's threads and choose Share with Chibi. Chibi gets a new thread with a readable copy of that one conversation. The original stays private, and so do your other private chats and your private memory."]},{"version":"0.1.130","added":["Atomic now opens on your Chief of Staff: the first time you open it, in every new window, and when the bot or room you had open is deleted. New conversation lists the Chief of Staff first."],"fixed":["On a Mac, the Local VM keeps its saved workspace after Docker Desktop restarts, instead of asking you to recreate it on every message."]},{"version":"0.1.129","added":["Dictate in any app on your Mac: press Command+D and talk, and Atomic types into the app in front. Turn it on in Settings > General > Dictation. You can pick another shortcut, and Settings tells you when another app already uses it.","Apps that use Command+D in their own menus, such as Bookmark in Safari or Duplicate in Finder, are listed under the shortcut with a switch for each. Switch an app off and its own Command+D works there while dictation stays on everywhere else.","New subscription bots start on each company's newest flagship model at medium effort when your account offers it: Claude Opus 5.5, ChatGPT GPT-6 Astra, Gemini 3.8 Flash, Grok 4.7 and Kimi K3. Your own model choices are never replaced.","iPhone and iPad: Settings > Frontier models shows each AI's default model, whether it is signed in on your computer, and what each company allows on a phone. Settings > PAW lets you check your PAW, edit About me, run the setup interview and suggest changes through your paired computer.","Mochii and Nexus are now on by default on Mac, Windows and Linux, signed in through Chibitek. If you removed one before, it stays removed.","Spec to Ship and the house writing check now run as part of Atomic's own checks, so specs, plans and reviews are held to the same rules every time."],"improved":["Settings > AI & accounts: the Open button now takes you straight to the right key field. Key-only AI cards now have a masked key field with Save and Test, and keys are kept in Atomic's secure store, backed by the Keychain on a Mac. Choose Company or Personal and each key is saved separately.","Atomic finds each AI's command line tool on its own, and you can point it at another copy if you need to.","On a Mac, Open install in Terminal now opens Terminal and runs the install command for you. Ollama Cloud has a key field and a Get a key link instead of a Terminal button."],"fixed":["Messages that pointed to Settings > AI providers now name the real place: Settings > AI & accounts > Subscriptions or API keys.","The model picker returns to the official model list once it loads, instead of staying on the placeholder list."]},{"version":"0.1.128","added":["iPhone and iPad: local chat, downloadable models, model selection, and download and removal controls on supported devices.","Provider bots use their official logos on desktop, iPhone and iPad."],"improved":["Private Bots can use company models when personal accounts are unavailable, with confirmation before premium model costs.","Nexus work summaries retain safe task and output links while excluding credential-bearing links."],"fixed":["Windows setup now selects the declared automatic installers for Grok, Cursor, Kimi and Qwen, without relying on the wording of a terminal command.","Supported Windows provider installers run in the background with progress in Atomic. Setup checks availability after installation; sign-in remains interactive when needed."]},{"version":"0.1.127","added":["A bot for every AI account you sign in to: sign in to Claude, ChatGPT, Gemini, Grok, Kimi, Qwen or Cursor (in setup or Settings > AI & accounts) and Atomic adds a bot named after it, such as \\"Claude\\", \\"Claude (Personal)\\" or \\"ChatGPT\\", wearing that company's icon. It uses only that account and that company's models, picking the best one for the job unless you choose another. Two accounts of the same AI get two bots. Rename, hide or delete them like any bot; a deleted one is not made again.","When a subscription bot's account is out of usage, it moves to your other account of the same AI without a word. If none is free, it says when it will be back and offers to hand your request to Chibi. It never switches to a different AI on its own.","Bots made from a Personal account follow the Private Bot's rules: they run only on your own account, stay off Chibi's team and never see company connections. Your organization can turn off making these bots with the SubscriptionBots setting.","A bot's Access settings now list the apps turned on in its Claude account, each marked Connected via Claude, with an On/Off for that bot. Bots on another AI say why they have none.","Chibi says hello in your code editor and your terminal. The Atomic panel in VS Code (and Cursor, Windsurf and Antigravity) opens with Chibi, a short greeting, a What's new card for the latest release that you can close, and quick tips such as /bot to switch bots and Send Selection to Bot. In the terminal, chibi start, setup and login show Chibi with your version, who you are signed in as and a tip. Add --quiet to skip it; it never shows when the output goes to a file or another program, and NO_COLOR shows it in plain text.","The window Atomic shows while it opens now has Chibi's animated mark on Windows, Mac and Linux, and the iPhone app shows it while your workspace first loads. With Reduce Motion on, Chibi stays still.","Your Personal Bot is now your Private Bot. In the sidebar it reads Create your Private Bot; hold the pointer over it to see what that means: your company can't read it, and nothing you say there is shared with your work bots.","Private Bot chats stay private. Chibi, your work bots, connected assistants and Administrators never see its conversations, memories or files, and they are never mentioned anywhere else. Usage, activity and exports that others can see leave it out, and backups kept by your company do not include it.","Your Private Bot can read your work memories to help you, read only. Turn this off in Settings > Private Bot.","If you attach or paste something into your Private Bot that looks like a company document (from a company drive or shared folder, Mochii or Nexus, marked confidential, or with your company's name), Chibi asks first: keep it private, move it to Chibi or another work bot, or cancel. This check runs on your computer; nothing is sent anywhere to decide.","Your Private Bot now saves to your Nexus as private memory: only it can read it, and every save and lookup is signed with a key that stays on your computer. Chibi, your work bots, your company and Administrators never see it.","New bots set themselves up: + New bot, Create your Private Bot, and asking Chibi for a new bot all open a short interview. It asks one simple question at a time (what it should help with, its name, which clients or projects, which connected tools, when to check in with a morning brief, wrap-up or weekly review, and how it should talk), then shows a plain summary with Create and Change. Atomic writes the bot's instructions, picks its icon and AI, connects its tools and creates its routines, then opens it. Nothing to fill in or paste into Settings. Every question can be skipped, and an interview closed halfway picks up where you left off.","Chibi no longer answers \\"set up a bot for me\\" with instructions to copy. It shows a Set up your new bot card in the chat, already filled in with what you told it."],"fixed":["Fixed: the Reticle web-app testing connection could fail before starting because Atomic supplied an environment setting reserved for its own runtime.","Fixed: setup could leave you stuck when Google refused the sign-in (for example \\"Atomic has not completed the Google verification process\\") or the browser was closed. The Google and Accounts steps now always have Continue without it, and a refused sign-in says plainly that you can continue and connect it later.","Fixed: Mochii and Nexus connect as you, so they show your own company's tasks and memory, and when Nexus is not turned on for your company yet, Settings and the new-bot interview show its own calm note (your organization's memory space is being set up) instead of an error, and bots stop trying to reach it until it is ready.","Fixed: Chibi no longer passes on technical messages such as a tool that timed out on connect. It mentions a tool only when your request needs it, in one plain sentence, and offers to try again or help you connect it."],"improved":["Subscription bots now wear each company's official logo (Claude, ChatGPT, Gemini, Grok, Qwen and Cursor) inside a Chibitek ring: a particle drifts round it while the bot rests, three race round while it thinks, and the ring pulses while it replies. The logo itself never moves or changes colour. With Reduce Motion on, the ring stays still. Kimi shows a plain K, because Moonshot allows its logo only in editorial and non-commercial use. The same logos appear in setup and Settings, on the Mac, on Windows and on iPhone.","Mac dictation now types as you talk: each sentence or phrase is typed when you finish it or pause for about a second, instead of everything at the end. If you talk without stopping, Atomic types what it has every 15 to 20 seconds.","While you talk, the words being recognized show in a small bubble next to your cursor. They are only typed once they are final and cleaned up, and a sentence that has been typed is never changed again.","Auto-correct now looks at the one or two sentences before each new one, so a phrase is corrected as part of its sentence.","Press Command+Z while dictating, or right after, to remove just the last sentence. Saying \\"scratch that\\" on its own does the same.","If you switch to another app while dictating, Atomic pauses typing and says so. Go back and it carries on; nothing is ever typed into the wrong app.","Connected apps no longer take new apps. Apps you connected before keep working, and you can sign one in again if it expires or disconnect it, under Settings > Marketplace > Connected apps. New apps connect in the Marketplace through each company's official connector, and bots point you there instead of offering a connection card."]},{"version":"0.1.126","added":["Team Rooms (coming soon; off until Chibitek sign-in arrives in Atomic): share a bot conversation or start a New Team Room, then invite people from your company or other companies with a link (7 days and 10 uses by default; only the room owner makes links and can turn them off). Everyone brings their own bots with Add my bot, except their Private Bot. A bot answers only when someone @mentions it, runs on its owner's computer and subscriptions, and asks its owner before anything that commits them. A room with other companies shows a banner, and each bot shares nothing from its owner's memories, accounts or files there unless the owner turns it on for that room. Your iPhone reads and replies in rooms through your computer.","Ask any bot to connect an app, like \\"connect my QuickBooks\\", and it now checks the Marketplace for you. If the app is there, it gives you a Connect button that opens Settings > Marketplace with that app selected. If it isn't there yet, it says so and offers a button to send it to Chibitek as an idea. Bots no longer suggest building a connection themselves.","Marketplace: \\"Recommended for your business\\" lists the apps most companies connect first and that you can connect today (QuickBooks, Granola, Gmail, Google Calendar and Drive, Microsoft 365, Slack, Zoom, Docusign, HubSpot, Stripe, Canva, Notion and Asana), each with the best way to connect it.","The Marketplace now lists only official connections: servers run by the company behind each app, and their official connectors in your Claude account. Servers made by other people or independent developers are no longer offered, and bots never suggest them, because Atomic can't tell where they send your data. You can still add a server you trust by hand under MCP servers.","Marketplace: \\"Through your Claude account\\" shows the apps you turned on at claude.ai (such as QuickBooks, which only connects that way) and marks them Connected via Claude. Turn on \\"Also use my Claude Code MCP servers\\" there and your bots on Claude can use them.","Marketplace: Granola and Dropbox are now featured, using their official servers.","Atomic Engine, Chibitek's own AI engine, now installs from Atomic on Windows and on Macs, Apple silicon and Intel: one click in setup or in Settings > Engines. Atomic downloads it, checks it against its published checksum, and starts it once before using it. No terminal needed.","Mac: dictate in any app. Turn it on in Settings > General > Dictation, then press Control+Option+Space in Mail, Slack, your browser or any other app, talk, and press it again. Your words are typed where your cursor is. You can also hold Right Option while you talk instead.","Dictation turns your voice into text on your Mac only: Apple's speech recognition on macOS 26 and later, or Parakeet on macOS 14 and 15. It removes \\"um\\" and \\"uh\\", understands \\"comma\\" and \\"new line\\", and Auto-correct fixes spelling and grammar with Apple Intelligence on your Mac without changing your words. Using your AI subscriptions for Auto-correct is optional and off by default.","Settings > General > Dictation explains each permission (Microphone, Accessibility, and Input Monitoring only for Right Option), lets you change the shortcut, download the speech model, add names Atomic should spell your way, and switch dictation off for single apps.","HIPAA mode: an Administrator can turn it on for the whole workspace in Settings > General > Dictation, and organizations can set it with the HipaaMode MDM key. In HIPAA mode nothing you dictate or type leaves your Mac.","Setup: when a step fails, Save diagnostics sits next to Get help. The file now includes what setup did on this computer: every AI app check that failed or was slow, each install with its output, and each sign-in, with passwords and keys removed. Settings > General > Export Diagnostics saves the same file.","Atomic now saves your work to Nexus, so Chibi remembers you on every device and in every Chibitek app. After every bot reply it saves a short summary: what you asked, what was done, decisions, next steps, and links to pull requests and Mochii tasks.","Handoffs, reports and briefs your bots write are saved to Nexus too, and so are the images, audio and video your bots make or you attach.","Every saved item says where it came from: the app (Mac, Windows, iPhone, VS Code, the command line or Slack), the bot, the conversation and the time.","When you start a conversation, your bot gets a short note of your recent work and files from Nexus. Bots can also search Nexus and open a saved file when you ask about earlier work.","Settings > Memory: Always save to Nexus is on by default. Choose whether to save media and the largest file to save, see what Nexus remembers, and forget any item.","Your Personal Bot never saves to or reads from the company's Nexus. Its memory stays on your computer, unless you mark your own Nexus connection Personal.","Company-managed computers: your organization can keep Always save to Nexus on, and can turn on HIPAA mode so nothing marked as patient data is saved.","A bot's Memory settings are new. Memory saved to Nexus shows who you are connected as and what the bot remembers about you and your work, with search, edit and forget. When a bot's memory can't go to Nexus (not connected, HIPAA, or your Personal Bot), it says plainly that it is kept on this computer.","Workspace knowledge (PAW) in a bot's Memory settings shows which layers it reads (your organization, your department and you) and how fresh they are, with Open PAW and Suggest a change. A suggestion goes to the file's owner for approval in Mochii."],"improved":["Windows: Atomic now follows Early updates unless you or your organisation chose otherwise, so Windows computers keep getting updates before the first stable Windows release.","Signing in with Google now shares only your name and email. Gmail, Calendar and Drive each stay off until you turn them on in Settings > Accounts, and Google asks about each one on its own, with a plain note on what it lets bots do. Reading mail and writing drafts are separate, and Atomic no longer asks for permission to change or delete email. Accounts you already connected keep working.","Setup: the Google step can always be skipped. If Google shows an error page or you choose not to allow something, Atomic carries on and you can connect later.","Setup: installing an AI app shows what it is doing: the download with its size for Gemini, then unpacking and the first start, and npm's latest lines under Show details.","Checking which AI apps are installed can no longer hold up the list. Each app gets a time limit; one that does not answer shows as not ready, with the reason, while the others carry on.","When an AI app is installed but does not start, setup says what Atomic ran and what happened (not found, the exit code with its error, or no answer in time), instead of \\"CLI not found\\".","Nothing that looks like a password or key is ever uploaded: a file that contains one stays on your computer, and a summary has it hidden.","If you are offline or Nexus can't be reached, saves wait on your computer and are sent when it is back, each one exactly once.","A bot's notes file on this computer is now its offline copy and is saved to Nexus too. The file, its size meter and Open in Obsidian moved under Advanced, so you no longer see folder paths unless you look for them."],"fixed":["Fixed: on Windows, installing a new Atomic could leave the old one installed beside it (one \\"for everyone\\", one \\"only for me\\"). The installer now updates the copy that is already there, and removes any other copy of Atomic it finds, keeping your workspace and settings.","Fixed: on Windows, Atomic flashed a console window when it started, and another when the computer-control helper was checked.","Fixed: on Windows, installing Gemini (Antigravity) could fail at the end with \\"EPERM: operation not permitted, rename\\". Atomic now moves the download into place before starting it for the first time, waits out the antivirus scan, and never leaves a half-installed copy. Atomic Engine installs the same way.","Fixed: when a bot was set to an AI that is not installed on this computer, its next chat now runs on your next AI that is ready instead of failing. An AI that is set up wrongly still says so, instead of being swapped silently.","Fixed: on Windows, setup could stay on ChatGPT (Codex) without ever finishing its check, and installing it could fail with no useful message. A check that does not answer now stops the whole program it started, including the codex.exe helper that kept running and blocked the next install, and the install checks that Codex really starts before saying it is done.","Fixed: on Windows, installing Gemini or ChatGPT flashed black console windows. Programs that AI apps start through Atomic's own Node.js are now started hidden.","Fixed: setup could spin forever if Atomic restarted or stopped answering during an install. It now says so and offers Try again."]},{"version":"0.1.125","added":["Send feedback from inside Atomic: Help > Send Feedback or Report a Bug, Settings > General > Basics, the profile menu, or the small Feedback button next to the version in the sidebar. Pick Bug or Idea, describe it, and choose whether to attach a screenshot of the window and diagnostics (passwords, keys and tokens are removed first). It goes straight to the Chibitek team; a person reviews every bug before it is fixed. On iPhone: Settings > Send Feedback.","Windows: Grok can now be installed on Windows. Setup shows its Windows install line for PowerShell.","Press Command-D (Ctrl+D on Windows) to dictate into the chat box, like in Claude and ChatGPT. Press it again or Esc to stop; your words stay in the box to edit or send. The mic button shows it is listening the whole time.","Settings > General > Basics > Dictation shortcut lets you pick a different shortcut: click it, press the keys you want, or reset to Command-D. Atomic refuses shortcuts the system or Atomic already uses."],"improved":["Your iPhone reconnects to your Mac by itself as soon as its network changes, for example when you leave Wi-Fi, switch to cellular, or Tailscale on the iPhone turns back on. It no longer waits out a retry timer first.","When your iPhone can't reach your Mac, it now says why: Tailscale on this iPhone isn't connected (open Tailscale and turn it on), your Mac isn't answering over Tailscale (asleep, offline, or Atomic isn't running), or this iPhone needs to be paired again.","Settings > Remote access on the Mac shows, under Tailscale pairing: this Mac's Tailscale name and IP, whether it answers on its Tailscale name, and when your phone was last seen.","Windows: setup now says PowerShell and Enter, not Terminal and Return, and says when an AI is not available on Windows yet instead of offering an install that cannot work.","Windows: Atomic finds Cursor, Kimi, Qwen and Hermes right after you install them, without restarting Atomic.","Windows: Atomic Engine is not available on Windows yet, so Windows no longer offers it in setup or picks it for Chibi.","Settings is simpler: eight items with tabs instead of a long list. Marketplace is now in Settings, second from the top, with everything you can add in one place: featured tools, the MCP Registry search, connected apps, MCP servers and add-ons. Tools > Marketplace opens it.","Settings > General now has Basics, Appearance, Bots & threads, and Setup, so you can rerun setup steps from there. AI providers, Accounts and Connected assistants are together under AI & accounts; Remote access and Computers under Devices & remote access; Repos, Connected workspaces and Backups under Workspaces & repos.","Searching Settings also finds settings inside tabs, and lists the matching tabs under each item.","When dictation is missing Microphone or Speech Recognition access, the message now has an Open System Settings button that goes straight to the right privacy page."],"fixed":["Fixed: renaming your Mac in Tailscale broke remote access from your iPhone until Atomic was restarted. Atomic now notices the new name within a minute, and the iPhone finds the Mac under its new name by itself.","Fixed: on Windows, connecting ChatGPT (Codex) failed with \\"spawn EINVAL\\". Atomic now starts every AI and tool it installs on Windows the right way, including on a PC without Node.js: Claude Code, Codex, OpenCode, Pi, MiniMax, Gemini, Grok, Cursor, Kimi, Qwen, Droid and Hermes.","Fixed: on Windows, connecting Claude Code to Atomic and MCP servers started with npx could fail the same way.","Fixed: a chat could fail with \\"\`atomic acp\` isn't installed\\" when its bot was set to an AI that is not on this computer. The turn now runs on your next AI that is ready, such as Claude, and the bot keeps its setting for when that AI is installed."]},{"version":"0.1.124","added":["PAW (Personal AI Workspace): Atomic now creates one folder for your AI context by itself, in your home folder under workspace/PAW (on Mac and Windows). Your company's files, your department's files and your own notes live there, and every bot reads only what a job needs.","Setup asks a few plain questions about you (your role, department, company, goals and how you like to work) and saves them as your About me in PAW. Chibitek staff join their department: Service Desk, Development, Back Office, Creative, or Sales and Marketing.","Settings > General > PAW shows where your PAW is, your department, how many files each layer has, when it last synced, and has Edit about me.","Company and department files are locked. If you or a bot change one, Atomic puts the original back and sends the change to its owner as a PAW change request in Mochii.","Chibi's regular check now tells the owner about company files nobody has reviewed in 90 days. This check is free.","Your Personal Bot reads only your own personal notes in PAW; company bots never see them."],"improved":["The old \\"Set up your AI context\\" form is gone. You never pick a folder or build one by hand. An existing ICM folder still works and bots still read it, after PAW.","Company-managed computers: your organization can choose the PAW template new installs start from."],"fixed":["Fixed: when one of your AI subscriptions runs out partway through a turn, even when the provider calls it a rate limit, the bot now finishes the turn on your next subscription without showing an error, and goes back to its usual AI as soon as that subscription has room again."]},{"version":"0.1.123","fixed":["Fixed: setup could not install Claude, Codex or OpenCode on a computer without Node.js (the copy of npm inside Atomic was incomplete). Atomic now ships npm as one checked archive and unpacks it on first use.","Fixed: Check for updates no longer says the update files are missing when there is simply nothing newer yet."]},{"version":"0.1.122","added":["The animated Chibi logo now also appears on the Mac while Atomic starts, on the first setup screen, and while Chibi is thinking.","Atomic for Windows, for Chibitek in-house testing. It is not signed yet, so Windows asks before the first install: choose More info, then Run anyway.","The Windows installer asks who Atomic is for: Only for me (no administrator needed) or Anyone who uses this computer. IT can also install it for everyone on a PC with Datto RMM.","Windows has the same update rings as the Mac: Early updates (internal testers) in Settings > General > Updates gets new Windows builds first. Your organization can set the ring, or manage updates for you, the same way it can on a Mac.","Your Personal Bot: one bot that is only yours. Create it from the sidebar or Settings > Personal Bot, and give it its own name, persona and icon, including a picture. You can change them any time.","Every AI account in Settings > AI providers is now marked Company or Personal. Accounts you already had stay Company, so nothing changes for your company bots. Mark an account you pay for yourself as Personal.","Your Personal Bot runs only on your Personal accounts and never on company AI. Company bots never use your Personal accounts.","When your personal subscriptions are resting, your Personal Bot stops and tells you when they are back. It can use free local AI on this Mac if you turn that on, and your own pay-per-use key only after you say yes.","Your Personal Bot starts with no company connections. Mark your own Google or Microsoft accounts and MCP servers as Personal to give them to it; company bots can't see or use them.","Chibi and company bots can't hand your Personal Bot work, and it can't hand them work. It carries a small Personal badge, and so do its conversations. Your iPhone shows it with the badge too; create it on your Mac.","The setup wizard asks once whether a plan you connect is your own. Chibitek company plans are always Company.","Company-managed Macs: your organization can turn the Personal Bot off. An existing one is then hidden, not deleted."],"improved":["On Windows, setup only shows what applies there: free local AI points you to ollama.com to install Ollama, and the Mac-only steps (macOS permissions and the Podman computer) are left out.","On Windows, Settings > Add-ons says RTK is not on Windows yet, instead of saying this copy is missing it. Apple Intelligence and dictation stay Mac-only and do not appear on Windows.","Usage reports can leave out your Personal Bot's usage, so company reports show only company work."]},{"version":"0.1.121","added":["Chibi is now your Primary Bot. It works on its own: it checks your team every 30 minutes, when Atomic starts and when your Mac wakes, and fixes what it can, like retrying a run that crashed or a routine that failed.","Chibi checks in only when it needs you: one short message in its main conversation, with links to the threads waiting on you. It never repeats itself about the same thing and stays quiet from 10 PM to 7 AM.","The check is free. Chibi only uses a model when something needs unblocking, and then on your cheapest plan, never pay-per-use unless you chose Keep going.","Settings > General > Primary Bot (Chibi): turn it on or off, choose how often it checks, set quiet hours, run a check now, and see what recent checks found and cost.","Move into Chibi: a bot you used as your go-to can move into Chibi from its menu. Its instructions, memory, skills, routines and conversations come along, Chibi keeps its own name and look, and the old bot is archived, not deleted. Importing from Grok Bot does the same for its Primary Bot.","Company-managed Macs: your organization can decide how Atomic updates through its device management (Addigy). When it manages updates, Atomic stops updating itself and Settings > Updates says \\"Updates are managed by your organization\\". It can also set your update channel, shown as Managed by your organization.","Settings > General > Updates shows your version and update channel, and has a new Early updates (internal testers) switch. It is off for everyone; testers who turn it on get new versions before they reach the rest of Chibitek.","A new setup wizard walks you through everything Atomic needs, one step at a time, with no Terminal: your name, which AI plans you have, connecting each one, free local AI, API keys, Google and Microsoft accounts, a computer for your bots, permissions, your iPhone, and meeting Chibi.","Atomic now installs Claude Code, Codex and OpenCode for you with one click, even on a Mac that has never had Node.js.","Grok, Cursor, Kimi and Qwen install from inside Atomic, and Grok, Cursor and Kimi sign in from inside Atomic: the sign-in page opens in your browser, with the code to type when there is one.","Free local AI: Atomic can install Ollama for you and recommends one model sized to your Mac, Gemma 4 on Apple silicon Macs with 16 GB or more, with the size shown before it downloads.","A computer for your bots: Atomic can download Podman's official installer, open it for you, and start the separate computer, with no command line.","Settings > Setup lists every setup step as done, skipped or not done, with Continue to pick up where you left off.","Chibi says hello in your first chat with three easy things to try."],"improved":["If you already use Atomic, a small Finish setting up Atomic card offers the new setup instead of a full-screen welcome.","The Ollama Cloud and Mistral setup cards now say they only need an API key and take you to AI providers, instead of showing a command."],"fixed":["Fixed: on a brand-new install, What's new no longer opens on top of the welcome.","Fixed: while Atomic starts, the window now says Starting Atomic instead of a developer command.","Fixed: the guided tour no longer waits invisibly when no AI plan is set up; it offers to set one up."]},{"version":"0.1.120","fixed":["Fixed: phone pairing over Tailscale now recovers automatically if Tailscale wasn't fully signed in when the app started, and refreshes when the Mac wakes from sleep."]},{"version":"0.1.118","added":["Settings > AI providers > Local models now lists the models Ollama has on this computer, with their size and which bots use them, and can give a model to a bot.","Get models suggests local models that can use tools, says which fit your computer's memory, and downloads any model with a progress bar you can cancel. Remove deletes one you no longer need.","New add-on: RTK shortens long command output (tests, builds, git, logs) before a bot reads it, so bots use fewer tokens. It is on for Engineering bots, and approvals still show the exact command the bot wrote.","New add-on: GitHub threat review. Before Atomic installs a skill, an MCP server or an add-on, it scans the code for backdoors, hidden instructions and supply-chain tricks, and stops the install when it finds clear signs of harm. You see what it found and can still go ahead. The scan runs inside Atomic and uses no AI tokens.","Bots have a new threat_scan tool that checks a folder, a GitHub repository or an npm package before they install or run it. A bot reads the full threat review only when a scan finds something worth a closer look, or when you ask for a deep review.","When a Claude bot clones a repository, Atomic scans it right away and tells the bot only if something turned up.","New add-on: Reticle lets bots check that a web or Electron app they changed really works. It is off until you turn it on, and Atomic installs it on your Mac the first time.","New add-on: a reviewed library of UI design skills bots can load for design and front-end work, following Apple's design guidelines and Liquid Glass first. Off until you turn it on.","Settings > Add-ons has a new option, Scan skills before install (SkillSpector). It is off, and scanning itself arrives in a later update.","When every subscription has hit its limit, Atomic keeps your bots working on your pay-per-use API keys and tells you once, with when a subscription is back. You can keep going, use your local models for free, or pause pay-per-use until then.","Settings > Engines and tiers now shows when each engine hit its limit, the reset time the provider gave in your own time zone, and when it came back."],"improved":["Greyed-out switches in a bot's Access settings now say why, with a link to fix it.","\\"Connected apps\\" is now \\"More apps\\"; Gmail, Calendar, Drive and Outlook come from Google and Microsoft accounts.","Chibi is always your Chief of Staff; its name and look are fixed so Atomic stays recognizable.","The MCP Marketplace is back in plain sight: Tools > Marketplace in the sidebar always opens it, and Settings > Add-ons links to it.","Ollama Cloud and OpenCode Go keys now appear once, as the Main key inside each provider's card, instead of a second row further down.","Atomic now uses your flat-price plans before anything billed per use: Claude, ChatGPT, Grok and Cursor first, then Ollama Cloud, then other plans like the Qwen Coding Plan, Kimi and OpenCode Go.","Switching a bot to another engine when one runs out now happens quietly, with no message in the chat.","An engine that runs out is not tried again until the time its provider said it resets.","Local models from Ollama can be given to any bot in Settings. When a bot cannot use one, it is shown greyed out with the reason."],"fixed":["Fixed: a bot could fail to save to its memory with an \\"unauthorized\\" error after its settings changed mid-conversation.","The Plugins window no longer reopens on MCP servers after you visited that tab, which hid the Marketplace.","Fixed: when a provider was out of credits, a bot could post the provider's billing error as its reply. The turn now finishes on the next engine instead.","Fixed: a model billed per use (like DeepInfra through Atomic Engine) could be picked ahead of a flat-price plan that offers the same model.","Fixed: Atomic Engine showed None for local models even when Ollama had models installed."]},{"version":"0.1.117","added":["In the iPhone app, a new animated Chibi logo plays while the app connects to your computer."]},{"version":"0.1.116","added":["Add-ons like Ponytail now work with every AI engine, not just Claude, and you can switch each one on or off (Settings > Add-ons), for all bots or per bot.","Settings > Add-ons tells you when a newer version of an add-on is out. Atomic includes it in a later update after it has been reviewed; nothing installs by itself."],"improved":["Every AI provider in Settings now links to where you get it: Get a subscription for Claude, ChatGPT and Grok, and Get an API key or See plans for the others.","Settings > AI providers now separates Subscriptions (flat monthly plans, including plans that use a key like the Qwen Coding Plan) from API keys (billed per use).","Each bot now shows a short summary of what it can do.","Opening a bot takes you straight to its latest conversation; older ones are under History."]},{"version":"0.1.115","added":["Add your Qwen Coding Plan as an AI provider account (Settings > Engines > AI provider accounts). Bots can then run on its flat-price models, like Qwen 3.7 Plus, GLM-5 and Kimi K2.5."]},{"version":"0.1.114","added":["Local models can use less memory in long chats. Turn on \\"Use less memory for long chats\\" in Settings > AI providers, then quit Ollama and open it again. Long conversations fit on your Mac with answers that stay practically the same."]},{"version":"0.1.113","added":["Connect Xcode as a code editor (Settings > Connected assistants > Code editors), so Xcode's Claude, Codex and Gemini agents can work with your Atomic team."],"fixed":["Saving a backup no longer fails on project folders your bots worked in. Reinstallable folders like node_modules are left out; reinstall them in each project after restoring."],"improved":["The Atomic iPhone app now shows this computer by its own name, so two computers are easy to tell apart."]},{"version":"0.1.112","added":["Google's Antigravity IDE is now a code editor you can connect (Settings > Connected assistants > Code editors), separate from the older Antigravity app."],"fixed":["Each code editor row now says which editor to restart, instead of always naming Claude Code."]},{"version":"0.1.111","added":["Stop a bot from your code editor: the Atomic extension for VS Code and Cursor shows a Stop button while a bot works, and stops only that chat.","Send images from your code editor and see the images in its chats: paste, drop or pick up to 4 per message."],"improved":["Every bot's past conversations are one click away: a History button in the chat header, and an empty chat now lists recent conversations, including work Chibi handed over.","Chats started from a code editor are recognized in your history, so the editor lists them as its own."]},{"version":"0.1.110","added":["Connect as many Google and Microsoft accounts as you like (Settings > Accounts). Bots can read and draft email, check and add calendar events, and find files in Gmail, Google Calendar, Drive, Outlook and OneDrive, only for the accounts you tick in each bot's Access settings.","Add more than one account per AI provider (Settings > Engines): two Perplexity keys, a second ChatGPT or Grok sign-in, and so on. Each account is its own engine, so a bot can use a specific one, and work moves to your other account when one runs out.","Perplexity is now an AI provider."],"fixed":["An extra Claude subscription account no longer switches to pay-as-you-go billing when an Anthropic API key is also saved."]},{"version":"0.1.109","fixed":["Apple Intelligence now actually ships in the Mac app. Earlier updates left out the small helper it needs, so it showed as unavailable."]},{"version":"0.1.108","added":["Import your Hermes agents: each Hermes profile becomes an Atomic bot with its instructions, memory, skills, scheduled jobs and MCP servers (Team library > Import)."]},{"version":"0.1.107","added":["Apple Intelligence runs on this Mac as a free, private Añejo engine, and writes thread titles without using your subscriptions.","Each bot now opens to one ongoing conversation, like Grok Bot. When the model starts a fresh session, a quiet divider marks it and earlier messages stay above. Separate threads are still there in the ⋯ menu."]},{"version":"0.1.106","improved":["Bots named after an engine run on it by default: Codex on ChatGPT models, Grok on Grok, Claude on Claude, and so on. Existing Codex and Grok bots were moved once; change them any time."]},{"version":"0.1.105","added":["Connect Atomic to VS Code, Cursor, Windsurf, Antigravity and OpenCode in one click (Settings > Connected assistants > Code editors). Each editor's AI chat can then ask Chibi or any bot for work, and each editor gets its own access you can disconnect."],"fixed":["Notifications on your iPhone now show the bot's avatar, or Chibi's mascot when the bot has no avatar, instead of the generic system icon."]},{"version":"0.1.104","added":["This \\"What's new\\" window, shown the first time you open Atomic after an update.","When an update is available, closing its pop-up leaves an \\"Update available\\" button in the bottom-left corner until you install it."],"fixed":["The iPhone pairing screen shows your computer's name with spaces instead of plus signs."]},{"version":"0.1.103","added":["Chibi's assignments now count as real work orders for the rest of the team.","For high-stakes steps (deploys, merges to main, new cloud resources, secrets), Chibi can attach your own message, and Atomic shows it to the specialist stamped as verified."],"improved":["Every bot can report back and escalate to the Chief of Staff that manages its team.","After an update, the Local VM's desktop image rebuilds itself instead of asking you to prepare it again."],"fixed":["Specialists no longer refuse work you already approved in your conversation with Chibi."]},{"version":"0.1.102","added":["A free Marketplace in Plugins: 16 featured services with their own icons, and search across the public MCP Registry. No paid key needed.","Saved backups in Settings > Backups: everything in ~/atomic_backup with Show in Finder, and Import for full backups.","Settings > AI providers brings subscriptions, API keys, and classes and failover together in one place."],"improved":["Settings > Computers now holds cloud computers and your own servers next to the Local VM.","Remote access sends you to Tailscale pairing when this computer has no public web address."],"fixed":["Downloading an update no longer crashes the app on networks that block the newer web protocol (QUIC)."]},{"version":"0.1.101","improved":["The Local VM keeps Firefox signed in with its history when its desktop is replaced.","Browser logins and history on each Local VM are backed up every hour to ~/atomic_backup, keeping the two latest copies."],"fixed":["The macOS menu says Settings…, matching the window it opens."]},{"version":"0.1.100","improved":["Every model your engines offer now gets a class (Mezcal, Plata, Reposado or Añejo), so the chat header never shows a model name."]},{"version":"0.1.99","added":["A new sidebar with one row per bot, and its threads inside the chat."],"improved":["The model chip shows only the class and effort, such as \\"Mezcal (Med)\\". Click it to see the model."]}]`),eRe=XEe;function U2(e,t){const a=s=>s.split(/[.+-]/).map(r=>Number.parseInt(r,10)||0),o=a(e),i=a(t);for(let s=0;s<Math.max(o.length,i.length);s++){const r=(o[s]??0)-(i[s]??0);if(r!==0)return r}return 0}function ZB(e,t,a=eRe){return a.filter(o=>U2(o.version,e)>0&&U2(o.version,t)<=0).sort((o,i)=>U2(i.version,o.version))}const W$="atomic.whatsNew.lastSeen";function tRe(){try{return localStorage.getItem(W$)}catch{return null}}function QB(e){try{localStorage.setItem(W$,e)}catch{}}function nRe(e,t,a={}){return t===null?a.firstRun?[]:ZB("0",e).filter(o=>o.version===e):ZB(t,e)}function aRe(e){const t=e?.onboarding;return!t?.completedAt&&!t?.setup?.deferredAt&&!Object.keys(t?.setup?.steps??{}).length}function V2({icon:e,title:t,items:a}){return a?.length?n.jsxs("div",{className:"mt-3",children:[n.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-semibold uppercase tracking-wide text-ink-secondary",children:[e,t]}),n.jsx("ul",{className:"mt-1.5 flex list-disc flex-col gap-1 pl-5 text-[13px] leading-relaxed text-ink",children:a.map(o=>n.jsx("li",{children:o},o))})]}):null}function oRe({initialNotes:e}){const t=zS(),[a,o]=f.useState(()=>e??[]),{state:i}=ke(),s=i.config,r=f.useRef(!1);f.useEffect(()=>{if(e||!window.ogb||!s||r.current)return;r.current=!0;const h=nRe(t,tRe(),{firstRun:aRe(s)});h.length?o(h):QB(t)},[t,e,s]);const c=f.useRef(null),d=a.length>0;if(f.useLayoutEffect(()=>{const h=c.current;if(!(!d||!h))return h.showModal(),()=>h.close()},[d]),!d)return null;const p=()=>{QB(t),o([])};return n.jsx("dialog",{ref:c,"aria-labelledby":"whats-new-title",onCancel:h=>{h.preventDefault(),p()},onKeyDown:h=>h.stopPropagation(),onMouseDown:h=>h.target===h.currentTarget&&p(),className:"animate-panel-in m-auto w-[min(520px,calc(100%-32px))] max-h-[80vh] overflow-hidden rounded-2xl border border-hairline/50 bg-panel p-0 text-ink shadow-2xl shadow-black/50 backdrop:bg-black/40",children:n.jsxs("div",{className:"flex max-h-[80vh] flex-col",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-hairline/30 px-5 py-4",children:[n.jsxs("div",{children:[n.jsx("h2",{id:"whats-new-title",className:"text-[16px] font-semibold text-ink",children:l("whatsNew.title",{app:Wa().name})}),n.jsx("p",{className:"mt-0.5 text-[12.5px] text-ink-secondary",children:l("whatsNew.subtitle",{version:t})})]}),n.jsx("button",{type:"button",onClick:p,className:"rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink","aria-label":l("whatsNew.close"),children:n.jsx(jt,{size:15})})]}),n.jsx("div",{className:"min-h-0 overflow-y-auto px-5 pb-4",children:a.map(h=>n.jsxs("section",{className:"border-b border-hairline/20 py-3 last:border-b-0",children:[n.jsx("h3",{className:"text-[13.5px] font-semibold text-ink",children:l("whatsNew.version",{version:h.version})}),n.jsx(V2,{icon:n.jsx(So,{size:13}),title:l("whatsNew.added"),items:h.added}),n.jsx(V2,{icon:n.jsx(G4,{size:13}),title:l("whatsNew.improved"),items:h.improved}),n.jsx(V2,{icon:n.jsx(f0,{size:13}),title:l("whatsNew.fixed"),items:h.fixed})]},h.version))}),n.jsx("div",{className:"flex justify-end border-t border-hairline/30 px-5 py-3",children:n.jsx("button",{type:"button",onClick:p,className:"rounded-lg bg-accent px-4 py-1.5 text-[13px] font-medium text-white",children:l("whatsNew.gotIt")})})]})})}function iRe(){const[e,t]=f.useState(!1),[a,o]=f.useState("idea"),[i,s]=f.useState(""),[r,c]=f.useState(""),[d,p]=f.useState(null),[h,g]=f.useState(!0),[b,x]=f.useState(!0),[v,k]=f.useState("editing"),[w,N]=f.useState(null),C=f.useRef(!1),{state:j}=ke(),M=j.bots.find(z=>z.id===j.selectedId)?.personal===!0,E=f.useRef(M);E.current=M;const A=f.useRef(null),R=f.useCallback(async(z,P="")=>{if(C.current)return;C.current=!0;let L=null;try{L=await window.ogb?.captureFeedbackScreenshot?.()??null}catch{L=null}o(z),P&&s(P),p(L),g(!!L&&!E.current),x(z==="bug"),k("editing"),N(null),t(!0),C.current=!1},[]);f.useEffect(()=>{const z=L=>{const G=L.detail;R(sI(G),kve(G))};window.addEventListener(m5,z);const P=window.ogb?.onOpenFeedback?.(L=>{R(sI(L))});return()=>{window.removeEventListener(m5,z),P?.()}},[R]),f.useEffect(()=>{e&&v==="editing"&&A.current?.focus()},[e,v]);const B=f.useCallback(()=>{v!=="sending"&&(t(!1),v==="sent"&&(s(""),c("")))},[v]);if(f.useEffect(()=>{if(!e)return;const z=P=>{P.key==="Escape"&&B()};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[e,B]),!e)return null;const O=async()=>{if(!(v!=="editing"||i.trim().length<3||!window.ogb?.submitFeedback)){k("sending"),N(null);try{await window.ogb.submitFeedback({type:a,description:i,email:r.trim()||void 0,includeScreenshot:h&&!!d,screenshotDataUrl:h?d:null,includeDiagnostics:b}),k("sent")}catch(z){N(l("feedback.error",{message:z instanceof Error?z.message:String(z)})),k("editing")}}},T=[{id:"bug",label:l("feedback.kind.bug"),icon:n.jsx(f0,{size:14})},{id:"idea",label:l("feedback.kind.idea"),icon:n.jsx(O4,{size:14})}];return n.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 p-4",onClick:B,children:n.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"feedback-title",onClick:z=>z.stopPropagation(),className:"animate-panel-in flex max-h-[85vh] w-full max-w-[520px] flex-col rounded-2xl border border-hairline/50 bg-panel shadow-2xl shadow-black/50",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-hairline/30 px-5 py-4",children:[n.jsxs("div",{children:[n.jsx("h2",{id:"feedback-title",className:"text-[16px] font-semibold text-ink",children:l("feedback.title")}),n.jsx("p",{className:"mt-0.5 text-[12.5px] text-ink-secondary",children:l("feedback.subtitle")})]}),n.jsx("button",{type:"button",onClick:B,className:"rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink","aria-label":l("feedback.close"),children:n.jsx(jt,{size:15})})]}),v==="sent"?n.jsxs("div",{className:"px-5 py-6",role:"status",children:[n.jsx("p",{className:"text-[14px] font-semibold text-ink",children:l("feedback.sent.title")}),n.jsx("p",{className:"mt-1 text-[13px] text-ink-secondary",children:l("feedback.sent.body")})]}):n.jsxs("div",{className:"flex min-h-0 flex-col gap-3 overflow-y-auto px-5 py-4",children:[n.jsx("div",{role:"radiogroup","aria-label":l("feedback.kind.label"),className:"flex gap-2",children:T.map(z=>n.jsxs("button",{type:"button",role:"radio","aria-checked":a===z.id,onClick:()=>{o(z.id),z.id==="bug"&&x(!0)},className:V("flex items-center gap-1.5 rounded-lg border px-3 py-1.5 text-[13px]",a===z.id?"border-accent bg-accent/15 text-ink":"border-hairline/50 text-ink-secondary hover:bg-raised/50"),children:[z.icon,z.label]},z.id))}),n.jsxs("label",{className:"flex flex-col gap-1 text-[13px] text-ink",children:[l(a==="bug"?"feedback.description.bug":"feedback.description.idea"),n.jsx("textarea",{ref:A,value:i,onChange:z=>s(z.target.value),rows:6,maxLength:8e3,placeholder:l(a==="bug"?"feedback.placeholder.bug":"feedback.placeholder.idea"),className:"min-h-[120px] w-full resize-y rounded-lg border border-hairline/40 bg-inset px-3 py-2 text-[13px] text-ink focus:border-hairline focus:outline-none"})]}),n.jsxs("label",{className:"flex flex-col gap-1 text-[13px] text-ink",children:[l("feedback.email.label"),n.jsx("input",{type:"email",value:r,onChange:z=>c(z.target.value),autoComplete:"email",className:"w-full rounded-lg border border-hairline/40 bg-inset px-3 py-1.5 text-[13px] text-ink focus:border-hairline focus:outline-none"}),n.jsx("span",{className:"text-[12px] text-ink-secondary",children:l("feedback.email.hint")})]}),n.jsxs("label",{className:V("flex items-start gap-2 text-[13px]",d?"text-ink":"text-ink-secondary"),children:[n.jsx("input",{type:"checkbox",className:"mt-0.5",checked:h&&!!d,disabled:!d,onChange:z=>g(z.target.checked)}),n.jsxs("span",{className:"flex flex-col gap-1.5",children:[l(d?"feedback.screenshot.label":"feedback.screenshot.unavailable"),d&&h&&n.jsx("img",{src:d,alt:l("feedback.screenshot.alt"),className:"max-h-28 w-auto self-start rounded-md border border-hairline/50"})]})]}),n.jsxs("label",{className:"flex items-start gap-2 text-[13px] text-ink",children:[n.jsx("input",{type:"checkbox",className:"mt-0.5",checked:b,onChange:z=>x(z.target.checked)}),n.jsxs("span",{className:"flex flex-col",children:[l("feedback.diagnostics.label"),n.jsx("span",{className:"text-[12px] text-ink-secondary",children:l("feedback.diagnostics.hint")})]})]}),w&&n.jsx("p",{role:"alert",className:"text-[12.5px] text-danger",children:w})]}),n.jsx("div",{className:"flex justify-end gap-2 border-t border-hairline/30 px-5 py-3",children:v==="sent"?n.jsx("button",{type:"button",onClick:B,className:"rounded-lg bg-accent px-4 py-1.5 text-[13px] font-medium text-white",children:l("feedback.close")}):n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:B,disabled:v==="sending",className:"ui-button",children:l("feedback.cancel")}),n.jsx("button",{type:"button",onClick:()=>{O()},disabled:v==="sending"||i.trim().length<3,className:"rounded-lg bg-accent px-4 py-1.5 text-[13px] font-medium text-white disabled:opacity-50",children:l(v==="sending"?"feedback.sending":"feedback.send")})]})})]})})}function sRe({episode:e,busy:t,error:a,onKeepGoing:o,onChoose:i}){const s=f.useRef(null);f.useEffect(()=>{const c=document.activeElement instanceof HTMLElement?document.activeElement:null;return s.current?.focus(),()=>c?.focus()},[]);const r="flex items-center justify-center gap-1.5 rounded-lg bg-control px-3 py-1.5 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50";return n.jsxs("div",{role:"dialog","aria-modal":"false","aria-labelledby":"pay-per-use-title","aria-describedby":"pay-per-use-body","data-pay-per-use-notice":!0,onKeyDown:c=>{c.key==="Escape"&&!t&&(c.stopPropagation(),o())},className:"animate-panel-in fixed bottom-4 right-4 z-50 w-[340px] max-w-[calc(100vw-32px)] rounded-2xl border border-hairline/40 bg-panel/85 p-4 shadow-2xl shadow-black/40 backdrop-blur-xl backdrop-saturate-150",children:[n.jsxs("div",{className:"flex items-start gap-2.5",children:[n.jsx("span",{className:"mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-full bg-accent/15 text-accent","aria-hidden":!0,children:n.jsx(Wh,{size:14})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("h2",{id:"pay-per-use-title",className:"text-[13.5px] font-semibold text-ink",children:ox(e).title}),n.jsx("p",{id:"pay-per-use-body",className:"mt-1 text-[12.5px] leading-relaxed text-ink-secondary",children:fX(e)})]})]}),a&&n.jsx("p",{role:"alert",className:"mt-2 text-[12.5px] text-danger",children:l("payPerUse.failed",{error:a})}),n.jsxs("div",{className:"mt-3 flex flex-col gap-1.5",children:[n.jsx("button",{ref:s,type:"button",disabled:t!==null,onClick:o,className:"rounded-lg bg-accent px-3 py-1.5 text-[13px] font-medium text-white disabled:opacity-50",children:ox(e).keepGoing}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsxs("button",{type:"button",disabled:t!==null,onClick:()=>i("local"),className:`${r} flex-1`,children:[t==="local"&&n.jsx(je,{size:13,className:"animate-spin","aria-hidden":!0}),l("payPerUse.useLocal")]}),n.jsxs("button",{type:"button",disabled:t!==null,onClick:()=>i("pause"),className:`${r} flex-1`,children:[t==="pause"&&n.jsx(je,{size:13,className:"animate-spin","aria-hidden":!0}),bX(e)]})]})]})]})}function rRe(){const{state:e,dispatch:t}=ke(),a=e.payPerUseNotice,[o,i]=f.useState(null),[s,r]=f.useState(null);if(f.useEffect(()=>{i(null),r(null)},[a?.id]),!a)return null;const c=async d=>{i(d),r(null);try{await Z(`${ox(a).base}/${d==="local"?"local":"pause"}`,{method:"POST"}),t({type:"dismissPayPerUse"})}catch(p){r(p instanceof Error?p.message:String(p)),i(null)}};return n.jsx(sRe,{episode:a,busy:o,error:s,onKeepGoing:()=>{t({type:"dismissPayPerUse"}),Z(`${ox(a).base}/keep-going`,{method:"POST"}).catch(()=>{})},onChoose:d=>{c(d)}},a.id)}function lRe({onGotIt:e,onSettings:t}){const a=f.useRef(null);return f.useEffect(()=>{const o=document.activeElement instanceof HTMLElement?document.activeElement:null;return a.current?.focus(),()=>o?.focus()},[]),n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/30 p-4","data-primary-bot-intro":!0,children:n.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"primary-bot-intro-title","aria-describedby":"primary-bot-intro-body",onKeyDown:o=>{o.key==="Escape"&&(o.stopPropagation(),e())},className:"animate-panel-in w-full max-w-[380px] rounded-3xl border border-white/15 bg-panel/70 p-6 text-center shadow-2xl shadow-black/40 backdrop-blur-2xl backdrop-saturate-150",children:[n.jsxs("div",{className:"relative mx-auto size-[72px]",children:[n.jsx("img",{src:Y4,alt:J4,className:"size-[72px] rounded-full object-cover ring-1 ring-white/20"}),n.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 flex size-6 items-center justify-center rounded-full bg-accent text-white shadow-md ring-2 ring-panel","aria-hidden":!0,children:n.jsx(XZ,{size:13,fill:"currentColor"})})]}),n.jsx("h2",{id:"primary-bot-intro-title",className:"mt-4 text-[17px] font-semibold text-ink",children:l("primaryBot.intro.title")}),n.jsx("p",{id:"primary-bot-intro-body",className:"mt-2 text-[13.5px] leading-relaxed text-ink-secondary",children:l("primaryBot.intro.body")}),n.jsxs("div",{className:"mt-5 flex gap-2",children:[n.jsx("button",{type:"button",onClick:t,className:"flex-1 rounded-xl bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover",children:l("primaryBot.intro.settings")}),n.jsx("button",{ref:a,type:"button",onClick:e,className:"flex-1 rounded-xl bg-accent px-3 py-2 text-[13px] font-medium text-white",children:l("primaryBot.intro.gotIt")})]})]})})}function cRe(){const{state:e,dispatch:t}=ke(),a=ec()===!0,[o,i]=f.useState(cBe),[s,r]=f.useState(null);f.useEffect(()=>{if(!a||o||!window.ogb)return;let g=!0;return Z("/api/primary-bot").then(b=>{g&&r(b.introSeenAt)}).catch(()=>{}),()=>{g=!1}},[a,o]);const c=window.ogb?.remoteClient?.active===!0,d=!!window.ogb&&!c,p=!!e.config&&!e.welcomeOpen&&!e.tourOpen&&!rS(e.config,{remoteClient:c,legacyDone:sS()});if(!d||s===null||!uBe({seenLocally:o,serverSeenAt:s,canManage:a,welcomeDone:p}))return null;const h=()=>{dBe(),i(!0),Z("/api/primary-bot/intro",{method:"POST"}).catch(()=>{})};return n.jsx(lRe,{onGotIt:h,onSettings:()=>{h(),t({type:"toggleAppSettings",open:!0,section:"general"})}})}function dRe(e){const t=e.split(/\n{2,}/),a=t[t.length-1]??"",o=/\[[^\]]+\]\**\s+\[[^\]]+\]\s*$/.test(a);return{paragraphs:o?t.slice(0,-1):t,choices:o?a:null}}function uRe(e){return e.split(/(\*\*[^*]+\*\*)/).filter(Boolean).map(t=>t.startsWith("**")&&t.endsWith("**")?{text:t.slice(2,-2),bold:!0}:{text:t,bold:!1})}const pRe=e=>e!==null&&e.status!=="hidden",mRe="rounded-xl bg-accent px-3 py-2 text-[13px] font-medium text-white disabled:opacity-50",XB="rounded-xl bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50";function hRe({state:e,busy:t,stiki:a,onYes:o,onNotNow:i,onDismissSignIn:s,onSignIn:r,onCancelSignIn:c}){if(e.status==="hidden")return null;if(e.status==="signIn")return n.jsxs("section",{"aria-label":l("nexusImport.label"),"data-nexus-import-offer":"sign-in",className:"fixed bottom-4 right-4 z-40 w-[min(420px,calc(100vw-2rem))] space-y-2 rounded-2xl border border-white/15 bg-panel/80 p-4 shadow-2xl backdrop-blur-2xl",children:[n.jsx("p",{className:"text-[13.5px] leading-relaxed text-ink",children:l(e.reason==="expired"?"nexusImport.signInAgain":"nexusImport.signIn")}),a?n.jsx(z$,{state:a,busy:t,onSignIn:r,onCancel:c,onSignOut:()=>{}}):n.jsx("p",{className:"text-[12.5px] text-ink-secondary",children:l("nexusImport.signInOnComputer")}),n.jsx("button",{type:"button",onClick:s,disabled:t,className:XB,children:l("nexusImport.notNow")})]});const{paragraphs:d,choices:p}=dRe(e.consentCopy),h=/\[([^\]]+)\]/.exec(p??"")?.[1]??l("nexusImport.yes"),g=/\]\s+\[([^\]]+)\]/.exec(p??"")?.[1]??l("nexusImport.notNow");return n.jsxs("section",{"aria-label":l("nexusImport.label"),"data-nexus-import-offer":"offer",className:"fixed bottom-4 right-4 z-40 w-[min(420px,calc(100vw-2rem))] rounded-2xl border border-white/15 bg-panel/80 p-4 shadow-2xl backdrop-blur-2xl",children:[d.map((b,x)=>n.jsx("p",{className:"mb-2 text-[13.5px] leading-relaxed text-ink",children:uRe(b).map((v,k)=>v.bold?n.jsx("strong",{children:v.text},k):n.jsx("span",{children:v.text},k))},x)),n.jsxs("div",{className:"mt-3 flex gap-2",children:[n.jsx("button",{type:"button",onClick:o,disabled:t,className:mRe,children:h}),n.jsx("button",{type:"button",onClick:i,disabled:t,className:XB,children:g})]})]})}function gRe(){const{state:e}=ke(),t=window.ogb?.remoteClient?.active?void 0:window.ogb?.stiki,[a,o]=f.useState(null),[i,s]=f.useState(null),[r,c]=f.useState(!1),d=f.useRef(!1),p=f.useRef(null),h=f.useCallback(async()=>{if(!d.current){d.current=!0;try{o(await Z("/api/nexus-memory/import-offer"))}catch{o(null)}finally{d.current=!1}}},[]);if(f.useEffect(()=>{h()},[h]),f.useEffect(()=>{if(!t)return;let b=!0;const x=k=>{if(!b||!k)return;s(k);const w=k.status==="signedIn";p.current===!1&&w&&h(),p.current=w},v=t.onState(x);return t.state().then(x).catch(()=>{}),()=>{b=!1,v()}},[t,h]),!pRe(a))return null;const g=async b=>{c(!0);try{if(b==="import"&&a.status==="offer"){const x=a.botId??e.bots[0]?.id;await Z("/api/nexus-memory/import-offer",{method:"POST",body:JSON.stringify({answer:"import"})}),x&&await Z(`/api/bots/${x}/messages`,{method:"POST",body:JSON.stringify({text:a.message})})}else await Z("/api/nexus-memory/import-offer",{method:"POST",body:JSON.stringify({answer:"decline"})})}catch{}finally{o(null),c(!1)}};return n.jsx(hRe,{state:a,busy:r,stiki:t?i:null,onYes:()=>{g("import")},onNotNow:()=>{g("decline")},onDismissSignIn:()=>o(null),onSignIn:b=>{c(!0),t?.signIn(b).then(s).catch(()=>{}).finally(()=>c(!1))},onCancelSignIn:()=>{t?.cancel().then(s).catch(()=>{})}})}function fRe({visible:e}){const[t,a]=f.useState(!1);if(f.useEffect(()=>{const r=window.ogb?.windowControls;if(!r)return;let c=!0;r.state().then(({maximized:p})=>{c&&a(p)});const d=r.onMaximizedChanged(p=>a(p));return()=>{c=!1,d()}},[]),!e)return null;const o=window.ogb?.windowControls,i={WebkitAppRegion:"no-drag"},s=V("flex h-[26px] w-11 items-center justify-center text-ink-secondary","hover:bg-raised hover:text-ink active:bg-raised/60");return n.jsxs("div",{"aria-hidden":!0,style:i,className:"absolute right-0 top-0 z-40 flex items-stretch",children:[n.jsx("button",{type:"button","aria-label":l("window.minimize"),title:l("window.minimize"),className:s,onClick:()=>{o?.minimize()},children:n.jsx(TE,{size:14})}),n.jsx("button",{type:"button","aria-label":l(t?"window.restore":"window.maximize"),title:l(t?"window.restore":"window.maximize"),className:s,onClick:()=>{o?.toggleMaximize()},children:t?n.jsx(Xa,{size:11}):n.jsx(Wl,{size:11})}),n.jsx("button",{type:"button","aria-label":l("window.close"),title:l("window.close"),className:V(s,"hover:bg-danger/25 hover:text-danger"),onClick:()=>{o?.close()},children:n.jsx(jt,{size:15})})]})}function bRe(){const{state:e,refreshInstances:t}=ke(),a=window.ogb?.remoteClient?.active===!0,[o,i]=f.useState(!1),s=async()=>{i(!0);try{await t()}finally{i(!1)}};if(a)return n.jsx("main",{className:"flex h-full min-w-0 flex-1 items-center justify-center bg-app px-6",children:n.jsxs("div",{className:"max-w-[520px] rounded-2xl border border-hairline/40 bg-card p-6 text-center",children:[n.jsx("h1",{className:"text-[20px] font-semibold text-ink",children:"The host needs an agent engine"}),n.jsx("p",{className:"mt-2 text-[13.5px] leading-relaxed text-ink-secondary",children:"Configure Claude, ACP, or another supported engine in Atomic on the host computer, then return here."}),n.jsx("button",{onClick:()=>{s()},disabled:o,className:"mt-5 rounded-lg bg-raised px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-60",children:o?"Checking…":"Check again"})]})});const r=e.instances.filter(c=>c.install).sort((c,d)=>{const p=tp(c.install)?0:1,h=tp(d.install)?0:1;return p-h});return n.jsx("main",{className:"flex h-full min-w-0 flex-1 flex-col overflow-y-auto bg-app",children:n.jsxs("div",{className:"mx-auto w-full max-w-[560px] px-6 py-12",children:[n.jsx("h1",{className:"text-[20px] font-semibold text-ink",children:l("noEngines.title")}),n.jsx("p",{className:"mt-1.5 text-[13.5px] leading-relaxed text-ink-secondary",children:l("noEngines.intro",{app:Wa().name})}),n.jsx("div",{className:"mt-6 flex flex-col gap-2.5",children:(()=>{const{subscription:c,custom:d}=Vz(r),p=h=>n.jsxs("div",{className:"rounded-xl border border-hairline/40 bg-card p-3.5",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[14px] font-medium text-ink",children:[n.jsx(Ll,{instance:h,size:16}),h.displayName]}),n.jsx(Fr,{instance:h,intent:h.access==="custom"?"inject":"cloud",className:"mt-0.5"})]},h.instanceId);return n.jsxs(n.Fragment,{children:[c.length>0&&n.jsx(rp,{className:"px-1",children:l("engines.cloud")}),c.map(p),d.length>0&&n.jsx(rp,{className:"px-1 pt-1",children:l("engines.local")}),d.map(p)]})})()}),n.jsxs("button",{onClick:s,disabled:o,className:"mt-6 flex items-center gap-2 rounded-lg bg-raised px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-60",children:[o?n.jsx(je,{size:14,className:"animate-spin"}):n.jsx(vn,{size:14}),l(o?"common.checking":"common.checkAgain")]})]})})}function eE(e,t){const a=t.trim().toLowerCase();if(!a)return[...e];const o=[],i=[];for(const s of e){const r=s.name.toLowerCase();r.startsWith(a)?o.push(s):r.includes(a)&&i.push(s)}return[...o,...i]}const yRe=["watch","video","youtube"];function xRe({onOpenChange:e}){const{state:t,dispatch:a}=ke(),o=dv(),[i,s]=f.useState(!1),[r,c]=f.useState(""),[d,p]=f.useState([]),[h,g]=f.useState(0),b=f.useRef(null);f.useEffect(()=>{const T=z=>{(z.metaKey||z.ctrlKey)&&z.key.toLowerCase()==="k"&&!z.shiftKey&&!z.altKey&&(z.preventDefault(),s(P=>!P))};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[]),f.useEffect(()=>{i&&(c(""),p([]),g(0))},[i]),f.useEffect(()=>{e?.(i)},[e,i]);const x=r.trim().toLowerCase();if(f.useEffect(()=>{if(!i||!x){p([]);return}p([]);let T=!0;const z=setTimeout(()=>{Z(`/api/search?q=${encodeURIComponent(x)}&limit=12`).then(P=>T&&p(P.hits??[])).catch(()=>T&&p([]))},150);return()=>{T=!1,clearTimeout(z)}},[i,x]),f.useEffect(()=>g(0),[x]),f.useEffect(()=>{b.current?.scrollIntoView({block:"nearest"})},[h,d]),!i)return null;const v=eE(t.bots.filter(T=>!T.hidden),x),k=eE(t.groups,x),w=o?DF(r):null,N=o?w?{kind:"watch",video:w}:x.length>=3&&yRe.some(T=>T.startsWith(x)||x.startsWith(T))?{kind:"watch",video:null}:null:null,C=[...N?[N]:[],...v.map(T=>({kind:"bot",bot:T})),...k.map(T=>({kind:"room",group:T})),...x?d.map(T=>({kind:"message",hit:T})):[]],j=C.length?Math.min(h,C.length-1):0,M=async T=>{if(T.kind==="watch")T.video?await $C(a,T.video).catch(z=>a({type:"error",message:z instanceof Error?z.message:String(z)})):OF();else if(T.kind==="message"){const z=T.hit;try{await fC(z,t,a)}catch(P){a({type:"error",message:P instanceof Error?P.message:String(P)})}}else a(T.kind==="bot"?la(T.bot):{type:"select",id:T.group.id});s(!1)},E=T=>{if(T.key==="Escape")T.preventDefault(),T.stopPropagation(),s(!1);else if(T.key==="ArrowDown")T.preventDefault(),g(C.length?(j+1)%C.length:0);else if(T.key==="ArrowUp")T.preventDefault(),g(C.length?(j-1+C.length)%C.length:0);else if(T.key==="Enter"){T.preventDefault();const z=C[j];z&&M(z)}},A=N?1:0,R=A+v.length,B=A+v.length+k.length,O=(T,z,P,L,G=!1)=>n.jsx("button",{ref:z===j?b:void 0,onClick:P,onMouseMove:()=>g(z),className:V("flex w-full items-center gap-3 rounded-xl px-3 py-2 text-left",G&&"flex-col items-stretch gap-0.5",z===j?"bg-raised":"hover:bg-raised/50"),children:L},T);return n.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center bg-black/50 p-6 pt-[14vh]",onMouseDown:T=>T.target===T.currentTarget&&s(!1),onKeyDown:E,children:n.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Command palette",className:"flex max-h-[min(480px,70vh)] w-full max-w-[560px] flex-col overflow-hidden rounded-xl border border-hairline/50 bg-card shadow-2xl shadow-black/60",children:[n.jsxs("div",{className:"flex items-center gap-3 border-b border-hairline/40 px-4 py-3",children:[n.jsx(La,{size:16,className:"shrink-0 text-ink-secondary"}),n.jsx("input",{autoFocus:!0,value:r,onChange:T=>c(T.target.value),placeholder:"Search bots, channels, messages…",className:"w-full bg-transparent text-[14px] text-ink placeholder:text-ink-secondary focus:outline-none"}),n.jsx("kbd",{className:"shrink-0 rounded-md border border-hairline/40 px-1.5 py-0.5 text-[11px] text-ink-secondary",children:"esc"})]}),n.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-2",children:[C.length===0&&n.jsx("div",{className:"px-3 py-6 text-center text-[13px] text-ink-secondary",children:x?`Nothing matches “${r}”`:"Nothing to switch to yet"}),v.length>0&&n.jsx("div",{className:"px-3 pb-1 pt-1.5 text-[11px] font-medium uppercase tracking-[0.08em] text-ink-secondary",children:"Bots"}),N&&O("watch",0,()=>{M(N)},n.jsxs(n.Fragment,{children:[n.jsx(T4,{size:16,className:"shrink-0 text-ink-secondary"}),n.jsx("span",{className:"truncate text-[14px] text-ink",children:l(w?"watch.entry.paletteLink":"watch.entry.menu")})]})),v.map((T,z)=>O(`bot:${T.id}`,A+z,()=>{M({kind:"bot",bot:T})},n.jsxs(n.Fragment,{children:[n.jsx(I4,{size:16,className:"shrink-0 text-ink-secondary"}),n.jsx("span",{className:"truncate text-[14px] text-ink",children:T.name}),T.title&&n.jsx("span",{className:"min-w-0 truncate text-[12.5px] text-ink-secondary",children:T.title})]}))),k.length>0&&n.jsx("div",{className:"px-3 pb-1 pt-2 text-[11px] font-medium uppercase tracking-[0.08em] text-ink-secondary",children:"Groups"}),k.map((T,z)=>O(`room:${T.id}`,R+z,()=>{M({kind:"room",group:T})},n.jsxs(n.Fragment,{children:[n.jsx(ki,{size:16,className:"shrink-0 text-ink-secondary"}),n.jsx("span",{className:"truncate text-[14px] text-ink",children:T.name})]}))),x&&d.length>0&&n.jsx("div",{className:"px-3 pb-1 pt-2 text-[11px] font-medium uppercase tracking-[0.08em] text-ink-secondary",children:"Messages"}),x&&d.map((T,z)=>{const P=T.snippet.slice(0,T.matchStart),L=T.snippet.slice(T.matchStart,T.matchStart+T.matchLength),G=T.snippet.slice(T.matchStart+T.matchLength);return O(`msg:${T.threadId}:${T.messageId}`,B+z,()=>{M({kind:"message",hit:T})},n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"flex items-center gap-2 truncate text-[13px] font-medium text-ink",children:[n.jsx(_4,{size:13,className:"shrink-0 text-ink-secondary"}),T.name,T.task?n.jsxs("span",{className:"font-normal text-ink-secondary",children:[" · ",T.task]}):null]}),n.jsxs("span",{className:"line-clamp-2 text-[12.5px] text-ink-secondary",children:[P,n.jsx("mark",{className:"rounded-sm bg-accent/25 px-0.5 text-ink",children:L}),G]})]}),!0)})]})]})})}function vRe({item:e,isMac:t}){const a=Bv(),o=e.id==="dictation"?XV(a,t):QS(e,t);return n.jsxs("div",{className:"flex items-center justify-between gap-4 py-1.5",children:[n.jsx("span",{className:"text-[13px] text-ink",children:e.description}),n.jsx("div",{className:"flex shrink-0 items-center gap-1",children:o.map((i,s)=>n.jsx("kbd",{className:"inline-flex min-w-[22px] items-center justify-center rounded-md border border-hairline/60 bg-control px-1.5 py-0.5 font-mono text-[11.5px] font-semibold text-ink shadow-xs",children:i},s))})]})}function kRe({open:e,onClose:t}){const[a,o]=f.useState(""),i=f.useRef(null),s=f.useRef(null),r=Zi();if(f.useLayoutEffect(()=>{const d=i.current;if(!(!e||!d))return o(""),d.showModal(),s.current?.focus(),()=>d.close()},[e]),!e)return null;const c=Tme(Zz,a,r);return n.jsx("dialog",{ref:i,"aria-labelledby":"shortcuts-dialog-title",className:"m-auto w-[min(500px,calc(100%-32px))] max-h-[85vh] overflow-hidden rounded-2xl border border-hairline/50 bg-panel p-0 text-ink shadow-2xl backdrop:bg-black/60 backdrop:backdrop-blur-xs",onCancel:d=>{d.preventDefault(),t()},onKeyDown:d=>d.stopPropagation(),onMouseDown:d=>d.target===d.currentTarget&&t(),children:n.jsxs("div",{className:"flex max-h-[85vh] flex-col",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-hairline/40 px-5 py-4",children:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-accent/15 text-accent",children:n.jsx(R4,{size:18})}),n.jsxs("div",{children:[n.jsx("h2",{id:"shortcuts-dialog-title",className:"text-[16px] font-semibold text-ink",children:"Keyboard Shortcuts"}),n.jsx("p",{className:"text-[12px] text-ink-secondary",children:"Quick commands and navigation"})]})]}),n.jsx("button",{type:"button",onClick:t,"aria-label":"Close keyboard shortcuts",className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised hover:text-ink",children:n.jsx(jt,{size:18})})]}),n.jsx("div",{className:"border-b border-hairline/30 px-5 py-2.5",children:n.jsxs("div",{className:"flex items-center gap-2 rounded-xl border border-hairline/40 bg-inset px-3 py-1.5 focus-within:border-accent/60",children:[n.jsx(La,{size:14,className:"shrink-0 text-ink-secondary"}),n.jsx("input",{ref:s,value:a,onChange:d=>o(d.target.value),placeholder:"Search shortcuts…","aria-label":"Search shortcuts",className:"w-full bg-transparent text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"})]})}),n.jsx("div",{className:"flex-1 overflow-y-auto px-5 py-3 space-y-4",children:c.length===0?n.jsxs("div",{className:"py-8 text-center text-[13px] text-ink-secondary",children:["No shortcuts found for “",a,"”"]}):c.map(d=>n.jsxs("div",{className:"space-y-1",children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider text-ink-secondary/70",children:d.category}),n.jsx("div",{className:"divide-y divide-hairline/20 rounded-xl bg-card/40 px-3 py-1 border border-hairline/30",children:d.items.map(p=>n.jsx(vRe,{item:p,isMac:r},p.id))})]},d.category))}),n.jsxs("div",{className:"flex items-center justify-between border-t border-hairline/40 bg-card/30 px-5 py-2.5 text-[11.5px] text-ink-secondary",children:[n.jsxs("span",{children:["Press ",n.jsx("kbd",{className:"rounded bg-control px-1 py-0.5 font-mono text-[10.5px]",children:"?"})," when not typing to open"]}),n.jsx("button",{type:"button",onClick:t,className:"rounded-lg bg-raised px-3 py-1 font-medium text-ink hover:brightness-110",children:"Done"})]})]})})}function wRe(e,t){const a=(o,i)=>o.left<i.right&&o.right>i.left&&o.top<i.bottom&&o.bottom>i.top;return t.some(o=>o.visible&&o.rect.width>0&&o.rect.height>0&&(o.explicit||o.zIndex!==null&&o.zIndex>=10)&&e.some(i=>a(o.rect,i)))}async function SRe(e,t,a,o){t&&t!==a&&(await e.setInteractive(null),await e.release(t));const i=await e.take(a);if(!i.held)throw new Error("The Local VM control hold was not acquired");if(i.owned!==!0)return{status:"held-elsewhere",botId:a,snapshot:i};try{await e.setInteractive(o)}catch(s){throw await e.setInteractive(null).catch(()=>{}),await e.release(a).catch(()=>{}),s}return{status:"controlled",botId:a,snapshot:i}}async function H2(e,t){return t?(await e.setInteractive(null).catch(()=>{}),e.release(t)):null}function J$(e){return e.filter(t=>t.computer==="vm"&&t.hidden!==!0).map(t=>t.id)}function CRe(e,t){const a=J$(e),o=a.includes(t)?t:a[0]??null;return[o,a.find(i=>i!==o)??null]}function jRe(e,t,a){const o=[...e],i=t===0?1:0;return a&&o[i]===a&&(o[i]=o[t]),o[t]=a,o}function NRe(e,t){const a=J$(t),o=new Set(a),i=[null,null];for(const s of[0,1]){const r=e[s];r&&o.delete(r)&&(i[s]=r)}for(const s of[0,1]){if(i[s])continue;const r=[...o][0];r&&(i[s]=r,o.delete(r))}return i}const ARe=zn({mode:Yo(["shared","per-bot"]).optional(),max_instances:Ps().int().positive().optional(),container:Yo(["running","stopped","missing"]).optional(),network:Yo(["loopback","unsafe","unknown"]).optional(),security:Yo(["hardened","unsafe","unknown"]).optional(),persistence:Yo(["durable","unsafe","unknown"]).optional(),desktopReady:_i().optional(),ready:_i().optional(),viewer_url:dn().min(1).optional()});function Y$(e){const t=ARe.safeParse(e);return t.success?t.data:null}function S4(e){const t=Y$(e),a=t?.mode??"unknown",o=t?.container??"unknown",i=t?.network??"unknown",s=t?.security??"unknown",r=t?.persistence??"unknown",c=t?.max_instances??0,d=t?.desktopReady===!0,p=!!(t?.ready===!0&&o==="running"&&i==="loopback"&&s==="hardened"&&r==="durable"&&d);return{mode:a,maxInstances:c,container:o,network:i,security:s,persistence:r,desktopReady:d,ready:p}}function MRe(e){const t=Y$(e);return!t||!S4(e).ready?null:t.viewer_url??null}const C4=["local-vm-workspace:left","local-vm-workspace:right"],Z$=zn({held:_i(),helpReason:dn().nullable(),owned:_i().optional(),acquired:_i().optional(),released:_i().optional()});async function tE(e,t,a){const o=await Z(`/api/bots/${e}/computer/control`,{method:"POST",body:JSON.stringify({action:t,controlLeaseId:a})}),i=Z$.safeParse(o);if(!i.success)throw new Error("invalid-control-snapshot");return i.data}async function IRe(e){const t=Z$.safeParse(await Z(`/api/bots/${e}/computer/control`));if(!t.success)throw new Error("invalid-control-snapshot");return t.data}function nE(e,t){fetch(`/api/bots/${e}/computer/control`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"release",controlLeaseId:t}),keepalive:!0}).then(async a=>{a.ok}).catch(()=>{})}async function aE(e,t){return!0}function $2(e,t,a){e({type:"computerControl",botId:t,held:a.held,helpReason:a.helpReason})}function oE(e){const t=e.current?.getBoundingClientRect();return!t||t.width<1||t.height<1?null:{x:Math.round(t.left),y:Math.round(t.top),width:Math.round(t.width),height:Math.round(t.height)}}const PRe=['[aria-modal="true"]','[role="dialog"]','[role="menu"]',"[popover]","[data-native-view-overlay]",".fixed",".absolute"].join(",");function TRe(){const e=[...document.querySelectorAll("[data-native-view-host]")],t=e.map(o=>o.getBoundingClientRect()).filter(o=>o.width>0&&o.height>0);if(t.length===0)return!1;const a=[...document.querySelectorAll(PRe)].filter(o=>!e.some(i=>o===i||o.contains(i)||i.contains(o))).map(o=>{const i=window.getComputedStyle(o),s=o.matches('[aria-modal="true"], [role="dialog"], [role="menu"], [popover], [data-native-view-overlay]'),r=Number.parseInt(i.zIndex,10);return{rect:o.getBoundingClientRect(),explicit:s,visible:i.display!=="none"&&i.visibility!=="hidden"&&Number(i.opacity)!==0,zIndex:Number.isFinite(r)?r:null}});return wRe(t,a)}function BRe(e){const[t,a]=f.useState(!1);return f.useEffect(()=>{let o=0;const i=()=>a(TRe()),s=()=>{o||(o=requestAnimationFrame(()=>{o=0,i()}))};i();const r=new MutationObserver(s);r.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["class","style","aria-hidden","aria-modal","role","open","popover"]});const c=new ResizeObserver(s);c.observe(document.body);for(const p of document.querySelectorAll("[data-native-view-host]"))c.observe(p);const d=["toggle","animationstart","animationend","transitionstart","transitionend"];for(const p of d)document.addEventListener(p,s,!0);return window.addEventListener("resize",s),window.addEventListener("scroll",s,!0),()=>{o&&cancelAnimationFrame(o),r.disconnect(),c.disconnect();for(const p of d)document.removeEventListener(p,s,!0);window.removeEventListener("resize",s),window.removeEventListener("scroll",s,!0)}},[]),e||t}function ERe(e,t){return e?e.container==="missing"?"VM not created":e.container==="stopped"?"VM stopped":e.ready?t==="error"?"Viewer unavailable":t!=="ready"?"Connecting viewer":"Live · watch-only":"VM unavailable":"Checking VM"}function RRe({index:e,bot:t,bots:a,otherBotId:o,obscured:i,active:s,heldElsewhere:r,controlPending:c,onSelect:d,onTake:p,onRelease:h,onOpenComputer:g}){const b=C4[e],x=t?.id??null,v=t?.name??"Local VM",k=f.useRef(null),w=f.useRef(Promise.resolve()),N=f.useRef(i),[C,j]=f.useState(0),[M,E]=f.useState(null),[A,R]=f.useState({contextId:b,open:!1,status:"closed",interactive:!1}),[B,O]=f.useState(null),T=f.useCallback(async H=>{if(x)try{const $=await Z(`/api/bots/${x}/local-computer`,{signal:H});H?.aborted||E(S4($))}catch{}},[x]),z=f.useRef(T);f.useEffect(()=>{z.current=T},[T]),f.useEffect(()=>{N.current=i},[i]),f.useEffect(()=>window.ogb?.desktopWorkspace?.onState($=>{$.contextId===b&&(R($),($.status==="error"||$.status==="closed")&&z.current())}),[b]),f.useEffect(()=>{const H=window.ogb?.desktopWorkspace;let $=!0;const U=new AbortController;E(null),O(null),R({contextId:b,open:!1,status:"closed",interactive:!1});const Q=async()=>{if(H&&await H.close(b).catch(()=>{}),!(!$||!x)){if(!H){O("The two-desktop workspace requires the Atomic desktop app.");return}try{const W=await Z(`/api/bots/${x}/local-computer`,{signal:U.signal});if(!$)return;const q=S4(W);E(q);const Y=MRe(W);if(!q.ready||!Y||(await new Promise(pe=>{let ge=!1;const Ne=()=>{ge||(ge=!0,pe())},ee=setTimeout(Ne,100);requestAnimationFrame(()=>{clearTimeout(ee),Ne()})}),!$))return;const ae=oE(k);if(!ae)throw new Error("layout-unavailable");const F=await H.open({contextId:b,url:Y,title:`${v}'s Local VM`,bounds:ae});if(!$){await H.close(b).catch(()=>{});return}R(F),await H.layout([{contextId:b,bounds:ae,visible:!N.current&&F.open}])}catch(W){if(!$||U.signal.aborted)return;O(W instanceof Error&&W.message==="layout-unavailable"?"The viewer area is not laid out yet. Retry after resizing the window.":"Atomic could not connect this Local VM viewer.")}}};return w.current=w.current.catch(()=>{}).then(Q),()=>{$=!1,U.abort(),H&&(w.current=w.current.catch(()=>{}).then(()=>H.close(b).then(()=>{}).catch(()=>{})))}},[x,v,b,C]),f.useEffect(()=>{if(!x)return;const H=new AbortController,$=window.setInterval(()=>{T(H.signal)},3e4);return()=>{H.abort(),window.clearInterval($)}},[x,T]);const P=f.useCallback(()=>{const H=window.ogb?.desktopWorkspace,$=oE(k);!H||!$||!A.open||H.layout([{contextId:b,bounds:$,visible:!i}]).catch(()=>O("Atomic could not position this Local VM viewer."))},[b,A.open,i]);f.useEffect(()=>{const H=k.current;if(!H)return;const $=new ResizeObserver(P);$.observe(H),window.addEventListener("resize",P);const U=requestAnimationFrame(P);return()=>{cancelAnimationFrame(U),$.disconnect(),window.removeEventListener("resize",P)}},[P]);const L=ERe(M,A.status),G=!!(t&&M?.ready&&A.status==="ready"&&A.open);return n.jsxs("section",{className:V("flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl border bg-panel",s?"border-accent/80 shadow-[0_0_0_1px_rgb(var(--accent)/0.35)]":"border-hairline/50"),children:[n.jsxs("div",{className:"flex min-h-[68px] items-center gap-3 border-b border-hairline/40 px-3 py-2.5",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("label",{className:"sr-only",htmlFor:`local-vm-slot-${e}`,children:["Local VM for pane ",e+1]}),n.jsxs("select",{id:`local-vm-slot-${e}`,value:t?.id??"",onChange:H=>d(H.target.value||null),disabled:c,className:"w-full truncate rounded-lg border border-hairline/50 bg-card px-2.5 py-1.5 text-[13px] font-medium text-ink outline-none focus:border-accent/70",children:[n.jsx("option",{value:"",children:"Choose a Local VM bot"}),a.map(H=>n.jsx("option",{value:H.id,disabled:H.id===o,children:H.name},H.id))]}),n.jsxs("div",{className:"mt-1 flex items-center gap-1.5 text-[11px] text-ink-secondary",children:[n.jsx("span",{className:V("h-1.5 w-1.5 rounded-full",s?"bg-accent":A.status==="ready"?"bg-success":A.status==="error"?"bg-danger":"bg-ink-secondary/50")}),s?"You have control":r?"Control held elsewhere":L]})]}),t&&s?n.jsxs("button",{type:"button",onClick:h,disabled:c,className:"flex shrink-0 items-center gap-1.5 rounded-lg bg-accent px-2.5 py-2 text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[c?n.jsx(je,{size:13,className:"animate-spin"}):n.jsx(Li,{size:13}),"Hand back"]}):t?n.jsxs("button",{type:"button",onClick:()=>p(t.id),disabled:!G||c||r,className:"flex shrink-0 items-center gap-1.5 rounded-lg bg-raised px-2.5 py-2 text-[12px] text-ink hover:bg-raised-hover disabled:opacity-45",title:"Pause only this bot and enable keyboard and pointer input in this pane",children:[c?n.jsx(je,{size:13,className:"animate-spin"}):n.jsx(Li,{size:13}),r?"Held elsewhere":"Take control"]}):null]}),n.jsx("div",{ref:k,"data-native-view-host":!0,className:"relative min-h-0 flex-1 bg-[#070707]",children:n.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-6 text-center",children:t?!M&&!B?n.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-ink-secondary",children:[n.jsx(je,{size:15,className:"animate-spin"})," Checking ",t.name,"'s VM…"]}):M?.ready&&A.status!=="error"&&!B?n.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-ink-secondary",children:[n.jsx(je,{size:15,className:"animate-spin"})," Connecting live view…"]}):n.jsxs("div",{className:"flex max-w-[300px] flex-col items-center gap-3 text-ink-secondary",children:[n.jsx(Qn,{size:21,className:"text-warning"}),n.jsx("div",{className:"text-[12px] leading-relaxed",children:B??(M?.container==="missing"?`${t.name}'s Local VM has not been created.`:M?.container==="stopped"?`${t.name}'s Local VM is stopped.`:`${t.name}'s Local VM is not ready for a live view.`)}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs("button",{type:"button",onClick:()=>j(H=>H+1),className:"flex items-center gap-1.5 rounded-lg bg-raised px-3 py-2 text-[12px] text-ink hover:bg-raised-hover",children:[n.jsx(vn,{size:13})," Retry status"]}),n.jsx("button",{type:"button",onClick:()=>g(t.id),className:"rounded-lg bg-raised px-3 py-2 text-[12px] text-ink hover:bg-raised-hover",children:"Open Computer"})]})]}):n.jsxs("div",{className:"flex max-w-[260px] flex-col items-center gap-2 text-ink-secondary",children:[n.jsx(Ea,{size:22}),n.jsx("span",{className:"text-[12px]",children:"Choose another bot configured for a Local VM."})]})})})]})}function DRe({primaryBotId:e,overlayOpen:t,onClose:a,onOpenComputer:o}){const{state:i,dispatch:s}=ke(),r=f.useMemo(()=>i.bots.filter(L=>L.computer==="vm"&&!L.hidden),[i.bots]),[c,d]=f.useState(()=>CRe(i.bots,e)),p=f.useRef(c),[h,g]=f.useState(null),b=f.useRef(null),x=f.useRef(null),v=x.current??crypto.randomUUID();x.current=v;const k=f.useRef(!1),w=f.useRef(!0),[N,C]=f.useState(!1),[j,M]=f.useState(null),E=BRe(t);f.useEffect(()=>{p.current=c},[c]);const A=f.useMemo(()=>({async take(L){const G=await p4({action:"take",syncNativeBrowser:!0,requestControl:H=>tE(L,H,v),setNativeBrowserControl:H=>aE()});return $2(s,L,G),G.held&&G.owned===!0?b.current=L:b.current===L&&(b.current=null),G},async release(L){const G=await p4({action:"release",syncNativeBrowser:!0,requestControl:H=>tE(L,H,v),setNativeBrowserControl:H=>aE()});return $2(s,L,G),b.current===L&&(b.current=null),G},async setInteractive(L){const G=window.ogb?.desktopWorkspace;if(!G)throw new Error("The desktop workspace bridge is unavailable");return G.setInteractive(L)}}),[v,s]);f.useEffect(()=>{d(L=>{const G=NRe(L,i.bots);return G[0]===L[0]&&G[1]===L[1]?L:G})},[i.bots]),f.useEffect(()=>{let L=!0;return(async()=>{for(const H of c)if(H)try{const $=await IRe(H);L&&$2(s,H,$)}catch{}})(),()=>{L=!1}},[s,c]),f.useEffect(()=>{const L=b.current;!L||c.includes(L)||H2(A,L).then(()=>{g(null)}).catch(()=>{M("The removed pane could not hand control back safely.")})},[A,c]),f.useEffect(()=>(w.current=!0,()=>{w.current=!1;const L=b.current,G=window.ogb?.desktopWorkspace;if(!G){L&&nE(L,v);return}G.setInteractive(null).catch(()=>{}).then(()=>(L&&nE(L,v),G.close())).catch(()=>{})}),[v]);const R=f.useCallback(L=>{const G=p.current.indexOf(L);return G<0?null:C4[G]},[]),B=f.useCallback(async()=>{const L=b.current;if(!L)return!0;if(k.current)return!1;k.current=!0,C(!0),M(null);try{return await H2(A,L),g(null),!0}catch{return M("Atomic could not hand control back. The workspace stayed open."),!1}finally{k.current=!1,C(!1)}},[A]),O=f.useCallback(async L=>{if(k.current||b.current===L)return;const G=window.ogb?.desktopWorkspace,H=R(L);if(!(!G||!H)){k.current=!0,C(!0),M(null);try{const $={...A,async setInteractive(Q){if(Q&&R(L)!==Q)throw new Error("The Local VM pane changed during control acquisition");return A.setInteractive(Q)}},U=await SRe($,b.current,L,H);if(g(null),U.status==="held-elsewhere"){M("This VM is already controlled in another viewer. Hand it back there first.");return}if(!w.current){await H2(A,L).catch(()=>{});return}g(L)}catch{g(b.current),M("Control could not switch safely. Any remaining hold stayed paused.")}finally{k.current=!1,C(!1)}}},[R,A]),T=f.useCallback(async(L,G)=>{if(k.current)return;const H=p.current[L];H!==G&&(H&&b.current===H&&!await B()||d($=>jRe($,L,G)))},[B]),z=f.useCallback(async()=>{b.current&&!await B()||a()},[B,a]),P=f.useCallback(async L=>{b.current&&!await B()||o(L)},[B,o]);return n.jsxs("main",{className:"flex h-full min-w-0 flex-1 flex-col bg-app",children:[n.jsxs("header",{className:"flex min-h-[60px] items-center gap-3 border-b border-hairline/40 px-5 py-3",children:[n.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-accent/15 text-accent",children:n.jsx(Ea,{size:18})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("h1",{className:"truncate text-[14px] font-semibold text-ink",children:"Local VM workspace"}),n.jsx("p",{className:"truncate text-[11.5px] text-ink-secondary",children:"Two live desktops · one active controller · watch-only by default"})]}),n.jsx("button",{type:"button",onClick:()=>{z()},disabled:N,className:"rounded-md p-1.5 text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-50","aria-label":"Close Local VM workspace",children:n.jsx(jt,{size:18})})]}),j&&n.jsxs("div",{className:"mx-3 mt-3 flex items-center gap-2 rounded-lg border border-danger/30 bg-danger/10 px-3 py-2 text-[12px] text-danger",children:[n.jsx(Qn,{size:14,className:"shrink-0"})," ",j]}),n.jsx("div",{className:"grid min-h-0 flex-1 grid-cols-2 gap-3 p-3",children:[0,1].map(L=>{const G=c[L],H=r.find($=>$.id===G)??null;return n.jsx(RRe,{index:L,bot:H,bots:r,otherBotId:c[L===0?1:0],obscured:E,active:!!(H&&h===H.id),heldElsewhere:!!(H&&i.computerControl[H.id]?.held&&h!==H.id),controlPending:N,onSelect:$=>{T(L,$)},onTake:$=>{O($)},onRelease:()=>{B()},onOpenComputer:$=>{P($)}},C4[L])})})]})}const ORe={collaborations:[],queued:[],running:[]};function zRe(e,t=[]){const a=new Map;for(const o of e){if(o.hidden)continue;const i=o.section?.trim()||"";a.set(i,[...a.get(i)??[],o])}for(const o of t){const i=o.trim();i&&!a.has(i)&&a.set(i,[])}return[...a].map(([o,i])=>({key:o,name:o||"General",chiefs:i.filter(s=>s.chiefOfStaff),members:i.filter(s=>!s.chiefOfStaff)}))}function LRe(e,t){const a=new Set(e.filter(s=>!s.hidden).map(s=>s.id)),o=new Map,i=(s,r)=>[s,r].sort().join(":");for(const s of t.collaborations){const[r,c]=s.botIds;!a.has(r)||!a.has(c)||o.set(i(r,c),{sourceBotId:r,targetBotId:c,state:"connected",groupId:s.groupId,lastAt:s.lastAt})}for(const s of t.queued)!a.has(s.sourceBotId)||!a.has(s.targetBotId)||o.set(i(s.sourceBotId,s.targetBotId),{sourceBotId:s.sourceBotId,targetBotId:s.targetBotId,state:"queued",reason:s.reason});for(const s of t.running)!a.has(s.sourceBotId)||!a.has(s.targetBotId)||o.set(i(s.sourceBotId,s.targetBotId),{sourceBotId:s.sourceBotId,targetBotId:s.targetBotId,state:"running",groupId:s.groupId});return[...o.values()].sort((s,r)=>{const c={running:0,queued:1,connected:2};return c[s.state]-c[r.state]||(r.lastAt??0)-(s.lastAt??0)})}function _Re(e){return e.activity==="waiting-on-you"?{label:"Waiting for you",tone:"warning"}:e.activity==="dead"||e.activity==="no-signal"?{label:"No signal",tone:"danger"}:e.busy||e.activity==="working"?{label:"Working",tone:"success"}:{label:"Ready",tone:"idle"}}const FRe=236,qRe=126,iE=16,sE=20,URe=64,G2="application/x-omb-computer";function rh(e,t=[]){const a=new Map(t.map((o,i)=>[o,i]));return[...e].sort((o,i)=>(a.get(o.id)??1/0)-(a.get(i.id)??1/0))}function VRe(e,t,a){const o=e.map(s=>s.id);if(!o.includes(t))return o;const i=o.filter(s=>s!==t);return i.splice(Math.max(0,Math.min(i.length,a)),0,t),i}function HRe(e){try{const t=JSON.parse(e??"null");return t===null||typeof t!="object"||Array.isArray(t)?{}:Object.fromEntries(Object.entries(t).flatMap(([a,o])=>Array.isArray(o)?[[a,[...new Set(o.filter(i=>typeof i=="string"&&i.length>0))]]]:[]))}catch{return{}}}function $Re(e){const t=e.chiefs.length>0&&e.members.length>0,a=t?Math.max(e.chiefs.length,e.members.length):Math.max(1,e.chiefs.length+e.members.length);return{width:FRe*(t?2:1)+sE*2+(t?40:0),height:URe+sE+a*(qRe+iE)-iE}}function GRe(e,t){const a=e.map($Re),o=Math.max(0,...a.filter((s,r)=>r%2===0).map(s=>s.width));let i=40;return e.map((s,r)=>{r>0&&r%2===0&&(i+=Math.max(a[r-2].height,a[r-1].height)+56);const c=Object.hasOwn(t,s.key)?t[s.key]:void 0;return{key:s.key,x:c?.x??(r%2===0?40:40+o+56),y:c?.y??i,...a[r]}})}function KRe(e,t,a){if(!e.length)return{x:0,y:0,scale:1};const o=Math.min(...e.map(d=>d.x)),i=Math.min(...e.map(d=>d.y)),s=Math.max(...e.map(d=>d.x+d.width))-o,r=Math.max(...e.map(d=>d.y+d.height))-i,c=Math.max(.3,Math.min(1,(t-80)/s,(a-80)/r));return{x:(t-s*c)/2-o*c,y:(a-r*c)/2-i*c,scale:c}}function rE(e,t,a){const o=t/e.scale;return{x:a.x-(a.x-e.x)*o,y:a.y-(a.y-e.y)*o,scale:t}}function WRe(e){try{const t=JSON.parse(e??"null");return t===null||typeof t!="object"||Array.isArray(t)?{}:Object.fromEntries(Object.entries(t).flatMap(([a,o])=>{if(o===null||typeof o!="object"||Array.isArray(o))return[];const{x:i,y:s}=o;return typeof i=="number"&&Number.isFinite(i)&&Math.abs(i)<1e5&&typeof s=="number"&&Number.isFinite(s)&&Math.abs(s)<1e5?[[a,{x:i,y:s}]]:[]}))}catch{return{}}}const Vh="flex size-9 shrink-0 items-center justify-center rounded-lg text-ink-secondary hover:bg-control hover:text-ink focus-visible:outline-2 focus-visible:outline-accent",Ny="flex w-full items-center gap-2 rounded-lg px-3 py-2.5 text-left text-[12px] text-ink-secondary hover:bg-control hover:text-ink";function JRe({bot:e,selected:t,moving:a,connected:o,onComputer:i,onArrange:s}){const{state:r,dispatch:c}=ke(),d=_Re(e),p=r.instances.find(g=>g.instanceId===e.modelSelection.instanceId),h=p?.models.options.find(g=>g.id===e.modelSelection.model)?.label??e.modelSelection.model;return n.jsxs("article",{className:V("relative h-[126px] w-[236px] shrink-0 rounded-xl border bg-card shadow-sm transition-colors",t?"border-accent/60 ring-1 ring-accent/15":o?"border-accent/40":"border-hairline/50 hover:border-ink-secondary/40",a&&"opacity-35"),children:[n.jsxs("button",{"data-bot-id":e.id,"aria-label":l("canvas.editBot",{name:e.name}),onClick:()=>c({type:"toggleSettings",botId:e.id,section:"identity",open:!0}),title:s?l("canvas.reorderHint"):void 0,onKeyDown:g=>{!s||!g.altKey||g.key!=="ArrowUp"&&g.key!=="ArrowDown"||(g.preventDefault(),g.stopPropagation(),s(e,g.key==="ArrowUp"?-1:1))},className:"flex h-[82px] w-full cursor-grab items-center gap-3 rounded-t-xl px-4 text-left active:cursor-grabbing focus-visible:outline-2 focus-visible:outline-accent",children:[n.jsx(Zt,{bot:e,size:38,motion:"none",motionKey:0,animated:!1}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"truncate text-[14px] font-semibold",children:e.name}),e.chiefOfStaff&&n.jsx(wp,{size:12,className:"shrink-0 text-warning","aria-label":l("chat.chiefOfStaff")})]}),n.jsx("span",{className:"mt-1 block truncate text-[11px] text-ink-secondary",children:e.title||(e.chiefOfStaff?l("chat.chiefOfStaff"):l("canvas.bot"))})]})]}),n.jsxs("div",{className:"flex h-[43px] items-center gap-1 border-t border-hairline/30 px-2",children:[n.jsx("button",{className:V(Vh,"size-8"),"aria-label":l("canvas.openBotChat",{name:e.name}),title:l("canvas.openChat"),onClick:()=>c(la(e)),children:n.jsx(EY,{size:13})}),d.tone!=="idle"&&n.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] text-ink-secondary",title:d.label,children:[n.jsx("span",{className:V("size-1.5 rounded-full",d.tone==="success"?"bg-success":d.tone==="warning"?"bg-warning":d.tone==="danger"?"bg-danger":"bg-ink-secondary/35")}),d.label]}),t&&i&&n.jsx("button",{className:V(Vh,"size-8"),"aria-label":l("canvas.botComputer",{name:e.name}),title:l("computer.tab.computer"),onClick:()=>i(e),children:n.jsx(Ea,{size:13})}),n.jsxs("button",{"aria-label":l("canvas.changeModel",{name:e.name}),title:`${l("canvas.defaultModel")}: ${h}`,onClick:()=>c({type:"toggleSettings",botId:e.id,section:"model",open:!0}),className:"ml-auto flex h-8 min-w-0 max-w-[130px] items-center gap-1.5 rounded-md px-2 text-[10px] text-ink-secondary hover:bg-control hover:text-ink focus-visible:outline-2 focus-visible:outline-accent",children:[n.jsx("span",{className:"flex size-3.5 shrink-0 items-center justify-center",children:p?n.jsx(Ll,{instance:p,size:13}):n.jsx(Nd,{driverKind:"",size:13})}),n.jsx("span",{className:"truncate",children:h||l("canvas.defaultModel")})]})]})]})}function YRe({sections:e,canManage:t,onMove:a,onInstructions:o,onEditTeam:i,onDeleteTeam:s,onComputer:r,onComputerDrop:c,onTeamComputer:d,teamComputers:p={},connectedBotIds:h=[]}){const{state:g}=ke(),b=f.useRef(null),x=f.useRef(null),v=f.useRef(!1),k=f.useRef(!1),w=f.useRef(null),[N,C]=f.useState({}),[j,M]=f.useState({}),[E,A]=f.useState({x:40,y:40,scale:1}),[R,B]=f.useState(null),[O,T]=f.useState(null),[z,P]=f.useState(null),[L,G]=f.useState(null),[H,$]=f.useState(null),[U,Q]=f.useState(""),[W,q]=f.useState(!1),[Y,ae]=f.useState(null),F=f.useMemo(()=>GRe(e,N),[e,N]),pe=f.useRef({view:E,positions:N,tiles:F,selectedId:g.selectedId,settingsOpen:g.settingsOpen});pe.current={view:E,positions:N,tiles:F,selectedId:g.selectedId,settingsOpen:g.settingsOpen},f.useEffect(()=>{let ue=!0;return Z("/.well-known/openmausbot/environment",{signal:AbortSignal.timeout(5e3)}).then(we=>{if(!(!ue||typeof we.environmentId!="string")){w.current=`omb-team-canvas:${we.environmentId}`;try{const me=WRe(localStorage.getItem(w.current));C($e=>({...me,...$e})),M(HRe(localStorage.getItem(`${w.current}:bot-order`)))}catch{}}}).catch(()=>{}).finally(()=>{ue&&q(!0)}),()=>{ue=!1}},[]);const ge=ue=>{if(C(ue),!!w.current)try{localStorage.setItem(w.current,JSON.stringify(Object.fromEntries(e.filter(we=>Object.hasOwn(ue,we.key)).map(we=>[we.key,ue[we.key]]))))}catch{}},Ne=ue=>Object.hasOwn(j,ue)?j[ue]:[],ee=(ue,we,me,$e)=>{const Re={...j,[ue.key]:[...VRe(we,me.id,$e),...rh(me.chiefOfStaff?ue.members:ue.chiefs,Ne(ue.key)).map(de=>de.id)]};if(M(Re),w.current)try{localStorage.setItem(`${w.current}:bot-order`,JSON.stringify(Re))}catch{}Q(l("canvas.arrangedBot",{name:me.name,team:ue.name}))},X=(ue,we)=>{const me=e.find(Re=>Re.key===(ue.section?.trim()??""));if(!me)return;const $e=rh(ue.chiefOfStaff?me.chiefs:me.members,Ne(me.key));ee(me,$e,ue,$e.findIndex(Re=>Re.id===ue.id)+we)},oe=f.useCallback(()=>{const ue=b.current?.getBoundingClientRect();ue&&A(KRe(pe.current.tiles,ue.width,ue.height))},[]);f.useEffect(()=>{const ue=b.current;if(!ue)return;let we=null;const me=new ResizeObserver(()=>{const $e=ue.getBoundingClientRect();if(!we)oe();else{const Re=pe.current.settingsOpen?[...ue.querySelectorAll("[data-bot-id]")].find(ce=>ce.dataset.botId===pe.current.selectedId)?.getBoundingClientRect():void 0,de=Re?$e.width/2-(Re.left-$e.left+Re.width/2):($e.width-we.width)/2,Ve=Re?$e.height/2-(Re.top-$e.top+Re.height/2):($e.height-we.height)/2;A(ce=>({...ce,x:ce.x+de,y:ce.y+Ve}))}we={width:$e.width,height:$e.height}});return me.observe(ue),()=>me.disconnect()},[oe]);const ne=JSON.stringify(F.map(({key:ue,width:we,height:me})=>[ue,we,me]));f.useEffect(()=>{oe()},[oe,ne,W]),f.useEffect(()=>{const ue=b.current?.querySelector("details[open]"),we=b.current?.getBoundingClientRect();ue&&we&&ae(ue.getBoundingClientRect().bottom>we.bottom-210*E.scale?ue.closest("[data-team-key]")?.dataset.teamKey??null:null)},[E,ne]),f.useEffect(()=>{const ue=b.current;if(!ue)return;const we=me=>{if(me.target.closest("details[open]")||(me.preventDefault(),x.current))return;const $e=pe.current.view,Re=ue.getBoundingClientRect();if(me.ctrlKey||me.metaKey){const de=Math.min(1.5,Math.max(.3,$e.scale*Math.exp(-me.deltaY*.006)));A(rE($e,de,{x:me.clientX-Re.left,y:me.clientY-Re.top}))}else{const de=me.deltaMode===1?16:me.deltaMode===2?Re.height:1;A({...$e,x:$e.x-me.deltaX*de,y:$e.y-me.deltaY*de})}};return ue.addEventListener("wheel",we,{passive:!1}),()=>ue.removeEventListener("wheel",we)},[]);const Ce=ue=>{if(ue.button!==0||!ue.isPrimary||x.current)return;const we=ue.target,me=we.closest("[data-bot-id]")?.dataset.botId,$e=we.closest("[data-arrange-team]")?.dataset.arrangeTeam,Re=me?e.flatMap(ce=>[...ce.chiefs,...ce.members]).find(ce=>ce.id===me):void 0;if(!Re&&$e===void 0&&we.closest("button, details, a, input, [data-team-key]")||Re&&(H||!W)||$e!==void 0&&!W)return;const de={id:ue.pointerId,start:{x:ue.clientX,y:ue.clientY},view:E,positions:N,moved:!1},Ve=$e===void 0?void 0:F.find(ce=>ce.key===$e);x.current=Re?{...de,kind:"bot",bot:Re}:Ve?{...de,kind:"team",key:Ve.key,origin:Ve}:{...de,kind:"pan"},v.current=!1},le=(ue,we)=>{const me=document.elementFromPoint(ue,we)?.closest("[data-team-key]");return me&&b.current?.contains(me)?me.dataset.teamKey??null:null},re=(ue,we)=>{const me=e.find(ce=>ce.key===(ue.section?.trim()??""));if(!me)return null;const $e=rh(ue.chiefOfStaff?me.chiefs:me.members,Ne(me.key)),Re=$e.filter(ce=>ce.id!==ue.id),de=[...b.current?.querySelectorAll("[data-bot-id]")??[]],Ve=Re.findIndex(ce=>{const Le=de.find(tt=>tt.dataset.botId===ce.id)?.closest("article")?.getBoundingClientRect();return Le?we<Le.top+Le.height/2:!1});return{section:me,lane:$e,remaining:Re,index:Ve<0?Re.length:Ve}},xe=ue=>{const we=x.current;if(!we||we.id!==ue.pointerId)return;if(ue.buttons===0){Te(ue,!0);return}const me=ue.clientX-we.start.x,$e=ue.clientY-we.start.y;if(!(!we.moved&&Math.hypot(me,$e)<5)&&(we.moved=!0,ue.currentTarget.setPointerCapture(ue.pointerId),we.kind==="pan"&&A({...we.view,x:we.view.x+me,y:we.view.y+$e}),we.kind==="team"&&C({...we.positions,[we.key]:{x:we.origin.x+me/E.scale,y:we.origin.y+$e/E.scale}}),we.kind==="bot")){const Re=ue.currentTarget.getBoundingClientRect();B({bot:we.bot,point:{x:ue.clientX-Re.left,y:ue.clientY-Re.top}});const de=le(ue.clientX,ue.clientY),Ve=de===(we.bot.section?.trim()??"");T(Ve||t?de:null);const ce=Ve?re(we.bot,ue.clientY):null,Le=ce?.remaining[ce.index]??ce?.remaining.at(-1);G(ce&&Le?{botId:Le.id,after:ce.index===ce.remaining.length}:null)}},Te=(ue,we=!1)=>{const me=x.current;if(!(!me||ue&&me.id!==ue.pointerId)){if(x.current=null,v.current=me.moved,window.setTimeout(()=>{v.current=!1},0),B(null),T(null),G(null),b.current?.hasPointerCapture(me.id)&&b.current.releasePointerCapture(me.id),we){C(me.positions),A(me.view);return}if(me.moved&&(me.kind==="team"&&ue&&ge({...me.positions,[me.key]:{x:me.origin.x+(ue.clientX-me.start.x)/me.view.scale,y:me.origin.y+(ue.clientY-me.start.y)/me.view.scale}}),me.kind==="bot"&&ue)){const $e=le(ue.clientX,ue.clientY);if($e===null)return;if($e===(me.bot.section?.trim()??"")){const Re=re(me.bot,ue.clientY);Re&&ee(Re.section,Re.lane,me.bot,Re.index);return}if(!t)return;$(me.bot.id),Q(l("canvas.reviewMove",{name:me.bot.name,team:$e||l("settings.section.general")})),a(me.bot,$e).then(Re=>{Q(Re===!1?l("canvas.moveCancelled"):l("canvas.moved",{name:me.bot.name,team:$e||l("settings.section.general")}))}).catch(Re=>{Q(Re instanceof Error?Re.message:String(Re))}).finally(()=>$(null))}}},nt=ue=>{const we=b.current?.getBoundingClientRect();we&&A(rE(E,Math.max(.3,Math.min(1.5,E.scale*ue)),{x:we.width/2,y:we.height/2}))},be=e.find(ue=>ue.key===O),Ye=z!==null?l("canvas.assignComputer",{team:e.find(ue=>ue.key===z)?.name??z}):R&&be?(R.bot.section?.trim()??"")===be.key?l("canvas.arrangeBot",{name:R.bot.name,team:be.name}):l("canvas.moveBot",{name:R.bot.name,team:be.name}):null;return n.jsxs("div",{ref:b,role:"region","aria-label":l("canvas.region"),tabIndex:0,"data-team-canvas":!0,className:"relative min-h-0 flex-1 touch-none overflow-clip outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40",style:{backgroundImage:"radial-gradient(circle, color-mix(in srgb, var(--color-ink-secondary) 18%, transparent) 1px, transparent 1px)",backgroundSize:`${24*E.scale}px ${24*E.scale}px`,backgroundPosition:`${E.x}px ${E.y}px`},onPointerDown:Ce,onPointerMove:xe,onPointerUp:ue=>Te(ue),onPointerCancel:ue=>Te(ue,!0),onDragOver:ue=>{if(!t||!c||!ue.dataTransfer.types.includes(G2))return;const we=ue.target.closest("[data-team-key]"),me=we&&ue.currentTarget.contains(we)?we.dataset.teamKey??null:null;P(me),me!==null&&(ue.preventDefault(),ue.dataTransfer.dropEffect="link")},onDragLeave:ue=>{(!(ue.relatedTarget instanceof Node)||!ue.currentTarget.contains(ue.relatedTarget))&&P(null)},onDrop:ue=>{if(P(null),!t||!c||!ue.dataTransfer.types.includes(G2))return;const we=ue.target.closest("[data-team-key]"),me=we&&ue.currentTarget.contains(we)?we.dataset.teamKey:void 0,$e=ue.dataTransfer.getData(G2);me===void 0||!e.some(Re=>Re.key===me)||!$e||(ue.preventDefault(),c($e,me))},onDragEnd:()=>P(null),onPointerDownCapture:ue=>{k.current=!1,ue.target.closest("details")||ue.currentTarget.querySelectorAll("details[open]").forEach(we=>we.removeAttribute("open"))},onKeyDownCapture:ue=>{ue.key==="Tab"&&(k.current=!0)},onPointerLeave:()=>{x.current&&!x.current.moved&&Te(void 0,!0)},onLostPointerCapture:()=>{x.current&&Te(void 0,!0)},onFocusCapture:ue=>{if(!k.current||!(ue.target instanceof HTMLElement)||!ue.target.closest("[data-canvas-world]"))return;const we=ue.currentTarget.getBoundingClientRect(),me=ue.target.getBoundingClientRect(),$e=me.left<we.left+16?we.left+16-me.left:me.right>we.right-16?we.right-16-me.right:0,Re=me.top<we.top+16?we.top+16-me.top:me.bottom>we.bottom-70?we.bottom-70-me.bottom:0;($e||Re)&&A(de=>({...de,x:de.x+$e,y:de.y+Re}))},onClickCapture:ue=>{v.current&&(v.current=!1,ue.preventDefault(),ue.stopPropagation())},onKeyDown:ue=>{if(ue.key==="Escape"&&(Te(void 0,!0),ue.currentTarget.querySelectorAll("details[open]").forEach($e=>{$e.querySelector("summary")?.focus({preventScroll:!0}),$e.removeAttribute("open")})),ue.target!==ue.currentTarget)return;const me={ArrowLeft:{x:60,y:0},ArrowRight:{x:-60,y:0},ArrowUp:{x:0,y:60},ArrowDown:{x:0,y:-60}}[ue.key];me&&(ue.preventDefault(),A({...E,x:E.x+me.x,y:E.y+me.y})),(ue.key==="+"||ue.key==="=")&&(ue.preventDefault(),nt(1.2)),ue.key==="-"&&(ue.preventDefault(),nt(1/1.2)),ue.key==="0"&&(ue.preventDefault(),oe())},children:[n.jsx("div",{"data-canvas-world":!0,className:"absolute left-0 top-0 origin-top-left",style:{transform:`translate(${E.x}px, ${E.y}px) scale(${E.scale})`},children:e.map((ue,we)=>{const me=F[we],$e=ue.chiefs.length>0&&ue.members.length>0,Re=z===ue.key||R&&O===ue.key&&(R.bot.section?.trim()??"")!==ue.key,de=Object.hasOwn(p,ue.key)?p[ue.key]:void 0,Ve=ce=>n.jsxs("div",{className:"relative",children:[L?.botId===ce.id&&n.jsx("div",{className:V("pointer-events-none absolute inset-x-1 h-0.5 rounded bg-accent",L.after?"-bottom-[9px]":"-top-[9px]")}),n.jsx(JRe,{bot:ce,selected:g.selectedId===ce.id&&g.settingsOpen,moving:R?.bot.id===ce.id||H===ce.id,connected:h.includes(ce.id),onComputer:r,onArrange:W?X:void 0})]},ce.id);return n.jsxs("section",{"data-team-key":ue.key,"aria-label":l("canvas.teamRegion",{name:ue.name}),className:V("absolute rounded-2xl border bg-panel/90 shadow-sm has-[details[open]]:z-20 data-[computer-dropping=true]:border-accent data-[computer-dropping=true]:ring-2 data-[computer-dropping=true]:ring-accent/25",Re?"border-accent ring-2 ring-accent/25":"border-hairline/50"),style:{left:me.x,top:me.y,width:me.width,height:me.height},children:[n.jsxs("header",{className:"flex h-16 items-center gap-2 px-5",children:[n.jsx("button",{"data-arrange-team":ue.key,disabled:!W,"aria-label":l("canvas.arrange",{name:ue.name}),title:l("canvas.arrangeHint"),className:"min-w-0 flex-1 cursor-grab rounded-md py-2 text-left active:cursor-grabbing focus-visible:outline-2 focus-visible:outline-accent",onKeyDown:ce=>{const Le={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[ce.key];if(!Le)return;ce.preventDefault(),ce.stopPropagation();const tt=ce.shiftKey?40:10;ge({...N,[ue.key]:{x:me.x+Le[0]*tt,y:me.y+Le[1]*tt}})},children:n.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:ue.name})}),de&&n.jsxs("button",{"aria-label":l("canvas.teamComputer",{team:ue.name,name:de.name}),title:`${de.name}${de.state?` · ${de.state}`:""}`,disabled:!d,onClick:()=>d?.(ue.key),className:"flex min-w-0 max-w-[120px] shrink items-center gap-1.5 rounded-md px-1.5 py-2 text-[10px] text-ink-secondary hover:bg-control hover:text-ink focus-visible:outline-2 focus-visible:outline-accent disabled:pointer-events-none",children:[n.jsx(Ea,{size:12,className:"shrink-0"}),n.jsx("span",{className:"truncate",children:de.name})]}),n.jsx("span",{className:"text-[11px] tabular-nums text-ink-secondary",children:ue.chiefs.length+ue.members.length}),t&&n.jsxs("details",{className:"relative",onToggle:ce=>{if(ce.currentTarget.open){const Le=b.current?.getBoundingClientRect();ae(Le&&ce.currentTarget.getBoundingClientRect().bottom>Le.bottom-210*E.scale?ue.key:null),b.current?.querySelectorAll("details[open]").forEach(tt=>{tt!==ce.currentTarget&&tt.removeAttribute("open")})}},children:[n.jsx("summary",{"aria-label":l("canvas.manageTeam",{name:ue.name}),className:V(Vh,"cursor-pointer list-none [&::-webkit-details-marker]:hidden"),children:n.jsx(Kl,{size:17})}),n.jsxs("div",{className:V("absolute right-0 z-30 w-[220px] rounded-xl border border-hairline bg-panel p-1.5 shadow-xl",Y===ue.key?"bottom-10":"top-10"),onClick:ce=>{const Le=ce.currentTarget.closest("details");Le?.querySelector("summary")?.focus(),Le?.removeAttribute("open")},children:[n.jsxs("button",{className:Ny,onClick:()=>i(ue.key),"aria-label":l("team.moveTo",{name:ue.name}),children:[n.jsx(ki,{size:14}),l("team.moveTo",{name:ue.name})]}),n.jsxs("button",{className:Ny,onClick:()=>o(ue.key,ue.name),"aria-label":l("team.instructionsEdit",{name:ue.name}),children:[n.jsx(Rs,{size:14}),l("team.instructions")]}),ue.key&&n.jsxs("button",{className:Ny,onClick:()=>i(ue.key,!0),"aria-label":l("team.renameAria",{name:ue.name}),children:[n.jsx($i,{size:14}),l("team.rename")]}),ue.key&&n.jsxs("button",{className:V(Ny,"hover:text-danger"),onClick:()=>s(ue.key),"aria-label":l("team.deleteAria",{name:ue.name}),children:[n.jsx(xn,{size:14}),l("team.delete")]})]})]})]}),Re&&n.jsx("div",{className:"pointer-events-none absolute -top-7 left-2 z-30 max-w-[calc(100%-16px)] truncate rounded-md bg-accent px-2 py-1 text-[10px] text-white shadow-sm",children:Ye}),n.jsxs("div",{className:"flex items-center px-5 pb-5",children:[ue.chiefs.length>0&&n.jsx("div",{className:"flex flex-col gap-4",children:rh(ue.chiefs,Ne(ue.key)).map(Ve)}),$e&&n.jsx("div",{className:"flex w-10 shrink-0 justify-center text-ink-secondary/35","aria-hidden":"true",children:n.jsx(Mg,{size:22,strokeWidth:1})}),ue.members.length>0&&n.jsx("div",{className:"flex flex-col gap-4",children:rh(ue.members,Ne(ue.key)).map(Ve)}),ue.chiefs.length+ue.members.length===0&&n.jsx("p",{className:"flex h-[126px] w-[236px] items-center justify-center rounded-xl border border-dashed border-hairline/70 px-6 text-center text-[12px] leading-relaxed text-ink-secondary",children:l("canvas.dropHere")})]})]},ue.key)})}),R&&n.jsxs("div",{className:"pointer-events-none absolute z-40 rounded-xl border border-accent/40 bg-card px-4 py-3 text-[13px] shadow-lg",style:{left:R.point.x+16,top:R.point.y+16},children:[n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Zt,{bot:R.bot,size:24,animated:!1}),R.bot.name]}),Ye&&n.jsx("p",{className:"mt-1 text-[10px] text-ink-secondary",children:Ye})]}),n.jsxs("div",{className:"pointer-events-none absolute inset-x-5 bottom-5 flex items-end justify-between gap-3",children:[n.jsxs("div",{className:"min-w-0 rounded-lg bg-app/90 px-2 py-1.5 text-[11px] text-ink-secondary",children:[n.jsx("p",{className:"max-sm:hidden",children:l("canvas.hint")}),n.jsx("p",{role:"status","aria-live":"polite",className:"max-w-[440px]",children:Ye??U})]}),n.jsxs("div",{className:"pointer-events-auto flex shrink-0 items-center gap-0.5 rounded-xl border border-hairline/60 bg-panel p-1 shadow-sm",children:[n.jsx("button",{className:Vh,"aria-label":l("canvas.zoomOut"),onClick:()=>nt(1/1.2),children:n.jsx(TE,{size:15})}),n.jsxs("button",{className:"min-w-12 rounded-md px-1 py-2 text-[11px] tabular-nums text-ink-secondary hover:bg-control","aria-label":l("canvas.fit"),title:l("canvas.fitHint"),onClick:oe,children:[Math.round(E.scale*100),"%"]}),n.jsx("button",{className:Vh,"aria-label":l("canvas.zoomIn"),onClick:()=>nt(1.2),children:n.jsx(Sn,{size:15})})]})]})]})}const vs="rounded-lg px-3 py-2 text-[12px] text-ink-secondary hover:bg-control hover:text-ink disabled:opacity-40",lE="w-full rounded-lg border border-hairline/60 bg-inset px-3 py-2 text-[12px] text-ink outline-none focus:border-accent";function ZRe({open:e,createRequest:t,drop:a,sections:o,onClose:i,onDropHandled:s,onChange:r}){const{dispatch:c}=ke(),[d,p]=f.useState(null),[h,g]=f.useState(!1),[b,x]=f.useState(""),[v,k]=f.useState(""),[w,N]=f.useState(null),[C,j]=f.useState(!1),[M,E]=f.useState(""),A=f.useRef(crypto.randomUUID()),R=f.useRef(null),B=f.useRef(null),O=f.useRef(null),T=f.useRef(!1),z=f.useRef(!0),P=f.useRef(null),L=f.useRef(r);L.current=r;const[G,H]=f.useState(null),[$,U]=f.useState(null),[Q,W]=f.useState(null),q=f.useRef(crypto.randomUUID()),Y=f.useRef(null),ae=f.useRef(null),F=f.useRef(null),pe=f.useRef(null),[ge,Ne]=f.useState(null),ee=f.useCallback(()=>{const be=F.current;F.current=null,pe.current?.removeAttribute("data-computer-dropping"),pe.current=null,be?.handle.hasPointerCapture(be.id)&&be.handle.releasePointerCapture(be.id),Ne(null)},[]);f.useEffect(()=>(e||ee(),()=>{pe.current?.removeAttribute("data-computer-dropping")}),[e,ee]),f.useEffect(()=>{Y.current=Q},[Q]),f.useEffect(()=>()=>{const be=Y.current;be&&fetch(`/api/team-computers/${encodeURIComponent(be)}/control`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"release",controlLeaseId:q.current}),keepalive:!0}).catch(()=>{})},[]);const X=f.useCallback((be,Ye)=>{if(!(T.current||be.section===Ye)){if(be.section!==null&&Ye!==null){x(`Unassign ${be.name} from ${be.section||"General"} before moving it to another team. Its files and signed-in accounts stay on the computer.`);return}x(""),H({computer:be,section:Ye})}},[]),oe=(be,Ye)=>{const ue=ae.current?.parentElement?.querySelector("[data-team-canvas]"),we=document.elementFromPoint(be,Ye)?.closest("[data-team-key]");return we&&ue?.contains(we)&&o.some(me=>me.key===we.dataset.teamKey)?we:null},ne=be=>{const Ye=F.current;if(!Ye||be.pointerId!==Ye.id)return;if(be.buttons===0){ee();return}if(!Ye.moved&&Math.hypot(be.clientX-Ye.x,be.clientY-Ye.y)<5)return;Ye.moved=!0,be.currentTarget.setPointerCapture(be.pointerId);const ue=oe(be.clientX,be.clientY);pe.current!==ue&&(pe.current?.removeAttribute("data-computer-dropping"),ue?.setAttribute("data-computer-dropping","true"),pe.current=ue);const we=ue?o.find(me=>me.key===ue.dataset.teamKey):null;Ne({name:Ye.computer.name,x:be.clientX,y:be.clientY,hint:we?Ye.computer.section!==null&&Ye.computer.section!==we.key?"Unassign before moving to another team":`Assign to ${we.name}`:"Drop onto a team"})},Ce=be=>{const Ye=F.current;if(!Ye||Ye.id!==be.pointerId)return;const ue=Ye.moved?oe(be.clientX,be.clientY)?.dataset.teamKey:void 0;ee(),ue!==void 0&&X(Ye.computer,ue)},le=f.useCallback(async()=>{P.current?.abort();const be=new AbortController;P.current=be,g(!0);try{const Ye=await Z("/api/team-computers",{signal:AbortSignal.any([be.signal,AbortSignal.timeout(3e4)])});if(be.signal.aborted||!z.current)return;p(Ye),k(""),L.current(Ye.computers)}catch(Ye){!be.signal.aborted&&z.current&&k(Ye instanceof Error?Ye.message:String(Ye))}finally{!be.signal.aborted&&z.current&&g(!1)}},[]);f.useEffect(()=>(z.current=!0,le(),()=>{z.current=!1,P.current?.abort()}),[le]),f.useEffect(()=>{if(!e)return;le();const be=window.setInterval(()=>{!T.current&&document.visibilityState==="visible"&&le()},2e4);return()=>window.clearInterval(be)},[e,le]),f.useEffect(()=>{t>0&&j(!0)},[t]),f.useEffect(()=>{if(!e)return;const be=document.activeElement instanceof HTMLElement?document.activeElement:null;return O.current?.focus(),()=>{be?.isConnected&&be.focus()}},[e]),f.useEffect(()=>{e&&C&&B.current?.focus()},[e,C]),f.useEffect(()=>{if(!a)return;const be=d?.computers.find(Ye=>Ye.id===a.id);be&&X(be,a.section),s()},[a,d,s,X]);const re=async(be,Ye,ue,we)=>{if(!T.current){T.current=!0,N(be),x(""),P.current?.abort();try{const me=await Ye();z.current&&ue?.(me)}catch(me){z.current&&(x(me instanceof Error?me.message:String(me)),we?.())}finally{T.current=!1,z.current&&(N(null),await le())}}},xe=f.useCallback(()=>H(null),[]),Te=(be,Ye,ue={})=>Z(`/api/team-computers/${encodeURIComponent(be)}/${Ye}`,{method:"POST",body:JSON.stringify(ue)}),nt=()=>{i(),c({type:"toggleAppSettings",open:!0,section:"computer"})};return n.jsxs(n.Fragment,{children:[e&&n.jsxs("aside",{ref:ae,"aria-label":"Team computers",onKeyDown:be=>{be.key==="Escape"&&!G&&(be.stopPropagation(),F.current?ee():i())},className:"flex w-[300px] max-w-[90vw] shrink-0 flex-col border-l border-hairline/50 bg-panel max-sm:absolute max-sm:inset-y-0 max-sm:right-0 max-sm:z-30 max-sm:shadow-xl",children:[n.jsxs("header",{className:"flex items-center gap-2 border-b border-hairline/40 px-4 py-3",children:[n.jsx(Ea,{size:16,className:"text-ink-secondary"}),n.jsx("h2",{className:"flex-1 text-[13px] font-semibold",children:"Computers"}),n.jsx("button",{"aria-label":"Refresh computers",className:vs,disabled:h||w!==null,onClick:()=>{x(""),le()},children:n.jsx(vn,{size:14,className:h?"animate-spin":""})}),n.jsx("button",{ref:O,"aria-label":"Close computers",className:vs,onClick:i,children:n.jsx(jt,{size:15})})]}),n.jsxs("div",{className:"min-h-0 flex-1 space-y-3 overflow-y-auto p-4",children:[n.jsx("p",{className:"text-[12px] leading-relaxed text-ink-secondary",children:"Drag a computer onto a team, or choose its team below. Bots on Auto will use it."}),(b||v||d?.problem)&&n.jsx("p",{role:"alert",className:"rounded-lg bg-danger/10 p-3 text-[12px] text-danger",children:b||v||d?.problem}),d&&!d.configured&&n.jsxs("div",{className:"rounded-xl border border-hairline/50 p-3 text-[12px]",children:[n.jsx("p",{className:"text-ink-secondary",children:"Connect your Box account before creating a cloud computer."}),n.jsx("button",{className:`${vs} mt-2 border border-hairline/50`,onClick:nt,children:"Connect Box"})]}),C?n.jsxs("form",{className:"space-y-3 rounded-xl border border-hairline/60 bg-card p-3",onSubmit:be=>{be.preventDefault();const Ye=R.current??M.trim();!Ye||!d?.configured||(R.current=Ye,re("create",()=>Z("/api/team-computers",{method:"POST",body:JSON.stringify({name:Ye,requestId:A.current,acknowledgeCost:!0})}),()=>{E(""),j(!1),A.current=crypto.randomUUID(),R.current=null},()=>{R.current=null}))},children:[n.jsx("label",{className:"block text-[12px] font-medium",htmlFor:"canvas-computer-name",children:"New Box computer"}),n.jsx("input",{ref:B,id:"canvas-computer-name",className:lE,value:M,maxLength:60,placeholder:"e.g. Engineering desktop",disabled:w!==null||R.current!==null,onChange:be=>E(be.target.value)}),n.jsx("p",{className:"text-[11px] leading-relaxed text-ink-secondary",children:"Creates a cloud machine in your connected boat.dev account. Your Box plan and usage charges apply. It stays unassigned until you choose a team."}),n.jsxs("div",{className:"flex justify-end gap-1",children:[n.jsx("button",{type:"button",className:vs,disabled:w!==null,onClick:()=>j(!1),children:"Cancel"}),n.jsxs("button",{type:"submit",className:"flex items-center gap-2 rounded-lg bg-accent px-3 py-2 text-[12px] font-medium text-white disabled:opacity-40",disabled:!d?.configured||!M.trim()||w!==null,children:[w==="create"&&n.jsx(je,{size:13,className:"animate-spin"}),"Create Box"]})]})]}):n.jsxs("button",{className:"flex w-full items-center justify-center gap-2 rounded-xl border border-dashed border-hairline/60 px-3 py-3 text-[12px] text-ink-secondary hover:bg-control hover:text-ink",disabled:w!==null,onClick:()=>j(!0),children:[n.jsx(Sn,{size:14})," New Box computer"]}),d?.computers.map(be=>{const Ye=["idle","ready","running"].includes(be.state),ue=["init","provisioning","provisioned","cloning","starting"].includes(be.state),we=Q===be.id,me=be.held||we;return n.jsxs("article",{"data-computer-id":be.id,className:"rounded-xl border border-hairline/60 bg-card p-3",children:[n.jsxs("div",{"data-computer-drag-id":be.id,role:"group",tabIndex:-1,"aria-label":`Drag ${be.name} to a team`,onPointerDown:$e=>{T.current||F.current||$e.button!==0||!$e.isPrimary||($e.currentTarget.focus({preventScroll:!0}),F.current={id:$e.pointerId,x:$e.clientX,y:$e.clientY,moved:!1,computer:be,handle:$e.currentTarget},$e.currentTarget.setPointerCapture($e.pointerId))},onPointerMove:ne,onPointerUp:Ce,onPointerCancel:ee,onLostPointerCapture:()=>{F.current&&ee()},className:"flex touch-none select-none cursor-grab items-center gap-2.5 rounded-lg py-1 outline-none active:cursor-grabbing",children:[n.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-control text-ink-secondary",children:n.jsx($h,{size:18})}),n.jsxs("span",{className:"min-w-0",children:[n.jsx("span",{className:"block truncate text-[13px] font-medium",children:be.name}),n.jsxs("span",{className:"block text-[11px] text-ink-secondary",children:["Box · ",w===be.id?"Updating…":be.state]})]})]}),be.problem&&n.jsx("p",{className:"mt-2 text-[11px] text-danger",children:be.problem}),n.jsxs("label",{className:"sr-only",htmlFor:`computer-team-${be.id}`,children:["Team for ",be.name]}),n.jsxs("select",{id:`computer-team-${be.id}`,className:`${lE} mt-3`,disabled:w!==null,value:be.section===null?"unassigned":`team:${be.section}`,onChange:$e=>X(be,$e.target.value==="unassigned"?null:$e.target.value.slice(5)),children:[n.jsx("option",{value:"unassigned",children:"Not assigned"}),o.filter($e=>be.section===null||$e.key===be.section).map($e=>n.jsx("option",{value:`team:${$e.key}`,children:$e.name},$e.key))]}),be.section!==null&&n.jsx("p",{className:"mt-1.5 text-[10px] text-ink-secondary",children:"Unassign to move to another team."}),n.jsxs("div",{className:"mt-2 flex flex-wrap gap-1",children:[!Ye&&!ue&&n.jsx("button",{className:vs,title:"Starts this Box; your provider's usage charges apply",disabled:w!==null||me,onClick:()=>{re(be.id,()=>Te(be.id,"provision",{acknowledgeCost:!0}))},children:"Start / retry"}),Ye&&!me&&n.jsx("button",{className:vs,disabled:w!==null,onClick:()=>{re(be.id,()=>Te(be.id,"sleep"))},children:"Sleep"}),Ye&&n.jsxs("button",{className:`${vs} flex items-center gap-1.5`,title:"Pauses bot control while you use the desktop",disabled:w!==null,onClick:()=>{re(be.id,async()=>(await Te(be.id,"control",{action:"take",controlLeaseId:q.current}),W(be.id),Te(be.id,"join")),$e=>{typeof $e.joinUrl=="string"&&$e.joinUrl.startsWith("https://")&&U({id:be.id,url:$e.joinUrl})})},children:["Open desktop ",n.jsx(Mn,{size:11})]}),we&&n.jsx("button",{className:`${vs} text-accent`,disabled:w!==null,onClick:()=>{re(be.id,()=>Te(be.id,"control",{action:"release",controlLeaseId:q.current}),()=>{W(null),U(null)})},children:"Return to bots"}),be.held&&!we&&n.jsx("button",{className:vs,disabled:!0,title:"Another viewer has paused bot control on this desktop",children:"In use"})]}),$?.id===be.id&&n.jsx("a",{href:$.url,target:"_blank",rel:"noopener noreferrer",className:"mt-2 block rounded-lg px-3 py-2 text-[12px] text-accent hover:bg-control",children:"Open secure desktop ↗"})]},be.id)})]}),n.jsx("footer",{className:"border-t border-hairline/40 p-3",children:n.jsx("button",{className:`${vs} w-full text-left`,onClick:nt,children:"Local VM and other computers…"})})]}),ge&&ta.createPortal(n.jsxs("div",{role:"status",className:"pointer-events-none fixed z-[70] rounded-xl border border-accent/40 bg-card px-4 py-3 text-[12px] text-ink shadow-xl",style:{left:ge.x+14,top:ge.y+14},children:[n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx($h,{size:15}),ge.name]}),n.jsx("p",{className:"mt-1 text-[10px] text-ink-secondary",children:ge.hint})]}),document.body),n.jsx(na,{open:G!==null,tone:"neutral",title:G?.section===null?`Unassign ${G?.computer.name??"computer"}?`:`Assign ${G?.computer.name??"computer"} to ${G?.section||"General"}?`,body:G?.section===null?"This removes the team default. It does not stop or delete the machine, its files, or its logins. Review the bots' Auto routing before their next task.":"Bots on Auto in this team will share this computer's files and signed-in accounts. Explicit bot computer settings stay unchanged. Only one bot can use the desktop at a time. This does not move the OMB server or enable 24/7 hosting.",confirmLabel:G?.section===null?"Unassign computer":"Assign computer",onCancel:xe,onConfirm:()=>{const be=G;be&&(H(null),U(null),re(be.computer.id,()=>Z(`/api/team-computers/${encodeURIComponent(be.computer.id)}`,{method:"PATCH",body:JSON.stringify({section:be.section,acknowledgeSharedAccess:!0})})))}})]})}function QRe({edge:e,bots:t}){const{dispatch:a}=ke(),o=t.find(r=>r.id===e.sourceBotId),i=t.find(r=>r.id===e.targetBotId);if(!o||!i)return null;const s=e.state!=="connected";return n.jsxs("button",{onClick:()=>a(e.groupId?{type:"select",id:e.groupId}:la(i)),className:"flex w-full items-center gap-3 rounded-xl border border-hairline/40 bg-card px-3 py-2.5 text-left transition hover:bg-raised/50",children:[n.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[n.jsx("span",{className:"truncate text-[13px] font-medium text-ink",children:o.name}),n.jsx(Mg,{size:13,className:V("shrink-0",s?"text-accent":"text-ink-secondary")}),n.jsx("span",{className:"truncate text-[13px] font-medium text-ink",children:i.name})]}),e.reason&&n.jsx("span",{className:"max-w-[220px] truncate text-[11.5px] text-ink-secondary",children:e.reason}),n.jsx("span",{className:V("rounded-full px-2 py-0.5 text-[10.5px] font-medium",e.state==="running"?"bg-success/15 text-success":e.state==="queued"?"bg-warning/15 text-warning":"bg-control text-ink-secondary"),children:e.state==="running"?"Running":e.state==="queued"?"Queued":e.lastAt?Ms(e.lastAt):"Connected"})]})}function XRe({section:e,label:t,onClose:a}){const o=f.useRef(null),i=f.useRef(null),s=f.useRef(a),r=f.useRef(!1),c=f.useRef(!1),[d,p]=f.useState(""),[h,g]=f.useState(""),[b,x]=f.useState(24e3),[v,k]=f.useState(null),[w,N]=f.useState(!0),[C,j]=f.useState(!1),[M,E]=f.useState(null),A=d!==h,R=f.useMemo(()=>new TextEncoder().encode(d).byteLength,[d]);s.current=a,r.current=C,c.current=A;const B=f.useCallback(()=>{r.current||c.current&&!window.confirm(l("team.instructionsDiscard"))||s.current()},[]);f.useEffect(()=>{const T=document.activeElement instanceof HTMLElement?document.activeElement:null;o.current?.focus();const z=P=>{if(P.key==="Escape"&&!r.current){P.preventDefault(),B();return}if(P.key!=="Tab")return;const L=o.current;if(!L)return;const G=[...L.querySelectorAll('button:not([disabled]), textarea:not([disabled]), input:not([disabled]), [href], [tabindex]:not([tabindex="-1"])')];if(G.length===0){P.preventDefault(),L.focus();return}const H=G[0],$=G[G.length-1];P.shiftKey&&document.activeElement===H?(P.preventDefault(),$.focus()):!P.shiftKey&&document.activeElement===$&&(P.preventDefault(),H.focus())};return window.addEventListener("keydown",z),()=>{window.removeEventListener("keydown",z),T?.focus()}},[B]),f.useEffect(()=>{let T=!1;return N(!0),E(null),Z(`/api/section-context?section=${encodeURIComponent(e)}`).then(z=>{T||(p(z.text),g(z.text),k(z.updatedAt),x(z.maxBytes),window.setTimeout(()=>i.current?.focus(),0))}).catch(z=>{T||E(z instanceof Error?z.message:String(z))}).finally(()=>{T||N(!1)}),()=>{T=!0}},[e]);const O=async()=>{if(!(R>b)){j(!0),E(null);try{const T=await Z(`/api/section-context?section=${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify({text:d})});g(T.text),p(T.text),k(T.updatedAt),x(T.maxBytes)}catch(T){E(T instanceof Error?T.message:String(T))}finally{j(!1)}}};return ta.createPortal(n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/55 p-4 backdrop-blur-[2px] sm:p-6",onMouseDown:T=>T.target===T.currentTarget&&B(),children:n.jsxs("div",{ref:o,role:"dialog","aria-modal":"true","aria-labelledby":"section-context-title",tabIndex:-1,className:"animate-pop-in flex max-h-[min(680px,calc(100dvh-2rem))] w-full max-w-[680px] flex-col overflow-hidden rounded-[24px] border border-hairline/50 bg-panel shadow-2xl shadow-black/50 outline-none",children:[n.jsxs("header",{className:"flex items-start justify-between gap-4 border-b border-hairline/40 px-6 pb-4 pt-6 sm:px-8 sm:pt-7",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Rs,{size:19,className:"text-accent"}),n.jsx("h2",{id:"section-context-title",className:"text-[20px] font-semibold tracking-[-0.01em] text-ink",children:l("team.instructionsTitle",{name:t})})]}),n.jsx("p",{className:"mt-1.5 max-w-[520px] text-[12.5px] leading-relaxed text-ink-secondary",children:l("team.instructionsHint")})]}),n.jsx("button",{onClick:B,disabled:C,"aria-label":l("team.instructionsClose"),className:"flex size-9 shrink-0 items-center justify-center rounded-lg text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-40",children:n.jsx(jt,{size:19})})]}),n.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 py-5 sm:px-8",children:[w?n.jsx("div",{className:"flex min-h-[260px] items-center justify-center text-ink-secondary",children:n.jsx(je,{size:20,className:"animate-spin","aria-label":l("team.instructionsLoading")})}):n.jsxs(n.Fragment,{children:[n.jsx("textarea",{ref:i,value:d,onChange:T=>p(T.target.value),placeholder:`Goals
|
|
607
607
|
- Ship the Windows onboarding refresh
|
|
608
608
|
|
|
609
609
|
Decisions
|