@tt-a1i/hive 2.1.6 → 2.1.8

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/src/server/agent-runtime-contract.d.ts +1 -9
  3. package/dist/src/server/agent-runtime.js +1 -7
  4. package/dist/src/server/agent-stdin-dispatcher.d.ts +2 -11
  5. package/dist/src/server/agent-stdin-dispatcher.js +14 -12
  6. package/dist/src/server/hive-team-guidance.js +12 -11
  7. package/dist/src/server/post-start-input-writer.js +1 -1
  8. package/dist/src/server/report-outbox-store.d.ts +10 -8
  9. package/dist/src/server/report-outbox-store.js +10 -1
  10. package/dist/src/server/role-templates.js +8 -4
  11. package/dist/src/server/routes-remote.js +46 -14
  12. package/dist/src/server/routes-team.js +1 -1
  13. package/dist/src/server/routes-workspaces.js +3 -6
  14. package/dist/src/server/runtime-store-contract.d.ts +2 -2
  15. package/dist/src/server/runtime-store-helpers.d.ts +4 -0
  16. package/dist/src/server/runtime-store-helpers.js +34 -11
  17. package/dist/src/server/runtime-store-worker-mutations.js +12 -6
  18. package/dist/src/server/runtime-store-workflows.js +7 -1
  19. package/dist/src/server/team-operations.d.ts +12 -5
  20. package/dist/src/server/team-operations.js +218 -159
  21. package/dist/src/shared/remote-bridge-routing.js +3 -1
  22. package/package.json +1 -1
  23. package/web/dist/assets/{AddWorkerDialog-DFNkbR_Q.js → AddWorkerDialog-Cd53ifv2.js} +2 -2
  24. package/web/dist/assets/{AddWorkspaceFlow-BjpjCuRe.js → AddWorkspaceFlow-3sR25gDy.js} +1 -1
  25. package/web/dist/assets/{FirstRunWizard-BuLgUAny.js → FirstRunWizard-DU8PipxA.js} +1 -1
  26. package/web/dist/assets/{MarketplaceDrawer-BALuhrnd.js → MarketplaceDrawer-BkNcknv0.js} +1 -1
  27. package/web/dist/assets/{TaskGraphDrawer-DQTS6JPI.js → TaskGraphDrawer-9mXNimSE.js} +1 -1
  28. package/web/dist/assets/{WhatsNewDialog-DpgjEIaA.js → WhatsNewDialog-C7awVYub.js} +1 -1
  29. package/web/dist/assets/WorkerModal-BzgrOKzF.js +1 -0
  30. package/web/dist/assets/{WorkflowsDrawer-DPWlZs4S.js → WorkflowsDrawer-C4yjTdY7.js} +1 -1
  31. package/web/dist/assets/{WorkspaceMemoryDrawer-C0vny4zK.js → WorkspaceMemoryDrawer-BlDznlGm.js} +1 -1
  32. package/web/dist/assets/{WorkspaceTaskDrawer-CJcFZh8C.js → WorkspaceTaskDrawer-CpGGZkp3.js} +1 -1
  33. package/web/dist/assets/index-BEyvsWk6.js +84 -0
  34. package/web/dist/assets/index-VHK8pAJq.css +1 -0
  35. package/web/dist/assets/{search-Bl5O-SfR.js → search-Cv0KnMjw.js} +1 -1
  36. package/web/dist/assets/{square-terminal-DCDaflg3.js → square-terminal-BZ7EavxU.js} +1 -1
  37. package/web/dist/index.html +2 -2
  38. package/web/dist/sw.js +1 -1
  39. package/web/dist/assets/WorkerModal-1y-Xdwv-.js +0 -1
  40. package/web/dist/assets/index-CEP_bvOg.css +0 -1
  41. package/web/dist/assets/index-CR1SPGBZ.js +0 -84
@@ -0,0 +1,84 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/WorkspaceTaskDrawer-CpGGZkp3.js","assets/TaskGraphDrawer-9mXNimSE.js","assets/AddWorkerDialog-Cd53ifv2.js","assets/search-Cv0KnMjw.js","assets/square-terminal-BZ7EavxU.js","assets/WorkflowsDrawer-C4yjTdY7.js","assets/WorkspaceMemoryDrawer-BlDznlGm.js"])))=>i.map(i=>d[i]);
2
+ function B2(t,a){for(var o=0;o<a.length;o++){const i=a[o];if(typeof i!="string"&&!Array.isArray(i)){for(const l in i)if(l!=="default"&&!(l in t)){const u=Object.getOwnPropertyDescriptor(i,l);u&&Object.defineProperty(t,l,u.get?u:{enumerable:!0,get:()=>i[l]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))i(l);new MutationObserver(l=>{for(const u of l)if(u.type==="childList")for(const f of u.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&i(f)}).observe(document,{childList:!0,subtree:!0});function o(l){const u={};return l.integrity&&(u.integrity=l.integrity),l.referrerPolicy&&(u.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?u.credentials="include":l.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function i(l){if(l.ep)return;l.ep=!0;const u=o(l);fetch(l.href,u)}})();function Ub(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Yd={exports:{}},_s={};var Xv;function U2(){if(Xv)return _s;Xv=1;var t=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function o(i,l,u){var f=null;if(u!==void 0&&(f=""+u),l.key!==void 0&&(f=""+l.key),"key"in l){u={};for(var m in l)m!=="key"&&(u[m]=l[m])}else u=l;return l=u.ref,{$$typeof:t,type:i,key:f,ref:l!==void 0?l:null,props:u}}return _s.Fragment=a,_s.jsx=o,_s.jsxs=o,_s}var Zv;function W2(){return Zv||(Zv=1,Yd.exports=U2()),Yd.exports}var c=W2(),$d={exports:{}},je={};var Qv;function I2(){if(Qv)return je;Qv=1;var t=Symbol.for("react.transitional.element"),a=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),f=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),k=Symbol.iterator;function S(R){return R===null||typeof R!="object"?null:(R=k&&R[k]||R["@@iterator"],typeof R=="function"?R:null)}var T={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,E={};function C(R,B,re){this.props=R,this.context=B,this.refs=E,this.updater=re||T}C.prototype.isReactComponent={},C.prototype.setState=function(R,B){if(typeof R!="object"&&typeof R!="function"&&R!=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,R,B,"setState")},C.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function j(){}j.prototype=C.prototype;function _(R,B,re){this.props=R,this.context=B,this.refs=E,this.updater=re||T}var N=_.prototype=new j;N.constructor=_,w(N,C.prototype),N.isPureReactComponent=!0;var O=Array.isArray;function M(){}var L={H:null,A:null,T:null,S:null},U=Object.prototype.hasOwnProperty;function q(R,B,re){var ne=re.ref;return{$$typeof:t,type:R,key:B,ref:ne!==void 0?ne:null,props:re}}function ae(R,B){return q(R.type,B,R.props)}function ee(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function F(R){var B={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(re){return B[re]})}var J=/\/+/g;function X(R,B){return typeof R=="object"&&R!==null&&R.key!=null?F(""+R.key):B.toString(36)}function $(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(M,M):(R.status="pending",R.then(function(B){R.status==="pending"&&(R.status="fulfilled",R.value=B)},function(B){R.status==="pending"&&(R.status="rejected",R.reason=B)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function D(R,B,re,ne,de){var fe=typeof R;(fe==="undefined"||fe==="boolean")&&(R=null);var ue=!1;if(R===null)ue=!0;else switch(fe){case"bigint":case"string":case"number":ue=!0;break;case"object":switch(R.$$typeof){case t:case a:ue=!0;break;case y:return ue=R._init,D(ue(R._payload),B,re,ne,de)}}if(ue)return de=de(R),ue=ne===""?"."+X(R,0):ne,O(de)?(re="",ue!=null&&(re=ue.replace(J,"$&/")+"/"),D(de,B,re,"",function(ce){return ce})):de!=null&&(ee(de)&&(de=ae(de,re+(de.key==null||R&&R.key===de.key?"":(""+de.key).replace(J,"$&/")+"/")+ue)),B.push(de)),1;ue=0;var ie=ne===""?".":ne+":";if(O(R))for(var le=0;le<R.length;le++)ne=R[le],fe=ie+X(ne,le),ue+=D(ne,B,re,fe,de);else if(le=S(R),typeof le=="function")for(R=le.call(R),le=0;!(ne=R.next()).done;)ne=ne.value,fe=ie+X(ne,le++),ue+=D(ne,B,re,fe,de);else if(fe==="object"){if(typeof R.then=="function")return D($(R),B,re,ne,de);throw B=String(R),Error("Objects are not valid as a React child (found: "+(B==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":B)+"). If you meant to render a collection of children, use an array instead.")}return ue}function P(R,B,re){if(R==null)return R;var ne=[],de=0;return D(R,ne,"","",function(fe){return B.call(re,fe,de++)}),ne}function I(R){if(R._status===-1){var B=R._result;B=B(),B.then(function(re){(R._status===0||R._status===-1)&&(R._status=1,R._result=re)},function(re){(R._status===0||R._status===-1)&&(R._status=2,R._result=re)}),R._status===-1&&(R._status=0,R._result=B)}if(R._status===1)return R._result.default;throw R._result}var V=typeof reportError=="function"?reportError:function(R){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var B=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof R=="object"&&R!==null&&typeof R.message=="string"?String(R.message):String(R),error:R});if(!window.dispatchEvent(B))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",R);return}console.error(R)},Z={map:P,forEach:function(R,B,re){P(R,function(){B.apply(this,arguments)},re)},count:function(R){var B=0;return P(R,function(){B++}),B},toArray:function(R){return P(R,function(B){return B})||[]},only:function(R){if(!ee(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};return je.Activity=v,je.Children=Z,je.Component=C,je.Fragment=o,je.Profiler=l,je.PureComponent=_,je.StrictMode=i,je.Suspense=g,je.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=L,je.__COMPILER_RUNTIME={__proto__:null,c:function(R){return L.H.useMemoCache(R)}},je.cache=function(R){return function(){return R.apply(null,arguments)}},je.cacheSignal=function(){return null},je.cloneElement=function(R,B,re){if(R==null)throw Error("The argument must be a React element, but you passed "+R+".");var ne=w({},R.props),de=R.key;if(B!=null)for(fe in B.key!==void 0&&(de=""+B.key),B)!U.call(B,fe)||fe==="key"||fe==="__self"||fe==="__source"||fe==="ref"&&B.ref===void 0||(ne[fe]=B[fe]);var fe=arguments.length-2;if(fe===1)ne.children=re;else if(1<fe){for(var ue=Array(fe),ie=0;ie<fe;ie++)ue[ie]=arguments[ie+2];ne.children=ue}return q(R.type,de,ne)},je.createContext=function(R){return R={$$typeof:f,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null},R.Provider=R,R.Consumer={$$typeof:u,_context:R},R},je.createElement=function(R,B,re){var ne,de={},fe=null;if(B!=null)for(ne in B.key!==void 0&&(fe=""+B.key),B)U.call(B,ne)&&ne!=="key"&&ne!=="__self"&&ne!=="__source"&&(de[ne]=B[ne]);var ue=arguments.length-2;if(ue===1)de.children=re;else if(1<ue){for(var ie=Array(ue),le=0;le<ue;le++)ie[le]=arguments[le+2];de.children=ie}if(R&&R.defaultProps)for(ne in ue=R.defaultProps,ue)de[ne]===void 0&&(de[ne]=ue[ne]);return q(R,fe,de)},je.createRef=function(){return{current:null}},je.forwardRef=function(R){return{$$typeof:m,render:R}},je.isValidElement=ee,je.lazy=function(R){return{$$typeof:y,_payload:{_status:-1,_result:R},_init:I}},je.memo=function(R,B){return{$$typeof:p,type:R,compare:B===void 0?null:B}},je.startTransition=function(R){var B=L.T,re={};L.T=re;try{var ne=R(),de=L.S;de!==null&&de(re,ne),typeof ne=="object"&&ne!==null&&typeof ne.then=="function"&&ne.then(M,V)}catch(fe){V(fe)}finally{B!==null&&re.types!==null&&(B.types=re.types),L.T=B}},je.unstable_useCacheRefresh=function(){return L.H.useCacheRefresh()},je.use=function(R){return L.H.use(R)},je.useActionState=function(R,B,re){return L.H.useActionState(R,B,re)},je.useCallback=function(R,B){return L.H.useCallback(R,B)},je.useContext=function(R){return L.H.useContext(R)},je.useDebugValue=function(){},je.useDeferredValue=function(R,B){return L.H.useDeferredValue(R,B)},je.useEffect=function(R,B){return L.H.useEffect(R,B)},je.useEffectEvent=function(R){return L.H.useEffectEvent(R)},je.useId=function(){return L.H.useId()},je.useImperativeHandle=function(R,B,re){return L.H.useImperativeHandle(R,B,re)},je.useInsertionEffect=function(R,B){return L.H.useInsertionEffect(R,B)},je.useLayoutEffect=function(R,B){return L.H.useLayoutEffect(R,B)},je.useMemo=function(R,B){return L.H.useMemo(R,B)},je.useOptimistic=function(R,B){return L.H.useOptimistic(R,B)},je.useReducer=function(R,B,re){return L.H.useReducer(R,B,re)},je.useRef=function(R){return L.H.useRef(R)},je.useState=function(R){return L.H.useState(R)},je.useSyncExternalStore=function(R,B,re){return L.H.useSyncExternalStore(R,B,re)},je.useTransition=function(){return L.H.useTransition()},je.version="19.2.5",je}var Jv;function bm(){return Jv||(Jv=1,$d.exports=I2()),$d.exports}var b=bm();const q2=Ub(b),Wb=B2({__proto__:null,default:q2},[b]);var Vd={exports:{}},Rs={},Gd={exports:{}},Xd={};var ey;function P2(){return ey||(ey=1,(function(t){function a(D,P){var I=D.length;D.push(P);e:for(;0<I;){var V=I-1>>>1,Z=D[V];if(0<l(Z,P))D[V]=P,D[I]=Z,I=V;else break e}}function o(D){return D.length===0?null:D[0]}function i(D){if(D.length===0)return null;var P=D[0],I=D.pop();if(I!==P){D[0]=I;e:for(var V=0,Z=D.length,R=Z>>>1;V<R;){var B=2*(V+1)-1,re=D[B],ne=B+1,de=D[ne];if(0>l(re,I))ne<Z&&0>l(de,re)?(D[V]=de,D[ne]=I,V=ne):(D[V]=re,D[B]=I,V=B);else if(ne<Z&&0>l(de,I))D[V]=de,D[ne]=I,V=ne;else break e}}return P}function l(D,P){var I=D.sortIndex-P.sortIndex;return I!==0?I:D.id-P.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;t.unstable_now=function(){return u.now()}}else{var f=Date,m=f.now();t.unstable_now=function(){return f.now()-m}}var g=[],p=[],y=1,v=null,k=3,S=!1,T=!1,w=!1,E=!1,C=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function N(D){for(var P=o(p);P!==null;){if(P.callback===null)i(p);else if(P.startTime<=D)i(p),P.sortIndex=P.expirationTime,a(g,P);else break;P=o(p)}}function O(D){if(w=!1,N(D),!T)if(o(g)!==null)T=!0,M||(M=!0,F());else{var P=o(p);P!==null&&$(O,P.startTime-D)}}var M=!1,L=-1,U=5,q=-1;function ae(){return E?!0:!(t.unstable_now()-q<U)}function ee(){if(E=!1,M){var D=t.unstable_now();q=D;var P=!0;try{e:{T=!1,w&&(w=!1,j(L),L=-1),S=!0;var I=k;try{t:{for(N(D),v=o(g);v!==null&&!(v.expirationTime>D&&ae());){var V=v.callback;if(typeof V=="function"){v.callback=null,k=v.priorityLevel;var Z=V(v.expirationTime<=D);if(D=t.unstable_now(),typeof Z=="function"){v.callback=Z,N(D),P=!0;break t}v===o(g)&&i(g),N(D)}else i(g);v=o(g)}if(v!==null)P=!0;else{var R=o(p);R!==null&&$(O,R.startTime-D),P=!1}}break e}finally{v=null,k=I,S=!1}P=void 0}}finally{P?F():M=!1}}}var F;if(typeof _=="function")F=function(){_(ee)};else if(typeof MessageChannel<"u"){var J=new MessageChannel,X=J.port2;J.port1.onmessage=ee,F=function(){X.postMessage(null)}}else F=function(){C(ee,0)};function $(D,P){L=C(function(){D(t.unstable_now())},P)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(D){D.callback=null},t.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<D?Math.floor(1e3/D):5},t.unstable_getCurrentPriorityLevel=function(){return k},t.unstable_next=function(D){switch(k){case 1:case 2:case 3:var P=3;break;default:P=k}var I=k;k=P;try{return D()}finally{k=I}},t.unstable_requestPaint=function(){E=!0},t.unstable_runWithPriority=function(D,P){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var I=k;k=D;try{return P()}finally{k=I}},t.unstable_scheduleCallback=function(D,P,I){var V=t.unstable_now();switch(typeof I=="object"&&I!==null?(I=I.delay,I=typeof I=="number"&&0<I?V+I:V):I=V,D){case 1:var Z=-1;break;case 2:Z=250;break;case 5:Z=1073741823;break;case 4:Z=1e4;break;default:Z=5e3}return Z=I+Z,D={id:y++,callback:P,priorityLevel:D,startTime:I,expirationTime:Z,sortIndex:-1},I>V?(D.sortIndex=I,a(p,D),o(g)===null&&D===o(p)&&(w?(j(L),L=-1):w=!0,$(O,I-V))):(D.sortIndex=Z,a(g,D),T||S||(T=!0,M||(M=!0,F()))),D},t.unstable_shouldYield=ae,t.unstable_wrapCallback=function(D){var P=k;return function(){var I=k;k=P;try{return D.apply(this,arguments)}finally{k=I}}}})(Xd)),Xd}var ty;function F2(){return ty||(ty=1,Gd.exports=P2()),Gd.exports}var Zd={exports:{}},kt={};var ny;function K2(){if(ny)return kt;ny=1;var t=bm();function a(g){var p="https://react.dev/errors/"+g;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)p+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+g+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(){}var i={d:{f:o,r:function(){throw Error(a(522))},D:o,C:o,L:o,m:o,X:o,S:o,M:o},p:0,findDOMNode:null},l=Symbol.for("react.portal");function u(g,p,y){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:v==null?null:""+v,children:g,containerInfo:p,implementation:y}}var f=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(g,p){if(g==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return kt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,kt.createPortal=function(g,p){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(a(299));return u(g,p,null,y)},kt.flushSync=function(g){var p=f.T,y=i.p;try{if(f.T=null,i.p=2,g)return g()}finally{f.T=p,i.p=y,i.d.f()}},kt.preconnect=function(g,p){typeof g=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,i.d.C(g,p))},kt.prefetchDNS=function(g){typeof g=="string"&&i.d.D(g)},kt.preinit=function(g,p){if(typeof g=="string"&&p&&typeof p.as=="string"){var y=p.as,v=m(y,p.crossOrigin),k=typeof p.integrity=="string"?p.integrity:void 0,S=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;y==="style"?i.d.S(g,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:v,integrity:k,fetchPriority:S}):y==="script"&&i.d.X(g,{crossOrigin:v,integrity:k,fetchPriority:S,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},kt.preinitModule=function(g,p){if(typeof g=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var y=m(p.as,p.crossOrigin);i.d.M(g,{crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&i.d.M(g)},kt.preload=function(g,p){if(typeof g=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var y=p.as,v=m(y,p.crossOrigin);i.d.L(g,y,{crossOrigin:v,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})}},kt.preloadModule=function(g,p){if(typeof g=="string")if(p){var y=m(p.as,p.crossOrigin);i.d.m(g,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else i.d.m(g)},kt.requestFormReset=function(g){i.d.r(g)},kt.unstable_batchedUpdates=function(g,p){return g(p)},kt.useFormState=function(g,p,y){return f.H.useFormState(g,p,y)},kt.useFormStatus=function(){return f.H.useHostTransitionStatus()},kt.version="19.2.5",kt}var ay;function Ib(){if(ay)return Zd.exports;ay=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(a){console.error(a)}}return t(),Zd.exports=K2(),Zd.exports}var ry;function Y2(){if(ry)return Rs;ry=1;var t=F2(),a=bm(),o=Ib();function i(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)n+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function u(e){var n=e,r=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(r=n.return),e=n.return;while(e)}return n.tag===3?r:null}function f(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function m(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function g(e){if(u(e)!==e)throw Error(i(188))}function p(e){var n=e.alternate;if(!n){if(n=u(e),n===null)throw Error(i(188));return n!==e?null:e}for(var r=e,s=n;;){var d=r.return;if(d===null)break;var h=d.alternate;if(h===null){if(s=d.return,s!==null){r=s;continue}break}if(d.child===h.child){for(h=d.child;h;){if(h===r)return g(d),e;if(h===s)return g(d),n;h=h.sibling}throw Error(i(188))}if(r.return!==s.return)r=d,s=h;else{for(var x=!1,A=d.child;A;){if(A===r){x=!0,r=d,s=h;break}if(A===s){x=!0,s=d,r=h;break}A=A.sibling}if(!x){for(A=h.child;A;){if(A===r){x=!0,r=h,s=d;break}if(A===s){x=!0,s=h,r=d;break}A=A.sibling}if(!x)throw Error(i(189))}}if(r.alternate!==s)throw Error(i(190))}if(r.tag!==3)throw Error(i(188));return r.stateNode.current===r?e:n}function y(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=y(e),n!==null)return n;e=e.sibling}return null}var v=Object.assign,k=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),T=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),j=Symbol.for("react.consumer"),_=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),q=Symbol.for("react.activity"),ae=Symbol.for("react.memo_cache_sentinel"),ee=Symbol.iterator;function F(e){return e===null||typeof e!="object"?null:(e=ee&&e[ee]||e["@@iterator"],typeof e=="function"?e:null)}var J=Symbol.for("react.client.reference");function X(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===J?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case w:return"Fragment";case C:return"Profiler";case E:return"StrictMode";case O:return"Suspense";case M:return"SuspenseList";case q:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case T:return"Portal";case _:return e.displayName||"Context";case j:return(e._context.displayName||"Context")+".Consumer";case N:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case L:return n=e.displayName||null,n!==null?n:X(e.type)||"Memo";case U:n=e._payload,e=e._init;try{return X(e(n))}catch{}}return null}var $=Array.isArray,D=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I={pending:!1,data:null,method:null,action:null},V=[],Z=-1;function R(e){return{current:e}}function B(e){0>Z||(e.current=V[Z],V[Z]=null,Z--)}function re(e,n){Z++,V[Z]=e.current,e.current=n}var ne=R(null),de=R(null),fe=R(null),ue=R(null);function ie(e,n){switch(re(fe,n),re(de,e),re(ne,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?bv(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=bv(n),e=wv(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}B(ne),re(ne,e)}function le(){B(ne),B(de),B(fe)}function ce(e){e.memoizedState!==null&&re(ue,e);var n=ne.current,r=wv(n,e.type);n!==r&&(re(de,e),re(ne,r))}function me(e){de.current===e&&(B(ne),B(de)),ue.current===e&&(B(ue),Ts._currentValue=I)}var Te,Ne;function Se(e){if(Te===void 0)try{throw Error()}catch(r){var n=r.stack.trim().match(/\n( *(at )?)/);Te=n&&n[1]||"",Ne=-1<r.stack.indexOf(`
3
+ at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
4
+ `+Te+e+Ne}var rt=!1;function xt(e,n){if(!e||rt)return"";rt=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(n){var se=function(){throw Error()};if(Object.defineProperty(se.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(se,[])}catch(Q){var G=Q}Reflect.construct(e,[],se)}else{try{se.call()}catch(Q){G=Q}e.call(se.prototype)}}else{try{throw Error()}catch(Q){G=Q}(se=e())&&typeof se.catch=="function"&&se.catch(function(){})}}catch(Q){if(Q&&G&&typeof Q.stack=="string")return[Q.stack,G.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var d=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");d&&d.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=s.DetermineComponentFrameRoot(),x=h[0],A=h[1];if(x&&A){var z=x.split(`
5
+ `),Y=A.split(`
6
+ `);for(d=s=0;s<z.length&&!z[s].includes("DetermineComponentFrameRoot");)s++;for(;d<Y.length&&!Y[d].includes("DetermineComponentFrameRoot");)d++;if(s===z.length||d===Y.length)for(s=z.length-1,d=Y.length-1;1<=s&&0<=d&&z[s]!==Y[d];)d--;for(;1<=s&&0<=d;s--,d--)if(z[s]!==Y[d]){if(s!==1||d!==1)do if(s--,d--,0>d||z[s]!==Y[d]){var te=`
7
+ `+z[s].replace(" at new "," at ");return e.displayName&&te.includes("<anonymous>")&&(te=te.replace("<anonymous>",e.displayName)),te}while(1<=s&&0<=d);break}}}finally{rt=!1,Error.prepareStackTrace=r}return(r=e?e.displayName||e.name:"")?Se(r):""}function Wt(e,n){switch(e.tag){case 26:case 27:case 5:return Se(e.type);case 16:return Se("Lazy");case 13:return e.child!==n&&n!==null?Se("Suspense Fallback"):Se("Suspense");case 19:return Se("SuspenseList");case 0:case 15:return xt(e.type,!1);case 11:return xt(e.type.render,!1);case 1:return xt(e.type,!0);case 31:return Se("Activity");default:return""}}function pn(e){try{var n="",r=null;do n+=Wt(e,r),r=e,e=e.return;while(e);return n}catch(s){return`
8
+ Error generating stack: `+s.message+`
9
+ `+s.stack}}var hn=Object.prototype.hasOwnProperty,Nn=t.unstable_scheduleCallback,tn=t.unstable_cancelCallback,ke=t.unstable_shouldYield,pe=t.unstable_requestPaint,Oe=t.unstable_now,Xa=t.unstable_getCurrentPriorityLevel,Ho=t.unstable_ImmediatePriority,Ee=t.unstable_UserBlockingPriority,Be=t.unstable_NormalPriority,ft=t.unstable_LowPriority,Za=t.unstable_IdlePriority,w1=t.log,x1=t.unstable_setDisableYieldValue,Bo=null,It=null;function ua(e){if(typeof w1=="function"&&x1(e),It&&typeof It.setStrictMode=="function")try{It.setStrictMode(Bo,e)}catch{}}var qt=Math.clz32?Math.clz32:E1,k1=Math.log,S1=Math.LN2;function E1(e){return e>>>=0,e===0?32:31-(k1(e)/S1|0)|0}var ii=256,li=262144,ci=4194304;function Qa(e){var n=e&42;if(n!==0)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ui(e,n,r){var s=e.pendingLanes;if(s===0)return 0;var d=0,h=e.suspendedLanes,x=e.pingedLanes;e=e.warmLanes;var A=s&134217727;return A!==0?(s=A&~h,s!==0?d=Qa(s):(x&=A,x!==0?d=Qa(x):r||(r=A&~e,r!==0&&(d=Qa(r))))):(A=s&~h,A!==0?d=Qa(A):x!==0?d=Qa(x):r||(r=s&~e,r!==0&&(d=Qa(r)))),d===0?0:n!==0&&n!==d&&(n&h)===0&&(h=d&-d,r=n&-n,h>=r||h===32&&(r&4194048)!==0)?n:d}function Uo(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function C1(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ep(){var e=ci;return ci<<=1,(ci&62914560)===0&&(ci=4194304),e}function Mc(e){for(var n=[],r=0;31>r;r++)n.push(e);return n}function Wo(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function T1(e,n,r,s,d,h){var x=e.pendingLanes;e.pendingLanes=r,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=r,e.entangledLanes&=r,e.errorRecoveryDisabledLanes&=r,e.shellSuspendCounter=0;var A=e.entanglements,z=e.expirationTimes,Y=e.hiddenUpdates;for(r=x&~r;0<r;){var te=31-qt(r),se=1<<te;A[te]=0,z[te]=-1;var G=Y[te];if(G!==null)for(Y[te]=null,te=0;te<G.length;te++){var Q=G[te];Q!==null&&(Q.lane&=-536870913)}r&=~se}s!==0&&tp(e,s,0),h!==0&&d===0&&e.tag!==0&&(e.suspendedLanes|=h&~(x&~n))}function tp(e,n,r){e.pendingLanes|=n,e.suspendedLanes&=~n;var s=31-qt(n);e.entangledLanes|=n,e.entanglements[s]=e.entanglements[s]|1073741824|r&261930}function np(e,n){var r=e.entangledLanes|=n;for(e=e.entanglements;r;){var s=31-qt(r),d=1<<s;d&n|e[s]&n&&(e[s]|=n),r&=~d}}function ap(e,n){var r=n&-n;return r=(r&42)!==0?1:Lc(r),(r&(e.suspendedLanes|n))!==0?0:r}function Lc(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function zc(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function rp(){var e=P.p;return e!==0?e:(e=window.event,e===void 0?32:Pv(e.type))}function op(e,n){var r=P.p;try{return P.p=e,n()}finally{P.p=r}}var da=Math.random().toString(36).slice(2),mt="__reactFiber$"+da,jt="__reactProps$"+da,Tr="__reactContainer$"+da,Hc="__reactEvents$"+da,N1="__reactListeners$"+da,j1="__reactHandles$"+da,sp="__reactResources$"+da,Io="__reactMarker$"+da;function Bc(e){delete e[mt],delete e[jt],delete e[Hc],delete e[N1],delete e[j1]}function Nr(e){var n=e[mt];if(n)return n;for(var r=e.parentNode;r;){if(n=r[Tr]||r[mt]){if(r=n.alternate,n.child!==null||r!==null&&r.child!==null)for(e=Nv(e);e!==null;){if(r=e[mt])return r;e=Nv(e)}return n}e=r,r=e.parentNode}return null}function jr(e){if(e=e[mt]||e[Tr]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function qo(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(i(33))}function Ar(e){var n=e[sp];return n||(n=e[sp]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function ut(e){e[Io]=!0}var ip=new Set,lp={};function Ja(e,n){_r(e,n),_r(e+"Capture",n)}function _r(e,n){for(lp[e]=n,e=0;e<n.length;e++)ip.add(n[e])}var A1=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),cp={},up={};function _1(e){return hn.call(up,e)?!0:hn.call(cp,e)?!1:A1.test(e)?up[e]=!0:(cp[e]=!0,!1)}function di(e,n,r){if(_1(n))if(r===null)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var s=n.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+r)}}function fi(e,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+r)}}function Wn(e,n,r,s){if(s===null)e.removeAttribute(r);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(r);return}e.setAttributeNS(n,r,""+s)}}function nn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function dp(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function R1(e,n,r){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var d=s.get,h=s.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return d.call(this)},set:function(x){r=""+x,h.call(this,x)}}),Object.defineProperty(e,n,{enumerable:s.enumerable}),{getValue:function(){return r},setValue:function(x){r=""+x},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function Uc(e){if(!e._valueTracker){var n=dp(e)?"checked":"value";e._valueTracker=R1(e,n,""+e[n])}}function fp(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var r=n.getValue(),s="";return e&&(s=dp(e)?e.checked?"true":"false":e.value),e=s,e!==r?(n.setValue(e),!0):!1}function mi(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var O1=/[\n"\\]/g;function an(e){return e.replace(O1,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Wc(e,n,r,s,d,h,x,A){e.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.type=x:e.removeAttribute("type"),n!=null?x==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+nn(n)):e.value!==""+nn(n)&&(e.value=""+nn(n)):x!=="submit"&&x!=="reset"||e.removeAttribute("value"),n!=null?Ic(e,x,nn(n)):r!=null?Ic(e,x,nn(r)):s!=null&&e.removeAttribute("value"),d==null&&h!=null&&(e.defaultChecked=!!h),d!=null&&(e.checked=d&&typeof d!="function"&&typeof d!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?e.name=""+nn(A):e.removeAttribute("name")}function mp(e,n,r,s,d,h,x,A){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.type=h),n!=null||r!=null){if(!(h!=="submit"&&h!=="reset"||n!=null)){Uc(e);return}r=r!=null?""+nn(r):"",n=n!=null?""+nn(n):r,A||n===e.value||(e.value=n),e.defaultValue=n}s=s??d,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=A?e.checked:!!s,e.defaultChecked=!!s,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.name=x),Uc(e)}function Ic(e,n,r){n==="number"&&mi(e.ownerDocument)===e||e.defaultValue===""+r||(e.defaultValue=""+r)}function Rr(e,n,r,s){if(e=e.options,n){n={};for(var d=0;d<r.length;d++)n["$"+r[d]]=!0;for(r=0;r<e.length;r++)d=n.hasOwnProperty("$"+e[r].value),e[r].selected!==d&&(e[r].selected=d),d&&s&&(e[r].defaultSelected=!0)}else{for(r=""+nn(r),n=null,d=0;d<e.length;d++){if(e[d].value===r){e[d].selected=!0,s&&(e[d].defaultSelected=!0);return}n!==null||e[d].disabled||(n=e[d])}n!==null&&(n.selected=!0)}}function pp(e,n,r){if(n!=null&&(n=""+nn(n),n!==e.value&&(e.value=n),r==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=r!=null?""+nn(r):""}function hp(e,n,r,s){if(n==null){if(s!=null){if(r!=null)throw Error(i(92));if($(s)){if(1<s.length)throw Error(i(93));s=s[0]}r=s}r==null&&(r=""),n=r}r=nn(n),e.defaultValue=r,s=e.textContent,s===r&&s!==""&&s!==null&&(e.value=s),Uc(e)}function Or(e,n){if(n){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=n;return}}e.textContent=n}var D1=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function gp(e,n,r){var s=n.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?s?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":s?e.setProperty(n,r):typeof r!="number"||r===0||D1.has(n)?n==="float"?e.cssFloat=r:e[n]=(""+r).trim():e[n]=r+"px"}function vp(e,n,r){if(n!=null&&typeof n!="object")throw Error(i(62));if(e=e.style,r!=null){for(var s in r)!r.hasOwnProperty(s)||n!=null&&n.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var d in n)s=n[d],n.hasOwnProperty(d)&&r[d]!==s&&gp(e,d,s)}else for(var h in n)n.hasOwnProperty(h)&&gp(e,h,n[h])}function qc(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var M1=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),L1=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function pi(e){return L1.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function In(){}var Pc=null;function Fc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Dr=null,Mr=null;function yp(e){var n=jr(e);if(n&&(e=n.stateNode)){var r=e[jt]||null;e:switch(e=n.stateNode,n.type){case"input":if(Wc(e,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),n=r.name,r.type==="radio"&&n!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+an(""+n)+'"][type="radio"]'),n=0;n<r.length;n++){var s=r[n];if(s!==e&&s.form===e.form){var d=s[jt]||null;if(!d)throw Error(i(90));Wc(s,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name)}}for(n=0;n<r.length;n++)s=r[n],s.form===e.form&&fp(s)}break e;case"textarea":pp(e,r.value,r.defaultValue);break e;case"select":n=r.value,n!=null&&Rr(e,!!r.multiple,n,!1)}}}var Kc=!1;function bp(e,n,r){if(Kc)return e(n,r);Kc=!0;try{var s=e(n);return s}finally{if(Kc=!1,(Dr!==null||Mr!==null)&&(tl(),Dr&&(n=Dr,e=Mr,Mr=Dr=null,yp(n),e)))for(n=0;n<e.length;n++)yp(e[n])}}function Po(e,n){var r=e.stateNode;if(r===null)return null;var s=r[jt]||null;if(s===null)return null;r=s[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(i(231,n,typeof r));return r}var qn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Yc=!1;if(qn)try{var Fo={};Object.defineProperty(Fo,"passive",{get:function(){Yc=!0}}),window.addEventListener("test",Fo,Fo),window.removeEventListener("test",Fo,Fo)}catch{Yc=!1}var fa=null,$c=null,hi=null;function wp(){if(hi)return hi;var e,n=$c,r=n.length,s,d="value"in fa?fa.value:fa.textContent,h=d.length;for(e=0;e<r&&n[e]===d[e];e++);var x=r-e;for(s=1;s<=x&&n[r-s]===d[h-s];s++);return hi=d.slice(e,1<s?1-s:void 0)}function gi(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function vi(){return!0}function xp(){return!1}function At(e){function n(r,s,d,h,x){this._reactName=r,this._targetInst=d,this.type=s,this.nativeEvent=h,this.target=x,this.currentTarget=null;for(var A in e)e.hasOwnProperty(A)&&(r=e[A],this[A]=r?r(h):h[A]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?vi:xp,this.isPropagationStopped=xp,this}return v(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=vi)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=vi)},persist:function(){},isPersistent:vi}),n}var er={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},yi=At(er),Ko=v({},er,{view:0,detail:0}),z1=At(Ko),Vc,Gc,Yo,bi=v({},Ko,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Zc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Yo&&(Yo&&e.type==="mousemove"?(Vc=e.screenX-Yo.screenX,Gc=e.screenY-Yo.screenY):Gc=Vc=0,Yo=e),Vc)},movementY:function(e){return"movementY"in e?e.movementY:Gc}}),kp=At(bi),H1=v({},bi,{dataTransfer:0}),B1=At(H1),U1=v({},Ko,{relatedTarget:0}),Xc=At(U1),W1=v({},er,{animationName:0,elapsedTime:0,pseudoElement:0}),I1=At(W1),q1=v({},er,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),P1=At(q1),F1=v({},er,{data:0}),Sp=At(F1),K1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Y1={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},$1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function V1(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=$1[e])?!!n[e]:!1}function Zc(){return V1}var G1=v({},Ko,{key:function(e){if(e.key){var n=K1[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=gi(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Y1[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Zc,charCode:function(e){return e.type==="keypress"?gi(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?gi(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),X1=At(G1),Z1=v({},bi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ep=At(Z1),Q1=v({},Ko,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Zc}),J1=At(Q1),ek=v({},er,{propertyName:0,elapsedTime:0,pseudoElement:0}),tk=At(ek),nk=v({},bi,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),ak=At(nk),rk=v({},er,{newState:0,oldState:0}),ok=At(rk),sk=[9,13,27,32],Qc=qn&&"CompositionEvent"in window,$o=null;qn&&"documentMode"in document&&($o=document.documentMode);var ik=qn&&"TextEvent"in window&&!$o,Cp=qn&&(!Qc||$o&&8<$o&&11>=$o),Tp=" ",Np=!1;function jp(e,n){switch(e){case"keyup":return sk.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ap(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Lr=!1;function lk(e,n){switch(e){case"compositionend":return Ap(n);case"keypress":return n.which!==32?null:(Np=!0,Tp);case"textInput":return e=n.data,e===Tp&&Np?null:e;default:return null}}function ck(e,n){if(Lr)return e==="compositionend"||!Qc&&jp(e,n)?(e=wp(),hi=$c=fa=null,Lr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return Cp&&n.locale!=="ko"?null:n.data;default:return null}}var uk={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function _p(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!uk[e.type]:n==="textarea"}function Rp(e,n,r,s){Dr?Mr?Mr.push(s):Mr=[s]:Dr=s,n=ll(n,"onChange"),0<n.length&&(r=new yi("onChange","change",null,r,s),e.push({event:r,listeners:n}))}var Vo=null,Go=null;function dk(e){mv(e,0)}function wi(e){var n=qo(e);if(fp(n))return e}function Op(e,n){if(e==="change")return n}var Dp=!1;if(qn){var Jc;if(qn){var eu="oninput"in document;if(!eu){var Mp=document.createElement("div");Mp.setAttribute("oninput","return;"),eu=typeof Mp.oninput=="function"}Jc=eu}else Jc=!1;Dp=Jc&&(!document.documentMode||9<document.documentMode)}function Lp(){Vo&&(Vo.detachEvent("onpropertychange",zp),Go=Vo=null)}function zp(e){if(e.propertyName==="value"&&wi(Go)){var n=[];Rp(n,Go,e,Fc(e)),bp(dk,n)}}function fk(e,n,r){e==="focusin"?(Lp(),Vo=n,Go=r,Vo.attachEvent("onpropertychange",zp)):e==="focusout"&&Lp()}function mk(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return wi(Go)}function pk(e,n){if(e==="click")return wi(n)}function hk(e,n){if(e==="input"||e==="change")return wi(n)}function gk(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var Pt=typeof Object.is=="function"?Object.is:gk;function Xo(e,n){if(Pt(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var r=Object.keys(e),s=Object.keys(n);if(r.length!==s.length)return!1;for(s=0;s<r.length;s++){var d=r[s];if(!hn.call(n,d)||!Pt(e[d],n[d]))return!1}return!0}function Hp(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Bp(e,n){var r=Hp(e);e=0;for(var s;r;){if(r.nodeType===3){if(s=e+r.textContent.length,e<=n&&s>=n)return{node:r,offset:n-e};e=s}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Hp(r)}}function Up(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Up(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Wp(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=mi(e.document);n instanceof e.HTMLIFrameElement;){try{var r=typeof n.contentWindow.location.href=="string"}catch{r=!1}if(r)e=n.contentWindow;else break;n=mi(e.document)}return n}function tu(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var vk=qn&&"documentMode"in document&&11>=document.documentMode,zr=null,nu=null,Zo=null,au=!1;function Ip(e,n,r){var s=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;au||zr==null||zr!==mi(s)||(s=zr,"selectionStart"in s&&tu(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Zo&&Xo(Zo,s)||(Zo=s,s=ll(nu,"onSelect"),0<s.length&&(n=new yi("onSelect","select",null,n,r),e.push({event:n,listeners:s}),n.target=zr)))}function tr(e,n){var r={};return r[e.toLowerCase()]=n.toLowerCase(),r["Webkit"+e]="webkit"+n,r["Moz"+e]="moz"+n,r}var Hr={animationend:tr("Animation","AnimationEnd"),animationiteration:tr("Animation","AnimationIteration"),animationstart:tr("Animation","AnimationStart"),transitionrun:tr("Transition","TransitionRun"),transitionstart:tr("Transition","TransitionStart"),transitioncancel:tr("Transition","TransitionCancel"),transitionend:tr("Transition","TransitionEnd")},ru={},qp={};qn&&(qp=document.createElement("div").style,"AnimationEvent"in window||(delete Hr.animationend.animation,delete Hr.animationiteration.animation,delete Hr.animationstart.animation),"TransitionEvent"in window||delete Hr.transitionend.transition);function nr(e){if(ru[e])return ru[e];if(!Hr[e])return e;var n=Hr[e],r;for(r in n)if(n.hasOwnProperty(r)&&r in qp)return ru[e]=n[r];return e}var Pp=nr("animationend"),Fp=nr("animationiteration"),Kp=nr("animationstart"),yk=nr("transitionrun"),bk=nr("transitionstart"),wk=nr("transitioncancel"),Yp=nr("transitionend"),$p=new Map,ou="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");ou.push("scrollEnd");function gn(e,n){$p.set(e,n),Ja(n,[e])}var xi=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},rn=[],Br=0,su=0;function ki(){for(var e=Br,n=su=Br=0;n<e;){var r=rn[n];rn[n++]=null;var s=rn[n];rn[n++]=null;var d=rn[n];rn[n++]=null;var h=rn[n];if(rn[n++]=null,s!==null&&d!==null){var x=s.pending;x===null?d.next=d:(d.next=x.next,x.next=d),s.pending=d}h!==0&&Vp(r,d,h)}}function Si(e,n,r,s){rn[Br++]=e,rn[Br++]=n,rn[Br++]=r,rn[Br++]=s,su|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function iu(e,n,r,s){return Si(e,n,r,s),Ei(e)}function ar(e,n){return Si(e,null,null,n),Ei(e)}function Vp(e,n,r){e.lanes|=r;var s=e.alternate;s!==null&&(s.lanes|=r);for(var d=!1,h=e.return;h!==null;)h.childLanes|=r,s=h.alternate,s!==null&&(s.childLanes|=r),h.tag===22&&(e=h.stateNode,e===null||e._visibility&1||(d=!0)),e=h,h=h.return;return e.tag===3?(h=e.stateNode,d&&n!==null&&(d=31-qt(r),e=h.hiddenUpdates,s=e[d],s===null?e[d]=[n]:s.push(n),n.lane=r|536870912),h):null}function Ei(e){if(50<bs)throw bs=0,gd=null,Error(i(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Ur={};function xk(e,n,r,s){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ft(e,n,r,s){return new xk(e,n,r,s)}function lu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Pn(e,n){var r=e.alternate;return r===null?(r=Ft(e.tag,n,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=n,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&65011712,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,n=e.dependencies,r.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function Gp(e,n){e.flags&=65011714;var r=e.alternate;return r===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=r.childLanes,e.lanes=r.lanes,e.child=r.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=r.memoizedProps,e.memoizedState=r.memoizedState,e.updateQueue=r.updateQueue,e.type=r.type,n=r.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function Ci(e,n,r,s,d,h){var x=0;if(s=e,typeof e=="function")lu(e)&&(x=1);else if(typeof e=="string")x=T2(e,r,ne.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case q:return e=Ft(31,r,n,d),e.elementType=q,e.lanes=h,e;case w:return rr(r.children,d,h,n);case E:x=8,d|=24;break;case C:return e=Ft(12,r,n,d|2),e.elementType=C,e.lanes=h,e;case O:return e=Ft(13,r,n,d),e.elementType=O,e.lanes=h,e;case M:return e=Ft(19,r,n,d),e.elementType=M,e.lanes=h,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case _:x=10;break e;case j:x=9;break e;case N:x=11;break e;case L:x=14;break e;case U:x=16,s=null;break e}x=29,r=Error(i(130,e===null?"null":typeof e,"")),s=null}return n=Ft(x,r,n,d),n.elementType=e,n.type=s,n.lanes=h,n}function rr(e,n,r,s){return e=Ft(7,e,s,n),e.lanes=r,e}function cu(e,n,r){return e=Ft(6,e,null,n),e.lanes=r,e}function Xp(e){var n=Ft(18,null,null,0);return n.stateNode=e,n}function uu(e,n,r){return n=Ft(4,e.children!==null?e.children:[],e.key,n),n.lanes=r,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var Zp=new WeakMap;function on(e,n){if(typeof e=="object"&&e!==null){var r=Zp.get(e);return r!==void 0?r:(n={value:e,source:n,stack:pn(n)},Zp.set(e,n),n)}return{value:e,source:n,stack:pn(n)}}var Wr=[],Ir=0,Ti=null,Qo=0,sn=[],ln=0,ma=null,jn=1,An="";function Fn(e,n){Wr[Ir++]=Qo,Wr[Ir++]=Ti,Ti=e,Qo=n}function Qp(e,n,r){sn[ln++]=jn,sn[ln++]=An,sn[ln++]=ma,ma=e;var s=jn;e=An;var d=32-qt(s)-1;s&=~(1<<d),r+=1;var h=32-qt(n)+d;if(30<h){var x=d-d%5;h=(s&(1<<x)-1).toString(32),s>>=x,d-=x,jn=1<<32-qt(n)+d|r<<d|s,An=h+e}else jn=1<<h|r<<d|s,An=e}function du(e){e.return!==null&&(Fn(e,1),Qp(e,1,0))}function fu(e){for(;e===Ti;)Ti=Wr[--Ir],Wr[Ir]=null,Qo=Wr[--Ir],Wr[Ir]=null;for(;e===ma;)ma=sn[--ln],sn[ln]=null,An=sn[--ln],sn[ln]=null,jn=sn[--ln],sn[ln]=null}function Jp(e,n){sn[ln++]=jn,sn[ln++]=An,sn[ln++]=ma,jn=n.id,An=n.overflow,ma=e}var pt=null,Ge=null,He=!1,pa=null,cn=!1,mu=Error(i(519));function ha(e){var n=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Jo(on(n,e)),mu}function eh(e){var n=e.stateNode,r=e.type,s=e.memoizedProps;switch(n[mt]=e,n[jt]=s,r){case"dialog":Me("cancel",n),Me("close",n);break;case"iframe":case"object":case"embed":Me("load",n);break;case"video":case"audio":for(r=0;r<xs.length;r++)Me(xs[r],n);break;case"source":Me("error",n);break;case"img":case"image":case"link":Me("error",n),Me("load",n);break;case"details":Me("toggle",n);break;case"input":Me("invalid",n),mp(n,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":Me("invalid",n);break;case"textarea":Me("invalid",n),hp(n,s.value,s.defaultValue,s.children)}r=s.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||n.textContent===""+r||s.suppressHydrationWarning===!0||vv(n.textContent,r)?(s.popover!=null&&(Me("beforetoggle",n),Me("toggle",n)),s.onScroll!=null&&Me("scroll",n),s.onScrollEnd!=null&&Me("scrollend",n),s.onClick!=null&&(n.onclick=In),n=!0):n=!1,n||ha(e,!0)}function th(e){for(pt=e.return;pt;)switch(pt.tag){case 5:case 31:case 13:cn=!1;return;case 27:case 3:cn=!0;return;default:pt=pt.return}}function qr(e){if(e!==pt)return!1;if(!He)return th(e),He=!0,!1;var n=e.tag,r;if((r=n!==3&&n!==27)&&((r=n===5)&&(r=e.type,r=!(r!=="form"&&r!=="button")||Rd(e.type,e.memoizedProps)),r=!r),r&&Ge&&ha(e),th(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));Ge=Tv(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));Ge=Tv(e)}else n===27?(n=Ge,Aa(e.type)?(e=zd,zd=null,Ge=e):Ge=n):Ge=pt?dn(e.stateNode.nextSibling):null;return!0}function or(){Ge=pt=null,He=!1}function pu(){var e=pa;return e!==null&&(Dt===null?Dt=e:Dt.push.apply(Dt,e),pa=null),e}function Jo(e){pa===null?pa=[e]:pa.push(e)}var hu=R(null),sr=null,Kn=null;function ga(e,n,r){re(hu,n._currentValue),n._currentValue=r}function Yn(e){e._currentValue=hu.current,B(hu)}function gu(e,n,r){for(;e!==null;){var s=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,s!==null&&(s.childLanes|=n)):s!==null&&(s.childLanes&n)!==n&&(s.childLanes|=n),e===r)break;e=e.return}}function vu(e,n,r,s){var d=e.child;for(d!==null&&(d.return=e);d!==null;){var h=d.dependencies;if(h!==null){var x=d.child;h=h.firstContext;e:for(;h!==null;){var A=h;h=d;for(var z=0;z<n.length;z++)if(A.context===n[z]){h.lanes|=r,A=h.alternate,A!==null&&(A.lanes|=r),gu(h.return,r,e),s||(x=null);break e}h=A.next}}else if(d.tag===18){if(x=d.return,x===null)throw Error(i(341));x.lanes|=r,h=x.alternate,h!==null&&(h.lanes|=r),gu(x,r,e),x=null}else x=d.child;if(x!==null)x.return=d;else for(x=d;x!==null;){if(x===e){x=null;break}if(d=x.sibling,d!==null){d.return=x.return,x=d;break}x=x.return}d=x}}function Pr(e,n,r,s){e=null;for(var d=n,h=!1;d!==null;){if(!h){if((d.flags&524288)!==0)h=!0;else if((d.flags&262144)!==0)break}if(d.tag===10){var x=d.alternate;if(x===null)throw Error(i(387));if(x=x.memoizedProps,x!==null){var A=d.type;Pt(d.pendingProps.value,x.value)||(e!==null?e.push(A):e=[A])}}else if(d===ue.current){if(x=d.alternate,x===null)throw Error(i(387));x.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(e!==null?e.push(Ts):e=[Ts])}d=d.return}e!==null&&vu(n,e,r,s),n.flags|=262144}function Ni(e){for(e=e.firstContext;e!==null;){if(!Pt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ir(e){sr=e,Kn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ht(e){return nh(sr,e)}function ji(e,n){return sr===null&&ir(e),nh(e,n)}function nh(e,n){var r=n._currentValue;if(n={context:n,memoizedValue:r,next:null},Kn===null){if(e===null)throw Error(i(308));Kn=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Kn=Kn.next=n;return r}var kk=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(r,s){e.push(s)}};this.abort=function(){n.aborted=!0,e.forEach(function(r){return r()})}},Sk=t.unstable_scheduleCallback,Ek=t.unstable_NormalPriority,ot={$$typeof:_,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function yu(){return{controller:new kk,data:new Map,refCount:0}}function es(e){e.refCount--,e.refCount===0&&Sk(Ek,function(){e.controller.abort()})}var ts=null,bu=0,Fr=0,Kr=null;function Ck(e,n){if(ts===null){var r=ts=[];bu=0,Fr=kd(),Kr={status:"pending",value:void 0,then:function(s){r.push(s)}}}return bu++,n.then(ah,ah),n}function ah(){if(--bu===0&&ts!==null){Kr!==null&&(Kr.status="fulfilled");var e=ts;ts=null,Fr=0,Kr=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function Tk(e,n){var r=[],s={status:"pending",value:null,reason:null,then:function(d){r.push(d)}};return e.then(function(){s.status="fulfilled",s.value=n;for(var d=0;d<r.length;d++)(0,r[d])(n)},function(d){for(s.status="rejected",s.reason=d,d=0;d<r.length;d++)(0,r[d])(void 0)}),s}var rh=D.S;D.S=function(e,n){Ig=Oe(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Ck(e,n),rh!==null&&rh(e,n)};var lr=R(null);function wu(){var e=lr.current;return e!==null?e:$e.pooledCache}function Ai(e,n){n===null?re(lr,lr.current):re(lr,n.pool)}function oh(){var e=wu();return e===null?null:{parent:ot._currentValue,pool:e}}var Yr=Error(i(460)),xu=Error(i(474)),_i=Error(i(542)),Ri={then:function(){}};function sh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function ih(e,n,r){switch(r=e[r],r===void 0?e.push(n):r!==n&&(n.then(In,In),n=r),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,ch(e),e;default:if(typeof n.status=="string")n.then(In,In);else{if(e=$e,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=n,e.status="pending",e.then(function(s){if(n.status==="pending"){var d=n;d.status="fulfilled",d.value=s}},function(s){if(n.status==="pending"){var d=n;d.status="rejected",d.reason=s}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,ch(e),e}throw ur=n,Yr}}function cr(e){try{var n=e._init;return n(e._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(ur=r,Yr):r}}var ur=null;function lh(){if(ur===null)throw Error(i(459));var e=ur;return ur=null,e}function ch(e){if(e===Yr||e===_i)throw Error(i(483))}var $r=null,ns=0;function Oi(e){var n=ns;return ns+=1,$r===null&&($r=[]),ih($r,e,n)}function as(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function Di(e,n){throw n.$$typeof===k?Error(i(525)):(e=Object.prototype.toString.call(n),Error(i(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function uh(e){function n(W,H){if(e){var K=W.deletions;K===null?(W.deletions=[H],W.flags|=16):K.push(H)}}function r(W,H){if(!e)return null;for(;H!==null;)n(W,H),H=H.sibling;return null}function s(W){for(var H=new Map;W!==null;)W.key!==null?H.set(W.key,W):H.set(W.index,W),W=W.sibling;return H}function d(W,H){return W=Pn(W,H),W.index=0,W.sibling=null,W}function h(W,H,K){return W.index=K,e?(K=W.alternate,K!==null?(K=K.index,K<H?(W.flags|=67108866,H):K):(W.flags|=67108866,H)):(W.flags|=1048576,H)}function x(W){return e&&W.alternate===null&&(W.flags|=67108866),W}function A(W,H,K,oe){return H===null||H.tag!==6?(H=cu(K,W.mode,oe),H.return=W,H):(H=d(H,K),H.return=W,H)}function z(W,H,K,oe){var xe=K.type;return xe===w?te(W,H,K.props.children,oe,K.key):H!==null&&(H.elementType===xe||typeof xe=="object"&&xe!==null&&xe.$$typeof===U&&cr(xe)===H.type)?(H=d(H,K.props),as(H,K),H.return=W,H):(H=Ci(K.type,K.key,K.props,null,W.mode,oe),as(H,K),H.return=W,H)}function Y(W,H,K,oe){return H===null||H.tag!==4||H.stateNode.containerInfo!==K.containerInfo||H.stateNode.implementation!==K.implementation?(H=uu(K,W.mode,oe),H.return=W,H):(H=d(H,K.children||[]),H.return=W,H)}function te(W,H,K,oe,xe){return H===null||H.tag!==7?(H=rr(K,W.mode,oe,xe),H.return=W,H):(H=d(H,K),H.return=W,H)}function se(W,H,K){if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return H=cu(""+H,W.mode,K),H.return=W,H;if(typeof H=="object"&&H!==null){switch(H.$$typeof){case S:return K=Ci(H.type,H.key,H.props,null,W.mode,K),as(K,H),K.return=W,K;case T:return H=uu(H,W.mode,K),H.return=W,H;case U:return H=cr(H),se(W,H,K)}if($(H)||F(H))return H=rr(H,W.mode,K,null),H.return=W,H;if(typeof H.then=="function")return se(W,Oi(H),K);if(H.$$typeof===_)return se(W,ji(W,H),K);Di(W,H)}return null}function G(W,H,K,oe){var xe=H!==null?H.key:null;if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return xe!==null?null:A(W,H,""+K,oe);if(typeof K=="object"&&K!==null){switch(K.$$typeof){case S:return K.key===xe?z(W,H,K,oe):null;case T:return K.key===xe?Y(W,H,K,oe):null;case U:return K=cr(K),G(W,H,K,oe)}if($(K)||F(K))return xe!==null?null:te(W,H,K,oe,null);if(typeof K.then=="function")return G(W,H,Oi(K),oe);if(K.$$typeof===_)return G(W,H,ji(W,K),oe);Di(W,K)}return null}function Q(W,H,K,oe,xe){if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return W=W.get(K)||null,A(H,W,""+oe,xe);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case S:return W=W.get(oe.key===null?K:oe.key)||null,z(H,W,oe,xe);case T:return W=W.get(oe.key===null?K:oe.key)||null,Y(H,W,oe,xe);case U:return oe=cr(oe),Q(W,H,K,oe,xe)}if($(oe)||F(oe))return W=W.get(K)||null,te(H,W,oe,xe,null);if(typeof oe.then=="function")return Q(W,H,K,Oi(oe),xe);if(oe.$$typeof===_)return Q(W,H,K,ji(H,oe),xe);Di(H,oe)}return null}function he(W,H,K,oe){for(var xe=null,Ue=null,be=H,Re=H=0,ze=null;be!==null&&Re<K.length;Re++){be.index>Re?(ze=be,be=null):ze=be.sibling;var We=G(W,be,K[Re],oe);if(We===null){be===null&&(be=ze);break}e&&be&&We.alternate===null&&n(W,be),H=h(We,H,Re),Ue===null?xe=We:Ue.sibling=We,Ue=We,be=ze}if(Re===K.length)return r(W,be),He&&Fn(W,Re),xe;if(be===null){for(;Re<K.length;Re++)be=se(W,K[Re],oe),be!==null&&(H=h(be,H,Re),Ue===null?xe=be:Ue.sibling=be,Ue=be);return He&&Fn(W,Re),xe}for(be=s(be);Re<K.length;Re++)ze=Q(be,W,Re,K[Re],oe),ze!==null&&(e&&ze.alternate!==null&&be.delete(ze.key===null?Re:ze.key),H=h(ze,H,Re),Ue===null?xe=ze:Ue.sibling=ze,Ue=ze);return e&&be.forEach(function(Ma){return n(W,Ma)}),He&&Fn(W,Re),xe}function Ce(W,H,K,oe){if(K==null)throw Error(i(151));for(var xe=null,Ue=null,be=H,Re=H=0,ze=null,We=K.next();be!==null&&!We.done;Re++,We=K.next()){be.index>Re?(ze=be,be=null):ze=be.sibling;var Ma=G(W,be,We.value,oe);if(Ma===null){be===null&&(be=ze);break}e&&be&&Ma.alternate===null&&n(W,be),H=h(Ma,H,Re),Ue===null?xe=Ma:Ue.sibling=Ma,Ue=Ma,be=ze}if(We.done)return r(W,be),He&&Fn(W,Re),xe;if(be===null){for(;!We.done;Re++,We=K.next())We=se(W,We.value,oe),We!==null&&(H=h(We,H,Re),Ue===null?xe=We:Ue.sibling=We,Ue=We);return He&&Fn(W,Re),xe}for(be=s(be);!We.done;Re++,We=K.next())We=Q(be,W,Re,We.value,oe),We!==null&&(e&&We.alternate!==null&&be.delete(We.key===null?Re:We.key),H=h(We,H,Re),Ue===null?xe=We:Ue.sibling=We,Ue=We);return e&&be.forEach(function(H2){return n(W,H2)}),He&&Fn(W,Re),xe}function Ye(W,H,K,oe){if(typeof K=="object"&&K!==null&&K.type===w&&K.key===null&&(K=K.props.children),typeof K=="object"&&K!==null){switch(K.$$typeof){case S:e:{for(var xe=K.key;H!==null;){if(H.key===xe){if(xe=K.type,xe===w){if(H.tag===7){r(W,H.sibling),oe=d(H,K.props.children),oe.return=W,W=oe;break e}}else if(H.elementType===xe||typeof xe=="object"&&xe!==null&&xe.$$typeof===U&&cr(xe)===H.type){r(W,H.sibling),oe=d(H,K.props),as(oe,K),oe.return=W,W=oe;break e}r(W,H);break}else n(W,H);H=H.sibling}K.type===w?(oe=rr(K.props.children,W.mode,oe,K.key),oe.return=W,W=oe):(oe=Ci(K.type,K.key,K.props,null,W.mode,oe),as(oe,K),oe.return=W,W=oe)}return x(W);case T:e:{for(xe=K.key;H!==null;){if(H.key===xe)if(H.tag===4&&H.stateNode.containerInfo===K.containerInfo&&H.stateNode.implementation===K.implementation){r(W,H.sibling),oe=d(H,K.children||[]),oe.return=W,W=oe;break e}else{r(W,H);break}else n(W,H);H=H.sibling}oe=uu(K,W.mode,oe),oe.return=W,W=oe}return x(W);case U:return K=cr(K),Ye(W,H,K,oe)}if($(K))return he(W,H,K,oe);if(F(K)){if(xe=F(K),typeof xe!="function")throw Error(i(150));return K=xe.call(K),Ce(W,H,K,oe)}if(typeof K.then=="function")return Ye(W,H,Oi(K),oe);if(K.$$typeof===_)return Ye(W,H,ji(W,K),oe);Di(W,K)}return typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint"?(K=""+K,H!==null&&H.tag===6?(r(W,H.sibling),oe=d(H,K),oe.return=W,W=oe):(r(W,H),oe=cu(K,W.mode,oe),oe.return=W,W=oe),x(W)):r(W,H)}return function(W,H,K,oe){try{ns=0;var xe=Ye(W,H,K,oe);return $r=null,xe}catch(be){if(be===Yr||be===_i)throw be;var Ue=Ft(29,be,null,W.mode);return Ue.lanes=oe,Ue.return=W,Ue}}}var dr=uh(!0),dh=uh(!1),va=!1;function ku(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Su(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ya(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ba(e,n,r){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Ie&2)!==0){var d=s.pending;return d===null?n.next=n:(n.next=d.next,d.next=n),s.pending=n,n=Ei(e),Vp(e,null,r),n}return Si(e,s,n,r),Ei(e)}function rs(e,n,r){if(n=n.updateQueue,n!==null&&(n=n.shared,(r&4194048)!==0)){var s=n.lanes;s&=e.pendingLanes,r|=s,n.lanes=r,np(e,r)}}function Eu(e,n){var r=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,r===s)){var d=null,h=null;if(r=r.firstBaseUpdate,r!==null){do{var x={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};h===null?d=h=x:h=h.next=x,r=r.next}while(r!==null);h===null?d=h=n:h=h.next=n}else d=h=n;r={baseState:s.baseState,firstBaseUpdate:d,lastBaseUpdate:h,shared:s.shared,callbacks:s.callbacks},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=n:e.next=n,r.lastBaseUpdate=n}var Cu=!1;function os(){if(Cu){var e=Kr;if(e!==null)throw e}}function ss(e,n,r,s){Cu=!1;var d=e.updateQueue;va=!1;var h=d.firstBaseUpdate,x=d.lastBaseUpdate,A=d.shared.pending;if(A!==null){d.shared.pending=null;var z=A,Y=z.next;z.next=null,x===null?h=Y:x.next=Y,x=z;var te=e.alternate;te!==null&&(te=te.updateQueue,A=te.lastBaseUpdate,A!==x&&(A===null?te.firstBaseUpdate=Y:A.next=Y,te.lastBaseUpdate=z))}if(h!==null){var se=d.baseState;x=0,te=Y=z=null,A=h;do{var G=A.lane&-536870913,Q=G!==A.lane;if(Q?(Le&G)===G:(s&G)===G){G!==0&&G===Fr&&(Cu=!0),te!==null&&(te=te.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var he=e,Ce=A;G=n;var Ye=r;switch(Ce.tag){case 1:if(he=Ce.payload,typeof he=="function"){se=he.call(Ye,se,G);break e}se=he;break e;case 3:he.flags=he.flags&-65537|128;case 0:if(he=Ce.payload,G=typeof he=="function"?he.call(Ye,se,G):he,G==null)break e;se=v({},se,G);break e;case 2:va=!0}}G=A.callback,G!==null&&(e.flags|=64,Q&&(e.flags|=8192),Q=d.callbacks,Q===null?d.callbacks=[G]:Q.push(G))}else Q={lane:G,tag:A.tag,payload:A.payload,callback:A.callback,next:null},te===null?(Y=te=Q,z=se):te=te.next=Q,x|=G;if(A=A.next,A===null){if(A=d.shared.pending,A===null)break;Q=A,A=Q.next,Q.next=null,d.lastBaseUpdate=Q,d.shared.pending=null}}while(!0);te===null&&(z=se),d.baseState=z,d.firstBaseUpdate=Y,d.lastBaseUpdate=te,h===null&&(d.shared.lanes=0),Ea|=x,e.lanes=x,e.memoizedState=se}}function fh(e,n){if(typeof e!="function")throw Error(i(191,e));e.call(n)}function mh(e,n){var r=e.callbacks;if(r!==null)for(e.callbacks=null,e=0;e<r.length;e++)fh(r[e],n)}var Vr=R(null),Mi=R(0);function ph(e,n){e=ta,re(Mi,e),re(Vr,n),ta=e|n.baseLanes}function Tu(){re(Mi,ta),re(Vr,Vr.current)}function Nu(){ta=Mi.current,B(Vr),B(Mi)}var Kt=R(null),un=null;function wa(e){var n=e.alternate;re(tt,tt.current&1),re(Kt,e),un===null&&(n===null||Vr.current!==null||n.memoizedState!==null)&&(un=e)}function ju(e){re(tt,tt.current),re(Kt,e),un===null&&(un=e)}function hh(e){e.tag===22?(re(tt,tt.current),re(Kt,e),un===null&&(un=e)):xa()}function xa(){re(tt,tt.current),re(Kt,Kt.current)}function Yt(e){B(Kt),un===e&&(un=null),B(tt)}var tt=R(0);function Li(e){for(var n=e;n!==null;){if(n.tag===13){var r=n.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||Md(r)||Ld(r)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var $n=0,_e=null,Fe=null,st=null,zi=!1,Gr=!1,fr=!1,Hi=0,is=0,Xr=null,Nk=0;function Je(){throw Error(i(321))}function Au(e,n){if(n===null)return!1;for(var r=0;r<n.length&&r<e.length;r++)if(!Pt(e[r],n[r]))return!1;return!0}function _u(e,n,r,s,d,h){return $n=h,_e=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,D.H=e===null||e.memoizedState===null?Qh:Ku,fr=!1,h=r(s,d),fr=!1,Gr&&(h=vh(n,r,s,d)),gh(e),h}function gh(e){D.H=us;var n=Fe!==null&&Fe.next!==null;if($n=0,st=Fe=_e=null,zi=!1,is=0,Xr=null,n)throw Error(i(300));e===null||it||(e=e.dependencies,e!==null&&Ni(e)&&(it=!0))}function vh(e,n,r,s){_e=e;var d=0;do{if(Gr&&(Xr=null),is=0,Gr=!1,25<=d)throw Error(i(301));if(d+=1,st=Fe=null,e.updateQueue!=null){var h=e.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}D.H=Jh,h=n(r,s)}while(Gr);return h}function jk(){var e=D.H,n=e.useState()[0];return n=typeof n.then=="function"?ls(n):n,e=e.useState()[0],(Fe!==null?Fe.memoizedState:null)!==e&&(_e.flags|=1024),n}function Ru(){var e=Hi!==0;return Hi=0,e}function Ou(e,n,r){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~r}function Du(e){if(zi){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}zi=!1}$n=0,st=Fe=_e=null,Gr=!1,is=Hi=0,Xr=null}function Tt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return st===null?_e.memoizedState=st=e:st=st.next=e,st}function nt(){if(Fe===null){var e=_e.alternate;e=e!==null?e.memoizedState:null}else e=Fe.next;var n=st===null?_e.memoizedState:st.next;if(n!==null)st=n,Fe=e;else{if(e===null)throw _e.alternate===null?Error(i(467)):Error(i(310));Fe=e,e={memoizedState:Fe.memoizedState,baseState:Fe.baseState,baseQueue:Fe.baseQueue,queue:Fe.queue,next:null},st===null?_e.memoizedState=st=e:st=st.next=e}return st}function Bi(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ls(e){var n=is;return is+=1,Xr===null&&(Xr=[]),e=ih(Xr,e,n),n=_e,(st===null?n.memoizedState:st.next)===null&&(n=n.alternate,D.H=n===null||n.memoizedState===null?Qh:Ku),e}function Ui(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ls(e);if(e.$$typeof===_)return ht(e)}throw Error(i(438,String(e)))}function Mu(e){var n=null,r=_e.updateQueue;if(r!==null&&(n=r.memoCache),n==null){var s=_e.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(n={data:s.data.map(function(d){return d.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),r===null&&(r=Bi(),_e.updateQueue=r),r.memoCache=n,r=n.data[n.index],r===void 0)for(r=n.data[n.index]=Array(e),s=0;s<e;s++)r[s]=ae;return n.index++,r}function Vn(e,n){return typeof n=="function"?n(e):n}function Wi(e){var n=nt();return Lu(n,Fe,e)}function Lu(e,n,r){var s=e.queue;if(s===null)throw Error(i(311));s.lastRenderedReducer=r;var d=e.baseQueue,h=s.pending;if(h!==null){if(d!==null){var x=d.next;d.next=h.next,h.next=x}n.baseQueue=d=h,s.pending=null}if(h=e.baseState,d===null)e.memoizedState=h;else{n=d.next;var A=x=null,z=null,Y=n,te=!1;do{var se=Y.lane&-536870913;if(se!==Y.lane?(Le&se)===se:($n&se)===se){var G=Y.revertLane;if(G===0)z!==null&&(z=z.next={lane:0,revertLane:0,gesture:null,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null}),se===Fr&&(te=!0);else if(($n&G)===G){Y=Y.next,G===Fr&&(te=!0);continue}else se={lane:0,revertLane:Y.revertLane,gesture:null,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null},z===null?(A=z=se,x=h):z=z.next=se,_e.lanes|=G,Ea|=G;se=Y.action,fr&&r(h,se),h=Y.hasEagerState?Y.eagerState:r(h,se)}else G={lane:se,revertLane:Y.revertLane,gesture:Y.gesture,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null},z===null?(A=z=G,x=h):z=z.next=G,_e.lanes|=se,Ea|=se;Y=Y.next}while(Y!==null&&Y!==n);if(z===null?x=h:z.next=A,!Pt(h,e.memoizedState)&&(it=!0,te&&(r=Kr,r!==null)))throw r;e.memoizedState=h,e.baseState=x,e.baseQueue=z,s.lastRenderedState=h}return d===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function zu(e){var n=nt(),r=n.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=e;var s=r.dispatch,d=r.pending,h=n.memoizedState;if(d!==null){r.pending=null;var x=d=d.next;do h=e(h,x.action),x=x.next;while(x!==d);Pt(h,n.memoizedState)||(it=!0),n.memoizedState=h,n.baseQueue===null&&(n.baseState=h),r.lastRenderedState=h}return[h,s]}function yh(e,n,r){var s=_e,d=nt(),h=He;if(h){if(r===void 0)throw Error(i(407));r=r()}else r=n();var x=!Pt((Fe||d).memoizedState,r);if(x&&(d.memoizedState=r,it=!0),d=d.queue,Uu(xh.bind(null,s,d,e),[e]),d.getSnapshot!==n||x||st!==null&&st.memoizedState.tag&1){if(s.flags|=2048,Zr(9,{destroy:void 0},wh.bind(null,s,d,r,n),null),$e===null)throw Error(i(349));h||($n&127)!==0||bh(s,n,r)}return r}function bh(e,n,r){e.flags|=16384,e={getSnapshot:n,value:r},n=_e.updateQueue,n===null?(n=Bi(),_e.updateQueue=n,n.stores=[e]):(r=n.stores,r===null?n.stores=[e]:r.push(e))}function wh(e,n,r,s){n.value=r,n.getSnapshot=s,kh(n)&&Sh(e)}function xh(e,n,r){return r(function(){kh(n)&&Sh(e)})}function kh(e){var n=e.getSnapshot;e=e.value;try{var r=n();return!Pt(e,r)}catch{return!0}}function Sh(e){var n=ar(e,2);n!==null&&Mt(n,e,2)}function Hu(e){var n=Tt();if(typeof e=="function"){var r=e;if(e=r(),fr){ua(!0);try{r()}finally{ua(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vn,lastRenderedState:e},n}function Eh(e,n,r,s){return e.baseState=r,Lu(e,Fe,typeof s=="function"?s:Vn)}function Ak(e,n,r,s,d){if(Pi(e))throw Error(i(485));if(e=n.action,e!==null){var h={payload:d,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){h.listeners.push(x)}};D.T!==null?r(!0):h.isTransition=!1,s(h),r=n.pending,r===null?(h.next=n.pending=h,Ch(n,h)):(h.next=r.next,n.pending=r.next=h)}}function Ch(e,n){var r=n.action,s=n.payload,d=e.state;if(n.isTransition){var h=D.T,x={};D.T=x;try{var A=r(d,s),z=D.S;z!==null&&z(x,A),Th(e,n,A)}catch(Y){Bu(e,n,Y)}finally{h!==null&&x.types!==null&&(h.types=x.types),D.T=h}}else try{h=r(d,s),Th(e,n,h)}catch(Y){Bu(e,n,Y)}}function Th(e,n,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(s){Nh(e,n,s)},function(s){return Bu(e,n,s)}):Nh(e,n,r)}function Nh(e,n,r){n.status="fulfilled",n.value=r,jh(n),e.state=r,n=e.pending,n!==null&&(r=n.next,r===n?e.pending=null:(r=r.next,n.next=r,Ch(e,r)))}function Bu(e,n,r){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do n.status="rejected",n.reason=r,jh(n),n=n.next;while(n!==s)}e.action=null}function jh(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function Ah(e,n){return n}function _h(e,n){if(He){var r=$e.formState;if(r!==null){e:{var s=_e;if(He){if(Ge){t:{for(var d=Ge,h=cn;d.nodeType!==8;){if(!h){d=null;break t}if(d=dn(d.nextSibling),d===null){d=null;break t}}h=d.data,d=h==="F!"||h==="F"?d:null}if(d){Ge=dn(d.nextSibling),s=d.data==="F!";break e}}ha(s)}s=!1}s&&(n=r[0])}}return r=Tt(),r.memoizedState=r.baseState=n,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ah,lastRenderedState:n},r.queue=s,r=Gh.bind(null,_e,s),s.dispatch=r,s=Hu(!1),h=Fu.bind(null,_e,!1,s.queue),s=Tt(),d={state:n,dispatch:null,action:e,pending:null},s.queue=d,r=Ak.bind(null,_e,d,h,r),d.dispatch=r,s.memoizedState=e,[n,r,!1]}function Rh(e){var n=nt();return Oh(n,Fe,e)}function Oh(e,n,r){if(n=Lu(e,n,Ah)[0],e=Wi(Vn)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var s=ls(n)}catch(x){throw x===Yr?_i:x}else s=n;n=nt();var d=n.queue,h=d.dispatch;return r!==n.memoizedState&&(_e.flags|=2048,Zr(9,{destroy:void 0},_k.bind(null,d,r),null)),[s,h,e]}function _k(e,n){e.action=n}function Dh(e){var n=nt(),r=Fe;if(r!==null)return Oh(n,r,e);nt(),n=n.memoizedState,r=nt();var s=r.queue.dispatch;return r.memoizedState=e,[n,s,!1]}function Zr(e,n,r,s){return e={tag:e,create:r,deps:s,inst:n,next:null},n=_e.updateQueue,n===null&&(n=Bi(),_e.updateQueue=n),r=n.lastEffect,r===null?n.lastEffect=e.next=e:(s=r.next,r.next=e,e.next=s,n.lastEffect=e),e}function Mh(){return nt().memoizedState}function Ii(e,n,r,s){var d=Tt();_e.flags|=e,d.memoizedState=Zr(1|n,{destroy:void 0},r,s===void 0?null:s)}function qi(e,n,r,s){var d=nt();s=s===void 0?null:s;var h=d.memoizedState.inst;Fe!==null&&s!==null&&Au(s,Fe.memoizedState.deps)?d.memoizedState=Zr(n,h,r,s):(_e.flags|=e,d.memoizedState=Zr(1|n,h,r,s))}function Lh(e,n){Ii(8390656,8,e,n)}function Uu(e,n){qi(2048,8,e,n)}function Rk(e){_e.flags|=4;var n=_e.updateQueue;if(n===null)n=Bi(),_e.updateQueue=n,n.events=[e];else{var r=n.events;r===null?n.events=[e]:r.push(e)}}function zh(e){var n=nt().memoizedState;return Rk({ref:n,nextImpl:e}),function(){if((Ie&2)!==0)throw Error(i(440));return n.impl.apply(void 0,arguments)}}function Hh(e,n){return qi(4,2,e,n)}function Bh(e,n){return qi(4,4,e,n)}function Uh(e,n){if(typeof n=="function"){e=e();var r=n(e);return function(){typeof r=="function"?r():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function Wh(e,n,r){r=r!=null?r.concat([e]):null,qi(4,4,Uh.bind(null,n,e),r)}function Wu(){}function Ih(e,n){var r=nt();n=n===void 0?null:n;var s=r.memoizedState;return n!==null&&Au(n,s[1])?s[0]:(r.memoizedState=[e,n],e)}function qh(e,n){var r=nt();n=n===void 0?null:n;var s=r.memoizedState;if(n!==null&&Au(n,s[1]))return s[0];if(s=e(),fr){ua(!0);try{e()}finally{ua(!1)}}return r.memoizedState=[s,n],s}function Iu(e,n,r){return r===void 0||($n&1073741824)!==0&&(Le&261930)===0?e.memoizedState=n:(e.memoizedState=r,e=Pg(),_e.lanes|=e,Ea|=e,r)}function Ph(e,n,r,s){return Pt(r,n)?r:Vr.current!==null?(e=Iu(e,r,s),Pt(e,n)||(it=!0),e):($n&42)===0||($n&1073741824)!==0&&(Le&261930)===0?(it=!0,e.memoizedState=r):(e=Pg(),_e.lanes|=e,Ea|=e,n)}function Fh(e,n,r,s,d){var h=P.p;P.p=h!==0&&8>h?h:8;var x=D.T,A={};D.T=A,Fu(e,!1,n,r);try{var z=d(),Y=D.S;if(Y!==null&&Y(A,z),z!==null&&typeof z=="object"&&typeof z.then=="function"){var te=Tk(z,s);cs(e,n,te,Gt(e))}else cs(e,n,s,Gt(e))}catch(se){cs(e,n,{then:function(){},status:"rejected",reason:se},Gt())}finally{P.p=h,x!==null&&A.types!==null&&(x.types=A.types),D.T=x}}function Ok(){}function qu(e,n,r,s){if(e.tag!==5)throw Error(i(476));var d=Kh(e).queue;Fh(e,d,n,I,r===null?Ok:function(){return Yh(e),r(s)})}function Kh(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:I,baseState:I,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vn,lastRenderedState:I},next:null};var r={};return n.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vn,lastRenderedState:r},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function Yh(e){var n=Kh(e);n.next===null&&(n=e.alternate.memoizedState),cs(e,n.next.queue,{},Gt())}function Pu(){return ht(Ts)}function $h(){return nt().memoizedState}function Vh(){return nt().memoizedState}function Dk(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var r=Gt();e=ya(r);var s=ba(n,e,r);s!==null&&(Mt(s,n,r),rs(s,n,r)),n={cache:yu()},e.payload=n;return}n=n.return}}function Mk(e,n,r){var s=Gt();r={lane:s,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Pi(e)?Xh(n,r):(r=iu(e,n,r,s),r!==null&&(Mt(r,e,s),Zh(r,n,s)))}function Gh(e,n,r){var s=Gt();cs(e,n,r,s)}function cs(e,n,r,s){var d={lane:s,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(Pi(e))Xh(n,d);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var x=n.lastRenderedState,A=h(x,r);if(d.hasEagerState=!0,d.eagerState=A,Pt(A,x))return Si(e,n,d,0),$e===null&&ki(),!1}catch{}if(r=iu(e,n,d,s),r!==null)return Mt(r,e,s),Zh(r,n,s),!0}return!1}function Fu(e,n,r,s){if(s={lane:2,revertLane:kd(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Pi(e)){if(n)throw Error(i(479))}else n=iu(e,r,s,2),n!==null&&Mt(n,e,2)}function Pi(e){var n=e.alternate;return e===_e||n!==null&&n===_e}function Xh(e,n){Gr=zi=!0;var r=e.pending;r===null?n.next=n:(n.next=r.next,r.next=n),e.pending=n}function Zh(e,n,r){if((r&4194048)!==0){var s=n.lanes;s&=e.pendingLanes,r|=s,n.lanes=r,np(e,r)}}var us={readContext:ht,use:Ui,useCallback:Je,useContext:Je,useEffect:Je,useImperativeHandle:Je,useLayoutEffect:Je,useInsertionEffect:Je,useMemo:Je,useReducer:Je,useRef:Je,useState:Je,useDebugValue:Je,useDeferredValue:Je,useTransition:Je,useSyncExternalStore:Je,useId:Je,useHostTransitionStatus:Je,useFormState:Je,useActionState:Je,useOptimistic:Je,useMemoCache:Je,useCacheRefresh:Je};us.useEffectEvent=Je;var Qh={readContext:ht,use:Ui,useCallback:function(e,n){return Tt().memoizedState=[e,n===void 0?null:n],e},useContext:ht,useEffect:Lh,useImperativeHandle:function(e,n,r){r=r!=null?r.concat([e]):null,Ii(4194308,4,Uh.bind(null,n,e),r)},useLayoutEffect:function(e,n){return Ii(4194308,4,e,n)},useInsertionEffect:function(e,n){Ii(4,2,e,n)},useMemo:function(e,n){var r=Tt();n=n===void 0?null:n;var s=e();if(fr){ua(!0);try{e()}finally{ua(!1)}}return r.memoizedState=[s,n],s},useReducer:function(e,n,r){var s=Tt();if(r!==void 0){var d=r(n);if(fr){ua(!0);try{r(n)}finally{ua(!1)}}}else d=n;return s.memoizedState=s.baseState=d,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:d},s.queue=e,e=e.dispatch=Mk.bind(null,_e,e),[s.memoizedState,e]},useRef:function(e){var n=Tt();return e={current:e},n.memoizedState=e},useState:function(e){e=Hu(e);var n=e.queue,r=Gh.bind(null,_e,n);return n.dispatch=r,[e.memoizedState,r]},useDebugValue:Wu,useDeferredValue:function(e,n){var r=Tt();return Iu(r,e,n)},useTransition:function(){var e=Hu(!1);return e=Fh.bind(null,_e,e.queue,!0,!1),Tt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,r){var s=_e,d=Tt();if(He){if(r===void 0)throw Error(i(407));r=r()}else{if(r=n(),$e===null)throw Error(i(349));(Le&127)!==0||bh(s,n,r)}d.memoizedState=r;var h={value:r,getSnapshot:n};return d.queue=h,Lh(xh.bind(null,s,h,e),[e]),s.flags|=2048,Zr(9,{destroy:void 0},wh.bind(null,s,h,r,n),null),r},useId:function(){var e=Tt(),n=$e.identifierPrefix;if(He){var r=An,s=jn;r=(s&~(1<<32-qt(s)-1)).toString(32)+r,n="_"+n+"R_"+r,r=Hi++,0<r&&(n+="H"+r.toString(32)),n+="_"}else r=Nk++,n="_"+n+"r_"+r.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Pu,useFormState:_h,useActionState:_h,useOptimistic:function(e){var n=Tt();n.memoizedState=n.baseState=e;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=r,n=Fu.bind(null,_e,!0,r),r.dispatch=n,[e,n]},useMemoCache:Mu,useCacheRefresh:function(){return Tt().memoizedState=Dk.bind(null,_e)},useEffectEvent:function(e){var n=Tt(),r={impl:e};return n.memoizedState=r,function(){if((Ie&2)!==0)throw Error(i(440));return r.impl.apply(void 0,arguments)}}},Ku={readContext:ht,use:Ui,useCallback:Ih,useContext:ht,useEffect:Uu,useImperativeHandle:Wh,useInsertionEffect:Hh,useLayoutEffect:Bh,useMemo:qh,useReducer:Wi,useRef:Mh,useState:function(){return Wi(Vn)},useDebugValue:Wu,useDeferredValue:function(e,n){var r=nt();return Ph(r,Fe.memoizedState,e,n)},useTransition:function(){var e=Wi(Vn)[0],n=nt().memoizedState;return[typeof e=="boolean"?e:ls(e),n]},useSyncExternalStore:yh,useId:$h,useHostTransitionStatus:Pu,useFormState:Rh,useActionState:Rh,useOptimistic:function(e,n){var r=nt();return Eh(r,Fe,e,n)},useMemoCache:Mu,useCacheRefresh:Vh};Ku.useEffectEvent=zh;var Jh={readContext:ht,use:Ui,useCallback:Ih,useContext:ht,useEffect:Uu,useImperativeHandle:Wh,useInsertionEffect:Hh,useLayoutEffect:Bh,useMemo:qh,useReducer:zu,useRef:Mh,useState:function(){return zu(Vn)},useDebugValue:Wu,useDeferredValue:function(e,n){var r=nt();return Fe===null?Iu(r,e,n):Ph(r,Fe.memoizedState,e,n)},useTransition:function(){var e=zu(Vn)[0],n=nt().memoizedState;return[typeof e=="boolean"?e:ls(e),n]},useSyncExternalStore:yh,useId:$h,useHostTransitionStatus:Pu,useFormState:Dh,useActionState:Dh,useOptimistic:function(e,n){var r=nt();return Fe!==null?Eh(r,Fe,e,n):(r.baseState=e,[e,r.queue.dispatch])},useMemoCache:Mu,useCacheRefresh:Vh};Jh.useEffectEvent=zh;function Yu(e,n,r,s){n=e.memoizedState,r=r(s,n),r=r==null?n:v({},n,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var $u={enqueueSetState:function(e,n,r){e=e._reactInternals;var s=Gt(),d=ya(s);d.payload=n,r!=null&&(d.callback=r),n=ba(e,d,s),n!==null&&(Mt(n,e,s),rs(n,e,s))},enqueueReplaceState:function(e,n,r){e=e._reactInternals;var s=Gt(),d=ya(s);d.tag=1,d.payload=n,r!=null&&(d.callback=r),n=ba(e,d,s),n!==null&&(Mt(n,e,s),rs(n,e,s))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var r=Gt(),s=ya(r);s.tag=2,n!=null&&(s.callback=n),n=ba(e,s,r),n!==null&&(Mt(n,e,r),rs(n,e,r))}};function eg(e,n,r,s,d,h,x){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,h,x):n.prototype&&n.prototype.isPureReactComponent?!Xo(r,s)||!Xo(d,h):!0}function tg(e,n,r,s){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(r,s),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(r,s),n.state!==e&&$u.enqueueReplaceState(n,n.state,null)}function mr(e,n){var r=n;if("ref"in n){r={};for(var s in n)s!=="ref"&&(r[s]=n[s])}if(e=e.defaultProps){r===n&&(r=v({},r));for(var d in e)r[d]===void 0&&(r[d]=e[d])}return r}function ng(e){xi(e)}function ag(e){console.error(e)}function rg(e){xi(e)}function Fi(e,n){try{var r=e.onUncaughtError;r(n.value,{componentStack:n.stack})}catch(s){setTimeout(function(){throw s})}}function og(e,n,r){try{var s=e.onCaughtError;s(r.value,{componentStack:r.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(d){setTimeout(function(){throw d})}}function Vu(e,n,r){return r=ya(r),r.tag=3,r.payload={element:null},r.callback=function(){Fi(e,n)},r}function sg(e){return e=ya(e),e.tag=3,e}function ig(e,n,r,s){var d=r.type.getDerivedStateFromError;if(typeof d=="function"){var h=s.value;e.payload=function(){return d(h)},e.callback=function(){og(n,r,s)}}var x=r.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(e.callback=function(){og(n,r,s),typeof d!="function"&&(Ca===null?Ca=new Set([this]):Ca.add(this));var A=s.stack;this.componentDidCatch(s.value,{componentStack:A!==null?A:""})})}function Lk(e,n,r,s,d){if(r.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(n=r.alternate,n!==null&&Pr(n,r,d,!0),r=Kt.current,r!==null){switch(r.tag){case 31:case 13:return un===null?nl():r.alternate===null&&et===0&&(et=3),r.flags&=-257,r.flags|=65536,r.lanes=d,s===Ri?r.flags|=16384:(n=r.updateQueue,n===null?r.updateQueue=new Set([s]):n.add(s),bd(e,s,d)),!1;case 22:return r.flags|=65536,s===Ri?r.flags|=16384:(n=r.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([s])},r.updateQueue=n):(r=n.retryQueue,r===null?n.retryQueue=new Set([s]):r.add(s)),bd(e,s,d)),!1}throw Error(i(435,r.tag))}return bd(e,s,d),nl(),!1}if(He)return n=Kt.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=d,s!==mu&&(e=Error(i(422),{cause:s}),Jo(on(e,r)))):(s!==mu&&(n=Error(i(423),{cause:s}),Jo(on(n,r))),e=e.current.alternate,e.flags|=65536,d&=-d,e.lanes|=d,s=on(s,r),d=Vu(e.stateNode,s,d),Eu(e,d),et!==4&&(et=2)),!1;var h=Error(i(520),{cause:s});if(h=on(h,r),ys===null?ys=[h]:ys.push(h),et!==4&&(et=2),n===null)return!0;s=on(s,r),r=n;do{switch(r.tag){case 3:return r.flags|=65536,e=d&-d,r.lanes|=e,e=Vu(r.stateNode,s,e),Eu(r,e),!1;case 1:if(n=r.type,h=r.stateNode,(r.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(Ca===null||!Ca.has(h))))return r.flags|=65536,d&=-d,r.lanes|=d,d=sg(d),ig(d,e,r,s),Eu(r,d),!1}r=r.return}while(r!==null);return!1}var Gu=Error(i(461)),it=!1;function gt(e,n,r,s){n.child=e===null?dh(n,null,r,s):dr(n,e.child,r,s)}function lg(e,n,r,s,d){r=r.render;var h=n.ref;if("ref"in s){var x={};for(var A in s)A!=="ref"&&(x[A]=s[A])}else x=s;return ir(n),s=_u(e,n,r,x,h,d),A=Ru(),e!==null&&!it?(Ou(e,n,d),Gn(e,n,d)):(He&&A&&du(n),n.flags|=1,gt(e,n,s,d),n.child)}function cg(e,n,r,s,d){if(e===null){var h=r.type;return typeof h=="function"&&!lu(h)&&h.defaultProps===void 0&&r.compare===null?(n.tag=15,n.type=h,ug(e,n,h,s,d)):(e=Ci(r.type,null,s,n,n.mode,d),e.ref=n.ref,e.return=n,n.child=e)}if(h=e.child,!ad(e,d)){var x=h.memoizedProps;if(r=r.compare,r=r!==null?r:Xo,r(x,s)&&e.ref===n.ref)return Gn(e,n,d)}return n.flags|=1,e=Pn(h,s),e.ref=n.ref,e.return=n,n.child=e}function ug(e,n,r,s,d){if(e!==null){var h=e.memoizedProps;if(Xo(h,s)&&e.ref===n.ref)if(it=!1,n.pendingProps=s=h,ad(e,d))(e.flags&131072)!==0&&(it=!0);else return n.lanes=e.lanes,Gn(e,n,d)}return Xu(e,n,r,s,d)}function dg(e,n,r,s){var d=s.children,h=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if((n.flags&128)!==0){if(h=h!==null?h.baseLanes|r:r,e!==null){for(s=n.child=e.child,d=0;s!==null;)d=d|s.lanes|s.childLanes,s=s.sibling;s=d&~h}else s=0,n.child=null;return fg(e,n,h,r,s)}if((r&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ai(n,h!==null?h.cachePool:null),h!==null?ph(n,h):Tu(),hh(n);else return s=n.lanes=536870912,fg(e,n,h!==null?h.baseLanes|r:r,r,s)}else h!==null?(Ai(n,h.cachePool),ph(n,h),xa(),n.memoizedState=null):(e!==null&&Ai(n,null),Tu(),xa());return gt(e,n,d,r),n.child}function ds(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function fg(e,n,r,s,d){var h=wu();return h=h===null?null:{parent:ot._currentValue,pool:h},n.memoizedState={baseLanes:r,cachePool:h},e!==null&&Ai(n,null),Tu(),hh(n),e!==null&&Pr(e,n,s,!0),n.childLanes=d,null}function Ki(e,n){return n=$i({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function mg(e,n,r){return dr(n,e.child,null,r),e=Ki(n,n.pendingProps),e.flags|=2,Yt(n),n.memoizedState=null,e}function zk(e,n,r){var s=n.pendingProps,d=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(He){if(s.mode==="hidden")return e=Ki(n,s),n.lanes=536870912,ds(null,e);if(ju(n),(e=Ge)?(e=Cv(e,cn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:ma!==null?{id:jn,overflow:An}:null,retryLane:536870912,hydrationErrors:null},r=Xp(e),r.return=n,n.child=r,pt=n,Ge=null)):e=null,e===null)throw ha(n);return n.lanes=536870912,null}return Ki(n,s)}var h=e.memoizedState;if(h!==null){var x=h.dehydrated;if(ju(n),d)if(n.flags&256)n.flags&=-257,n=mg(e,n,r);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(i(558));else if(it||Pr(e,n,r,!1),d=(r&e.childLanes)!==0,it||d){if(s=$e,s!==null&&(x=ap(s,r),x!==0&&x!==h.retryLane))throw h.retryLane=x,ar(e,x),Mt(s,e,x),Gu;nl(),n=mg(e,n,r)}else e=h.treeContext,Ge=dn(x.nextSibling),pt=n,He=!0,pa=null,cn=!1,e!==null&&Jp(n,e),n=Ki(n,s),n.flags|=4096;return n}return e=Pn(e.child,{mode:s.mode,children:s.children}),e.ref=n.ref,n.child=e,e.return=n,e}function Yi(e,n){var r=n.ref;if(r===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(i(284));(e===null||e.ref!==r)&&(n.flags|=4194816)}}function Xu(e,n,r,s,d){return ir(n),r=_u(e,n,r,s,void 0,d),s=Ru(),e!==null&&!it?(Ou(e,n,d),Gn(e,n,d)):(He&&s&&du(n),n.flags|=1,gt(e,n,r,d),n.child)}function pg(e,n,r,s,d,h){return ir(n),n.updateQueue=null,r=vh(n,s,r,d),gh(e),s=Ru(),e!==null&&!it?(Ou(e,n,h),Gn(e,n,h)):(He&&s&&du(n),n.flags|=1,gt(e,n,r,h),n.child)}function hg(e,n,r,s,d){if(ir(n),n.stateNode===null){var h=Ur,x=r.contextType;typeof x=="object"&&x!==null&&(h=ht(x)),h=new r(s,h),n.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=$u,n.stateNode=h,h._reactInternals=n,h=n.stateNode,h.props=s,h.state=n.memoizedState,h.refs={},ku(n),x=r.contextType,h.context=typeof x=="object"&&x!==null?ht(x):Ur,h.state=n.memoizedState,x=r.getDerivedStateFromProps,typeof x=="function"&&(Yu(n,r,x,s),h.state=n.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(x=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),x!==h.state&&$u.enqueueReplaceState(h,h.state,null),ss(n,s,h,d),os(),h.state=n.memoizedState),typeof h.componentDidMount=="function"&&(n.flags|=4194308),s=!0}else if(e===null){h=n.stateNode;var A=n.memoizedProps,z=mr(r,A);h.props=z;var Y=h.context,te=r.contextType;x=Ur,typeof te=="object"&&te!==null&&(x=ht(te));var se=r.getDerivedStateFromProps;te=typeof se=="function"||typeof h.getSnapshotBeforeUpdate=="function",A=n.pendingProps!==A,te||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(A||Y!==x)&&tg(n,h,s,x),va=!1;var G=n.memoizedState;h.state=G,ss(n,s,h,d),os(),Y=n.memoizedState,A||G!==Y||va?(typeof se=="function"&&(Yu(n,r,se,s),Y=n.memoizedState),(z=va||eg(n,r,z,s,G,Y,x))?(te||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(n.flags|=4194308)):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=s,n.memoizedState=Y),h.props=s,h.state=Y,h.context=x,s=z):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),s=!1)}else{h=n.stateNode,Su(e,n),x=n.memoizedProps,te=mr(r,x),h.props=te,se=n.pendingProps,G=h.context,Y=r.contextType,z=Ur,typeof Y=="object"&&Y!==null&&(z=ht(Y)),A=r.getDerivedStateFromProps,(Y=typeof A=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(x!==se||G!==z)&&tg(n,h,s,z),va=!1,G=n.memoizedState,h.state=G,ss(n,s,h,d),os();var Q=n.memoizedState;x!==se||G!==Q||va||e!==null&&e.dependencies!==null&&Ni(e.dependencies)?(typeof A=="function"&&(Yu(n,r,A,s),Q=n.memoizedState),(te=va||eg(n,r,te,s,G,Q,z)||e!==null&&e.dependencies!==null&&Ni(e.dependencies))?(Y||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(s,Q,z),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(s,Q,z)),typeof h.componentDidUpdate=="function"&&(n.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof h.componentDidUpdate!="function"||x===e.memoizedProps&&G===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&G===e.memoizedState||(n.flags|=1024),n.memoizedProps=s,n.memoizedState=Q),h.props=s,h.state=Q,h.context=z,s=te):(typeof h.componentDidUpdate!="function"||x===e.memoizedProps&&G===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&G===e.memoizedState||(n.flags|=1024),s=!1)}return h=s,Yi(e,n),s=(n.flags&128)!==0,h||s?(h=n.stateNode,r=s&&typeof r.getDerivedStateFromError!="function"?null:h.render(),n.flags|=1,e!==null&&s?(n.child=dr(n,e.child,null,d),n.child=dr(n,null,r,d)):gt(e,n,r,d),n.memoizedState=h.state,e=n.child):e=Gn(e,n,d),e}function gg(e,n,r,s){return or(),n.flags|=256,gt(e,n,r,s),n.child}var Zu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Qu(e){return{baseLanes:e,cachePool:oh()}}function Ju(e,n,r){return e=e!==null?e.childLanes&~r:0,n&&(e|=Vt),e}function vg(e,n,r){var s=n.pendingProps,d=!1,h=(n.flags&128)!==0,x;if((x=h)||(x=e!==null&&e.memoizedState===null?!1:(tt.current&2)!==0),x&&(d=!0,n.flags&=-129),x=(n.flags&32)!==0,n.flags&=-33,e===null){if(He){if(d?wa(n):xa(),(e=Ge)?(e=Cv(e,cn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:ma!==null?{id:jn,overflow:An}:null,retryLane:536870912,hydrationErrors:null},r=Xp(e),r.return=n,n.child=r,pt=n,Ge=null)):e=null,e===null)throw ha(n);return Ld(e)?n.lanes=32:n.lanes=536870912,null}var A=s.children;return s=s.fallback,d?(xa(),d=n.mode,A=$i({mode:"hidden",children:A},d),s=rr(s,d,r,null),A.return=n,s.return=n,A.sibling=s,n.child=A,s=n.child,s.memoizedState=Qu(r),s.childLanes=Ju(e,x,r),n.memoizedState=Zu,ds(null,s)):(wa(n),ed(n,A))}var z=e.memoizedState;if(z!==null&&(A=z.dehydrated,A!==null)){if(h)n.flags&256?(wa(n),n.flags&=-257,n=td(e,n,r)):n.memoizedState!==null?(xa(),n.child=e.child,n.flags|=128,n=null):(xa(),A=s.fallback,d=n.mode,s=$i({mode:"visible",children:s.children},d),A=rr(A,d,r,null),A.flags|=2,s.return=n,A.return=n,s.sibling=A,n.child=s,dr(n,e.child,null,r),s=n.child,s.memoizedState=Qu(r),s.childLanes=Ju(e,x,r),n.memoizedState=Zu,n=ds(null,s));else if(wa(n),Ld(A)){if(x=A.nextSibling&&A.nextSibling.dataset,x)var Y=x.dgst;x=Y,s=Error(i(419)),s.stack="",s.digest=x,Jo({value:s,source:null,stack:null}),n=td(e,n,r)}else if(it||Pr(e,n,r,!1),x=(r&e.childLanes)!==0,it||x){if(x=$e,x!==null&&(s=ap(x,r),s!==0&&s!==z.retryLane))throw z.retryLane=s,ar(e,s),Mt(x,e,s),Gu;Md(A)||nl(),n=td(e,n,r)}else Md(A)?(n.flags|=192,n.child=e.child,n=null):(e=z.treeContext,Ge=dn(A.nextSibling),pt=n,He=!0,pa=null,cn=!1,e!==null&&Jp(n,e),n=ed(n,s.children),n.flags|=4096);return n}return d?(xa(),A=s.fallback,d=n.mode,z=e.child,Y=z.sibling,s=Pn(z,{mode:"hidden",children:s.children}),s.subtreeFlags=z.subtreeFlags&65011712,Y!==null?A=Pn(Y,A):(A=rr(A,d,r,null),A.flags|=2),A.return=n,s.return=n,s.sibling=A,n.child=s,ds(null,s),s=n.child,A=e.child.memoizedState,A===null?A=Qu(r):(d=A.cachePool,d!==null?(z=ot._currentValue,d=d.parent!==z?{parent:z,pool:z}:d):d=oh(),A={baseLanes:A.baseLanes|r,cachePool:d}),s.memoizedState=A,s.childLanes=Ju(e,x,r),n.memoizedState=Zu,ds(e.child,s)):(wa(n),r=e.child,e=r.sibling,r=Pn(r,{mode:"visible",children:s.children}),r.return=n,r.sibling=null,e!==null&&(x=n.deletions,x===null?(n.deletions=[e],n.flags|=16):x.push(e)),n.child=r,n.memoizedState=null,r)}function ed(e,n){return n=$i({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function $i(e,n){return e=Ft(22,e,null,n),e.lanes=0,e}function td(e,n,r){return dr(n,e.child,null,r),e=ed(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function yg(e,n,r){e.lanes|=n;var s=e.alternate;s!==null&&(s.lanes|=n),gu(e.return,n,r)}function nd(e,n,r,s,d,h){var x=e.memoizedState;x===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:s,tail:r,tailMode:d,treeForkCount:h}:(x.isBackwards=n,x.rendering=null,x.renderingStartTime=0,x.last=s,x.tail=r,x.tailMode=d,x.treeForkCount=h)}function bg(e,n,r){var s=n.pendingProps,d=s.revealOrder,h=s.tail;s=s.children;var x=tt.current,A=(x&2)!==0;if(A?(x=x&1|2,n.flags|=128):x&=1,re(tt,x),gt(e,n,s,r),s=He?Qo:0,!A&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&yg(e,r,n);else if(e.tag===19)yg(e,r,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(d){case"forwards":for(r=n.child,d=null;r!==null;)e=r.alternate,e!==null&&Li(e)===null&&(d=r),r=r.sibling;r=d,r===null?(d=n.child,n.child=null):(d=r.sibling,r.sibling=null),nd(n,!1,d,r,h,s);break;case"backwards":case"unstable_legacy-backwards":for(r=null,d=n.child,n.child=null;d!==null;){if(e=d.alternate,e!==null&&Li(e)===null){n.child=d;break}e=d.sibling,d.sibling=r,r=d,d=e}nd(n,!0,r,null,h,s);break;case"together":nd(n,!1,null,null,void 0,s);break;default:n.memoizedState=null}return n.child}function Gn(e,n,r){if(e!==null&&(n.dependencies=e.dependencies),Ea|=n.lanes,(r&n.childLanes)===0)if(e!==null){if(Pr(e,n,r,!1),(r&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(i(153));if(n.child!==null){for(e=n.child,r=Pn(e,e.pendingProps),n.child=r,r.return=n;e.sibling!==null;)e=e.sibling,r=r.sibling=Pn(e,e.pendingProps),r.return=n;r.sibling=null}return n.child}function ad(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Ni(e)))}function Hk(e,n,r){switch(n.tag){case 3:ie(n,n.stateNode.containerInfo),ga(n,ot,e.memoizedState.cache),or();break;case 27:case 5:ce(n);break;case 4:ie(n,n.stateNode.containerInfo);break;case 10:ga(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,ju(n),null;break;case 13:var s=n.memoizedState;if(s!==null)return s.dehydrated!==null?(wa(n),n.flags|=128,null):(r&n.child.childLanes)!==0?vg(e,n,r):(wa(n),e=Gn(e,n,r),e!==null?e.sibling:null);wa(n);break;case 19:var d=(e.flags&128)!==0;if(s=(r&n.childLanes)!==0,s||(Pr(e,n,r,!1),s=(r&n.childLanes)!==0),d){if(s)return bg(e,n,r);n.flags|=128}if(d=n.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),re(tt,tt.current),s)break;return null;case 22:return n.lanes=0,dg(e,n,r,n.pendingProps);case 24:ga(n,ot,e.memoizedState.cache)}return Gn(e,n,r)}function wg(e,n,r){if(e!==null)if(e.memoizedProps!==n.pendingProps)it=!0;else{if(!ad(e,r)&&(n.flags&128)===0)return it=!1,Hk(e,n,r);it=(e.flags&131072)!==0}else it=!1,He&&(n.flags&1048576)!==0&&Qp(n,Qo,n.index);switch(n.lanes=0,n.tag){case 16:e:{var s=n.pendingProps;if(e=cr(n.elementType),n.type=e,typeof e=="function")lu(e)?(s=mr(e,s),n.tag=1,n=hg(null,n,e,s,r)):(n.tag=0,n=Xu(null,n,e,s,r));else{if(e!=null){var d=e.$$typeof;if(d===N){n.tag=11,n=lg(null,n,e,s,r);break e}else if(d===L){n.tag=14,n=cg(null,n,e,s,r);break e}}throw n=X(e)||e,Error(i(306,n,""))}}return n;case 0:return Xu(e,n,n.type,n.pendingProps,r);case 1:return s=n.type,d=mr(s,n.pendingProps),hg(e,n,s,d,r);case 3:e:{if(ie(n,n.stateNode.containerInfo),e===null)throw Error(i(387));s=n.pendingProps;var h=n.memoizedState;d=h.element,Su(e,n),ss(n,s,null,r);var x=n.memoizedState;if(s=x.cache,ga(n,ot,s),s!==h.cache&&vu(n,[ot],r,!0),os(),s=x.element,h.isDehydrated)if(h={element:s,isDehydrated:!1,cache:x.cache},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){n=gg(e,n,s,r);break e}else if(s!==d){d=on(Error(i(424)),n),Jo(d),n=gg(e,n,s,r);break e}else for(e=n.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,Ge=dn(e.firstChild),pt=n,He=!0,pa=null,cn=!0,r=dh(n,null,s,r),n.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(or(),s===d){n=Gn(e,n,r);break e}gt(e,n,s,r)}n=n.child}return n;case 26:return Yi(e,n),e===null?(r=Rv(n.type,null,n.pendingProps,null))?n.memoizedState=r:He||(r=n.type,e=n.pendingProps,s=cl(fe.current).createElement(r),s[mt]=n,s[jt]=e,vt(s,r,e),ut(s),n.stateNode=s):n.memoizedState=Rv(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return ce(n),e===null&&He&&(s=n.stateNode=jv(n.type,n.pendingProps,fe.current),pt=n,cn=!0,d=Ge,Aa(n.type)?(zd=d,Ge=dn(s.firstChild)):Ge=d),gt(e,n,n.pendingProps.children,r),Yi(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&He&&((d=s=Ge)&&(s=m2(s,n.type,n.pendingProps,cn),s!==null?(n.stateNode=s,pt=n,Ge=dn(s.firstChild),cn=!1,d=!0):d=!1),d||ha(n)),ce(n),d=n.type,h=n.pendingProps,x=e!==null?e.memoizedProps:null,s=h.children,Rd(d,h)?s=null:x!==null&&Rd(d,x)&&(n.flags|=32),n.memoizedState!==null&&(d=_u(e,n,jk,null,null,r),Ts._currentValue=d),Yi(e,n),gt(e,n,s,r),n.child;case 6:return e===null&&He&&((e=r=Ge)&&(r=p2(r,n.pendingProps,cn),r!==null?(n.stateNode=r,pt=n,Ge=null,e=!0):e=!1),e||ha(n)),null;case 13:return vg(e,n,r);case 4:return ie(n,n.stateNode.containerInfo),s=n.pendingProps,e===null?n.child=dr(n,null,s,r):gt(e,n,s,r),n.child;case 11:return lg(e,n,n.type,n.pendingProps,r);case 7:return gt(e,n,n.pendingProps,r),n.child;case 8:return gt(e,n,n.pendingProps.children,r),n.child;case 12:return gt(e,n,n.pendingProps.children,r),n.child;case 10:return s=n.pendingProps,ga(n,n.type,s.value),gt(e,n,s.children,r),n.child;case 9:return d=n.type._context,s=n.pendingProps.children,ir(n),d=ht(d),s=s(d),n.flags|=1,gt(e,n,s,r),n.child;case 14:return cg(e,n,n.type,n.pendingProps,r);case 15:return ug(e,n,n.type,n.pendingProps,r);case 19:return bg(e,n,r);case 31:return zk(e,n,r);case 22:return dg(e,n,r,n.pendingProps);case 24:return ir(n),s=ht(ot),e===null?(d=wu(),d===null&&(d=$e,h=yu(),d.pooledCache=h,h.refCount++,h!==null&&(d.pooledCacheLanes|=r),d=h),n.memoizedState={parent:s,cache:d},ku(n),ga(n,ot,d)):((e.lanes&r)!==0&&(Su(e,n),ss(n,null,null,r),os()),d=e.memoizedState,h=n.memoizedState,d.parent!==s?(d={parent:s,cache:s},n.memoizedState=d,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=d),ga(n,ot,s)):(s=h.cache,ga(n,ot,s),s!==d.cache&&vu(n,[ot],r,!0))),gt(e,n,n.pendingProps.children,r),n.child;case 29:throw n.pendingProps}throw Error(i(156,n.tag))}function Xn(e){e.flags|=4}function rd(e,n,r,s,d){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(d&335544128)===d)if(e.stateNode.complete)e.flags|=8192;else if($g())e.flags|=8192;else throw ur=Ri,xu}else e.flags&=-16777217}function xg(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!zv(n))if($g())e.flags|=8192;else throw ur=Ri,xu}function Vi(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?ep():536870912,e.lanes|=n,to|=n)}function fs(e,n){if(!He)switch(e.tailMode){case"hidden":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var s=null;r!==null;)r.alternate!==null&&(s=r),r=r.sibling;s===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Xe(e){var n=e.alternate!==null&&e.alternate.child===e.child,r=0,s=0;if(n)for(var d=e.child;d!==null;)r|=d.lanes|d.childLanes,s|=d.subtreeFlags&65011712,s|=d.flags&65011712,d.return=e,d=d.sibling;else for(d=e.child;d!==null;)r|=d.lanes|d.childLanes,s|=d.subtreeFlags,s|=d.flags,d.return=e,d=d.sibling;return e.subtreeFlags|=s,e.childLanes=r,n}function Bk(e,n,r){var s=n.pendingProps;switch(fu(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Xe(n),null;case 1:return Xe(n),null;case 3:return r=n.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),n.memoizedState.cache!==s&&(n.flags|=2048),Yn(ot),le(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(qr(n)?Xn(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,pu())),Xe(n),null;case 26:var d=n.type,h=n.memoizedState;return e===null?(Xn(n),h!==null?(Xe(n),xg(n,h)):(Xe(n),rd(n,d,null,s,r))):h?h!==e.memoizedState?(Xn(n),Xe(n),xg(n,h)):(Xe(n),n.flags&=-16777217):(e=e.memoizedProps,e!==s&&Xn(n),Xe(n),rd(n,d,e,s,r)),null;case 27:if(me(n),r=fe.current,d=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==s&&Xn(n);else{if(!s){if(n.stateNode===null)throw Error(i(166));return Xe(n),null}e=ne.current,qr(n)?eh(n):(e=jv(d,s,r),n.stateNode=e,Xn(n))}return Xe(n),null;case 5:if(me(n),d=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==s&&Xn(n);else{if(!s){if(n.stateNode===null)throw Error(i(166));return Xe(n),null}if(h=ne.current,qr(n))eh(n);else{var x=cl(fe.current);switch(h){case 1:h=x.createElementNS("http://www.w3.org/2000/svg",d);break;case 2:h=x.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;default:switch(d){case"svg":h=x.createElementNS("http://www.w3.org/2000/svg",d);break;case"math":h=x.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;case"script":h=x.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof s.is=="string"?x.createElement("select",{is:s.is}):x.createElement("select"),s.multiple?h.multiple=!0:s.size&&(h.size=s.size);break;default:h=typeof s.is=="string"?x.createElement(d,{is:s.is}):x.createElement(d)}}h[mt]=n,h[jt]=s;e:for(x=n.child;x!==null;){if(x.tag===5||x.tag===6)h.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===n)break e;for(;x.sibling===null;){if(x.return===null||x.return===n)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}n.stateNode=h;e:switch(vt(h,d,s),d){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&Xn(n)}}return Xe(n),rd(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,r),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==s&&Xn(n);else{if(typeof s!="string"&&n.stateNode===null)throw Error(i(166));if(e=fe.current,qr(n)){if(e=n.stateNode,r=n.memoizedProps,s=null,d=pt,d!==null)switch(d.tag){case 27:case 5:s=d.memoizedProps}e[mt]=n,e=!!(e.nodeValue===r||s!==null&&s.suppressHydrationWarning===!0||vv(e.nodeValue,r)),e||ha(n,!0)}else e=cl(e).createTextNode(s),e[mt]=n,n.stateNode=e}return Xe(n),null;case 31:if(r=n.memoizedState,e===null||e.memoizedState!==null){if(s=qr(n),r!==null){if(e===null){if(!s)throw Error(i(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(557));e[mt]=n}else or(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Xe(n),e=!1}else r=pu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),e=!0;if(!e)return n.flags&256?(Yt(n),n):(Yt(n),null);if((n.flags&128)!==0)throw Error(i(558))}return Xe(n),null;case 13:if(s=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(d=qr(n),s!==null&&s.dehydrated!==null){if(e===null){if(!d)throw Error(i(318));if(d=n.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(i(317));d[mt]=n}else or(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Xe(n),d=!1}else d=pu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=d),d=!0;if(!d)return n.flags&256?(Yt(n),n):(Yt(n),null)}return Yt(n),(n.flags&128)!==0?(n.lanes=r,n):(r=s!==null,e=e!==null&&e.memoizedState!==null,r&&(s=n.child,d=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(d=s.alternate.memoizedState.cachePool.pool),h=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(h=s.memoizedState.cachePool.pool),h!==d&&(s.flags|=2048)),r!==e&&r&&(n.child.flags|=8192),Vi(n,n.updateQueue),Xe(n),null);case 4:return le(),e===null&&Td(n.stateNode.containerInfo),Xe(n),null;case 10:return Yn(n.type),Xe(n),null;case 19:if(B(tt),s=n.memoizedState,s===null)return Xe(n),null;if(d=(n.flags&128)!==0,h=s.rendering,h===null)if(d)fs(s,!1);else{if(et!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(h=Li(e),h!==null){for(n.flags|=128,fs(s,!1),e=h.updateQueue,n.updateQueue=e,Vi(n,e),n.subtreeFlags=0,e=r,r=n.child;r!==null;)Gp(r,e),r=r.sibling;return re(tt,tt.current&1|2),He&&Fn(n,s.treeForkCount),n.child}e=e.sibling}s.tail!==null&&Oe()>Ji&&(n.flags|=128,d=!0,fs(s,!1),n.lanes=4194304)}else{if(!d)if(e=Li(h),e!==null){if(n.flags|=128,d=!0,e=e.updateQueue,n.updateQueue=e,Vi(n,e),fs(s,!0),s.tail===null&&s.tailMode==="hidden"&&!h.alternate&&!He)return Xe(n),null}else 2*Oe()-s.renderingStartTime>Ji&&r!==536870912&&(n.flags|=128,d=!0,fs(s,!1),n.lanes=4194304);s.isBackwards?(h.sibling=n.child,n.child=h):(e=s.last,e!==null?e.sibling=h:n.child=h,s.last=h)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Oe(),e.sibling=null,r=tt.current,re(tt,d?r&1|2:r&1),He&&Fn(n,s.treeForkCount),e):(Xe(n),null);case 22:case 23:return Yt(n),Nu(),s=n.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(n.flags|=8192):s&&(n.flags|=8192),s?(r&536870912)!==0&&(n.flags&128)===0&&(Xe(n),n.subtreeFlags&6&&(n.flags|=8192)):Xe(n),r=n.updateQueue,r!==null&&Vi(n,r.retryQueue),r=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),s=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(s=n.memoizedState.cachePool.pool),s!==r&&(n.flags|=2048),e!==null&&B(lr),null;case 24:return r=null,e!==null&&(r=e.memoizedState.cache),n.memoizedState.cache!==r&&(n.flags|=2048),Yn(ot),Xe(n),null;case 25:return null;case 30:return null}throw Error(i(156,n.tag))}function Uk(e,n){switch(fu(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Yn(ot),le(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return me(n),null;case 31:if(n.memoizedState!==null){if(Yt(n),n.alternate===null)throw Error(i(340));or()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(Yt(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(i(340));or()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return B(tt),null;case 4:return le(),null;case 10:return Yn(n.type),null;case 22:case 23:return Yt(n),Nu(),e!==null&&B(lr),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Yn(ot),null;case 25:return null;default:return null}}function kg(e,n){switch(fu(n),n.tag){case 3:Yn(ot),le();break;case 26:case 27:case 5:me(n);break;case 4:le();break;case 31:n.memoizedState!==null&&Yt(n);break;case 13:Yt(n);break;case 19:B(tt);break;case 10:Yn(n.type);break;case 22:case 23:Yt(n),Nu(),e!==null&&B(lr);break;case 24:Yn(ot)}}function ms(e,n){try{var r=n.updateQueue,s=r!==null?r.lastEffect:null;if(s!==null){var d=s.next;r=d;do{if((r.tag&e)===e){s=void 0;var h=r.create,x=r.inst;s=h(),x.destroy=s}r=r.next}while(r!==d)}}catch(A){Pe(n,n.return,A)}}function ka(e,n,r){try{var s=n.updateQueue,d=s!==null?s.lastEffect:null;if(d!==null){var h=d.next;s=h;do{if((s.tag&e)===e){var x=s.inst,A=x.destroy;if(A!==void 0){x.destroy=void 0,d=n;var z=r,Y=A;try{Y()}catch(te){Pe(d,z,te)}}}s=s.next}while(s!==h)}}catch(te){Pe(n,n.return,te)}}function Sg(e){var n=e.updateQueue;if(n!==null){var r=e.stateNode;try{mh(n,r)}catch(s){Pe(e,e.return,s)}}}function Eg(e,n,r){r.props=mr(e.type,e.memoizedProps),r.state=e.memoizedState;try{r.componentWillUnmount()}catch(s){Pe(e,n,s)}}function ps(e,n){try{var r=e.ref;if(r!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof r=="function"?e.refCleanup=r(s):r.current=s}}catch(d){Pe(e,n,d)}}function _n(e,n){var r=e.ref,s=e.refCleanup;if(r!==null)if(typeof s=="function")try{s()}catch(d){Pe(e,n,d)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(d){Pe(e,n,d)}else r.current=null}function Cg(e){var n=e.type,r=e.memoizedProps,s=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":r.autoFocus&&s.focus();break e;case"img":r.src?s.src=r.src:r.srcSet&&(s.srcset=r.srcSet)}}catch(d){Pe(e,e.return,d)}}function od(e,n,r){try{var s=e.stateNode;i2(s,e.type,r,n),s[jt]=n}catch(d){Pe(e,e.return,d)}}function Tg(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Aa(e.type)||e.tag===4}function sd(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Tg(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Aa(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function id(e,n,r){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(e,n):(n=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,n.appendChild(e),r=r._reactRootContainer,r!=null||n.onclick!==null||(n.onclick=In));else if(s!==4&&(s===27&&Aa(e.type)&&(r=e.stateNode,n=null),e=e.child,e!==null))for(id(e,n,r),e=e.sibling;e!==null;)id(e,n,r),e=e.sibling}function Gi(e,n,r){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?r.insertBefore(e,n):r.appendChild(e);else if(s!==4&&(s===27&&Aa(e.type)&&(r=e.stateNode),e=e.child,e!==null))for(Gi(e,n,r),e=e.sibling;e!==null;)Gi(e,n,r),e=e.sibling}function Ng(e){var n=e.stateNode,r=e.memoizedProps;try{for(var s=e.type,d=n.attributes;d.length;)n.removeAttributeNode(d[0]);vt(n,s,r),n[mt]=e,n[jt]=r}catch(h){Pe(e,e.return,h)}}var Zn=!1,lt=!1,ld=!1,jg=typeof WeakSet=="function"?WeakSet:Set,dt=null;function Wk(e,n){if(e=e.containerInfo,Ad=gl,e=Wp(e),tu(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var s=r.getSelection&&r.getSelection();if(s&&s.rangeCount!==0){r=s.anchorNode;var d=s.anchorOffset,h=s.focusNode;s=s.focusOffset;try{r.nodeType,h.nodeType}catch{r=null;break e}var x=0,A=-1,z=-1,Y=0,te=0,se=e,G=null;t:for(;;){for(var Q;se!==r||d!==0&&se.nodeType!==3||(A=x+d),se!==h||s!==0&&se.nodeType!==3||(z=x+s),se.nodeType===3&&(x+=se.nodeValue.length),(Q=se.firstChild)!==null;)G=se,se=Q;for(;;){if(se===e)break t;if(G===r&&++Y===d&&(A=x),G===h&&++te===s&&(z=x),(Q=se.nextSibling)!==null)break;se=G,G=se.parentNode}se=Q}r=A===-1||z===-1?null:{start:A,end:z}}else r=null}r=r||{start:0,end:0}}else r=null;for(_d={focusedElem:e,selectionRange:r},gl=!1,dt=n;dt!==null;)if(n=dt,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,dt=e;else for(;dt!==null;){switch(n=dt,h=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(r=0;r<e.length;r++)d=e[r],d.ref.impl=d.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&h!==null){e=void 0,r=n,d=h.memoizedProps,h=h.memoizedState,s=r.stateNode;try{var he=mr(r.type,d);e=s.getSnapshotBeforeUpdate(he,h),s.__reactInternalSnapshotBeforeUpdate=e}catch(Ce){Pe(r,r.return,Ce)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,r=e.nodeType,r===9)Dd(e);else if(r===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Dd(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(i(163))}if(e=n.sibling,e!==null){e.return=n.return,dt=e;break}dt=n.return}}function Ag(e,n,r){var s=r.flags;switch(r.tag){case 0:case 11:case 15:Jn(e,r),s&4&&ms(5,r);break;case 1:if(Jn(e,r),s&4)if(e=r.stateNode,n===null)try{e.componentDidMount()}catch(x){Pe(r,r.return,x)}else{var d=mr(r.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(d,n,e.__reactInternalSnapshotBeforeUpdate)}catch(x){Pe(r,r.return,x)}}s&64&&Sg(r),s&512&&ps(r,r.return);break;case 3:if(Jn(e,r),s&64&&(e=r.updateQueue,e!==null)){if(n=null,r.child!==null)switch(r.child.tag){case 27:case 5:n=r.child.stateNode;break;case 1:n=r.child.stateNode}try{mh(e,n)}catch(x){Pe(r,r.return,x)}}break;case 27:n===null&&s&4&&Ng(r);case 26:case 5:Jn(e,r),n===null&&s&4&&Cg(r),s&512&&ps(r,r.return);break;case 12:Jn(e,r);break;case 31:Jn(e,r),s&4&&Og(e,r);break;case 13:Jn(e,r),s&4&&Dg(e,r),s&64&&(e=r.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(r=Gk.bind(null,r),h2(e,r))));break;case 22:if(s=r.memoizedState!==null||Zn,!s){n=n!==null&&n.memoizedState!==null||lt,d=Zn;var h=lt;Zn=s,(lt=n)&&!h?ea(e,r,(r.subtreeFlags&8772)!==0):Jn(e,r),Zn=d,lt=h}break;case 30:break;default:Jn(e,r)}}function _g(e){var n=e.alternate;n!==null&&(e.alternate=null,_g(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&Bc(n)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Ze=null,_t=!1;function Qn(e,n,r){for(r=r.child;r!==null;)Rg(e,n,r),r=r.sibling}function Rg(e,n,r){if(It&&typeof It.onCommitFiberUnmount=="function")try{It.onCommitFiberUnmount(Bo,r)}catch{}switch(r.tag){case 26:lt||_n(r,n),Qn(e,n,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:lt||_n(r,n);var s=Ze,d=_t;Aa(r.type)&&(Ze=r.stateNode,_t=!1),Qn(e,n,r),Ss(r.stateNode),Ze=s,_t=d;break;case 5:lt||_n(r,n);case 6:if(s=Ze,d=_t,Ze=null,Qn(e,n,r),Ze=s,_t=d,Ze!==null)if(_t)try{(Ze.nodeType===9?Ze.body:Ze.nodeName==="HTML"?Ze.ownerDocument.body:Ze).removeChild(r.stateNode)}catch(h){Pe(r,n,h)}else try{Ze.removeChild(r.stateNode)}catch(h){Pe(r,n,h)}break;case 18:Ze!==null&&(_t?(e=Ze,Sv(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,r.stateNode),co(e)):Sv(Ze,r.stateNode));break;case 4:s=Ze,d=_t,Ze=r.stateNode.containerInfo,_t=!0,Qn(e,n,r),Ze=s,_t=d;break;case 0:case 11:case 14:case 15:ka(2,r,n),lt||ka(4,r,n),Qn(e,n,r);break;case 1:lt||(_n(r,n),s=r.stateNode,typeof s.componentWillUnmount=="function"&&Eg(r,n,s)),Qn(e,n,r);break;case 21:Qn(e,n,r);break;case 22:lt=(s=lt)||r.memoizedState!==null,Qn(e,n,r),lt=s;break;default:Qn(e,n,r)}}function Og(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{co(e)}catch(r){Pe(n,n.return,r)}}}function Dg(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{co(e)}catch(r){Pe(n,n.return,r)}}function Ik(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new jg),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new jg),n;default:throw Error(i(435,e.tag))}}function Xi(e,n){var r=Ik(e);n.forEach(function(s){if(!r.has(s)){r.add(s);var d=Xk.bind(null,e,s);s.then(d,d)}})}function Rt(e,n){var r=n.deletions;if(r!==null)for(var s=0;s<r.length;s++){var d=r[s],h=e,x=n,A=x;e:for(;A!==null;){switch(A.tag){case 27:if(Aa(A.type)){Ze=A.stateNode,_t=!1;break e}break;case 5:Ze=A.stateNode,_t=!1;break e;case 3:case 4:Ze=A.stateNode.containerInfo,_t=!0;break e}A=A.return}if(Ze===null)throw Error(i(160));Rg(h,x,d),Ze=null,_t=!1,h=d.alternate,h!==null&&(h.return=null),d.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Mg(n,e),n=n.sibling}var vn=null;function Mg(e,n){var r=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Rt(n,e),Ot(e),s&4&&(ka(3,e,e.return),ms(3,e),ka(5,e,e.return));break;case 1:Rt(n,e),Ot(e),s&512&&(lt||r===null||_n(r,r.return)),s&64&&Zn&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(r=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=r===null?s:r.concat(s))));break;case 26:var d=vn;if(Rt(n,e),Ot(e),s&512&&(lt||r===null||_n(r,r.return)),s&4){var h=r!==null?r.memoizedState:null;if(s=e.memoizedState,r===null)if(s===null)if(e.stateNode===null){e:{s=e.type,r=e.memoizedProps,d=d.ownerDocument||d;t:switch(s){case"title":h=d.getElementsByTagName("title")[0],(!h||h[Io]||h[mt]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=d.createElement(s),d.head.insertBefore(h,d.querySelector("head > title"))),vt(h,s,r),h[mt]=e,ut(h),s=h;break e;case"link":var x=Mv("link","href",d).get(s+(r.href||""));if(x){for(var A=0;A<x.length;A++)if(h=x[A],h.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&h.getAttribute("rel")===(r.rel==null?null:r.rel)&&h.getAttribute("title")===(r.title==null?null:r.title)&&h.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){x.splice(A,1);break t}}h=d.createElement(s),vt(h,s,r),d.head.appendChild(h);break;case"meta":if(x=Mv("meta","content",d).get(s+(r.content||""))){for(A=0;A<x.length;A++)if(h=x[A],h.getAttribute("content")===(r.content==null?null:""+r.content)&&h.getAttribute("name")===(r.name==null?null:r.name)&&h.getAttribute("property")===(r.property==null?null:r.property)&&h.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&h.getAttribute("charset")===(r.charSet==null?null:r.charSet)){x.splice(A,1);break t}}h=d.createElement(s),vt(h,s,r),d.head.appendChild(h);break;default:throw Error(i(468,s))}h[mt]=e,ut(h),s=h}e.stateNode=s}else Lv(d,e.type,e.stateNode);else e.stateNode=Dv(d,s,e.memoizedProps);else h!==s?(h===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):h.count--,s===null?Lv(d,e.type,e.stateNode):Dv(d,s,e.memoizedProps)):s===null&&e.stateNode!==null&&od(e,e.memoizedProps,r.memoizedProps)}break;case 27:Rt(n,e),Ot(e),s&512&&(lt||r===null||_n(r,r.return)),r!==null&&s&4&&od(e,e.memoizedProps,r.memoizedProps);break;case 5:if(Rt(n,e),Ot(e),s&512&&(lt||r===null||_n(r,r.return)),e.flags&32){d=e.stateNode;try{Or(d,"")}catch(he){Pe(e,e.return,he)}}s&4&&e.stateNode!=null&&(d=e.memoizedProps,od(e,d,r!==null?r.memoizedProps:d)),s&1024&&(ld=!0);break;case 6:if(Rt(n,e),Ot(e),s&4){if(e.stateNode===null)throw Error(i(162));s=e.memoizedProps,r=e.stateNode;try{r.nodeValue=s}catch(he){Pe(e,e.return,he)}}break;case 3:if(fl=null,d=vn,vn=ul(n.containerInfo),Rt(n,e),vn=d,Ot(e),s&4&&r!==null&&r.memoizedState.isDehydrated)try{co(n.containerInfo)}catch(he){Pe(e,e.return,he)}ld&&(ld=!1,Lg(e));break;case 4:s=vn,vn=ul(e.stateNode.containerInfo),Rt(n,e),Ot(e),vn=s;break;case 12:Rt(n,e),Ot(e);break;case 31:Rt(n,e),Ot(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Xi(e,s)));break;case 13:Rt(n,e),Ot(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(Qi=Oe()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Xi(e,s)));break;case 22:d=e.memoizedState!==null;var z=r!==null&&r.memoizedState!==null,Y=Zn,te=lt;if(Zn=Y||d,lt=te||z,Rt(n,e),lt=te,Zn=Y,Ot(e),s&8192)e:for(n=e.stateNode,n._visibility=d?n._visibility&-2:n._visibility|1,d&&(r===null||z||Zn||lt||pr(e)),r=null,n=e;;){if(n.tag===5||n.tag===26){if(r===null){z=r=n;try{if(h=z.stateNode,d)x=h.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{A=z.stateNode;var se=z.memoizedProps.style,G=se!=null&&se.hasOwnProperty("display")?se.display:null;A.style.display=G==null||typeof G=="boolean"?"":(""+G).trim()}}catch(he){Pe(z,z.return,he)}}}else if(n.tag===6){if(r===null){z=n;try{z.stateNode.nodeValue=d?"":z.memoizedProps}catch(he){Pe(z,z.return,he)}}}else if(n.tag===18){if(r===null){z=n;try{var Q=z.stateNode;d?Ev(Q,!0):Ev(z.stateNode,!1)}catch(he){Pe(z,z.return,he)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;r===n&&(r=null),n=n.return}r===n&&(r=null),n.sibling.return=n.return,n=n.sibling}s&4&&(s=e.updateQueue,s!==null&&(r=s.retryQueue,r!==null&&(s.retryQueue=null,Xi(e,r))));break;case 19:Rt(n,e),Ot(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Xi(e,s)));break;case 30:break;case 21:break;default:Rt(n,e),Ot(e)}}function Ot(e){var n=e.flags;if(n&2){try{for(var r,s=e.return;s!==null;){if(Tg(s)){r=s;break}s=s.return}if(r==null)throw Error(i(160));switch(r.tag){case 27:var d=r.stateNode,h=sd(e);Gi(e,h,d);break;case 5:var x=r.stateNode;r.flags&32&&(Or(x,""),r.flags&=-33);var A=sd(e);Gi(e,A,x);break;case 3:case 4:var z=r.stateNode.containerInfo,Y=sd(e);id(e,Y,z);break;default:throw Error(i(161))}}catch(te){Pe(e,e.return,te)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Lg(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Lg(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Jn(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Ag(e,n.alternate,n),n=n.sibling}function pr(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:ka(4,n,n.return),pr(n);break;case 1:_n(n,n.return);var r=n.stateNode;typeof r.componentWillUnmount=="function"&&Eg(n,n.return,r),pr(n);break;case 27:Ss(n.stateNode);case 26:case 5:_n(n,n.return),pr(n);break;case 22:n.memoizedState===null&&pr(n);break;case 30:pr(n);break;default:pr(n)}e=e.sibling}}function ea(e,n,r){for(r=r&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var s=n.alternate,d=e,h=n,x=h.flags;switch(h.tag){case 0:case 11:case 15:ea(d,h,r),ms(4,h);break;case 1:if(ea(d,h,r),s=h,d=s.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch(Y){Pe(s,s.return,Y)}if(s=h,d=s.updateQueue,d!==null){var A=s.stateNode;try{var z=d.shared.hiddenCallbacks;if(z!==null)for(d.shared.hiddenCallbacks=null,d=0;d<z.length;d++)fh(z[d],A)}catch(Y){Pe(s,s.return,Y)}}r&&x&64&&Sg(h),ps(h,h.return);break;case 27:Ng(h);case 26:case 5:ea(d,h,r),r&&s===null&&x&4&&Cg(h),ps(h,h.return);break;case 12:ea(d,h,r);break;case 31:ea(d,h,r),r&&x&4&&Og(d,h);break;case 13:ea(d,h,r),r&&x&4&&Dg(d,h);break;case 22:h.memoizedState===null&&ea(d,h,r),ps(h,h.return);break;case 30:break;default:ea(d,h,r)}n=n.sibling}}function cd(e,n){var r=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==r&&(e!=null&&e.refCount++,r!=null&&es(r))}function ud(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&es(e))}function yn(e,n,r,s){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)zg(e,n,r,s),n=n.sibling}function zg(e,n,r,s){var d=n.flags;switch(n.tag){case 0:case 11:case 15:yn(e,n,r,s),d&2048&&ms(9,n);break;case 1:yn(e,n,r,s);break;case 3:yn(e,n,r,s),d&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&es(e)));break;case 12:if(d&2048){yn(e,n,r,s),e=n.stateNode;try{var h=n.memoizedProps,x=h.id,A=h.onPostCommit;typeof A=="function"&&A(x,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(z){Pe(n,n.return,z)}}else yn(e,n,r,s);break;case 31:yn(e,n,r,s);break;case 13:yn(e,n,r,s);break;case 23:break;case 22:h=n.stateNode,x=n.alternate,n.memoizedState!==null?h._visibility&2?yn(e,n,r,s):hs(e,n):h._visibility&2?yn(e,n,r,s):(h._visibility|=2,Qr(e,n,r,s,(n.subtreeFlags&10256)!==0||!1)),d&2048&&cd(x,n);break;case 24:yn(e,n,r,s),d&2048&&ud(n.alternate,n);break;default:yn(e,n,r,s)}}function Qr(e,n,r,s,d){for(d=d&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var h=e,x=n,A=r,z=s,Y=x.flags;switch(x.tag){case 0:case 11:case 15:Qr(h,x,A,z,d),ms(8,x);break;case 23:break;case 22:var te=x.stateNode;x.memoizedState!==null?te._visibility&2?Qr(h,x,A,z,d):hs(h,x):(te._visibility|=2,Qr(h,x,A,z,d)),d&&Y&2048&&cd(x.alternate,x);break;case 24:Qr(h,x,A,z,d),d&&Y&2048&&ud(x.alternate,x);break;default:Qr(h,x,A,z,d)}n=n.sibling}}function hs(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var r=e,s=n,d=s.flags;switch(s.tag){case 22:hs(r,s),d&2048&&cd(s.alternate,s);break;case 24:hs(r,s),d&2048&&ud(s.alternate,s);break;default:hs(r,s)}n=n.sibling}}var gs=8192;function Jr(e,n,r){if(e.subtreeFlags&gs)for(e=e.child;e!==null;)Hg(e,n,r),e=e.sibling}function Hg(e,n,r){switch(e.tag){case 26:Jr(e,n,r),e.flags&gs&&e.memoizedState!==null&&N2(r,vn,e.memoizedState,e.memoizedProps);break;case 5:Jr(e,n,r);break;case 3:case 4:var s=vn;vn=ul(e.stateNode.containerInfo),Jr(e,n,r),vn=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=gs,gs=16777216,Jr(e,n,r),gs=s):Jr(e,n,r));break;default:Jr(e,n,r)}}function Bg(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function vs(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];dt=s,Wg(s,e)}Bg(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ug(e),e=e.sibling}function Ug(e){switch(e.tag){case 0:case 11:case 15:vs(e),e.flags&2048&&ka(9,e,e.return);break;case 3:vs(e);break;case 12:vs(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,Zi(e)):vs(e);break;default:vs(e)}}function Zi(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];dt=s,Wg(s,e)}Bg(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:ka(8,n,n.return),Zi(n);break;case 22:r=n.stateNode,r._visibility&2&&(r._visibility&=-3,Zi(n));break;default:Zi(n)}e=e.sibling}}function Wg(e,n){for(;dt!==null;){var r=dt;switch(r.tag){case 0:case 11:case 15:ka(8,r,n);break;case 23:case 22:if(r.memoizedState!==null&&r.memoizedState.cachePool!==null){var s=r.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:es(r.memoizedState.cache)}if(s=r.child,s!==null)s.return=r,dt=s;else e:for(r=e;dt!==null;){s=dt;var d=s.sibling,h=s.return;if(_g(s),s===r){dt=null;break e}if(d!==null){d.return=h,dt=d;break e}dt=h}}}var qk={getCacheForType:function(e){var n=ht(ot),r=n.data.get(e);return r===void 0&&(r=e(),n.data.set(e,r)),r},cacheSignal:function(){return ht(ot).controller.signal}},Pk=typeof WeakMap=="function"?WeakMap:Map,Ie=0,$e=null,De=null,Le=0,qe=0,$t=null,Sa=!1,eo=!1,dd=!1,ta=0,et=0,Ea=0,hr=0,fd=0,Vt=0,to=0,ys=null,Dt=null,md=!1,Qi=0,Ig=0,Ji=1/0,el=null,Ca=null,ct=0,Ta=null,no=null,na=0,pd=0,hd=null,qg=null,bs=0,gd=null;function Gt(){return(Ie&2)!==0&&Le!==0?Le&-Le:D.T!==null?kd():rp()}function Pg(){if(Vt===0)if((Le&536870912)===0||He){var e=li;li<<=1,(li&3932160)===0&&(li=262144),Vt=e}else Vt=536870912;return e=Kt.current,e!==null&&(e.flags|=32),Vt}function Mt(e,n,r){(e===$e&&(qe===2||qe===9)||e.cancelPendingCommit!==null)&&(ao(e,0),Na(e,Le,Vt,!1)),Wo(e,r),((Ie&2)===0||e!==$e)&&(e===$e&&((Ie&2)===0&&(hr|=r),et===4&&Na(e,Le,Vt,!1)),Rn(e))}function Fg(e,n,r){if((Ie&6)!==0)throw Error(i(327));var s=!r&&(n&127)===0&&(n&e.expiredLanes)===0||Uo(e,n),d=s?Yk(e,n):yd(e,n,!0),h=s;do{if(d===0){eo&&!s&&Na(e,n,0,!1);break}else{if(r=e.current.alternate,h&&!Fk(r)){d=yd(e,n,!1),h=!1;continue}if(d===2){if(h=n,e.errorRecoveryDisabledLanes&h)var x=0;else x=e.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){n=x;e:{var A=e;d=ys;var z=A.current.memoizedState.isDehydrated;if(z&&(ao(A,x).flags|=256),x=yd(A,x,!1),x!==2){if(dd&&!z){A.errorRecoveryDisabledLanes|=h,hr|=h,d=4;break e}h=Dt,Dt=d,h!==null&&(Dt===null?Dt=h:Dt.push.apply(Dt,h))}d=x}if(h=!1,d!==2)continue}}if(d===1){ao(e,0),Na(e,n,0,!0);break}e:{switch(s=e,h=d,h){case 0:case 1:throw Error(i(345));case 4:if((n&4194048)!==n)break;case 6:Na(s,n,Vt,!Sa);break e;case 2:Dt=null;break;case 3:case 5:break;default:throw Error(i(329))}if((n&62914560)===n&&(d=Qi+300-Oe(),10<d)){if(Na(s,n,Vt,!Sa),ui(s,0,!0)!==0)break e;na=n,s.timeoutHandle=xv(Kg.bind(null,s,r,Dt,el,md,n,Vt,hr,to,Sa,h,"Throttled",-0,0),d);break e}Kg(s,r,Dt,el,md,n,Vt,hr,to,Sa,h,null,-0,0)}}break}while(!0);Rn(e)}function Kg(e,n,r,s,d,h,x,A,z,Y,te,se,G,Q){if(e.timeoutHandle=-1,se=n.subtreeFlags,se&8192||(se&16785408)===16785408){se={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:In},Hg(n,h,se);var he=(h&62914560)===h?Qi-Oe():(h&4194048)===h?Ig-Oe():0;if(he=j2(se,he),he!==null){na=h,e.cancelPendingCommit=he(Jg.bind(null,e,n,h,r,s,d,x,A,z,te,se,null,G,Q)),Na(e,h,x,!Y);return}}Jg(e,n,h,r,s,d,x,A,z)}function Fk(e){for(var n=e;;){var r=n.tag;if((r===0||r===11||r===15)&&n.flags&16384&&(r=n.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var s=0;s<r.length;s++){var d=r[s],h=d.getSnapshot;d=d.value;try{if(!Pt(h(),d))return!1}catch{return!1}}if(r=n.child,n.subtreeFlags&16384&&r!==null)r.return=n,n=r;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Na(e,n,r,s){n&=~fd,n&=~hr,e.suspendedLanes|=n,e.pingedLanes&=~n,s&&(e.warmLanes|=n),s=e.expirationTimes;for(var d=n;0<d;){var h=31-qt(d),x=1<<h;s[h]=-1,d&=~x}r!==0&&tp(e,r,n)}function tl(){return(Ie&6)===0?(ws(0),!1):!0}function vd(){if(De!==null){if(qe===0)var e=De.return;else e=De,Kn=sr=null,Du(e),$r=null,ns=0,e=De;for(;e!==null;)kg(e.alternate,e),e=e.return;De=null}}function ao(e,n){var r=e.timeoutHandle;r!==-1&&(e.timeoutHandle=-1,u2(r)),r=e.cancelPendingCommit,r!==null&&(e.cancelPendingCommit=null,r()),na=0,vd(),$e=e,De=r=Pn(e.current,null),Le=n,qe=0,$t=null,Sa=!1,eo=Uo(e,n),dd=!1,to=Vt=fd=hr=Ea=et=0,Dt=ys=null,md=!1,(n&8)!==0&&(n|=n&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=n;0<s;){var d=31-qt(s),h=1<<d;n|=e[d],s&=~h}return ta=n,ki(),r}function Yg(e,n){_e=null,D.H=us,n===Yr||n===_i?(n=lh(),qe=3):n===xu?(n=lh(),qe=4):qe=n===Gu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,$t=n,De===null&&(et=1,Fi(e,on(n,e.current)))}function $g(){var e=Kt.current;return e===null?!0:(Le&4194048)===Le?un===null:(Le&62914560)===Le||(Le&536870912)!==0?e===un:!1}function Vg(){var e=D.H;return D.H=us,e===null?us:e}function Gg(){var e=D.A;return D.A=qk,e}function nl(){et=4,Sa||(Le&4194048)!==Le&&Kt.current!==null||(eo=!0),(Ea&134217727)===0&&(hr&134217727)===0||$e===null||Na($e,Le,Vt,!1)}function yd(e,n,r){var s=Ie;Ie|=2;var d=Vg(),h=Gg();($e!==e||Le!==n)&&(el=null,ao(e,n)),n=!1;var x=et;e:do try{if(qe!==0&&De!==null){var A=De,z=$t;switch(qe){case 8:vd(),x=6;break e;case 3:case 2:case 9:case 6:Kt.current===null&&(n=!0);var Y=qe;if(qe=0,$t=null,ro(e,A,z,Y),r&&eo){x=0;break e}break;default:Y=qe,qe=0,$t=null,ro(e,A,z,Y)}}Kk(),x=et;break}catch(te){Yg(e,te)}while(!0);return n&&e.shellSuspendCounter++,Kn=sr=null,Ie=s,D.H=d,D.A=h,De===null&&($e=null,Le=0,ki()),x}function Kk(){for(;De!==null;)Xg(De)}function Yk(e,n){var r=Ie;Ie|=2;var s=Vg(),d=Gg();$e!==e||Le!==n?(el=null,Ji=Oe()+500,ao(e,n)):eo=Uo(e,n);e:do try{if(qe!==0&&De!==null){n=De;var h=$t;t:switch(qe){case 1:qe=0,$t=null,ro(e,n,h,1);break;case 2:case 9:if(sh(h)){qe=0,$t=null,Zg(n);break}n=function(){qe!==2&&qe!==9||$e!==e||(qe=7),Rn(e)},h.then(n,n);break e;case 3:qe=7;break e;case 4:qe=5;break e;case 7:sh(h)?(qe=0,$t=null,Zg(n)):(qe=0,$t=null,ro(e,n,h,7));break;case 5:var x=null;switch(De.tag){case 26:x=De.memoizedState;case 5:case 27:var A=De;if(x?zv(x):A.stateNode.complete){qe=0,$t=null;var z=A.sibling;if(z!==null)De=z;else{var Y=A.return;Y!==null?(De=Y,al(Y)):De=null}break t}}qe=0,$t=null,ro(e,n,h,5);break;case 6:qe=0,$t=null,ro(e,n,h,6);break;case 8:vd(),et=6;break e;default:throw Error(i(462))}}$k();break}catch(te){Yg(e,te)}while(!0);return Kn=sr=null,D.H=s,D.A=d,Ie=r,De!==null?0:($e=null,Le=0,ki(),et)}function $k(){for(;De!==null&&!ke();)Xg(De)}function Xg(e){var n=wg(e.alternate,e,ta);e.memoizedProps=e.pendingProps,n===null?al(e):De=n}function Zg(e){var n=e,r=n.alternate;switch(n.tag){case 15:case 0:n=pg(r,n,n.pendingProps,n.type,void 0,Le);break;case 11:n=pg(r,n,n.pendingProps,n.type.render,n.ref,Le);break;case 5:Du(n);default:kg(r,n),n=De=Gp(n,ta),n=wg(r,n,ta)}e.memoizedProps=e.pendingProps,n===null?al(e):De=n}function ro(e,n,r,s){Kn=sr=null,Du(n),$r=null,ns=0;var d=n.return;try{if(Lk(e,d,n,r,Le)){et=1,Fi(e,on(r,e.current)),De=null;return}}catch(h){if(d!==null)throw De=d,h;et=1,Fi(e,on(r,e.current)),De=null;return}n.flags&32768?(He||s===1?e=!0:eo||(Le&536870912)!==0?e=!1:(Sa=e=!0,(s===2||s===9||s===3||s===6)&&(s=Kt.current,s!==null&&s.tag===13&&(s.flags|=16384))),Qg(n,e)):al(n)}function al(e){var n=e;do{if((n.flags&32768)!==0){Qg(n,Sa);return}e=n.return;var r=Bk(n.alternate,n,ta);if(r!==null){De=r;return}if(n=n.sibling,n!==null){De=n;return}De=n=e}while(n!==null);et===0&&(et=5)}function Qg(e,n){do{var r=Uk(e.alternate,e);if(r!==null){r.flags&=32767,De=r;return}if(r=e.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!n&&(e=e.sibling,e!==null)){De=e;return}De=e=r}while(e!==null);et=6,De=null}function Jg(e,n,r,s,d,h,x,A,z){e.cancelPendingCommit=null;do rl();while(ct!==0);if((Ie&6)!==0)throw Error(i(327));if(n!==null){if(n===e.current)throw Error(i(177));if(h=n.lanes|n.childLanes,h|=su,T1(e,r,h,x,A,z),e===$e&&(De=$e=null,Le=0),no=n,Ta=e,na=r,pd=h,hd=d,qg=s,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Zk(Be,function(){return rv(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||s){s=D.T,D.T=null,d=P.p,P.p=2,x=Ie,Ie|=4;try{Wk(e,n,r)}finally{Ie=x,P.p=d,D.T=s}}ct=1,ev(),tv(),nv()}}function ev(){if(ct===1){ct=0;var e=Ta,n=no,r=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||r){r=D.T,D.T=null;var s=P.p;P.p=2;var d=Ie;Ie|=4;try{Mg(n,e);var h=_d,x=Wp(e.containerInfo),A=h.focusedElem,z=h.selectionRange;if(x!==A&&A&&A.ownerDocument&&Up(A.ownerDocument.documentElement,A)){if(z!==null&&tu(A)){var Y=z.start,te=z.end;if(te===void 0&&(te=Y),"selectionStart"in A)A.selectionStart=Y,A.selectionEnd=Math.min(te,A.value.length);else{var se=A.ownerDocument||document,G=se&&se.defaultView||window;if(G.getSelection){var Q=G.getSelection(),he=A.textContent.length,Ce=Math.min(z.start,he),Ye=z.end===void 0?Ce:Math.min(z.end,he);!Q.extend&&Ce>Ye&&(x=Ye,Ye=Ce,Ce=x);var W=Bp(A,Ce),H=Bp(A,Ye);if(W&&H&&(Q.rangeCount!==1||Q.anchorNode!==W.node||Q.anchorOffset!==W.offset||Q.focusNode!==H.node||Q.focusOffset!==H.offset)){var K=se.createRange();K.setStart(W.node,W.offset),Q.removeAllRanges(),Ce>Ye?(Q.addRange(K),Q.extend(H.node,H.offset)):(K.setEnd(H.node,H.offset),Q.addRange(K))}}}}for(se=[],Q=A;Q=Q.parentNode;)Q.nodeType===1&&se.push({element:Q,left:Q.scrollLeft,top:Q.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<se.length;A++){var oe=se[A];oe.element.scrollLeft=oe.left,oe.element.scrollTop=oe.top}}gl=!!Ad,_d=Ad=null}finally{Ie=d,P.p=s,D.T=r}}e.current=n,ct=2}}function tv(){if(ct===2){ct=0;var e=Ta,n=no,r=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||r){r=D.T,D.T=null;var s=P.p;P.p=2;var d=Ie;Ie|=4;try{Ag(e,n.alternate,n)}finally{Ie=d,P.p=s,D.T=r}}ct=3}}function nv(){if(ct===4||ct===3){ct=0,pe();var e=Ta,n=no,r=na,s=qg;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?ct=5:(ct=0,no=Ta=null,av(e,e.pendingLanes));var d=e.pendingLanes;if(d===0&&(Ca=null),zc(r),n=n.stateNode,It&&typeof It.onCommitFiberRoot=="function")try{It.onCommitFiberRoot(Bo,n,void 0,(n.current.flags&128)===128)}catch{}if(s!==null){n=D.T,d=P.p,P.p=2,D.T=null;try{for(var h=e.onRecoverableError,x=0;x<s.length;x++){var A=s[x];h(A.value,{componentStack:A.stack})}}finally{D.T=n,P.p=d}}(na&3)!==0&&rl(),Rn(e),d=e.pendingLanes,(r&261930)!==0&&(d&42)!==0?e===gd?bs++:(bs=0,gd=e):bs=0,ws(0)}}function av(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,es(n)))}function rl(){return ev(),tv(),nv(),rv()}function rv(){if(ct!==5)return!1;var e=Ta,n=pd;pd=0;var r=zc(na),s=D.T,d=P.p;try{P.p=32>r?32:r,D.T=null,r=hd,hd=null;var h=Ta,x=na;if(ct=0,no=Ta=null,na=0,(Ie&6)!==0)throw Error(i(331));var A=Ie;if(Ie|=4,Ug(h.current),zg(h,h.current,x,r),Ie=A,ws(0,!1),It&&typeof It.onPostCommitFiberRoot=="function")try{It.onPostCommitFiberRoot(Bo,h)}catch{}return!0}finally{P.p=d,D.T=s,av(e,n)}}function ov(e,n,r){n=on(r,n),n=Vu(e.stateNode,n,2),e=ba(e,n,2),e!==null&&(Wo(e,2),Rn(e))}function Pe(e,n,r){if(e.tag===3)ov(e,e,r);else for(;n!==null;){if(n.tag===3){ov(n,e,r);break}else if(n.tag===1){var s=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Ca===null||!Ca.has(s))){e=on(r,e),r=sg(2),s=ba(n,r,2),s!==null&&(ig(r,s,n,e),Wo(s,2),Rn(s));break}}n=n.return}}function bd(e,n,r){var s=e.pingCache;if(s===null){s=e.pingCache=new Pk;var d=new Set;s.set(n,d)}else d=s.get(n),d===void 0&&(d=new Set,s.set(n,d));d.has(r)||(dd=!0,d.add(r),e=Vk.bind(null,e,n,r),n.then(e,e))}function Vk(e,n,r){var s=e.pingCache;s!==null&&s.delete(n),e.pingedLanes|=e.suspendedLanes&r,e.warmLanes&=~r,$e===e&&(Le&r)===r&&(et===4||et===3&&(Le&62914560)===Le&&300>Oe()-Qi?(Ie&2)===0&&ao(e,0):fd|=r,to===Le&&(to=0)),Rn(e)}function sv(e,n){n===0&&(n=ep()),e=ar(e,n),e!==null&&(Wo(e,n),Rn(e))}function Gk(e){var n=e.memoizedState,r=0;n!==null&&(r=n.retryLane),sv(e,r)}function Xk(e,n){var r=0;switch(e.tag){case 31:case 13:var s=e.stateNode,d=e.memoizedState;d!==null&&(r=d.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(i(314))}s!==null&&s.delete(n),sv(e,r)}function Zk(e,n){return Nn(e,n)}var ol=null,oo=null,wd=!1,sl=!1,xd=!1,ja=0;function Rn(e){e!==oo&&e.next===null&&(oo===null?ol=oo=e:oo=oo.next=e),sl=!0,wd||(wd=!0,Jk())}function ws(e,n){if(!xd&&sl){xd=!0;do for(var r=!1,s=ol;s!==null;){if(e!==0){var d=s.pendingLanes;if(d===0)var h=0;else{var x=s.suspendedLanes,A=s.pingedLanes;h=(1<<31-qt(42|e)+1)-1,h&=d&~(x&~A),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(r=!0,uv(s,h))}else h=Le,h=ui(s,s===$e?h:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(h&3)===0||Uo(s,h)||(r=!0,uv(s,h));s=s.next}while(r);xd=!1}}function Qk(){iv()}function iv(){sl=wd=!1;var e=0;ja!==0&&c2()&&(e=ja);for(var n=Oe(),r=null,s=ol;s!==null;){var d=s.next,h=lv(s,n);h===0?(s.next=null,r===null?ol=d:r.next=d,d===null&&(oo=r)):(r=s,(e!==0||(h&3)!==0)&&(sl=!0)),s=d}ct!==0&&ct!==5||ws(e),ja!==0&&(ja=0)}function lv(e,n){for(var r=e.suspendedLanes,s=e.pingedLanes,d=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var x=31-qt(h),A=1<<x,z=d[x];z===-1?((A&r)===0||(A&s)!==0)&&(d[x]=C1(A,n)):z<=n&&(e.expiredLanes|=A),h&=~A}if(n=$e,r=Le,r=ui(e,e===n?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,r===0||e===n&&(qe===2||qe===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&tn(s),e.callbackNode=null,e.callbackPriority=0;if((r&3)===0||Uo(e,r)){if(n=r&-r,n===e.callbackPriority)return n;switch(s!==null&&tn(s),zc(r)){case 2:case 8:r=Ee;break;case 32:r=Be;break;case 268435456:r=Za;break;default:r=Be}return s=cv.bind(null,e),r=Nn(r,s),e.callbackPriority=n,e.callbackNode=r,n}return s!==null&&s!==null&&tn(s),e.callbackPriority=2,e.callbackNode=null,2}function cv(e,n){if(ct!==0&&ct!==5)return e.callbackNode=null,e.callbackPriority=0,null;var r=e.callbackNode;if(rl()&&e.callbackNode!==r)return null;var s=Le;return s=ui(e,e===$e?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(Fg(e,s,n),lv(e,Oe()),e.callbackNode!=null&&e.callbackNode===r?cv.bind(null,e):null)}function uv(e,n){if(rl())return null;Fg(e,n,!0)}function Jk(){d2(function(){(Ie&6)!==0?Nn(Ho,Qk):iv()})}function kd(){if(ja===0){var e=Fr;e===0&&(e=ii,ii<<=1,(ii&261888)===0&&(ii=256)),ja=e}return ja}function dv(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:pi(""+e)}function fv(e,n){var r=n.ownerDocument.createElement("input");return r.name=n.name,r.value=n.value,e.id&&r.setAttribute("form",e.id),n.parentNode.insertBefore(r,n),e=new FormData(e),r.parentNode.removeChild(r),e}function e2(e,n,r,s,d){if(n==="submit"&&r&&r.stateNode===d){var h=dv((d[jt]||null).action),x=s.submitter;x&&(n=(n=x[jt]||null)?dv(n.formAction):x.getAttribute("formAction"),n!==null&&(h=n,x=null));var A=new yi("action","action",null,s,d);e.push({event:A,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(ja!==0){var z=x?fv(d,x):new FormData(d);qu(r,{pending:!0,data:z,method:d.method,action:h},null,z)}}else typeof h=="function"&&(A.preventDefault(),z=x?fv(d,x):new FormData(d),qu(r,{pending:!0,data:z,method:d.method,action:h},h,z))},currentTarget:d}]})}}for(var Sd=0;Sd<ou.length;Sd++){var Ed=ou[Sd],t2=Ed.toLowerCase(),n2=Ed[0].toUpperCase()+Ed.slice(1);gn(t2,"on"+n2)}gn(Pp,"onAnimationEnd"),gn(Fp,"onAnimationIteration"),gn(Kp,"onAnimationStart"),gn("dblclick","onDoubleClick"),gn("focusin","onFocus"),gn("focusout","onBlur"),gn(yk,"onTransitionRun"),gn(bk,"onTransitionStart"),gn(wk,"onTransitionCancel"),gn(Yp,"onTransitionEnd"),_r("onMouseEnter",["mouseout","mouseover"]),_r("onMouseLeave",["mouseout","mouseover"]),_r("onPointerEnter",["pointerout","pointerover"]),_r("onPointerLeave",["pointerout","pointerover"]),Ja("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ja("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ja("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ja("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ja("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ja("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var xs="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),a2=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(xs));function mv(e,n){n=(n&4)!==0;for(var r=0;r<e.length;r++){var s=e[r],d=s.event;s=s.listeners;e:{var h=void 0;if(n)for(var x=s.length-1;0<=x;x--){var A=s[x],z=A.instance,Y=A.currentTarget;if(A=A.listener,z!==h&&d.isPropagationStopped())break e;h=A,d.currentTarget=Y;try{h(d)}catch(te){xi(te)}d.currentTarget=null,h=z}else for(x=0;x<s.length;x++){if(A=s[x],z=A.instance,Y=A.currentTarget,A=A.listener,z!==h&&d.isPropagationStopped())break e;h=A,d.currentTarget=Y;try{h(d)}catch(te){xi(te)}d.currentTarget=null,h=z}}}}function Me(e,n){var r=n[Hc];r===void 0&&(r=n[Hc]=new Set);var s=e+"__bubble";r.has(s)||(pv(n,e,2,!1),r.add(s))}function Cd(e,n,r){var s=0;n&&(s|=4),pv(r,e,s,n)}var il="_reactListening"+Math.random().toString(36).slice(2);function Td(e){if(!e[il]){e[il]=!0,ip.forEach(function(r){r!=="selectionchange"&&(a2.has(r)||Cd(r,!1,e),Cd(r,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[il]||(n[il]=!0,Cd("selectionchange",!1,n))}}function pv(e,n,r,s){switch(Pv(n)){case 2:var d=R2;break;case 8:d=O2;break;default:d=Id}r=d.bind(null,n,r,e),d=void 0,!Yc||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(d=!0),s?d!==void 0?e.addEventListener(n,r,{capture:!0,passive:d}):e.addEventListener(n,r,!0):d!==void 0?e.addEventListener(n,r,{passive:d}):e.addEventListener(n,r,!1)}function Nd(e,n,r,s,d){var h=s;if((n&1)===0&&(n&2)===0&&s!==null)e:for(;;){if(s===null)return;var x=s.tag;if(x===3||x===4){var A=s.stateNode.containerInfo;if(A===d)break;if(x===4)for(x=s.return;x!==null;){var z=x.tag;if((z===3||z===4)&&x.stateNode.containerInfo===d)return;x=x.return}for(;A!==null;){if(x=Nr(A),x===null)return;if(z=x.tag,z===5||z===6||z===26||z===27){s=h=x;continue e}A=A.parentNode}}s=s.return}bp(function(){var Y=h,te=Fc(r),se=[];e:{var G=$p.get(e);if(G!==void 0){var Q=yi,he=e;switch(e){case"keypress":if(gi(r)===0)break e;case"keydown":case"keyup":Q=X1;break;case"focusin":he="focus",Q=Xc;break;case"focusout":he="blur",Q=Xc;break;case"beforeblur":case"afterblur":Q=Xc;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Q=kp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Q=B1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Q=J1;break;case Pp:case Fp:case Kp:Q=I1;break;case Yp:Q=tk;break;case"scroll":case"scrollend":Q=z1;break;case"wheel":Q=ak;break;case"copy":case"cut":case"paste":Q=P1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Q=Ep;break;case"toggle":case"beforetoggle":Q=ok}var Ce=(n&4)!==0,Ye=!Ce&&(e==="scroll"||e==="scrollend"),W=Ce?G!==null?G+"Capture":null:G;Ce=[];for(var H=Y,K;H!==null;){var oe=H;if(K=oe.stateNode,oe=oe.tag,oe!==5&&oe!==26&&oe!==27||K===null||W===null||(oe=Po(H,W),oe!=null&&Ce.push(ks(H,oe,K))),Ye)break;H=H.return}0<Ce.length&&(G=new Q(G,he,null,r,te),se.push({event:G,listeners:Ce}))}}if((n&7)===0){e:{if(G=e==="mouseover"||e==="pointerover",Q=e==="mouseout"||e==="pointerout",G&&r!==Pc&&(he=r.relatedTarget||r.fromElement)&&(Nr(he)||he[Tr]))break e;if((Q||G)&&(G=te.window===te?te:(G=te.ownerDocument)?G.defaultView||G.parentWindow:window,Q?(he=r.relatedTarget||r.toElement,Q=Y,he=he?Nr(he):null,he!==null&&(Ye=u(he),Ce=he.tag,he!==Ye||Ce!==5&&Ce!==27&&Ce!==6)&&(he=null)):(Q=null,he=Y),Q!==he)){if(Ce=kp,oe="onMouseLeave",W="onMouseEnter",H="mouse",(e==="pointerout"||e==="pointerover")&&(Ce=Ep,oe="onPointerLeave",W="onPointerEnter",H="pointer"),Ye=Q==null?G:qo(Q),K=he==null?G:qo(he),G=new Ce(oe,H+"leave",Q,r,te),G.target=Ye,G.relatedTarget=K,oe=null,Nr(te)===Y&&(Ce=new Ce(W,H+"enter",he,r,te),Ce.target=K,Ce.relatedTarget=Ye,oe=Ce),Ye=oe,Q&&he)t:{for(Ce=r2,W=Q,H=he,K=0,oe=W;oe;oe=Ce(oe))K++;oe=0;for(var xe=H;xe;xe=Ce(xe))oe++;for(;0<K-oe;)W=Ce(W),K--;for(;0<oe-K;)H=Ce(H),oe--;for(;K--;){if(W===H||H!==null&&W===H.alternate){Ce=W;break t}W=Ce(W),H=Ce(H)}Ce=null}else Ce=null;Q!==null&&hv(se,G,Q,Ce,!1),he!==null&&Ye!==null&&hv(se,Ye,he,Ce,!0)}}e:{if(G=Y?qo(Y):window,Q=G.nodeName&&G.nodeName.toLowerCase(),Q==="select"||Q==="input"&&G.type==="file")var Ue=Op;else if(_p(G))if(Dp)Ue=hk;else{Ue=mk;var be=fk}else Q=G.nodeName,!Q||Q.toLowerCase()!=="input"||G.type!=="checkbox"&&G.type!=="radio"?Y&&qc(Y.elementType)&&(Ue=Op):Ue=pk;if(Ue&&(Ue=Ue(e,Y))){Rp(se,Ue,r,te);break e}be&&be(e,G,Y),e==="focusout"&&Y&&G.type==="number"&&Y.memoizedProps.value!=null&&Ic(G,"number",G.value)}switch(be=Y?qo(Y):window,e){case"focusin":(_p(be)||be.contentEditable==="true")&&(zr=be,nu=Y,Zo=null);break;case"focusout":Zo=nu=zr=null;break;case"mousedown":au=!0;break;case"contextmenu":case"mouseup":case"dragend":au=!1,Ip(se,r,te);break;case"selectionchange":if(vk)break;case"keydown":case"keyup":Ip(se,r,te)}var Re;if(Qc)e:{switch(e){case"compositionstart":var ze="onCompositionStart";break e;case"compositionend":ze="onCompositionEnd";break e;case"compositionupdate":ze="onCompositionUpdate";break e}ze=void 0}else Lr?jp(e,r)&&(ze="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(ze="onCompositionStart");ze&&(Cp&&r.locale!=="ko"&&(Lr||ze!=="onCompositionStart"?ze==="onCompositionEnd"&&Lr&&(Re=wp()):(fa=te,$c="value"in fa?fa.value:fa.textContent,Lr=!0)),be=ll(Y,ze),0<be.length&&(ze=new Sp(ze,e,null,r,te),se.push({event:ze,listeners:be}),Re?ze.data=Re:(Re=Ap(r),Re!==null&&(ze.data=Re)))),(Re=ik?lk(e,r):ck(e,r))&&(ze=ll(Y,"onBeforeInput"),0<ze.length&&(be=new Sp("onBeforeInput","beforeinput",null,r,te),se.push({event:be,listeners:ze}),be.data=Re)),e2(se,e,Y,r,te)}mv(se,n)})}function ks(e,n,r){return{instance:e,listener:n,currentTarget:r}}function ll(e,n){for(var r=n+"Capture",s=[];e!==null;){var d=e,h=d.stateNode;if(d=d.tag,d!==5&&d!==26&&d!==27||h===null||(d=Po(e,r),d!=null&&s.unshift(ks(e,d,h)),d=Po(e,n),d!=null&&s.push(ks(e,d,h))),e.tag===3)return s;e=e.return}return[]}function r2(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function hv(e,n,r,s,d){for(var h=n._reactName,x=[];r!==null&&r!==s;){var A=r,z=A.alternate,Y=A.stateNode;if(A=A.tag,z!==null&&z===s)break;A!==5&&A!==26&&A!==27||Y===null||(z=Y,d?(Y=Po(r,h),Y!=null&&x.unshift(ks(r,Y,z))):d||(Y=Po(r,h),Y!=null&&x.push(ks(r,Y,z)))),r=r.return}x.length!==0&&e.push({event:n,listeners:x})}var o2=/\r\n?/g,s2=/\u0000|\uFFFD/g;function gv(e){return(typeof e=="string"?e:""+e).replace(o2,`
10
+ `).replace(s2,"")}function vv(e,n){return n=gv(n),gv(e)===n}function Ke(e,n,r,s,d,h){switch(r){case"children":typeof s=="string"?n==="body"||n==="textarea"&&s===""||Or(e,s):(typeof s=="number"||typeof s=="bigint")&&n!=="body"&&Or(e,""+s);break;case"className":fi(e,"class",s);break;case"tabIndex":fi(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":fi(e,r,s);break;case"style":vp(e,s,h);break;case"data":if(n!=="object"){fi(e,"data",s);break}case"src":case"href":if(s===""&&(n!=="a"||r!=="href")){e.removeAttribute(r);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(r);break}s=pi(""+s),e.setAttribute(r,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(r,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof h=="function"&&(r==="formAction"?(n!=="input"&&Ke(e,n,"name",d.name,d,null),Ke(e,n,"formEncType",d.formEncType,d,null),Ke(e,n,"formMethod",d.formMethod,d,null),Ke(e,n,"formTarget",d.formTarget,d,null)):(Ke(e,n,"encType",d.encType,d,null),Ke(e,n,"method",d.method,d,null),Ke(e,n,"target",d.target,d,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(r);break}s=pi(""+s),e.setAttribute(r,s);break;case"onClick":s!=null&&(e.onclick=In);break;case"onScroll":s!=null&&Me("scroll",e);break;case"onScrollEnd":s!=null&&Me("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(i(61));if(r=s.__html,r!=null){if(d.children!=null)throw Error(i(60));e.innerHTML=r}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}r=pi(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(r,""+s):e.removeAttribute(r);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(r,""):e.removeAttribute(r);break;case"capture":case"download":s===!0?e.setAttribute(r,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(r,s):e.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(r,s):e.removeAttribute(r);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(r):e.setAttribute(r,s);break;case"popover":Me("beforetoggle",e),Me("toggle",e),di(e,"popover",s);break;case"xlinkActuate":Wn(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":Wn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":Wn(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":Wn(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":Wn(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":Wn(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":Wn(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":Wn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":Wn(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":di(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(r=M1.get(r)||r,di(e,r,s))}}function jd(e,n,r,s,d,h){switch(r){case"style":vp(e,s,h);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(i(61));if(r=s.__html,r!=null){if(d.children!=null)throw Error(i(60));e.innerHTML=r}}break;case"children":typeof s=="string"?Or(e,s):(typeof s=="number"||typeof s=="bigint")&&Or(e,""+s);break;case"onScroll":s!=null&&Me("scroll",e);break;case"onScrollEnd":s!=null&&Me("scrollend",e);break;case"onClick":s!=null&&(e.onclick=In);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!lp.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(d=r.endsWith("Capture"),n=r.slice(2,d?r.length-7:void 0),h=e[jt]||null,h=h!=null?h[r]:null,typeof h=="function"&&e.removeEventListener(n,h,d),typeof s=="function")){typeof h!="function"&&h!==null&&(r in e?e[r]=null:e.hasAttribute(r)&&e.removeAttribute(r)),e.addEventListener(n,s,d);break e}r in e?e[r]=s:s===!0?e.setAttribute(r,""):di(e,r,s)}}}function vt(e,n,r){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Me("error",e),Me("load",e);var s=!1,d=!1,h;for(h in r)if(r.hasOwnProperty(h)){var x=r[h];if(x!=null)switch(h){case"src":s=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Ke(e,n,h,x,r,null)}}d&&Ke(e,n,"srcSet",r.srcSet,r,null),s&&Ke(e,n,"src",r.src,r,null);return;case"input":Me("invalid",e);var A=h=x=d=null,z=null,Y=null;for(s in r)if(r.hasOwnProperty(s)){var te=r[s];if(te!=null)switch(s){case"name":d=te;break;case"type":x=te;break;case"checked":z=te;break;case"defaultChecked":Y=te;break;case"value":h=te;break;case"defaultValue":A=te;break;case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(i(137,n));break;default:Ke(e,n,s,te,r,null)}}mp(e,h,A,z,Y,x,d,!1);return;case"select":Me("invalid",e),s=x=h=null;for(d in r)if(r.hasOwnProperty(d)&&(A=r[d],A!=null))switch(d){case"value":h=A;break;case"defaultValue":x=A;break;case"multiple":s=A;default:Ke(e,n,d,A,r,null)}n=h,r=x,e.multiple=!!s,n!=null?Rr(e,!!s,n,!1):r!=null&&Rr(e,!!s,r,!0);return;case"textarea":Me("invalid",e),h=d=s=null;for(x in r)if(r.hasOwnProperty(x)&&(A=r[x],A!=null))switch(x){case"value":s=A;break;case"defaultValue":d=A;break;case"children":h=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(i(91));break;default:Ke(e,n,x,A,r,null)}hp(e,s,d,h);return;case"option":for(z in r)r.hasOwnProperty(z)&&(s=r[z],s!=null)&&(z==="selected"?e.selected=s&&typeof s!="function"&&typeof s!="symbol":Ke(e,n,z,s,r,null));return;case"dialog":Me("beforetoggle",e),Me("toggle",e),Me("cancel",e),Me("close",e);break;case"iframe":case"object":Me("load",e);break;case"video":case"audio":for(s=0;s<xs.length;s++)Me(xs[s],e);break;case"image":Me("error",e),Me("load",e);break;case"details":Me("toggle",e);break;case"embed":case"source":case"link":Me("error",e),Me("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Y in r)if(r.hasOwnProperty(Y)&&(s=r[Y],s!=null))switch(Y){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Ke(e,n,Y,s,r,null)}return;default:if(qc(n)){for(te in r)r.hasOwnProperty(te)&&(s=r[te],s!==void 0&&jd(e,n,te,s,r,void 0));return}}for(A in r)r.hasOwnProperty(A)&&(s=r[A],s!=null&&Ke(e,n,A,s,r,null))}function i2(e,n,r,s){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var d=null,h=null,x=null,A=null,z=null,Y=null,te=null;for(Q in r){var se=r[Q];if(r.hasOwnProperty(Q)&&se!=null)switch(Q){case"checked":break;case"value":break;case"defaultValue":z=se;default:s.hasOwnProperty(Q)||Ke(e,n,Q,null,s,se)}}for(var G in s){var Q=s[G];if(se=r[G],s.hasOwnProperty(G)&&(Q!=null||se!=null))switch(G){case"type":h=Q;break;case"name":d=Q;break;case"checked":Y=Q;break;case"defaultChecked":te=Q;break;case"value":x=Q;break;case"defaultValue":A=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(i(137,n));break;default:Q!==se&&Ke(e,n,G,Q,s,se)}}Wc(e,x,A,z,Y,te,h,d);return;case"select":Q=x=A=G=null;for(h in r)if(z=r[h],r.hasOwnProperty(h)&&z!=null)switch(h){case"value":break;case"multiple":Q=z;default:s.hasOwnProperty(h)||Ke(e,n,h,null,s,z)}for(d in s)if(h=s[d],z=r[d],s.hasOwnProperty(d)&&(h!=null||z!=null))switch(d){case"value":G=h;break;case"defaultValue":A=h;break;case"multiple":x=h;default:h!==z&&Ke(e,n,d,h,s,z)}n=A,r=x,s=Q,G!=null?Rr(e,!!r,G,!1):!!s!=!!r&&(n!=null?Rr(e,!!r,n,!0):Rr(e,!!r,r?[]:"",!1));return;case"textarea":Q=G=null;for(A in r)if(d=r[A],r.hasOwnProperty(A)&&d!=null&&!s.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:Ke(e,n,A,null,s,d)}for(x in s)if(d=s[x],h=r[x],s.hasOwnProperty(x)&&(d!=null||h!=null))switch(x){case"value":G=d;break;case"defaultValue":Q=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(i(91));break;default:d!==h&&Ke(e,n,x,d,s,h)}pp(e,G,Q);return;case"option":for(var he in r)G=r[he],r.hasOwnProperty(he)&&G!=null&&!s.hasOwnProperty(he)&&(he==="selected"?e.selected=!1:Ke(e,n,he,null,s,G));for(z in s)G=s[z],Q=r[z],s.hasOwnProperty(z)&&G!==Q&&(G!=null||Q!=null)&&(z==="selected"?e.selected=G&&typeof G!="function"&&typeof G!="symbol":Ke(e,n,z,G,s,Q));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ce in r)G=r[Ce],r.hasOwnProperty(Ce)&&G!=null&&!s.hasOwnProperty(Ce)&&Ke(e,n,Ce,null,s,G);for(Y in s)if(G=s[Y],Q=r[Y],s.hasOwnProperty(Y)&&G!==Q&&(G!=null||Q!=null))switch(Y){case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(i(137,n));break;default:Ke(e,n,Y,G,s,Q)}return;default:if(qc(n)){for(var Ye in r)G=r[Ye],r.hasOwnProperty(Ye)&&G!==void 0&&!s.hasOwnProperty(Ye)&&jd(e,n,Ye,void 0,s,G);for(te in s)G=s[te],Q=r[te],!s.hasOwnProperty(te)||G===Q||G===void 0&&Q===void 0||jd(e,n,te,G,s,Q);return}}for(var W in r)G=r[W],r.hasOwnProperty(W)&&G!=null&&!s.hasOwnProperty(W)&&Ke(e,n,W,null,s,G);for(se in s)G=s[se],Q=r[se],!s.hasOwnProperty(se)||G===Q||G==null&&Q==null||Ke(e,n,se,G,s,Q)}function yv(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function l2(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,r=performance.getEntriesByType("resource"),s=0;s<r.length;s++){var d=r[s],h=d.transferSize,x=d.initiatorType,A=d.duration;if(h&&A&&yv(x)){for(x=0,A=d.responseEnd,s+=1;s<r.length;s++){var z=r[s],Y=z.startTime;if(Y>A)break;var te=z.transferSize,se=z.initiatorType;te&&yv(se)&&(z=z.responseEnd,x+=te*(z<A?1:(A-Y)/(z-Y)))}if(--s,n+=8*(h+x)/(d.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Ad=null,_d=null;function cl(e){return e.nodeType===9?e:e.ownerDocument}function bv(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function wv(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function Rd(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var Od=null;function c2(){var e=window.event;return e&&e.type==="popstate"?e===Od?!1:(Od=e,!0):(Od=null,!1)}var xv=typeof setTimeout=="function"?setTimeout:void 0,u2=typeof clearTimeout=="function"?clearTimeout:void 0,kv=typeof Promise=="function"?Promise:void 0,d2=typeof queueMicrotask=="function"?queueMicrotask:typeof kv<"u"?function(e){return kv.resolve(null).then(e).catch(f2)}:xv;function f2(e){setTimeout(function(){throw e})}function Aa(e){return e==="head"}function Sv(e,n){var r=n,s=0;do{var d=r.nextSibling;if(e.removeChild(r),d&&d.nodeType===8)if(r=d.data,r==="/$"||r==="/&"){if(s===0){e.removeChild(d),co(n);return}s--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")s++;else if(r==="html")Ss(e.ownerDocument.documentElement);else if(r==="head"){r=e.ownerDocument.head,Ss(r);for(var h=r.firstChild;h;){var x=h.nextSibling,A=h.nodeName;h[Io]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&h.rel.toLowerCase()==="stylesheet"||r.removeChild(h),h=x}}else r==="body"&&Ss(e.ownerDocument.body);r=d}while(r);co(n)}function Ev(e,n){var r=e;e=0;do{var s=r.nextSibling;if(r.nodeType===1?n?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(n?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),s&&s.nodeType===8)if(r=s.data,r==="/$"){if(e===0)break;e--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||e++;r=s}while(r)}function Dd(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var r=n;switch(n=n.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":Dd(r),Bc(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}e.removeChild(r)}}function m2(e,n,r,s){for(;e.nodeType===1;){var d=r;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[Io])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(h=e.getAttribute("rel"),h==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(h!==d.rel||e.getAttribute("href")!==(d.href==null||d.href===""?null:d.href)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin)||e.getAttribute("title")!==(d.title==null?null:d.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(h=e.getAttribute("src"),(h!==(d.src==null?null:d.src)||e.getAttribute("type")!==(d.type==null?null:d.type)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&h&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var h=d.name==null?null:""+d.name;if(d.type==="hidden"&&e.getAttribute("name")===h)return e}else return e;if(e=dn(e.nextSibling),e===null)break}return null}function p2(e,n,r){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!r||(e=dn(e.nextSibling),e===null))return null;return e}function Cv(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=dn(e.nextSibling),e===null))return null;return e}function Md(e){return e.data==="$?"||e.data==="$~"}function Ld(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function h2(e,n){var r=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||r.readyState!=="loading")n();else{var s=function(){n(),r.removeEventListener("DOMContentLoaded",s)};r.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function dn(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var zd=null;function Tv(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"||r==="/&"){if(n===0)return dn(e.nextSibling);n--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||n++}e=e.nextSibling}return null}function Nv(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(n===0)return e;n--}else r!=="/$"&&r!=="/&"||n++}e=e.previousSibling}return null}function jv(e,n,r){switch(n=cl(r),e){case"html":if(e=n.documentElement,!e)throw Error(i(452));return e;case"head":if(e=n.head,!e)throw Error(i(453));return e;case"body":if(e=n.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function Ss(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);Bc(e)}var fn=new Map,Av=new Set;function ul(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var aa=P.d;P.d={f:g2,r:v2,D:y2,C:b2,L:w2,m:x2,X:S2,S:k2,M:E2};function g2(){var e=aa.f(),n=tl();return e||n}function v2(e){var n=jr(e);n!==null&&n.tag===5&&n.type==="form"?Yh(n):aa.r(e)}var so=typeof document>"u"?null:document;function _v(e,n,r){var s=so;if(s&&typeof n=="string"&&n){var d=an(n);d='link[rel="'+e+'"][href="'+d+'"]',typeof r=="string"&&(d+='[crossorigin="'+r+'"]'),Av.has(d)||(Av.add(d),e={rel:e,crossOrigin:r,href:n},s.querySelector(d)===null&&(n=s.createElement("link"),vt(n,"link",e),ut(n),s.head.appendChild(n)))}}function y2(e){aa.D(e),_v("dns-prefetch",e,null)}function b2(e,n){aa.C(e,n),_v("preconnect",e,n)}function w2(e,n,r){aa.L(e,n,r);var s=so;if(s&&e&&n){var d='link[rel="preload"][as="'+an(n)+'"]';n==="image"&&r&&r.imageSrcSet?(d+='[imagesrcset="'+an(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(d+='[imagesizes="'+an(r.imageSizes)+'"]')):d+='[href="'+an(e)+'"]';var h=d;switch(n){case"style":h=io(e);break;case"script":h=lo(e)}fn.has(h)||(e=v({rel:"preload",href:n==="image"&&r&&r.imageSrcSet?void 0:e,as:n},r),fn.set(h,e),s.querySelector(d)!==null||n==="style"&&s.querySelector(Es(h))||n==="script"&&s.querySelector(Cs(h))||(n=s.createElement("link"),vt(n,"link",e),ut(n),s.head.appendChild(n)))}}function x2(e,n){aa.m(e,n);var r=so;if(r&&e){var s=n&&typeof n.as=="string"?n.as:"script",d='link[rel="modulepreload"][as="'+an(s)+'"][href="'+an(e)+'"]',h=d;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=lo(e)}if(!fn.has(h)&&(e=v({rel:"modulepreload",href:e},n),fn.set(h,e),r.querySelector(d)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(Cs(h)))return}s=r.createElement("link"),vt(s,"link",e),ut(s),r.head.appendChild(s)}}}function k2(e,n,r){aa.S(e,n,r);var s=so;if(s&&e){var d=Ar(s).hoistableStyles,h=io(e);n=n||"default";var x=d.get(h);if(!x){var A={loading:0,preload:null};if(x=s.querySelector(Es(h)))A.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":n},r),(r=fn.get(h))&&Hd(e,r);var z=x=s.createElement("link");ut(z),vt(z,"link",e),z._p=new Promise(function(Y,te){z.onload=Y,z.onerror=te}),z.addEventListener("load",function(){A.loading|=1}),z.addEventListener("error",function(){A.loading|=2}),A.loading|=4,dl(x,n,s)}x={type:"stylesheet",instance:x,count:1,state:A},d.set(h,x)}}}function S2(e,n){aa.X(e,n);var r=so;if(r&&e){var s=Ar(r).hoistableScripts,d=lo(e),h=s.get(d);h||(h=r.querySelector(Cs(d)),h||(e=v({src:e,async:!0},n),(n=fn.get(d))&&Bd(e,n),h=r.createElement("script"),ut(h),vt(h,"link",e),r.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},s.set(d,h))}}function E2(e,n){aa.M(e,n);var r=so;if(r&&e){var s=Ar(r).hoistableScripts,d=lo(e),h=s.get(d);h||(h=r.querySelector(Cs(d)),h||(e=v({src:e,async:!0,type:"module"},n),(n=fn.get(d))&&Bd(e,n),h=r.createElement("script"),ut(h),vt(h,"link",e),r.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},s.set(d,h))}}function Rv(e,n,r,s){var d=(d=fe.current)?ul(d):null;if(!d)throw Error(i(446));switch(e){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(n=io(r.href),r=Ar(d).hoistableStyles,s=r.get(n),s||(s={type:"style",instance:null,count:0,state:null},r.set(n,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){e=io(r.href);var h=Ar(d).hoistableStyles,x=h.get(e);if(x||(d=d.ownerDocument||d,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,x),(h=d.querySelector(Es(e)))&&!h._p&&(x.instance=h,x.state.loading=5),fn.has(e)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},fn.set(e,r),h||C2(d,e,r,x.state))),n&&s===null)throw Error(i(528,""));return x}if(n&&s!==null)throw Error(i(529,""));return null;case"script":return n=r.async,r=r.src,typeof r=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=lo(r),r=Ar(d).hoistableScripts,s=r.get(n),s||(s={type:"script",instance:null,count:0,state:null},r.set(n,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,e))}}function io(e){return'href="'+an(e)+'"'}function Es(e){return'link[rel="stylesheet"]['+e+"]"}function Ov(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function C2(e,n,r,s){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?s.loading=1:(n=e.createElement("link"),s.preload=n,n.addEventListener("load",function(){return s.loading|=1}),n.addEventListener("error",function(){return s.loading|=2}),vt(n,"link",r),ut(n),e.head.appendChild(n))}function lo(e){return'[src="'+an(e)+'"]'}function Cs(e){return"script[async]"+e}function Dv(e,n,r){if(n.count++,n.instance===null)switch(n.type){case"style":var s=e.querySelector('style[data-href~="'+an(r.href)+'"]');if(s)return n.instance=s,ut(s),s;var d=v({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),ut(s),vt(s,"style",d),dl(s,r.precedence,e),n.instance=s;case"stylesheet":d=io(r.href);var h=e.querySelector(Es(d));if(h)return n.state.loading|=4,n.instance=h,ut(h),h;s=Ov(r),(d=fn.get(d))&&Hd(s,d),h=(e.ownerDocument||e).createElement("link"),ut(h);var x=h;return x._p=new Promise(function(A,z){x.onload=A,x.onerror=z}),vt(h,"link",s),n.state.loading|=4,dl(h,r.precedence,e),n.instance=h;case"script":return h=lo(r.src),(d=e.querySelector(Cs(h)))?(n.instance=d,ut(d),d):(s=r,(d=fn.get(h))&&(s=v({},r),Bd(s,d)),e=e.ownerDocument||e,d=e.createElement("script"),ut(d),vt(d,"link",s),e.head.appendChild(d),n.instance=d);case"void":return null;default:throw Error(i(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(s=n.instance,n.state.loading|=4,dl(s,r.precedence,e));return n.instance}function dl(e,n,r){for(var s=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=s.length?s[s.length-1]:null,h=d,x=0;x<s.length;x++){var A=s[x];if(A.dataset.precedence===n)h=A;else if(h!==d)break}h?h.parentNode.insertBefore(e,h.nextSibling):(n=r.nodeType===9?r.head:r,n.insertBefore(e,n.firstChild))}function Hd(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function Bd(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var fl=null;function Mv(e,n,r){if(fl===null){var s=new Map,d=fl=new Map;d.set(r,s)}else d=fl,s=d.get(r),s||(s=new Map,d.set(r,s));if(s.has(e))return s;for(s.set(e,null),r=r.getElementsByTagName(e),d=0;d<r.length;d++){var h=r[d];if(!(h[Io]||h[mt]||e==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var x=h.getAttribute(n)||"";x=e+x;var A=s.get(x);A?A.push(h):s.set(x,[h])}}return s}function Lv(e,n,r){e=e.ownerDocument||e,e.head.insertBefore(r,n==="title"?e.querySelector("head > title"):null)}function T2(e,n,r){if(r===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;return n.rel==="stylesheet"?(e=n.disabled,typeof n.precedence=="string"&&e==null):!0;case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function zv(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function N2(e,n,r,s){if(r.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var d=io(s.href),h=n.querySelector(Es(d));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=ml.bind(e),n.then(e,e)),r.state.loading|=4,r.instance=h,ut(h);return}h=n.ownerDocument||n,s=Ov(s),(d=fn.get(d))&&Hd(s,d),h=h.createElement("link"),ut(h);var x=h;x._p=new Promise(function(A,z){x.onload=A,x.onerror=z}),vt(h,"link",s),r.instance=h}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(r,n),(n=r.state.preload)&&(r.state.loading&3)===0&&(e.count++,r=ml.bind(e),n.addEventListener("load",r),n.addEventListener("error",r))}}var Ud=0;function j2(e,n){return e.stylesheets&&e.count===0&&hl(e,e.stylesheets),0<e.count||0<e.imgCount?function(r){var s=setTimeout(function(){if(e.stylesheets&&hl(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+n);0<e.imgBytes&&Ud===0&&(Ud=62500*l2());var d=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&hl(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>Ud?50:800)+n);return e.unsuspend=r,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(d)}}:null}function ml(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)hl(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var pl=null;function hl(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,pl=new Map,n.forEach(A2,e),pl=null,ml.call(e))}function A2(e,n){if(!(n.state.loading&4)){var r=pl.get(e);if(r)var s=r.get(null);else{r=new Map,pl.set(e,r);for(var d=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<d.length;h++){var x=d[h];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(r.set(x.dataset.precedence,x),s=x)}s&&r.set(null,s)}d=n.instance,x=d.getAttribute("data-precedence"),h=r.get(x)||s,h===s&&r.set(null,d),r.set(x,d),this.count++,s=ml.bind(this),d.addEventListener("load",s),d.addEventListener("error",s),h?h.parentNode.insertBefore(d,h.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(d,e.firstChild)),n.state.loading|=4}}var Ts={$$typeof:_,Provider:null,Consumer:null,_currentValue:I,_currentValue2:I,_threadCount:0};function _2(e,n,r,s,d,h,x,A,z){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Mc(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Mc(0),this.hiddenUpdates=Mc(null),this.identifierPrefix=s,this.onUncaughtError=d,this.onCaughtError=h,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=z,this.incompleteTransitions=new Map}function Hv(e,n,r,s,d,h,x,A,z,Y,te,se){return e=new _2(e,n,r,x,z,Y,te,se,A),n=1,h===!0&&(n|=24),h=Ft(3,null,null,n),e.current=h,h.stateNode=e,n=yu(),n.refCount++,e.pooledCache=n,n.refCount++,h.memoizedState={element:s,isDehydrated:r,cache:n},ku(h),e}function Bv(e){return e?(e=Ur,e):Ur}function Uv(e,n,r,s,d,h){d=Bv(d),s.context===null?s.context=d:s.pendingContext=d,s=ya(n),s.payload={element:r},h=h===void 0?null:h,h!==null&&(s.callback=h),r=ba(e,s,n),r!==null&&(Mt(r,e,n),rs(r,e,n))}function Wv(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<n?r:n}}function Wd(e,n){Wv(e,n),(e=e.alternate)&&Wv(e,n)}function Iv(e){if(e.tag===13||e.tag===31){var n=ar(e,67108864);n!==null&&Mt(n,e,67108864),Wd(e,67108864)}}function qv(e){if(e.tag===13||e.tag===31){var n=Gt();n=Lc(n);var r=ar(e,n);r!==null&&Mt(r,e,n),Wd(e,n)}}var gl=!0;function R2(e,n,r,s){var d=D.T;D.T=null;var h=P.p;try{P.p=2,Id(e,n,r,s)}finally{P.p=h,D.T=d}}function O2(e,n,r,s){var d=D.T;D.T=null;var h=P.p;try{P.p=8,Id(e,n,r,s)}finally{P.p=h,D.T=d}}function Id(e,n,r,s){if(gl){var d=qd(s);if(d===null)Nd(e,n,s,vl,r),Fv(e,s);else if(M2(d,e,n,r,s))s.stopPropagation();else if(Fv(e,s),n&4&&-1<D2.indexOf(e)){for(;d!==null;){var h=jr(d);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var x=Qa(h.pendingLanes);if(x!==0){var A=h;for(A.pendingLanes|=2,A.entangledLanes|=2;x;){var z=1<<31-qt(x);A.entanglements[1]|=z,x&=~z}Rn(h),(Ie&6)===0&&(Ji=Oe()+500,ws(0))}}break;case 31:case 13:A=ar(h,2),A!==null&&Mt(A,h,2),tl(),Wd(h,2)}if(h=qd(s),h===null&&Nd(e,n,s,vl,r),h===d)break;d=h}d!==null&&s.stopPropagation()}else Nd(e,n,s,null,r)}}function qd(e){return e=Fc(e),Pd(e)}var vl=null;function Pd(e){if(vl=null,e=Nr(e),e!==null){var n=u(e);if(n===null)e=null;else{var r=n.tag;if(r===13){if(e=f(n),e!==null)return e;e=null}else if(r===31){if(e=m(n),e!==null)return e;e=null}else if(r===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return vl=e,null}function Pv(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Xa()){case Ho:return 2;case Ee:return 8;case Be:case ft:return 32;case Za:return 268435456;default:return 32}default:return 32}}var Fd=!1,_a=null,Ra=null,Oa=null,Ns=new Map,js=new Map,Da=[],D2="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Fv(e,n){switch(e){case"focusin":case"focusout":_a=null;break;case"dragenter":case"dragleave":Ra=null;break;case"mouseover":case"mouseout":Oa=null;break;case"pointerover":case"pointerout":Ns.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":js.delete(n.pointerId)}}function As(e,n,r,s,d,h){return e===null||e.nativeEvent!==h?(e={blockedOn:n,domEventName:r,eventSystemFlags:s,nativeEvent:h,targetContainers:[d]},n!==null&&(n=jr(n),n!==null&&Iv(n)),e):(e.eventSystemFlags|=s,n=e.targetContainers,d!==null&&n.indexOf(d)===-1&&n.push(d),e)}function M2(e,n,r,s,d){switch(n){case"focusin":return _a=As(_a,e,n,r,s,d),!0;case"dragenter":return Ra=As(Ra,e,n,r,s,d),!0;case"mouseover":return Oa=As(Oa,e,n,r,s,d),!0;case"pointerover":var h=d.pointerId;return Ns.set(h,As(Ns.get(h)||null,e,n,r,s,d)),!0;case"gotpointercapture":return h=d.pointerId,js.set(h,As(js.get(h)||null,e,n,r,s,d)),!0}return!1}function Kv(e){var n=Nr(e.target);if(n!==null){var r=u(n);if(r!==null){if(n=r.tag,n===13){if(n=f(r),n!==null){e.blockedOn=n,op(e.priority,function(){qv(r)});return}}else if(n===31){if(n=m(r),n!==null){e.blockedOn=n,op(e.priority,function(){qv(r)});return}}else if(n===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function yl(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var r=qd(e.nativeEvent);if(r===null){r=e.nativeEvent;var s=new r.constructor(r.type,r);Pc=s,r.target.dispatchEvent(s),Pc=null}else return n=jr(r),n!==null&&Iv(n),e.blockedOn=r,!1;n.shift()}return!0}function Yv(e,n,r){yl(e)&&r.delete(n)}function L2(){Fd=!1,_a!==null&&yl(_a)&&(_a=null),Ra!==null&&yl(Ra)&&(Ra=null),Oa!==null&&yl(Oa)&&(Oa=null),Ns.forEach(Yv),js.forEach(Yv)}function bl(e,n){e.blockedOn===n&&(e.blockedOn=null,Fd||(Fd=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,L2)))}var wl=null;function $v(e){wl!==e&&(wl=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){wl===e&&(wl=null);for(var n=0;n<e.length;n+=3){var r=e[n],s=e[n+1],d=e[n+2];if(typeof s!="function"){if(Pd(s||r)===null)continue;break}var h=jr(r);h!==null&&(e.splice(n,3),n-=3,qu(h,{pending:!0,data:d,method:r.method,action:s},s,d))}}))}function co(e){function n(z){return bl(z,e)}_a!==null&&bl(_a,e),Ra!==null&&bl(Ra,e),Oa!==null&&bl(Oa,e),Ns.forEach(n),js.forEach(n);for(var r=0;r<Da.length;r++){var s=Da[r];s.blockedOn===e&&(s.blockedOn=null)}for(;0<Da.length&&(r=Da[0],r.blockedOn===null);)Kv(r),r.blockedOn===null&&Da.shift();if(r=(e.ownerDocument||e).$$reactFormReplay,r!=null)for(s=0;s<r.length;s+=3){var d=r[s],h=r[s+1],x=d[jt]||null;if(typeof h=="function")x||$v(r);else if(x){var A=null;if(h&&h.hasAttribute("formAction")){if(d=h,x=h[jt]||null)A=x.formAction;else if(Pd(d)!==null)continue}else A=x.action;typeof A=="function"?r[s+1]=A:(r.splice(s,3),s-=3),$v(r)}}}function Vv(){function e(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(x){return d=x})},focusReset:"manual",scroll:"manual"})}function n(){d!==null&&(d(),d=null),s||setTimeout(r,20)}function r(){if(!s&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,d=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(r,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),d!==null&&(d(),d=null)}}}function Kd(e){this._internalRoot=e}xl.prototype.render=Kd.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(i(409));var r=n.current,s=Gt();Uv(r,s,e,n,null,null)},xl.prototype.unmount=Kd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;Uv(e.current,2,null,e,null,null),tl(),n[Tr]=null}};function xl(e){this._internalRoot=e}xl.prototype.unstable_scheduleHydration=function(e){if(e){var n=rp();e={blockedOn:null,target:e,priority:n};for(var r=0;r<Da.length&&n!==0&&n<Da[r].priority;r++);Da.splice(r,0,e),r===0&&Kv(e)}};var Gv=a.version;if(Gv!=="19.2.5")throw Error(i(527,Gv,"19.2.5"));P.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(i(188)):(e=Object.keys(e).join(","),Error(i(268,e)));return e=p(n),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var z2={bundleType:0,version:"19.2.5",rendererPackageName:"react-dom",currentDispatcherRef:D,reconcilerVersion:"19.2.5"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var kl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!kl.isDisabled&&kl.supportsFiber)try{Bo=kl.inject(z2),It=kl}catch{}}return Rs.createRoot=function(e,n){if(!l(e))throw Error(i(299));var r=!1,s="",d=ng,h=ag,x=rg;return n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onUncaughtError!==void 0&&(d=n.onUncaughtError),n.onCaughtError!==void 0&&(h=n.onCaughtError),n.onRecoverableError!==void 0&&(x=n.onRecoverableError)),n=Hv(e,1,!1,null,null,r,s,null,d,h,x,Vv),e[Tr]=n.current,Td(e),new Kd(n)},Rs.hydrateRoot=function(e,n,r){if(!l(e))throw Error(i(299));var s=!1,d="",h=ng,x=ag,A=rg,z=null;return r!=null&&(r.unstable_strictMode===!0&&(s=!0),r.identifierPrefix!==void 0&&(d=r.identifierPrefix),r.onUncaughtError!==void 0&&(h=r.onUncaughtError),r.onCaughtError!==void 0&&(x=r.onCaughtError),r.onRecoverableError!==void 0&&(A=r.onRecoverableError),r.formState!==void 0&&(z=r.formState)),n=Hv(e,1,!0,n,r??null,s,d,z,h,x,A,Vv),n.context=Bv(null),r=n.current,s=Gt(),s=Lc(s),d=ya(s),d.callback=null,ba(r,d,s),r=s,n.current.lanes=r,Wo(n,r),Rn(n),e[Tr]=n.current,Td(e),new xl(n)},Rs.version="19.2.5",Rs}var oy;function $2(){if(oy)return Vd.exports;oy=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(a){console.error(a)}}return t(),Vd.exports=Y2(),Vd.exports}var V2=$2();const G2="modulepreload",X2=function(t){return"/"+t},sy={},Nt=function(a,o,i){let l=Promise.resolve();if(o&&o.length>0){let g=function(p){return Promise.all(p.map(y=>Promise.resolve(y).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),m=f?.nonce||f?.getAttribute("nonce");l=g(o.map(p=>{if(p=X2(p),p in sy)return;sy[p]=!0;const y=p.endsWith(".css"),v=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${v}`))return;const k=document.createElement("link");if(k.rel=y?"stylesheet":G2,y||(k.as="script"),k.crossOrigin="",k.href=p,m&&k.setAttribute("nonce",m),document.head.appendChild(k),y)return new Promise((S,T)=>{k.addEventListener("load",S),k.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${p}`)))})}))}function u(f){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=f,window.dispatchEvent(m),!m.defaultPrevented)throw f}return l.then(f=>{for(const m of f||[])m.status==="rejected"&&u(m.reason);return a().catch(u)})},Z2=b.lazy(()=>Nt(()=>import("./WorkspaceTaskDrawer-CpGGZkp3.js"),__vite__mapDeps([0,1])).then(t=>({default:t.WorkspaceTaskDrawer}))),Q2=b.lazy(()=>Nt(()=>import("./AddWorkspaceFlow-3sR25gDy.js"),[]).then(t=>({default:t.AddWorkspaceFlow}))),J2=b.lazy(()=>Nt(()=>import("./FirstRunWizard-DU8PipxA.js"),[]).then(t=>({default:t.FirstRunWizard}))),eS=b.lazy(()=>Nt(()=>import("./WhatsNewDialog-C7awVYub.js"),[]).then(t=>({default:t.WhatsNewDialog}))),tS=({addDialogTrigger:t,onAddWorkspace:a,onCloseTaskGraph:o,onCloseWizard:i,onCreateWorkspace:l,onTryDemo:u,taskGraphOpen:f,tasksFile:m,wizardOpen:g,whatsNewOpen:p,whatsNewEntries:y,onCloseWhatsNew:v,workspacePath:k,workers:S,onSelectOwner:T,connectionStale:w})=>c.jsxs(c.Fragment,{children:[k?c.jsx(b.Suspense,{fallback:null,children:c.jsx(Z2,{open:f,tasksFile:m,onClose:o,workspacePath:k,...S?{workers:S}:{},...T?{onSelectOwner:T}:{},...w!==void 0?{connectionStale:w}:{}})}):null,t>0?c.jsx(b.Suspense,{fallback:null,children:c.jsx(Q2,{onClose:()=>{},onCreate:l,onTryDemo:u,trigger:t})}):null,g?c.jsx(b.Suspense,{fallback:null,children:c.jsx(J2,{open:g,onClose:i,onAddWorkspace:a,onTryDemo:u})}):null,p?c.jsx(b.Suspense,{fallback:null,children:c.jsx(eS,{open:p,entries:[...y],onClose:v})}):null]});const qb=(...t)=>t.filter((a,o,i)=>!!a&&a.trim()!==""&&i.indexOf(a)===o).join(" ").trim();const nS=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const aS=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,o,i)=>i?i.toUpperCase():o.toLowerCase());const iy=t=>{const a=aS(t);return a.charAt(0).toUpperCase()+a.slice(1)};var Qd={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const rS=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0;return!1},oS=b.createContext({}),sS=()=>b.useContext(oS),iS=b.forwardRef(({color:t,size:a,strokeWidth:o,absoluteStrokeWidth:i,className:l="",children:u,iconNode:f,...m},g)=>{const{size:p=24,strokeWidth:y=2,absoluteStrokeWidth:v=!1,color:k="currentColor",className:S=""}=sS()??{},T=i??v?Number(o??y)*24/Number(a??p):o??y;return b.createElement("svg",{ref:g,...Qd,width:a??p??Qd.width,height:a??p??Qd.height,stroke:t??k,strokeWidth:T,className:qb("lucide",S,l),...!u&&!rS(m)&&{"aria-hidden":"true"},...m},[...f.map(([w,E])=>b.createElement(w,E)),...Array.isArray(u)?u:[u]])});const ye=(t,a)=>{const o=b.forwardRef(({className:i,...l},u)=>b.createElement(iS,{ref:u,iconNode:a,className:qb(`lucide-${nS(iy(t))}`,`lucide-${t}`,i),...l}));return o.displayName=iy(t),o};const lS=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],fc=ye("activity",lS);const cS=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],uS=ye("arrow-right",cS);const dS=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],Wf=ye("bell",dS);const fS=[["path",{d:"M12 21V7",key:"gj6g52"}],["path",{d:"m16 12 2 2 4-4",key:"mdajum"}],["path",{d:"M22 6V4a1 1 0 0 0-1-1h-5a4 4 0 0 0-4 4 4 4 0 0 0-4-4H3a1 1 0 0 0-1 1v13a1 1 0 0 0 1 1h6a3 3 0 0 1 3 3 3 3 0 0 1 3-3h6a1 1 0 0 0 1-1v-1.3",key:"8arnkb"}]],mS=ye("book-open-check",fS);const pS=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],hS=ye("brain",pS);const gS=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ga=ye("check",gS);const vS=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],No=ye("chevron-down",vS);const yS=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],bS=ye("chevron-left",yS);const wS=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],mc=ye("chevron-right",wS);const xS=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],kS=ye("chevrons-left",xS);const SS=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],ES=ye("chevrons-right",SS);const CS=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Pb=ye("circle-check",CS);const TS=[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],NS=ye("circle-play",TS);const jS=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],AS=ye("circle-question-mark",jS);const _S=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],RS=ye("circle-x",_S);const OS=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],DS=ye("circle",OS);const MS=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]],LS=ye("clock-3",MS);const zS=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],HS=ye("code-xml",zS);const BS=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Cr=ye("copy",BS);const US=[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]],wm=ye("crown",US);const WS=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],IS=ye("ellipsis-vertical",WS);const qS=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],xm=ye("external-link",qS);const PS=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],FS=ye("eye",PS);const KS=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Fb=ye("file-text",KS);const YS=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],Fl=ye("flask-conical",YS);const $S=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Kb=ye("folder-plus",$S);const VS=[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9",key:"1hayfq"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"15ts47"}]],GS=ye("hammer",VS);const XS=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Yb=ye("info",XS);const ZS=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],QS=ye("languages",ZS);const JS=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]],Jd=ye("laptop",JS);const eE=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],$b=ye("list-checks",eE);const tE=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Fa=ye("loader-circle",tE);const nE=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],aE=ye("log-out",nE);const rE=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],oE=ye("maximize-2",rE);const sE=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],iE=ye("minimize-2",sE);const lE=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],cE=ye("package",lE);const uE=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Vb=ye("pencil",uE);const dE=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],jo=ye("play",dE);const fE=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Kl=ye("plus",fE);const mE=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],ly=ye("radio",mE);const pE=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],km=ye("refresh-cw",pE);const hE=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],Sm=ye("rotate-ccw",hE);const gE=[["path",{d:"m8 11 2 2 4-4",key:"1sed1v"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],vE=ye("search-check",gE);const yE=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],bE=ye("send",yE);const wE=[["path",{d:"M6 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-2",key:"4b9dqc"}],["path",{d:"M6 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-2",key:"22nnkd"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"m13 6-4 6h6l-4 6",key:"14hqih"}]],xE=ye("server-crash",wE);const kE=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],If=ye("settings",kE);const SE=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],EE=ye("shield-check",SE);const CE=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],TE=ye("sliders-horizontal",CE);const NE=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],Gb=ye("smartphone",NE);const jE=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],Xb=ye("sparkles",jE);const AE=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Zb=ye("square",AE);const _E=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],pc=ye("terminal",_E);const RE=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],hc=ye("trash-2",RE);const OE=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ks=ye("triangle-alert",OE);const DE=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],ef=ye("user-plus",DE);const ME=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],LE=ye("user-round",ME);const zE=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],gc=ye("users",zE);const HE=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],Yl=ye("volume-2",HE);const BE=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],Qb=ye("volume-x",BE);const UE=[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]],WE=ye("webhook",UE);const IE=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],Jb=ye("workflow",IE);const qE=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ka=ye("x",qE),PE=t=>t==="en"||t==="zh",e0="hive.uiLanguage",t0={"addWorker.agentCli":"Agent CLI","addWorker.agentNotFound":"not found","addWorker.agentExists":"Member name already exists","addWorker.cancel":"Cancel","addWorker.create":"Add Member","addWorker.creating":"Creating…","addWorker.customPlaceholder":"You are a security reviewer focused on auth and input validation. Use team report to hand findings back to the orchestrator.","addWorker.description":"Pick a role and a CLI agent. The orchestrator dispatches work via {command}.","addWorker.enterName":"Enter a name","addWorker.genericAgent":"Generic command","addWorker.genericCommand":"startup command only","addWorker.loadingPresets":"Loading presets…","addWorker.name":"Name","addWorker.namePlaceholder":"e.g. Alice","addWorker.modifiedFrom":"Modified from {role} default","addWorker.pickCliOrStartup":"Pick a CLI agent or enter a startup command","addWorker.random":"Random","addWorker.randomAria":"Generate random member name","addWorker.randomTooltip":"Suggest a random name","addWorker.role":"Role","addWorker.roleInstructions":"Role instructions","addWorker.roleInstructionsTitle":"Injected into the agent's startup prompt and every dispatch. Hive's team protocol stays fixed; this only steers role behavior.","addWorker.reset":"Reset","addWorker.saveAsTemplate":"Save as template","addWorker.startupCommand":"Startup command","addWorker.startupHelp":"Optional. Runs through your shell in this Workspace (bash/zsh/fish on POSIX, cmd.exe on Windows). Use it for custom agents or native resume commands such as {example}.","addWorker.startupOverrides":"overrides CLI launch","addWorker.template":"Saved templates","addWorker.templateClear":"Use blank Custom (no template)","addWorker.templateDeleteAria":"Delete template {name}","addWorker.templateDeleteConfirm":'Delete the saved template "{name}"? This cannot be undone.',"addWorker.templateDeleteConfirmLabel":"Delete","addWorker.templateDeleteTitle":"Delete role template","addWorker.templateEmpty":"No saved templates yet. Fill in role instructions and save one.","addWorker.templateNamePlaceholder":"Template name","addWorker.templateNoMatch":"No templates match this search.","addWorker.templatePickPlaceholder":"Choose a saved template…","addWorker.templateSaveConfirm":"Save","addWorker.templateSearchPlaceholder":"Search templates","addWorker.title":"Add team member","addWorker.unavailable":"{name} is not installed","addWorker.emptyInstructions":"Add role instructions","actionCenter.activity.cancelled":"{worker} cancelled {ago}","actionCenter.activity.queued":"{worker} received work {ago}","actionCenter.activity.reported":"{worker} reported {ago}","actionCenter.activity.submitted":"{worker} started {ago}","actionCenter.attention":"Attention","actionCenter.attention.noWorkers":"No team members yet.","actionCenter.attention.remoteError":"Remote request errored at {endpoint}.","actionCenter.attention.remoteRejected":"Remote request rejected at {endpoint}: {reason}.","actionCenter.attention.stoppedWithQueue":"{worker} is stopped with open work.","actionCenter.attention.waitingReport":"{worker} has been waiting to report for {minutes}m.","actionCenter.attentionSubtitle":"Blocked or stale work that may need orchestration.","actionCenter.allClear":"All clear","actionCenter.collapse":"Collapse Action Center","actionCenter.copyRecap":"Copy recap","actionCenter.currentDispatch":"Current","actionCenter.expand":"Expand Action Center","actionCenter.latestReport":"Report","actionCenter.loadFailed":"Could not load team activity.","actionCenter.liveSnapshot":"Live snapshot","actionCenter.loading":"Loading team activity...","actionCenter.metrics":"Action Center metrics","actionCenter.needsAttention":"{count} need attention","actionCenter.noActivity":"No recent team activity.","actionCenter.noAttention":"No blocked work or remote errors right now.","actionCenter.noWorkerEvidence":"No active worker evidence.","actionCenter.openDispatches":"Open dispatches","actionCenter.recapCopied":"Recap copied to clipboard.","actionCenter.recapCopyFailed":"Could not copy recap.","actionCenter.recent":"Recent","actionCenter.recentReports":"Recent reports","actionCenter.recentSubtitle":"Dispatches, reports, and cancellations in order.","actionCenter.reportCount":"{count} reports","actionCenter.runningCount":"{count} running","actionCenter.subtitle":"Team activity, open dispatches, and evidence for the next orchestration move","actionCenter.terminalHint":"Terminal","actionCenter.title":"Action Center","actionCenter.totalWorkers":"Team members","actionCenter.unknownWorker":"Unknown member","actionCenter.updated":"Updated {ago}","actionCenter.workingWorkers":"Working now","actionCenter.workerStatus":"Status","actionCenter.workers":"Workers","actionCenter.workersSubtitle":"Current work, latest reports, and terminal hints.","common.cancel":"Cancel","common.close":"Close","common.dismiss":"Dismiss","common.never":"Never","common.error":"Error","common.closeDialog":"Close dialog","common.time.sAgo":"{count}s ago","common.time.mAgo":"{count}m ago","common.time.hAgo":"{count}h ago","common.time.dAgo":"{count}d ago","common.copied":"Copied","common.copyError":"Copy error","common.delete":"Delete","common.idle":"idle","common.loading":"Loading…","common.refresh":"Refresh","common.restart":"Restart","common.retry":"Retry","common.running":"running","common.save":"Save","common.saving":"Saving…","common.start":"Start","common.starting":"Starting…","common.stop":"Stop","common.stopped":"stopped","common.working":"working","connect.login.failed":"Sign-in failed — check your connection and try again.","connect.login.heading":"Connect to your Hive","connect.login.subtitle":"Sign in to reach the computers running Hive on your account.","connect.login.github":"Continue with GitHub","connect.login.google":"Continue with Google","connect.login.signingIn":"Signing in…","connect.machines.back":"Back","connect.machines.connecting":"Connecting…","connect.machines.heading":"Your computers","connect.machines.empty":"No computers yet. Run Hive on a computer and enable remote access.","connect.machines.lastSeen":"Last seen {ago} ago","connect.machines.manageDevices":"Manage devices","connect.machines.offline":"Offline","connect.machines.online":"Online","connect.machines.revoked":"Access revoked","connect.machines.revokedHint":"This device's access was revoked — enter a new pairing code to connect again.","connect.machines.select":"Connect","connect.pair.back":"Back","connect.pair.finalizing":"Confirmed — preparing your session…","connect.pair.guideHeading":"Pair this phone","connect.pair.guideStep1":"On that computer, open Settings → Remote access.","connect.pair.guideStep2":"Click Add device and keep the pairing code visible.","connect.pair.guideStep3":"Enter that pairing code below.","connect.pair.qrLabel":"Pairing code","connect.pair.sasInstruction":"On your computer, open Settings → Remote access and tap Confirm if this code matches.","connect.pair.sasPrompt":"Confirm this code matches the one shown on your computer:","connect.pair.startOver":"Start over","connect.pair.submit":"Pair","connect.error.selectFailed":"Couldn't reach that computer. Your saved session may have expired, or it's offline — pair again below.","connect.error.invalidCode":"That pairing code doesn't look right. Check it and try again.","demo.banner":"Demo mode — interactive product replay.","demo.exit":"Exit demo","demo.replaySubtitle":"A local replay of planning, dispatch, report, and task closure.","demo.replayTitle":"Hive demo workspace","demo.tasksTitle":"Task graph","demo.teamTitle":"Team","firstRun.addWorkspace":"Add Workspace","firstRun.back":"Back","firstRun.desc":"Coordinate multiple CLI coding agents — locally.","firstRun.getStarted":"Get started","firstRun.howItWorks":"How it works","firstRun.next":"Next","firstRun.optionDesc":"Choose how you want to begin.","firstRun.slide1Desc":"Pick a project folder.","firstRun.slide1Title":"Add a Workspace","firstRun.slide2Desc":"Antigravity CLI, Claude Code, Codex, Gemini, OpenCode, Hermes, Qwen Code — your choice.","firstRun.slide2Title":"Pick an Orchestrator","firstRun.slide3Desc":"The Orchestrator dispatches `team send <worker> <task>` to team members.","firstRun.slide3Title":"Dispatch tasks","firstRun.skip":"Skip","firstRun.skipForNow":"Skip for now","firstRun.step":"Step {current} of {total}","firstRun.subtitle":"Each Workspace runs an Orchestrator that dispatches tasks to team members.","firstRun.title":"Welcome to Hive","firstRun.tryDemo":"Try Demo","language.aria":"Switch language","language.currentEn":"EN","language.currentZh":"中","language.en":"EN","language.switchToEn":"Switch language to English","language.switchToZh":"Switch language to 中文","language.tooltip":"Language","language.zh":"中文","marketplace.allCategories":"All","marketplace.backToList":"Back to list","marketplace.close":"Close marketplace","marketplace.empty":"No matching agents","marketplace.importButton":"Fill into form","marketplace.importedBadge":"You have a saved template with this name","marketplace.loading":"Loading…","marketplace.imported":"Filled the form from {name}","marketplace.loadFailed":"Failed to load marketplace","marketplace.openFromAddWorker":"Browse marketplace","marketplace.searchPlaceholder":"Search agents…","marketplace.showAllCategories":"Show {count} more categories","marketplace.showCoreOnly":"Show core only","marketplace.sourceLabel":"Curated from {repo}","marketplace.title":"Template marketplace","marketplace.viewSource":"View on GitHub","mobile.nav.aria":"Main navigation","mobile.focus.enter":"Focus the terminal (hide navigation)","mobile.focus.exit":"Show navigation","mobile.nav.flows":"Flows","mobile.nav.more":"More","mobile.nav.settings":"Settings","mobile.nav.tasks":"Tasks","mobile.nav.team":"Team","mobile.reconnect.disconnected":"Disconnected.","mobile.reconnect.reconnecting":"Reconnecting…","mobile.reconnect.retry":"Retry","mobile.reconnect.revoked":"Access revoked — re-pair this device from your computer.","mobile.section.about":"About","mobile.section.demo":"Demo","mobile.section.devices":"Devices","mobile.section.settings":"Settings","mobile.section.workflows":"Workflows","mobile.section.workspaces":"Workspaces","mobile.tasks.noWorkspaceDesc":"Pick or add a workspace to see its task graph.","mobile.tasks.noWorkspaceTitle":"No workspace selected","mobile.team.orchestrator":"Orchestrator","mobile.team.workers":"Workers","mobile.workspaces.switch":"Switch workspace","openWorkspace.error.appNotInstalled":"Couldn't find {app}. Make sure it's installed and reachable.","openWorkspace.error.commandNotInPath":"Couldn't run the launcher for {app}. Add its CLI to your PATH and retry.","openWorkspace.error.invalidPath":"The workspace path contains characters that are unsafe to launch.","openWorkspace.error.invalidTarget":"That app is no longer a supported open target.","openWorkspace.error.unknown":"Couldn't open in {app}.","openWorkspace.noWorkspace":"Select a workspace to enable","openWorkspace.open":"Open","openWorkspace.opened":"Opened {workspace} in {app} on your computer","openWorkspace.openIn":"Open {workspace} in {app}","openWorkspace.openInAria":"Open workspace {workspace} in {app}","openWorkspace.selectTarget":"Choose app","openWorkspace.target.cursor":"Cursor","openWorkspace.target.finder.linux":"File Manager","openWorkspace.target.finder.mac":"Finder","openWorkspace.target.finder.windows":"File Explorer","openWorkspace.target.ghostty":"Ghostty","openWorkspace.target.terminal":"Terminal","openWorkspace.target.vscode":"VS Code","openWorkspace.target.vscodeInsiders":"VS Code Insiders","openWorkspace.target.zed":"Zed","packageUpdate.body":"You are running v{current}. Update when you are ready; Hive will keep running.","packageUpdate.commandCopied":"Command copied","packageUpdate.commandCopyFailed":"Could not copy command","packageUpdate.copyCommand":"Copy command","packageUpdate.later":"Later","packageUpdate.openRelease":"Open release notes","packageUpdate.release":"Release","packageUpdate.title":"Hive v{version} is available","orchestrator.copyErrorAria":"Copy error message","orchestrator.failed":"Orchestrator failed to start","orchestrator.removeWorkspace":"Remove workspace","orchestrator.start":"Start Orchestrator","orchestrator.stop":"Stop Orchestrator","orchestrator.startingDesc":"Preparing the Orchestrator terminal.","orchestrator.startingTitle":"Starting Orchestrator","orchestrator.stoppedDesc":"Start the Orchestrator to plan tasks and dispatch them to team members.","orchestrator.stoppedTitle":"Orchestrator is stopped","role.coder":"Coder","role.custom":"Custom","role.reviewer":"Reviewer","role.sentinel":"Sentinel","role.tester":"Tester","runtime.retryNow":"Retry now","runtime.staleBody":"Writes are paused until Hive reconnects to the local runtime.","runtime.staleTitle":"Hive runtime connection lost","runtime.writeDisabled":"Hive runtime connection lost; retry once it is back.","sidebar.deleteAria":"Delete Workspace {name}","sidebar.deleteConfirm":'Delete Workspace "{name}"?',"sidebar.deleteDescription":"This stops its agents and removes it from Hive. The folder on disk ({path}) is left untouched. {summary}.","sidebar.deleteFailed":"Failed to delete: {message}","sidebar.deleteLabel":"Delete Workspace","sidebar.deleting":"Deleting…","sidebar.dismissRepository":"Hide the GitHub link","sidebar.noMembers":"no team members yet","sidebar.newWorkspace":"New Workspace","sidebar.noWorkspaces":"No Workspaces","sidebar.noWorkspacesDesc":"Add one to start. Hive will load .hive/tasks.md and start the Orchestrator.","sidebar.oneWorking":"One team member working","sidebar.demoVideo":"Demo video","sidebar.openDemoVideo":"Watch the Hive demo video","sidebar.openRepository":"Open the Hive GitHub repository","sidebar.removed":'Removed Workspace "{name}".',"sidebar.teamMemberCount":"{count} team members","sidebar.workingCount":"{working} of {total} working","sidebar.workingMembers":"{count} team members working","sidebar.workspaces":"Workspaces","shellTerminal.closeFailed":"Failed to close shell: {message}","shellTerminal.open":"Terminal","shellTerminal.openAria":"Open workspace terminal","pairing.awaitingConfirm":"Confirm on your computer to finish pairing.","pairing.cancel":"Cancel","pairing.connecting":"Connecting to your computer…","pairing.failed.expired":"Pairing expired — start again.","pairing.failed.mintForbidden":"Pairing was not confirmed on your computer.","pairing.failed.rejected":"Pairing was rejected.","pairing.failed.socket":"Lost the connection before pairing finished.","pairing.failed.version":"This phone and computer are on different versions.","pairing.handshaking":"Verifying…","pairing.paired":"Paired.","pairing.sasPrompt":"Check that this code matches the one on your computer:","pwa.appShellUpdated":"Web UI updated","pwa.reloadToActivate":"Reload to activate","pwa.reloading":"Reloading…","pwa.runtimeOffline.autoReconnect":"Auto-reconnect on — Hive will reload when the runtime is back.","pwa.runtimeOffline.body":"Start the Hive daemon by running `hive` in a terminal.","pwa.runtimeOffline.retry":"Retry now","pwa.runtimeOffline.retrying":"Retrying…","pwa.runtimeOffline.title":"Hive runtime is not running","pwa.runtimeOffline.tryDemo":"Try Demo instead","pwa.waitForAgents":"Wait for agents to finish","remote.addDevice":"Add device","remote.audit.bytes":"{count} bytes","remote.audit.empty":"No remote activity yet.","remote.audit.heading":"Remote activity","remote.audit.hide":"Hide activity","remote.audit.loadFailed":"Could not load activity.","remote.audit.result.error":"error","remote.audit.result.ok":"ok","remote.audit.result.rejected":"rejected","remote.audit.show":"Show activity","remote.connect.connecting":"Connecting…","remote.connect.disconnected":"Disconnected","remote.connect.online":"Connected","remote.connect.reconnecting":"Reconnecting…","remote.connect.sessionExpired":"Session expired — sign in again.","remote.confirm.confirm":"Confirm","remote.confirm.confirming":"Confirming…","remote.confirm.description":"A phone is trying to pair as “{name}”. Compare this code with the one shown on the phone — they must match.","remote.confirm.expired":"Pairing request expired.","remote.confirm.failed":"Could not complete — try pairing again.","remote.confirm.paired":"Paired “{name}”.","remote.confirm.reject":"Reject","remote.confirm.rejected":"Pairing rejected.","remote.confirm.sasLabel":"Verification code","remote.confirm.title":"Confirm new device","remote.confirm.warning":"Only confirm if you started this and the codes match.","remote.devices.activeNow":"Active just now","remote.devices.empty":"No paired devices yet.","remote.devices.heading":"Paired devices","remote.devices.lastActive":"Active {ago} ago","remote.devices.loadFailed":"Could not load devices.","remote.devices.neverActive":"Not active yet","remote.devices.revoke":"Revoke","remote.devices.revokeAria":"Revoke device {name}","remote.devices.revokeConfirm":"Revoke “{name}”? Its open sessions close immediately and it must pair again.","remote.devices.revokeFailed":"Could not revoke — try again.","remote.devices.revokeTitle":"Revoke device","remote.devices.revoked":"Revoked “{name}”.","remote.diagnostics.copy":"Copy diagnostics","remote.diagnostics.copied":"Diagnostics copied","remote.diagnostics.copyFailed":"Could not copy diagnostics.","remote.diagnostics.copying":"Copying...","remote.retention.activeDays":"active days","remote.retention.loadFailed":"Could not load local retention signals.","remote.retention.localOnly":"local only","remote.retention.reports":"reports","remote.retention.sends":"sends","remote.retention.streak":"current streak","remote.retention.title":"Protocol activity","remote.disable.confirmBody":"Remote devices (including this one) will disconnect immediately. You can only re-enable it from the desktop.","remote.disable.confirmTitle":"Turn off remote access?","remote.enable.description":"Reach this machine from your phone over an end-to-end encrypted tunnel. Off by default.","remote.enable.label":"Remote access","remote.qr.cancel":"Cancel","remote.qr.expired":"Code expired — generate a new one.","remote.qr.expiresIn":"Expires in {seconds}s","remote.qr.instructions":"Enter this code on your phone. Keep this open until you confirm here.","remote.qr.regenerate":"New code","remote.qr.startFailed":"Could not start pairing — try again.","remote.qr.title":"Pairing code","remote.section":"Remote access","remote.status.connected":"Tunnel connected","remote.status.disconnected":"Tunnel offline","remote.status.linked":"Linked to {gateway}","remote.status.notLinked":"Not linked — run `hive remote login` in a terminal.","remote.status.connecting":"Connecting to the gateway…","remote.status.reconnecting":"Reconnecting…","remote.status.revoked":"Access revoked — re-link to restore remote access.","scenario.applied":"Team assembled — the goal is with the Orchestrator","scenario.apply":"Assemble team & start","scenario.applying":"Assembling…","scenario.build_review_test.desc":"Coder + Reviewer + Tester running a build–review–verify loop.","scenario.build_review_test.title":"Build · Review · Test","scenario.cancel":"Cancel","scenario.docs_pipeline.desc":"A drafter writes the doc, a doc reviewer checks facts and flow.","scenario.docs_pipeline.title":"Docs pipeline","scenario.goalHint":"Sent to the Orchestrator — it dispatches with team send/team spawn, or uses team workflow for staged or 3+ worker work.","scenario.goalLabel":"Goal","scenario.research_factcheck.desc":"A researcher gathers sourced findings, a fact-checker verifies them.","scenario.research_factcheck.title":"Research & Fact-check","scenario.sectionTitle":"Or start with a scenario team","settings.aria":"Settings","settings.autostaff.description":"Let the orchestrator size the team to each task — spawn the right mix of coders / testers / reviewers. On by default.","settings.autostaff.label":"Auto-staff team","settings.experimental":"Experimental","settings.language":"Language","settings.heading":"Settings","settings.notifications":"Notifications","settings.subtitle":"Features, webhooks, and remote access.","settings.saveError":"Could not save — check the runtime connection and try again.","settings.tooltip":"Settings","settings.webhook.description":"POST a small JSON payload to this URL when a worker reports or a workflow finishes — wire it to Slack, ntfy, Feishu, etc. Best-effort; the runtime sends to whatever URL you set, so keep it private.","settings.webhook.label":"Completion webhook","settings.webhook.saved":"Saved","settings.workflows.description":"Let the orchestrator author and run multi-agent workflows (`team workflow`). Off by default.","settings.workflows.label":"Workflows","topbar.hideTodo":"Hide Tasks","topbar.openWebsite":"Open hivehq.dev","topbar.showTodo":"Show Tasks (.hive/tasks.md)","topbar.todo":"Tasks","topbar.todoOpen":"Tasks — {count} open tasks","topbar.copyUpdateCommand":"Copy update command","topbar.openRelease":"Open release notes","topbar.updateAvailable":"Update available","topbar.updateCommandCopied":"Update command copied","topbar.updateCommandCopyFailed":"Could not copy update command","topbar.hideMemory":"Hide Memory","topbar.showMemory":"Show Memory","topbar.memory":"Memory","topbar.hideWorkflows":"Hide Workflows","topbar.showWorkflows":"Show Workflows","topbar.workflows":"Workflows","memory.title":"Memory","memory.subtitle":"Workspace knowledge, Dream runs, and injection controls","memory.searchPlaceholder":"Search...","memory.tabActive":"Active","memory.tabArchived":"Archived","memory.tabDreams":"Dreams","memory.runNow":"Run now","memory.injection":"Memory injection","memory.dreamProcessing":"Dream processing","memory.emptyActive":"No memory entries","memory.emptyActiveDesc":"Entries appear here after the orchestrator adds memory or Dream extracts it.","memory.emptyDreams":"No dream runs yet","memory.emptyDreamsDesc":"Run history appears after a manual or scheduled Dream pass.","memory.archiveTitle":"Archive Memory","memory.archiveDesc":"Archived memory stops appearing in startup, recovery, and dispatch injection.","memory.archiveButton":"Archive","memory.revertTitle":"Revert Dream Run","memory.revertDesc":"This restores the memory rows changed by the selected Dream run and archives entries it added.","memory.revertButton":"Revert","memory.sources":"Sources","memory.noSources":"No source evidence.","memory.updated":"Updated {time}","memory.injected":"Injected {time}","memory.started":"Started {time}","memory.finished":"Finished {time}","memory.revertTooltip":"Revert dream run","memory.status.pending":"pending","memory.status.running":"running","memory.status.completed":"completed","memory.status.failed":"failed","memory.status.reverted":"reverted","memory.trigger.manual":"manual","memory.trigger.cron":"scheduled","memory.trigger.scheduled":"scheduled","memory.noReport":"No report","memory.noInput":"No input","memory.seq":"Seq","memory.reportAdded":"added","memory.reportRewritten":"rewritten","memory.reportArchived":"archived","memory.reportMerged":"merged","memory.diff.added":"Added","memory.diff.rewritten":"Rewritten","memory.diff.archived":"Archived","memory.diff.merged":"Merged","memory.pinned":"Pinned","memory.scopeUser":"User","memory.disabled":"Disabled","memory.unpinTooltip":"Unpin","memory.pinTooltip":"Pin","memory.enableTooltip":"Enable","memory.disableTooltip":"Disable","memory.entries":"entries","memory.runs":"runs","memory.kind.decision":"Decision","memory.kind.fact":"Fact","memory.kind.pitfall":"Pitfall","memory.kind.preference":"Preference","memory.kind.procedure_ref":"Procedure","tasks.title":"Tasks","tasks.subtitle":"Project todo list parsed from .hive/tasks.md","tasks.editMarkdown":"Edit Markdown","tasks.save":"Save","tasks.local":"Keep Local","tasks.reload":"Reload","tasks.noTasks":"No task entries","tasks.noTasksDesc":"Orchestrators parse task items formatted as checkboxes from tasks.md.","workflows.title":"Workflows","workflows.subtitle":"Multi-agent workflows, dispatches, and logs","workflows.description":"Hive workflows are authored and run by the Orchestrator via team workflow run --stdin (recurring runs go through team workflow schedule). Native CLI subagents/workflows do not appear here; this panel observes Hive phases, workers, logs, and schedule controls.","workflows.recentRuns":"Recent runs","workflows.filterAll":"All","workflows.filterRunning":"Running","workflows.filterFailed":"Failed","workflows.emptyRuns":"No runs yet","workflows.emptyRunsDesc":"Ask the Orchestrator to run a Hive workflow for work that fans out across multiple workers.","workflows.emptyFilter":"No runs matching this filter.","workflows.schedules":"Schedules","workflows.noAgents":"No agent() calls in this run.","workflows.narrator":"Narrator ({count} lines)","workflows.narratorOne":"Narrator (1 line)","workflows.runError":"Run error: {error}","workflows.stopTooltip":"Stop run","workflows.deleteScheduleTooltip":"Delete schedule","workflows.pauseTooltip":"Pause","workflows.resumeTooltip":"Resume","workflows.loading":"Loading…","workflows.status.pending":"pending","workflows.status.running":"running","workflows.status.completed":"completed","workflows.status.failed":"failed","workflows.status.interrupted":"interrupted","workflows.status.stopped":"stopped","workflows.dispatchStatus.queued":"queued","workflows.dispatchStatus.submitted":"submitted","workflows.dispatchStatus.reported":"reported","workflows.dispatchStatus.cancelled":"cancelled","workflows.dispatchStatus.awaitingReport":"awaiting report…","workflows.cli.title":"Workflow agent CLI","workflows.cli.desc":"Which CLI a workflow agent launches when its script doesn't name one, and which CLIs are allowed. Custom role templates keep their own CLI.","workflows.cli.default":"Default","workflows.cli.allowed":"Allowed","workflows.cli.saving":"Saving…","workflows.cli.save":"Save","workflows.cli.pickOne":"Pick at least one CLI","workflows.cli.saved":"Saved","workflows.cli.failed":"Failed to save","welcome.addWorkspace":"Add your first Workspace","welcome.demo":"or try the demo (no install needed)","welcome.desc":"Coordinate Antigravity CLI, Claude Code, Codex, Gemini, OpenCode, Hermes, Qwen Code — locally.","welcome.step1Desc":"Pick a project folder.","welcome.step1Title":"Add a Workspace","welcome.step2Desc":"Antigravity / Claude / Codex / Gemini / OpenCode / Hermes / Qwen.","welcome.step2Title":"Choose an Orchestrator","welcome.step3Desc":"The Orchestrator routes work via team send.","welcome.step3Title":"Dispatch tasks","welcome.title":"Welcome to Hive","worker.deleteAria":"Delete team member {name}","worker.deleteConfirm":"Delete {name}?","worker.deleteDescription":"This stops {name}'s terminal and removes it from the workspace. All queued dispatches are dropped.","worker.deleteMember":"Delete member","worker.detail":"{name} detail","worker.closeOutsideHint":"Click outside the member window to close.","worker.emptyAdd":"Add your first member","worker.emptyDesc":"Add team members (Antigravity CLI, Claude Code, Codex, Gemini, OpenCode, Hermes, Qwen Code) and the Orchestrator will route tasks to them.","worker.emptyTitle":"No team members yet","worker.actionsAria":"Actions for {name}","worker.lastActivity":"Latest terminal output (a hint, not a reported reply).","worker.open":"Open {name}","worker.rename":"Rename","worker.renameAria":"Rename {name}","worker.restartAria":"Restart {name}","worker.renameDesc":"Pick a new display name. The agent's id and PTY are unchanged.","worker.renameFailed":"Rename failed: {message}","worker.renameSuccess":'Renamed to "{name}".',"worker.renameTitle":"Rename team member","worker.startAgent":"Start the agent to begin receiving dispatches.","worker.startAria":"Start {name}","worker.stopAria":"Stop {name}","worker.teamMembers":"Team members","worker.terminalNotStarted":"PTY not started yet — ","worker.terminalStopped":"PTY stopped — ","worker.widthResize":"Resize worker detail width","worker.workingLegend":"Working = busy or waiting for input. Hive doesn’t detect stalls automatically — open the terminal to check.","workerPane.resize":"Resize Orchestrator and Team Members panes","tasks.action.addSubtask":"Add subtask","tasks.action.backToList":"Back to list","tasks.action.closeTodo":"Close Tasks","tasks.action.copied":"Copied","tasks.action.copyLine":"Copy line","tasks.action.delete":"Delete","tasks.action.edit":"Edit","tasks.action.viewSource":"View source","tasks.aria.addSubtask":"Add subtask","tasks.aria.collapseSubtasks":"Collapse {count} subtasks","tasks.aria.copiedTaskLine":"Copied task line","tasks.aria.copyTaskLine":"Copy task line","tasks.aria.deleteTask":"Delete task","tasks.aria.drawer":"Tasks","tasks.aria.editTask":"Edit task","tasks.aria.expandSubtasks":"Expand {count} subtasks","tasks.aria.progress":"Task completion","tasks.button.addTask":"Add task","tasks.completed.toggle":"{count} completed","tasks.empty.description":"Ask the Orchestrator to split the work via team send/team spawn, or team workflow for staged or 3+ worker work — or add your first task to bootstrap .hive/tasks.md.","tasks.empty.title":"No tasks yet","tasks.placeholder.editTask":"Edit task","tasks.placeholder.newSubtask":"New subtask","tasks.placeholder.newTask":"What needs to be done?","tasks.progress.subtaskTitle":"{done} of {total} direct subtasks complete","tasks.raw.conflictDescription":"Reloading will discard the current draft; Keep local will continue editing it.","tasks.raw.conflictTitle":"File changed externally","tasks.raw.keepLocal":"Keep local","tasks.raw.label":"Tasks Markdown","tasks.raw.lineCount":"{count} lines","tasks.raw.reload":"Reload","tasks.raw.save":"Save tasks","tasks.title.todo":"Tasks","notifications.desktop.aria":"Browser notifications","notifications.desktop.helper":"Use system notifications when permission is granted.","notifications.desktop.label":"Browser notifications","notifications.desktop.unsupported":"Not supported in this browser.","notifications.detail.brief.description":"Compact status line","notifications.detail.brief.label":"Brief","notifications.detail.detailed.description":"Workspace and queue context","notifications.detail.detailed.label":"Detailed","notifications.detail.sectionLabel":"Information","notifications.settings.aria":"Notification settings","notifications.settings.heading":"Notifications","notifications.settings.subtitle":"Choose how Hive alerts you when team members report or stop.","notifications.settings.tooltip":"Notifications","notifications.sound.beacon.description":"Distinct question tone","notifications.sound.beacon.label":"Signal","notifications.sound.cascade.description":"Layered success tone","notifications.sound.cascade.label":"Cascade","notifications.sound.chime.description":"Clean glass tap","notifications.sound.chime.label":"Glass","notifications.sound.longerBadge":"longer","notifications.sound.off.description":"Mute sounds","notifications.sound.off.label":"Off","notifications.sound.ping.description":"Tiny UI tick","notifications.sound.ping.label":"Tap","notifications.sound.previewAria":"Preview {label} sound","notifications.sound.resolve.description":"Longer completion cue","notifications.sound.resolve.label":"Done","notifications.sound.sectionLabel":"Sound","notifications.sound.soft.description":"Warm default chime","notifications.sound.soft.label":"Soft","notifications.test.brief":"Hive notifications are working.","notifications.test.button":"Test","notifications.test.detail":"Hive notifications are working with your selected sound and detail level.","notifications.test.title":"Hive notification test","notifications.remoteSession.brief":"{name} connected","notifications.remoteSession.detail":"{name} established a remote session.","notifications.remoteSession.title":"Remote device connected","notifications.toast.blocked":"Browser notifications are blocked.","notifications.toast.declined":"Browser notifications were not enabled.","notifications.toast.unsupported":"This browser does not support notifications.","notifications.workerReported.brief":"{name} reported","notifications.workerReported.detail":"{name} reported in {workspace}.","notifications.workerReported.title":"Team member report","notifications.workerStarted.brief":"{name} started","notifications.workerStarted.detail":"{name} started in {workspace} as {role}.","notifications.workerStarted.title":"Team member started","notifications.workerStopped.brief":"{name} stopped","notifications.workerStopped.detail":"{name} stopped in {workspace}.","notifications.workerStopped.title":"Team member stopped","workspace.add.manualHint":"Type or paste the absolute path to a project folder on your computer.","workspace.advanced.browse":"Advanced: browse server filesystem","workspace.advanced.pastePath":"Advanced: paste path","workspace.advanced.settings":"Advanced Options","workspace.advanced.startup":"Advanced: custom startup command","workspace.browse.breadcrumb":"Breadcrumb","workspace.browse.drivesAria":"Show all drives","workspace.browse.drivesRoot":"This PC","workspace.browse.empty":"This directory is empty.","workspace.browse.gitBadge":"git","workspace.browse.openAria":"Open {name}","workspace.browse.parentAria":"Go to parent directory","workspace.browse.root":"root: {path}","workspace.browse.rootLoading":"(loading)","workspace.browse.selected":"Selected","workspace.browse.title":"Browse server filesystem","workspace.browse.up":"up","workspace.confirm.create":"Create Workspace","workspace.confirm.description":"Hive will load .hive/tasks.md and start the Orchestrator here.","workspace.confirm.title":"Add Workspace","workspace.error.createFailed":"Failed to create workspace","workspace.error.createTitle":"Could not create workspace","workspace.error.outsideSandbox":"Picked folder is not inside the Hive sandbox. Use paste path.","workspace.error.pastePathInstead":"Paste path instead","workspace.error.pickerFailed":"Folder picker failed","workspace.field.absolutePath":"Absolute path","workspace.field.absolutePathPlaceholder":"C:\\path\\to\\project or /absolute/path","workspace.field.name":"Workspace name","workspace.field.nameDefaultPlaceholder":"my-project","workspace.field.path":"Path","workspace.field.pathEmptyPlaceholder":"(no folder picked — use paste path below)","workspace.field.startup":"Startup command","workspace.field.startupPlaceholder":"claude --resume <session-id>","workspace.git.detached":"detached","workspace.git.detected":"git repository detected","workspace.git.none":"No git repository at this path.","workspace.git.noneShort":"no git","workspace.git.short":"git · {branch}","workspace.picking.message":"Opening system folder picker…","workspace.picking.title":"Opening folder picker","workspace.preset.label":"Orchestrator CLI","workspace.preset.generic":"Generic command","workspace.preset.genericPreview":"custom startup command only","workspace.preset.genericRequiresStartup":"Generic command requires a startup command.","workspace.preset.installCopy":"Copy","workspace.preset.installCopyAria":"Copy install command","workspace.preset.installDocs":"Install guide","workspace.preset.installHint":"Install {name}:","workspace.preset.loadFailed":"Failed to load CLI presets; using server default.","workspace.preset.loading":"Loading CLI presets…","workspace.preset.noneAvailable":"No supported CLI agent was found on this machine. You can watch the demo first — no install needed.","workspace.preset.notFoundSuffix":" (not found)","workspace.preset.notInstalled":"{name} is not installed. Choose another CLI or add a custom startup command.","workspace.preset.optionsAria":"Orchestrator CLI options","workspace.preset.pathHelpBody":"Hive detects CLIs using the PATH of the shell that launched it. With nvm or a GUI launcher, that PATH can differ from your terminal. Quit Hive and re-run `hive` from a terminal where this CLI works.","workspace.preset.pathHelpTitle":"Installed it, but still shown as not found?","workspace.preset.tryDemo":"Try the demo first","workspace.yolo.notice":"Agents start in auto-approve mode: CLI permission prompts are skipped (e.g. `--dangerously-skip-permissions`), so an agent can run commands and edit files as you. The Stop button on each card halts a runaway agent.","workspace.startup.hint":"Overrides the preset for this Orchestrator. Runs in the workspace directory through your shell (bash/zsh/fish on POSIX, cmd.exe on Windows), so only paste commands you trust.","workspace.startup.hintShort":"Runs through your shell in the workspace directory. Only paste commands you trust.","demo.orchestratorLabel":"Orchestrator — pre-recorded","demo.readOnlyBadge":"DEMO read-only","layout.sidebarAria":"Workspace sidebar","layout.sidebarResizeAria":"Resize Workspace sidebar","layout.sidebarCollapse":"Collapse sidebar","layout.sidebarExpand":"Expand sidebar","terminal.composer.placeholder":"Type a command…","terminal.composer.send":"Send","terminal.composer.sendEnter":"Send ⏎","terminal.paste.button":"Paste","terminal.paste.cancel":"Cancel","terminal.paste.confirm":"Paste","terminal.paste.denied":"Clipboard access was denied — long-press the input to paste instead.","terminal.paste.lengthChars":"{count} characters","terminal.paste.preview":"Preview","terminal.paste.title":"Paste into terminal?","terminal.renderer.canvasFallbackNotice":"WebGL unavailable — using the canvas renderer.","terminal.firstRunSetup":"Finish this CLI setup in the terminal, then Hive will send startup instructions.","terminal.scrollToBottom":"Jump to latest","terminal.statusConnecting":"Connecting","terminal.statusRunning":"Running","terminalPanel.closePanel":"Close terminal panel","terminalPanel.closeTab":"Close {name}","terminalPanel.maximize":"Maximize terminal panel","terminalPanel.newShell":"New shell","terminalPanel.resizeAria":"Resize terminal panel height","terminalPanel.restore":"Restore terminal panel","terminalPanel.tablistAria":"Workspace terminal tabs","terminalPanel.workerStopped":"{name} is stopped — start the member to attach a terminal.","terminalPanels.aria":"Terminal panels","toast.dismissAria":"Dismiss","whatsNew.gotIt":"Got it","whatsNew.subtitle":"Updates since you were last here","whatsNew.title":"What's New","whatsNew.versionLabel":"Version {version}","workspaceList.empty":"No Workspaces yet"},FE={"addWorker.agentCli":"Agent CLI","addWorker.agentNotFound":"未找到","addWorker.agentExists":"成员名字已存在","addWorker.cancel":"取消","addWorker.create":"添加成员","addWorker.creating":"创建中…","addWorker.customPlaceholder":"你是安全审查成员,重点关注鉴权和输入校验。用 team report 把发现交还给 Orchestrator。","addWorker.description":"选择角色和 CLI Agent。Orchestrator 会通过 {command} 分派任务。","addWorker.emptyInstructions":"补充角色说明","addWorker.enterName":"请输入名称","addWorker.genericAgent":"通用命令","addWorker.genericCommand":"仅使用启动命令","addWorker.loadingPresets":"正在加载预设…","addWorker.name":"名称","addWorker.namePlaceholder":"例如 鲁班","addWorker.modifiedFrom":"已修改 {role} 默认说明","addWorker.pickCliOrStartup":"请选择 CLI Agent,或填写启动命令","addWorker.random":"随机","addWorker.randomAria":"生成随机成员名","addWorker.randomTooltip":"随机来一个","addWorker.role":"角色","addWorker.roleInstructions":"角色说明","addWorker.roleInstructionsTitle":"会注入到 Agent 启动提示和每次派单中。Hive 的 team 协议保持不变,这里只影响角色行为。","addWorker.reset":"重置","addWorker.saveAsTemplate":"保存为模板","addWorker.startupCommand":"启动命令","addWorker.startupHelp":"可选。会在当前 Workspace 里通过当前 shell 运行(POSIX 上是 bash/zsh/fish,Windows 上是 cmd.exe)。适合自定义 Agent 或原生命令恢复会话,例如 {example}。","addWorker.startupOverrides":"覆盖 CLI 启动","addWorker.template":"已保存的模板","addWorker.templateClear":"不使用模板(空白 Custom)","addWorker.templateDeleteAria":"删除模板 {name}","addWorker.templateDeleteConfirm":'删除已保存的模板"{name}"?该操作无法撤销。',"addWorker.templateDeleteConfirmLabel":"删除","addWorker.templateDeleteTitle":"删除角色模板","addWorker.templateEmpty":"还没有已保存的模板。在下方填写角色说明并保存。","addWorker.templateNamePlaceholder":"模板名称","addWorker.templateNoMatch":"没有匹配的模板。","addWorker.templatePickPlaceholder":"选择已保存的模板…","addWorker.templateSaveConfirm":"保存","addWorker.templateSearchPlaceholder":"搜索模板","addWorker.title":"添加团队成员","addWorker.unavailable":"{name} 未安装","actionCenter.activity.cancelled":"{worker} 已取消 · {ago}","actionCenter.activity.queued":"{worker} 已接收任务 · {ago}","actionCenter.activity.reported":"{worker} 已汇报 · {ago}","actionCenter.activity.submitted":"{worker} 已开始 · {ago}","actionCenter.attention":"注意","actionCenter.attention.noWorkers":"还没有团队成员。","actionCenter.attention.remoteError":"远程请求在 {endpoint} 出错。","actionCenter.attention.remoteRejected":"远程请求在 {endpoint} 被拒绝:{reason}。","actionCenter.attention.stoppedWithQueue":"{worker} 已停止,但还有未处理任务。","actionCenter.attention.waitingReport":"{worker} 已等待汇报 {minutes} 分钟。","actionCenter.attentionSubtitle":"可能需要 Orchestrator 处理的阻塞、等待或远程错误。","actionCenter.allClear":"状态正常","actionCenter.collapse":"收起 Action Center","actionCenter.copyRecap":"复制战报","actionCenter.currentDispatch":"当前","actionCenter.expand":"展开 Action Center","actionCenter.latestReport":"汇报","actionCenter.loadFailed":"无法加载团队动态。","actionCenter.liveSnapshot":"实时快照","actionCenter.loading":"正在加载团队动态...","actionCenter.metrics":"Action Center 指标","actionCenter.needsAttention":"{count} 项需关注","actionCenter.noActivity":"暂无团队动态。","actionCenter.noAttention":"当前没有阻塞任务或远程错误。","actionCenter.noWorkerEvidence":"暂无活跃成员证据。","actionCenter.openDispatches":"打开的任务","actionCenter.recapCopied":"战报已复制到剪贴板。","actionCenter.recapCopyFailed":"复制战报失败。","actionCenter.recent":"最近","actionCenter.recentReports":"近期汇报","actionCenter.recentSubtitle":"按时间排列的派发、汇报和取消记录。","actionCenter.reportCount":"{count} 条汇报","actionCenter.runningCount":"{count} 个运行中","actionCenter.subtitle":"团队动态、打开任务与下一步调度需要的证据","actionCenter.terminalHint":"终端","actionCenter.title":"Action Center","actionCenter.totalWorkers":"团队成员","actionCenter.unknownWorker":"未知成员","actionCenter.updated":"更新于 {ago}","actionCenter.workingWorkers":"正在工作","actionCenter.workerStatus":"状态","actionCenter.workers":"成员","actionCenter.workersSubtitle":"当前任务、最新汇报与终端线索。","common.cancel":"取消","common.close":"关闭","common.dismiss":"关闭提示","common.never":"从未","common.error":"错误","common.closeDialog":"关闭对话框","common.time.sAgo":"{count} 秒前","common.time.mAgo":"{count} 分钟前","common.time.hAgo":"{count} 小时前","common.time.dAgo":"{count} 天前","common.copied":"已复制","common.copyError":"复制错误","common.delete":"删除","common.idle":"空闲","common.loading":"加载中…","common.refresh":"刷新","common.restart":"重启","common.retry":"重试","common.running":"运行中","common.save":"保存","common.saving":"保存中…","common.start":"启动","common.starting":"启动中…","common.stop":"停止","common.stopped":"已停止","common.working":"工作中","connect.login.failed":"登录失败——请检查网络后重试。","connect.login.heading":"连接到你的 Hive","connect.login.subtitle":"登录后即可访问你账号下正在运行 Hive 的电脑。","connect.login.github":"使用 GitHub 登录","connect.login.google":"使用 Google 登录","connect.login.signingIn":"登录中…","connect.machines.back":"返回","connect.machines.connecting":"连接中…","connect.machines.heading":"你的电脑","connect.machines.empty":"还没有电脑。在电脑上运行 Hive 并开启远程访问。","connect.machines.lastSeen":"{ago}前在线","connect.machines.manageDevices":"管理设备","connect.machines.offline":"离线","connect.machines.online":"在线","connect.machines.revoked":"访问已被吊销","connect.machines.revokedHint":"此设备的访问已被吊销——请输入新的配对码重新连接。","connect.machines.select":"连接","connect.pair.back":"返回","connect.pair.finalizing":"已确认——正在准备会话…","connect.pair.guideHeading":"配对这台手机","connect.pair.guideStep1":"在那台电脑上,打开 设置 → 远程访问。","connect.pair.guideStep2":"点击添加设备,并保持配对码可见。","connect.pair.guideStep3":"在下面输入那个配对码。","connect.pair.qrLabel":"配对码","connect.pair.sasInstruction":"在你的电脑上,打开 设置 → 远程访问,确认验证码一致后点击确认。","connect.pair.sasPrompt":"确认此验证码与电脑上显示的一致:","connect.pair.startOver":"重新开始","connect.pair.submit":"配对","connect.error.selectFailed":"无法连接那台电脑。你保存的会话可能已失效,或它已离线 —— 请在下方重新配对。","connect.error.invalidCode":"这个配对码看起来不对,请检查后重试。","demo.banner":"演示模式 — 本地交互回放。","demo.exit":"退出演示","demo.replaySubtitle":"本地回放规划、派单、汇报和任务闭环。","demo.replayTitle":"Hive 演示工作区","demo.tasksTitle":"任务图","demo.teamTitle":"团队","firstRun.addWorkspace":"添加 Workspace","firstRun.back":"返回","firstRun.desc":"在本地协调多个 CLI 编码 Agent。","firstRun.getStarted":"开始使用","firstRun.howItWorks":"工作方式","firstRun.next":"下一步","firstRun.optionDesc":"选择一个开始方式。","firstRun.slide1Desc":"选择一个项目目录。","firstRun.slide1Title":"添加 Workspace","firstRun.slide2Desc":"Antigravity CLI、Claude Code、Codex、Gemini、OpenCode、Hermes、Qwen Code,任选。","firstRun.slide2Title":"选择 Orchestrator","firstRun.slide3Desc":"Orchestrator 通过 `team send <worker> <task>` 向团队成员派单。","firstRun.slide3Title":"分派任务","firstRun.skip":"跳过","firstRun.skipForNow":"暂时跳过","firstRun.step":"第 {current} / {total} 步","firstRun.subtitle":"每个 Workspace 运行一个 Orchestrator,再把任务派给团队成员。","firstRun.title":"欢迎使用 Hive","firstRun.tryDemo":"试用演示","language.aria":"切换语言","language.currentEn":"EN","language.currentZh":"中","language.en":"EN","language.switchToEn":"切换语言到 English","language.switchToZh":"切换语言到中文","language.tooltip":"语言","language.zh":"中文","marketplace.allCategories":"全部","marketplace.backToList":"返回列表","marketplace.close":"关闭模板市场","marketplace.empty":"没有匹配的角色","marketplace.importButton":"填入表单","marketplace.importedBadge":"本地已有同名模板","marketplace.loading":"加载中…","marketplace.imported":"已把 {name} 填入表单","marketplace.loadFailed":"加载失败","marketplace.openFromAddWorker":"从模板市场选择","marketplace.searchPlaceholder":"搜索角色…","marketplace.showAllCategories":"显示其他 {count} 个分类","marketplace.showCoreOnly":"只看核心分类","marketplace.sourceLabel":"由 {repo} 提供","marketplace.title":"模板市场","marketplace.viewSource":"在 GitHub 查看","mobile.nav.aria":"主导航","mobile.focus.enter":"专注终端(隐藏导航)","mobile.focus.exit":"显示导航","mobile.nav.flows":"工作流","mobile.nav.more":"更多","mobile.nav.settings":"设置","mobile.nav.tasks":"任务","mobile.nav.team":"团队","mobile.reconnect.disconnected":"已断开。","mobile.reconnect.reconnecting":"正在重新连接…","mobile.reconnect.retry":"重试","mobile.reconnect.revoked":"访问已被吊销——请在电脑上重新配对此设备。","mobile.section.about":"关于","mobile.section.demo":"演示","mobile.section.devices":"设备","mobile.section.settings":"设置","mobile.section.workflows":"工作流","mobile.section.workspaces":"工作区","mobile.tasks.noWorkspaceDesc":"选择或添加一个工作区即可查看其任务图。","mobile.tasks.noWorkspaceTitle":"未选择工作区","mobile.team.orchestrator":"Orchestrator","mobile.team.workers":"成员","mobile.workspaces.switch":"切换工作区","openWorkspace.error.appNotInstalled":"未找到 {app},请确认已安装并可启动。","openWorkspace.error.commandNotInPath":"{app} 的命令行入口不可用,请把它的 CLI 加入 PATH 后重试。","openWorkspace.error.invalidPath":"workspace 路径包含无法安全启动的字符。","openWorkspace.error.invalidTarget":"该应用已不在支持的打开目标列表里。","openWorkspace.error.unknown":"在 {app} 中打开失败。","openWorkspace.noWorkspace":"请先选择一个 workspace","openWorkspace.open":"打开","openWorkspace.opened":"已在你的电脑上用 {app} 打开 {workspace}","openWorkspace.openIn":"用 {app} 打开 {workspace}","openWorkspace.openInAria":"用 {app} 打开 workspace {workspace}","openWorkspace.selectTarget":"选择应用","openWorkspace.target.cursor":"Cursor","openWorkspace.target.finder.linux":"文件管理器","openWorkspace.target.finder.mac":"访达","openWorkspace.target.finder.windows":"文件资源管理器","openWorkspace.target.ghostty":"Ghostty","openWorkspace.target.terminal":"终端","openWorkspace.target.vscode":"VS Code","openWorkspace.target.vscodeInsiders":"VS Code Insiders","openWorkspace.target.zed":"Zed","packageUpdate.body":"当前运行的是 v{current}。准备好后再升级,Hive 会继续运行。","packageUpdate.commandCopied":"命令已复制","packageUpdate.commandCopyFailed":"复制命令失败","packageUpdate.copyCommand":"复制命令","packageUpdate.later":"稍后","packageUpdate.openRelease":"查看版本说明","packageUpdate.release":"版本说明","packageUpdate.title":"Hive v{version} 可用","orchestrator.copyErrorAria":"复制错误信息","orchestrator.failed":"Orchestrator 启动失败","orchestrator.removeWorkspace":"移除 workspace","orchestrator.start":"启动 Orchestrator","orchestrator.stop":"停止 Orchestrator","orchestrator.startingDesc":"正在准备 Orchestrator 终端。","orchestrator.startingTitle":"Orchestrator 启动中","orchestrator.stoppedDesc":"启动 Orchestrator 后才能规划任务并分派给团队成员。","orchestrator.stoppedTitle":"Orchestrator 已停止","role.coder":"开发","role.custom":"自定义","role.reviewer":"审查","role.sentinel":"巡检","role.tester":"测试","runtime.retryNow":"立即重试","runtime.staleBody":"重新连接本地后端前,写操作已暂停。","runtime.staleTitle":"Hive 后端连接已断开","runtime.writeDisabled":"Hive 后端连接已断开,恢复后再重试。","sidebar.deleteAria":"删除 Workspace {name}","sidebar.deleteConfirm":'删除 Workspace "{name}"?',"sidebar.deleteDescription":"这会停止其中的 Agent,并从 Hive 移除它。磁盘目录({path})不会被删除。{summary}。","sidebar.deleteFailed":"删除失败:{message}","sidebar.deleteLabel":"删除 Workspace","sidebar.deleting":"删除中…","sidebar.dismissRepository":"隐藏 GitHub 链接","sidebar.noMembers":"还没有团队成员","sidebar.newWorkspace":"新建 Workspace","sidebar.noWorkspaces":"还没有 Workspace","sidebar.noWorkspacesDesc":"添加一个开始使用。Hive 会加载 .hive/tasks.md 并启动 Orchestrator。","sidebar.oneWorking":"1 个团队成员工作中","sidebar.demoVideo":"演示视频","sidebar.openDemoVideo":"观看 Hive 演示视频","sidebar.openRepository":"打开 Hive GitHub 仓库","sidebar.removed":'已移除 Workspace "{name}"。',"sidebar.teamMemberCount":"{count} 个团队成员","sidebar.workingCount":"{working} / {total} 工作中","sidebar.workingMembers":"{count} 个团队成员工作中","sidebar.workspaces":"Workspaces","shellTerminal.closeFailed":"关闭 shell 失败:{message}","shellTerminal.open":"终端","shellTerminal.openAria":"打开 workspace 终端","pairing.awaitingConfirm":"在电脑上确认以完成配对。","pairing.cancel":"取消","pairing.connecting":"正在连接你的电脑…","pairing.failed.expired":"配对已过期——请重新开始。","pairing.failed.mintForbidden":"电脑端尚未确认此次配对。","pairing.failed.rejected":"配对被拒绝。","pairing.failed.socket":"配对完成前连接已断开。","pairing.failed.version":"手机与电脑版本不一致。","pairing.handshaking":"校验中…","pairing.paired":"已配对。","pairing.sasPrompt":"请核对此验证码与电脑上显示的一致:","pwa.appShellUpdated":"Web UI 已更新","pwa.reloadToActivate":"刷新以应用","pwa.reloading":"正在刷新…","pwa.runtimeOffline.autoReconnect":"已开启自动重连——后端恢复后会自动刷新。","pwa.runtimeOffline.body":"在终端运行 `hive` 启动后端。","pwa.runtimeOffline.retry":"立即重试","pwa.runtimeOffline.retrying":"重试中…","pwa.runtimeOffline.title":"Hive 后端未启动","pwa.runtimeOffline.tryDemo":"改试用演示","pwa.waitForAgents":"等待 Agent 完成","remote.addDevice":"添加设备","remote.audit.bytes":"{count} 字节","remote.audit.empty":"还没有远程活动。","remote.audit.heading":"远程活动","remote.audit.hide":"隐藏活动","remote.audit.loadFailed":"无法加载活动记录。","remote.audit.result.error":"错误","remote.audit.result.ok":"成功","remote.audit.result.rejected":"已拒绝","remote.audit.show":"查看活动","remote.connect.connecting":"连接中…","remote.connect.disconnected":"已断开","remote.connect.online":"已连接","remote.connect.reconnecting":"重连中…","remote.connect.sessionExpired":"会话已过期 —— 请重新登录。","remote.confirm.confirm":"确认","remote.confirm.confirming":"确认中…","remote.confirm.description":"一台手机正尝试以“{name}”配对。请把这个码和手机上显示的对比 —— 两者必须一致。","remote.confirm.expired":"配对请求已过期。","remote.confirm.failed":"无法完成 —— 请重新配对。","remote.confirm.paired":"已配对“{name}”。","remote.confirm.reject":"拒绝","remote.confirm.rejected":"已拒绝配对。","remote.confirm.sasLabel":"校验码","remote.confirm.title":"确认新设备","remote.confirm.warning":"仅在你发起配对且两个码一致时确认。","remote.devices.activeNow":"刚刚活跃","remote.devices.empty":"还没有已配对的设备。","remote.devices.heading":"已配对设备","remote.devices.lastActive":"{ago}前活跃","remote.devices.loadFailed":"无法加载设备列表。","remote.devices.neverActive":"尚未活跃","remote.devices.revoke":"吊销","remote.devices.revokeAria":"吊销设备 {name}","remote.devices.revokeConfirm":"吊销“{name}”?它的会话会立即断开,需要重新配对。","remote.devices.revokeFailed":"吊销失败 —— 请重试。","remote.devices.revokeTitle":"吊销设备","remote.devices.revoked":"已吊销“{name}”。","remote.diagnostics.copy":"复制诊断信息","remote.diagnostics.copied":"诊断信息已复制","remote.diagnostics.copyFailed":"无法复制诊断信息。","remote.diagnostics.copying":"正在复制...","remote.retention.activeDays":"活跃天数","remote.retention.loadFailed":"无法加载本地留存信号。","remote.retention.localOnly":"仅本地","remote.retention.reports":"汇报","remote.retention.sends":"派单","remote.retention.streak":"当前连续天数","remote.retention.title":"协议活动","remote.disable.confirmBody":"远程设备(包括本设备)将立即断开。只能在桌面端重新开启。","remote.disable.confirmTitle":"关闭远程访问?","remote.enable.description":"通过端到端加密隧道从手机访问这台机器。默认关闭。","remote.enable.label":"远程访问","remote.qr.cancel":"取消","remote.qr.expired":"配对码已过期 —— 请重新生成。","remote.qr.expiresIn":"{seconds} 秒后过期","remote.qr.instructions":"在手机上输入这个配对码。在这里确认前请保持打开。","remote.qr.regenerate":"重新生成","remote.qr.startFailed":"无法开始配对 —— 请重试。","remote.qr.title":"配对码","remote.section":"远程访问","remote.status.connected":"隧道已连接","remote.status.disconnected":"隧道离线","remote.status.linked":"已连接到 {gateway}","remote.status.notLinked":"未连接 —— 在终端运行 `hive remote login`。","remote.status.connecting":"正在连接网关…","remote.status.reconnecting":"正在重连…","remote.status.revoked":"访问已被吊销 —— 重新连接以恢复远程访问。","scenario.applied":"团队已组建,目标已交给 Orchestrator","scenario.apply":"组队并开工","scenario.applying":"组队中…","scenario.build_review_test.desc":"Coder + Reviewer + Tester,实现—审查—验证闭环。","scenario.build_review_test.title":"开发 · 审查 · 测试","scenario.cancel":"取消","scenario.docs_pipeline.desc":"起草成员成文,审稿成员核对事实与表达。","scenario.docs_pipeline.title":"文档流水线","scenario.goalHint":"将以你的名义发给 Orchestrator——由它拆解任务并用 team send 派单。","scenario.goalLabel":"目标","scenario.research_factcheck.desc":"调研员收集带出处的发现,核查员逐条复核。","scenario.research_factcheck.title":"调研与核查","scenario.sectionTitle":"或从场景一键组队","settings.aria":"设置","settings.autostaff.description":"让 Orchestrator 按任务自动配置团队规模,动态补充合适的开发、测试和审查成员。默认开启。","settings.autostaff.label":"自动组队","settings.experimental":"实验性功能","settings.language":"语言","settings.heading":"设置","settings.notifications":"通知","settings.subtitle":"功能开关、Webhook 和远程访问。","settings.saveError":"保存失败 —— 检查 runtime 连接后重试。","settings.tooltip":"设置","settings.webhook.description":"worker 汇报或 workflow 完成时,向此 URL POST 一小段 JSON —— 可接入 Slack、ntfy、飞书等。尽力投递;runtime 会发往你填的任意 URL,请妥善保管。","settings.webhook.label":"完成通知 Webhook","settings.webhook.saved":"已保存","settings.workflows.description":"允许 orchestrator 编写并运行多 agent 工作流(team workflow)。默认关闭。","settings.workflows.label":"工作流","topbar.hideTodo":"隐藏任务","topbar.openWebsite":"访问官网 hivehq.dev","topbar.showTodo":"显示任务 (.hive/tasks.md)","topbar.todo":"任务","topbar.todoOpen":"任务 — {count} 个未完成","topbar.copyUpdateCommand":"复制更新命令","topbar.openRelease":"查看版本","topbar.updateAvailable":"有新版本","topbar.updateCommandCopied":"已复制更新命令","topbar.updateCommandCopyFailed":"复制更新命令失败","topbar.hideMemory":"隐藏记忆","topbar.showMemory":"显示记忆","topbar.memory":"记忆","topbar.hideWorkflows":"隐藏工作流","topbar.showWorkflows":"显示工作流","topbar.workflows":"工作流","memory.title":"记忆","memory.subtitle":"工作区知识积累、Dream运行记录及注入配置","memory.searchPlaceholder":"搜索记忆...","memory.tabActive":"活跃中","memory.tabArchived":"已归档","memory.tabDreams":"Dream 运行记录","memory.runNow":"立即运行","memory.injection":"记忆注入","memory.dreamProcessing":"Dream 优化处理","memory.emptyActive":"暂无记忆条目","memory.emptyActiveDesc":"当 Orchestrator 添加记忆或 Dream 提取出知识后,此处会显示记录。","memory.emptyDreams":"暂无 Dream 运行记录","memory.emptyDreamsDesc":"在执行手动或定时的 Dream 优化后,此处将展示运行历史。","memory.archiveTitle":"归档记忆","memory.archiveDesc":"归档后的记忆将不再注入到启动、恢复以及 dispatch 阶段。","memory.archiveButton":"归档","memory.revertTitle":"撤销 Dream 运行","memory.revertDesc":"这将恢复由选定的 Dream 运行所修改的记忆行,并归档其新添加的条目。","memory.revertButton":"撤销","memory.sources":"来源证据","memory.noSources":"暂无来源证据。","memory.updated":"更新于 {time}","memory.injected":"注入于 {time}","memory.started":"启动于 {time}","memory.finished":"结束于 {time}","memory.revertTooltip":"撤销 Dream 运行效果","memory.status.pending":"待处理","memory.status.running":"进行中","memory.status.completed":"已完成","memory.status.failed":"已失败","memory.status.reverted":"已撤销","memory.trigger.manual":"手动触发","memory.trigger.cron":"定时计划","memory.trigger.scheduled":"定时计划","memory.noReport":"无报告","memory.noInput":"无输入","memory.seq":"序列号","memory.reportAdded":"新增","memory.reportRewritten":"已重写","memory.reportArchived":"已归档","memory.reportMerged":"已合并","memory.diff.added":"新增知识","memory.diff.rewritten":"重写知识","memory.diff.archived":"归档知识","memory.diff.merged":"合并知识","memory.pinned":"已置顶","memory.scopeUser":"用户偏好","memory.disabled":"已禁用","memory.unpinTooltip":"取消置顶","memory.pinTooltip":"置顶","memory.enableTooltip":"启用","memory.disableTooltip":"禁用","memory.entries":"条记录","memory.runs":"次运行记录","memory.kind.decision":"决议","memory.kind.fact":"事实","memory.kind.pitfall":"踩坑避雷","memory.kind.preference":"偏好","memory.kind.procedure_ref":"流程步骤","tasks.title":"任务清单","tasks.subtitle":"解析自项目内 .hive/tasks.md 的代办任务图","tasks.editMarkdown":"编辑 Markdown","tasks.save":"保存","tasks.local":"保留本地","tasks.reload":"重新加载","tasks.noTasks":"暂无任务条目","tasks.noTasksDesc":"Orchestrator 会从 tasks.md 中解析出复选框格式的任务项。","workflows.title":"工作流","workflows.subtitle":"多 Agent 工作流、分派任务与运行日志","workflows.description":"Hive 工作流由 Orchestrator 通过 team workflow run --stdin 编写并运行(循环任务会经过 team workflow schedule)。当前 CLI 内建的 subagent/workflow 不会出现在这里;此面板只观察 Hive 阶段、成员、日志和定时计划。","workflows.recentRuns":"最近运行","workflows.filterAll":"全部","workflows.filterRunning":"运行中","workflows.filterFailed":"已失败","workflows.emptyRuns":"暂无运行记录","workflows.emptyRunsDesc":"让 Orchestrator 为需要多个成员并行的任务启动 Hive workflow。","workflows.emptyFilter":"没有与此过滤条件匹配的运行记录。","workflows.schedules":"定时计划","workflows.noAgents":"本次运行没有调用任何 agent()。","workflows.narrator":"叙述器(共 {count} 行)","workflows.narratorOne":"叙述器(共 1 行)","workflows.runError":"运行错误:{error}","workflows.stopTooltip":"停止运行","workflows.deleteScheduleTooltip":"删除定时计划","workflows.pauseTooltip":"暂停","workflows.resumeTooltip":"恢复","workflows.loading":"加载中…","workflows.status.pending":"待处理","workflows.status.running":"运行中","workflows.status.completed":"已完成","workflows.status.failed":"已失败","workflows.status.interrupted":"已中断","workflows.status.stopped":"已停止","workflows.dispatchStatus.queued":"待派发","workflows.dispatchStatus.submitted":"提交中","workflows.dispatchStatus.reported":"已报告","workflows.dispatchStatus.cancelled":"已取消","workflows.dispatchStatus.awaitingReport":"等待报告…","workflows.cli.title":"工作流 Agent 运行环境 (CLI)","workflows.cli.desc":"设置工作流中未指定运行环境的 Agent 默认使用的 CLI,以及允许被工作流调用的 CLI 列表。自定义成员模板使用其自身的 CLI 设定。","workflows.cli.default":"默认运行环境","workflows.cli.allowed":"允许调用的环境","workflows.cli.saving":"保存中…","workflows.cli.save":"保存","workflows.cli.pickOne":"请至少选择一个 CLI","workflows.cli.saved":"保存成功","workflows.cli.failed":"保存失败","welcome.addWorkspace":"添加第一个 Workspace","welcome.demo":"或试用演示(无需安装 CLI)","welcome.desc":"在本地协调 Antigravity CLI、Claude Code、Codex、Gemini、OpenCode、Hermes、Qwen Code。","welcome.step1Desc":"选择一个项目目录。","welcome.step1Title":"添加 Workspace","welcome.step2Desc":"Antigravity / Claude / Codex / Gemini / OpenCode / Hermes / Qwen。","welcome.step2Title":"选择 Orchestrator","welcome.step3Desc":"Orchestrator 通过 team send 分派任务。","welcome.step3Title":"分派任务","welcome.title":"欢迎使用 Hive","worker.deleteAria":"删除团队成员 {name}","worker.deleteConfirm":"删除 {name}?","worker.deleteDescription":"这会停止 {name} 的终端,并从 workspace 中移除它。未处理任务会被丢弃。","worker.deleteMember":"删除成员","worker.detail":"{name} 详情","worker.closeOutsideHint":"点击成员窗口外任意区域关闭。","worker.emptyAdd":"添加第一个成员","worker.emptyDesc":"添加团队成员(Antigravity CLI、Claude Code、Codex、Gemini、OpenCode、Hermes、Qwen Code),Orchestrator 会分派任务。","worker.emptyTitle":"还没有团队成员","worker.actionsAria":"{name} 的操作","worker.lastActivity":"终端最新输出(仅供参考,不是汇报内容)。","worker.open":"打开 {name}","worker.rename":"重命名","worker.renameAria":"重命名 {name}","worker.restartAria":"重启 {name}","worker.renameDesc":"选择新的显示名称。Agent id 和终端不会变化。","worker.renameFailed":"重命名失败:{message}","worker.renameSuccess":'已重命名为 "{name}"。',"worker.renameTitle":"重命名团队成员","worker.startAgent":"启动 Agent 后即可接收派单。","worker.startAria":"启动 {name}","worker.stopAria":"停止 {name}","worker.teamMembers":"团队成员","worker.terminalNotStarted":"终端未启动 — ","worker.terminalStopped":"终端已停止 — ","worker.widthResize":"调整成员详情宽度","worker.workingLegend":"工作中 = 忙碌或等待输入。Hive 不会自动检测卡死 —— 打开终端查看。","workerPane.resize":"调整 Orchestrator 和团队成员面板宽度","tasks.action.addSubtask":"添加子任务","tasks.action.backToList":"返回列表","tasks.action.closeTodo":"关闭任务清单","tasks.action.copied":"已复制","tasks.action.copyLine":"复制行","tasks.action.delete":"删除","tasks.action.edit":"编辑","tasks.action.viewSource":"查看源码","tasks.aria.addSubtask":"添加子任务","tasks.aria.collapseSubtasks":"折叠 {count} 个子任务","tasks.aria.copiedTaskLine":"已复制任务行","tasks.aria.copyTaskLine":"复制任务行","tasks.aria.deleteTask":"删除任务","tasks.aria.drawer":"任务清单","tasks.aria.editTask":"编辑任务","tasks.aria.expandSubtasks":"展开 {count} 个子任务","tasks.aria.progress":"任务完成度","tasks.button.addTask":"添加任务","tasks.completed.toggle":"{count} 个已完成","tasks.empty.description":"让 Orchestrator 拆分任务并用 team send/team spawn 派给成员,或手动加第一条任务来创建 .hive/tasks.md。","tasks.empty.title":"还没有任务","tasks.placeholder.editTask":"编辑任务","tasks.placeholder.newSubtask":"新建子任务","tasks.placeholder.newTask":"下一步要做什么?","tasks.progress.subtaskTitle":"已完成 {done} / {total} 个直接子任务","tasks.raw.conflictDescription":"重新载入会丢弃当前草稿;保留本地会继续编辑当前内容。","tasks.raw.conflictTitle":"文件已在外部变化","tasks.raw.keepLocal":"保留本地","tasks.raw.label":"任务 Markdown","tasks.raw.lineCount":"{count} 行","tasks.raw.reload":"重新载入","tasks.raw.save":"保存任务","tasks.title.todo":"任务","notifications.desktop.aria":"浏览器通知","notifications.desktop.helper":"授权后使用系统通知。","notifications.desktop.label":"浏览器通知","notifications.desktop.unsupported":"此浏览器不支持。","notifications.detail.brief.description":"一行状态摘要","notifications.detail.brief.label":"简略","notifications.detail.detailed.description":"包含 Workspace 和队列信息","notifications.detail.detailed.label":"详细","notifications.detail.sectionLabel":"信息","notifications.settings.aria":"通知设置","notifications.settings.heading":"通知","notifications.settings.subtitle":"选择团队成员汇报或停止时 Hive 的提醒方式。","notifications.settings.tooltip":"通知","notifications.sound.beacon.description":"清晰的提示音","notifications.sound.beacon.label":"信号","notifications.sound.cascade.description":"层次更丰富的完成音","notifications.sound.cascade.label":"瀑布","notifications.sound.chime.description":"干净的玻璃轻点","notifications.sound.chime.label":"玻璃","notifications.sound.longerBadge":"更长","notifications.sound.off.description":"静音","notifications.sound.off.label":"关闭","notifications.sound.ping.description":"很短的界面轻点","notifications.sound.ping.label":"轻点","notifications.sound.previewAria":"试听 {label} 声音","notifications.sound.resolve.description":"更长的完成提示","notifications.sound.resolve.label":"完成","notifications.sound.sectionLabel":"声音","notifications.sound.soft.description":"温和的默认提示","notifications.sound.soft.label":"轻柔","notifications.test.brief":"Hive 通知正常工作。","notifications.test.button":"测试","notifications.test.detail":"Hive 通知按你选择的声音和详情级别正常工作。","notifications.test.title":"Hive 通知测试","notifications.remoteSession.brief":"{name} 已连接","notifications.remoteSession.detail":"{name} 建立了远程会话。","notifications.remoteSession.title":"远程设备已连接","notifications.toast.blocked":"浏览器通知被屏蔽。","notifications.toast.declined":"未启用浏览器通知。","notifications.toast.unsupported":"此浏览器不支持通知。","notifications.workerReported.brief":"{name} 已汇报","notifications.workerReported.detail":"{name} 已在 {workspace} 汇报。","notifications.workerReported.title":"团队成员汇报","notifications.workerStarted.brief":"{name} 已启动","notifications.workerStarted.detail":"{name} 已在 {workspace} 以 {role} 角色启动。","notifications.workerStarted.title":"团队成员已启动","notifications.workerStopped.brief":"{name} 已停止","notifications.workerStopped.detail":"{name} 已在 {workspace} 停止。","notifications.workerStopped.title":"团队成员已停止","workspace.add.manualHint":"输入或粘贴你电脑上某个项目文件夹的绝对路径。","workspace.advanced.browse":"高级:浏览服务器文件系统","workspace.advanced.pastePath":"高级:粘贴路径","workspace.advanced.settings":"高级选项","workspace.advanced.startup":"高级:自定义启动命令","workspace.browse.breadcrumb":"面包屑","workspace.browse.drivesAria":"显示所有磁盘","workspace.browse.drivesRoot":"此电脑","workspace.browse.empty":"此目录为空。","workspace.browse.gitBadge":"git","workspace.browse.openAria":"打开 {name}","workspace.browse.parentAria":"返回上级目录","workspace.browse.root":"根目录:{path}","workspace.browse.rootLoading":"(加载中)","workspace.browse.selected":"已选择","workspace.browse.title":"浏览服务器文件系统","workspace.browse.up":"上级","workspace.confirm.create":"创建 Workspace","workspace.confirm.description":"Hive 会在此加载 .hive/tasks.md 并启动 Orchestrator。","workspace.confirm.title":"添加 Workspace","workspace.error.createFailed":"创建 Workspace 失败","workspace.error.createTitle":"无法创建 Workspace","workspace.error.outsideSandbox":"所选目录不在 Hive 沙盒内,请改用粘贴路径。","workspace.error.pastePathInstead":"改为粘贴路径","workspace.error.pickerFailed":"目录选择失败","workspace.field.absolutePath":"绝对路径","workspace.field.absolutePathPlaceholder":"C:\\path\\to\\project 或 /absolute/path","workspace.field.name":"Workspace 名称","workspace.field.nameDefaultPlaceholder":"my-project","workspace.field.path":"路径","workspace.field.pathEmptyPlaceholder":"(未选择目录 — 请使用下方粘贴路径)","workspace.field.startup":"启动命令","workspace.field.startupPlaceholder":"claude --resume <session-id>","workspace.git.detached":"游离 HEAD","workspace.git.detected":"检测到 git 仓库","workspace.git.none":"此路径下没有 git 仓库。","workspace.git.noneShort":"无 git","workspace.git.short":"git · {branch}","workspace.picking.message":"正在打开系统目录选择器…","workspace.picking.title":"正在打开目录选择器","workspace.preset.label":"Orchestrator CLI","workspace.preset.generic":"通用命令","workspace.preset.genericPreview":"仅使用自定义启动命令","workspace.preset.genericRequiresStartup":"通用命令需要填写启动命令。","workspace.preset.installCopy":"复制","workspace.preset.installCopyAria":"复制安装命令","workspace.preset.installDocs":"安装指南","workspace.preset.installHint":"安装 {name}:","workspace.preset.loadFailed":"加载 CLI 预设失败,使用服务器默认值。","workspace.preset.loading":"正在加载 CLI 预设…","workspace.preset.noneAvailable":"本机未检测到任何支持的 CLI agent。可以先看演示,无需安装。","workspace.preset.notFoundSuffix":"(未找到)","workspace.preset.notInstalled":"{name} 未安装。请选择其他 CLI 或填写启动命令。","workspace.preset.optionsAria":"Orchestrator CLI 选项","workspace.preset.pathHelpBody":"Hive 用启动它的那个 shell 的 PATH 探测 CLI。使用 nvm 或从图形界面启动时,该 PATH 可能与你的终端不同。请退出 Hive,在装有该 CLI 的终端里重新运行 `hive`。","workspace.preset.pathHelpTitle":"装了却显示未找到?","workspace.preset.tryDemo":"先看演示","workspace.yolo.notice":"Agent 默认以自动批准模式运行:CLI 的权限确认会被跳过(如 `--dangerously-skip-permissions`),agent 可以像你本人一样执行命令、修改文件。每张卡片上的 Stop 按钮可随时叫停失控的 agent。","workspace.startup.hint":"覆盖该 Orchestrator 的预设。通过当前 shell(POSIX 上是 bash/zsh/fish,Windows 上是 cmd.exe)在 Workspace 目录中运行,请只粘贴你信任的命令。","workspace.startup.hintShort":"通过当前 shell 在 Workspace 目录中运行。请只粘贴你信任的命令。","demo.orchestratorLabel":"Orchestrator — 预录数据","demo.readOnlyBadge":"演示 只读","layout.sidebarAria":"Workspace 侧栏","layout.sidebarResizeAria":"调整 Workspace 侧栏宽度","layout.sidebarCollapse":"收起侧栏","layout.sidebarExpand":"展开侧栏","terminal.composer.placeholder":"输入命令…","terminal.composer.send":"发送","terminal.composer.sendEnter":"发送 ⏎","terminal.paste.button":"粘贴","terminal.paste.cancel":"取消","terminal.paste.confirm":"粘贴","terminal.paste.denied":"剪贴板访问被拒绝——请长按输入框粘贴。","terminal.paste.lengthChars":"共 {count} 个字符","terminal.paste.preview":"预览","terminal.paste.title":"粘贴到终端?","terminal.renderer.canvasFallbackNotice":"WebGL 不可用——已改用 canvas 渲染器。","terminal.firstRunSetup":"请先在终端完成该 CLI 的首次设置,随后 Hive 会发送启动指令。","terminal.scrollToBottom":"回到底部","terminal.statusConnecting":"连接中","terminal.statusRunning":"运行中","terminalPanel.closePanel":"关闭终端面板","terminalPanel.closeTab":"关闭 {name}","terminalPanel.maximize":"最大化终端面板","terminalPanel.newShell":"新建 shell","terminalPanel.resizeAria":"调整终端面板高度","terminalPanel.restore":"还原终端面板","terminalPanel.tablistAria":"Workspace 终端标签","terminalPanel.workerStopped":"{name} 已停止——启动该成员后会自动连接终端。","terminalPanels.aria":"终端面板","toast.dismissAria":"关闭","whatsNew.gotIt":"知道了","whatsNew.subtitle":"上次使用以来的更新","whatsNew.title":"更新内容","whatsNew.versionLabel":"版本 {version}","workspaceList.empty":"还没有 Workspace"},KE={en:t0,zh:FE},YE=()=>{if(typeof window>"u")return"en";const t=$E();return t||(window.navigator.language.toLowerCase().startsWith("zh")?"zh":"en")},$E=()=>{try{const t=window.localStorage.getItem(e0);return PE(t)?t:null}catch{return null}},VE=t=>{try{window.localStorage.setItem(e0,t)}catch{}},n0=t=>(a,o={})=>(KE[t][a]??t0[a]??a).replace(/\{(\w+)\}/g,(l,u)=>{const f=o[u];return f===void 0?l:String(f)}),GE={language:"en",setLanguage:()=>{},t:n0("en")},a0=b.createContext(GE),XE=({children:t})=>{const[a,o]=b.useState(YE),i=b.useMemo(()=>({language:a,setLanguage:u=>{o(u),VE(u)},t:n0(a)}),[a]);return c.jsx(a0.Provider,{value:i,children:t})},we=()=>b.useContext(a0),ZE=({onExit:t})=>{const{t:a}=we();return c.jsxs("section",{"aria-label":"Demo mode","data-testid":"demo-banner",className:"flex shrink-0 items-center justify-between border-b px-4 py-2 text-xs",style:{background:"var(--status-yellow-bg, #3a2c1c)",borderColor:"var(--border)"},children:[c.jsxs("div",{className:"flex items-center gap-2 text-pri",children:[c.jsx(Xb,{size:14,"aria-hidden":!0}),c.jsx("span",{children:a("demo.banner")})]}),c.jsx("button",{type:"button",onClick:t,className:"icon-btn icon-btn--ghost",children:a("demo.exit")})]})},Sl=[{label:"Plan",terminal:["$ hive demo","Orchestrator: turning the request into .hive/tasks.md","$ team spawn coder --name ada-lovelace","$ team spawn reviewer --name socrates"],doneTasks:1,workerStates:["idle","idle"]},{label:"Dispatch",terminal:['$ team send ada-lovelace "Implement POST /todos with SQLite persistence"',"Hive: dispatch queued and delivered to ada-lovelace","ada-lovelace: editing src/routes/todos.ts"],doneTasks:2,workerStates:["working","idle"]},{label:"Report",terminal:['ada-lovelace: team report "POST /todos implemented; tests added"',"Orchestrator: marking implementation done, sending review",'$ team send socrates "Review todo endpoint and tests"'],doneTasks:3,workerStates:["idle","working"]},{label:"Close",terminal:['socrates: team report "No blocker; one naming nit fixed"',"Orchestrator: validation complete","tasks.md: all demo tasks checked"],doneTasks:5,workerStates:["idle","idle"]}],tf=["Create the Todo API route","Persist todos in SQLite","Add Vitest coverage","Review route behavior","Mark .hive/tasks.md complete"],QE=[{name:"ada-lovelace",role:"Coder"},{name:"socrates",role:"Reviewer"}],JE=({onExit:t})=>{const{t:a}=we(),[o,i]=b.useState(0);b.useEffect(()=>{const f=window.setInterval(()=>{i(m=>(m+1)%Sl.length)},1800);return()=>window.clearInterval(f)},[]);const l=Sl[o]??Sl[0],u=b.useMemo(()=>Sl.slice(0,o+1).flatMap(f=>f.terminal),[o]);return c.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[c.jsx(ZE,{onExit:t}),c.jsx("div",{className:"scroll-y min-h-0 flex-1 px-4 py-4",style:{background:"var(--bg-2)"},children:c.jsxs("section",{className:"mx-auto grid h-full min-h-[520px] w-full max-w-6xl gap-3 lg:grid-cols-[minmax(0,1.35fr)_minmax(320px,0.65fr)]","data-testid":"demo-replay-panel",children:[c.jsxs("div",{className:"flex min-h-0 flex-col rounded-md border bg-0",children:[c.jsxs("header",{className:"flex items-center justify-between border-b px-3 py-2",style:{borderColor:"var(--border)"},children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx(pc,{size:15,className:"text-accent"}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("h1",{className:"truncate text-sm font-semibold text-pri",children:a("demo.replayTitle")}),c.jsx("p",{className:"text-xs text-ter",children:a("demo.replaySubtitle")})]})]}),c.jsx("span",{className:"rounded border px-2 py-1 text-[11px] text-sec",children:l.label})]}),c.jsx("pre",{className:"mono min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-4 text-xs leading-6 text-sec","data-testid":"demo-replay-terminal",children:u.join(`
11
+ `)})]}),c.jsxs("aside",{className:"flex min-h-0 flex-col gap-3",children:[c.jsxs("div",{className:"rounded-md border bg-0 p-3","data-testid":"demo-task-graph",children:[c.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[c.jsx("h2",{className:"text-sm font-semibold text-pri",children:a("demo.tasksTitle")}),c.jsxs("span",{className:"text-xs text-ter",children:[Math.min(l.doneTasks,tf.length),"/",tf.length]})]}),c.jsx("ul",{className:"space-y-2",children:tf.map((f,m)=>{const g=m<l.doneTasks;return c.jsxs("li",{className:"flex items-start gap-2 text-sm","data-testid":`demo-task-${m}`,"data-done":g||void 0,children:[g?c.jsx(Pb,{size:16,className:"mt-0.5 shrink-0 text-status-green"}):c.jsx(DS,{size:16,className:"mt-0.5 shrink-0 text-ter"}),c.jsx("span",{className:g?"text-pri":"text-sec",children:f})]},f)})})]}),c.jsxs("div",{className:"rounded-md border bg-0 p-3","data-testid":"demo-team",children:[c.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[c.jsx(gc,{size:15,className:"text-accent"}),c.jsx("h2",{className:"text-sm font-semibold text-pri",children:a("demo.teamTitle")})]}),c.jsx("div",{className:"grid gap-2",children:QE.map((f,m)=>{const g=l.workerStates[m]??"idle";return c.jsxs("div",{className:"rounded border px-3 py-2","data-testid":`demo-worker-${f.name}`,style:{borderColor:"var(--border)"},children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"text-sm font-medium text-pri",children:f.name}),c.jsx("span",{className:"rounded px-1.5 py-0.5 text-[11px] text-sec bg-2",children:g})]}),c.jsx("p",{className:"mt-1 text-xs text-ter",children:f.role})]},f.name)})})]})]})]})})]})};function zt(t,a,{checkForDefaultPrevented:o=!0}={}){return function(l){if(t?.(l),o===!1||!l.defaultPrevented)return a?.(l)}}function cy(t,a){if(typeof t=="function")return t(a);t!=null&&(t.current=a)}function r0(...t){return a=>{let o=!1;const i=t.map(l=>{const u=cy(l,a);return!o&&typeof u=="function"&&(o=!0),u});if(o)return()=>{for(let l=0;l<i.length;l++){const u=i[l];typeof u=="function"?u():cy(t[l],null)}}}}function Cn(...t){return b.useCallback(r0(...t),t)}function eC(t,a){const o=b.createContext(a),i=u=>{const{children:f,...m}=u,g=b.useMemo(()=>m,Object.values(m));return c.jsx(o.Provider,{value:g,children:f})};i.displayName=t+"Provider";function l(u){const f=b.useContext(o);if(f)return f;if(a!==void 0)return a;throw new Error(`\`${u}\` must be used within \`${t}\``)}return[i,l]}function Em(t,a=[]){let o=[];function i(u,f){const m=b.createContext(f),g=o.length;o=[...o,f];const p=v=>{const{scope:k,children:S,...T}=v,w=k?.[t]?.[g]||m,E=b.useMemo(()=>T,Object.values(T));return c.jsx(w.Provider,{value:E,children:S})};p.displayName=u+"Provider";function y(v,k){const S=k?.[t]?.[g]||m,T=b.useContext(S);if(T)return T;if(f!==void 0)return f;throw new Error(`\`${v}\` must be used within \`${u}\``)}return[p,y]}const l=()=>{const u=o.map(f=>b.createContext(f));return function(m){const g=m?.[t]||u;return b.useMemo(()=>({[`__scope${t}`]:{...m,[t]:g}}),[m,g])}};return l.scopeName=t,[i,tC(l,...a)]}function tC(...t){const a=t[0];if(t.length===1)return a;const o=()=>{const i=t.map(l=>({useScope:l(),scopeName:l.scopeName}));return function(u){const f=i.reduce((m,{useScope:g,scopeName:p})=>{const v=g(u)[`__scope${p}`];return{...m,...v}},{});return b.useMemo(()=>({[`__scope${a.scopeName}`]:f}),[f])}};return o.scopeName=a.scopeName,o}var Ya=globalThis?.document?b.useLayoutEffect:()=>{},nC=Wb[" useId ".trim().toString()]||(()=>{}),aC=0;function Ll(t){const[a,o]=b.useState(nC());return Ya(()=>{o(i=>i??String(aC++))},[t]),t||(a?`radix-${a}`:"")}var rC=Wb[" useInsertionEffect ".trim().toString()]||Ya;function o0({prop:t,defaultProp:a,onChange:o=()=>{},caller:i}){const[l,u,f]=oC({defaultProp:a,onChange:o}),m=t!==void 0,g=m?t:l;{const y=b.useRef(t!==void 0);b.useEffect(()=>{const v=y.current;v!==m&&console.warn(`${i} is changing from ${v?"controlled":"uncontrolled"} to ${m?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),y.current=m},[m,i])}const p=b.useCallback(y=>{if(m){const v=sC(y)?y(t):y;v!==t&&f.current?.(v)}else u(y)},[m,t,u,f]);return[g,p]}function oC({defaultProp:t,onChange:a}){const[o,i]=b.useState(t),l=b.useRef(o),u=b.useRef(a);return rC(()=>{u.current=a},[a]),b.useEffect(()=>{l.current!==o&&(u.current?.(o),l.current=o)},[o,l]),[o,i,u]}function sC(t){return typeof t=="function"}var vc=Ib();const iC=Ub(vc);function s0(t){const a=lC(t),o=b.forwardRef((i,l)=>{const{children:u,...f}=i,m=b.Children.toArray(u),g=m.find(uC);if(g){const p=g.props.children,y=m.map(v=>v===g?b.Children.count(p)>1?b.Children.only(null):b.isValidElement(p)?p.props.children:null:v);return c.jsx(a,{...f,ref:l,children:b.isValidElement(p)?b.cloneElement(p,void 0,y):null})}return c.jsx(a,{...f,ref:l,children:u})});return o.displayName=`${t}.Slot`,o}function lC(t){const a=b.forwardRef((o,i)=>{const{children:l,...u}=o;if(b.isValidElement(l)){const f=fC(l),m=dC(u,l.props);return l.type!==b.Fragment&&(m.ref=i?r0(i,f):f),b.cloneElement(l,m)}return b.Children.count(l)>1?b.Children.only(null):null});return a.displayName=`${t}.SlotClone`,a}var i0=Symbol("radix.slottable");function cC(t){const a=({children:o})=>c.jsx(c.Fragment,{children:o});return a.displayName=`${t}.Slottable`,a.__radixId=i0,a}function uC(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===i0}function dC(t,a){const o={...a};for(const i in a){const l=t[i],u=a[i];/^on[A-Z]/.test(i)?l&&u?o[i]=(...m)=>{const g=u(...m);return l(...m),g}:l&&(o[i]=l):i==="style"?o[i]={...l,...u}:i==="className"&&(o[i]=[l,u].filter(Boolean).join(" "))}return{...t,...o}}function fC(t){let a=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,o=a&&"isReactWarning"in a&&a.isReactWarning;return o?t.ref:(a=Object.getOwnPropertyDescriptor(t,"ref")?.get,o=a&&"isReactWarning"in a&&a.isReactWarning,o?t.props.ref:t.props.ref||t.ref)}var mC=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ut=mC.reduce((t,a)=>{const o=s0(`Primitive.${a}`),i=b.forwardRef((l,u)=>{const{asChild:f,...m}=l,g=f?o:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(g,{...m,ref:u})});return i.displayName=`Primitive.${a}`,{...t,[a]:i}},{});function pC(t,a){t&&vc.flushSync(()=>t.dispatchEvent(a))}function xo(t){const a=b.useRef(t);return b.useEffect(()=>{a.current=t}),b.useMemo(()=>(...o)=>a.current?.(...o),[])}function hC(t,a=globalThis?.document){const o=xo(t);b.useEffect(()=>{const i=l=>{l.key==="Escape"&&o(l)};return a.addEventListener("keydown",i,{capture:!0}),()=>a.removeEventListener("keydown",i,{capture:!0})},[o,a])}var gC="DismissableLayer",qf="dismissableLayer.update",vC="dismissableLayer.pointerDownOutside",yC="dismissableLayer.focusOutside",uy,l0=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Cm=b.forwardRef((t,a)=>{const{disableOutsidePointerEvents:o=!1,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:f,onDismiss:m,...g}=t,p=b.useContext(l0),[y,v]=b.useState(null),k=y?.ownerDocument??globalThis?.document,[,S]=b.useState({}),T=Cn(a,L=>v(L)),w=Array.from(p.layers),[E]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),C=w.indexOf(E),j=y?w.indexOf(y):-1,_=p.layersWithOutsidePointerEventsDisabled.size>0,N=j>=C,O=xC(L=>{const U=L.target,q=[...p.branches].some(ae=>ae.contains(U));!N||q||(l?.(L),f?.(L),L.defaultPrevented||m?.())},k),M=kC(L=>{const U=L.target;[...p.branches].some(ae=>ae.contains(U))||(u?.(L),f?.(L),L.defaultPrevented||m?.())},k);return hC(L=>{j===p.layers.size-1&&(i?.(L),!L.defaultPrevented&&m&&(L.preventDefault(),m()))},k),b.useEffect(()=>{if(y)return o&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(uy=k.body.style.pointerEvents,k.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(y)),p.layers.add(y),dy(),()=>{o&&p.layersWithOutsidePointerEventsDisabled.size===1&&(k.body.style.pointerEvents=uy)}},[y,k,o,p]),b.useEffect(()=>()=>{y&&(p.layers.delete(y),p.layersWithOutsidePointerEventsDisabled.delete(y),dy())},[y,p]),b.useEffect(()=>{const L=()=>S({});return document.addEventListener(qf,L),()=>document.removeEventListener(qf,L)},[]),c.jsx(Ut.div,{...g,ref:T,style:{pointerEvents:_?N?"auto":"none":void 0,...t.style},onFocusCapture:zt(t.onFocusCapture,M.onFocusCapture),onBlurCapture:zt(t.onBlurCapture,M.onBlurCapture),onPointerDownCapture:zt(t.onPointerDownCapture,O.onPointerDownCapture)})});Cm.displayName=gC;var bC="DismissableLayerBranch",wC=b.forwardRef((t,a)=>{const o=b.useContext(l0),i=b.useRef(null),l=Cn(a,i);return b.useEffect(()=>{const u=i.current;if(u)return o.branches.add(u),()=>{o.branches.delete(u)}},[o.branches]),c.jsx(Ut.div,{...t,ref:l})});wC.displayName=bC;function xC(t,a=globalThis?.document){const o=xo(t),i=b.useRef(!1),l=b.useRef(()=>{});return b.useEffect(()=>{const u=m=>{if(m.target&&!i.current){let g=function(){c0(vC,o,p,{discrete:!0})};const p={originalEvent:m};m.pointerType==="touch"?(a.removeEventListener("click",l.current),l.current=g,a.addEventListener("click",l.current,{once:!0})):g()}else a.removeEventListener("click",l.current);i.current=!1},f=window.setTimeout(()=>{a.addEventListener("pointerdown",u)},0);return()=>{window.clearTimeout(f),a.removeEventListener("pointerdown",u),a.removeEventListener("click",l.current)}},[a,o]),{onPointerDownCapture:()=>i.current=!0}}function kC(t,a=globalThis?.document){const o=xo(t),i=b.useRef(!1);return b.useEffect(()=>{const l=u=>{u.target&&!i.current&&c0(yC,o,{originalEvent:u},{discrete:!1})};return a.addEventListener("focusin",l),()=>a.removeEventListener("focusin",l)},[a,o]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function dy(){const t=new CustomEvent(qf);document.dispatchEvent(t)}function c0(t,a,o,{discrete:i}){const l=o.originalEvent.target,u=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:o});a&&l.addEventListener(t,a,{once:!0}),i?pC(l,u):l.dispatchEvent(u)}var nf="focusScope.autoFocusOnMount",af="focusScope.autoFocusOnUnmount",fy={bubbles:!1,cancelable:!0},SC="FocusScope",u0=b.forwardRef((t,a)=>{const{loop:o=!1,trapped:i=!1,onMountAutoFocus:l,onUnmountAutoFocus:u,...f}=t,[m,g]=b.useState(null),p=xo(l),y=xo(u),v=b.useRef(null),k=Cn(a,w=>g(w)),S=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(i){let w=function(_){if(S.paused||!m)return;const N=_.target;m.contains(N)?v.current=N:Ba(v.current,{select:!0})},E=function(_){if(S.paused||!m)return;const N=_.relatedTarget;N!==null&&(m.contains(N)||Ba(v.current,{select:!0}))},C=function(_){if(document.activeElement===document.body)for(const O of _)O.removedNodes.length>0&&Ba(m)};document.addEventListener("focusin",w),document.addEventListener("focusout",E);const j=new MutationObserver(C);return m&&j.observe(m,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",E),j.disconnect()}}},[i,m,S.paused]),b.useEffect(()=>{if(m){py.add(S);const w=document.activeElement;if(!m.contains(w)){const C=new CustomEvent(nf,fy);m.addEventListener(nf,p),m.dispatchEvent(C),C.defaultPrevented||(EC(AC(d0(m)),{select:!0}),document.activeElement===w&&Ba(m))}return()=>{m.removeEventListener(nf,p),setTimeout(()=>{const C=new CustomEvent(af,fy);m.addEventListener(af,y),m.dispatchEvent(C),C.defaultPrevented||Ba(w??document.body,{select:!0}),m.removeEventListener(af,y),py.remove(S)},0)}}},[m,p,y,S]);const T=b.useCallback(w=>{if(!o&&!i||S.paused)return;const E=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,C=document.activeElement;if(E&&C){const j=w.currentTarget,[_,N]=CC(j);_&&N?!w.shiftKey&&C===N?(w.preventDefault(),o&&Ba(_,{select:!0})):w.shiftKey&&C===_&&(w.preventDefault(),o&&Ba(N,{select:!0})):C===j&&w.preventDefault()}},[o,i,S.paused]);return c.jsx(Ut.div,{tabIndex:-1,...f,ref:k,onKeyDown:T})});u0.displayName=SC;function EC(t,{select:a=!1}={}){const o=document.activeElement;for(const i of t)if(Ba(i,{select:a}),document.activeElement!==o)return}function CC(t){const a=d0(t),o=my(a,t),i=my(a.reverse(),t);return[o,i]}function d0(t){const a=[],o=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const l=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||l?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;o.nextNode();)a.push(o.currentNode);return a}function my(t,a){for(const o of t)if(!TC(o,{upTo:a}))return o}function TC(t,{upTo:a}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(a!==void 0&&t===a)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function NC(t){return t instanceof HTMLInputElement&&"select"in t}function Ba(t,{select:a=!1}={}){if(t&&t.focus){const o=document.activeElement;t.focus({preventScroll:!0}),t!==o&&NC(t)&&a&&t.select()}}var py=jC();function jC(){let t=[];return{add(a){const o=t[0];a!==o&&o?.pause(),t=hy(t,a),t.unshift(a)},remove(a){t=hy(t,a),t[0]?.resume()}}}function hy(t,a){const o=[...t],i=o.indexOf(a);return i!==-1&&o.splice(i,1),o}function AC(t){return t.filter(a=>a.tagName!=="A")}var _C="Portal",Tm=b.forwardRef((t,a)=>{const{container:o,...i}=t,[l,u]=b.useState(!1);Ya(()=>u(!0),[]);const f=o||l&&globalThis?.document?.body;return f?iC.createPortal(c.jsx(Ut.div,{...i,ref:a}),f):null});Tm.displayName=_C;function RC(t,a){return b.useReducer((o,i)=>a[o][i]??o,t)}var Ao=t=>{const{present:a,children:o}=t,i=OC(a),l=typeof o=="function"?o({present:i.isPresent}):b.Children.only(o),u=Cn(i.ref,DC(l));return typeof o=="function"||i.isPresent?b.cloneElement(l,{ref:u}):null};Ao.displayName="Presence";function OC(t){const[a,o]=b.useState(),i=b.useRef(null),l=b.useRef(t),u=b.useRef("none"),f=t?"mounted":"unmounted",[m,g]=RC(f,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const p=El(i.current);u.current=m==="mounted"?p:"none"},[m]),Ya(()=>{const p=i.current,y=l.current;if(y!==t){const k=u.current,S=El(p);t?g("MOUNT"):S==="none"||p?.display==="none"?g("UNMOUNT"):g(y&&k!==S?"ANIMATION_OUT":"UNMOUNT"),l.current=t}},[t,g]),Ya(()=>{if(a){let p;const y=a.ownerDocument.defaultView??window,v=S=>{const w=El(i.current).includes(CSS.escape(S.animationName));if(S.target===a&&w&&(g("ANIMATION_END"),!l.current)){const E=a.style.animationFillMode;a.style.animationFillMode="forwards",p=y.setTimeout(()=>{a.style.animationFillMode==="forwards"&&(a.style.animationFillMode=E)})}},k=S=>{S.target===a&&(u.current=El(i.current))};return a.addEventListener("animationstart",k),a.addEventListener("animationcancel",v),a.addEventListener("animationend",v),()=>{y.clearTimeout(p),a.removeEventListener("animationstart",k),a.removeEventListener("animationcancel",v),a.removeEventListener("animationend",v)}}else g("ANIMATION_END")},[a,g]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:b.useCallback(p=>{i.current=p?getComputedStyle(p):null,o(p)},[])}}function El(t){return t?.animationName||"none"}function DC(t){let a=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,o=a&&"isReactWarning"in a&&a.isReactWarning;return o?t.ref:(a=Object.getOwnPropertyDescriptor(t,"ref")?.get,o=a&&"isReactWarning"in a&&a.isReactWarning,o?t.props.ref:t.props.ref||t.ref)}var rf=0;function MC(){b.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??gy()),document.body.insertAdjacentElement("beforeend",t[1]??gy()),rf++,()=>{rf===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(a=>a.remove()),rf--}},[])}function gy(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Mn=function(){return Mn=Object.assign||function(a){for(var o,i=1,l=arguments.length;i<l;i++){o=arguments[i];for(var u in o)Object.prototype.hasOwnProperty.call(o,u)&&(a[u]=o[u])}return a},Mn.apply(this,arguments)};function f0(t,a){var o={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&a.indexOf(i)<0&&(o[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var l=0,i=Object.getOwnPropertySymbols(t);l<i.length;l++)a.indexOf(i[l])<0&&Object.prototype.propertyIsEnumerable.call(t,i[l])&&(o[i[l]]=t[i[l]]);return o}function LC(t,a,o){if(o||arguments.length===2)for(var i=0,l=a.length,u;i<l;i++)(u||!(i in a))&&(u||(u=Array.prototype.slice.call(a,0,i)),u[i]=a[i]);return t.concat(u||Array.prototype.slice.call(a))}var zl="right-scroll-bar-position",Hl="width-before-scroll-bar",zC="with-scroll-bars-hidden",HC="--removed-body-scroll-bar-size";function of(t,a){return typeof t=="function"?t(a):t&&(t.current=a),t}function BC(t,a){var o=b.useState(function(){return{value:t,callback:a,facade:{get current(){return o.value},set current(i){var l=o.value;l!==i&&(o.value=i,o.callback(i,l))}}}})[0];return o.callback=a,o.facade}var UC=typeof window<"u"?b.useLayoutEffect:b.useEffect,vy=new WeakMap;function WC(t,a){var o=BC(null,function(i){return t.forEach(function(l){return of(l,i)})});return UC(function(){var i=vy.get(o);if(i){var l=new Set(i),u=new Set(t),f=o.current;l.forEach(function(m){u.has(m)||of(m,null)}),u.forEach(function(m){l.has(m)||of(m,f)})}vy.set(o,t)},[t]),o}function IC(t){return t}function qC(t,a){a===void 0&&(a=IC);var o=[],i=!1,l={read:function(){if(i)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return o.length?o[o.length-1]:t},useMedium:function(u){var f=a(u,i);return o.push(f),function(){o=o.filter(function(m){return m!==f})}},assignSyncMedium:function(u){for(i=!0;o.length;){var f=o;o=[],f.forEach(u)}o={push:function(m){return u(m)},filter:function(){return o}}},assignMedium:function(u){i=!0;var f=[];if(o.length){var m=o;o=[],m.forEach(u),f=o}var g=function(){var y=f;f=[],y.forEach(u)},p=function(){return Promise.resolve().then(g)};p(),o={push:function(y){f.push(y),p()},filter:function(y){return f=f.filter(y),o}}}};return l}function PC(t){t===void 0&&(t={});var a=qC(null);return a.options=Mn({async:!0,ssr:!1},t),a}var m0=function(t){var a=t.sideCar,o=f0(t,["sideCar"]);if(!a)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var i=a.read();if(!i)throw new Error("Sidecar medium not found");return b.createElement(i,Mn({},o))};m0.isSideCarExport=!0;function FC(t,a){return t.useMedium(a),m0}var p0=PC(),sf=function(){},yc=b.forwardRef(function(t,a){var o=b.useRef(null),i=b.useState({onScrollCapture:sf,onWheelCapture:sf,onTouchMoveCapture:sf}),l=i[0],u=i[1],f=t.forwardProps,m=t.children,g=t.className,p=t.removeScrollBar,y=t.enabled,v=t.shards,k=t.sideCar,S=t.noRelative,T=t.noIsolation,w=t.inert,E=t.allowPinchZoom,C=t.as,j=C===void 0?"div":C,_=t.gapMode,N=f0(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),O=k,M=WC([o,a]),L=Mn(Mn({},N),l);return b.createElement(b.Fragment,null,y&&b.createElement(O,{sideCar:p0,removeScrollBar:p,shards:v,noRelative:S,noIsolation:T,inert:w,setCallbacks:u,allowPinchZoom:!!E,lockRef:o,gapMode:_}),f?b.cloneElement(b.Children.only(m),Mn(Mn({},L),{ref:M})):b.createElement(j,Mn({},L,{className:g,ref:M}),m))});yc.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};yc.classNames={fullWidth:Hl,zeroRight:zl};var KC=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function YC(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var a=KC();return a&&t.setAttribute("nonce",a),t}function $C(t,a){t.styleSheet?t.styleSheet.cssText=a:t.appendChild(document.createTextNode(a))}function VC(t){var a=document.head||document.getElementsByTagName("head")[0];a.appendChild(t)}var GC=function(){var t=0,a=null;return{add:function(o){t==0&&(a=YC())&&($C(a,o),VC(a)),t++},remove:function(){t--,!t&&a&&(a.parentNode&&a.parentNode.removeChild(a),a=null)}}},XC=function(){var t=GC();return function(a,o){b.useEffect(function(){return t.add(a),function(){t.remove()}},[a&&o])}},h0=function(){var t=XC(),a=function(o){var i=o.styles,l=o.dynamic;return t(i,l),null};return a},ZC={left:0,top:0,right:0,gap:0},lf=function(t){return parseInt(t||"",10)||0},QC=function(t){var a=window.getComputedStyle(document.body),o=a[t==="padding"?"paddingLeft":"marginLeft"],i=a[t==="padding"?"paddingTop":"marginTop"],l=a[t==="padding"?"paddingRight":"marginRight"];return[lf(o),lf(i),lf(l)]},JC=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return ZC;var a=QC(t),o=document.documentElement.clientWidth,i=window.innerWidth;return{left:a[0],top:a[1],right:a[2],gap:Math.max(0,i-o+a[2]-a[0])}},eT=h0(),vo="data-scroll-locked",tT=function(t,a,o,i){var l=t.left,u=t.top,f=t.right,m=t.gap;return o===void 0&&(o="margin"),`
12
+ .`.concat(zC,` {
13
+ overflow: hidden `).concat(i,`;
14
+ padding-right: `).concat(m,"px ").concat(i,`;
15
+ }
16
+ body[`).concat(vo,`] {
17
+ overflow: hidden `).concat(i,`;
18
+ overscroll-behavior: contain;
19
+ `).concat([a&&"position: relative ".concat(i,";"),o==="margin"&&`
20
+ padding-left: `.concat(l,`px;
21
+ padding-top: `).concat(u,`px;
22
+ padding-right: `).concat(f,`px;
23
+ margin-left:0;
24
+ margin-top:0;
25
+ margin-right: `).concat(m,"px ").concat(i,`;
26
+ `),o==="padding"&&"padding-right: ".concat(m,"px ").concat(i,";")].filter(Boolean).join(""),`
27
+ }
28
+
29
+ .`).concat(zl,` {
30
+ right: `).concat(m,"px ").concat(i,`;
31
+ }
32
+
33
+ .`).concat(Hl,` {
34
+ margin-right: `).concat(m,"px ").concat(i,`;
35
+ }
36
+
37
+ .`).concat(zl," .").concat(zl,` {
38
+ right: 0 `).concat(i,`;
39
+ }
40
+
41
+ .`).concat(Hl," .").concat(Hl,` {
42
+ margin-right: 0 `).concat(i,`;
43
+ }
44
+
45
+ body[`).concat(vo,`] {
46
+ `).concat(HC,": ").concat(m,`px;
47
+ }
48
+ `)},yy=function(){var t=parseInt(document.body.getAttribute(vo)||"0",10);return isFinite(t)?t:0},nT=function(){b.useEffect(function(){return document.body.setAttribute(vo,(yy()+1).toString()),function(){var t=yy()-1;t<=0?document.body.removeAttribute(vo):document.body.setAttribute(vo,t.toString())}},[])},aT=function(t){var a=t.noRelative,o=t.noImportant,i=t.gapMode,l=i===void 0?"margin":i;nT();var u=b.useMemo(function(){return JC(l)},[l]);return b.createElement(eT,{styles:tT(u,!a,l,o?"":"!important")})},Pf=!1;if(typeof window<"u")try{var Cl=Object.defineProperty({},"passive",{get:function(){return Pf=!0,!0}});window.addEventListener("test",Cl,Cl),window.removeEventListener("test",Cl,Cl)}catch{Pf=!1}var uo=Pf?{passive:!1}:!1,rT=function(t){return t.tagName==="TEXTAREA"},g0=function(t,a){if(!(t instanceof Element))return!1;var o=window.getComputedStyle(t);return o[a]!=="hidden"&&!(o.overflowY===o.overflowX&&!rT(t)&&o[a]==="visible")},oT=function(t){return g0(t,"overflowY")},sT=function(t){return g0(t,"overflowX")},by=function(t,a){var o=a.ownerDocument,i=a;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var l=v0(t,i);if(l){var u=y0(t,i),f=u[1],m=u[2];if(f>m)return!0}i=i.parentNode}while(i&&i!==o.body);return!1},iT=function(t){var a=t.scrollTop,o=t.scrollHeight,i=t.clientHeight;return[a,o,i]},lT=function(t){var a=t.scrollLeft,o=t.scrollWidth,i=t.clientWidth;return[a,o,i]},v0=function(t,a){return t==="v"?oT(a):sT(a)},y0=function(t,a){return t==="v"?iT(a):lT(a)},cT=function(t,a){return t==="h"&&a==="rtl"?-1:1},uT=function(t,a,o,i,l){var u=cT(t,window.getComputedStyle(a).direction),f=u*i,m=o.target,g=a.contains(m),p=!1,y=f>0,v=0,k=0;do{if(!m)break;var S=y0(t,m),T=S[0],w=S[1],E=S[2],C=w-E-u*T;(T||C)&&v0(t,m)&&(v+=C,k+=T);var j=m.parentNode;m=j&&j.nodeType===Node.DOCUMENT_FRAGMENT_NODE?j.host:j}while(!g&&m!==document.body||g&&(a.contains(m)||a===m));return(y&&Math.abs(v)<1||!y&&Math.abs(k)<1)&&(p=!0),p},Tl=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},wy=function(t){return[t.deltaX,t.deltaY]},xy=function(t){return t&&"current"in t?t.current:t},dT=function(t,a){return t[0]===a[0]&&t[1]===a[1]},fT=function(t){return`
49
+ .block-interactivity-`.concat(t,` {pointer-events: none;}
50
+ .allow-interactivity-`).concat(t,` {pointer-events: all;}
51
+ `)},mT=0,fo=[];function pT(t){var a=b.useRef([]),o=b.useRef([0,0]),i=b.useRef(),l=b.useState(mT++)[0],u=b.useState(h0)[0],f=b.useRef(t);b.useEffect(function(){f.current=t},[t]),b.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(l));var w=LC([t.lockRef.current],(t.shards||[]).map(xy),!0).filter(Boolean);return w.forEach(function(E){return E.classList.add("allow-interactivity-".concat(l))}),function(){document.body.classList.remove("block-interactivity-".concat(l)),w.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(l))})}}},[t.inert,t.lockRef.current,t.shards]);var m=b.useCallback(function(w,E){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!f.current.allowPinchZoom;var C=Tl(w),j=o.current,_="deltaX"in w?w.deltaX:j[0]-C[0],N="deltaY"in w?w.deltaY:j[1]-C[1],O,M=w.target,L=Math.abs(_)>Math.abs(N)?"h":"v";if("touches"in w&&L==="h"&&M.type==="range")return!1;var U=window.getSelection(),q=U&&U.anchorNode,ae=q?q===M||q.contains(M):!1;if(ae)return!1;var ee=by(L,M);if(!ee)return!0;if(ee?O=L:(O=L==="v"?"h":"v",ee=by(L,M)),!ee)return!1;if(!i.current&&"changedTouches"in w&&(_||N)&&(i.current=O),!O)return!0;var F=i.current||O;return uT(F,E,w,F==="h"?_:N)},[]),g=b.useCallback(function(w){var E=w;if(!(!fo.length||fo[fo.length-1]!==u)){var C="deltaY"in E?wy(E):Tl(E),j=a.current.filter(function(O){return O.name===E.type&&(O.target===E.target||E.target===O.shadowParent)&&dT(O.delta,C)})[0];if(j&&j.should){E.cancelable&&E.preventDefault();return}if(!j){var _=(f.current.shards||[]).map(xy).filter(Boolean).filter(function(O){return O.contains(E.target)}),N=_.length>0?m(E,_[0]):!f.current.noIsolation;N&&E.cancelable&&E.preventDefault()}}},[]),p=b.useCallback(function(w,E,C,j){var _={name:w,delta:E,target:C,should:j,shadowParent:hT(C)};a.current.push(_),setTimeout(function(){a.current=a.current.filter(function(N){return N!==_})},1)},[]),y=b.useCallback(function(w){o.current=Tl(w),i.current=void 0},[]),v=b.useCallback(function(w){p(w.type,wy(w),w.target,m(w,t.lockRef.current))},[]),k=b.useCallback(function(w){p(w.type,Tl(w),w.target,m(w,t.lockRef.current))},[]);b.useEffect(function(){return fo.push(u),t.setCallbacks({onScrollCapture:v,onWheelCapture:v,onTouchMoveCapture:k}),document.addEventListener("wheel",g,uo),document.addEventListener("touchmove",g,uo),document.addEventListener("touchstart",y,uo),function(){fo=fo.filter(function(w){return w!==u}),document.removeEventListener("wheel",g,uo),document.removeEventListener("touchmove",g,uo),document.removeEventListener("touchstart",y,uo)}},[]);var S=t.removeScrollBar,T=t.inert;return b.createElement(b.Fragment,null,T?b.createElement(u,{styles:fT(l)}):null,S?b.createElement(aT,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function hT(t){for(var a=null;t!==null;)t instanceof ShadowRoot&&(a=t.host,t=t.host),t=t.parentNode;return a}const gT=FC(p0,pT);var b0=b.forwardRef(function(t,a){return b.createElement(yc,Mn({},t,{ref:a,sideCar:gT}))});b0.classNames=yc.classNames;var vT=function(t){if(typeof document>"u")return null;var a=Array.isArray(t)?t[0]:t;return a.ownerDocument.body},mo=new WeakMap,Nl=new WeakMap,jl={},cf=0,w0=function(t){return t&&(t.host||w0(t.parentNode))},yT=function(t,a){return a.map(function(o){if(t.contains(o))return o;var i=w0(o);return i&&t.contains(i)?i:(console.error("aria-hidden",o,"in not contained inside",t,". Doing nothing"),null)}).filter(function(o){return!!o})},bT=function(t,a,o,i){var l=yT(a,Array.isArray(t)?t:[t]);jl[o]||(jl[o]=new WeakMap);var u=jl[o],f=[],m=new Set,g=new Set(l),p=function(v){!v||m.has(v)||(m.add(v),p(v.parentNode))};l.forEach(p);var y=function(v){!v||g.has(v)||Array.prototype.forEach.call(v.children,function(k){if(m.has(k))y(k);else try{var S=k.getAttribute(i),T=S!==null&&S!=="false",w=(mo.get(k)||0)+1,E=(u.get(k)||0)+1;mo.set(k,w),u.set(k,E),f.push(k),w===1&&T&&Nl.set(k,!0),E===1&&k.setAttribute(o,"true"),T||k.setAttribute(i,"true")}catch(C){console.error("aria-hidden: cannot operate on ",k,C)}})};return y(a),m.clear(),cf++,function(){f.forEach(function(v){var k=mo.get(v)-1,S=u.get(v)-1;mo.set(v,k),u.set(v,S),k||(Nl.has(v)||v.removeAttribute(i),Nl.delete(v)),S||v.removeAttribute(o)}),cf--,cf||(mo=new WeakMap,mo=new WeakMap,Nl=new WeakMap,jl={})}},wT=function(t,a,o){o===void 0&&(o="data-aria-hidden");var i=Array.from(Array.isArray(t)?t:[t]),l=vT(t);return l?(i.push.apply(i,Array.from(l.querySelectorAll("[aria-live], script"))),bT(i,l,o,"aria-hidden")):function(){return null}},bc="Dialog",[x0]=Em(bc),[xT,Tn]=x0(bc),k0=t=>{const{__scopeDialog:a,children:o,open:i,defaultOpen:l,onOpenChange:u,modal:f=!0}=t,m=b.useRef(null),g=b.useRef(null),[p,y]=o0({prop:i,defaultProp:l??!1,onChange:u,caller:bc});return c.jsx(xT,{scope:a,triggerRef:m,contentRef:g,contentId:Ll(),titleId:Ll(),descriptionId:Ll(),open:p,onOpenChange:y,onOpenToggle:b.useCallback(()=>y(v=>!v),[y]),modal:f,children:o})};k0.displayName=bc;var S0="DialogTrigger",E0=b.forwardRef((t,a)=>{const{__scopeDialog:o,...i}=t,l=Tn(S0,o),u=Cn(a,l.triggerRef);return c.jsx(Ut.button,{type:"button","aria-haspopup":"dialog","aria-expanded":l.open,"aria-controls":l.contentId,"data-state":Am(l.open),...i,ref:u,onClick:zt(t.onClick,l.onOpenToggle)})});E0.displayName=S0;var Nm="DialogPortal",[kT,C0]=x0(Nm,{forceMount:void 0}),T0=t=>{const{__scopeDialog:a,forceMount:o,children:i,container:l}=t,u=Tn(Nm,a);return c.jsx(kT,{scope:a,forceMount:o,children:b.Children.map(i,f=>c.jsx(Ao,{present:o||u.open,children:c.jsx(Tm,{asChild:!0,container:l,children:f})}))})};T0.displayName=Nm;var $l="DialogOverlay",N0=b.forwardRef((t,a)=>{const o=C0($l,t.__scopeDialog),{forceMount:i=o.forceMount,...l}=t,u=Tn($l,t.__scopeDialog);return u.modal?c.jsx(Ao,{present:i||u.open,children:c.jsx(ET,{...l,ref:a})}):null});N0.displayName=$l;var ST=s0("DialogOverlay.RemoveScroll"),ET=b.forwardRef((t,a)=>{const{__scopeDialog:o,...i}=t,l=Tn($l,o);return c.jsx(b0,{as:ST,allowPinchZoom:!0,shards:[l.contentRef],children:c.jsx(Ut.div,{"data-state":Am(l.open),...i,ref:a,style:{pointerEvents:"auto",...i.style}})})}),Sr="DialogContent",j0=b.forwardRef((t,a)=>{const o=C0(Sr,t.__scopeDialog),{forceMount:i=o.forceMount,...l}=t,u=Tn(Sr,t.__scopeDialog);return c.jsx(Ao,{present:i||u.open,children:u.modal?c.jsx(CT,{...l,ref:a}):c.jsx(TT,{...l,ref:a})})});j0.displayName=Sr;var CT=b.forwardRef((t,a)=>{const o=Tn(Sr,t.__scopeDialog),i=b.useRef(null),l=Cn(a,o.contentRef,i);return b.useEffect(()=>{const u=i.current;if(u)return wT(u)},[]),c.jsx(A0,{...t,ref:l,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:zt(t.onCloseAutoFocus,u=>{u.preventDefault(),o.triggerRef.current?.focus()}),onPointerDownOutside:zt(t.onPointerDownOutside,u=>{const f=u.detail.originalEvent,m=f.button===0&&f.ctrlKey===!0;(f.button===2||m)&&u.preventDefault()}),onFocusOutside:zt(t.onFocusOutside,u=>u.preventDefault())})}),TT=b.forwardRef((t,a)=>{const o=Tn(Sr,t.__scopeDialog),i=b.useRef(!1),l=b.useRef(!1);return c.jsx(A0,{...t,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:u=>{t.onCloseAutoFocus?.(u),u.defaultPrevented||(i.current||o.triggerRef.current?.focus(),u.preventDefault()),i.current=!1,l.current=!1},onInteractOutside:u=>{t.onInteractOutside?.(u),u.defaultPrevented||(i.current=!0,u.detail.originalEvent.type==="pointerdown"&&(l.current=!0));const f=u.target;o.triggerRef.current?.contains(f)&&u.preventDefault(),u.detail.originalEvent.type==="focusin"&&l.current&&u.preventDefault()}})}),A0=b.forwardRef((t,a)=>{const{__scopeDialog:o,trapFocus:i,onOpenAutoFocus:l,onCloseAutoFocus:u,...f}=t,m=Tn(Sr,o),g=b.useRef(null),p=Cn(a,g);return MC(),c.jsxs(c.Fragment,{children:[c.jsx(u0,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:l,onUnmountAutoFocus:u,children:c.jsx(Cm,{role:"dialog",id:m.contentId,"aria-describedby":m.descriptionId,"aria-labelledby":m.titleId,"data-state":Am(m.open),...f,ref:p,onDismiss:()=>m.onOpenChange(!1)})}),c.jsxs(c.Fragment,{children:[c.jsx(NT,{titleId:m.titleId}),c.jsx(AT,{contentRef:g,descriptionId:m.descriptionId})]})]})}),jm="DialogTitle",_0=b.forwardRef((t,a)=>{const{__scopeDialog:o,...i}=t,l=Tn(jm,o);return c.jsx(Ut.h2,{id:l.titleId,...i,ref:a})});_0.displayName=jm;var R0="DialogDescription",O0=b.forwardRef((t,a)=>{const{__scopeDialog:o,...i}=t,l=Tn(R0,o);return c.jsx(Ut.p,{id:l.descriptionId,...i,ref:a})});O0.displayName=R0;var D0="DialogClose",M0=b.forwardRef((t,a)=>{const{__scopeDialog:o,...i}=t,l=Tn(D0,o);return c.jsx(Ut.button,{type:"button",...i,ref:a,onClick:zt(t.onClick,()=>l.onOpenChange(!1))})});M0.displayName=D0;function Am(t){return t?"open":"closed"}var L0="DialogTitleWarning",[aM,z0]=eC(L0,{contentName:Sr,titleName:jm,docsSlug:"dialog"}),NT=({titleId:t})=>{const a=z0(L0),o=`\`${a.contentName}\` requires a \`${a.titleName}\` for the component to be accessible for screen reader users.
52
+
53
+ If you want to hide the \`${a.titleName}\`, you can wrap it with our VisuallyHidden component.
54
+
55
+ For more information, see https://radix-ui.com/primitives/docs/components/${a.docsSlug}`;return b.useEffect(()=>{t&&(document.getElementById(t)||console.error(o))},[o,t]),null},jT="DialogDescriptionWarning",AT=({contentRef:t,descriptionId:a})=>{const i=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${z0(jT).contentName}}.`;return b.useEffect(()=>{const l=t.current?.getAttribute("aria-describedby");a&&l&&(document.getElementById(a)||console.warn(i))},[i,t,a]),null},_o=k0,_T=E0,Ro=T0,Oo=N0,Do=j0,Mo=_0,ti=O0,rM=M0;const RT=(t,a={})=>{const o=new URL(t,window.location.href);o.protocol=o.protocol==="https:"?"wss:":"ws:";for(const[i,l]of Object.entries(a))l!==void 0&&o.searchParams.set(i,String(l));return o.toString()},OT={requiresUiSession:!0,fetch(t,a){return fetch(t,a)},openWebSocket(t,a){return new WebSocket(RT(t,a))}};let ko=OT;const DT=t=>{ko=t},H0=()=>ko,B0=()=>ko.requiresUiSession!==!1,U0=t=>({id:t.id,name:t.name,role:t.role,status:t.status,pendingTaskCount:t.pending_task_count,...t.last_pty_line?{lastPtyLine:t.last_pty_line}:{},...t.command_preset_id?{commandPresetId:t.command_preset_id}:{},...t.ephemeral===!0?{ephemeral:!0}:{},...t.spawned_by?{spawnedBy:t.spawned_by}:{}}),Ae=async(t,a)=>{try{const o=await t.json();if(typeof o.error=="string"&&o.error.trim())return o.error}catch{}return a},MT=async t=>{if(t.status!==403)return!1;try{return(await t.clone().json()).error==="UI endpoint requires valid UI token"}catch{return!1}},W0=async()=>{if(!B0())return;const t=await ko.fetch("/api/ui/session",{mode:"same-origin"});if(!t.ok)throw new Error("Failed to initialize UI session");await t.json()};let uf=null;const LT=()=>(uf??=W0().finally(()=>{uf=null}),uf),ge=async(t,a)=>{const o=await ko.fetch(t,a);return!B0()||!await MT(o)?o:(await LT(),ko.fetch(t,a))},zT=async()=>{const t=await ge("/api/workspaces");if(!t.ok)throw new Error("Failed to load workspaces");return await t.json()},HT=async()=>{const t=await ge("/api/version");if(!t.ok)throw new Error("Failed to load version info");const a=await t.json();return{canRunHiveUpdate:a.can_run_hive_update??a.install_hint==="hive update",currentVersion:a.current_version,installHint:a.install_hint,installSource:a.install_source??"unknown",latestVersion:a.latest_version,packageName:a.package_name,releaseUrl:a.release_url,updateNote:a.update_note??"",updateAvailable:a.update_available}},I0=t=>({description:t.description,id:t.id,isBuiltin:t.is_builtin,name:t.name,roleType:t.role_type}),BT=t=>({name:t.name,role_type:t.roleType,description:t.description,default_command:"",default_args:[],default_env:{}}),UT=async t=>{const a=await ge("/api/workspaces",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(!a.ok)throw new Error(await Ae(a,"Failed to create workspace"));return await a.json()},WT=async t=>{const a=await ge(`/api/workspaces/${t}`,{method:"DELETE"});if(!a.ok)throw new Error(await Ae(a,"Failed to delete workspace"))},Vl=async(t,a)=>{const o=await ge(`/api/workspaces/${t}/agents/${a}/start`,{method:"POST"});if(!o.ok)throw new Error(await Ae(o,"Failed to start agent run"));return{runId:(await o.json()).run_id}},Gl=async t=>{if(!(await ge(`/api/runtime/runs/${t}/stop`,{method:"POST"})).ok)throw new Error("Failed to stop agent run")},IT=async(t,a,o)=>(await Gl(o).catch(i=>{console.error("[hive] swallowed:restartAgentRun.stop",i)}),Vl(t,a)),qT=async()=>{const t=await ge("/api/settings/app-state/active_workspace_id");if(!t.ok)throw new Error("Failed to load active workspace");return(await t.json()).value},q0=async t=>{if(!(await ge("/api/settings/app-state/active_workspace_id",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({value:t})})).ok)throw new Error("Failed to save active workspace")},P0="notifications.webhook-url",PT=async()=>{const t=await ge(`/api/settings/app-state/${P0}`);if(!t.ok)throw new Error("Failed to load webhook URL");return(await t.json()).value??""},FT=async t=>{if(!(await ge(`/api/settings/app-state/${P0}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({value:t.trim()})})).ok)throw new Error("Failed to save webhook URL")},oM=async()=>{const t=await ge("/api/settings/workflow-cli-policy");if(!t.ok)throw new Error("Failed to load workflow CLI policy");return await t.json()},sM=async t=>{const a=await ge("/api/settings/workflow-cli-policy",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(!a.ok)throw new Error("Failed to save workflow CLI policy");return await a.json()},KT=async()=>{const t=await ge("/api/settings/workflow-feature");if(!t.ok)throw new Error("Failed to load workflow feature flag");return await t.json()},YT=async t=>{const a=await ge("/api/settings/workflow-feature",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({enabled:t})});if(!a.ok)throw new Error("Failed to save workflow feature flag");return await a.json()},$T=async()=>{const t=await ge("/api/settings/team-autostaff");if(!t.ok)throw new Error("Failed to load auto-staff feature flag");return await t.json()},VT=async t=>{const a=await ge("/api/settings/team-autostaff",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({enabled:t})});if(!a.ok)throw new Error("Failed to save auto-staff feature flag");return await a.json()},GT=async t=>{const a=await ge(`/api/ui/workspaces/${t}/team`,{mode:"same-origin"});if(!a.ok)throw new Error("Failed to load workers");return(await a.json()).map(U0)},XT=async()=>{const t=await ge("/api/settings/command-presets");if(!t.ok)throw new Error("Failed to load command presets");return(await t.json()).map(a=>({args:a.args,available:a.available,command:a.command,displayName:a.display_name,id:a.id}))},ZT=t=>`${t}:shell`,wc=(t,a)=>t.agent_id===ZT(a),QT=async t=>{const a=await ge(`/api/workspaces/${t}/shell/start`,{method:"POST"});if(!a.ok)throw new Error(await Ae(a,"Failed to start workspace terminal"));return await a.json()},JT=async(t,a)=>{const o=await ge(`/api/workspaces/${t}/shell/${a}`,{method:"DELETE"});if(!o.ok)throw new Error(await Ae(o,"Failed to close workspace terminal"))},eN=async()=>{const t=await ge("/api/settings/role-templates",{mode:"same-origin"});if(!t.ok)throw new Error("Failed to load role templates");return(await t.json()).map(I0)},tN=async t=>{const a=await ge("/api/settings/role-templates",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(BT(t))});if(!a.ok)throw new Error(await Ae(a,"Failed to create role template"));return I0(await a.json())},nN=async t=>{const a=await ge(`/api/settings/role-templates/${t}`,{method:"DELETE"});if(!a.ok)throw new Error(await Ae(a,"Failed to delete role template"))},iM=async t=>{const a=await ge(`/api/marketplace/manifest?lang=${t}`,{mode:"same-origin"});if(!a.ok)throw new Error(await Ae(a,"Failed to load marketplace manifest"));return await a.json()},lM=async(t,a)=>{const o=await ge(`/api/marketplace/agent?lang=${t}&path=${encodeURIComponent(a)}`,{mode:"same-origin"});if(!o.ok)throw new Error(await Ae(o,"Failed to load marketplace agent"));return await o.json()},aN=async t=>{const a=await ge(`/api/ui/workspaces/${t}/runs`,{mode:"same-origin"});if(!a.ok)throw new Error("Failed to load terminal runs");return await a.json()},rN=async(t,a)=>{const o=await ge(`/api/workspaces/${t}/workers`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(a)});if(!o.ok)throw new Error(await Ae(o,"Failed to create worker"));const i=await o.json();return{agentStart:{error:i.agent_start?.error??null,ok:i.agent_start?.ok??!1,runId:i.agent_start?.run_id??null},worker:U0(i)}},oN=async(t,a,o,i)=>{const l=await ge(`/api/workspaces/${t}/scenarios/${encodeURIComponent(a)}/apply`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({goal:o,locale:i})});if(!l.ok)throw new Error(await Ae(l,"Failed to assemble the scenario team"));return{createdWorkers:(await l.json()).created_workers}},sN=async(t,a)=>{const o=await ge(`/api/workspaces/${t}/workers/${a}`,{method:"DELETE"});if(!o.ok)throw new Error(await Ae(o,"Failed to delete worker"))},iN=async(t,a,o)=>{const i=await ge(`/api/workspaces/${t}/workers/${a}`,{body:JSON.stringify({name:o}),headers:{"content-type":"application/json"},method:"PATCH"});if(!i.ok)throw new Error(await Ae(i,"Failed to rename worker"))},lN=async t=>{const a=await ge(`/api/workspaces/${t}/tasks`);if(!a.ok)throw new Error("Failed to load tasks");return await a.json()},Al=async(t,a)=>{const o=await ge(`/api/workspaces/${t}/tasks`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(a)});if(!o.ok)throw new Error("Failed to save tasks");return await o.json()},cM=async t=>{const a=t?`?path=${encodeURIComponent(t)}`:"";return await(await ge(`/api/fs/browse${a}`,{mode:"same-origin"})).json()},uM=async t=>await(await ge(`/api/fs/probe?path=${encodeURIComponent(t)}`,{mode:"same-origin"})).json(),dM=async()=>await(await ge("/api/fs/pick-folder",{method:"POST",mode:"same-origin"})).json(),cN=async(t,a)=>{const o=await ge(`/api/workspaces/${t}/open`,{body:JSON.stringify({target_id:a}),headers:{"content-type":"application/json"},method:"POST"});if(o.status===200)return{ok:!0,effectiveTargetId:(await o.json()).effective_target_id};if(o.status===502){const i=await o.json();return{ok:!1,effectiveTargetId:i.effective_target_id,errorCode:i.error_code}}throw new Error(await Ae(o,"Failed to open workspace"))},uN=t=>({actorAgentIdSnapshot:t.actor_agent_id_snapshot,actorNameSnapshot:t.actor_name_snapshot,actorRoleSnapshot:t.actor_role_snapshot,createdAt:t.created_at,excerpt:t.excerpt,id:t.id,memoryId:t.memory_id,sourceId:t.source_id,sourceSequence:t.source_sequence,sourceType:t.source_type,textHash:t.text_hash}),xc=t=>({archivedAt:t.archived_at,body:t.body,confidence:t.confidence,createdAt:t.created_at,disabled:t.disabled,id:t.id,kind:t.kind,lastInjectedAt:t.last_injected_at,pinned:t.pinned,procedureRef:t.procedure_ref,scope:t.scope,source:t.source,sources:t.sources.map(uN),status:t.status,tags:t.tags,updatedAt:t.updated_at,workspaceId:t.workspace_id}),dN=t=>({contextType:t.context_type,dispatchId:t.dispatch_id,id:t.id,injectedAt:t.injected_at,memory:xc(t.memory),memoryId:t.memory_id,targetAgentIdSnapshot:t.target_agent_id_snapshot,workspaceId:t.workspace_id}),fM=async(t,a={})=>{const o=new URLSearchParams;a.status&&o.set("status",a.status),a.scope&&o.set("scope",a.scope),a.query?.trim()&&o.set("query",a.query.trim()),a.limit!==void 0&&o.set("limit",String(a.limit));const i=o.size>0?`?${o}`:"",l=await ge(`/api/ui/workspaces/${t}/memory${i}`);if(!l.ok)throw new Error(await Ae(l,"Failed to load memory"));return(await l.json()).memories.map(xc)},mM=async(t,a,o)=>{const i=await ge(`/api/ui/workspaces/${t}/memory/${a}`,{body:JSON.stringify(o),headers:{"content-type":"application/json"},method:"PATCH"});if(!i.ok)throw new Error(await Ae(i,"Failed to update memory"));const l=await i.json();return xc(l.memory)},fN=async(t,a,o)=>{const i=await ge(`/api/ui/workspaces/${t}/memory/${a}/${o}`,{method:"POST"});if(!i.ok)throw new Error(await Ae(i,`Failed to ${o} memory`));const l=await i.json();return xc(l.memory)},pM=(t,a)=>fN(t,a,"archive"),_m=t=>({error:t.error,finishedAt:t.finished_at,id:t.id,inputSeqFrom:t.input_seq_from,inputSeqTo:t.input_seq_to,report:t.report,startedAt:t.started_at,status:t.status,trigger:t.trigger,workspaceId:t.workspace_id}),hM=async(t,a={})=>{const o=new URLSearchParams;a.limit!==void 0&&o.set("limit",String(a.limit));const i=o.size>0?`?${o}`:"",l=await ge(`/api/ui/workspaces/${t}/memory/dream-runs${i}`);if(!l.ok)throw new Error(await Ae(l,"Failed to load dream runs"));return(await l.json()).runs.map(_m)},gM=async t=>{const a=await ge(`/api/ui/workspaces/${t}/memory/dream-runs`,{body:JSON.stringify({}),headers:{"content-type":"application/json"},method:"POST"});if(!a.ok)throw new Error(await Ae(a,"Failed to run dream"));const o=await a.json();return _m(o.run)},vM=async(t,a)=>{const o=await ge(`/api/ui/workspaces/${t}/memory/dream-runs/${a}/revert`,{body:JSON.stringify({}),headers:{"content-type":"application/json"},method:"POST"});if(!o.ok)throw new Error(await Ae(o,"Failed to revert dream run"));const i=await o.json();return _m(i.run)},yM=async t=>{const a=await ge(`/api/ui/workspaces/${t}/memory/settings`);if(!a.ok)throw new Error(await Ae(a,"Failed to load memory settings"));const o=await a.json();return{dreamEnabled:o.dream_enabled,enabled:o.enabled}},bM=async(t,a)=>{const o=await ge(`/api/ui/workspaces/${t}/memory/settings`,{body:JSON.stringify({...a.dreamEnabled===void 0?{}:{dream_enabled:a.dreamEnabled},...a.enabled===void 0?{}:{enabled:a.enabled}}),headers:{"content-type":"application/json"},method:"PUT"});if(!o.ok)throw new Error(await Ae(o,"Failed to update memory settings"));const i=await o.json();return{dreamEnabled:i.dream_enabled,enabled:i.enabled}},wM=async(t,a)=>{const o=new URLSearchParams({dispatch_id:a}),i=await ge(`/api/ui/workspaces/${t}/memory/injections?${o}`);if(!i.ok)throw new Error(await Ae(i,"Failed to load memory injections"));return(await i.json()).injections.map(dN)},mN=t=>({id:t.id,workspaceId:t.workspace_id,scriptPath:t.script_path,name:t.name,status:t.status,startedAt:t.started_at,finishedAt:t.finished_at,error:t.error,phase:t.phase,result:t.result??null,args:t.args??null,agentCount:typeof t.agent_count=="number"?t.agent_count:0,parentRunId:t.parent_run_id??null}),xM=async t=>{const a=await ge(`/api/workspaces/${t}/workflows/runs`);if(!a.ok)throw new Error(await Ae(a,"Failed to list workflow runs"));return(await a.json()).runs.map(mN)},F0=t=>({id:t.id,workspaceId:t.workspace_id,scriptPath:t.script_path,cron:t.cron,args:t.args,enabled:t.enabled,lastRunAt:t.last_run_at,nextRunAt:t.next_run_at,createdAt:t.created_at,updatedAt:t.updated_at}),kM=async t=>{const a=await ge(`/api/workspaces/${t}/workflow-schedules`);if(!a.ok)throw new Error(await Ae(a,"Failed to list workflow schedules"));return(await a.json()).schedules.map(F0)},SM=async(t,a)=>{const o=await ge(`/api/workflow-schedules/${t}`,{body:JSON.stringify(a),headers:{"content-type":"application/json"},method:"PATCH"});if(!o.ok)throw new Error(await Ae(o,"Failed to update workflow schedule"));const i=await o.json();return F0(i.schedule)},pN=t=>({id:t.id,workspaceId:t.workspace_id,fromAgentId:t.from_agent_id,toAgentId:t.to_agent_id,text:t.text,status:t.status,reportText:t.report_text,reportedAt:t.reported_at,createdAt:t.created_at,workflowRunId:t.workflow_run_id,stepIndex:t.step_index,phase:t.phase,label:t.label,...t.last_pty_line?{lastPtyLine:t.last_pty_line}:{}}),EM=async t=>{const a=await ge(`/api/workflows/runs/${t}/stop`,{method:"POST"});if(!a.ok)throw new Error(await Ae(a,"Failed to stop workflow run"))},CM=async t=>{const a=await ge(`/api/workflows/runs/${t}/dispatches`);if(!a.ok)throw new Error(await Ae(a,"Failed to load workflow run dispatches"));return(await a.json()).dispatches.map(pN)},TM=async t=>{const a=await ge(`/api/workflows/runs/${t}/logs`);if(!a.ok)throw new Error(await Ae(a,"Failed to load workflow run logs"));return(await a.json()).logs},NM=async t=>{const a=await ge(`/api/workflow-schedules/${t}`,{method:"DELETE"});if(!a.ok)throw new Error(await Ae(a,"Failed to delete workflow schedule"))},hN=["disabled","loggedOut","connecting","online","reconnecting","revoked"],gN=(t,a)=>typeof t=="string"&&hN.includes(t)?t:a?"online":"disabled",Us=(t,a)=>{if(typeof t=="string"&&t.length>0)return t;throw new Error(`Remote payload missing ${a}`)},K0=(t,a)=>{if(typeof t=="number"&&Number.isFinite(t))return t;throw new Error(`Remote payload missing ${a}`)},Y0=t=>({enabled:t.enabled===!0,loggedIn:t.logged_in===!0,gatewayUrl:t.gateway_url??null,connected:t.connected===!0,connection:gN(t.connection,t.connected===!0)}),vN=t=>({deviceId:t.id,name:t.name,lastActive:t.last_active,createdAt:t.created_at,revoked:t.revoked_at!==null}),yN=t=>({pairingId:Us(t.pairing_id,"pairing_id"),qr:Us(t.qr,"qr"),code:Us(t.code,"code"),expiresAt:K0(t.expires_at,"expires_at")}),bN=t=>({pairingId:Us(t.pairing_id,"pairing_id"),deviceName:t.device_name??null,sas:Us(t.sas,"sas"),expiresAt:K0(t.expires_at,"expires_at")}),wN=t=>({id:t.id,deviceId:t.device_id,ts:t.ts,workspaceId:t.workspace_id,action:t.action,endpoint:t.endpoint,result:t.result,rejectReason:t.reject_reason,byteCount:t.byte_count,preview:t.preview}),df=async()=>{const t=await ge("/api/remote/status");if(!t.ok)throw new Error(await Ae(t,"Failed to load remote status"));return Y0(await t.json())},xN=async t=>{const a=await ge("/api/remote/enabled",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({enabled:t})});if(!a.ok)throw new Error(await Ae(a,"Failed to update remote access"));return Y0(await a.json())},kN=async()=>{const t=await ge("/api/remote/pairings",{method:"POST"});if(!t.ok)throw new Error(await Ae(t,"Failed to start pairing"));return yN(await t.json())},ky=async()=>{const t=await ge("/api/remote/pairings/pending");if(!t.ok)throw new Error(await Ae(t,"Failed to load pending pairing"));const o=(await t.json())[0];return o?bN(o):null},SN=async t=>{const a=await ge(`/api/remote/pairings/${t}/confirm`,{method:"POST"});if(!a.ok)throw new Error(await Ae(a,"Failed to confirm pairing"))},EN=async t=>{const a=await ge(`/api/remote/pairings/${t}/reject`,{method:"POST"});if(!a.ok)throw new Error(await Ae(a,"Failed to reject pairing"))},$0=async()=>{const t=await ge("/api/remote/devices");if(!t.ok)throw new Error(await Ae(t,"Failed to load devices"));return(await t.json()).map(vN)},CN=async t=>{const a=await ge(`/api/remote/devices/${t}/revoke`,{method:"POST"});if(!a.ok)throw new Error(await Ae(a,"Failed to revoke device"))},TN=async(t=100)=>{const a=await ge(`/api/remote/audit?limit=${t}`);if(!a.ok)throw new Error(await Ae(a,"Failed to load remote activity"));return(await a.json()).map(wN)},NN=t=>t.kind==="stopped_with_queue"?{kind:t.kind,openDispatches:t.open_dispatches,pendingTaskCount:t.pending_task_count,severity:t.severity,workerId:t.worker_id,workerName:t.worker_name}:t.kind==="dispatch_waiting_report"?{dispatchId:t.dispatch_id,kind:t.kind,minutesAgo:t.minutes_ago,severity:t.severity,submittedAt:t.submitted_at,workerId:t.worker_id,workerName:t.worker_name}:t,ff=t=>({createdAt:t.created_at,id:t.id,label:t.label,phase:t.phase,reportPreview:t.report_preview??null,status:t.status,submittedAt:t.submitted_at,taskPreview:t.task_preview??null,timestamp:t.timestamp,toAgentId:t.to_agent_id,toWorkerName:t.to_worker_name,workflowRunId:t.workflow_run_id}),jN=t=>({attention:(t.attention??[]).map(NN),generatedAt:t.generated_at,recentActivity:t.recent_activity.map(a=>({...ff(a),kind:a.kind})),summary:{idleWorkers:t.summary.idle_workers,openDispatches:t.summary.open_dispatches,recentReports:t.summary.recent_reports,stoppedWithQueue:t.summary.stopped_with_queue,stoppedWorkers:t.summary.stopped_workers,totalWorkers:t.summary.total_workers,waitingReports:t.summary.waiting_reports??0,workingWorkers:t.summary.working_workers},workers:t.workers.map(a=>({currentDispatch:a.current_dispatch?ff(a.current_dispatch):null,id:a.id,latestReport:a.latest_report?ff(a.latest_report):null,name:a.name,pendingTaskCount:a.pending_task_count,role:a.role,status:a.status,terminalHint:a.terminal_hint??null})),workspaceId:t.workspace_id}),AN=async(t,a)=>{const o=await ge(`/api/ui/workspaces/${t}/action-center`,a);if(!o.ok)throw new Error(await Ae(o,"Failed to load action center"));return jN(await o.json())},_N=async(t,a)=>{const o=await ge(`/api/workspaces/${t}/recap`,a);if(!o.ok)throw new Error(await Ae(o,"Failed to load team recap"));const i=await o.json();return{generatedAt:i.generated_at,markdown:i.markdown}},RN=async()=>{const t=await ge("/api/diagnostics/support-bundle");if(!t.ok)throw new Error(await Ae(t,"Failed to load diagnostics"));return await t.json()},ON=async()=>{const t=await ge("/api/diagnostics/retention");if(!t.ok)throw new Error(await Ae(t,"Failed to load retention diagnostics"));return await t.json()},V0=async t=>{if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(t);return}catch{}const a=document.createElement("textarea");a.value=t,a.setAttribute("readonly",""),a.style.position="fixed",a.style.top="0",a.style.left="-9999px",a.style.opacity="0";const o=document.activeElement instanceof HTMLElement?document.activeElement:null;let i=!1;try{document.body.appendChild(a),a.focus(),a.select(),a.setSelectionRange(0,a.value.length),i=document.execCommand("copy")}finally{a.remove(),o?.focus()}if(!i)throw new Error("Clipboard copy failed")},G0=async t=>{if(navigator.clipboard?.write&&typeof ClipboardItem<"u"){const a=t.then(o=>new Blob([o],{type:"text/plain"}));a.catch(()=>{});try{await navigator.clipboard.write([new ClipboardItem({"text/plain":a})]);return}catch{}}await V0(await t)},Sy="(max-width: 767px)",X0=b.createContext({mode:"wide"}),mf={mode:"wide"},DN={mode:"mobile"},MN=(t=typeof window<"u"?window.matchMedia.bind(window):void 0)=>{const a=i=>{if(!t)return()=>{};const l=t(Sy);return l.addEventListener?.("change",i),()=>l.removeEventListener?.("change",i)},o=()=>t&&t(Sy).matches?DN:mf;return b.useSyncExternalStore(a,o,()=>mf)},LN=({children:t,value:a})=>{const o=MN();return c.jsx(X0.Provider,{value:a??o,children:t})},Z0=()=>b.useContext(X0),wt=()=>Z0().mode==="mobile",zN=["top","right","bottom","left"],$a=Math.min,Zt=Math.max,Xl=Math.round,_l=Math.floor,Hn=t=>({x:t,y:t}),HN={left:"right",right:"left",bottom:"top",top:"bottom"};function Ff(t,a,o){return Zt(t,$a(a,o))}function sa(t,a){return typeof t=="function"?t(a):t}function ia(t){return t.split("-")[0]}function Lo(t){return t.split("-")[1]}function Rm(t){return t==="x"?"y":"x"}function Om(t){return t==="y"?"height":"width"}function zn(t){const a=t[0];return a==="t"||a==="b"?"y":"x"}function Dm(t){return Rm(zn(t))}function BN(t,a,o){o===void 0&&(o=!1);const i=Lo(t),l=Dm(t),u=Om(l);let f=l==="x"?i===(o?"end":"start")?"right":"left":i==="start"?"bottom":"top";return a.reference[u]>a.floating[u]&&(f=Zl(f)),[f,Zl(f)]}function UN(t){const a=Zl(t);return[Kf(t),a,Kf(a)]}function Kf(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const Ey=["left","right"],Cy=["right","left"],WN=["top","bottom"],IN=["bottom","top"];function qN(t,a,o){switch(t){case"top":case"bottom":return o?a?Cy:Ey:a?Ey:Cy;case"left":case"right":return a?WN:IN;default:return[]}}function PN(t,a,o,i){const l=Lo(t);let u=qN(ia(t),o==="start",i);return l&&(u=u.map(f=>f+"-"+l),a&&(u=u.concat(u.map(Kf)))),u}function Zl(t){const a=ia(t);return HN[a]+t.slice(a.length)}function FN(t){return{top:0,right:0,bottom:0,left:0,...t}}function Q0(t){return typeof t!="number"?FN(t):{top:t,right:t,bottom:t,left:t}}function Ql(t){const{x:a,y:o,width:i,height:l}=t;return{width:i,height:l,top:o,left:a,right:a+i,bottom:o+l,x:a,y:o}}function Ty(t,a,o){let{reference:i,floating:l}=t;const u=zn(a),f=Dm(a),m=Om(f),g=ia(a),p=u==="y",y=i.x+i.width/2-l.width/2,v=i.y+i.height/2-l.height/2,k=i[m]/2-l[m]/2;let S;switch(g){case"top":S={x:y,y:i.y-l.height};break;case"bottom":S={x:y,y:i.y+i.height};break;case"right":S={x:i.x+i.width,y:v};break;case"left":S={x:i.x-l.width,y:v};break;default:S={x:i.x,y:i.y}}switch(Lo(a)){case"start":S[f]-=k*(o&&p?-1:1);break;case"end":S[f]+=k*(o&&p?-1:1);break}return S}async function KN(t,a){var o;a===void 0&&(a={});const{x:i,y:l,platform:u,rects:f,elements:m,strategy:g}=t,{boundary:p="clippingAncestors",rootBoundary:y="viewport",elementContext:v="floating",altBoundary:k=!1,padding:S=0}=sa(a,t),T=Q0(S),E=m[k?v==="floating"?"reference":"floating":v],C=Ql(await u.getClippingRect({element:(o=await(u.isElement==null?void 0:u.isElement(E)))==null||o?E:E.contextElement||await(u.getDocumentElement==null?void 0:u.getDocumentElement(m.floating)),boundary:p,rootBoundary:y,strategy:g})),j=v==="floating"?{x:i,y:l,width:f.floating.width,height:f.floating.height}:f.reference,_=await(u.getOffsetParent==null?void 0:u.getOffsetParent(m.floating)),N=await(u.isElement==null?void 0:u.isElement(_))?await(u.getScale==null?void 0:u.getScale(_))||{x:1,y:1}:{x:1,y:1},O=Ql(u.convertOffsetParentRelativeRectToViewportRelativeRect?await u.convertOffsetParentRelativeRectToViewportRelativeRect({elements:m,rect:j,offsetParent:_,strategy:g}):j);return{top:(C.top-O.top+T.top)/N.y,bottom:(O.bottom-C.bottom+T.bottom)/N.y,left:(C.left-O.left+T.left)/N.x,right:(O.right-C.right+T.right)/N.x}}const YN=50,$N=async(t,a,o)=>{const{placement:i="bottom",strategy:l="absolute",middleware:u=[],platform:f}=o,m=f.detectOverflow?f:{...f,detectOverflow:KN},g=await(f.isRTL==null?void 0:f.isRTL(a));let p=await f.getElementRects({reference:t,floating:a,strategy:l}),{x:y,y:v}=Ty(p,i,g),k=i,S=0;const T={};for(let w=0;w<u.length;w++){const E=u[w];if(!E)continue;const{name:C,fn:j}=E,{x:_,y:N,data:O,reset:M}=await j({x:y,y:v,initialPlacement:i,placement:k,strategy:l,middlewareData:T,rects:p,platform:m,elements:{reference:t,floating:a}});y=_??y,v=N??v,T[C]={...T[C],...O},M&&S<YN&&(S++,typeof M=="object"&&(M.placement&&(k=M.placement),M.rects&&(p=M.rects===!0?await f.getElementRects({reference:t,floating:a,strategy:l}):M.rects),{x:y,y:v}=Ty(p,k,g)),w=-1)}return{x:y,y:v,placement:k,strategy:l,middlewareData:T}},VN=t=>({name:"arrow",options:t,async fn(a){const{x:o,y:i,placement:l,rects:u,platform:f,elements:m,middlewareData:g}=a,{element:p,padding:y=0}=sa(t,a)||{};if(p==null)return{};const v=Q0(y),k={x:o,y:i},S=Dm(l),T=Om(S),w=await f.getDimensions(p),E=S==="y",C=E?"top":"left",j=E?"bottom":"right",_=E?"clientHeight":"clientWidth",N=u.reference[T]+u.reference[S]-k[S]-u.floating[T],O=k[S]-u.reference[S],M=await(f.getOffsetParent==null?void 0:f.getOffsetParent(p));let L=M?M[_]:0;(!L||!await(f.isElement==null?void 0:f.isElement(M)))&&(L=m.floating[_]||u.floating[T]);const U=N/2-O/2,q=L/2-w[T]/2-1,ae=$a(v[C],q),ee=$a(v[j],q),F=ae,J=L-w[T]-ee,X=L/2-w[T]/2+U,$=Ff(F,X,J),D=!g.arrow&&Lo(l)!=null&&X!==$&&u.reference[T]/2-(X<F?ae:ee)-w[T]/2<0,P=D?X<F?X-F:X-J:0;return{[S]:k[S]+P,data:{[S]:$,centerOffset:X-$-P,...D&&{alignmentOffset:P}},reset:D}}}),GN=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(a){var o,i;const{placement:l,middlewareData:u,rects:f,initialPlacement:m,platform:g,elements:p}=a,{mainAxis:y=!0,crossAxis:v=!0,fallbackPlacements:k,fallbackStrategy:S="bestFit",fallbackAxisSideDirection:T="none",flipAlignment:w=!0,...E}=sa(t,a);if((o=u.arrow)!=null&&o.alignmentOffset)return{};const C=ia(l),j=zn(m),_=ia(m)===m,N=await(g.isRTL==null?void 0:g.isRTL(p.floating)),O=k||(_||!w?[Zl(m)]:UN(m)),M=T!=="none";!k&&M&&O.push(...PN(m,w,T,N));const L=[m,...O],U=await g.detectOverflow(a,E),q=[];let ae=((i=u.flip)==null?void 0:i.overflows)||[];if(y&&q.push(U[C]),v){const X=BN(l,f,N);q.push(U[X[0]],U[X[1]])}if(ae=[...ae,{placement:l,overflows:q}],!q.every(X=>X<=0)){var ee,F;const X=(((ee=u.flip)==null?void 0:ee.index)||0)+1,$=L[X];if($&&(!(v==="alignment"?j!==zn($):!1)||ae.every(I=>zn(I.placement)===j?I.overflows[0]>0:!0)))return{data:{index:X,overflows:ae},reset:{placement:$}};let D=(F=ae.filter(P=>P.overflows[0]<=0).sort((P,I)=>P.overflows[1]-I.overflows[1])[0])==null?void 0:F.placement;if(!D)switch(S){case"bestFit":{var J;const P=(J=ae.filter(I=>{if(M){const V=zn(I.placement);return V===j||V==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(V=>V>0).reduce((V,Z)=>V+Z,0)]).sort((I,V)=>I[1]-V[1])[0])==null?void 0:J[0];P&&(D=P);break}case"initialPlacement":D=m;break}if(l!==D)return{reset:{placement:D}}}return{}}}};function Ny(t,a){return{top:t.top-a.height,right:t.right-a.width,bottom:t.bottom-a.height,left:t.left-a.width}}function jy(t){return zN.some(a=>t[a]>=0)}const XN=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(a){const{rects:o,platform:i}=a,{strategy:l="referenceHidden",...u}=sa(t,a);switch(l){case"referenceHidden":{const f=await i.detectOverflow(a,{...u,elementContext:"reference"}),m=Ny(f,o.reference);return{data:{referenceHiddenOffsets:m,referenceHidden:jy(m)}}}case"escaped":{const f=await i.detectOverflow(a,{...u,altBoundary:!0}),m=Ny(f,o.floating);return{data:{escapedOffsets:m,escaped:jy(m)}}}default:return{}}}}},J0=new Set(["left","top"]);async function ZN(t,a){const{placement:o,platform:i,elements:l}=t,u=await(i.isRTL==null?void 0:i.isRTL(l.floating)),f=ia(o),m=Lo(o),g=zn(o)==="y",p=J0.has(f)?-1:1,y=u&&g?-1:1,v=sa(a,t);let{mainAxis:k,crossAxis:S,alignmentAxis:T}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return m&&typeof T=="number"&&(S=m==="end"?T*-1:T),g?{x:S*y,y:k*p}:{x:k*p,y:S*y}}const QN=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(a){var o,i;const{x:l,y:u,placement:f,middlewareData:m}=a,g=await ZN(a,t);return f===((o=m.offset)==null?void 0:o.placement)&&(i=m.arrow)!=null&&i.alignmentOffset?{}:{x:l+g.x,y:u+g.y,data:{...g,placement:f}}}}},JN=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(a){const{x:o,y:i,placement:l,platform:u}=a,{mainAxis:f=!0,crossAxis:m=!1,limiter:g={fn:C=>{let{x:j,y:_}=C;return{x:j,y:_}}},...p}=sa(t,a),y={x:o,y:i},v=await u.detectOverflow(a,p),k=zn(ia(l)),S=Rm(k);let T=y[S],w=y[k];if(f){const C=S==="y"?"top":"left",j=S==="y"?"bottom":"right",_=T+v[C],N=T-v[j];T=Ff(_,T,N)}if(m){const C=k==="y"?"top":"left",j=k==="y"?"bottom":"right",_=w+v[C],N=w-v[j];w=Ff(_,w,N)}const E=g.fn({...a,[S]:T,[k]:w});return{...E,data:{x:E.x-o,y:E.y-i,enabled:{[S]:f,[k]:m}}}}}},ej=function(t){return t===void 0&&(t={}),{options:t,fn(a){const{x:o,y:i,placement:l,rects:u,middlewareData:f}=a,{offset:m=0,mainAxis:g=!0,crossAxis:p=!0}=sa(t,a),y={x:o,y:i},v=zn(l),k=Rm(v);let S=y[k],T=y[v];const w=sa(m,a),E=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(g){const _=k==="y"?"height":"width",N=u.reference[k]-u.floating[_]+E.mainAxis,O=u.reference[k]+u.reference[_]-E.mainAxis;S<N?S=N:S>O&&(S=O)}if(p){var C,j;const _=k==="y"?"width":"height",N=J0.has(ia(l)),O=u.reference[v]-u.floating[_]+(N&&((C=f.offset)==null?void 0:C[v])||0)+(N?0:E.crossAxis),M=u.reference[v]+u.reference[_]+(N?0:((j=f.offset)==null?void 0:j[v])||0)-(N?E.crossAxis:0);T<O?T=O:T>M&&(T=M)}return{[k]:S,[v]:T}}}},tj=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(a){var o,i;const{placement:l,rects:u,platform:f,elements:m}=a,{apply:g=()=>{},...p}=sa(t,a),y=await f.detectOverflow(a,p),v=ia(l),k=Lo(l),S=zn(l)==="y",{width:T,height:w}=u.floating;let E,C;v==="top"||v==="bottom"?(E=v,C=k===(await(f.isRTL==null?void 0:f.isRTL(m.floating))?"start":"end")?"left":"right"):(C=v,E=k==="end"?"top":"bottom");const j=w-y.top-y.bottom,_=T-y.left-y.right,N=$a(w-y[E],j),O=$a(T-y[C],_),M=!a.middlewareData.shift;let L=N,U=O;if((o=a.middlewareData.shift)!=null&&o.enabled.x&&(U=_),(i=a.middlewareData.shift)!=null&&i.enabled.y&&(L=j),M&&!k){const ae=Zt(y.left,0),ee=Zt(y.right,0),F=Zt(y.top,0),J=Zt(y.bottom,0);S?U=T-2*(ae!==0||ee!==0?ae+ee:Zt(y.left,y.right)):L=w-2*(F!==0||J!==0?F+J:Zt(y.top,y.bottom))}await g({...a,availableWidth:U,availableHeight:L});const q=await f.getDimensions(m.floating);return T!==q.width||w!==q.height?{reset:{rects:!0}}:{}}}};function kc(){return typeof window<"u"}function zo(t){return ew(t)?(t.nodeName||"").toLowerCase():"#document"}function Jt(t){var a;return(t==null||(a=t.ownerDocument)==null?void 0:a.defaultView)||window}function Un(t){var a;return(a=(ew(t)?t.ownerDocument:t.document)||window.document)==null?void 0:a.documentElement}function ew(t){return kc()?t instanceof Node||t instanceof Jt(t).Node:!1}function Sn(t){return kc()?t instanceof Element||t instanceof Jt(t).Element:!1}function ca(t){return kc()?t instanceof HTMLElement||t instanceof Jt(t).HTMLElement:!1}function Ay(t){return!kc()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Jt(t).ShadowRoot}function ni(t){const{overflow:a,overflowX:o,overflowY:i,display:l}=En(t);return/auto|scroll|overlay|hidden|clip/.test(a+i+o)&&l!=="inline"&&l!=="contents"}function nj(t){return/^(table|td|th)$/.test(zo(t))}function Sc(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const aj=/transform|translate|scale|rotate|perspective|filter/,rj=/paint|layout|strict|content/,gr=t=>!!t&&t!=="none";let pf;function Mm(t){const a=Sn(t)?En(t):t;return gr(a.transform)||gr(a.translate)||gr(a.scale)||gr(a.rotate)||gr(a.perspective)||!Lm()&&(gr(a.backdropFilter)||gr(a.filter))||aj.test(a.willChange||"")||rj.test(a.contain||"")}function oj(t){let a=Va(t);for(;ca(a)&&!So(a);){if(Mm(a))return a;if(Sc(a))return null;a=Va(a)}return null}function Lm(){return pf==null&&(pf=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),pf}function So(t){return/^(html|body|#document)$/.test(zo(t))}function En(t){return Jt(t).getComputedStyle(t)}function Ec(t){return Sn(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Va(t){if(zo(t)==="html")return t;const a=t.assignedSlot||t.parentNode||Ay(t)&&t.host||Un(t);return Ay(a)?a.host:a}function tw(t){const a=Va(t);return So(a)?t.ownerDocument?t.ownerDocument.body:t.body:ca(a)&&ni(a)?a:tw(a)}function Ys(t,a,o){var i;a===void 0&&(a=[]),o===void 0&&(o=!0);const l=tw(t),u=l===((i=t.ownerDocument)==null?void 0:i.body),f=Jt(l);if(u){const m=Yf(f);return a.concat(f,f.visualViewport||[],ni(l)?l:[],m&&o?Ys(m):[])}else return a.concat(l,Ys(l,[],o))}function Yf(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function nw(t){const a=En(t);let o=parseFloat(a.width)||0,i=parseFloat(a.height)||0;const l=ca(t),u=l?t.offsetWidth:o,f=l?t.offsetHeight:i,m=Xl(o)!==u||Xl(i)!==f;return m&&(o=u,i=f),{width:o,height:i,$:m}}function zm(t){return Sn(t)?t:t.contextElement}function yo(t){const a=zm(t);if(!ca(a))return Hn(1);const o=a.getBoundingClientRect(),{width:i,height:l,$:u}=nw(a);let f=(u?Xl(o.width):o.width)/i,m=(u?Xl(o.height):o.height)/l;return(!f||!Number.isFinite(f))&&(f=1),(!m||!Number.isFinite(m))&&(m=1),{x:f,y:m}}const sj=Hn(0);function aw(t){const a=Jt(t);return!Lm()||!a.visualViewport?sj:{x:a.visualViewport.offsetLeft,y:a.visualViewport.offsetTop}}function ij(t,a,o){return a===void 0&&(a=!1),!o||a&&o!==Jt(t)?!1:a}function Er(t,a,o,i){a===void 0&&(a=!1),o===void 0&&(o=!1);const l=t.getBoundingClientRect(),u=zm(t);let f=Hn(1);a&&(i?Sn(i)&&(f=yo(i)):f=yo(t));const m=ij(u,o,i)?aw(u):Hn(0);let g=(l.left+m.x)/f.x,p=(l.top+m.y)/f.y,y=l.width/f.x,v=l.height/f.y;if(u){const k=Jt(u),S=i&&Sn(i)?Jt(i):i;let T=k,w=Yf(T);for(;w&&i&&S!==T;){const E=yo(w),C=w.getBoundingClientRect(),j=En(w),_=C.left+(w.clientLeft+parseFloat(j.paddingLeft))*E.x,N=C.top+(w.clientTop+parseFloat(j.paddingTop))*E.y;g*=E.x,p*=E.y,y*=E.x,v*=E.y,g+=_,p+=N,T=Jt(w),w=Yf(T)}}return Ql({width:y,height:v,x:g,y:p})}function Cc(t,a){const o=Ec(t).scrollLeft;return a?a.left+o:Er(Un(t)).left+o}function rw(t,a){const o=t.getBoundingClientRect(),i=o.left+a.scrollLeft-Cc(t,o),l=o.top+a.scrollTop;return{x:i,y:l}}function lj(t){let{elements:a,rect:o,offsetParent:i,strategy:l}=t;const u=l==="fixed",f=Un(i),m=a?Sc(a.floating):!1;if(i===f||m&&u)return o;let g={scrollLeft:0,scrollTop:0},p=Hn(1);const y=Hn(0),v=ca(i);if((v||!v&&!u)&&((zo(i)!=="body"||ni(f))&&(g=Ec(i)),v)){const S=Er(i);p=yo(i),y.x=S.x+i.clientLeft,y.y=S.y+i.clientTop}const k=f&&!v&&!u?rw(f,g):Hn(0);return{width:o.width*p.x,height:o.height*p.y,x:o.x*p.x-g.scrollLeft*p.x+y.x+k.x,y:o.y*p.y-g.scrollTop*p.y+y.y+k.y}}function cj(t){return Array.from(t.getClientRects())}function uj(t){const a=Un(t),o=Ec(t),i=t.ownerDocument.body,l=Zt(a.scrollWidth,a.clientWidth,i.scrollWidth,i.clientWidth),u=Zt(a.scrollHeight,a.clientHeight,i.scrollHeight,i.clientHeight);let f=-o.scrollLeft+Cc(t);const m=-o.scrollTop;return En(i).direction==="rtl"&&(f+=Zt(a.clientWidth,i.clientWidth)-l),{width:l,height:u,x:f,y:m}}const _y=25;function dj(t,a){const o=Jt(t),i=Un(t),l=o.visualViewport;let u=i.clientWidth,f=i.clientHeight,m=0,g=0;if(l){u=l.width,f=l.height;const y=Lm();(!y||y&&a==="fixed")&&(m=l.offsetLeft,g=l.offsetTop)}const p=Cc(i);if(p<=0){const y=i.ownerDocument,v=y.body,k=getComputedStyle(v),S=y.compatMode==="CSS1Compat"&&parseFloat(k.marginLeft)+parseFloat(k.marginRight)||0,T=Math.abs(i.clientWidth-v.clientWidth-S);T<=_y&&(u-=T)}else p<=_y&&(u+=p);return{width:u,height:f,x:m,y:g}}function fj(t,a){const o=Er(t,!0,a==="fixed"),i=o.top+t.clientTop,l=o.left+t.clientLeft,u=ca(t)?yo(t):Hn(1),f=t.clientWidth*u.x,m=t.clientHeight*u.y,g=l*u.x,p=i*u.y;return{width:f,height:m,x:g,y:p}}function Ry(t,a,o){let i;if(a==="viewport")i=dj(t,o);else if(a==="document")i=uj(Un(t));else if(Sn(a))i=fj(a,o);else{const l=aw(t);i={x:a.x-l.x,y:a.y-l.y,width:a.width,height:a.height}}return Ql(i)}function ow(t,a){const o=Va(t);return o===a||!Sn(o)||So(o)?!1:En(o).position==="fixed"||ow(o,a)}function mj(t,a){const o=a.get(t);if(o)return o;let i=Ys(t,[],!1).filter(m=>Sn(m)&&zo(m)!=="body"),l=null;const u=En(t).position==="fixed";let f=u?Va(t):t;for(;Sn(f)&&!So(f);){const m=En(f),g=Mm(f);!g&&m.position==="fixed"&&(l=null),(u?!g&&!l:!g&&m.position==="static"&&!!l&&(l.position==="absolute"||l.position==="fixed")||ni(f)&&!g&&ow(t,f))?i=i.filter(y=>y!==f):l=m,f=Va(f)}return a.set(t,i),i}function pj(t){let{element:a,boundary:o,rootBoundary:i,strategy:l}=t;const f=[...o==="clippingAncestors"?Sc(a)?[]:mj(a,this._c):[].concat(o),i],m=Ry(a,f[0],l);let g=m.top,p=m.right,y=m.bottom,v=m.left;for(let k=1;k<f.length;k++){const S=Ry(a,f[k],l);g=Zt(S.top,g),p=$a(S.right,p),y=$a(S.bottom,y),v=Zt(S.left,v)}return{width:p-v,height:y-g,x:v,y:g}}function hj(t){const{width:a,height:o}=nw(t);return{width:a,height:o}}function gj(t,a,o){const i=ca(a),l=Un(a),u=o==="fixed",f=Er(t,!0,u,a);let m={scrollLeft:0,scrollTop:0};const g=Hn(0);function p(){g.x=Cc(l)}if(i||!i&&!u)if((zo(a)!=="body"||ni(l))&&(m=Ec(a)),i){const S=Er(a,!0,u,a);g.x=S.x+a.clientLeft,g.y=S.y+a.clientTop}else l&&p();u&&!i&&l&&p();const y=l&&!i&&!u?rw(l,m):Hn(0),v=f.left+m.scrollLeft-g.x-y.x,k=f.top+m.scrollTop-g.y-y.y;return{x:v,y:k,width:f.width,height:f.height}}function hf(t){return En(t).position==="static"}function Oy(t,a){if(!ca(t)||En(t).position==="fixed")return null;if(a)return a(t);let o=t.offsetParent;return Un(t)===o&&(o=o.ownerDocument.body),o}function sw(t,a){const o=Jt(t);if(Sc(t))return o;if(!ca(t)){let l=Va(t);for(;l&&!So(l);){if(Sn(l)&&!hf(l))return l;l=Va(l)}return o}let i=Oy(t,a);for(;i&&nj(i)&&hf(i);)i=Oy(i,a);return i&&So(i)&&hf(i)&&!Mm(i)?o:i||oj(t)||o}const vj=async function(t){const a=this.getOffsetParent||sw,o=this.getDimensions,i=await o(t.floating);return{reference:gj(t.reference,await a(t.floating),t.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function yj(t){return En(t).direction==="rtl"}const bj={convertOffsetParentRelativeRectToViewportRelativeRect:lj,getDocumentElement:Un,getClippingRect:pj,getOffsetParent:sw,getElementRects:vj,getClientRects:cj,getDimensions:hj,getScale:yo,isElement:Sn,isRTL:yj};function iw(t,a){return t.x===a.x&&t.y===a.y&&t.width===a.width&&t.height===a.height}function wj(t,a){let o=null,i;const l=Un(t);function u(){var m;clearTimeout(i),(m=o)==null||m.disconnect(),o=null}function f(m,g){m===void 0&&(m=!1),g===void 0&&(g=1),u();const p=t.getBoundingClientRect(),{left:y,top:v,width:k,height:S}=p;if(m||a(),!k||!S)return;const T=_l(v),w=_l(l.clientWidth-(y+k)),E=_l(l.clientHeight-(v+S)),C=_l(y),_={rootMargin:-T+"px "+-w+"px "+-E+"px "+-C+"px",threshold:Zt(0,$a(1,g))||1};let N=!0;function O(M){const L=M[0].intersectionRatio;if(L!==g){if(!N)return f();L?f(!1,L):i=setTimeout(()=>{f(!1,1e-7)},1e3)}L===1&&!iw(p,t.getBoundingClientRect())&&f(),N=!1}try{o=new IntersectionObserver(O,{..._,root:l.ownerDocument})}catch{o=new IntersectionObserver(O,_)}o.observe(t)}return f(!0),u}function xj(t,a,o,i){i===void 0&&(i={});const{ancestorScroll:l=!0,ancestorResize:u=!0,elementResize:f=typeof ResizeObserver=="function",layoutShift:m=typeof IntersectionObserver=="function",animationFrame:g=!1}=i,p=zm(t),y=l||u?[...p?Ys(p):[],...a?Ys(a):[]]:[];y.forEach(C=>{l&&C.addEventListener("scroll",o,{passive:!0}),u&&C.addEventListener("resize",o)});const v=p&&m?wj(p,o):null;let k=-1,S=null;f&&(S=new ResizeObserver(C=>{let[j]=C;j&&j.target===p&&S&&a&&(S.unobserve(a),cancelAnimationFrame(k),k=requestAnimationFrame(()=>{var _;(_=S)==null||_.observe(a)})),o()}),p&&!g&&S.observe(p),a&&S.observe(a));let T,w=g?Er(t):null;g&&E();function E(){const C=Er(t);w&&!iw(w,C)&&o(),w=C,T=requestAnimationFrame(E)}return o(),()=>{var C;y.forEach(j=>{l&&j.removeEventListener("scroll",o),u&&j.removeEventListener("resize",o)}),v?.(),(C=S)==null||C.disconnect(),S=null,g&&cancelAnimationFrame(T)}}const kj=QN,Sj=JN,Ej=GN,Cj=tj,Tj=XN,Dy=VN,Nj=ej,jj=(t,a,o)=>{const i=new Map,l={platform:bj,...o},u={...l.platform,_c:i};return $N(t,a,{...l,platform:u})};var Aj=typeof document<"u",_j=function(){},Bl=Aj?b.useLayoutEffect:_j;function Jl(t,a){if(t===a)return!0;if(typeof t!=typeof a)return!1;if(typeof t=="function"&&t.toString()===a.toString())return!0;let o,i,l;if(t&&a&&typeof t=="object"){if(Array.isArray(t)){if(o=t.length,o!==a.length)return!1;for(i=o;i--!==0;)if(!Jl(t[i],a[i]))return!1;return!0}if(l=Object.keys(t),o=l.length,o!==Object.keys(a).length)return!1;for(i=o;i--!==0;)if(!{}.hasOwnProperty.call(a,l[i]))return!1;for(i=o;i--!==0;){const u=l[i];if(!(u==="_owner"&&t.$$typeof)&&!Jl(t[u],a[u]))return!1}return!0}return t!==t&&a!==a}function lw(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function My(t,a){const o=lw(t);return Math.round(a*o)/o}function gf(t){const a=b.useRef(t);return Bl(()=>{a.current=t}),a}function Rj(t){t===void 0&&(t={});const{placement:a="bottom",strategy:o="absolute",middleware:i=[],platform:l,elements:{reference:u,floating:f}={},transform:m=!0,whileElementsMounted:g,open:p}=t,[y,v]=b.useState({x:0,y:0,strategy:o,placement:a,middlewareData:{},isPositioned:!1}),[k,S]=b.useState(i);Jl(k,i)||S(i);const[T,w]=b.useState(null),[E,C]=b.useState(null),j=b.useCallback(I=>{I!==M.current&&(M.current=I,w(I))},[]),_=b.useCallback(I=>{I!==L.current&&(L.current=I,C(I))},[]),N=u||T,O=f||E,M=b.useRef(null),L=b.useRef(null),U=b.useRef(y),q=g!=null,ae=gf(g),ee=gf(l),F=gf(p),J=b.useCallback(()=>{if(!M.current||!L.current)return;const I={placement:a,strategy:o,middleware:k};ee.current&&(I.platform=ee.current),jj(M.current,L.current,I).then(V=>{const Z={...V,isPositioned:F.current!==!1};X.current&&!Jl(U.current,Z)&&(U.current=Z,vc.flushSync(()=>{v(Z)}))})},[k,a,o,ee,F]);Bl(()=>{p===!1&&U.current.isPositioned&&(U.current.isPositioned=!1,v(I=>({...I,isPositioned:!1})))},[p]);const X=b.useRef(!1);Bl(()=>(X.current=!0,()=>{X.current=!1}),[]),Bl(()=>{if(N&&(M.current=N),O&&(L.current=O),N&&O){if(ae.current)return ae.current(N,O,J);J()}},[N,O,J,ae,q]);const $=b.useMemo(()=>({reference:M,floating:L,setReference:j,setFloating:_}),[j,_]),D=b.useMemo(()=>({reference:N,floating:O}),[N,O]),P=b.useMemo(()=>{const I={position:o,left:0,top:0};if(!D.floating)return I;const V=My(D.floating,y.x),Z=My(D.floating,y.y);return m?{...I,transform:"translate("+V+"px, "+Z+"px)",...lw(D.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:V,top:Z}},[o,m,D.floating,y.x,y.y]);return b.useMemo(()=>({...y,update:J,refs:$,elements:D,floatingStyles:P}),[y,J,$,D,P])}const Oj=t=>{function a(o){return{}.hasOwnProperty.call(o,"current")}return{name:"arrow",options:t,fn(o){const{element:i,padding:l}=typeof t=="function"?t(o):t;return i&&a(i)?i.current!=null?Dy({element:i.current,padding:l}).fn(o):{}:i?Dy({element:i,padding:l}).fn(o):{}}}},Dj=(t,a)=>{const o=kj(t);return{name:o.name,fn:o.fn,options:[t,a]}},Mj=(t,a)=>{const o=Sj(t);return{name:o.name,fn:o.fn,options:[t,a]}},Lj=(t,a)=>({fn:Nj(t).fn,options:[t,a]}),zj=(t,a)=>{const o=Ej(t);return{name:o.name,fn:o.fn,options:[t,a]}},Hj=(t,a)=>{const o=Cj(t);return{name:o.name,fn:o.fn,options:[t,a]}},Bj=(t,a)=>{const o=Tj(t);return{name:o.name,fn:o.fn,options:[t,a]}},Uj=(t,a)=>{const o=Oj(t);return{name:o.name,fn:o.fn,options:[t,a]}};var Wj="Arrow",cw=b.forwardRef((t,a)=>{const{children:o,width:i=10,height:l=5,...u}=t;return c.jsx(Ut.svg,{...u,ref:a,width:i,height:l,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?o:c.jsx("polygon",{points:"0,0 30,0 15,10"})})});cw.displayName=Wj;var Ij=cw;function qj(t){const[a,o]=b.useState(void 0);return Ya(()=>{if(t){o({width:t.offsetWidth,height:t.offsetHeight});const i=new ResizeObserver(l=>{if(!Array.isArray(l)||!l.length)return;const u=l[0];let f,m;if("borderBoxSize"in u){const g=u.borderBoxSize,p=Array.isArray(g)?g[0]:g;f=p.inlineSize,m=p.blockSize}else f=t.offsetWidth,m=t.offsetHeight;o({width:f,height:m})});return i.observe(t,{box:"border-box"}),()=>i.unobserve(t)}else o(void 0)},[t]),a}var Hm="Popper",[uw,dw]=Em(Hm),[Pj,fw]=uw(Hm),mw=t=>{const{__scopePopper:a,children:o}=t,[i,l]=b.useState(null);return c.jsx(Pj,{scope:a,anchor:i,onAnchorChange:l,children:o})};mw.displayName=Hm;var pw="PopperAnchor",hw=b.forwardRef((t,a)=>{const{__scopePopper:o,virtualRef:i,...l}=t,u=fw(pw,o),f=b.useRef(null),m=Cn(a,f),g=b.useRef(null);return b.useEffect(()=>{const p=g.current;g.current=i?.current||f.current,p!==g.current&&u.onAnchorChange(g.current)}),i?null:c.jsx(Ut.div,{...l,ref:m})});hw.displayName=pw;var Bm="PopperContent",[Fj,Kj]=uw(Bm),gw=b.forwardRef((t,a)=>{const{__scopePopper:o,side:i="bottom",sideOffset:l=0,align:u="center",alignOffset:f=0,arrowPadding:m=0,avoidCollisions:g=!0,collisionBoundary:p=[],collisionPadding:y=0,sticky:v="partial",hideWhenDetached:k=!1,updatePositionStrategy:S="optimized",onPlaced:T,...w}=t,E=fw(Bm,o),[C,j]=b.useState(null),_=Cn(a,ue=>j(ue)),[N,O]=b.useState(null),M=qj(N),L=M?.width??0,U=M?.height??0,q=i+(u!=="center"?"-"+u:""),ae=typeof y=="number"?y:{top:0,right:0,bottom:0,left:0,...y},ee=Array.isArray(p)?p:[p],F=ee.length>0,J={padding:ae,boundary:ee.filter($j),altBoundary:F},{refs:X,floatingStyles:$,placement:D,isPositioned:P,middlewareData:I}=Rj({strategy:"fixed",placement:q,whileElementsMounted:(...ue)=>xj(...ue,{animationFrame:S==="always"}),elements:{reference:E.anchor},middleware:[Dj({mainAxis:l+U,alignmentAxis:f}),g&&Mj({mainAxis:!0,crossAxis:!1,limiter:v==="partial"?Lj():void 0,...J}),g&&zj({...J}),Hj({...J,apply:({elements:ue,rects:ie,availableWidth:le,availableHeight:ce})=>{const{width:me,height:Te}=ie.reference,Ne=ue.floating.style;Ne.setProperty("--radix-popper-available-width",`${le}px`),Ne.setProperty("--radix-popper-available-height",`${ce}px`),Ne.setProperty("--radix-popper-anchor-width",`${me}px`),Ne.setProperty("--radix-popper-anchor-height",`${Te}px`)}}),N&&Uj({element:N,padding:m}),Vj({arrowWidth:L,arrowHeight:U}),k&&Bj({strategy:"referenceHidden",...J})]}),[V,Z]=bw(D),R=xo(T);Ya(()=>{P&&R?.()},[P,R]);const B=I.arrow?.x,re=I.arrow?.y,ne=I.arrow?.centerOffset!==0,[de,fe]=b.useState();return Ya(()=>{C&&fe(window.getComputedStyle(C).zIndex)},[C]),c.jsx("div",{ref:X.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:P?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:de,"--radix-popper-transform-origin":[I.transformOrigin?.x,I.transformOrigin?.y].join(" "),...I.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:c.jsx(Fj,{scope:o,placedSide:V,onArrowChange:O,arrowX:B,arrowY:re,shouldHideArrow:ne,children:c.jsx(Ut.div,{"data-side":V,"data-align":Z,...w,ref:_,style:{...w.style,animation:P?void 0:"none"}})})})});gw.displayName=Bm;var vw="PopperArrow",Yj={top:"bottom",right:"left",bottom:"top",left:"right"},yw=b.forwardRef(function(a,o){const{__scopePopper:i,...l}=a,u=Kj(vw,i),f=Yj[u.placedSide];return c.jsx("span",{ref:u.onArrowChange,style:{position:"absolute",left:u.arrowX,top:u.arrowY,[f]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[u.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[u.placedSide],visibility:u.shouldHideArrow?"hidden":void 0},children:c.jsx(Ij,{...l,ref:o,style:{...l.style,display:"block"}})})});yw.displayName=vw;function $j(t){return t!==null}var Vj=t=>({name:"transformOrigin",options:t,fn(a){const{placement:o,rects:i,middlewareData:l}=a,f=l.arrow?.centerOffset!==0,m=f?0:t.arrowWidth,g=f?0:t.arrowHeight,[p,y]=bw(o),v={start:"0%",center:"50%",end:"100%"}[y],k=(l.arrow?.x??0)+m/2,S=(l.arrow?.y??0)+g/2;let T="",w="";return p==="bottom"?(T=f?v:`${k}px`,w=`${-g}px`):p==="top"?(T=f?v:`${k}px`,w=`${i.floating.height+g}px`):p==="right"?(T=`${-g}px`,w=f?v:`${S}px`):p==="left"&&(T=`${i.floating.width+g}px`,w=f?v:`${S}px`),{data:{x:T,y:w}}}});function bw(t){const[a,o="center"]=t.split("-");return[a,o]}var Gj=mw,Xj=hw,Zj=gw,Qj=yw,Jj=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),eA="VisuallyHidden",ww=b.forwardRef((t,a)=>c.jsx(Ut.span,{...t,ref:a,style:{...Jj,...t.style}}));ww.displayName=eA;var tA=ww,[Tc]=Em("Tooltip",[dw]),Nc=dw(),xw="TooltipProvider",nA=700,$f="tooltip.open",[aA,Um]=Tc(xw),kw=t=>{const{__scopeTooltip:a,delayDuration:o=nA,skipDelayDuration:i=300,disableHoverableContent:l=!1,children:u}=t,f=b.useRef(!0),m=b.useRef(!1),g=b.useRef(0);return b.useEffect(()=>{const p=g.current;return()=>window.clearTimeout(p)},[]),c.jsx(aA,{scope:a,isOpenDelayedRef:f,delayDuration:o,onOpen:b.useCallback(()=>{window.clearTimeout(g.current),f.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>f.current=!0,i)},[i]),isPointerInTransitRef:m,onPointerInTransitChange:b.useCallback(p=>{m.current=p},[]),disableHoverableContent:l,children:u})};kw.displayName=xw;var $s="Tooltip",[rA,ai]=Tc($s),Sw=t=>{const{__scopeTooltip:a,children:o,open:i,defaultOpen:l,onOpenChange:u,disableHoverableContent:f,delayDuration:m}=t,g=Um($s,t.__scopeTooltip),p=Nc(a),[y,v]=b.useState(null),k=Ll(),S=b.useRef(0),T=f??g.disableHoverableContent,w=m??g.delayDuration,E=b.useRef(!1),[C,j]=o0({prop:i,defaultProp:l??!1,onChange:L=>{L?(g.onOpen(),document.dispatchEvent(new CustomEvent($f))):g.onClose(),u?.(L)},caller:$s}),_=b.useMemo(()=>C?E.current?"delayed-open":"instant-open":"closed",[C]),N=b.useCallback(()=>{window.clearTimeout(S.current),S.current=0,E.current=!1,j(!0)},[j]),O=b.useCallback(()=>{window.clearTimeout(S.current),S.current=0,j(!1)},[j]),M=b.useCallback(()=>{window.clearTimeout(S.current),S.current=window.setTimeout(()=>{E.current=!0,j(!0),S.current=0},w)},[w,j]);return b.useEffect(()=>()=>{S.current&&(window.clearTimeout(S.current),S.current=0)},[]),c.jsx(Gj,{...p,children:c.jsx(rA,{scope:a,contentId:k,open:C,stateAttribute:_,trigger:y,onTriggerChange:v,onTriggerEnter:b.useCallback(()=>{g.isOpenDelayedRef.current?M():N()},[g.isOpenDelayedRef,M,N]),onTriggerLeave:b.useCallback(()=>{T?O():(window.clearTimeout(S.current),S.current=0)},[O,T]),onOpen:N,onClose:O,disableHoverableContent:T,children:o})})};Sw.displayName=$s;var Vf="TooltipTrigger",Ew=b.forwardRef((t,a)=>{const{__scopeTooltip:o,...i}=t,l=ai(Vf,o),u=Um(Vf,o),f=Nc(o),m=b.useRef(null),g=Cn(a,m,l.onTriggerChange),p=b.useRef(!1),y=b.useRef(!1),v=b.useCallback(()=>p.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",v),[v]),c.jsx(Xj,{asChild:!0,...f,children:c.jsx(Ut.button,{"aria-describedby":l.open?l.contentId:void 0,"data-state":l.stateAttribute,...i,ref:g,onPointerMove:zt(t.onPointerMove,k=>{k.pointerType!=="touch"&&!y.current&&!u.isPointerInTransitRef.current&&(l.onTriggerEnter(),y.current=!0)}),onPointerLeave:zt(t.onPointerLeave,()=>{l.onTriggerLeave(),y.current=!1}),onPointerDown:zt(t.onPointerDown,()=>{l.open&&l.onClose(),p.current=!0,document.addEventListener("pointerup",v,{once:!0})}),onFocus:zt(t.onFocus,()=>{p.current||l.onOpen()}),onBlur:zt(t.onBlur,l.onClose),onClick:zt(t.onClick,l.onClose)})})});Ew.displayName=Vf;var Wm="TooltipPortal",[oA,sA]=Tc(Wm,{forceMount:void 0}),Cw=t=>{const{__scopeTooltip:a,forceMount:o,children:i,container:l}=t,u=ai(Wm,a);return c.jsx(oA,{scope:a,forceMount:o,children:c.jsx(Ao,{present:o||u.open,children:c.jsx(Tm,{asChild:!0,container:l,children:i})})})};Cw.displayName=Wm;var Eo="TooltipContent",Tw=b.forwardRef((t,a)=>{const o=sA(Eo,t.__scopeTooltip),{forceMount:i=o.forceMount,side:l="top",...u}=t,f=ai(Eo,t.__scopeTooltip);return c.jsx(Ao,{present:i||f.open,children:f.disableHoverableContent?c.jsx(Nw,{side:l,...u,ref:a}):c.jsx(iA,{side:l,...u,ref:a})})}),iA=b.forwardRef((t,a)=>{const o=ai(Eo,t.__scopeTooltip),i=Um(Eo,t.__scopeTooltip),l=b.useRef(null),u=Cn(a,l),[f,m]=b.useState(null),{trigger:g,onClose:p}=o,y=l.current,{onPointerInTransitChange:v}=i,k=b.useCallback(()=>{m(null),v(!1)},[v]),S=b.useCallback((T,w)=>{const E=T.currentTarget,C={x:T.clientX,y:T.clientY},j=fA(C,E.getBoundingClientRect()),_=mA(C,j),N=pA(w.getBoundingClientRect()),O=gA([..._,...N]);m(O),v(!0)},[v]);return b.useEffect(()=>()=>k(),[k]),b.useEffect(()=>{if(g&&y){const T=E=>S(E,y),w=E=>S(E,g);return g.addEventListener("pointerleave",T),y.addEventListener("pointerleave",w),()=>{g.removeEventListener("pointerleave",T),y.removeEventListener("pointerleave",w)}}},[g,y,S,k]),b.useEffect(()=>{if(f){const T=w=>{const E=w.target,C={x:w.clientX,y:w.clientY},j=g?.contains(E)||y?.contains(E),_=!hA(C,f);j?k():_&&(k(),p())};return document.addEventListener("pointermove",T),()=>document.removeEventListener("pointermove",T)}},[g,y,f,p,k]),c.jsx(Nw,{...t,ref:u})}),[lA,cA]=Tc($s,{isInside:!1}),uA=cC("TooltipContent"),Nw=b.forwardRef((t,a)=>{const{__scopeTooltip:o,children:i,"aria-label":l,onEscapeKeyDown:u,onPointerDownOutside:f,...m}=t,g=ai(Eo,o),p=Nc(o),{onClose:y}=g;return b.useEffect(()=>(document.addEventListener($f,y),()=>document.removeEventListener($f,y)),[y]),b.useEffect(()=>{if(g.trigger){const v=k=>{k.target?.contains(g.trigger)&&y()};return window.addEventListener("scroll",v,{capture:!0}),()=>window.removeEventListener("scroll",v,{capture:!0})}},[g.trigger,y]),c.jsx(Cm,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:v=>v.preventDefault(),onDismiss:y,children:c.jsxs(Zj,{"data-state":g.stateAttribute,...p,...m,ref:a,style:{...m.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[c.jsx(uA,{children:i}),c.jsx(lA,{scope:o,isInside:!0,children:c.jsx(tA,{id:g.contentId,role:"tooltip",children:l||i})})]})})});Tw.displayName=Eo;var jw="TooltipArrow",dA=b.forwardRef((t,a)=>{const{__scopeTooltip:o,...i}=t,l=Nc(o);return cA(jw,o).isInside?null:c.jsx(Qj,{...l,...i,ref:a})});dA.displayName=jw;function fA(t,a){const o=Math.abs(a.top-t.y),i=Math.abs(a.bottom-t.y),l=Math.abs(a.right-t.x),u=Math.abs(a.left-t.x);switch(Math.min(o,i,l,u)){case u:return"left";case l:return"right";case o:return"top";case i:return"bottom";default:throw new Error("unreachable")}}function mA(t,a,o=5){const i=[];switch(a){case"top":i.push({x:t.x-o,y:t.y+o},{x:t.x+o,y:t.y+o});break;case"bottom":i.push({x:t.x-o,y:t.y-o},{x:t.x+o,y:t.y-o});break;case"left":i.push({x:t.x+o,y:t.y-o},{x:t.x+o,y:t.y+o});break;case"right":i.push({x:t.x-o,y:t.y-o},{x:t.x-o,y:t.y+o});break}return i}function pA(t){const{top:a,right:o,bottom:i,left:l}=t;return[{x:l,y:a},{x:o,y:a},{x:o,y:i},{x:l,y:i}]}function hA(t,a){const{x:o,y:i}=t;let l=!1;for(let u=0,f=a.length-1;u<a.length;f=u++){const m=a[u],g=a[f],p=m.x,y=m.y,v=g.x,k=g.y;y>i!=k>i&&o<(v-p)*(i-y)/(k-y)+p&&(l=!l)}return l}function gA(t){const a=t.slice();return a.sort((o,i)=>o.x<i.x?-1:o.x>i.x?1:o.y<i.y?-1:o.y>i.y?1:0),vA(a)}function vA(t){if(t.length<=1)return t.slice();const a=[];for(let i=0;i<t.length;i++){const l=t[i];for(;a.length>=2;){const u=a[a.length-1],f=a[a.length-2];if((u.x-f.x)*(l.y-f.y)>=(u.y-f.y)*(l.x-f.x))a.pop();else break}a.push(l)}a.pop();const o=[];for(let i=t.length-1;i>=0;i--){const l=t[i];for(;o.length>=2;){const u=o[o.length-1],f=o[o.length-2];if((u.x-f.x)*(l.y-f.y)>=(u.y-f.y)*(l.x-f.x))o.pop();else break}o.push(l)}return o.pop(),a.length===1&&o.length===1&&a[0].x===o[0].x&&a[0].y===o[0].y?a:a.concat(o)}var Aw=kw,yA=Sw,bA=Ew,wA=Cw,xA=Tw;const Qe=({children:t,label:a,side:o="top",align:i="center"})=>a?c.jsx(Aw,{delayDuration:250,skipDelayDuration:150,children:c.jsxs(yA,{children:[c.jsx(bA,{asChild:!0,children:t}),c.jsx(wA,{children:c.jsx(xA,{className:"tooltip",side:o,align:i,sideOffset:6,children:a})})]})}):c.jsx(c.Fragment,{children:t}),_w=b.createContext(null),Rw=b.createContext([]),vf=3,kA=t=>t==="success"?3e3:t==="warning"?5e3:0;let Ly=0;const SA=()=>(Ly+=1,`t-${Ly.toString(36)}-${Date.now().toString(36)}`),EA=({children:t})=>{const[a,o]=b.useState([]),i=b.useRef(new Map),l=b.useCallback(v=>{const k=i.current.get(v);k?.timer&&clearTimeout(k.timer),i.current.delete(v)},[]),u=b.useCallback(v=>{o(k=>k.filter(S=>S.id!==v)),l(v)},[l]),f=b.useCallback(({kind:v,message:k,durationMs:S})=>{const T=SA();o(E=>{const C=[...E,{id:T,kind:v,message:k}];if(C.length<=vf)return C;const j=C.slice(0,C.length-vf);for(const _ of j)l(_.id);return C.slice(C.length-vf)});const w=S??kA(v);if(w>0){const E=setTimeout(()=>u(T),w);i.current.set(T,{timer:E,dueAt:Date.now()+w,durationMs:w,remainingMs:w})}return T},[u,l]),m=b.useCallback(v=>{const k=i.current.get(v);k?.timer&&(clearTimeout(k.timer),i.current.set(v,{...k,timer:null,remainingMs:Math.max(0,k.dueAt-Date.now())}))},[]),g=b.useCallback(v=>{const k=i.current.get(v);if(!k||k.timer||k.remainingMs<=0)return;const S=setTimeout(()=>u(v),k.remainingMs);i.current.set(v,{...k,timer:S,dueAt:Date.now()+k.remainingMs})},[u]),p=b.useCallback(v=>i.current.get(v)?.durationMs??0,[]);b.useEffect(()=>{const v=i.current;return()=>{for(const k of v.values())k.timer&&clearTimeout(k.timer);v.clear()}},[]);const y=b.useMemo(()=>({show:f,dismiss:u,pauseDismiss:m,resumeDismiss:g,getDuration:p}),[f,u,m,g,p]);return c.jsx(_w.Provider,{value:y,children:c.jsx(Rw.Provider,{value:a,children:t})})},en=()=>{const t=b.useContext(_w);if(!t)throw new Error("useToast must be used within ToastProvider");return t},CA=()=>b.useContext(Rw),TA=2e3,yf=()=>document.visibilityState==="hidden",Ow=(t,a)=>{const o=Math.max(0,Math.floor((Date.now()-t)/1e3));return o<60?a("common.time.sAgo",{count:o}):o<3600?a("common.time.mAgo",{count:Math.floor(o/60)}):o<86400?a("common.time.hAgo",{count:Math.floor(o/3600)}):a("common.time.dAgo",{count:Math.floor(o/86400)})},NA={cancelled:"actionCenter.activity.cancelled",queued:"actionCenter.activity.queued",reported:"actionCenter.activity.reported",submitted:"actionCenter.activity.submitted"},ec=(t,a)=>{const o=t.toWorkerName??a("actionCenter.unknownWorker");return a(NA[t.kind],{ago:Ow(t.timestamp,a),worker:o})},Im=t=>t.reportPreview??t.taskPreview??t.label??t.phase,Dw=t=>t.currentDispatch?.taskPreview??t.latestReport?.reportPreview??t.terminalHint??null,Mw=(t,a)=>t.currentDispatch?a("actionCenter.currentDispatch"):t.latestReport?a("actionCenter.latestReport"):t.terminalHint?a("actionCenter.terminalHint"):a("actionCenter.workerStatus"),Gf=(t,a)=>t.kind==="no_workers"?a("actionCenter.attention.noWorkers"):t.kind==="stopped_with_queue"?a("actionCenter.attention.stoppedWithQueue",{worker:t.workerName}):t.kind==="dispatch_waiting_report"?a("actionCenter.attention.waitingReport",{minutes:t.minutesAgo,worker:t.workerName??a("actionCenter.unknownWorker")}):a(t.kind==="remote_error"?"actionCenter.attention.remoteError":"actionCenter.attention.remoteRejected",{endpoint:t.endpoint??t.action,reason:t.reason??"unknown"}),tc=t=>t.kind==="stopped_with_queue"?`${t.kind}-${t.workerId}`:t.kind==="dispatch_waiting_report"?`${t.kind}-${t.dispatchId}`:t.kind==="remote_error"||t.kind==="remote_rejected"?`${t.kind}-${t.ts}-${t.action}-${t.endpoint??""}-${t.reason??""}`:t.kind,Lw=t=>{const[a,o]=b.useState(null),[i,l]=b.useState(!1),u=b.useCallback(async f=>AN(t,f?{signal:f}:void 0),[t]);return b.useEffect(()=>{let f=!1,m=!1,g=null,p=null;const y=async()=>{if(!(f||m||yf())){m=!0,p=new AbortController;try{const k=await u(p.signal);if(f)return;o(k),l(!1)}catch{f||l(!0)}finally{p=null,m=!1}!f&&!yf()&&(g=setTimeout(y,TA))}},v=()=>{f||yf()||(g&&(clearTimeout(g),g=null),y())};return document.addEventListener("visibilitychange",v),y(),()=>{f=!0,p?.abort(),g&&clearTimeout(g),document.removeEventListener("visibilitychange",v)}},[u]),{error:i,summary:a}},zw=t=>{const{t:a}=we(),o=en(),[i,l]=b.useState(!1);return{copyingRecap:i,handleCopyRecap:()=>{if(i)return;l(!0);const f=_N(t).then(m=>m.markdown);G0(f).then(()=>o.show({kind:"success",message:a("actionCenter.recapCopied")})).catch(()=>o.show({kind:"error",message:a("actionCenter.recapCopyFailed")})).finally(()=>l(!1))}}},qm=t=>{const a=t?.recentActivity[0]??null,o=a?Im(a):null,i=t?.attention.slice(0,5)??[],l=t?.workers.filter(f=>f.currentDispatch||f.latestReport||f.terminalHint||f.status==="working").slice(0,6)??[],u=t?.recentActivity.slice(0,6)??[];return{attention:i,evidenceWorkers:l,latest:a,latestDetail:o,recentActivity:u}},jA=t=>t==="reported"?"green":t==="cancelled"?"red":t==="queued"?"orange":"accent",AA=({copyingRecap:t,onCopyRecap:a,onOpenWorker:o,summary:i})=>{const{t:l}=we(),{attention:u,evidenceWorkers:f,recentActivity:m}=qm(i);return c.jsxs("div",{className:"mt-2 grid gap-2 md:grid-cols-2","data-testid":"action-center-evidence",children:[c.jsx("div",{className:"flex min-w-0 justify-end md:col-span-2",children:c.jsxs("button",{type:"button",onClick:a,disabled:t,className:"inline-flex items-center gap-1.5 rounded border border-bright/40 px-2 py-1 text-xs text-sec hover:bg-2 hover:text-pri disabled:cursor-default disabled:opacity-60","data-testid":"action-center-copy-recap",children:[c.jsx(Cr,{size:12,"aria-hidden":!0}),l("actionCenter.copyRecap")]})}),u.length>0?c.jsxs("div",{className:"min-w-0 md:col-span-2",children:[c.jsx("div",{className:"mb-1 text-[11px] font-semibold uppercase tracking-wide text-ter",children:l("actionCenter.attention")}),c.jsx("ul",{className:"flex flex-col gap-px rounded border border-bright/40 bg-0",children:u.map(g=>c.jsx("li",{children:c.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-2 py-1.5 text-xs","data-testid":`action-center-attention-${tc(g)}`,children:[c.jsx("span",{className:"inline-block h-1.5 w-1.5 shrink-0 rounded-full",style:{background:g.severity==="error"?"var(--status-red)":g.severity==="warning"?"var(--status-orange)":"var(--text-tertiary)"},"aria-hidden":!0}),c.jsx("span",{className:"min-w-0 truncate text-sec",title:Gf(g,l),children:Gf(g,l)})]})},tc(g)))})]}):null,c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"mb-1 text-[11px] font-semibold uppercase tracking-wide text-ter",children:l("actionCenter.recent")}),m.length>0?c.jsx("ul",{className:"flex max-h-36 flex-col gap-px overflow-auto rounded border border-bright/40 bg-0",children:m.map(g=>{const p=Im(g);return c.jsx("li",{children:c.jsxs("button",{type:"button",onClick:()=>o?.(g.toAgentId),className:"flex w-full min-w-0 items-center gap-2 px-2 py-1.5 text-left text-xs hover:bg-2 disabled:cursor-default disabled:hover:bg-transparent",disabled:!o,"data-testid":`action-center-activity-${g.id}`,children:[c.jsx("span",{className:"shrink-0 text-sec",children:ec(g,l)}),p?c.jsx("span",{className:"min-w-0 truncate text-ter",title:p,children:p}):null]})},g.id)})}):c.jsx("div",{className:"rounded border border-dashed border-bright/40 px-2 py-2 text-xs text-ter",children:l("actionCenter.noActivity")})]}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"mb-1 text-[11px] font-semibold uppercase tracking-wide text-ter",children:l("actionCenter.workers")}),f.length>0?c.jsx("ul",{className:"flex max-h-36 flex-col gap-px overflow-auto rounded border border-bright/40 bg-0",children:f.map(g=>{const p=Dw(g);return c.jsx("li",{children:c.jsxs("button",{type:"button",onClick:()=>o?.(g.id),className:"flex w-full min-w-0 items-center gap-2 px-2 py-1.5 text-left text-xs hover:bg-2 disabled:cursor-default disabled:hover:bg-transparent",disabled:!o,"data-testid":`action-center-worker-${g.id}`,children:[c.jsx("span",{className:"min-w-0 flex-1 truncate text-sec",children:g.name}),c.jsx("span",{className:"shrink-0 text-ter",children:Mw(g,l)}),p?c.jsx("span",{className:"min-w-0 flex-[1.4] truncate text-ter",title:p,children:p}):null]})},g.id)})}):c.jsx("div",{className:"rounded border border-dashed border-bright/40 px-2 py-2 text-xs text-ter",children:l("actionCenter.noWorkerEvidence")})]})]})},Rl=({icon:t,label:a,tone:o="neutral",value:i})=>c.jsxs("div",{className:"action-center-metric","data-tone":o,children:[c.jsx("div",{className:"action-center-metric__icon","aria-hidden":!0,children:t}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"mono text-lg font-semibold leading-none text-pri",children:i}),c.jsx("div",{className:"mt-1 truncate text-[11px] font-medium text-ter",children:a})]})]}),_A=({copyingRecap:t,error:a,onClose:o,onCopyRecap:i,onOpenWorker:l,open:u,summary:f})=>{const{t:m}=we(),g=wt(),{attention:p,evidenceWorkers:y,latest:v,latestDetail:k,recentActivity:S}=qm(f),T=w=>{l?.(w),o()};return c.jsx(_o,{open:u,onOpenChange:w=>!w&&o(),children:c.jsxs(Ro,{children:[c.jsx(Oo,{"data-testid":"action-center-overlay",className:"app-overlay fixed inset-0 z-40"}),c.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 grid place-items-center p-4",children:c.jsxs(Do,{"data-testid":"action-center-drawer","aria-label":m("actionCenter.title"),"data-mobile":g||void 0,className:"dialog-scale-pop elev-2 pointer-events-auto flex flex-col rounded-lg border",style:g?{background:"var(--bg-1)",borderColor:"var(--border-bright)"}:{background:"var(--bg-1)",borderColor:"var(--border-bright)",height:"min(720px, calc(100vh - 48px))",width:"min(820px, calc(100vw - 48px))"},children:[c.jsxs("header",{className:"flex items-center justify-between gap-3 border-b px-4 py-2",style:{borderColor:"var(--border)"},children:[c.jsxs("div",{className:"min-w-0",children:[c.jsxs(Mo,{className:"flex items-center gap-2 text-base font-semibold text-pri",children:[c.jsx(fc,{size:17,className:"text-accent","aria-hidden":!0}),m("actionCenter.title")]}),c.jsx(ti,{className:"text-xs text-ter",children:m("actionCenter.subtitle")})]}),c.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[c.jsx(Qe,{label:m("actionCenter.copyRecap"),children:c.jsxs("button",{type:"button",onClick:i,disabled:t||!f,className:"drawer-action-btn pointer-coarse:min-h-10","data-testid":"action-center-copy-recap",children:[t?c.jsx(Fa,{size:14,className:"animate-spin"}):c.jsx(Cr,{size:14}),c.jsx("span",{className:"hidden sm:inline",children:m("actionCenter.copyRecap")})]})}),c.jsx(Qe,{label:m("common.close"),children:c.jsx("button",{type:"button",onClick:o,"aria-label":m("common.close"),className:"icon-btn pointer-coarse:min-h-11 pointer-coarse:min-w-11",children:c.jsx(Ka,{size:14})})})]})]}),c.jsxs("div",{className:"scroll-y min-h-0 flex-1 px-4 py-4",children:[a?c.jsxs("div",{className:"action-center-alert action-center-alert--error",children:[c.jsx(Ks,{size:15,"aria-hidden":!0}),c.jsx("span",{children:m("actionCenter.loadFailed")})]}):null,f?c.jsxs("div",{className:"space-y-4",children:[c.jsxs("section",{className:"action-center-hero","data-state":p.length>0?"attention":"calm",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsxs("span",{className:"action-center-kicker",children:[c.jsx(ly,{size:13,"aria-hidden":!0}),m("actionCenter.liveSnapshot")]}),c.jsx("span",{className:"text-[11px] text-ter",children:m("actionCenter.updated",{ago:Ow(f.generatedAt,m)})})]}),c.jsx("p",{className:"mt-2 text-sm font-medium text-pri",children:v?ec(v,m):m("actionCenter.noActivity")}),k?c.jsx("p",{className:"mt-1 line-clamp-2 text-xs text-sec",title:k,children:k}):null]}),c.jsx("div",{className:"action-center-hero__status",children:p.length>0?m("actionCenter.needsAttention",{count:p.length}):m("actionCenter.allClear")})]}),c.jsxs("section",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-4","aria-label":m("actionCenter.metrics"),children:[c.jsx(Rl,{icon:c.jsx(gc,{size:15}),label:m("actionCenter.totalWorkers"),value:f.summary.totalWorkers}),c.jsx(Rl,{icon:c.jsx(ly,{size:15}),label:m("actionCenter.workingWorkers"),tone:"green",value:f.summary.workingWorkers}),c.jsx(Rl,{icon:c.jsx(LS,{size:15}),label:m("actionCenter.openDispatches"),tone:f.summary.openDispatches>0?"orange":"neutral",value:f.summary.openDispatches}),c.jsx(Rl,{icon:c.jsx(Fb,{size:15}),label:m("actionCenter.recentReports"),tone:"accent",value:f.summary.recentReports})]}),c.jsxs("section",{className:"grid gap-3 lg:grid-cols-[1fr_1fr]",children:[c.jsxs("div",{className:"action-center-panel lg:col-span-2",children:[c.jsx("div",{className:"action-center-panel__header",children:c.jsxs("div",{children:[c.jsx("h3",{children:m("actionCenter.attention")}),c.jsx("p",{children:m("actionCenter.attentionSubtitle")})]})}),p.length>0?c.jsx("ul",{className:"space-y-2",children:p.map(w=>c.jsx("li",{children:c.jsxs("div",{className:"action-center-attention-row","data-severity":w.severity,"data-testid":`action-center-attention-${tc(w)}`,children:[c.jsx(Ks,{size:14,"aria-hidden":!0}),c.jsx("span",{className:"min-w-0 flex-1 truncate",children:Gf(w,m)})]})},tc(w)))}):c.jsx("div",{className:"action-center-empty",children:m("actionCenter.noAttention")})]}),c.jsxs("div",{className:"action-center-panel",children:[c.jsx("div",{className:"action-center-panel__header",children:c.jsxs("div",{children:[c.jsx("h3",{children:m("actionCenter.recent")}),c.jsx("p",{children:m("actionCenter.recentSubtitle")})]})}),S.length>0?c.jsx("ul",{className:"space-y-1.5",children:S.map(w=>{const E=Im(w);return c.jsx("li",{children:c.jsxs("button",{type:"button",onClick:()=>T(w.toAgentId),className:"action-center-list-row","data-tone":jA(w.kind),disabled:!l,"data-testid":`action-center-activity-${w.id}`,children:[c.jsx("span",{className:"action-center-row-dot","aria-hidden":!0}),c.jsxs("span",{className:"min-w-0 flex-1",children:[c.jsx("span",{className:"block truncate text-xs font-medium text-pri",children:ec(w,m)}),E?c.jsx("span",{className:"block truncate text-[11px] text-ter",children:E}):null]})]})},w.id)})}):c.jsx("div",{className:"action-center-empty",children:m("actionCenter.noActivity")})]}),c.jsxs("div",{className:"action-center-panel",children:[c.jsx("div",{className:"action-center-panel__header",children:c.jsxs("div",{children:[c.jsx("h3",{children:m("actionCenter.workers")}),c.jsx("p",{children:m("actionCenter.workersSubtitle")})]})}),y.length>0?c.jsx("ul",{className:"space-y-1.5",children:y.map(w=>{const E=Dw(w);return c.jsx("li",{children:c.jsxs("button",{type:"button",onClick:()=>T(w.id),className:"action-center-list-row","data-tone":w.status==="working"?"green":"neutral",disabled:!l,"data-testid":`action-center-worker-${w.id}`,children:[c.jsx("span",{className:"action-center-worker-avatar","aria-hidden":!0,children:c.jsx(LE,{size:13})}),c.jsxs("span",{className:"min-w-0 flex-1",children:[c.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[c.jsx("span",{className:"truncate text-xs font-medium text-pri",children:w.name}),c.jsx("span",{className:"shrink-0 text-[11px] text-ter",children:Mw(w,m)})]}),E?c.jsx("span",{className:"block truncate text-[11px] text-ter",children:E}):null]})]})},w.id)})}):c.jsx("div",{className:"action-center-empty",children:m("actionCenter.noWorkerEvidence")})]})]})]}):c.jsxs("div",{className:"flex h-[320px] items-center justify-center text-ter",children:[c.jsx(Fa,{size:18,className:"animate-spin"}),c.jsx("span",{className:"ml-2 text-sm",children:m("actionCenter.loading")})]})]})]})})]})})},RA=({onOpenWorker:t,workspaceId:a})=>{const{t:o}=we(),{error:i,summary:l}=Lw(a),{copyingRecap:u,handleCopyRecap:f}=zw(a),[m,g]=b.useState(!1);return c.jsxs(c.Fragment,{children:[c.jsx(Qe,{label:o(m?"actionCenter.collapse":"actionCenter.expand"),children:c.jsxs("button",{type:"button",onClick:()=>g(p=>!p),"aria-expanded":m,"aria-haspopup":"dialog","aria-label":o(m?"actionCenter.collapse":"actionCenter.expand"),"data-testid":"topbar-action-center",className:"flex h-7 cursor-pointer items-center gap-1 rounded border px-2 text-xs font-medium text-ter transition-colors hover:bg-3 hover:text-pri focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)]",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:[c.jsx(fc,{size:13,"aria-hidden":!0}),c.jsx("span",{children:o("actionCenter.title")}),l&&l.summary.workingWorkers>0?c.jsx("span",{className:"mono rounded bg-3 px-1 text-[11px] text-accent",children:l.summary.workingWorkers}):null]})}),c.jsx(_A,{copyingRecap:u,error:i,onClose:()=>g(!1),onCopyRecap:f,onOpenWorker:t,open:m,summary:l})]})},OA=({onOpenWorker:t,workspaceId:a})=>{const{t:o}=we(),{error:i,summary:l}=Lw(a),{copyingRecap:u,handleCopyRecap:f}=zw(a),[m,g]=b.useState(!1),{latest:p,latestDetail:y}=qm(l);return c.jsxs("section",{className:"shrink-0 border-b px-4 py-2","data-testid":"action-center-strip",style:{background:"var(--bg-1)",borderColor:"var(--border)"},children:[c.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[c.jsxs("button",{type:"button",onClick:()=>g(v=>!v),"aria-expanded":m,"aria-label":o(m?"actionCenter.collapse":"actionCenter.expand"),className:"inline-flex items-center gap-1.5 rounded px-1 py-0.5 text-xs font-semibold uppercase tracking-wide text-ter hover:bg-3 hover:text-pri",children:[m?c.jsx(No,{size:13,"aria-hidden":!0}):c.jsx(mc,{size:13,"aria-hidden":!0}),c.jsx(fc,{size:13,"aria-hidden":!0}),o("actionCenter.title")]}),c.jsx("span",{className:"pill pill--green",children:o("actionCenter.runningCount",{count:l?.summary.workingWorkers??0})}),c.jsx("span",{className:"pill pill--ghost",children:o("actionCenter.reportCount",{count:l?.summary.recentReports??0})})]}),c.jsx("div",{className:"mt-1 flex min-w-0 items-center gap-1.5 text-xs text-sec",children:i?c.jsx("span",{style:{color:"var(--text-error)"},children:o("actionCenter.loadFailed")}):p?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"shrink-0 text-ter",children:ec(p,o)}),y?c.jsxs("span",{className:"min-w-0 truncate text-ter",title:y,children:["· ",y]}):null]}):c.jsx("span",{className:"text-ter",children:o(l?"actionCenter.noActivity":"actionCenter.loading")})}),m&&l?c.jsx(AA,{copyingRecap:u,onCopyRecap:f,onOpenWorker:t,summary:l}):null]})};let nc=!1;const Xf=new Set,DA=()=>nc,Hw=t=>{if(nc!==t){nc=t;for(const a of Xf)a()}},MA=()=>{Hw(!nc)},LA=t=>(Xf.add(t),()=>Xf.delete(t)),Bw=()=>b.useSyncExternalStore(LA,DA,()=>!1),Uw="hive.notification.settings",po={desktop:!1,detail:"brief",sound:"soft"},zA={beacon:"/sounds/hive-beacon.ogg",cascade:"/sounds/hive-cascade.ogg",chime:"/sounds/hive-chime.ogg",ping:"/sounds/hive-ping.ogg",resolve:"/sounds/hive-resolve.ogg",soft:"/sounds/hive-soft.ogg"},HA=t=>t==="off"||t==="ping"||t==="chime"||t==="soft"||t==="cascade"||t==="beacon"||t==="resolve",BA=()=>{if(typeof window>"u")return po;try{const t=window.localStorage.getItem(Uw);if(!t)return po;const a=JSON.parse(t);return{desktop:typeof a.desktop=="boolean"?a.desktop:po.desktop,detail:a.detail==="detailed"?"detailed":po.detail,sound:HA(a.sound)?a.sound:po.sound}}catch{return po}},UA=t=>{try{window.localStorage.setItem(Uw,JSON.stringify(t))}catch{}},zy=t=>{if(!(t==="off"||typeof window>"u"))try{const a=new window.Audio(zA[t]);a.preload="auto",a.volume=.72,a.play()?.catch(()=>{})}catch{}},Ww=b.createContext(null),WA=({children:t})=>{const a=en(),{t:o}=we(),[i,l]=b.useState(()=>BA());b.useEffect(()=>{UA(i)},[i]);const u=b.useCallback(y=>{l(v=>({...v,...y}))},[]),f=b.useCallback(async()=>{if(typeof window>"u"||!("Notification"in window))return u({desktop:!1}),a.show({kind:"warning",message:o("notifications.toast.unsupported")}),!1;if(window.Notification.permission==="granted")return u({desktop:!0}),!0;if(window.Notification.permission==="denied")return u({desktop:!1}),a.show({kind:"warning",message:o("notifications.toast.blocked")}),!1;const v=await window.Notification.requestPermission()==="granted";return u({desktop:v}),v||a.show({kind:"warning",message:o("notifications.toast.declined")}),v},[o,a,u]),m=b.useCallback(({brief:y,detail:v,kind:k,title:S})=>{const T=i.detail==="detailed"&&v?v:y;if(a.show({kind:k,message:T}),zy(i.sound),i.desktop&&typeof window<"u"&&"Notification"in window&&window.Notification.permission==="granted")try{new window.Notification(S,{body:T})}catch{}},[i,a]),g=b.useCallback(y=>{zy(y)},[]),p=b.useMemo(()=>({notify:m,previewSound:g,requestDesktopNotifications:f,settings:i,updateSettings:u}),[m,g,f,i,u]);return c.jsx(Ww.Provider,{value:p,children:t})},jc=()=>{const t=b.useContext(Ww);if(!t)throw new Error("useNotifications must be used within NotificationProvider");return t},IA={coder:"role.coder",custom:"role.custom",reviewer:"role.reviewer",sentinel:"role.sentinel",tester:"role.tester"},qA=t=>new Map(t.map(a=>[a.id,{id:a.id,name:a.name,pendingTaskCount:a.pendingTaskCount,role:a.role,status:a.status}])),PA=({terminalRuns:t,workers:a,workspace:o})=>{const{notify:i}=jc(),{t:l}=we(),u=b.useRef(null);return b.useEffect(()=>{if(!o){u.current=null;return}const f=qA(a),m=u.current;if(u.current={workers:f,workspaceId:o.id},!(!m||m.workspaceId!==o.id))for(const g of f.values()){const p=m.workers.get(g.id);if(!p)continue;if(p.status!=="stopped"&&g.status==="stopped"){i({brief:l("notifications.workerStopped.brief",{name:g.name}),detail:l("notifications.workerStopped.detail",{name:g.name,workspace:o.name}),kind:"error",title:l("notifications.workerStopped.title")});continue}if(p.status==="stopped"&&g.status!=="stopped"){i({brief:l("notifications.workerStarted.brief",{name:g.name}),detail:l("notifications.workerStarted.detail",{name:g.name,workspace:o.name,role:l(IA[g.role])}),kind:"success",title:l("notifications.workerStarted.title")});continue}(g.pendingTaskCount<p.pendingTaskCount||p.status==="working"&&g.status==="idle")&&i({brief:l("notifications.workerReported.brief",{name:g.name}),detail:l("notifications.workerReported.detail",{name:g.name,workspace:o.name}),kind:"success",title:l("notifications.workerReported.title")})}},[i,l,a,o]),null},FA=({tabs:t,activeId:a,onSelect:o,onClose:i,onClosePanel:l,onNewShell:u,newShellPending:f})=>{const{t:m}=we();return c.jsxs("div",{role:"tablist","aria-label":m("terminalPanel.tablistAria"),className:"scrollbar-thin flex h-9 min-h-9 w-full items-stretch overflow-x-auto pointer-coarse:h-12 pointer-coarse:min-h-12",style:{background:"var(--bg-2)",borderBottom:"1px solid var(--border)"},"data-testid":"terminal-tab-strip",children:[t.map(g=>{const p=g.id===a,y=m("terminalPanel.closeTab",{name:g.label}),v=k=>{k.stopPropagation(),i(g.id)};return c.jsxs("div",{role:"tab","aria-selected":p,"data-testid":`terminal-tab-${g.id}`,onClick:()=>o(g.id),className:"group relative flex max-w-[200px] shrink-0 cursor-pointer items-center gap-1.5 border-r text-xs",style:{background:p?"var(--bg-1)":"transparent",borderRightColor:"var(--border)",color:p?"var(--text-primary)":"var(--text-secondary)"},children:[p?c.jsx("span",{"data-tab-accent":!0,"aria-hidden":!0,className:"pointer-events-none absolute top-0 right-0 left-0 h-0.5",style:{background:"var(--accent)"}}):null,c.jsxs("button",{type:"button","data-testid":`terminal-tab-select-${g.id}`,onClick:k=>{k.stopPropagation(),o(g.id)},className:"flex min-w-0 flex-1 items-center gap-1.5 py-2 pr-1 pl-3 text-left",style:{color:"inherit"},children:[c.jsx(pc,{size:12,"aria-hidden":!0}),c.jsx("span",{className:"truncate",children:g.label})]}),c.jsx(Qe,{label:y,children:c.jsx("button",{type:"button","aria-label":y,"data-testid":`terminal-tab-close-${g.id}`,onClick:v,className:`mr-1 rounded p-0.5 pointer-coarse:p-2 transition ${p?"opacity-100":"opacity-0 group-hover:opacity-100 pointer-coarse:opacity-100"}`,style:{color:"var(--text-secondary)"},children:c.jsx(Ka,{size:12,"aria-hidden":!0})})})]},g.id)}),c.jsxs("div",{className:"flex flex-1 items-center justify-end gap-1 px-2",children:[c.jsx(Qe,{label:m("terminalPanel.closePanel"),children:c.jsx("button",{type:"button","aria-label":m("terminalPanel.closePanel"),"data-testid":"terminal-panel-close",onClick:l,className:"flex h-6 w-6 shrink-0 items-center justify-center rounded border text-sec transition hover:text-pri disabled:opacity-50 pointer-coarse:h-10 pointer-coarse:w-10",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:c.jsx(Ka,{size:12,"aria-hidden":!0})})}),c.jsx(Qe,{label:m("terminalPanel.newShell"),children:c.jsx("button",{type:"button","aria-label":m("terminalPanel.newShell"),"data-testid":"terminal-tab-new-shell",onClick:u,disabled:f,className:"flex h-6 w-6 shrink-0 items-center justify-center rounded border text-sec transition hover:text-pri disabled:opacity-50 pointer-coarse:h-10 pointer-coarse:w-10",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:f?c.jsx(Fa,{size:12,className:"animate-spin","aria-hidden":!0}):c.jsx(Kl,{size:12,"aria-hidden":!0})})})]})]})},Iw="hive.terminal-panel.height",qw="hive.terminal-panel.collapsed",Zf=160,KA=.35,YA=160,Ws=t=>{const a=typeof window<"u"?window.innerHeight:800,o=Math.max(Zf,a-YA);return Math.min(Math.max(t,Zf),o)},bf=()=>{const t=typeof window<"u"?window.innerHeight:800;return Ws(Math.floor(t*KA))},$A=()=>{try{const t=window.localStorage.getItem(Iw);if(!t)return bf();const a=Number.parseInt(t,10);return Number.isFinite(a)?Ws(a):bf()}catch{return bf()}},VA=()=>{try{return window.localStorage.getItem(qw)==="1"}catch{return!1}},GA=()=>{const[t,a]=b.useState(()=>$A()),[o,i]=b.useState(()=>VA()),[l,u]=b.useState(!1);b.useEffect(()=>{try{window.localStorage.setItem(Iw,String(Math.round(t)))}catch{}},[t]),b.useEffect(()=>{try{window.localStorage.setItem(qw,o?"1":"0")}catch{}},[o]),b.useEffect(()=>{const p=()=>a(y=>Ws(y));return window.addEventListener("resize",p),()=>window.removeEventListener("resize",p)},[]);const f=b.useCallback(p=>a(Ws(p)),[]),m=b.useCallback(p=>i(p),[]),g=b.useCallback(p=>{p.preventDefault();const y=p.clientY;let v=t;a(E=>(v=E,E)),u(!0);const k=document.body.style.cursor,S=document.body.style.userSelect;document.body.style.cursor="ns-resize",document.body.style.userSelect="none";const T=E=>{const C=E.clientY-y;a(Ws(v-C))},w=()=>{u(!1),document.body.style.cursor=k,document.body.style.userSelect=S,document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",w),document.removeEventListener("pointercancel",w)};document.addEventListener("pointermove",T),document.addEventListener("pointerup",w),document.addEventListener("pointercancel",w)},[t]);return{height:t,collapsed:o,dragging:l,setHeight:f,setCollapsed:m,beginDrag:g}},XA=(t,a)=>a?t.find(o=>o.id===a)??null:null,ZA=({tabs:t,activeId:a,onSelect:o,onClose:i,onClosePanel:l,onNewShell:u,newShellPending:f,onStartWorker:m,startingWorkerId:g})=>{const{t:p}=we(),y=GA(),v=wt();if(t.length===0)return null;const k=XA(t,a)??t[0]??null;return c.jsxs("div",{"data-testid":"terminal-bottom-panel",className:"relative flex shrink-0 flex-col",style:{height:v?"45%":y.height,minHeight:v?"min(160px, 60%)":void 0,background:"var(--bg-1)",borderTop:"1px solid var(--border)"},tabIndex:-1,onKeyDown:S=>{(S.metaKey||S.ctrlKey)&&!S.altKey&&!S.shiftKey&&S.key.toLowerCase()==="w"&&a&&(S.preventDefault(),i(a))},children:[v?null:c.jsx("div",{role:"separator","aria-orientation":"horizontal","aria-label":p("terminalPanel.resizeAria"),"aria-valuemin":Zf,"aria-valuenow":Math.round(y.height),className:"absolute top-0 right-0 left-0 z-10 h-2 -translate-y-1 cursor-ns-resize",tabIndex:-1,"data-resizing":y.dragging||void 0,"data-testid":"terminal-panel-resize-handle",onPointerDown:y.beginDrag}),c.jsx(FA,{tabs:t,activeId:k?.id??null,onSelect:o,onClose:i,onClosePanel:l,onNewShell:u,newShellPending:f}),c.jsx("div",{className:"relative min-h-0 flex-1",style:{background:"var(--bg-crust)"},children:t.map(S=>c.jsx(QA,{tab:S,isActive:S.id===(k?.id??null),onStartWorker:m,startingWorkerId:g},S.id))})]})},QA=({tab:t,isActive:a,onStartWorker:o,startingWorkerId:i})=>{const{t:l}=we(),u=a?"flex h-full w-full":"hidden";if(t.kind==="worker"){if(!t.runId){const f=i===t.workerId;return c.jsxs("div",{className:a?"flex h-full w-full flex-col items-center justify-center gap-3 px-6 text-center text-xs text-ter":"hidden","data-testid":"terminal-panel-stopped-worker",children:[c.jsxs("span",{className:"flex items-center gap-2",children:[c.jsx(pc,{size:14,"aria-hidden":!0}),l("terminalPanel.workerStopped",{name:t.label})]}),c.jsxs("button",{type:"button",onClick:()=>o(t.workerId),disabled:f,className:"icon-btn icon-btn--primary","data-testid":"terminal-panel-start-worker",children:[f?c.jsx(Fa,{size:12,className:"animate-spin","aria-hidden":!0}):c.jsx(jo,{size:12,"aria-hidden":!0}),l(f?"common.starting":"common.start")]})]})}return c.jsx("div",{id:`worker-pty-${t.runId}`,className:u,"data-pty-slot":"worker","data-testid":`terminal-panel-slot-worker-${t.workerId}`})}return c.jsx("div",{id:`shell-pty-${t.runId}`,className:u,"data-pty-slot":"shell","data-testid":`terminal-panel-slot-shell-${t.runId}`})},wf=t=>`hive.terminal-panel.tabs.${t}`,xf=t=>`hive.terminal-panel.active.${t}`,JA=t=>`worker:${t}`,e_=t=>`shell:${t}`,Hy=t=>{try{const a=window.localStorage.getItem(t);if(!a)return[];const o=JSON.parse(a);return Array.isArray(o)?o.filter(i=>typeof i=="string"):[]}catch{return[]}},By=t=>{try{return window.localStorage.getItem(t)??""}catch{return""}},Uy=(t,a)=>{try{window.localStorage.setItem(t,a)}catch{}},t_=({workspaceId:t,workers:a,terminalRuns:o})=>{const[i,l]=b.useState(()=>Hy(wf(t))),[u,f]=b.useState(()=>{const j=By(xf(t));return j.length>0?j:null}),m=b.useRef(i);m.current=i;const g=b.useRef(t);b.useEffect(()=>{if(g.current===t)return;g.current=t,l(Hy(wf(t)));const j=By(xf(t));f(j.length>0?j:null)},[t]);const p=b.useRef(!1);b.useEffect(()=>{p.current=a.length>0||o.length>0},[t]),b.useEffect(()=>{(a.length>0||o.length>0)&&(p.current=!0)},[a,o]),b.useEffect(()=>{p.current&&Uy(wf(t),JSON.stringify(i))},[i,t]),b.useEffect(()=>{p.current&&Uy(xf(t),u??"")},[u,t]);const y=b.useMemo(()=>new Map(a.map(j=>[j.id,j])),[a]),{runByAgentId:v,shellRunById:k}=b.useMemo(()=>{const j=new Map,_=new Map;for(const N of o)j.set(N.agent_id,N),wc(N,t)&&_.set(N.run_id,N);return{runByAgentId:j,shellRunById:_}},[o,t]),S=b.useMemo(()=>{const j=[];for(const _ of i)if(_.startsWith("worker:")){const N=_.slice(7),O=y.get(N);if(!O)continue;const M=v.get(O.id);j.push({id:_,kind:"worker",workerId:N,runId:M?.run_id??null,label:O.name})}else if(_.startsWith("shell:")){const N=_.slice(6),O=k.get(N);if(!O)continue;j.push({id:_,kind:"shell",runId:N,label:O.agent_name})}return j},[i,y,v,k]);b.useEffect(()=>{p.current&&l(j=>{const _=j.filter(N=>N.startsWith("worker:")?y.has(N.slice(7)):N.startsWith("shell:")?k.has(N.slice(6)):!1);return _.length===j.length?j:_})},[y,k]),b.useEffect(()=>{p.current&&(u&&S.some(j=>j.id===u)||f(S[0]?.id??null))},[u,S]);const T=b.useCallback(j=>{p.current=!0;const _=JA(j);l(N=>N.includes(_)?N:[...N,_]),f(_)},[]),w=b.useCallback(j=>{p.current=!0;const _=e_(j);l(N=>N.includes(_)?N:[...N,_]),f(_)},[]),E=b.useCallback(j=>{const _=m.current,N=_.filter(O=>O!==j);N.length!==_.length&&(l(N),f(O=>{if(O!==j)return O;const M=_.indexOf(j);return N[M]??N[M-1]??N[0]??null}))},[]),C=b.useCallback(j=>f(j),[]);return{tabs:S,activeId:u,openWorkerTab:T,openShellTab:w,closeTab:E,setActive:C}},Wy=500,n_=2500,a_=5e3,r_=t=>t.status==="starting"||t.status==="running",o_=(t,a)=>t>0?Math.min(Wy*2**t,a_):a.some(r_)?Wy:n_,Pw=t=>`${t}:orchestrator`,s_=(t,a)=>t.length!==a.length?!1:t.every((o,i)=>{const l=a[i];return l!==void 0&&o.agent_id===l.agent_id&&o.agent_name===l.agent_name&&o.run_id===l.run_id&&o.status===l.status&&o.terminal_input_profile===l.terminal_input_profile}),i_=t=>{const[a,o]=b.useState([]);return b.useEffect(()=>{if(!t){o([]);return}let i=!1,l=0,u=!1,f=[],m;const g=()=>{i||(m=window.setTimeout(p,o_(l,f)))},p=()=>{u||(u=!0,aN(t).then(y=>{i||(l=0,f=y,o(v=>s_(v,y)?v:y))}).catch(y=>{i||(l=Math.min(l+1,4),o(v=>v.length===0?v:[])),console.error("[hive] swallowed:terminalRuns.list",y)}).finally(()=>{u=!1,g()}))};return p(),()=>{i=!0,m!==void 0&&window.clearTimeout(m)}},[t]),a},l_=(t,a)=>t.find(o=>o.agent_id===Pw(a)),c_=(t,a)=>t.find(o=>o.agent_id===a),u_=({onCloseFailed:t,onShellRunClosed:a,onShellRunStarted:o,panelTabs:i,shellRuns:l,workspaceId:u})=>{const[f,m]=b.useState(null),[g,p]=b.useState(null),[y,v]=b.useState(!1),k=b.useRef(new Map),S=b.useRef(0),T=b.useRef(new Map),w=b.useRef(new Map),E=b.useRef(new Set),C=b.useRef(u),_=(l.find(F=>F.run_id===g)??l[0]??null)?.run_id??null,N=b.useCallback((F,J)=>{const X=T.current.get(F)??new Set;X.add(J),T.current.set(F,X)},[]),O=b.useCallback((F,J,X)=>{const $=w.current.get(F)??new Map;$.set(J,X),w.current.set(F,$),X.finally(()=>{const D=w.current.get(F);D&&(D.delete(J),D.size===0&&w.current.delete(F))}).catch(()=>{})},[]),M=b.useCallback((F,J)=>{const X=T.current.get(F);X&&(X.delete(J),X.size===0&&T.current.delete(F))},[]);b.useLayoutEffect(()=>{C.current=u},[u]),b.useEffect(()=>()=>{T.current.clear(),w.current.clear(),E.current.clear()},[]),b.useEffect(()=>{m(null),p(null),v(!1)},[u]),b.useEffect(()=>{if(!u)return;const F=T.current.get(u);if(!F)return;const J=new Set(l.map($=>$.run_id)),X=w.current.get(u);for(const $ of Array.from(F))X?.has($)||J.has($)||M(u,$)},[l,M,u]);const L=()=>{if(!u||k.current.has(u))return;const F=u,J=S.current+1;S.current=J,k.current.set(F,J);const X=()=>C.current===F,$=()=>k.current.get(F)===J;m(null),v(!0),QT(F).then(D=>{o?.(F,D),X()&&(p(D.run_id),i.openShellTab(D.run_id))}).catch(D=>{X()&&m(D instanceof Error?D.message:String(D))}).finally(()=>{$()&&k.current.delete(F),X()&&v(!1)})},U=()=>{if(!u||k.current.has(u)||E.current.has(u))return;const F=u,J=Array.from(w.current.get(F)?.values()??[]);if(J.length===0){L();return}E.current.add(F),m(null),v(!0),Promise.allSettled(J).then(X=>{X.some($=>$.status==="rejected")||C.current===F&&(k.current.has(F)||L())}).finally(()=>{E.current.delete(F),C.current===F&&!k.current.has(F)&&v(!1)})};return{closeShellTab:F=>{if(!u)return;const J=l.find($=>$.run_id!==F)??null;_===F&&p(J?.run_id??null),a?.(u,F),N(u,F);const X=JT(u,F).catch($=>{throw M(u,F),t($ instanceof Error?$.message:String($)),$});O(u,F,X),X.catch(()=>{})},openShell:()=>{if(!u||k.current.has(u)||y)return;const F=i.tabs.find($=>$.kind==="shell");if(F){i.setActive(F.id);return}const J=T.current.get(u)??new Set,X=l.find($=>!J.has($.run_id));if(X){p(X.run_id),i.openShellTab(X.run_id);return}if(J.size>0){U();return}L()},shellError:f,shellStarting:y,startNewShell:()=>{if(!u||k.current.has(u)||y)return;if((T.current.get(u)??new Set).size>0){U();return}L()}}},Fw="hive.split.orch-pct",Hs=.3,Bs=.78,Ul=.6,Iy=.02,Wl=(t,a,o)=>Math.min(o,Math.max(a,t)),d_=()=>{try{const t=localStorage.getItem(Fw);if(!t)return Ul;const a=Number.parseFloat(t);return Number.isFinite(a)?Wl(a,Hs,Bs):Ul}catch{return Ul}},f_=()=>{const t=b.useRef(null),[a,o]=b.useState(()=>d_()),[i,l]=b.useState(!1);b.useEffect(()=>{try{localStorage.setItem(Fw,a.toFixed(4))}catch{}},[a]);const u=b.useCallback(m=>{m.preventDefault();const g=t.current;if(!g)return;l(!0);const p=document.body.style.userSelect,y=document.body.style.cursor;document.body.style.userSelect="none",document.body.style.cursor="col-resize";const v=S=>{const T=g.getBoundingClientRect();if(T.width<=0)return;const w=(S.clientX-T.left)/T.width;o(Wl(w,Hs,Bs))},k=()=>{l(!1),document.body.style.userSelect=p,document.body.style.cursor=y,document.removeEventListener("pointermove",v),document.removeEventListener("pointerup",k),document.removeEventListener("pointercancel",k)};document.addEventListener("pointermove",v),document.addEventListener("pointerup",k),document.addEventListener("pointercancel",k)},[]),f=b.useCallback(m=>{m.key==="ArrowLeft"?(m.preventDefault(),o(g=>Wl(g-Iy,Hs,Bs))):m.key==="ArrowRight"?(m.preventDefault(),o(g=>Wl(g+Iy,Hs,Bs))):m.key==="Home"?(m.preventDefault(),o(Hs)):m.key==="End"?(m.preventDefault(),o(Bs)):m.key==="Enter"&&(m.metaKey||m.ctrlKey)&&(m.preventDefault(),o(Ul))},[]);return{containerRef:t,orchPct:a,dragging:i,beginDrag:u,onKeyDown:f}},ri=({title:t,description:a,icon:o,action:i})=>c.jsxs("div",{className:"m-auto flex max-w-[380px] flex-col items-center gap-3 px-6 py-8 text-center","data-testid":"empty-state",children:[o?c.jsx("div",{"data-testid":"empty-state-icon","aria-hidden":!0,className:"flex h-12 w-12 items-center justify-center rounded text-sec",style:{background:"var(--bg-2)",border:"1px solid var(--border-bright)"},children:o}):null,c.jsx("div",{className:"text-lg font-semibold text-pri","data-testid":"empty-state-title",children:t}),c.jsx("div",{className:"text-sm text-ter","data-testid":"empty-state-description",children:a}),i]}),Ua=t=>a=>{console.error(`[hive] swallowed:${t}`,a)},m_={agy:{command:"curl -fsSL https://antigravity.google/cli/install.sh | bash",docsUrl:"https://antigravity.google/docs/cli-getting-started"},claude:{command:"npm install -g @anthropic-ai/claude-code",docsUrl:"https://github.com/anthropics/claude-code"},codex:{command:"npm install -g @openai/codex",docsUrl:"https://github.com/openai/codex"},cursor:{command:"curl https://cursor.com/install -fsS | bash",docsUrl:"https://cursor.com/docs/cli/installation"},gemini:{command:"npm install -g @google/gemini-cli",docsUrl:"https://github.com/google-gemini/gemini-cli"},grok:{command:"curl -fsSL https://x.ai/cli/install.sh | bash",docsUrl:"https://x.ai/cli"},hermes:{command:"curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash",docsUrl:"https://github.com/NousResearch/hermes-agent"},opencode:{command:"npm install -g opencode-ai",docsUrl:"https://opencode.ai/docs"},qwen:{command:"npm install -g @qwen-code/qwen-code@latest",docsUrl:"https://github.com/QwenLM/qwen-code"}},p_=t=>m_[t]??null,h_=({presetId:t,presetName:a})=>{const{t:o}=we(),i=p_(t),[l,u]=b.useState(!1),[f,m]=b.useState(!1),g=b.useRef(null);b.useEffect(()=>()=>{g.current&&clearTimeout(g.current)},[]);const p=()=>{i&&V0(i.command).then(()=>{u(!0),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{u(!1),g.current=null},1500)}).catch(Ua("cli-install-copy"))};return c.jsxs("div",{className:"flex flex-col gap-2 rounded-lg border p-3",style:{background:"var(--bg-2)",borderColor:"var(--border)"},"data-testid":"cli-install-guidance",children:[i?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-xs text-sec",children:o("workspace.preset.installHint",{name:a})}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("code",{className:"mono min-w-0 flex-1 truncate rounded border px-2 py-1.5 text-xs text-pri",style:{background:"var(--bg-1)",borderColor:"var(--border)"},title:i.command,children:i.command}),c.jsxs("button",{type:"button",onClick:p,className:"icon-btn shrink-0 inline-flex items-center gap-1.5","aria-label":o("workspace.preset.installCopyAria"),"data-testid":"cli-install-copy",children:[l?c.jsx(Ga,{size:13,"aria-hidden":!0}):c.jsx(Cr,{size:13,"aria-hidden":!0}),c.jsx("span",{className:"text-xs",children:o(l?"common.copied":"workspace.preset.installCopy")})]})]}),c.jsxs("a",{href:i.docsUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 self-start text-xs text-sec underline hover:text-pri","data-testid":"cli-install-docs",children:[c.jsx(xm,{size:11,"aria-hidden":!0}),o("workspace.preset.installDocs")]})]}):null,c.jsxs("button",{type:"button",onClick:()=>m(y=>!y),"aria-expanded":f,className:"flex items-center gap-1 text-left text-xs text-sec hover:text-pri cursor-pointer","data-testid":"cli-install-path-help-toggle",children:[f?c.jsx(No,{size:12,"aria-hidden":!0}):c.jsx(mc,{size:12,"aria-hidden":!0}),o("workspace.preset.pathHelpTitle")]}),f?c.jsx("p",{className:"text-xs leading-relaxed text-ter","data-testid":"cli-install-path-help-body",children:o("workspace.preset.pathHelpBody")}):null]})},g_={"cursor-agent":"cursor"},v_=/^(\S+) CLI not found in PATH/u,y_=()=>{const{t}=we();return c.jsx("div",{"data-testid":"orchestrator-starting-body",className:"flex flex-1",children:c.jsx(ri,{icon:c.jsx(Fa,{size:24,className:"animate-spin"}),title:t("orchestrator.startingTitle"),description:t("orchestrator.startingDesc")})})},b_=({onStart:t})=>{const{t:a}=we();return c.jsx("div",{"data-testid":"orchestrator-stopped-body",className:"flex flex-1",children:c.jsx(ri,{icon:c.jsx(wm,{size:24}),title:a("orchestrator.stoppedTitle"),description:a("orchestrator.stoppedDesc"),action:c.jsxs("button",{type:"button",onClick:t,className:"icon-btn icon-btn--primary","data-testid":"orchestrator-start",children:[c.jsx(jo,{size:12,"aria-hidden":!0})," ",a("orchestrator.start")]})})})},w_=({error:t,onRemoveWorkspace:a,onRestart:o})=>{const{t:i}=we(),[l,u]=b.useState(!1),f=()=>{navigator.clipboard?.writeText(t).then(()=>{u(!0),window.setTimeout(()=>u(!1),1500)}).catch(()=>{})},m=v_.exec(t)?.[1];return c.jsxs("div",{"data-testid":"orchestrator-failed-body",className:"m-auto flex max-w-[480px] flex-col items-center gap-3 px-6 py-8",children:[c.jsx("div",{"aria-hidden":!0,className:"flex h-12 w-12 items-center justify-center rounded text-sec",style:{background:"var(--bg-2)",border:"1px solid var(--border-bright)"},children:c.jsx(wm,{size:24})}),c.jsx("div",{className:"text-lg font-semibold text-pri",children:i("orchestrator.failed")}),c.jsxs("div",{className:"relative w-full",children:[c.jsx("pre",{"data-testid":"orchestrator-error-message",className:"mono w-full max-h-40 overflow-auto whitespace-pre-wrap break-all rounded p-3 text-left text-xs",style:{background:"color-mix(in oklab, var(--status-red) 8%, var(--bg-2))",border:"1px solid color-mix(in oklab, var(--status-red) 24%, transparent)",color:"var(--text-secondary)"},children:t}),c.jsx(Qe,{label:i(l?"common.copied":"common.copyError"),children:c.jsx("button",{type:"button",onClick:f,"aria-label":i("orchestrator.copyErrorAria"),className:"icon-btn icon-btn--ghost absolute right-1 top-1 h-6 px-1.5","data-testid":"orchestrator-copy-error",children:c.jsx(Cr,{size:12,"aria-hidden":!0})})})]}),m?c.jsx("div",{className:"w-full",children:c.jsx(h_,{presetId:g_[m]??m,presetName:m})}):null,c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsxs("button",{type:"button",onClick:o,className:"icon-btn icon-btn--primary","data-testid":"orchestrator-retry",children:[c.jsx(Sm,{size:12,"aria-hidden":!0})," ",i("common.retry")]}),c.jsx("button",{type:"button",onClick:a,className:"icon-btn icon-btn--danger","data-testid":"orchestrator-remove-workspace",children:i("orchestrator.removeWorkspace")})]}),c.jsx("span",{"data-testid":"orchestrator-retry-header",className:"sr-only",children:i("common.retry")})]})},x_=({state:t,onRemoveWorkspace:a,onRestart:o,onStart:i})=>{const{t:l}=we(),u=wt();return c.jsx("div",{className:"orchestrator-pane-root relative flex h-full w-full min-w-0 flex-col",style:{background:"var(--bg-crust)",...u?{}:{borderRight:"1px solid var(--border)"}},"data-testid":"orchestrator-terminal-slot",children:t.kind==="running"?c.jsx("div",{id:`orch-pty-${t.runId}`,className:"orchestrator-pty-slot relative flex h-full w-full","data-pty-slot":"orchestrator",children:c.jsx("div",{className:"orchestrator-pty-placeholder pointer-events-none absolute inset-0 flex items-center justify-center px-4 text-center","data-testid":"orchestrator-running-placeholder",children:c.jsx("div",{className:"mono text-xs text-ter",children:l("terminal.statusConnecting")})})}):t.kind==="failed"?c.jsx(w_,{error:t.error,onRemoveWorkspace:a,onRestart:o}):t.kind==="stopped"?c.jsx(b_,{onStart:i}):c.jsx(y_,{})})},k_=({workspaceId:t,terminalRuns:a,autostartError:o,suppressAutostartRunId:i,onClearAutostartError:l,onAfterStart:u})=>{const f=l_(a,t),m=Pw(t),[g,p]=b.useState(null),[y,v]=b.useState(null),[k,S]=b.useState(null),T=y?.workspaceId===t?y.runId:null,w=!!(k&&!f&&!T);b.useEffect(()=>{S(i??null)},[i]),b.useEffect(()=>{f&&(p(null),v(null),S(null))},[f]),b.useEffect(()=>{if(!k||f)return;const N=window.setTimeout(()=>S(null),1500);return()=>window.clearTimeout(N)},[k,f]),b.useEffect(()=>{if(!T||f)return;const N=window.setTimeout(()=>v(null),2e3);return()=>window.clearTimeout(N)},[T,f]);let E;f?E={hasUserInputSinceStart:f.has_user_input_since_start===!0,kind:"running",runId:f.run_id,startupBlockedReason:f.startup_blocked_reason??null}:T?E={hasUserInputSinceStart:!1,kind:"running",runId:T,startupBlockedReason:null}:g===t||w?E={kind:"starting"}:o?E={kind:"failed",error:o}:E={kind:"stopped"};const C=b.useCallback(()=>{!t||g===t||f||(l(),p(t),Vl(t,m).then(N=>{v({workspaceId:t,runId:N.runId}),u?.({ok:!0,error:null,run_id:N.runId})}).catch(N=>{const O=N instanceof Error?N.message:"Failed to start Queen";v(null),u?.({ok:!1,error:O,run_id:null})}).finally(()=>p(N=>N===t?null:N)))},[m,u,l,f,g,t]),j=b.useCallback(()=>{f&&Gl(f.run_id).catch(N=>{console.error("[hive] swallowed:orchestrator.stop",N)})},[f]),_=b.useCallback(()=>{if(l(),f){Gl(f.run_id).catch(N=>{console.error("[hive] swallowed:orchestrator.restart.stop",N)}).then(()=>Vl(t,m)).then(N=>{v({workspaceId:t,runId:N.runId}),u?.({ok:!0,error:null,run_id:N.runId})}).catch(N=>{const O=N instanceof Error?N.message:"Failed to restart Queen";u?.({ok:!1,error:O,run_id:null})});return}C()},[m,u,l,f,C,t]);return{state:E,start:C,stop:j,restart:_}},Kw=["ada-lovelace","archimedes","babbage","bell","da-vinci","edison","eiffel","euclid","euler","fermat","fibonacci","gutenberg","leibniz","marconi","morse","nobel","pascal","pythagoras","tesla","turing","watt","wright-brothers"],Yw=["adam-smith","aquinas","aristotle","augustine","bacon","calvin","cicero","democritus","descartes","epicurus","hegel","herodotus","hobbes","hume","kant","kierkegaard","locke","luther","machiavelli","marcus-aurelius","montesquieu","nietzsche","plato","rousseau","seneca","socrates","spinoza","voltaire"],$w=["amundsen","boyle","cook","copernicus","curie","da-gama","darwin","drake","faraday","fleming","galileo","halley","hippocrates","kepler","magellan","marco-polo","mendel","mendeleev","newton","pasteur","planck","ptolemy","rutherford","volta"],S_=["alexander","augustus","austen","bach","beethoven","brahms","byron","caesar","cervantes","charlemagne","chopin","cleopatra","dante","dickens","dostoevsky","dumas","einstein","elizabeth-i","franklin","goethe","goya","handel","hannibal","henry-viii","homer","hugo","jefferson","joan-of-arc","keats","leonidas","lincoln","liszt","louis-xiv","michelangelo","milton","monet","mozart","napoleon","nightingale","orwell","picasso","poe","raphael","rembrandt","schubert","shakespeare","sophocles","tchaikovsky","titian","tolstoy","twain","van-gogh","velazquez","verdi","vermeer","virgil","vivaldi","wagner","washington","whitman","wilde","woolf","wordsworth"],Vw=["八大山人","毕昇","蔡伦","干将","顾恺之","黄道婆","李冰","柳公权","鲁班","莫邪","墨子","沈括","宋应星","唐寅","王羲之","文徵明","吴道子","颜真卿","张衡","张择端","郑板桥","祖冲之"],Gw=["班固","包拯","狄仁杰","董仲舒","范仲淹","顾炎武","管仲","海瑞","韩非","韩愈","嵇康","贾谊","孔子","老子","林则徐","柳宗元","孟子","欧阳修","商鞅","司马光","司马迁","谭嗣同","王安石","王守仁","魏徵","荀子","张居正","周敦颐","朱熹","庄子"],Xw=["班超","扁鹊","法显","葛洪","华佗","鉴真","郦道元","李时珍","神农","苏武","孙思邈","陶弘景","徐光启","徐霞客","玄奘","张骞","张仲景","郑和"],E_=["白居易","蔡文姬","曹操","曹雪芹","曹植","程咬金","大禹","杜甫","杜牧","范蠡","关羽","汉武帝","韩信","忽必烈","花木兰","黄帝","霍去病","姜子牙","康熙","李白","李广","李靖","李清照","李煜","刘邦","刘备","刘伯温","柳永","陆游","罗贯中","吕布","吕不韦","孟浩然","蒙恬","努尔哈赤","庞统","蒲松龄","戚继光","乾隆","秦始皇","屈原","上官婉儿","施耐庵","司马懿","苏轼","孙膑","孙权","孙武","孙中山","唐太宗","唐玄宗","陶渊明","王维","卫青","文天祥","吴承恩","吴起","萧何","谢安","辛弃疾","杨贵妃","雍正","虞姬","岳飞","张飞","张良","张仪","赵子龙","周瑜","朱棣","诸葛亮","朱元璋","左宗棠"],C_=[...Kw,...Yw,...$w,...S_],T_=[...Vw,...Gw,...Xw,...E_],N_=["argus","cassandra","copernicus","halley","herodotus","hypatia","kepler","ptolemy","thucydides","tycho-brahe"],j_=["班固","郭守敬","沈括","司马光","司马迁","一行","张衡","祖冲之"],A_={en:{coder:Kw,reviewer:Yw,tester:$w,sentinel:N_,custom:C_},zh:{coder:Vw,reviewer:Gw,tester:Xw,sentinel:j_,custom:T_}},__=()=>{const t=new Uint32Array(1);return globalThis.crypto.getRandomValues(t),t[0]??0},kf=({language:t="en",role:a="coder",usedNames:o,nextUint32:i=__}={})=>{const l=A_[t][a],u=o&&o.size>0?l.filter(m=>!o.has(m)):l,f=u.length>0?u:l;return f[i()%f.length]},Is={en:{coder:["You are a Coder. Turn clearly scoped tasks into the smallest correct code change.","Working style:","- Read the relevant files and local patterns before editing.","- Prefer small changes; avoid unrelated refactors and scope creep.","- Run validation that covers the risk. If you cannot validate, explain why.","Report changed files, verification, remaining risk, and blockers."].join(`
56
+ `),custom:["You are a custom team member. Rewrite this into the member's operating contract.","Recommended shape:","- Goal: what this member owns.","- Boundaries: what to do and what to avoid.","- Working style: how to inspect, edit, verify, or review.","- Done means: what results, risks, and blockers to report."].join(`
57
+ `),reviewer:["You are a Reviewer. Focus on quality review; do not replace the Orchestrator or edit by default.","Working style:","- Prioritize real bugs, regressions, edge cases, and test gaps.","- For each issue, include severity, file/line, trigger condition, and minimal fix.","- If no high-risk issue exists, state residual risk and unverified scope.","Report blocking issues first, ordered by severity."].join(`
58
+ `),sentinel:["You are a Sentinel: a read-only patrol observer. You never execute tasks or modify anything.","Working style:","- The runtime periodically injects a workspace snapshot (worker states, open dispatches, possible orphans).","- Cross-check it against your own observations; surface only what deserves a human glance.","- A long-quiet dispatch is not necessarily stuck — big tasks are slow by nature.","Hard boundaries:","- Observe only: no file edits, no side-effecting commands, no dispatching.",'- You take no dispatches and have no `team report`; report findings via `team status "<finding>"`.',"- When nothing is unusual, stay quiet."].join(`
59
+ `),tester:["You are a Tester. Reproduce, test, and produce concrete verification evidence.","Working style:","- Clarify the behavior, entry point, and failure condition under test.","- Prefer real commands or real paths. Add a minimal test when useful.","- Record commands, results, key output, and uncovered scenarios.","Report pass/fail/unverified separately, then suggest the next step."].join(`
60
+ `)},zh:{coder:["你是实现型 Coder,负责把明确任务落成最小正确代码改动。","工作方式:","- 先阅读相关文件和现有模式,再动手。","- 优先小步修改,避免无关重构和范围扩张。","- 改动后运行能覆盖风险的验证命令;不能验证时说明原因。","交付说明要包含:改动文件、验证结果、剩余风险或阻塞。"].join(`
61
+ `),custom:["你是自定义成员。请把这段改成该成员的行为契约。","建议包含:","- 目标:这个成员主要负责什么。","- 边界:哪些事可以做,哪些事不要做。","- 工作方式:如何调查、修改、验证或审查。","- 完成标准:交付时需要说明哪些结果、风险和阻塞。"].join(`
62
+ `),reviewer:["你是监工型 Reviewer,负责质量审查,不替代 Orchestrator,也不默认改代码。","工作方式:","- 优先找真实 bug、回归风险、边界条件和测试缺口。","- 发现问题时给出严重度、文件/行号、触发条件和最小修复建议。","- 没有高风险问题时明确说清剩余风险和未验证范围。","交付说明按严重度排序,先列 blocking 问题。"].join(`
63
+ `),sentinel:["你是只读巡检型 Sentinel,负责观察团队运行状态,不执行任务、不修改任何东西。","工作方式:","- 系统会定期向你注入工作区快照(成员状态、未关闭派单、疑似孤儿单)。",'- 把快照与你自己的观察对照,只把"值得人看一眼"的事项报上去。',"- 长时间无汇报不等于卡死——正常的大任务本来就慢。","硬性边界:","- 只观察:不改文件、不跑有副作用的命令、不派活。",'- 你不接派单,也没有 `team report`;发现统一用 `team status "<巡检发现>"` 汇报。',"- 没有异常时保持安静。"].join(`
64
+ `),tester:["你是验证型 Tester,负责复现、测试和证据化验证。","工作方式:","- 先明确要验证的行为、入口和失败条件。","- 优先跑真实命令或真实链路;必要时补充最小测试。","- 记录命令、结果、关键输出和不能覆盖的场景。","交付说明要区分通过、失败、未验证和建议下一步。"].join(`
65
+ `)}},Sf=(t,a,o)=>t==="custom"?a.find(i=>i.roleType==="custom"&&i.isBuiltin)?.description??Is[o].custom:Is[o][t],R_=({createWorker:t,open:a,workers:o})=>{const{language:i}=we(),[l,u]=b.useState(""),[f,m]=b.useState("coder"),[g,p]=b.useState([]),[y,v]=b.useState(null),[k,S]=b.useState(!1),[T,w]=b.useState(null),[E,C]=b.useState(Is[i].coder),[j,_]=b.useState([]),[N,O]=b.useState("claude"),[M,L]=b.useState(""),[U,q]=b.useState(null),[ae,ee]=b.useState(!1),F=b.useRef(!1),J=b.useRef(!1),X=b.useRef(!1),$=Sf(f,g,i),D=b.useMemo(()=>g.filter(ce=>!ce.isBuiltin),[g]);b.useEffect(()=>{if(!a)return;let ce=!1;return XT().then(me=>{ce||(_(me),O(Te=>me.some(Ne=>Ne.id===Te&&Ne.available)?Te:me.find(Ne=>Ne.id==="claude"&&Ne.available)?.id??me.find(Ne=>Ne.available)?.id??me[0]?.id??""))}).catch(me=>{ce||q(me instanceof Error?me.message:String(me))}),()=>{ce=!0}},[a]),b.useEffect(()=>{if(!a)return;let ce=!1;return eN().then(me=>{ce||p(me)}).catch(me=>{ce||q(me instanceof Error?me.message:String(me))}),()=>{ce=!0}},[a]),b.useEffect(()=>{y===null&&(J.current||C(Sf(f,g,i)))},[i,g,f,y]);const P=ce=>{J.current=!0,C(ce)},I=ce=>{F.current=!1,u(ce)},V=b.useMemo(()=>new Set(o.map(ce=>ce.name)),[o]),Z=b.useRef(V);Z.current=V;const R=()=>{F.current=!0,u(kf({language:i,role:f,usedNames:V}))};b.useEffect(()=>{const ce=a&&!X.current;if(X.current=a,!!a){if(ce){F.current=!0,u(kf({language:i,role:f,usedNames:Z.current}));return}F.current&&u(kf({language:i,role:f,usedNames:Z.current}))}},[a,i,f]);const B=ce=>{m(ce),v(null),J.current=!1,C(Sf(ce,g,i))};return{commandPresets:j,commandPresetId:N,createWorkerError:U,creating:ae,customTemplates:D,roleDescription:E,roleDescriptionDefault:$,selectedTemplateId:y,startupCommand:M,templateBusy:k,templateError:T,workerName:l,workerRole:f,setCommandPresetId:ce=>{O(ce)},setRoleDescription:P,setStartupCommand:L,setWorkerName:I,setWorkerRole:B,selectTemplate:ce=>{if(ce===null){m("custom"),v(null),J.current=!1,C(Is[i].custom);return}const me=g.find(Te=>Te.id===ce);!me||me.isBuiltin||(m("custom"),v(ce),J.current=!1,C(me.description))},saveAsTemplate:async ce=>{const me=ce.trim(),Te=E.trim();if(!(!me||!Te)){S(!0),w(null);try{const Ne=await tN({name:me,roleType:"custom",description:Te});p(Se=>[...Se,Ne]),v(Ne.id),m("custom"),J.current=!1,C(Ne.description)}catch(Ne){throw w(Ne instanceof Error?Ne.message:String(Ne)),Ne}finally{S(!1)}}},deleteTemplate:async ce=>{const me=g.find(Te=>Te.id===ce);if(!(!me||me.isBuiltin)){S(!0),w(null);try{await nN(ce),p(Te=>Te.filter(Ne=>Ne.id!==ce)),y===ce&&(v(null),J.current=!1,C(Is[i].custom))}catch(Te){throw w(Te instanceof Error?Te.message:String(Te)),Te}finally{S(!1)}}},randomizeWorkerName:R,resetRoleDescription:()=>{J.current=!1,C($)},resetError:()=>q(null),applyMarketplaceImport:({name:ce,description:me})=>{F.current=!1,u(ce),v(null),m("custom"),J.current=!0,C(me)},submit:(ce,me)=>{ce.preventDefault(),ee(!0),q(null),t({commandPresetId:N,name:l,role:f,roleDescription:E,startupCommand:M}).then(({error:Te})=>{u(""),F.current=!1,B("coder"),v(null),O("claude"),L(""),me(),Te&&q(Te)}).catch(Te=>{q(Te instanceof Error?Te.message:String(Te))}).finally(()=>ee(!1))}}},O_=[{icon:c.jsx(Kb,{size:16}),titleKey:"welcome.step1Title",descriptionKey:"welcome.step1Desc"},{icon:c.jsx(gc,{size:16}),titleKey:"welcome.step2Title",descriptionKey:"welcome.step2Desc"},{icon:c.jsx(bE,{size:16}),titleKey:"welcome.step3Title",descriptionKey:"welcome.step3Desc"}],D_=({onAddWorkspace:t,onTryDemo:a,heroImageSrc:o,disabledReason:i})=>{const{t:l}=we(),u=!!i;return c.jsxs("div",{"data-testid":"welcome-pane",className:"m-auto flex w-full flex-col items-center gap-6 px-6 py-12 text-center",style:{maxWidth:"540px"},children:[o?c.jsx("img",{src:o,alt:"",className:"h-24 w-24","aria-hidden":!0}):null,c.jsxs("div",{className:"space-y-2",children:[c.jsx("div",{className:"text-2xl font-semibold text-pri",children:l("welcome.title")}),c.jsx("div",{className:"text-sm text-sec",children:l("welcome.desc")})]}),c.jsx("ol",{className:"grid w-full grid-cols-1 gap-3 text-left md:grid-cols-3",children:O_.map((f,m)=>c.jsxs("li",{className:"rounded border bg-1 p-3",style:{borderColor:"var(--border)"},children:[c.jsxs("div",{className:"mb-1 flex items-center gap-2 text-pri",children:[c.jsx("span",{className:"font-medium text-xs text-ter",children:m+1}),f.icon]}),c.jsx("div",{className:"text-xs font-medium text-pri",children:l(f.titleKey)}),c.jsx("div",{className:"mt-1 text-xs text-ter",children:l(f.descriptionKey)})]},f.titleKey))}),u?c.jsxs("div",{role:"alert","data-testid":"welcome-pane-disabled-reason",className:"flex items-start gap-2 rounded px-3 py-2 text-left text-xs",style:{background:"color-mix(in oklab, var(--status-red) 10%, transparent)",border:"1px solid color-mix(in oklab, var(--status-red) 28%, transparent)",color:"var(--status-red)"},children:[c.jsx(Ks,{size:14,className:"mt-0.5 shrink-0","aria-hidden":!0}),c.jsx("span",{className:"break-words",children:i})]}):null,c.jsxs("button",{type:"button",disabled:u,onClick:u?void 0:t,"aria-disabled":u||void 0,title:i,className:"icon-btn icon-btn--primary inline-flex items-center gap-2 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"welcome-pane-add",children:[c.jsx("span",{children:l("welcome.addWorkspace")}),c.jsx(uS,{size:14,"aria-hidden":!0})]}),a?c.jsx("button",{type:"button",onClick:a,className:"text-xs text-sec underline hover:text-pri",children:l("welcome.demo")}):null]})},Ef=t=>t==="danger"?"var(--status-red)":"var(--accent)",oi=({open:t,onOpenChange:a,title:o,description:i,confirmLabel:l,confirmKind:u="default",cancelLabel:f,onConfirm:m})=>{const{t:g}=we(),p=f??g("common.cancel");return c.jsx(_o,{open:t,onOpenChange:a,children:c.jsxs(Ro,{children:[c.jsx(Oo,{"data-testid":"confirm-overlay",className:"app-overlay fixed inset-0 z-[60]"}),c.jsx("div",{className:"pointer-events-none fixed inset-0 z-[70] grid place-items-center p-4",children:c.jsxs(Do,{"data-testid":"confirm-content",className:"dialog-scale-pop elev-2 pointer-events-auto w-[440px] max-w-[calc(100vw-32px)] rounded-lg border p-5",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},children:[c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx("div",{"aria-hidden":!0,className:"flex h-9 w-9 shrink-0 items-center justify-center rounded",style:{background:`color-mix(in oklab, ${Ef(u)} 14%, transparent)`,color:Ef(u),border:`1px solid color-mix(in oklab, ${Ef(u)} 30%, transparent)`},children:u==="danger"?c.jsx(Ks,{size:18}):c.jsx(AS,{size:18})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx(Mo,{"data-testid":"confirm-title",className:"text-lg font-semibold text-pri",children:o}),c.jsx(ti,{"data-testid":"confirm-description",className:"mt-1.5 text-sm text-sec",children:i})]})]}),c.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[c.jsx("button",{type:"button","data-testid":"confirm-cancel",onClick:()=>a(!1),autoFocus:u==="danger",className:"icon-btn",children:p}),c.jsx("button",{type:"button","data-testid":"confirm-action",onClick:()=>{m(),a(!1)},autoFocus:u!=="danger",className:u==="danger"?"icon-btn icon-btn--danger-solid":"icon-btn icon-btn--primary",children:l})]})]})})]})})},M_=["You are a Researcher. Collect facts, data, and sources for the assigned topic.","How to work:","- Break the topic into key questions first, then investigate each one.","- Prefer primary sources and real project files; attach a source or file path to every conclusion.","- Separate facts, inferences, and unknowns; never present guesses as facts.","Delivery: include findings by topic, source list, and unresolved questions."].join(`
66
+ `),L_=["你是 Researcher,负责为指定主题收集事实、数据和来源。","工作方式:","- 先拆出要回答的关键问题,再逐项调查。","- 优先一手来源和项目内真实文件;每个结论都附上来源或文件路径。","- 区分事实、推断和未知,不把猜测写成结论。","交付说明:按主题列出发现、来源清单和未解决问题。"].join(`
67
+ `),z_=["You are a Fact-checker. Verify research claims and evidence strength without expanding the scope by default.","How to work:","- Check every claim against its source and mark supported, uncertain, or unsupported.","- Cross-check critical claims with a second source, command, or direct file read.","- When a claim is wrong, provide the corrected wording and evidence.","Delivery: group by confidence and list refuted or uncertain claims first."].join(`
68
+ `),H_=["你是 Fact-checker,负责验证研究结论和证据强度,默认不扩范围。","工作方式:","- 逐条核对结论与其来源,标注支持、存疑或不支持。","- 对关键结论用第二来源、命令或直接读文件做交叉验证。","- 发现错误时给出纠正后的表述和依据。","交付说明:按可信度分组,先列被推翻或存疑的结论。"].join(`
69
+ `),B_=["You are a Drafter. Turn goals and source material into a clear first-draft document.","How to work:","- Confirm audience, purpose, and scope before outlining and writing.","- Use real project code and files as the source of truth; do not invent behavior or APIs.","- Mark missing material and points that need confirmation.","Delivery: include document path, structure overview, and confirmation checklist."].join(`
70
+ `),U_=["你是 Drafter,负责把目标和素材写成清晰的第一版文档。","工作方式:","- 先确认读者、目的和范围,再列提纲,后成文。","- 以项目内真实代码和文件为准,不编造行为或接口。","- 标注待确认和缺素材的位置。","交付说明:包含文档路径、结构概览和确认清单。"].join(`
71
+ `),W_=["You are a Document Reviewer. Check a draft for accuracy and readability; do not rewrite the whole document by default.","How to work:","- Verify technical details against real code and files first.","- Check structure, terminology consistency, and whether readers can follow the document.","- List issues by severity with concrete edits or rewrite examples.","Delivery: list factual errors first, then structure and wording issues."].join(`
72
+ `),I_=["你是 Document Reviewer,负责检查草稿的准确性和可读性;默认不要整篇重写。","工作方式:","- 先对照项目真实代码和文件核对技术细节。","- 检查结构、术语一致性,以及读者能否按文档完成操作。","- 问题按严重度列出,给出具体修改建议或改写示例。","交付说明:先列事实错误,再列结构和表达问题。"].join(`
73
+ `),q_=[{id:"build_review_test",workers:[{nameStem:"coder",role:"coder"},{nameStem:"reviewer",role:"reviewer"},{nameStem:"tester",role:"tester"}],goalTemplate:{en:"Implement <feature>: have the Coder implement, Reviewer audit, and Tester verify; describe what to build, key constraints, and validation commands or acceptance criteria.",zh:"实现 X 功能:让 Coder 实现、Reviewer 审查、Tester 验证;写清楚要做什么、关键约束,以及验证命令或验收标准。"}},{id:"research_factcheck",workers:[{nameStem:"researcher",role:"custom",descriptionOverride:{en:M_,zh:L_}},{nameStem:"factchecker",role:"custom",descriptionOverride:{en:z_,zh:H_}}],goalTemplate:{en:"Research <topic>: have the Researcher gather evidence and the Factchecker verify it; list questions, trusted sources, and the decision this research should support.",zh:"调研 X 主题:让 Researcher 收集证据、Factchecker 复核;列出要回答的问题、可信来源要求,以及这次调研要支撑的决策。"}},{id:"docs_pipeline",workers:[{nameStem:"drafter",role:"custom",descriptionOverride:{en:B_,zh:U_}},{nameStem:"doc-reviewer",role:"custom",descriptionOverride:{en:W_,zh:I_}}],goalTemplate:{en:"Write <doc>: have the Drafter write and the Doc Reviewer review; state the audience, scope, required sections, and code or files it should describe.",zh:"撰写 X 文档:让 Drafter 撰写、Doc Reviewer 审查;写明读者、范围、必备章节,以及它要描述的代码或文件。"}}],qy={build_review_test:{icon:c.jsx(GS,{size:16,"aria-hidden":!0}),titleKey:"scenario.build_review_test.title",descKey:"scenario.build_review_test.desc"},research_factcheck:{icon:c.jsx(mS,{size:16,"aria-hidden":!0}),titleKey:"scenario.research_factcheck.title",descKey:"scenario.research_factcheck.desc"},docs_pipeline:{icon:c.jsx(Fb,{size:16,"aria-hidden":!0}),titleKey:"scenario.docs_pipeline.title",descKey:"scenario.docs_pipeline.desc"}},P_=({workspaceId:t})=>{const{language:a,t:o}=we(),i=en(),[l,u]=b.useState(null),[f,m]=b.useState(""),[g,p]=b.useState(!1),y=S=>{m(S.goalTemplate[a]),u(S)},v=()=>{g||u(null)},k=()=>{!l||g||!f.trim()||(p(!0),oN(t,l.id,f,a).then(()=>{i.show({kind:"success",message:o("scenario.applied")}),u(null)}).catch(S=>{i.show({kind:"error",message:S instanceof Error?S.message:String(S)})}).finally(()=>p(!1)))};return c.jsxs("div",{className:"mx-auto mt-6 w-full max-w-[420px]","data-testid":"scenario-team-cards",children:[c.jsxs("div",{className:"mb-2 flex items-center justify-center gap-1.5 text-xs font-medium uppercase tracking-wide text-ter",children:[c.jsx(Xb,{size:12,"aria-hidden":!0}),o("scenario.sectionTitle")]}),c.jsx("div",{className:"flex flex-col gap-2",children:q_.map(S=>{const T=qy[S.id];return c.jsxs("button",{type:"button",onClick:()=>y(S),className:"rounded border bg-1 p-3 text-left transition-colors hover:bg-3",style:{borderColor:"var(--border)"},"data-testid":`scenario-card-${S.id}`,children:[c.jsxs("div",{className:"flex items-center gap-2 text-pri",children:[T.icon,c.jsx("span",{className:"text-sm font-medium",children:o(T.titleKey)})]}),c.jsx("div",{className:"mt-1 text-xs text-ter",children:o(T.descKey)})]},S.id)})}),c.jsx(_o,{open:l!==null,onOpenChange:S=>{S||v()},children:c.jsxs(Ro,{children:[c.jsx(Oo,{className:"app-overlay fixed inset-0 z-[60]"}),c.jsx("div",{className:"pointer-events-none fixed inset-0 z-[70] grid place-items-center p-4",children:c.jsxs(Do,{"data-testid":"scenario-goal-dialog",className:"dialog-scale-pop elev-2 pointer-events-auto w-[480px] max-w-[calc(100vw-32px)] rounded-lg border p-5",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},onEscapeKeyDown:S=>{g&&S.preventDefault()},onPointerDownOutside:S=>{g&&S.preventDefault()},children:[c.jsx(Mo,{className:"text-lg font-semibold text-pri",children:l?o(qy[l.id].titleKey):""}),c.jsx(ti,{className:"mt-1 text-xs text-ter",children:o("scenario.goalHint")}),c.jsxs("label",{className:"mt-4 block",children:[c.jsx("span",{className:"mb-1 block text-xs font-medium text-sec",children:o("scenario.goalLabel")}),c.jsx("textarea",{value:f,onChange:S=>m(S.target.value),rows:5,className:"w-full resize-y rounded border bg-1 p-2 text-sm text-pri outline-none focus:border-[var(--accent)]",style:{borderColor:"var(--border)"},disabled:g,"data-testid":"scenario-goal-input"})]}),c.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[c.jsx("button",{type:"button",className:"icon-btn",onClick:v,disabled:g,"data-testid":"scenario-goal-cancel",children:o("scenario.cancel")}),c.jsx("button",{type:"button",className:"icon-btn icon-btn--primary disabled:cursor-not-allowed disabled:opacity-50",onClick:k,disabled:g||!f.trim(),"data-testid":"scenario-goal-apply",children:o(g?"scenario.applying":"scenario.apply")})]})]})})]})})]})},Zw=({size:t,children:a,color:o,fontRatio:i=.4,ringColor:l=null,ringSurface:u="var(--bg-1)",mono:f=!1,decoration:m,testId:g,data:p,className:y="",style:v={}})=>{const k={};if(p)for(const[S,T]of Object.entries(p))T!==void 0&&(k[`data-${S}`]=T);return c.jsxs("span",{"data-testid":g,...k,className:`relative inline-flex shrink-0 items-center justify-center rounded font-semibold ${f?"mono ":""}${y}`.trim(),style:{width:`${t}px`,height:`${t}px`,fontSize:`${Math.round(t*i)}px`,color:o,background:`color-mix(in oklab, ${o} 14%, transparent)`,border:`1px solid color-mix(in oklab, ${o} 35%, transparent)`,boxShadow:l?`0 0 0 2px ${u}, 0 0 0 4px ${l}`:void 0,...v},"aria-hidden":!0,children:[a,m]})},F_={orchestrator:wm,coder:HS,reviewer:vE,tester:Fl,sentinel:FS,custom:TE},K_={orchestrator:"crown",coder:"code",reviewer:"review",tester:"test",sentinel:"sentinel",custom:"custom"},Y_={orchestrator:"var(--accent)",coder:"var(--status-blue)",reviewer:"var(--status-purple)",tester:"var(--status-orange)",sentinel:"var(--status-green)",custom:"var(--text-secondary)"},$_={working:"var(--status-green)",idle:"var(--text-tertiary)",stopped:"var(--status-red)"},V_=({role:t,size:a=32,statusRing:o="none"})=>{const i=F_[t];return c.jsx(Zw,{size:a,color:Y_[t],ringColor:o==="none"?null:$_[o],ringSurface:"var(--bg-2)",testId:"role-avatar",data:{role:t,icon:K_[t],"status-ring":o},children:c.jsx(i,{size:Math.round(a*.56),"aria-hidden":!0})})},G_={agy:{src:"/cli-icons/agy.png",surface:"#f4f4f4"},claude:{src:"/cli-icons/claude.png",surface:"#f7f5f2"},codex:{src:"/cli-icons/codex.png",surface:"#f4f4f4"},cursor:{src:"/cli-icons/cursor.ico",surface:"#ffffff"},gemini:{src:"/cli-icons/gemini.png",surface:"#f4f4f4"},grok:{src:"/cli-icons/grok.ico",surface:"#ffffff"},hermes:{src:"/cli-icons/hermes.png",surface:"#ffffff"},opencode:{src:"/cli-icons/opencode.svg",surface:"#f4f4f4"},qwen:{src:"/cli-icons/qwen.png",surface:"#f4f8ff"}},X_={working:"var(--status-green)",idle:"var(--text-tertiary)",stopped:"var(--status-red)"},Qw=t=>t?G_[t]??null:null,jM=({commandPresetId:t,fallback:a=null,size:o=20,testId:i="cli-agent-logo"})=>{const l=Qw(t);if(!l)return a;const u=Math.round(o*.78);return c.jsx("span",{"data-testid":i,"data-command-preset":t,className:"inline-flex shrink-0 items-center justify-center overflow-hidden rounded","aria-hidden":!0,style:{width:`${o}px`,height:`${o}px`,background:l.surface,border:"1px solid color-mix(in oklab, var(--text-primary) 12%, transparent)"},children:c.jsx("img",{src:l.src,alt:"",decoding:"sync",width:u,height:u,style:{width:`${u}px`,height:`${u}px`,objectFit:"contain"}})})},Jw=({commandPresetId:t,workerRole:a,size:o=32,statusRing:i="none"})=>{const l=Qw(t);if(!l)return c.jsx(V_,{role:a,size:o,statusRing:i});const u=i==="none"?null:X_[i],f=Math.round(o*.78);return c.jsx("span",{"data-testid":"cli-agent-avatar","data-command-preset":t,"data-status-ring":i,className:"relative inline-flex shrink-0 items-center justify-center overflow-hidden rounded","aria-hidden":!0,style:{width:`${o}px`,height:`${o}px`,background:l.surface,border:"1px solid color-mix(in oklab, var(--text-primary) 12%, transparent)",boxShadow:u?`0 0 0 2px var(--bg-1), 0 0 0 4px ${u}`:void 0},children:c.jsx("img",{src:l.src,alt:"",decoding:"sync",width:f,height:f,style:{width:`${f}px`,height:`${f}px`,objectFit:"contain"}})})},ex=({initialValue:t,saving:a,setSaving:o,onSave:i,onCancel:l,className:u})=>{const f=en(),[m,g]=b.useState(t),p=b.useRef(null),y=b.useRef(!1);b.useEffect(()=>{const T=setTimeout(()=>{p.current?.focus(),p.current?.select()},50);return()=>clearTimeout(T)},[]);const v=async()=>{const T=m.trim();if(!T||T===t){l();return}o(!0);try{const w=await i(T);if(w.error){f.show({kind:"error",message:w.error}),g(t),setTimeout(()=>{p.current?.focus(),p.current?.select()},50),o(!1);return}}catch(w){const E=w instanceof Error?w.message:"Failed to rename worker";f.show({kind:"error",message:E}),g(t),setTimeout(()=>{p.current?.focus(),p.current?.select()},50),o(!1);return}o(!1),l()},k=T=>{T.stopPropagation(),T.key==="Enter"?(T.preventDefault(),v()):T.key==="Escape"&&(T.preventDefault(),y.current=!0,l())},S=()=>{y.current||v()};return c.jsx("input",{ref:p,type:"text",value:m,disabled:a,onChange:T=>g(T.target.value),onKeyDown:k,onBlur:S,maxLength:64,className:u,onClick:T=>T.stopPropagation()})},tx=t=>t.status==="working"?{kind:"working",label:"working",dotClass:"status-dot status-dot--working",tone:"var(--status-green)"}:t.status==="stopped"?{kind:"stopped",label:"stopped",dotClass:"status-dot status-dot--stopped",tone:"var(--status-red)"}:{kind:"idle",label:"idle",dotClass:"status-dot status-dot--idle",tone:"var(--text-tertiary)"},AM=t=>t?{kind:"working",label:"running",dotClass:"status-dot status-dot--working",tone:"var(--status-green)"}:{kind:"stopped",label:"stopped",dotClass:"status-dot status-dot--stopped",tone:"var(--status-red)"},nx={working:"pill--green",idle:"pill--ghost",stopped:"pill--red"},ax=t=>`role.${t}`,ac=t=>t==="working"?"common.running":t==="idle"?"common.idle":"common.stopped",Z_=({hasRun:t,isPending:a=!1,isEditing:o=!1,onRenameWorker:i,onStartEditing:l,onCancelEditing:u,onAction:f,onClick:m,worker:g})=>{const{t:p}=we(),y=wt(),v=tx(g),[k,S]=b.useState(!1),T=_=>N=>{if(N.stopPropagation(),_==="rename"){l?.();return}f?.(_,g)},w=g.ephemeral===!0&&g.spawnedBy==="workflow",E=g.ephemeral===!0&&g.spawnedBy==="orchestrator",C=w?"workflow":E?"orchestrator":null;if(y)return c.jsx(Q_,{ephemeralTone:C,hasRun:t,isPending:a,onAction:f,onClick:m,status:v,worker:g,isEditing:o,onRenameWorker:i,onCancelEditing:u});const j=o?"div":"button";return c.jsxs("div",{className:"worker-card-shell relative","data-status":v.kind,"data-worker-name":g.name,"data-ephemeral":g.ephemeral===!0?"true":void 0,"data-spawned-by":g.spawnedBy??void 0,"data-mobile":y?"true":void 0,children:[c.jsxs(j,{type:o?void 0:"button",onClick:o?void 0:()=>m(g),"aria-label":o?void 0:p("worker.open",{name:g.name}),className:`card worker-card relative flex w-full flex-col gap-3 overflow-hidden p-4 text-left ${o?"":"card--interactive"}`,"data-testid":`worker-card-${g.id}`,"data-status":v.kind,style:C?{borderStyle:"dashed",borderColor:C==="workflow"?"var(--accent)":"var(--border-bright)"}:void 0,children:[c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsx(Jw,{commandPresetId:g.commandPresetId,workerRole:g.role,size:40,statusRing:v.kind}),C?c.jsx("span",{className:"ml-auto rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide",style:{background:C==="workflow"?"color-mix(in oklab, var(--accent) 18%, transparent)":"color-mix(in oklab, var(--text-secondary) 14%, transparent)",color:C==="workflow"?"var(--accent)":"var(--text-secondary)"},"data-testid":"worker-card-ephemeral-badge",title:C==="workflow"?"Spawned by a workflow run — auto-dismissed when its dispatch reports back.":"Spawned by the orchestrator via `team spawn` — auto-dismissed when the orchestrator exits.",children:C==="workflow"?"workflow":"temp"}):null]}),c.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[o?c.jsx(ex,{initialValue:g.name,saving:k,setSaving:S,onSave:_=>i(g,_),onCancel:()=>u?.(),className:"worker-card-name-input"}):c.jsx("span",{className:"truncate text-base font-medium leading-tight text-pri",title:g.name,children:g.name}),c.jsx("span",{className:"worker-card__role-tag truncate leading-none mt-1",children:p(ax(g.role))})]}),c.jsx("div",{className:"flex min-w-0 flex-col gap-1.5",children:c.jsx("div",{className:"flex items-center gap-1.5",children:c.jsxs("span",{className:`pill ${nx[v.kind]} worker-card__status`,role:"status",title:v.kind==="working"?p("worker.workingLegend"):p(ac(v.kind)),children:[c.jsx("span",{className:v.dotClass,"aria-hidden":!0}),p(ac(v.kind))]})})})]}),f?c.jsxs("div",{className:"worker-card__actions",children:[t?y?c.jsxs(c.Fragment,{children:[c.jsx(Os,{title:p("common.stop"),onClick:T("stop"),disabled:a,variant:"danger",testId:`worker-card-stop-${g.id}`,ariaLabel:p("worker.stopAria",{name:g.name}),children:c.jsx(Zb,{size:12,"aria-hidden":!0})}),c.jsx(Os,{title:p("common.restart"),onClick:T("restart"),disabled:a,testId:`worker-card-restart-${g.id}`,ariaLabel:p("worker.restartAria",{name:g.name}),children:c.jsx(Sm,{size:12,"aria-hidden":!0})})]}):null:c.jsx(Os,{title:p("common.start"),onClick:T("start"),disabled:a,variant:"primary",testId:`worker-card-start-${g.id}`,ariaLabel:p("worker.startAria",{name:g.name}),children:c.jsx(jo,{size:12,"aria-hidden":!0})}),c.jsx(Os,{title:p("worker.rename"),onClick:T("rename"),disabled:a||v.kind==="working",testId:`worker-card-rename-${g.id}`,ariaLabel:p("worker.renameAria",{name:g.name}),children:c.jsx(Vb,{size:12,"aria-hidden":!0})}),c.jsx(Os,{title:p("common.delete"),onClick:T("delete"),variant:"danger",testId:`worker-card-delete-${g.id}`,ariaLabel:p("worker.deleteAria",{name:g.name}),children:c.jsx(hc,{size:12,"aria-hidden":!0})})]}):null]})},Os=({ariaLabel:t,children:a,disabled:o,onClick:i,testId:l,title:u,variant:f="default"})=>c.jsx(Qe,{label:u,children:c.jsx("button",{type:"button",onClick:i,disabled:o,"aria-label":t,"data-testid":l,"data-variant":f,className:"worker-card__action",children:a})}),Q_=({ephemeralTone:t,hasRun:a,isPending:o,onAction:i,onClick:l,status:u,worker:f,isEditing:m=!1,onRenameWorker:g,onCancelEditing:p})=>{const{t:y}=we(),[v,k]=b.useState(!1),[S,T]=b.useState(!1),w=b.useRef(!1),E=_=>{_==="rename"&&(w.current=!0),k(!1),i?.(_,f)},C=y(ax(f.role)),j=m?"div":"button";return c.jsxs("div",{className:"worker-card-shell relative","data-status":u.kind,"data-worker-name":f.name,"data-ephemeral":f.ephemeral===!0?"true":void 0,"data-spawned-by":f.spawnedBy??void 0,"data-mobile":"true",children:[c.jsxs(j,{type:m?void 0:"button",onClick:m?void 0:()=>l(f),"aria-label":m?void 0:y("worker.open",{name:f.name}),className:`card worker-card flex w-full items-center gap-3 p-3 pr-12 text-left ${m?"":"card--interactive"}`,"data-testid":`worker-card-${f.id}`,"data-status":u.kind,style:t?{borderStyle:"dashed",borderColor:t==="workflow"?"var(--accent)":"var(--border-bright)"}:void 0,children:[c.jsx(Jw,{commandPresetId:f.commandPresetId,workerRole:f.role,size:40,statusRing:u.kind}),c.jsxs("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[c.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[m?c.jsx(ex,{initialValue:f.name,saving:S,setSaving:T,onSave:_=>g(f,_),onCancel:()=>p?.(),className:"worker-card-name-input flex-1"}):c.jsx("span",{className:"truncate text-sm font-medium text-pri",children:f.name}),t?c.jsx("span",{className:"shrink-0 rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide",style:{background:t==="workflow"?"color-mix(in oklab, var(--accent) 18%, transparent)":"color-mix(in oklab, var(--text-secondary) 14%, transparent)",color:t==="workflow"?"var(--accent)":"var(--text-secondary)"},"data-testid":"worker-card-ephemeral-badge",children:t==="workflow"?"workflow":"temp"}):null]}),c.jsx("span",{className:"truncate text-xs text-ter",children:C})]}),c.jsxs("span",{className:`pill ${nx[u.kind]} worker-card__status shrink-0`,role:"status",children:[c.jsx("span",{className:u.dotClass,"aria-hidden":!0}),y(ac(u.kind))]})]}),i?c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button","aria-label":y("worker.actionsAria",{name:f.name}),"data-testid":`worker-card-menu-${f.id}`,onClick:()=>k(!0),className:"absolute top-1/2 right-1 z-[2] flex h-11 w-11 -translate-y-1/2 items-center justify-center rounded-md text-ter",children:c.jsx(IS,{size:18,"aria-hidden":!0})}),c.jsx(_o,{open:v,onOpenChange:k,children:c.jsxs(Ro,{children:[c.jsx(Oo,{className:"app-overlay fixed inset-0 z-40"}),c.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 grid items-end",children:c.jsxs(Do,{onCloseAutoFocus:_=>{w.current&&(_.preventDefault(),w.current=!1)},"data-testid":`worker-action-sheet-${f.id}`,className:"dialog-slide-up elev-2 pointer-events-auto flex w-full flex-col overflow-hidden rounded-t-xl border-t pb-[max(8px,env(safe-area-inset-bottom))]",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},children:[c.jsxs(Mo,{className:"flex items-center gap-2 border-b px-4 py-3 text-sm font-semibold text-pri",style:{borderColor:"var(--border)"},children:[c.jsx("span",{className:"truncate",children:f.name}),c.jsx("span",{className:"shrink-0 text-xs font-normal text-ter",children:y(ac(u.kind))})]}),c.jsx(ti,{className:"sr-only",children:y("worker.actionsAria",{name:f.name})}),a?c.jsxs(c.Fragment,{children:[c.jsx(Ds,{disabled:o,icon:c.jsx(Zb,{size:16,"aria-hidden":!0}),label:y("common.stop"),onSelect:()=>E("stop"),testId:`worker-card-stop-${f.id}`,danger:!0}),c.jsx(Ds,{disabled:o,icon:c.jsx(Sm,{size:16,"aria-hidden":!0}),label:y("common.restart"),onSelect:()=>E("restart"),testId:`worker-card-restart-${f.id}`})]}):c.jsx(Ds,{disabled:o,icon:c.jsx(jo,{size:16,"aria-hidden":!0}),label:y("common.start"),onSelect:()=>E("start"),testId:`worker-card-start-${f.id}`}),c.jsx(Ds,{disabled:o||u.kind==="working",icon:c.jsx(Vb,{size:16,"aria-hidden":!0}),label:y("worker.rename"),onSelect:()=>E("rename"),testId:`worker-card-rename-${f.id}`}),c.jsx(Ds,{icon:c.jsx(hc,{size:16,"aria-hidden":!0}),label:y("common.delete"),onSelect:()=>E("delete"),testId:`worker-card-delete-${f.id}`,danger:!0})]})})]})})]}):null]})},Ds=({danger:t=!1,disabled:a=!1,icon:o,label:i,onSelect:l,testId:u})=>c.jsxs("button",{type:"button",disabled:a,"data-testid":u,onClick:l,className:"flex min-h-12 w-full items-center gap-3 px-4 text-left text-sm disabled:opacity-50",style:{color:t?"var(--status-red)":"var(--text-primary)"},children:[o,i]}),J_=["working","idle","stopped"],Py=t=>t==="working"?"common.running":t==="idle"?"common.idle":"common.stopped",e3=t=>{const a={idle:[],working:[],stopped:[]};for(const o of t)a[tx(o).kind].push(o);return{sections:J_.filter(o=>a[o].length>0).map(o=>({kind:o,workers:a[o]})),summary:{idle:a.idle.length,stopped:a.stopped.length,working:a.working.length}}},t3=({onAddWorkerClick:t,onDeleteWorker:a,onOpenShellTerminal:o,onOpenWorker:i,onRenameWorker:l,onStopWorker:u,onRestartWorker:f,onStartWorker:m,shellTerminalAvailable:g=!0,startingWorkerId:p,terminalRuns:y,workers:v,workspaceId:k})=>{const{t:S}=we(),{sections:T,summary:w}=b.useMemo(()=>e3(v),[v]),E=b.useMemo(()=>new Map(y.map(L=>[L.agent_id,L.run_id])),[y]),[C,j]=b.useState(null),[_,N]=b.useState(null),O=(L,U)=>{if(L==="start"){m(U);return}if(L==="stop"){const q=E.get(U.id);q&&u?.(q);return}if(L==="restart"){const q=E.get(U.id);q&&f?.(U.id,q);return}if(L==="rename"){N(U.id);return}L==="delete"&&j(U)},M=()=>{C&&(a(C),j(null))};return c.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",style:{background:"var(--bg-2)"},"data-testid":"workers-pane",children:[c.jsxs("div",{className:"flex shrink-0 flex-col gap-1 px-4 pt-3 pb-2.5",style:{boxShadow:"inset 0 -1px 0 var(--border)"},children:[c.jsxs("div",{className:"flex items-center gap-2.5",children:[c.jsx("span",{className:"text-lg font-semibold text-pri",children:S("worker.teamMembers")}),c.jsx("span",{className:"mono inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-3 px-1 text-[11px] font-medium tabular-nums leading-none text-sec",children:v.length}),c.jsx("div",{className:"flex-1"}),g?c.jsxs("button",{type:"button",onClick:o,className:"icon-btn icon-btn--tertiary","aria-label":S("shellTerminal.openAria"),"data-testid":"open-workspace-shell",children:[c.jsx(pc,{size:14,"aria-hidden":!0})," ",S("shellTerminal.open")]}):null,c.jsxs("button",{type:"button",onClick:t,className:"icon-btn icon-btn--primary","data-testid":"add-worker-trigger",children:[c.jsx(ef,{size:14,"aria-hidden":!0})," ",S("addWorker.create")]})]}),v.length>0?c.jsxs("div",{className:"flex items-center gap-3 text-xs text-ter",children:[c.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[c.jsx("span",{className:"status-dot status-dot--working","aria-hidden":!0}),c.jsx("span",{className:"text-sec",children:w.working})," ",S("common.running")]}),c.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[c.jsx("span",{className:"status-dot status-dot--idle","aria-hidden":!0}),c.jsx("span",{className:"text-sec",children:w.idle})," ",S("common.idle")]}),c.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[c.jsx("span",{className:"status-dot status-dot--stopped","aria-hidden":!0}),c.jsx("span",{className:"text-sec",children:w.stopped})," ",S("common.stopped")]})]}):null]}),c.jsx("div",{className:"workers-pane-body scroll-y min-h-0 min-w-0 flex-1 px-2 py-2",children:v.length===0?c.jsxs(c.Fragment,{children:[c.jsx(ri,{icon:c.jsx(ef,{size:28}),title:S("worker.emptyTitle"),description:S("worker.emptyDesc"),action:c.jsxs("button",{type:"button",onClick:t,className:"icon-btn icon-btn--primary","data-testid":"add-worker-empty",children:[c.jsx(ef,{size:14,"aria-hidden":!0})," ",S("worker.emptyAdd")]})}),k?c.jsx(P_,{workspaceId:k}):null]}):c.jsx("div",{"data-testid":"worker-grid",children:T.map(L=>c.jsxs("section",{className:"mb-3 last:mb-0",children:[c.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 text-xs font-medium uppercase tracking-wide text-ter",children:[S(Py(L.kind)),c.jsx("span",{className:"mono inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-full px-1 text-[11px] font-medium tabular-nums leading-none",children:L.workers.length})]}),c.jsx("ul",{"aria-label":`${S(Py(L.kind))} team members`,className:"worker-card-grid",children:L.workers.map(U=>c.jsx("li",{children:c.jsx(Z_,{hasRun:E.has(U.id),isPending:p===U.id,isEditing:_===U.id,onRenameWorker:async(q,ae)=>v.some(F=>F.id!==q.id&&F.name.toLowerCase()===ae.toLowerCase())?{error:S("addWorker.agentExists")}:l(q,ae),onStartEditing:()=>N(U.id),onCancelEditing:()=>N(null),onAction:O,onClick:i,worker:U})},U.id))})]},L.kind))})}),c.jsx(oi,{open:C!==null,onOpenChange:L=>{L||j(null)},title:C?S("worker.deleteConfirm",{name:C.name}):"",description:C?S("worker.deleteDescription",{name:C.name}):"",confirmLabel:S("worker.deleteMember"),confirmKind:"danger",onConfirm:M})]})},n3=b.lazy(()=>Nt(()=>import("./AddWorkerDialog-Cd53ifv2.js"),__vite__mapDeps([2,3,4])).then(t=>({default:t.AddWorkerDialog}))),a3=b.lazy(()=>Nt(()=>import("./WorkerModal-BzgrOKzF.js"),[]).then(t=>({default:t.WorkerModal}))),r3=({activeWorkerId:t,onCreateWorker:a,onDeleteWorker:o,onDeleteWorkspace:i,onStartWorker:l,onStopWorker:u,onRestartWorker:f,onOrchestratorResult:m,onRequestAddWorkspace:g,onShellRunClosed:p,onShellRunStarted:y,onTryDemo:v,welcomeDisabledReason:k,orchestratorAutostartError:S,orchestratorAutostartRunId:T,terminalRuns:w,workers:E,workspace:C,onActiveWorkerChange:j,showInlineActionCenter:_=!0})=>{const{t:N}=we(),O=wt(),[M,L]=b.useState(null),U=t===void 0?M:t,q=b.useCallback(Ee=>{j?j(Ee):L(Ee)},[j]),[ae,ee]=b.useState(!1),[F,J]=b.useState("orchestrator"),X=Bw();b.useEffect(()=>()=>Hw(!1),[]);const[$,D]=b.useState(null),[P,I]=b.useState(null),[V,Z]=b.useState(null),[R,B]=b.useState(!1),re=en(),ne=R_({createWorker:a,open:ae,workers:E}),de=k_({workspaceId:C?.id??"",terminalRuns:w,autostartError:S,suppressAutostartRunId:T,onClearAutostartError:()=>{C&&m(C.id,{ok:!0,error:null,run_id:null})},onAfterStart:Ee=>{C&&m(C.id,Ee)}}),fe=f_(),ue=E.find(Ee=>Ee.id===U)??null;b.useEffect(()=>{U&&!ue&&q(null)},[U,ue,q]);const ie=t_({workspaceId:C?.id??"",workers:E,terminalRuns:w}),le=ie.tabs.filter(Ee=>Ee.kind==="shell"),ce=C?w.filter(Ee=>wc(Ee,C.id)):[],{closeShellTab:me,openShell:Te,shellError:Ne,shellStarting:Se,startNewShell:rt}=u_({onCloseFailed:Ee=>re.show({kind:"error",message:N("shellTerminal.closeFailed",{message:Ee})}),onShellRunClosed:p,onShellRunStarted:y,panelTabs:ie,shellRuns:ce,workspaceId:C?.id??null});if(b.useEffect(()=>{ne.createWorkerError&&re.show({kind:"error",message:ne.createWorkerError})},[ne.createWorkerError,re]),b.useEffect(()=>{$&&re.show({kind:"error",message:$})},[$,re]),b.useEffect(()=>{P&&re.show({kind:"error",message:P})},[P,re]),b.useEffect(()=>{Ne&&re.show({kind:"error",message:Ne})},[Ne,re]),b.useEffect(()=>{q(null),D(null),I(null),Z(null),B(!1),J("orchestrator")},[C?.id,q]),!C){const Ee={onAddWorkspace:g};return v&&(Ee.onTryDemo=v),k&&(Ee.disabledReason=k),c.jsx(D_,{...Ee})}const xt=ue?c_(w,ue.id):void 0,Wt=Ee=>{D(null),o(Ee.id).then(()=>q(null)).catch(Be=>{D(Be instanceof Error?Be.message:String(Be))})},pn=Ee=>{I(null),Z(Ee.id),l(Ee.id).then(({error:Be})=>{Be&&I(Be)}).catch(Be=>{I(Be instanceof Error?Be.message:String(Be))}).finally(()=>Z(null))},hn=Ee=>{u(Ee).then(({error:Be})=>{Be&&re.show({kind:"error",message:Be})})},Nn=(Ee,Be)=>{I(null),Z(Ee),f(Ee,Be).then(({error:ft})=>{ft&&I(ft)}).catch(ft=>{I(ft instanceof Error?ft.message:String(ft))}).finally(()=>Z(null))},tn=async(Ee,Be)=>{try{return await iN(C.id,Ee.id,Be),re.show({kind:"success",message:N("worker.renameSuccess",{name:Be})}),{error:null}}catch(ft){const Za=ft instanceof Error?ft.message:String(ft);return re.show({kind:"error",message:N("worker.renameFailed",{message:Za})}),{error:Za}}},ke=`${(fe.orchPct*100).toFixed(2)}%`,pe=()=>{B(!1),Te()},Oe=()=>{B(!1),rt()},Xa=c.jsx(x_,{state:de.state,onRemoveWorkspace:()=>{i(C).catch(Ee=>{const Be=Ee instanceof Error?Ee.message:String(Ee);re.show({kind:"error",message:`Delete failed: ${Be}`})})},onStart:de.start,onRestart:de.restart}),Ho=c.jsxs("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:[c.jsx(t3,{onAddWorkerClick:()=>ee(!0),onDeleteWorker:Wt,onOpenShellTerminal:pe,onOpenWorker:Ee=>q(Ee.id),onRenameWorker:tn,onStartWorker:pn,onStopWorker:hn,onRestartWorker:Nn,startingWorkerId:V,terminalRuns:w,workers:E,workspaceId:C.id}),R?null:c.jsx(ZA,{tabs:le,activeId:ie.activeId,scopeKey:C.id,onSelect:ie.setActive,onClose:Ee=>{Ee.startsWith("shell:")&&me(Ee.slice(6)),ie.closeTab(Ee)},onClosePanel:()=>B(!0),onNewShell:Oe,newShellPending:Se,onStartWorker:Ee=>{const Be=E.find(ft=>ft.id===Ee);Be&&pn(Be)},startingWorkerId:V})]});return c.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",style:{background:"var(--bg-2)"},children:[c.jsx(PA,{terminalRuns:w,workers:E,workspace:C}),_?c.jsx(OA,{workspaceId:C.id,onOpenWorker:q},C.id):null,O?c.jsxs("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden","data-mobile":"true","data-testid":"workspace-detail-panes",children:[c.jsxs("div",{role:"tablist","aria-label":N("mobile.nav.team"),className:"flex shrink-0 items-center gap-1 border-b p-2",style:{borderColor:"var(--border)"},children:[["orchestrator","workers"].map(Ee=>{const Be=F===Ee,ft=`mobile-team-tab-${Ee}`,Za=`mobile-team-panel-${Ee}`;return c.jsxs("button",{id:ft,type:"button",role:"tab","aria-selected":Be,"aria-controls":Za,tabIndex:Be?0:-1,"data-active":Be||void 0,"data-testid":ft,onClick:()=>J(Ee),className:"flex min-h-11 flex-1 items-center justify-center gap-1.5 rounded-md text-sm font-medium",style:Be?{background:"var(--accent)",color:"var(--bg-0)"}:{background:"var(--bg-3)",color:"var(--text-secondary)"},children:[c.jsx("span",{children:N(Ee==="orchestrator"?"mobile.team.orchestrator":"mobile.team.workers")}),Ee==="workers"&&E.length>0?c.jsx("span",{className:"inline-flex items-center justify-center rounded-full min-w-[18px] h-[18px] px-1 text-[11px] font-medium tabular-nums leading-none",style:Be?{background:"var(--bg-0)",color:"var(--accent)"}:{background:"var(--bg-1)",color:"var(--text-secondary)"},children:E.length}):null]},Ee)}),c.jsx("button",{type:"button",onClick:MA,"aria-pressed":X,"aria-label":N(X?"mobile.focus.exit":"mobile.focus.enter"),"data-testid":"mobile-focus-toggle",className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-md",style:{background:"var(--bg-3)",color:"var(--text-secondary)"},children:X?c.jsx(iE,{size:16,"aria-hidden":!0}):c.jsx(oE,{size:16,"aria-hidden":!0})})]}),c.jsxs("div",{className:"relative min-h-0 min-w-0 flex-1 overflow-hidden","data-testid":"mobile-team-panel",children:[c.jsx("div",{id:"mobile-team-panel-orchestrator",role:"tabpanel","aria-labelledby":"mobile-team-tab-orchestrator","aria-hidden":F!=="orchestrator",className:"mobile-team-pane flex min-h-0 min-w-0 flex-col","data-active":F==="orchestrator"?"true":"false",children:Xa}),c.jsx("div",{id:"mobile-team-panel-workers",role:"tabpanel","aria-labelledby":"mobile-team-tab-workers","aria-hidden":F!=="workers",className:"mobile-team-pane flex min-h-0 min-w-0 flex-col","data-active":F==="workers"?"true":"false",children:Ho})]})]}):c.jsxs("div",{ref:fe.containerRef,className:"relative flex min-h-0 min-w-0 flex-1 overflow-hidden","data-testid":"workspace-detail-panes",children:[c.jsx("div",{className:"flex min-w-[480px] shrink-0 flex-col overflow-hidden",style:{width:ke},"data-testid":"orchestrator-pane-shell",children:Xa}),c.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":N("workerPane.resize"),"aria-valuenow":Math.round(fe.orchPct*100),"aria-valuemin":30,"aria-valuemax":78,tabIndex:0,className:"pane-splitter",style:{left:`calc(${ke} - 4px)`},"data-dragging":fe.dragging||void 0,"data-testid":"pane-splitter",onPointerDown:fe.beginDrag,onKeyDown:fe.onKeyDown}),Ho]}),ue?c.jsx(b.Suspense,{fallback:null,children:c.jsx(a3,{onClose:()=>q(null),onStart:pn,runId:xt?.run_id??null,startError:P,starting:V===ue.id,worker:ue})}):null,ae?c.jsx(b.Suspense,{fallback:null,children:c.jsx(n3,{commandPresets:ne.commandPresets,commandPresetId:ne.commandPresetId,creating:ne.creating,customTemplates:ne.customTemplates,onApplyMarketplaceImport:ne.applyMarketplaceImport,onClose:()=>ee(!1),onDeleteTemplate:ne.deleteTemplate,onNameChange:ne.setWorkerName,onPresetChange:ne.setCommandPresetId,onRandomName:ne.randomizeWorkerName,onRoleDescriptionChange:ne.setRoleDescription,onRoleDescriptionReset:ne.resetRoleDescription,onRoleChange:ne.setWorkerRole,onSaveAsTemplate:ne.saveAsTemplate,onSubmit:Ee=>ne.submit(Ee,()=>ee(!1)),onStartupCommandChange:ne.setStartupCommand,onTemplateChange:ne.selectTemplate,roleDescription:ne.roleDescription,roleDescriptionDefault:ne.roleDescriptionDefault,selectedTemplateId:ne.selectedTemplateId,startupCommand:ne.startupCommand,templateBusy:ne.templateBusy,workerName:ne.workerName,workerRole:ne.workerRole})}):null]})},o3=({activeId:t,activeWorkspace:a,activeWorkerId:o,bootstrapError:i,demoMode:l,onActiveWorkerChange:u,onDeleteWorkspace:f,onExitDemo:m,onRequestAddWorkspace:g,onShellRunClosed:p,onShellRunStarted:y,onTryDemo:v,orchestratorAutostartErrors:k,orchestratorAutostartRunIds:S,recordOrchestratorResult:T,terminalRuns:w,workerActions:E,workers:C,workspacesLoading:j,showInlineActionCenter:_})=>l?c.jsx(JE,{onExit:m}):j&&!a?c.jsx("div",{className:"flex flex-1 items-center justify-center",children:c.jsx(Fa,{size:24,className:"animate-spin text-ter"})}):c.jsx(r3,{activeWorkerId:o,onCreateWorker:E.createWorker,onDeleteWorker:E.deleteWorker,onDeleteWorkspace:f,onStartWorker:E.startWorker,onStopWorker:E.stopWorkerRun,onRestartWorker:E.restartWorkerRun,onOrchestratorResult:T,onRequestAddWorkspace:g,onShellRunClosed:p,onShellRunStarted:y,onTryDemo:v,onActiveWorkerChange:u,welcomeDisabledReason:i??void 0,orchestratorAutostartError:t?k[t]??null:null,orchestratorAutostartRunId:t?S[t]??null:null,terminalRuns:w,workers:C,workspace:a,showInlineActionCenter:_}),Ol={id:"demo-workspace",name:"demo-todo-app",path:"/Users/you/demo-todo-app"},s3=[{id:"demo-coder",name:"ada-lovelace",role:"coder",status:"working",pendingTaskCount:1,lastPtyLine:"Editing src/routes/todos.ts (line 42)",commandPresetId:"claude"},{id:"demo-reviewer",name:"socrates",role:"reviewer",status:"idle",pendingTaskCount:0,commandPresetId:"gemini"}],i3=`# Todo app
74
+
75
+ - [x] Set up Express server
76
+ - [x] Add /todos GET endpoint
77
+ - [ ] Add /todos POST endpoint
78
+ - [ ] Write Vitest for both endpoints
79
+ - [ ] Wire up SQLite for persistence
80
+ `,l3=()=>{const[t,a]=b.useState(!1);return{demoMode:t,enableDemo:()=>a(!0),exitDemo:()=>a(!1)}},c3=t=>{const{demoMode:a,workspaces:o,activeWorkspaceId:i,workersByWorkspaceId:l}=t,u=a?[Ol]:o,f=a?{[Ol.id]:s3}:l,m=a?Ol.id:i,g=a?Ol:o?.find(y=>y.id===i);return{effectiveActiveWorkspaceId:m,effectiveWorkspaces:u,effectiveWorkersByWorkspaceId:f,effectiveActiveWorkspace:g,pollWorkspaceId:a?null:i}},u3=[{accent:"var(--status-green)",descriptionKey:"notifications.sound.soft.description",labelKey:"notifications.sound.soft.label",length:"short",value:"soft"},{accent:"var(--status-blue)",descriptionKey:"notifications.sound.ping.description",labelKey:"notifications.sound.ping.label",length:"short",value:"ping"},{accent:"var(--status-gold)",descriptionKey:"notifications.sound.chime.description",labelKey:"notifications.sound.chime.label",length:"short",value:"chime"},{accent:"var(--accent)",descriptionKey:"notifications.sound.cascade.description",labelKey:"notifications.sound.cascade.label",length:"long",value:"cascade"},{accent:"var(--status-orange)",descriptionKey:"notifications.sound.beacon.description",labelKey:"notifications.sound.beacon.label",length:"long",value:"beacon"},{accent:"var(--status-purple)",descriptionKey:"notifications.sound.resolve.description",labelKey:"notifications.sound.resolve.label",length:"long",value:"resolve"},{accent:"var(--text-tertiary)",descriptionKey:"notifications.sound.off.description",labelKey:"notifications.sound.off.label",length:"silent",value:"off"}],d3=[{descriptionKey:"notifications.detail.brief.description",labelKey:"notifications.detail.brief.label",value:"brief"},{descriptionKey:"notifications.detail.detailed.description",labelKey:"notifications.detail.detailed.label",value:"detailed"}],f3=()=>{const{t}=we(),a=wt(),[o,i]=b.useState(!1),l=b.useRef(null),u=b.useRef(null),{notify:f,previewSound:m,requestDesktopNotifications:g,settings:p,updateSettings:y}=jc(),v=typeof window<"u"&&!("Notification"in window),k=b.useMemo(()=>u3.map(w=>({...w,description:t(w.descriptionKey),label:t(w.labelKey)})),[t]),S=b.useMemo(()=>d3.map(w=>({...w,description:t(w.descriptionKey),label:t(w.labelKey)})),[t]),T=w=>{if(!w){y({desktop:!1});return}g()};return b.useEffect(()=>{if(!o)return;const w=C=>{C.key==="Escape"&&(i(!1),u.current?.focus())},E=C=>{const j=l.current;j&&!j.contains(C.target)&&i(!1)};return document.addEventListener("keydown",w),document.addEventListener("pointerdown",E),()=>{document.removeEventListener("keydown",w),document.removeEventListener("pointerdown",E)}},[o]),c.jsxs("div",{ref:l,className:"relative",children:[c.jsx(Qe,{label:t("notifications.settings.tooltip"),children:c.jsx("button",{ref:u,type:"button","aria-expanded":o,"aria-haspopup":"dialog","aria-label":t("notifications.settings.aria"),className:"flex h-7 w-7 max-md:min-w-11 cursor-pointer items-center justify-center rounded text-sec hover:bg-3 hover:text-pri","data-testid":"topbar-settings",onClick:()=>i(w=>!w),children:c.jsx(Wf,{size:14,"aria-hidden":!0})})}),o?c.jsxs("div",{role:"dialog","aria-modal":a?"true":void 0,"aria-label":t("notifications.settings.aria"),className:a?"fixed inset-0 z-50 flex flex-col overflow-y-auto":"elev-2 absolute top-8 right-0 z-50 w-[380px] rounded border p-3",style:a?{background:"var(--bg-0)"}:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},"data-testid":"notification-settings",children:[c.jsxs("div",{className:a?"flex shrink-0 items-center gap-2 border-b px-4 py-3":"mb-3 flex items-start gap-2",style:a?{borderColor:"var(--border)"}:void 0,children:[c.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded bg-3 text-sec",children:c.jsx(Wf,{size:16,"aria-hidden":!0})}),c.jsxs("div",{className:a?"min-w-0 flex-1":"min-w-0",children:[c.jsx("div",{className:"text-sm font-semibold text-pri",children:t("notifications.settings.heading")}),a?null:c.jsx("div",{className:"text-ter text-xs",children:t("notifications.settings.subtitle")})]}),a?c.jsx("button",{type:"button","aria-label":t("common.close"),className:"flex h-11 w-11 shrink-0 items-center justify-center rounded text-sec hover:bg-3 hover:text-pri",onClick:()=>i(!1),children:c.jsx(Ka,{size:20,"aria-hidden":!0})}):null]}),c.jsxs("div",{className:a?"flex-1 overflow-y-auto p-4":"contents",children:[c.jsxs("section",{className:"mb-3",children:[c.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-ter text-xs uppercase tracking-wider",children:[c.jsx(Yl,{size:12,"aria-hidden":!0}),t("notifications.sound.sectionLabel")]}),c.jsx("div",{role:"radiogroup","aria-label":t("notifications.sound.sectionLabel"),className:a?"grid grid-cols-1 gap-2":"grid grid-cols-2 gap-2",children:k.map(w=>c.jsxs("div",{className:"relative min-h-[78px] rounded border transition-colors",style:{background:p.sound===w.value?`color-mix(in oklab, ${w.accent} 10%, var(--bg-2))`:"var(--bg-2)",borderColor:p.sound===w.value?`color-mix(in oklab, ${w.accent} 54%, var(--border-bright))`:"var(--border)"},children:[c.jsxs("label",{className:"block h-full w-full cursor-pointer rounded px-3 py-2 pr-10 text-left transition-colors hover:bg-3 focus-within:outline-none focus-within:ring-2 focus-within:ring-[var(--ring-focus)]",children:[c.jsx("input",{type:"radio",name:"notification-sound",value:w.value,checked:p.sound===w.value,className:"sr-only",onChange:()=>y({sound:w.value})}),c.jsxs("span",{className:"mb-1 flex items-center gap-2",children:[c.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded",style:{background:`color-mix(in oklab, ${w.accent} 16%, transparent)`,color:w.accent},children:w.value==="off"?c.jsx(Qb,{size:12,"aria-hidden":!0}):c.jsx(Yl,{size:12,"aria-hidden":!0})}),c.jsx("span",{className:"font-medium text-pri text-xs",children:w.label}),w.length==="long"?c.jsx("span",{className:"rounded border border-[var(--border-bright)] px-1.5 py-0.5 text-xs text-ter uppercase",children:t("notifications.sound.longerBadge")}):null,p.sound===w.value?c.jsx(Ga,{size:12,className:"ml-auto text-pri","aria-hidden":!0}):null]}),c.jsx("span",{className:"block text-ter text-xs",children:w.description})]}),w.value!=="off"?c.jsx("button",{type:"button","aria-label":t("notifications.sound.previewAria",{label:w.label}),className:"absolute right-2 bottom-2 flex h-6 w-6 pointer-coarse:h-10 pointer-coarse:w-10 items-center justify-center rounded border text-sec transition-colors hover:bg-3 hover:text-pri",style:{borderColor:"var(--border-bright)"},onClick:()=>m(w.value),children:c.jsx(jo,{size:12,"aria-hidden":!0})}):null]},w.value))})]}),c.jsxs("section",{className:"mb-3",children:[c.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-ter text-xs uppercase tracking-wider",children:[c.jsx(Yb,{size:12,"aria-hidden":!0}),t("notifications.detail.sectionLabel")]}),c.jsx("div",{role:"radiogroup","aria-label":t("notifications.detail.sectionLabel"),className:"grid grid-cols-2 rounded border p-1",style:{background:"var(--bg-1)",borderColor:"var(--border)"},children:S.map(w=>c.jsxs("label",{className:"cursor-pointer rounded px-3 py-2 text-left transition-colors hover:bg-3 focus-within:outline-none focus-within:ring-2 focus-within:ring-[var(--ring-focus)]",style:{background:p.detail===w.value?"var(--bg-3)":"transparent",color:p.detail===w.value?"var(--text-primary)":"var(--text-secondary)"},children:[c.jsx("input",{type:"radio",name:"notification-detail",value:w.value,checked:p.detail===w.value,className:"sr-only",onChange:()=>y({detail:w.value})}),c.jsx("span",{className:"block font-medium text-xs",children:w.label}),c.jsx("span",{className:"block text-ter text-xs",children:w.description})]},w.value))})]}),c.jsxs("label",{className:"mb-3 flex items-start gap-2 rounded border p-2 text-sec text-xs",children:[c.jsx("input",{type:"checkbox","aria-label":t("notifications.desktop.aria"),checked:p.desktop,disabled:v,className:"mt-0.5",onChange:w=>T(w.currentTarget.checked)}),c.jsxs("span",{children:[c.jsx("span",{className:"block font-medium text-pri",children:t("notifications.desktop.label")}),c.jsx("span",{className:"text-ter",children:t(v?"notifications.desktop.unsupported":"notifications.desktop.helper")})]})]}),c.jsxs("div",{className:"flex justify-end gap-2 border-t pt-3",style:{borderColor:"var(--border)"},children:[c.jsx("button",{type:"button",className:"icon-btn",onClick:()=>i(!1),children:t("common.close")}),c.jsx("button",{type:"button",className:"icon-btn icon-btn--primary",onClick:()=>f({brief:t("notifications.test.brief"),detail:t("notifications.test.detail"),kind:"success",title:t("notifications.test.title")}),children:t("notifications.test.button")})]})]})]}):null]})},rx=({checked:t,disabled:a,onChange:o,...i})=>c.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-label":i["aria-label"],disabled:a,className:"settings-switch","data-checked":t||void 0,"data-testid":i["data-testid"],onClick:l=>{l.stopPropagation(),o(!t)},children:c.jsx("span",{className:"settings-switch__thumb"})}),m3=t=>Math.max(0,Math.ceil((t-Date.now())/1e3)),p3=()=>{const{t}=we(),[a,o]=b.useState(null),[i,l]=b.useState(!1),[u,f]=b.useState(!1),[m,g]=b.useState(()=>Date.now());b.useEffect(()=>{if(!a)return;const k=window.setInterval(()=>g(Date.now()),1e3);return()=>window.clearInterval(k)},[a]);const p=async()=>{f(!1),l(!0);try{const k=await kN();o(k),g(Date.now())}catch{f(!0)}finally{l(!1)}};if(!a)return c.jsxs("div",{className:"p-1.5",children:[c.jsxs("button",{type:"button","data-testid":"settings-remote-add-device",onClick:()=>{p()},disabled:i,className:"icon-btn icon-btn--primary flex items-center gap-1.5",children:[c.jsx(Gb,{size:14,"aria-hidden":!0}),t("remote.addDevice")]}),u?c.jsx("div",{className:"mt-1 text-xs",style:{color:"var(--text-error)"},role:"alert",children:t("remote.qr.startFailed")}):null]});const y=m3(a.expiresAt),v=y<=0||m>=a.expiresAt;return c.jsxs("div",{className:"p-1.5","data-testid":"remote-qr-panel",children:[c.jsx("div",{className:"text-sm font-medium text-pri",children:t("remote.qr.title")}),c.jsx("p",{className:"mt-0.5 mb-2 text-xs text-ter",children:t("remote.qr.instructions")}),c.jsxs("div",{className:"flex flex-col items-center gap-2",children:[v?c.jsx("div",{className:"text-xs",style:{color:"var(--text-error)"},"data-testid":"remote-qr-expired",children:t("remote.qr.expired")}):c.jsxs(c.Fragment,{children:[c.jsx("div",{"data-testid":"remote-pair-code",className:"mono rounded-lg border px-4 py-3 text-center text-2xl font-semibold tracking-[0.18em] text-pri",style:{borderColor:"var(--border)"},children:a.code}),c.jsx("div",{className:"text-xs text-ter","data-testid":"remote-qr-countdown",children:t("remote.qr.expiresIn",{seconds:y})})]}),c.jsxs("div",{className:"flex gap-2",children:[v?c.jsx("button",{type:"button","data-testid":"remote-qr-regenerate",onClick:()=>{p()},disabled:i,className:"icon-btn icon-btn--primary",children:t("remote.qr.regenerate")}):null,c.jsx("button",{type:"button","data-testid":"remote-qr-cancel",onClick:()=>o(null),className:"icon-btn",children:t("remote.qr.cancel")})]})]})]})},h3={ok:"remote.audit.result.ok",rejected:"remote.audit.result.rejected",error:"remote.audit.result.error"},g3=t=>{const a=Math.max(0,Date.now()-t),o=Math.floor(a/1e3);if(o<60)return"<1m";const i=Math.floor(o/60);if(i<60)return`${i}m`;const l=Math.floor(i/60);return l<24?`${l}h`:`${Math.floor(l/24)}d`},v3=()=>{const{t}=we(),[a,o]=b.useState(!1),[i,l]=b.useState(null),[u,f]=b.useState(!1),m=b.useCallback(async()=>{f(!1);try{l(await TN(100))}catch{f(!0)}},[]);return b.useEffect(()=>{a&&m()},[a,m]),c.jsxs("div",{className:"mt-2","data-testid":"remote-audit-view",children:[c.jsxs("button",{type:"button","data-testid":"remote-audit-toggle",onClick:()=>o(g=>!g),className:"flex w-full items-center gap-1.5 rounded px-2 py-1.5 text-xs font-medium text-sec transition-colors hover:bg-3 hover:text-pri","aria-expanded":a,children:[c.jsx(fc,{size:12,"aria-hidden":!0,className:"shrink-0"}),c.jsx("span",{className:"flex-1 text-left",children:t(a?"remote.audit.hide":"remote.audit.show")}),a?c.jsx(No,{size:12,"aria-hidden":!0,className:"shrink-0 text-ter"}):c.jsx(mc,{size:12,"aria-hidden":!0,className:"shrink-0 text-ter"})]}),a?c.jsx("div",{className:"mt-1.5",children:u?c.jsx("div",{className:"rounded px-2 py-2 text-xs",style:{color:"var(--text-error)",background:"color-mix(in oklab, var(--status-red) 8%, transparent)"},role:"alert",children:t("remote.audit.loadFailed")}):!i||i.length===0?c.jsx("div",{className:"px-2 py-2 text-xs text-ter",children:t("remote.audit.empty")}):c.jsx("ul",{className:"scroll-y flex max-h-[160px] flex-col gap-px rounded border",style:{borderColor:"var(--border)",background:"var(--bg-0)"},children:i.map(g=>{const p=g.result!=="ok";return c.jsxs("li",{className:"flex items-center gap-2 px-2.5 py-1.5 text-xs","data-testid":`remote-audit-row-${g.id}`,style:p?{background:"color-mix(in oklab, var(--status-red) 6%, transparent)"}:void 0,children:[c.jsx("span",{className:"inline-block h-1.5 w-1.5 shrink-0 rounded-full",style:{background:p?"var(--status-red)":"var(--status-green)"},"aria-hidden":!0}),c.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[c.jsx("span",{className:"font-medium text-pri",children:g.action}),g.endpoint?c.jsx("span",{className:"ml-1 text-ter",children:g.endpoint}):null,g.preview?c.jsxs("span",{className:"ml-1 text-ter",children:["· ",g.preview]}):null,typeof g.byteCount=="number"?c.jsxs("span",{className:"ml-1 text-ter",children:["· ",t("remote.audit.bytes",{count:g.byteCount})]}):null]}),p?c.jsxs("span",{className:"shrink-0 rounded px-1.5 py-0.5 text-[10px] font-medium",style:{color:"color-mix(in oklab, var(--status-red) 55%, white)",background:"color-mix(in oklab, var(--status-red) 14%, transparent)"},children:[t(h3[g.result]),g.rejectReason?` · ${g.rejectReason}`:""]}):null,c.jsx("span",{className:"shrink-0 tabular-nums text-ter",children:g3(g.ts)})]},g.id)})})}):null]})},Fy=t=>{const a=Math.max(0,Date.now()-t),o=Math.floor(a/6e4);if(o<1)return"<1m";if(o<60)return`${o}m`;const i=Math.floor(o/60);return i<24?`${i}h`:`${Math.floor(i/24)}d`},y3=({reloadKey:t=0})=>{const{t:a}=we(),o=en(),[i,l]=b.useState(null),[u,f]=b.useState(!1),[m,g]=b.useState(null),p=b.useCallback(async()=>{f(!1);try{const k=await $0();l(k)}catch{f(!0)}},[]);b.useEffect(()=>{p()},[p,t]);const y=async k=>{try{await CN(k.deviceId),o.show({kind:"success",message:a("remote.devices.revoked",{name:k.name})}),await p()}catch{o.show({kind:"error",message:a("remote.devices.revokeFailed")})}},v=(i??[]).filter(k=>!k.revoked);return c.jsxs("div",{className:"p-1.5","data-testid":"remote-device-list",children:[c.jsx("div",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-ter",children:a("remote.devices.heading")}),u?c.jsx("div",{className:"text-xs",style:{color:"var(--text-error)"},role:"alert",children:a("remote.devices.loadFailed")}):v.length===0?c.jsx("div",{className:"text-xs text-ter",children:a("remote.devices.empty")}):c.jsx("ul",{className:"flex flex-col gap-1",children:v.map(k=>c.jsxs("li",{className:"flex items-center justify-between gap-2 rounded p-1.5 hover:bg-3","data-testid":`remote-device-${k.deviceId}`,children:[c.jsxs("span",{className:"min-w-0",children:[c.jsx("span",{className:"block truncate text-sm text-pri",children:k.name}),c.jsx("span",{className:"block text-xs text-ter",children:k.lastActive===null?a("remote.devices.neverActive"):Fy(k.lastActive)==="<1m"?a("remote.devices.activeNow"):a("remote.devices.lastActive",{ago:Fy(k.lastActive)})})]}),c.jsx("button",{type:"button","data-testid":`remote-device-revoke-${k.deviceId}`,"aria-label":a("remote.devices.revokeAria",{name:k.name}),onClick:()=>g(k),className:"icon-btn icon-btn--danger shrink-0",children:a("remote.devices.revoke")})]},k.deviceId))}),c.jsx(oi,{open:m!==null,onOpenChange:k=>{k||g(null)},title:a("remote.devices.revokeTitle"),description:m?a("remote.devices.revokeConfirm",{name:m.name}):"",confirmLabel:a("remote.devices.revoke"),confirmKind:"danger",onConfirm:()=>{m&&y(m)}})]})},b3=2e3,Qf={enabled:!1,loggedIn:!1,gatewayUrl:null,connected:!1,connection:"disabled"},ox=b.createContext({status:Qf,loading:!0,setEnabled:async()=>{},pending:null,refresh:async()=>{}}),w3=({children:t})=>{const a=wt(),[o,i]=b.useState(Qf),[l,u]=b.useState(!0),[f,m]=b.useState(null);b.useEffect(()=>{let v=!1;return df().then(k=>{v||i(k)}).catch(()=>{}).finally(()=>{v||u(!1)}),()=>{v=!0}},[]);const g=b.useCallback(async v=>{const k=await xN(v);i(k),k.enabled||m(null)},[]),p=b.useCallback(async()=>{const v=await df().catch(()=>Qf);i(v),v.enabled&&v.loggedIn&&!a?m(await ky().catch(()=>null)):m(null)},[a]),y=o.enabled&&o.loggedIn&&!a;return b.useEffect(()=>{if(!y){m(null);return}let v=!1;const k=()=>{df().then(T=>{v||i(T)}).catch(()=>{}),ky().then(T=>{v||m(T)}).catch(()=>{})};k();const S=window.setInterval(k,b3);return()=>{v=!0,window.clearInterval(S)}},[y]),c.jsx(ox.Provider,{value:{status:o,loading:l,setEnabled:g,pending:f,refresh:p},children:t})},Pm=()=>b.useContext(ox),x3={online:"var(--status-green)",connecting:"var(--status-amber, #d29922)",reconnecting:"var(--status-amber, #d29922)",revoked:"var(--status-red, #f85149)",loggedOut:"var(--text-ter)",disabled:"var(--text-ter)"},k3={connecting:"remote.status.connecting",reconnecting:"remote.status.reconnecting",revoked:"remote.status.revoked"},S3=()=>{const{t}=we(),a=en(),o=wt(),{status:i,loading:l,setEnabled:u,pending:f}=Pm(),m=x3[i.connection],g=k3[i.connection],[p,y]=b.useState(!1),[v,k]=b.useState(!1),[S,T]=b.useState(!1),[w,E]=b.useState(!1),[C,j]=b.useState(!1),[_,N]=b.useState(null),[O,M]=b.useState(!1),L=b.useRef(null),[U,q]=b.useState(0),ae=b.useRef(!1);b.useEffect(()=>{f?ae.current=!0:ae.current&&(ae.current=!1,q(I=>I+1))},[f]),b.useEffect(()=>()=>{L.current&&clearTimeout(L.current)},[]),b.useEffect(()=>{let I=!1;return ON().then(V=>{I||(N(V),M(!1))}).catch(()=>{I||M(!0)}),()=>{I=!0}},[]);const ee=async I=>{k(!1),y(!0);try{await u(I)}catch{k(!0)}finally{y(!1)}},F=I=>{if(!I&&o){T(!0);return}ee(I)},J=async()=>{if(!w){E(!0);try{const I=RN().then(V=>JSON.stringify(V,null,2));await G0(I),j(!0),L.current&&clearTimeout(L.current),L.current=setTimeout(()=>{j(!1),L.current=null},1200),a.show({kind:"success",message:t("remote.diagnostics.copied")})}catch{a.show({kind:"error",message:t("remote.diagnostics.copyFailed")})}finally{E(!1)}}},X=_?.current_streak_days??0,$=_?.days_active_total??0,D=_?.totals?.send??0,P=_?.totals?.report??0;return c.jsxs("div",{className:"settings-section","data-testid":"remote-access-section",children:[c.jsxs("div",{className:"settings-section__heading",children:[c.jsx(Gb,{size:12,"aria-hidden":!0}),c.jsx("span",{children:t("remote.section")})]}),c.jsxs("div",{className:"settings-toggle-row",onClick:()=>{!l&&!p&&F(!i.enabled)},children:[c.jsxs("span",{className:"min-w-0 flex-1 text-left",children:[c.jsx("span",{className:"block text-sm font-medium text-pri",children:t("remote.enable.label")}),c.jsx("span",{className:"mt-0.5 block text-xs text-ter leading-relaxed",children:t("remote.enable.description")})]}),c.jsx("div",{className:"mt-0.5 shrink-0",children:c.jsx(rx,{checked:i.enabled,disabled:l||p,onChange:F,"data-testid":"settings-toggle-remote","aria-label":t("remote.enable.label")})})]}),v?c.jsx("div",{className:"mt-1 ml-2 text-xs",style:{color:"var(--text-error)"},role:"alert",children:t("settings.saveError")}):null,c.jsxs("button",{type:"button","data-testid":"remote-copy-diagnostics",onClick:J,disabled:w,className:"icon-btn mt-2 w-full justify-center pointer-coarse:min-h-11",children:[C?c.jsx(Ga,{size:12,"aria-hidden":!0}):c.jsx(Cr,{size:12,"aria-hidden":!0}),c.jsx("span",{children:t(w?"remote.diagnostics.copying":C?"remote.diagnostics.copied":"remote.diagnostics.copy")})]}),c.jsxs("div",{className:"mt-2 rounded border px-3 py-2 text-xs","data-testid":"retention-diagnostics-panel",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:[c.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[c.jsx("span",{className:"font-medium text-sec",children:t("remote.retention.title")}),c.jsx("span",{className:"text-ter",children:t("remote.retention.localOnly")})]}),O?c.jsx("p",{className:"text-ter",children:t("remote.retention.loadFailed")}):_?c.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[c.jsxs("div",{children:[c.jsx("div",{className:"text-lg font-semibold text-pri",children:X}),c.jsx("div",{className:"text-ter",children:t("remote.retention.streak")})]}),c.jsxs("div",{children:[c.jsx("div",{className:"text-lg font-semibold text-pri",children:$}),c.jsx("div",{className:"text-ter",children:t("remote.retention.activeDays")})]}),c.jsxs("div",{children:[c.jsx("div",{className:"text-lg font-semibold text-pri",children:D}),c.jsx("div",{className:"text-ter",children:t("remote.retention.sends")})]}),c.jsxs("div",{children:[c.jsx("div",{className:"text-lg font-semibold text-pri",children:P}),c.jsx("div",{className:"text-ter",children:t("remote.retention.reports")})]})]}):c.jsx("p",{className:"text-ter",children:t("common.loading")})]}),i.enabled?c.jsxs("div",{className:"mt-2 border-t pt-2",style:{borderColor:"var(--border)"},children:[c.jsxs("div",{className:"flex items-center gap-2 rounded px-2 py-1.5 text-xs","data-testid":"remote-login-status",children:[c.jsx("span",{"aria-hidden":!0,"data-connection":i.connection,className:"inline-block h-2 w-2 rounded-full",style:{background:m}}),c.jsx("span",{className:"min-w-0 text-sec",children:g?t(g):i.loggedIn?t("remote.status.linked",{gateway:i.gatewayUrl??""}):t("remote.status.notLinked")})]}),i.loggedIn&&!o?c.jsx(p3,{}):null,c.jsx(y3,{reloadKey:U}),c.jsx(v3,{})]}):null,c.jsx(oi,{open:S,onOpenChange:I=>{I||T(!1)},title:t("remote.disable.confirmTitle"),description:t("remote.disable.confirmBody"),confirmLabel:t("common.stop"),confirmKind:"danger",onConfirm:()=>{ee(!1)}})]})},sx=b.createContext({enabled:!0,loading:!0,setEnabled:async()=>{}}),E3=({children:t})=>{const[a,o]=b.useState(!0),[i,l]=b.useState(!0);b.useEffect(()=>{let f=!1;return $T().then(m=>{f||o(m.enabled)}).catch(()=>{}).finally(()=>{f||l(!1)}),()=>{f=!0}},[]);const u=b.useCallback(async f=>{const m=await VT(f);o(m.enabled)},[]);return c.jsx(sx.Provider,{value:{enabled:a,loading:i,setEnabled:u},children:t})},C3=()=>b.useContext(sx),ix=b.createContext({enabled:!1,loading:!0,setEnabled:async()=>{}}),T3=({children:t})=>{const[a,o]=b.useState(!1),[i,l]=b.useState(!0);b.useEffect(()=>{let f=!1;return KT().then(m=>{f||o(m.enabled)}).catch(()=>{}).finally(()=>{f||l(!1)}),()=>{f=!0}},[]);const u=b.useCallback(async f=>{const m=await YT(f);o(m.enabled)},[]);return c.jsx(ix.Provider,{value:{enabled:a,loading:i,setEnabled:u},children:t})},lx=()=>b.useContext(ix),N3=()=>{const{language:t,setLanguage:a,t:o}=we();return c.jsxs("div",{className:"settings-section",children:[c.jsxs("div",{className:"settings-section__heading",children:[c.jsx(QS,{size:12,"aria-hidden":!0}),c.jsx("span",{children:o("settings.language")})]}),c.jsxs("div",{className:"flex gap-1 p-1 rounded border",style:{background:"var(--bg-1)",borderColor:"var(--border)"},children:[c.jsx("button",{type:"button",className:"flex-1 py-1 px-2 rounded text-xs font-medium transition-colors cursor-pointer",style:{background:t==="zh"?"var(--bg-3)":"transparent",color:t==="zh"?"var(--text-primary)":"var(--text-secondary)",border:"none"},onClick:()=>a("zh"),"data-testid":"language-zh-btn",children:"中文"}),c.jsx("button",{type:"button",className:"flex-1 py-1 px-2 rounded text-xs font-medium transition-colors cursor-pointer",style:{background:t==="en"?"var(--bg-3)":"transparent",color:t==="en"?"var(--text-primary)":"var(--text-secondary)",border:"none"},onClick:()=>a("en"),"data-testid":"language-en-btn",children:"English"})]})]})},Ky=({feature:t,label:a,description:o,testId:i})=>{const{t:l}=we(),[u,f]=b.useState(!1),[m,g]=b.useState(!1),p=async y=>{g(!1),f(!0);try{await t.setEnabled(y)}catch{g(!0)}finally{f(!1)}};return c.jsxs("div",{className:"settings-toggle-row",onClick:()=>{!t.loading&&!u&&p(!t.enabled)},children:[c.jsxs("span",{className:"min-w-0 flex-1 text-left",children:[c.jsx("span",{className:"block text-sm font-medium text-pri",children:a}),c.jsx("span",{className:"mt-0.5 block text-xs text-ter leading-relaxed",children:o}),m?c.jsx("span",{className:"mt-1 block text-xs",style:{color:"var(--text-error)"},role:"alert",children:l("settings.saveError")}):null]}),c.jsx("div",{className:"mt-0.5 shrink-0",children:c.jsx(rx,{checked:t.enabled,disabled:t.loading||u,onChange:y=>{p(y)},"data-testid":i,"aria-label":a})})]})},j3=()=>{const{t}=we(),[a,o]=b.useState(""),[i,l]=b.useState(!1),[u,f]=b.useState(!1),[m,g]=b.useState(null);b.useEffect(()=>{let y=!1;return PT().then(v=>{y||(o(v),l(!0))}).catch(()=>{y||l(!0)}),()=>{y=!0}},[]);const p=async()=>{g(null),f(!0);try{await FT(a),g("saved")}catch{g("error")}finally{f(!1)}};return c.jsxs("div",{children:[c.jsx("label",{className:"mb-1.5 block text-sm font-medium text-pri",htmlFor:"settings-webhook-url",children:t("settings.webhook.label")}),c.jsx("span",{className:"mb-2 block text-xs text-ter leading-relaxed",children:t("settings.webhook.description")}),c.jsx("input",{id:"settings-webhook-url",type:"url",inputMode:"url",placeholder:"https://…",className:"input",value:a,disabled:!i||u,onChange:y=>{g(null),o(y.target.value)},onBlur:()=>{p()},onKeyDown:y=>{if(y.key==="Enter"){if(y.nativeEvent.isComposing||y.keyCode===229)return;y.currentTarget.blur()}},"data-testid":"settings-webhook-url"}),m==="saved"?c.jsxs("span",{className:"mt-1.5 block text-xs",style:{color:"var(--status-green)"},children:["✓ ",t("settings.webhook.saved")]}):null,m==="error"?c.jsx("span",{className:"mt-1.5 block text-xs",style:{color:"var(--text-error)"},role:"alert",children:t("settings.saveError")}):null]})},cx=()=>{const{t}=we(),a=lx(),o=C3();return c.jsxs("div",{className:"flex flex-col gap-2.5",children:[c.jsx(N3,{}),c.jsxs("div",{className:"settings-section",children:[c.jsxs("div",{className:"settings-section__heading",children:[c.jsx(Fl,{size:12,"aria-hidden":!0}),c.jsx("span",{children:t("settings.experimental")})]}),c.jsx(Ky,{feature:a,label:t("settings.workflows.label"),description:t("settings.workflows.description"),testId:"settings-toggle-workflows"}),c.jsx(Ky,{feature:o,label:t("settings.autostaff.label"),description:t("settings.autostaff.description"),testId:"settings-toggle-autostaff"})]}),c.jsx(S3,{}),c.jsxs("div",{className:"settings-section",children:[c.jsxs("div",{className:"settings-section__heading",children:[c.jsx(WE,{size:12,"aria-hidden":!0}),c.jsx("span",{children:t("settings.webhook.label")})]}),c.jsx(j3,{})]})]})},ux=()=>{const{t}=we(),a=wt(),[o,i]=b.useState(!1),l=b.useRef(null),u=b.useRef(null);return b.useEffect(()=>{if(!o)return;const f=g=>{g.key==="Escape"&&(i(!1),u.current?.focus())},m=g=>{const p=l.current;p&&!p.contains(g.target)&&i(!1)};return document.addEventListener("keydown",f),document.addEventListener("pointerdown",m),()=>{document.removeEventListener("keydown",f),document.removeEventListener("pointerdown",m)}},[o]),c.jsxs("div",{ref:l,className:"relative",children:[c.jsx(Qe,{label:t("settings.tooltip"),children:c.jsx("button",{ref:u,type:"button","aria-expanded":o,"aria-haspopup":"dialog","aria-label":t("settings.aria"),className:"flex h-7 w-7 cursor-pointer items-center justify-center rounded text-sec hover:bg-3 hover:text-pri","data-testid":"topbar-app-settings",onClick:()=>i(f=>!f),children:c.jsx(If,{size:14,"aria-hidden":!0})})}),o?c.jsxs("div",{role:"dialog","aria-label":t("settings.aria"),className:a?"settings-sheet fixed inset-0 z-50 flex flex-col overflow-y-auto p-4":"settings-popover elev-2 absolute top-8 right-0 z-50 w-[380px] max-h-[calc(100vh-64px)] overflow-y-auto scroll-y rounded-lg border p-4","data-mobile":a||void 0,style:a?{background:"var(--bg-0)"}:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},"data-testid":"app-settings-menu",children:[c.jsxs("div",{className:"mb-4 flex items-start gap-3",children:[c.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg",style:{background:"color-mix(in oklab, var(--accent) 12%, transparent)",color:"var(--accent)"},children:c.jsx(If,{size:18,"aria-hidden":!0})}),c.jsxs("div",{className:a?"min-w-0 flex-1":"min-w-0",children:[c.jsx("div",{className:"text-sm font-semibold text-pri",children:t("settings.heading")}),c.jsx("div",{className:"text-xs text-ter",children:t("settings.subtitle")})]}),a?c.jsx("button",{type:"button",onClick:()=>i(!1),"aria-label":t("common.close"),"data-testid":"mobile-settings-close",className:"icon-btn icon-btn--ghost shrink-0",children:c.jsx(Ka,{size:16,"aria-hidden":!0})}):null]}),c.jsx(cx,{})]}):null]})},dx=t=>{const[a,o]=b.useState(null);return b.useEffect(()=>{if(t!==void 0)return;let i=!0;return HT().then(l=>{i&&o(l)}).catch(()=>{i&&o(null)}),()=>{i=!1}},[t]),t===void 0?a:t},A3="2.1.8",_3={version:A3},Fm=_3.version,R3=({actions:t,hideActions:a=!1,memoryOpen:o=!1,onToggleMemory:i,onToggleTaskGraph:l,openTaskCount:u=0,taskGraphOpen:f=!1,onToggleWorkflows:m,workflowsOpen:g=!1,version:p=Fm,versionInfo:y})=>{const{t:v}=we(),[k,S]=b.useState("idle"),T=dx(y),w=T?.updateAvailable&&T.latestVersion!==p?T:null,E=!!w?.installHint,C=u>0,j=f?v("topbar.hideTodo"):C?v("topbar.todoOpen",{count:u}):v("topbar.showTodo"),_=async()=>{if(w?.installHint)try{await navigator.clipboard.writeText(w.installHint),S("copied"),window.setTimeout(()=>S("idle"),1600)}catch{S("error"),window.setTimeout(()=>S("idle"),2200)}},N=v(k==="copied"?"topbar.updateCommandCopied":k==="error"?"topbar.updateCommandCopyFailed":"topbar.copyUpdateCommand");return c.jsxs("header",{className:"flex h-11 shrink-0 items-center px-4",style:{background:"var(--bg-0)",borderBottom:"1px solid var(--border)"},children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsxs("a",{href:"https://hivehq.dev",target:"_blank",rel:"noopener noreferrer","aria-label":v("topbar.openWebsite"),title:v("topbar.openWebsite"),className:"-mx-1 flex items-center gap-2 rounded px-1 transition-opacity hover:opacity-80 focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)]","data-testid":"topbar-brand-link",children:[c.jsx("img",{src:"/logo.png",alt:"","aria-hidden":!0,className:"h-5 w-5 rounded-md","data-testid":"topbar-logo"}),c.jsx("span",{className:"font-semibold text-pri",children:"Hive"}),c.jsxs("span",{className:"text-ter text-xs tabular-nums",children:["v",p]})]}),w?c.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 text-xs","data-testid":"topbar-update-badge",children:[c.jsx("span",{className:"rounded border px-2 py-0.5 font-medium",style:{background:"color-mix(in oklab, var(--accent) 10%, transparent)",borderColor:"color-mix(in oklab, var(--accent) 30%, transparent)",color:"var(--accent)"},children:v("topbar.updateAvailable")}),c.jsxs("span",{className:"hidden text-ter sm:inline",children:["v",p," → v",w.latestVersion]}),E?c.jsx("code",{className:"mono hidden max-w-[18rem] truncate rounded border px-1.5 py-0.5 text-ter md:inline-block",title:w.updateNote||w.installHint,style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:w.installHint}):null,w.updateNote?c.jsx("span",{className:"hidden max-w-[18rem] truncate text-ter xl:inline",title:w.updateNote,children:w.updateNote}):null,E?c.jsx(Qe,{label:N,children:c.jsx("button",{type:"button",onClick:_,"aria-label":N,className:"flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded border text-ter transition-colors hover:bg-3 hover:text-pri focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)]","data-testid":"topbar-copy-update-command",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:k==="copied"?c.jsx(Ga,{size:12}):c.jsx(Cr,{size:12})})}):null,w.releaseUrl?c.jsx(Qe,{label:v("topbar.openRelease"),children:c.jsx("a",{href:w.releaseUrl,target:"_blank",rel:"noopener noreferrer","aria-label":v("topbar.openRelease"),className:"flex h-6 w-6 shrink-0 items-center justify-center rounded border text-ter transition-colors hover:bg-3 hover:text-pri focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)]","data-testid":"topbar-open-release",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:c.jsx(xm,{size:12})})}):null]}):null]}),c.jsx("div",{className:"flex-1"}),a?null:c.jsxs("div",{className:"flex items-center gap-1",children:[t,i?c.jsx(Qe,{label:v(o?"topbar.hideMemory":"topbar.showMemory"),children:c.jsxs("button",{type:"button",onClick:i,"aria-pressed":o,"aria-label":v(o?"topbar.hideMemory":"topbar.showMemory"),className:"flex h-7 cursor-pointer items-center gap-1 rounded border px-2 text-xs font-medium text-ter transition-colors hover:bg-3 hover:text-pri focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)]","data-testid":"topbar-memory",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:[c.jsx(hS,{size:13}),c.jsx("span",{children:v("topbar.memory")})]})}):null,l?c.jsx(Qe,{label:j,children:c.jsxs("button",{type:"button",onClick:l,"aria-pressed":f,"aria-label":j,"data-has-tasks":C?"true":void 0,className:"flex h-7 cursor-pointer items-center gap-1 rounded border px-2 text-xs font-medium text-ter transition-colors hover:bg-3 hover:text-pri focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)]","data-testid":"topbar-blueprint",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:[c.jsx($b,{size:13,className:C?"text-accent":void 0}),c.jsx("span",{children:v("topbar.todo")})]})}):null,m?c.jsx(Qe,{label:v(g?"topbar.hideWorkflows":"topbar.showWorkflows"),children:c.jsxs("button",{type:"button",onClick:m,"aria-pressed":g,"aria-label":v(g?"topbar.hideWorkflows":"topbar.showWorkflows"),className:"flex h-7 cursor-pointer items-center gap-1 rounded border px-2 text-xs font-medium text-ter transition-colors hover:bg-3 hover:text-pri focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)]","data-testid":"topbar-workflows",style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:[c.jsx(Jb,{size:13}),c.jsx("span",{children:v("topbar.workflows")})]})}):null,c.jsx(f3,{}),c.jsx(ux,{})]})]})},fx="hive.workspace-sidebar.width",Vs=56,Km=280,Cf=Vs,Yy=16,O3=240,$y=96,Il=t=>Math.min(Km,Math.max(Vs,t)),D3=()=>{try{const t=localStorage.getItem(fx);if(!t)return Cf;const a=Number.parseInt(t,10);return Number.isFinite(a)?Il(a):Cf}catch{return Cf}},M3=()=>{const[t,a]=b.useState(D3),[o,i]=b.useState(!1);b.useEffect(()=>{try{localStorage.setItem(fx,String(Math.round(t)))}catch{}},[t]);const l=b.useCallback(g=>{g.preventDefault();const p=g.clientX,y=t;i(!0);const v=document.body.style.cursor,k=document.body.style.userSelect;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const S=w=>{a(Il(y+w.clientX-p))},T=()=>{i(!1),document.body.style.cursor=v,document.body.style.userSelect=k,document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",T)};document.addEventListener("mousemove",S),document.addEventListener("mouseup",T)},[t]),u=t<=$y,f=b.useCallback(()=>{a(g=>g<=$y?O3:Vs)},[]),m=b.useCallback(g=>{g.key==="ArrowLeft"?(g.preventDefault(),a(p=>Il(p-Yy))):g.key==="ArrowRight"?(g.preventDefault(),a(p=>Il(p+Yy))):g.key==="Home"?(g.preventDefault(),a(Vs)):g.key==="End"&&(g.preventDefault(),a(Km))},[]);return{beginResize:l,collapsed:u,onResizeKeyDown:m,resizing:o,toggleCollapsed:f,width:t}},L3=({children:t,hideTopbarActions:a=!1,memoryOpen:o=!1,onToggleMemory:i,onToggleTaskGraph:l,openTaskCount:u=0,onToggleWorkflows:f,workflowsOpen:m=!1,sidebar:g,sidebarResize:p,taskGraphOpen:y=!1,topbarActions:v,versionInfo:k})=>{const{t:S}=we();return c.jsxs("div",{className:"flex h-screen w-full flex-col overflow-hidden",style:{background:"var(--bg-0)",color:"var(--text-primary)"},children:[c.jsx(R3,{actions:v,hideActions:a,memoryOpen:o,onToggleMemory:i,onToggleTaskGraph:l,openTaskCount:u,taskGraphOpen:y,onToggleWorkflows:f,versionInfo:k,workflowsOpen:m}),c.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 overflow-hidden",children:[c.jsxs("aside",{"aria-label":S("layout.sidebarAria"),className:"workspace-sidebar relative flex shrink-0 flex-col","data-resizing":p.resizing?"true":"false",style:{background:"var(--bg-0)",boxShadow:"inset -1px 0 0 var(--border)",width:`${p.width}px`},children:[g,c.jsx("hr",{"aria-label":S("layout.sidebarResizeAria"),"aria-orientation":"vertical","aria-valuemin":Vs,"aria-valuemax":Km,"aria-valuenow":Math.round(p.width),tabIndex:0,className:"workspace-sidebar-resizer","data-resizing":p.resizing?"true":"false",onMouseDown:p.beginResize,onKeyDown:p.onResizeKeyDown})]}),c.jsx("section",{className:"relative flex min-w-0 flex-1 overflow-hidden",children:t})]})]})},z3={disconnected:"mobile.reconnect.disconnected",reconnecting:"mobile.reconnect.reconnecting",revoked:"mobile.reconnect.revoked"},H3=({status:t})=>{const{t:a}=we();if(!t||t.state!=="reconnecting"&&t.state!=="disconnected"&&t.state!=="revoked")return null;const o=t.state==="revoked"?"var(--status-red)":"var(--status-orange)",i=t.state==="disconnected"?t.retry:void 0;return c.jsxs("div",{role:"status","data-testid":"mobile-reconnect-banner",className:"flex items-center justify-center gap-2 px-3 py-1.5 text-center text-xs",style:{background:`color-mix(in oklab, ${o} 18%, var(--bg-0))`,color:o},children:[c.jsx("span",{children:a(z3[t.state])}),i?c.jsx("button",{type:"button","data-testid":"mobile-reconnect-retry",className:"rounded border px-2 py-0.5 font-medium",style:{borderColor:"currentColor",color:"currentColor"},onClick:i,children:a("mobile.reconnect.retry")}):null]})},B3=[{accent:"var(--status-green)",descriptionKey:"notifications.sound.soft.description",labelKey:"notifications.sound.soft.label",length:"short",value:"soft"},{accent:"var(--status-blue)",descriptionKey:"notifications.sound.ping.description",labelKey:"notifications.sound.ping.label",length:"short",value:"ping"},{accent:"var(--status-gold)",descriptionKey:"notifications.sound.chime.description",labelKey:"notifications.sound.chime.label",length:"short",value:"chime"},{accent:"var(--accent)",descriptionKey:"notifications.sound.cascade.description",labelKey:"notifications.sound.cascade.label",length:"long",value:"cascade"},{accent:"var(--status-orange)",descriptionKey:"notifications.sound.beacon.description",labelKey:"notifications.sound.beacon.label",length:"long",value:"beacon"},{accent:"var(--status-purple)",descriptionKey:"notifications.sound.resolve.description",labelKey:"notifications.sound.resolve.label",length:"long",value:"resolve"},{accent:"var(--text-tertiary)",descriptionKey:"notifications.sound.off.description",labelKey:"notifications.sound.off.label",length:"silent",value:"off"}],U3=[{descriptionKey:"notifications.detail.brief.description",labelKey:"notifications.detail.brief.label",value:"brief"},{descriptionKey:"notifications.detail.detailed.description",labelKey:"notifications.detail.detailed.label",value:"detailed"}],W3=()=>{const{t}=we(),a=wt(),{notify:o,previewSound:i,requestDesktopNotifications:l,settings:u,updateSettings:f}=jc(),m=typeof window<"u"&&!("Notification"in window),g=b.useMemo(()=>B3.map(v=>({...v,description:t(v.descriptionKey),label:t(v.labelKey)})),[t]),p=b.useMemo(()=>U3.map(v=>({...v,description:t(v.descriptionKey),label:t(v.labelKey)})),[t]),y=v=>{if(!v){f({desktop:!1});return}l()};return c.jsxs("details",{className:"settings-details group",children:[c.jsxs("summary",{className:"settings-details__summary",children:[c.jsxs("div",{className:"settings-section__heading !mb-0",children:[c.jsx(Wf,{size:12,"aria-hidden":!0}),c.jsx("span",{children:t("notifications.settings.heading")})]}),c.jsx(No,{size:14,className:"text-sec transition-transform group-open:rotate-180","aria-hidden":!0})]}),c.jsxs("div",{className:"settings-details__content flex flex-col gap-3.5",children:[c.jsxs("section",{children:[c.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-ter text-[10px] font-semibold uppercase tracking-wider",children:[c.jsx(Yl,{size:12,"aria-hidden":!0}),t("notifications.sound.sectionLabel")]}),c.jsx("div",{role:"radiogroup","aria-label":t("notifications.sound.sectionLabel"),className:a?"grid grid-cols-1 gap-2":"grid grid-cols-2 gap-2",children:g.map(v=>c.jsxs("div",{className:"relative min-h-[78px] rounded border transition-colors",style:{background:u.sound===v.value?`color-mix(in oklab, ${v.accent} 10%, var(--bg-2))`:"var(--bg-2)",borderColor:u.sound===v.value?`color-mix(in oklab, ${v.accent} 54%, var(--border-bright))`:"var(--border)"},children:[c.jsxs("label",{className:"block h-full w-full cursor-pointer rounded px-3 py-2 pr-10 text-left transition-colors hover:bg-3 focus-within:outline-none focus-within:ring-2 focus-within:ring-[var(--ring-focus)]",children:[c.jsx("input",{type:"radio",name:"notification-sound",value:v.value,checked:u.sound===v.value,className:"sr-only",onChange:()=>f({sound:v.value})}),c.jsxs("span",{className:"mb-1 flex items-center gap-2",children:[c.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded",style:{background:`color-mix(in oklab, ${v.accent} 16%, transparent)`,color:v.accent},children:v.value==="off"?c.jsx(Qb,{size:12,"aria-hidden":!0}):c.jsx(Yl,{size:12,"aria-hidden":!0})}),c.jsx("span",{className:"font-medium text-pri text-xs",children:v.label}),v.length==="long"?c.jsx("span",{className:"rounded border border-[var(--border-bright)] px-1.5 py-0.5 text-[10px] text-ter uppercase",children:t("notifications.sound.longerBadge")}):null,u.sound===v.value?c.jsx(Ga,{size:12,className:"ml-auto text-pri","aria-hidden":!0}):null]}),c.jsx("span",{className:"block text-ter text-[11px] leading-relaxed",children:v.description})]}),v.value!=="off"?c.jsx("button",{type:"button","aria-label":t("notifications.sound.previewAria",{label:v.label}),className:"absolute right-2 bottom-2 flex h-6 w-6 pointer-coarse:h-10 pointer-coarse:w-10 items-center justify-center rounded border text-sec transition-colors hover:bg-3 hover:text-pri cursor-pointer",style:{borderColor:"var(--border-bright)"},onClick:()=>i(v.value),children:c.jsx(jo,{size:12,"aria-hidden":!0})}):null]},v.value))})]}),c.jsxs("section",{children:[c.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-ter text-[10px] font-semibold uppercase tracking-wider",children:[c.jsx(Yb,{size:12,"aria-hidden":!0}),t("notifications.detail.sectionLabel")]}),c.jsx("div",{role:"radiogroup","aria-label":t("notifications.detail.sectionLabel"),className:"grid grid-cols-2 rounded border p-1",style:{background:"var(--bg-1)",borderColor:"var(--border)"},children:p.map(v=>c.jsxs("label",{className:"cursor-pointer rounded px-3 py-2 text-left transition-colors hover:bg-3 focus-within:outline-none focus-within:ring-2 focus-within:ring-[var(--ring-focus)]",style:{background:u.detail===v.value?"var(--bg-3)":"transparent",color:u.detail===v.value?"var(--text-primary)":"var(--text-secondary)"},children:[c.jsx("input",{type:"radio",name:"notification-detail",value:v.value,checked:u.detail===v.value,className:"sr-only",onChange:()=>f({detail:v.value})}),c.jsx("span",{className:"block font-medium text-xs",children:v.label}),c.jsx("span",{className:"block text-ter text-[11px] leading-relaxed",children:v.description})]},v.value))})]}),c.jsxs("label",{className:"flex items-start gap-2 rounded border p-2 text-sec text-xs cursor-pointer",children:[c.jsx("input",{type:"checkbox","aria-label":t("notifications.desktop.aria"),checked:u.desktop,disabled:m,className:"mt-0.5 cursor-pointer",onChange:v=>y(v.currentTarget.checked)}),c.jsxs("span",{children:[c.jsx("span",{className:"block font-medium text-pri",children:t("notifications.desktop.label")}),c.jsx("span",{className:"text-ter leading-relaxed",children:t(m?"notifications.desktop.unsupported":"notifications.desktop.helper")})]})]}),c.jsx("div",{className:"flex justify-end gap-2 border-t pt-3",style:{borderColor:"var(--border)"},children:c.jsx("button",{type:"button",className:"icon-btn icon-btn--primary ml-auto cursor-pointer",onClick:()=>o({brief:t("notifications.test.brief"),detail:t("notifications.test.detail"),kind:"success",title:t("notifications.test.title")}),children:t("notifications.test.button")})})]})]})},I3=({demoMode:t,onTryDemo:a,onExitDemo:o})=>{const{t:i}=we();return c.jsxs("div",{className:"mobile-settings-section flex min-h-full flex-col p-4","data-testid":"mobile-settings-section",children:[c.jsx("h1",{className:"mb-4 text-base font-semibold text-pri",children:i("mobile.section.settings")}),c.jsx(cx,{}),c.jsx(W3,{}),c.jsxs("div",{className:"settings-section mt-3",children:[c.jsxs("div",{className:"settings-section__heading",children:[c.jsx(Fl,{size:12,"aria-hidden":!0}),c.jsx("span",{children:i("mobile.section.demo")})]}),t?c.jsxs("button",{type:"button","data-testid":"mobile-settings-exit-demo",onClick:o,className:"flex w-full items-center gap-3 rounded p-2 text-left text-sm text-pri hover:bg-3",children:[c.jsx(aE,{size:16,"aria-hidden":!0,className:"text-ter"}),c.jsx("span",{className:"min-w-0 flex-1 truncate",children:i("demo.exit")})]}):c.jsxs("button",{type:"button","data-testid":"mobile-settings-demo",onClick:a,className:"flex w-full items-center gap-3 rounded p-2 text-left text-sm text-pri hover:bg-3",children:[c.jsx(Fl,{size:16,"aria-hidden":!0,className:"text-ter"}),c.jsx("span",{className:"min-w-0 flex-1 truncate",children:i("mobile.section.demo")})]})]})]})},q3={team:gc,tasks:$b,flows:Jb,settings:If},P3={team:"mobile.nav.team",tasks:"mobile.nav.tasks",flows:"mobile.nav.flows",settings:"mobile.nav.settings"},F3=({active:t,onSelect:a,sections:o,openTaskCount:i=0,workingCount:l=0})=>{const{t:u}=we();return c.jsx("nav",{"aria-label":u("mobile.nav.aria"),className:"mobile-bottom-nav flex shrink-0 items-stretch","data-testid":"mobile-bottom-nav",style:{background:"var(--bg-0)",borderTop:"1px solid var(--border)"},children:o.map(f=>{const m=q3[f],g=u(P3[f]),p=f===t,y=f==="tasks"&&i>0?i:f==="team"&&l>0?l:0;return c.jsxs("button",{type:"button","aria-label":g,"aria-current":p?"page":void 0,"data-testid":`mobile-nav-${f}`,"data-active":p?"true":void 0,onClick:()=>a(f),className:"mobile-bottom-nav__tab relative flex flex-1 cursor-pointer flex-col items-center justify-center gap-0.5 py-2 text-xs",style:{color:p?"var(--text-primary)":"var(--text-tertiary)"},children:[p?c.jsx("span",{"aria-hidden":!0,className:"absolute top-0 left-1/2 h-0.5 w-8 -translate-x-1/2 rounded-b",style:{background:"var(--accent)"}}):null,c.jsx(m,{size:20,"aria-hidden":!0}),c.jsx("span",{children:g}),y>0?c.jsx("span",{className:"absolute top-1 right-[calc(50%-18px)] inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-full px-1 text-[11px] font-medium tabular-nums leading-none","data-testid":`mobile-nav-${f}-badge`,style:{background:"var(--accent)",color:"#ffffff"},children:y}):null]},f)})})},K3=({workspaceSwitcher:t,actions:a,banner:o})=>c.jsxs("header",{className:"mobile-topbar flex shrink-0 flex-col","data-testid":"mobile-topbar",style:{background:"var(--bg-0)",borderBottom:"1px solid var(--border)"},children:[c.jsxs("div",{className:"flex h-12 items-center gap-2 px-3",children:[c.jsx("div",{className:"min-w-0 flex-1",children:t??c.jsx("span",{className:"font-semibold text-pri",children:"Hive"})}),c.jsx("div",{className:"flex shrink-0 items-center gap-1",children:a})]}),o]}),Y3=()=>typeof navigator<"u"&&/iP(hone|ad|od)/.test(navigator.platform??navigator.userAgent),$3=()=>{const[t,a]=b.useState(null);return b.useEffect(()=>{if(!Y3())return;const o=typeof window<"u"?window.visualViewport:null;if(!o)return;const i=()=>{const l=Math.abs(o.height-window.innerHeight)<10;a(l?null:o.height)};return i(),o.addEventListener("resize",i),()=>{o.removeEventListener("resize",i)}},[]),t},V3={team:"mobile-section-team",tasks:"mobile-section-tasks",flows:"mobile-section-flows",settings:"mobile-section-settings"},G3=({workspaceSwitcher:t,topbarActions:a,banner:o,fullBleed:i,team:l,tasks:u,flows:f,settings:m,terminalPanels:g,overlays:p,openTaskCount:y=0,workingCount:v=0,activeSection:k,onSectionChange:S})=>{const[T,w]=b.useState("team"),E=k??T,C=$3(),j=U=>{w(U),S?.(U)},_={team:l,tasks:u,flows:f,settings:m},N=["team","tasks"];f!=null&&N.push("flows"),m!=null&&N.push("settings");const O=N.includes(E)?E:"team",L=Bw()&&O==="team"&&i==null;return c.jsxs("div",{className:`mobile-shell flex h-dvh w-full max-w-[100vw] min-w-0 flex-col overflow-hidden${L?" mobile-shell--focus":""}`,"data-mobile-shell":"true","data-testid":"mobile-shell","data-focus-mode":L?"true":void 0,style:{background:"var(--bg-0)",color:"var(--text-primary)",...C!=null?{height:`${C}px`}:{}},children:[L?o:c.jsx(K3,{workspaceSwitcher:t,actions:a,banner:o}),c.jsx("main",{className:"relative min-h-0 min-w-0 flex-1 overflow-hidden",children:i??c.jsx("div",{className:O==="team"?"flex h-full min-w-0 flex-col overflow-hidden":"flex h-full min-w-0 flex-col overflow-y-auto","data-testid":V3[O],"data-mobile-section":O,children:_[O]})}),g,i!=null||L?null:c.jsx(F3,{active:O,onSelect:j,sections:N,openTaskCount:y,workingCount:v}),p]})},X3=[],Z3=b.lazy(()=>Nt(()=>import("./TaskGraphDrawer-9mXNimSE.js"),[]).then(t=>({default:t.TaskGraphContent}))),Q3=({tasksFile:t,workspacePath:a,workers:o,onSelectOwner:i,onAddWorkspace:l,demoMode:u=!1})=>{const{t:f}=we(),m=o??X3,g=b.useMemo(()=>m.length?m.map(p=>p.name):void 0,[m]);return a?c.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[u?c.jsx("div",{className:"flex shrink-0 items-center justify-end px-3 py-1",children:c.jsx("span",{className:"pill pill--neutral text-xs",children:f("demo.readOnlyBadge")})}):null,c.jsx("div",{className:"min-h-0 flex-1",children:c.jsx(b.Suspense,{fallback:null,children:c.jsx(Z3,{content:t.content,hasConflict:t.hasConflict,onContentChange:t.onChange,onKeepLocal:t.onKeepLocal,onReload:t.onReload,onSave:t.onSave,onToggleTaskLine:p=>{t.toggleTaskAtLine(p).catch(Ua("tasks.toggleTaskAtLine"))},onAppendTask:p=>{t.appendTask(p).catch(Ua("tasks.appendTask"))},onAppendSubtask:(p,y)=>{t.appendSubtask(p,y).catch(Ua("tasks.appendSubtask"))},onUpdateTaskText:(p,y)=>{t.updateTaskText(p,y).catch(Ua("tasks.updateTaskText"))},onDeleteTask:p=>{t.deleteTask(p).catch(Ua("tasks.deleteTask"))},workspacePath:a,...g?{knownWorkerNames:g}:{},...i?{onSelectOwner:i}:{}})})})]}):c.jsx("div",{className:"flex h-full flex-col","data-testid":"mobile-tasks-empty",children:c.jsx(ri,{title:f("mobile.tasks.noWorkspaceTitle"),description:f("mobile.tasks.noWorkspaceDesc"),action:l?c.jsx("button",{type:"button",onClick:l,className:"icon-btn icon-btn--primary mt-1 flex min-h-11 items-center gap-1.5 px-4 py-2 text-xs font-medium",children:f("firstRun.addWorkspace")}):void 0})})},Vy=[{token:"var(--accent)",label:"accent"},{token:"var(--status-blue)",label:"blue"},{token:"var(--status-purple)",label:"purple"},{token:"var(--status-orange)",label:"orange"},{token:"var(--status-green)",label:"green"},{token:"var(--status-gold)",label:"gold"}],J3=t=>{let a=0;for(let i=0;i<t.length;i+=1)a=a*31+t.charCodeAt(i)|0;const o=Math.abs(a)%Vy.length;return Vy[o]},eR=t=>{const a=t.trim();if(a.length===0)return"?";const o=a.codePointAt(0);return o===void 0?"?":String.fromCodePoint(o).toUpperCase()},Jf=({workspaceId:t,name:a,isActive:o,working:i,workingCount:l,size:u=32})=>{const{token:f,label:m}=J3(t),g=eR(a),p=l&&l>1?l:null;return c.jsx(Zw,{size:u,color:f,fontRatio:.45,ringColor:o?f:null,testId:"workspace-avatar",data:{"workspace-id":t,active:o?"true":void 0,"color-label":m},decoration:p!==null?c.jsx("span",{className:"absolute flex h-[16px] min-w-[16px] items-center justify-center rounded-full px-1 font-medium text-xs tabular-nums leading-none",style:{right:"-4px",bottom:"-4px",background:"var(--status-green)",color:"#0a1f0a",boxShadow:"0 0 0 2px var(--bg-1)"},"data-testid":"workspace-avatar-working-count","aria-hidden":!0,children:p>9?"9+":p}):i?c.jsx("span",{className:"status-dot status-dot--working absolute",style:{right:"-2px",bottom:"-2px",boxShadow:"0 0 0 2px var(--bg-1)"},"aria-hidden":!0}):null,children:g})},Gy=(t,a)=>{if(!t||t.length===0)return a("sidebar.noMembers");const o=t.filter(i=>i.status==="working").length;return o>0?a("sidebar.workingCount",{working:o,total:t.length}):a("sidebar.teamMemberCount",{count:t.length})},tR=({activeWorkspaceId:t,workspaces:a,workersByWorkspaceId:o,createDisabledReason:i,onSelectWorkspace:l,onCreateClick:u,onDeleteWorkspace:f})=>{const{t:m}=we(),g=en(),[p,y]=b.useState(!1),[v,k]=b.useState(null),[S,T]=b.useState(!1),w=a?.find(C=>C.id===t)?.name??m("mobile.section.workspaces"),E=()=>{if(!v||S)return;const C=v;T(!0),Promise.resolve(f(C)).then(()=>{g.show({kind:"success",message:m("sidebar.removed",{name:C.name})})}).catch(j=>{const _=j instanceof Error?j.message:String(j);g.show({kind:"error",message:m("sidebar.deleteFailed",{message:_})})}).finally(()=>{T(!1),k(null)})};return c.jsxs(_o,{open:p,onOpenChange:y,children:[c.jsx(_T,{asChild:!0,children:c.jsxs("button",{type:"button","data-testid":"mobile-workspace-switcher-trigger","aria-label":m("mobile.workspaces.switch"),className:"mobile-ws-switcher flex min-h-11 w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-left hover:bg-2",children:[c.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-pri",children:w}),c.jsx(No,{size:16,"aria-hidden":!0,className:"shrink-0 text-ter"})]})}),c.jsxs(Ro,{children:[c.jsx(Oo,{"data-testid":"mobile-workspace-switcher-overlay",className:"app-overlay fixed inset-0 z-40"}),c.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 grid items-end",children:c.jsxs(Do,{"data-testid":"mobile-workspace-switcher-sheet",className:"dialog-slide-up elev-2 pointer-events-auto flex max-h-[70dvh] w-full flex-col overflow-hidden rounded-t-xl border-t",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},children:[c.jsx(Mo,{asChild:!0,children:c.jsxs("div",{className:"flex shrink-0 items-baseline gap-2 border-b px-4 py-3",style:{borderColor:"var(--border)"},children:[c.jsx("span",{className:"text-base font-semibold text-pri",children:m("sidebar.workspaces")}),a&&a.length>0?c.jsx("span",{className:"text-xs text-ter tabular-nums",children:a.length}):null]})}),c.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto py-1",children:!a||a.length===0?c.jsxs("div",{className:"flex flex-col items-center gap-1 px-6 py-8 text-center",children:[c.jsx("span",{className:"text-sm font-medium text-sec",children:m("sidebar.noWorkspaces")}),c.jsx("span",{className:"text-xs text-ter",children:i??m("sidebar.noWorkspacesDesc")})]}):a.map(C=>{const j=C.id===t,_=o[C.id],N=_?.filter(O=>O.status==="working").length??0;return c.jsxs("div",{className:"flex items-center gap-1 pr-2",children:[c.jsxs("button",{type:"button","data-testid":`mobile-ws-row-${C.id}`,onClick:()=>{y(!1),l(C.id)},className:"flex min-h-14 min-w-0 flex-1 items-center gap-3 px-4 py-2 text-left",style:j?{background:"color-mix(in oklab, var(--accent) 10%, transparent)"}:void 0,children:[c.jsx(Jf,{workspaceId:C.id,name:C.name,isActive:j,working:N>0,workingCount:N,size:36}),c.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[c.jsx("span",{className:"truncate text-sm font-medium text-pri",children:C.name}),c.jsx("span",{className:"truncate text-xs text-ter",children:Gy(_,m)})]}),j?c.jsx(Ga,{size:18,className:"shrink-0 text-accent","aria-hidden":!0}):null]}),c.jsx("button",{type:"button","aria-label":m("sidebar.deleteAria",{name:C.name}),"data-testid":`mobile-ws-delete-${C.id}`,onClick:()=>k(C),className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-md text-ter",children:c.jsx(hc,{size:16,"aria-hidden":!0})})]},C.id)})}),c.jsx("div",{className:"shrink-0 border-t px-4 pt-3 pb-[max(12px,env(safe-area-inset-bottom))]",style:{borderColor:"var(--border)",background:"var(--bg-2)"},children:c.jsxs("button",{type:"button",disabled:!!i,title:i,"data-testid":"mobile-ws-create",onClick:()=>{y(!1),u()},className:"icon-btn icon-btn--primary flex w-full min-h-11 items-center justify-center gap-1.5",children:[c.jsx(Kl,{size:16,"aria-hidden":!0}),m("sidebar.newWorkspace")]})})]})})]}),c.jsx(oi,{open:v!==null,onOpenChange:C=>{!C&&!S&&k(null)},title:v?m("sidebar.deleteConfirm",{name:v.name}):m("sidebar.deleteLabel"),description:v?m("sidebar.deleteDescription",{path:v.path,summary:Gy(o[v.id],m)}):"",confirmLabel:m(S?"sidebar.deleting":"sidebar.deleteLabel"),confirmKind:"danger",onConfirm:E})]})},nR=4e3,aR=t=>{const[a,o]=b.useState([]);return b.useEffect(()=>{if(!t){o([]);return}let i=!1;const l=()=>{$0().then(f=>{i||o(f)}).catch(()=>{})};l();const u=window.setInterval(l,nR);return()=>{i=!0,window.clearInterval(u)}},[t]),a},rR=({devices:t,enabled:a})=>{const{notify:o}=jc(),{t:i}=we(),l=b.useRef(null);return b.useEffect(()=>{if(!a){l.current=null;return}const u=new Map(t.filter(m=>!m.revoked).map(m=>[m.deviceId,m])),f=l.current;if(l.current=new Set(u.keys()),!!f)for(const[m,g]of u)f.has(m)||o({brief:i("notifications.remoteSession.brief",{name:g.name}),detail:i("notifications.remoteSession.detail",{name:g.name}),kind:"success",title:i("notifications.remoteSession.title")})},[t,a,o,i]),null},oR=()=>{const{status:t}=Pm(),a=t.enabled&&t.loggedIn,o=aR(a);return c.jsx(rR,{devices:o,enabled:a})};let em=!1;const mx=()=>{em=!0,window.location.reload()},sR=t=>{b.useEffect(()=>{const a=o=>{if(em){em=!1;return}o.preventDefault(),o.returnValue=""};return window.addEventListener("beforeunload",a),()=>window.removeEventListener("beforeunload",a)},[t])},iR=3e3,lR=({onTryDemo:t}={})=>{const{t:a}=we(),[o,i]=b.useState(!1),l=b.useRef(!0),u=b.useCallback(()=>{typeof window>"u"||mx()},[]),f=b.useCallback(async()=>{try{return(await fetch("/api/version",{credentials:"include"})).ok}catch{return!1}},[]);b.useEffect(()=>{l.current=!0;const g=window.setInterval(async()=>{l.current&&await f()&&u()},iR);return()=>{l.current=!1,window.clearInterval(g)}},[f,u]);const m=async()=>{i(!0);try{if(await f()){u();return}}finally{window.setTimeout(()=>{l.current&&i(!1)},400)}};return c.jsx("div",{className:"flex flex-1 items-center justify-center p-8","data-testid":"runtime-offline-page",children:c.jsxs("div",{className:"elev-1 flex max-w-md flex-col items-center gap-3 rounded border p-6 text-center",style:{background:"var(--bg-elevated)",borderColor:"var(--border)"},children:[c.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-full",style:{background:"var(--bg-3)",color:"var(--status-orange)"},children:c.jsx(xE,{size:24,"aria-hidden":!0})}),c.jsx("div",{className:"font-semibold text-pri",children:a("pwa.runtimeOffline.title")}),c.jsx("div",{className:"text-sec text-sm leading-relaxed",children:a("pwa.runtimeOffline.body")}),c.jsxs("div",{className:"mt-2 flex flex-wrap items-center justify-center gap-2",children:[c.jsxs("button",{type:"button",className:"icon-btn icon-btn--primary flex items-center gap-2","data-testid":"runtime-offline-retry",disabled:o,onClick:()=>{m()},children:[o?c.jsx(Fa,{size:12,className:"animate-spin","aria-hidden":!0}):c.jsx(km,{size:12,"aria-hidden":!0}),a(o?"pwa.runtimeOffline.retrying":"pwa.runtimeOffline.retry")]}),t?c.jsxs("button",{type:"button",className:"icon-btn flex items-center gap-2","data-testid":"runtime-offline-try-demo",onClick:t,children:[c.jsx(NS,{size:12,"aria-hidden":!0}),a("pwa.runtimeOffline.tryDemo")]}):null]}),c.jsx("div",{className:"text-ter text-xs",children:a("pwa.runtimeOffline.autoReconnect")})]})})},tm=new Set;let px=null;const cR=t=>{px=t;for(const a of tm)a(t)},uR=t=>(tm.add(t),t(px),()=>{tm.delete(t)}),dR=2e3,fR=async t=>{if(!t.serviceWorker)return;let a;try{a=await t.serviceWorker.register("/sw.js")}catch{return}const o=l=>{const u=()=>{l.state==="installed"&&t.serviceWorker?.controller&&cR(()=>{l.postMessage({type:"SKIP_WAITING"}),setTimeout(t.reload,dR)})};l.addEventListener("statechange",u)};a.waiting&&t.serviceWorker.controller&&o(a.waiting),a.installing&&o(a.installing),a.addEventListener("updatefound",()=>{a.installing&&o(a.installing)});let i=!1;t.serviceWorker.addEventListener("controllerchange",()=>{i||(i=!0,t.reload())})},mR=()=>typeof navigator>"u"||typeof window>"u"?Promise.resolve():fR({isProd:!0,serviceWorker:"serviceWorker"in navigator?navigator.serviceWorker:null,reload:mx}),Xy=({terminalRuns:t})=>{const{t:a}=we(),o=wt(),[i,l]=b.useState(null),[u,f]=b.useState(!1);if(b.useEffect(()=>uR(y=>{l(()=>y)}),[]),!i)return null;const m=t.every(y=>y.status==="stopped"),g=!m||u,p=a(u?"pwa.reloading":m?"pwa.reloadToActivate":"pwa.waitForAgents");return c.jsxs("div",{className:"update-toast elev-2 fixed right-4 bottom-8 z-50 flex items-center gap-3 rounded border px-3 py-2",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},"data-mobile":o||void 0,"data-testid":"update-available-toast",role:"status","aria-live":"polite",children:[c.jsx(km,{size:14,className:"text-sec","aria-hidden":!0}),c.jsxs("div",{className:"flex flex-col",children:[c.jsx("span",{className:"font-medium text-pri text-xs",children:a("pwa.appShellUpdated")}),c.jsx("span",{className:"text-ter text-xs",children:a(m?"pwa.reloadToActivate":"pwa.waitForAgents")})]}),c.jsx("button",{type:"button",className:"icon-btn icon-btn--primary","data-testid":"update-available-reload",disabled:g,onClick:()=>{f(!0),i()},children:p})]})},pR=new Set(["add-workspace","try-demo"]),hR=t=>t!==null&&pR.has(t),gR=({onAddWorkspace:t,onTryDemo:a,ready:o})=>{const i=b.useRef(!1);b.useEffect(()=>{if(!o||i.current||typeof window>"u")return;const u=new URLSearchParams(window.location.search).get("action");hR(u)&&(i.current=!0,window.history.replaceState({},"",window.location.pathname),u==="add-workspace"?t():u==="try-demo"&&a())},[o,t,a])},Zy=()=>{const{t}=we(),a=en(),o=wt(),{pending:i,refresh:l}=Pm(),[u,f]=b.useState(!1),m=b.useRef(!1),g=i?.deviceName??"",p=i?.pairingId??null,y=i?.expiresAt??null;b.useEffect(()=>{p!==null&&(m.current=!1)},[p]);const v=b.useCallback(async()=>{if(!(!p||u||m.current)){m.current=!0,f(!0);try{await SN(p),a.show({kind:"success",message:t("remote.confirm.paired",{name:g})})}catch{m.current=!1,a.show({kind:"error",message:t("remote.confirm.failed")})}finally{f(!1),await l()}}},[p,u,g,l,t,a]),k=b.useCallback(async S=>{if(!(!p||m.current)){m.current=!0;try{await EN(p)}catch{}a.show({kind:S==="expired"?"warning":"success",message:t(S==="expired"?"remote.confirm.expired":"remote.confirm.rejected")}),f(!1),await l()}},[p,l,t,a]);return b.useEffect(()=>{if(y===null)return;const S=y-Date.now();if(S<=0){k("expired");return}const T=window.setTimeout(()=>{k("expired")},S);return()=>window.clearTimeout(T)},[y,k]),!i||o?null:c.jsx(_o,{open:!0,onOpenChange:S=>{S||k("rejected")},children:c.jsxs(Ro,{children:[c.jsx(Oo,{"data-testid":"remote-pairing-confirm-overlay",className:"app-overlay fixed inset-0 z-[80]"}),c.jsx("div",{className:"pointer-events-none fixed inset-0 z-[90] grid place-items-center p-4",children:c.jsxs(Do,{"data-testid":"remote-pairing-confirm",className:"dialog-scale-pop elev-2 pointer-events-auto w-[440px] max-w-[calc(100vw-32px)] rounded-lg border p-5",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},children:[c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx("div",{"aria-hidden":!0,className:"flex h-9 w-9 shrink-0 items-center justify-center rounded",style:{background:"color-mix(in oklab, var(--accent) 14%, transparent)",color:"var(--accent)",border:"1px solid color-mix(in oklab, var(--accent) 30%, transparent)"},children:c.jsx(EE,{size:18})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx(Mo,{className:"text-lg font-semibold text-pri",children:t("remote.confirm.title")}),c.jsx(ti,{className:"mt-1.5 text-sm text-sec",children:t("remote.confirm.description",{name:g})})]})]}),c.jsxs("div",{className:"mt-4",children:[c.jsx("div",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-ter",children:t("remote.confirm.sasLabel")}),c.jsx("div",{"data-testid":"remote-pairing-sas",className:"rounded border bg-2 py-3 text-center font-mono text-3xl tracking-[0.4em] text-pri",style:{borderColor:"var(--border)"},children:i.sas}),c.jsx("p",{className:"mt-2 text-xs text-ter",children:t("remote.confirm.warning")})]}),c.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[c.jsx("button",{type:"button","data-testid":"remote-pairing-reject",onClick:()=>{k("rejected")},disabled:u,className:"icon-btn",children:t("remote.confirm.reject")}),c.jsx("button",{type:"button","data-testid":"remote-pairing-confirm-action",onClick:()=>{v()},disabled:u,className:"icon-btn icon-btn--primary",children:t(u?"remote.confirm.confirming":"remote.confirm.confirm")})]})]})})]})})},vR=t=>!!t?.some(a=>a.status==="working"),yR=t=>t?.filter(a=>a.status==="working").length??0,bR=(t,a)=>{if(!t||t.length===0)return a("sidebar.noMembers");const o=t.filter(i=>i.status==="working").length;return o>0?a("sidebar.workingCount",{working:o,total:t.length}):a("sidebar.teamMemberCount",{count:t.length})},hx="hive.sidebar.githubDismissed",wR="https://www.bilibili.com/video/BV1UHLp6nEQR",xR=()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(hx)==="1"}catch{return!1}},kR=({activeWorkspaceId:t,collapsed:a=!1,createDisabledReason:o,onCreateClick:i,onDeleteWorkspace:l,onSelectWorkspace:u,onToggleCollapse:f,workersByWorkspaceId:m,workspaces:g})=>{const{t:p}=we(),[y,v]=b.useState(null),[k,S]=b.useState(!1),[T,w]=b.useState(xR),E=en(),C=()=>{w(!0);try{window.localStorage.setItem(hx,"1")}catch{}},j=!!o,_=M=>{v(M)},N=()=>{if(!y||k)return;const M=y;S(!0),Promise.resolve(l(M)).then(()=>{E.show({kind:"success",message:p("sidebar.removed",{name:M.name})})}).catch(L=>{const U=L instanceof Error?L.message:String(L);E.show({kind:"error",message:p("sidebar.deleteFailed",{message:U})})}).finally(()=>{S(!1),v(null)})},O=c.jsx(oi,{open:y!==null,onOpenChange:M=>{!M&&!k&&v(null)},title:y?p("sidebar.deleteConfirm",{name:y.name}):p("sidebar.deleteLabel"),description:y?p("sidebar.deleteDescription",{path:y.path,summary:bR(m[y.id],p)}):"",confirmLabel:p(k?"sidebar.deleting":"sidebar.deleteLabel"),confirmKind:"danger",onConfirm:N});return c.jsxs("nav",{"aria-label":"Workspaces",className:"flex h-full flex-col",children:[c.jsxs("div",{className:"ws-sidebar-header flex items-center justify-between gap-2 px-3 pt-3 pb-2",style:{boxShadow:"inset 0 -1px 0 var(--border)"},children:[c.jsxs("div",{className:"ws-sidebar-title flex min-w-0 items-center gap-2",children:[c.jsx("span",{className:"ws-sidebar-title__text text-xs font-medium text-ter","data-testid":"workspace-sidebar-title",children:p("sidebar.workspaces")}),g&&g.length>0?c.jsx("span",{className:"ws-sidebar-count mono rounded bg-2 px-1.5 py-0.5 text-xs text-ter",children:g.length}):null]}),f?c.jsx(Qe,{side:"right",label:p(a?"layout.sidebarExpand":"layout.sidebarCollapse"),children:c.jsx("button",{type:"button","aria-label":p(a?"layout.sidebarExpand":"layout.sidebarCollapse"),"aria-expanded":!a,"data-testid":"workspace-sidebar-toggle",onClick:f,className:"ws-collapse-toggle",children:a?c.jsx(ES,{size:16,"aria-hidden":!0}):c.jsx(kS,{size:16,"aria-hidden":!0})})}):null]}),g===null?c.jsx("p",{className:"px-3 py-2 text-xs text-ter",children:p("common.loading")}):g.length===0?c.jsx("div",{className:"ws-empty flex-1 px-2 py-4",children:c.jsx("div",{className:"ws-empty__wide",children:c.jsx(ri,{title:p("sidebar.noWorkspaces"),description:o??p("sidebar.noWorkspacesDesc"),icon:c.jsx(Kb,{size:20}),action:c.jsxs("button",{type:"button",onClick:j?void 0:i,disabled:j,"aria-label":p("sidebar.newWorkspace"),title:o??p("sidebar.newWorkspace"),className:"icon-btn icon-btn--primary mt-1 flex items-center gap-1.5 px-4 py-2 text-xs font-medium disabled:cursor-not-allowed disabled:opacity-50",children:[c.jsx(Kl,{size:14,"aria-hidden":!0}),p("sidebar.newWorkspace")]})})})}):c.jsxs("ul",{className:"flex-1 scroll-y pb-2",children:[g.map(M=>{const L=m[M.id],U=M.id===t,q=vR(L),ae=yR(L);return c.jsxs("li",{className:"group relative",children:[c.jsx(Qe,{side:"right",label:c.jsxs("span",{className:"flex flex-col gap-0.5",children:[c.jsx("span",{className:"font-medium",children:M.name}),c.jsx("span",{className:"mono text-ter",children:M.path})]}),children:c.jsxs("button",{type:"button","aria-label":M.name,"aria-current":U?"true":void 0,"data-workspace-path":M.path,onClick:()=>u(M.id),className:`ws-row flex w-full items-center gap-2.5 py-1.5 pr-7 pl-2 text-left pointer-coarse:min-h-11${U?" active":""}`,children:[c.jsx(Jf,{workspaceId:M.id,name:M.name,isActive:!1,working:q,workingCount:ae}),c.jsx("span",{className:`min-w-0 flex-1 truncate text-sm ${U?"font-medium text-pri":"text-pri"}`,children:M.name})]})}),c.jsx(Qe,{side:"right",label:c.jsxs("span",{className:"flex flex-col gap-0.5",children:[c.jsx("span",{className:"font-medium",children:M.name}),c.jsx("span",{className:"mono text-ter",children:M.path})]}),children:c.jsx("button",{type:"button","aria-label":M.name,"aria-current":U?"true":void 0,onClick:()=>u(M.id),className:"ws-avatar-cell hidden w-full justify-center py-2","data-testid":"ws-avatar-cell",children:c.jsx(Jf,{workspaceId:M.id,name:M.name,isActive:U,working:q,workingCount:ae})})}),c.jsx(Qe,{label:p("sidebar.deleteAria",{name:M.name}),children:c.jsx("button",{type:"button","aria-label":p("sidebar.deleteAria",{name:M.name}),onClick:()=>_(M),className:"ws-row-delete absolute top-2 right-2 flex h-6 w-6 items-center justify-center rounded text-ter opacity-0 transition-colors pointer-coarse:h-10 pointer-coarse:w-10 hover:text-status-red focus:opacity-100 group-hover:opacity-100",children:c.jsx(hc,{size:14,"aria-hidden":!0})})})]},M.id)}),c.jsx("li",{children:c.jsx(Qe,{label:o??p("sidebar.newWorkspace"),children:c.jsxs("button",{type:"button",onClick:j?void 0:i,disabled:j,"aria-label":p("sidebar.newWorkspace"),title:o??void 0,className:"ws-add ws-add--inline flex items-center justify-center gap-1.5 rounded border border-dashed px-3 py-2 text-xs font-medium text-sec transition-colors disabled:cursor-not-allowed disabled:opacity-50",style:{borderColor:"var(--border-bright)"},children:[c.jsx(Kl,{size:14,"aria-hidden":!0}),c.jsx("span",{className:"ws-add__label",children:p("sidebar.newWorkspace")})]})})})]}),T?null:c.jsxs("div",{className:"ws-sidebar-footer group relative",children:[c.jsxs("a",{href:wR,target:"_blank",rel:"noopener noreferrer","aria-label":p("sidebar.openDemoVideo"),title:p("sidebar.openDemoVideo"),className:"ws-sidebar-footer__link flex items-center gap-2.5 px-3 py-3 text-sm text-ter transition-colors hover:text-pri",children:[c.jsx("img",{src:"/bilibili.ico",alt:"","aria-hidden":"true",className:"h-[18px] w-[18px] rounded-[4px] object-cover",draggable:!1}),c.jsx("span",{className:"ws-sidebar-footer__label",children:p("sidebar.demoVideo")})]}),c.jsxs("a",{href:"https://github.com/tt-a1i/hive",target:"_blank",rel:"noopener noreferrer","aria-label":p("sidebar.openRepository"),title:p("sidebar.openRepository"),className:"ws-sidebar-footer__link flex items-center gap-2.5 px-3 py-3 text-sm text-ter transition-colors hover:text-pri",children:[c.jsx("svg",{width:"18",height:"18",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:c.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"})}),c.jsx("span",{className:"ws-sidebar-footer__label",children:"GitHub"})]}),c.jsx("button",{type:"button","aria-label":p("sidebar.dismissRepository"),title:p("sidebar.dismissRepository"),onClick:C,className:"ws-sidebar-footer__dismiss absolute top-1.5 right-1.5 flex h-4 w-4 items-center justify-center rounded text-ter opacity-0 transition-opacity pointer-coarse:h-8 pointer-coarse:w-8 hover:bg-3 hover:text-pri focus:opacity-100 group-hover:opacity-100",children:c.jsx(Ka,{size:10,"aria-hidden":!0})})]}),O]})},Bn=/^(\s*)-\s+\[( |x|X)\]\s+(.*)$/,SR=/(?:^|[\s\p{P}])(@[A-Za-z0-9_-]+)/gu,ER=t=>{const a=[];for(const o of t.matchAll(SR))o[1]&&a.push(o[1]);return a},CR=t=>{const a=new Map;for(const o of t){const i=o.trim();i&&a.set(i.toLowerCase(),i)}return a},_M=(t,a={})=>{const o=[],i=[],l=t.split(/\r?\n/),u=a.knownWorkerNames?CR(a.knownWorkerNames):null;for(let f=0;f<l.length;f++){const m=l[f];if(!m)continue;const g=m.match(Bn);if(!g)continue;const[,p="",y=" ",v=""]=g,k=p.replace(/\t/g," ").length,S=ER(v);let T;if(u){T=[];for(const j of S){const _=u.get(j.slice(1).toLowerCase());_&&T.push(`@${_}`)}}else T=S;let w=v;for(const j of T){const _=j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");w=w.replace(new RegExp(`(?:^|(?<=\\s|\\p{P}))${_}(?!\\w)`,"u"),"")}w=w.replace(/\s+/g," ").trim();const E={checked:y.toLowerCase()==="x",children:[],indent:k,line:f,mentions:T,text:w};for(;i.length>0;){const j=i[i.length-1];if(j&&j.indent<k)break;i.pop()}const C=i[i.length-1];C?C.children.push(E):o.push(E),i.push(E)}return o},TR=t=>{let a=0;const o=[],i=t.split(/\r?\n/);for(const l of i){if(!l)continue;const u=l.match(Bn);if(!u)continue;const[,f="",m=" "]=u,g=f.replace(/\t/g," ").length;for(;o.length>0;){const p=o[o.length-1];if(p&&p.indent<g)break;o.pop()}!o[o.length-1]&&m.toLowerCase()!=="x"&&(a+=1),o.push({indent:g})}return a},RM=t=>{if(t.children.length===0)return null;let a=0;for(const o of t.children)o.checked&&(a+=1);return{done:a,total:t.children.length}},si=t=>t.includes(`\r
81
+ `)?`\r
82
+ `:`
83
+ `,NR=(t,a)=>{const o=si(t),i=t.length>0&&!t.endsWith(`
84
+ `);return`${t}${i?o:""}- [ ] ${a}${o}`},jR=(t,a)=>{const o=t.split(/\r?\n/),i=o[a];if(i===void 0)return t;const l=i.match(Bn);if(!l)return t;const u=(l[2]??" ").toLowerCase()==="x",f=i.replace(Bn,(m,g,p,y)=>`${g}- [${u?" ":"x"}] ${y}`);return o[a]=f,o.join(si(t))},gx=t=>t.replace(/\r?\n/g," ").replace(/\s+/g," ").trim(),AR=(t,a,o)=>{const i=t.split(/\r?\n/),l=i[a];if(l===void 0||!l.match(Bn))return t;const f=gx(o);if(!f)return t;const m=l.replace(Bn,(g,p,y)=>`${p}- [${y}] ${f}`);return i[a]=m,i.join(si(t))},_R=(t,a)=>{const o=t.split(/\r?\n/),i=o[a];if(i===void 0)return t;const l=i.match(Bn);if(!l)return t;const u=(l[1]??"").replace(/\t/g," ").length;let f=a+1;for(;f<o.length;){const m=o[f];if(m===void 0)break;const g=m.match(Bn);if(!g||(g[1]??"").replace(/\t/g," ").length<=u)break;f+=1}return o.splice(a,f-a),o.join(si(t))},RR=(t,a,o)=>{const i=gx(o);if(!i)return t;const l=t.split(/\r?\n/),u=l[a];if(u===void 0)return t;const f=u.match(Bn);if(!f)return t;const m=f[1]??"",g=m.replace(/\t/g," ").length;let p=a+1;for(;p<l.length;){const v=l[p];if(v===void 0)break;const k=v.match(Bn);if(!k||(k[1]??"").replace(/\t/g," ").length<=g)break;p+=1}const y=`${m} `;return l.splice(p,0,`${y}- [ ] ${i}`),l.join(si(t))},OR=(t,a,o)=>t===a||t===o,DR=(t,a)=>{const[o,i]=b.useState(""),[l,u]=b.useState(!1),[f,m]=b.useState(!1),[g,p]=b.useState(null),y=b.useRef(!1),v=b.useRef(""),k=b.useRef(""),S=b.useCallback((w,E)=>{if(!y.current){v.current=w,k.current=w,i(w),m(!1),p(null);return}OR(w,v.current,E)||(p(w),m(!0))},[]);if(b.useEffect(()=>{if(!t){i(""),u(!1),m(!1),p(null),y.current=!1,v.current="",k.current="";return}let w=!1;return i(""),u(!1),m(!1),p(null),y.current=!1,v.current="",k.current="",lN(t).then(({content:E})=>{w||(v.current=E,y.current=!1,k.current=E,i(E),u(!0),m(!1),p(null))}).catch(E=>{w||(v.current="",y.current=!1,k.current="",i(""),u(!0),m(!1),console.error("[hive] swallowed:tasks.initialLoad",E),p(null))}),()=>{w=!0}},[t]),b.useEffect(()=>{if(!t)return;let w=!1,E=null,C=0,j=null;const _=()=>{if(w)return;const N=H0().openWebSocket(`/ws/tasks/${t}`);j=N,N.onmessage=O=>{if(w)return;const M=JSON.parse(String(O.data));M.type!=="tasks-snapshot"&&M.type!=="tasks-updated"||typeof M.content=="string"&&(C=0,S(M.content,k.current))},N.onclose=()=>{if(w)return;C+=1;const O=Math.min(3e4,500*2**(C-1));E=setTimeout(_,O)}};return _(),()=>{w=!0,E!==null&&(clearTimeout(E),E=null),j?.close()}},[S,t]),a!==void 0)return{content:a,hasConflict:!1,loaded:!0,onChange:w=>{},onKeepLocal:()=>{},onReload:()=>{},onSave:async()=>{},toggleTaskAtLine:async w=>{},appendTask:async w=>{},appendSubtask:async(w,E)=>{},updateTaskText:async(w,E)=>{},deleteTask:async w=>{}};const T=async(w,E)=>{if(!t)return;const C=k.current,j=w(C);if(j!==C){v.current=j,k.current=j,y.current=!1,i(j);try{const _=await Al(t,{content:j});v.current=_.content,k.current=_.content,i(_.content)}catch(_){throw v.current=C,k.current=C,i(C),console.error(`[hive] swallowed:tasks.${E}`,_),_}}};return{content:o,hasConflict:f,loaded:l,onChange:w=>{y.current=w!==v.current,k.current=w,i(w)},onKeepLocal:()=>{m(!1),p(null)},onReload:()=>{const w=g??v.current;v.current=w,y.current=!1,k.current=w,i(w),m(!1),p(null)},onSave:async()=>{if(!t)return;const w=await Al(t,{content:o});v.current=w.content,y.current=!1,k.current=w.content,i(w.content),m(!1),p(null)},toggleTaskAtLine:async w=>{if(!t)return;const E=k.current,C=jR(E,w);if(C!==E){v.current=C,k.current=C,y.current=!1,i(C);try{const j=await Al(t,{content:C});v.current=j.content,k.current=j.content,i(j.content)}catch(j){throw v.current=E,k.current=E,i(E),j}}},appendTask:async w=>{const E=w.trim();if(!t||!E)return;const C=k.current,j=NR(C,E);v.current=j,k.current=j,y.current=!1,i(j);try{const _=await Al(t,{content:j});v.current=_.content,k.current=_.content,i(_.content)}catch(_){throw v.current=C,k.current=C,i(C),_}},appendSubtask:async(w,E)=>{const C=E.trim();C&&await T(j=>RR(j,w,C),"appendSubtask")},updateTaskText:async(w,E)=>{const C=E.trim();C&&await T(j=>AR(j,w,C),"updateTaskText")},deleteTask:async w=>{await T(E=>_R(E,w),"deleteTask")}}},MR=3e3,vx=(t,a,o)=>{const i=new Set(t.map(u=>u.run_id)),l=new Set(t.map(u=>u.agent_id));return[...t,...a.filter(u=>i.has(u.run_id)?!1:o&&wc(u,o)?!0:!l.has(u.agent_id))]},LR=(t,a)=>{const[o,i]=b.useState({}),l=b.useRef(new Map);b.useEffect(()=>()=>{for(const p of l.current.values())window.clearTimeout(p);l.current.clear()},[]);const u=b.useCallback((p,y)=>{i(v=>({...v,[p]:(v[p]??[]).filter(k=>k.agent_id!==y)}))},[]),f=b.useCallback((p,y)=>{const v=l.current.get(y);v&&window.clearTimeout(v),l.current.delete(y),i(k=>({...k,[p]:(k[p]??[]).filter(S=>S.run_id!==y)}))},[]);b.useEffect(()=>{if(!t||a.length===0)return;const p=new Set(a.map(y=>y.run_id));i(y=>{const v=y[t]??[],k=v.filter(S=>{if(!p.has(S.run_id))return!0;const T=l.current.get(S.run_id);return T&&window.clearTimeout(T),l.current.delete(S.run_id),!1});return k.length===v.length?y:{...y,[t]:k}})},[a,t]);const m=b.useCallback(({agentId:p,agentName:y,runId:v,status:k="starting",terminalInputProfile:S="default",workspaceId:T})=>{const w={agent_id:p,agent_name:y,run_id:v,status:k,terminal_input_profile:S};i(j=>{const _=wc(w,T),N=(j[T]??[]).filter(O=>O.run_id===w.run_id?!1:_?!0:O.agent_id!==w.agent_id);return{...j,[T]:[...N,w]}});const E=l.current.get(v);E&&window.clearTimeout(E);const C=window.setTimeout(()=>{i(j=>({...j,[T]:(j[T]??[]).filter(_=>_.run_id!==v)})),l.current.delete(v)},MR);l.current.set(v,C)},[]),g=b.useMemo(()=>vx(a,t?o[t]??[]:[],t),[a,o,t]);return{forgetOptimisticAgent:u,forgetOptimisticRun:f,optimisticRunsByWorkspaceId:o,recordOptimisticRun:m,terminalRuns:g}};let yx=null;const nm=new Set,zR=t=>{yx=t;for(const a of nm)a()},HR=t=>(nm.add(t),()=>nm.delete(t)),BR=()=>yx,bx="hive.package-update.dismissed-version",UR=()=>{try{return window.localStorage.getItem(bx)}catch{return null}},WR=t=>{try{window.localStorage.setItem(bx,t)}catch{}},Qy=({currentVersion:t=Fm,versionInfo:a})=>{const{t:o}=we(),i=wt(),[l,u]=b.useState(UR),[f,m]=b.useState("idle"),g=a?.updateAvailable&&a.latestVersion!==t?a:null;if(!g||l===g.latestVersion)return null;const p=!!g.installHint,y=o(f==="copied"?"packageUpdate.commandCopied":f==="error"?"packageUpdate.commandCopyFailed":"packageUpdate.copyCommand"),v=()=>{WR(g.latestVersion),u(g.latestVersion)},k=async()=>{if(g.installHint)try{await navigator.clipboard.writeText(g.installHint),m("copied"),window.setTimeout(()=>m("idle"),1600)}catch{m("error"),window.setTimeout(()=>m("idle"),2200)}};return c.jsxs("div",{className:"package-update-toast elev-2 toast-pop fixed right-4 bottom-24 z-50 flex w-[min(420px,calc(100vw-2rem))] items-start gap-3 rounded border px-3 py-2.5",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},"data-mobile":i||void 0,"data-testid":"package-update-toast",role:"status","aria-live":"polite",children:[c.jsx("div",{className:"mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center rounded border",style:{background:"color-mix(in oklab, var(--accent) 10%, transparent)",borderColor:"color-mix(in oklab, var(--accent) 28%, transparent)",color:"var(--accent)"},"aria-hidden":!0,children:c.jsx(cE,{size:15})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:"font-medium text-pri text-xs",children:o("packageUpdate.title",{version:g.latestVersion})}),c.jsx("div",{className:"mt-0.5 text-ter text-xs",children:o("packageUpdate.body",{current:t,latest:g.latestVersion})}),p?c.jsx("code",{className:"mono mt-2 block truncate rounded border px-2 py-1 text-ter text-xs",title:g.updateNote||g.installHint,style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:g.installHint}):g.updateNote?c.jsx("div",{className:"mt-2 text-ter text-xs",children:g.updateNote}):null,c.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[p?c.jsxs("button",{type:"button",className:"icon-btn icon-btn--primary","data-testid":"package-update-copy-command",onClick:k,"aria-label":y,title:y,children:[f==="copied"?c.jsx(Ga,{size:13}):c.jsx(Cr,{size:13}),c.jsx("span",{children:y})]}):null,g.releaseUrl?c.jsxs("a",{href:g.releaseUrl,target:"_blank",rel:"noopener noreferrer",className:"icon-btn","data-testid":"package-update-open-release","aria-label":o("packageUpdate.openRelease"),title:o("packageUpdate.openRelease"),children:[c.jsx(xm,{size:13}),c.jsx("span",{children:o("packageUpdate.release")})]}):null,c.jsx("button",{type:"button",className:"icon-btn","data-testid":"package-update-dismiss",onClick:v,children:o("packageUpdate.later")})]})]}),c.jsx(Qe,{label:o("common.dismiss"),children:c.jsx("button",{type:"button",className:"flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded text-ter transition-colors hover:bg-3 hover:text-pri focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)]","data-testid":"package-update-close",onClick:v,"aria-label":o("common.dismiss"),children:c.jsx(Ka,{size:13})})})]})},IR=(t=typeof window<"u"?window.matchMedia.bind(window):void 0,a=typeof navigator<"u"?navigator.standalone:void 0)=>t?.("(display-mode: standalone)").matches?!0:a===!0,qR=t=>{if(!t||!(t instanceof HTMLElement))return!1;const a=t.tagName.toLowerCase();return!!(a==="input"||a==="textarea"||a==="select"||t.isContentEditable||t.closest(".xterm"))},PR=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform),FR=(t,a)=>a?t.metaKey:t.ctrlKey,KR=(t,a,o=PR)=>!(t.key.toLowerCase()!==a.key||(a.mod??!1)!==FR(t,o)||(a.alt??!1)!==t.altKey||(a.shift??!1)!==t.shiftKey),YR=t=>{b.useEffect(()=>{const a=o=>{if(!qR(o.target))for(const i of t){if(!KR(o,i))continue;i.handler(o)!==!1&&o.preventDefault();return}};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[t])},$R=({bootstrapError:t,onSelectWorkspace:a,onTriggerAddDialog:o,workspaces:i})=>{const l=b.useMemo(()=>{if(!IR())return[];const u=(i??[]).slice(0,9).map((f,m)=>({key:String(m+1),mod:!0,handler:()=>a(f.id)}));return[{key:"n",mod:!0,shift:!0,handler:()=>{t||o()}},...u]},[t,a,o,i]);YR(l)},VR=15e3,GR=async(t,a=VR)=>new Promise((o,i)=>{let l=!1;const u=window.setTimeout(()=>{l=!0,i(new Error("Hive runtime bootstrap timed out"))},a);t.then(f=>{l||(l=!0,window.clearTimeout(u),o(f))},f=>{l||(l=!0,window.clearTimeout(u),i(f))})}),XR=(t,a)=>a&&t.some(o=>o.id===a)?a:t[0]?.id??null,ZR=(t,a)=>{if(t===null)return a;const o=new Map(t.map(i=>[i.id,i]));for(const i of a)o.set(i.id,i);return Array.from(o.values())},QR=(t,a,o)=>{b.useEffect(()=>{let i=!1;const l=W0().then(async()=>{const[u,f]=await Promise.all([zT(),qT().catch(()=>null)]);return{items:u,persistedId:f}});return GR(l).then(({items:u,persistedId:f})=>{i||t(m=>{const g=ZR(m,u),p=XR(g,f);return a(p),f!==p&&q0(p).catch(y=>{console.error("[hive] swallowed:initSession.save",y)}),g})}).catch(u=>{i||(a(null),o&&o("Could not reach Hive runtime. Refresh once the runtime is back up.")),console.error("[hive] swallowed:initSession.bootstrap",u)}),()=>{i=!0}},[a,t,o])},JR=()=>{const t=b.useRef(null);return b.useCallback(a=>{if(typeof document>"u")return;const o=typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(a):a.replace(/"/g,'\\"'),i=document.querySelector(`[data-worker-name="${o}"]`);i&&(i.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"}),i.classList.add("worker-card-shell--highlight"),t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{i.classList.remove("worker-card-shell--highlight"),t.current=null},1e3))},[])},e4=({onWorkspaceCreated:t,onError:a})=>{const{language:o}=we(),[i,l]=b.useState({}),[u,f]=b.useState({}),m=b.useCallback((p,y)=>{l(v=>({...v,[p]:y.ok?null:y.error})),f(v=>({...v,[p]:y.ok?y.run_id:null}))},[]),g=b.useCallback(async p=>{try{const y=await UT({name:p.name,path:p.path,autostart_orchestrator:!0,command_preset_id:p.commandPresetId,startup_command:p.startupCommand??null,ui_language:o});return m(y.id,y.orchestrator_start),t({id:y.id,name:y.name,path:y.path}),y}catch(y){const v=y instanceof Error?y.message:"Failed to create workspace";throw a?.(v),y}},[o,t,a,m]);return{orchestratorAutostartErrors:i,orchestratorAutostartRunIds:u,recordOrchestratorResult:m,createNewWorkspace:g}},t4=(t,a)=>{const o=t.findIndex(l=>l.id===a),i=t.filter(l=>l.id!==a);return o<0?i[0]?.id??null:i[Math.min(o,i.length-1)]?.id??null},n4=({activeWorkspaceId:t,onActiveDeleted:a,selectWorkspace:o,setWorkersByWorkspaceId:i,setWorkspaces:l,workspaces:u})=>async f=>{const g=t4(u??[],f.id);await WT(f.id),l(p=>p?.filter(y=>y.id!==f.id)??p),i(p=>{const y={...p};return delete y[f.id],y}),f.id===t&&(a(),o(g))},a4=()=>{const[t,a]=b.useState(null),o=b.useRef(Promise.resolve());return{activeWorkspaceId:t,selectWorkspace:l=>{a(l),o.current=o.current.catch(Ua("selectWorkspace.prevQueue")).then(()=>q0(l)).catch(Ua("selectWorkspace.save"))},setActiveWorkspaceId:a}},wx=500,r4=5e3,o4=5e3,s4=()=>({failureCount:0,inFlight:!1,lastSettledAt:null}),i4=(t,a)=>Math.min((a?wx:r4)*2**t,o4),l4=(t,a)=>t.length!==a.length?!1:t.every((o,i)=>{const l=a[i];return l!==void 0&&o.commandPresetId===l.commandPresetId&&o.id===l.id&&o.lastPtyLine===l.lastPtyLine&&o.name===l.name&&o.pendingTaskCount===l.pendingTaskCount&&o.role===l.role&&o.status===l.status}),Jy=(t,a)=>{const o=Object.keys(t),i=Object.keys(a);return o.length!==i.length?!1:i.every(l=>Object.hasOwn(t,l)&&l4(t[l]??[],a[l]??[]))},c4=(t,a={})=>{const o=t.join("\0"),i=b.useRef(a.activeWorkspaceId),l=b.useRef(new Map),u=b.useRef(null),[f,m]=b.useState({});return i.current=a.activeWorkspaceId,b.useEffect(()=>{if(!o){m({}),l.current.clear();return}let g=!1,p;const y=o.split("\0"),v=new Set(y);for(const C of l.current.keys())v.has(C)||l.current.delete(C);m(C=>{const j={};for(const _ of y)j[_]=C[_]??[];return Jy(C,j)?C:j});const k=C=>{let j=l.current.get(C);return j||(j=s4(),l.current.set(C,j)),j},S=C=>i.current===C,T=C=>{const j=k(C);j.inFlight||(j.inFlight=!0,GT(C).then(_=>{g||(j.failureCount=0,m(N=>{if(!v.has(C))return N;const O={};for(const M of y)O[M]=M===C?_:N[M]??[];return Jy(N,O)?N:O}))}).catch(_=>{g||(j.failureCount=Math.min(j.failureCount+1,4),console.error("[hive] swallowed:workspaceWorkers.list",_))}).finally(()=>{j.inFlight=!1,j.lastSettledAt=g?null:Date.now()}))},w=()=>{const C=Date.now();for(const j of y){const _=k(j);if(_.inFlight)continue;if(_.lastSettledAt===null){T(j);continue}const N=i4(_.failureCount,S(j));C-_.lastSettledAt>=N&&T(j)}},E=(C=wx)=>{g||(p!==void 0&&window.clearTimeout(p),p=window.setTimeout(()=>{p=void 0,w(),E()},C))};return u.current=()=>{p!==void 0&&(window.clearTimeout(p),p=void 0),w(),E()},w(),E(),()=>{g=!0,p!==void 0&&window.clearTimeout(p),u.current&&(u.current=null)}},[o]),b.useEffect(()=>{const g=a.activeWorkspaceId;if(!g||!o.split("\0").includes(g))return;const p=l.current.get(g);p&&!p.inFlight&&(p.lastSettledAt=null,p.failureCount=0),u.current?.()},[a.activeWorkspaceId,o]),[f,m]},am="hive:terminal-visible-resize",u4=t=>new CustomEvent(am,{detail:{runId:t}}),d4="\x1B[200~",eb="\x1B[201~",f4=(t,a)=>{const o=t.split(eb).join("");return a?.modes?.bracketedPasteMode===!1?o:`${d4}${o}${eb}`},kn="\x1B",tb="\x07",m4=new RegExp(`${kn}\\[[0-?]*[ -/]*[@-~]`,"gu"),p4=new RegExp(`${kn}\\][^${tb}${kn}]*(?:${tb}|${kn}\\\\)`,"gu"),h4=new RegExp("[\0-]","gu"),g4=new RegExp(`${kn}\\[([0135]) q`,"gu"),v4=new RegExp(`${kn}\\[[0135] q`,"u"),xx=new RegExp(`${kn}\\[[0-?]*K`,"u"),y4=new RegExp(`${kn}\\[[0-9]*D`,"u"),b4="\b",w4=t=>{switch(t){case"3":return"4";case"5":return"6";default:return"2"}},x4=t=>t.replace(p4,"").replace(m4,"").replace(h4,""),k4=t=>x4(t).trim().length>0,S4=t=>xx.test(t)&&(y4.test(t)||t.includes(b4)),E4=t=>!k4(t)&&t.includes(`${kn}[?2026`)&&t.includes(`${kn}[?25`)&&v4.test(t)&&xx.test(t)&&!S4(t),nb=t=>({chunk:t.replace(g4,(a,o)=>`${kn}[${w4(o)} q`),suppress:E4(t)}),C4=(t,a)=>{let o,i=!1,l=!1;const u=()=>{t.value="",t.scrollLeft=0,t.scrollTop=0},f=()=>{o!==void 0&&clearTimeout(o),o=setTimeout(()=>{o=void 0,i=!1,l=!1,a.setComposing(!1)},0)},m=T=>T.data||t.value,g=T=>T.inputType==="insertText"||T.inputType==="insertFromComposition"||T.inputType==="insertReplacementText"||T.inputType==="insertDictationResult",p=()=>{i=!0,l=!1,a.setComposing(!0)},y=()=>{i=!0,a.setComposing(!0)},v=T=>{const E=T.data||t.value;!l&&E&&a.commit(E),u(),f()},k=T=>{const w=T;if(i||w.isComposing){if(g(w)){const E=m(w);E&&(a.commit(E),l=!0),u()}return}w.defaultPrevented&&g(w)&&u()},S={capture:!0};return t.addEventListener("compositionstart",p,S),t.addEventListener("compositionupdate",y,S),t.addEventListener("compositionend",v,S),t.addEventListener("input",k,S),()=>{o!==void 0&&clearTimeout(o),t.removeEventListener("compositionstart",p,S),t.removeEventListener("compositionupdate",y,S),t.removeEventListener("compositionend",v,S),t.removeEventListener("input",k,S)}},T4=()=>typeof navigator>"u"?!1:/Mac|iPhone|iPad/.test(navigator.platform),Dn={killToLineStart:"",lineStart:"",lineEnd:"",killWordBack:"\x1B",wordBack:"\x1Bb",wordForward:"\x1Bf",shiftEnter:"\x1B[13;2u"},N4=(t,a={})=>{const o=a.isMac??T4();if(t.key==="Enter"&&t.shiftKey)return t.type==="keypress"?{kind:"send",bytes:Dn.shiftEnter}:{kind:"block"};if(!o&&t.type==="keydown"&&t.ctrlKey&&!t.shiftKey&&!t.altKey&&!t.metaKey&&(t.key==="c"||t.key==="C")&&a.hasSelection)return{kind:"copy"};if(!o||t.type!=="keydown")return{kind:"passthrough"};const i=t.metaKey&&!t.ctrlKey&&!t.altKey&&!t.shiftKey,l=t.altKey&&!t.metaKey&&!t.ctrlKey;if(i)switch(t.key){case"Backspace":return{kind:"send",bytes:Dn.killToLineStart};case"ArrowLeft":return{kind:"send",bytes:Dn.lineStart};case"ArrowRight":return{kind:"send",bytes:Dn.lineEnd};case"k":case"K":return{kind:"clear"}}if(l)switch(t.key){case"Backspace":return{kind:"send",bytes:Dn.killWordBack};case"ArrowLeft":return{kind:"send",bytes:Dn.wordBack};case"ArrowRight":return{kind:"send",bytes:Dn.wordForward}}return{kind:"passthrough"}},j4=16,A4=.3,_4={up:"A",down:"B",right:"C",left:"D"},rm=(t,a)=>{const o=_4[a];return t?`\x1BO${o}`:`\x1B[${o}`},R4=(t,a,o)=>a==="codex"||a==="grok"||a==="opencode"?o==="up"?"\x1B[5~":"\x1B[6~":rm(t.modes?.applicationCursorKeysMode,o),O4=t=>t==="codex"||t==="grok"||t==="opencode",kx=(t,a="default")=>{let o=0;return i=>{if(t.buffer?.active?.type!=="alternate")return o=0,{handled:!1,input:null};if(!O4(a)&&t.modes?.mouseTrackingMode&&t.modes.mouseTrackingMode!=="none")return o=0,{handled:!1,input:null};if(i.deltaY===0||i.shiftKey)return{handled:!1,input:null};let l=i.deltaY;return i.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(l/=j4,Math.abs(i.deltaY)<50&&(l*=A4),o+=l,l=Math.trunc(o),o%=1):o=0,l===0?{handled:!0,input:null}:{handled:!0,input:R4(t,a,l<0?"up":"down")}}},D4=({element:t,profile:a="default",sendInput:o,terminal:i})=>{const l=kx(i,a),u=m=>{const{handled:g,input:p}=l(m);return g?(m.preventDefault(),m.stopPropagation(),p&&o(p),!1):!0};if(typeof i.attachCustomWheelEventHandler=="function")return i.attachCustomWheelEventHandler(u),()=>{};const f=m=>{u(m)||m.stopImmediatePropagation()};return t.addEventListener("wheel",f,{capture:!0,passive:!1}),()=>t.removeEventListener("wheel",f,{capture:!0})},M4=(t,a={})=>{switch(t){case"esc":return"\x1B";case"tab":return" ";case"enter":return"\r";case"arrowUp":return rm(a.applicationCursorKeys,"up");case"arrowDown":return rm(a.applicationCursorKeys,"down");case"arrowRight":return a.applicationCursorKeys?"\x1BOC":"\x1B[C";case"arrowLeft":return a.applicationCursorKeys?"\x1BOD":"\x1B[D";case"home":return"\x1B[H";case"end":return"\x1B[F";case"ctrlC":return"";case"ctrlD":return"";case"ctrlZ":return"";case"ctrlL":return"\f";case"ctrlR":return"";case"ctrlU":return Dn.killToLineStart;case"ctrlA":return Dn.lineStart;case"ctrlE":return Dn.lineEnd;case"ctrlW":return""}},L4="Invalid terminal control message",z4=t=>{let a;try{a=JSON.parse(String(t))}catch{return null}if(!a||typeof a!="object")return null;const o=a;return o.type==="error"&&typeof o.message=="string"?{type:"error",message:o.message}:o.type==="exit"&&(o.code===null||typeof o.code=="number")?{type:"exit",code:o.code}:o.type==="restore"&&typeof o.snapshot=="string"?{type:"restore",snapshot:o.snapshot}:null},H4=({initialSize:t,onError:a,onExit:o,onOutput:i,onRestore:l,onClose:u,runId:f})=>{const m=crypto.randomUUID(),g={...t,clientId:m},p=H0(),y=p.openWebSocket(`/ws/terminal/${f}/io`,g),v=p.openWebSocket(`/ws/terminal/${f}/control`,g);let k=!1,S=!1,T=!1;const w=[];let E=null;const C=()=>{S||T||(T=!0,u?.())};y.onclose=C,v.onclose=C;const j=()=>{!E||v.readyState!==v.OPEN||(v.send(JSON.stringify({type:"resize",...E})),E=null)};return y.onmessage=_=>{const N=typeof _.data=="string"?_.data:"",O=M=>{v.readyState===v.OPEN&&v.send(JSON.stringify({type:"output_ack",bytes:M}))};if(!k){w.push({chunk:N,acknowledge:O});return}i(N,O)},v.onopen=()=>{j()},v.onmessage=_=>{const N=z4(_.data);if(!N){a(L4);return}if(N.type==="exit"&&o(N.code),N.type==="error"&&a(N.message),N.type==="restore"){l(N.snapshot),k=!0,v.readyState===v.OPEN&&v.send(JSON.stringify({type:"restore_complete"}));for(const O of w.splice(0))i(O.chunk,O.acknowledge)}},{dispose(){S=!0,y.close(),v.close()},resize(_,N,O,M){E={cols:_,rows:N},O!==void 0&&(E.pixelWidth=O),M!==void 0&&(E.pixelHeight=M),j()},sendBinaryInput(_){if(y.readyState!==y.OPEN)return;const N=new Uint8Array(_.length);for(let O=0;O<_.length;O++)N[O]=_.charCodeAt(O)&255;y.send(N)},sendInput(_){y.readyState===y.OPEN&&y.send(_)}}},B4=16,U4=.08,W4=.96,I4=.025,ab=5,q4=100,P4=8,F4=6,K4=4,Y4=.5,$4=250,V4=24,G4=2,X4=".xterm-viewport",Z4=".xterm-screen";function Q4({element:t,profile:a="default",sendInput:o,terminal:i}){let l=null,u=0,f=0,m,g=0,p=null,y=0,v=!1,k=null,S=null,T=B4,w=0,E=0,C=null,j=[];const _=kx(i,a),N=()=>{p!==null&&(window.cancelAnimationFrame(p),p=null)},O=()=>{C!==null&&(window.cancelAnimationFrame(C),C=null)},M=()=>(k?.isConnected||(k=t.querySelector(X4)),k),L=()=>(S?.isConnected||(S=t.querySelector(Z4)),S),U=()=>{const ie=M(),le=i.rows;if(!ie||!le||le<=0)return;const ce=ie.clientHeight/le;ce>=6&&ce<=64&&(T=ce)},q=()=>{const ie=L();ie&&(ie.style.transform=w!==0?`translateY(${-w}px)`:"")},ae=()=>{w!==0&&(w=0,q())},ee=()=>{if(Math.abs(w)>=T/2){const ie=M();if(ie){const le=ie.scrollHeight-ie.clientHeight,ce=w>0?T:-T;ie.scrollTop=Math.min(le,Math.max(0,ie.scrollTop+ce))}}ae()},F=ie=>{const le=M();if(!le)return"missing";const ce=le.scrollHeight-le.clientHeight;if(ce<=0)return ae(),"stuck";const me=w+ie,Te=Math.trunc(me/T);let Ne=me-Te*T;const Se=le.scrollTop,rt=Math.min(ce,Math.max(0,Se+Te*T)),xt=rt!==Se;xt&&(le.scrollTop=rt),(rt<=0&&me<0||rt>=ce&&me>0)&&(Ne=0);const Wt=Ne!==w;return w=Ne,Wt&&q(),xt||Wt?"moved":"stuck"},J=ie=>{u+=ie/T;const le=Math.trunc(u);return u%=1,le===0||i.scrollLines?.(le),!0},X=(ie,le)=>{const ce=[];for(let me=0;me<le;me++){const{handled:Te,input:Ne}=_({deltaMode:WheelEvent.DOM_DELTA_LINE,deltaY:ie,shiftKey:!1});if(!Te)break;Ne&&ce.push(Ne)}return ce.length>0&&o(ce.join("")),ce.length},$=ie=>{f+=ie/T;const le=Math.trunc(f);if(f%=1,le===0)return!1;const ce=a==="codex"||a==="opencode"?K4:F4;return X(le<0?-1:1,Math.min(Math.abs(le),ce))>0},D=ie=>{const le=i.buffer?.active?.type;return le!==m&&(u=0,f=0,m=le,ae()),le==="alternate"?{moved:$(ie),normalBuffer:!1}:{moved:F(ie)==="moved"||J(ie),normalBuffer:!0}},P=()=>{C=null;const ie=E;E=0,ie!==0&&(v=D(ie).normalBuffer)},I=()=>{C===null&&(C=window.requestAnimationFrame(P))},V=(ie,le)=>{j.push({t:ie,y:le}),j.length>P4&&j.shift()},Z=ie=>{const le=ie-q4,ce=j.filter(rt=>rt.t>=le),me=ce[0],Te=ce[ce.length-1];if(!me||!Te||me===Te)return 0;const Ne=Te.t-me.t;if(Ne<=0)return 0;const Se=(me.y-Te.y)/Ne;return Math.max(-ab,Math.min(ab,Se))};let R=0;const B=()=>{if(p=null,R===0)return;if(i.buffer?.active?.type!=="alternate"){R=0;return}const ie=R>0?1:-1,le=Math.min(Math.abs(R),G4);if(X(ie,le)<le){R=0;return}R-=ie*le,R!==0&&(p=window.requestAnimationFrame(B))},re=ie=>{const le=Math.min(32,Math.max(1,ie-y));y=ie;const{moved:ce,normalBuffer:me}=D(g*le);if(!ce||!me){p=null,u=0,g=0,ee();return}if(g*=W4**(le/16.67),Math.abs(g)<I4){p=null,u=0,ee();return}p=window.requestAnimationFrame(re)},ne=ie=>{N(),R=0,O(),E=0,j=[],l=ie.touches.length===1?ie.touches[0]?.clientY??null:null,l!==null&&V(ie.timeStamp,l),g=0,v=!1,M(),U()},de=ie=>{if(l===null||ie.touches.length!==1)return;const le=ie.touches[0]?.clientY??l,ce=l-le;Math.abs(ce)<1||(l=le,ie.preventDefault(),E+=ce,V(ie.timeStamp,le),I())},fe=ie=>{l=null,O(),P();const le=Z(ie.timeStamp);if(j=[],v&&Math.abs(le)>=U4){g=le,y=performance.now(),p=window.requestAnimationFrame(re);return}if(!v&&a!=="opencode"&&Math.abs(le)>=Y4&&i.buffer?.active?.type==="alternate"){const ce=Math.min(V4,Math.round(Math.abs(le)*$4/T));if(ce>0){R=le>0?ce:-ce,p=window.requestAnimationFrame(B);return}}g=0,u=0,ee()},ue=()=>{N(),R=0,O(),E=0,j=[],l=null,u=0,f=0,g=0,v=!1,ae()};return t.addEventListener("touchstart",ne,{passive:!0}),t.addEventListener("touchmove",de,{passive:!1}),t.addEventListener("touchend",fe,{passive:!0}),t.addEventListener("touchcancel",ue,{passive:!0}),()=>{t.removeEventListener("touchstart",ne),t.removeEventListener("touchmove",de),t.removeEventListener("touchend",fe),t.removeEventListener("touchcancel",ue),N(),O(),ae()}}const J4=(t=()=>typeof document<"u"?document.createElement("canvas"):null)=>{const a=t();if(!a||typeof a.getContext!="function")return!1;try{return!!(a.getContext("webgl2")||a.getContext("webgl"))}catch{return!1}},e5=t=>t instanceof Error&&t.message?`Terminal failed to load: ${t.message}`:"Terminal failed to load. Refresh this page and try again.",t5=new RegExp("\x1B\\[M([\\s\\S])([\\s\\S])([\\s\\S])","g"),n5=new TextEncoder,a5=(t,a,o,i)=>{const l=a.charCodeAt(0)-32,u=o.charCodeAt(0)-32,f=i.charCodeAt(0)-32;if(l<0||u<1||f<1)return t;const g=(l&3)===3&&(l&32)===0&&(l&64)===0?"m":"M";return`\x1B[<${l};${u};${f}${g}`},r5=(t,a)=>{if(a!=="grok"&&a!=="opencode")return{binary:!0,chunk:t};const o=t.replace(t5,a5);return{binary:o===t,chunk:o}},o5=(t,a="default")=>{const o=wt(),i=b.useRef(null),[l,u]=b.useState(null),[f,m]=b.useState("connecting"),g=b.useRef("connecting"),[p,y]=b.useState(0),v=b.useRef(null),k=b.useRef(null),S=b.useRef(!1),[T,w]=b.useState("canvas"),[E,C]=b.useState(!1),j=b.useRef(!1),_=b.useCallback(U=>{w(U);const q=i.current;q&&(q.dataset.renderer=U)},[]),N=b.useCallback(U=>{S.current||v.current?.sendInput(U)},[]),O=b.useCallback(U=>{const q=k.current?.modes?.applicationCursorKeysMode;N(M4(U,q===void 0?{}:{applicationCursorKeys:q}))},[N]),M=b.useCallback(U=>{const q=f4(U,k.current??void 0);return v.current?.sendInput(q),q},[]),L=b.useCallback(()=>{const U=()=>{k.current?.scrollToBottom();const q=i.current?.querySelector(".xterm-viewport");q&&(q.scrollTop=q.scrollHeight)};U(),window.requestAnimationFrame(()=>{U(),window.requestAnimationFrame(U)}),window.setTimeout(U,80),j.current=!1,C(!1)},[]);return b.useEffect(()=>{if(!i.current)return;let U=!1,q,ae,ee,F,J,X,$,D,P,I,V,Z=null,R,B,re,ne,de;u(null),g.current="connecting",m("connecting"),j.current=!1,C(!1);const fe=ue=>{g.current!==ue&&(g.current=ue,m(ue))};return Promise.all([Nt(()=>import("./xterm-B-qIQCd3.js"),[]),Nt(()=>import("./addon-fit-DX4qG4td.js"),[]),Nt(()=>import("./addon-unicode11-Bt8F3D7-.js"),[]),Nt(()=>import("./addon-clipboard-wHJhZAA4.js"),[])]).then(([ue,ie,le,ce])=>{if(U||!i.current)return;const me=typeof window<"u"?getComputedStyle(document.documentElement):null,Te=me?.getPropertyValue("--bg-crust").trim()||"#0e0e0e",Ne=me?.getPropertyValue("--text-primary").trim()||"#ebebeb",Se=new ue.Terminal({allowProposedApi:!0,convertEol:!1,fontFamily:"'DM Mono', ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:o?12:13,letterSpacing:0,lineHeight:1,scrollback:1e4,theme:{background:Te,foreground:Ne}}),rt=new ie.FitAddon;Se.loadAddon(rt),Se.loadAddon(new le.Unicode11Addon),Se.unicode.activeVersion="11",Se.loadAddon(new ce.ClipboardAddon),Se.open(i.current),_("canvas"),rt.fit(),X=Se,k.current=Se,$=rt;const xt=()=>{const ke=Se.buffer.active,pe=ke.viewportY<ke.baseY;j.current!==pe&&(j.current=pe,C(pe))},Wt=()=>{ne===void 0&&(ne=window.requestAnimationFrame(()=>{ne=void 0,xt()}))};B=Se.onScroll(Wt),re=Se.buffer.onBufferChange(Wt),I=D4({element:i.current,profile:a,sendInput:ke=>J?.sendInput(ke),terminal:Se}),o&&(V=Q4({element:i.current,profile:a,sendInput:ke=>J?.sendInput(ke),terminal:Se})),Z=i.current.querySelector(".xterm-helper-textarea"),Z&&(R=C4(Z,{setComposing:ke=>{S.current=ke},commit:ke=>J?.sendInput(ke)})),typeof Se.attachCustomKeyEventHandler=="function"&&Se.attachCustomKeyEventHandler(ke=>{const pe=N4(ke,{hasSelection:Se.hasSelection()});switch(pe.kind){case"send":return ke.preventDefault(),J?.sendInput(pe.bytes),!1;case"clear":return ke.preventDefault(),Se.clear(),!1;case"copy":{ke.preventDefault();const Oe=Se.getSelection();return Oe&&navigator.clipboard?.writeText(Oe).catch(()=>{}),Se.clearSelection(),!1}case"block":return!1;case"passthrough":return!0}});const pn=()=>{const ke=i.current;return ke?.isConnected?!ke.closest('[data-terminal-host-parked="true"]'):!1},hn=()=>{if(!i.current)return{};const ke=i.current.clientWidth,pe=i.current.clientHeight,Oe={};return pe>0&&(Oe.pixelHeight=pe),ke>0&&(Oe.pixelWidth=ke),Oe},Nn=()=>{if(!i.current||!pn())return;const ke=hn();if(!ke.pixelHeight||!ke.pixelWidth||de&&de.pixelHeight===ke.pixelHeight&&de.pixelWidth===ke.pixelWidth)return;$?.fit();const pe={cols:X?.cols??80,rows:X?.rows??24,...hn()};de&&de.cols===pe.cols&&de.rows===pe.rows&&de.pixelHeight===pe.pixelHeight&&de.pixelWidth===pe.pixelWidth||(de=pe,J?.resize(pe.cols,pe.rows,pe.pixelWidth,pe.pixelHeight))},tn=()=>{P&&window.clearTimeout(P),P=window.setTimeout(()=>{P=void 0,Nn()},50)};Nt(()=>import("./addon-web-links-DIbG5aQx.js"),[]).then(ke=>{U||X!==Se||Se.loadAddon(new ke.WebLinksAddon)}).catch(()=>{}),J4()&&Nt(()=>import("./addon-webgl-DCtw1yLn.js"),[]).then(ke=>{if(!(U||X!==Se))try{const pe=new ke.WebglAddon;pe.onContextLoss(()=>{pe.dispose(),_("canvas")}),Se.loadAddon(pe),_("webgl"),tn()}catch{_("canvas")}}).catch(()=>{_("canvas")}),J=H4({initialSize:{cols:Se.cols,rows:Se.rows,...hn()},onError(ke){u(ke)},onExit(){fe("stopped")},onOutput(ke,pe){fe("running");const Oe=n5.encode(ke).byteLength;if(a==="codex"){const Xa=nb(ke);if(Xa.suppress){pe(Oe);return}Se.write(Xa.chunk,()=>pe(Oe));return}Se.write(ke,()=>pe(Oe))},onRestore(ke){fe("running"),Se.write(a==="codex"?nb(ke).chunk:ke)},onClose(){U||y(ke=>ke+1)},runId:t}),v.current=J,F=Se.onData(ke=>{S.current||J?.sendInput(ke)}),typeof Se.onBinary=="function"&&(ee=Se.onBinary(ke=>{const pe=r5(ke,a);pe.binary?J?.sendBinaryInput(pe.chunk):J?.sendInput(pe.chunk)})),Nn(),typeof ResizeObserver<"u"&&i.current&&(D=new ResizeObserver(tn),D.observe(i.current)),q=ke=>{ke.detail?.runId===t&&tn()},ae=()=>tn(),window.addEventListener(am,q),window.addEventListener("resize",ae)}).catch(ue=>{U||(u(e5(ue)),fe("stopped"))}),()=>{U=!0,q&&window.removeEventListener(am,q),ae&&window.removeEventListener("resize",ae),D?.disconnect(),P&&window.clearTimeout(P),I?.(),V?.(),R?.(),ne!==void 0&&window.cancelAnimationFrame(ne),B?.dispose(),re?.dispose(),ee?.dispose(),F?.dispose(),J?.dispose(),X?.dispose(),$?.dispose(),v.current=null,k.current=null}},[t,a,p]),{containerRef:i,error:l,status:f,sendInput:N,sendKey:O,beginPaste:M,renderer:T,isScrolledUp:E,scrollToBottom:L}},s5={connecting:"terminal.statusConnecting",running:"terminal.statusRunning",stopped:"common.stopped"},om="hive-terminal-parking-lot",i5=500,l5=t=>[`worker-pty-${t}`,`orch-pty-${t}`,`shell-pty-${t}`],c5=t=>{for(let a=t;a;a=a.parentElement){if(a.hidden||a.getAttribute("aria-hidden")==="true"||a.classList.contains("hidden"))return!0;const o=window.getComputedStyle?.(a);if(o?.display==="none"||o?.visibility==="hidden")return!0}return!1},u5=t=>{const a=Array.from(document.querySelectorAll("[data-pty-slot]")).filter(o=>o.id===t&&o.isConnected&&!c5(o));return a[a.length-1]??null},d5=()=>{let t=document.getElementById(om);return t||(t=document.createElement("div"),t.id=om,t.hidden=!0,t.style.display="none",(document.body??document.documentElement).appendChild(t)),t},Tf=()=>{const t=document.getElementById(om);t&&t.childElementCount===0&&t.remove()},ql=new Set;let qs,Ps;const rb=()=>{for(const t of ql)t()},f5=()=>{qs?.disconnect(),qs=void 0,Ps!==void 0&&(window.clearInterval(Ps),Ps=void 0)},m5=()=>{if(qs||Ps!==void 0)return;const t=document.body??document.documentElement;if(typeof MutationObserver<"u"&&t){qs=new MutationObserver(rb),qs.observe(t,{attributeFilter:["aria-hidden","class","data-pty-slot","hidden","id","style"],attributes:!0,childList:!0,subtree:!0});return}Ps=window.setInterval(rb,100)},p5=t=>(ql.add(t),m5(),()=>{ql.delete(t),ql.size===0&&f5()}),h5=[50,150,300],g5=t=>{const a=[],o=[],i=()=>window.dispatchEvent(u4(t)),l=(u,f)=>{const m=window.setTimeout(()=>{const g=o.indexOf(m);g>=0&&o.splice(g,1),f()},u);o.push(m)};if(typeof window.requestAnimationFrame=="function"){const u=window.requestAnimationFrame(()=>{i();const f=window.requestAnimationFrame(i);a.push(f)});a.push(u)}else l(0,i);for(const u of h5)l(u,i);return()=>{for(const u of a)window.cancelAnimationFrame?.(u);for(const u of o)window.clearTimeout(u);a.length=0,o.length=0}},v5=t=>{const[a,o]=b.useState(null);return b.useEffect(()=>{const i=l5(t),l=()=>{for(const f of i){const m=u5(f);if(m)return m}return null},u=()=>{const f=l();o(m=>m===f?m:f)};return u(),p5(u)},[t]),a},y5=(t,a)=>{const[o,i]=b.useState(!1),[l,u]=b.useState(null),f=b.useRef(void 0),m=b.useRef(null),g=b.useRef(void 0),p=b.useCallback(()=>{f.current!==void 0&&(window.clearTimeout(f.current),f.current=void 0)},[]),y=b.useCallback(()=>{g.current?.(),g.current=void 0},[]);return b.useLayoutEffect(()=>{const v=document.createElement("div");return v.dataset.terminalHostRunId=t,v.dataset.terminalHostParked="false",v.className="h-full min-h-0 w-full min-w-0",m.current=v,u(v),()=>{p(),y(),v.remove(),m.current=null,Tf()}},[p,y,t]),b.useLayoutEffect(()=>{if(a){p(),i(!0);return}if(!(!o||f.current!==void 0))return f.current=window.setTimeout(()=>{f.current=void 0,i(!1)},i5),p},[o,p,a]),b.useLayoutEffect(()=>{const v=m.current;if(!v)return;if(!o){y(),v.remove(),v.dataset.terminalHostParked="false",Tf();return}const k=a??d5();if(v.parentElement===k)return;const S=v.parentElement!==null,T=document.activeElement;a||y(),!a&&T instanceof HTMLElement&&v.contains(T)&&T.blur(),v.dataset.terminalHostParked=a?"false":"true",k.appendChild(v),Tf(),a&&S&&(y(),g.current=g5(t))},[o,y,t,a]),o?l:null},b5=({inputProfile:t="default",runId:a,startupBlockedReason:o,title:i})=>{const l=v5(a),u=y5(a,l);return u?vc.createPortal(c.jsx(w5,{inputProfile:t,runId:a,startupBlockedReason:o??null,title:i}),u):null},w5=({inputProfile:t,runId:a,startupBlockedReason:o,title:i})=>{const{t:l}=we(),u=wt(),{containerRef:f,error:m,status:g,isScrolledUp:p,scrollToBottom:y}=o5(a,t),v=s5[g],k=b.useCallback(()=>{f.current?.querySelector(".xterm-helper-textarea")?.blur(),y()},[f,y]);return c.jsxs("div",{className:"flex h-full min-h-0 w-full min-w-0 flex-col overflow-hidden",children:[c.jsx("p",{className:"sr-only",children:v?l(v):g}),m?c.jsx("p",{role:"alert",className:"mono shrink-0 break-words px-3 py-2 text-xs",style:{background:"color-mix(in oklab, var(--status-red) 12%, transparent)",borderBottom:"1px solid color-mix(in oklab, var(--status-red) 30%, transparent)",color:"var(--status-red)"},children:m}):null,!m&&o==="first_run_setup"?c.jsx("p",{className:"mono shrink-0 break-words px-3 py-2 text-xs","data-testid":`terminal-startup-setup-${a}`,style:{background:"color-mix(in oklab, var(--status-orange) 12%, transparent)",borderBottom:"1px solid color-mix(in oklab, var(--status-orange) 28%, transparent)",color:"var(--text-secondary)"},children:l("terminal.firstRunSetup")}):null,c.jsxs("div",{className:"relative h-full min-h-0 w-full min-w-0 flex-1 overflow-hidden",children:[c.jsx("div",{"data-testid":`terminal-${a}`,ref:f,className:"bg-crust h-full min-h-0 w-full min-w-0 overflow-hidden"}),!m&&g==="connecting"?c.jsx("div",{role:"status",className:"mono pointer-events-none absolute inset-0 flex items-center justify-center px-4 text-center text-xs",style:{color:"var(--text-muted)"},children:l("terminal.statusConnecting")}):null,u&&p?c.jsx(x5,{label:l("terminal.scrollToBottom"),onJump:k}):null]})]})},x5=({label:t,onJump:a})=>{const o=b.useRef(null),i=b.useRef(Number.NEGATIVE_INFINITY),l=b.useCallback(u=>{u.preventDefault?.(),u.stopPropagation?.();const f=u.timeStamp??performance.now();f-i.current<250||(i.current=f,a())},[a]);return b.useEffect(()=>{const u=o.current;if(!u)return;const f=m=>{m.cancelable&&m.preventDefault(),m.stopImmediatePropagation(),l(m)};return u.addEventListener("touchstart",f,{capture:!0,passive:!1}),u.addEventListener("pointerdown",f,{capture:!0}),u.addEventListener("mousedown",f,{capture:!0}),()=>{u.removeEventListener("touchstart",f,{capture:!0}),u.removeEventListener("pointerdown",f,{capture:!0}),u.removeEventListener("mousedown",f,{capture:!0})}},[l]),c.jsx("button",{ref:o,type:"button","aria-label":t,className:"icon-btn icon-btn--primary mobile-terminal-jump-button absolute bottom-2 left-1/2 -translate-x-1/2",tabIndex:-1,onClick:l,onFocus:u=>u.currentTarget.blur(),children:t})},k5=({hidden:t=!1,optimisticRuns:a=[],terminalRuns:o,workspaceId:i})=>{const{t:l}=we(),u=vx(o,a,i);return c.jsx("section",{hidden:t,"aria-hidden":t||void 0,"aria-label":l("terminalPanels.aria"),children:u.map(f=>c.jsx(b5,{inputProfile:f.terminal_input_profile??"default",runId:f.run_id,startupBlockedReason:f.startup_blocked_reason??null,title:`${f.agent_name} (${f.status})`},f.run_id))})},S5=[{version:"2.1.8",date:"2026-06-23",en:["Codex terminals now repaint CJK input correctly when you press Backspace, so deleted characters disappear immediately instead of lingering on screen.","Desktop member windows no longer show a visible close button over the terminal corner; click outside the window to close it, while mobile keeps its full-screen close button."],zh:["Codex 终端现在能正确刷新中文/CJK 输入:按下删除键后,被删字符会立即从画面消失,不再残留。","桌面端成员窗口不再在终端右上角显示关闭按钮;点击窗口外即可关闭,移动端全屏窗口仍保留关闭按钮。"]},{version:"2.1.7",date:"2026-06-23",en:["Worker reports are now queued for durable redelivery when the Orchestrator is offline or restarting, so completed work is not silently lost.","Cancels, dismissed workers, and queued dispatch recovery now produce clearer outcomes when work can no longer be delivered.","User input now fails honestly when the Orchestrator terminal is offline instead of being recorded as if it had been sent.","Remote access has a stricter pairing boundary: phones cannot read or approve desktop-only pairing requests through the tunnel."],zh:["当 Orchestrator 离线或重启时,worker report 现在会进入持久化重投递队列,完成的工作不会再静默丢失。","取消任务、删除 worker 和排队派单恢复路径现在会给出更明确的结果,避免无法投递的工作一直悬着。","当 Orchestrator 终端离线时,用户输入现在会真实失败,不再被记录成已经发送。","远程访问的配对边界更严格:手机端不能通过 tunnel 读取或审批只能在桌面完成的新设备配对请求。"]},{version:"2.1.6",date:"2026-06-21",en:["Hive now shows a global package-update prompt when a newer npm version is available, so upgrade visibility is not limited to the topbar.","Newly started workers send a ready status after receiving Hive startup instructions, giving the Orchestrator a clearer signal that the member actually came online.","The Orchestrator pane no longer exposes a stop button in its chrome, reducing accidental shutdowns of the central coordinator.","Action Center now opens as a dedicated drawer with live workspace health, attention items, recent activity, and worker selection instead of a compact popover."],zh:["检测到新的 npm 版本时,Hive 现在会显示全局更新提示,不再只依赖顶部栏的小提示。","新启动的成员收到 Hive 启动指令后会主动发送 ready 状态,让 Orchestrator 更清楚成员已经真正上线。","Orchestrator 面板不再显示关闭按钮,降低误关中央协调者的风险。","Action Center 改为专用抽屉面板,集中展示 workspace 健康状态、待关注事项、最近动态和成员选择,不再使用紧凑 popover。"]},{version:"2.1.5",date:"2026-06-21",en:["Team memory is more ambient: the Memory drawer no longer asks you to review candidates, while active memory, archived entries, and Dream history stay available for audit.","Hive can now keep lightweight user preferences separately from workspace project facts, so personal working style does not pollute team knowledge.","Workflow and skill memories can point to structured procedure references instead of copying long instructions into memory text.","Dispatch memory retrieval is stricter about relevance, avoiding unrelated role-only matches when a worker receives a new task.","Dream consolidation can run in the background with transactional apply, source checks, isolated failures, and one-step revert."],zh:["团队记忆更低打扰:Memory 抽屉不再让你处理候选记忆,但 active 记忆、归档项和 Dream 历史仍可审计。","Hive 现在可以把轻量用户偏好与 workspace 项目事实分开保存,个人工作风格不会污染团队知识。","流程和 skill 类记忆可以引用结构化 procedure,不再把长流程说明直接塞进记忆正文。","派单记忆检索更严格,只在任务相关时注入,避免仅因 worker 角色匹配就带入无关记忆。","Dream 整理可在后台完成,带事务 apply、source window 校验、失败隔离和一键回滚。"]},{version:"2.1.4",date:"2026-06-21",en:["The first workspace screen is quieter: Hive no longer pushes an Orchestrator dispatch prompt before you have a concrete task.","Team activity is easier to scan, with dispatch pulse effects and queue-count badges removed from the visible UI.","The collapsed empty-workspace sidebar no longer shows a stray compact add button.","Maintainer release checks now use a faster package-focused default gate, with the full test gate still available for high-risk releases."],zh:["第一个 workspace 页面更安静:在你还没有明确任务前,Hive 不再主动提示 Orchestrator 派发工作。","团队动态更好扫读:可见 UI 里的派单脉冲和排队数量徽标已移除。","空 workspace 的折叠侧栏不再出现孤立的紧凑添加按钮。","维护者发布检查改为默认使用更快的打包发版闸门;高风险发版仍保留完整测试闸门。"]},{version:"2.1.3",date:"2026-06-18",en:["Hive now waits when first-run CLI setup screens are visible, so startup instructions no longer collide with trust, login, or confirmation prompts.","User input reports a real delivery failure if the Orchestrator terminal is offline.","Built-in role contracts and scenario/spawn defaults are language-aware, so English workspaces receive English worker prompts by default.","The demo is now a local self-running Hive replay with task progress, worker state changes, and team dispatch flow instead of an external video.","Release checks include a local CLI compatibility report for native modules and Tier-1 agent CLIs.","Settings now shows local-only retention diagnostics, and Memory keeps ambient Dream-maintained workspace knowledge without a candidate review surface."],zh:["首次运行 CLI 出现信任、登录或确认提示时,Hive 现在会等待,不再把启动指令盲注入到 onboarding 屏幕里。","如果 Orchestrator 终端已离线,用户输入会明确返回投递失败,而不是假装成功。","内置角色契约和场景/派生成员默认值已支持语言感知,英文 workspace 默认收到英文 worker prompt。","Demo 改成本地自运行 Hive replay,直接展示任务进度、worker 状态变化和团队派单流,不再依赖外部视频。","发布检查新增本地 CLI 兼容报告,覆盖原生模块和 Tier-1 agent CLI。","Settings 增加本地留存诊断;Memory 保持由 Dream 维护的低打扰工作区知识,不再展示人工复核入口。"]},{version:"2.1.2",date:"2026-06-16",en:["Newly spawned workers now wake correctly for their first team send instead of leaving the task parked in the stopped queue.","If a spawned worker is later stopped manually, Hive still keeps the normal queued-task behavior until you start that worker again.","Claude Code sessions on Windows are more tolerant of large Hive startup and dispatch injections, reducing premature submit or leftover input."],zh:["新建的 worker 现在会正确接住第一次 team send,不会把任务停在 stopped 队列里。","如果这个 worker 后续被手动停止,Hive 仍会保留正常的排队语义:任务等你再次启动该 worker 后再投递。","Windows 上的 Claude Code 会更稳地处理大段 Hive 启动与派单注入,减少过早回车或输入残留。"]},{version:"2.1.1",date:"2026-06-14",en:["Codex terminal input is smoother and more reliable when prompts are pasted or injected for an agent.","Action Center layout and interaction details are cleaner on narrow and mobile-sized screens."],zh:["Codex 终端在粘贴或注入 prompt 时输入更顺、更可靠。","活动中心在窄屏和手机尺寸下的布局与交互细节更干净。"]},{version:"2.1.0",date:"2026-06-13",en:["New Sentinel role: a read-only patrol member that watches the team and flags stalled or orphaned work, without taking dispatches or editing memory itself.","One-click scenario team assembly — spin up a ready-made team from a preset instead of adding members one by one.",'Team memory "Dream" consolidation now runs through your Orchestrator where you can see and review it, instead of a hidden background pass. Workers can be asked to review proposed changes, but only the Orchestrator commits them — and every run can be reverted in one step.',"Action Center adds a one-click copyable team recap and a diagnostics bundle, so sharing status and getting support is faster.","Dispatch pulse: a team send now visibly flows from the Orchestrator to the worker, so you can watch work being handed off.","The add-workspace dialog now guides you to install any missing CLI before you start.","More reliable dispatching: queued tasks replay when a worker starts, delivery failures notify the issuer instead of being lost, and team list shows open dispatches.","Remote/mobile fixes: large uploads over the tunnel no longer fail, and terminal scrolling is restored for CLIs launched through wrapper or legacy commands (such as Codex on Windows).","Hardened prompts and workflow runtime against prompt-injection, with clearer protocol errors and onboarding."],zh:["新增 Sentinel 巡检角色:只读巡检成员,盯团队进度、提示停滞或孤儿任务,自己不接派单、不改记忆。","一键场景组队:从预设模板直接拉起一支现成团队,不用逐个添加成员。","团队记忆 Dream 整理改为经由 Orchestrator 执行,你能看到也能复核,不再后台静默处理。可让 worker 协助评审建议,但只有 Orchestrator 能提交,且每次整理都可一键回滚。","活动中心新增一键复制团队战报与诊断信息包,分享状态、寻求支持更快。","派单脉冲:team send 现在会从蜂后可视化地流向工蜂,派单交接一目了然。","添加 workspace 时,若缺少对应 CLI 会引导你先安装。","派单更可靠:worker 启动时重放排队任务、投递失败会通知发起方而不再丢失、team list 会列出未完成派单。","远程/移动端修复:隧道大文件上传不再失败;经包装或旧版命令启动的 CLI(如 Windows 上的 Codex)终端滚动已恢复。","强化了提示词与 workflow 运行时对提示注入的防护,协议报错与新手引导更清晰。"]},{version:"2.0.2",date:"2026-06-10",en:["Windows Codex terminals now keep the Codex-specific wheel scrolling behavior even when an older saved launch command points through node.exe and @openai/codex/bin/codex.js."],zh:["Windows 上的 Codex 终端滚轮修复:即使旧配置还通过 node.exe 和 @openai/codex/bin/codex.js 启动,Hive 也会继续使用 Codex 专用的滚轮翻页行为。"]},{version:"2.0.1",date:"2026-06-09",en:["Team memory is now available: Hive can keep useful workspace context and bring back prior decisions, constraints, and project notes when your team needs them.","The Memory and Workflows drawers have cleaner desktop and mobile layouts, clearer tabs, and a search field that stays out of the way on wide screens.","Worker cards are easier to scan, with clearer status styling, higher contrast, cleaner role text, and in-place rename instead of a separate edit dialog.","Pending dispatch status is clearer while the Orchestrator is coordinating queued or waiting worker activity.","The current remote/mobile build is now published under the original official @tt-a1i/hive package name."],zh:["团队记忆上线:Hive 可以保留有用的 workspace 上下文,并在团队需要时重新带回之前的决策、约束和项目笔记。","Memory 和 Workflows 抽屉做了桌面端与移动端布局优化,tab 更清楚,宽屏上的搜索框也更不挡内容。","Worker 卡片更容易扫读:状态样式更清晰、对比度更高、角色文字更干净,并改成卡片内直接重命名。","Orchestrator 协调排队或等待中的 worker 活动时,pending dispatch 状态显示更明确。","当前远程访问和移动端构建已通过原来的官方 @tt-a1i/hive 包名发布。"]},{version:"2.0.0",date:"2026-06-07",en:["Remote access is here, off by default: open your running Hive from a phone browser over an end-to-end encrypted tunnel, with the same authority as your local desktop browser.","The new gateway handles identity and routing only. It supports GitHub/Google sign-in, version-pinned mobile bundles, and self-hosting; your agents, terminals, workspaces, and project data stay on your computer.","Pairing is desktop-confirmed: create a short-lived pairing code on the computer, enter it on the phone, compare the 6-digit SAS code on both screens, then confirm on the desktop before the device is trusted.","Manage paired devices from Settings or the CLI: list devices, revoke one, drop a live remote session, and review the audit trail for remote requests and denials.","New CLI commands: hive remote login / status / logout / devices / revoke link the machine to a gateway account and manage trusted devices from the host.","The phone UI is the same Hive reflowed for a small screen: sign-in and machine selection, bottom navigation, workspace switching, full-screen Team / Tasks panels, reconnect banners, and update prompts.","Mobile terminals are writable directly in xterm. Worker terminals open full-screen, focus mode hides surrounding chrome while you work, and touch scrolling is smoother for shell output and faster in full-screen TUI agents.","Local-first behavior stays intact: Hive still works on 127.0.0.1 without any gateway, the tunnel is limited to Hive /api/* and /ws/*, and phones cannot approve new devices or turn Remote access back on."],zh:["远程访问上线,默认关闭:用手机浏览器通过端到端加密隧道打开正在本机运行的 Hive,权限与本地桌面浏览器等同。","新网关只做身份和路由:支持 GitHub / Google 登录、按版本固定的手机端 bundle、以及 self-host;Agent、终端、Workspace 和项目数据都留在你的电脑上。","配对必须由桌面确认:电脑生成短时配对码,手机输入后,两边显示同一个 6 位 SAS 短码;只有在电脑上确认后,新设备才会被信任。","可以在 Settings 或 CLI 里管理已配对设备:查看列表、吊销设备、立即断开正在连接的远程会话,并查看远程请求和拒绝记录的审计流水。","新增 CLI:hive remote login / status / logout / devices / revoke,可在本机完成网关联动和受信设备管理。","手机 UI 是同一个 Hive 的小屏重排:登录与机器选择、底部导航、Workspace 切换、全屏 Team / Tasks 面板、重连提示和更新提示。","移动端终端可以直接在 xterm 里输入。成员终端全屏打开,focus mode 会隐藏周边 chrome;shell 输出滚动更顺,全屏 TUI agent 里的触摸滚动也更跟手。","本地优先不变:没有网关时 Hive 仍照常运行在 127.0.0.1;隧道只允许访问 Hive 自己的 /api/* 和 /ws/*;手机不能批准新设备,也不能在关闭远程后自行重新开启。"]},{version:"1.7.0",date:"2026-06-05",en:["Hermes is now a built-in CLI agent preset alongside Claude Code, Codex, OpenCode, and Gemini — usable as Orchestrator or Worker, via team spawn --cli hermes, and in workflows.","Hermes sessions survive crashes: Hive captures the session id from the CLI startup output and resumes with --resume on restart.","Existing installs get the new preset automatically — just have hermes on your PATH."],zh:["Hermes 成为第五个内置 CLI agent preset,与 Claude Code、Codex、OpenCode、Gemini 并列 —— 可当 Orchestrator 或 Worker,支持 team spawn --cli hermes 和 workflow。","Hermes 会话可在崩溃后恢复:Hive 从 CLI 启动输出捕获 session id,重启时用 --resume 续上。","已有安装会自动获得新 preset —— 只要 PATH 里有 hermes 即可。"]},{version:"1.6.0",date:"2026-06-02",en:["A Stop button on the running Orchestrator lets you halt a runaway agent straight from the UI.","Worker cards now show queue depth and the latest activity line, and the working badge explains that Hive does not auto-detect stalls — check the terminal.","Worker reports are no longer lost when the Orchestrator is down or restarting; they are queued and redelivered automatically.","Deliberately stopping and restarting the Orchestrator no longer replays a stale crash-recovery handover.","A new completion webhook can POST to a URL you choose (Slack, ntfy, Feishu, …) when a worker reports or a workflow finishes.","Workflow agent() gains opt-in structured output via outputSchema, and the new team next lists tasks unblocked by [needs:] dependencies in tasks.md."],zh:["运行中的 Orchestrator 面板新增 Stop 按钮,可以直接在 UI 里停掉跑飞的 agent。","Worker 卡片现在显示队列数和最近活动行;working 状态会说明 Hive 不会自动检测卡死 —— 以终端为准。","Orchestrator 掉线或重启时,Worker 的汇报不再丢失,会自动排队并补投。","手动停止后再重启 Orchestrator,不会再灌入陈旧的崩溃恢复接管。","新增完成通知 Webhook:Worker 汇报或 Workflow 完成时,向你设置的 URL POST(可接 Slack、ntfy、飞书等)。","Workflow 的 agent() 支持 outputSchema 结构化输出;新增 team next 可列出 tasks.md 里被 [needs:] 解除阻塞、当前可做的任务。"]},{version:"1.5.0",date:"2026-05-31",en:["Experimental Workflows let the Orchestrator run multi-agent plans across real Hive workers, with run details, logs, stop controls, and schedules in the Workflows drawer.","Workflow-created agents can now follow your selected default CLI and allowed CLI policy instead of always falling back to Claude Code.","Experimental auto-staff can let the Orchestrator size the worker roster to the task and create task-scoped coders, testers, or reviewers.","Codex dispatches stay reliable for long pasted tasks, while short worker reports now submit quickly instead of waiting several seconds in the input box.","Runtime hardening covers malformed WebSocket frames, Windows Codex startup paths, and workflow worker cleanup edge cases."],zh:["实验性的 Workflows 可以让 Orchestrator 用真实 Hive Worker 执行多 Agent 计划,并在 Workflows 抽屉里查看详情、日志、停止控制和定时任务。","Workflow 创建的 Agent 现在会遵守你选择的默认 CLI 和允许列表,不再总是回退到 Claude Code。","实验性的自动组队可以让 Orchestrator 按任务规模创建临时 coder、tester 或 reviewer。","Codex 的长任务粘贴仍保持可靠;短的 Worker 汇报现在会快速提交,不再在输入框里等好几秒。","运行时加固覆盖了异常 WebSocket 帧、Windows Codex 启动路径和 Workflow Worker 清理等边界情况。"]},{version:"1.4.4",date:"2026-05-30",en:["Windows .cmd and .bat startup commands now launch reliably, including quoted nvm4w and Program Files paths.","Worker shutdown is more robust on Windows, with process-tree cleanup before PTY termination.","Folder picking, filesystem browsing, editor launch, hive update, and port recovery are friendlier on Windows.","Task files keep CRLF line endings, and the watcher handles atomic-save editors more gracefully."],zh:["Windows 上的 .cmd / .bat 启动命令更可靠,包括带引号的 nvm4w 和 Program Files 路径。","Windows 下 Worker 关闭更稳,会先清理进程树再终止 PTY。","文件夹选择、文件浏览、编辑器打开、hive update 和端口占用恢复在 Windows 上更顺手。","任务文件会保留 CRLF 换行,watcher 对原子保存编辑器也更宽容。"]}],ob=t=>{const[a="",o=""]=t.split("-",2),[i=0,l=0,u=0]=a.split(".").map(f=>Number.parseInt(f,10)||0);return{core:[i,l,u],prerelease:o}},Nf=(t,a)=>{const o=ob(t),i=ob(a);for(let l=0;l<3;l+=1){const u=(o.core[l]??0)-(i.core[l]??0);if(u!==0)return u}return o.prerelease===i.prerelease?0:o.prerelease?i.prerelease?o.prerelease.localeCompare(i.prerelease,void 0,{numeric:!0}):-1:1},E5=(t,a,o=S5)=>{if(a===null)return{show:!1,entries:[],seedOnly:!0};if(Nf(t,a)<=0)return{show:!1,entries:[],seedOnly:!1};const i=o.filter(l=>Nf(l.version,a)>0&&Nf(l.version,t)<=0);return i.length===0?{show:!1,entries:[],seedOnly:!0}:{show:!0,entries:i,seedOnly:!1}},Sx="hive.last-seen-version",C5="1.7.0",T5=(t,a)=>{try{const o=window.localStorage.getItem(Sx);return o||(a?C5:null)}catch{return t}},sb=t=>{try{window.localStorage.setItem(Sx,t)}catch{}},N5=({hasExistingWorkspace:t,wizardOpen:a})=>{const o=Fm,[i,l]=b.useState(void 0);b.useEffect(()=>{i!==void 0||t===null||l(T5(o,t))},[t,i]);const u=b.useMemo(()=>i===void 0?{show:!1,entries:[],seedOnly:!1}:E5(o,i),[i]),[f,m]=b.useState(!1);b.useEffect(()=>{u.seedOnly&&sb(o)},[u.seedOnly]);const g=b.useCallback(()=>{sb(o),m(!0)},[]);return{open:u.show&&!f&&!a,entries:u.entries,close:g}},ib="hive.first-run-seen",j5=()=>{const[t,a]=b.useState(()=>{try{return window.localStorage.getItem(ib)==="1"}catch{return!0}}),o=b.useCallback(()=>{try{window.localStorage.setItem(ib,"1")}catch{}a(!0)},[]);return{seen:t,markSeen:o}},A5=t=>{const{seen:a,markSeen:o}=j5(),[i,l]=b.useState(!1);b.useEffect(()=>{!a&&t!==null&&t.length===0&&l(!0)},[a,t]);const u=b.useCallback((f=!0)=>{f&&o(),l(!1)},[o]);return{wizardOpen:i,closeWizard:u}},_5=(t,a)=>t.findIndex(i=>i.id===a.id)===-1?[...t,a]:t.map(i=>i.id===a.id?a:i),Ex=t=>t==="codex"?"codex":t==="grok"?"grok":t==="opencode"?"opencode":"default",lb=(t,a)=>Ex(t.find(o=>o.id===a)?.commandPresetId),R5=({activeWorkspaceId:t,onWorkerDeleted:a,onWorkerRunStarted:o,setWorkersByWorkspaceId:i,workers:l})=>{const{language:u}=we(),f=b.useCallback(async({commandPresetId:v,name:k,role:S,roleDescription:T,startupCommand:w})=>{if(!t)return{error:"No active workspace",runId:null};const E=w.trim(),C=await rN(t,{autostart:!0,command_preset_id:v||null,description:T.trim(),name:k,role:S,startup_command:E||null,ui_language:u});return i(j=>({...j,[t]:_5(j[t]??[],C.worker)})),C.agentStart.ok&&C.agentStart.runId&&o?.({agentId:C.worker.id,agentName:C.worker.name,runId:C.agentStart.runId,terminalInputProfile:Ex(v),workspaceId:t}),{error:C.agentStart.ok?null:C.agentStart.error,runId:C.agentStart.ok?C.agentStart.runId:null}},[t,u,o,i]),m=b.useCallback(async v=>{if(!t)throw new Error("No active workspace");await sN(t,v),i(k=>({...k,[t]:(k[t]??[]).filter(S=>S.id!==v)})),a?.(t,v)},[t,a,i]),g=b.useCallback(async v=>{if(!t)return{error:"No active workspace",runId:null};try{const k=await Vl(t,v);return o?.({agentId:v,agentName:v,runId:k.runId,terminalInputProfile:lb(l,v),workspaceId:t}),{error:null,runId:k.runId}}catch(k){return{error:k instanceof Error?k.message:String(k),runId:null}}},[t,o,l]),p=b.useCallback(async v=>{try{return await Gl(v),{error:null}}catch(k){return{error:k instanceof Error?k.message:String(k)}}},[]),y=b.useCallback(async(v,k)=>{if(!t)return{error:"No active workspace",runId:null};try{const S=await IT(t,v,k);return o?.({agentId:v,agentName:v,runId:S.runId,terminalInputProfile:lb(l,v),workspaceId:t}),{error:null,runId:S.runId}}catch(S){return{error:S instanceof Error?S.message:String(S),runId:null}}},[t,o,l]);return{createWorker:f,deleteWorker:m,startWorker:g,stopWorkerRun:p,restartWorkerRun:y}},Ym={mac:["vscode","vscode-insiders","cursor","finder","terminal","ghostty","zed"],windows:["vscode","vscode-insiders","cursor","finder","zed"],linux:["vscode","vscode-insiders","cursor","finder","zed"],other:["vscode","vscode-insiders","finder"]},O5=new Set(Ym.mac),D5=t=>typeof t=="string"&&O5.has(t),Cx=(t,a)=>Ym[a].includes(t),Tx=t=>t==="mac"||t==="windows"||t==="linux"?"finder":"vscode",M5="data:image/svg+xml,%3csvg%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill='%23FFFFFF'%20d='M11.503.131%201.891%205.678a.84.84%200%200%200-.42.726v11.188c0%20.3.162.575.42.724l9.609%205.55a1%201%200%200%200%20.998%200l9.61-5.55a.84.84%200%200%200%20.42-.724V6.404a.84.84%200%200%200-.42-.726L12.497.131a1.01%201.01%200%200%200-.996%200M2.657%206.338h18.55c.263%200%20.43.287.297.515L12.23%2022.918c-.062.107-.229.064-.229-.06V12.335a.59.59%200%200%200-.295-.51l-9.11-5.257c-.109-.063-.064-.23.061-.23'/%3e%3c/svg%3e",jf="data:image/svg+xml,%3csvg%20width='64'%20height='64'%20viewBox='0%200%2064%2064'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='5'%20y='13'%20width='54'%20height='40'%20rx='8'%20fill='%23F2B73B'/%3e%3cpath%20d='M5%2021C5%2016.58%208.58%2013%2013%2013H25.2C27.2%2013%2029.1%2013.94%2030.3%2015.54L33.2%2019.4H51C55.42%2019.4%2059%2022.98%2059%2027.4V31H5V21Z'%20fill='%23FFD565'/%3e%3cpath%20d='M8%2027H56C58.76%2027%2061%2029.24%2061%2032V49C61%2051.76%2058.76%2054%2056%2054H8C5.24%2054%203%2051.76%203%2049V32C3%2029.24%205.24%2027%208%2027Z'%20fill='%23F8C344'/%3e%3cpath%20d='M8%2032C8%2030.9%208.9%2030%2010%2030H54C55.1%2030%2056%2030.9%2056%2032V48C56%2049.1%2055.1%2050%2054%2050H10C8.9%2050%208%2049.1%208%2048V32Z'%20fill='%23F4B43B'/%3e%3cpath%20d='M10%2031H54C55.1%2031%2056%2031.9%2056%2033V36H8V33C8%2031.9%208.9%2031%2010%2031Z'%20fill='%23FFE082'/%3e%3cpath%20d='M12%2037H52C53.1%2037%2054%2037.9%2054%2039V47C54%2048.1%2053.1%2049%2052%2049H12C10.9%2049%2010%2048.1%2010%2047V39C10%2037.9%2010.9%2037%2012%2037Z'%20fill='%23F0A82F'/%3e%3c/svg%3e",Nx="/assets/finder-C4Jmsb0B.png",L5="/assets/ghostty-D-Js4rdm.png",z5="data:image/svg+xml,%3csvg%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='24'%20height='24'%20rx='4'%20fill='%232D2D2E'/%3e%3cpath%20d='M6.5%209%20L10%2012%20L6.5%2015'%20stroke='%23FFFFFF'%20stroke-width='1.7'%20fill='none'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cline%20x1='12.5'%20y1='15.5'%20x2='17.5'%20y2='15.5'%20stroke='%23FFFFFF'%20stroke-width='1.7'%20stroke-linecap='round'/%3e%3c/svg%3e",H5="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='%23007ACC'%20d='M22%205.75v12.48c0%20.49-.28.94-.72%201.15-.91.43-2.46%201.18-3.33%201.59.03-.16.05-.33.05-.5V3.53C18%203.3%2017.97%203.12%2017.94%203c.94.46%202.44%201.18%203.33%201.6C21.72%204.81%2022%205.26%2022%205.75zM3.91%2013.35c.89.8%201.73%201.56%202.51%202.28l-1.48%201.12c-.37.28-.89.27-1.25-.03l-.94-.79c-.46-.39-.48-1.09-.03-1.5C3.05%2014.13%203.46%2013.76%203.91%2013.35zM16%203.53v4.81l-3.16%202.4-3.3-2.5c2.29-2.07%204.46-4.05%205.59-5.1.23-.22.56-.16.74.04.05.06.09.13.11.22C15.99%203.44%2016%203.48%2016%203.53zM16%2020.47v-4.81L4.938%207.252c-.372-.283-.889-.27-1.247.03L2.754%208.066C2.289%208.456%202.271%209.162%202.72%209.569c2.747%202.488%209.998%209.06%2012.41%2011.291C15.462%2021.167%2016%2020.93%2016%2020.47z'/%3e%3c/svg%3e",B5="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='%2324BFA5'%20d='M22%205.75v12.48c0%20.49-.28.94-.72%201.15-.91.43-2.46%201.18-3.33%201.59.03-.16.05-.33.05-.5V3.53C18%203.3%2017.97%203.12%2017.94%203c.94.46%202.44%201.18%203.33%201.6C21.72%204.81%2022%205.26%2022%205.75zM3.91%2013.35c.89.8%201.73%201.56%202.51%202.28l-1.48%201.12c-.37.28-.89.27-1.25-.03l-.94-.79c-.46-.39-.48-1.09-.03-1.5C3.05%2014.13%203.46%2013.76%203.91%2013.35zM16%203.53v4.81l-3.16%202.4-3.3-2.5c2.29-2.07%204.46-4.05%205.59-5.1.23-.22.56-.16.74.04.05.06.09.13.11.22C15.99%203.44%2016%203.48%2016%203.53zM16%2020.47v-4.81L4.938%207.252c-.372-.283-.889-.27-1.247.03L2.754%208.066C2.289%208.456%202.271%209.162%202.72%209.569c2.747%202.488%209.998%209.06%2012.41%2011.291C15.462%2021.167%2016%2020.93%2016%2020.47z'/%3e%3c/svg%3e",U5="/assets/zed-C5BQT8X3.png",W5={mac:"openWorkspace.target.finder.mac",windows:"openWorkspace.target.finder.windows",linux:"openWorkspace.target.finder.linux",other:"openWorkspace.target.finder.linux"},I5={mac:Nx,windows:jf,linux:jf,other:jf},Ac={vscode:{labelKey:"openWorkspace.target.vscode",iconSrc:H5},"vscode-insiders":{labelKey:"openWorkspace.target.vscodeInsiders",iconSrc:B5},cursor:{labelKey:"openWorkspace.target.cursor",iconSrc:M5},finder:{labelKey:"openWorkspace.target.finder.mac",iconSrc:Nx},terminal:{labelKey:"openWorkspace.target.terminal",iconSrc:z5},ghostty:{labelKey:"openWorkspace.target.ghostty",iconSrc:L5,iconScale:1.2},zed:{labelKey:"openWorkspace.target.zed",iconSrc:U5}},jx=(t,a)=>t==="finder"?W5[a]:Ac[t].labelKey,Ax=(t,a)=>t==="finder"?I5[a]:Ac[t].iconSrc,Af=(t,a)=>{const o=Cx(t,a)?t:Tx(a),i=Ac[o];return{id:o,iconSrc:Ax(o,a),labelKey:jx(o,a),...i.iconScale!==void 0?{iconScale:i.iconScale}:{}}},q5=t=>Ym[t].map(a=>{const o=Ac[a];return{id:a,iconSrc:Ax(a,t),labelKey:jx(a,t),...o.iconScale!==void 0?{iconScale:o.iconScale}:{}}}),P5=()=>{if(typeof navigator>"u")return"other";const t=`${navigator.userAgent} ${navigator.platform}`.toLowerCase();return t.includes("mac")||t.includes("darwin")?"mac":t.includes("win")?"windows":t.includes("linux")||t.includes("x11")?"linux":"other"},_x="hive.openTarget.preferred",F5=()=>{try{return window.localStorage.getItem(_x)}catch{return null}},K5=t=>{const a=Tx(t);if(typeof window>"u")return a;const o=F5();if(!o)return a;const i=o==="ghostie"?"ghostty":o;return D5(i)&&Cx(i,t)?i:a},Y5=t=>{try{window.localStorage.setItem(_x,t)}catch{}},$5={"app-not-installed":"openWorkspace.error.appNotInstalled","command-not-in-path":"openWorkspace.error.commandNotInPath","invalid-path":"openWorkspace.error.invalidPath","invalid-target":"openWorkspace.error.invalidTarget",unknown:"openWorkspace.error.unknown"},V5=({workspace:t})=>{const{t:a}=we(),{mode:o}=Z0(),i=en(),l=b.useMemo(()=>P5(),[]),u=q5(l),[f,m]=b.useState(()=>K5(l)),[g,p]=b.useState(!1),[y,v]=b.useState(!1),k=b.useRef(null),S=b.useRef(null),T=Af(f,l),w=a(T.labelKey);b.useEffect(()=>{if(!g)return;const M=U=>{U.key==="Escape"&&p(!1)},L=U=>{const q=k.current;q&&!q.contains(U.target)&&p(!1)};return document.addEventListener("keydown",M),document.addEventListener("pointerdown",L),()=>{document.removeEventListener("keydown",M),document.removeEventListener("pointerdown",L)}},[g]);const E=b.useCallback(M=>{m(M),Y5(M),p(!1),S.current?.focus()},[]),C=b.useCallback(async()=>{if(!(!t||y)){v(!0);try{const M=await cN(t.id,f);if(M.ok){if(o==="mobile"){const L=Af(M.effectiveTargetId,l).labelKey;i.show({kind:"success",message:a("openWorkspace.opened",{app:a(L),workspace:t.name})})}}else{const L=Af(M.effectiveTargetId,l).labelKey;i.show({kind:"error",message:a($5[M.errorCode],{app:a(L)})})}}catch(M){const L=M instanceof Error?M.message:String(M);i.show({kind:"error",message:L})}finally{v(!1)}}},[y,o,l,f,a,i,t]),j=!t,_=a("openWorkspace.noWorkspace"),N=t?a("openWorkspace.openIn",{app:w,workspace:t.name}):_,O=t?a("openWorkspace.openInAria",{app:w,workspace:t.name}):_;return c.jsxs("div",{ref:k,className:"open-workspace relative flex",children:[c.jsx(Qe,{label:N,children:c.jsx("span",{className:"flex",children:c.jsxs("button",{ref:S,type:"button","aria-label":O,"data-testid":"topbar-open-workspace",disabled:j||y,onClick:()=>{C()},className:"open-workspace__main",children:[c.jsx("span",{className:"open-workspace__trigger-icon","aria-hidden":!0,children:y?c.jsx(Fa,{size:13,className:"animate-spin"}):c.jsx("img",{src:T.iconSrc,alt:"",className:"open-workspace__trigger-img",style:{transform:T.iconScale?`scale(${T.iconScale})`:void 0}})}),c.jsx("span",{children:a("openWorkspace.open")})]})})}),c.jsx(Qe,{label:a("openWorkspace.selectTarget"),children:c.jsx("button",{type:"button","aria-label":a("openWorkspace.selectTarget"),"aria-haspopup":"menu","aria-expanded":g,"data-testid":"topbar-open-workspace-chevron",disabled:j,onClick:()=>p(M=>!M),className:"open-workspace__chevron",children:c.jsx(No,{size:12,"aria-hidden":!0})})}),g?c.jsx("div",{role:"menu","aria-label":a("openWorkspace.selectTarget"),className:"open-workspace__menu elev-2","data-testid":"topbar-open-workspace-menu",children:u.map(M=>{const L=M.id===f;return c.jsxs("button",{role:"menuitemradio","aria-checked":L,type:"button",onClick:()=>E(M.id),className:"open-workspace__option","data-selected":L?"true":void 0,"data-testid":`topbar-open-workspace-option-${M.id}`,children:[c.jsx("span",{className:"open-workspace__option-icon","aria-hidden":!0,children:c.jsx("img",{src:M.iconSrc,alt:"",className:"open-workspace__option-img",style:{transform:M.iconScale?`scale(${M.iconScale})`:void 0}})}),c.jsx("span",{className:"flex-1",children:a(M.labelKey)}),c.jsx("span",{className:"open-workspace__check","aria-hidden":!0,children:L?c.jsx(Ga,{size:13}):null})]},M.id)})}):null]})},G5=b.lazy(()=>Nt(()=>import("./WorkflowsDrawer-C4yjTdY7.js"),__vite__mapDeps([5,4])).then(t=>({default:t.WorkflowsDrawer}))),X5=b.lazy(()=>Nt(()=>import("./WorkspaceMemoryDrawer-BlDznlGm.js"),__vite__mapDeps([6,3])).then(t=>({default:t.WorkspaceMemoryDrawer}))),Z5=()=>{const[t,a]=b.useState(null),{activeWorkspaceId:o,selectWorkspace:i,setActiveWorkspaceId:l}=a4(),{demoMode:u,enableDemo:f,exitDemo:m}=l3(),g=u||!t?[]:t.map(({id:pe})=>pe),[p,y]=c4(g,{activeWorkspaceId:o}),[v,k]=b.useState(0),[S,T]=b.useState(!1),[w,E]=b.useState(!1),[C,j]=b.useState(!1),[_,N]=b.useState(null),[O,M]=b.useState("team"),L=M3(),U=en(),q=dx(),{wizardOpen:ae,closeWizard:ee}=A5(t),F=N5({hasExistingWorkspace:t===null?null:t.length>0,wizardOpen:ae}),X=lx().enabled;b.useEffect(()=>{X||(j(!1),M(pe=>pe==="flows"?"team":pe))},[X]);const $=b.useCallback(()=>k(pe=>pe+1),[]),[D,P]=b.useState(null),I=b.useCallback(pe=>{P(pe),U.show({kind:"error",message:pe})},[U]);QR(a,l,I);const V=e4({onWorkspaceCreated:pe=>{a(Oe=>Oe===null?[pe]:[...Oe,pe]),i(pe.id),y(Oe=>({...Oe,[pe.id]:[]}))},onError:pe=>U.show({kind:"error",message:pe})}),R=c3({demoMode:u,workspaces:t,activeWorkspaceId:o,workersByWorkspaceId:p}),B=R.effectiveActiveWorkspace?.id,re=B?R.effectiveWorkersByWorkspaceId[B]??[]:[];b.useEffect(()=>{N(pe=>pe&&re.some(Oe=>Oe.id===pe)?pe:null)},[re]);const ne=LR(R.pollWorkspaceId,i_(R.pollWorkspaceId));sR(!0);const de=DR(u?null:o??null,u?i3:void 0),fe=b.useMemo(()=>R.effectiveActiveWorkspace?TR(de.content):0,[R.effectiveActiveWorkspace,de.content]),ue=R5({activeWorkspaceId:o,onWorkerDeleted:ne.forgetOptimisticAgent,onWorkerRunStarted:ne.recordOptimisticRun,setWorkersByWorkspaceId:y,workers:re}),ie=n4({activeWorkspaceId:o,onActiveDeleted:()=>{E(!1),T(!1),j(!1)},selectWorkspace:i,setWorkersByWorkspaceId:y,setWorkspaces:a,workspaces:t});$R({bootstrapError:D,onSelectWorkspace:i,onTriggerAddDialog:$,workspaces:R.effectiveWorkspaces}),gR({onAddWorkspace:$,onTryDemo:f,ready:u||t!==null||D!==null});const le=JR(),ce=D!==null&&!u&&t===null,me=wt(),Te=b.useSyncExternalStore(HR,BR),Ne=me?c.jsx(H3,{status:Te}):null,Se=B?ne.optimisticRunsByWorkspaceId[B]??[]:[],xt=!ce&&!u&&B!==void 0&&(ne.terminalRuns.length>0||Se.length>0)?c.jsx(k5,{optimisticRuns:Se,terminalRuns:ne.terminalRuns,workspaceId:B},`terminal-${B}`):null,Wt=ce?c.jsx(lR,{onTryDemo:f}):c.jsx(o3,{activeId:B,activeWorkspace:R.effectiveActiveWorkspace,activeWorkerId:_,bootstrapError:D,demoMode:u,workspacesLoading:!u&&t===null,onActiveWorkerChange:N,onDeleteWorkspace:ie,onExitDemo:m,onRequestAddWorkspace:$,onShellRunClosed:ne.forgetOptimisticRun,onShellRunStarted:(pe,Oe)=>ne.recordOptimisticRun({agentId:Oe.agent_id,agentName:Oe.agent_name,runId:Oe.run_id,status:Oe.status,terminalInputProfile:Oe.terminal_input_profile??"default",workspaceId:pe}),onTryDemo:f,orchestratorAutostartErrors:V.orchestratorAutostartErrors,orchestratorAutostartRunIds:V.orchestratorAutostartRunIds,recordOrchestratorResult:V.recordOrchestratorResult,terminalRuns:ne.terminalRuns,workerActions:ue,workers:re,showInlineActionCenter:me}),pn=c.jsx(tS,{addDialogTrigger:v,wizardOpen:ae,whatsNewOpen:F.open,whatsNewEntries:F.entries,onCloseWhatsNew:F.close,onAddWorkspace:$,onCloseTaskGraph:()=>T(!1),onCloseWizard:ee,onCreateWorkspace:V.createNewWorkspace,onTryDemo:f,taskGraphOpen:S,tasksFile:de,workspacePath:R.effectiveActiveWorkspace?.path??null,workers:re,onSelectOwner:le}),hn=C&&!u&&X?c.jsx(b.Suspense,{fallback:null,children:c.jsx(G5,{open:!0,onClose:()=>j(!1),workspaceId:o??null})}):null,Nn=w&&!u?c.jsx(b.Suspense,{fallback:null,children:c.jsx(X5,{open:!0,onClose:()=>E(!1),workspaceId:o??null})}):null,tn=c.jsx(kR,{activeWorkspaceId:R.effectiveActiveWorkspaceId,collapsed:L.collapsed,createDisabledReason:D??void 0,onCreateClick:$,onDeleteWorkspace:ie,onSelectWorkspace:i,onToggleCollapse:L.toggleCollapsed,workersByWorkspaceId:R.effectiveWorkersByWorkspaceId,workspaces:R.effectiveWorkspaces}),ke=c.jsxs(c.Fragment,{children:[c.jsx(V5,{workspace:R.effectiveActiveWorkspace}),ce||u||!B?null:c.jsx(RA,{workspaceId:B,onOpenWorker:N},B)]});return me?c.jsxs(c.Fragment,{children:[c.jsx(G3,{workspaceSwitcher:ce?void 0:c.jsx(tR,{activeWorkspaceId:R.effectiveActiveWorkspaceId,workspaces:R.effectiveWorkspaces,workersByWorkspaceId:R.effectiveWorkersByWorkspaceId,createDisabledReason:D??void 0,onCreateClick:$,onDeleteWorkspace:ie,onSelectWorkspace:i}),topbarActions:ce?void 0:c.jsx(c.Fragment,{children:c.jsx(ux,{})}),openTaskCount:fe,workingCount:re.filter(pe=>pe.status==="working").length,banner:Ne,terminalPanels:xt,fullBleed:ce?Wt:void 0,team:ce?null:Wt,tasks:ce?null:c.jsx(Q3,{tasksFile:de,workspacePath:R.effectiveActiveWorkspace?.path??null,workers:re,onSelectOwner:le,onAddWorkspace:$,demoMode:u}),settings:ce||!u?void 0:c.jsx(I3,{demoMode:u,onTryDemo:f,onExitDemo:m}),activeSection:O,onSectionChange:M,overlays:pn}),c.jsx(Qy,{versionInfo:q}),c.jsx(Xy,{terminalRuns:ne.terminalRuns}),c.jsx(Zy,{})]}):c.jsxs(c.Fragment,{children:[c.jsxs(L3,{hideTopbarActions:!R.effectiveActiveWorkspace,memoryOpen:w,onToggleMemory:u?void 0:()=>E(pe=>!pe),onToggleTaskGraph:()=>T(pe=>!pe),openTaskCount:fe,topbarActions:ke,taskGraphOpen:S,onToggleWorkflows:u||!X?void 0:()=>j(pe=>!pe),workflowsOpen:C,sidebarResize:L,sidebar:tn,versionInfo:q,children:[Wt,xt,pn,Nn,hn]}),c.jsx(Qy,{versionInfo:q}),c.jsx(Xy,{terminalRuns:ne.terminalRuns}),c.jsx(Zy,{}),c.jsx(oR,{})]})},Q5={success:Pb,warning:Ks,error:RS},_f={success:"var(--status-green)",warning:"var(--status-orange)",error:"var(--status-red)"},cb=({toast:t,api:a})=>{const{t:o}=we(),i=Q5[t.kind],l=a.getDuration(t.id);return c.jsxs("div",{"data-testid":"toast","data-kind":t.kind,onMouseEnter:()=>a.pauseDismiss(t.id),onMouseLeave:()=>a.resumeDismiss(t.id),className:"toast elev-2 toast-pop pointer-events-auto relative flex min-w-[260px] max-w-[400px] items-start gap-3 overflow-hidden rounded-lg border px-3 py-2.5",style:{background:"var(--bg-elevated)",borderColor:`color-mix(in oklab, ${_f[t.kind]} 35%, var(--border))`},children:[c.jsx("span",{className:"mt-0.5 shrink-0",style:{color:_f[t.kind]},"aria-hidden":!0,children:c.jsx(i,{size:14})}),c.jsx("div",{className:"min-w-0 flex-1 break-words text-sm text-pri",children:t.message}),c.jsx("button",{type:"button","data-testid":"toast-close",onClick:()=>a.dismiss(t.id),className:"-mt-0.5 -mr-1 flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded text-ter transition-colors hover:bg-3 hover:text-pri","aria-label":o("toast.dismissAria"),children:c.jsx(Ka,{size:14,"aria-hidden":!0})}),l>0?c.jsx("span",{className:"toast-progress-bar",style:{background:_f[t.kind],animationDuration:`${l}ms`},"aria-hidden":!0}):null]})},J5=()=>{const t=CA(),a=en(),o=wt();if(t.length===0)return null;const i=t.filter(u=>u.kind==="error"),l=t.filter(u=>u.kind!=="error");return c.jsxs("div",{className:"toaster pointer-events-none fixed right-4 bottom-8 z-50 flex flex-col gap-2","data-mobile":o||void 0,"data-testid":"toaster",children:[c.jsx("div",{role:"status","aria-live":"polite",className:"flex flex-col gap-2",children:l.map(u=>c.jsx(cb,{toast:u,api:a},u.id))}),c.jsx("div",{role:"alert","aria-live":"assertive",className:"flex flex-col gap-2",children:i.map(u=>c.jsx(cb,{toast:u,api:a},u.id))})]})},eO=({children:t})=>c.jsx(Aw,{delayDuration:250,skipDelayDuration:150,children:c.jsx(XE,{children:c.jsx(EA,{children:c.jsx(WA,{children:c.jsx(T3,{children:c.jsx(E3,{children:c.jsxs(w3,{children:[t,c.jsx(J5,{})]})})})})})})}),tO=()=>c.jsx(LN,{children:c.jsx(eO,{children:c.jsx(Z5,{})})}),ub="\0gw:",xr={Unauthorized:4401,Forbidden:4403,DaemonOffline:4404,Revoked:4410,InternalError:4500},Rx="hb:ping",Ox="hb:pong",nO=t=>t===xr.Unauthorized||t===xr.Revoked;function aO(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in t&&t.BYTES_PER_ELEMENT===1}function sm(t){if(typeof t!="boolean")throw new TypeError(`boolean expected, not ${t}`)}function bo(t){if(typeof t!="number")throw new TypeError("number expected, got "+typeof t);if(!Number.isSafeInteger(t)||t<0)throw new RangeError("positive integer expected, got "+t)}function Et(t,a,o=""){const i=aO(t),l=t?.length,u=a!==void 0;if(!i||u&&l!==a){const f=o&&`"${o}" `,m=u?` of length ${a}`:"",g=i?`length=${l}`:`type=${typeof t}`,p=f+"expected Uint8Array"+m+", got "+g;throw i?new RangeError(p):new TypeError(p)}return t}function db(t,a=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(a&&t.finished)throw new Error("Hash#digest() has already been called")}function rO(t,a,o=!1){Et(t,void 0,"output");const i=a.outputLen;if(t.length<i)throw new RangeError("digestInto() expects output buffer of length at least "+i);if(o&&!Gs(t))throw new Error("invalid output, must be aligned")}function oa(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function qa(...t){for(let a=0;a<t.length;a++)t[a].fill(0)}function oO(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}const kr=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,Dx=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255,St=kr?t=>t:t=>Dx(t)>>>0,sO=t=>{for(let a=0;a<t.length;a++)t[a]=Dx(t[a]);return t},Wa=kr?t=>t:sO;function iO(t,a){if(a==null||typeof a!="object")throw new Error("options must be defined");return Object.assign(t,a)}function lO(t,a){if(t.length!==a.length)return!1;let o=0;for(let i=0;i<t.length;i++)o|=t[i]^a[i];return o===0}function cO(t,a,o){const i=a,l=(()=>[]),u=(m,g)=>i(g,...l(m)).update(m).digest(),f=i(new Uint8Array(t),...l(new Uint8Array(0)));return u.outputLen=f.outputLen,u.blockLen=f.blockLen,u.create=(m,...g)=>i(m,...g),u}const uO=(t,a)=>{function o(i,...l){if(Et(i,void 0,"key"),t.nonceLength!==void 0){const y=l[0];Et(y,t.varSizeNonce?void 0:t.nonceLength,"nonce")}const u=t.tagLength;u&&l[1]!==void 0&&Et(l[1],void 0,"AAD");const f=a(i,...l),m=(y,v)=>{if(v!==void 0){if(y!==2)throw new Error("cipher output not supported");Et(v,void 0,"output")}};let g=!1;return{encrypt(y,v){if(g)throw new Error("cannot encrypt() twice with same key + nonce");return g=!0,Et(y),m(f.encrypt.length,v),f.encrypt(y,v)},decrypt(y,v){if(Et(y),u&&y.length<u)throw new Error('"ciphertext" expected length bigger than tagLength='+u);return m(f.decrypt.length,v),f.decrypt(y,v)}}}return Object.assign(o,t),o};function im(t,a,o=!0){if(a===void 0)return new Uint8Array(t);if(Et(a,void 0,"output"),a.length!==t)throw new Error('"output" expected Uint8Array of length '+t+", got: "+a.length);if(o&&!Gs(a))throw new Error("invalid output, must be aligned");return a}function dO(t,a,o){bo(t),bo(a),sm(o);const i=new Uint8Array(16),l=oO(i);return l.setBigUint64(0,BigInt(a),o),l.setBigUint64(8,BigInt(t),o),i}function Gs(t){return t.byteOffset%4===0}function rc(t){return Uint8Array.from(Et(t))}function Mx(t=32){bo(t);const a=typeof globalThis=="object"?globalThis.crypto:null;if(typeof a?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");return a.getRandomValues(new Uint8Array(t))}const Lx=t=>Uint8Array.from(t.split(""),a=>a.charCodeAt(0)),fO=Wa(oa(Lx("expand 16-byte k"))),mO=Wa(oa(Lx("expand 32-byte k")));function ve(t,a){return t<<a|t>>>32-a}const Ms=64,pO=16,lm=2**32-1,fb=Uint32Array.of();function hO(t,a,o,i,l,u,f,m){const g=l.length,p=new Uint8Array(Ms),y=oa(p),v=kr&&Gs(l)&&Gs(u),k=v?oa(l):fb,S=v?oa(u):fb;if(!kr){for(let T=0;T<g;f++){if(t(a,o,i,y,f,m),Wa(y),f>=lm)throw new Error("arx: counter overflow");const w=Math.min(Ms,g-T);for(let E=0,C;E<w;E++)C=T+E,u[C]=l[C]^p[E];T+=w}return}for(let T=0;T<g;f++){if(t(a,o,i,y,f,m),f>=lm)throw new Error("arx: counter overflow");const w=Math.min(Ms,g-T);if(v&&w===Ms){const E=T/4;if(T%4!==0)throw new Error("arx: invalid block position");for(let C=0,j;C<pO;C++)j=E+C,S[j]=k[j]^y[C];T+=Ms;continue}for(let E=0,C;E<w;E++)C=T+E,u[C]=l[C]^p[E];T+=w}}function gO(t,a){const{allowShortKeys:o,extendNonceFn:i,counterLength:l,counterRight:u,rounds:f}=iO({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},a);if(typeof t!="function")throw new Error("core must be a function");return bo(l),bo(f),sm(u),sm(o),(m,g,p,y,v=0)=>{Et(m,void 0,"key"),Et(g,void 0,"nonce"),Et(p,void 0,"data");const k=p.length;if(y=im(k,y,!1),bo(v),v<0||v>=lm)throw new Error("arx: counter overflow");const S=[];let T=m.length,w,E;if(T===32)S.push(w=rc(m)),E=mO;else if(T===16&&o)w=new Uint8Array(32),w.set(m),w.set(m,16),E=fO,S.push(w);else throw Et(m,32,"arx key"),new Error("invalid key size");(!kr||!Gs(g))&&S.push(g=rc(g));let C=oa(w);if(i){if(g.length!==24)throw new Error("arx: extended nonce must be 24 bytes");const N=g.subarray(0,16);if(kr)i(E,C,oa(N),C);else{const O=Wa(Uint32Array.from(E));i(O,C,oa(N),C),qa(O),Wa(C)}g=g.subarray(16)}else kr||Wa(C);const j=16-l;if(j!==g.length)throw new Error(`arx: nonce must be ${j} or 16 bytes`);if(j!==12){const N=new Uint8Array(12);N.set(g,u?0:12-g.length),g=N,S.push(g)}const _=Wa(oa(g));try{return hO(t,E,C,_,p,y,v,f),y}finally{qa(...S)}}}function yt(t,a){return t[a++]&255|(t[a++]&255)<<8}class vO{blockLen=16;outputLen=16;buffer=new Uint8Array(16);r=new Uint16Array(10);h=new Uint16Array(10);pad=new Uint16Array(8);pos=0;finished=!1;destroyed=!1;constructor(a){a=rc(Et(a,32,"key"));const o=yt(a,0),i=yt(a,2),l=yt(a,4),u=yt(a,6),f=yt(a,8),m=yt(a,10),g=yt(a,12),p=yt(a,14);this.r[0]=o&8191,this.r[1]=(o>>>13|i<<3)&8191,this.r[2]=(i>>>10|l<<6)&7939,this.r[3]=(l>>>7|u<<9)&8191,this.r[4]=(u>>>4|f<<12)&255,this.r[5]=f>>>1&8190,this.r[6]=(f>>>14|m<<2)&8191,this.r[7]=(m>>>11|g<<5)&8065,this.r[8]=(g>>>8|p<<8)&8191,this.r[9]=p>>>5&127;for(let y=0;y<8;y++)this.pad[y]=yt(a,16+2*y)}process(a,o,i=!1){const l=i?0:2048,{h:u,r:f}=this,m=f[0],g=f[1],p=f[2],y=f[3],v=f[4],k=f[5],S=f[6],T=f[7],w=f[8],E=f[9],C=yt(a,o+0),j=yt(a,o+2),_=yt(a,o+4),N=yt(a,o+6),O=yt(a,o+8),M=yt(a,o+10),L=yt(a,o+12),U=yt(a,o+14);let q=u[0]+(C&8191),ae=u[1]+((C>>>13|j<<3)&8191),ee=u[2]+((j>>>10|_<<6)&8191),F=u[3]+((_>>>7|N<<9)&8191),J=u[4]+((N>>>4|O<<12)&8191),X=u[5]+(O>>>1&8191),$=u[6]+((O>>>14|M<<2)&8191),D=u[7]+((M>>>11|L<<5)&8191),P=u[8]+((L>>>8|U<<8)&8191),I=u[9]+(U>>>5|l),V=0,Z=V+q*m+ae*(5*E)+ee*(5*w)+F*(5*T)+J*(5*S);V=Z>>>13,Z&=8191,Z+=X*(5*k)+$*(5*v)+D*(5*y)+P*(5*p)+I*(5*g),V+=Z>>>13,Z&=8191;let R=V+q*g+ae*m+ee*(5*E)+F*(5*w)+J*(5*T);V=R>>>13,R&=8191,R+=X*(5*S)+$*(5*k)+D*(5*v)+P*(5*y)+I*(5*p),V+=R>>>13,R&=8191;let B=V+q*p+ae*g+ee*m+F*(5*E)+J*(5*w);V=B>>>13,B&=8191,B+=X*(5*T)+$*(5*S)+D*(5*k)+P*(5*v)+I*(5*y),V+=B>>>13,B&=8191;let re=V+q*y+ae*p+ee*g+F*m+J*(5*E);V=re>>>13,re&=8191,re+=X*(5*w)+$*(5*T)+D*(5*S)+P*(5*k)+I*(5*v),V+=re>>>13,re&=8191;let ne=V+q*v+ae*y+ee*p+F*g+J*m;V=ne>>>13,ne&=8191,ne+=X*(5*E)+$*(5*w)+D*(5*T)+P*(5*S)+I*(5*k),V+=ne>>>13,ne&=8191;let de=V+q*k+ae*v+ee*y+F*p+J*g;V=de>>>13,de&=8191,de+=X*m+$*(5*E)+D*(5*w)+P*(5*T)+I*(5*S),V+=de>>>13,de&=8191;let fe=V+q*S+ae*k+ee*v+F*y+J*p;V=fe>>>13,fe&=8191,fe+=X*g+$*m+D*(5*E)+P*(5*w)+I*(5*T),V+=fe>>>13,fe&=8191;let ue=V+q*T+ae*S+ee*k+F*v+J*y;V=ue>>>13,ue&=8191,ue+=X*p+$*g+D*m+P*(5*E)+I*(5*w),V+=ue>>>13,ue&=8191;let ie=V+q*w+ae*T+ee*S+F*k+J*v;V=ie>>>13,ie&=8191,ie+=X*y+$*p+D*g+P*m+I*(5*E),V+=ie>>>13,ie&=8191;let le=V+q*E+ae*w+ee*T+F*S+J*k;V=le>>>13,le&=8191,le+=X*v+$*y+D*p+P*g+I*m,V+=le>>>13,le&=8191,V=(V<<2)+V|0,V=V+Z|0,Z=V&8191,V=V>>>13,R+=V,u[0]=Z,u[1]=R,u[2]=B,u[3]=re,u[4]=ne,u[5]=de,u[6]=fe,u[7]=ue,u[8]=ie,u[9]=le}finalize(){const{h:a,pad:o}=this,i=new Uint16Array(10);let l=a[1]>>>13;a[1]&=8191;for(let m=2;m<10;m++)a[m]+=l,l=a[m]>>>13,a[m]&=8191;a[0]+=l*5,l=a[0]>>>13,a[0]&=8191,a[1]+=l,l=a[1]>>>13,a[1]&=8191,a[2]+=l,i[0]=a[0]+5,l=i[0]>>>13,i[0]&=8191;for(let m=1;m<10;m++)i[m]=a[m]+l,l=i[m]>>>13,i[m]&=8191;i[9]-=8192;let u=(l^1)-1;for(let m=0;m<10;m++)i[m]&=u;u=~u;for(let m=0;m<10;m++)a[m]=a[m]&u|i[m];a[0]=(a[0]|a[1]<<13)&65535,a[1]=(a[1]>>>3|a[2]<<10)&65535,a[2]=(a[2]>>>6|a[3]<<7)&65535,a[3]=(a[3]>>>9|a[4]<<4)&65535,a[4]=(a[4]>>>12|a[5]<<1|a[6]<<14)&65535,a[5]=(a[6]>>>2|a[7]<<11)&65535,a[6]=(a[7]>>>5|a[8]<<8)&65535,a[7]=(a[8]>>>8|a[9]<<5)&65535;let f=a[0]+o[0];a[0]=f&65535;for(let m=1;m<8;m++)f=(a[m]+o[m]|0)+(f>>>16)|0,a[m]=f&65535;qa(i)}update(a){db(this),Et(a),a=rc(a);const{buffer:o,blockLen:i}=this,l=a.length;for(let u=0;u<l;){const f=Math.min(i-this.pos,l-u);if(f===i){for(;i<=l-u;u+=i)this.process(a,u);continue}o.set(a.subarray(u,u+f),this.pos),this.pos+=f,u+=f,this.pos===i&&(this.process(o,0,!1),this.pos=0)}return this}destroy(){this.destroyed=!0,qa(this.h,this.r,this.buffer,this.pad)}digestInto(a){db(this),rO(a,this),this.finished=!0;const{buffer:o,h:i}=this;let{pos:l}=this;if(l){for(o[l++]=1;l<16;l++)o[l]=0;this.process(o,0,!0)}this.finalize();let u=0;for(let f=0;f<8;f++)a[u++]=i[f]>>>0,a[u++]=i[f]>>>8}digest(){const{buffer:a,outputLen:o}=this;this.digestInto(a);const i=a.slice(0,o);return this.destroy(),i}}const yO=cO(32,t=>new vO(t));function bO(t,a,o,i,l,u=20){let f=t[0],m=t[1],g=t[2],p=t[3],y=a[0],v=a[1],k=a[2],S=a[3],T=a[4],w=a[5],E=a[6],C=a[7],j=l,_=o[0],N=o[1],O=o[2],M=f,L=m,U=g,q=p,ae=y,ee=v,F=k,J=S,X=T,$=w,D=E,P=C,I=j,V=_,Z=N,R=O;for(let re=0;re<u;re+=2)M=M+ae|0,I=ve(I^M,16),X=X+I|0,ae=ve(ae^X,12),M=M+ae|0,I=ve(I^M,8),X=X+I|0,ae=ve(ae^X,7),L=L+ee|0,V=ve(V^L,16),$=$+V|0,ee=ve(ee^$,12),L=L+ee|0,V=ve(V^L,8),$=$+V|0,ee=ve(ee^$,7),U=U+F|0,Z=ve(Z^U,16),D=D+Z|0,F=ve(F^D,12),U=U+F|0,Z=ve(Z^U,8),D=D+Z|0,F=ve(F^D,7),q=q+J|0,R=ve(R^q,16),P=P+R|0,J=ve(J^P,12),q=q+J|0,R=ve(R^q,8),P=P+R|0,J=ve(J^P,7),M=M+ee|0,R=ve(R^M,16),D=D+R|0,ee=ve(ee^D,12),M=M+ee|0,R=ve(R^M,8),D=D+R|0,ee=ve(ee^D,7),L=L+F|0,I=ve(I^L,16),P=P+I|0,F=ve(F^P,12),L=L+F|0,I=ve(I^L,8),P=P+I|0,F=ve(F^P,7),U=U+J|0,V=ve(V^U,16),X=X+V|0,J=ve(J^X,12),U=U+J|0,V=ve(V^U,8),X=X+V|0,J=ve(J^X,7),q=q+ae|0,Z=ve(Z^q,16),$=$+Z|0,ae=ve(ae^$,12),q=q+ae|0,Z=ve(Z^q,8),$=$+Z|0,ae=ve(ae^$,7);let B=0;i[B++]=f+M|0,i[B++]=m+L|0,i[B++]=g+U|0,i[B++]=p+q|0,i[B++]=y+ae|0,i[B++]=v+ee|0,i[B++]=k+F|0,i[B++]=S+J|0,i[B++]=T+X|0,i[B++]=w+$|0,i[B++]=E+D|0,i[B++]=C+P|0,i[B++]=j+I|0,i[B++]=_+V|0,i[B++]=N+Z|0,i[B++]=O+R|0}function wO(t,a,o,i){let l=St(t[0]),u=St(t[1]),f=St(t[2]),m=St(t[3]),g=St(a[0]),p=St(a[1]),y=St(a[2]),v=St(a[3]),k=St(a[4]),S=St(a[5]),T=St(a[6]),w=St(a[7]),E=St(o[0]),C=St(o[1]),j=St(o[2]),_=St(o[3]);for(let O=0;O<20;O+=2)l=l+g|0,E=ve(E^l,16),k=k+E|0,g=ve(g^k,12),l=l+g|0,E=ve(E^l,8),k=k+E|0,g=ve(g^k,7),u=u+p|0,C=ve(C^u,16),S=S+C|0,p=ve(p^S,12),u=u+p|0,C=ve(C^u,8),S=S+C|0,p=ve(p^S,7),f=f+y|0,j=ve(j^f,16),T=T+j|0,y=ve(y^T,12),f=f+y|0,j=ve(j^f,8),T=T+j|0,y=ve(y^T,7),m=m+v|0,_=ve(_^m,16),w=w+_|0,v=ve(v^w,12),m=m+v|0,_=ve(_^m,8),w=w+_|0,v=ve(v^w,7),l=l+p|0,_=ve(_^l,16),T=T+_|0,p=ve(p^T,12),l=l+p|0,_=ve(_^l,8),T=T+_|0,p=ve(p^T,7),u=u+y|0,E=ve(E^u,16),w=w+E|0,y=ve(y^w,12),u=u+y|0,E=ve(E^u,8),w=w+E|0,y=ve(y^w,7),f=f+v|0,C=ve(C^f,16),k=k+C|0,v=ve(v^k,12),f=f+v|0,C=ve(C^f,8),k=k+C|0,v=ve(v^k,7),m=m+g|0,j=ve(j^m,16),S=S+j|0,g=ve(g^S,12),m=m+g|0,j=ve(j^m,8),S=S+j|0,g=ve(g^S,7);let N=0;i[N++]=l,i[N++]=u,i[N++]=f,i[N++]=m,i[N++]=E,i[N++]=C,i[N++]=j,i[N++]=_,Wa(i)}const xO=gO(bO,{counterRight:!1,counterLength:8,extendNonceFn:wO,allowShortKeys:!1}),kO=new Uint8Array(16),mb=(t,a)=>{t.update(a);const o=a.length%16;o&&t.update(kO.subarray(o))},SO=new Uint8Array(32);function pb(t,a,o,i,l){l!==void 0&&Et(l,void 0,"AAD");const u=t(a,o,SO),f=dO(i.length,l?l.length:0,!0),m=yO.create(u);l&&mb(m,l),mb(m,i),m.update(f);const g=m.digest();return qa(u,f),g}const EO=t=>(a,o,i)=>({encrypt(u,f){const m=u.length;f=im(m+16,f,!1),f.set(u);const g=f.subarray(0,-16);t(a,o,g,g,1);const p=pb(t,a,o,g,i);return f.set(p,m),qa(p),f},decrypt(u,f){f=im(u.length-16,f,!1);const m=u.subarray(0,-16),g=u.subarray(-16),p=pb(t,a,o,m,i);if(!lO(g,p))throw qa(p),new Error("invalid tag");return f.set(u.subarray(0,-16)),t(a,o,f,f,1),qa(p),f}}),zx=uO({blockSize:64,nonceLength:24,tagLength:16},EO(xO));function CO(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in t&&t.BYTES_PER_ELEMENT===1}function Co(t,a=""){if(typeof t!="number"){const o=a&&`"${a}" `;throw new TypeError(`${o}expected number, got ${typeof t}`)}if(!Number.isSafeInteger(t)||t<0){const o=a&&`"${a}" `;throw new RangeError(`${o}expected integer >= 0, got ${t}`)}}function la(t,a,o=""){const i=CO(t),l=t?.length,u=a!==void 0;if(!i||u&&l!==a){const f=o&&`"${o}" `,m=u?` of length ${a}`:"",g=i?`length=${l}`:`type=${typeof t}`,p=f+"expected Uint8Array"+m+", got "+g;throw i?new RangeError(p):new TypeError(p)}return t}function $m(t){if(typeof t!="function"||typeof t.create!="function")throw new TypeError("Hash must wrapped by utils.createHasher");if(Co(t.outputLen),Co(t.blockLen),t.outputLen<1)throw new Error('"outputLen" must be >= 1');if(t.blockLen<1)throw new Error('"blockLen" must be >= 1')}function oc(t,a=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(a&&t.finished)throw new Error("Hash#digest() has already been called")}function Hx(t,a){la(t,void 0,"digestInto() output");const o=a.outputLen;if(t.length<o)throw new RangeError('"digestInto() output" expected to be of length >='+o)}function Xs(...t){for(let a=0;a<t.length;a++)t[a].fill(0)}function Rf(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function On(t,a){return t<<32-a|t>>>a}const Bx=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",TO=Array.from({length:256},(t,a)=>a.toString(16).padStart(2,"0"));function Vm(t){if(la(t),Bx)return t.toHex();let a="";for(let o=0;o<t.length;o++)a+=TO[t[o]];return a}const ra={_0:48,_9:57,A:65,F:70,a:97,f:102};function hb(t){if(t>=ra._0&&t<=ra._9)return t-ra._0;if(t>=ra.A&&t<=ra.F)return t-(ra.A-10);if(t>=ra.a&&t<=ra.f)return t-(ra.a-10)}function Gm(t){if(typeof t!="string")throw new TypeError("hex string expected, got "+typeof t);if(Bx)try{return Uint8Array.fromHex(t)}catch(l){throw l instanceof SyntaxError?new RangeError(l.message):l}const a=t.length,o=a/2;if(a%2)throw new RangeError("hex string expected, got unpadded hex of length "+a);const i=new Uint8Array(o);for(let l=0,u=0;l<o;l++,u+=2){const f=hb(t.charCodeAt(u)),m=hb(t.charCodeAt(u+1));if(f===void 0||m===void 0){const g=t[u]+t[u+1];throw new RangeError('hex string expected, got non-hex character "'+g+'" at index '+u)}i[l]=f*16+m}return i}function NO(t,a={}){const o=(l,u)=>t(u).update(l).digest(),i=t(void 0);return o.outputLen=i.outputLen,o.blockLen=i.blockLen,o.canXOF=i.canXOF,o.create=l=>t(l),Object.assign(o,a),Object.freeze(o)}function jO(t=32){Co(t,"bytesLength");const a=typeof globalThis=="object"?globalThis.crypto:null;if(typeof a?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");if(t>65536)throw new RangeError(`"bytesLength" expected <= 65536, got ${t}`);return a.getRandomValues(new Uint8Array(t))}const AO=t=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,t])});function _O(t,a,o){return t&a^~t&o}function RO(t,a,o){return t&a^t&o^a&o}class OO{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(a,o,i,l){this.blockLen=a,this.outputLen=o,this.padOffset=i,this.isLE=l,this.buffer=new Uint8Array(a),this.view=Rf(this.buffer)}update(a){oc(this),la(a);const{view:o,buffer:i,blockLen:l}=this,u=a.length;for(let f=0;f<u;){const m=Math.min(l-this.pos,u-f);if(m===l){const g=Rf(a);for(;l<=u-f;f+=l)this.process(g,f);continue}i.set(a.subarray(f,f+m),this.pos),this.pos+=m,f+=m,this.pos===l&&(this.process(o,0),this.pos=0)}return this.length+=a.length,this.roundClean(),this}digestInto(a){oc(this),Hx(a,this),this.finished=!0;const{buffer:o,view:i,blockLen:l,isLE:u}=this;let{pos:f}=this;o[f++]=128,Xs(this.buffer.subarray(f)),this.padOffset>l-f&&(this.process(i,0),f=0);for(let v=f;v<l;v++)o[v]=0;i.setBigUint64(l-8,BigInt(this.length*8),u),this.process(i,0);const m=Rf(a),g=this.outputLen;if(g%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const p=g/4,y=this.get();if(p>y.length)throw new Error("_sha2: outputLen bigger than state");for(let v=0;v<p;v++)m.setUint32(4*v,y[v],u)}digest(){const{buffer:a,outputLen:o}=this;this.digestInto(a);const i=a.slice(0,o);return this.destroy(),i}_cloneInto(a){a||=new this.constructor,a.set(...this.get());const{blockLen:o,buffer:i,length:l,finished:u,destroyed:f,pos:m}=this;return a.destroyed=f,a.finished=u,a.length=l,a.pos=m,l%o&&a.buffer.set(i),a}clone(){return this._cloneInto()}}const La=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),DO=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),za=new Uint32Array(64);class MO extends OO{constructor(a){super(64,a,8,!1)}get(){const{A:a,B:o,C:i,D:l,E:u,F:f,G:m,H:g}=this;return[a,o,i,l,u,f,m,g]}set(a,o,i,l,u,f,m,g){this.A=a|0,this.B=o|0,this.C=i|0,this.D=l|0,this.E=u|0,this.F=f|0,this.G=m|0,this.H=g|0}process(a,o){for(let v=0;v<16;v++,o+=4)za[v]=a.getUint32(o,!1);for(let v=16;v<64;v++){const k=za[v-15],S=za[v-2],T=On(k,7)^On(k,18)^k>>>3,w=On(S,17)^On(S,19)^S>>>10;za[v]=w+za[v-7]+T+za[v-16]|0}let{A:i,B:l,C:u,D:f,E:m,F:g,G:p,H:y}=this;for(let v=0;v<64;v++){const k=On(m,6)^On(m,11)^On(m,25),S=y+k+_O(m,g,p)+DO[v]+za[v]|0,w=(On(i,2)^On(i,13)^On(i,22))+RO(i,l,u)|0;y=p,p=g,g=m,m=f+S|0,f=u,u=l,l=i,i=S+w|0}i=i+this.A|0,l=l+this.B|0,u=u+this.C|0,f=f+this.D|0,m=m+this.E|0,g=g+this.F|0,p=p+this.G|0,y=y+this.H|0,this.set(i,l,u,f,m,g,p,y)}roundClean(){Xs(za)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),Xs(this.buffer)}}class LO extends MO{A=La[0]|0;B=La[1]|0;C=La[2]|0;D=La[3]|0;E=La[4]|0;F=La[5]|0;G=La[6]|0;H=La[7]|0;constructor(){super(32)}}const wo=NO(()=>new LO,AO(1));const Pa=(t,a,o)=>la(t,a,o),Ux=Co,Wx=Vm,zO=t=>Gm(t),HO=t=>jO(t),sc=BigInt(0),cm=BigInt(1);function Ix(t,a=""){if(typeof t!="boolean"){const o=a&&`"${a}" `;throw new TypeError(o+"expected boolean, got type="+typeof t)}return t}function BO(t){if(typeof t=="bigint"){if(!Pl(t))throw new RangeError("positive bigint expected, got "+t)}else Ux(t);return t}function gb(t,a=""){if(typeof t!="number"){const o=a&&`"${a}" `;throw new TypeError(o+"expected number, got type="+typeof t)}if(!Number.isSafeInteger(t)){const o=a&&`"${a}" `;throw new RangeError(o+"expected safe integer, got "+t)}}function qx(t){if(typeof t!="string")throw new TypeError("hex string expected, got "+typeof t);return t===""?sc:BigInt("0x"+t)}function UO(t){return qx(Vm(t))}function Zs(t){return qx(Vm(Qs(la(t)).reverse()))}function Px(t,a){if(Co(a),a===0)throw new RangeError("zero length");t=BO(t);const o=t.toString(16);if(o.length>a*2)throw new RangeError("number too large");return Gm(o.padStart(a*2,"0"))}function Fx(t,a){return Px(t,a).reverse()}function WO(t,a){if(t=Pa(t),a=Pa(a),t.length!==a.length)return!1;let o=0;for(let i=0;i<t.length;i++)o|=t[i]^a[i];return o===0}function Qs(t){return Uint8Array.from(Pa(t))}const Pl=t=>typeof t=="bigint"&&sc<=t;function IO(t,a,o){return Pl(t)&&Pl(a)&&Pl(o)&&a<=t&&t<o}function ic(t,a,o,i){if(!IO(a,o,i))throw new RangeError("expected valid "+t+": "+o+" <= n < "+i+", got "+a)}function qO(t){if(t<sc)throw new Error("expected non-negative bigint, got "+t);let a;for(a=0;t>sc;t>>=cm,a+=1);return a}const PO=t=>(cm<<BigInt(t))-cm;function Xm(t,a={},o={}){if(Object.prototype.toString.call(t)!=="[object Object]")throw new TypeError("expected valid options object");function i(u,f,m){if(!m&&f!=="function"&&!Object.hasOwn(t,u))throw new TypeError(`param "${u}" is invalid: expected own property`);const g=t[u];if(m&&g===void 0)return;const p=typeof g;if(p!==f||g===null)throw new TypeError(`param "${u}" is invalid: expected ${f}, got ${p}`)}const l=(u,f)=>Object.entries(u).forEach(([m,g])=>i(m,g,f));l(a,!1),l(o,!0)}const vb=()=>{throw new Error("not implemented")};const Ct=BigInt(0),bt=BigInt(1),br=BigInt(2),Kx=BigInt(3),Yx=BigInt(4),$x=BigInt(5),FO=BigInt(7),Vx=BigInt(8),KO=BigInt(9),Gx=BigInt(16);function at(t,a){if(a<=Ct)throw new Error("mod: expected positive modulus, got "+a);const o=t%a;return o>=Ct?o:a+o}function bn(t,a,o){if(a<Ct)throw new Error("pow2: expected non-negative exponent, got "+a);let i=t;for(;a-- >Ct;)i*=i,i%=o;return i}function yb(t,a){if(t===Ct)throw new Error("invert: expected non-zero number");if(a<=Ct)throw new Error("invert: expected positive modulus, got "+a);let o=at(t,a),i=a,l=Ct,u=bt;for(;o!==Ct;){const m=i/o,g=i-o*m,p=l-u*m;i=o,o=g,l=u,u=p}if(i!==bt)throw new Error("invert: does not exist");return at(l,a)}function Zm(t,a,o){const i=t;if(!i.eql(i.sqr(a),o))throw new Error("Cannot find square root")}function Xx(t,a){const o=t,i=(o.ORDER+bt)/Yx,l=o.pow(a,i);return Zm(o,l,a),l}function YO(t,a){const o=t,i=(o.ORDER-$x)/Vx,l=o.mul(a,br),u=o.pow(l,i),f=o.mul(a,u),m=o.mul(o.mul(f,br),u),g=o.mul(f,o.sub(m,o.ONE));return Zm(o,g,a),g}function $O(t){const a=Qm(t),o=Zx(t),i=o(a,a.neg(a.ONE)),l=o(a,i),u=o(a,a.neg(i)),f=(t+FO)/Gx;return((m,g)=>{const p=m;let y=p.pow(g,f),v=p.mul(y,i);const k=p.mul(y,l),S=p.mul(y,u),T=p.eql(p.sqr(v),g),w=p.eql(p.sqr(k),g);y=p.cmov(y,v,T),v=p.cmov(S,k,w);const E=p.eql(p.sqr(v),g),C=p.cmov(y,v,E);return Zm(p,C,g),C})}function Zx(t){if(t<Kx)throw new Error("sqrt is not defined for small field");let a=t-bt,o=0;for(;a%br===Ct;)a/=br,o++;let i=br;const l=Qm(t);for(;bb(l,i)===1;)if(i++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(o===1)return Xx;let u=l.pow(i,a);const f=(a+bt)/br;return function(g,p){const y=g;if(y.is0(p))return p;if(bb(y,p)!==1)throw new Error("Cannot find square root");let v=o,k=y.mul(y.ONE,u),S=y.pow(p,a),T=y.pow(p,f);for(;!y.eql(S,y.ONE);){if(y.is0(S))return y.ZERO;let w=1,E=y.sqr(S);for(;!y.eql(E,y.ONE);)if(w++,E=y.sqr(E),w===v)throw new Error("Cannot find square root");const C=bt<<BigInt(v-w-1),j=y.pow(k,C);v=w,k=y.sqr(j),S=y.mul(S,k),T=y.mul(T,j)}return T}}function VO(t){return t%Yx===Kx?Xx:t%Vx===$x?YO:t%Gx===KO?$O(t):Zx(t)}const vr=(t,a)=>(at(t,a)&bt)===bt,GO=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function XO(t){const a={ORDER:"bigint",BYTES:"number",BITS:"number"},o=GO.reduce((i,l)=>(i[l]="function",i),a);if(Xm(t,o),gb(t.BYTES,"BYTES"),gb(t.BITS,"BITS"),t.BYTES<1||t.BITS<1)throw new Error("invalid field: expected BYTES/BITS > 0");if(t.ORDER<=bt)throw new Error("invalid field: expected ORDER > 1, got "+t.ORDER);return t}function ZO(t,a,o){const i=t;if(o<Ct)throw new Error("invalid exponent, negatives unsupported");if(o===Ct)return i.ONE;if(o===bt)return a;let l=i.ONE,u=a;for(;o>Ct;)o&bt&&(l=i.mul(l,u)),u=i.sqr(u),o>>=bt;return l}function Qx(t,a,o=!1){const i=t,l=new Array(a.length).fill(o?i.ZERO:void 0),u=a.reduce((m,g,p)=>i.is0(g)?m:(l[p]=m,i.mul(m,g)),i.ONE),f=i.inv(u);return a.reduceRight((m,g,p)=>i.is0(g)?m:(l[p]=i.mul(m,l[p]),i.mul(m,g)),f),l}function bb(t,a){const o=t,i=(o.ORDER-bt)/br,l=o.pow(a,i),u=o.eql(l,o.ONE),f=o.eql(l,o.ZERO),m=o.eql(l,o.neg(o.ONE));if(!u&&!f&&!m)throw new Error("invalid Legendre symbol result");return u?1:f?0:-1}function QO(t,a){if(a!==void 0&&Ux(a),t<=Ct)throw new Error("invalid n length: expected positive n, got "+t);if(a!==void 0&&a<1)throw new Error("invalid n length: expected positive bit length, got "+a);const o=qO(t);if(a!==void 0&&a<o)throw new Error(`invalid n length: expected bit length (${o}) >= n.length (${a})`);const i=a!==void 0?a:o,l=Math.ceil(i/8);return{nBitLength:i,nByteLength:l}}const wb=new WeakMap;class Jx{ORDER;BITS;BYTES;isLE;ZERO=Ct;ONE=bt;_lengths;_mod;constructor(a,o={}){if(a<=bt)throw new Error("invalid field: expected ORDER > 1, got "+a);let i;this.isLE=!1,o!=null&&typeof o=="object"&&(typeof o.BITS=="number"&&(i=o.BITS),typeof o.sqrt=="function"&&Object.defineProperty(this,"sqrt",{value:o.sqrt,enumerable:!0}),typeof o.isLE=="boolean"&&(this.isLE=o.isLE),o.allowedLengths&&(this._lengths=Object.freeze(o.allowedLengths.slice())),typeof o.modFromBytes=="boolean"&&(this._mod=o.modFromBytes));const{nBitLength:l,nByteLength:u}=QO(a,i);if(u>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=a,this.BITS=l,this.BYTES=u,Object.freeze(this)}create(a){return at(a,this.ORDER)}isValid(a){if(typeof a!="bigint")throw new TypeError("invalid field element: expected bigint, got "+typeof a);return Ct<=a&&a<this.ORDER}is0(a){return a===Ct}isValidNot0(a){return!this.is0(a)&&this.isValid(a)}isOdd(a){return(a&bt)===bt}neg(a){return at(-a,this.ORDER)}eql(a,o){return a===o}sqr(a){return at(a*a,this.ORDER)}add(a,o){return at(a+o,this.ORDER)}sub(a,o){return at(a-o,this.ORDER)}mul(a,o){return at(a*o,this.ORDER)}pow(a,o){return ZO(this,a,o)}div(a,o){return at(a*yb(o,this.ORDER),this.ORDER)}sqrN(a){return a*a}addN(a,o){return a+o}subN(a,o){return a-o}mulN(a,o){return a*o}inv(a){return yb(a,this.ORDER)}sqrt(a){let o=wb.get(this);return o||wb.set(this,o=VO(this.ORDER)),o(this,a)}toBytes(a){return this.isLE?Fx(a,this.BYTES):Px(a,this.BYTES)}fromBytes(a,o=!1){Pa(a);const{_lengths:i,BYTES:l,isLE:u,ORDER:f,_mod:m}=this;if(i){if(a.length<1||!i.includes(a.length)||a.length>l)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+a.length);const p=new Uint8Array(l);p.set(a,u?0:p.length-a.length),a=p}if(a.length!==l)throw new Error("Field.fromBytes: expected "+l+" bytes, got "+a.length);let g=u?Zs(a):UO(a);if(m&&(g=at(g,f)),!o&&!this.isValid(g))throw new Error("invalid field element: outside of range 0..ORDER");return g}invertBatch(a){return Qx(this,a)}cmov(a,o,i){return Ix(i,"condition"),i?o:a}}Object.freeze(Jx.prototype);function Qm(t,a={}){return new Jx(t,a)}const lc=BigInt(0),um=BigInt(1);function xb(t,a){const o=a.negate();return t?o:a}function Of(t,a){const o=Qx(t.Fp,a.map(i=>i.Z));return a.map((i,l)=>t.fromAffine(i.toAffine(o[l])))}function e1(t,a){if(!Number.isSafeInteger(t)||t<=0||t>a)throw new Error("invalid window size, expected [1.."+a+"], got W="+t)}function Df(t,a){e1(t,a);const o=Math.ceil(a/t)+1,i=2**(t-1),l=2**t,u=PO(t),f=BigInt(t);return{windows:o,windowSize:i,mask:u,maxNumber:l,shiftBy:f}}function kb(t,a,o){const{windowSize:i,mask:l,maxNumber:u,shiftBy:f}=o;let m=Number(t&l),g=t>>f;m>i&&(m-=u,g+=um);const p=a*i,y=p+Math.abs(m)-1,v=m===0,k=m<0,S=a%2!==0;return{nextN:g,offset:y,isZero:v,isNeg:k,isNegF:S,offsetF:p}}const Mf=new WeakMap,t1=new WeakMap;function Lf(t){return t1.get(t)||1}function Sb(t){if(t!==lc)throw new Error("invalid wNAF")}class JO{BASE;ZERO;Fn;bits;constructor(a,o){this.BASE=a.BASE,this.ZERO=a.ZERO,this.Fn=a.Fn,this.bits=o}_unsafeLadder(a,o,i=this.ZERO){let l=a;for(;o>lc;)o&um&&(i=i.add(l)),l=l.double(),o>>=um;return i}precomputeWindow(a,o){const{windows:i,windowSize:l}=Df(o,this.bits),u=[];let f=a,m=f;for(let g=0;g<i;g++){m=f,u.push(m);for(let p=1;p<l;p++)m=m.add(f),u.push(m);f=m.double()}return u}wNAF(a,o,i){if(!this.Fn.isValid(i))throw new Error("invalid scalar");let l=this.ZERO,u=this.BASE;const f=Df(a,this.bits);for(let m=0;m<f.windows;m++){const{nextN:g,offset:p,isZero:y,isNeg:v,isNegF:k,offsetF:S}=kb(i,m,f);i=g,y?u=u.add(xb(k,o[S])):l=l.add(xb(v,o[p]))}return Sb(i),{p:l,f:u}}wNAFUnsafe(a,o,i,l=this.ZERO){const u=Df(a,this.bits);for(let f=0;f<u.windows&&i!==lc;f++){const{nextN:m,offset:g,isZero:p,isNeg:y}=kb(i,f,u);if(i=m,!p){const v=o[g];l=l.add(y?v.negate():v)}}return Sb(i),l}getPrecomputes(a,o,i){let l=Mf.get(o);return l||(l=this.precomputeWindow(o,a),a!==1&&(typeof i=="function"&&(l=i(l)),Mf.set(o,l))),l}cached(a,o,i){const l=Lf(a);return this.wNAF(l,this.getPrecomputes(l,a,i),o)}unsafe(a,o,i,l){const u=Lf(a);return u===1?this._unsafeLadder(a,o,l):this.wNAFUnsafe(u,this.getPrecomputes(u,a,i),o,l)}createCache(a,o){e1(o,this.bits),t1.set(a,o),Mf.delete(a)}hasCache(a){return Lf(a)!==1}}function Eb(t,a,o){if(a){if(a.ORDER!==t)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return XO(a),a}else return Qm(t,{isLE:o})}function e6(t,a,o={},i){if(i===void 0&&(i=t==="edwards"),!a||typeof a!="object")throw new Error(`expected valid ${t} CURVE object`);for(const g of["p","n","h"]){const p=a[g];if(!(typeof p=="bigint"&&p>lc))throw new Error(`CURVE.${g} must be positive bigint`)}const l=Eb(a.p,o.Fp,i),u=Eb(a.n,o.Fn,i),m=["Gx","Gy","a","d"];for(const g of m)if(!l.isValid(a[g]))throw new Error(`CURVE.${g} must be valid field element of CURVE.Fp`);return a=Object.freeze(Object.assign({},a)),{CURVE:a,Fp:l,Fn:u}}function t6(t,a){return function(i){const l=t(i);return{secretKey:l,publicKey:a(l)}}}const Ha=BigInt(0),Lt=BigInt(1),zf=BigInt(2),n6=BigInt(8);function a6(t,a,o,i){const l=t.sqr(o),u=t.sqr(i),f=t.add(t.mul(a.a,l),u),m=t.add(t.ONE,t.mul(a.d,t.mul(l,u)));return t.eql(f,m)}function r6(t,a={}){const o=a,i=e6("edwards",t,o,o.FpFnLE),{Fp:l,Fn:u}=i;let f=i.CURVE;const{h:m}=f;Xm(o,{},{uvRatio:"function"});const g=zf<<BigInt(u.BYTES*8)-Lt,p=w=>l.create(w),y=o.uvRatio===void 0?(w,E)=>{try{return{isValid:!0,value:l.sqrt(l.div(w,E))}}catch{return{isValid:!1,value:Ha}}}:o.uvRatio;if(!a6(l,f,f.Gx,f.Gy))throw new Error("bad curve params: generator point");function v(w,E,C=!1){const j=C?Lt:Ha;return ic("coordinate "+w,E,j,g),E}function k(w){if(!(w instanceof S))throw new Error("EdwardsPoint expected")}class S{static BASE=new S(f.Gx,f.Gy,Lt,p(f.Gx*f.Gy));static ZERO=new S(Ha,Lt,Lt,Ha);static Fp=l;static Fn=u;X;Y;Z;T;constructor(E,C,j,_){this.X=v("x",E),this.Y=v("y",C),this.Z=v("z",j,!0),this.T=v("t",_),Object.freeze(this)}static CURVE(){return f}static fromAffine(E){if(E instanceof S)throw new Error("extended point not allowed");const{x:C,y:j}=E||{};return v("x",C),v("y",j),new S(C,j,Lt,p(C*j))}static fromBytes(E,C=!1){const j=l.BYTES,{a:_,d:N}=f;E=Qs(Pa(E,j,"point")),Ix(C,"zip215");const O=Qs(E),M=E[j-1];O[j-1]=M&-129;const L=Zs(O),U=C?g:l.ORDER;ic("point.y",L,Ha,U);const q=p(L*L),ae=p(q-Lt),ee=p(N*q-_);let{isValid:F,value:J}=y(ae,ee);if(!F)throw new Error("bad point: invalid y coordinate");const X=(J&Lt)===Lt,$=(M&128)!==0;if(!C&&J===Ha&&$)throw new Error("bad point: x=0 and x_0=1");return $!==X&&(J=p(-J)),S.fromAffine({x:J,y:L})}static fromHex(E,C=!1){return S.fromBytes(zO(E),C)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(E=8,C=!0){return T.createCache(this,E),C||this.multiply(zf),this}assertValidity(){const E=this,{a:C,d:j}=f;if(E.is0())throw new Error("bad point: ZERO");const{X:_,Y:N,Z:O,T:M}=E,L=p(_*_),U=p(N*N),q=p(O*O),ae=p(q*q),ee=p(L*C),F=p(q*p(ee+U)),J=p(ae+p(j*p(L*U)));if(F!==J)throw new Error("bad point: equation left != right (1)");const X=p(_*N),$=p(O*M);if(X!==$)throw new Error("bad point: equation left != right (2)")}equals(E){k(E);const{X:C,Y:j,Z:_}=this,{X:N,Y:O,Z:M}=E,L=p(C*M),U=p(N*_),q=p(j*M),ae=p(O*_);return L===U&&q===ae}is0(){return this.equals(S.ZERO)}negate(){return new S(p(-this.X),this.Y,this.Z,p(-this.T))}double(){const{a:E}=f,{X:C,Y:j,Z:_}=this,N=p(C*C),O=p(j*j),M=p(zf*p(_*_)),L=p(E*N),U=C+j,q=p(p(U*U)-N-O),ae=L+O,ee=ae-M,F=L-O,J=p(q*ee),X=p(ae*F),$=p(q*F),D=p(ee*ae);return new S(J,X,D,$)}add(E){k(E);const{a:C,d:j}=f,{X:_,Y:N,Z:O,T:M}=this,{X:L,Y:U,Z:q,T:ae}=E,ee=p(_*L),F=p(N*U),J=p(M*j*ae),X=p(O*q),$=p((_+N)*(L+U)-ee-F),D=X-J,P=X+J,I=p(F-C*ee),V=p($*D),Z=p(P*I),R=p($*I),B=p(D*P);return new S(V,Z,B,R)}subtract(E){return k(E),this.add(E.negate())}multiply(E){if(!u.isValidNot0(E))throw new RangeError("invalid scalar: expected 1 <= sc < curve.n");const{p:C,f:j}=T.cached(this,E,_=>Of(S,_));return Of(S,[C,j])[0]}multiplyUnsafe(E){if(!u.isValid(E))throw new RangeError("invalid scalar: expected 0 <= sc < curve.n");return E===Ha?S.ZERO:this.is0()||E===Lt?this:T.unsafe(this,E,C=>Of(S,C))}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){return T.unsafe(this,f.n).is0()}toAffine(E){const C=this;let j=E;const{X:_,Y:N,Z:O}=C,M=C.is0();j==null&&(j=M?n6:l.inv(O));const L=p(_*j),U=p(N*j),q=l.mul(O,j);if(M)return{x:Ha,y:Lt};if(q!==Lt)throw new Error("invZ was invalid");return{x:L,y:U}}clearCofactor(){return m===Lt?this:this.multiplyUnsafe(m)}toBytes(){const{x:E,y:C}=this.toAffine(),j=l.toBytes(C);return j[j.length-1]|=E&Lt?128:0,j}toHex(){return Wx(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}const T=new JO(S,u.BITS);return u.BITS>=8&&S.BASE.precompute(8),Object.freeze(S.prototype),Object.freeze(S),S}class o6{static BASE;static ZERO;static Fp;static Fn;ep;constructor(a){this.ep=a}static fromBytes(a){vb()}static fromHex(a){vb()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(a){return this.ep.toAffine(a)}toHex(){return Wx(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(a){return this.assertSame(a),this.init(this.ep.add(a.ep))}subtract(a){return this.assertSame(a),this.init(this.ep.subtract(a.ep))}multiply(a){return this.init(this.ep.multiply(a))}multiplyUnsafe(a){return this.init(this.ep.multiplyUnsafe(a))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(a,o){return this.ep.precompute(a,o),this}}const Ls=BigInt(0),ho=BigInt(1),Dl=BigInt(2);function s6(t){return Xm(t,{P:"bigint",type:"string",adjustScalarBytes:"function",powPminus2:"function"},{randomBytes:"function"}),Object.freeze({...t})}function i6(t){const a=s6(t),{P:o,type:i,adjustScalarBytes:l,powPminus2:u,randomBytes:f}=a,m=i==="x25519";if(!m&&i!=="x448")throw new Error("invalid type");const g=f===void 0?HO:f,p=m?255:448,y=m?32:56,v=BigInt(m?9:5),k=BigInt(m?121665:39081),S=m?Dl**BigInt(254):Dl**BigInt(447),T=m?BigInt(8)*Dl**BigInt(251)-ho:BigInt(4)*Dl**BigInt(445)-ho,w=S+T+ho,E=X=>at(X,o),C=j(v);function j(X){return Fx(E(X),y)}function _(X){const $=Qs(Pa(X,y,"uCoordinate"));return m&&($[31]&=127),E(Zs($))}function N(X){return Zs(l(Qs(Pa(X,y,"scalar"))))}function O(X,$){const D=ae(_($),N(X));if(D===Ls)throw new Error("invalid private or public key received");return j(D)}function M(X){return O(X,C)}const L=M,U=O;function q(X,$,D){const P=E(X*($-D));return $=E($-P),D=E(D+P),{x_2:$,x_3:D}}function ae(X,$){ic("u",X,Ls,o),ic("scalar",$,S,w);const D=$,P=X;let I=ho,V=Ls,Z=X,R=ho,B=Ls;for(let ne=BigInt(p-1);ne>=Ls;ne--){const de=D>>ne&ho;B^=de,{x_2:I,x_3:Z}=q(B,I,Z),{x_2:V,x_3:R}=q(B,V,R),B=de;const fe=I+V,ue=E(fe*fe),ie=I-V,le=E(ie*ie),ce=ue-le,me=Z+R,Te=Z-R,Ne=E(Te*fe),Se=E(me*ie),rt=Ne+Se,xt=Ne-Se;Z=E(rt*rt),R=E(P*E(xt*xt)),I=E(ue*le),V=E(ce*(ue+E(k*ce)))}({x_2:I,x_3:Z}=q(B,I,Z)),{x_2:V,x_3:R}=q(B,V,R);const re=u(V);return E(I*re)}const ee={secretKey:y,publicKey:y,seed:y},F=X=>(X=X===void 0?g(y):X,Pa(X,ee.seed,"seed"),X),J={randomSecretKey:F};return Object.freeze(ee),Object.freeze(J),Object.freeze({keygen:t6(F,L),getSharedSecret:U,getPublicKey:L,scalarMult:O,scalarMultBase:M,utils:J,GuBytes:C.slice(),lengths:ee})}const l6=BigInt(0),Fs=BigInt(1),Cb=BigInt(2),c6=BigInt(3),u6=BigInt(5),d6=BigInt(8),To=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),n1={p:To,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:d6,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function a1(t){const a=BigInt(10),o=BigInt(20),i=BigInt(40),l=BigInt(80),u=To,m=t*t%u*t%u,g=bn(m,Cb,u)*m%u,p=bn(g,Fs,u)*t%u,y=bn(p,u6,u)*p%u,v=bn(y,a,u)*y%u,k=bn(v,o,u)*v%u,S=bn(k,i,u)*k%u,T=bn(S,l,u)*S%u,w=bn(T,l,u)*S%u,E=bn(w,a,u)*y%u;return{pow_p_5_8:bn(E,Cb,u)*t%u,b2:m}}function f6(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}const dm=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function r1(t,a){const o=To,i=at(a*a*a,o),l=at(i*i*a,o),u=a1(t*l).pow_p_5_8;let f=at(t*i*u,o);const m=at(a*f*f,o),g=f,p=at(f*dm,o),y=m===t,v=m===at(-t,o),k=m===at(-t*dm,o);return y&&(f=g),(v||k)&&(f=p),vr(f,o)&&(f=at(-f,o)),{isValid:y||v,value:f}}const go=r6(n1,{uvRatio:r1}),yr=go.Fp,m6=go.Fn,fm=(()=>{const t=To;return i6({P:t,type:"x25519",powPminus2:a=>{const{pow_p_5_8:o,b2:i}=a1(a);return at(bn(o,c6,t)*i,t)},adjustScalarBytes:f6})})(),Tb=dm,p6=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),Nb=t=>r1(Fs,t),h6=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),g6=t=>yr.create(Zs(t)&h6);class Xt extends o6{static BASE=new Xt(go.BASE);static ZERO=new Xt(go.ZERO);static Fp=yr;static Fn=m6;constructor(a){super(a)}static fromAffine(a){return new Xt(go.fromAffine(a))}assertSame(a){if(!(a instanceof Xt))throw new Error("RistrettoPoint expected")}init(a){return new Xt(a)}static fromBytes(a){la(a,32);const{a:o,d:i}=n1,l=To,u=N=>yr.create(N),f=g6(a);if(!WO(yr.toBytes(f),a)||vr(f,l))throw new Error("invalid ristretto255 encoding 1");const m=u(f*f),g=u(Fs+o*m),p=u(Fs-o*m),y=u(g*g),v=u(p*p),k=u(o*i*y-v),{isValid:S,value:T}=Nb(u(k*v)),w=u(T*p),E=u(T*w*k);let C=u((f+f)*w);vr(C,l)&&(C=u(-C));const j=u(g*E),_=u(C*j);if(!S||vr(_,l)||j===l6)throw new Error("invalid ristretto255 encoding 2");return new Xt(new go(C,j,Fs,_))}static fromHex(a){return Xt.fromBytes(Gm(a))}toBytes(){let{X:a,Y:o,Z:i,T:l}=this.ep;const u=To,f=E=>yr.create(E),m=f(f(i+o)*f(i-o)),g=f(a*o),p=f(g*g),{value:y}=Nb(f(m*p)),v=f(y*m),k=f(y*g),S=f(v*k*l);let T;if(vr(l*S,u)){let E=f(o*Tb),C=f(a*Tb);a=E,o=C,T=f(v*p6)}else T=k;vr(a*S,u)&&(o=f(-o));let w=f((i-o)*T);return vr(w,u)&&(w=f(-w)),yr.toBytes(w)}equals(a){this.assertSame(a);const{X:o,Y:i}=this.ep,{X:l,Y:u}=a.ep,f=p=>yr.create(p),m=f(o*u)===f(i*l),g=f(i*u)===f(o*l);return m||g}is0(){return this.equals(Xt.ZERO)}}Object.freeze(Xt.BASE);Object.freeze(Xt.ZERO);Object.freeze(Xt.prototype);Object.freeze(Xt);class jb{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(a,o){if($m(a),la(o,void 0,"key"),this.iHash=a.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,l=new Uint8Array(i);l.set(o.length>i?a.create().update(o).digest():o);for(let u=0;u<l.length;u++)l[u]^=54;this.iHash.update(l),this.oHash=a.create();for(let u=0;u<l.length;u++)l[u]^=106;this.oHash.update(l),Xs(l)}update(a){return oc(this),this.iHash.update(a),this}digestInto(a){oc(this),Hx(a,this),this.finished=!0;const o=a.subarray(0,this.outputLen);this.iHash.digestInto(o),this.oHash.update(o),this.oHash.digestInto(o),this.destroy()}digest(){const a=new Uint8Array(this.oHash.outputLen);return this.digestInto(a),a}_cloneInto(a){a||=Object.create(Object.getPrototypeOf(this),{});const{oHash:o,iHash:i,finished:l,destroyed:u,blockLen:f,outputLen:m}=this;return a=a,a.finished=l,a.destroyed=u,a.blockLen=f,a.outputLen=m,a.oHash=o._cloneInto(a.oHash),a.iHash=i._cloneInto(a.iHash),a}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const o1=(()=>{const t=((a,o,i)=>new jb(a,o).update(i).digest());return t.create=(a,o)=>new jb(a,o),t})();function v6(t,a,o){return $m(t),o===void 0&&(o=new Uint8Array(t.outputLen)),o1(t,o,a)}const Hf=Uint8Array.of(0),Ab=Uint8Array.of();function y6(t,a,o,i=32){$m(t),Co(i,"length"),la(a,void 0,"prk");const l=t.outputLen;if(a.length<l)throw new Error('"prk" must be at least HashLen octets');if(i>255*l)throw new Error("Length must be <= 255*HashLen");const u=Math.ceil(i/l);o===void 0?o=Ab:la(o,void 0,"info");const f=new Uint8Array(u*l),m=o1.create(t,a),g=m._cloneInto(),p=new Uint8Array(m.outputLen);for(let y=0;y<u;y++)Hf[0]=y+1,g.update(y===0?Ab:p).update(o).update(Hf).digestInto(p),f.set(p,l*y),m._cloneInto(g);return m.destroy(),g.destroy(),Xs(p,Hf),f.slice(0,i)}const Js=(t,a,o,i,l)=>y6(t,v6(t,a,o),i,l),xn=2,_b=32,b6=32,Ia=32,w6=24,mm=32,s1=32,x6=6,pm=32,i1="hive/remote/v1/pair",k6="hive/remote/v1/key/daemon->device",S6="hive/remote/v1/key/device->daemon",E6="hive/remote/v1/sas",C6="hive/remote/v1/transcript",T6="hive/remote/v2/conn/daemon->device",N6="hive/remote/v2/conn/device->daemon",j6="hive/remote/v2/conn-salt",A6=1,_6=2,R6=4,O6=8,l1=12,D6=new TextEncoder;function Qt(t){return D6.encode(t)}function Ln(...t){let a=0;for(const l of t)a+=l.length;const o=new Uint8Array(a);let i=0;for(const l of t)o.set(l,i),i+=l.length;return o}function _c(t){if(!Number.isInteger(t)||t<0||t>4294967295)throw new RangeError(`u32be out of range: ${t}`);const a=new Uint8Array(4);return new DataView(a.buffer).setUint32(0,t),a}function Jm(t,a=0){if(t.length<a+4)throw new RangeError("u32beRead: buffer too short");return new DataView(t.buffer,t.byteOffset,t.byteLength).getUint32(a)}function M6(t){if(!Number.isSafeInteger(t)||t<0)throw new RangeError(`u64be out of range: ${t}`);const a=new Uint8Array(8),o=Math.floor(t/4294967296),i=t>>>0,l=new DataView(a.buffer);return l.setUint32(0,o),l.setUint32(4,i),a}function cc(t){if(t.length>65535)throw new RangeError("lp: value too long for u16 length prefix");const a=new Uint8Array(2+t.length);return new DataView(a.buffer).setUint16(0,t.length),a.set(t,2),a}function mn(t,a,o){if(t.length!==a)throw new RangeError(`${o} must be ${a} bytes, got ${t.length}`)}const wn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",L6=(()=>{const t=new Int16Array(128).fill(-1);for(let a=0;a<wn.length;a++)t[wn.charCodeAt(a)]=a;return t})();function wr(t){let a="",o=0;for(;o+3<=t.length;o+=3){const l=t[o],u=t[o+1],f=t[o+2];a+=wn[l>>2],a+=wn[(l&3)<<4|u>>4],a+=wn[(u&15)<<2|f>>6],a+=wn[f&63]}const i=t.length-o;if(i===1){const l=t[o];a+=wn[l>>2],a+=wn[(l&3)<<4]}else if(i===2){const l=t[o],u=t[o+1];a+=wn[l>>2],a+=wn[(l&3)<<4|u>>4],a+=wn[(u&15)<<2]}return a}function ei(t){if(t.length%4===1)throw new RangeError("invalid base64url");const a=t.length>>2,o=t.length&3,i=a*3+(o===0?0:o-1),l=new Uint8Array(i),u=g=>{if(g>=128)throw new RangeError("invalid base64url");const p=L6[g];if(p<0)throw new RangeError("invalid base64url");return p};let f=0,m=0;for(;m+4<=t.length;m+=4){const g=u(t.charCodeAt(m)),p=u(t.charCodeAt(m+1)),y=u(t.charCodeAt(m+2)),v=u(t.charCodeAt(m+3));l[f++]=g<<2|p>>4,l[f++]=(p&15)<<4|y>>2,l[f++]=(y&3)<<6|v}if(o===2){const g=u(t.charCodeAt(m)),p=u(t.charCodeAt(m+1));l[f++]=g<<2|p>>4}else if(o===3){const g=u(t.charCodeAt(m)),p=u(t.charCodeAt(m+1)),y=u(t.charCodeAt(m+2));l[f++]=g<<2|p>>4,l[f++]=(p&15)<<4|y>>2}return l}function z6(t){return JSON.stringify(t)}function H6(t){let a;try{a=JSON.parse(t)}catch{throw new RangeError("invalid pairing payload: not JSON")}if(typeof a!="object"||a===null)throw new RangeError("invalid pairing payload: not an object");const o=a;if(o.v!==xn)throw new RangeError(`unsupported pairing version: ${String(o.v)}`);if(typeof o.gatewayUrl!="string"||o.gatewayUrl.length===0)throw new RangeError("invalid pairing payload: gatewayUrl");if(typeof o.daemonId!="string"||o.daemonId.length===0)throw new RangeError("invalid pairing payload: daemonId");if(typeof o.pairingSecret!="string")throw new RangeError("invalid pairing payload: pairingSecret");if(ei(o.pairingSecret).length!==mm)throw new RangeError(`pairingSecret must be ${mm} bytes`);return{v:o.v,gatewayUrl:o.gatewayUrl,daemonId:o.daemonId,pairingSecret:o.pairingSecret}}function B6(){const t=fm.utils.randomSecretKey(),a=fm.getPublicKey(t);return{secretKey:t,publicKey:a}}function U6(t){return{secretKey:wr(t.secretKey),publicKey:wr(t.publicKey)}}function W6(){return Mx(s1)}function I6(t){mn(t.pairingSecret,mm,"pairingSecret"),mn(t.sessionSalt,s1,"sessionSalt"),mn(t.daemonPublicKey,_b,"daemonPublicKey"),mn(t.devicePublicKey,_b,"devicePublicKey");const a=fm.getSharedSecret(t.localSecretKey,t.peerPublicKey);mn(a,b6,"sharedSecret");const o=Ln(t.pairingSecret,a),i=Ln(Qt(C6),Uint8Array.of(0),_c(t.ids.protocolVersion),cc(Qt(t.ids.daemonId)),cc(Qt(t.ids.deviceId)),t.daemonPublicKey,t.devicePublicKey,t.sessionSalt),l=wo(i),u=Ln(Qt(i1),t.sessionSalt),f=Js(wo,o,u,Ln(Qt(k6),Uint8Array.of(0),l),Ia),m=Js(wo,o,u,Ln(Qt(S6),Uint8Array.of(0),l),Ia),g=K6(l,t.ids);return{d2p:f,p2d:m,sas:g,transcriptHash:l}}function q6(t){return I6({localSecretKey:t.deviceSecretKey,peerPublicKey:t.daemonPublicKey,daemonPublicKey:t.daemonPublicKey,devicePublicKey:t.devicePublicKey,pairingSecret:t.pairingSecret,sessionSalt:t.sessionSalt,ids:t.ids})}function P6(){return Mx(pm)}function F6(t){mn(t.rootD2p,Ia,"rootD2p"),mn(t.rootP2d,Ia,"rootP2d"),mn(t.phoneConnSalt,pm,"phoneConnSalt"),mn(t.daemonConnSalt,pm,"daemonConnSalt");const a=Ln(Qt(j6),t.phoneConnSalt,t.daemonConnSalt),o=Ln(Uint8Array.of(0),_c(t.ids.protocolVersion),cc(Qt(t.ids.daemonId)),cc(Qt(t.ids.deviceId)),t.phoneConnSalt,t.daemonConnSalt),i=Js(wo,t.rootD2p,a,Ln(Qt(T6),o),Ia),l=Js(wo,t.rootP2d,a,Ln(Qt(N6),o),Ia);return{d2p:i,p2d:l}}function K6(t,a){mn(t,32,"transcriptHash");const o=Js(wo,t,Qt(i1),Ln(Qt(E6),Uint8Array.of(0),_c(a.protocolVersion)),4);return(Jm(o)%1e6).toString().padStart(x6,"0")}function c1(t,a,o){if(!Number.isInteger(a)||a<0||a>4294967295)throw new RangeError(`streamId out of range: ${a}`);const i=new Uint8Array(w6);return i[0]=t==="d2p"?A6:_6,i.set(_c(a),1),i.set(M6(o),8),i}function u1(t){if(t.length<l1)throw new RangeError("headerBytes too short");return Jm(t,R6)}function Rc(t){if(t.length<l1)throw new RangeError("headerBytes too short");return Jm(t,O6)}function Y6(t){mn(t.key,Ia,"key");const a=u1(t.headerBytes),o=Rc(t.headerBytes),i=c1(t.direction,a,o);return zx(t.key,i,t.headerBytes).encrypt(t.payload)}function $6(t){mn(t.key,Ia,"key");const a=u1(t.headerBytes),o=Rc(t.headerBytes),i=c1(t.direction,a,o);return zx(t.key,i,t.headerBytes).decrypt(t.ciphertext)}function V6(t){return{direction:t,nextSeq:0}}function G6(t){return{direction:t,lastSeq:-1}}function X6(t,a){const o=Rc(a.headerBytes);if(o!==t.nextSeq)throw new RangeError(`header seq ${o} does not match sealer.nextSeq ${t.nextSeq}`);const i=Y6({key:a.key,direction:t.direction,headerBytes:a.headerBytes,payload:a.payload}),l=t.nextSeq;return t.nextSeq+=1,{seq:l,ciphertext:i}}function Z6(t,a){if(a.seq!==t.lastSeq+1)throw new RangeError("out-of-order or replayed frame");if(Rc(a.headerBytes)!==a.seq)throw new RangeError("out-of-order or replayed frame");const i=$6({key:a.key,direction:t.direction,headerBytes:a.headerBytes,ciphertext:a.ciphertext});return t.lastSeq=a.seq,i}const Q6=(t,a)=>{const o=new URL(t);if(o.protocol==="https:"?o.protocol="wss:":o.protocol==="http:"&&(o.protocol="ws:"),o.protocol!=="wss:"&&o.protocol!=="ws:")throw new Error(`unsupported pairing gateway protocol: ${o.protocol}`);return`${o.toString().replace(/\/+$/,"")}/relay/pair?daemonId=${encodeURIComponent(a)}`},J6=t=>typeof t=="object"&&t!==null&&typeof t.t=="string",eD=2e4,tD=1e4;function nD(t,a,o){const i=o.generateKeyPair??B6,l=o.generateSalt??W6,u=o.heartbeatMs??eD,f=o.heartbeatDeadlineMs??tD;let m="idle",g=null,p=null,y=null,v=!1,k=null,S=null,T=null,w=null,E=null,C=null,j="",_="",N=null;const O=Z=>{m=Z,a.onPhase(Z)},M=()=>{S!==null&&(clearTimeout(S),S=null)},L=()=>{k!==null&&(clearInterval(k),k=null),M()},U=Z=>{L(),k=setInterval(()=>{if(!v){try{Z.send(Rx)}catch{}S===null&&(S=setTimeout(()=>{if(S=null,!v){try{Z.close()}catch{}$()}},f))}},u)},q=()=>{T?.secretKey.fill(0),w?.fill(0),E&&(E.d2p.fill(0),E.p2d.fill(0),E.transcriptHash.fill(0)),T=null,w=null,E=null},ae=Z=>{if(!v){v=!0,L(),q();try{y?.close()}catch{}y=null,N?.(Z)}},ee=(Z,R)=>{if(v)return;const B={code:Z,message:R};O(Z==="rejected"?"rejected":Z==="expired"?"expired":"error"),a.onFailure(B),ae({ok:!1,failure:B})},F=Z=>{if(m!=="connecting"&&m!=="handshaking")return;if(Z.protocolVersion!==xn){ee("protocol_version",`unsupported pairing protocol version ${Z.protocolVersion}`);return}if(!T||!w){ee("pair_ack_invalid","pair-ack arrived before the phone keypair was ready");return}let R;try{R=ei(Z.daemonPublicKey)}catch{ee("pair_ack_invalid","pair-ack daemonPublicKey is not valid base64url");return}const B={daemonId:Z.daemonId,deviceId:Z.deviceId,protocolVersion:Z.protocolVersion};try{E=q6({deviceSecretKey:T.secretKey,daemonPublicKey:R,devicePublicKey:T.publicKey,pairingSecret:I,sessionSalt:w,ids:B})}catch(re){ee("pair_ack_invalid",`handshake derivation failed: ${re.message}`);return}p=Z.deviceId,_=Z.daemonId,C=Z.daemonPublicKey,g=E.sas,O("awaiting_confirm"),a.onSas(g)},J=()=>{if(!v){if(!E||!T||!p){ee("pair_ack_invalid","cannot mint before the handshake produced a session");return}O("minting"),o.mintSession(j,{daemonId:_,deviceId:p}).then(()=>{if(v||!T||!C||!p||!E)return;const Z={v:2,gatewayUrl:j,daemonId:_,deviceId:p,deviceKeyPair:U6(T),daemonPublicKey:C,rootKeys:{d2p:wr(E.d2p),p2d:wr(E.p2d)},protocolVersion:xn,pairedAt:(o.now??Date.now)()};o.store.save(Z);const R=p;O("paired"),ae({ok:!0,deviceId:R})}).catch(Z=>{Z.status===403?ee("mint_forbidden","gateway refused to mint a device session (not confirmed)"):ee("mint_failed",`device session mint failed: ${Z.message??"unknown"}`)})}},X=Z=>{if(m==="awaiting_confirm"){if(!E||!T||!p||Z.deviceId!==p){ee("pair_ack_invalid","confirmed for an unexpected device");return}J()}},$=()=>{if(!v){if(m==="awaiting_confirm"){J();return}m!=="minting"&&ee("socket_closed","pairing socket closed before the device was paired")}},D=Z=>{if(v||typeof Z!="string")return;if(Z===Ox){M();return}let R;try{R=JSON.parse(Z)}catch{return}if(J6(R))switch(m==="connecting"&&R.t==="pair-ack"&&O("handshaking"),R.t){case"pair-ack":F(R);break;case"confirmed":X(R);break;case"rejected":{const B=R.reason;B==="expired"||B==="pairing_expired"?ee("expired","pairing code expired; generate a new pairing code"):ee("rejected",B??"pairing rejected at the desktop")}break}},P=H6(t),I=ei(P.pairingSecret);return j=P.gatewayUrl,_=P.daemonId,{get phase(){return m},get sas(){return g},get deviceId(){return p},start:()=>v?Promise.resolve({ok:!1,failure:{code:"cancelled",message:"already settled"}}):new Promise(Z=>{N=Z,T=i(),w=l(),O("connecting");const R=Q6(P.gatewayUrl,P.daemonId);try{y=o.openSocket(R)}catch(B){ee("socket_closed",`failed to open pairing socket: ${B.message}`);return}y.addEventListener("open",()=>{if(v||!y||!T||!w)return;U(y);const B={t:"hello",devicePublicKey:wr(T.publicKey),sessionSalt:wr(w),...o.proposedName?{proposedName:o.proposedName}:{},...o.boundJti?{boundJti:o.boundJti}:{}};y?.send(JSON.stringify(B))}),y.addEventListener("message",B=>{D(B.data)}),y.addEventListener("close",$),y.addEventListener("error",$)}),cancel:()=>{v||(O("rejected"),ee("cancelled","pairing cancelled"))},dispose:()=>{v?q():ae({ok:!1,failure:{code:"cancelled",message:"disposed"}})}}}const aD=t=>async(a,o)=>{const i=await t(`${a}/pair/session`,{method:"POST",credentials:"include",headers:{"content-type":"application/json"},body:JSON.stringify(o)});if(!i.ok)throw Object.assign(new Error(`mint failed: ${i.status}`),{status:i.status})};function rD(t){const a=t.fetchImpl??globalThis.fetch.bind(globalThis),o=t.gatewayBaseUrl??window.location.origin,i=t.redirect??(T=>window.location.assign(T)),l=t.createPairing??nD,u=t.mintSession??aD(a);let f=t.authProvider??"github",m="login",g=null;const p=T=>{m=T,t.onPhase?.(T)},y=T=>t.store.load(o,T),v=async T=>{T&&(f=T);const w=await a(`${o}/pair/machines`,{credentials:"include"});if(w.status===401){const j=encodeURIComponent(window.location.pathname+window.location.search);return p("login"),i(`${o}/auth/${f}?redirect=${j}`),{daemons:[],selfDeviceId:null}}if(!w.ok)throw new Error(`Failed to load machines: ${w.status}`);const E=await w.json(),C=E.daemons.map(j=>({id:j.id,name:j.name,lastSeen:j.lastSeen,revoked:j.revoked,online:j.online}));return p("machines"),{daemons:C,selfDeviceId:E.self.deviceId}},k=T=>{p("pairing");const E=l(T,{onPhase:C=>t.onPairingPhase?.(C),onSas:C=>t.onPairingSas?.(C),onFailure:C=>t.onPairingFailure?.(C)},{openSocket:(C,j)=>new WebSocket(C,j),store:t.store,mintSession:u,...t.proposedName?{proposedName:t.proposedName}:{},...t.boundJti?{boundJti:t.boundJti}:{}});return g=E,E.start()};return{get phase(){return m},get pairingClient(){return g},loadMachines:v,selectDaemon:async(T,w)=>{g=null;const E=y(T);if(E&&!w){const N=await t.connectTransport({daemonId:T,deviceId:E.deviceId,stored:E});return N.ok?(p("connected"),N):(!N.ok&&N.failure.code==="relay_revoked"&&t.store.clear(o,T),p("selecting"),N)}if(p("selecting"),!w)return{ok:!1,failure:{code:"needs_pairing",message:"this device is not paired with that computer — enter its pairing code first"}};const C=await k(w);if(!C.ok)return C;const j=y(T),_=await t.connectTransport({daemonId:T,deviceId:C.deviceId,stored:j});return _.ok?(p("connected"),_):(_.failure.code==="relay_revoked"&&t.store.clear(o,T),p("selecting"),_)}}}const d1="0123456789ABCDEFGHJKMNPQRSTVWXYZ",oD=12,sD="hive-remote-pairing-code-v1:",iD=t=>{const a=t.trim().toUpperCase().replace(/[\s-]+/g,"").replace(/O/g,"0").replace(/[IL]/g,"1");if(a.length!==oD)return null;for(const o of a)if(!d1.includes(o))return null;return a},lD=new TextEncoder,cD=t=>new URL(t).origin,uD=async t=>{const a=iD(t.code);if(!a)return null;const o=await crypto.subtle.digest("SHA-256",lD.encode(`${sD}${a}`));return z6({v:xn,gatewayUrl:cD(t.gatewayUrl),daemonId:t.daemonId,pairingSecret:wr(new Uint8Array(o))})},dD="hive.device-session.v2",fD="hive.device-session.v1",Bf=(t,a)=>`${dD}:${t}:${a}`,Rb=(t,a)=>`${fD}:${t}:${a}`,mD=t=>{if(typeof t!="object"||t===null)return!1;const a=t;if(a.v!==2||typeof a.gatewayUrl!="string"||typeof a.daemonId!="string"||typeof a.deviceId!="string"||typeof a.daemonPublicKey!="string"||typeof a.protocolVersion!="number"||typeof a.pairedAt!="number")return!1;const o=a.deviceKeyPair;if(typeof o!="object"||o===null)return!1;const i=o;if(typeof i.secretKey!="string"||typeof i.publicKey!="string")return!1;const l=a.rootKeys;if(typeof l!="object"||l===null)return!1;const u=l;return typeof u.d2p=="string"&&typeof u.p2d=="string"},pD=(t=globalThis.localStorage??null)=>({load:(a,o)=>{if(!t)return null;t.getItem(Rb(a,o))!==null&&t.removeItem(Rb(a,o));const i=t.getItem(Bf(a,o));if(i===null)return null;try{const l=JSON.parse(i);return mD(l)?l:null}catch{return null}},save:a=>{t&&t.setItem(Bf(a.gatewayUrl,a.daemonId),JSON.stringify(a))},clear:(a,o)=>{t&&t.removeItem(Bf(a,o))}}),f1=()=>{const t=window.location.hostname;return!(t==="127.0.0.1"||t==="localhost"||t==="[::1]"||t==="::1")},m1=t=>{switch(t){case"rejected":case"cancelled":return"pairing.failed.rejected";case"expired":return"pairing.failed.expired";case"mint_forbidden":return"pairing.failed.mintForbidden";case"protocol_version":return"pairing.failed.version";case"socket_closed":case"pair_ack_invalid":case"mint_failed":return"pairing.failed.socket";default:return null}},hD=(t,a)=>{const o=m1(a);if(o)return o;switch(t){case"connecting":return"pairing.connecting";case"handshaking":case"minting":return"pairing.handshaking";case"awaiting_confirm":return null;case"paired":return"pairing.paired";case"rejected":return"pairing.failed.rejected";case"expired":return"pairing.failed.expired";case"error":return"pairing.failed.socket";default:return null}},gD=t=>t==="select_failed"?"connect.error.selectFailed":t==="invalid_code"?"connect.error.invalidCode":t==="relay_revoked"?"connect.machines.revokedHint":null,vD=t=>{const a=Math.floor((Date.now()-t)/1e3);if(a<60)return null;const o=Math.floor(a/60);if(o<60)return`${o}m`;const i=Math.floor(o/60);return i<24?`${i}h`:`${Math.floor(i/24)}d`},yD={O:"0",I:"1",L:"1"},bD=t=>{const a=t.toUpperCase();let o="";for(const l of a){const u=yD[l]??l;if(d1.includes(u)&&(o+=u,o.length===12))break}const i=[];for(let l=0;l<o.length;l+=4)i.push(o.slice(l,l+4));return i.join("-")},wD=t=>t==="minting"||t==="paired",Ml=({children:t,className:a="",testId:o})=>c.jsx("div",{"data-testid":o,className:`connect-screen flex min-h-full flex-col p-6 ${a}`,children:t}),zs=({primary:t,children:a,disabled:o,onClick:i,testId:l,type:u="button"})=>c.jsx("button",{type:u,"data-testid":l,disabled:o,onClick:i,className:"flex w-full items-center justify-center rounded-lg px-4 text-sm font-semibold transition-colors",style:{minHeight:"44px",background:t?"var(--accent)":"var(--bg-2)",color:t?"#ffffff":"var(--text-secondary)",border:`1px solid ${t?"var(--accent)":"var(--border-bright)"}`,opacity:o?.4:1,cursor:o?"not-allowed":"pointer"},children:a}),xD=({flow:t,phase:a,machines:o,selectedMachineId:i,pairingPhase:l,pairingFailureCode:u,connectError:f,sas:m,isSigningIn:g=!1,pendingMachineId:p,loginError:y=!1,isGatewayBundle:v=!1,onRefreshMachines:k,onSelectProvider:S,onSelectMachine:T,onSubmitCode:w,onCancelPairing:E,onGoBack:C})=>{const{t:j}=we(),[_,N]=b.useState(""),O=b.useRef(!1),M=hD(l,u),L=gD(f),U=m1(u)!=null,q=wD(l),ae=m!=null&&m.length>0&&(l==="awaiting_confirm"||q),ee=$=>{const D=bD($);N(D),D.replace(/-/g,"").length===12&&i&&!O.current&&(O.current=!0,w(i,D.trim()))},F=_.replace(/-/g,"").length===12,J=!!i&&F,X=v?"/brand/icon-192.png":"/logo.png";if(a==="login")return c.jsxs(Ml,{testId:"connect-login",className:"justify-center gap-6",children:[c.jsxs("div",{className:"mb-2 flex flex-col items-center gap-3 text-center",children:[c.jsx("img",{src:X,width:72,height:72,alt:"",style:{filter:"drop-shadow(0 8px 28px rgba(51,88,212,.38))"}}),c.jsx("span",{className:"text-2xl font-bold tracking-tight",style:{color:"var(--text-primary)"},children:"Hive"})]}),c.jsxs("div",{className:"text-center",children:[c.jsx("h1",{className:"text-xl font-semibold text-pri",children:j("connect.login.heading")}),c.jsx("p",{className:"mt-2 text-sm text-ter",children:j("connect.login.subtitle")})]}),y?c.jsx("p",{"data-testid":"connect-login-error",className:"rounded-lg px-3 py-2 text-center text-sm",style:{background:"color-mix(in oklab, var(--status-red) 12%, transparent)",color:"var(--status-red)"},children:j("connect.login.failed")}):null,c.jsx("div",{className:"flex flex-col gap-3",children:g?c.jsx("div",{className:"flex items-center justify-center text-sm text-ter",style:{minHeight:"44px"},children:j("connect.login.signingIn")}):c.jsxs(c.Fragment,{children:[c.jsx(zs,{primary:!0,testId:"connect-login-github",onClick:()=>S("github"),children:j("connect.login.github")}),c.jsx(zs,{testId:"connect-login-google",onClick:()=>S("google"),children:j("connect.login.google")})]})})]});if(a==="machines"){const $=p!=null;return c.jsxs(Ml,{testId:"connect-machines",className:"gap-4",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("img",{src:X,width:20,height:20,alt:"",className:"shrink-0"}),c.jsx("span",{className:"text-sm font-semibold text-sec",children:"Hive"})]}),c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("h1",{className:"text-xl font-semibold text-pri",children:j("connect.machines.heading")}),k?c.jsx("button",{type:"button","aria-label":j("common.refresh"),"data-testid":"connect-machines-refresh",onClick:k,className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-md text-sec",style:{background:"var(--bg-2)",border:"1px solid var(--border-bright)"},children:c.jsx(km,{size:16,"aria-hidden":!0})}):null]}),L?c.jsx("p",{"data-testid":"connect-error",className:"rounded-lg px-3 py-2 text-sm",style:{background:"color-mix(in oklab, var(--status-red) 12%, transparent)",color:"var(--status-red)"},children:j(L)}):null,o.length===0?c.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-4 px-4 text-center",children:[c.jsx("span",{className:"flex h-16 w-16 items-center justify-center rounded-2xl",style:{background:"color-mix(in oklab, var(--accent) 12%, transparent)",color:"var(--accent-hover, var(--accent))"},"aria-hidden":!0,children:c.jsx(Jd,{size:28})}),c.jsx("p",{"data-testid":"connect-machines-empty",className:"max-w-[280px] text-sm text-ter",children:j("connect.machines.empty")}),c.jsx("div",{className:"flex w-full max-w-[320px] flex-col gap-3 pt-2",children:c.jsx(zs,{testId:"connect-machines-back",...C?{onClick:C}:{},children:j("connect.machines.back")})})]}):c.jsx("ul",{className:"flex flex-col gap-2.5",children:o.map(D=>{const P=p===D.id,I=!D.online||D.revoked||$;let V,Z="var(--text-tertiary)";if(D.revoked)V=j("connect.machines.revoked"),Z="var(--status-red)";else if(D.online)P?(V=j("connect.machines.connecting"),Z="var(--text-secondary)"):(V=j("connect.machines.online"),Z="var(--status-green)");else{const B=D.lastSeen!=null?vD(D.lastSeen):null;V=B!=null?j("connect.machines.lastSeen",{ago:B}):j("connect.machines.offline")}const R=D.revoked?"var(--status-red)":D.online?"var(--status-green)":"var(--text-tertiary)";return c.jsx("li",{children:c.jsxs("button",{type:"button","data-testid":`connect-machine-${D.id}`,className:"flex w-full items-center gap-3 rounded-xl border px-3.5 py-3 text-left transition-colors",style:{minHeight:"64px",borderColor:"var(--border-bright)",background:P?"var(--bg-2)":"var(--bg-1)",opacity:I&&!P?.55:1,cursor:I?"not-allowed":"pointer"},disabled:I,"aria-disabled":I,onClick:()=>T(D.id),children:[c.jsxs("span",{className:"relative shrink-0","aria-hidden":!0,children:[c.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-lg",style:{background:"color-mix(in oklab, var(--accent) 12%, transparent)",color:"var(--accent-hover, var(--accent))"},children:c.jsx(Jd,{size:20})}),c.jsx("span",{className:"absolute -right-0.5 -bottom-0.5 h-3 w-3 rounded-full border-2",style:{background:R,borderColor:"var(--bg-1)"}})]}),c.jsxs("span",{className:"min-w-0 flex-1",children:[c.jsx("span",{className:"block truncate text-[15px] font-medium text-pri",children:D.name}),c.jsx("span",{className:"mt-0.5 block text-xs",style:{color:Z},children:V})]}),P?c.jsx("span",{"aria-hidden":!0,className:"h-4 w-4 shrink-0 animate-spin rounded-full border-2",style:{borderColor:"var(--border-bright)",borderTopColor:"var(--accent)"}}):I?null:c.jsx(mc,{size:18,className:"shrink-0 text-ter","aria-hidden":!0})]})},D.id)})}),v?c.jsx("div",{className:"mt-auto pt-4 text-center",children:c.jsx("a",{href:"/machines",className:"text-xs underline-offset-2 hover:underline",style:{color:"var(--text-tertiary)"},children:j("connect.machines.manageDevices")})}):null]})}if(a==="selecting"){const $=o.find(D=>D.id===i);return c.jsxs(Ml,{testId:"connect-pair-guide",className:"gap-4",children:[c.jsxs("button",{type:"button",className:"-ml-2 flex items-center gap-1 self-start rounded-md px-2 text-sm text-sec",style:{minHeight:"44px"},onClick:C,children:[c.jsx(bS,{size:16,"aria-hidden":!0}),j("connect.pair.back")]}),c.jsxs("div",{children:[c.jsx("h1",{className:"text-xl font-semibold text-pri",children:j("connect.pair.guideHeading")}),$?c.jsxs("p",{className:"mt-1 flex items-center gap-1.5 text-sm text-ter",children:[c.jsx(Jd,{size:14,"aria-hidden":!0,className:"shrink-0"}),c.jsx("span",{className:"truncate",children:$.name})]}):null]}),L?c.jsx("p",{"data-testid":"connect-error",className:"rounded-lg px-3 py-2 text-sm",style:{background:"color-mix(in oklab, var(--status-red) 12%, transparent)",color:"var(--status-red)"},children:j(L)}):null,c.jsx("ol",{className:"flex flex-col gap-3",children:["connect.pair.guideStep1","connect.pair.guideStep2","connect.pair.guideStep3"].map((D,P)=>c.jsxs("li",{className:"flex items-start gap-3 text-sm text-sec",children:[c.jsx("span",{"aria-hidden":!0,className:"mt-px flex h-[22px] w-[22px] shrink-0 items-center justify-center rounded-lg text-xs font-semibold",style:{background:"color-mix(in oklab, var(--accent) 13%, transparent)",border:"1px solid color-mix(in oklab, var(--accent) 34%, transparent)",color:"var(--accent-hover)"},children:P+1}),c.jsx("span",{className:"min-w-0 leading-relaxed",children:j(D)})]},D))}),c.jsxs("label",{className:"flex flex-col gap-2 text-xs uppercase tracking-wider text-ter",children:[j("connect.pair.qrLabel"),c.jsx("input",{type:"text","data-testid":"connect-code-input",className:"input mono text-center",inputMode:"text",autoCapitalize:"characters",autoCorrect:"off",autoComplete:"off",spellCheck:!1,placeholder:"XXXX-XXXX-XXXX",maxLength:14,value:_,onChange:D=>{O.current=!1,ee(D.target.value)},style:{fontSize:"18px",letterSpacing:"0.12em",minHeight:"52px"}})]}),c.jsx(zs,{primary:!0,testId:"connect-code-submit",disabled:!J,onClick:()=>{i&&!O.current&&(O.current=!0,w(i,_.trim()))},children:j("connect.pair.submit")})]})}if(a==="pairing"){const $=U;return c.jsxs(Ml,{testId:"connect-pairing",className:"justify-center gap-6",children:[ae&&!$?c.jsxs("div",{className:"flex flex-col items-center gap-4",children:[c.jsx("div",{"data-testid":"connect-pairing-sas",className:"mono rounded-2xl border px-7 py-5 font-bold text-pri","aria-live":"polite",style:{fontSize:"2.5rem",letterSpacing:"0.25em",paddingRight:"calc(1.75rem - 0.25em)",background:"var(--bg-1)",borderColor:"var(--border-bright)"},children:m}),c.jsx("p",{className:"text-center text-sm text-ter",style:{maxWidth:"280px"},children:j(q?"connect.pair.finalizing":"connect.pair.sasInstruction")}),q?c.jsx("span",{"aria-hidden":!0,className:"h-5 w-5 animate-spin rounded-full border-2",style:{borderColor:"var(--border-bright)",borderTopColor:"var(--accent)"}}):null]}):null,M&&!ae&&!$?c.jsx("p",{"data-testid":"connect-pairing-phase",className:"text-center text-sm text-ter",children:j(M)}):null,$&&M?c.jsx("p",{"data-testid":"connect-pairing-phase",className:"text-center text-sm",style:{color:"var(--status-red)"},children:j(M)}):null,q?null:c.jsx("div",{className:"flex flex-col gap-3",children:c.jsx(zs,{primary:$,testId:"connect-pairing-cancel",onClick:()=>{N(""),O.current=!1,E?E():t.pairingClient?.cancel()},children:j($?"connect.pair.startOver":"common.cancel")})})]})}return null},kD=()=>{if(typeof navigator>"u")return"Phone";const t=navigator.userAgent??"";let a="Phone";/iPad/.test(t)?a="iPad":/iPhone/.test(t)?a="iPhone":/Android/.test(t)&&(a="Android");let o="Browser";return/EdgA?\//.test(t)?o="Edge":/SamsungBrowser\//.test(t)?o="Samsung":/OPR\/|OPT\//.test(t)?o="Opera":/Firefox\//.test(t)?o="Firefox":/Chrome\//.test(t)?o="Chrome":/Safari\//.test(t)&&(o="Safari"),`${a} · ${o}`.slice(0,48)},SD=({children:t,connectTransport:a,createFlow:o=rD,store:i,gatewayBaseUrl:l,isGateway:u=f1})=>{const f=u(),[m,g]=b.useState("login"),[p,y]=b.useState([]),[v,k]=b.useState(null),[S,T]=b.useState(void 0),[w,E]=b.useState(null),[C,j]=b.useState(null),[_,N]=b.useState(null),[O,M]=b.useState(null),[L,U]=b.useState(!1),[q,ae]=b.useState(null),[ee,F]=b.useState(!1),[J,X]=b.useState(!0),$=b.useMemo(()=>o({store:i??pD(),connectTransport:a,...l?{gatewayBaseUrl:l}:{},proposedName:kD(),onPhase:g,onPairingPhase:ue=>{E(ue),ue!=="error"&&ue!=="expired"&&ue!=="rejected"&&j(null)},onPairingSas:M,onPairingFailure:ue=>j(ue.code)}),[o,i,a,l]),D=b.useRef($);D.current=$;const P=b.useRef(0),I=b.useCallback(()=>{E(null),j(null),M(null)},[]),V=b.useCallback(()=>(P.current+=1,P.current),[]),Z=b.useCallback(ue=>P.current===ue,[]);b.useEffect(()=>{let ue=!1;return D.current.loadMachines().then(({daemons:ie,selfDeviceId:le})=>{ue||(y(ie),k(le))}).catch(()=>{}).finally(()=>{ue||X(!1)}),()=>{ue=!0}},[]);const R=b.useCallback(()=>{const ue=V();N(null),I(),U(!0),D.current.loadMachines().then(({daemons:ie,selfDeviceId:le})=>{Z(ue)&&(y(ie),k(le))}).finally(()=>{Z(ue)&&U(!1)})},[I,Z,V]),B=b.useCallback(ue=>{const ie=V();N(null),I(),F(!1),U(!0),D.current.loadMachines(ue).then(({daemons:le,selfDeviceId:ce})=>{Z(ie)&&(y(le),k(ce))}).catch(()=>{Z(ie)&&F(!0)}).finally(()=>{Z(ie)&&U(!1)})},[I,Z,V]),re=b.useCallback(ue=>{const ie=V();T(ue),N(null),I(),ae(ue),(async()=>{const le=await D.current.selectDaemon(ue);Z(ie)&&(ae(null),!le.ok&&le.failure.code==="select_failed"&&N("select_failed"),!le.ok&&le.failure.code==="relay_revoked"&&N("relay_revoked"))})()},[I,Z,V]),ne=b.useCallback((ue,ie)=>{const le=V();N(null),I(),(async()=>{const ce=await uD({code:ie,daemonId:ue,gatewayUrl:l??window.location.origin});if(!Z(le))return;if(!ce){N("invalid_code");return}const me=await D.current.selectDaemon(ue,ce);Z(le)&&(!me.ok&&me.failure.code==="select_failed"&&N("select_failed"),!me.ok&&me.failure.code==="relay_revoked"&&N("relay_revoked"))})()},[I,l,Z,V]),de=b.useCallback(()=>{V(),D.current.pairingClient?.cancel(),I(),N(null),g(S?"selecting":"machines")},[I,V,S]),fe=b.useCallback(()=>{V(),N(null),I(),g("machines")},[I,V]);return m==="connected"?(typeof history<"u"&&history.replaceState(null,"","/app"),c.jsx(c.Fragment,{children:t})):J?c.jsxs("div",{className:"connect-screen flex min-h-full flex-col items-center justify-center gap-3 p-6",children:[c.jsx("img",{src:f?"/brand/icon-192.png":"/logo.png",width:56,height:56,alt:"",className:"animate-pulse"}),c.jsx("span",{className:"sr-only","aria-live":"polite",children:"…"})]}):c.jsx(xD,{flow:$,phase:m,machines:p,selfDeviceId:v,...S?{selectedMachineId:S}:{},pairingPhase:w,pairingFailureCode:C,connectError:_,sas:O,isSigningIn:L,pendingMachineId:q,loginError:ee,isGatewayBundle:f,onRefreshMachines:R,onSelectProvider:B,onSelectMachine:re,onSubmitCode:ne,onCancelPairing:de,onGoBack:fe})},ED=(t,a,o)=>t.mode==="tunnel"?c.jsx(o,{connectTransport:t.connectTransport,children:c.jsx(a,{})}):c.jsx(a,{}),Ve={Open:1,Data:2,End:3,Reset:4,Ping:5,Ack:6},uc={Http:1,Ws:2},Ht={ProtocolError:1,VersionMismatch:4},Ob={INITIAL_WINDOW:256*1024,ACK_THRESHOLD:32*1024},dc=12,Db=0,hm=4294967295,p1=4294967295,CD=0,h1=1;class Bt extends Error{code;constructor(a,o){super(a),this.name="ProtocolError",this.code=o}}const TD=new TextEncoder,ND=new TextDecoder;function g1(t){return TD.encode(t)}function Oc(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function gm(t,a){if(!Number.isInteger(t)||t<0||t>p1)throw new RangeError(`${a} out of u32 range: ${t}`)}function v1(t){return t===Ve.Open||t===Ve.Data||t===Ve.End||t===Ve.Reset||t===Ve.Ping||t===Ve.Ack}function y1(t){return(t&-2)===0}function Mb(t){if(t.version!==xn)throw new RangeError(`version must be ${xn}`);if(!v1(t.kind))throw new RangeError(`unknown kind: ${t.kind}`);if(!Number.isInteger(t.flags)||t.flags<0||t.flags>65535)throw new RangeError(`flags out of u16 range: ${t.flags}`);if(t.kind===Ve.Data){if(!y1(t.flags))throw new RangeError("reserved flag bits set on Data frame")}else if(t.flags!==0)throw new RangeError("flags must be 0 on a non-Data frame");gm(t.streamId,"streamId"),gm(t.seq,"seq");const a=new Uint8Array(dc),o=Oc(a);return o.setUint8(0,t.version),o.setUint8(1,t.kind),o.setUint16(2,t.flags),o.setUint32(4,t.streamId),o.setUint32(8,t.seq),a}function jD(t){if(t.length<dc)throw new Bt("header too short",Ht.ProtocolError);const a=Oc(t),o=a.getUint8(0);if(o!==xn)throw new Bt(`bad version ${o}`,Ht.VersionMismatch);const i=a.getUint8(1);if(!v1(i))throw new Bt(`unknown kind ${i}`,Ht.ProtocolError);const l=a.getUint16(2);if(i===Ve.Data){if(!y1(l))throw new Bt("reserved flag bits set on Data frame",Ht.ProtocolError)}else if(l!==0)throw new Bt("flags must be 0 on a non-Data frame",Ht.ProtocolError);const u=a.getUint32(4),f=a.getUint32(8);return{version:o,kind:i,flags:l,streamId:u,seq:f}}function Lb(t){let a;if(t.transport===uc.Http){if(!t.http)throw new RangeError("http meta required for Http transport");a=t.http}else if(t.transport===uc.Ws){if(!t.ws)throw new RangeError("ws meta required for Ws transport");a=t.ws}else throw new RangeError(`unknown transport: ${t.transport}`);const o=g1(JSON.stringify(a));if(o.length>65535)throw new RangeError("open meta too large");const i=new Uint8Array(3+o.length);return i[0]=t.transport,Oc(i).setUint16(1,o.length),i.set(o,3),i}function AD(t){if(!Array.isArray(t))return!1;for(const a of t)if(!Array.isArray(a)||a.length!==2||typeof a[0]!="string"||typeof a[1]!="string")return!1;return!0}const Dc={ConnSalt:1,Hello:2},vm={daemon:1,device:2},_D=34;function RD(t){if(t.salt.length!==32)throw new RangeError(`conn salt must be 32 bytes, got ${t.salt.length}`);const a=new Uint8Array(34);return a[0]=Dc.ConnSalt,a[1]=vm.device,a.set(t.salt,2),a}function OD(t){if(t.length!==_D)throw new Bt("conn salt must be 34 bytes",Ht.ProtocolError);if(t[0]!==Dc.ConnSalt)throw new Bt("not a ConnSalt frame",Ht.ProtocolError);const a=t[1],o=a===vm.daemon?"daemon":a===vm.device?"device":null;if(o===null)throw new Bt("bad conn salt role",Ht.ProtocolError);return{role:o,salt:t.slice(2)}}function DD(t){return t.length>=1&&t[0]===Dc.ConnSalt}function MD(t){if(t.role!=="daemon"&&t.role!=="device")throw new RangeError(`bad role: ${t.role}`);const a=g1(JSON.stringify(t)),o=new Uint8Array(1+a.length);return o[0]=Dc.Hello,o.set(a,1),o}function LD(t){gm(t,"cumulativeBytes");const a=new Uint8Array(4);return Oc(a).setUint32(0,t),a}function zD(t,a){const o=new Uint8Array(1+t.length);return o[0]=a?1:0,o.set(t,1),o}function HD(t){if(t.length<1)throw new Bt("ws message too short",Ht.ProtocolError);const a=t[0];if(a!==0&&a!==1)throw new Bt("bad ws isText flag",Ht.ProtocolError);return{data:t.slice(1),isText:a===1}}function zb(t){const a=new Uint8Array(1+t.length);return a[0]=h1,a.set(t,1),a}function BD(t){if(t.length<1)throw new Bt("http data too short",Ht.ProtocolError);const a=t[0];if(a===CD){let o;try{o=JSON.parse(ND.decode(t.subarray(1)))}catch{throw new Bt("http head not JSON",Ht.ProtocolError)}const i=o;if(typeof i.status!="number"||!AD(i.headers))throw new Bt("bad http head",Ht.ProtocolError);return{kind:"head",head:{status:i.status,headers:i.headers}}}if(a===h1)return{kind:"body",data:t.slice(1)};throw new Bt(`unknown http disc ${a}`,Ht.ProtocolError)}function Hb(t){let a=1;return()=>{a===hm&&(a+=2);const o=a;if(a+=2,a>p1)throw new RangeError("stream id space exhausted; re-handshake required");return o}}const UD={ok:!0};function Bb(t=Ob.INITIAL_WINDOW,a=Ob.ACK_THRESHOLD){let o=0,i=0,l=0,u=0;const f=()=>o-i,m=()=>f()>=t;return{trySend(g){return f()+g>t?{ok:!1,reason:"WindowExhausted"}:(o+=g,UD)},applyAck(g){const p=m();return g<=i?{resumed:!1}:(i=Math.min(g,o),{resumed:p&&!m()})},onConsume(g){return l+=g,l-u>=a?(u=l,{ackCumulative:l}):null},flushAck(){return u=l,{ackCumulative:l}},isPaused:()=>m()}}const WD=1,Uf=256*1024,ym=new TextEncoder,ID=new TextDecoder,qD=t=>{let a=0;for(const l of t)a+=l.length;const o=new Uint8Array(a);let i=0;for(const l of t)o.set(l,i),i+=l.length;return o},PD=t=>{if(typeof t=="string")return{bytes:ym.encode(t),isText:!0};if(t instanceof Uint8Array)return{bytes:t,isText:!1};if(t instanceof ArrayBuffer)return{bytes:new Uint8Array(t),isText:!1};const a=t;return{bytes:new Uint8Array(a.buffer,a.byteOffset,a.byteLength),isText:!1}},FD=t=>{const a=t.generateConnSalt??P6;let o=null,i=null,l=null,u=null,f=null,m=Hb();const g=new Map,p=(_,N)=>{if(_.length!==N.length)return!1;for(let O=0;O<_.length;O++)if(_[O]!==N[O])return!1;return!0},y=(_,N,O,M=0)=>{if(!i||!o)throw new Error("frame-mux: seal before channel handshake complete");const L=Mb({version:xn,kind:_,flags:M,streamId:N,seq:i.nextSeq});t.onSeal?.({key:o.p2d,direction:"p2d",headerBytes:L});const{ciphertext:U}=X6(i,{key:o.p2d,headerBytes:L,payload:O}),q=new Uint8Array(L.length+U.length);return q.set(L,0),q.set(U,L.length),q},v=()=>{t.send(y(Ve.Data,Db,MD({protocolVersion:xn,role:"device",daemonId:t.daemonId,deviceId:t.deviceId})))},k=_=>{u&&(f&&p(f,_)||(o=F6({rootD2p:t.roots.d2p,rootP2d:t.roots.p2d,phoneConnSalt:u,daemonConnSalt:_,ids:{daemonId:t.daemonId,deviceId:t.deviceId,protocolVersion:xn}}),i=V6("p2d"),l=G6("d2p"),f=Uint8Array.from(_),v(),t.onReady?.()))},S=(_,N)=>{t.send(y(Ve.Ack,_,LD(N)))},T=(_,N)=>{if(!o)return Promise.reject(new Error("tunnel: channel not ready"));const O=m(),M=(N?.method??"GET").toUpperCase(),L=[];N?.headers&&new Headers(N.headers).forEach((ee,F)=>{L.push([F,ee])});const U=N?.body===void 0||N.body===null?void 0:KD(N.body),q=U!==void 0&&U.length>0;return new Promise((ae,ee)=>{const F={kind:"http",body:[],recvFlow:Bb(),resolve:ae,reject:ee,settled:!1};g.set(O,F),t.send(y(Ve.Open,O,Lb({transport:uc.Http,http:{method:M,path:_,headers:L,hasBody:q}}))),q&&U?U.length<=Uf?(t.send(y(Ve.Data,O,zb(U))),t.send(y(Ve.End,O,new Uint8Array(0)))):w(O,F,U):t.send(y(Ve.End,O,new Uint8Array(0)))})},w=async(_,N,O)=>{try{for(let M=0;M<O.length;M+=Uf){if(M>0&&t.awaitDrain&&await t.awaitDrain(),N.settled)return;t.send(y(Ve.Data,_,zb(O.subarray(M,M+Uf))))}if(N.settled)return;t.send(y(Ve.End,_,new Uint8Array(0)))}catch(M){if(N.settled)return;N.settled=!0,g.delete(_),N.reject(M)}},E=(_,N)=>{if(N.settled)return;N.settled=!0,g.delete(_);const O=N.head,M=qD(N.body);if(!O){N.reject(new Error("tunnel: stream ended without an HTTP head"));return}let L=null;if(M.length>0){const U=new ArrayBuffer(M.length);new Uint8Array(U).set(M),L=U}N.resolve(new Response(L,{status:O.status,headers:O.headers}))};class C{OPEN=1;readyState=0;onopen=null;onmessage=null;onclose=null;onerror=null;streamId;constructor(N){this.streamId=N}send(N){if(this.readyState!==this.OPEN)return;const{bytes:O,isText:M}=PD(N);t.send(y(Ve.Data,this.streamId,zD(O,M)))}close(N,O){if(this.readyState===3)return;const M=this.readyState===this.OPEN;this.readyState=3,M&&t.send(y(Ve.End,this.streamId,new Uint8Array(0))),g.delete(this.streamId)}_deliver(N,O){this.onmessage&&this.onmessage({data:O?ID.decode(N):N})}_remoteClose(N,O){this.readyState!==3&&(this.readyState=3,g.delete(this.streamId),this.onclose?.(O===void 0?{code:N}:{code:N,reason:O}))}}return{beginChannel(){u=a(),o=null,i=null,l=null,f=null,this.resetAll("rekey"),m=Hb();const _=Mb({version:xn,kind:Ve.Data,flags:0,streamId:hm,seq:0}),N=RD({salt:u}),O=new Uint8Array(_.length+N.length);O.set(_,0),O.set(N,_.length),t.send(O)},onFrame(_){const N=_.subarray(0,dc),O=_.subarray(dc),M=jD(N);if(M.streamId===hm&&DD(O)){const{role:q,salt:ae}=OD(O);q==="daemon"&&k(ae);return}if(!l||!o)return;const L=Z6(l,{key:o.d2p,headerBytes:N,ciphertext:O,seq:M.seq});if(M.streamId===Db)return;const U=g.get(M.streamId);if(U){if(U.kind==="http"){if(M.kind===Ve.Reset){U.settled||(U.settled=!0,g.delete(M.streamId),U.reject(new Error("tunnel: HTTP stream reset by daemon")));return}if(M.kind===Ve.Data){const q=BD(L);if(q.kind==="head")U.head=q.head;else{U.body.push(q.data);const ae=U.recvFlow.onConsume(q.data.length);ae&&S(M.streamId,ae.ackCumulative)}(M.flags&WD)!==0&&E(M.streamId,U);return}if(M.kind===Ve.End){E(M.streamId,U);return}return}if(M.kind===Ve.Data){const q=HD(L),ae=U.recvFlow.onConsume(q.data.length);ae&&S(M.streamId,ae.ackCumulative),U.socket._deliver(q.data,q.isText);return}if(M.kind===Ve.End||M.kind===Ve.Reset){U.socket._remoteClose(M.kind===Ve.Reset?1011:1e3);return}}},fetch:T,openWebSocket:(_,N)=>{if(!o){const U=new C(-1);return queueMicrotask(()=>U._remoteClose(1011,"tunnel: channel not ready")),U}const O=m(),M=[];if(N)for(const[U,q]of Object.entries(N))q!==void 0&&M.push([U,String(q)]);const L=new C(O);return g.set(O,{kind:"ws",recvFlow:Bb(),socket:L}),t.send(y(Ve.Open,O,Lb({transport:uc.Ws,ws:M.length>0?{path:_,query:M}:{path:_}}))),queueMicrotask(()=>{L.readyState===0&&(L.readyState=L.OPEN,L.onopen?.())}),L},resetAll(_){for(const[N,O]of[...g.entries()])g.delete(N),O.kind==="http"?O.settled||(O.settled=!0,O.reject(new Error(`tunnel: connection lost (${_})`))):O.socket._remoteClose(1006,_)}}},KD=t=>typeof t=="string"?ym.encode(t):t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):ym.encode(String(t)),YD=2e4,$D=1e4,VD=6,GD=()=>{let t=0;return{next(){t+=1;const a=Math.min(3e4,500*2**(t-1));return Math.floor(a/2+Math.random()*(a/2))},reset(){t=0}}},XD=(t,a)=>!a&&(t===xr.Forbidden||t===xr.Unauthorized),ZD=(t,a)=>{const o=t.WebSocketImpl??WebSocket,i=t.setTimer??((ee,F)=>setTimeout(ee,F)),l=t.clearTimer??(ee=>clearTimeout(ee)),u=t.backoff??GD(),f=t.heartbeatMs??YD,m=t.heartbeatDeadlineMs??$D,g=t.maxOfflineRetries??VD;let p=null,y=0,v=!1,k=!1,S=!1,T=0,w=null,E=null,C=null;const j=`${t.gatewayUrl}/relay?daemonId=${encodeURIComponent(t.daemonId)}`,_=()=>{C!==null&&(l(C),C=null)},N=()=>{E!==null&&(clearInterval(E),E=null),_()},O=(ee,F)=>{N(),E=setInterval(()=>{if(ee.readyState===ee.OPEN){try{ee.send(Rx)}catch{}C===null&&(C=i(()=>{if(C=null,!(F!==y||k)){N();try{ee.close()}catch{}}},m))}},f)},M=()=>{if(k||v||S)return;const ee=++y;let F=!1;const J=new o(j,[`bearer.${t.phoneSessionToken}`]);J.binaryType="arraybuffer",p=J,J.onopen=()=>{ee!==y||k||(F=!0,u.reset(),T=0,O(J,ee),a.onUp())},J.onmessage=X=>{if(ee!==y||k)return;const $=X.data;if(typeof $=="string"){if($.startsWith(ub)){let P;try{P=JSON.parse($.slice(ub.length))}catch{return}if(P.t==="revoked"){L(xr.Revoked),a.onControl(P);return}a.onControl(P);return}$===Ox&&_();return}const D=$ instanceof ArrayBuffer?new Uint8Array($):new Uint8Array($);a.onFrame(D)},J.onerror=()=>{},J.onclose=X=>{if(ee!==y||k)return;N(),p=null;const $=X.code??xr.InternalError;if(nO($)||XD($,F)){L($);return}if($===xr.DaemonOffline){if(T+=1,T>=g){S=!0,a.onDown({code:$,authFatal:!1,daemonOffline:!0});return}}else T=0;const D=u.next();a.onDown({code:$,authFatal:!1,nextRetryInMs:D}),w=i(()=>{w=null,M()},D)}},L=ee=>{v||(v=!0,N(),w!==null&&(l(w),w=null),a.onDown({code:ee,authFatal:!0}))},U=()=>{k||v||S||p!==null&&(p.readyState===p.OPEN||p.readyState===WebSocket.CONNECTING)||(w!==null&&(l(w),w=null),M())},q=()=>{typeof document<"u"&&document.visibilityState==="visible"&&U()},ae=()=>U();return typeof document<"u"&&document.addEventListener("visibilitychange",q),typeof window<"u"&&window.addEventListener("online",ae),M(),{send(ee){p&&p.readyState===p.OPEN&&p.send(ee)},bufferedAmount:()=>p&&p.readyState===p.OPEN?p.bufferedAmount:0,isOpen:()=>p!==null&&p.readyState===p.OPEN,resume(){k||v||!S||(S=!1,T=0,u.reset(),M())},close(){if(k=!0,y+=1,N(),w!==null&&(l(w),w=null),p){try{p.close()}catch{}p=null}typeof document<"u"&&document.removeEventListener("visibilitychange",q),typeof window<"u"&&window.removeEventListener("online",ae)}}};function QD(t){const a=t.session??t.persistedSession?.()??null;if(!a)throw new Error("createTunnelTransport: no session and persistedSession() returned null");let o={state:"connecting"};const i=(N,O)=>{o={state:N,...O?.reason?{reason:O.reason}:{},...O?.nextRetryInMs!==void 0?{nextRetryInMs:O.nextRetryInMs}:{},...O?.retry?{retry:O.retry}:{}},t.onStatus(o)};let l=null,u=!1,f=!1,m=!1;const g=new Set,p=t.setTimer??((N,O)=>setTimeout(N,O)),y=t.clearTimer??(N=>clearTimeout(N)),v=()=>{for(const N of g)N.timer!==null&&y(N.timer),N.resolve();g.clear()},k=N=>{for(const O of g)O.timer!==null&&y(O.timer),O.reject(new Error(`tunnel: ${N}`));g.clear()},S=()=>{u=!1},T=()=>{u||(m=!1,f=!1,u=!0,i("online"),v())},w=()=>{m=!0,u=!1,_.beginChannel()},E=4*1024*1024,C=50,j=()=>new Promise(N=>{const O=()=>{if(!l||l.bufferedAmount()<=E){N();return}p(O,C)};O()}),_=FD({roots:a.roots,daemonId:a.daemonId,deviceId:a.deviceId,send:N=>l?.send(N),onReady:T,awaitDrain:j});return l=ZD({gatewayUrl:a.gatewayUrl,daemonId:a.daemonId,phoneSessionToken:a.phoneSessionToken,...t.WebSocketImpl?{WebSocketImpl:t.WebSocketImpl}:{},...t.setTimer?{setTimer:t.setTimer}:{},...t.clearTimer?{clearTimer:t.clearTimer}:{},...t.backoff?{backoff:t.backoff}:{}},{onFrame:N=>{try{_.onFrame(N)}catch{_.resetAll("frame_open_failed"),l?.close(),i("disconnected",{reason:"integrity"})}},onControl:N=>{if(N.t==="peer-offline"&&N.role==="daemon")f=!0,m=!1,S(),_.resetAll("peer_offline"),i("reconnecting");else if(N.t==="peer-online"&&N.role==="daemon"){if(u||m||!f)return;f=!1,w()}else N.t==="revoked"&&(f=!1,m=!1,S(),_.resetAll("revoked"),k(N.reason??"revoked"),i("revoked",{reason:N.reason}))},onUp:()=>{f=!1,w()},onDown:N=>{f=!1,m=!1,S(),_.resetAll(N.authFatal?"auth_fatal":N.daemonOffline?"daemon_offline":"transient"),N.authFatal?(k("auth_fatal"),i("revoked")):N.daemonOffline?(k("daemon_offline"),i("disconnected",{reason:"daemon_offline",retry:()=>l?.resume()})):i("reconnecting",N.nextRetryInMs!==void 0?{nextRetryInMs:N.nextRetryInMs}:void 0)}}),{requiresUiSession:!1,fetch:(N,O)=>_.fetch(N,O),openWebSocket:(N,O)=>_.openWebSocket(N,O),status:()=>o,ready:(N={})=>{if(u)return Promise.resolve();const O=N.timeoutMs??1e4;return new Promise((M,L)=>{const U={resolve:M,reject:L,timer:null};U.timer=p(()=>{g.delete(U),L(new Error("tunnel: channel ready timed out"))},O),g.add(U)})},dispose:()=>{f=!1,m=!1,S(),l?.close(),l=null,_.resetAll("disposed"),k("disposed")}}}const JD=t=>{const a=t.onStatus??(()=>{});return async({daemonId:o,deviceId:i,stored:l})=>{let u;try{u=await t.resolveSession({daemonId:o,deviceId:i,stored:l})}catch(m){return m.relayTokenStatus===403?{ok:!1,failure:{code:"relay_revoked",message:`device session revoked for ${o}`}}:{ok:!1,failure:{code:"select_failed",message:`could not establish a session for ${o}: ${m.message}`}}}const f=QD({session:u,onStatus:a,...t.WebSocketImpl?{WebSocketImpl:t.WebSocketImpl}:{}});try{await f.ready({timeoutMs:t.readyTimeoutMs??1e4})}catch(m){return f.dispose(),{ok:!1,failure:{code:"select_failed",message:`could not open a ready tunnel for ${o}: ${m.message}`}}}return DT(f),{ok:!0}}},eM=(t={})=>{if(!(t.isGateway??f1)())return{mode:"direct"};if(!t.resolveSession)throw new Error("bootTransport: a gateway bundle requires resolveSession to build the tunnel");return{mode:"tunnel",connectTransport:JD({resolveSession:t.resolveSession,...t.onStatus?{onStatus:t.onStatus}:{},...t.WebSocketImpl?{WebSocketImpl:t.WebSocketImpl}:{},...t.readyTimeoutMs!==void 0?{readyTimeoutMs:t.readyTimeoutMs}:{}})}},tM=async({stored:t})=>{if(!t)throw new Error("mobileResolveSession: no persisted device session for the selected daemon");const a=window.location.origin,o=a.replace(/^http/,"ws"),i=await fetch(`${a}/pair/relay-token`,{method:"POST",credentials:"include"});if(!i.ok)throw Object.assign(new Error(`mobileResolveSession: relay-token request failed (${i.status})`),{relayTokenStatus:i.status});const{token:l}=await i.json();return{roots:{d2p:ei(t.rootKeys.d2p),p2d:ei(t.rootKeys.p2d)},deviceId:t.deviceId,daemonId:t.daemonId,gatewayUrl:o,phoneSessionToken:l}},b1=document.getElementById("root");if(!b1)throw new Error("Root element not found");const nM=eM({resolveSession:tM,onStatus:zR});V2.createRoot(b1).render(c.jsx(b.StrictMode,{children:ED(nM,tO,SD)}));mR();export{pc as $,fc as A,wM as B,No as C,yM as D,ri as E,fM as F,hM as G,Xb as H,Yb as I,oi as J,gM as K,Fa as L,oE as M,bM as N,Oo as O,Ro as P,Sm as Q,_o as R,EE as S,Qe as T,FS as U,vM as V,Jb as W,Ka as X,mM as Y,pM as Z,Ua as _,kM as a,ti as a0,h_ as a1,cM as a2,uM as a3,XT as a4,dM as a5,Ks as a6,Z0 as a7,km as a8,_M as a9,$b as aa,Fb as ab,Kl as ac,DS as ad,RM as ae,Vb as af,V_ as ag,jM as ah,Nt as ai,Hw as aj,Jw as ak,AM as al,DA as am,xm as an,iM as ao,lM as ap,bS as aq,mc as b,ye as c,Pb as d,en as e,EM as f,oM as g,TE as h,wt as i,c as j,Do as k,xM as l,Mo as m,RS as n,CM as o,TM as p,jo as q,b as r,sM as s,hc as t,we as u,NM as v,SM as w,Ga as x,Cr as y,rM as z};