@tt-a1i/hive 2.1.1 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/README.en.md +5 -460
- package/README.md +338 -187
- package/README.zh.md +389 -0
- package/dist/src/cli/hive-update.d.ts +3 -2
- package/dist/src/cli/hive-update.js +20 -60
- package/dist/src/cli/hive.js +5 -1
- package/dist/src/server/agent-manager-support.js +16 -9
- package/dist/src/server/agent-runtime-contract.d.ts +4 -0
- package/dist/src/server/agent-runtime.js +27 -0
- package/dist/src/server/agent-stdin-dispatcher.d.ts +3 -0
- package/dist/src/server/agent-stdin-dispatcher.js +3 -0
- package/dist/src/server/diagnostics-support-bundle.d.ts +3 -0
- package/dist/src/server/diagnostics-support-bundle.js +3 -0
- package/dist/src/server/hive-team-guidance.js +34 -4
- package/dist/src/server/message-log-store.d.ts +1 -0
- package/dist/src/server/message-log-store.js +13 -0
- package/dist/src/server/orchestrator-autostart.d.ts +2 -0
- package/dist/src/server/orchestrator-autostart.js +30 -11
- package/dist/src/server/post-start-input-writer.d.ts +1 -0
- package/dist/src/server/post-start-input-writer.js +78 -12
- package/dist/src/server/role-templates.d.ts +8 -1
- package/dist/src/server/role-templates.js +102 -48
- package/dist/src/server/route-types.d.ts +6 -0
- package/dist/src/server/routes-scenarios.d.ts +2 -1
- package/dist/src/server/routes-scenarios.js +11 -6
- package/dist/src/server/routes-team.js +21 -15
- package/dist/src/server/routes-workspaces.js +22 -2
- package/dist/src/server/runtime-store-contract.d.ts +2 -0
- package/dist/src/server/runtime-store-helpers.d.ts +11 -2
- package/dist/src/server/runtime-store-helpers.js +29 -5
- package/dist/src/server/runtime-store-workflows.js +20 -0
- package/dist/src/server/runtime-store.js +2 -0
- package/dist/src/server/scenario-presets.d.ts +3 -1
- package/dist/src/server/scenario-presets.js +12 -1
- package/dist/src/server/spawn-worker-defaults.d.ts +2 -0
- package/dist/src/server/spawn-worker-defaults.js +10 -5
- package/dist/src/server/team-operations.d.ts +3 -0
- package/dist/src/server/team-operations.js +97 -29
- package/dist/src/server/terminal-input-profile.d.ts +2 -0
- package/dist/src/server/update-install-plan.d.ts +20 -0
- package/dist/src/server/update-install-plan.js +151 -0
- package/dist/src/server/version-service.d.ts +5 -0
- package/dist/src/server/version-service.js +17 -13
- package/dist/src/server/workflow-agent-call-executor.d.ts +81 -0
- package/dist/src/server/workflow-agent-call-executor.js +259 -0
- package/dist/src/server/workflow-dag-layer-tracker.d.ts +14 -0
- package/dist/src/server/workflow-dag-layer-tracker.js +37 -0
- package/dist/src/server/workflow-dag.d.ts +8 -0
- package/dist/src/server/workflow-dag.js +65 -0
- package/dist/src/server/workflow-dispatch-awaiter.d.ts +7 -1
- package/dist/src/server/workflow-dispatch-awaiter.js +60 -9
- package/dist/src/server/workflow-runner.d.ts +5 -38
- package/dist/src/server/workflow-runner.js +113 -445
- package/dist/src/server/workflow-script-host-dispatcher.d.ts +14 -0
- package/dist/src/server/workflow-script-host-dispatcher.js +42 -0
- package/dist/src/server/workflow-script-loader.d.ts +2 -2
- package/dist/src/server/workflow-script-loader.js +2 -2
- package/dist/src/server/workflow-script-worker.d.ts +14 -0
- package/dist/src/server/workflow-script-worker.js +81 -0
- package/dist/src/server/workflow-vm-worker-source.d.ts +1 -0
- package/dist/src/server/workflow-vm-worker-source.js +1 -0
- package/dist/src/server/workflow-vm-worker.cjs +238 -0
- package/dist/src/server/workspace-ui-language.d.ts +7 -0
- package/dist/src/server/workspace-ui-language.js +9 -0
- package/dist/src/shared/scenario-presets.d.ts +6 -1
- package/dist/src/shared/scenario-presets.js +80 -28
- package/dist/src/shared/types.d.ts +11 -7
- package/dist/src/shared/ui-language.d.ts +4 -0
- package/dist/src/shared/ui-language.js +3 -0
- package/package.json +4 -2
- package/web/dist/assets/{AddWorkerDialog-CTOsPurT.js → AddWorkerDialog-DHwOZ75i.js} +2 -2
- package/web/dist/assets/AddWorkspaceFlow-qOI1CmqC.js +1 -0
- package/web/dist/assets/{FirstRunWizard-C24MUssx.js → FirstRunWizard-D5kGMD_V.js} +1 -1
- package/web/dist/assets/{MarketplaceDrawer-7gVUjgAx.js → MarketplaceDrawer-BuCbtqFk.js} +1 -1
- package/web/dist/assets/TaskGraphDrawer-e_bg3f5u.js +1 -0
- package/web/dist/assets/{WhatsNewDialog-vnShQWjg.js → WhatsNewDialog-BB9ieq3T.js} +1 -1
- package/web/dist/assets/{WorkerModal-DcxIBPlu.js → WorkerModal-CGeWO3Dg.js} +1 -1
- package/web/dist/assets/{WorkflowsDrawer-C8csID1I.js → WorkflowsDrawer-CVvGxxdR.js} +1 -1
- package/web/dist/assets/WorkspaceMemoryDrawer-BamHuJEp.js +1 -0
- package/web/dist/assets/WorkspaceTaskDrawer-CqntbH9-.js +1 -0
- package/web/dist/assets/index-BOpmn5Ij.js +84 -0
- package/web/dist/assets/index-rPYd0MUk.css +1 -0
- package/web/dist/assets/{search-BRQbevR2.js → search-DKgM9IgX.js} +1 -1
- package/web/dist/assets/{square-terminal-Co4pmGzn.js → square-terminal-DMWazpEv.js} +1 -1
- package/web/dist/index.html +2 -2
- package/web/dist/sw.js +1 -1
- package/web/dist/assets/AddWorkspaceFlow-D_fSv-cO.js +0 -1
- package/web/dist/assets/TaskGraphDrawer-Beh95yUu.js +0 -1
- package/web/dist/assets/WorkspaceMemoryDrawer-C_Aq9-o6.js +0 -1
- package/web/dist/assets/WorkspaceTaskDrawer-CIMYzlpt.js +0 -1
- package/web/dist/assets/index-3Hc1oXlt.css +0 -1
- package/web/dist/assets/index-D9zUE0W6.js +0 -79
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/WorkspaceTaskDrawer-CqntbH9-.js","assets/TaskGraphDrawer-e_bg3f5u.js","assets/AddWorkerDialog-DHwOZ75i.js","assets/search-DKgM9IgX.js","assets/square-terminal-DMWazpEv.js","assets/WorkflowsDrawer-CVvGxxdR.js","assets/WorkspaceMemoryDrawer-BamHuJEp.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
function D2(t,r){for(var o=0;o<r.length;o++){const i=r[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 r=document.createElement("link").relList;if(r&&r.supports&&r.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 Bb(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var qd={exports:{}},Cs={};var Yv;function M2(){if(Yv)return Cs;Yv=1;var t=Symbol.for("react.transitional.element"),r=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 h in l)h!=="key"&&(u[h]=l[h])}else u=l;return l=u.ref,{$$typeof:t,type:i,key:f,ref:l!==void 0?l:null,props:u}}return Cs.Fragment=r,Cs.jsx=o,Cs.jsxs=o,Cs}var $v;function L2(){return $v||($v=1,qd.exports=M2()),qd.exports}var c=L2(),Pd={exports:{}},Ae={};var Vv;function z2(){if(Vv)return Ae;Vv=1;var t=Symbol.for("react.transitional.element"),r=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"),h=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),x=Symbol.iterator;function S(R){return R===null||typeof R!="object"?null:(R=x&&R[x]||R["@@iterator"],typeof R=="function"?R:null)}var T={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,C={};function E(R,W,ne){this.props=R,this.context=W,this.refs=C,this.updater=ne||T}E.prototype.isReactComponent={},E.prototype.setState=function(R,W){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,W,"setState")},E.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function A(){}A.prototype=E.prototype;function j(R,W,ne){this.props=R,this.context=W,this.refs=C,this.updater=ne||T}var N=j.prototype=new A;N.constructor=j,k(N,E.prototype),N.isPureReactComponent=!0;var O=Array.isArray;function D(){}var L={H:null,A:null,T:null,S:null},B=Object.prototype.hasOwnProperty;function P(R,W,ne){var ae=ne.ref;return{$$typeof:t,type:R,key:W,ref:ae!==void 0?ae:null,props:ne}}function re(R,W){return P(R.type,W,R.props)}function ee(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function Y(R){var W={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(ne){return W[ne]})}var J=/\/+/g;function G(R,W){return typeof R=="object"&&R!==null&&R.key!=null?Y(""+R.key):W.toString(36)}function V(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(D,D):(R.status="pending",R.then(function(W){R.status==="pending"&&(R.status="fulfilled",R.value=W)},function(W){R.status==="pending"&&(R.status="rejected",R.reason=W)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function M(R,W,ne,ae,fe){var me=typeof R;(me==="undefined"||me==="boolean")&&(R=null);var ce=!1;if(R===null)ce=!0;else switch(me){case"bigint":case"string":case"number":ce=!0;break;case"object":switch(R.$$typeof){case t:case r:ce=!0;break;case y:return ce=R._init,M(ce(R._payload),W,ne,ae,fe)}}if(ce)return fe=fe(R),ce=ae===""?"."+G(R,0):ae,O(fe)?(ne="",ce!=null&&(ne=ce.replace(J,"$&/")+"/"),M(fe,W,ne,"",function(ue){return ue})):fe!=null&&(ee(fe)&&(fe=re(fe,ne+(fe.key==null||R&&R.key===fe.key?"":(""+fe.key).replace(J,"$&/")+"/")+ce)),W.push(fe)),1;ce=0;var le=ae===""?".":ae+":";if(O(R))for(var ie=0;ie<R.length;ie++)ae=R[ie],me=le+G(ae,ie),ce+=M(ae,W,ne,me,fe);else if(ie=S(R),typeof ie=="function")for(R=ie.call(R),ie=0;!(ae=R.next()).done;)ae=ae.value,me=le+G(ae,ie++),ce+=M(ae,W,ne,me,fe);else if(me==="object"){if(typeof R.then=="function")return M(V(R),W,ne,ae,fe);throw W=String(R),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return ce}function q(R,W,ne){if(R==null)return R;var ae=[],fe=0;return M(R,ae,"","",function(me){return W.call(ne,me,fe++)}),ae}function I(R){if(R._status===-1){var W=R._result;W=W(),W.then(function(ne){(R._status===0||R._status===-1)&&(R._status=1,R._result=ne)},function(ne){(R._status===0||R._status===-1)&&(R._status=2,R._result=ne)}),R._status===-1&&(R._status=0,R._result=W)}if(R._status===1)return R._result.default;throw R._result}var Z=typeof reportError=="function"?reportError:function(R){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=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(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",R);return}console.error(R)},F={map:q,forEach:function(R,W,ne){q(R,function(){W.apply(this,arguments)},ne)},count:function(R){var W=0;return q(R,function(){W++}),W},toArray:function(R){return q(R,function(W){return W})||[]},only:function(R){if(!ee(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};return Ae.Activity=v,Ae.Children=F,Ae.Component=E,Ae.Fragment=o,Ae.Profiler=l,Ae.PureComponent=j,Ae.StrictMode=i,Ae.Suspense=g,Ae.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=L,Ae.__COMPILER_RUNTIME={__proto__:null,c:function(R){return L.H.useMemoCache(R)}},Ae.cache=function(R){return function(){return R.apply(null,arguments)}},Ae.cacheSignal=function(){return null},Ae.cloneElement=function(R,W,ne){if(R==null)throw Error("The argument must be a React element, but you passed "+R+".");var ae=k({},R.props),fe=R.key;if(W!=null)for(me in W.key!==void 0&&(fe=""+W.key),W)!B.call(W,me)||me==="key"||me==="__self"||me==="__source"||me==="ref"&&W.ref===void 0||(ae[me]=W[me]);var me=arguments.length-2;if(me===1)ae.children=ne;else if(1<me){for(var ce=Array(me),le=0;le<me;le++)ce[le]=arguments[le+2];ae.children=ce}return P(R.type,fe,ae)},Ae.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},Ae.createElement=function(R,W,ne){var ae,fe={},me=null;if(W!=null)for(ae in W.key!==void 0&&(me=""+W.key),W)B.call(W,ae)&&ae!=="key"&&ae!=="__self"&&ae!=="__source"&&(fe[ae]=W[ae]);var ce=arguments.length-2;if(ce===1)fe.children=ne;else if(1<ce){for(var le=Array(ce),ie=0;ie<ce;ie++)le[ie]=arguments[ie+2];fe.children=le}if(R&&R.defaultProps)for(ae in ce=R.defaultProps,ce)fe[ae]===void 0&&(fe[ae]=ce[ae]);return P(R,me,fe)},Ae.createRef=function(){return{current:null}},Ae.forwardRef=function(R){return{$$typeof:h,render:R}},Ae.isValidElement=ee,Ae.lazy=function(R){return{$$typeof:y,_payload:{_status:-1,_result:R},_init:I}},Ae.memo=function(R,W){return{$$typeof:m,type:R,compare:W===void 0?null:W}},Ae.startTransition=function(R){var W=L.T,ne={};L.T=ne;try{var ae=R(),fe=L.S;fe!==null&&fe(ne,ae),typeof ae=="object"&&ae!==null&&typeof ae.then=="function"&&ae.then(D,Z)}catch(me){Z(me)}finally{W!==null&&ne.types!==null&&(W.types=ne.types),L.T=W}},Ae.unstable_useCacheRefresh=function(){return L.H.useCacheRefresh()},Ae.use=function(R){return L.H.use(R)},Ae.useActionState=function(R,W,ne){return L.H.useActionState(R,W,ne)},Ae.useCallback=function(R,W){return L.H.useCallback(R,W)},Ae.useContext=function(R){return L.H.useContext(R)},Ae.useDebugValue=function(){},Ae.useDeferredValue=function(R,W){return L.H.useDeferredValue(R,W)},Ae.useEffect=function(R,W){return L.H.useEffect(R,W)},Ae.useEffectEvent=function(R){return L.H.useEffectEvent(R)},Ae.useId=function(){return L.H.useId()},Ae.useImperativeHandle=function(R,W,ne){return L.H.useImperativeHandle(R,W,ne)},Ae.useInsertionEffect=function(R,W){return L.H.useInsertionEffect(R,W)},Ae.useLayoutEffect=function(R,W){return L.H.useLayoutEffect(R,W)},Ae.useMemo=function(R,W){return L.H.useMemo(R,W)},Ae.useOptimistic=function(R,W){return L.H.useOptimistic(R,W)},Ae.useReducer=function(R,W,ne){return L.H.useReducer(R,W,ne)},Ae.useRef=function(R){return L.H.useRef(R)},Ae.useState=function(R){return L.H.useState(R)},Ae.useSyncExternalStore=function(R,W,ne){return L.H.useSyncExternalStore(R,W,ne)},Ae.useTransition=function(){return L.H.useTransition()},Ae.version="19.2.5",Ae}var Gv;function pm(){return Gv||(Gv=1,Pd.exports=z2()),Pd.exports}var b=pm();const H2=Bb(b),Wb=D2({__proto__:null,default:H2},[b]);var Fd={exports:{}},Ts={},Kd={exports:{}},Yd={};var Xv;function B2(){return Xv||(Xv=1,(function(t){function r(M,q){var I=M.length;M.push(q);e:for(;0<I;){var Z=I-1>>>1,F=M[Z];if(0<l(F,q))M[Z]=q,M[I]=F,I=Z;else break e}}function o(M){return M.length===0?null:M[0]}function i(M){if(M.length===0)return null;var q=M[0],I=M.pop();if(I!==q){M[0]=I;e:for(var Z=0,F=M.length,R=F>>>1;Z<R;){var W=2*(Z+1)-1,ne=M[W],ae=W+1,fe=M[ae];if(0>l(ne,I))ae<F&&0>l(fe,ne)?(M[Z]=fe,M[ae]=I,Z=ae):(M[Z]=ne,M[W]=I,Z=W);else if(ae<F&&0>l(fe,I))M[Z]=fe,M[ae]=I,Z=ae;else break e}}return q}function l(M,q){var I=M.sortIndex-q.sortIndex;return I!==0?I:M.id-q.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,h=f.now();t.unstable_now=function(){return f.now()-h}}var g=[],m=[],y=1,v=null,x=3,S=!1,T=!1,k=!1,C=!1,E=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function N(M){for(var q=o(m);q!==null;){if(q.callback===null)i(m);else if(q.startTime<=M)i(m),q.sortIndex=q.expirationTime,r(g,q);else break;q=o(m)}}function O(M){if(k=!1,N(M),!T)if(o(g)!==null)T=!0,D||(D=!0,Y());else{var q=o(m);q!==null&&V(O,q.startTime-M)}}var D=!1,L=-1,B=5,P=-1;function re(){return C?!0:!(t.unstable_now()-P<B)}function ee(){if(C=!1,D){var M=t.unstable_now();P=M;var q=!0;try{e:{T=!1,k&&(k=!1,A(L),L=-1),S=!0;var I=x;try{t:{for(N(M),v=o(g);v!==null&&!(v.expirationTime>M&&re());){var Z=v.callback;if(typeof Z=="function"){v.callback=null,x=v.priorityLevel;var F=Z(v.expirationTime<=M);if(M=t.unstable_now(),typeof F=="function"){v.callback=F,N(M),q=!0;break t}v===o(g)&&i(g),N(M)}else i(g);v=o(g)}if(v!==null)q=!0;else{var R=o(m);R!==null&&V(O,R.startTime-M),q=!1}}break e}finally{v=null,x=I,S=!1}q=void 0}}finally{q?Y():D=!1}}}var Y;if(typeof j=="function")Y=function(){j(ee)};else if(typeof MessageChannel<"u"){var J=new MessageChannel,G=J.port2;J.port1.onmessage=ee,Y=function(){G.postMessage(null)}}else Y=function(){E(ee,0)};function V(M,q){L=E(function(){M(t.unstable_now())},q)}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(M){M.callback=null},t.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):B=0<M?Math.floor(1e3/M):5},t.unstable_getCurrentPriorityLevel=function(){return x},t.unstable_next=function(M){switch(x){case 1:case 2:case 3:var q=3;break;default:q=x}var I=x;x=q;try{return M()}finally{x=I}},t.unstable_requestPaint=function(){C=!0},t.unstable_runWithPriority=function(M,q){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var I=x;x=M;try{return q()}finally{x=I}},t.unstable_scheduleCallback=function(M,q,I){var Z=t.unstable_now();switch(typeof I=="object"&&I!==null?(I=I.delay,I=typeof I=="number"&&0<I?Z+I:Z):I=Z,M){case 1:var F=-1;break;case 2:F=250;break;case 5:F=1073741823;break;case 4:F=1e4;break;default:F=5e3}return F=I+F,M={id:y++,callback:q,priorityLevel:M,startTime:I,expirationTime:F,sortIndex:-1},I>Z?(M.sortIndex=I,r(m,M),o(g)===null&&M===o(m)&&(k?(A(L),L=-1):k=!0,V(O,I-Z))):(M.sortIndex=F,r(g,M),T||S||(T=!0,D||(D=!0,Y()))),M},t.unstable_shouldYield=re,t.unstable_wrapCallback=function(M){var q=x;return function(){var I=x;x=q;try{return M.apply(this,arguments)}finally{x=I}}}})(Yd)),Yd}var Zv;function W2(){return Zv||(Zv=1,Kd.exports=B2()),Kd.exports}var $d={exports:{}},xt={};var Qv;function U2(){if(Qv)return xt;Qv=1;var t=pm();function r(g){var m="https://react.dev/errors/"+g;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)m+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+g+"; visit "+m+" 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(r(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,m,y){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:v==null?null:""+v,children:g,containerInfo:m,implementation:y}}var f=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(g,m){if(g==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return xt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,xt.createPortal=function(g,m){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(r(299));return u(g,m,null,y)},xt.flushSync=function(g){var m=f.T,y=i.p;try{if(f.T=null,i.p=2,g)return g()}finally{f.T=m,i.p=y,i.d.f()}},xt.preconnect=function(g,m){typeof g=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,i.d.C(g,m))},xt.prefetchDNS=function(g){typeof g=="string"&&i.d.D(g)},xt.preinit=function(g,m){if(typeof g=="string"&&m&&typeof m.as=="string"){var y=m.as,v=h(y,m.crossOrigin),x=typeof m.integrity=="string"?m.integrity:void 0,S=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;y==="style"?i.d.S(g,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:v,integrity:x,fetchPriority:S}):y==="script"&&i.d.X(g,{crossOrigin:v,integrity:x,fetchPriority:S,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},xt.preinitModule=function(g,m){if(typeof g=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var y=h(m.as,m.crossOrigin);i.d.M(g,{crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&i.d.M(g)},xt.preload=function(g,m){if(typeof g=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var y=m.as,v=h(y,m.crossOrigin);i.d.L(g,y,{crossOrigin:v,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},xt.preloadModule=function(g,m){if(typeof g=="string")if(m){var y=h(m.as,m.crossOrigin);i.d.m(g,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else i.d.m(g)},xt.requestFormReset=function(g){i.d.r(g)},xt.unstable_batchedUpdates=function(g,m){return g(m)},xt.useFormState=function(g,m,y){return f.H.useFormState(g,m,y)},xt.useFormStatus=function(){return f.H.useHostTransitionStatus()},xt.version="19.2.5",xt}var Jv;function Ub(){if(Jv)return $d.exports;Jv=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(r){console.error(r)}}return t(),$d.exports=U2(),$d.exports}var ey;function I2(){if(ey)return Ts;ey=1;var t=W2(),r=pm(),o=Ub();function i(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}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,a=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(a=n.return),e=n.return;while(e)}return n.tag===3?a: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 h(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 m(e){var n=e.alternate;if(!n){if(n=u(e),n===null)throw Error(i(188));return n!==e?null:e}for(var a=e,s=n;;){var d=a.return;if(d===null)break;var p=d.alternate;if(p===null){if(s=d.return,s!==null){a=s;continue}break}if(d.child===p.child){for(p=d.child;p;){if(p===a)return g(d),e;if(p===s)return g(d),n;p=p.sibling}throw Error(i(188))}if(a.return!==s.return)a=d,s=p;else{for(var w=!1,_=d.child;_;){if(_===a){w=!0,a=d,s=p;break}if(_===s){w=!0,s=d,a=p;break}_=_.sibling}if(!w){for(_=p.child;_;){if(_===a){w=!0,a=p,s=d;break}if(_===s){w=!0,s=p,a=d;break}_=_.sibling}if(!w)throw Error(i(189))}}if(a.alternate!==s)throw Error(i(190))}if(a.tag!==3)throw Error(i(188));return a.stateNode.current===a?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,x=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),T=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),j=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),P=Symbol.for("react.activity"),re=Symbol.for("react.memo_cache_sentinel"),ee=Symbol.iterator;function Y(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 G(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 k:return"Fragment";case E:return"Profiler";case C:return"StrictMode";case O:return"Suspense";case D:return"SuspenseList";case P:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case T:return"Portal";case j:return e.displayName||"Context";case A: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:G(e.type)||"Memo";case B:n=e._payload,e=e._init;try{return G(e(n))}catch{}}return null}var V=Array.isArray,M=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I={pending:!1,data:null,method:null,action:null},Z=[],F=-1;function R(e){return{current:e}}function W(e){0>F||(e.current=Z[F],Z[F]=null,F--)}function ne(e,n){F++,Z[F]=e.current,e.current=n}var ae=R(null),fe=R(null),me=R(null),ce=R(null);function le(e,n){switch(ne(me,n),ne(fe,e),ne(ae,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?hv(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=hv(n),e=gv(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}W(ae),ne(ae,e)}function ie(){W(ae),W(fe),W(me)}function ue(e){e.memoizedState!==null&&ne(ce,e);var n=ae.current,a=gv(n,e.type);n!==a&&(ne(fe,e),ne(ae,a))}function pe(e){fe.current===e&&(W(ae),W(fe)),ce.current===e&&(W(ce),xs._currentValue=I)}var Ne,Ce;function Se(e){if(Ne===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);Ne=n&&n[1]||"",Ce=-1<a.stack.indexOf(`
|
|
3
|
+
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
4
|
+
`+Ne+e+Ce}var Je=!1;function mt(e,n){if(!e||Je)return"";Je=!0;var a=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 X=Q}Reflect.construct(e,[],se)}else{try{se.call()}catch(Q){X=Q}e.call(se.prototype)}}else{try{throw Error()}catch(Q){X=Q}(se=e())&&typeof se.catch=="function"&&se.catch(function(){})}}catch(Q){if(Q&&X&&typeof Q.stack=="string")return[Q.stack,X.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 p=s.DetermineComponentFrameRoot(),w=p[0],_=p[1];if(w&&_){var z=w.split(`
|
|
5
|
+
`),$=_.split(`
|
|
6
|
+
`);for(d=s=0;s<z.length&&!z[s].includes("DetermineComponentFrameRoot");)s++;for(;d<$.length&&!$[d].includes("DetermineComponentFrameRoot");)d++;if(s===z.length||d===$.length)for(s=z.length-1,d=$.length-1;1<=s&&0<=d&&z[s]!==$[d];)d--;for(;1<=s&&0<=d;s--,d--)if(z[s]!==$[d]){if(s!==1||d!==1)do if(s--,d--,0>d||z[s]!==$[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{Je=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Se(a):""}function en(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 mt(e.type,!1);case 11:return mt(e.type.render,!1);case 1:return mt(e.type,!0);case 31:return Se("Activity");default:return""}}function Cn(e){try{var n="",a=null;do n+=en(e,a),a=e,e=e.return;while(e);return n}catch(s){return`
|
|
8
|
+
Error generating stack: `+s.message+`
|
|
9
|
+
`+s.stack}}var pn=Object.prototype.hasOwnProperty,Tn=t.unstable_scheduleCallback,tn=t.unstable_cancelCallback,de=t.unstable_shouldYield,Te=t.unstable_requestPaint,Ve=t.unstable_now,Sa=t.unstable_getCurrentPriorityLevel,Ro=t.unstable_ImmediatePriority,Oo=t.unstable_UserBlockingPriority,be=t.unstable_NormalPriority,He=t.unstable_LowPriority,ut=t.unstable_IdlePriority,Ea=t.log,g1=t.unstable_setDisableYieldValue,Do=null,Ut=null;function ur(e){if(typeof Ea=="function"&&g1(e),Ut&&typeof Ut.setStrictMode=="function")try{Ut.setStrictMode(Do,e)}catch{}}var It=Math.clz32?Math.clz32:b1,v1=Math.log,y1=Math.LN2;function b1(e){return e>>>=0,e===0?32:31-(v1(e)/y1|0)|0}var si=256,ii=262144,li=4194304;function $r(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 ci(e,n,a){var s=e.pendingLanes;if(s===0)return 0;var d=0,p=e.suspendedLanes,w=e.pingedLanes;e=e.warmLanes;var _=s&134217727;return _!==0?(s=_&~p,s!==0?d=$r(s):(w&=_,w!==0?d=$r(w):a||(a=_&~e,a!==0&&(d=$r(a))))):(_=s&~p,_!==0?d=$r(_):w!==0?d=$r(w):a||(a=s&~e,a!==0&&(d=$r(a)))),d===0?0:n!==0&&n!==d&&(n&p)===0&&(p=d&-d,a=n&-n,p>=a||p===32&&(a&4194048)!==0)?n:d}function Mo(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function w1(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 Xm(){var e=li;return li<<=1,(li&62914560)===0&&(li=4194304),e}function jc(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function Lo(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function x1(e,n,a,s,d,p){var w=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var _=e.entanglements,z=e.expirationTimes,$=e.hiddenUpdates;for(a=w&~a;0<a;){var te=31-It(a),se=1<<te;_[te]=0,z[te]=-1;var X=$[te];if(X!==null)for($[te]=null,te=0;te<X.length;te++){var Q=X[te];Q!==null&&(Q.lane&=-536870913)}a&=~se}s!==0&&Zm(e,s,0),p!==0&&d===0&&e.tag!==0&&(e.suspendedLanes|=p&~(w&~n))}function Zm(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var s=31-It(n);e.entangledLanes|=n,e.entanglements[s]=e.entanglements[s]|1073741824|a&261930}function Qm(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var s=31-It(a),d=1<<s;d&n|e[s]&n&&(e[s]|=n),a&=~d}}function Jm(e,n){var a=n&-n;return a=(a&42)!==0?1:Rc(a),(a&(e.suspendedLanes|n))!==0?0:a}function Rc(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 Oc(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function ep(){var e=q.p;return e!==0?e:(e=window.event,e===void 0?32:Wv(e.type))}function tp(e,n){var a=q.p;try{return q.p=e,n()}finally{q.p=a}}var dr=Math.random().toString(36).slice(2),pt="__reactFiber$"+dr,At="__reactProps$"+dr,Ca="__reactContainer$"+dr,Dc="__reactEvents$"+dr,k1="__reactListeners$"+dr,S1="__reactHandles$"+dr,np="__reactResources$"+dr,zo="__reactMarker$"+dr;function Mc(e){delete e[pt],delete e[At],delete e[Dc],delete e[k1],delete e[S1]}function Ta(e){var n=e[pt];if(n)return n;for(var a=e.parentNode;a;){if(n=a[Ca]||a[pt]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=Sv(e);e!==null;){if(a=e[pt])return a;e=Sv(e)}return n}e=a,a=e.parentNode}return null}function Na(e){if(e=e[pt]||e[Ca]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function Ho(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(i(33))}function Aa(e){var n=e[np];return n||(n=e[np]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function dt(e){e[zo]=!0}var rp=new Set,ap={};function Vr(e,n){_a(e,n),_a(e+"Capture",n)}function _a(e,n){for(ap[e]=n,e=0;e<n.length;e++)rp.add(n[e])}var E1=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]*$"),op={},sp={};function C1(e){return pn.call(sp,e)?!0:pn.call(op,e)?!1:E1.test(e)?sp[e]=!0:(op[e]=!0,!1)}function ui(e,n,a){if(C1(n))if(a===null)e.removeAttribute(n);else{switch(typeof a){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,""+a)}}function di(e,n,a){if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+a)}}function Un(e,n,a,s){if(s===null)e.removeAttribute(a);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(n,a,""+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 ip(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function T1(e,n,a){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,p=s.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return d.call(this)},set:function(w){a=""+w,p.call(this,w)}}),Object.defineProperty(e,n,{enumerable:s.enumerable}),{getValue:function(){return a},setValue:function(w){a=""+w},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function Lc(e){if(!e._valueTracker){var n=ip(e)?"checked":"value";e._valueTracker=T1(e,n,""+e[n])}}function lp(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),s="";return e&&(s=ip(e)?e.checked?"true":"false":e.value),e=s,e!==a?(n.setValue(e),!0):!1}function fi(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 N1=/[\n"\\]/g;function rn(e){return e.replace(N1,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function zc(e,n,a,s,d,p,w,_){e.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.type=w:e.removeAttribute("type"),n!=null?w==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+nn(n)):e.value!==""+nn(n)&&(e.value=""+nn(n)):w!=="submit"&&w!=="reset"||e.removeAttribute("value"),n!=null?Hc(e,w,nn(n)):a!=null?Hc(e,w,nn(a)):s!=null&&e.removeAttribute("value"),d==null&&p!=null&&(e.defaultChecked=!!p),d!=null&&(e.checked=d&&typeof d!="function"&&typeof d!="symbol"),_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?e.name=""+nn(_):e.removeAttribute("name")}function cp(e,n,a,s,d,p,w,_){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.type=p),n!=null||a!=null){if(!(p!=="submit"&&p!=="reset"||n!=null)){Lc(e);return}a=a!=null?""+nn(a):"",n=n!=null?""+nn(n):a,_||n===e.value||(e.value=n),e.defaultValue=n}s=s??d,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=_?e.checked:!!s,e.defaultChecked=!!s,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(e.name=w),Lc(e)}function Hc(e,n,a){n==="number"&&fi(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function ja(e,n,a,s){if(e=e.options,n){n={};for(var d=0;d<a.length;d++)n["$"+a[d]]=!0;for(a=0;a<e.length;a++)d=n.hasOwnProperty("$"+e[a].value),e[a].selected!==d&&(e[a].selected=d),d&&s&&(e[a].defaultSelected=!0)}else{for(a=""+nn(a),n=null,d=0;d<e.length;d++){if(e[d].value===a){e[d].selected=!0,s&&(e[d].defaultSelected=!0);return}n!==null||e[d].disabled||(n=e[d])}n!==null&&(n.selected=!0)}}function up(e,n,a){if(n!=null&&(n=""+nn(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+nn(a):""}function dp(e,n,a,s){if(n==null){if(s!=null){if(a!=null)throw Error(i(92));if(V(s)){if(1<s.length)throw Error(i(93));s=s[0]}a=s}a==null&&(a=""),n=a}a=nn(n),e.defaultValue=a,s=e.textContent,s===a&&s!==""&&s!==null&&(e.value=s),Lc(e)}function Ra(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var A1=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 fp(e,n,a){var s=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?s?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":s?e.setProperty(n,a):typeof a!="number"||a===0||A1.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function mp(e,n,a){if(n!=null&&typeof n!="object")throw Error(i(62));if(e=e.style,a!=null){for(var s in a)!a.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)&&a[d]!==s&&fp(e,d,s)}else for(var p in n)n.hasOwnProperty(p)&&fp(e,p,n[p])}function Bc(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 _1=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"]]),j1=/^[\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 mi(e){return j1.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function In(){}var Wc=null;function Uc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Oa=null,Da=null;function pp(e){var n=Na(e);if(n&&(e=n.stateNode)){var a=e[At]||null;e:switch(e=n.stateNode,n.type){case"input":if(zc(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+rn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var s=a[n];if(s!==e&&s.form===e.form){var d=s[At]||null;if(!d)throw Error(i(90));zc(s,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name)}}for(n=0;n<a.length;n++)s=a[n],s.form===e.form&&lp(s)}break e;case"textarea":up(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&ja(e,!!a.multiple,n,!1)}}}var Ic=!1;function hp(e,n,a){if(Ic)return e(n,a);Ic=!0;try{var s=e(n);return s}finally{if(Ic=!1,(Oa!==null||Da!==null)&&(el(),Oa&&(n=Oa,e=Da,Da=Oa=null,pp(n),e)))for(n=0;n<e.length;n++)pp(e[n])}}function Bo(e,n){var a=e.stateNode;if(a===null)return null;var s=a[At]||null;if(s===null)return null;a=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(a&&typeof a!="function")throw Error(i(231,n,typeof a));return a}var qn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),qc=!1;if(qn)try{var Wo={};Object.defineProperty(Wo,"passive",{get:function(){qc=!0}}),window.addEventListener("test",Wo,Wo),window.removeEventListener("test",Wo,Wo)}catch{qc=!1}var fr=null,Pc=null,pi=null;function gp(){if(pi)return pi;var e,n=Pc,a=n.length,s,d="value"in fr?fr.value:fr.textContent,p=d.length;for(e=0;e<a&&n[e]===d[e];e++);var w=a-e;for(s=1;s<=w&&n[a-s]===d[p-s];s++);return pi=d.slice(e,1<s?1-s:void 0)}function hi(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 gi(){return!0}function vp(){return!1}function _t(e){function n(a,s,d,p,w){this._reactName=a,this._targetInst=d,this.type=s,this.nativeEvent=p,this.target=w,this.currentTarget=null;for(var _ in e)e.hasOwnProperty(_)&&(a=e[_],this[_]=a?a(p):p[_]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?gi:vp,this.isPropagationStopped=vp,this}return v(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=gi)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=gi)},persist:function(){},isPersistent:gi}),n}var Gr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},vi=_t(Gr),Uo=v({},Gr,{view:0,detail:0}),R1=_t(Uo),Fc,Kc,Io,yi=v({},Uo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:$c,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!==Io&&(Io&&e.type==="mousemove"?(Fc=e.screenX-Io.screenX,Kc=e.screenY-Io.screenY):Kc=Fc=0,Io=e),Fc)},movementY:function(e){return"movementY"in e?e.movementY:Kc}}),yp=_t(yi),O1=v({},yi,{dataTransfer:0}),D1=_t(O1),M1=v({},Uo,{relatedTarget:0}),Yc=_t(M1),L1=v({},Gr,{animationName:0,elapsedTime:0,pseudoElement:0}),z1=_t(L1),H1=v({},Gr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),B1=_t(H1),W1=v({},Gr,{data:0}),bp=_t(W1),U1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},I1={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"},q1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function P1(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=q1[e])?!!n[e]:!1}function $c(){return P1}var F1=v({},Uo,{key:function(e){if(e.key){var n=U1[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=hi(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?I1[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:$c,charCode:function(e){return e.type==="keypress"?hi(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?hi(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),K1=_t(F1),Y1=v({},yi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),wp=_t(Y1),$1=v({},Uo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:$c}),V1=_t($1),G1=v({},Gr,{propertyName:0,elapsedTime:0,pseudoElement:0}),X1=_t(G1),Z1=v({},yi,{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}),Q1=_t(Z1),J1=v({},Gr,{newState:0,oldState:0}),ek=_t(J1),tk=[9,13,27,32],Vc=qn&&"CompositionEvent"in window,qo=null;qn&&"documentMode"in document&&(qo=document.documentMode);var nk=qn&&"TextEvent"in window&&!qo,xp=qn&&(!Vc||qo&&8<qo&&11>=qo),kp=" ",Sp=!1;function Ep(e,n){switch(e){case"keyup":return tk.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Cp(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ma=!1;function rk(e,n){switch(e){case"compositionend":return Cp(n);case"keypress":return n.which!==32?null:(Sp=!0,kp);case"textInput":return e=n.data,e===kp&&Sp?null:e;default:return null}}function ak(e,n){if(Ma)return e==="compositionend"||!Vc&&Ep(e,n)?(e=gp(),pi=Pc=fr=null,Ma=!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 xp&&n.locale!=="ko"?null:n.data;default:return null}}var ok={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 Tp(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!ok[e.type]:n==="textarea"}function Np(e,n,a,s){Oa?Da?Da.push(s):Da=[s]:Oa=s,n=il(n,"onChange"),0<n.length&&(a=new vi("onChange","change",null,a,s),e.push({event:a,listeners:n}))}var Po=null,Fo=null;function sk(e){cv(e,0)}function bi(e){var n=Ho(e);if(lp(n))return e}function Ap(e,n){if(e==="change")return n}var _p=!1;if(qn){var Gc;if(qn){var Xc="oninput"in document;if(!Xc){var jp=document.createElement("div");jp.setAttribute("oninput","return;"),Xc=typeof jp.oninput=="function"}Gc=Xc}else Gc=!1;_p=Gc&&(!document.documentMode||9<document.documentMode)}function Rp(){Po&&(Po.detachEvent("onpropertychange",Op),Fo=Po=null)}function Op(e){if(e.propertyName==="value"&&bi(Fo)){var n=[];Np(n,Fo,e,Uc(e)),hp(sk,n)}}function ik(e,n,a){e==="focusin"?(Rp(),Po=n,Fo=a,Po.attachEvent("onpropertychange",Op)):e==="focusout"&&Rp()}function lk(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return bi(Fo)}function ck(e,n){if(e==="click")return bi(n)}function uk(e,n){if(e==="input"||e==="change")return bi(n)}function dk(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var qt=typeof Object.is=="function"?Object.is:dk;function Ko(e,n){if(qt(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var a=Object.keys(e),s=Object.keys(n);if(a.length!==s.length)return!1;for(s=0;s<a.length;s++){var d=a[s];if(!pn.call(n,d)||!qt(e[d],n[d]))return!1}return!0}function Dp(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Mp(e,n){var a=Dp(e);e=0;for(var s;a;){if(a.nodeType===3){if(s=e+a.textContent.length,e<=n&&s>=n)return{node:a,offset:n-e};e=s}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Dp(a)}}function Lp(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Lp(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function zp(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=fi(e.document);n instanceof e.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)e=n.contentWindow;else break;n=fi(e.document)}return n}function Zc(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 fk=qn&&"documentMode"in document&&11>=document.documentMode,La=null,Qc=null,Yo=null,Jc=!1;function Hp(e,n,a){var s=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Jc||La==null||La!==fi(s)||(s=La,"selectionStart"in s&&Zc(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}),Yo&&Ko(Yo,s)||(Yo=s,s=il(Qc,"onSelect"),0<s.length&&(n=new vi("onSelect","select",null,n,a),e.push({event:n,listeners:s}),n.target=La)))}function Xr(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var za={animationend:Xr("Animation","AnimationEnd"),animationiteration:Xr("Animation","AnimationIteration"),animationstart:Xr("Animation","AnimationStart"),transitionrun:Xr("Transition","TransitionRun"),transitionstart:Xr("Transition","TransitionStart"),transitioncancel:Xr("Transition","TransitionCancel"),transitionend:Xr("Transition","TransitionEnd")},eu={},Bp={};qn&&(Bp=document.createElement("div").style,"AnimationEvent"in window||(delete za.animationend.animation,delete za.animationiteration.animation,delete za.animationstart.animation),"TransitionEvent"in window||delete za.transitionend.transition);function Zr(e){if(eu[e])return eu[e];if(!za[e])return e;var n=za[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in Bp)return eu[e]=n[a];return e}var Wp=Zr("animationend"),Up=Zr("animationiteration"),Ip=Zr("animationstart"),mk=Zr("transitionrun"),pk=Zr("transitionstart"),hk=Zr("transitioncancel"),qp=Zr("transitionend"),Pp=new Map,tu="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(" ");tu.push("scrollEnd");function hn(e,n){Pp.set(e,n),Vr(n,[e])}var wi=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)},an=[],Ha=0,nu=0;function xi(){for(var e=Ha,n=nu=Ha=0;n<e;){var a=an[n];an[n++]=null;var s=an[n];an[n++]=null;var d=an[n];an[n++]=null;var p=an[n];if(an[n++]=null,s!==null&&d!==null){var w=s.pending;w===null?d.next=d:(d.next=w.next,w.next=d),s.pending=d}p!==0&&Fp(a,d,p)}}function ki(e,n,a,s){an[Ha++]=e,an[Ha++]=n,an[Ha++]=a,an[Ha++]=s,nu|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function ru(e,n,a,s){return ki(e,n,a,s),Si(e)}function Qr(e,n){return ki(e,null,null,n),Si(e)}function Fp(e,n,a){e.lanes|=a;var s=e.alternate;s!==null&&(s.lanes|=a);for(var d=!1,p=e.return;p!==null;)p.childLanes|=a,s=p.alternate,s!==null&&(s.childLanes|=a),p.tag===22&&(e=p.stateNode,e===null||e._visibility&1||(d=!0)),e=p,p=p.return;return e.tag===3?(p=e.stateNode,d&&n!==null&&(d=31-It(a),e=p.hiddenUpdates,s=e[d],s===null?e[d]=[n]:s.push(n),n.lane=a|536870912),p):null}function Si(e){if(50<ps)throw ps=0,fd=null,Error(i(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Ba={};function gk(e,n,a,s){this.tag=e,this.key=a,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 Pt(e,n,a,s){return new gk(e,n,a,s)}function au(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Pn(e,n){var a=e.alternate;return a===null?(a=Pt(e.tag,n,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=n,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,n=e.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function Kp(e,n){e.flags&=65011714;var a=e.alternate;return a===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=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,n=a.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function Ei(e,n,a,s,d,p){var w=0;if(s=e,typeof e=="function")au(e)&&(w=1);else if(typeof e=="string")w=x2(e,a,ae.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case P:return e=Pt(31,a,n,d),e.elementType=P,e.lanes=p,e;case k:return Jr(a.children,d,p,n);case C:w=8,d|=24;break;case E:return e=Pt(12,a,n,d|2),e.elementType=E,e.lanes=p,e;case O:return e=Pt(13,a,n,d),e.elementType=O,e.lanes=p,e;case D:return e=Pt(19,a,n,d),e.elementType=D,e.lanes=p,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case j:w=10;break e;case A:w=9;break e;case N:w=11;break e;case L:w=14;break e;case B:w=16,s=null;break e}w=29,a=Error(i(130,e===null?"null":typeof e,"")),s=null}return n=Pt(w,a,n,d),n.elementType=e,n.type=s,n.lanes=p,n}function Jr(e,n,a,s){return e=Pt(7,e,s,n),e.lanes=a,e}function ou(e,n,a){return e=Pt(6,e,null,n),e.lanes=a,e}function Yp(e){var n=Pt(18,null,null,0);return n.stateNode=e,n}function su(e,n,a){return n=Pt(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var $p=new WeakMap;function on(e,n){if(typeof e=="object"&&e!==null){var a=$p.get(e);return a!==void 0?a:(n={value:e,source:n,stack:Cn(n)},$p.set(e,n),n)}return{value:e,source:n,stack:Cn(n)}}var Wa=[],Ua=0,Ci=null,$o=0,sn=[],ln=0,mr=null,Nn=1,An="";function Fn(e,n){Wa[Ua++]=$o,Wa[Ua++]=Ci,Ci=e,$o=n}function Vp(e,n,a){sn[ln++]=Nn,sn[ln++]=An,sn[ln++]=mr,mr=e;var s=Nn;e=An;var d=32-It(s)-1;s&=~(1<<d),a+=1;var p=32-It(n)+d;if(30<p){var w=d-d%5;p=(s&(1<<w)-1).toString(32),s>>=w,d-=w,Nn=1<<32-It(n)+d|a<<d|s,An=p+e}else Nn=1<<p|a<<d|s,An=e}function iu(e){e.return!==null&&(Fn(e,1),Vp(e,1,0))}function lu(e){for(;e===Ci;)Ci=Wa[--Ua],Wa[Ua]=null,$o=Wa[--Ua],Wa[Ua]=null;for(;e===mr;)mr=sn[--ln],sn[ln]=null,An=sn[--ln],sn[ln]=null,Nn=sn[--ln],sn[ln]=null}function Gp(e,n){sn[ln++]=Nn,sn[ln++]=An,sn[ln++]=mr,Nn=n.id,An=n.overflow,mr=e}var ht=null,Ge=null,ze=!1,pr=null,cn=!1,cu=Error(i(519));function hr(e){var n=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Vo(on(n,e)),cu}function Xp(e){var n=e.stateNode,a=e.type,s=e.memoizedProps;switch(n[pt]=e,n[At]=s,a){case"dialog":De("cancel",n),De("close",n);break;case"iframe":case"object":case"embed":De("load",n);break;case"video":case"audio":for(a=0;a<gs.length;a++)De(gs[a],n);break;case"source":De("error",n);break;case"img":case"image":case"link":De("error",n),De("load",n);break;case"details":De("toggle",n);break;case"input":De("invalid",n),cp(n,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":De("invalid",n);break;case"textarea":De("invalid",n),dp(n,s.value,s.defaultValue,s.children)}a=s.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||s.suppressHydrationWarning===!0||mv(n.textContent,a)?(s.popover!=null&&(De("beforetoggle",n),De("toggle",n)),s.onScroll!=null&&De("scroll",n),s.onScrollEnd!=null&&De("scrollend",n),s.onClick!=null&&(n.onclick=In),n=!0):n=!1,n||hr(e,!0)}function Zp(e){for(ht=e.return;ht;)switch(ht.tag){case 5:case 31:case 13:cn=!1;return;case 27:case 3:cn=!0;return;default:ht=ht.return}}function Ia(e){if(e!==ht)return!1;if(!ze)return Zp(e),ze=!0,!1;var n=e.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Nd(e.type,e.memoizedProps)),a=!a),a&&Ge&&hr(e),Zp(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));Ge=kv(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));Ge=kv(e)}else n===27?(n=Ge,_r(e.type)?(e=Od,Od=null,Ge=e):Ge=n):Ge=ht?dn(e.stateNode.nextSibling):null;return!0}function ea(){Ge=ht=null,ze=!1}function uu(){var e=pr;return e!==null&&(Dt===null?Dt=e:Dt.push.apply(Dt,e),pr=null),e}function Vo(e){pr===null?pr=[e]:pr.push(e)}var du=R(null),ta=null,Kn=null;function gr(e,n,a){ne(du,n._currentValue),n._currentValue=a}function Yn(e){e._currentValue=du.current,W(du)}function fu(e,n,a){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===a)break;e=e.return}}function mu(e,n,a,s){var d=e.child;for(d!==null&&(d.return=e);d!==null;){var p=d.dependencies;if(p!==null){var w=d.child;p=p.firstContext;e:for(;p!==null;){var _=p;p=d;for(var z=0;z<n.length;z++)if(_.context===n[z]){p.lanes|=a,_=p.alternate,_!==null&&(_.lanes|=a),fu(p.return,a,e),s||(w=null);break e}p=_.next}}else if(d.tag===18){if(w=d.return,w===null)throw Error(i(341));w.lanes|=a,p=w.alternate,p!==null&&(p.lanes|=a),fu(w,a,e),w=null}else w=d.child;if(w!==null)w.return=d;else for(w=d;w!==null;){if(w===e){w=null;break}if(d=w.sibling,d!==null){d.return=w.return,w=d;break}w=w.return}d=w}}function qa(e,n,a,s){e=null;for(var d=n,p=!1;d!==null;){if(!p){if((d.flags&524288)!==0)p=!0;else if((d.flags&262144)!==0)break}if(d.tag===10){var w=d.alternate;if(w===null)throw Error(i(387));if(w=w.memoizedProps,w!==null){var _=d.type;qt(d.pendingProps.value,w.value)||(e!==null?e.push(_):e=[_])}}else if(d===ce.current){if(w=d.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(e!==null?e.push(xs):e=[xs])}d=d.return}e!==null&&mu(n,e,a,s),n.flags|=262144}function Ti(e){for(e=e.firstContext;e!==null;){if(!qt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function na(e){ta=e,Kn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function gt(e){return Qp(ta,e)}function Ni(e,n){return ta===null&&na(e),Qp(e,n)}function Qp(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,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 a}var vk=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(a,s){e.push(s)}};this.abort=function(){n.aborted=!0,e.forEach(function(a){return a()})}},yk=t.unstable_scheduleCallback,bk=t.unstable_NormalPriority,ot={$$typeof:j,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function pu(){return{controller:new vk,data:new Map,refCount:0}}function Go(e){e.refCount--,e.refCount===0&&yk(bk,function(){e.controller.abort()})}var Xo=null,hu=0,Pa=0,Fa=null;function wk(e,n){if(Xo===null){var a=Xo=[];hu=0,Pa=yd(),Fa={status:"pending",value:void 0,then:function(s){a.push(s)}}}return hu++,n.then(Jp,Jp),n}function Jp(){if(--hu===0&&Xo!==null){Fa!==null&&(Fa.status="fulfilled");var e=Xo;Xo=null,Pa=0,Fa=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function xk(e,n){var a=[],s={status:"pending",value:null,reason:null,then:function(d){a.push(d)}};return e.then(function(){s.status="fulfilled",s.value=n;for(var d=0;d<a.length;d++)(0,a[d])(n)},function(d){for(s.status="rejected",s.reason=d,d=0;d<a.length;d++)(0,a[d])(void 0)}),s}var eh=M.S;M.S=function(e,n){Hg=Ve(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&wk(e,n),eh!==null&&eh(e,n)};var ra=R(null);function gu(){var e=ra.current;return e!==null?e:Ye.pooledCache}function Ai(e,n){n===null?ne(ra,ra.current):ne(ra,n.pool)}function th(){var e=gu();return e===null?null:{parent:ot._currentValue,pool:e}}var Ka=Error(i(460)),vu=Error(i(474)),_i=Error(i(542)),ji={then:function(){}};function nh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function rh(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then(In,In),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,oh(e),e;default:if(typeof n.status=="string")n.then(In,In);else{if(e=Ye,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,oh(e),e}throw oa=n,Ka}}function aa(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(oa=a,Ka):a}}var oa=null;function ah(){if(oa===null)throw Error(i(459));var e=oa;return oa=null,e}function oh(e){if(e===Ka||e===_i)throw Error(i(483))}var Ya=null,Zo=0;function Ri(e){var n=Zo;return Zo+=1,Ya===null&&(Ya=[]),rh(Ya,e,n)}function Qo(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function Oi(e,n){throw n.$$typeof===x?Error(i(525)):(e=Object.prototype.toString.call(n),Error(i(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function sh(e){function n(U,H){if(e){var K=U.deletions;K===null?(U.deletions=[H],U.flags|=16):K.push(H)}}function a(U,H){if(!e)return null;for(;H!==null;)n(U,H),H=H.sibling;return null}function s(U){for(var H=new Map;U!==null;)U.key!==null?H.set(U.key,U):H.set(U.index,U),U=U.sibling;return H}function d(U,H){return U=Pn(U,H),U.index=0,U.sibling=null,U}function p(U,H,K){return U.index=K,e?(K=U.alternate,K!==null?(K=K.index,K<H?(U.flags|=67108866,H):K):(U.flags|=67108866,H)):(U.flags|=1048576,H)}function w(U){return e&&U.alternate===null&&(U.flags|=67108866),U}function _(U,H,K,oe){return H===null||H.tag!==6?(H=ou(K,U.mode,oe),H.return=U,H):(H=d(H,K),H.return=U,H)}function z(U,H,K,oe){var xe=K.type;return xe===k?te(U,H,K.props.children,oe,K.key):H!==null&&(H.elementType===xe||typeof xe=="object"&&xe!==null&&xe.$$typeof===B&&aa(xe)===H.type)?(H=d(H,K.props),Qo(H,K),H.return=U,H):(H=Ei(K.type,K.key,K.props,null,U.mode,oe),Qo(H,K),H.return=U,H)}function $(U,H,K,oe){return H===null||H.tag!==4||H.stateNode.containerInfo!==K.containerInfo||H.stateNode.implementation!==K.implementation?(H=su(K,U.mode,oe),H.return=U,H):(H=d(H,K.children||[]),H.return=U,H)}function te(U,H,K,oe,xe){return H===null||H.tag!==7?(H=Jr(K,U.mode,oe,xe),H.return=U,H):(H=d(H,K),H.return=U,H)}function se(U,H,K){if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return H=ou(""+H,U.mode,K),H.return=U,H;if(typeof H=="object"&&H!==null){switch(H.$$typeof){case S:return K=Ei(H.type,H.key,H.props,null,U.mode,K),Qo(K,H),K.return=U,K;case T:return H=su(H,U.mode,K),H.return=U,H;case B:return H=aa(H),se(U,H,K)}if(V(H)||Y(H))return H=Jr(H,U.mode,K,null),H.return=U,H;if(typeof H.then=="function")return se(U,Ri(H),K);if(H.$$typeof===j)return se(U,Ni(U,H),K);Oi(U,H)}return null}function X(U,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:_(U,H,""+K,oe);if(typeof K=="object"&&K!==null){switch(K.$$typeof){case S:return K.key===xe?z(U,H,K,oe):null;case T:return K.key===xe?$(U,H,K,oe):null;case B:return K=aa(K),X(U,H,K,oe)}if(V(K)||Y(K))return xe!==null?null:te(U,H,K,oe,null);if(typeof K.then=="function")return X(U,H,Ri(K),oe);if(K.$$typeof===j)return X(U,H,Ni(U,K),oe);Oi(U,K)}return null}function Q(U,H,K,oe,xe){if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return U=U.get(K)||null,_(H,U,""+oe,xe);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case S:return U=U.get(oe.key===null?K:oe.key)||null,z(H,U,oe,xe);case T:return U=U.get(oe.key===null?K:oe.key)||null,$(H,U,oe,xe);case B:return oe=aa(oe),Q(U,H,K,oe,xe)}if(V(oe)||Y(oe))return U=U.get(K)||null,te(H,U,oe,xe,null);if(typeof oe.then=="function")return Q(U,H,K,Ri(oe),xe);if(oe.$$typeof===j)return Q(U,H,K,Ni(H,oe),xe);Oi(H,oe)}return null}function ge(U,H,K,oe){for(var xe=null,Be=null,ye=H,Re=H=0,Le=null;ye!==null&&Re<K.length;Re++){ye.index>Re?(Le=ye,ye=null):Le=ye.sibling;var We=X(U,ye,K[Re],oe);if(We===null){ye===null&&(ye=Le);break}e&&ye&&We.alternate===null&&n(U,ye),H=p(We,H,Re),Be===null?xe=We:Be.sibling=We,Be=We,ye=Le}if(Re===K.length)return a(U,ye),ze&&Fn(U,Re),xe;if(ye===null){for(;Re<K.length;Re++)ye=se(U,K[Re],oe),ye!==null&&(H=p(ye,H,Re),Be===null?xe=ye:Be.sibling=ye,Be=ye);return ze&&Fn(U,Re),xe}for(ye=s(ye);Re<K.length;Re++)Le=Q(ye,U,Re,K[Re],oe),Le!==null&&(e&&Le.alternate!==null&&ye.delete(Le.key===null?Re:Le.key),H=p(Le,H,Re),Be===null?xe=Le:Be.sibling=Le,Be=Le);return e&&ye.forEach(function(Mr){return n(U,Mr)}),ze&&Fn(U,Re),xe}function Ee(U,H,K,oe){if(K==null)throw Error(i(151));for(var xe=null,Be=null,ye=H,Re=H=0,Le=null,We=K.next();ye!==null&&!We.done;Re++,We=K.next()){ye.index>Re?(Le=ye,ye=null):Le=ye.sibling;var Mr=X(U,ye,We.value,oe);if(Mr===null){ye===null&&(ye=Le);break}e&&ye&&Mr.alternate===null&&n(U,ye),H=p(Mr,H,Re),Be===null?xe=Mr:Be.sibling=Mr,Be=Mr,ye=Le}if(We.done)return a(U,ye),ze&&Fn(U,Re),xe;if(ye===null){for(;!We.done;Re++,We=K.next())We=se(U,We.value,oe),We!==null&&(H=p(We,H,Re),Be===null?xe=We:Be.sibling=We,Be=We);return ze&&Fn(U,Re),xe}for(ye=s(ye);!We.done;Re++,We=K.next())We=Q(ye,U,Re,We.value,oe),We!==null&&(e&&We.alternate!==null&&ye.delete(We.key===null?Re:We.key),H=p(We,H,Re),Be===null?xe=We:Be.sibling=We,Be=We);return e&&ye.forEach(function(O2){return n(U,O2)}),ze&&Fn(U,Re),xe}function Ke(U,H,K,oe){if(typeof K=="object"&&K!==null&&K.type===k&&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===k){if(H.tag===7){a(U,H.sibling),oe=d(H,K.props.children),oe.return=U,U=oe;break e}}else if(H.elementType===xe||typeof xe=="object"&&xe!==null&&xe.$$typeof===B&&aa(xe)===H.type){a(U,H.sibling),oe=d(H,K.props),Qo(oe,K),oe.return=U,U=oe;break e}a(U,H);break}else n(U,H);H=H.sibling}K.type===k?(oe=Jr(K.props.children,U.mode,oe,K.key),oe.return=U,U=oe):(oe=Ei(K.type,K.key,K.props,null,U.mode,oe),Qo(oe,K),oe.return=U,U=oe)}return w(U);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){a(U,H.sibling),oe=d(H,K.children||[]),oe.return=U,U=oe;break e}else{a(U,H);break}else n(U,H);H=H.sibling}oe=su(K,U.mode,oe),oe.return=U,U=oe}return w(U);case B:return K=aa(K),Ke(U,H,K,oe)}if(V(K))return ge(U,H,K,oe);if(Y(K)){if(xe=Y(K),typeof xe!="function")throw Error(i(150));return K=xe.call(K),Ee(U,H,K,oe)}if(typeof K.then=="function")return Ke(U,H,Ri(K),oe);if(K.$$typeof===j)return Ke(U,H,Ni(U,K),oe);Oi(U,K)}return typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint"?(K=""+K,H!==null&&H.tag===6?(a(U,H.sibling),oe=d(H,K),oe.return=U,U=oe):(a(U,H),oe=ou(K,U.mode,oe),oe.return=U,U=oe),w(U)):a(U,H)}return function(U,H,K,oe){try{Zo=0;var xe=Ke(U,H,K,oe);return Ya=null,xe}catch(ye){if(ye===Ka||ye===_i)throw ye;var Be=Pt(29,ye,null,U.mode);return Be.lanes=oe,Be.return=U,Be}}}var sa=sh(!0),ih=sh(!1),vr=!1;function yu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function bu(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 yr(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function br(e,n,a){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Ue&2)!==0){var d=s.pending;return d===null?n.next=n:(n.next=d.next,d.next=n),s.pending=n,n=Si(e),Fp(e,null,a),n}return ki(e,s,n,a),Si(e)}function Jo(e,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var s=n.lanes;s&=e.pendingLanes,a|=s,n.lanes=a,Qm(e,a)}}function wu(e,n){var a=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,a===s)){var d=null,p=null;if(a=a.firstBaseUpdate,a!==null){do{var w={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};p===null?d=p=w:p=p.next=w,a=a.next}while(a!==null);p===null?d=p=n:p=p.next=n}else d=p=n;a={baseState:s.baseState,firstBaseUpdate:d,lastBaseUpdate:p,shared:s.shared,callbacks:s.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=n:e.next=n,a.lastBaseUpdate=n}var xu=!1;function es(){if(xu){var e=Fa;if(e!==null)throw e}}function ts(e,n,a,s){xu=!1;var d=e.updateQueue;vr=!1;var p=d.firstBaseUpdate,w=d.lastBaseUpdate,_=d.shared.pending;if(_!==null){d.shared.pending=null;var z=_,$=z.next;z.next=null,w===null?p=$:w.next=$,w=z;var te=e.alternate;te!==null&&(te=te.updateQueue,_=te.lastBaseUpdate,_!==w&&(_===null?te.firstBaseUpdate=$:_.next=$,te.lastBaseUpdate=z))}if(p!==null){var se=d.baseState;w=0,te=$=z=null,_=p;do{var X=_.lane&-536870913,Q=X!==_.lane;if(Q?(Me&X)===X:(s&X)===X){X!==0&&X===Pa&&(xu=!0),te!==null&&(te=te.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var ge=e,Ee=_;X=n;var Ke=a;switch(Ee.tag){case 1:if(ge=Ee.payload,typeof ge=="function"){se=ge.call(Ke,se,X);break e}se=ge;break e;case 3:ge.flags=ge.flags&-65537|128;case 0:if(ge=Ee.payload,X=typeof ge=="function"?ge.call(Ke,se,X):ge,X==null)break e;se=v({},se,X);break e;case 2:vr=!0}}X=_.callback,X!==null&&(e.flags|=64,Q&&(e.flags|=8192),Q=d.callbacks,Q===null?d.callbacks=[X]:Q.push(X))}else Q={lane:X,tag:_.tag,payload:_.payload,callback:_.callback,next:null},te===null?($=te=Q,z=se):te=te.next=Q,w|=X;if(_=_.next,_===null){if(_=d.shared.pending,_===null)break;Q=_,_=Q.next,Q.next=null,d.lastBaseUpdate=Q,d.shared.pending=null}}while(!0);te===null&&(z=se),d.baseState=z,d.firstBaseUpdate=$,d.lastBaseUpdate=te,p===null&&(d.shared.lanes=0),Er|=w,e.lanes=w,e.memoizedState=se}}function lh(e,n){if(typeof e!="function")throw Error(i(191,e));e.call(n)}function ch(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)lh(a[e],n)}var $a=R(null),Di=R(0);function uh(e,n){e=tr,ne(Di,e),ne($a,n),tr=e|n.baseLanes}function ku(){ne(Di,tr),ne($a,$a.current)}function Su(){tr=Di.current,W($a),W(Di)}var Ft=R(null),un=null;function wr(e){var n=e.alternate;ne(nt,nt.current&1),ne(Ft,e),un===null&&(n===null||$a.current!==null||n.memoizedState!==null)&&(un=e)}function Eu(e){ne(nt,nt.current),ne(Ft,e),un===null&&(un=e)}function dh(e){e.tag===22?(ne(nt,nt.current),ne(Ft,e),un===null&&(un=e)):xr()}function xr(){ne(nt,nt.current),ne(Ft,Ft.current)}function Kt(e){W(Ft),un===e&&(un=null),W(nt)}var nt=R(0);function Mi(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||jd(a)||Rd(a)))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,je=null,Pe=null,st=null,Li=!1,Va=!1,ia=!1,zi=0,ns=0,Ga=null,kk=0;function et(){throw Error(i(321))}function Cu(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!qt(e[a],n[a]))return!1;return!0}function Tu(e,n,a,s,d,p){return $n=p,je=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,M.H=e===null||e.memoizedState===null?Vh:Iu,ia=!1,p=a(s,d),ia=!1,Va&&(p=mh(n,a,s,d)),fh(e),p}function fh(e){M.H=os;var n=Pe!==null&&Pe.next!==null;if($n=0,st=Pe=je=null,Li=!1,ns=0,Ga=null,n)throw Error(i(300));e===null||it||(e=e.dependencies,e!==null&&Ti(e)&&(it=!0))}function mh(e,n,a,s){je=e;var d=0;do{if(Va&&(Ga=null),ns=0,Va=!1,25<=d)throw Error(i(301));if(d+=1,st=Pe=null,e.updateQueue!=null){var p=e.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}M.H=Gh,p=n(a,s)}while(Va);return p}function Sk(){var e=M.H,n=e.useState()[0];return n=typeof n.then=="function"?rs(n):n,e=e.useState()[0],(Pe!==null?Pe.memoizedState:null)!==e&&(je.flags|=1024),n}function Nu(){var e=zi!==0;return zi=0,e}function Au(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function _u(e){if(Li){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Li=!1}$n=0,st=Pe=je=null,Va=!1,ns=zi=0,Ga=null}function Ct(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return st===null?je.memoizedState=st=e:st=st.next=e,st}function rt(){if(Pe===null){var e=je.alternate;e=e!==null?e.memoizedState:null}else e=Pe.next;var n=st===null?je.memoizedState:st.next;if(n!==null)st=n,Pe=e;else{if(e===null)throw je.alternate===null?Error(i(467)):Error(i(310));Pe=e,e={memoizedState:Pe.memoizedState,baseState:Pe.baseState,baseQueue:Pe.baseQueue,queue:Pe.queue,next:null},st===null?je.memoizedState=st=e:st=st.next=e}return st}function Hi(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function rs(e){var n=ns;return ns+=1,Ga===null&&(Ga=[]),e=rh(Ga,e,n),n=je,(st===null?n.memoizedState:st.next)===null&&(n=n.alternate,M.H=n===null||n.memoizedState===null?Vh:Iu),e}function Bi(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return rs(e);if(e.$$typeof===j)return gt(e)}throw Error(i(438,String(e)))}function ju(e){var n=null,a=je.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var s=je.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}),a===null&&(a=Hi(),je.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(e),s=0;s<e;s++)a[s]=re;return n.index++,a}function Vn(e,n){return typeof n=="function"?n(e):n}function Wi(e){var n=rt();return Ru(n,Pe,e)}function Ru(e,n,a){var s=e.queue;if(s===null)throw Error(i(311));s.lastRenderedReducer=a;var d=e.baseQueue,p=s.pending;if(p!==null){if(d!==null){var w=d.next;d.next=p.next,p.next=w}n.baseQueue=d=p,s.pending=null}if(p=e.baseState,d===null)e.memoizedState=p;else{n=d.next;var _=w=null,z=null,$=n,te=!1;do{var se=$.lane&-536870913;if(se!==$.lane?(Me&se)===se:($n&se)===se){var X=$.revertLane;if(X===0)z!==null&&(z=z.next={lane:0,revertLane:0,gesture:null,action:$.action,hasEagerState:$.hasEagerState,eagerState:$.eagerState,next:null}),se===Pa&&(te=!0);else if(($n&X)===X){$=$.next,X===Pa&&(te=!0);continue}else se={lane:0,revertLane:$.revertLane,gesture:null,action:$.action,hasEagerState:$.hasEagerState,eagerState:$.eagerState,next:null},z===null?(_=z=se,w=p):z=z.next=se,je.lanes|=X,Er|=X;se=$.action,ia&&a(p,se),p=$.hasEagerState?$.eagerState:a(p,se)}else X={lane:se,revertLane:$.revertLane,gesture:$.gesture,action:$.action,hasEagerState:$.hasEagerState,eagerState:$.eagerState,next:null},z===null?(_=z=X,w=p):z=z.next=X,je.lanes|=se,Er|=se;$=$.next}while($!==null&&$!==n);if(z===null?w=p:z.next=_,!qt(p,e.memoizedState)&&(it=!0,te&&(a=Fa,a!==null)))throw a;e.memoizedState=p,e.baseState=w,e.baseQueue=z,s.lastRenderedState=p}return d===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function Ou(e){var n=rt(),a=n.queue;if(a===null)throw Error(i(311));a.lastRenderedReducer=e;var s=a.dispatch,d=a.pending,p=n.memoizedState;if(d!==null){a.pending=null;var w=d=d.next;do p=e(p,w.action),w=w.next;while(w!==d);qt(p,n.memoizedState)||(it=!0),n.memoizedState=p,n.baseQueue===null&&(n.baseState=p),a.lastRenderedState=p}return[p,s]}function ph(e,n,a){var s=je,d=rt(),p=ze;if(p){if(a===void 0)throw Error(i(407));a=a()}else a=n();var w=!qt((Pe||d).memoizedState,a);if(w&&(d.memoizedState=a,it=!0),d=d.queue,Lu(vh.bind(null,s,d,e),[e]),d.getSnapshot!==n||w||st!==null&&st.memoizedState.tag&1){if(s.flags|=2048,Xa(9,{destroy:void 0},gh.bind(null,s,d,a,n),null),Ye===null)throw Error(i(349));p||($n&127)!==0||hh(s,n,a)}return a}function hh(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=je.updateQueue,n===null?(n=Hi(),je.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function gh(e,n,a,s){n.value=a,n.getSnapshot=s,yh(n)&&bh(e)}function vh(e,n,a){return a(function(){yh(n)&&bh(e)})}function yh(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!qt(e,a)}catch{return!0}}function bh(e){var n=Qr(e,2);n!==null&&Mt(n,e,2)}function Du(e){var n=Ct();if(typeof e=="function"){var a=e;if(e=a(),ia){ur(!0);try{a()}finally{ur(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vn,lastRenderedState:e},n}function wh(e,n,a,s){return e.baseState=a,Ru(e,Pe,typeof s=="function"?s:Vn)}function Ek(e,n,a,s,d){if(qi(e))throw Error(i(485));if(e=n.action,e!==null){var p={payload:d,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){p.listeners.push(w)}};M.T!==null?a(!0):p.isTransition=!1,s(p),a=n.pending,a===null?(p.next=n.pending=p,xh(n,p)):(p.next=a.next,n.pending=a.next=p)}}function xh(e,n){var a=n.action,s=n.payload,d=e.state;if(n.isTransition){var p=M.T,w={};M.T=w;try{var _=a(d,s),z=M.S;z!==null&&z(w,_),kh(e,n,_)}catch($){Mu(e,n,$)}finally{p!==null&&w.types!==null&&(p.types=w.types),M.T=p}}else try{p=a(d,s),kh(e,n,p)}catch($){Mu(e,n,$)}}function kh(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(s){Sh(e,n,s)},function(s){return Mu(e,n,s)}):Sh(e,n,a)}function Sh(e,n,a){n.status="fulfilled",n.value=a,Eh(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,xh(e,a)))}function Mu(e,n,a){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do n.status="rejected",n.reason=a,Eh(n),n=n.next;while(n!==s)}e.action=null}function Eh(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function Ch(e,n){return n}function Th(e,n){if(ze){var a=Ye.formState;if(a!==null){e:{var s=je;if(ze){if(Ge){t:{for(var d=Ge,p=cn;d.nodeType!==8;){if(!p){d=null;break t}if(d=dn(d.nextSibling),d===null){d=null;break t}}p=d.data,d=p==="F!"||p==="F"?d:null}if(d){Ge=dn(d.nextSibling),s=d.data==="F!";break e}}hr(s)}s=!1}s&&(n=a[0])}}return a=Ct(),a.memoizedState=a.baseState=n,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ch,lastRenderedState:n},a.queue=s,a=Kh.bind(null,je,s),s.dispatch=a,s=Du(!1),p=Uu.bind(null,je,!1,s.queue),s=Ct(),d={state:n,dispatch:null,action:e,pending:null},s.queue=d,a=Ek.bind(null,je,d,p,a),d.dispatch=a,s.memoizedState=e,[n,a,!1]}function Nh(e){var n=rt();return Ah(n,Pe,e)}function Ah(e,n,a){if(n=Ru(e,n,Ch)[0],e=Wi(Vn)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var s=rs(n)}catch(w){throw w===Ka?_i:w}else s=n;n=rt();var d=n.queue,p=d.dispatch;return a!==n.memoizedState&&(je.flags|=2048,Xa(9,{destroy:void 0},Ck.bind(null,d,a),null)),[s,p,e]}function Ck(e,n){e.action=n}function _h(e){var n=rt(),a=Pe;if(a!==null)return Ah(n,a,e);rt(),n=n.memoizedState,a=rt();var s=a.queue.dispatch;return a.memoizedState=e,[n,s,!1]}function Xa(e,n,a,s){return e={tag:e,create:a,deps:s,inst:n,next:null},n=je.updateQueue,n===null&&(n=Hi(),je.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=e.next=e:(s=a.next,a.next=e,e.next=s,n.lastEffect=e),e}function jh(){return rt().memoizedState}function Ui(e,n,a,s){var d=Ct();je.flags|=e,d.memoizedState=Xa(1|n,{destroy:void 0},a,s===void 0?null:s)}function Ii(e,n,a,s){var d=rt();s=s===void 0?null:s;var p=d.memoizedState.inst;Pe!==null&&s!==null&&Cu(s,Pe.memoizedState.deps)?d.memoizedState=Xa(n,p,a,s):(je.flags|=e,d.memoizedState=Xa(1|n,p,a,s))}function Rh(e,n){Ui(8390656,8,e,n)}function Lu(e,n){Ii(2048,8,e,n)}function Tk(e){je.flags|=4;var n=je.updateQueue;if(n===null)n=Hi(),je.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function Oh(e){var n=rt().memoizedState;return Tk({ref:n,nextImpl:e}),function(){if((Ue&2)!==0)throw Error(i(440));return n.impl.apply(void 0,arguments)}}function Dh(e,n){return Ii(4,2,e,n)}function Mh(e,n){return Ii(4,4,e,n)}function Lh(e,n){if(typeof n=="function"){e=e();var a=n(e);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function zh(e,n,a){a=a!=null?a.concat([e]):null,Ii(4,4,Lh.bind(null,n,e),a)}function zu(){}function Hh(e,n){var a=rt();n=n===void 0?null:n;var s=a.memoizedState;return n!==null&&Cu(n,s[1])?s[0]:(a.memoizedState=[e,n],e)}function Bh(e,n){var a=rt();n=n===void 0?null:n;var s=a.memoizedState;if(n!==null&&Cu(n,s[1]))return s[0];if(s=e(),ia){ur(!0);try{e()}finally{ur(!1)}}return a.memoizedState=[s,n],s}function Hu(e,n,a){return a===void 0||($n&1073741824)!==0&&(Me&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=Wg(),je.lanes|=e,Er|=e,a)}function Wh(e,n,a,s){return qt(a,n)?a:$a.current!==null?(e=Hu(e,a,s),qt(e,n)||(it=!0),e):($n&42)===0||($n&1073741824)!==0&&(Me&261930)===0?(it=!0,e.memoizedState=a):(e=Wg(),je.lanes|=e,Er|=e,n)}function Uh(e,n,a,s,d){var p=q.p;q.p=p!==0&&8>p?p:8;var w=M.T,_={};M.T=_,Uu(e,!1,n,a);try{var z=d(),$=M.S;if($!==null&&$(_,z),z!==null&&typeof z=="object"&&typeof z.then=="function"){var te=xk(z,s);as(e,n,te,Vt(e))}else as(e,n,s,Vt(e))}catch(se){as(e,n,{then:function(){},status:"rejected",reason:se},Vt())}finally{q.p=p,w!==null&&_.types!==null&&(w.types=_.types),M.T=w}}function Nk(){}function Bu(e,n,a,s){if(e.tag!==5)throw Error(i(476));var d=Ih(e).queue;Uh(e,d,n,I,a===null?Nk:function(){return qh(e),a(s)})}function Ih(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 a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vn,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function qh(e){var n=Ih(e);n.next===null&&(n=e.alternate.memoizedState),as(e,n.next.queue,{},Vt())}function Wu(){return gt(xs)}function Ph(){return rt().memoizedState}function Fh(){return rt().memoizedState}function Ak(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=Vt();e=yr(a);var s=br(n,e,a);s!==null&&(Mt(s,n,a),Jo(s,n,a)),n={cache:pu()},e.payload=n;return}n=n.return}}function _k(e,n,a){var s=Vt();a={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},qi(e)?Yh(n,a):(a=ru(e,n,a,s),a!==null&&(Mt(a,e,s),$h(a,n,s)))}function Kh(e,n,a){var s=Vt();as(e,n,a,s)}function as(e,n,a,s){var d={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(qi(e))Yh(n,d);else{var p=e.alternate;if(e.lanes===0&&(p===null||p.lanes===0)&&(p=n.lastRenderedReducer,p!==null))try{var w=n.lastRenderedState,_=p(w,a);if(d.hasEagerState=!0,d.eagerState=_,qt(_,w))return ki(e,n,d,0),Ye===null&&xi(),!1}catch{}if(a=ru(e,n,d,s),a!==null)return Mt(a,e,s),$h(a,n,s),!0}return!1}function Uu(e,n,a,s){if(s={lane:2,revertLane:yd(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},qi(e)){if(n)throw Error(i(479))}else n=ru(e,a,s,2),n!==null&&Mt(n,e,2)}function qi(e){var n=e.alternate;return e===je||n!==null&&n===je}function Yh(e,n){Va=Li=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function $h(e,n,a){if((a&4194048)!==0){var s=n.lanes;s&=e.pendingLanes,a|=s,n.lanes=a,Qm(e,a)}}var os={readContext:gt,use:Bi,useCallback:et,useContext:et,useEffect:et,useImperativeHandle:et,useLayoutEffect:et,useInsertionEffect:et,useMemo:et,useReducer:et,useRef:et,useState:et,useDebugValue:et,useDeferredValue:et,useTransition:et,useSyncExternalStore:et,useId:et,useHostTransitionStatus:et,useFormState:et,useActionState:et,useOptimistic:et,useMemoCache:et,useCacheRefresh:et};os.useEffectEvent=et;var Vh={readContext:gt,use:Bi,useCallback:function(e,n){return Ct().memoizedState=[e,n===void 0?null:n],e},useContext:gt,useEffect:Rh,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,Ui(4194308,4,Lh.bind(null,n,e),a)},useLayoutEffect:function(e,n){return Ui(4194308,4,e,n)},useInsertionEffect:function(e,n){Ui(4,2,e,n)},useMemo:function(e,n){var a=Ct();n=n===void 0?null:n;var s=e();if(ia){ur(!0);try{e()}finally{ur(!1)}}return a.memoizedState=[s,n],s},useReducer:function(e,n,a){var s=Ct();if(a!==void 0){var d=a(n);if(ia){ur(!0);try{a(n)}finally{ur(!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=_k.bind(null,je,e),[s.memoizedState,e]},useRef:function(e){var n=Ct();return e={current:e},n.memoizedState=e},useState:function(e){e=Du(e);var n=e.queue,a=Kh.bind(null,je,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:zu,useDeferredValue:function(e,n){var a=Ct();return Hu(a,e,n)},useTransition:function(){var e=Du(!1);return e=Uh.bind(null,je,e.queue,!0,!1),Ct().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var s=je,d=Ct();if(ze){if(a===void 0)throw Error(i(407));a=a()}else{if(a=n(),Ye===null)throw Error(i(349));(Me&127)!==0||hh(s,n,a)}d.memoizedState=a;var p={value:a,getSnapshot:n};return d.queue=p,Rh(vh.bind(null,s,p,e),[e]),s.flags|=2048,Xa(9,{destroy:void 0},gh.bind(null,s,p,a,n),null),a},useId:function(){var e=Ct(),n=Ye.identifierPrefix;if(ze){var a=An,s=Nn;a=(s&~(1<<32-It(s)-1)).toString(32)+a,n="_"+n+"R_"+a,a=zi++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=kk++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Wu,useFormState:Th,useActionState:Th,useOptimistic:function(e){var n=Ct();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=Uu.bind(null,je,!0,a),a.dispatch=n,[e,n]},useMemoCache:ju,useCacheRefresh:function(){return Ct().memoizedState=Ak.bind(null,je)},useEffectEvent:function(e){var n=Ct(),a={impl:e};return n.memoizedState=a,function(){if((Ue&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}},Iu={readContext:gt,use:Bi,useCallback:Hh,useContext:gt,useEffect:Lu,useImperativeHandle:zh,useInsertionEffect:Dh,useLayoutEffect:Mh,useMemo:Bh,useReducer:Wi,useRef:jh,useState:function(){return Wi(Vn)},useDebugValue:zu,useDeferredValue:function(e,n){var a=rt();return Wh(a,Pe.memoizedState,e,n)},useTransition:function(){var e=Wi(Vn)[0],n=rt().memoizedState;return[typeof e=="boolean"?e:rs(e),n]},useSyncExternalStore:ph,useId:Ph,useHostTransitionStatus:Wu,useFormState:Nh,useActionState:Nh,useOptimistic:function(e,n){var a=rt();return wh(a,Pe,e,n)},useMemoCache:ju,useCacheRefresh:Fh};Iu.useEffectEvent=Oh;var Gh={readContext:gt,use:Bi,useCallback:Hh,useContext:gt,useEffect:Lu,useImperativeHandle:zh,useInsertionEffect:Dh,useLayoutEffect:Mh,useMemo:Bh,useReducer:Ou,useRef:jh,useState:function(){return Ou(Vn)},useDebugValue:zu,useDeferredValue:function(e,n){var a=rt();return Pe===null?Hu(a,e,n):Wh(a,Pe.memoizedState,e,n)},useTransition:function(){var e=Ou(Vn)[0],n=rt().memoizedState;return[typeof e=="boolean"?e:rs(e),n]},useSyncExternalStore:ph,useId:Ph,useHostTransitionStatus:Wu,useFormState:_h,useActionState:_h,useOptimistic:function(e,n){var a=rt();return Pe!==null?wh(a,Pe,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:ju,useCacheRefresh:Fh};Gh.useEffectEvent=Oh;function qu(e,n,a,s){n=e.memoizedState,a=a(s,n),a=a==null?n:v({},n,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Pu={enqueueSetState:function(e,n,a){e=e._reactInternals;var s=Vt(),d=yr(s);d.payload=n,a!=null&&(d.callback=a),n=br(e,d,s),n!==null&&(Mt(n,e,s),Jo(n,e,s))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var s=Vt(),d=yr(s);d.tag=1,d.payload=n,a!=null&&(d.callback=a),n=br(e,d,s),n!==null&&(Mt(n,e,s),Jo(n,e,s))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=Vt(),s=yr(a);s.tag=2,n!=null&&(s.callback=n),n=br(e,s,a),n!==null&&(Mt(n,e,a),Jo(n,e,a))}};function Xh(e,n,a,s,d,p,w){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,p,w):n.prototype&&n.prototype.isPureReactComponent?!Ko(a,s)||!Ko(d,p):!0}function Zh(e,n,a,s){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,s),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,s),n.state!==e&&Pu.enqueueReplaceState(n,n.state,null)}function la(e,n){var a=n;if("ref"in n){a={};for(var s in n)s!=="ref"&&(a[s]=n[s])}if(e=e.defaultProps){a===n&&(a=v({},a));for(var d in e)a[d]===void 0&&(a[d]=e[d])}return a}function Qh(e){wi(e)}function Jh(e){console.error(e)}function eg(e){wi(e)}function Pi(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(s){setTimeout(function(){throw s})}}function tg(e,n,a){try{var s=e.onCaughtError;s(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(d){setTimeout(function(){throw d})}}function Fu(e,n,a){return a=yr(a),a.tag=3,a.payload={element:null},a.callback=function(){Pi(e,n)},a}function ng(e){return e=yr(e),e.tag=3,e}function rg(e,n,a,s){var d=a.type.getDerivedStateFromError;if(typeof d=="function"){var p=s.value;e.payload=function(){return d(p)},e.callback=function(){tg(n,a,s)}}var w=a.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(e.callback=function(){tg(n,a,s),typeof d!="function"&&(Cr===null?Cr=new Set([this]):Cr.add(this));var _=s.stack;this.componentDidCatch(s.value,{componentStack:_!==null?_:""})})}function jk(e,n,a,s,d){if(a.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(n=a.alternate,n!==null&&qa(n,a,d,!0),a=Ft.current,a!==null){switch(a.tag){case 31:case 13:return un===null?tl():a.alternate===null&&tt===0&&(tt=3),a.flags&=-257,a.flags|=65536,a.lanes=d,s===ji?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([s]):n.add(s),hd(e,s,d)),!1;case 22:return a.flags|=65536,s===ji?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([s])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([s]):a.add(s)),hd(e,s,d)),!1}throw Error(i(435,a.tag))}return hd(e,s,d),tl(),!1}if(ze)return n=Ft.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=d,s!==cu&&(e=Error(i(422),{cause:s}),Vo(on(e,a)))):(s!==cu&&(n=Error(i(423),{cause:s}),Vo(on(n,a))),e=e.current.alternate,e.flags|=65536,d&=-d,e.lanes|=d,s=on(s,a),d=Fu(e.stateNode,s,d),wu(e,d),tt!==4&&(tt=2)),!1;var p=Error(i(520),{cause:s});if(p=on(p,a),ms===null?ms=[p]:ms.push(p),tt!==4&&(tt=2),n===null)return!0;s=on(s,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=d&-d,a.lanes|=e,e=Fu(a.stateNode,s,e),wu(a,e),!1;case 1:if(n=a.type,p=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(Cr===null||!Cr.has(p))))return a.flags|=65536,d&=-d,a.lanes|=d,d=ng(d),rg(d,e,a,s),wu(a,d),!1}a=a.return}while(a!==null);return!1}var Ku=Error(i(461)),it=!1;function vt(e,n,a,s){n.child=e===null?ih(n,null,a,s):sa(n,e.child,a,s)}function ag(e,n,a,s,d){a=a.render;var p=n.ref;if("ref"in s){var w={};for(var _ in s)_!=="ref"&&(w[_]=s[_])}else w=s;return na(n),s=Tu(e,n,a,w,p,d),_=Nu(),e!==null&&!it?(Au(e,n,d),Gn(e,n,d)):(ze&&_&&iu(n),n.flags|=1,vt(e,n,s,d),n.child)}function og(e,n,a,s,d){if(e===null){var p=a.type;return typeof p=="function"&&!au(p)&&p.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=p,sg(e,n,p,s,d)):(e=Ei(a.type,null,s,n,n.mode,d),e.ref=n.ref,e.return=n,n.child=e)}if(p=e.child,!Ju(e,d)){var w=p.memoizedProps;if(a=a.compare,a=a!==null?a:Ko,a(w,s)&&e.ref===n.ref)return Gn(e,n,d)}return n.flags|=1,e=Pn(p,s),e.ref=n.ref,e.return=n,n.child=e}function sg(e,n,a,s,d){if(e!==null){var p=e.memoizedProps;if(Ko(p,s)&&e.ref===n.ref)if(it=!1,n.pendingProps=s=p,Ju(e,d))(e.flags&131072)!==0&&(it=!0);else return n.lanes=e.lanes,Gn(e,n,d)}return Yu(e,n,a,s,d)}function ig(e,n,a,s){var d=s.children,p=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(p=p!==null?p.baseLanes|a:a,e!==null){for(s=n.child=e.child,d=0;s!==null;)d=d|s.lanes|s.childLanes,s=s.sibling;s=d&~p}else s=0,n.child=null;return lg(e,n,p,a,s)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ai(n,p!==null?p.cachePool:null),p!==null?uh(n,p):ku(),dh(n);else return s=n.lanes=536870912,lg(e,n,p!==null?p.baseLanes|a:a,a,s)}else p!==null?(Ai(n,p.cachePool),uh(n,p),xr(),n.memoizedState=null):(e!==null&&Ai(n,null),ku(),xr());return vt(e,n,d,a),n.child}function ss(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function lg(e,n,a,s,d){var p=gu();return p=p===null?null:{parent:ot._currentValue,pool:p},n.memoizedState={baseLanes:a,cachePool:p},e!==null&&Ai(n,null),ku(),dh(n),e!==null&&qa(e,n,s,!0),n.childLanes=d,null}function Fi(e,n){return n=Yi({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function cg(e,n,a){return sa(n,e.child,null,a),e=Fi(n,n.pendingProps),e.flags|=2,Kt(n),n.memoizedState=null,e}function Rk(e,n,a){var s=n.pendingProps,d=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(ze){if(s.mode==="hidden")return e=Fi(n,s),n.lanes=536870912,ss(null,e);if(Eu(n),(e=Ge)?(e=xv(e,cn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:mr!==null?{id:Nn,overflow:An}:null,retryLane:536870912,hydrationErrors:null},a=Yp(e),a.return=n,n.child=a,ht=n,Ge=null)):e=null,e===null)throw hr(n);return n.lanes=536870912,null}return Fi(n,s)}var p=e.memoizedState;if(p!==null){var w=p.dehydrated;if(Eu(n),d)if(n.flags&256)n.flags&=-257,n=cg(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(i(558));else if(it||qa(e,n,a,!1),d=(a&e.childLanes)!==0,it||d){if(s=Ye,s!==null&&(w=Jm(s,a),w!==0&&w!==p.retryLane))throw p.retryLane=w,Qr(e,w),Mt(s,e,w),Ku;tl(),n=cg(e,n,a)}else e=p.treeContext,Ge=dn(w.nextSibling),ht=n,ze=!0,pr=null,cn=!1,e!==null&&Gp(n,e),n=Fi(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 Ki(e,n){var a=n.ref;if(a===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(i(284));(e===null||e.ref!==a)&&(n.flags|=4194816)}}function Yu(e,n,a,s,d){return na(n),a=Tu(e,n,a,s,void 0,d),s=Nu(),e!==null&&!it?(Au(e,n,d),Gn(e,n,d)):(ze&&s&&iu(n),n.flags|=1,vt(e,n,a,d),n.child)}function ug(e,n,a,s,d,p){return na(n),n.updateQueue=null,a=mh(n,s,a,d),fh(e),s=Nu(),e!==null&&!it?(Au(e,n,p),Gn(e,n,p)):(ze&&s&&iu(n),n.flags|=1,vt(e,n,a,p),n.child)}function dg(e,n,a,s,d){if(na(n),n.stateNode===null){var p=Ba,w=a.contextType;typeof w=="object"&&w!==null&&(p=gt(w)),p=new a(s,p),n.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=Pu,n.stateNode=p,p._reactInternals=n,p=n.stateNode,p.props=s,p.state=n.memoizedState,p.refs={},yu(n),w=a.contextType,p.context=typeof w=="object"&&w!==null?gt(w):Ba,p.state=n.memoizedState,w=a.getDerivedStateFromProps,typeof w=="function"&&(qu(n,a,w,s),p.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(w=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),w!==p.state&&Pu.enqueueReplaceState(p,p.state,null),ts(n,s,p,d),es(),p.state=n.memoizedState),typeof p.componentDidMount=="function"&&(n.flags|=4194308),s=!0}else if(e===null){p=n.stateNode;var _=n.memoizedProps,z=la(a,_);p.props=z;var $=p.context,te=a.contextType;w=Ba,typeof te=="object"&&te!==null&&(w=gt(te));var se=a.getDerivedStateFromProps;te=typeof se=="function"||typeof p.getSnapshotBeforeUpdate=="function",_=n.pendingProps!==_,te||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(_||$!==w)&&Zh(n,p,s,w),vr=!1;var X=n.memoizedState;p.state=X,ts(n,s,p,d),es(),$=n.memoizedState,_||X!==$||vr?(typeof se=="function"&&(qu(n,a,se,s),$=n.memoizedState),(z=vr||Xh(n,a,z,s,X,$,w))?(te||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(n.flags|=4194308)):(typeof p.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=s,n.memoizedState=$),p.props=s,p.state=$,p.context=w,s=z):(typeof p.componentDidMount=="function"&&(n.flags|=4194308),s=!1)}else{p=n.stateNode,bu(e,n),w=n.memoizedProps,te=la(a,w),p.props=te,se=n.pendingProps,X=p.context,$=a.contextType,z=Ba,typeof $=="object"&&$!==null&&(z=gt($)),_=a.getDerivedStateFromProps,($=typeof _=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w!==se||X!==z)&&Zh(n,p,s,z),vr=!1,X=n.memoizedState,p.state=X,ts(n,s,p,d),es();var Q=n.memoizedState;w!==se||X!==Q||vr||e!==null&&e.dependencies!==null&&Ti(e.dependencies)?(typeof _=="function"&&(qu(n,a,_,s),Q=n.memoizedState),(te=vr||Xh(n,a,te,s,X,Q,z)||e!==null&&e.dependencies!==null&&Ti(e.dependencies))?($||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(s,Q,z),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(s,Q,z)),typeof p.componentDidUpdate=="function"&&(n.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof p.componentDidUpdate!="function"||w===e.memoizedProps&&X===e.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&X===e.memoizedState||(n.flags|=1024),n.memoizedProps=s,n.memoizedState=Q),p.props=s,p.state=Q,p.context=z,s=te):(typeof p.componentDidUpdate!="function"||w===e.memoizedProps&&X===e.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&X===e.memoizedState||(n.flags|=1024),s=!1)}return p=s,Ki(e,n),s=(n.flags&128)!==0,p||s?(p=n.stateNode,a=s&&typeof a.getDerivedStateFromError!="function"?null:p.render(),n.flags|=1,e!==null&&s?(n.child=sa(n,e.child,null,d),n.child=sa(n,null,a,d)):vt(e,n,a,d),n.memoizedState=p.state,e=n.child):e=Gn(e,n,d),e}function fg(e,n,a,s){return ea(),n.flags|=256,vt(e,n,a,s),n.child}var $u={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Vu(e){return{baseLanes:e,cachePool:th()}}function Gu(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=$t),e}function mg(e,n,a){var s=n.pendingProps,d=!1,p=(n.flags&128)!==0,w;if((w=p)||(w=e!==null&&e.memoizedState===null?!1:(nt.current&2)!==0),w&&(d=!0,n.flags&=-129),w=(n.flags&32)!==0,n.flags&=-33,e===null){if(ze){if(d?wr(n):xr(),(e=Ge)?(e=xv(e,cn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:mr!==null?{id:Nn,overflow:An}:null,retryLane:536870912,hydrationErrors:null},a=Yp(e),a.return=n,n.child=a,ht=n,Ge=null)):e=null,e===null)throw hr(n);return Rd(e)?n.lanes=32:n.lanes=536870912,null}var _=s.children;return s=s.fallback,d?(xr(),d=n.mode,_=Yi({mode:"hidden",children:_},d),s=Jr(s,d,a,null),_.return=n,s.return=n,_.sibling=s,n.child=_,s=n.child,s.memoizedState=Vu(a),s.childLanes=Gu(e,w,a),n.memoizedState=$u,ss(null,s)):(wr(n),Xu(n,_))}var z=e.memoizedState;if(z!==null&&(_=z.dehydrated,_!==null)){if(p)n.flags&256?(wr(n),n.flags&=-257,n=Zu(e,n,a)):n.memoizedState!==null?(xr(),n.child=e.child,n.flags|=128,n=null):(xr(),_=s.fallback,d=n.mode,s=Yi({mode:"visible",children:s.children},d),_=Jr(_,d,a,null),_.flags|=2,s.return=n,_.return=n,s.sibling=_,n.child=s,sa(n,e.child,null,a),s=n.child,s.memoizedState=Vu(a),s.childLanes=Gu(e,w,a),n.memoizedState=$u,n=ss(null,s));else if(wr(n),Rd(_)){if(w=_.nextSibling&&_.nextSibling.dataset,w)var $=w.dgst;w=$,s=Error(i(419)),s.stack="",s.digest=w,Vo({value:s,source:null,stack:null}),n=Zu(e,n,a)}else if(it||qa(e,n,a,!1),w=(a&e.childLanes)!==0,it||w){if(w=Ye,w!==null&&(s=Jm(w,a),s!==0&&s!==z.retryLane))throw z.retryLane=s,Qr(e,s),Mt(w,e,s),Ku;jd(_)||tl(),n=Zu(e,n,a)}else jd(_)?(n.flags|=192,n.child=e.child,n=null):(e=z.treeContext,Ge=dn(_.nextSibling),ht=n,ze=!0,pr=null,cn=!1,e!==null&&Gp(n,e),n=Xu(n,s.children),n.flags|=4096);return n}return d?(xr(),_=s.fallback,d=n.mode,z=e.child,$=z.sibling,s=Pn(z,{mode:"hidden",children:s.children}),s.subtreeFlags=z.subtreeFlags&65011712,$!==null?_=Pn($,_):(_=Jr(_,d,a,null),_.flags|=2),_.return=n,s.return=n,s.sibling=_,n.child=s,ss(null,s),s=n.child,_=e.child.memoizedState,_===null?_=Vu(a):(d=_.cachePool,d!==null?(z=ot._currentValue,d=d.parent!==z?{parent:z,pool:z}:d):d=th(),_={baseLanes:_.baseLanes|a,cachePool:d}),s.memoizedState=_,s.childLanes=Gu(e,w,a),n.memoizedState=$u,ss(e.child,s)):(wr(n),a=e.child,e=a.sibling,a=Pn(a,{mode:"visible",children:s.children}),a.return=n,a.sibling=null,e!==null&&(w=n.deletions,w===null?(n.deletions=[e],n.flags|=16):w.push(e)),n.child=a,n.memoizedState=null,a)}function Xu(e,n){return n=Yi({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function Yi(e,n){return e=Pt(22,e,null,n),e.lanes=0,e}function Zu(e,n,a){return sa(n,e.child,null,a),e=Xu(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function pg(e,n,a){e.lanes|=n;var s=e.alternate;s!==null&&(s.lanes|=n),fu(e.return,n,a)}function Qu(e,n,a,s,d,p){var w=e.memoizedState;w===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:s,tail:a,tailMode:d,treeForkCount:p}:(w.isBackwards=n,w.rendering=null,w.renderingStartTime=0,w.last=s,w.tail=a,w.tailMode=d,w.treeForkCount=p)}function hg(e,n,a){var s=n.pendingProps,d=s.revealOrder,p=s.tail;s=s.children;var w=nt.current,_=(w&2)!==0;if(_?(w=w&1|2,n.flags|=128):w&=1,ne(nt,w),vt(e,n,s,a),s=ze?$o:0,!_&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&pg(e,a,n);else if(e.tag===19)pg(e,a,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(a=n.child,d=null;a!==null;)e=a.alternate,e!==null&&Mi(e)===null&&(d=a),a=a.sibling;a=d,a===null?(d=n.child,n.child=null):(d=a.sibling,a.sibling=null),Qu(n,!1,d,a,p,s);break;case"backwards":case"unstable_legacy-backwards":for(a=null,d=n.child,n.child=null;d!==null;){if(e=d.alternate,e!==null&&Mi(e)===null){n.child=d;break}e=d.sibling,d.sibling=a,a=d,d=e}Qu(n,!0,a,null,p,s);break;case"together":Qu(n,!1,null,null,void 0,s);break;default:n.memoizedState=null}return n.child}function Gn(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),Er|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(qa(e,n,a,!1),(a&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,a=Pn(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=Pn(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function Ju(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Ti(e)))}function Ok(e,n,a){switch(n.tag){case 3:le(n,n.stateNode.containerInfo),gr(n,ot,e.memoizedState.cache),ea();break;case 27:case 5:ue(n);break;case 4:le(n,n.stateNode.containerInfo);break;case 10:gr(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Eu(n),null;break;case 13:var s=n.memoizedState;if(s!==null)return s.dehydrated!==null?(wr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?mg(e,n,a):(wr(n),e=Gn(e,n,a),e!==null?e.sibling:null);wr(n);break;case 19:var d=(e.flags&128)!==0;if(s=(a&n.childLanes)!==0,s||(qa(e,n,a,!1),s=(a&n.childLanes)!==0),d){if(s)return hg(e,n,a);n.flags|=128}if(d=n.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),ne(nt,nt.current),s)break;return null;case 22:return n.lanes=0,ig(e,n,a,n.pendingProps);case 24:gr(n,ot,e.memoizedState.cache)}return Gn(e,n,a)}function gg(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)it=!0;else{if(!Ju(e,a)&&(n.flags&128)===0)return it=!1,Ok(e,n,a);it=(e.flags&131072)!==0}else it=!1,ze&&(n.flags&1048576)!==0&&Vp(n,$o,n.index);switch(n.lanes=0,n.tag){case 16:e:{var s=n.pendingProps;if(e=aa(n.elementType),n.type=e,typeof e=="function")au(e)?(s=la(e,s),n.tag=1,n=dg(null,n,e,s,a)):(n.tag=0,n=Yu(null,n,e,s,a));else{if(e!=null){var d=e.$$typeof;if(d===N){n.tag=11,n=ag(null,n,e,s,a);break e}else if(d===L){n.tag=14,n=og(null,n,e,s,a);break e}}throw n=G(e)||e,Error(i(306,n,""))}}return n;case 0:return Yu(e,n,n.type,n.pendingProps,a);case 1:return s=n.type,d=la(s,n.pendingProps),dg(e,n,s,d,a);case 3:e:{if(le(n,n.stateNode.containerInfo),e===null)throw Error(i(387));s=n.pendingProps;var p=n.memoizedState;d=p.element,bu(e,n),ts(n,s,null,a);var w=n.memoizedState;if(s=w.cache,gr(n,ot,s),s!==p.cache&&mu(n,[ot],a,!0),es(),s=w.element,p.isDehydrated)if(p={element:s,isDehydrated:!1,cache:w.cache},n.updateQueue.baseState=p,n.memoizedState=p,n.flags&256){n=fg(e,n,s,a);break e}else if(s!==d){d=on(Error(i(424)),n),Vo(d),n=fg(e,n,s,a);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),ht=n,ze=!0,pr=null,cn=!0,a=ih(n,null,s,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(ea(),s===d){n=Gn(e,n,a);break e}vt(e,n,s,a)}n=n.child}return n;case 26:return Ki(e,n),e===null?(a=Nv(n.type,null,n.pendingProps,null))?n.memoizedState=a:ze||(a=n.type,e=n.pendingProps,s=ll(me.current).createElement(a),s[pt]=n,s[At]=e,yt(s,a,e),dt(s),n.stateNode=s):n.memoizedState=Nv(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return ue(n),e===null&&ze&&(s=n.stateNode=Ev(n.type,n.pendingProps,me.current),ht=n,cn=!0,d=Ge,_r(n.type)?(Od=d,Ge=dn(s.firstChild)):Ge=d),vt(e,n,n.pendingProps.children,a),Ki(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&ze&&((d=s=Ge)&&(s=l2(s,n.type,n.pendingProps,cn),s!==null?(n.stateNode=s,ht=n,Ge=dn(s.firstChild),cn=!1,d=!0):d=!1),d||hr(n)),ue(n),d=n.type,p=n.pendingProps,w=e!==null?e.memoizedProps:null,s=p.children,Nd(d,p)?s=null:w!==null&&Nd(d,w)&&(n.flags|=32),n.memoizedState!==null&&(d=Tu(e,n,Sk,null,null,a),xs._currentValue=d),Ki(e,n),vt(e,n,s,a),n.child;case 6:return e===null&&ze&&((e=a=Ge)&&(a=c2(a,n.pendingProps,cn),a!==null?(n.stateNode=a,ht=n,Ge=null,e=!0):e=!1),e||hr(n)),null;case 13:return mg(e,n,a);case 4:return le(n,n.stateNode.containerInfo),s=n.pendingProps,e===null?n.child=sa(n,null,s,a):vt(e,n,s,a),n.child;case 11:return ag(e,n,n.type,n.pendingProps,a);case 7:return vt(e,n,n.pendingProps,a),n.child;case 8:return vt(e,n,n.pendingProps.children,a),n.child;case 12:return vt(e,n,n.pendingProps.children,a),n.child;case 10:return s=n.pendingProps,gr(n,n.type,s.value),vt(e,n,s.children,a),n.child;case 9:return d=n.type._context,s=n.pendingProps.children,na(n),d=gt(d),s=s(d),n.flags|=1,vt(e,n,s,a),n.child;case 14:return og(e,n,n.type,n.pendingProps,a);case 15:return sg(e,n,n.type,n.pendingProps,a);case 19:return hg(e,n,a);case 31:return Rk(e,n,a);case 22:return ig(e,n,a,n.pendingProps);case 24:return na(n),s=gt(ot),e===null?(d=gu(),d===null&&(d=Ye,p=pu(),d.pooledCache=p,p.refCount++,p!==null&&(d.pooledCacheLanes|=a),d=p),n.memoizedState={parent:s,cache:d},yu(n),gr(n,ot,d)):((e.lanes&a)!==0&&(bu(e,n),ts(n,null,null,a),es()),d=e.memoizedState,p=n.memoizedState,d.parent!==s?(d={parent:s,cache:s},n.memoizedState=d,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=d),gr(n,ot,s)):(s=p.cache,gr(n,ot,s),s!==d.cache&&mu(n,[ot],a,!0))),vt(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(i(156,n.tag))}function Xn(e){e.flags|=4}function ed(e,n,a,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(Pg())e.flags|=8192;else throw oa=ji,vu}else e.flags&=-16777217}function vg(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Ov(n))if(Pg())e.flags|=8192;else throw oa=ji,vu}function $i(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?Xm():536870912,e.lanes|=n,eo|=n)}function is(e,n){if(!ze)switch(e.tailMode){case"hidden":n=e.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var s=null;a!==null;)a.alternate!==null&&(s=a),a=a.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,a=0,s=0;if(n)for(var d=e.child;d!==null;)a|=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;)a|=d.lanes|d.childLanes,s|=d.subtreeFlags,s|=d.flags,d.return=e,d=d.sibling;return e.subtreeFlags|=s,e.childLanes=a,n}function Dk(e,n,a){var s=n.pendingProps;switch(lu(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 a=n.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),n.memoizedState.cache!==s&&(n.flags|=2048),Yn(ot),ie(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Ia(n)?Xn(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,uu())),Xe(n),null;case 26:var d=n.type,p=n.memoizedState;return e===null?(Xn(n),p!==null?(Xe(n),vg(n,p)):(Xe(n),ed(n,d,null,s,a))):p?p!==e.memoizedState?(Xn(n),Xe(n),vg(n,p)):(Xe(n),n.flags&=-16777217):(e=e.memoizedProps,e!==s&&Xn(n),Xe(n),ed(n,d,e,s,a)),null;case 27:if(pe(n),a=me.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=ae.current,Ia(n)?Xp(n):(e=Ev(d,s,a),n.stateNode=e,Xn(n))}return Xe(n),null;case 5:if(pe(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(p=ae.current,Ia(n))Xp(n);else{var w=ll(me.current);switch(p){case 1:p=w.createElementNS("http://www.w3.org/2000/svg",d);break;case 2:p=w.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;default:switch(d){case"svg":p=w.createElementNS("http://www.w3.org/2000/svg",d);break;case"math":p=w.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;case"script":p=w.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof s.is=="string"?w.createElement("select",{is:s.is}):w.createElement("select"),s.multiple?p.multiple=!0:s.size&&(p.size=s.size);break;default:p=typeof s.is=="string"?w.createElement(d,{is:s.is}):w.createElement(d)}}p[pt]=n,p[At]=s;e:for(w=n.child;w!==null;){if(w.tag===5||w.tag===6)p.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===n)break e;for(;w.sibling===null;){if(w.return===null||w.return===n)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}n.stateNode=p;e:switch(yt(p,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),ed(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),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=me.current,Ia(n)){if(e=n.stateNode,a=n.memoizedProps,s=null,d=ht,d!==null)switch(d.tag){case 27:case 5:s=d.memoizedProps}e[pt]=n,e=!!(e.nodeValue===a||s!==null&&s.suppressHydrationWarning===!0||mv(e.nodeValue,a)),e||hr(n,!0)}else e=ll(e).createTextNode(s),e[pt]=n,n.stateNode=e}return Xe(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(s=Ia(n),a!==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[pt]=n}else ea(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Xe(n),e=!1}else a=uu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(Kt(n),n):(Kt(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=Ia(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[pt]=n}else ea(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Xe(n),d=!1}else d=uu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=d),d=!0;if(!d)return n.flags&256?(Kt(n),n):(Kt(n),null)}return Kt(n),(n.flags&128)!==0?(n.lanes=a,n):(a=s!==null,e=e!==null&&e.memoizedState!==null,a&&(s=n.child,d=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(d=s.alternate.memoizedState.cachePool.pool),p=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(p=s.memoizedState.cachePool.pool),p!==d&&(s.flags|=2048)),a!==e&&a&&(n.child.flags|=8192),$i(n,n.updateQueue),Xe(n),null);case 4:return ie(),e===null&&kd(n.stateNode.containerInfo),Xe(n),null;case 10:return Yn(n.type),Xe(n),null;case 19:if(W(nt),s=n.memoizedState,s===null)return Xe(n),null;if(d=(n.flags&128)!==0,p=s.rendering,p===null)if(d)is(s,!1);else{if(tt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(p=Mi(e),p!==null){for(n.flags|=128,is(s,!1),e=p.updateQueue,n.updateQueue=e,$i(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)Kp(a,e),a=a.sibling;return ne(nt,nt.current&1|2),ze&&Fn(n,s.treeForkCount),n.child}e=e.sibling}s.tail!==null&&Ve()>Qi&&(n.flags|=128,d=!0,is(s,!1),n.lanes=4194304)}else{if(!d)if(e=Mi(p),e!==null){if(n.flags|=128,d=!0,e=e.updateQueue,n.updateQueue=e,$i(n,e),is(s,!0),s.tail===null&&s.tailMode==="hidden"&&!p.alternate&&!ze)return Xe(n),null}else 2*Ve()-s.renderingStartTime>Qi&&a!==536870912&&(n.flags|=128,d=!0,is(s,!1),n.lanes=4194304);s.isBackwards?(p.sibling=n.child,n.child=p):(e=s.last,e!==null?e.sibling=p:n.child=p,s.last=p)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Ve(),e.sibling=null,a=nt.current,ne(nt,d?a&1|2:a&1),ze&&Fn(n,s.treeForkCount),e):(Xe(n),null);case 22:case 23:return Kt(n),Su(),s=n.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(n.flags|=8192):s&&(n.flags|=8192),s?(a&536870912)!==0&&(n.flags&128)===0&&(Xe(n),n.subtreeFlags&6&&(n.flags|=8192)):Xe(n),a=n.updateQueue,a!==null&&$i(n,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),s=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(s=n.memoizedState.cachePool.pool),s!==a&&(n.flags|=2048),e!==null&&W(ra),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),Yn(ot),Xe(n),null;case 25:return null;case 30:return null}throw Error(i(156,n.tag))}function Mk(e,n){switch(lu(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Yn(ot),ie(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return pe(n),null;case 31:if(n.memoizedState!==null){if(Kt(n),n.alternate===null)throw Error(i(340));ea()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(Kt(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(i(340));ea()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return W(nt),null;case 4:return ie(),null;case 10:return Yn(n.type),null;case 22:case 23:return Kt(n),Su(),e!==null&&W(ra),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 yg(e,n){switch(lu(n),n.tag){case 3:Yn(ot),ie();break;case 26:case 27:case 5:pe(n);break;case 4:ie();break;case 31:n.memoizedState!==null&&Kt(n);break;case 13:Kt(n);break;case 19:W(nt);break;case 10:Yn(n.type);break;case 22:case 23:Kt(n),Su(),e!==null&&W(ra);break;case 24:Yn(ot)}}function ls(e,n){try{var a=n.updateQueue,s=a!==null?a.lastEffect:null;if(s!==null){var d=s.next;a=d;do{if((a.tag&e)===e){s=void 0;var p=a.create,w=a.inst;s=p(),w.destroy=s}a=a.next}while(a!==d)}}catch(_){qe(n,n.return,_)}}function kr(e,n,a){try{var s=n.updateQueue,d=s!==null?s.lastEffect:null;if(d!==null){var p=d.next;s=p;do{if((s.tag&e)===e){var w=s.inst,_=w.destroy;if(_!==void 0){w.destroy=void 0,d=n;var z=a,$=_;try{$()}catch(te){qe(d,z,te)}}}s=s.next}while(s!==p)}}catch(te){qe(n,n.return,te)}}function bg(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{ch(n,a)}catch(s){qe(e,e.return,s)}}}function wg(e,n,a){a.props=la(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(s){qe(e,n,s)}}function cs(e,n){try{var a=e.ref;if(a!==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 a=="function"?e.refCleanup=a(s):a.current=s}}catch(d){qe(e,n,d)}}function _n(e,n){var a=e.ref,s=e.refCleanup;if(a!==null)if(typeof s=="function")try{s()}catch(d){qe(e,n,d)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(d){qe(e,n,d)}else a.current=null}function xg(e){var n=e.type,a=e.memoizedProps,s=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&s.focus();break e;case"img":a.src?s.src=a.src:a.srcSet&&(s.srcset=a.srcSet)}}catch(d){qe(e,e.return,d)}}function td(e,n,a){try{var s=e.stateNode;n2(s,e.type,a,n),s[At]=n}catch(d){qe(e,e.return,d)}}function kg(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&_r(e.type)||e.tag===4}function nd(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||kg(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&&_r(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 rd(e,n,a){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(e),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=In));else if(s!==4&&(s===27&&_r(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(rd(e,n,a),e=e.sibling;e!==null;)rd(e,n,a),e=e.sibling}function Vi(e,n,a){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?a.insertBefore(e,n):a.appendChild(e);else if(s!==4&&(s===27&&_r(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Vi(e,n,a),e=e.sibling;e!==null;)Vi(e,n,a),e=e.sibling}function Sg(e){var n=e.stateNode,a=e.memoizedProps;try{for(var s=e.type,d=n.attributes;d.length;)n.removeAttributeNode(d[0]);yt(n,s,a),n[pt]=e,n[At]=a}catch(p){qe(e,e.return,p)}}var Zn=!1,lt=!1,ad=!1,Eg=typeof WeakSet=="function"?WeakSet:Set,ft=null;function Lk(e,n){if(e=e.containerInfo,Cd=hl,e=zp(e),Zc(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var s=a.getSelection&&a.getSelection();if(s&&s.rangeCount!==0){a=s.anchorNode;var d=s.anchorOffset,p=s.focusNode;s=s.focusOffset;try{a.nodeType,p.nodeType}catch{a=null;break e}var w=0,_=-1,z=-1,$=0,te=0,se=e,X=null;t:for(;;){for(var Q;se!==a||d!==0&&se.nodeType!==3||(_=w+d),se!==p||s!==0&&se.nodeType!==3||(z=w+s),se.nodeType===3&&(w+=se.nodeValue.length),(Q=se.firstChild)!==null;)X=se,se=Q;for(;;){if(se===e)break t;if(X===a&&++$===d&&(_=w),X===p&&++te===s&&(z=w),(Q=se.nextSibling)!==null)break;se=X,X=se.parentNode}se=Q}a=_===-1||z===-1?null:{start:_,end:z}}else a=null}a=a||{start:0,end:0}}else a=null;for(Td={focusedElem:e,selectionRange:a},hl=!1,ft=n;ft!==null;)if(n=ft,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,ft=e;else for(;ft!==null;){switch(n=ft,p=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(a=0;a<e.length;a++)d=e[a],d.ref.impl=d.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&p!==null){e=void 0,a=n,d=p.memoizedProps,p=p.memoizedState,s=a.stateNode;try{var ge=la(a.type,d);e=s.getSnapshotBeforeUpdate(ge,p),s.__reactInternalSnapshotBeforeUpdate=e}catch(Ee){qe(a,a.return,Ee)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)_d(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":_d(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,ft=e;break}ft=n.return}}function Cg(e,n,a){var s=a.flags;switch(a.tag){case 0:case 11:case 15:Jn(e,a),s&4&&ls(5,a);break;case 1:if(Jn(e,a),s&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(w){qe(a,a.return,w)}else{var d=la(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(d,n,e.__reactInternalSnapshotBeforeUpdate)}catch(w){qe(a,a.return,w)}}s&64&&bg(a),s&512&&cs(a,a.return);break;case 3:if(Jn(e,a),s&64&&(e=a.updateQueue,e!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{ch(e,n)}catch(w){qe(a,a.return,w)}}break;case 27:n===null&&s&4&&Sg(a);case 26:case 5:Jn(e,a),n===null&&s&4&&xg(a),s&512&&cs(a,a.return);break;case 12:Jn(e,a);break;case 31:Jn(e,a),s&4&&Ag(e,a);break;case 13:Jn(e,a),s&4&&_g(e,a),s&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=Fk.bind(null,a),u2(e,a))));break;case 22:if(s=a.memoizedState!==null||Zn,!s){n=n!==null&&n.memoizedState!==null||lt,d=Zn;var p=lt;Zn=s,(lt=n)&&!p?er(e,a,(a.subtreeFlags&8772)!==0):Jn(e,a),Zn=d,lt=p}break;case 30:break;default:Jn(e,a)}}function Tg(e){var n=e.alternate;n!==null&&(e.alternate=null,Tg(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&Mc(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,jt=!1;function Qn(e,n,a){for(a=a.child;a!==null;)Ng(e,n,a),a=a.sibling}function Ng(e,n,a){if(Ut&&typeof Ut.onCommitFiberUnmount=="function")try{Ut.onCommitFiberUnmount(Do,a)}catch{}switch(a.tag){case 26:lt||_n(a,n),Qn(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:lt||_n(a,n);var s=Ze,d=jt;_r(a.type)&&(Ze=a.stateNode,jt=!1),Qn(e,n,a),ys(a.stateNode),Ze=s,jt=d;break;case 5:lt||_n(a,n);case 6:if(s=Ze,d=jt,Ze=null,Qn(e,n,a),Ze=s,jt=d,Ze!==null)if(jt)try{(Ze.nodeType===9?Ze.body:Ze.nodeName==="HTML"?Ze.ownerDocument.body:Ze).removeChild(a.stateNode)}catch(p){qe(a,n,p)}else try{Ze.removeChild(a.stateNode)}catch(p){qe(a,n,p)}break;case 18:Ze!==null&&(jt?(e=Ze,bv(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),lo(e)):bv(Ze,a.stateNode));break;case 4:s=Ze,d=jt,Ze=a.stateNode.containerInfo,jt=!0,Qn(e,n,a),Ze=s,jt=d;break;case 0:case 11:case 14:case 15:kr(2,a,n),lt||kr(4,a,n),Qn(e,n,a);break;case 1:lt||(_n(a,n),s=a.stateNode,typeof s.componentWillUnmount=="function"&&wg(a,n,s)),Qn(e,n,a);break;case 21:Qn(e,n,a);break;case 22:lt=(s=lt)||a.memoizedState!==null,Qn(e,n,a),lt=s;break;default:Qn(e,n,a)}}function Ag(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{lo(e)}catch(a){qe(n,n.return,a)}}}function _g(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{lo(e)}catch(a){qe(n,n.return,a)}}function zk(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new Eg),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new Eg),n;default:throw Error(i(435,e.tag))}}function Gi(e,n){var a=zk(e);n.forEach(function(s){if(!a.has(s)){a.add(s);var d=Kk.bind(null,e,s);s.then(d,d)}})}function Rt(e,n){var a=n.deletions;if(a!==null)for(var s=0;s<a.length;s++){var d=a[s],p=e,w=n,_=w;e:for(;_!==null;){switch(_.tag){case 27:if(_r(_.type)){Ze=_.stateNode,jt=!1;break e}break;case 5:Ze=_.stateNode,jt=!1;break e;case 3:case 4:Ze=_.stateNode.containerInfo,jt=!0;break e}_=_.return}if(Ze===null)throw Error(i(160));Ng(p,w,d),Ze=null,jt=!1,p=d.alternate,p!==null&&(p.return=null),d.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)jg(n,e),n=n.sibling}var gn=null;function jg(e,n){var a=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Rt(n,e),Ot(e),s&4&&(kr(3,e,e.return),ls(3,e),kr(5,e,e.return));break;case 1:Rt(n,e),Ot(e),s&512&&(lt||a===null||_n(a,a.return)),s&64&&Zn&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?s:a.concat(s))));break;case 26:var d=gn;if(Rt(n,e),Ot(e),s&512&&(lt||a===null||_n(a,a.return)),s&4){var p=a!==null?a.memoizedState:null;if(s=e.memoizedState,a===null)if(s===null)if(e.stateNode===null){e:{s=e.type,a=e.memoizedProps,d=d.ownerDocument||d;t:switch(s){case"title":p=d.getElementsByTagName("title")[0],(!p||p[zo]||p[pt]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=d.createElement(s),d.head.insertBefore(p,d.querySelector("head > title"))),yt(p,s,a),p[pt]=e,dt(p),s=p;break e;case"link":var w=jv("link","href",d).get(s+(a.href||""));if(w){for(var _=0;_<w.length;_++)if(p=w[_],p.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&p.getAttribute("rel")===(a.rel==null?null:a.rel)&&p.getAttribute("title")===(a.title==null?null:a.title)&&p.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){w.splice(_,1);break t}}p=d.createElement(s),yt(p,s,a),d.head.appendChild(p);break;case"meta":if(w=jv("meta","content",d).get(s+(a.content||""))){for(_=0;_<w.length;_++)if(p=w[_],p.getAttribute("content")===(a.content==null?null:""+a.content)&&p.getAttribute("name")===(a.name==null?null:a.name)&&p.getAttribute("property")===(a.property==null?null:a.property)&&p.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&p.getAttribute("charset")===(a.charSet==null?null:a.charSet)){w.splice(_,1);break t}}p=d.createElement(s),yt(p,s,a),d.head.appendChild(p);break;default:throw Error(i(468,s))}p[pt]=e,dt(p),s=p}e.stateNode=s}else Rv(d,e.type,e.stateNode);else e.stateNode=_v(d,s,e.memoizedProps);else p!==s?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,s===null?Rv(d,e.type,e.stateNode):_v(d,s,e.memoizedProps)):s===null&&e.stateNode!==null&&td(e,e.memoizedProps,a.memoizedProps)}break;case 27:Rt(n,e),Ot(e),s&512&&(lt||a===null||_n(a,a.return)),a!==null&&s&4&&td(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Rt(n,e),Ot(e),s&512&&(lt||a===null||_n(a,a.return)),e.flags&32){d=e.stateNode;try{Ra(d,"")}catch(ge){qe(e,e.return,ge)}}s&4&&e.stateNode!=null&&(d=e.memoizedProps,td(e,d,a!==null?a.memoizedProps:d)),s&1024&&(ad=!0);break;case 6:if(Rt(n,e),Ot(e),s&4){if(e.stateNode===null)throw Error(i(162));s=e.memoizedProps,a=e.stateNode;try{a.nodeValue=s}catch(ge){qe(e,e.return,ge)}}break;case 3:if(dl=null,d=gn,gn=cl(n.containerInfo),Rt(n,e),gn=d,Ot(e),s&4&&a!==null&&a.memoizedState.isDehydrated)try{lo(n.containerInfo)}catch(ge){qe(e,e.return,ge)}ad&&(ad=!1,Rg(e));break;case 4:s=gn,gn=cl(e.stateNode.containerInfo),Rt(n,e),Ot(e),gn=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,Gi(e,s)));break;case 13:Rt(n,e),Ot(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Zi=Ve()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Gi(e,s)));break;case 22:d=e.memoizedState!==null;var z=a!==null&&a.memoizedState!==null,$=Zn,te=lt;if(Zn=$||d,lt=te||z,Rt(n,e),lt=te,Zn=$,Ot(e),s&8192)e:for(n=e.stateNode,n._visibility=d?n._visibility&-2:n._visibility|1,d&&(a===null||z||Zn||lt||ca(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){z=a=n;try{if(p=z.stateNode,d)w=p.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{_=z.stateNode;var se=z.memoizedProps.style,X=se!=null&&se.hasOwnProperty("display")?se.display:null;_.style.display=X==null||typeof X=="boolean"?"":(""+X).trim()}}catch(ge){qe(z,z.return,ge)}}}else if(n.tag===6){if(a===null){z=n;try{z.stateNode.nodeValue=d?"":z.memoizedProps}catch(ge){qe(z,z.return,ge)}}}else if(n.tag===18){if(a===null){z=n;try{var Q=z.stateNode;d?wv(Q,!0):wv(z.stateNode,!1)}catch(ge){qe(z,z.return,ge)}}}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;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}s&4&&(s=e.updateQueue,s!==null&&(a=s.retryQueue,a!==null&&(s.retryQueue=null,Gi(e,a))));break;case 19:Rt(n,e),Ot(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Gi(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 a,s=e.return;s!==null;){if(kg(s)){a=s;break}s=s.return}if(a==null)throw Error(i(160));switch(a.tag){case 27:var d=a.stateNode,p=nd(e);Vi(e,p,d);break;case 5:var w=a.stateNode;a.flags&32&&(Ra(w,""),a.flags&=-33);var _=nd(e);Vi(e,_,w);break;case 3:case 4:var z=a.stateNode.containerInfo,$=nd(e);rd(e,$,z);break;default:throw Error(i(161))}}catch(te){qe(e,e.return,te)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Rg(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Rg(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;)Cg(e,n.alternate,n),n=n.sibling}function ca(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:kr(4,n,n.return),ca(n);break;case 1:_n(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&wg(n,n.return,a),ca(n);break;case 27:ys(n.stateNode);case 26:case 5:_n(n,n.return),ca(n);break;case 22:n.memoizedState===null&&ca(n);break;case 30:ca(n);break;default:ca(n)}e=e.sibling}}function er(e,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var s=n.alternate,d=e,p=n,w=p.flags;switch(p.tag){case 0:case 11:case 15:er(d,p,a),ls(4,p);break;case 1:if(er(d,p,a),s=p,d=s.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch($){qe(s,s.return,$)}if(s=p,d=s.updateQueue,d!==null){var _=s.stateNode;try{var z=d.shared.hiddenCallbacks;if(z!==null)for(d.shared.hiddenCallbacks=null,d=0;d<z.length;d++)lh(z[d],_)}catch($){qe(s,s.return,$)}}a&&w&64&&bg(p),cs(p,p.return);break;case 27:Sg(p);case 26:case 5:er(d,p,a),a&&s===null&&w&4&&xg(p),cs(p,p.return);break;case 12:er(d,p,a);break;case 31:er(d,p,a),a&&w&4&&Ag(d,p);break;case 13:er(d,p,a),a&&w&4&&_g(d,p);break;case 22:p.memoizedState===null&&er(d,p,a),cs(p,p.return);break;case 30:break;default:er(d,p,a)}n=n.sibling}}function od(e,n){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&Go(a))}function sd(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Go(e))}function vn(e,n,a,s){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Og(e,n,a,s),n=n.sibling}function Og(e,n,a,s){var d=n.flags;switch(n.tag){case 0:case 11:case 15:vn(e,n,a,s),d&2048&&ls(9,n);break;case 1:vn(e,n,a,s);break;case 3:vn(e,n,a,s),d&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Go(e)));break;case 12:if(d&2048){vn(e,n,a,s),e=n.stateNode;try{var p=n.memoizedProps,w=p.id,_=p.onPostCommit;typeof _=="function"&&_(w,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(z){qe(n,n.return,z)}}else vn(e,n,a,s);break;case 31:vn(e,n,a,s);break;case 13:vn(e,n,a,s);break;case 23:break;case 22:p=n.stateNode,w=n.alternate,n.memoizedState!==null?p._visibility&2?vn(e,n,a,s):us(e,n):p._visibility&2?vn(e,n,a,s):(p._visibility|=2,Za(e,n,a,s,(n.subtreeFlags&10256)!==0||!1)),d&2048&&od(w,n);break;case 24:vn(e,n,a,s),d&2048&&sd(n.alternate,n);break;default:vn(e,n,a,s)}}function Za(e,n,a,s,d){for(d=d&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var p=e,w=n,_=a,z=s,$=w.flags;switch(w.tag){case 0:case 11:case 15:Za(p,w,_,z,d),ls(8,w);break;case 23:break;case 22:var te=w.stateNode;w.memoizedState!==null?te._visibility&2?Za(p,w,_,z,d):us(p,w):(te._visibility|=2,Za(p,w,_,z,d)),d&&$&2048&&od(w.alternate,w);break;case 24:Za(p,w,_,z,d),d&&$&2048&&sd(w.alternate,w);break;default:Za(p,w,_,z,d)}n=n.sibling}}function us(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=e,s=n,d=s.flags;switch(s.tag){case 22:us(a,s),d&2048&&od(s.alternate,s);break;case 24:us(a,s),d&2048&&sd(s.alternate,s);break;default:us(a,s)}n=n.sibling}}var ds=8192;function Qa(e,n,a){if(e.subtreeFlags&ds)for(e=e.child;e!==null;)Dg(e,n,a),e=e.sibling}function Dg(e,n,a){switch(e.tag){case 26:Qa(e,n,a),e.flags&ds&&e.memoizedState!==null&&k2(a,gn,e.memoizedState,e.memoizedProps);break;case 5:Qa(e,n,a);break;case 3:case 4:var s=gn;gn=cl(e.stateNode.containerInfo),Qa(e,n,a),gn=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=ds,ds=16777216,Qa(e,n,a),ds=s):Qa(e,n,a));break;default:Qa(e,n,a)}}function Mg(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 fs(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var s=n[a];ft=s,zg(s,e)}Mg(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Lg(e),e=e.sibling}function Lg(e){switch(e.tag){case 0:case 11:case 15:fs(e),e.flags&2048&&kr(9,e,e.return);break;case 3:fs(e);break;case 12:fs(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,Xi(e)):fs(e);break;default:fs(e)}}function Xi(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var s=n[a];ft=s,zg(s,e)}Mg(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:kr(8,n,n.return),Xi(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,Xi(n));break;default:Xi(n)}e=e.sibling}}function zg(e,n){for(;ft!==null;){var a=ft;switch(a.tag){case 0:case 11:case 15:kr(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var s=a.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:Go(a.memoizedState.cache)}if(s=a.child,s!==null)s.return=a,ft=s;else e:for(a=e;ft!==null;){s=ft;var d=s.sibling,p=s.return;if(Tg(s),s===a){ft=null;break e}if(d!==null){d.return=p,ft=d;break e}ft=p}}}var Hk={getCacheForType:function(e){var n=gt(ot),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return gt(ot).controller.signal}},Bk=typeof WeakMap=="function"?WeakMap:Map,Ue=0,Ye=null,Oe=null,Me=0,Ie=0,Yt=null,Sr=!1,Ja=!1,id=!1,tr=0,tt=0,Er=0,ua=0,ld=0,$t=0,eo=0,ms=null,Dt=null,cd=!1,Zi=0,Hg=0,Qi=1/0,Ji=null,Cr=null,ct=0,Tr=null,to=null,nr=0,ud=0,dd=null,Bg=null,ps=0,fd=null;function Vt(){return(Ue&2)!==0&&Me!==0?Me&-Me:M.T!==null?yd():ep()}function Wg(){if($t===0)if((Me&536870912)===0||ze){var e=ii;ii<<=1,(ii&3932160)===0&&(ii=262144),$t=e}else $t=536870912;return e=Ft.current,e!==null&&(e.flags|=32),$t}function Mt(e,n,a){(e===Ye&&(Ie===2||Ie===9)||e.cancelPendingCommit!==null)&&(no(e,0),Nr(e,Me,$t,!1)),Lo(e,a),((Ue&2)===0||e!==Ye)&&(e===Ye&&((Ue&2)===0&&(ua|=a),tt===4&&Nr(e,Me,$t,!1)),jn(e))}function Ug(e,n,a){if((Ue&6)!==0)throw Error(i(327));var s=!a&&(n&127)===0&&(n&e.expiredLanes)===0||Mo(e,n),d=s?Ik(e,n):pd(e,n,!0),p=s;do{if(d===0){Ja&&!s&&Nr(e,n,0,!1);break}else{if(a=e.current.alternate,p&&!Wk(a)){d=pd(e,n,!1),p=!1;continue}if(d===2){if(p=n,e.errorRecoveryDisabledLanes&p)var w=0;else w=e.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){n=w;e:{var _=e;d=ms;var z=_.current.memoizedState.isDehydrated;if(z&&(no(_,w).flags|=256),w=pd(_,w,!1),w!==2){if(id&&!z){_.errorRecoveryDisabledLanes|=p,ua|=p,d=4;break e}p=Dt,Dt=d,p!==null&&(Dt===null?Dt=p:Dt.push.apply(Dt,p))}d=w}if(p=!1,d!==2)continue}}if(d===1){no(e,0),Nr(e,n,0,!0);break}e:{switch(s=e,p=d,p){case 0:case 1:throw Error(i(345));case 4:if((n&4194048)!==n)break;case 6:Nr(s,n,$t,!Sr);break e;case 2:Dt=null;break;case 3:case 5:break;default:throw Error(i(329))}if((n&62914560)===n&&(d=Zi+300-Ve(),10<d)){if(Nr(s,n,$t,!Sr),ci(s,0,!0)!==0)break e;nr=n,s.timeoutHandle=vv(Ig.bind(null,s,a,Dt,Ji,cd,n,$t,ua,eo,Sr,p,"Throttled",-0,0),d);break e}Ig(s,a,Dt,Ji,cd,n,$t,ua,eo,Sr,p,null,-0,0)}}break}while(!0);jn(e)}function Ig(e,n,a,s,d,p,w,_,z,$,te,se,X,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},Dg(n,p,se);var ge=(p&62914560)===p?Zi-Ve():(p&4194048)===p?Hg-Ve():0;if(ge=S2(se,ge),ge!==null){nr=p,e.cancelPendingCommit=ge(Gg.bind(null,e,n,p,a,s,d,w,_,z,te,se,null,X,Q)),Nr(e,p,w,!$);return}}Gg(e,n,p,a,s,d,w,_,z)}function Wk(e){for(var n=e;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var s=0;s<a.length;s++){var d=a[s],p=d.getSnapshot;d=d.value;try{if(!qt(p(),d))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;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 Nr(e,n,a,s){n&=~ld,n&=~ua,e.suspendedLanes|=n,e.pingedLanes&=~n,s&&(e.warmLanes|=n),s=e.expirationTimes;for(var d=n;0<d;){var p=31-It(d),w=1<<p;s[p]=-1,d&=~w}a!==0&&Zm(e,a,n)}function el(){return(Ue&6)===0?(hs(0),!1):!0}function md(){if(Oe!==null){if(Ie===0)var e=Oe.return;else e=Oe,Kn=ta=null,_u(e),Ya=null,Zo=0,e=Oe;for(;e!==null;)yg(e.alternate,e),e=e.return;Oe=null}}function no(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,o2(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),nr=0,md(),Ye=e,Oe=a=Pn(e.current,null),Me=n,Ie=0,Yt=null,Sr=!1,Ja=Mo(e,n),id=!1,eo=$t=ld=ua=Er=tt=0,Dt=ms=null,cd=!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-It(s),p=1<<d;n|=e[d],s&=~p}return tr=n,xi(),a}function qg(e,n){je=null,M.H=os,n===Ka||n===_i?(n=ah(),Ie=3):n===vu?(n=ah(),Ie=4):Ie=n===Ku?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,Yt=n,Oe===null&&(tt=1,Pi(e,on(n,e.current)))}function Pg(){var e=Ft.current;return e===null?!0:(Me&4194048)===Me?un===null:(Me&62914560)===Me||(Me&536870912)!==0?e===un:!1}function Fg(){var e=M.H;return M.H=os,e===null?os:e}function Kg(){var e=M.A;return M.A=Hk,e}function tl(){tt=4,Sr||(Me&4194048)!==Me&&Ft.current!==null||(Ja=!0),(Er&134217727)===0&&(ua&134217727)===0||Ye===null||Nr(Ye,Me,$t,!1)}function pd(e,n,a){var s=Ue;Ue|=2;var d=Fg(),p=Kg();(Ye!==e||Me!==n)&&(Ji=null,no(e,n)),n=!1;var w=tt;e:do try{if(Ie!==0&&Oe!==null){var _=Oe,z=Yt;switch(Ie){case 8:md(),w=6;break e;case 3:case 2:case 9:case 6:Ft.current===null&&(n=!0);var $=Ie;if(Ie=0,Yt=null,ro(e,_,z,$),a&&Ja){w=0;break e}break;default:$=Ie,Ie=0,Yt=null,ro(e,_,z,$)}}Uk(),w=tt;break}catch(te){qg(e,te)}while(!0);return n&&e.shellSuspendCounter++,Kn=ta=null,Ue=s,M.H=d,M.A=p,Oe===null&&(Ye=null,Me=0,xi()),w}function Uk(){for(;Oe!==null;)Yg(Oe)}function Ik(e,n){var a=Ue;Ue|=2;var s=Fg(),d=Kg();Ye!==e||Me!==n?(Ji=null,Qi=Ve()+500,no(e,n)):Ja=Mo(e,n);e:do try{if(Ie!==0&&Oe!==null){n=Oe;var p=Yt;t:switch(Ie){case 1:Ie=0,Yt=null,ro(e,n,p,1);break;case 2:case 9:if(nh(p)){Ie=0,Yt=null,$g(n);break}n=function(){Ie!==2&&Ie!==9||Ye!==e||(Ie=7),jn(e)},p.then(n,n);break e;case 3:Ie=7;break e;case 4:Ie=5;break e;case 7:nh(p)?(Ie=0,Yt=null,$g(n)):(Ie=0,Yt=null,ro(e,n,p,7));break;case 5:var w=null;switch(Oe.tag){case 26:w=Oe.memoizedState;case 5:case 27:var _=Oe;if(w?Ov(w):_.stateNode.complete){Ie=0,Yt=null;var z=_.sibling;if(z!==null)Oe=z;else{var $=_.return;$!==null?(Oe=$,nl($)):Oe=null}break t}}Ie=0,Yt=null,ro(e,n,p,5);break;case 6:Ie=0,Yt=null,ro(e,n,p,6);break;case 8:md(),tt=6;break e;default:throw Error(i(462))}}qk();break}catch(te){qg(e,te)}while(!0);return Kn=ta=null,M.H=s,M.A=d,Ue=a,Oe!==null?0:(Ye=null,Me=0,xi(),tt)}function qk(){for(;Oe!==null&&!de();)Yg(Oe)}function Yg(e){var n=gg(e.alternate,e,tr);e.memoizedProps=e.pendingProps,n===null?nl(e):Oe=n}function $g(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=ug(a,n,n.pendingProps,n.type,void 0,Me);break;case 11:n=ug(a,n,n.pendingProps,n.type.render,n.ref,Me);break;case 5:_u(n);default:yg(a,n),n=Oe=Kp(n,tr),n=gg(a,n,tr)}e.memoizedProps=e.pendingProps,n===null?nl(e):Oe=n}function ro(e,n,a,s){Kn=ta=null,_u(n),Ya=null,Zo=0;var d=n.return;try{if(jk(e,d,n,a,Me)){tt=1,Pi(e,on(a,e.current)),Oe=null;return}}catch(p){if(d!==null)throw Oe=d,p;tt=1,Pi(e,on(a,e.current)),Oe=null;return}n.flags&32768?(ze||s===1?e=!0:Ja||(Me&536870912)!==0?e=!1:(Sr=e=!0,(s===2||s===9||s===3||s===6)&&(s=Ft.current,s!==null&&s.tag===13&&(s.flags|=16384))),Vg(n,e)):nl(n)}function nl(e){var n=e;do{if((n.flags&32768)!==0){Vg(n,Sr);return}e=n.return;var a=Dk(n.alternate,n,tr);if(a!==null){Oe=a;return}if(n=n.sibling,n!==null){Oe=n;return}Oe=n=e}while(n!==null);tt===0&&(tt=5)}function Vg(e,n){do{var a=Mk(e.alternate,e);if(a!==null){a.flags&=32767,Oe=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){Oe=e;return}Oe=e=a}while(e!==null);tt=6,Oe=null}function Gg(e,n,a,s,d,p,w,_,z){e.cancelPendingCommit=null;do rl();while(ct!==0);if((Ue&6)!==0)throw Error(i(327));if(n!==null){if(n===e.current)throw Error(i(177));if(p=n.lanes|n.childLanes,p|=nu,x1(e,a,p,w,_,z),e===Ye&&(Oe=Ye=null,Me=0),to=n,Tr=e,nr=a,ud=p,dd=d,Bg=s,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Yk(be,function(){return ev(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||s){s=M.T,M.T=null,d=q.p,q.p=2,w=Ue,Ue|=4;try{Lk(e,n,a)}finally{Ue=w,q.p=d,M.T=s}}ct=1,Xg(),Zg(),Qg()}}function Xg(){if(ct===1){ct=0;var e=Tr,n=to,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=M.T,M.T=null;var s=q.p;q.p=2;var d=Ue;Ue|=4;try{jg(n,e);var p=Td,w=zp(e.containerInfo),_=p.focusedElem,z=p.selectionRange;if(w!==_&&_&&_.ownerDocument&&Lp(_.ownerDocument.documentElement,_)){if(z!==null&&Zc(_)){var $=z.start,te=z.end;if(te===void 0&&(te=$),"selectionStart"in _)_.selectionStart=$,_.selectionEnd=Math.min(te,_.value.length);else{var se=_.ownerDocument||document,X=se&&se.defaultView||window;if(X.getSelection){var Q=X.getSelection(),ge=_.textContent.length,Ee=Math.min(z.start,ge),Ke=z.end===void 0?Ee:Math.min(z.end,ge);!Q.extend&&Ee>Ke&&(w=Ke,Ke=Ee,Ee=w);var U=Mp(_,Ee),H=Mp(_,Ke);if(U&&H&&(Q.rangeCount!==1||Q.anchorNode!==U.node||Q.anchorOffset!==U.offset||Q.focusNode!==H.node||Q.focusOffset!==H.offset)){var K=se.createRange();K.setStart(U.node,U.offset),Q.removeAllRanges(),Ee>Ke?(Q.addRange(K),Q.extend(H.node,H.offset)):(K.setEnd(H.node,H.offset),Q.addRange(K))}}}}for(se=[],Q=_;Q=Q.parentNode;)Q.nodeType===1&&se.push({element:Q,left:Q.scrollLeft,top:Q.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_<se.length;_++){var oe=se[_];oe.element.scrollLeft=oe.left,oe.element.scrollTop=oe.top}}hl=!!Cd,Td=Cd=null}finally{Ue=d,q.p=s,M.T=a}}e.current=n,ct=2}}function Zg(){if(ct===2){ct=0;var e=Tr,n=to,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=M.T,M.T=null;var s=q.p;q.p=2;var d=Ue;Ue|=4;try{Cg(e,n.alternate,n)}finally{Ue=d,q.p=s,M.T=a}}ct=3}}function Qg(){if(ct===4||ct===3){ct=0,Te();var e=Tr,n=to,a=nr,s=Bg;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?ct=5:(ct=0,to=Tr=null,Jg(e,e.pendingLanes));var d=e.pendingLanes;if(d===0&&(Cr=null),Oc(a),n=n.stateNode,Ut&&typeof Ut.onCommitFiberRoot=="function")try{Ut.onCommitFiberRoot(Do,n,void 0,(n.current.flags&128)===128)}catch{}if(s!==null){n=M.T,d=q.p,q.p=2,M.T=null;try{for(var p=e.onRecoverableError,w=0;w<s.length;w++){var _=s[w];p(_.value,{componentStack:_.stack})}}finally{M.T=n,q.p=d}}(nr&3)!==0&&rl(),jn(e),d=e.pendingLanes,(a&261930)!==0&&(d&42)!==0?e===fd?ps++:(ps=0,fd=e):ps=0,hs(0)}}function Jg(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,Go(n)))}function rl(){return Xg(),Zg(),Qg(),ev()}function ev(){if(ct!==5)return!1;var e=Tr,n=ud;ud=0;var a=Oc(nr),s=M.T,d=q.p;try{q.p=32>a?32:a,M.T=null,a=dd,dd=null;var p=Tr,w=nr;if(ct=0,to=Tr=null,nr=0,(Ue&6)!==0)throw Error(i(331));var _=Ue;if(Ue|=4,Lg(p.current),Og(p,p.current,w,a),Ue=_,hs(0,!1),Ut&&typeof Ut.onPostCommitFiberRoot=="function")try{Ut.onPostCommitFiberRoot(Do,p)}catch{}return!0}finally{q.p=d,M.T=s,Jg(e,n)}}function tv(e,n,a){n=on(a,n),n=Fu(e.stateNode,n,2),e=br(e,n,2),e!==null&&(Lo(e,2),jn(e))}function qe(e,n,a){if(e.tag===3)tv(e,e,a);else for(;n!==null;){if(n.tag===3){tv(n,e,a);break}else if(n.tag===1){var s=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Cr===null||!Cr.has(s))){e=on(a,e),a=ng(2),s=br(n,a,2),s!==null&&(rg(a,s,n,e),Lo(s,2),jn(s));break}}n=n.return}}function hd(e,n,a){var s=e.pingCache;if(s===null){s=e.pingCache=new Bk;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(a)||(id=!0,d.add(a),e=Pk.bind(null,e,n,a),n.then(e,e))}function Pk(e,n,a){var s=e.pingCache;s!==null&&s.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Ye===e&&(Me&a)===a&&(tt===4||tt===3&&(Me&62914560)===Me&&300>Ve()-Zi?(Ue&2)===0&&no(e,0):ld|=a,eo===Me&&(eo=0)),jn(e)}function nv(e,n){n===0&&(n=Xm()),e=Qr(e,n),e!==null&&(Lo(e,n),jn(e))}function Fk(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),nv(e,a)}function Kk(e,n){var a=0;switch(e.tag){case 31:case 13:var s=e.stateNode,d=e.memoizedState;d!==null&&(a=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),nv(e,a)}function Yk(e,n){return Tn(e,n)}var al=null,ao=null,gd=!1,ol=!1,vd=!1,Ar=0;function jn(e){e!==ao&&e.next===null&&(ao===null?al=ao=e:ao=ao.next=e),ol=!0,gd||(gd=!0,Vk())}function hs(e,n){if(!vd&&ol){vd=!0;do for(var a=!1,s=al;s!==null;){if(e!==0){var d=s.pendingLanes;if(d===0)var p=0;else{var w=s.suspendedLanes,_=s.pingedLanes;p=(1<<31-It(42|e)+1)-1,p&=d&~(w&~_),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,sv(s,p))}else p=Me,p=ci(s,s===Ye?p:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(p&3)===0||Mo(s,p)||(a=!0,sv(s,p));s=s.next}while(a);vd=!1}}function $k(){rv()}function rv(){ol=gd=!1;var e=0;Ar!==0&&a2()&&(e=Ar);for(var n=Ve(),a=null,s=al;s!==null;){var d=s.next,p=av(s,n);p===0?(s.next=null,a===null?al=d:a.next=d,d===null&&(ao=a)):(a=s,(e!==0||(p&3)!==0)&&(ol=!0)),s=d}ct!==0&&ct!==5||hs(e),Ar!==0&&(Ar=0)}function av(e,n){for(var a=e.suspendedLanes,s=e.pingedLanes,d=e.expirationTimes,p=e.pendingLanes&-62914561;0<p;){var w=31-It(p),_=1<<w,z=d[w];z===-1?((_&a)===0||(_&s)!==0)&&(d[w]=w1(_,n)):z<=n&&(e.expiredLanes|=_),p&=~_}if(n=Ye,a=Me,a=ci(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,a===0||e===n&&(Ie===2||Ie===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&tn(s),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Mo(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(s!==null&&tn(s),Oc(a)){case 2:case 8:a=Oo;break;case 32:a=be;break;case 268435456:a=ut;break;default:a=be}return s=ov.bind(null,e),a=Tn(a,s),e.callbackPriority=n,e.callbackNode=a,n}return s!==null&&s!==null&&tn(s),e.callbackPriority=2,e.callbackNode=null,2}function ov(e,n){if(ct!==0&&ct!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(rl()&&e.callbackNode!==a)return null;var s=Me;return s=ci(e,e===Ye?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(Ug(e,s,n),av(e,Ve()),e.callbackNode!=null&&e.callbackNode===a?ov.bind(null,e):null)}function sv(e,n){if(rl())return null;Ug(e,n,!0)}function Vk(){s2(function(){(Ue&6)!==0?Tn(Ro,$k):rv()})}function yd(){if(Ar===0){var e=Pa;e===0&&(e=si,si<<=1,(si&261888)===0&&(si=256)),Ar=e}return Ar}function iv(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:mi(""+e)}function lv(e,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,e.id&&a.setAttribute("form",e.id),n.parentNode.insertBefore(a,n),e=new FormData(e),a.parentNode.removeChild(a),e}function Gk(e,n,a,s,d){if(n==="submit"&&a&&a.stateNode===d){var p=iv((d[At]||null).action),w=s.submitter;w&&(n=(n=w[At]||null)?iv(n.formAction):w.getAttribute("formAction"),n!==null&&(p=n,w=null));var _=new vi("action","action",null,s,d);e.push({event:_,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Ar!==0){var z=w?lv(d,w):new FormData(d);Bu(a,{pending:!0,data:z,method:d.method,action:p},null,z)}}else typeof p=="function"&&(_.preventDefault(),z=w?lv(d,w):new FormData(d),Bu(a,{pending:!0,data:z,method:d.method,action:p},p,z))},currentTarget:d}]})}}for(var bd=0;bd<tu.length;bd++){var wd=tu[bd],Xk=wd.toLowerCase(),Zk=wd[0].toUpperCase()+wd.slice(1);hn(Xk,"on"+Zk)}hn(Wp,"onAnimationEnd"),hn(Up,"onAnimationIteration"),hn(Ip,"onAnimationStart"),hn("dblclick","onDoubleClick"),hn("focusin","onFocus"),hn("focusout","onBlur"),hn(mk,"onTransitionRun"),hn(pk,"onTransitionStart"),hn(hk,"onTransitionCancel"),hn(qp,"onTransitionEnd"),_a("onMouseEnter",["mouseout","mouseover"]),_a("onMouseLeave",["mouseout","mouseover"]),_a("onPointerEnter",["pointerout","pointerover"]),_a("onPointerLeave",["pointerout","pointerover"]),Vr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Vr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Vr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Vr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Vr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Vr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var gs="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(" "),Qk=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(gs));function cv(e,n){n=(n&4)!==0;for(var a=0;a<e.length;a++){var s=e[a],d=s.event;s=s.listeners;e:{var p=void 0;if(n)for(var w=s.length-1;0<=w;w--){var _=s[w],z=_.instance,$=_.currentTarget;if(_=_.listener,z!==p&&d.isPropagationStopped())break e;p=_,d.currentTarget=$;try{p(d)}catch(te){wi(te)}d.currentTarget=null,p=z}else for(w=0;w<s.length;w++){if(_=s[w],z=_.instance,$=_.currentTarget,_=_.listener,z!==p&&d.isPropagationStopped())break e;p=_,d.currentTarget=$;try{p(d)}catch(te){wi(te)}d.currentTarget=null,p=z}}}}function De(e,n){var a=n[Dc];a===void 0&&(a=n[Dc]=new Set);var s=e+"__bubble";a.has(s)||(uv(n,e,2,!1),a.add(s))}function xd(e,n,a){var s=0;n&&(s|=4),uv(a,e,s,n)}var sl="_reactListening"+Math.random().toString(36).slice(2);function kd(e){if(!e[sl]){e[sl]=!0,rp.forEach(function(a){a!=="selectionchange"&&(Qk.has(a)||xd(a,!1,e),xd(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[sl]||(n[sl]=!0,xd("selectionchange",!1,n))}}function uv(e,n,a,s){switch(Wv(n)){case 2:var d=T2;break;case 8:d=N2;break;default:d=Hd}a=d.bind(null,n,a,e),d=void 0,!qc||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(d=!0),s?d!==void 0?e.addEventListener(n,a,{capture:!0,passive:d}):e.addEventListener(n,a,!0):d!==void 0?e.addEventListener(n,a,{passive:d}):e.addEventListener(n,a,!1)}function Sd(e,n,a,s,d){var p=s;if((n&1)===0&&(n&2)===0&&s!==null)e:for(;;){if(s===null)return;var w=s.tag;if(w===3||w===4){var _=s.stateNode.containerInfo;if(_===d)break;if(w===4)for(w=s.return;w!==null;){var z=w.tag;if((z===3||z===4)&&w.stateNode.containerInfo===d)return;w=w.return}for(;_!==null;){if(w=Ta(_),w===null)return;if(z=w.tag,z===5||z===6||z===26||z===27){s=p=w;continue e}_=_.parentNode}}s=s.return}hp(function(){var $=p,te=Uc(a),se=[];e:{var X=Pp.get(e);if(X!==void 0){var Q=vi,ge=e;switch(e){case"keypress":if(hi(a)===0)break e;case"keydown":case"keyup":Q=K1;break;case"focusin":ge="focus",Q=Yc;break;case"focusout":ge="blur",Q=Yc;break;case"beforeblur":case"afterblur":Q=Yc;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Q=yp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Q=D1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Q=V1;break;case Wp:case Up:case Ip:Q=z1;break;case qp:Q=X1;break;case"scroll":case"scrollend":Q=R1;break;case"wheel":Q=Q1;break;case"copy":case"cut":case"paste":Q=B1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Q=wp;break;case"toggle":case"beforetoggle":Q=ek}var Ee=(n&4)!==0,Ke=!Ee&&(e==="scroll"||e==="scrollend"),U=Ee?X!==null?X+"Capture":null:X;Ee=[];for(var H=$,K;H!==null;){var oe=H;if(K=oe.stateNode,oe=oe.tag,oe!==5&&oe!==26&&oe!==27||K===null||U===null||(oe=Bo(H,U),oe!=null&&Ee.push(vs(H,oe,K))),Ke)break;H=H.return}0<Ee.length&&(X=new Q(X,ge,null,a,te),se.push({event:X,listeners:Ee}))}}if((n&7)===0){e:{if(X=e==="mouseover"||e==="pointerover",Q=e==="mouseout"||e==="pointerout",X&&a!==Wc&&(ge=a.relatedTarget||a.fromElement)&&(Ta(ge)||ge[Ca]))break e;if((Q||X)&&(X=te.window===te?te:(X=te.ownerDocument)?X.defaultView||X.parentWindow:window,Q?(ge=a.relatedTarget||a.toElement,Q=$,ge=ge?Ta(ge):null,ge!==null&&(Ke=u(ge),Ee=ge.tag,ge!==Ke||Ee!==5&&Ee!==27&&Ee!==6)&&(ge=null)):(Q=null,ge=$),Q!==ge)){if(Ee=yp,oe="onMouseLeave",U="onMouseEnter",H="mouse",(e==="pointerout"||e==="pointerover")&&(Ee=wp,oe="onPointerLeave",U="onPointerEnter",H="pointer"),Ke=Q==null?X:Ho(Q),K=ge==null?X:Ho(ge),X=new Ee(oe,H+"leave",Q,a,te),X.target=Ke,X.relatedTarget=K,oe=null,Ta(te)===$&&(Ee=new Ee(U,H+"enter",ge,a,te),Ee.target=K,Ee.relatedTarget=Ke,oe=Ee),Ke=oe,Q&&ge)t:{for(Ee=Jk,U=Q,H=ge,K=0,oe=U;oe;oe=Ee(oe))K++;oe=0;for(var xe=H;xe;xe=Ee(xe))oe++;for(;0<K-oe;)U=Ee(U),K--;for(;0<oe-K;)H=Ee(H),oe--;for(;K--;){if(U===H||H!==null&&U===H.alternate){Ee=U;break t}U=Ee(U),H=Ee(H)}Ee=null}else Ee=null;Q!==null&&dv(se,X,Q,Ee,!1),ge!==null&&Ke!==null&&dv(se,Ke,ge,Ee,!0)}}e:{if(X=$?Ho($):window,Q=X.nodeName&&X.nodeName.toLowerCase(),Q==="select"||Q==="input"&&X.type==="file")var Be=Ap;else if(Tp(X))if(_p)Be=uk;else{Be=lk;var ye=ik}else Q=X.nodeName,!Q||Q.toLowerCase()!=="input"||X.type!=="checkbox"&&X.type!=="radio"?$&&Bc($.elementType)&&(Be=Ap):Be=ck;if(Be&&(Be=Be(e,$))){Np(se,Be,a,te);break e}ye&&ye(e,X,$),e==="focusout"&&$&&X.type==="number"&&$.memoizedProps.value!=null&&Hc(X,"number",X.value)}switch(ye=$?Ho($):window,e){case"focusin":(Tp(ye)||ye.contentEditable==="true")&&(La=ye,Qc=$,Yo=null);break;case"focusout":Yo=Qc=La=null;break;case"mousedown":Jc=!0;break;case"contextmenu":case"mouseup":case"dragend":Jc=!1,Hp(se,a,te);break;case"selectionchange":if(fk)break;case"keydown":case"keyup":Hp(se,a,te)}var Re;if(Vc)e:{switch(e){case"compositionstart":var Le="onCompositionStart";break e;case"compositionend":Le="onCompositionEnd";break e;case"compositionupdate":Le="onCompositionUpdate";break e}Le=void 0}else Ma?Ep(e,a)&&(Le="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Le="onCompositionStart");Le&&(xp&&a.locale!=="ko"&&(Ma||Le!=="onCompositionStart"?Le==="onCompositionEnd"&&Ma&&(Re=gp()):(fr=te,Pc="value"in fr?fr.value:fr.textContent,Ma=!0)),ye=il($,Le),0<ye.length&&(Le=new bp(Le,e,null,a,te),se.push({event:Le,listeners:ye}),Re?Le.data=Re:(Re=Cp(a),Re!==null&&(Le.data=Re)))),(Re=nk?rk(e,a):ak(e,a))&&(Le=il($,"onBeforeInput"),0<Le.length&&(ye=new bp("onBeforeInput","beforeinput",null,a,te),se.push({event:ye,listeners:Le}),ye.data=Re)),Gk(se,e,$,a,te)}cv(se,n)})}function vs(e,n,a){return{instance:e,listener:n,currentTarget:a}}function il(e,n){for(var a=n+"Capture",s=[];e!==null;){var d=e,p=d.stateNode;if(d=d.tag,d!==5&&d!==26&&d!==27||p===null||(d=Bo(e,a),d!=null&&s.unshift(vs(e,d,p)),d=Bo(e,n),d!=null&&s.push(vs(e,d,p))),e.tag===3)return s;e=e.return}return[]}function Jk(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function dv(e,n,a,s,d){for(var p=n._reactName,w=[];a!==null&&a!==s;){var _=a,z=_.alternate,$=_.stateNode;if(_=_.tag,z!==null&&z===s)break;_!==5&&_!==26&&_!==27||$===null||(z=$,d?($=Bo(a,p),$!=null&&w.unshift(vs(a,$,z))):d||($=Bo(a,p),$!=null&&w.push(vs(a,$,z)))),a=a.return}w.length!==0&&e.push({event:n,listeners:w})}var e2=/\r\n?/g,t2=/\u0000|\uFFFD/g;function fv(e){return(typeof e=="string"?e:""+e).replace(e2,`
|
|
10
|
+
`).replace(t2,"")}function mv(e,n){return n=fv(n),fv(e)===n}function Fe(e,n,a,s,d,p){switch(a){case"children":typeof s=="string"?n==="body"||n==="textarea"&&s===""||Ra(e,s):(typeof s=="number"||typeof s=="bigint")&&n!=="body"&&Ra(e,""+s);break;case"className":di(e,"class",s);break;case"tabIndex":di(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":di(e,a,s);break;case"style":mp(e,s,p);break;case"data":if(n!=="object"){di(e,"data",s);break}case"src":case"href":if(s===""&&(n!=="a"||a!=="href")){e.removeAttribute(a);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(a);break}s=mi(""+s),e.setAttribute(a,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(a,"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 p=="function"&&(a==="formAction"?(n!=="input"&&Fe(e,n,"name",d.name,d,null),Fe(e,n,"formEncType",d.formEncType,d,null),Fe(e,n,"formMethod",d.formMethod,d,null),Fe(e,n,"formTarget",d.formTarget,d,null)):(Fe(e,n,"encType",d.encType,d,null),Fe(e,n,"method",d.method,d,null),Fe(e,n,"target",d.target,d,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(a);break}s=mi(""+s),e.setAttribute(a,s);break;case"onClick":s!=null&&(e.onclick=In);break;case"onScroll":s!=null&&De("scroll",e);break;case"onScrollEnd":s!=null&&De("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(i(61));if(a=s.__html,a!=null){if(d.children!=null)throw Error(i(60));e.innerHTML=a}}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}a=mi(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);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(a,""+s):e.removeAttribute(a);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(a,""):e.removeAttribute(a);break;case"capture":case"download":s===!0?e.setAttribute(a,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(a,s):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(a,s):e.removeAttribute(a);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(a):e.setAttribute(a,s);break;case"popover":De("beforetoggle",e),De("toggle",e),ui(e,"popover",s);break;case"xlinkActuate":Un(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":Un(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":Un(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":Un(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":Un(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":Un(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":Un(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":Un(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":Un(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":ui(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=_1.get(a)||a,ui(e,a,s))}}function Ed(e,n,a,s,d,p){switch(a){case"style":mp(e,s,p);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(i(61));if(a=s.__html,a!=null){if(d.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"children":typeof s=="string"?Ra(e,s):(typeof s=="number"||typeof s=="bigint")&&Ra(e,""+s);break;case"onScroll":s!=null&&De("scroll",e);break;case"onScrollEnd":s!=null&&De("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(!ap.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(d=a.endsWith("Capture"),n=a.slice(2,d?a.length-7:void 0),p=e[At]||null,p=p!=null?p[a]:null,typeof p=="function"&&e.removeEventListener(n,p,d),typeof s=="function")){typeof p!="function"&&p!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(n,s,d);break e}a in e?e[a]=s:s===!0?e.setAttribute(a,""):ui(e,a,s)}}}function yt(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":De("error",e),De("load",e);var s=!1,d=!1,p;for(p in a)if(a.hasOwnProperty(p)){var w=a[p];if(w!=null)switch(p){case"src":s=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Fe(e,n,p,w,a,null)}}d&&Fe(e,n,"srcSet",a.srcSet,a,null),s&&Fe(e,n,"src",a.src,a,null);return;case"input":De("invalid",e);var _=p=w=d=null,z=null,$=null;for(s in a)if(a.hasOwnProperty(s)){var te=a[s];if(te!=null)switch(s){case"name":d=te;break;case"type":w=te;break;case"checked":z=te;break;case"defaultChecked":$=te;break;case"value":p=te;break;case"defaultValue":_=te;break;case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(i(137,n));break;default:Fe(e,n,s,te,a,null)}}cp(e,p,_,z,$,w,d,!1);return;case"select":De("invalid",e),s=w=p=null;for(d in a)if(a.hasOwnProperty(d)&&(_=a[d],_!=null))switch(d){case"value":p=_;break;case"defaultValue":w=_;break;case"multiple":s=_;default:Fe(e,n,d,_,a,null)}n=p,a=w,e.multiple=!!s,n!=null?ja(e,!!s,n,!1):a!=null&&ja(e,!!s,a,!0);return;case"textarea":De("invalid",e),p=d=s=null;for(w in a)if(a.hasOwnProperty(w)&&(_=a[w],_!=null))switch(w){case"value":s=_;break;case"defaultValue":d=_;break;case"children":p=_;break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(i(91));break;default:Fe(e,n,w,_,a,null)}dp(e,s,d,p);return;case"option":for(z in a)a.hasOwnProperty(z)&&(s=a[z],s!=null)&&(z==="selected"?e.selected=s&&typeof s!="function"&&typeof s!="symbol":Fe(e,n,z,s,a,null));return;case"dialog":De("beforetoggle",e),De("toggle",e),De("cancel",e),De("close",e);break;case"iframe":case"object":De("load",e);break;case"video":case"audio":for(s=0;s<gs.length;s++)De(gs[s],e);break;case"image":De("error",e),De("load",e);break;case"details":De("toggle",e);break;case"embed":case"source":case"link":De("error",e),De("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($ in a)if(a.hasOwnProperty($)&&(s=a[$],s!=null))switch($){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Fe(e,n,$,s,a,null)}return;default:if(Bc(n)){for(te in a)a.hasOwnProperty(te)&&(s=a[te],s!==void 0&&Ed(e,n,te,s,a,void 0));return}}for(_ in a)a.hasOwnProperty(_)&&(s=a[_],s!=null&&Fe(e,n,_,s,a,null))}function n2(e,n,a,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,p=null,w=null,_=null,z=null,$=null,te=null;for(Q in a){var se=a[Q];if(a.hasOwnProperty(Q)&&se!=null)switch(Q){case"checked":break;case"value":break;case"defaultValue":z=se;default:s.hasOwnProperty(Q)||Fe(e,n,Q,null,s,se)}}for(var X in s){var Q=s[X];if(se=a[X],s.hasOwnProperty(X)&&(Q!=null||se!=null))switch(X){case"type":p=Q;break;case"name":d=Q;break;case"checked":$=Q;break;case"defaultChecked":te=Q;break;case"value":w=Q;break;case"defaultValue":_=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(i(137,n));break;default:Q!==se&&Fe(e,n,X,Q,s,se)}}zc(e,w,_,z,$,te,p,d);return;case"select":Q=w=_=X=null;for(p in a)if(z=a[p],a.hasOwnProperty(p)&&z!=null)switch(p){case"value":break;case"multiple":Q=z;default:s.hasOwnProperty(p)||Fe(e,n,p,null,s,z)}for(d in s)if(p=s[d],z=a[d],s.hasOwnProperty(d)&&(p!=null||z!=null))switch(d){case"value":X=p;break;case"defaultValue":_=p;break;case"multiple":w=p;default:p!==z&&Fe(e,n,d,p,s,z)}n=_,a=w,s=Q,X!=null?ja(e,!!a,X,!1):!!s!=!!a&&(n!=null?ja(e,!!a,n,!0):ja(e,!!a,a?[]:"",!1));return;case"textarea":Q=X=null;for(_ in a)if(d=a[_],a.hasOwnProperty(_)&&d!=null&&!s.hasOwnProperty(_))switch(_){case"value":break;case"children":break;default:Fe(e,n,_,null,s,d)}for(w in s)if(d=s[w],p=a[w],s.hasOwnProperty(w)&&(d!=null||p!=null))switch(w){case"value":X=d;break;case"defaultValue":Q=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(i(91));break;default:d!==p&&Fe(e,n,w,d,s,p)}up(e,X,Q);return;case"option":for(var ge in a)X=a[ge],a.hasOwnProperty(ge)&&X!=null&&!s.hasOwnProperty(ge)&&(ge==="selected"?e.selected=!1:Fe(e,n,ge,null,s,X));for(z in s)X=s[z],Q=a[z],s.hasOwnProperty(z)&&X!==Q&&(X!=null||Q!=null)&&(z==="selected"?e.selected=X&&typeof X!="function"&&typeof X!="symbol":Fe(e,n,z,X,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 Ee in a)X=a[Ee],a.hasOwnProperty(Ee)&&X!=null&&!s.hasOwnProperty(Ee)&&Fe(e,n,Ee,null,s,X);for($ in s)if(X=s[$],Q=a[$],s.hasOwnProperty($)&&X!==Q&&(X!=null||Q!=null))switch($){case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(i(137,n));break;default:Fe(e,n,$,X,s,Q)}return;default:if(Bc(n)){for(var Ke in a)X=a[Ke],a.hasOwnProperty(Ke)&&X!==void 0&&!s.hasOwnProperty(Ke)&&Ed(e,n,Ke,void 0,s,X);for(te in s)X=s[te],Q=a[te],!s.hasOwnProperty(te)||X===Q||X===void 0&&Q===void 0||Ed(e,n,te,X,s,Q);return}}for(var U in a)X=a[U],a.hasOwnProperty(U)&&X!=null&&!s.hasOwnProperty(U)&&Fe(e,n,U,null,s,X);for(se in s)X=s[se],Q=a[se],!s.hasOwnProperty(se)||X===Q||X==null&&Q==null||Fe(e,n,se,X,s,Q)}function pv(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function r2(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,a=performance.getEntriesByType("resource"),s=0;s<a.length;s++){var d=a[s],p=d.transferSize,w=d.initiatorType,_=d.duration;if(p&&_&&pv(w)){for(w=0,_=d.responseEnd,s+=1;s<a.length;s++){var z=a[s],$=z.startTime;if($>_)break;var te=z.transferSize,se=z.initiatorType;te&&pv(se)&&(z=z.responseEnd,w+=te*(z<_?1:(_-$)/(z-$)))}if(--s,n+=8*(p+w)/(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 Cd=null,Td=null;function ll(e){return e.nodeType===9?e:e.ownerDocument}function hv(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 gv(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 Nd(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 Ad=null;function a2(){var e=window.event;return e&&e.type==="popstate"?e===Ad?!1:(Ad=e,!0):(Ad=null,!1)}var vv=typeof setTimeout=="function"?setTimeout:void 0,o2=typeof clearTimeout=="function"?clearTimeout:void 0,yv=typeof Promise=="function"?Promise:void 0,s2=typeof queueMicrotask=="function"?queueMicrotask:typeof yv<"u"?function(e){return yv.resolve(null).then(e).catch(i2)}:vv;function i2(e){setTimeout(function(){throw e})}function _r(e){return e==="head"}function bv(e,n){var a=n,s=0;do{var d=a.nextSibling;if(e.removeChild(a),d&&d.nodeType===8)if(a=d.data,a==="/$"||a==="/&"){if(s===0){e.removeChild(d),lo(n);return}s--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")s++;else if(a==="html")ys(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,ys(a);for(var p=a.firstChild;p;){var w=p.nextSibling,_=p.nodeName;p[zo]||_==="SCRIPT"||_==="STYLE"||_==="LINK"&&p.rel.toLowerCase()==="stylesheet"||a.removeChild(p),p=w}}else a==="body"&&ys(e.ownerDocument.body);a=d}while(a);lo(n)}function wv(e,n){var a=e;e=0;do{var s=a.nextSibling;if(a.nodeType===1?n?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(n?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),s&&s.nodeType===8)if(a=s.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=s}while(a)}function _d(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var a=n;switch(n=n.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":_d(a),Mc(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function l2(e,n,a,s){for(;e.nodeType===1;){var d=a;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[zo])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(p=e.getAttribute("rel"),p==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(p!==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(p=e.getAttribute("src"),(p!==(d.src==null?null:d.src)||e.getAttribute("type")!==(d.type==null?null:d.type)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&p&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var p=d.name==null?null:""+d.name;if(d.type==="hidden"&&e.getAttribute("name")===p)return e}else return e;if(e=dn(e.nextSibling),e===null)break}return null}function c2(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=dn(e.nextSibling),e===null))return null;return e}function xv(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 jd(e){return e.data==="$?"||e.data==="$~"}function Rd(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function u2(e,n){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||a.readyState!=="loading")n();else{var s=function(){n(),a.removeEventListener("DOMContentLoaded",s)};a.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 Od=null;function kv(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return dn(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function Sv(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return e;n--}else a!=="/$"&&a!=="/&"||n++}e=e.previousSibling}return null}function Ev(e,n,a){switch(n=ll(a),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 ys(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);Mc(e)}var fn=new Map,Cv=new Set;function cl(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var rr=q.d;q.d={f:d2,r:f2,D:m2,C:p2,L:h2,m:g2,X:y2,S:v2,M:b2};function d2(){var e=rr.f(),n=el();return e||n}function f2(e){var n=Na(e);n!==null&&n.tag===5&&n.type==="form"?qh(n):rr.r(e)}var oo=typeof document>"u"?null:document;function Tv(e,n,a){var s=oo;if(s&&typeof n=="string"&&n){var d=rn(n);d='link[rel="'+e+'"][href="'+d+'"]',typeof a=="string"&&(d+='[crossorigin="'+a+'"]'),Cv.has(d)||(Cv.add(d),e={rel:e,crossOrigin:a,href:n},s.querySelector(d)===null&&(n=s.createElement("link"),yt(n,"link",e),dt(n),s.head.appendChild(n)))}}function m2(e){rr.D(e),Tv("dns-prefetch",e,null)}function p2(e,n){rr.C(e,n),Tv("preconnect",e,n)}function h2(e,n,a){rr.L(e,n,a);var s=oo;if(s&&e&&n){var d='link[rel="preload"][as="'+rn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(d+='[imagesrcset="'+rn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(d+='[imagesizes="'+rn(a.imageSizes)+'"]')):d+='[href="'+rn(e)+'"]';var p=d;switch(n){case"style":p=so(e);break;case"script":p=io(e)}fn.has(p)||(e=v({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),fn.set(p,e),s.querySelector(d)!==null||n==="style"&&s.querySelector(bs(p))||n==="script"&&s.querySelector(ws(p))||(n=s.createElement("link"),yt(n,"link",e),dt(n),s.head.appendChild(n)))}}function g2(e,n){rr.m(e,n);var a=oo;if(a&&e){var s=n&&typeof n.as=="string"?n.as:"script",d='link[rel="modulepreload"][as="'+rn(s)+'"][href="'+rn(e)+'"]',p=d;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=io(e)}if(!fn.has(p)&&(e=v({rel:"modulepreload",href:e},n),fn.set(p,e),a.querySelector(d)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(ws(p)))return}s=a.createElement("link"),yt(s,"link",e),dt(s),a.head.appendChild(s)}}}function v2(e,n,a){rr.S(e,n,a);var s=oo;if(s&&e){var d=Aa(s).hoistableStyles,p=so(e);n=n||"default";var w=d.get(p);if(!w){var _={loading:0,preload:null};if(w=s.querySelector(bs(p)))_.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":n},a),(a=fn.get(p))&&Dd(e,a);var z=w=s.createElement("link");dt(z),yt(z,"link",e),z._p=new Promise(function($,te){z.onload=$,z.onerror=te}),z.addEventListener("load",function(){_.loading|=1}),z.addEventListener("error",function(){_.loading|=2}),_.loading|=4,ul(w,n,s)}w={type:"stylesheet",instance:w,count:1,state:_},d.set(p,w)}}}function y2(e,n){rr.X(e,n);var a=oo;if(a&&e){var s=Aa(a).hoistableScripts,d=io(e),p=s.get(d);p||(p=a.querySelector(ws(d)),p||(e=v({src:e,async:!0},n),(n=fn.get(d))&&Md(e,n),p=a.createElement("script"),dt(p),yt(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},s.set(d,p))}}function b2(e,n){rr.M(e,n);var a=oo;if(a&&e){var s=Aa(a).hoistableScripts,d=io(e),p=s.get(d);p||(p=a.querySelector(ws(d)),p||(e=v({src:e,async:!0,type:"module"},n),(n=fn.get(d))&&Md(e,n),p=a.createElement("script"),dt(p),yt(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},s.set(d,p))}}function Nv(e,n,a,s){var d=(d=me.current)?cl(d):null;if(!d)throw Error(i(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=so(a.href),a=Aa(d).hoistableStyles,s=a.get(n),s||(s={type:"style",instance:null,count:0,state:null},a.set(n,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=so(a.href);var p=Aa(d).hoistableStyles,w=p.get(e);if(w||(d=d.ownerDocument||d,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(e,w),(p=d.querySelector(bs(e)))&&!p._p&&(w.instance=p,w.state.loading=5),fn.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},fn.set(e,a),p||w2(d,e,a,w.state))),n&&s===null)throw Error(i(528,""));return w}if(n&&s!==null)throw Error(i(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=io(a),a=Aa(d).hoistableScripts,s=a.get(n),s||(s={type:"script",instance:null,count:0,state:null},a.set(n,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,e))}}function so(e){return'href="'+rn(e)+'"'}function bs(e){return'link[rel="stylesheet"]['+e+"]"}function Av(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function w2(e,n,a,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}),yt(n,"link",a),dt(n),e.head.appendChild(n))}function io(e){return'[src="'+rn(e)+'"]'}function ws(e){return"script[async]"+e}function _v(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var s=e.querySelector('style[data-href~="'+rn(a.href)+'"]');if(s)return n.instance=s,dt(s),s;var d=v({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),dt(s),yt(s,"style",d),ul(s,a.precedence,e),n.instance=s;case"stylesheet":d=so(a.href);var p=e.querySelector(bs(d));if(p)return n.state.loading|=4,n.instance=p,dt(p),p;s=Av(a),(d=fn.get(d))&&Dd(s,d),p=(e.ownerDocument||e).createElement("link"),dt(p);var w=p;return w._p=new Promise(function(_,z){w.onload=_,w.onerror=z}),yt(p,"link",s),n.state.loading|=4,ul(p,a.precedence,e),n.instance=p;case"script":return p=io(a.src),(d=e.querySelector(ws(p)))?(n.instance=d,dt(d),d):(s=a,(d=fn.get(p))&&(s=v({},a),Md(s,d)),e=e.ownerDocument||e,d=e.createElement("script"),dt(d),yt(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,ul(s,a.precedence,e));return n.instance}function ul(e,n,a){for(var s=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=s.length?s[s.length-1]:null,p=d,w=0;w<s.length;w++){var _=s[w];if(_.dataset.precedence===n)p=_;else if(p!==d)break}p?p.parentNode.insertBefore(e,p.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(e,n.firstChild))}function Dd(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function Md(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var dl=null;function jv(e,n,a){if(dl===null){var s=new Map,d=dl=new Map;d.set(a,s)}else d=dl,s=d.get(a),s||(s=new Map,d.set(a,s));if(s.has(e))return s;for(s.set(e,null),a=a.getElementsByTagName(e),d=0;d<a.length;d++){var p=a[d];if(!(p[zo]||p[pt]||e==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var w=p.getAttribute(n)||"";w=e+w;var _=s.get(w);_?_.push(p):s.set(w,[p])}}return s}function Rv(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function x2(e,n,a){if(a===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 Ov(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function k2(e,n,a,s){if(a.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var d=so(s.href),p=n.querySelector(bs(d));if(p){n=p._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=fl.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=p,dt(p);return}p=n.ownerDocument||n,s=Av(s),(d=fn.get(d))&&Dd(s,d),p=p.createElement("link"),dt(p);var w=p;w._p=new Promise(function(_,z){w.onload=_,w.onerror=z}),yt(p,"link",s),a.instance=p}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=fl.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var Ld=0;function S2(e,n){return e.stylesheets&&e.count===0&&pl(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var s=setTimeout(function(){if(e.stylesheets&&pl(e,e.stylesheets),e.unsuspend){var p=e.unsuspend;e.unsuspend=null,p()}},6e4+n);0<e.imgBytes&&Ld===0&&(Ld=62500*r2());var d=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&pl(e,e.stylesheets),e.unsuspend)){var p=e.unsuspend;e.unsuspend=null,p()}},(e.imgBytes>Ld?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(d)}}:null}function fl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)pl(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ml=null;function pl(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ml=new Map,n.forEach(E2,e),ml=null,fl.call(e))}function E2(e,n){if(!(n.state.loading&4)){var a=ml.get(e);if(a)var s=a.get(null);else{a=new Map,ml.set(e,a);for(var d=e.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<d.length;p++){var w=d[p];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(a.set(w.dataset.precedence,w),s=w)}s&&a.set(null,s)}d=n.instance,w=d.getAttribute("data-precedence"),p=a.get(w)||s,p===s&&a.set(null,d),a.set(w,d),this.count++,s=fl.bind(this),d.addEventListener("load",s),d.addEventListener("error",s),p?p.parentNode.insertBefore(d,p.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(d,e.firstChild)),n.state.loading|=4}}var xs={$$typeof:j,Provider:null,Consumer:null,_currentValue:I,_currentValue2:I,_threadCount:0};function C2(e,n,a,s,d,p,w,_,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=jc(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=jc(0),this.hiddenUpdates=jc(null),this.identifierPrefix=s,this.onUncaughtError=d,this.onCaughtError=p,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=z,this.incompleteTransitions=new Map}function Dv(e,n,a,s,d,p,w,_,z,$,te,se){return e=new C2(e,n,a,w,z,$,te,se,_),n=1,p===!0&&(n|=24),p=Pt(3,null,null,n),e.current=p,p.stateNode=e,n=pu(),n.refCount++,e.pooledCache=n,n.refCount++,p.memoizedState={element:s,isDehydrated:a,cache:n},yu(p),e}function Mv(e){return e?(e=Ba,e):Ba}function Lv(e,n,a,s,d,p){d=Mv(d),s.context===null?s.context=d:s.pendingContext=d,s=yr(n),s.payload={element:a},p=p===void 0?null:p,p!==null&&(s.callback=p),a=br(e,s,n),a!==null&&(Mt(a,e,n),Jo(a,e,n))}function zv(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function zd(e,n){zv(e,n),(e=e.alternate)&&zv(e,n)}function Hv(e){if(e.tag===13||e.tag===31){var n=Qr(e,67108864);n!==null&&Mt(n,e,67108864),zd(e,67108864)}}function Bv(e){if(e.tag===13||e.tag===31){var n=Vt();n=Rc(n);var a=Qr(e,n);a!==null&&Mt(a,e,n),zd(e,n)}}var hl=!0;function T2(e,n,a,s){var d=M.T;M.T=null;var p=q.p;try{q.p=2,Hd(e,n,a,s)}finally{q.p=p,M.T=d}}function N2(e,n,a,s){var d=M.T;M.T=null;var p=q.p;try{q.p=8,Hd(e,n,a,s)}finally{q.p=p,M.T=d}}function Hd(e,n,a,s){if(hl){var d=Bd(s);if(d===null)Sd(e,n,s,gl,a),Uv(e,s);else if(_2(d,e,n,a,s))s.stopPropagation();else if(Uv(e,s),n&4&&-1<A2.indexOf(e)){for(;d!==null;){var p=Na(d);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var w=$r(p.pendingLanes);if(w!==0){var _=p;for(_.pendingLanes|=2,_.entangledLanes|=2;w;){var z=1<<31-It(w);_.entanglements[1]|=z,w&=~z}jn(p),(Ue&6)===0&&(Qi=Ve()+500,hs(0))}}break;case 31:case 13:_=Qr(p,2),_!==null&&Mt(_,p,2),el(),zd(p,2)}if(p=Bd(s),p===null&&Sd(e,n,s,gl,a),p===d)break;d=p}d!==null&&s.stopPropagation()}else Sd(e,n,s,null,a)}}function Bd(e){return e=Uc(e),Wd(e)}var gl=null;function Wd(e){if(gl=null,e=Ta(e),e!==null){var n=u(e);if(n===null)e=null;else{var a=n.tag;if(a===13){if(e=f(n),e!==null)return e;e=null}else if(a===31){if(e=h(n),e!==null)return e;e=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return gl=e,null}function Wv(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(Sa()){case Ro:return 2;case Oo:return 8;case be:case He:return 32;case ut:return 268435456;default:return 32}default:return 32}}var Ud=!1,jr=null,Rr=null,Or=null,ks=new Map,Ss=new Map,Dr=[],A2="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 Uv(e,n){switch(e){case"focusin":case"focusout":jr=null;break;case"dragenter":case"dragleave":Rr=null;break;case"mouseover":case"mouseout":Or=null;break;case"pointerover":case"pointerout":ks.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ss.delete(n.pointerId)}}function Es(e,n,a,s,d,p){return e===null||e.nativeEvent!==p?(e={blockedOn:n,domEventName:a,eventSystemFlags:s,nativeEvent:p,targetContainers:[d]},n!==null&&(n=Na(n),n!==null&&Hv(n)),e):(e.eventSystemFlags|=s,n=e.targetContainers,d!==null&&n.indexOf(d)===-1&&n.push(d),e)}function _2(e,n,a,s,d){switch(n){case"focusin":return jr=Es(jr,e,n,a,s,d),!0;case"dragenter":return Rr=Es(Rr,e,n,a,s,d),!0;case"mouseover":return Or=Es(Or,e,n,a,s,d),!0;case"pointerover":var p=d.pointerId;return ks.set(p,Es(ks.get(p)||null,e,n,a,s,d)),!0;case"gotpointercapture":return p=d.pointerId,Ss.set(p,Es(Ss.get(p)||null,e,n,a,s,d)),!0}return!1}function Iv(e){var n=Ta(e.target);if(n!==null){var a=u(n);if(a!==null){if(n=a.tag,n===13){if(n=f(a),n!==null){e.blockedOn=n,tp(e.priority,function(){Bv(a)});return}}else if(n===31){if(n=h(a),n!==null){e.blockedOn=n,tp(e.priority,function(){Bv(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function vl(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=Bd(e.nativeEvent);if(a===null){a=e.nativeEvent;var s=new a.constructor(a.type,a);Wc=s,a.target.dispatchEvent(s),Wc=null}else return n=Na(a),n!==null&&Hv(n),e.blockedOn=a,!1;n.shift()}return!0}function qv(e,n,a){vl(e)&&a.delete(n)}function j2(){Ud=!1,jr!==null&&vl(jr)&&(jr=null),Rr!==null&&vl(Rr)&&(Rr=null),Or!==null&&vl(Or)&&(Or=null),ks.forEach(qv),Ss.forEach(qv)}function yl(e,n){e.blockedOn===n&&(e.blockedOn=null,Ud||(Ud=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,j2)))}var bl=null;function Pv(e){bl!==e&&(bl=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){bl===e&&(bl=null);for(var n=0;n<e.length;n+=3){var a=e[n],s=e[n+1],d=e[n+2];if(typeof s!="function"){if(Wd(s||a)===null)continue;break}var p=Na(a);p!==null&&(e.splice(n,3),n-=3,Bu(p,{pending:!0,data:d,method:a.method,action:s},s,d))}}))}function lo(e){function n(z){return yl(z,e)}jr!==null&&yl(jr,e),Rr!==null&&yl(Rr,e),Or!==null&&yl(Or,e),ks.forEach(n),Ss.forEach(n);for(var a=0;a<Dr.length;a++){var s=Dr[a];s.blockedOn===e&&(s.blockedOn=null)}for(;0<Dr.length&&(a=Dr[0],a.blockedOn===null);)Iv(a),a.blockedOn===null&&Dr.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(s=0;s<a.length;s+=3){var d=a[s],p=a[s+1],w=d[At]||null;if(typeof p=="function")w||Pv(a);else if(w){var _=null;if(p&&p.hasAttribute("formAction")){if(d=p,w=p[At]||null)_=w.formAction;else if(Wd(d)!==null)continue}else _=w.action;typeof _=="function"?a[s+1]=_:(a.splice(s,3),s-=3),Pv(a)}}}function Fv(){function e(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(w){return d=w})},focusReset:"manual",scroll:"manual"})}function n(){d!==null&&(d(),d=null),s||setTimeout(a,20)}function a(){if(!s&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.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(a,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),d!==null&&(d(),d=null)}}}function Id(e){this._internalRoot=e}wl.prototype.render=Id.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(i(409));var a=n.current,s=Vt();Lv(a,s,e,n,null,null)},wl.prototype.unmount=Id.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;Lv(e.current,2,null,e,null,null),el(),n[Ca]=null}};function wl(e){this._internalRoot=e}wl.prototype.unstable_scheduleHydration=function(e){if(e){var n=ep();e={blockedOn:null,target:e,priority:n};for(var a=0;a<Dr.length&&n!==0&&n<Dr[a].priority;a++);Dr.splice(a,0,e),a===0&&Iv(e)}};var Kv=r.version;if(Kv!=="19.2.5")throw Error(i(527,Kv,"19.2.5"));q.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=m(n),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var R2={bundleType:0,version:"19.2.5",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.5"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var xl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!xl.isDisabled&&xl.supportsFiber)try{Do=xl.inject(R2),Ut=xl}catch{}}return Ts.createRoot=function(e,n){if(!l(e))throw Error(i(299));var a=!1,s="",d=Qh,p=Jh,w=eg;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onUncaughtError!==void 0&&(d=n.onUncaughtError),n.onCaughtError!==void 0&&(p=n.onCaughtError),n.onRecoverableError!==void 0&&(w=n.onRecoverableError)),n=Dv(e,1,!1,null,null,a,s,null,d,p,w,Fv),e[Ca]=n.current,kd(e),new Id(n)},Ts.hydrateRoot=function(e,n,a){if(!l(e))throw Error(i(299));var s=!1,d="",p=Qh,w=Jh,_=eg,z=null;return a!=null&&(a.unstable_strictMode===!0&&(s=!0),a.identifierPrefix!==void 0&&(d=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(w=a.onCaughtError),a.onRecoverableError!==void 0&&(_=a.onRecoverableError),a.formState!==void 0&&(z=a.formState)),n=Dv(e,1,!0,n,a??null,s,d,z,p,w,_,Fv),n.context=Mv(null),a=n.current,s=Vt(),s=Rc(s),d=yr(s),d.callback=null,br(a,d,s),a=s,n.current.lanes=a,Lo(n,a),jn(n),e[Ca]=n.current,kd(e),new wl(n)},Ts.version="19.2.5",Ts}var ty;function q2(){if(ty)return Fd.exports;ty=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(r){console.error(r)}}return t(),Fd.exports=I2(),Fd.exports}var P2=q2();const F2="modulepreload",K2=function(t){return"/"+t},ny={},Tt=function(r,o,i){let l=Promise.resolve();if(o&&o.length>0){let g=function(m){return Promise.all(m.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]"),h=f?.nonce||f?.getAttribute("nonce");l=g(o.map(m=>{if(m=K2(m),m in ny)return;ny[m]=!0;const y=m.endsWith(".css"),v=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${v}`))return;const x=document.createElement("link");if(x.rel=y?"stylesheet":F2,y||(x.as="script"),x.crossOrigin="",x.href=m,h&&x.setAttribute("nonce",h),document.head.appendChild(x),y)return new Promise((S,T)=>{x.addEventListener("load",S),x.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${m}`)))})}))}function u(f){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=f,window.dispatchEvent(h),!h.defaultPrevented)throw f}return l.then(f=>{for(const h of f||[])h.status==="rejected"&&u(h.reason);return r().catch(u)})},Y2=b.lazy(()=>Tt(()=>import("./WorkspaceTaskDrawer-CqntbH9-.js"),__vite__mapDeps([0,1])).then(t=>({default:t.WorkspaceTaskDrawer}))),$2=b.lazy(()=>Tt(()=>import("./AddWorkspaceFlow-qOI1CmqC.js"),[]).then(t=>({default:t.AddWorkspaceFlow}))),V2=b.lazy(()=>Tt(()=>import("./FirstRunWizard-D5kGMD_V.js"),[]).then(t=>({default:t.FirstRunWizard}))),G2=b.lazy(()=>Tt(()=>import("./WhatsNewDialog-BB9ieq3T.js"),[]).then(t=>({default:t.WhatsNewDialog}))),X2=({addDialogTrigger:t,onAddWorkspace:r,onCloseTaskGraph:o,onCloseWizard:i,onCreateWorkspace:l,onTryDemo:u,taskGraphOpen:f,tasksFile:h,wizardOpen:g,whatsNewOpen:m,whatsNewEntries:y,onCloseWhatsNew:v,workspacePath:x,workers:S,onSelectOwner:T,connectionStale:k})=>c.jsxs(c.Fragment,{children:[x?c.jsx(b.Suspense,{fallback:null,children:c.jsx(Y2,{open:f,tasksFile:h,onClose:o,workspacePath:x,...S?{workers:S}:{},...T?{onSelectOwner:T}:{},...k!==void 0?{connectionStale:k}:{}})}):null,t>0?c.jsx(b.Suspense,{fallback:null,children:c.jsx($2,{onClose:()=>{},onCreate:l,onTryDemo:u,trigger:t})}):null,g?c.jsx(b.Suspense,{fallback:null,children:c.jsx(V2,{open:g,onClose:i,onAddWorkspace:r,onTryDemo:u})}):null,m?c.jsx(b.Suspense,{fallback:null,children:c.jsx(G2,{open:m,entries:[...y],onClose:v})}):null]});const Ib=(...t)=>t.filter((r,o,i)=>!!r&&r.trim()!==""&&i.indexOf(r)===o).join(" ").trim();const Z2=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Q2=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(r,o,i)=>i?i.toUpperCase():o.toLowerCase());const ry=t=>{const r=Q2(t);return r.charAt(0).toUpperCase()+r.slice(1)};var Vd={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 J2=t=>{for(const r in t)if(r.startsWith("aria-")||r==="role"||r==="title")return!0;return!1},eS=b.createContext({}),tS=()=>b.useContext(eS),nS=b.forwardRef(({color:t,size:r,strokeWidth:o,absoluteStrokeWidth:i,className:l="",children:u,iconNode:f,...h},g)=>{const{size:m=24,strokeWidth:y=2,absoluteStrokeWidth:v=!1,color:x="currentColor",className:S=""}=tS()??{},T=i??v?Number(o??y)*24/Number(r??m):o??y;return b.createElement("svg",{ref:g,...Vd,width:r??m??Vd.width,height:r??m??Vd.height,stroke:t??x,strokeWidth:T,className:Ib("lucide",S,l),...!u&&!J2(h)&&{"aria-hidden":"true"},...h},[...f.map(([k,C])=>b.createElement(k,C)),...Array.isArray(u)?u:[u]])});const we=(t,r)=>{const o=b.forwardRef(({className:i,...l},u)=>b.createElement(nS,{ref:u,iconNode:r,className:Ib(`lucide-${Z2(ry(t))}`,`lucide-${t}`,i),...l}));return o.displayName=ry(t),o};const rS=[["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"}]],ql=we("activity",rS);const aS=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],oS=we("arrow-right",aS);const sS=[["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"}]],zf=we("bell",sS);const iS=[["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"}]],lS=we("book-open-check",iS);const cS=[["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"}]],uS=we("brain",cS);const dS=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],xa=we("check",dS);const fS=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],To=we("chevron-down",fS);const mS=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],pS=we("chevron-left",mS);const hS=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],lc=we("chevron-right",hS);const gS=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],vS=we("chevrons-left",gS);const yS=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],bS=we("chevrons-right",yS);const wS=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],qb=we("circle-check",wS);const xS=[["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"}]],kS=we("circle-play",xS);const SS=[["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"}]],ES=we("circle-question-mark",SS);const CS=[["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"}]],TS=we("circle-x",CS);const NS=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],AS=we("circle",NS);const _S=[["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"}]],jS=we("code-xml",_S);const RS=[["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"}]],Gs=we("copy",RS);const OS=[["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"}]],hm=we("crown",OS);const DS=[["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"}]],MS=we("ellipsis-vertical",DS);const LS=[["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"}]],Pb=we("external-link",LS);const zS=[["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"}]],HS=we("eye",zS);const BS=[["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"}]],WS=we("file-text",BS);const US=[["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"}]],Pl=we("flask-conical",US);const IS=[["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"}]],Fb=we("folder-plus",IS);const qS=[["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"}]],PS=we("hammer",qS);const FS=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Kb=we("info",FS);const KS=[["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"}]],YS=we("languages",KS);const $S=[["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"}]],Gd=we("laptop",$S);const VS=[["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"}]],Yb=we("list-checks",VS);const GS=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ka=we("loader-circle",GS);const XS=[["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"}]],ZS=we("log-out",XS);const QS=[["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"}]],JS=we("maximize-2",QS);const eE=[["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"}]],tE=we("minimize-2",eE);const nE=[["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"}]],$b=we("pencil",nE);const rE=[["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"}]],No=we("play",rE);const aE=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ms=we("plus",aE);const oE=[["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"}]],gm=we("refresh-cw",oE);const sE=[["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"}]],vm=we("rotate-ccw",sE);const iE=[["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"}]],lE=we("search-check",iE);const cE=[["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"}]],Vb=we("send",cE);const uE=[["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"}]],dE=we("server-crash",uE);const fE=[["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"}]],Hf=we("settings",fE);const mE=[["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"}]],pE=we("shield-check",mE);const hE=[["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"}]],gE=we("sliders-horizontal",hE);const vE=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],Gb=we("smartphone",vE);const yE=[["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=we("sparkles",yE);const bE=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],ym=we("square",bE);const wE=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],cc=we("terminal",wE);const xE=[["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"}]],uc=we("trash-2",xE);const kE=[["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"}]],dc=we("triangle-alert",kE);const SE=[["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"}]],Xd=we("user-plus",SE);const EE=[["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"}]],bm=we("users",EE);const CE=[["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"}]],Fl=we("volume-2",CE);const TE=[["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"}]],Zb=we("volume-x",TE);const NE=[["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"}]],AE=we("webhook",NE);const _E=[["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"}]],Qb=we("workflow",_E);const jE=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ya=we("x",jE),RE=t=>t==="en"||t==="zh",Jb="hive.uiLanguage",e0={"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} queued {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 {count} queued.","actionCenter.attention.waitingReport":"{worker} has been waiting to report for {minutes}m.","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.loading":"Loading team activity...","actionCenter.noActivity":"No recent team activity.","actionCenter.noWorkerEvidence":"No active worker evidence.","actionCenter.openCount":"{count} open","actionCenter.recapCopied":"Recap copied to clipboard.","actionCenter.recapCopyFailed":"Could not copy recap.","actionCenter.recent":"Recent","actionCenter.reportCount":"{count} reports","actionCenter.runningCount":"{count} running","actionCenter.stoppedWithQueue":"{count} stopped with queue","actionCenter.terminalHint":"Terminal","actionCenter.title":"Action Center","actionCenter.unknownWorker":"Unknown member","actionCenter.waitingReports":"{count} waiting report","actionCenter.workerStatus":"Status","actionCenter.workers":"Workers","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","orchestrator.copyErrorAria":"Copy error message","orchestrator.failed":"Orchestrator failed to start","orchestrator.firstDispatchGuide":"Ask Orchestrator to dispatch work","orchestrator.firstDispatchPrompt":"Use Hive for this workspace: if the concrete goal is missing, ask me for it. Once the goal is clear, break it into tasks in .hive/tasks.md and dispatch work with `team send <worker-name> <task>`. If the team is not staffed yet, spawn suitable workers first.","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.tabCandidate":"Candidates","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.emptyCandidate":"No candidate memory","memory.emptyCandidateDesc":"Candidate entries from workers appear here for review before injection.","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.approveTooltip":"Approve candidate","memory.rejectTooltip":"Reject candidate","memory.rejectTitle":"Reject Candidate","memory.rejectDesc":"Rejected candidate memory will stay out of active injection.","memory.rejectButton":"Reject","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.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.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.pendingResume":"{count} pending tasks will resume after restart.","worker.queued":"{count} queued","worker.queuedAria":"{count} pending dispatches in this worker’s queue.","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}; {count} queued tasks remain.","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}; {count} queued tasks remain.","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"},OE={"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} 已停止,但还有 {count} 个排队任务。","actionCenter.attention.waitingReport":"{worker} 已等待汇报 {minutes} 分钟。","actionCenter.collapse":"收起 Action Center","actionCenter.copyRecap":"复制战报","actionCenter.currentDispatch":"当前","actionCenter.expand":"展开 Action Center","actionCenter.latestReport":"汇报","actionCenter.loadFailed":"无法加载团队动态。","actionCenter.loading":"正在加载团队动态...","actionCenter.noActivity":"暂无团队动态。","actionCenter.noWorkerEvidence":"暂无活跃成员证据。","actionCenter.openCount":"{count} 个进行中","actionCenter.recapCopied":"战报已复制到剪贴板。","actionCenter.recapCopyFailed":"复制战报失败。","actionCenter.recent":"最近","actionCenter.reportCount":"{count} 条汇报","actionCenter.runningCount":"{count} 个运行中","actionCenter.stoppedWithQueue":"{count} 个停止但有队列","actionCenter.terminalHint":"终端","actionCenter.title":"Action Center","actionCenter.unknownWorker":"未知成员","actionCenter.waitingReports":"{count} 个等待汇报","actionCenter.workerStatus":"状态","actionCenter.workers":"成员","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","orchestrator.copyErrorAria":"复制错误信息","orchestrator.failed":"Orchestrator 启动失败","orchestrator.firstDispatchGuide":"让 Orchestrator 开始派发任务","orchestrator.firstDispatchPrompt":"用 Hive 接管这个 workspace:如果还缺具体目标,先问我;拿到目标后把它拆成任务写进 .hive/tasks.md,并用 `team send <worker-name> <task>` 派发给合适成员。团队不够时先 `team spawn` 创建成员。","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.tabCandidate":"待审批","memory.tabArchived":"已归档","memory.tabDreams":"Dream 运行记录","memory.runNow":"立即运行","memory.injection":"记忆注入","memory.dreamProcessing":"Dream 优化处理","memory.emptyActive":"暂无记忆条目","memory.emptyActiveDesc":"当 Orchestrator 添加记忆或 Dream 提取出知识后,此处会显示记录。","memory.emptyCandidate":"暂无待审批记忆","memory.emptyCandidateDesc":"Worker 提交的 candidate 记忆会先出现在这里,审批后才参与注入。","memory.emptyDreams":"暂无 Dream 运行记录","memory.emptyDreamsDesc":"在执行手动或定时的 Dream 优化后,此处将展示运行历史。","memory.archiveTitle":"归档记忆","memory.archiveDesc":"归档后的记忆将不再注入到启动、恢复以及 dispatch 阶段。","memory.archiveButton":"归档","memory.approveTooltip":"批准 candidate 记忆","memory.rejectTooltip":"拒绝 candidate 记忆","memory.rejectTitle":"拒绝待审批记忆","memory.rejectDesc":"被拒绝的 candidate 记忆不会进入活跃注入。","memory.rejectButton":"拒绝","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.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.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.pendingResume":"重启后会继续 {count} 个排队任务。","worker.queued":"{count} 个排队","worker.queuedAria":"该成员队列中有 {count} 个待处理派单。","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} 汇报;还有 {count} 个排队任务。","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} 停止;还有 {count} 个排队任务。","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"},DE={en:e0,zh:OE},ME=()=>{if(typeof window>"u")return"en";const t=LE();return t||(window.navigator.language.toLowerCase().startsWith("zh")?"zh":"en")},LE=()=>{try{const t=window.localStorage.getItem(Jb);return RE(t)?t:null}catch{return null}},zE=t=>{try{window.localStorage.setItem(Jb,t)}catch{}},t0=t=>(r,o={})=>(DE[t][r]??e0[r]??r).replace(/\{(\w+)\}/g,(l,u)=>{const f=o[u];return f===void 0?l:String(f)}),HE={language:"en",setLanguage:()=>{},t:t0("en")},n0=b.createContext(HE),BE=({children:t})=>{const[r,o]=b.useState(ME),i=b.useMemo(()=>({language:r,setLanguage:u=>{o(u),zE(u)},t:t0(r)}),[r]);return c.jsx(n0.Provider,{value:i,children:t})},ke=()=>b.useContext(n0),WE=({onExit:t})=>{const{t:r}=ke();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:r("demo.banner")})]}),c.jsx("button",{type:"button",onClick:t,className:"icon-btn icon-btn--ghost",children:r("demo.exit")})]})},kl=[{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"]}],Zd=["Create the Todo API route","Persist todos in SQLite","Add Vitest coverage","Review route behavior","Mark .hive/tasks.md complete"],UE=[{name:"ada-lovelace",role:"Coder"},{name:"socrates",role:"Reviewer"}],IE=({onExit:t})=>{const{t:r}=ke(),[o,i]=b.useState(0);b.useEffect(()=>{const f=window.setInterval(()=>{i(h=>(h+1)%kl.length)},1800);return()=>window.clearInterval(f)},[]);const l=kl[o]??kl[0],u=b.useMemo(()=>kl.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(WE,{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(cc,{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:r("demo.replayTitle")}),c.jsx("p",{className:"text-xs text-ter",children:r("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:r("demo.tasksTitle")}),c.jsxs("span",{className:"text-xs text-ter",children:[Math.min(l.doneTasks,Zd.length),"/",Zd.length]})]}),c.jsx("ul",{className:"space-y-2",children:Zd.map((f,h)=>{const g=h<l.doneTasks;return c.jsxs("li",{className:"flex items-start gap-2 text-sm","data-testid":`demo-task-${h}`,"data-done":g||void 0,children:[g?c.jsx(qb,{size:16,className:"mt-0.5 shrink-0 text-status-green"}):c.jsx(AS,{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(bm,{size:15,className:"text-accent"}),c.jsx("h2",{className:"text-sm font-semibold text-pri",children:r("demo.teamTitle")})]}),c.jsx("div",{className:"grid gap-2",children:UE.map((f,h)=>{const g=l.workerStates[h]??"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)})})]})]})]})})]})},qE=(t,r={})=>{const o=new URL(t,window.location.href);o.protocol=o.protocol==="https:"?"wss:":"ws:";for(const[i,l]of Object.entries(r))l!==void 0&&o.searchParams.set(i,String(l));return o.toString()},PE={requiresUiSession:!0,fetch(t,r){return fetch(t,r)},openWebSocket(t,r){return new WebSocket(qE(t,r))}};let wo=PE;const FE=t=>{wo=t},r0=()=>wo,a0=()=>wo.requiresUiSession!==!1,o0=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}:{}}),_e=async(t,r)=>{try{const o=await t.json();if(typeof o.error=="string"&&o.error.trim())return o.error}catch{}return r},KE=async t=>{if(t.status!==403)return!1;try{return(await t.clone().json()).error==="UI endpoint requires valid UI token"}catch{return!1}},s0=async()=>{if(!a0())return;const t=await wo.fetch("/api/ui/session",{mode:"same-origin"});if(!t.ok)throw new Error("Failed to initialize UI session");await t.json()};let Qd=null;const YE=()=>(Qd??=s0().finally(()=>{Qd=null}),Qd),he=async(t,r)=>{const o=await wo.fetch(t,r);return!a0()||!await KE(o)?o:(await YE(),wo.fetch(t,r))},$E=async()=>{const t=await he("/api/workspaces");if(!t.ok)throw new Error("Failed to load workspaces");return await t.json()},VE=async()=>{const t=await he("/api/version");if(!t.ok)throw new Error("Failed to load version info");const r=await t.json();return{canRunHiveUpdate:r.can_run_hive_update??r.install_hint==="hive update",currentVersion:r.current_version,installHint:r.install_hint,installSource:r.install_source??"unknown",latestVersion:r.latest_version,packageName:r.package_name,releaseUrl:r.release_url,updateNote:r.update_note??"",updateAvailable:r.update_available}},i0=t=>({description:t.description,id:t.id,isBuiltin:t.is_builtin,name:t.name,roleType:t.role_type}),GE=t=>({name:t.name,role_type:t.roleType,description:t.description,default_command:"",default_args:[],default_env:{}}),XE=async t=>{const r=await he("/api/workspaces",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw new Error(await _e(r,"Failed to create workspace"));return await r.json()},ZE=async t=>{const r=await he(`/api/workspaces/${t}`,{method:"DELETE"});if(!r.ok)throw new Error(await _e(r,"Failed to delete workspace"))},Kl=async(t,r)=>{const o=await he(`/api/workspaces/${t}/agents/${r}/start`,{method:"POST"});if(!o.ok)throw new Error(await _e(o,"Failed to start agent run"));return{runId:(await o.json()).run_id}},Yl=async t=>{if(!(await he(`/api/runtime/runs/${t}/stop`,{method:"POST"})).ok)throw new Error("Failed to stop agent run")},QE=async(t,r)=>{const o=await he(`/api/workspaces/${t}/user-input`,{body:JSON.stringify({text:r}),headers:{"content-type":"application/json"},method:"POST"});if(!o.ok)throw new Error(await _e(o,"Failed to send goal to Orchestrator"))},JE=async(t,r,o)=>(await Yl(o).catch(i=>{console.error("[hive] swallowed:restartAgentRun.stop",i)}),Kl(t,r)),eC=async()=>{const t=await he("/api/settings/app-state/active_workspace_id");if(!t.ok)throw new Error("Failed to load active workspace");return(await t.json()).value},l0=async t=>{if(!(await he("/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")},c0="notifications.webhook-url",tC=async()=>{const t=await he(`/api/settings/app-state/${c0}`);if(!t.ok)throw new Error("Failed to load webhook URL");return(await t.json()).value??""},nC=async t=>{if(!(await he(`/api/settings/app-state/${c0}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({value:t.trim()})})).ok)throw new Error("Failed to save webhook URL")},YD=async()=>{const t=await he("/api/settings/workflow-cli-policy");if(!t.ok)throw new Error("Failed to load workflow CLI policy");return await t.json()},$D=async t=>{const r=await he("/api/settings/workflow-cli-policy",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw new Error("Failed to save workflow CLI policy");return await r.json()},rC=async()=>{const t=await he("/api/settings/workflow-feature");if(!t.ok)throw new Error("Failed to load workflow feature flag");return await t.json()},aC=async t=>{const r=await he("/api/settings/workflow-feature",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({enabled:t})});if(!r.ok)throw new Error("Failed to save workflow feature flag");return await r.json()},oC=async()=>{const t=await he("/api/settings/team-autostaff");if(!t.ok)throw new Error("Failed to load auto-staff feature flag");return await t.json()},sC=async t=>{const r=await he("/api/settings/team-autostaff",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({enabled:t})});if(!r.ok)throw new Error("Failed to save auto-staff feature flag");return await r.json()},iC=async t=>{const r=await he(`/api/ui/workspaces/${t}/team`,{mode:"same-origin"});if(!r.ok)throw new Error("Failed to load workers");return(await r.json()).map(o0)},lC=async()=>{const t=await he("/api/settings/command-presets");if(!t.ok)throw new Error("Failed to load command presets");return(await t.json()).map(r=>({args:r.args,available:r.available,command:r.command,displayName:r.display_name,id:r.id}))},cC=t=>`${t}:shell`,fc=(t,r)=>t.agent_id===cC(r),uC=async t=>{const r=await he(`/api/workspaces/${t}/shell/start`,{method:"POST"});if(!r.ok)throw new Error(await _e(r,"Failed to start workspace terminal"));return await r.json()},dC=async(t,r)=>{const o=await he(`/api/workspaces/${t}/shell/${r}`,{method:"DELETE"});if(!o.ok)throw new Error(await _e(o,"Failed to close workspace terminal"))},fC=async()=>{const t=await he("/api/settings/role-templates",{mode:"same-origin"});if(!t.ok)throw new Error("Failed to load role templates");return(await t.json()).map(i0)},mC=async t=>{const r=await he("/api/settings/role-templates",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(GE(t))});if(!r.ok)throw new Error(await _e(r,"Failed to create role template"));return i0(await r.json())},pC=async t=>{const r=await he(`/api/settings/role-templates/${t}`,{method:"DELETE"});if(!r.ok)throw new Error(await _e(r,"Failed to delete role template"))},VD=async t=>{const r=await he(`/api/marketplace/manifest?lang=${t}`,{mode:"same-origin"});if(!r.ok)throw new Error(await _e(r,"Failed to load marketplace manifest"));return await r.json()},GD=async(t,r)=>{const o=await he(`/api/marketplace/agent?lang=${t}&path=${encodeURIComponent(r)}`,{mode:"same-origin"});if(!o.ok)throw new Error(await _e(o,"Failed to load marketplace agent"));return await o.json()},hC=async t=>{const r=await he(`/api/ui/workspaces/${t}/runs`,{mode:"same-origin"});if(!r.ok)throw new Error("Failed to load terminal runs");return await r.json()},gC=async(t,r)=>{const o=await he(`/api/workspaces/${t}/workers`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw new Error(await _e(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:o0(i)}},vC=async(t,r,o,i)=>{const l=await he(`/api/workspaces/${t}/scenarios/${encodeURIComponent(r)}/apply`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({goal:o,locale:i})});if(!l.ok)throw new Error(await _e(l,"Failed to assemble the scenario team"));return{createdWorkers:(await l.json()).created_workers}},yC=async(t,r)=>{const o=await he(`/api/workspaces/${t}/workers/${r}`,{method:"DELETE"});if(!o.ok)throw new Error(await _e(o,"Failed to delete worker"))},bC=async(t,r,o)=>{const i=await he(`/api/workspaces/${t}/workers/${r}`,{body:JSON.stringify({name:o}),headers:{"content-type":"application/json"},method:"PATCH"});if(!i.ok)throw new Error(await _e(i,"Failed to rename worker"))},wC=async t=>{const r=await he(`/api/workspaces/${t}/tasks`);if(!r.ok)throw new Error("Failed to load tasks");return await r.json()},Sl=async(t,r)=>{const o=await he(`/api/workspaces/${t}/tasks`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw new Error("Failed to save tasks");return await o.json()},XD=async t=>{const r=t?`?path=${encodeURIComponent(t)}`:"";return await(await he(`/api/fs/browse${r}`,{mode:"same-origin"})).json()},ZD=async t=>await(await he(`/api/fs/probe?path=${encodeURIComponent(t)}`,{mode:"same-origin"})).json(),QD=async()=>await(await he("/api/fs/pick-folder",{method:"POST",mode:"same-origin"})).json(),xC=async(t,r)=>{const o=await he(`/api/workspaces/${t}/open`,{body:JSON.stringify({target_id:r}),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 _e(o,"Failed to open workspace"))},kC=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}),mc=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,scope:t.scope,source:t.source,sources:t.sources.map(kC),status:t.status,tags:t.tags,updatedAt:t.updated_at,workspaceId:t.workspace_id}),SC=t=>({contextType:t.context_type,dispatchId:t.dispatch_id,id:t.id,injectedAt:t.injected_at,memory:mc(t.memory),memoryId:t.memory_id,targetAgentIdSnapshot:t.target_agent_id_snapshot,workspaceId:t.workspace_id}),JD=async(t,r={})=>{const o=new URLSearchParams;r.status&&o.set("status",r.status),r.query?.trim()&&o.set("query",r.query.trim()),r.limit!==void 0&&o.set("limit",String(r.limit));const i=o.size>0?`?${o}`:"",l=await he(`/api/ui/workspaces/${t}/memory${i}`);if(!l.ok)throw new Error(await _e(l,"Failed to load memory"));return(await l.json()).memories.map(mc)},eM=async(t,r,o)=>{const i=await he(`/api/ui/workspaces/${t}/memory/${r}`,{body:JSON.stringify(o),headers:{"content-type":"application/json"},method:"PATCH"});if(!i.ok)throw new Error(await _e(i,"Failed to update memory"));const l=await i.json();return mc(l.memory)},wm=async(t,r,o)=>{const i=await he(`/api/ui/workspaces/${t}/memory/${r}/${o}`,{method:"POST"});if(!i.ok)throw new Error(await _e(i,`Failed to ${o} memory`));const l=await i.json();return mc(l.memory)},tM=(t,r)=>wm(t,r,"approve"),nM=(t,r)=>wm(t,r,"reject"),rM=(t,r)=>wm(t,r,"archive"),xm=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}),aM=async(t,r={})=>{const o=new URLSearchParams;r.limit!==void 0&&o.set("limit",String(r.limit));const i=o.size>0?`?${o}`:"",l=await he(`/api/ui/workspaces/${t}/memory/dream-runs${i}`);if(!l.ok)throw new Error(await _e(l,"Failed to load dream runs"));return(await l.json()).runs.map(xm)},oM=async t=>{const r=await he(`/api/ui/workspaces/${t}/memory/dream-runs`,{body:JSON.stringify({}),headers:{"content-type":"application/json"},method:"POST"});if(!r.ok)throw new Error(await _e(r,"Failed to run dream"));const o=await r.json();return xm(o.run)},sM=async(t,r)=>{const o=await he(`/api/ui/workspaces/${t}/memory/dream-runs/${r}/revert`,{body:JSON.stringify({}),headers:{"content-type":"application/json"},method:"POST"});if(!o.ok)throw new Error(await _e(o,"Failed to revert dream run"));const i=await o.json();return xm(i.run)},iM=async t=>{const r=await he(`/api/ui/workspaces/${t}/memory/settings`);if(!r.ok)throw new Error(await _e(r,"Failed to load memory settings"));const o=await r.json();return{dreamEnabled:o.dream_enabled,enabled:o.enabled}},lM=async(t,r)=>{const o=await he(`/api/ui/workspaces/${t}/memory/settings`,{body:JSON.stringify({...r.dreamEnabled===void 0?{}:{dream_enabled:r.dreamEnabled},...r.enabled===void 0?{}:{enabled:r.enabled}}),headers:{"content-type":"application/json"},method:"PUT"});if(!o.ok)throw new Error(await _e(o,"Failed to update memory settings"));const i=await o.json();return{dreamEnabled:i.dream_enabled,enabled:i.enabled}},cM=async(t,r)=>{const o=new URLSearchParams({dispatch_id:r}),i=await he(`/api/ui/workspaces/${t}/memory/injections?${o}`);if(!i.ok)throw new Error(await _e(i,"Failed to load memory injections"));return(await i.json()).injections.map(SC)},EC=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}),uM=async t=>{const r=await he(`/api/workspaces/${t}/workflows/runs`);if(!r.ok)throw new Error(await _e(r,"Failed to list workflow runs"));return(await r.json()).runs.map(EC)},u0=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}),dM=async t=>{const r=await he(`/api/workspaces/${t}/workflow-schedules`);if(!r.ok)throw new Error(await _e(r,"Failed to list workflow schedules"));return(await r.json()).schedules.map(u0)},fM=async(t,r)=>{const o=await he(`/api/workflow-schedules/${t}`,{body:JSON.stringify(r),headers:{"content-type":"application/json"},method:"PATCH"});if(!o.ok)throw new Error(await _e(o,"Failed to update workflow schedule"));const i=await o.json();return u0(i.schedule)},CC=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}:{}}),mM=async t=>{const r=await he(`/api/workflows/runs/${t}/stop`,{method:"POST"});if(!r.ok)throw new Error(await _e(r,"Failed to stop workflow run"))},pM=async t=>{const r=await he(`/api/workflows/runs/${t}/dispatches`);if(!r.ok)throw new Error(await _e(r,"Failed to load workflow run dispatches"));return(await r.json()).dispatches.map(CC)},hM=async t=>{const r=await he(`/api/workflows/runs/${t}/logs`);if(!r.ok)throw new Error(await _e(r,"Failed to load workflow run logs"));return(await r.json()).logs},gM=async t=>{const r=await he(`/api/workflow-schedules/${t}`,{method:"DELETE"});if(!r.ok)throw new Error(await _e(r,"Failed to delete workflow schedule"))},TC=["disabled","loggedOut","connecting","online","reconnecting","revoked"],NC=(t,r)=>typeof t=="string"&&TC.includes(t)?t:r?"online":"disabled",d0=t=>({enabled:t.enabled===!0,loggedIn:t.loggedIn===!0,gatewayUrl:t.gatewayUrl??null,connected:t.connected===!0,connection:NC(t.connection,t.connected===!0)}),AC=t=>({deviceId:t.id,name:t.name,lastActive:t.last_active,createdAt:t.created_at,revoked:t.revoked_at!==null}),_C=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}),Jd=async()=>{const t=await he("/api/remote/status");if(!t.ok)throw new Error(await _e(t,"Failed to load remote status"));return d0(await t.json())},jC=async t=>{const r=await he("/api/remote/enabled",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({enabled:t})});if(!r.ok)throw new Error(await _e(r,"Failed to update remote access"));return d0(await r.json())},RC=async()=>{const t=await he("/api/remote/pairings",{method:"POST"});if(!t.ok)throw new Error(await _e(t,"Failed to start pairing"));return await t.json()},ay=async()=>{const t=await he("/api/remote/pairings/pending");if(!t.ok)throw new Error(await _e(t,"Failed to load pending pairing"));const o=(await t.json())[0];return o?{...o}:null},OC=async t=>{const r=await he(`/api/remote/pairings/${t}/confirm`,{method:"POST"});if(!r.ok)throw new Error(await _e(r,"Failed to confirm pairing"))},DC=async t=>{const r=await he(`/api/remote/pairings/${t}/reject`,{method:"POST"});if(!r.ok)throw new Error(await _e(r,"Failed to reject pairing"))},f0=async()=>{const t=await he("/api/remote/devices");if(!t.ok)throw new Error(await _e(t,"Failed to load devices"));return(await t.json()).map(AC)},MC=async t=>{const r=await he(`/api/remote/devices/${t}/revoke`,{method:"POST"});if(!r.ok)throw new Error(await _e(r,"Failed to revoke device"))},LC=async(t=100)=>{const r=await he(`/api/remote/audit?limit=${t}`);if(!r.ok)throw new Error(await _e(r,"Failed to load remote activity"));return(await r.json()).map(_C)},zC=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,ef=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}),HC=t=>({attention:(t.attention??[]).map(zC),generatedAt:t.generated_at,recentActivity:t.recent_activity.map(r=>({...ef(r),kind:r.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(r=>({currentDispatch:r.current_dispatch?ef(r.current_dispatch):null,id:r.id,latestReport:r.latest_report?ef(r.latest_report):null,name:r.name,pendingTaskCount:r.pending_task_count,role:r.role,status:r.status,terminalHint:r.terminal_hint??null})),workspaceId:t.workspace_id}),BC=async(t,r)=>{const o=await he(`/api/ui/workspaces/${t}/action-center`,r);if(!o.ok)throw new Error(await _e(o,"Failed to load action center"));return HC(await o.json())},WC=async(t,r)=>{const o=await he(`/api/workspaces/${t}/recap`,r);if(!o.ok)throw new Error(await _e(o,"Failed to load team recap"));const i=await o.json();return{generatedAt:i.generated_at,markdown:i.markdown}},UC=async()=>{const t=await he("/api/diagnostics/support-bundle");if(!t.ok)throw new Error(await _e(t,"Failed to load diagnostics"));return await t.json()},IC=async()=>{const t=await he("/api/diagnostics/retention");if(!t.ok)throw new Error(await _e(t,"Failed to load retention diagnostics"));return await t.json()},m0=async t=>{if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(t);return}catch{}const r=document.createElement("textarea");r.value=t,r.setAttribute("readonly",""),r.style.position="fixed",r.style.top="0",r.style.left="-9999px",r.style.opacity="0";const o=document.activeElement instanceof HTMLElement?document.activeElement:null;let i=!1;try{document.body.appendChild(r),r.focus(),r.select(),r.setSelectionRange(0,r.value.length),i=document.execCommand("copy")}finally{r.remove(),o?.focus()}if(!i)throw new Error("Clipboard copy failed")},p0=async t=>{if(navigator.clipboard?.write&&typeof ClipboardItem<"u"){const r=t.then(o=>new Blob([o],{type:"text/plain"}));r.catch(()=>{});try{await navigator.clipboard.write([new ClipboardItem({"text/plain":r})]);return}catch{}}await m0(await t)};function zt(t,r,{checkForDefaultPrevented:o=!0}={}){return function(l){if(t?.(l),o===!1||!l.defaultPrevented)return r?.(l)}}function oy(t,r){if(typeof t=="function")return t(r);t!=null&&(t.current=r)}function h0(...t){return r=>{let o=!1;const i=t.map(l=>{const u=oy(l,r);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():oy(t[l],null)}}}}function Sn(...t){return b.useCallback(h0(...t),t)}function qC(t,r){const o=b.createContext(r),i=u=>{const{children:f,...h}=u,g=b.useMemo(()=>h,Object.values(h));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(r!==void 0)return r;throw new Error(`\`${u}\` must be used within \`${t}\``)}return[i,l]}function km(t,r=[]){let o=[];function i(u,f){const h=b.createContext(f),g=o.length;o=[...o,f];const m=v=>{const{scope:x,children:S,...T}=v,k=x?.[t]?.[g]||h,C=b.useMemo(()=>T,Object.values(T));return c.jsx(k.Provider,{value:C,children:S})};m.displayName=u+"Provider";function y(v,x){const S=x?.[t]?.[g]||h,T=b.useContext(S);if(T)return T;if(f!==void 0)return f;throw new Error(`\`${v}\` must be used within \`${u}\``)}return[m,y]}const l=()=>{const u=o.map(f=>b.createContext(f));return function(h){const g=h?.[t]||u;return b.useMemo(()=>({[`__scope${t}`]:{...h,[t]:g}}),[h,g])}};return l.scopeName=t,[i,PC(l,...r)]}function PC(...t){const r=t[0];if(t.length===1)return r;const o=()=>{const i=t.map(l=>({useScope:l(),scopeName:l.scopeName}));return function(u){const f=i.reduce((h,{useScope:g,scopeName:m})=>{const v=g(u)[`__scope${m}`];return{...h,...v}},{});return b.useMemo(()=>({[`__scope${r.scopeName}`]:f}),[f])}};return o.scopeName=r.scopeName,o}var pc=Ub();const FC=Bb(pc);function g0(t){const r=KC(t),o=b.forwardRef((i,l)=>{const{children:u,...f}=i,h=b.Children.toArray(u),g=h.find($C);if(g){const m=g.props.children,y=h.map(v=>v===g?b.Children.count(m)>1?b.Children.only(null):b.isValidElement(m)?m.props.children:null:v);return c.jsx(r,{...f,ref:l,children:b.isValidElement(m)?b.cloneElement(m,void 0,y):null})}return c.jsx(r,{...f,ref:l,children:u})});return o.displayName=`${t}.Slot`,o}function KC(t){const r=b.forwardRef((o,i)=>{const{children:l,...u}=o;if(b.isValidElement(l)){const f=GC(l),h=VC(u,l.props);return l.type!==b.Fragment&&(h.ref=i?h0(i,f):f),b.cloneElement(l,h)}return b.Children.count(l)>1?b.Children.only(null):null});return r.displayName=`${t}.SlotClone`,r}var v0=Symbol("radix.slottable");function YC(t){const r=({children:o})=>c.jsx(c.Fragment,{children:o});return r.displayName=`${t}.Slottable`,r.__radixId=v0,r}function $C(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===v0}function VC(t,r){const o={...r};for(const i in r){const l=t[i],u=r[i];/^on[A-Z]/.test(i)?l&&u?o[i]=(...h)=>{const g=u(...h);return l(...h),g}:l&&(o[i]=l):i==="style"?o[i]={...l,...u}:i==="className"&&(o[i]=[l,u].filter(Boolean).join(" "))}return{...t,...o}}function GC(t){let r=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?t.ref:(r=Object.getOwnPropertyDescriptor(t,"ref")?.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?t.props.ref:t.props.ref||t.ref)}var XC=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Wt=XC.reduce((t,r)=>{const o=g0(`Primitive.${r}`),i=b.forwardRef((l,u)=>{const{asChild:f,...h}=l,g=f?o:r;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(g,{...h,ref:u})});return i.displayName=`Primitive.${r}`,{...t,[r]:i}},{});function ZC(t,r){t&&pc.flushSync(()=>t.dispatchEvent(r))}function xo(t){const r=b.useRef(t);return b.useEffect(()=>{r.current=t}),b.useMemo(()=>(...o)=>r.current?.(...o),[])}function QC(t,r=globalThis?.document){const o=xo(t);b.useEffect(()=>{const i=l=>{l.key==="Escape"&&o(l)};return r.addEventListener("keydown",i,{capture:!0}),()=>r.removeEventListener("keydown",i,{capture:!0})},[o,r])}var JC="DismissableLayer",Bf="dismissableLayer.update",eT="dismissableLayer.pointerDownOutside",tT="dismissableLayer.focusOutside",sy,y0=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Sm=b.forwardRef((t,r)=>{const{disableOutsidePointerEvents:o=!1,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:f,onDismiss:h,...g}=t,m=b.useContext(y0),[y,v]=b.useState(null),x=y?.ownerDocument??globalThis?.document,[,S]=b.useState({}),T=Sn(r,L=>v(L)),k=Array.from(m.layers),[C]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),E=k.indexOf(C),A=y?k.indexOf(y):-1,j=m.layersWithOutsidePointerEventsDisabled.size>0,N=A>=E,O=aT(L=>{const B=L.target,P=[...m.branches].some(re=>re.contains(B));!N||P||(l?.(L),f?.(L),L.defaultPrevented||h?.())},x),D=oT(L=>{const B=L.target;[...m.branches].some(re=>re.contains(B))||(u?.(L),f?.(L),L.defaultPrevented||h?.())},x);return QC(L=>{A===m.layers.size-1&&(i?.(L),!L.defaultPrevented&&h&&(L.preventDefault(),h()))},x),b.useEffect(()=>{if(y)return o&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(sy=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(y)),m.layers.add(y),iy(),()=>{o&&m.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=sy)}},[y,x,o,m]),b.useEffect(()=>()=>{y&&(m.layers.delete(y),m.layersWithOutsidePointerEventsDisabled.delete(y),iy())},[y,m]),b.useEffect(()=>{const L=()=>S({});return document.addEventListener(Bf,L),()=>document.removeEventListener(Bf,L)},[]),c.jsx(Wt.div,{...g,ref:T,style:{pointerEvents:j?N?"auto":"none":void 0,...t.style},onFocusCapture:zt(t.onFocusCapture,D.onFocusCapture),onBlurCapture:zt(t.onBlurCapture,D.onBlurCapture),onPointerDownCapture:zt(t.onPointerDownCapture,O.onPointerDownCapture)})});Sm.displayName=JC;var nT="DismissableLayerBranch",rT=b.forwardRef((t,r)=>{const o=b.useContext(y0),i=b.useRef(null),l=Sn(r,i);return b.useEffect(()=>{const u=i.current;if(u)return o.branches.add(u),()=>{o.branches.delete(u)}},[o.branches]),c.jsx(Wt.div,{...t,ref:l})});rT.displayName=nT;function aT(t,r=globalThis?.document){const o=xo(t),i=b.useRef(!1),l=b.useRef(()=>{});return b.useEffect(()=>{const u=h=>{if(h.target&&!i.current){let g=function(){b0(eT,o,m,{discrete:!0})};const m={originalEvent:h};h.pointerType==="touch"?(r.removeEventListener("click",l.current),l.current=g,r.addEventListener("click",l.current,{once:!0})):g()}else r.removeEventListener("click",l.current);i.current=!1},f=window.setTimeout(()=>{r.addEventListener("pointerdown",u)},0);return()=>{window.clearTimeout(f),r.removeEventListener("pointerdown",u),r.removeEventListener("click",l.current)}},[r,o]),{onPointerDownCapture:()=>i.current=!0}}function oT(t,r=globalThis?.document){const o=xo(t),i=b.useRef(!1);return b.useEffect(()=>{const l=u=>{u.target&&!i.current&&b0(tT,o,{originalEvent:u},{discrete:!1})};return r.addEventListener("focusin",l),()=>r.removeEventListener("focusin",l)},[r,o]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function iy(){const t=new CustomEvent(Bf);document.dispatchEvent(t)}function b0(t,r,o,{discrete:i}){const l=o.originalEvent.target,u=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:o});r&&l.addEventListener(t,r,{once:!0}),i?ZC(l,u):l.dispatchEvent(u)}var Fr=globalThis?.document?b.useLayoutEffect:()=>{},sT=Wb[" useId ".trim().toString()]||(()=>{}),iT=0;function Dl(t){const[r,o]=b.useState(sT());return Fr(()=>{o(i=>i??String(iT++))},[t]),t||(r?`radix-${r}`:"")}const lT=["top","right","bottom","left"],Kr=Math.min,Xt=Math.max,$l=Math.round,El=Math.floor,zn=t=>({x:t,y:t}),cT={left:"right",right:"left",bottom:"top",top:"bottom"};function Wf(t,r,o){return Xt(t,Kr(r,o))}function sr(t,r){return typeof t=="function"?t(r):t}function ir(t){return t.split("-")[0]}function Ao(t){return t.split("-")[1]}function Em(t){return t==="x"?"y":"x"}function Cm(t){return t==="y"?"height":"width"}function Ln(t){const r=t[0];return r==="t"||r==="b"?"y":"x"}function Tm(t){return Em(Ln(t))}function uT(t,r,o){o===void 0&&(o=!1);const i=Ao(t),l=Tm(t),u=Cm(l);let f=l==="x"?i===(o?"end":"start")?"right":"left":i==="start"?"bottom":"top";return r.reference[u]>r.floating[u]&&(f=Vl(f)),[f,Vl(f)]}function dT(t){const r=Vl(t);return[Uf(t),r,Uf(r)]}function Uf(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const ly=["left","right"],cy=["right","left"],fT=["top","bottom"],mT=["bottom","top"];function pT(t,r,o){switch(t){case"top":case"bottom":return o?r?cy:ly:r?ly:cy;case"left":case"right":return r?fT:mT;default:return[]}}function hT(t,r,o,i){const l=Ao(t);let u=pT(ir(t),o==="start",i);return l&&(u=u.map(f=>f+"-"+l),r&&(u=u.concat(u.map(Uf)))),u}function Vl(t){const r=ir(t);return cT[r]+t.slice(r.length)}function gT(t){return{top:0,right:0,bottom:0,left:0,...t}}function w0(t){return typeof t!="number"?gT(t):{top:t,right:t,bottom:t,left:t}}function Gl(t){const{x:r,y:o,width:i,height:l}=t;return{width:i,height:l,top:o,left:r,right:r+i,bottom:o+l,x:r,y:o}}function uy(t,r,o){let{reference:i,floating:l}=t;const u=Ln(r),f=Tm(r),h=Cm(f),g=ir(r),m=u==="y",y=i.x+i.width/2-l.width/2,v=i.y+i.height/2-l.height/2,x=i[h]/2-l[h]/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(Ao(r)){case"start":S[f]-=x*(o&&m?-1:1);break;case"end":S[f]+=x*(o&&m?-1:1);break}return S}async function vT(t,r){var o;r===void 0&&(r={});const{x:i,y:l,platform:u,rects:f,elements:h,strategy:g}=t,{boundary:m="clippingAncestors",rootBoundary:y="viewport",elementContext:v="floating",altBoundary:x=!1,padding:S=0}=sr(r,t),T=w0(S),C=h[x?v==="floating"?"reference":"floating":v],E=Gl(await u.getClippingRect({element:(o=await(u.isElement==null?void 0:u.isElement(C)))==null||o?C:C.contextElement||await(u.getDocumentElement==null?void 0:u.getDocumentElement(h.floating)),boundary:m,rootBoundary:y,strategy:g})),A=v==="floating"?{x:i,y:l,width:f.floating.width,height:f.floating.height}:f.reference,j=await(u.getOffsetParent==null?void 0:u.getOffsetParent(h.floating)),N=await(u.isElement==null?void 0:u.isElement(j))?await(u.getScale==null?void 0:u.getScale(j))||{x:1,y:1}:{x:1,y:1},O=Gl(u.convertOffsetParentRelativeRectToViewportRelativeRect?await u.convertOffsetParentRelativeRectToViewportRelativeRect({elements:h,rect:A,offsetParent:j,strategy:g}):A);return{top:(E.top-O.top+T.top)/N.y,bottom:(O.bottom-E.bottom+T.bottom)/N.y,left:(E.left-O.left+T.left)/N.x,right:(O.right-E.right+T.right)/N.x}}const yT=50,bT=async(t,r,o)=>{const{placement:i="bottom",strategy:l="absolute",middleware:u=[],platform:f}=o,h=f.detectOverflow?f:{...f,detectOverflow:vT},g=await(f.isRTL==null?void 0:f.isRTL(r));let m=await f.getElementRects({reference:t,floating:r,strategy:l}),{x:y,y:v}=uy(m,i,g),x=i,S=0;const T={};for(let k=0;k<u.length;k++){const C=u[k];if(!C)continue;const{name:E,fn:A}=C,{x:j,y:N,data:O,reset:D}=await A({x:y,y:v,initialPlacement:i,placement:x,strategy:l,middlewareData:T,rects:m,platform:h,elements:{reference:t,floating:r}});y=j??y,v=N??v,T[E]={...T[E],...O},D&&S<yT&&(S++,typeof D=="object"&&(D.placement&&(x=D.placement),D.rects&&(m=D.rects===!0?await f.getElementRects({reference:t,floating:r,strategy:l}):D.rects),{x:y,y:v}=uy(m,x,g)),k=-1)}return{x:y,y:v,placement:x,strategy:l,middlewareData:T}},wT=t=>({name:"arrow",options:t,async fn(r){const{x:o,y:i,placement:l,rects:u,platform:f,elements:h,middlewareData:g}=r,{element:m,padding:y=0}=sr(t,r)||{};if(m==null)return{};const v=w0(y),x={x:o,y:i},S=Tm(l),T=Cm(S),k=await f.getDimensions(m),C=S==="y",E=C?"top":"left",A=C?"bottom":"right",j=C?"clientHeight":"clientWidth",N=u.reference[T]+u.reference[S]-x[S]-u.floating[T],O=x[S]-u.reference[S],D=await(f.getOffsetParent==null?void 0:f.getOffsetParent(m));let L=D?D[j]:0;(!L||!await(f.isElement==null?void 0:f.isElement(D)))&&(L=h.floating[j]||u.floating[T]);const B=N/2-O/2,P=L/2-k[T]/2-1,re=Kr(v[E],P),ee=Kr(v[A],P),Y=re,J=L-k[T]-ee,G=L/2-k[T]/2+B,V=Wf(Y,G,J),M=!g.arrow&&Ao(l)!=null&&G!==V&&u.reference[T]/2-(G<Y?re:ee)-k[T]/2<0,q=M?G<Y?G-Y:G-J:0;return{[S]:x[S]+q,data:{[S]:V,centerOffset:G-V-q,...M&&{alignmentOffset:q}},reset:M}}}),xT=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(r){var o,i;const{placement:l,middlewareData:u,rects:f,initialPlacement:h,platform:g,elements:m}=r,{mainAxis:y=!0,crossAxis:v=!0,fallbackPlacements:x,fallbackStrategy:S="bestFit",fallbackAxisSideDirection:T="none",flipAlignment:k=!0,...C}=sr(t,r);if((o=u.arrow)!=null&&o.alignmentOffset)return{};const E=ir(l),A=Ln(h),j=ir(h)===h,N=await(g.isRTL==null?void 0:g.isRTL(m.floating)),O=x||(j||!k?[Vl(h)]:dT(h)),D=T!=="none";!x&&D&&O.push(...hT(h,k,T,N));const L=[h,...O],B=await g.detectOverflow(r,C),P=[];let re=((i=u.flip)==null?void 0:i.overflows)||[];if(y&&P.push(B[E]),v){const G=uT(l,f,N);P.push(B[G[0]],B[G[1]])}if(re=[...re,{placement:l,overflows:P}],!P.every(G=>G<=0)){var ee,Y;const G=(((ee=u.flip)==null?void 0:ee.index)||0)+1,V=L[G];if(V&&(!(v==="alignment"?A!==Ln(V):!1)||re.every(I=>Ln(I.placement)===A?I.overflows[0]>0:!0)))return{data:{index:G,overflows:re},reset:{placement:V}};let M=(Y=re.filter(q=>q.overflows[0]<=0).sort((q,I)=>q.overflows[1]-I.overflows[1])[0])==null?void 0:Y.placement;if(!M)switch(S){case"bestFit":{var J;const q=(J=re.filter(I=>{if(D){const Z=Ln(I.placement);return Z===A||Z==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(Z=>Z>0).reduce((Z,F)=>Z+F,0)]).sort((I,Z)=>I[1]-Z[1])[0])==null?void 0:J[0];q&&(M=q);break}case"initialPlacement":M=h;break}if(l!==M)return{reset:{placement:M}}}return{}}}};function dy(t,r){return{top:t.top-r.height,right:t.right-r.width,bottom:t.bottom-r.height,left:t.left-r.width}}function fy(t){return lT.some(r=>t[r]>=0)}const kT=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(r){const{rects:o,platform:i}=r,{strategy:l="referenceHidden",...u}=sr(t,r);switch(l){case"referenceHidden":{const f=await i.detectOverflow(r,{...u,elementContext:"reference"}),h=dy(f,o.reference);return{data:{referenceHiddenOffsets:h,referenceHidden:fy(h)}}}case"escaped":{const f=await i.detectOverflow(r,{...u,altBoundary:!0}),h=dy(f,o.floating);return{data:{escapedOffsets:h,escaped:fy(h)}}}default:return{}}}}},x0=new Set(["left","top"]);async function ST(t,r){const{placement:o,platform:i,elements:l}=t,u=await(i.isRTL==null?void 0:i.isRTL(l.floating)),f=ir(o),h=Ao(o),g=Ln(o)==="y",m=x0.has(f)?-1:1,y=u&&g?-1:1,v=sr(r,t);let{mainAxis:x,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 h&&typeof T=="number"&&(S=h==="end"?T*-1:T),g?{x:S*y,y:x*m}:{x:x*m,y:S*y}}const ET=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(r){var o,i;const{x:l,y:u,placement:f,middlewareData:h}=r,g=await ST(r,t);return f===((o=h.offset)==null?void 0:o.placement)&&(i=h.arrow)!=null&&i.alignmentOffset?{}:{x:l+g.x,y:u+g.y,data:{...g,placement:f}}}}},CT=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(r){const{x:o,y:i,placement:l,platform:u}=r,{mainAxis:f=!0,crossAxis:h=!1,limiter:g={fn:E=>{let{x:A,y:j}=E;return{x:A,y:j}}},...m}=sr(t,r),y={x:o,y:i},v=await u.detectOverflow(r,m),x=Ln(ir(l)),S=Em(x);let T=y[S],k=y[x];if(f){const E=S==="y"?"top":"left",A=S==="y"?"bottom":"right",j=T+v[E],N=T-v[A];T=Wf(j,T,N)}if(h){const E=x==="y"?"top":"left",A=x==="y"?"bottom":"right",j=k+v[E],N=k-v[A];k=Wf(j,k,N)}const C=g.fn({...r,[S]:T,[x]:k});return{...C,data:{x:C.x-o,y:C.y-i,enabled:{[S]:f,[x]:h}}}}}},TT=function(t){return t===void 0&&(t={}),{options:t,fn(r){const{x:o,y:i,placement:l,rects:u,middlewareData:f}=r,{offset:h=0,mainAxis:g=!0,crossAxis:m=!0}=sr(t,r),y={x:o,y:i},v=Ln(l),x=Em(v);let S=y[x],T=y[v];const k=sr(h,r),C=typeof k=="number"?{mainAxis:k,crossAxis:0}:{mainAxis:0,crossAxis:0,...k};if(g){const j=x==="y"?"height":"width",N=u.reference[x]-u.floating[j]+C.mainAxis,O=u.reference[x]+u.reference[j]-C.mainAxis;S<N?S=N:S>O&&(S=O)}if(m){var E,A;const j=x==="y"?"width":"height",N=x0.has(ir(l)),O=u.reference[v]-u.floating[j]+(N&&((E=f.offset)==null?void 0:E[v])||0)+(N?0:C.crossAxis),D=u.reference[v]+u.reference[j]+(N?0:((A=f.offset)==null?void 0:A[v])||0)-(N?C.crossAxis:0);T<O?T=O:T>D&&(T=D)}return{[x]:S,[v]:T}}}},NT=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(r){var o,i;const{placement:l,rects:u,platform:f,elements:h}=r,{apply:g=()=>{},...m}=sr(t,r),y=await f.detectOverflow(r,m),v=ir(l),x=Ao(l),S=Ln(l)==="y",{width:T,height:k}=u.floating;let C,E;v==="top"||v==="bottom"?(C=v,E=x===(await(f.isRTL==null?void 0:f.isRTL(h.floating))?"start":"end")?"left":"right"):(E=v,C=x==="end"?"top":"bottom");const A=k-y.top-y.bottom,j=T-y.left-y.right,N=Kr(k-y[C],A),O=Kr(T-y[E],j),D=!r.middlewareData.shift;let L=N,B=O;if((o=r.middlewareData.shift)!=null&&o.enabled.x&&(B=j),(i=r.middlewareData.shift)!=null&&i.enabled.y&&(L=A),D&&!x){const re=Xt(y.left,0),ee=Xt(y.right,0),Y=Xt(y.top,0),J=Xt(y.bottom,0);S?B=T-2*(re!==0||ee!==0?re+ee:Xt(y.left,y.right)):L=k-2*(Y!==0||J!==0?Y+J:Xt(y.top,y.bottom))}await g({...r,availableWidth:B,availableHeight:L});const P=await f.getDimensions(h.floating);return T!==P.width||k!==P.height?{reset:{rects:!0}}:{}}}};function hc(){return typeof window<"u"}function _o(t){return k0(t)?(t.nodeName||"").toLowerCase():"#document"}function Qt(t){var r;return(t==null||(r=t.ownerDocument)==null?void 0:r.defaultView)||window}function Wn(t){var r;return(r=(k0(t)?t.ownerDocument:t.document)||window.document)==null?void 0:r.documentElement}function k0(t){return hc()?t instanceof Node||t instanceof Qt(t).Node:!1}function xn(t){return hc()?t instanceof Element||t instanceof Qt(t).Element:!1}function cr(t){return hc()?t instanceof HTMLElement||t instanceof Qt(t).HTMLElement:!1}function my(t){return!hc()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Qt(t).ShadowRoot}function Xs(t){const{overflow:r,overflowX:o,overflowY:i,display:l}=kn(t);return/auto|scroll|overlay|hidden|clip/.test(r+i+o)&&l!=="inline"&&l!=="contents"}function AT(t){return/^(table|td|th)$/.test(_o(t))}function gc(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const _T=/transform|translate|scale|rotate|perspective|filter/,jT=/paint|layout|strict|content/,da=t=>!!t&&t!=="none";let tf;function Nm(t){const r=xn(t)?kn(t):t;return da(r.transform)||da(r.translate)||da(r.scale)||da(r.rotate)||da(r.perspective)||!Am()&&(da(r.backdropFilter)||da(r.filter))||_T.test(r.willChange||"")||jT.test(r.contain||"")}function RT(t){let r=Yr(t);for(;cr(r)&&!ko(r);){if(Nm(r))return r;if(gc(r))return null;r=Yr(r)}return null}function Am(){return tf==null&&(tf=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),tf}function ko(t){return/^(html|body|#document)$/.test(_o(t))}function kn(t){return Qt(t).getComputedStyle(t)}function vc(t){return xn(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Yr(t){if(_o(t)==="html")return t;const r=t.assignedSlot||t.parentNode||my(t)&&t.host||Wn(t);return my(r)?r.host:r}function S0(t){const r=Yr(t);return ko(r)?t.ownerDocument?t.ownerDocument.body:t.body:cr(r)&&Xs(r)?r:S0(r)}function Us(t,r,o){var i;r===void 0&&(r=[]),o===void 0&&(o=!0);const l=S0(t),u=l===((i=t.ownerDocument)==null?void 0:i.body),f=Qt(l);if(u){const h=If(f);return r.concat(f,f.visualViewport||[],Xs(l)?l:[],h&&o?Us(h):[])}else return r.concat(l,Us(l,[],o))}function If(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function E0(t){const r=kn(t);let o=parseFloat(r.width)||0,i=parseFloat(r.height)||0;const l=cr(t),u=l?t.offsetWidth:o,f=l?t.offsetHeight:i,h=$l(o)!==u||$l(i)!==f;return h&&(o=u,i=f),{width:o,height:i,$:h}}function _m(t){return xn(t)?t:t.contextElement}function go(t){const r=_m(t);if(!cr(r))return zn(1);const o=r.getBoundingClientRect(),{width:i,height:l,$:u}=E0(r);let f=(u?$l(o.width):o.width)/i,h=(u?$l(o.height):o.height)/l;return(!f||!Number.isFinite(f))&&(f=1),(!h||!Number.isFinite(h))&&(h=1),{x:f,y:h}}const OT=zn(0);function C0(t){const r=Qt(t);return!Am()||!r.visualViewport?OT:{x:r.visualViewport.offsetLeft,y:r.visualViewport.offsetTop}}function DT(t,r,o){return r===void 0&&(r=!1),!o||r&&o!==Qt(t)?!1:r}function ba(t,r,o,i){r===void 0&&(r=!1),o===void 0&&(o=!1);const l=t.getBoundingClientRect(),u=_m(t);let f=zn(1);r&&(i?xn(i)&&(f=go(i)):f=go(t));const h=DT(u,o,i)?C0(u):zn(0);let g=(l.left+h.x)/f.x,m=(l.top+h.y)/f.y,y=l.width/f.x,v=l.height/f.y;if(u){const x=Qt(u),S=i&&xn(i)?Qt(i):i;let T=x,k=If(T);for(;k&&i&&S!==T;){const C=go(k),E=k.getBoundingClientRect(),A=kn(k),j=E.left+(k.clientLeft+parseFloat(A.paddingLeft))*C.x,N=E.top+(k.clientTop+parseFloat(A.paddingTop))*C.y;g*=C.x,m*=C.y,y*=C.x,v*=C.y,g+=j,m+=N,T=Qt(k),k=If(T)}}return Gl({width:y,height:v,x:g,y:m})}function yc(t,r){const o=vc(t).scrollLeft;return r?r.left+o:ba(Wn(t)).left+o}function T0(t,r){const o=t.getBoundingClientRect(),i=o.left+r.scrollLeft-yc(t,o),l=o.top+r.scrollTop;return{x:i,y:l}}function MT(t){let{elements:r,rect:o,offsetParent:i,strategy:l}=t;const u=l==="fixed",f=Wn(i),h=r?gc(r.floating):!1;if(i===f||h&&u)return o;let g={scrollLeft:0,scrollTop:0},m=zn(1);const y=zn(0),v=cr(i);if((v||!v&&!u)&&((_o(i)!=="body"||Xs(f))&&(g=vc(i)),v)){const S=ba(i);m=go(i),y.x=S.x+i.clientLeft,y.y=S.y+i.clientTop}const x=f&&!v&&!u?T0(f,g):zn(0);return{width:o.width*m.x,height:o.height*m.y,x:o.x*m.x-g.scrollLeft*m.x+y.x+x.x,y:o.y*m.y-g.scrollTop*m.y+y.y+x.y}}function LT(t){return Array.from(t.getClientRects())}function zT(t){const r=Wn(t),o=vc(t),i=t.ownerDocument.body,l=Xt(r.scrollWidth,r.clientWidth,i.scrollWidth,i.clientWidth),u=Xt(r.scrollHeight,r.clientHeight,i.scrollHeight,i.clientHeight);let f=-o.scrollLeft+yc(t);const h=-o.scrollTop;return kn(i).direction==="rtl"&&(f+=Xt(r.clientWidth,i.clientWidth)-l),{width:l,height:u,x:f,y:h}}const py=25;function HT(t,r){const o=Qt(t),i=Wn(t),l=o.visualViewport;let u=i.clientWidth,f=i.clientHeight,h=0,g=0;if(l){u=l.width,f=l.height;const y=Am();(!y||y&&r==="fixed")&&(h=l.offsetLeft,g=l.offsetTop)}const m=yc(i);if(m<=0){const y=i.ownerDocument,v=y.body,x=getComputedStyle(v),S=y.compatMode==="CSS1Compat"&&parseFloat(x.marginLeft)+parseFloat(x.marginRight)||0,T=Math.abs(i.clientWidth-v.clientWidth-S);T<=py&&(u-=T)}else m<=py&&(u+=m);return{width:u,height:f,x:h,y:g}}function BT(t,r){const o=ba(t,!0,r==="fixed"),i=o.top+t.clientTop,l=o.left+t.clientLeft,u=cr(t)?go(t):zn(1),f=t.clientWidth*u.x,h=t.clientHeight*u.y,g=l*u.x,m=i*u.y;return{width:f,height:h,x:g,y:m}}function hy(t,r,o){let i;if(r==="viewport")i=HT(t,o);else if(r==="document")i=zT(Wn(t));else if(xn(r))i=BT(r,o);else{const l=C0(t);i={x:r.x-l.x,y:r.y-l.y,width:r.width,height:r.height}}return Gl(i)}function N0(t,r){const o=Yr(t);return o===r||!xn(o)||ko(o)?!1:kn(o).position==="fixed"||N0(o,r)}function WT(t,r){const o=r.get(t);if(o)return o;let i=Us(t,[],!1).filter(h=>xn(h)&&_o(h)!=="body"),l=null;const u=kn(t).position==="fixed";let f=u?Yr(t):t;for(;xn(f)&&!ko(f);){const h=kn(f),g=Nm(f);!g&&h.position==="fixed"&&(l=null),(u?!g&&!l:!g&&h.position==="static"&&!!l&&(l.position==="absolute"||l.position==="fixed")||Xs(f)&&!g&&N0(t,f))?i=i.filter(y=>y!==f):l=h,f=Yr(f)}return r.set(t,i),i}function UT(t){let{element:r,boundary:o,rootBoundary:i,strategy:l}=t;const f=[...o==="clippingAncestors"?gc(r)?[]:WT(r,this._c):[].concat(o),i],h=hy(r,f[0],l);let g=h.top,m=h.right,y=h.bottom,v=h.left;for(let x=1;x<f.length;x++){const S=hy(r,f[x],l);g=Xt(S.top,g),m=Kr(S.right,m),y=Kr(S.bottom,y),v=Xt(S.left,v)}return{width:m-v,height:y-g,x:v,y:g}}function IT(t){const{width:r,height:o}=E0(t);return{width:r,height:o}}function qT(t,r,o){const i=cr(r),l=Wn(r),u=o==="fixed",f=ba(t,!0,u,r);let h={scrollLeft:0,scrollTop:0};const g=zn(0);function m(){g.x=yc(l)}if(i||!i&&!u)if((_o(r)!=="body"||Xs(l))&&(h=vc(r)),i){const S=ba(r,!0,u,r);g.x=S.x+r.clientLeft,g.y=S.y+r.clientTop}else l&&m();u&&!i&&l&&m();const y=l&&!i&&!u?T0(l,h):zn(0),v=f.left+h.scrollLeft-g.x-y.x,x=f.top+h.scrollTop-g.y-y.y;return{x:v,y:x,width:f.width,height:f.height}}function nf(t){return kn(t).position==="static"}function gy(t,r){if(!cr(t)||kn(t).position==="fixed")return null;if(r)return r(t);let o=t.offsetParent;return Wn(t)===o&&(o=o.ownerDocument.body),o}function A0(t,r){const o=Qt(t);if(gc(t))return o;if(!cr(t)){let l=Yr(t);for(;l&&!ko(l);){if(xn(l)&&!nf(l))return l;l=Yr(l)}return o}let i=gy(t,r);for(;i&&AT(i)&&nf(i);)i=gy(i,r);return i&&ko(i)&&nf(i)&&!Nm(i)?o:i||RT(t)||o}const PT=async function(t){const r=this.getOffsetParent||A0,o=this.getDimensions,i=await o(t.floating);return{reference:qT(t.reference,await r(t.floating),t.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function FT(t){return kn(t).direction==="rtl"}const KT={convertOffsetParentRelativeRectToViewportRelativeRect:MT,getDocumentElement:Wn,getClippingRect:UT,getOffsetParent:A0,getElementRects:PT,getClientRects:LT,getDimensions:IT,getScale:go,isElement:xn,isRTL:FT};function _0(t,r){return t.x===r.x&&t.y===r.y&&t.width===r.width&&t.height===r.height}function YT(t,r){let o=null,i;const l=Wn(t);function u(){var h;clearTimeout(i),(h=o)==null||h.disconnect(),o=null}function f(h,g){h===void 0&&(h=!1),g===void 0&&(g=1),u();const m=t.getBoundingClientRect(),{left:y,top:v,width:x,height:S}=m;if(h||r(),!x||!S)return;const T=El(v),k=El(l.clientWidth-(y+x)),C=El(l.clientHeight-(v+S)),E=El(y),j={rootMargin:-T+"px "+-k+"px "+-C+"px "+-E+"px",threshold:Xt(0,Kr(1,g))||1};let N=!0;function O(D){const L=D[0].intersectionRatio;if(L!==g){if(!N)return f();L?f(!1,L):i=setTimeout(()=>{f(!1,1e-7)},1e3)}L===1&&!_0(m,t.getBoundingClientRect())&&f(),N=!1}try{o=new IntersectionObserver(O,{...j,root:l.ownerDocument})}catch{o=new IntersectionObserver(O,j)}o.observe(t)}return f(!0),u}function $T(t,r,o,i){i===void 0&&(i={});const{ancestorScroll:l=!0,ancestorResize:u=!0,elementResize:f=typeof ResizeObserver=="function",layoutShift:h=typeof IntersectionObserver=="function",animationFrame:g=!1}=i,m=_m(t),y=l||u?[...m?Us(m):[],...r?Us(r):[]]:[];y.forEach(E=>{l&&E.addEventListener("scroll",o,{passive:!0}),u&&E.addEventListener("resize",o)});const v=m&&h?YT(m,o):null;let x=-1,S=null;f&&(S=new ResizeObserver(E=>{let[A]=E;A&&A.target===m&&S&&r&&(S.unobserve(r),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var j;(j=S)==null||j.observe(r)})),o()}),m&&!g&&S.observe(m),r&&S.observe(r));let T,k=g?ba(t):null;g&&C();function C(){const E=ba(t);k&&!_0(k,E)&&o(),k=E,T=requestAnimationFrame(C)}return o(),()=>{var E;y.forEach(A=>{l&&A.removeEventListener("scroll",o),u&&A.removeEventListener("resize",o)}),v?.(),(E=S)==null||E.disconnect(),S=null,g&&cancelAnimationFrame(T)}}const VT=ET,GT=CT,XT=xT,ZT=NT,QT=kT,vy=wT,JT=TT,eN=(t,r,o)=>{const i=new Map,l={platform:KT,...o},u={...l.platform,_c:i};return bT(t,r,{...l,platform:u})};var tN=typeof document<"u",nN=function(){},Ml=tN?b.useLayoutEffect:nN;function Xl(t,r){if(t===r)return!0;if(typeof t!=typeof r)return!1;if(typeof t=="function"&&t.toString()===r.toString())return!0;let o,i,l;if(t&&r&&typeof t=="object"){if(Array.isArray(t)){if(o=t.length,o!==r.length)return!1;for(i=o;i--!==0;)if(!Xl(t[i],r[i]))return!1;return!0}if(l=Object.keys(t),o=l.length,o!==Object.keys(r).length)return!1;for(i=o;i--!==0;)if(!{}.hasOwnProperty.call(r,l[i]))return!1;for(i=o;i--!==0;){const u=l[i];if(!(u==="_owner"&&t.$$typeof)&&!Xl(t[u],r[u]))return!1}return!0}return t!==t&&r!==r}function j0(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function yy(t,r){const o=j0(t);return Math.round(r*o)/o}function rf(t){const r=b.useRef(t);return Ml(()=>{r.current=t}),r}function rN(t){t===void 0&&(t={});const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l,elements:{reference:u,floating:f}={},transform:h=!0,whileElementsMounted:g,open:m}=t,[y,v]=b.useState({x:0,y:0,strategy:o,placement:r,middlewareData:{},isPositioned:!1}),[x,S]=b.useState(i);Xl(x,i)||S(i);const[T,k]=b.useState(null),[C,E]=b.useState(null),A=b.useCallback(I=>{I!==D.current&&(D.current=I,k(I))},[]),j=b.useCallback(I=>{I!==L.current&&(L.current=I,E(I))},[]),N=u||T,O=f||C,D=b.useRef(null),L=b.useRef(null),B=b.useRef(y),P=g!=null,re=rf(g),ee=rf(l),Y=rf(m),J=b.useCallback(()=>{if(!D.current||!L.current)return;const I={placement:r,strategy:o,middleware:x};ee.current&&(I.platform=ee.current),eN(D.current,L.current,I).then(Z=>{const F={...Z,isPositioned:Y.current!==!1};G.current&&!Xl(B.current,F)&&(B.current=F,pc.flushSync(()=>{v(F)}))})},[x,r,o,ee,Y]);Ml(()=>{m===!1&&B.current.isPositioned&&(B.current.isPositioned=!1,v(I=>({...I,isPositioned:!1})))},[m]);const G=b.useRef(!1);Ml(()=>(G.current=!0,()=>{G.current=!1}),[]),Ml(()=>{if(N&&(D.current=N),O&&(L.current=O),N&&O){if(re.current)return re.current(N,O,J);J()}},[N,O,J,re,P]);const V=b.useMemo(()=>({reference:D,floating:L,setReference:A,setFloating:j}),[A,j]),M=b.useMemo(()=>({reference:N,floating:O}),[N,O]),q=b.useMemo(()=>{const I={position:o,left:0,top:0};if(!M.floating)return I;const Z=yy(M.floating,y.x),F=yy(M.floating,y.y);return h?{...I,transform:"translate("+Z+"px, "+F+"px)",...j0(M.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:Z,top:F}},[o,h,M.floating,y.x,y.y]);return b.useMemo(()=>({...y,update:J,refs:V,elements:M,floatingStyles:q}),[y,J,V,M,q])}const aN=t=>{function r(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&&r(i)?i.current!=null?vy({element:i.current,padding:l}).fn(o):{}:i?vy({element:i,padding:l}).fn(o):{}}}},oN=(t,r)=>{const o=VT(t);return{name:o.name,fn:o.fn,options:[t,r]}},sN=(t,r)=>{const o=GT(t);return{name:o.name,fn:o.fn,options:[t,r]}},iN=(t,r)=>({fn:JT(t).fn,options:[t,r]}),lN=(t,r)=>{const o=XT(t);return{name:o.name,fn:o.fn,options:[t,r]}},cN=(t,r)=>{const o=ZT(t);return{name:o.name,fn:o.fn,options:[t,r]}},uN=(t,r)=>{const o=QT(t);return{name:o.name,fn:o.fn,options:[t,r]}},dN=(t,r)=>{const o=aN(t);return{name:o.name,fn:o.fn,options:[t,r]}};var fN="Arrow",R0=b.forwardRef((t,r)=>{const{children:o,width:i=10,height:l=5,...u}=t;return c.jsx(Wt.svg,{...u,ref:r,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"})})});R0.displayName=fN;var mN=R0;function pN(t){const[r,o]=b.useState(void 0);return Fr(()=>{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,h;if("borderBoxSize"in u){const g=u.borderBoxSize,m=Array.isArray(g)?g[0]:g;f=m.inlineSize,h=m.blockSize}else f=t.offsetWidth,h=t.offsetHeight;o({width:f,height:h})});return i.observe(t,{box:"border-box"}),()=>i.unobserve(t)}else o(void 0)},[t]),r}var jm="Popper",[O0,D0]=km(jm),[hN,M0]=O0(jm),L0=t=>{const{__scopePopper:r,children:o}=t,[i,l]=b.useState(null);return c.jsx(hN,{scope:r,anchor:i,onAnchorChange:l,children:o})};L0.displayName=jm;var z0="PopperAnchor",H0=b.forwardRef((t,r)=>{const{__scopePopper:o,virtualRef:i,...l}=t,u=M0(z0,o),f=b.useRef(null),h=Sn(r,f),g=b.useRef(null);return b.useEffect(()=>{const m=g.current;g.current=i?.current||f.current,m!==g.current&&u.onAnchorChange(g.current)}),i?null:c.jsx(Wt.div,{...l,ref:h})});H0.displayName=z0;var Rm="PopperContent",[gN,vN]=O0(Rm),B0=b.forwardRef((t,r)=>{const{__scopePopper:o,side:i="bottom",sideOffset:l=0,align:u="center",alignOffset:f=0,arrowPadding:h=0,avoidCollisions:g=!0,collisionBoundary:m=[],collisionPadding:y=0,sticky:v="partial",hideWhenDetached:x=!1,updatePositionStrategy:S="optimized",onPlaced:T,...k}=t,C=M0(Rm,o),[E,A]=b.useState(null),j=Sn(r,ce=>A(ce)),[N,O]=b.useState(null),D=pN(N),L=D?.width??0,B=D?.height??0,P=i+(u!=="center"?"-"+u:""),re=typeof y=="number"?y:{top:0,right:0,bottom:0,left:0,...y},ee=Array.isArray(m)?m:[m],Y=ee.length>0,J={padding:re,boundary:ee.filter(bN),altBoundary:Y},{refs:G,floatingStyles:V,placement:M,isPositioned:q,middlewareData:I}=rN({strategy:"fixed",placement:P,whileElementsMounted:(...ce)=>$T(...ce,{animationFrame:S==="always"}),elements:{reference:C.anchor},middleware:[oN({mainAxis:l+B,alignmentAxis:f}),g&&sN({mainAxis:!0,crossAxis:!1,limiter:v==="partial"?iN():void 0,...J}),g&&lN({...J}),cN({...J,apply:({elements:ce,rects:le,availableWidth:ie,availableHeight:ue})=>{const{width:pe,height:Ne}=le.reference,Ce=ce.floating.style;Ce.setProperty("--radix-popper-available-width",`${ie}px`),Ce.setProperty("--radix-popper-available-height",`${ue}px`),Ce.setProperty("--radix-popper-anchor-width",`${pe}px`),Ce.setProperty("--radix-popper-anchor-height",`${Ne}px`)}}),N&&dN({element:N,padding:h}),wN({arrowWidth:L,arrowHeight:B}),x&&uN({strategy:"referenceHidden",...J})]}),[Z,F]=I0(M),R=xo(T);Fr(()=>{q&&R?.()},[q,R]);const W=I.arrow?.x,ne=I.arrow?.y,ae=I.arrow?.centerOffset!==0,[fe,me]=b.useState();return Fr(()=>{E&&me(window.getComputedStyle(E).zIndex)},[E]),c.jsx("div",{ref:G.setFloating,"data-radix-popper-content-wrapper":"",style:{...V,transform:q?V.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:fe,"--radix-popper-transform-origin":[I.transformOrigin?.x,I.transformOrigin?.y].join(" "),...I.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:c.jsx(gN,{scope:o,placedSide:Z,onArrowChange:O,arrowX:W,arrowY:ne,shouldHideArrow:ae,children:c.jsx(Wt.div,{"data-side":Z,"data-align":F,...k,ref:j,style:{...k.style,animation:q?void 0:"none"}})})})});B0.displayName=Rm;var W0="PopperArrow",yN={top:"bottom",right:"left",bottom:"top",left:"right"},U0=b.forwardRef(function(r,o){const{__scopePopper:i,...l}=r,u=vN(W0,i),f=yN[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(mN,{...l,ref:o,style:{...l.style,display:"block"}})})});U0.displayName=W0;function bN(t){return t!==null}var wN=t=>({name:"transformOrigin",options:t,fn(r){const{placement:o,rects:i,middlewareData:l}=r,f=l.arrow?.centerOffset!==0,h=f?0:t.arrowWidth,g=f?0:t.arrowHeight,[m,y]=I0(o),v={start:"0%",center:"50%",end:"100%"}[y],x=(l.arrow?.x??0)+h/2,S=(l.arrow?.y??0)+g/2;let T="",k="";return m==="bottom"?(T=f?v:`${x}px`,k=`${-g}px`):m==="top"?(T=f?v:`${x}px`,k=`${i.floating.height+g}px`):m==="right"?(T=`${-g}px`,k=f?v:`${S}px`):m==="left"&&(T=`${i.floating.width+g}px`,k=f?v:`${S}px`),{data:{x:T,y:k}}}});function I0(t){const[r,o="center"]=t.split("-");return[r,o]}var xN=L0,kN=H0,SN=B0,EN=U0,CN="Portal",Om=b.forwardRef((t,r)=>{const{container:o,...i}=t,[l,u]=b.useState(!1);Fr(()=>u(!0),[]);const f=o||l&&globalThis?.document?.body;return f?FC.createPortal(c.jsx(Wt.div,{...i,ref:r}),f):null});Om.displayName=CN;function TN(t,r){return b.useReducer((o,i)=>r[o][i]??o,t)}var jo=t=>{const{present:r,children:o}=t,i=NN(r),l=typeof o=="function"?o({present:i.isPresent}):b.Children.only(o),u=Sn(i.ref,AN(l));return typeof o=="function"||i.isPresent?b.cloneElement(l,{ref:u}):null};jo.displayName="Presence";function NN(t){const[r,o]=b.useState(),i=b.useRef(null),l=b.useRef(t),u=b.useRef("none"),f=t?"mounted":"unmounted",[h,g]=TN(f,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const m=Cl(i.current);u.current=h==="mounted"?m:"none"},[h]),Fr(()=>{const m=i.current,y=l.current;if(y!==t){const x=u.current,S=Cl(m);t?g("MOUNT"):S==="none"||m?.display==="none"?g("UNMOUNT"):g(y&&x!==S?"ANIMATION_OUT":"UNMOUNT"),l.current=t}},[t,g]),Fr(()=>{if(r){let m;const y=r.ownerDocument.defaultView??window,v=S=>{const k=Cl(i.current).includes(CSS.escape(S.animationName));if(S.target===r&&k&&(g("ANIMATION_END"),!l.current)){const C=r.style.animationFillMode;r.style.animationFillMode="forwards",m=y.setTimeout(()=>{r.style.animationFillMode==="forwards"&&(r.style.animationFillMode=C)})}},x=S=>{S.target===r&&(u.current=Cl(i.current))};return r.addEventListener("animationstart",x),r.addEventListener("animationcancel",v),r.addEventListener("animationend",v),()=>{y.clearTimeout(m),r.removeEventListener("animationstart",x),r.removeEventListener("animationcancel",v),r.removeEventListener("animationend",v)}}else g("ANIMATION_END")},[r,g]),{isPresent:["mounted","unmountSuspended"].includes(h),ref:b.useCallback(m=>{i.current=m?getComputedStyle(m):null,o(m)},[])}}function Cl(t){return t?.animationName||"none"}function AN(t){let r=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?t.ref:(r=Object.getOwnPropertyDescriptor(t,"ref")?.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?t.props.ref:t.props.ref||t.ref)}var _N=Wb[" useInsertionEffect ".trim().toString()]||Fr;function q0({prop:t,defaultProp:r,onChange:o=()=>{},caller:i}){const[l,u,f]=jN({defaultProp:r,onChange:o}),h=t!==void 0,g=h?t:l;{const y=b.useRef(t!==void 0);b.useEffect(()=>{const v=y.current;v!==h&&console.warn(`${i} is changing from ${v?"controlled":"uncontrolled"} to ${h?"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=h},[h,i])}const m=b.useCallback(y=>{if(h){const v=RN(y)?y(t):y;v!==t&&f.current?.(v)}else u(y)},[h,t,u,f]);return[g,m]}function jN({defaultProp:t,onChange:r}){const[o,i]=b.useState(t),l=b.useRef(o),u=b.useRef(r);return _N(()=>{u.current=r},[r]),b.useEffect(()=>{l.current!==o&&(u.current?.(o),l.current=o)},[o,l]),[o,i,u]}function RN(t){return typeof t=="function"}var ON=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"}),DN="VisuallyHidden",P0=b.forwardRef((t,r)=>c.jsx(Wt.span,{...t,ref:r,style:{...ON,...t.style}}));P0.displayName=DN;var MN=P0,[bc]=km("Tooltip",[D0]),wc=D0(),F0="TooltipProvider",LN=700,qf="tooltip.open",[zN,Dm]=bc(F0),K0=t=>{const{__scopeTooltip:r,delayDuration:o=LN,skipDelayDuration:i=300,disableHoverableContent:l=!1,children:u}=t,f=b.useRef(!0),h=b.useRef(!1),g=b.useRef(0);return b.useEffect(()=>{const m=g.current;return()=>window.clearTimeout(m)},[]),c.jsx(zN,{scope:r,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:h,onPointerInTransitChange:b.useCallback(m=>{h.current=m},[]),disableHoverableContent:l,children:u})};K0.displayName=F0;var Is="Tooltip",[HN,Zs]=bc(Is),Y0=t=>{const{__scopeTooltip:r,children:o,open:i,defaultOpen:l,onOpenChange:u,disableHoverableContent:f,delayDuration:h}=t,g=Dm(Is,t.__scopeTooltip),m=wc(r),[y,v]=b.useState(null),x=Dl(),S=b.useRef(0),T=f??g.disableHoverableContent,k=h??g.delayDuration,C=b.useRef(!1),[E,A]=q0({prop:i,defaultProp:l??!1,onChange:L=>{L?(g.onOpen(),document.dispatchEvent(new CustomEvent(qf))):g.onClose(),u?.(L)},caller:Is}),j=b.useMemo(()=>E?C.current?"delayed-open":"instant-open":"closed",[E]),N=b.useCallback(()=>{window.clearTimeout(S.current),S.current=0,C.current=!1,A(!0)},[A]),O=b.useCallback(()=>{window.clearTimeout(S.current),S.current=0,A(!1)},[A]),D=b.useCallback(()=>{window.clearTimeout(S.current),S.current=window.setTimeout(()=>{C.current=!0,A(!0),S.current=0},k)},[k,A]);return b.useEffect(()=>()=>{S.current&&(window.clearTimeout(S.current),S.current=0)},[]),c.jsx(xN,{...m,children:c.jsx(HN,{scope:r,contentId:x,open:E,stateAttribute:j,trigger:y,onTriggerChange:v,onTriggerEnter:b.useCallback(()=>{g.isOpenDelayedRef.current?D():N()},[g.isOpenDelayedRef,D,N]),onTriggerLeave:b.useCallback(()=>{T?O():(window.clearTimeout(S.current),S.current=0)},[O,T]),onOpen:N,onClose:O,disableHoverableContent:T,children:o})})};Y0.displayName=Is;var Pf="TooltipTrigger",$0=b.forwardRef((t,r)=>{const{__scopeTooltip:o,...i}=t,l=Zs(Pf,o),u=Dm(Pf,o),f=wc(o),h=b.useRef(null),g=Sn(r,h,l.onTriggerChange),m=b.useRef(!1),y=b.useRef(!1),v=b.useCallback(()=>m.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",v),[v]),c.jsx(kN,{asChild:!0,...f,children:c.jsx(Wt.button,{"aria-describedby":l.open?l.contentId:void 0,"data-state":l.stateAttribute,...i,ref:g,onPointerMove:zt(t.onPointerMove,x=>{x.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(),m.current=!0,document.addEventListener("pointerup",v,{once:!0})}),onFocus:zt(t.onFocus,()=>{m.current||l.onOpen()}),onBlur:zt(t.onBlur,l.onClose),onClick:zt(t.onClick,l.onClose)})})});$0.displayName=Pf;var Mm="TooltipPortal",[BN,WN]=bc(Mm,{forceMount:void 0}),V0=t=>{const{__scopeTooltip:r,forceMount:o,children:i,container:l}=t,u=Zs(Mm,r);return c.jsx(BN,{scope:r,forceMount:o,children:c.jsx(jo,{present:o||u.open,children:c.jsx(Om,{asChild:!0,container:l,children:i})})})};V0.displayName=Mm;var So="TooltipContent",G0=b.forwardRef((t,r)=>{const o=WN(So,t.__scopeTooltip),{forceMount:i=o.forceMount,side:l="top",...u}=t,f=Zs(So,t.__scopeTooltip);return c.jsx(jo,{present:i||f.open,children:f.disableHoverableContent?c.jsx(X0,{side:l,...u,ref:r}):c.jsx(UN,{side:l,...u,ref:r})})}),UN=b.forwardRef((t,r)=>{const o=Zs(So,t.__scopeTooltip),i=Dm(So,t.__scopeTooltip),l=b.useRef(null),u=Sn(r,l),[f,h]=b.useState(null),{trigger:g,onClose:m}=o,y=l.current,{onPointerInTransitChange:v}=i,x=b.useCallback(()=>{h(null),v(!1)},[v]),S=b.useCallback((T,k)=>{const C=T.currentTarget,E={x:T.clientX,y:T.clientY},A=KN(E,C.getBoundingClientRect()),j=YN(E,A),N=$N(k.getBoundingClientRect()),O=GN([...j,...N]);h(O),v(!0)},[v]);return b.useEffect(()=>()=>x(),[x]),b.useEffect(()=>{if(g&&y){const T=C=>S(C,y),k=C=>S(C,g);return g.addEventListener("pointerleave",T),y.addEventListener("pointerleave",k),()=>{g.removeEventListener("pointerleave",T),y.removeEventListener("pointerleave",k)}}},[g,y,S,x]),b.useEffect(()=>{if(f){const T=k=>{const C=k.target,E={x:k.clientX,y:k.clientY},A=g?.contains(C)||y?.contains(C),j=!VN(E,f);A?x():j&&(x(),m())};return document.addEventListener("pointermove",T),()=>document.removeEventListener("pointermove",T)}},[g,y,f,m,x]),c.jsx(X0,{...t,ref:u})}),[IN,qN]=bc(Is,{isInside:!1}),PN=YC("TooltipContent"),X0=b.forwardRef((t,r)=>{const{__scopeTooltip:o,children:i,"aria-label":l,onEscapeKeyDown:u,onPointerDownOutside:f,...h}=t,g=Zs(So,o),m=wc(o),{onClose:y}=g;return b.useEffect(()=>(document.addEventListener(qf,y),()=>document.removeEventListener(qf,y)),[y]),b.useEffect(()=>{if(g.trigger){const v=x=>{x.target?.contains(g.trigger)&&y()};return window.addEventListener("scroll",v,{capture:!0}),()=>window.removeEventListener("scroll",v,{capture:!0})}},[g.trigger,y]),c.jsx(Sm,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:v=>v.preventDefault(),onDismiss:y,children:c.jsxs(SN,{"data-state":g.stateAttribute,...m,...h,ref:r,style:{...h.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(PN,{children:i}),c.jsx(IN,{scope:o,isInside:!0,children:c.jsx(MN,{id:g.contentId,role:"tooltip",children:l||i})})]})})});G0.displayName=So;var Z0="TooltipArrow",FN=b.forwardRef((t,r)=>{const{__scopeTooltip:o,...i}=t,l=wc(o);return qN(Z0,o).isInside?null:c.jsx(EN,{...l,...i,ref:r})});FN.displayName=Z0;function KN(t,r){const o=Math.abs(r.top-t.y),i=Math.abs(r.bottom-t.y),l=Math.abs(r.right-t.x),u=Math.abs(r.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 YN(t,r,o=5){const i=[];switch(r){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 $N(t){const{top:r,right:o,bottom:i,left:l}=t;return[{x:l,y:r},{x:o,y:r},{x:o,y:i},{x:l,y:i}]}function VN(t,r){const{x:o,y:i}=t;let l=!1;for(let u=0,f=r.length-1;u<r.length;f=u++){const h=r[u],g=r[f],m=h.x,y=h.y,v=g.x,x=g.y;y>i!=x>i&&o<(v-m)*(i-y)/(x-y)+m&&(l=!l)}return l}function GN(t){const r=t.slice();return r.sort((o,i)=>o.x<i.x?-1:o.x>i.x?1:o.y<i.y?-1:o.y>i.y?1:0),XN(r)}function XN(t){if(t.length<=1)return t.slice();const r=[];for(let i=0;i<t.length;i++){const l=t[i];for(;r.length>=2;){const u=r[r.length-1],f=r[r.length-2];if((u.x-f.x)*(l.y-f.y)>=(u.y-f.y)*(l.x-f.x))r.pop();else break}r.push(l)}r.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(),r.length===1&&o.length===1&&r[0].x===o[0].x&&r[0].y===o[0].y?r:r.concat(o)}var Q0=K0,ZN=Y0,QN=$0,JN=V0,eA=G0;const Qe=({children:t,label:r,side:o="top",align:i="center"})=>r?c.jsx(Q0,{delayDuration:250,skipDelayDuration:150,children:c.jsxs(ZN,{children:[c.jsx(QN,{asChild:!0,children:t}),c.jsx(JN,{children:c.jsx(eA,{className:"tooltip",side:o,align:i,sideOffset:6,children:r})})]})}):c.jsx(c.Fragment,{children:t}),J0=b.createContext(null),ew=b.createContext([]),af=3,tA=t=>t==="success"?3e3:t==="warning"?5e3:0;let by=0;const nA=()=>(by+=1,`t-${by.toString(36)}-${Date.now().toString(36)}`),rA=({children:t})=>{const[r,o]=b.useState([]),i=b.useRef(new Map),l=b.useCallback(v=>{const x=i.current.get(v);x?.timer&&clearTimeout(x.timer),i.current.delete(v)},[]),u=b.useCallback(v=>{o(x=>x.filter(S=>S.id!==v)),l(v)},[l]),f=b.useCallback(({kind:v,message:x,durationMs:S})=>{const T=nA();o(C=>{const E=[...C,{id:T,kind:v,message:x}];if(E.length<=af)return E;const A=E.slice(0,E.length-af);for(const j of A)l(j.id);return E.slice(E.length-af)});const k=S??tA(v);if(k>0){const C=setTimeout(()=>u(T),k);i.current.set(T,{timer:C,dueAt:Date.now()+k,durationMs:k,remainingMs:k})}return T},[u,l]),h=b.useCallback(v=>{const x=i.current.get(v);x?.timer&&(clearTimeout(x.timer),i.current.set(v,{...x,timer:null,remainingMs:Math.max(0,x.dueAt-Date.now())}))},[]),g=b.useCallback(v=>{const x=i.current.get(v);if(!x||x.timer||x.remainingMs<=0)return;const S=setTimeout(()=>u(v),x.remainingMs);i.current.set(v,{...x,timer:S,dueAt:Date.now()+x.remainingMs})},[u]),m=b.useCallback(v=>i.current.get(v)?.durationMs??0,[]);b.useEffect(()=>{const v=i.current;return()=>{for(const x of v.values())x.timer&&clearTimeout(x.timer);v.clear()}},[]);const y=b.useMemo(()=>({show:f,dismiss:u,pauseDismiss:h,resumeDismiss:g,getDuration:m}),[f,u,h,g,m]);return c.jsx(J0.Provider,{value:y,children:c.jsx(ew.Provider,{value:r,children:t})})},Jt=()=>{const t=b.useContext(J0);if(!t)throw new Error("useToast must be used within ToastProvider");return t},aA=()=>b.useContext(ew),oA=2e3,of=()=>document.visibilityState==="hidden",sA=(t,r)=>{const o=Math.max(0,Math.floor((Date.now()-t)/1e3));return o<60?r("common.time.sAgo",{count:o}):o<3600?r("common.time.mAgo",{count:Math.floor(o/60)}):o<86400?r("common.time.hAgo",{count:Math.floor(o/3600)}):r("common.time.dAgo",{count:Math.floor(o/86400)})},iA={cancelled:"actionCenter.activity.cancelled",queued:"actionCenter.activity.queued",reported:"actionCenter.activity.reported",submitted:"actionCenter.activity.submitted"},Lm=(t,r)=>{const o=t.toWorkerName??r("actionCenter.unknownWorker");return r(iA[t.kind],{ago:sA(t.timestamp,r),worker:o})},tw=t=>t.reportPreview??t.taskPreview??t.label??t.phase,lA=t=>t.currentDispatch?.taskPreview??t.latestReport?.reportPreview??t.terminalHint??null,cA=(t,r)=>t.currentDispatch?r("actionCenter.currentDispatch"):t.latestReport?r("actionCenter.latestReport"):t.terminalHint?r("actionCenter.terminalHint"):r("actionCenter.workerStatus"),wy=(t,r)=>t.kind==="no_workers"?r("actionCenter.attention.noWorkers"):t.kind==="stopped_with_queue"?r("actionCenter.attention.stoppedWithQueue",{count:t.pendingTaskCount,worker:t.workerName}):t.kind==="dispatch_waiting_report"?r("actionCenter.attention.waitingReport",{minutes:t.minutesAgo,worker:t.workerName??r("actionCenter.unknownWorker")}):r(t.kind==="remote_error"?"actionCenter.attention.remoteError":"actionCenter.attention.remoteRejected",{endpoint:t.endpoint??t.action,reason:t.reason??"unknown"}),xy=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,nw=t=>{const[r,o]=b.useState(null),[i,l]=b.useState(!1),u=b.useCallback(async f=>BC(t,f?{signal:f}:void 0),[t]);return b.useEffect(()=>{let f=!1,h=!1,g=null,m=null;const y=async()=>{if(!(f||h||of())){h=!0,m=new AbortController;try{const x=await u(m.signal);if(f)return;o(x),l(!1)}catch{f||l(!0)}finally{m=null,h=!1}!f&&!of()&&(g=setTimeout(y,oA))}},v=()=>{f||of()||(g&&(clearTimeout(g),g=null),y())};return document.addEventListener("visibilitychange",v),y(),()=>{f=!0,m?.abort(),g&&clearTimeout(g),document.removeEventListener("visibilitychange",v)}},[u]),{error:i,summary:r}},rw=t=>{const{t:r}=ke(),o=Jt(),[i,l]=b.useState(!1);return{copyingRecap:i,handleCopyRecap:()=>{if(i)return;l(!0);const f=WC(t).then(h=>h.markdown);p0(f).then(()=>o.show({kind:"success",message:r("actionCenter.recapCopied")})).catch(()=>o.show({kind:"error",message:r("actionCenter.recapCopyFailed")})).finally(()=>l(!1))}}},zm=t=>{const r=t?.recentActivity[0]??null,o=r?tw(r):null,i=t?.summary.stoppedWithQueue??0,l=t?.summary.waitingReports??0,u=t?.attention.slice(0,5)??[],f=t?.workers.filter(g=>g.currentDispatch||g.latestReport||g.terminalHint||g.pendingTaskCount>0||g.status==="working").slice(0,6)??[],h=t?.recentActivity.slice(0,6)??[];return{attention:u,evidenceWorkers:f,latest:r,latestDetail:o,recentActivity:h,stoppedWithQueue:i,waitingReports:l}},aw=({copyingRecap:t,onCopyRecap:r,onOpenWorker:o,summary:i})=>{const{t:l}=ke(),{attention:u,evidenceWorkers:f,recentActivity:h}=zm(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:r,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(Gs,{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-${xy(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:wy(g,l),children:wy(g,l)})]})},xy(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")}),h.length>0?c.jsx("ul",{className:"flex max-h-36 flex-col gap-px overflow-auto rounded border border-bright/40 bg-0",children:h.map(g=>{const m=tw(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:Lm(g,l)}),m?c.jsx("span",{className:"min-w-0 truncate text-ter",title:m,children:m}):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 m=lA(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.jsxs("span",{className:"shrink-0 text-ter",children:[cA(g,l),g.pendingTaskCount>0?` · ${l("worker.queued",{count:g.pendingTaskCount})}`:""]}),m?c.jsx("span",{className:"min-w-0 flex-[1.4] truncate text-ter",title:m,children:m}):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")})]})]})},uA=({onOpenWorker:t,workspaceId:r})=>{const{t:o}=ke(),{error:i,summary:l}=nw(r),{copyingRecap:u,handleCopyRecap:f}=rw(r),[h,g]=b.useState(!1),m=b.useRef(null),{latest:y,latestDetail:v,stoppedWithQueue:x,waitingReports:S}=zm(l),T=x+S;return b.useEffect(()=>{if(!h)return;const k=E=>{E.key==="Escape"&&g(!1)},C=E=>{const A=m.current;A&&!A.contains(E.target)&&g(!1)};return document.addEventListener("keydown",k),document.addEventListener("pointerdown",C),()=>{document.removeEventListener("keydown",k),document.removeEventListener("pointerdown",C)}},[h]),c.jsxs("div",{ref:m,className:"relative",children:[c.jsx(Qe,{label:o(h?"actionCenter.collapse":"actionCenter.expand"),children:c.jsxs("button",{type:"button",onClick:()=>g(k=>!k),"aria-expanded":h,"aria-haspopup":"dialog","aria-label":o(h?"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(ql,{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,T>0?c.jsx("span",{className:"mono rounded px-1 text-[11px]",style:{background:"color-mix(in oklab, var(--status-orange) 15%, transparent)",color:"var(--status-orange)"},children:T}):null]})}),h?c.jsxs("div",{role:"dialog","aria-label":o("actionCenter.title"),className:"elev-2 absolute top-8 right-0 z-50 w-[min(560px,calc(100vw-24px))] rounded border p-3","data-testid":"action-center-popover",style:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},children:[c.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[c.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-ter",children:[c.jsx(ql,{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.openCount",{count:l?.summary.openDispatches??0})}),c.jsx("span",{className:"pill pill--ghost",children:o("actionCenter.reportCount",{count:l?.summary.recentReports??0})})]}),c.jsx("div",{className:"mt-2 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")}):y?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"shrink-0 text-ter",children:Lm(y,o)}),v?c.jsxs("span",{className:"min-w-0 truncate text-ter",title:v,children:["· ",v]}):null]}):c.jsx("span",{className:"text-ter",children:o(l?"actionCenter.noActivity":"actionCenter.loading")})}),l?c.jsx(aw,{copyingRecap:u,onCopyRecap:f,onOpenWorker:t,summary:l}):null]}):null]})},dA=({onOpenWorker:t,workspaceId:r})=>{const{t:o}=ke(),{error:i,summary:l}=nw(r),{copyingRecap:u,handleCopyRecap:f}=rw(r),[h,g]=b.useState(!1),{latest:m,latestDetail:y,stoppedWithQueue:v,waitingReports:x}=zm(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(S=>!S),"aria-expanded":h,"aria-label":o(h?"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:[h?c.jsx(To,{size:13,"aria-hidden":!0}):c.jsx(lc,{size:13,"aria-hidden":!0}),c.jsx(ql,{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.openCount",{count:l?.summary.openDispatches??0})}),c.jsx("span",{className:"pill pill--ghost",children:o("actionCenter.reportCount",{count:l?.summary.recentReports??0})}),v>0?c.jsxs("span",{className:"pill",style:{background:"color-mix(in oklab, var(--status-orange) 15%, transparent)",color:"var(--status-orange)"},children:[c.jsx(dc,{size:11,"aria-hidden":!0}),o("actionCenter.stoppedWithQueue",{count:v})]}):null,x>0?c.jsx("span",{className:"pill pill--ghost",children:o("actionCenter.waitingReports",{count:x})}):null]}),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")}):m?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"shrink-0 text-ter",children:Lm(m,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")})}),h&&l?c.jsx(aw,{copyingRecap:u,onCopyRecap:f,onOpenWorker:t,summary:l}):null]})};let Zl=!1;const Ff=new Set,fA=()=>Zl,ow=t=>{if(Zl!==t){Zl=t;for(const r of Ff)r()}},mA=()=>{ow(!Zl)},pA=t=>(Ff.add(t),()=>Ff.delete(t)),sw=()=>b.useSyncExternalStore(pA,fA,()=>!1),ky="(max-width: 767px)",iw=b.createContext({mode:"wide"}),sf={mode:"wide"},hA={mode:"mobile"},gA=(t=typeof window<"u"?window.matchMedia.bind(window):void 0)=>{const r=i=>{if(!t)return()=>{};const l=t(ky);return l.addEventListener?.("change",i),()=>l.removeEventListener?.("change",i)},o=()=>t&&t(ky).matches?hA:sf;return b.useSyncExternalStore(r,o,()=>sf)},vA=({children:t,value:r})=>{const o=gA();return c.jsx(iw.Provider,{value:r??o,children:t})},lw=()=>b.useContext(iw),Nt=()=>lw().mode==="mobile",cw="hive.notification.settings",co={desktop:!1,detail:"brief",sound:"soft"},yA={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"},bA=t=>t==="off"||t==="ping"||t==="chime"||t==="soft"||t==="cascade"||t==="beacon"||t==="resolve",wA=()=>{if(typeof window>"u")return co;try{const t=window.localStorage.getItem(cw);if(!t)return co;const r=JSON.parse(t);return{desktop:typeof r.desktop=="boolean"?r.desktop:co.desktop,detail:r.detail==="detailed"?"detailed":co.detail,sound:bA(r.sound)?r.sound:co.sound}}catch{return co}},xA=t=>{try{window.localStorage.setItem(cw,JSON.stringify(t))}catch{}},Sy=t=>{if(!(t==="off"||typeof window>"u"))try{const r=new window.Audio(yA[t]);r.preload="auto",r.volume=.72,r.play()?.catch(()=>{})}catch{}},uw=b.createContext(null),kA=({children:t})=>{const r=Jt(),{t:o}=ke(),[i,l]=b.useState(()=>wA());b.useEffect(()=>{xA(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}),r.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}),r.show({kind:"warning",message:o("notifications.toast.blocked")}),!1;const v=await window.Notification.requestPermission()==="granted";return u({desktop:v}),v||r.show({kind:"warning",message:o("notifications.toast.declined")}),v},[o,r,u]),h=b.useCallback(({brief:y,detail:v,kind:x,title:S})=>{const T=i.detail==="detailed"&&v?v:y;if(r.show({kind:x,message:T}),Sy(i.sound),i.desktop&&typeof window<"u"&&"Notification"in window&&window.Notification.permission==="granted")try{new window.Notification(S,{body:T})}catch{}},[i,r]),g=b.useCallback(y=>{Sy(y)},[]),m=b.useMemo(()=>({notify:h,previewSound:g,requestDesktopNotifications:f,settings:i,updateSettings:u}),[h,g,f,i,u]);return c.jsx(uw.Provider,{value:m,children:t})},xc=()=>{const t=b.useContext(uw);if(!t)throw new Error("useNotifications must be used within NotificationProvider");return t},SA={coder:"role.coder",custom:"role.custom",reviewer:"role.reviewer",sentinel:"role.sentinel",tester:"role.tester"},EA=t=>new Map(t.map(r=>[r.id,{id:r.id,name:r.name,pendingTaskCount:r.pendingTaskCount,role:r.role,status:r.status}])),CA=({terminalRuns:t,workers:r,workspace:o})=>{const{notify:i}=xc(),{t:l}=ke(),u=b.useRef(null);return b.useEffect(()=>{if(!o){u.current=null;return}const f=EA(r),h=u.current;if(u.current={workers:f,workspaceId:o.id},!(!h||h.workspaceId!==o.id))for(const g of f.values()){const m=h.workers.get(g.id);if(!m)continue;if(m.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,count:g.pendingTaskCount}),kind:"error",title:l("notifications.workerStopped.title")});continue}if(m.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(SA[g.role])}),kind:"success",title:l("notifications.workerStarted.title")});continue}(g.pendingTaskCount<m.pendingTaskCount||m.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,count:g.pendingTaskCount}),kind:"success",title:l("notifications.workerReported.title")})}},[i,l,r,o]),null},TA=({tabs:t,activeId:r,onSelect:o,onClose:i,onClosePanel:l,onNewShell:u,newShellPending:f})=>{const{t:h}=ke();return c.jsxs("div",{role:"tablist","aria-label":h("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 m=g.id===r,y=h("terminalPanel.closeTab",{name:g.label}),v=x=>{x.stopPropagation(),i(g.id)};return c.jsxs("div",{role:"tab","aria-selected":m,"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:m?"var(--bg-1)":"transparent",borderRightColor:"var(--border)",color:m?"var(--text-primary)":"var(--text-secondary)"},children:[m?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:x=>{x.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(cc,{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 ${m?"opacity-100":"opacity-0 group-hover:opacity-100 pointer-coarse:opacity-100"}`,style:{color:"var(--text-secondary)"},children:c.jsx(ya,{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:h("terminalPanel.closePanel"),children:c.jsx("button",{type:"button","aria-label":h("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(ya,{size:12,"aria-hidden":!0})})}),c.jsx(Qe,{label:h("terminalPanel.newShell"),children:c.jsx("button",{type:"button","aria-label":h("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(ka,{size:12,className:"animate-spin","aria-hidden":!0}):c.jsx(Ms,{size:12,"aria-hidden":!0})})})]})]})},dw="hive.terminal-panel.height",fw="hive.terminal-panel.collapsed",Kf=160,NA=.35,AA=160,Ls=t=>{const r=typeof window<"u"?window.innerHeight:800,o=Math.max(Kf,r-AA);return Math.min(Math.max(t,Kf),o)},lf=()=>{const t=typeof window<"u"?window.innerHeight:800;return Ls(Math.floor(t*NA))},_A=()=>{try{const t=window.localStorage.getItem(dw);if(!t)return lf();const r=Number.parseInt(t,10);return Number.isFinite(r)?Ls(r):lf()}catch{return lf()}},jA=()=>{try{return window.localStorage.getItem(fw)==="1"}catch{return!1}},RA=()=>{const[t,r]=b.useState(()=>_A()),[o,i]=b.useState(()=>jA()),[l,u]=b.useState(!1);b.useEffect(()=>{try{window.localStorage.setItem(dw,String(Math.round(t)))}catch{}},[t]),b.useEffect(()=>{try{window.localStorage.setItem(fw,o?"1":"0")}catch{}},[o]),b.useEffect(()=>{const m=()=>r(y=>Ls(y));return window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)},[]);const f=b.useCallback(m=>r(Ls(m)),[]),h=b.useCallback(m=>i(m),[]),g=b.useCallback(m=>{m.preventDefault();const y=m.clientY;let v=t;r(C=>(v=C,C)),u(!0);const x=document.body.style.cursor,S=document.body.style.userSelect;document.body.style.cursor="ns-resize",document.body.style.userSelect="none";const T=C=>{const E=C.clientY-y;r(Ls(v-E))},k=()=>{u(!1),document.body.style.cursor=x,document.body.style.userSelect=S,document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",k),document.removeEventListener("pointercancel",k)};document.addEventListener("pointermove",T),document.addEventListener("pointerup",k),document.addEventListener("pointercancel",k)},[t]);return{height:t,collapsed:o,dragging:l,setHeight:f,setCollapsed:h,beginDrag:g}},OA=(t,r)=>r?t.find(o=>o.id===r)??null:null,DA=({tabs:t,activeId:r,onSelect:o,onClose:i,onClosePanel:l,onNewShell:u,newShellPending:f,onStartWorker:h,startingWorkerId:g})=>{const{t:m}=ke(),y=RA(),v=Nt();if(t.length===0)return null;const x=OA(t,r)??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"&&r&&(S.preventDefault(),i(r))},children:[v?null:c.jsx("div",{role:"separator","aria-orientation":"horizontal","aria-label":m("terminalPanel.resizeAria"),"aria-valuemin":Kf,"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(TA,{tabs:t,activeId:x?.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(MA,{tab:S,isActive:S.id===(x?.id??null),onStartWorker:h,startingWorkerId:g},S.id))})]})},MA=({tab:t,isActive:r,onStartWorker:o,startingWorkerId:i})=>{const{t:l}=ke(),u=r?"flex h-full w-full":"hidden";if(t.kind==="worker"){if(!t.runId){const f=i===t.workerId;return c.jsxs("div",{className:r?"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(cc,{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(ka,{size:12,className:"animate-spin","aria-hidden":!0}):c.jsx(No,{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}`})},cf=t=>`hive.terminal-panel.tabs.${t}`,uf=t=>`hive.terminal-panel.active.${t}`,LA=t=>`worker:${t}`,zA=t=>`shell:${t}`,Ey=t=>{try{const r=window.localStorage.getItem(t);if(!r)return[];const o=JSON.parse(r);return Array.isArray(o)?o.filter(i=>typeof i=="string"):[]}catch{return[]}},Cy=t=>{try{return window.localStorage.getItem(t)??""}catch{return""}},Ty=(t,r)=>{try{window.localStorage.setItem(t,r)}catch{}},HA=({workspaceId:t,workers:r,terminalRuns:o})=>{const[i,l]=b.useState(()=>Ey(cf(t))),[u,f]=b.useState(()=>{const A=Cy(uf(t));return A.length>0?A:null}),h=b.useRef(i);h.current=i;const g=b.useRef(t);b.useEffect(()=>{if(g.current===t)return;g.current=t,l(Ey(cf(t)));const A=Cy(uf(t));f(A.length>0?A:null)},[t]);const m=b.useRef(!1);b.useEffect(()=>{m.current=r.length>0||o.length>0},[t]),b.useEffect(()=>{(r.length>0||o.length>0)&&(m.current=!0)},[r,o]),b.useEffect(()=>{m.current&&Ty(cf(t),JSON.stringify(i))},[i,t]),b.useEffect(()=>{m.current&&Ty(uf(t),u??"")},[u,t]);const y=b.useMemo(()=>new Map(r.map(A=>[A.id,A])),[r]),{runByAgentId:v,shellRunById:x}=b.useMemo(()=>{const A=new Map,j=new Map;for(const N of o)A.set(N.agent_id,N),fc(N,t)&&j.set(N.run_id,N);return{runByAgentId:A,shellRunById:j}},[o,t]),S=b.useMemo(()=>{const A=[];for(const j of i)if(j.startsWith("worker:")){const N=j.slice(7),O=y.get(N);if(!O)continue;const D=v.get(O.id);A.push({id:j,kind:"worker",workerId:N,runId:D?.run_id??null,label:O.name})}else if(j.startsWith("shell:")){const N=j.slice(6),O=x.get(N);if(!O)continue;A.push({id:j,kind:"shell",runId:N,label:O.agent_name})}return A},[i,y,v,x]);b.useEffect(()=>{m.current&&l(A=>{const j=A.filter(N=>N.startsWith("worker:")?y.has(N.slice(7)):N.startsWith("shell:")?x.has(N.slice(6)):!1);return j.length===A.length?A:j})},[y,x]),b.useEffect(()=>{m.current&&(u&&S.some(A=>A.id===u)||f(S[0]?.id??null))},[u,S]);const T=b.useCallback(A=>{m.current=!0;const j=LA(A);l(N=>N.includes(j)?N:[...N,j]),f(j)},[]),k=b.useCallback(A=>{m.current=!0;const j=zA(A);l(N=>N.includes(j)?N:[...N,j]),f(j)},[]),C=b.useCallback(A=>{const j=h.current,N=j.filter(O=>O!==A);N.length!==j.length&&(l(N),f(O=>{if(O!==A)return O;const D=j.indexOf(A);return N[D]??N[D-1]??N[0]??null}))},[]),E=b.useCallback(A=>f(A),[]);return{tabs:S,activeId:u,openWorkerTab:T,openShellTab:k,closeTab:C,setActive:E}},Ny=500,BA=2500,WA=5e3,UA=t=>t.status==="starting"||t.status==="running",IA=(t,r)=>t>0?Math.min(Ny*2**t,WA):r.some(UA)?Ny:BA,mw=t=>`${t}:orchestrator`,qA=(t,r)=>t.length!==r.length?!1:t.every((o,i)=>{const l=r[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}),PA=t=>{const[r,o]=b.useState([]);return b.useEffect(()=>{if(!t){o([]);return}let i=!1,l=0,u=!1,f=[],h;const g=()=>{i||(h=window.setTimeout(m,IA(l,f)))},m=()=>{u||(u=!0,hC(t).then(y=>{i||(l=0,f=y,o(v=>qA(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 m(),()=>{i=!0,h!==void 0&&window.clearTimeout(h)}},[t]),r},FA=(t,r)=>t.find(o=>o.agent_id===mw(r)),KA=(t,r)=>t.find(o=>o.agent_id===r),YA=({onCloseFailed:t,onShellRunClosed:r,onShellRunStarted:o,panelTabs:i,shellRuns:l,workspaceId:u})=>{const[f,h]=b.useState(null),[g,m]=b.useState(null),[y,v]=b.useState(!1),x=b.useRef(new Map),S=b.useRef(0),T=b.useRef(new Map),k=b.useRef(new Map),C=b.useRef(new Set),E=b.useRef(u),j=(l.find(Y=>Y.run_id===g)??l[0]??null)?.run_id??null,N=b.useCallback((Y,J)=>{const G=T.current.get(Y)??new Set;G.add(J),T.current.set(Y,G)},[]),O=b.useCallback((Y,J,G)=>{const V=k.current.get(Y)??new Map;V.set(J,G),k.current.set(Y,V),G.finally(()=>{const M=k.current.get(Y);M&&(M.delete(J),M.size===0&&k.current.delete(Y))}).catch(()=>{})},[]),D=b.useCallback((Y,J)=>{const G=T.current.get(Y);G&&(G.delete(J),G.size===0&&T.current.delete(Y))},[]);b.useLayoutEffect(()=>{E.current=u},[u]),b.useEffect(()=>()=>{T.current.clear(),k.current.clear(),C.current.clear()},[]),b.useEffect(()=>{h(null),m(null),v(!1)},[u]),b.useEffect(()=>{if(!u)return;const Y=T.current.get(u);if(!Y)return;const J=new Set(l.map(V=>V.run_id)),G=k.current.get(u);for(const V of Array.from(Y))G?.has(V)||J.has(V)||D(u,V)},[l,D,u]);const L=()=>{if(!u||x.current.has(u))return;const Y=u,J=S.current+1;S.current=J,x.current.set(Y,J);const G=()=>E.current===Y,V=()=>x.current.get(Y)===J;h(null),v(!0),uC(Y).then(M=>{o?.(Y,M),G()&&(m(M.run_id),i.openShellTab(M.run_id))}).catch(M=>{G()&&h(M instanceof Error?M.message:String(M))}).finally(()=>{V()&&x.current.delete(Y),G()&&v(!1)})},B=()=>{if(!u||x.current.has(u)||C.current.has(u))return;const Y=u,J=Array.from(k.current.get(Y)?.values()??[]);if(J.length===0){L();return}C.current.add(Y),h(null),v(!0),Promise.allSettled(J).then(G=>{G.some(V=>V.status==="rejected")||E.current===Y&&(x.current.has(Y)||L())}).finally(()=>{C.current.delete(Y),E.current===Y&&!x.current.has(Y)&&v(!1)})};return{closeShellTab:Y=>{if(!u)return;const J=l.find(V=>V.run_id!==Y)??null;j===Y&&m(J?.run_id??null),r?.(u,Y),N(u,Y);const G=dC(u,Y).catch(V=>{throw D(u,Y),t(V instanceof Error?V.message:String(V)),V});O(u,Y,G),G.catch(()=>{})},openShell:()=>{if(!u||x.current.has(u)||y)return;const Y=i.tabs.find(V=>V.kind==="shell");if(Y){i.setActive(Y.id);return}const J=T.current.get(u)??new Set,G=l.find(V=>!J.has(V.run_id));if(G){m(G.run_id),i.openShellTab(G.run_id);return}if(J.size>0){B();return}L()},shellError:f,shellStarting:y,startNewShell:()=>{if(!u||x.current.has(u)||y)return;if((T.current.get(u)??new Set).size>0){B();return}L()}}},pw="hive.split.orch-pct",Os=.3,Ds=.78,Ll=.6,Ay=.02,zl=(t,r,o)=>Math.min(o,Math.max(r,t)),$A=()=>{try{const t=localStorage.getItem(pw);if(!t)return Ll;const r=Number.parseFloat(t);return Number.isFinite(r)?zl(r,Os,Ds):Ll}catch{return Ll}},VA=()=>{const t=b.useRef(null),[r,o]=b.useState(()=>$A()),[i,l]=b.useState(!1);b.useEffect(()=>{try{localStorage.setItem(pw,r.toFixed(4))}catch{}},[r]);const u=b.useCallback(h=>{h.preventDefault();const g=t.current;if(!g)return;l(!0);const m=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 k=(S.clientX-T.left)/T.width;o(zl(k,Os,Ds))},x=()=>{l(!1),document.body.style.userSelect=m,document.body.style.cursor=y,document.removeEventListener("pointermove",v),document.removeEventListener("pointerup",x),document.removeEventListener("pointercancel",x)};document.addEventListener("pointermove",v),document.addEventListener("pointerup",x),document.addEventListener("pointercancel",x)},[]),f=b.useCallback(h=>{h.key==="ArrowLeft"?(h.preventDefault(),o(g=>zl(g-Ay,Os,Ds))):h.key==="ArrowRight"?(h.preventDefault(),o(g=>zl(g+Ay,Os,Ds))):h.key==="Home"?(h.preventDefault(),o(Os)):h.key==="End"?(h.preventDefault(),o(Ds)):h.key==="Enter"&&(h.metaKey||h.ctrlKey)&&(h.preventDefault(),o(Ll))},[]);return{containerRef:t,orchPct:r,dragging:i,beginDrag:u,onKeyDown:f}},Qs=({title:t,description:r,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:r}),i]}),Wr=t=>r=>{console.error(`[hive] swallowed:${t}`,r)},GA={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"}},XA=t=>GA[t]??null,ZA=({presetId:t,presetName:r})=>{const{t:o}=ke(),i=XA(t),[l,u]=b.useState(!1),[f,h]=b.useState(!1),g=b.useRef(null);b.useEffect(()=>()=>{g.current&&clearTimeout(g.current)},[]);const m=()=>{i&&m0(i.command).then(()=>{u(!0),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{u(!1),g.current=null},1500)}).catch(Wr("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:r})}),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:m,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(xa,{size:13,"aria-hidden":!0}):c.jsx(Gs,{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(Pb,{size:11,"aria-hidden":!0}),o("workspace.preset.installDocs")]})]}):null,c.jsxs("button",{type:"button",onClick:()=>h(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(To,{size:12,"aria-hidden":!0}):c.jsx(lc,{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]})},QA={"cursor-agent":"cursor"},JA=/^(\S+) CLI not found in PATH/u,e_=()=>{const{t}=ke();return c.jsx("div",{"data-testid":"orchestrator-starting-body",className:"flex flex-1",children:c.jsx(Qs,{icon:c.jsx(ka,{size:24,className:"animate-spin"}),title:t("orchestrator.startingTitle"),description:t("orchestrator.startingDesc")})})},t_=({onStart:t})=>{const{t:r}=ke();return c.jsx("div",{"data-testid":"orchestrator-stopped-body",className:"flex flex-1",children:c.jsx(Qs,{icon:c.jsx(hm,{size:24}),title:r("orchestrator.stoppedTitle"),description:r("orchestrator.stoppedDesc"),action:c.jsxs("button",{type:"button",onClick:t,className:"icon-btn icon-btn--primary","data-testid":"orchestrator-start",children:[c.jsx(No,{size:12,"aria-hidden":!0})," ",r("orchestrator.start")]})})})},n_=({error:t,onRemoveWorkspace:r,onRestart:o})=>{const{t:i}=ke(),[l,u]=b.useState(!1),f=()=>{navigator.clipboard?.writeText(t).then(()=>{u(!0),window.setTimeout(()=>u(!1),1500)}).catch(()=>{})},h=JA.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(hm,{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(Gs,{size:12,"aria-hidden":!0})})})]}),h?c.jsx("div",{className:"w-full",children:c.jsx(ZA,{presetId:QA[h]??h,presetName:h})}):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(vm,{size:12,"aria-hidden":!0})," ",i("common.retry")]}),c.jsx("button",{type:"button",onClick:r,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")})]})},hw=t=>`hive.orchestrator.first-dispatch-guide.dismissed.${t}`,_y=t=>{try{return window.localStorage.getItem(hw(t))==="1"}catch{return!1}},r_=t=>{try{window.localStorage.setItem(hw(t),"1")}catch{}},a_=({onDismiss:t,onSend:r,sending:o})=>{const{t:i}=ke();return c.jsxs("div",{className:"absolute left-3 right-3 bottom-3 z-10 flex items-center gap-2 rounded-md px-2.5 py-2 shadow-lg","data-testid":"orchestrator-first-dispatch-guide",style:{background:"color-mix(in oklab, var(--bg-1) 94%, transparent)",border:"1px solid var(--border-bright)"},children:[c.jsxs("button",{type:"button",onClick:r,disabled:o,className:"icon-btn icon-btn--primary min-w-0 flex-1 justify-start","data-testid":"orchestrator-first-dispatch-send",children:[o?c.jsx(ka,{size:13,className:"animate-spin"}):c.jsx(Vb,{size:13}),c.jsx("span",{className:"truncate",children:i("orchestrator.firstDispatchGuide")})]}),c.jsx(Qe,{label:i("common.dismiss"),children:c.jsx("button",{type:"button",onClick:t,"aria-label":i("common.dismiss"),className:"icon-btn icon-btn--ghost h-8 w-8 justify-center","data-testid":"orchestrator-first-dispatch-dismiss",children:c.jsx(ya,{size:13,"aria-hidden":!0})})})]})},o_=({onSendFirstDispatchGuide:t,state:r,onRemoveWorkspace:o,onRestart:i,onStart:l,onStop:u,workspaceId:f})=>{const{t:h}=ke(),g=Nt(),[m,y]=b.useState(()=>_y(f)),[v,x]=b.useState(!1);b.useEffect(()=>{y(_y(f)),x(!1)},[f]);const S=r.kind==="running"&&r.startupBlockedReason===null&&!r.hasUserInputSinceStart&&!m,T=()=>{r_(f),y(!0)},k=()=>{v||(x(!0),t().then(T).catch(()=>{}).finally(()=>x(!1)))};return c.jsx("div",{className:"orchestrator-pane-root relative flex h-full w-full min-w-0 flex-col",style:{background:"var(--bg-crust)",...g?{}:{borderRight:"1px solid var(--border)"}},"data-testid":"orchestrator-terminal-slot",children:r.kind==="running"?c.jsxs(c.Fragment,{children:[c.jsx("div",{id:`orch-pty-${r.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:h("terminal.statusConnecting")})})}),g?null:c.jsx(Qe,{label:h("orchestrator.stop"),children:c.jsx("button",{type:"button",onClick:u,"aria-label":h("orchestrator.stop"),"data-testid":"orchestrator-stop",className:"icon-btn icon-btn--ghost absolute right-2 top-2 z-10 h-7 w-7 justify-center hover:text-status-red",style:{background:"var(--bg-2)",border:"1px solid var(--border)"},children:c.jsx(ym,{size:13,"aria-hidden":!0})})}),S?c.jsx(a_,{onDismiss:T,onSend:k,sending:v}):null]}):r.kind==="failed"?c.jsx(n_,{error:r.error,onRemoveWorkspace:o,onRestart:i}):r.kind==="stopped"?c.jsx(t_,{onStart:l}):c.jsx(e_,{})})},s_=({workspaceId:t,terminalRuns:r,autostartError:o,suppressAutostartRunId:i,onClearAutostartError:l,onAfterStart:u})=>{const f=FA(r,t),h=mw(t),[g,m]=b.useState(null),[y,v]=b.useState(null),[x,S]=b.useState(null),T=y?.workspaceId===t?y.runId:null,k=!!(x&&!f&&!T);b.useEffect(()=>{S(i??null)},[i]),b.useEffect(()=>{f&&(m(null),v(null),S(null))},[f]),b.useEffect(()=>{if(!x||f)return;const N=window.setTimeout(()=>S(null),1500);return()=>window.clearTimeout(N)},[x,f]),b.useEffect(()=>{if(!T||f)return;const N=window.setTimeout(()=>v(null),2e3);return()=>window.clearTimeout(N)},[T,f]);let C;f?C={hasUserInputSinceStart:f.has_user_input_since_start===!0,kind:"running",runId:f.run_id,startupBlockedReason:f.startup_blocked_reason??null}:T?C={hasUserInputSinceStart:!1,kind:"running",runId:T,startupBlockedReason:null}:g===t||k?C={kind:"starting"}:o?C={kind:"failed",error:o}:C={kind:"stopped"};const E=b.useCallback(()=>{!t||g===t||f||(l(),m(t),Kl(t,h).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(()=>m(N=>N===t?null:N)))},[h,u,l,f,g,t]),A=b.useCallback(()=>{f&&Yl(f.run_id).catch(N=>{console.error("[hive] swallowed:orchestrator.stop",N)})},[f]),j=b.useCallback(()=>{if(l(),f){Yl(f.run_id).catch(N=>{console.error("[hive] swallowed:orchestrator.restart.stop",N)}).then(()=>Kl(t,h)).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}E()},[h,u,l,f,E,t]);return{state:C,start:E,stop:A,restart:j}},gw=["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"],vw=["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"],yw=["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"],i_=["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"],bw=["八大山人","毕昇","蔡伦","干将","顾恺之","黄道婆","李冰","柳公权","鲁班","莫邪","墨子","沈括","宋应星","唐寅","王羲之","文徵明","吴道子","颜真卿","张衡","张择端","郑板桥","祖冲之"],ww=["班固","包拯","狄仁杰","董仲舒","范仲淹","顾炎武","管仲","海瑞","韩非","韩愈","嵇康","贾谊","孔子","老子","林则徐","柳宗元","孟子","欧阳修","商鞅","司马光","司马迁","谭嗣同","王安石","王守仁","魏徵","荀子","张居正","周敦颐","朱熹","庄子"],xw=["班超","扁鹊","法显","葛洪","华佗","鉴真","郦道元","李时珍","神农","苏武","孙思邈","陶弘景","徐光启","徐霞客","玄奘","张骞","张仲景","郑和"],l_=["白居易","蔡文姬","曹操","曹雪芹","曹植","程咬金","大禹","杜甫","杜牧","范蠡","关羽","汉武帝","韩信","忽必烈","花木兰","黄帝","霍去病","姜子牙","康熙","李白","李广","李靖","李清照","李煜","刘邦","刘备","刘伯温","柳永","陆游","罗贯中","吕布","吕不韦","孟浩然","蒙恬","努尔哈赤","庞统","蒲松龄","戚继光","乾隆","秦始皇","屈原","上官婉儿","施耐庵","司马懿","苏轼","孙膑","孙权","孙武","孙中山","唐太宗","唐玄宗","陶渊明","王维","卫青","文天祥","吴承恩","吴起","萧何","谢安","辛弃疾","杨贵妃","雍正","虞姬","岳飞","张飞","张良","张仪","赵子龙","周瑜","朱棣","诸葛亮","朱元璋","左宗棠"],c_=[...gw,...vw,...yw,...i_],u_=[...bw,...ww,...xw,...l_],d_=["argus","cassandra","copernicus","halley","herodotus","hypatia","kepler","ptolemy","thucydides","tycho-brahe"],f_=["班固","郭守敬","沈括","司马光","司马迁","一行","张衡","祖冲之"],m_={en:{coder:gw,reviewer:vw,tester:yw,sentinel:d_,custom:c_},zh:{coder:bw,reviewer:ww,tester:xw,sentinel:f_,custom:u_}},p_=()=>{const t=new Uint32Array(1);return globalThis.crypto.getRandomValues(t),t[0]??0},df=({language:t="en",role:r="coder",usedNames:o,nextUint32:i=p_}={})=>{const l=m_[t][r],u=o&&o.size>0?l.filter(h=>!o.has(h)):l,f=u.length>0?u:l;return f[i()%f.length]},zs={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(`
|
|
12
|
+
`),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(`
|
|
13
|
+
`),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(`
|
|
14
|
+
`),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(`
|
|
15
|
+
`),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(`
|
|
16
|
+
`)},zh:{coder:["你是实现型 Coder,负责把明确任务落成最小正确代码改动。","工作方式:","- 先阅读相关文件和现有模式,再动手。","- 优先小步修改,避免无关重构和范围扩张。","- 改动后运行能覆盖风险的验证命令;不能验证时说明原因。","交付说明要包含:改动文件、验证结果、剩余风险或阻塞。"].join(`
|
|
17
|
+
`),custom:["你是自定义成员。请把这段改成该成员的行为契约。","建议包含:","- 目标:这个成员主要负责什么。","- 边界:哪些事可以做,哪些事不要做。","- 工作方式:如何调查、修改、验证或审查。","- 完成标准:交付时需要说明哪些结果、风险和阻塞。"].join(`
|
|
18
|
+
`),reviewer:["你是监工型 Reviewer,负责质量审查,不替代 Orchestrator,也不默认改代码。","工作方式:","- 优先找真实 bug、回归风险、边界条件和测试缺口。","- 发现问题时给出严重度、文件/行号、触发条件和最小修复建议。","- 没有高风险问题时明确说清剩余风险和未验证范围。","交付说明按严重度排序,先列 blocking 问题。"].join(`
|
|
19
|
+
`),sentinel:["你是只读巡检型 Sentinel,负责观察团队运行状态,不执行任务、不修改任何东西。","工作方式:","- 系统会定期向你注入工作区快照(成员状态、未关闭派单、疑似孤儿单)。",'- 把快照与你自己的观察对照,只把"值得人看一眼"的事项报上去。',"- 长时间无汇报不等于卡死——正常的大任务本来就慢。","硬性边界:","- 只观察:不改文件、不跑有副作用的命令、不派活。",'- 你不接派单,也没有 `team report`;发现统一用 `team status "<巡检发现>"` 汇报。',"- 没有异常时保持安静。"].join(`
|
|
20
|
+
`),tester:["你是验证型 Tester,负责复现、测试和证据化验证。","工作方式:","- 先明确要验证的行为、入口和失败条件。","- 优先跑真实命令或真实链路;必要时补充最小测试。","- 记录命令、结果、关键输出和不能覆盖的场景。","交付说明要区分通过、失败、未验证和建议下一步。"].join(`
|
|
21
|
+
`)}},ff=(t,r,o)=>t==="custom"?r.find(i=>i.roleType==="custom"&&i.isBuiltin)?.description??zs[o].custom:zs[o][t],h_=({createWorker:t,open:r,workers:o})=>{const{language:i}=ke(),[l,u]=b.useState(""),[f,h]=b.useState("coder"),[g,m]=b.useState([]),[y,v]=b.useState(null),[x,S]=b.useState(!1),[T,k]=b.useState(null),[C,E]=b.useState(zs[i].coder),[A,j]=b.useState([]),[N,O]=b.useState("claude"),[D,L]=b.useState(""),[B,P]=b.useState(null),[re,ee]=b.useState(!1),Y=b.useRef(!1),J=b.useRef(!1),G=b.useRef(!1),V=ff(f,g,i),M=b.useMemo(()=>g.filter(ue=>!ue.isBuiltin),[g]);b.useEffect(()=>{if(!r)return;let ue=!1;return lC().then(pe=>{ue||(j(pe),O(Ne=>pe.some(Ce=>Ce.id===Ne&&Ce.available)?Ne:pe.find(Ce=>Ce.id==="claude"&&Ce.available)?.id??pe.find(Ce=>Ce.available)?.id??pe[0]?.id??""))}).catch(pe=>{ue||P(pe instanceof Error?pe.message:String(pe))}),()=>{ue=!0}},[r]),b.useEffect(()=>{if(!r)return;let ue=!1;return fC().then(pe=>{ue||m(pe)}).catch(pe=>{ue||P(pe instanceof Error?pe.message:String(pe))}),()=>{ue=!0}},[r]),b.useEffect(()=>{y===null&&(J.current||E(ff(f,g,i)))},[i,g,f,y]);const q=ue=>{J.current=!0,E(ue)},I=ue=>{Y.current=!1,u(ue)},Z=b.useMemo(()=>new Set(o.map(ue=>ue.name)),[o]),F=b.useRef(Z);F.current=Z;const R=()=>{Y.current=!0,u(df({language:i,role:f,usedNames:Z}))};b.useEffect(()=>{const ue=r&&!G.current;if(G.current=r,!!r){if(ue){Y.current=!0,u(df({language:i,role:f,usedNames:F.current}));return}Y.current&&u(df({language:i,role:f,usedNames:F.current}))}},[r,i,f]);const W=ue=>{h(ue),v(null),J.current=!1,E(ff(ue,g,i))};return{commandPresets:A,commandPresetId:N,createWorkerError:B,creating:re,customTemplates:M,roleDescription:C,roleDescriptionDefault:V,selectedTemplateId:y,startupCommand:D,templateBusy:x,templateError:T,workerName:l,workerRole:f,setCommandPresetId:ue=>{O(ue)},setRoleDescription:q,setStartupCommand:L,setWorkerName:I,setWorkerRole:W,selectTemplate:ue=>{if(ue===null){h("custom"),v(null),J.current=!1,E(zs[i].custom);return}const pe=g.find(Ne=>Ne.id===ue);!pe||pe.isBuiltin||(h("custom"),v(ue),J.current=!1,E(pe.description))},saveAsTemplate:async ue=>{const pe=ue.trim(),Ne=C.trim();if(!(!pe||!Ne)){S(!0),k(null);try{const Ce=await mC({name:pe,roleType:"custom",description:Ne});m(Se=>[...Se,Ce]),v(Ce.id),h("custom"),J.current=!1,E(Ce.description)}catch(Ce){throw k(Ce instanceof Error?Ce.message:String(Ce)),Ce}finally{S(!1)}}},deleteTemplate:async ue=>{const pe=g.find(Ne=>Ne.id===ue);if(!(!pe||pe.isBuiltin)){S(!0),k(null);try{await pC(ue),m(Ne=>Ne.filter(Ce=>Ce.id!==ue)),y===ue&&(v(null),J.current=!1,E(zs[i].custom))}catch(Ne){throw k(Ne instanceof Error?Ne.message:String(Ne)),Ne}finally{S(!1)}}},randomizeWorkerName:R,resetRoleDescription:()=>{J.current=!1,E(V)},resetError:()=>P(null),applyMarketplaceImport:({name:ue,description:pe})=>{Y.current=!1,u(ue),v(null),h("custom"),J.current=!0,E(pe)},submit:(ue,pe)=>{ue.preventDefault(),ee(!0),P(null),t({commandPresetId:N,name:l,role:f,roleDescription:C,startupCommand:D}).then(({error:Ne})=>{u(""),Y.current=!1,W("coder"),v(null),O("claude"),L(""),pe(),Ne&&P(Ne)}).catch(Ne=>{P(Ne instanceof Error?Ne.message:String(Ne))}).finally(()=>ee(!1))}}},g_=[{icon:c.jsx(Fb,{size:16}),titleKey:"welcome.step1Title",descriptionKey:"welcome.step1Desc"},{icon:c.jsx(bm,{size:16}),titleKey:"welcome.step2Title",descriptionKey:"welcome.step2Desc"},{icon:c.jsx(Vb,{size:16}),titleKey:"welcome.step3Title",descriptionKey:"welcome.step3Desc"}],v_=({onAddWorkspace:t,onTryDemo:r,heroImageSrc:o,disabledReason:i})=>{const{t:l}=ke(),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:g_.map((f,h)=>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:h+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(dc,{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(oS,{size:14,"aria-hidden":!0})]}),r?c.jsx("button",{type:"button",onClick:r,className:"text-xs text-sec underline hover:text-pri",children:l("welcome.demo")}):null]})};var mf="focusScope.autoFocusOnMount",pf="focusScope.autoFocusOnUnmount",jy={bubbles:!1,cancelable:!0},y_="FocusScope",kw=b.forwardRef((t,r)=>{const{loop:o=!1,trapped:i=!1,onMountAutoFocus:l,onUnmountAutoFocus:u,...f}=t,[h,g]=b.useState(null),m=xo(l),y=xo(u),v=b.useRef(null),x=Sn(r,k=>g(k)),S=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(i){let k=function(j){if(S.paused||!h)return;const N=j.target;h.contains(N)?v.current=N:Br(v.current,{select:!0})},C=function(j){if(S.paused||!h)return;const N=j.relatedTarget;N!==null&&(h.contains(N)||Br(v.current,{select:!0}))},E=function(j){if(document.activeElement===document.body)for(const O of j)O.removedNodes.length>0&&Br(h)};document.addEventListener("focusin",k),document.addEventListener("focusout",C);const A=new MutationObserver(E);return h&&A.observe(h,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",k),document.removeEventListener("focusout",C),A.disconnect()}}},[i,h,S.paused]),b.useEffect(()=>{if(h){Oy.add(S);const k=document.activeElement;if(!h.contains(k)){const E=new CustomEvent(mf,jy);h.addEventListener(mf,m),h.dispatchEvent(E),E.defaultPrevented||(b_(E_(Sw(h)),{select:!0}),document.activeElement===k&&Br(h))}return()=>{h.removeEventListener(mf,m),setTimeout(()=>{const E=new CustomEvent(pf,jy);h.addEventListener(pf,y),h.dispatchEvent(E),E.defaultPrevented||Br(k??document.body,{select:!0}),h.removeEventListener(pf,y),Oy.remove(S)},0)}}},[h,m,y,S]);const T=b.useCallback(k=>{if(!o&&!i||S.paused)return;const C=k.key==="Tab"&&!k.altKey&&!k.ctrlKey&&!k.metaKey,E=document.activeElement;if(C&&E){const A=k.currentTarget,[j,N]=w_(A);j&&N?!k.shiftKey&&E===N?(k.preventDefault(),o&&Br(j,{select:!0})):k.shiftKey&&E===j&&(k.preventDefault(),o&&Br(N,{select:!0})):E===A&&k.preventDefault()}},[o,i,S.paused]);return c.jsx(Wt.div,{tabIndex:-1,...f,ref:x,onKeyDown:T})});kw.displayName=y_;function b_(t,{select:r=!1}={}){const o=document.activeElement;for(const i of t)if(Br(i,{select:r}),document.activeElement!==o)return}function w_(t){const r=Sw(t),o=Ry(r,t),i=Ry(r.reverse(),t);return[o,i]}function Sw(t){const r=[],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();)r.push(o.currentNode);return r}function Ry(t,r){for(const o of t)if(!x_(o,{upTo:r}))return o}function x_(t,{upTo:r}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(r!==void 0&&t===r)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function k_(t){return t instanceof HTMLInputElement&&"select"in t}function Br(t,{select:r=!1}={}){if(t&&t.focus){const o=document.activeElement;t.focus({preventScroll:!0}),t!==o&&k_(t)&&r&&t.select()}}var Oy=S_();function S_(){let t=[];return{add(r){const o=t[0];r!==o&&o?.pause(),t=Dy(t,r),t.unshift(r)},remove(r){t=Dy(t,r),t[0]?.resume()}}}function Dy(t,r){const o=[...t],i=o.indexOf(r);return i!==-1&&o.splice(i,1),o}function E_(t){return t.filter(r=>r.tagName!=="A")}var hf=0;function C_(){b.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??My()),document.body.insertAdjacentElement("beforeend",t[1]??My()),hf++,()=>{hf===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),hf--}},[])}function My(){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 Dn=function(){return Dn=Object.assign||function(r){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)&&(r[u]=o[u])}return r},Dn.apply(this,arguments)};function Ew(t,r){var o={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&r.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++)r.indexOf(i[l])<0&&Object.prototype.propertyIsEnumerable.call(t,i[l])&&(o[i[l]]=t[i[l]]);return o}function T_(t,r,o){if(o||arguments.length===2)for(var i=0,l=r.length,u;i<l;i++)(u||!(i in r))&&(u||(u=Array.prototype.slice.call(r,0,i)),u[i]=r[i]);return t.concat(u||Array.prototype.slice.call(r))}var Hl="right-scroll-bar-position",Bl="width-before-scroll-bar",N_="with-scroll-bars-hidden",A_="--removed-body-scroll-bar-size";function gf(t,r){return typeof t=="function"?t(r):t&&(t.current=r),t}function __(t,r){var o=b.useState(function(){return{value:t,callback:r,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=r,o.facade}var j_=typeof window<"u"?b.useLayoutEffect:b.useEffect,Ly=new WeakMap;function R_(t,r){var o=__(null,function(i){return t.forEach(function(l){return gf(l,i)})});return j_(function(){var i=Ly.get(o);if(i){var l=new Set(i),u=new Set(t),f=o.current;l.forEach(function(h){u.has(h)||gf(h,null)}),u.forEach(function(h){l.has(h)||gf(h,f)})}Ly.set(o,t)},[t]),o}function O_(t){return t}function D_(t,r){r===void 0&&(r=O_);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=r(u,i);return o.push(f),function(){o=o.filter(function(h){return h!==f})}},assignSyncMedium:function(u){for(i=!0;o.length;){var f=o;o=[],f.forEach(u)}o={push:function(h){return u(h)},filter:function(){return o}}},assignMedium:function(u){i=!0;var f=[];if(o.length){var h=o;o=[],h.forEach(u),f=o}var g=function(){var y=f;f=[],y.forEach(u)},m=function(){return Promise.resolve().then(g)};m(),o={push:function(y){f.push(y),m()},filter:function(y){return f=f.filter(y),o}}}};return l}function M_(t){t===void 0&&(t={});var r=D_(null);return r.options=Dn({async:!0,ssr:!1},t),r}var Cw=function(t){var r=t.sideCar,o=Ew(t,["sideCar"]);if(!r)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var i=r.read();if(!i)throw new Error("Sidecar medium not found");return b.createElement(i,Dn({},o))};Cw.isSideCarExport=!0;function L_(t,r){return t.useMedium(r),Cw}var Tw=M_(),vf=function(){},kc=b.forwardRef(function(t,r){var o=b.useRef(null),i=b.useState({onScrollCapture:vf,onWheelCapture:vf,onTouchMoveCapture:vf}),l=i[0],u=i[1],f=t.forwardProps,h=t.children,g=t.className,m=t.removeScrollBar,y=t.enabled,v=t.shards,x=t.sideCar,S=t.noRelative,T=t.noIsolation,k=t.inert,C=t.allowPinchZoom,E=t.as,A=E===void 0?"div":E,j=t.gapMode,N=Ew(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),O=x,D=R_([o,r]),L=Dn(Dn({},N),l);return b.createElement(b.Fragment,null,y&&b.createElement(O,{sideCar:Tw,removeScrollBar:m,shards:v,noRelative:S,noIsolation:T,inert:k,setCallbacks:u,allowPinchZoom:!!C,lockRef:o,gapMode:j}),f?b.cloneElement(b.Children.only(h),Dn(Dn({},L),{ref:D})):b.createElement(A,Dn({},L,{className:g,ref:D}),h))});kc.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};kc.classNames={fullWidth:Bl,zeroRight:Hl};var z_=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function H_(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var r=z_();return r&&t.setAttribute("nonce",r),t}function B_(t,r){t.styleSheet?t.styleSheet.cssText=r:t.appendChild(document.createTextNode(r))}function W_(t){var r=document.head||document.getElementsByTagName("head")[0];r.appendChild(t)}var U_=function(){var t=0,r=null;return{add:function(o){t==0&&(r=H_())&&(B_(r,o),W_(r)),t++},remove:function(){t--,!t&&r&&(r.parentNode&&r.parentNode.removeChild(r),r=null)}}},I_=function(){var t=U_();return function(r,o){b.useEffect(function(){return t.add(r),function(){t.remove()}},[r&&o])}},Nw=function(){var t=I_(),r=function(o){var i=o.styles,l=o.dynamic;return t(i,l),null};return r},q_={left:0,top:0,right:0,gap:0},yf=function(t){return parseInt(t||"",10)||0},P_=function(t){var r=window.getComputedStyle(document.body),o=r[t==="padding"?"paddingLeft":"marginLeft"],i=r[t==="padding"?"paddingTop":"marginTop"],l=r[t==="padding"?"paddingRight":"marginRight"];return[yf(o),yf(i),yf(l)]},F_=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return q_;var r=P_(t),o=document.documentElement.clientWidth,i=window.innerWidth;return{left:r[0],top:r[1],right:r[2],gap:Math.max(0,i-o+r[2]-r[0])}},K_=Nw(),vo="data-scroll-locked",Y_=function(t,r,o,i){var l=t.left,u=t.top,f=t.right,h=t.gap;return o===void 0&&(o="margin"),`
|
|
22
|
+
.`.concat(N_,` {
|
|
23
|
+
overflow: hidden `).concat(i,`;
|
|
24
|
+
padding-right: `).concat(h,"px ").concat(i,`;
|
|
25
|
+
}
|
|
26
|
+
body[`).concat(vo,`] {
|
|
27
|
+
overflow: hidden `).concat(i,`;
|
|
28
|
+
overscroll-behavior: contain;
|
|
29
|
+
`).concat([r&&"position: relative ".concat(i,";"),o==="margin"&&`
|
|
30
|
+
padding-left: `.concat(l,`px;
|
|
31
|
+
padding-top: `).concat(u,`px;
|
|
32
|
+
padding-right: `).concat(f,`px;
|
|
33
|
+
margin-left:0;
|
|
34
|
+
margin-top:0;
|
|
35
|
+
margin-right: `).concat(h,"px ").concat(i,`;
|
|
36
|
+
`),o==="padding"&&"padding-right: ".concat(h,"px ").concat(i,";")].filter(Boolean).join(""),`
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.`).concat(Hl,` {
|
|
40
|
+
right: `).concat(h,"px ").concat(i,`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.`).concat(Bl,` {
|
|
44
|
+
margin-right: `).concat(h,"px ").concat(i,`;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.`).concat(Hl," .").concat(Hl,` {
|
|
48
|
+
right: 0 `).concat(i,`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.`).concat(Bl," .").concat(Bl,` {
|
|
52
|
+
margin-right: 0 `).concat(i,`;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
body[`).concat(vo,`] {
|
|
56
|
+
`).concat(A_,": ").concat(h,`px;
|
|
57
|
+
}
|
|
58
|
+
`)},zy=function(){var t=parseInt(document.body.getAttribute(vo)||"0",10);return isFinite(t)?t:0},$_=function(){b.useEffect(function(){return document.body.setAttribute(vo,(zy()+1).toString()),function(){var t=zy()-1;t<=0?document.body.removeAttribute(vo):document.body.setAttribute(vo,t.toString())}},[])},V_=function(t){var r=t.noRelative,o=t.noImportant,i=t.gapMode,l=i===void 0?"margin":i;$_();var u=b.useMemo(function(){return F_(l)},[l]);return b.createElement(K_,{styles:Y_(u,!r,l,o?"":"!important")})},Yf=!1;if(typeof window<"u")try{var Tl=Object.defineProperty({},"passive",{get:function(){return Yf=!0,!0}});window.addEventListener("test",Tl,Tl),window.removeEventListener("test",Tl,Tl)}catch{Yf=!1}var uo=Yf?{passive:!1}:!1,G_=function(t){return t.tagName==="TEXTAREA"},Aw=function(t,r){if(!(t instanceof Element))return!1;var o=window.getComputedStyle(t);return o[r]!=="hidden"&&!(o.overflowY===o.overflowX&&!G_(t)&&o[r]==="visible")},X_=function(t){return Aw(t,"overflowY")},Z_=function(t){return Aw(t,"overflowX")},Hy=function(t,r){var o=r.ownerDocument,i=r;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var l=_w(t,i);if(l){var u=jw(t,i),f=u[1],h=u[2];if(f>h)return!0}i=i.parentNode}while(i&&i!==o.body);return!1},Q_=function(t){var r=t.scrollTop,o=t.scrollHeight,i=t.clientHeight;return[r,o,i]},J_=function(t){var r=t.scrollLeft,o=t.scrollWidth,i=t.clientWidth;return[r,o,i]},_w=function(t,r){return t==="v"?X_(r):Z_(r)},jw=function(t,r){return t==="v"?Q_(r):J_(r)},ej=function(t,r){return t==="h"&&r==="rtl"?-1:1},tj=function(t,r,o,i,l){var u=ej(t,window.getComputedStyle(r).direction),f=u*i,h=o.target,g=r.contains(h),m=!1,y=f>0,v=0,x=0;do{if(!h)break;var S=jw(t,h),T=S[0],k=S[1],C=S[2],E=k-C-u*T;(T||E)&&_w(t,h)&&(v+=E,x+=T);var A=h.parentNode;h=A&&A.nodeType===Node.DOCUMENT_FRAGMENT_NODE?A.host:A}while(!g&&h!==document.body||g&&(r.contains(h)||r===h));return(y&&Math.abs(v)<1||!y&&Math.abs(x)<1)&&(m=!0),m},Nl=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},By=function(t){return[t.deltaX,t.deltaY]},Wy=function(t){return t&&"current"in t?t.current:t},nj=function(t,r){return t[0]===r[0]&&t[1]===r[1]},rj=function(t){return`
|
|
59
|
+
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
|
60
|
+
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
|
61
|
+
`)},aj=0,fo=[];function oj(t){var r=b.useRef([]),o=b.useRef([0,0]),i=b.useRef(),l=b.useState(aj++)[0],u=b.useState(Nw)[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 k=T_([t.lockRef.current],(t.shards||[]).map(Wy),!0).filter(Boolean);return k.forEach(function(C){return C.classList.add("allow-interactivity-".concat(l))}),function(){document.body.classList.remove("block-interactivity-".concat(l)),k.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(l))})}}},[t.inert,t.lockRef.current,t.shards]);var h=b.useCallback(function(k,C){if("touches"in k&&k.touches.length===2||k.type==="wheel"&&k.ctrlKey)return!f.current.allowPinchZoom;var E=Nl(k),A=o.current,j="deltaX"in k?k.deltaX:A[0]-E[0],N="deltaY"in k?k.deltaY:A[1]-E[1],O,D=k.target,L=Math.abs(j)>Math.abs(N)?"h":"v";if("touches"in k&&L==="h"&&D.type==="range")return!1;var B=window.getSelection(),P=B&&B.anchorNode,re=P?P===D||P.contains(D):!1;if(re)return!1;var ee=Hy(L,D);if(!ee)return!0;if(ee?O=L:(O=L==="v"?"h":"v",ee=Hy(L,D)),!ee)return!1;if(!i.current&&"changedTouches"in k&&(j||N)&&(i.current=O),!O)return!0;var Y=i.current||O;return tj(Y,C,k,Y==="h"?j:N)},[]),g=b.useCallback(function(k){var C=k;if(!(!fo.length||fo[fo.length-1]!==u)){var E="deltaY"in C?By(C):Nl(C),A=r.current.filter(function(O){return O.name===C.type&&(O.target===C.target||C.target===O.shadowParent)&&nj(O.delta,E)})[0];if(A&&A.should){C.cancelable&&C.preventDefault();return}if(!A){var j=(f.current.shards||[]).map(Wy).filter(Boolean).filter(function(O){return O.contains(C.target)}),N=j.length>0?h(C,j[0]):!f.current.noIsolation;N&&C.cancelable&&C.preventDefault()}}},[]),m=b.useCallback(function(k,C,E,A){var j={name:k,delta:C,target:E,should:A,shadowParent:sj(E)};r.current.push(j),setTimeout(function(){r.current=r.current.filter(function(N){return N!==j})},1)},[]),y=b.useCallback(function(k){o.current=Nl(k),i.current=void 0},[]),v=b.useCallback(function(k){m(k.type,By(k),k.target,h(k,t.lockRef.current))},[]),x=b.useCallback(function(k){m(k.type,Nl(k),k.target,h(k,t.lockRef.current))},[]);b.useEffect(function(){return fo.push(u),t.setCallbacks({onScrollCapture:v,onWheelCapture:v,onTouchMoveCapture:x}),document.addEventListener("wheel",g,uo),document.addEventListener("touchmove",g,uo),document.addEventListener("touchstart",y,uo),function(){fo=fo.filter(function(k){return k!==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:rj(l)}):null,S?b.createElement(V_,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function sj(t){for(var r=null;t!==null;)t instanceof ShadowRoot&&(r=t.host,t=t.host),t=t.parentNode;return r}const ij=L_(Tw,oj);var Rw=b.forwardRef(function(t,r){return b.createElement(kc,Dn({},t,{ref:r,sideCar:ij}))});Rw.classNames=kc.classNames;var lj=function(t){if(typeof document>"u")return null;var r=Array.isArray(t)?t[0]:t;return r.ownerDocument.body},mo=new WeakMap,Al=new WeakMap,_l={},bf=0,Ow=function(t){return t&&(t.host||Ow(t.parentNode))},cj=function(t,r){return r.map(function(o){if(t.contains(o))return o;var i=Ow(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})},uj=function(t,r,o,i){var l=cj(r,Array.isArray(t)?t:[t]);_l[o]||(_l[o]=new WeakMap);var u=_l[o],f=[],h=new Set,g=new Set(l),m=function(v){!v||h.has(v)||(h.add(v),m(v.parentNode))};l.forEach(m);var y=function(v){!v||g.has(v)||Array.prototype.forEach.call(v.children,function(x){if(h.has(x))y(x);else try{var S=x.getAttribute(i),T=S!==null&&S!=="false",k=(mo.get(x)||0)+1,C=(u.get(x)||0)+1;mo.set(x,k),u.set(x,C),f.push(x),k===1&&T&&Al.set(x,!0),C===1&&x.setAttribute(o,"true"),T||x.setAttribute(i,"true")}catch(E){console.error("aria-hidden: cannot operate on ",x,E)}})};return y(r),h.clear(),bf++,function(){f.forEach(function(v){var x=mo.get(v)-1,S=u.get(v)-1;mo.set(v,x),u.set(v,S),x||(Al.has(v)||v.removeAttribute(i),Al.delete(v)),S||v.removeAttribute(o)}),bf--,bf||(mo=new WeakMap,mo=new WeakMap,Al=new WeakMap,_l={})}},dj=function(t,r,o){o===void 0&&(o="data-aria-hidden");var i=Array.from(Array.isArray(t)?t:[t]),l=lj(t);return l?(i.push.apply(i,Array.from(l.querySelectorAll("[aria-live], script"))),uj(i,l,o,"aria-hidden")):function(){return null}},Sc="Dialog",[Dw]=km(Sc),[fj,En]=Dw(Sc),Mw=t=>{const{__scopeDialog:r,children:o,open:i,defaultOpen:l,onOpenChange:u,modal:f=!0}=t,h=b.useRef(null),g=b.useRef(null),[m,y]=q0({prop:i,defaultProp:l??!1,onChange:u,caller:Sc});return c.jsx(fj,{scope:r,triggerRef:h,contentRef:g,contentId:Dl(),titleId:Dl(),descriptionId:Dl(),open:m,onOpenChange:y,onOpenToggle:b.useCallback(()=>y(v=>!v),[y]),modal:f,children:o})};Mw.displayName=Sc;var Lw="DialogTrigger",zw=b.forwardRef((t,r)=>{const{__scopeDialog:o,...i}=t,l=En(Lw,o),u=Sn(r,l.triggerRef);return c.jsx(Wt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":l.open,"aria-controls":l.contentId,"data-state":Wm(l.open),...i,ref:u,onClick:zt(t.onClick,l.onOpenToggle)})});zw.displayName=Lw;var Hm="DialogPortal",[mj,Hw]=Dw(Hm,{forceMount:void 0}),Bw=t=>{const{__scopeDialog:r,forceMount:o,children:i,container:l}=t,u=En(Hm,r);return c.jsx(mj,{scope:r,forceMount:o,children:b.Children.map(i,f=>c.jsx(jo,{present:o||u.open,children:c.jsx(Om,{asChild:!0,container:l,children:f})}))})};Bw.displayName=Hm;var Ql="DialogOverlay",Ww=b.forwardRef((t,r)=>{const o=Hw(Ql,t.__scopeDialog),{forceMount:i=o.forceMount,...l}=t,u=En(Ql,t.__scopeDialog);return u.modal?c.jsx(jo,{present:i||u.open,children:c.jsx(hj,{...l,ref:r})}):null});Ww.displayName=Ql;var pj=g0("DialogOverlay.RemoveScroll"),hj=b.forwardRef((t,r)=>{const{__scopeDialog:o,...i}=t,l=En(Ql,o);return c.jsx(Rw,{as:pj,allowPinchZoom:!0,shards:[l.contentRef],children:c.jsx(Wt.div,{"data-state":Wm(l.open),...i,ref:r,style:{pointerEvents:"auto",...i.style}})})}),wa="DialogContent",Uw=b.forwardRef((t,r)=>{const o=Hw(wa,t.__scopeDialog),{forceMount:i=o.forceMount,...l}=t,u=En(wa,t.__scopeDialog);return c.jsx(jo,{present:i||u.open,children:u.modal?c.jsx(gj,{...l,ref:r}):c.jsx(vj,{...l,ref:r})})});Uw.displayName=wa;var gj=b.forwardRef((t,r)=>{const o=En(wa,t.__scopeDialog),i=b.useRef(null),l=Sn(r,o.contentRef,i);return b.useEffect(()=>{const u=i.current;if(u)return dj(u)},[]),c.jsx(Iw,{...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,h=f.button===0&&f.ctrlKey===!0;(f.button===2||h)&&u.preventDefault()}),onFocusOutside:zt(t.onFocusOutside,u=>u.preventDefault())})}),vj=b.forwardRef((t,r)=>{const o=En(wa,t.__scopeDialog),i=b.useRef(!1),l=b.useRef(!1);return c.jsx(Iw,{...t,ref:r,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()}})}),Iw=b.forwardRef((t,r)=>{const{__scopeDialog:o,trapFocus:i,onOpenAutoFocus:l,onCloseAutoFocus:u,...f}=t,h=En(wa,o),g=b.useRef(null),m=Sn(r,g);return C_(),c.jsxs(c.Fragment,{children:[c.jsx(kw,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:l,onUnmountAutoFocus:u,children:c.jsx(Sm,{role:"dialog",id:h.contentId,"aria-describedby":h.descriptionId,"aria-labelledby":h.titleId,"data-state":Wm(h.open),...f,ref:m,onDismiss:()=>h.onOpenChange(!1)})}),c.jsxs(c.Fragment,{children:[c.jsx(yj,{titleId:h.titleId}),c.jsx(wj,{contentRef:g,descriptionId:h.descriptionId})]})]})}),Bm="DialogTitle",qw=b.forwardRef((t,r)=>{const{__scopeDialog:o,...i}=t,l=En(Bm,o);return c.jsx(Wt.h2,{id:l.titleId,...i,ref:r})});qw.displayName=Bm;var Pw="DialogDescription",Fw=b.forwardRef((t,r)=>{const{__scopeDialog:o,...i}=t,l=En(Pw,o);return c.jsx(Wt.p,{id:l.descriptionId,...i,ref:r})});Fw.displayName=Pw;var Kw="DialogClose",Yw=b.forwardRef((t,r)=>{const{__scopeDialog:o,...i}=t,l=En(Kw,o);return c.jsx(Wt.button,{type:"button",...i,ref:r,onClick:zt(t.onClick,()=>l.onOpenChange(!1))})});Yw.displayName=Kw;function Wm(t){return t?"open":"closed"}var $w="DialogTitleWarning",[vM,Vw]=qC($w,{contentName:wa,titleName:Bm,docsSlug:"dialog"}),yj=({titleId:t})=>{const r=Vw($w),o=`\`${r.contentName}\` requires a \`${r.titleName}\` for the component to be accessible for screen reader users.
|
|
62
|
+
|
|
63
|
+
If you want to hide the \`${r.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
64
|
+
|
|
65
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${r.docsSlug}`;return b.useEffect(()=>{t&&(document.getElementById(t)||console.error(o))},[o,t]),null},bj="DialogDescriptionWarning",wj=({contentRef:t,descriptionId:r})=>{const i=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Vw(bj).contentName}}.`;return b.useEffect(()=>{const l=t.current?.getAttribute("aria-describedby");r&&l&&(document.getElementById(r)||console.warn(i))},[i,t,r]),null},Js=Mw,xj=zw,ei=Bw,ti=Ww,ni=Uw,ri=qw,Ec=Fw,yM=Yw;const wf=t=>t==="danger"?"var(--status-red)":"var(--accent)",ai=({open:t,onOpenChange:r,title:o,description:i,confirmLabel:l,confirmKind:u="default",cancelLabel:f,onConfirm:h})=>{const{t:g}=ke(),m=f??g("common.cancel");return c.jsx(Js,{open:t,onOpenChange:r,children:c.jsxs(ei,{children:[c.jsx(ti,{"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(ni,{"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, ${wf(u)} 14%, transparent)`,color:wf(u),border:`1px solid color-mix(in oklab, ${wf(u)} 30%, transparent)`},children:u==="danger"?c.jsx(dc,{size:18}):c.jsx(ES,{size:18})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx(ri,{"data-testid":"confirm-title",className:"text-lg font-semibold text-pri",children:o}),c.jsx(Ec,{"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:()=>r(!1),autoFocus:u==="danger",className:"icon-btn",children:m}),c.jsx("button",{type:"button","data-testid":"confirm-action",onClick:()=>{h(),r(!1)},autoFocus:u!=="danger",className:u==="danger"?"icon-btn icon-btn--danger-solid":"icon-btn icon-btn--primary",children:l})]})]})})]})})},kj=["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
|
+
`),Sj=["你是 Researcher,负责为指定主题收集事实、数据和来源。","工作方式:","- 先拆出要回答的关键问题,再逐项调查。","- 优先一手来源和项目内真实文件;每个结论都附上来源或文件路径。","- 区分事实、推断和未知,不把猜测写成结论。","交付说明:按主题列出发现、来源清单和未解决问题。"].join(`
|
|
67
|
+
`),Ej=["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
|
+
`),Cj=["你是 Fact-checker,负责验证研究结论和证据强度,默认不扩范围。","工作方式:","- 逐条核对结论与其来源,标注支持、存疑或不支持。","- 对关键结论用第二来源、命令或直接读文件做交叉验证。","- 发现错误时给出纠正后的表述和依据。","交付说明:按可信度分组,先列被推翻或存疑的结论。"].join(`
|
|
69
|
+
`),Tj=["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
|
+
`),Nj=["你是 Drafter,负责把目标和素材写成清晰的第一版文档。","工作方式:","- 先确认读者、目的和范围,再列提纲,后成文。","- 以项目内真实代码和文件为准,不编造行为或接口。","- 标注待确认和缺素材的位置。","交付说明:包含文档路径、结构概览和确认清单。"].join(`
|
|
71
|
+
`),Aj=["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
|
+
`),_j=["你是 Document Reviewer,负责检查草稿的准确性和可读性;默认不要整篇重写。","工作方式:","- 先对照项目真实代码和文件核对技术细节。","- 检查结构、术语一致性,以及读者能否按文档完成操作。","- 问题按严重度列出,给出具体修改建议或改写示例。","交付说明:先列事实错误,再列结构和表达问题。"].join(`
|
|
73
|
+
`),jj=[{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:kj,zh:Sj}},{nameStem:"factchecker",role:"custom",descriptionOverride:{en:Ej,zh:Cj}}],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:Tj,zh:Nj}},{nameStem:"doc-reviewer",role:"custom",descriptionOverride:{en:Aj,zh:_j}}],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 审查;写明读者、范围、必备章节,以及它要描述的代码或文件。"}}],Uy={build_review_test:{icon:c.jsx(PS,{size:16,"aria-hidden":!0}),titleKey:"scenario.build_review_test.title",descKey:"scenario.build_review_test.desc"},research_factcheck:{icon:c.jsx(lS,{size:16,"aria-hidden":!0}),titleKey:"scenario.research_factcheck.title",descKey:"scenario.research_factcheck.desc"},docs_pipeline:{icon:c.jsx(WS,{size:16,"aria-hidden":!0}),titleKey:"scenario.docs_pipeline.title",descKey:"scenario.docs_pipeline.desc"}},Rj=({workspaceId:t})=>{const{language:r,t:o}=ke(),i=Jt(),[l,u]=b.useState(null),[f,h]=b.useState(""),[g,m]=b.useState(!1),y=S=>{h(S.goalTemplate[r]),u(S)},v=()=>{g||u(null)},x=()=>{!l||g||!f.trim()||(m(!0),vC(t,l.id,f,r).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(()=>m(!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:jj.map(S=>{const T=Uy[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(Js,{open:l!==null,onOpenChange:S=>{S||v()},children:c.jsxs(ei,{children:[c.jsx(ti,{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(ni,{"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(ri,{className:"text-lg font-semibold text-pri",children:l?o(Uy[l.id].titleKey):""}),c.jsx(Ec,{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=>h(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:x,disabled:g||!f.trim(),"data-testid":"scenario-goal-apply",children:o(g?"scenario.applying":"scenario.apply")})]})]})})]})})]})},Gw=({size:t,children:r,color:o,fontRatio:i=.4,ringColor:l=null,ringSurface:u="var(--bg-1)",mono:f=!1,decoration:h,testId:g,data:m,className:y="",style:v={}})=>{const x={};if(m)for(const[S,T]of Object.entries(m))T!==void 0&&(x[`data-${S}`]=T);return c.jsxs("span",{"data-testid":g,...x,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:[r,h]})},Oj={orchestrator:hm,coder:jS,reviewer:lE,tester:Pl,sentinel:HS,custom:gE},Dj={orchestrator:"crown",coder:"code",reviewer:"review",tester:"test",sentinel:"sentinel",custom:"custom"},Mj={orchestrator:"var(--accent)",coder:"var(--status-blue)",reviewer:"var(--status-purple)",tester:"var(--status-orange)",sentinel:"var(--status-green)",custom:"var(--text-secondary)"},Lj={working:"var(--status-green)",idle:"var(--text-tertiary)",stopped:"var(--status-red)"},zj=({role:t,size:r=32,statusRing:o="none"})=>{const i=Oj[t];return c.jsx(Gw,{size:r,color:Mj[t],ringColor:o==="none"?null:Lj[o],ringSurface:"var(--bg-2)",testId:"role-avatar",data:{role:t,icon:Dj[t],"status-ring":o},children:c.jsx(i,{size:Math.round(r*.56),"aria-hidden":!0})})},Hj={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"}},Bj={working:"var(--status-green)",idle:"var(--text-tertiary)",stopped:"var(--status-red)"},Xw=t=>t?Hj[t]??null:null,bM=({commandPresetId:t,fallback:r=null,size:o=20,testId:i="cli-agent-logo"})=>{const l=Xw(t);if(!l)return r;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"}})})},Zw=({commandPresetId:t,workerRole:r,size:o=32,statusRing:i="none"})=>{const l=Xw(t);if(!l)return c.jsx(zj,{role:r,size:o,statusRing:i});const u=i==="none"?null:Bj[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"}})})},Qw=({initialValue:t,saving:r,setSaving:o,onSave:i,onCancel:l,className:u})=>{const f=Jt(),[h,g]=b.useState(t),m=b.useRef(null),y=b.useRef(!1);b.useEffect(()=>{const T=setTimeout(()=>{m.current?.focus(),m.current?.select()},50);return()=>clearTimeout(T)},[]);const v=async()=>{const T=h.trim();if(!T||T===t){l();return}o(!0);try{const k=await i(T);if(k.error){f.show({kind:"error",message:k.error}),g(t),setTimeout(()=>{m.current?.focus(),m.current?.select()},50),o(!1);return}}catch(k){const C=k instanceof Error?k.message:"Failed to rename worker";f.show({kind:"error",message:C}),g(t),setTimeout(()=>{m.current?.focus(),m.current?.select()},50),o(!1);return}o(!1),l()},x=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:m,type:"text",value:h,disabled:r,onChange:T=>g(T.target.value),onKeyDown:x,onBlur:S,maxLength:64,className:u,onClick:T=>T.stopPropagation()})},Jw=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)"},wM=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)"},ex={working:"pill--green",idle:"pill--ghost",stopped:"pill--red"},tx=t=>`role.${t}`,Jl=t=>t==="working"?"common.running":t==="idle"?"common.idle":"common.stopped",Wj=({hasRun:t,isPending:r=!1,isEditing:o=!1,onRenameWorker:i,onStartEditing:l,onCancelEditing:u,onAction:f,onClick:h,worker:g})=>{const{t:m}=ke(),y=Nt(),v=Jw(g),[x,S]=b.useState(!1),T=j=>N=>{if(N.stopPropagation(),j==="rename"){l?.();return}f?.(j,g)},k=g.ephemeral===!0&&g.spawnedBy==="workflow",C=g.ephemeral===!0&&g.spawnedBy==="orchestrator",E=k?"workflow":C?"orchestrator":null;if(y)return c.jsx(Uj,{ephemeralTone:E,hasRun:t,isPending:r,onAction:f,onClick:h,status:v,worker:g,isEditing:o,onRenameWorker:i,onCancelEditing:u});const A=o?"div":"button";return c.jsxs("div",{className:"worker-card-shell relative","data-status":v.kind,"data-worker-name":g.name,"data-role":g.role,"data-ephemeral":g.ephemeral===!0?"true":void 0,"data-spawned-by":g.spawnedBy??void 0,"data-mobile":y?"true":void 0,children:[c.jsxs(A,{type:o?void 0:"button",onClick:o?void 0:()=>h(g),"aria-label":o?void 0:m("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:E?{borderStyle:"dashed",borderColor:E==="workflow"?"var(--accent)":"var(--border-bright)"}:void 0,children:[c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsx(Zw,{commandPresetId:g.commandPresetId,workerRole:g.role,size:40,statusRing:v.kind}),E?c.jsx("span",{className:"ml-auto rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide",style:{background:E==="workflow"?"color-mix(in oklab, var(--accent) 18%, transparent)":"color-mix(in oklab, var(--text-secondary) 14%, transparent)",color:E==="workflow"?"var(--accent)":"var(--text-secondary)"},"data-testid":"worker-card-ephemeral-badge",title:E==="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:E==="workflow"?"workflow":"temp"}):null]}),c.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[o?c.jsx(Qw,{initialValue:g.name,saving:x,setSaving:S,onSave:j=>i(g,j),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:m(tx(g.role))})]}),c.jsx("div",{className:"flex min-w-0 flex-col gap-1.5",children:c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsxs("span",{className:`pill ${ex[v.kind]} worker-card__status`,role:"status",title:v.kind==="working"?m("worker.workingLegend"):m(Jl(v.kind)),children:[c.jsx("span",{className:v.dotClass,"aria-hidden":!0}),m(Jl(v.kind))]}),g.pendingTaskCount>0?c.jsx("span",{className:"pill pill--ghost","data-testid":`worker-card-queue-${g.id}`,title:m("worker.queuedAria",{count:g.pendingTaskCount}),children:m("worker.queued",{count:g.pendingTaskCount})}):null]})})]}),f?c.jsxs("div",{className:"worker-card__actions",children:[t?y?c.jsxs(c.Fragment,{children:[c.jsx(Ns,{title:m("common.stop"),onClick:T("stop"),disabled:r,variant:"danger",testId:`worker-card-stop-${g.id}`,ariaLabel:m("worker.stopAria",{name:g.name}),children:c.jsx(ym,{size:12,"aria-hidden":!0})}),c.jsx(Ns,{title:m("common.restart"),onClick:T("restart"),disabled:r,testId:`worker-card-restart-${g.id}`,ariaLabel:m("worker.restartAria",{name:g.name}),children:c.jsx(vm,{size:12,"aria-hidden":!0})})]}):null:c.jsx(Ns,{title:m("common.start"),onClick:T("start"),disabled:r,variant:"primary",testId:`worker-card-start-${g.id}`,ariaLabel:m("worker.startAria",{name:g.name}),children:c.jsx(No,{size:12,"aria-hidden":!0})}),c.jsx(Ns,{title:m("worker.rename"),onClick:T("rename"),disabled:r||v.kind==="working",testId:`worker-card-rename-${g.id}`,ariaLabel:m("worker.renameAria",{name:g.name}),children:c.jsx($b,{size:12,"aria-hidden":!0})}),c.jsx(Ns,{title:m("common.delete"),onClick:T("delete"),variant:"danger",testId:`worker-card-delete-${g.id}`,ariaLabel:m("worker.deleteAria",{name:g.name}),children:c.jsx(uc,{size:12,"aria-hidden":!0})})]}):null]})},Ns=({ariaLabel:t,children:r,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:r})}),Uj=({ephemeralTone:t,hasRun:r,isPending:o,onAction:i,onClick:l,status:u,worker:f,isEditing:h=!1,onRenameWorker:g,onCancelEditing:m})=>{const{t:y}=ke(),[v,x]=b.useState(!1),[S,T]=b.useState(!1),k=b.useRef(!1),C=j=>{j==="rename"&&(k.current=!0),x(!1),i?.(j,f)},E=y(tx(f.role)),A=h?"div":"button";return c.jsxs("div",{className:"worker-card-shell relative","data-status":u.kind,"data-worker-name":f.name,"data-role":f.role,"data-ephemeral":f.ephemeral===!0?"true":void 0,"data-spawned-by":f.spawnedBy??void 0,"data-mobile":"true",children:[c.jsxs(A,{type:h?void 0:"button",onClick:h?void 0:()=>l(f),"aria-label":h?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 ${h?"":"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(Zw,{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:[h?c.jsx(Qw,{initialValue:f.name,saving:S,setSaving:T,onSave:j=>g(f,j),onCancel:()=>m?.(),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:E})]}),c.jsxs("span",{className:`pill ${ex[u.kind]} worker-card__status shrink-0`,role:"status",children:[c.jsx("span",{className:u.dotClass,"aria-hidden":!0}),y(Jl(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:()=>x(!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(MS,{size:18,"aria-hidden":!0})}),c.jsx(Js,{open:v,onOpenChange:x,children:c.jsxs(ei,{children:[c.jsx(ti,{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(ni,{onCloseAutoFocus:j=>{k.current&&(j.preventDefault(),k.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(ri,{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(Jl(u.kind))})]}),c.jsx(Ec,{className:"sr-only",children:y("worker.actionsAria",{name:f.name})}),r?c.jsxs(c.Fragment,{children:[c.jsx(As,{disabled:o,icon:c.jsx(ym,{size:16,"aria-hidden":!0}),label:y("common.stop"),onSelect:()=>C("stop"),testId:`worker-card-stop-${f.id}`,danger:!0}),c.jsx(As,{disabled:o,icon:c.jsx(vm,{size:16,"aria-hidden":!0}),label:y("common.restart"),onSelect:()=>C("restart"),testId:`worker-card-restart-${f.id}`})]}):c.jsx(As,{disabled:o,icon:c.jsx(No,{size:16,"aria-hidden":!0}),label:y("common.start"),onSelect:()=>C("start"),testId:`worker-card-start-${f.id}`}),c.jsx(As,{disabled:o||u.kind==="working",icon:c.jsx($b,{size:16,"aria-hidden":!0}),label:y("worker.rename"),onSelect:()=>C("rename"),testId:`worker-card-rename-${f.id}`}),c.jsx(As,{icon:c.jsx(uc,{size:16,"aria-hidden":!0}),label:y("common.delete"),onSelect:()=>C("delete"),testId:`worker-card-delete-${f.id}`,danger:!0})]})})]})})]}):null]})},As=({danger:t=!1,disabled:r=!1,icon:o,label:i,onSelect:l,testId:u})=>c.jsxs("button",{type:"button",disabled:r,"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]}),Ij=["working","idle","stopped"],Iy=t=>t==="working"?"common.running":t==="idle"?"common.idle":"common.stopped",qj=t=>{const r={idle:[],working:[],stopped:[]};for(const o of t)r[Jw(o).kind].push(o);return{sections:Ij.filter(o=>r[o].length>0).map(o=>({kind:o,workers:r[o]})),summary:{idle:r.idle.length,stopped:r.stopped.length,working:r.working.length}}},Pj=({onAddWorkerClick:t,onDeleteWorker:r,onOpenShellTerminal:o,onOpenWorker:i,onRenameWorker:l,onStopWorker:u,onRestartWorker:f,onStartWorker:h,shellTerminalAvailable:g=!0,startingWorkerId:m,terminalRuns:y,workers:v,workspaceId:x})=>{const{t:S}=ke(),{sections:T,summary:k}=b.useMemo(()=>qj(v),[v]),C=b.useMemo(()=>new Map(y.map(L=>[L.agent_id,L.run_id])),[y]),[E,A]=b.useState(null),[j,N]=b.useState(null),O=(L,B)=>{if(L==="start"){h(B);return}if(L==="stop"){const P=C.get(B.id);P&&u?.(P);return}if(L==="restart"){const P=C.get(B.id);P&&f?.(B.id,P);return}if(L==="rename"){N(B.id);return}L==="delete"&&A(B)},D=()=>{E&&(r(E),A(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(cc,{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(Xd,{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:k.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:k.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:k.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(Qs,{icon:c.jsx(Xd,{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(Xd,{size:14,"aria-hidden":!0})," ",S("worker.emptyAdd")]})}),x?c.jsx(Rj,{workspaceId:x}):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(Iy(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(Iy(L.kind))} team members`,className:"worker-card-grid",children:L.workers.map(B=>c.jsx("li",{children:c.jsx(Wj,{hasRun:C.has(B.id),isPending:m===B.id,isEditing:j===B.id,onRenameWorker:async(P,re)=>v.some(Y=>Y.id!==P.id&&Y.name.toLowerCase()===re.toLowerCase())?{error:S("addWorker.agentExists")}:l(P,re),onStartEditing:()=>N(B.id),onCancelEditing:()=>N(null),onAction:O,onClick:i,worker:B})},B.id))})]},L.kind))})}),c.jsx(ai,{open:E!==null,onOpenChange:L=>{L||A(null)},title:E?S("worker.deleteConfirm",{name:E.name}):"",description:E?S("worker.deleteDescription",{name:E.name}):"",confirmLabel:S("worker.deleteMember"),confirmKind:"danger",onConfirm:D})]})},Fj=b.lazy(()=>Tt(()=>import("./AddWorkerDialog-DHwOZ75i.js"),__vite__mapDeps([2,3,4])).then(t=>({default:t.AddWorkerDialog}))),Kj=b.lazy(()=>Tt(()=>import("./WorkerModal-CGeWO3Dg.js"),[]).then(t=>({default:t.WorkerModal}))),Yj=({activeWorkerId:t,onCreateWorker:r,onDeleteWorker:o,onDeleteWorkspace:i,onStartWorker:l,onStopWorker:u,onRestartWorker:f,onOrchestratorResult:h,onRequestAddWorkspace:g,onShellRunClosed:m,onShellRunStarted:y,onTryDemo:v,welcomeDisabledReason:x,orchestratorAutostartError:S,orchestratorAutostartRunId:T,terminalRuns:k,workers:C,workspace:E,onActiveWorkerChange:A,showInlineActionCenter:j=!0})=>{const{t:N}=ke(),O=Nt(),[D,L]=b.useState(null),B=t===void 0?D:t,P=b.useCallback(be=>{A?A(be):L(be)},[A]),[re,ee]=b.useState(!1),[Y,J]=b.useState("orchestrator"),G=sw();b.useEffect(()=>()=>ow(!1),[]);const[V,M]=b.useState(null),[q,I]=b.useState(null),[Z,F]=b.useState(null),[R,W]=b.useState(!1),ne=Jt(),ae=h_({createWorker:r,open:re,workers:C}),fe=s_({workspaceId:E?.id??"",terminalRuns:k,autostartError:S,suppressAutostartRunId:T,onClearAutostartError:()=>{E&&h(E.id,{ok:!0,error:null,run_id:null})},onAfterStart:be=>{E&&h(E.id,be)}}),me=VA(),ce=C.find(be=>be.id===B)??null;b.useEffect(()=>{B&&!ce&&P(null)},[B,ce,P]);const le=HA({workspaceId:E?.id??"",workers:C,terminalRuns:k}),ie=le.tabs.filter(be=>be.kind==="shell"),ue=E?k.filter(be=>fc(be,E.id)):[],{closeShellTab:pe,openShell:Ne,shellError:Ce,shellStarting:Se,startNewShell:Je}=YA({onCloseFailed:be=>ne.show({kind:"error",message:N("shellTerminal.closeFailed",{message:be})}),onShellRunClosed:m,onShellRunStarted:y,panelTabs:le,shellRuns:ue,workspaceId:E?.id??null});if(b.useEffect(()=>{ae.createWorkerError&&ne.show({kind:"error",message:ae.createWorkerError})},[ae.createWorkerError,ne]),b.useEffect(()=>{V&&ne.show({kind:"error",message:V})},[V,ne]),b.useEffect(()=>{q&&ne.show({kind:"error",message:q})},[q,ne]),b.useEffect(()=>{Ce&&ne.show({kind:"error",message:Ce})},[Ce,ne]),b.useEffect(()=>{P(null),M(null),I(null),F(null),W(!1),J("orchestrator")},[E?.id,P]),!E){const be={onAddWorkspace:g};return v&&(be.onTryDemo=v),x&&(be.disabledReason=x),c.jsx(v_,{...be})}const mt=ce?KA(k,ce.id):void 0,en=be=>{M(null),o(be.id).then(()=>P(null)).catch(He=>{M(He instanceof Error?He.message:String(He))})},Cn=be=>{I(null),F(be.id),l(be.id).then(({error:He})=>{He&&I(He)}).catch(He=>{I(He instanceof Error?He.message:String(He))}).finally(()=>F(null))},pn=be=>{u(be).then(({error:He})=>{He&&ne.show({kind:"error",message:He})})},Tn=(be,He)=>{I(null),F(be),f(be,He).then(({error:ut})=>{ut&&I(ut)}).catch(ut=>{I(ut instanceof Error?ut.message:String(ut))}).finally(()=>F(null))},tn=async(be,He)=>{try{return await bC(E.id,be.id,He),ne.show({kind:"success",message:N("worker.renameSuccess",{name:He})}),{error:null}}catch(ut){const Ea=ut instanceof Error?ut.message:String(ut);return ne.show({kind:"error",message:N("worker.renameFailed",{message:Ea})}),{error:Ea}}},de=`${(me.orchPct*100).toFixed(2)}%`,Te=()=>{W(!1),Ne()},Ve=()=>{W(!1),Je()},Sa=async()=>{try{await QE(E.id,N("orchestrator.firstDispatchPrompt"))}catch(be){const He=be instanceof Error?be.message:String(be);throw ne.show({kind:"error",message:He}),be}},Ro=c.jsx(o_,{state:fe.state,onSendFirstDispatchGuide:Sa,onStop:fe.stop,onRemoveWorkspace:()=>{i(E).catch(be=>{const He=be instanceof Error?be.message:String(be);ne.show({kind:"error",message:`Delete failed: ${He}`})})},onStart:fe.start,onRestart:fe.restart,workspaceId:E.id}),Oo=c.jsxs("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:[c.jsx(Pj,{onAddWorkerClick:()=>ee(!0),onDeleteWorker:en,onOpenShellTerminal:Te,onOpenWorker:be=>P(be.id),onRenameWorker:tn,onStartWorker:Cn,onStopWorker:pn,onRestartWorker:Tn,startingWorkerId:Z,terminalRuns:k,workers:C,workspaceId:E.id}),R?null:c.jsx(DA,{tabs:ie,activeId:le.activeId,scopeKey:E.id,onSelect:le.setActive,onClose:be=>{be.startsWith("shell:")&&pe(be.slice(6)),le.closeTab(be)},onClosePanel:()=>W(!0),onNewShell:Ve,newShellPending:Se,onStartWorker:be=>{const He=C.find(ut=>ut.id===be);He&&Cn(He)},startingWorkerId:Z})]});return c.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",style:{background:"var(--bg-2)"},children:[c.jsx(CA,{terminalRuns:k,workers:C,workspace:E}),j?c.jsx(dA,{workspaceId:E.id,onOpenWorker:P},E.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(be=>{const He=Y===be,ut=`mobile-team-tab-${be}`,Ea=`mobile-team-panel-${be}`;return c.jsxs("button",{id:ut,type:"button",role:"tab","aria-selected":He,"aria-controls":Ea,tabIndex:He?0:-1,"data-active":He||void 0,"data-testid":ut,onClick:()=>J(be),className:"flex min-h-11 flex-1 items-center justify-center gap-1.5 rounded-md text-sm font-medium",style:He?{background:"var(--accent)",color:"var(--bg-0)"}:{background:"var(--bg-3)",color:"var(--text-secondary)"},children:[c.jsx("span",{children:N(be==="orchestrator"?"mobile.team.orchestrator":"mobile.team.workers")}),be==="workers"&&C.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:He?{background:"var(--bg-0)",color:"var(--accent)"}:{background:"var(--bg-1)",color:"var(--text-secondary)"},children:C.length}):null]},be)}),c.jsx("button",{type:"button",onClick:mA,"aria-pressed":G,"aria-label":N(G?"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:G?c.jsx(tE,{size:16,"aria-hidden":!0}):c.jsx(JS,{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":Y!=="orchestrator",className:"mobile-team-pane flex min-h-0 min-w-0 flex-col","data-active":Y==="orchestrator"?"true":"false",children:Ro}),c.jsx("div",{id:"mobile-team-panel-workers",role:"tabpanel","aria-labelledby":"mobile-team-tab-workers","aria-hidden":Y!=="workers",className:"mobile-team-pane flex min-h-0 min-w-0 flex-col","data-active":Y==="workers"?"true":"false",children:Oo})]})]}):c.jsxs("div",{ref:me.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:de},"data-testid":"orchestrator-pane-shell",children:Ro}),c.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":N("workerPane.resize"),"aria-valuenow":Math.round(me.orchPct*100),"aria-valuemin":30,"aria-valuemax":78,tabIndex:0,className:"pane-splitter",style:{left:`calc(${de} - 4px)`},"data-dragging":me.dragging||void 0,"data-testid":"pane-splitter",onPointerDown:me.beginDrag,onKeyDown:me.onKeyDown}),Oo]}),ce?c.jsx(b.Suspense,{fallback:null,children:c.jsx(Kj,{onClose:()=>P(null),onStart:Cn,runId:mt?.run_id??null,startError:q,starting:Z===ce.id,worker:ce})}):null,re?c.jsx(b.Suspense,{fallback:null,children:c.jsx(Fj,{commandPresets:ae.commandPresets,commandPresetId:ae.commandPresetId,creating:ae.creating,customTemplates:ae.customTemplates,onApplyMarketplaceImport:ae.applyMarketplaceImport,onClose:()=>ee(!1),onDeleteTemplate:ae.deleteTemplate,onNameChange:ae.setWorkerName,onPresetChange:ae.setCommandPresetId,onRandomName:ae.randomizeWorkerName,onRoleDescriptionChange:ae.setRoleDescription,onRoleDescriptionReset:ae.resetRoleDescription,onRoleChange:ae.setWorkerRole,onSaveAsTemplate:ae.saveAsTemplate,onSubmit:be=>ae.submit(be,()=>ee(!1)),onStartupCommandChange:ae.setStartupCommand,onTemplateChange:ae.selectTemplate,roleDescription:ae.roleDescription,roleDescriptionDefault:ae.roleDescriptionDefault,selectedTemplateId:ae.selectedTemplateId,startupCommand:ae.startupCommand,templateBusy:ae.templateBusy,workerName:ae.workerName,workerRole:ae.workerRole})}):null]})},$j=({activeId:t,activeWorkspace:r,activeWorkerId:o,bootstrapError:i,demoMode:l,onActiveWorkerChange:u,onDeleteWorkspace:f,onExitDemo:h,onRequestAddWorkspace:g,onShellRunClosed:m,onShellRunStarted:y,onTryDemo:v,orchestratorAutostartErrors:x,orchestratorAutostartRunIds:S,recordOrchestratorResult:T,terminalRuns:k,workerActions:C,workers:E,workspacesLoading:A,showInlineActionCenter:j})=>l?c.jsx(IE,{onExit:h}):A&&!r?c.jsx("div",{className:"flex flex-1 items-center justify-center",children:c.jsx(ka,{size:24,className:"animate-spin text-ter"})}):c.jsx(Yj,{activeWorkerId:o,onCreateWorker:C.createWorker,onDeleteWorker:C.deleteWorker,onDeleteWorkspace:f,onStartWorker:C.startWorker,onStopWorker:C.stopWorkerRun,onRestartWorker:C.restartWorkerRun,onOrchestratorResult:T,onRequestAddWorkspace:g,onShellRunClosed:m,onShellRunStarted:y,onTryDemo:v,onActiveWorkerChange:u,welcomeDisabledReason:i??void 0,orchestratorAutostartError:t?x[t]??null:null,orchestratorAutostartRunId:t?S[t]??null:null,terminalRuns:k,workers:E,workspace:r,showInlineActionCenter:j}),jl={id:"demo-workspace",name:"demo-todo-app",path:"/Users/you/demo-todo-app"},Vj=[{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"}],Gj=`# 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
|
+
`,Xj=()=>{const[t,r]=b.useState(!1);return{demoMode:t,enableDemo:()=>r(!0),exitDemo:()=>r(!1)}},Zj=t=>{const{demoMode:r,workspaces:o,activeWorkspaceId:i,workersByWorkspaceId:l}=t,u=r?[jl]:o,f=r?{[jl.id]:Vj}:l,h=r?jl.id:i,g=r?jl:o?.find(y=>y.id===i);return{effectiveActiveWorkspaceId:h,effectiveWorkspaces:u,effectiveWorkersByWorkspaceId:f,effectiveActiveWorkspace:g,pollWorkspaceId:r?null:i}},Qj=[{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"}],Jj=[{descriptionKey:"notifications.detail.brief.description",labelKey:"notifications.detail.brief.label",value:"brief"},{descriptionKey:"notifications.detail.detailed.description",labelKey:"notifications.detail.detailed.label",value:"detailed"}],eR=()=>{const{t}=ke(),r=Nt(),[o,i]=b.useState(!1),l=b.useRef(null),u=b.useRef(null),{notify:f,previewSound:h,requestDesktopNotifications:g,settings:m,updateSettings:y}=xc(),v=typeof window<"u"&&!("Notification"in window),x=b.useMemo(()=>Qj.map(k=>({...k,description:t(k.descriptionKey),label:t(k.labelKey)})),[t]),S=b.useMemo(()=>Jj.map(k=>({...k,description:t(k.descriptionKey),label:t(k.labelKey)})),[t]),T=k=>{if(!k){y({desktop:!1});return}g()};return b.useEffect(()=>{if(!o)return;const k=E=>{E.key==="Escape"&&(i(!1),u.current?.focus())},C=E=>{const A=l.current;A&&!A.contains(E.target)&&i(!1)};return document.addEventListener("keydown",k),document.addEventListener("pointerdown",C),()=>{document.removeEventListener("keydown",k),document.removeEventListener("pointerdown",C)}},[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(k=>!k),children:c.jsx(zf,{size:14,"aria-hidden":!0})})}),o?c.jsxs("div",{role:"dialog","aria-modal":r?"true":void 0,"aria-label":t("notifications.settings.aria"),className:r?"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:r?{background:"var(--bg-0)"}:{background:"var(--bg-elevated)",borderColor:"var(--border-bright)"},"data-testid":"notification-settings",children:[c.jsxs("div",{className:r?"flex shrink-0 items-center gap-2 border-b px-4 py-3":"mb-3 flex items-start gap-2",style:r?{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(zf,{size:16,"aria-hidden":!0})}),c.jsxs("div",{className:r?"min-w-0 flex-1":"min-w-0",children:[c.jsx("div",{className:"text-sm font-semibold text-pri",children:t("notifications.settings.heading")}),r?null:c.jsx("div",{className:"text-ter text-xs",children:t("notifications.settings.subtitle")})]}),r?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(ya,{size:20,"aria-hidden":!0})}):null]}),c.jsxs("div",{className:r?"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(Fl,{size:12,"aria-hidden":!0}),t("notifications.sound.sectionLabel")]}),c.jsx("div",{role:"radiogroup","aria-label":t("notifications.sound.sectionLabel"),className:r?"grid grid-cols-1 gap-2":"grid grid-cols-2 gap-2",children:x.map(k=>c.jsxs("div",{className:"relative min-h-[78px] rounded border transition-colors",style:{background:m.sound===k.value?`color-mix(in oklab, ${k.accent} 10%, var(--bg-2))`:"var(--bg-2)",borderColor:m.sound===k.value?`color-mix(in oklab, ${k.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:k.value,checked:m.sound===k.value,className:"sr-only",onChange:()=>y({sound:k.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, ${k.accent} 16%, transparent)`,color:k.accent},children:k.value==="off"?c.jsx(Zb,{size:12,"aria-hidden":!0}):c.jsx(Fl,{size:12,"aria-hidden":!0})}),c.jsx("span",{className:"font-medium text-pri text-xs",children:k.label}),k.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,m.sound===k.value?c.jsx(xa,{size:12,className:"ml-auto text-pri","aria-hidden":!0}):null]}),c.jsx("span",{className:"block text-ter text-xs",children:k.description})]}),k.value!=="off"?c.jsx("button",{type:"button","aria-label":t("notifications.sound.previewAria",{label:k.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:()=>h(k.value),children:c.jsx(No,{size:12,"aria-hidden":!0})}):null]},k.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(Kb,{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(k=>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:m.detail===k.value?"var(--bg-3)":"transparent",color:m.detail===k.value?"var(--text-primary)":"var(--text-secondary)"},children:[c.jsx("input",{type:"radio",name:"notification-detail",value:k.value,checked:m.detail===k.value,className:"sr-only",onChange:()=>y({detail:k.value})}),c.jsx("span",{className:"block font-medium text-xs",children:k.label}),c.jsx("span",{className:"block text-ter text-xs",children:k.description})]},k.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:m.desktop,disabled:v,className:"mt-0.5",onChange:k=>T(k.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]})},nx=({checked:t,disabled:r,onChange:o,...i})=>c.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-label":i["aria-label"],disabled:r,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"})}),tR=t=>Math.max(0,Math.ceil((t-Date.now())/1e3)),nR=()=>{const{t}=ke(),[r,o]=b.useState(null),[i,l]=b.useState(!1),[u,f]=b.useState(!1),[h,g]=b.useState(()=>Date.now());b.useEffect(()=>{if(!r)return;const x=window.setInterval(()=>g(Date.now()),1e3);return()=>window.clearInterval(x)},[r]);const m=async()=>{f(!1),l(!0);try{const x=await RC();o(x),g(Date.now())}catch{f(!0)}finally{l(!1)}};if(!r)return c.jsxs("div",{className:"p-1.5",children:[c.jsxs("button",{type:"button","data-testid":"settings-remote-add-device",onClick:()=>{m()},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=tR(r.expiresAt),v=y<=0||h>=r.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:r.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:()=>{m()},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")})]})]})]})},rR={ok:"remote.audit.result.ok",rejected:"remote.audit.result.rejected",error:"remote.audit.result.error"},aR=t=>{const r=Math.max(0,Date.now()-t),o=Math.floor(r/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`},oR=()=>{const{t}=ke(),[r,o]=b.useState(!1),[i,l]=b.useState(null),[u,f]=b.useState(!1),h=b.useCallback(async()=>{f(!1);try{l(await LC(100))}catch{f(!0)}},[]);return b.useEffect(()=>{r&&h()},[r,h]),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":r,children:[c.jsx(ql,{size:12,"aria-hidden":!0,className:"shrink-0"}),c.jsx("span",{className:"flex-1 text-left",children:t(r?"remote.audit.hide":"remote.audit.show")}),r?c.jsx(To,{size:12,"aria-hidden":!0,className:"shrink-0 text-ter"}):c.jsx(lc,{size:12,"aria-hidden":!0,className:"shrink-0 text-ter"})]}),r?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 m=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:m?{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:m?"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]}),m?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(rR[g.result]),g.rejectReason?` · ${g.rejectReason}`:""]}):null,c.jsx("span",{className:"shrink-0 tabular-nums text-ter",children:aR(g.ts)})]},g.id)})})}):null]})},qy=t=>{const r=Math.max(0,Date.now()-t),o=Math.floor(r/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`},sR=({reloadKey:t=0})=>{const{t:r}=ke(),o=Jt(),[i,l]=b.useState(null),[u,f]=b.useState(!1),[h,g]=b.useState(null),m=b.useCallback(async()=>{f(!1);try{const x=await f0();l(x)}catch{f(!0)}},[]);b.useEffect(()=>{m()},[m,t]);const y=async x=>{try{await MC(x.deviceId),o.show({kind:"success",message:r("remote.devices.revoked",{name:x.name})}),await m()}catch{o.show({kind:"error",message:r("remote.devices.revokeFailed")})}},v=(i??[]).filter(x=>!x.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:r("remote.devices.heading")}),u?c.jsx("div",{className:"text-xs",style:{color:"var(--text-error)"},role:"alert",children:r("remote.devices.loadFailed")}):v.length===0?c.jsx("div",{className:"text-xs text-ter",children:r("remote.devices.empty")}):c.jsx("ul",{className:"flex flex-col gap-1",children:v.map(x=>c.jsxs("li",{className:"flex items-center justify-between gap-2 rounded p-1.5 hover:bg-3","data-testid":`remote-device-${x.deviceId}`,children:[c.jsxs("span",{className:"min-w-0",children:[c.jsx("span",{className:"block truncate text-sm text-pri",children:x.name}),c.jsx("span",{className:"block text-xs text-ter",children:x.lastActive===null?r("remote.devices.neverActive"):qy(x.lastActive)==="<1m"?r("remote.devices.activeNow"):r("remote.devices.lastActive",{ago:qy(x.lastActive)})})]}),c.jsx("button",{type:"button","data-testid":`remote-device-revoke-${x.deviceId}`,"aria-label":r("remote.devices.revokeAria",{name:x.name}),onClick:()=>g(x),className:"icon-btn icon-btn--danger shrink-0",children:r("remote.devices.revoke")})]},x.deviceId))}),c.jsx(ai,{open:h!==null,onOpenChange:x=>{x||g(null)},title:r("remote.devices.revokeTitle"),description:h?r("remote.devices.revokeConfirm",{name:h.name}):"",confirmLabel:r("remote.devices.revoke"),confirmKind:"danger",onConfirm:()=>{h&&y(h)}})]})},iR=2e3,$f={enabled:!1,loggedIn:!1,gatewayUrl:null,connected:!1,connection:"disabled"},rx=b.createContext({status:$f,loading:!0,setEnabled:async()=>{},pending:null,refresh:async()=>{}}),lR=({children:t})=>{const r=Nt(),[o,i]=b.useState($f),[l,u]=b.useState(!0),[f,h]=b.useState(null);b.useEffect(()=>{let v=!1;return Jd().then(x=>{v||i(x)}).catch(()=>{}).finally(()=>{v||u(!1)}),()=>{v=!0}},[]);const g=b.useCallback(async v=>{const x=await jC(v);i(x),x.enabled||h(null)},[]),m=b.useCallback(async()=>{const v=await Jd().catch(()=>$f);i(v),v.enabled&&v.loggedIn&&!r?h(await ay().catch(()=>null)):h(null)},[r]),y=o.enabled&&o.loggedIn&&!r;return b.useEffect(()=>{if(!y){h(null);return}let v=!1;const x=()=>{Jd().then(T=>{v||i(T)}).catch(()=>{}),ay().then(T=>{v||h(T)}).catch(()=>{})};x();const S=window.setInterval(x,iR);return()=>{v=!0,window.clearInterval(S)}},[y]),c.jsx(rx.Provider,{value:{status:o,loading:l,setEnabled:g,pending:f,refresh:m},children:t})},Um=()=>b.useContext(rx),cR={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)"},uR={connecting:"remote.status.connecting",reconnecting:"remote.status.reconnecting",revoked:"remote.status.revoked"},dR=()=>{const{t}=ke(),r=Jt(),o=Nt(),{status:i,loading:l,setEnabled:u,pending:f}=Um(),h=cR[i.connection],g=uR[i.connection],[m,y]=b.useState(!1),[v,x]=b.useState(!1),[S,T]=b.useState(!1),[k,C]=b.useState(!1),[E,A]=b.useState(!1),[j,N]=b.useState(null),[O,D]=b.useState(!1),L=b.useRef(null),[B,P]=b.useState(0),re=b.useRef(!1);b.useEffect(()=>{f?re.current=!0:re.current&&(re.current=!1,P(I=>I+1))},[f]),b.useEffect(()=>()=>{L.current&&clearTimeout(L.current)},[]),b.useEffect(()=>{let I=!1;return IC().then(Z=>{I||(N(Z),D(!1))}).catch(()=>{I||D(!0)}),()=>{I=!0}},[]);const ee=async I=>{x(!1),y(!0);try{await u(I)}catch{x(!0)}finally{y(!1)}},Y=I=>{if(!I&&o){T(!0);return}ee(I)},J=async()=>{if(!k){C(!0);try{const I=UC().then(Z=>JSON.stringify(Z,null,2));await p0(I),A(!0),L.current&&clearTimeout(L.current),L.current=setTimeout(()=>{A(!1),L.current=null},1200),r.show({kind:"success",message:t("remote.diagnostics.copied")})}catch{r.show({kind:"error",message:t("remote.diagnostics.copyFailed")})}finally{C(!1)}}},G=j?.current_streak_days??0,V=j?.days_active_total??0,M=j?.totals?.send??0,q=j?.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&&!m&&Y(!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(nx,{checked:i.enabled,disabled:l||m,onChange:Y,"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:k,className:"icon-btn mt-2 w-full justify-center pointer-coarse:min-h-11",children:[E?c.jsx(xa,{size:12,"aria-hidden":!0}):c.jsx(Gs,{size:12,"aria-hidden":!0}),c.jsx("span",{children:t(k?"remote.diagnostics.copying":E?"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")}):j?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:G}),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:V}),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:M}),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:q}),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:h}}),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(nR,{}):null,c.jsx(sR,{reloadKey:B}),c.jsx(oR,{})]}):null,c.jsx(ai,{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)}})]})},ax=b.createContext({enabled:!0,loading:!0,setEnabled:async()=>{}}),fR=({children:t})=>{const[r,o]=b.useState(!0),[i,l]=b.useState(!0);b.useEffect(()=>{let f=!1;return oC().then(h=>{f||o(h.enabled)}).catch(()=>{}).finally(()=>{f||l(!1)}),()=>{f=!0}},[]);const u=b.useCallback(async f=>{const h=await sC(f);o(h.enabled)},[]);return c.jsx(ax.Provider,{value:{enabled:r,loading:i,setEnabled:u},children:t})},mR=()=>b.useContext(ax),ox=b.createContext({enabled:!1,loading:!0,setEnabled:async()=>{}}),pR=({children:t})=>{const[r,o]=b.useState(!1),[i,l]=b.useState(!0);b.useEffect(()=>{let f=!1;return rC().then(h=>{f||o(h.enabled)}).catch(()=>{}).finally(()=>{f||l(!1)}),()=>{f=!0}},[]);const u=b.useCallback(async f=>{const h=await aC(f);o(h.enabled)},[]);return c.jsx(ox.Provider,{value:{enabled:r,loading:i,setEnabled:u},children:t})},sx=()=>b.useContext(ox),hR=()=>{const{language:t,setLanguage:r,t:o}=ke();return c.jsxs("div",{className:"settings-section",children:[c.jsxs("div",{className:"settings-section__heading",children:[c.jsx(YS,{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:()=>r("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:()=>r("en"),"data-testid":"language-en-btn",children:"English"})]})]})},Py=({feature:t,label:r,description:o,testId:i})=>{const{t:l}=ke(),[u,f]=b.useState(!1),[h,g]=b.useState(!1),m=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&&m(!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:r}),c.jsx("span",{className:"mt-0.5 block text-xs text-ter leading-relaxed",children:o}),h?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(nx,{checked:t.enabled,disabled:t.loading||u,onChange:y=>{m(y)},"data-testid":i,"aria-label":r})})]})},gR=()=>{const{t}=ke(),[r,o]=b.useState(""),[i,l]=b.useState(!1),[u,f]=b.useState(!1),[h,g]=b.useState(null);b.useEffect(()=>{let y=!1;return tC().then(v=>{y||(o(v),l(!0))}).catch(()=>{y||l(!0)}),()=>{y=!0}},[]);const m=async()=>{g(null),f(!0);try{await nC(r),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:r,disabled:!i||u,onChange:y=>{g(null),o(y.target.value)},onBlur:()=>{m()},onKeyDown:y=>{if(y.key==="Enter"){if(y.nativeEvent.isComposing||y.keyCode===229)return;y.currentTarget.blur()}},"data-testid":"settings-webhook-url"}),h==="saved"?c.jsxs("span",{className:"mt-1.5 block text-xs",style:{color:"var(--status-green)"},children:["✓ ",t("settings.webhook.saved")]}):null,h==="error"?c.jsx("span",{className:"mt-1.5 block text-xs",style:{color:"var(--text-error)"},role:"alert",children:t("settings.saveError")}):null]})},ix=()=>{const{t}=ke(),r=sx(),o=mR();return c.jsxs("div",{className:"flex flex-col gap-2.5",children:[c.jsx(hR,{}),c.jsxs("div",{className:"settings-section",children:[c.jsxs("div",{className:"settings-section__heading",children:[c.jsx(Pl,{size:12,"aria-hidden":!0}),c.jsx("span",{children:t("settings.experimental")})]}),c.jsx(Py,{feature:r,label:t("settings.workflows.label"),description:t("settings.workflows.description"),testId:"settings-toggle-workflows"}),c.jsx(Py,{feature:o,label:t("settings.autostaff.label"),description:t("settings.autostaff.description"),testId:"settings-toggle-autostaff"})]}),c.jsx(dR,{}),c.jsxs("div",{className:"settings-section",children:[c.jsxs("div",{className:"settings-section__heading",children:[c.jsx(AE,{size:12,"aria-hidden":!0}),c.jsx("span",{children:t("settings.webhook.label")})]}),c.jsx(gR,{})]})]})},lx=()=>{const{t}=ke(),r=Nt(),[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())},h=g=>{const m=l.current;m&&!m.contains(g.target)&&i(!1)};return document.addEventListener("keydown",f),document.addEventListener("pointerdown",h),()=>{document.removeEventListener("keydown",f),document.removeEventListener("pointerdown",h)}},[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(Hf,{size:14,"aria-hidden":!0})})}),o?c.jsxs("div",{role:"dialog","aria-label":t("settings.aria"),className:r?"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":r||void 0,style:r?{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(Hf,{size:18,"aria-hidden":!0})}),c.jsxs("div",{className:r?"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")})]}),r?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(ya,{size:16,"aria-hidden":!0})}):null]}),c.jsx(ix,{})]}):null]})},vR=t=>{const[r,o]=b.useState(null);return b.useEffect(()=>{if(t)return;let i=!0;return VE().then(l=>{i&&o(l)}).catch(()=>{i&&o(null)}),()=>{i=!1}},[t]),t??r},yR="2.1.3",bR={version:yR},cx=bR.version,wR=({actions:t,hideActions:r=!1,memoryOpen:o=!1,onToggleMemory:i,onToggleTaskGraph:l,openTaskCount:u=0,taskGraphOpen:f=!1,onToggleWorkflows:h,workflowsOpen:g=!1,version:m=cx,versionInfo:y})=>{const{t:v}=ke(),[x,S]=b.useState("idle"),T=vR(y),k=T?.updateAvailable&&T.latestVersion!==m?T:null,C=!!k?.installHint,E=u>0,A=f?v("topbar.hideTodo"):E?v("topbar.todoOpen",{count:u}):v("topbar.showTodo"),j=async()=>{if(k?.installHint)try{await navigator.clipboard.writeText(k.installHint),S("copied"),window.setTimeout(()=>S("idle"),1600)}catch{S("error"),window.setTimeout(()=>S("idle"),2200)}},N=v(x==="copied"?"topbar.updateCommandCopied":x==="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",m]})]}),k?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",m," → v",k.latestVersion]}),C?c.jsx("code",{className:"mono hidden max-w-[18rem] truncate rounded border px-1.5 py-0.5 text-ter md:inline-block",title:k.updateNote||k.installHint,style:{borderColor:"var(--border)",background:"var(--bg-1)"},children:k.installHint}):null,k.updateNote?c.jsx("span",{className:"hidden max-w-[18rem] truncate text-ter xl:inline",title:k.updateNote,children:k.updateNote}):null,C?c.jsx(Qe,{label:N,children:c.jsx("button",{type:"button",onClick:j,"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:x==="copied"?c.jsx(xa,{size:12}):c.jsx(Gs,{size:12})})}):null,k.releaseUrl?c.jsx(Qe,{label:v("topbar.openRelease"),children:c.jsx("a",{href:k.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(Pb,{size:12})})}):null]}):null]}),c.jsx("div",{className:"flex-1"}),r?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(uS,{size:13}),c.jsx("span",{children:v("topbar.memory")})]})}):null,l?c.jsx(Qe,{label:A,children:c.jsxs("button",{type:"button",onClick:l,"aria-pressed":f,"aria-label":A,"data-has-tasks":E?"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(Yb,{size:13,className:E?"text-accent":void 0}),c.jsx("span",{children:v("topbar.todo")})]})}):null,h?c.jsx(Qe,{label:v(g?"topbar.hideWorkflows":"topbar.showWorkflows"),children:c.jsxs("button",{type:"button",onClick:h,"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(Qb,{size:13}),c.jsx("span",{children:v("topbar.workflows")})]})}):null,c.jsx(eR,{}),c.jsx(lx,{})]})]})},ux="hive.workspace-sidebar.width",qs=56,Im=280,xf=qs,Fy=16,xR=240,Ky=96,Wl=t=>Math.min(Im,Math.max(qs,t)),kR=()=>{try{const t=localStorage.getItem(ux);if(!t)return xf;const r=Number.parseInt(t,10);return Number.isFinite(r)?Wl(r):xf}catch{return xf}},SR=()=>{const[t,r]=b.useState(kR),[o,i]=b.useState(!1);b.useEffect(()=>{try{localStorage.setItem(ux,String(Math.round(t)))}catch{}},[t]);const l=b.useCallback(g=>{g.preventDefault();const m=g.clientX,y=t;i(!0);const v=document.body.style.cursor,x=document.body.style.userSelect;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const S=k=>{r(Wl(y+k.clientX-m))},T=()=>{i(!1),document.body.style.cursor=v,document.body.style.userSelect=x,document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",T)};document.addEventListener("mousemove",S),document.addEventListener("mouseup",T)},[t]),u=t<=Ky,f=b.useCallback(()=>{r(g=>g<=Ky?xR:qs)},[]),h=b.useCallback(g=>{g.key==="ArrowLeft"?(g.preventDefault(),r(m=>Wl(m-Fy))):g.key==="ArrowRight"?(g.preventDefault(),r(m=>Wl(m+Fy))):g.key==="Home"?(g.preventDefault(),r(qs)):g.key==="End"&&(g.preventDefault(),r(Im))},[]);return{beginResize:l,collapsed:u,onResizeKeyDown:h,resizing:o,toggleCollapsed:f,width:t}},ER=({children:t,hideTopbarActions:r=!1,memoryOpen:o=!1,onToggleMemory:i,onToggleTaskGraph:l,openTaskCount:u=0,onToggleWorkflows:f,workflowsOpen:h=!1,sidebar:g,sidebarResize:m,taskGraphOpen:y=!1,topbarActions:v})=>{const{t:x}=ke();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(wR,{actions:v,hideActions:r,memoryOpen:o,onToggleMemory:i,onToggleTaskGraph:l,openTaskCount:u,taskGraphOpen:y,onToggleWorkflows:f,workflowsOpen:h}),c.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 overflow-hidden",children:[c.jsxs("aside",{"aria-label":x("layout.sidebarAria"),className:"workspace-sidebar relative flex shrink-0 flex-col","data-resizing":m.resizing?"true":"false",style:{background:"var(--bg-0)",boxShadow:"inset -1px 0 0 var(--border)",width:`${m.width}px`},children:[g,c.jsx("hr",{"aria-label":x("layout.sidebarResizeAria"),"aria-orientation":"vertical","aria-valuemin":qs,"aria-valuemax":Im,"aria-valuenow":Math.round(m.width),tabIndex:0,className:"workspace-sidebar-resizer","data-resizing":m.resizing?"true":"false",onMouseDown:m.beginResize,onKeyDown:m.onResizeKeyDown})]}),c.jsx("section",{className:"relative flex min-w-0 flex-1 overflow-hidden",children:t})]})]})},CR={disconnected:"mobile.reconnect.disconnected",reconnecting:"mobile.reconnect.reconnecting",revoked:"mobile.reconnect.revoked"},TR=({status:t})=>{const{t:r}=ke();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:r(CR[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:r("mobile.reconnect.retry")}):null]})},NR=[{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"}],AR=[{descriptionKey:"notifications.detail.brief.description",labelKey:"notifications.detail.brief.label",value:"brief"},{descriptionKey:"notifications.detail.detailed.description",labelKey:"notifications.detail.detailed.label",value:"detailed"}],_R=()=>{const{t}=ke(),r=Nt(),{notify:o,previewSound:i,requestDesktopNotifications:l,settings:u,updateSettings:f}=xc(),h=typeof window<"u"&&!("Notification"in window),g=b.useMemo(()=>NR.map(v=>({...v,description:t(v.descriptionKey),label:t(v.labelKey)})),[t]),m=b.useMemo(()=>AR.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(zf,{size:12,"aria-hidden":!0}),c.jsx("span",{children:t("notifications.settings.heading")})]}),c.jsx(To,{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(Fl,{size:12,"aria-hidden":!0}),t("notifications.sound.sectionLabel")]}),c.jsx("div",{role:"radiogroup","aria-label":t("notifications.sound.sectionLabel"),className:r?"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(Zb,{size:12,"aria-hidden":!0}):c.jsx(Fl,{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(xa,{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(No,{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(Kb,{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:m.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:h,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(h?"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")})})]})]})},jR=({demoMode:t,onTryDemo:r,onExitDemo:o})=>{const{t:i}=ke();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(ix,{}),c.jsx(_R,{}),c.jsxs("div",{className:"settings-section mt-3",children:[c.jsxs("div",{className:"settings-section__heading",children:[c.jsx(Pl,{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(ZS,{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:r,className:"flex w-full items-center gap-3 rounded p-2 text-left text-sm text-pri hover:bg-3",children:[c.jsx(Pl,{size:16,"aria-hidden":!0,className:"text-ter"}),c.jsx("span",{className:"min-w-0 flex-1 truncate",children:i("mobile.section.demo")})]})]})]})},RR={team:bm,tasks:Yb,flows:Qb,settings:Hf},OR={team:"mobile.nav.team",tasks:"mobile.nav.tasks",flows:"mobile.nav.flows",settings:"mobile.nav.settings"},DR=({active:t,onSelect:r,sections:o,openTaskCount:i=0,workingCount:l=0})=>{const{t:u}=ke();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 h=RR[f],g=u(OR[f]),m=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":m?"page":void 0,"data-testid":`mobile-nav-${f}`,"data-active":m?"true":void 0,onClick:()=>r(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:m?"var(--text-primary)":"var(--text-tertiary)"},children:[m?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(h,{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)})})},MR=({workspaceSwitcher:t,actions:r,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:r})]}),o]}),LR=()=>typeof navigator<"u"&&/iP(hone|ad|od)/.test(navigator.platform??navigator.userAgent),zR=()=>{const[t,r]=b.useState(null);return b.useEffect(()=>{if(!LR())return;const o=typeof window<"u"?window.visualViewport:null;if(!o)return;const i=()=>{const l=Math.abs(o.height-window.innerHeight)<10;r(l?null:o.height)};return i(),o.addEventListener("resize",i),()=>{o.removeEventListener("resize",i)}},[]),t},HR={team:"mobile-section-team",tasks:"mobile-section-tasks",flows:"mobile-section-flows",settings:"mobile-section-settings"},BR=({workspaceSwitcher:t,topbarActions:r,banner:o,fullBleed:i,team:l,tasks:u,flows:f,settings:h,terminalPanels:g,overlays:m,openTaskCount:y=0,workingCount:v=0,activeSection:x,onSectionChange:S})=>{const[T,k]=b.useState("team"),C=x??T,E=zR(),A=B=>{k(B),S?.(B)},j={team:l,tasks:u,flows:f,settings:h},N=["team","tasks"];f!=null&&N.push("flows"),h!=null&&N.push("settings");const O=N.includes(C)?C:"team",L=sw()&&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)",...E!=null?{height:`${E}px`}:{}},children:[L?o:c.jsx(MR,{workspaceSwitcher:t,actions:r,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":HR[O],"data-mobile-section":O,children:j[O]})}),g,i!=null||L?null:c.jsx(DR,{active:O,onSelect:A,sections:N,openTaskCount:y,workingCount:v}),m]})},WR=[],UR=b.lazy(()=>Tt(()=>import("./TaskGraphDrawer-e_bg3f5u.js"),[]).then(t=>({default:t.TaskGraphContent}))),IR=({tasksFile:t,workspacePath:r,workers:o,onSelectOwner:i,onAddWorkspace:l,demoMode:u=!1})=>{const{t:f}=ke(),h=o??WR,g=b.useMemo(()=>h.length?h.map(m=>m.name):void 0,[h]);return r?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(UR,{content:t.content,hasConflict:t.hasConflict,onContentChange:t.onChange,onKeepLocal:t.onKeepLocal,onReload:t.onReload,onSave:t.onSave,onToggleTaskLine:m=>{t.toggleTaskAtLine(m).catch(Wr("tasks.toggleTaskAtLine"))},onAppendTask:m=>{t.appendTask(m).catch(Wr("tasks.appendTask"))},onAppendSubtask:(m,y)=>{t.appendSubtask(m,y).catch(Wr("tasks.appendSubtask"))},onUpdateTaskText:(m,y)=>{t.updateTaskText(m,y).catch(Wr("tasks.updateTaskText"))},onDeleteTask:m=>{t.deleteTask(m).catch(Wr("tasks.deleteTask"))},workspacePath:r,...g?{knownWorkerNames:g}:{},...i?{onSelectOwner:i}:{}})})})]}):c.jsx("div",{className:"flex h-full flex-col","data-testid":"mobile-tasks-empty",children:c.jsx(Qs,{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})})},Yy=[{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"}],qR=t=>{let r=0;for(let i=0;i<t.length;i+=1)r=r*31+t.charCodeAt(i)|0;const o=Math.abs(r)%Yy.length;return Yy[o]},PR=t=>{const r=t.trim();if(r.length===0)return"?";const o=r.codePointAt(0);return o===void 0?"?":String.fromCodePoint(o).toUpperCase()},Vf=({workspaceId:t,name:r,isActive:o,working:i,workingCount:l,size:u=32})=>{const{token:f,label:h}=qR(t),g=PR(r),m=l&&l>1?l:null;return c.jsx(Gw,{size:u,color:f,fontRatio:.45,ringColor:o?f:null,testId:"workspace-avatar",data:{"workspace-id":t,active:o?"true":void 0,"color-label":h},decoration:m!==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:m>9?"9+":m}):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})},$y=(t,r)=>{if(!t||t.length===0)return r("sidebar.noMembers");const o=t.filter(i=>i.status==="working").length;return o>0?r("sidebar.workingCount",{working:o,total:t.length}):r("sidebar.teamMemberCount",{count:t.length})},FR=({activeWorkspaceId:t,workspaces:r,workersByWorkspaceId:o,createDisabledReason:i,onSelectWorkspace:l,onCreateClick:u,onDeleteWorkspace:f})=>{const{t:h}=ke(),g=Jt(),[m,y]=b.useState(!1),[v,x]=b.useState(null),[S,T]=b.useState(!1),k=r?.find(E=>E.id===t)?.name??h("mobile.section.workspaces"),C=()=>{if(!v||S)return;const E=v;T(!0),Promise.resolve(f(E)).then(()=>{g.show({kind:"success",message:h("sidebar.removed",{name:E.name})})}).catch(A=>{const j=A instanceof Error?A.message:String(A);g.show({kind:"error",message:h("sidebar.deleteFailed",{message:j})})}).finally(()=>{T(!1),x(null)})};return c.jsxs(Js,{open:m,onOpenChange:y,children:[c.jsx(xj,{asChild:!0,children:c.jsxs("button",{type:"button","data-testid":"mobile-workspace-switcher-trigger","aria-label":h("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:k}),c.jsx(To,{size:16,"aria-hidden":!0,className:"shrink-0 text-ter"})]})}),c.jsxs(ei,{children:[c.jsx(ti,{"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(ni,{"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(ri,{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:h("sidebar.workspaces")}),r&&r.length>0?c.jsx("span",{className:"text-xs text-ter tabular-nums",children:r.length}):null]})}),c.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto py-1",children:!r||r.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:h("sidebar.noWorkspaces")}),c.jsx("span",{className:"text-xs text-ter",children:i??h("sidebar.noWorkspacesDesc")})]}):r.map(E=>{const A=E.id===t,j=o[E.id],N=j?.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-${E.id}`,onClick:()=>{y(!1),l(E.id)},className:"flex min-h-14 min-w-0 flex-1 items-center gap-3 px-4 py-2 text-left",style:A?{background:"color-mix(in oklab, var(--accent) 10%, transparent)"}:void 0,children:[c.jsx(Vf,{workspaceId:E.id,name:E.name,isActive:A,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:E.name}),c.jsx("span",{className:"truncate text-xs text-ter",children:$y(j,h)})]}),A?c.jsx(xa,{size:18,className:"shrink-0 text-accent","aria-hidden":!0}):null]}),c.jsx("button",{type:"button","aria-label":h("sidebar.deleteAria",{name:E.name}),"data-testid":`mobile-ws-delete-${E.id}`,onClick:()=>x(E),className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-md text-ter",children:c.jsx(uc,{size:16,"aria-hidden":!0})})]},E.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(Ms,{size:16,"aria-hidden":!0}),h("sidebar.newWorkspace")]})})]})})]}),c.jsx(ai,{open:v!==null,onOpenChange:E=>{!E&&!S&&x(null)},title:v?h("sidebar.deleteConfirm",{name:v.name}):h("sidebar.deleteLabel"),description:v?h("sidebar.deleteDescription",{path:v.path,summary:$y(o[v.id],h)}):"",confirmLabel:h(S?"sidebar.deleting":"sidebar.deleteLabel"),confirmKind:"danger",onConfirm:C})]})},KR=4e3,YR=t=>{const[r,o]=b.useState([]);return b.useEffect(()=>{if(!t){o([]);return}let i=!1;const l=()=>{f0().then(f=>{i||o(f)}).catch(()=>{})};l();const u=window.setInterval(l,KR);return()=>{i=!0,window.clearInterval(u)}},[t]),r},$R=({devices:t,enabled:r})=>{const{notify:o}=xc(),{t:i}=ke(),l=b.useRef(null);return b.useEffect(()=>{if(!r){l.current=null;return}const u=new Map(t.filter(h=>!h.revoked).map(h=>[h.deviceId,h])),f=l.current;if(l.current=new Set(u.keys()),!!f)for(const[h,g]of u)f.has(h)||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,r,o,i]),null},VR=()=>{const{status:t}=Um(),r=t.enabled&&t.loggedIn,o=YR(r);return c.jsx($R,{devices:o,enabled:r})};let Gf=!1;const dx=()=>{Gf=!0,window.location.reload()},GR=t=>{b.useEffect(()=>{const r=o=>{if(Gf){Gf=!1;return}o.preventDefault(),o.returnValue=""};return window.addEventListener("beforeunload",r),()=>window.removeEventListener("beforeunload",r)},[t])},XR=3e3,ZR=({onTryDemo:t}={})=>{const{t:r}=ke(),[o,i]=b.useState(!1),l=b.useRef(!0),u=b.useCallback(()=>{typeof window>"u"||dx()},[]),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()},XR);return()=>{l.current=!1,window.clearInterval(g)}},[f,u]);const h=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(dE,{size:24,"aria-hidden":!0})}),c.jsx("div",{className:"font-semibold text-pri",children:r("pwa.runtimeOffline.title")}),c.jsx("div",{className:"text-sec text-sm leading-relaxed",children:r("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:()=>{h()},children:[o?c.jsx(ka,{size:12,className:"animate-spin","aria-hidden":!0}):c.jsx(gm,{size:12,"aria-hidden":!0}),r(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(kS,{size:12,"aria-hidden":!0}),r("pwa.runtimeOffline.tryDemo")]}):null]}),c.jsx("div",{className:"text-ter text-xs",children:r("pwa.runtimeOffline.autoReconnect")})]})})},Xf=new Set;let fx=null;const QR=t=>{fx=t;for(const r of Xf)r(t)},JR=t=>(Xf.add(t),t(fx),()=>{Xf.delete(t)}),e3=2e3,t3=async t=>{if(!t.serviceWorker)return;let r;try{r=await t.serviceWorker.register("/sw.js")}catch{return}const o=l=>{const u=()=>{l.state==="installed"&&t.serviceWorker?.controller&&QR(()=>{l.postMessage({type:"SKIP_WAITING"}),setTimeout(t.reload,e3)})};l.addEventListener("statechange",u)};r.waiting&&t.serviceWorker.controller&&o(r.waiting),r.installing&&o(r.installing),r.addEventListener("updatefound",()=>{r.installing&&o(r.installing)});let i=!1;t.serviceWorker.addEventListener("controllerchange",()=>{i||(i=!0,t.reload())})},n3=()=>typeof navigator>"u"||typeof window>"u"?Promise.resolve():t3({isProd:!0,serviceWorker:"serviceWorker"in navigator?navigator.serviceWorker:null,reload:dx}),Vy=({terminalRuns:t})=>{const{t:r}=ke(),o=Nt(),[i,l]=b.useState(null),[u,f]=b.useState(!1);if(b.useEffect(()=>JR(y=>{l(()=>y)}),[]),!i)return null;const h=t.every(y=>y.status==="stopped"),g=!h||u,m=r(u?"pwa.reloading":h?"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(gm,{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:r("pwa.appShellUpdated")}),c.jsx("span",{className:"text-ter text-xs",children:r(h?"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:m})]})},r3=new Set(["add-workspace","try-demo"]),a3=t=>t!==null&&r3.has(t),o3=({onAddWorkspace:t,onTryDemo:r,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");a3(u)&&(i.current=!0,window.history.replaceState({},"",window.location.pathname),u==="add-workspace"?t():u==="try-demo"&&r())},[o,t,r])},Gy=()=>{const{t}=ke(),r=Jt(),o=Nt(),{pending:i,refresh:l}=Um(),[u,f]=b.useState(!1),h=b.useRef(!1),g=i?.deviceName??"",m=i?.pairingId??null,y=i?.expiresAt??null;b.useEffect(()=>{m!==null&&(h.current=!1)},[m]);const v=b.useCallback(async()=>{if(!(!m||u||h.current)){h.current=!0,f(!0);try{await OC(m),r.show({kind:"success",message:t("remote.confirm.paired",{name:g})})}catch{h.current=!1,r.show({kind:"error",message:t("remote.confirm.failed")})}finally{f(!1),await l()}}},[m,u,g,l,t,r]),x=b.useCallback(async S=>{if(!(!m||h.current)){h.current=!0;try{await DC(m)}catch{}r.show({kind:S==="expired"?"warning":"success",message:t(S==="expired"?"remote.confirm.expired":"remote.confirm.rejected")}),f(!1),await l()}},[m,l,t,r]);return b.useEffect(()=>{if(y===null)return;const S=y-Date.now();if(S<=0){x("expired");return}const T=window.setTimeout(()=>{x("expired")},S);return()=>window.clearTimeout(T)},[y,x]),!i||o?null:c.jsx(Js,{open:!0,onOpenChange:S=>{S||x("rejected")},children:c.jsxs(ei,{children:[c.jsx(ti,{"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(ni,{"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(pE,{size:18})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx(ri,{className:"text-lg font-semibold text-pri",children:t("remote.confirm.title")}),c.jsx(Ec,{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:()=>{x("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")})]})]})})]})})},s3=t=>!!t?.some(r=>r.status==="working"),i3=t=>t?.filter(r=>r.status==="working").length??0,l3=(t,r)=>{if(!t||t.length===0)return r("sidebar.noMembers");const o=t.filter(i=>i.status==="working").length;return o>0?r("sidebar.workingCount",{working:o,total:t.length}):r("sidebar.teamMemberCount",{count:t.length})},mx="hive.sidebar.githubDismissed",c3="https://www.bilibili.com/video/BV1UHLp6nEQR",u3=()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(mx)==="1"}catch{return!1}},d3=({activeWorkspaceId:t,collapsed:r=!1,createDisabledReason:o,onCreateClick:i,onDeleteWorkspace:l,onSelectWorkspace:u,onToggleCollapse:f,workersByWorkspaceId:h,workspaces:g})=>{const{t:m}=ke(),[y,v]=b.useState(null),[x,S]=b.useState(!1),[T,k]=b.useState(u3),C=Jt(),E=()=>{k(!0);try{window.localStorage.setItem(mx,"1")}catch{}},A=!!o,j=D=>{v(D)},N=()=>{if(!y||x)return;const D=y;S(!0),Promise.resolve(l(D)).then(()=>{C.show({kind:"success",message:m("sidebar.removed",{name:D.name})})}).catch(L=>{const B=L instanceof Error?L.message:String(L);C.show({kind:"error",message:m("sidebar.deleteFailed",{message:B})})}).finally(()=>{S(!1),v(null)})},O=c.jsx(ai,{open:y!==null,onOpenChange:D=>{!D&&!x&&v(null)},title:y?m("sidebar.deleteConfirm",{name:y.name}):m("sidebar.deleteLabel"),description:y?m("sidebar.deleteDescription",{path:y.path,summary:l3(h[y.id],m)}):"",confirmLabel:m(x?"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:m("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:m(r?"layout.sidebarExpand":"layout.sidebarCollapse"),children:c.jsx("button",{type:"button","aria-label":m(r?"layout.sidebarExpand":"layout.sidebarCollapse"),"aria-expanded":!r,"data-testid":"workspace-sidebar-toggle",onClick:f,className:"ws-collapse-toggle",children:r?c.jsx(bS,{size:16,"aria-hidden":!0}):c.jsx(vS,{size:16,"aria-hidden":!0})})}):null]}),g===null?c.jsx("p",{className:"px-3 py-2 text-xs text-ter",children:m("common.loading")}):g.length===0?c.jsxs("div",{className:"ws-empty flex-1 px-2 py-4",children:[c.jsx("div",{className:"ws-empty__wide",children:c.jsx(Qs,{title:m("sidebar.noWorkspaces"),description:o??m("sidebar.noWorkspacesDesc"),icon:c.jsx(Fb,{size:20}),action:c.jsxs("button",{type:"button",onClick:A?void 0:i,disabled:A,"aria-label":m("sidebar.newWorkspace"),title:o??m("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(Ms,{size:14,"aria-hidden":!0}),m("sidebar.newWorkspace")]})})}),c.jsx(Qe,{side:"right",label:o??m("sidebar.newWorkspace"),children:c.jsx("button",{type:"button",onClick:A?void 0:i,disabled:A,"aria-label":m("sidebar.newWorkspace"),title:o??m("sidebar.newWorkspace"),"data-testid":"sidebar-empty-compact-add",className:"ws-empty__compact icon-btn icon-btn--primary hidden h-8 w-8 items-center justify-center disabled:cursor-not-allowed disabled:opacity-50",children:c.jsx(Ms,{size:16,"aria-hidden":!0})})})]}):c.jsxs("ul",{className:"flex-1 scroll-y pb-2",children:[g.map(D=>{const L=h[D.id],B=D.id===t,P=s3(L),re=i3(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:D.name}),c.jsx("span",{className:"mono text-ter",children:D.path})]}),children:c.jsxs("button",{type:"button","aria-label":D.name,"aria-current":B?"true":void 0,"data-workspace-path":D.path,onClick:()=>u(D.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${B?" active":""}`,children:[c.jsx(Vf,{workspaceId:D.id,name:D.name,isActive:!1,working:P,workingCount:re}),c.jsx("span",{className:`min-w-0 flex-1 truncate text-sm ${B?"font-medium text-pri":"text-pri"}`,children:D.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:D.name}),c.jsx("span",{className:"mono text-ter",children:D.path})]}),children:c.jsx("button",{type:"button","aria-label":D.name,"aria-current":B?"true":void 0,onClick:()=>u(D.id),className:"ws-avatar-cell hidden w-full justify-center py-2","data-testid":"ws-avatar-cell",children:c.jsx(Vf,{workspaceId:D.id,name:D.name,isActive:B,working:P,workingCount:re})})}),c.jsx(Qe,{label:m("sidebar.deleteAria",{name:D.name}),children:c.jsx("button",{type:"button","aria-label":m("sidebar.deleteAria",{name:D.name}),onClick:()=>j(D),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(uc,{size:14,"aria-hidden":!0})})})]},D.id)}),c.jsx("li",{children:c.jsx(Qe,{label:o??m("sidebar.newWorkspace"),children:c.jsxs("button",{type:"button",onClick:A?void 0:i,disabled:A,"aria-label":m("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(Ms,{size:14,"aria-hidden":!0}),c.jsx("span",{className:"ws-add__label",children:m("sidebar.newWorkspace")})]})})})]}),T?null:c.jsxs("div",{className:"ws-sidebar-footer group relative",children:[c.jsxs("a",{href:c3,target:"_blank",rel:"noopener noreferrer","aria-label":m("sidebar.openDemoVideo"),title:m("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:m("sidebar.demoVideo")})]}),c.jsxs("a",{href:"https://github.com/tt-a1i/hive",target:"_blank",rel:"noopener noreferrer","aria-label":m("sidebar.openRepository"),title:m("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":m("sidebar.dismissRepository"),title:m("sidebar.dismissRepository"),onClick:E,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(ya,{size:10,"aria-hidden":!0})})]}),O]})},Bn=/^(\s*)-\s+\[( |x|X)\]\s+(.*)$/,f3=/(?:^|[\s\p{P}])(@[A-Za-z0-9_-]+)/gu,m3=t=>{const r=[];for(const o of t.matchAll(f3))o[1]&&r.push(o[1]);return r},p3=t=>{const r=new Map;for(const o of t){const i=o.trim();i&&r.set(i.toLowerCase(),i)}return r},xM=(t,r={})=>{const o=[],i=[],l=t.split(/\r?\n/),u=r.knownWorkerNames?p3(r.knownWorkerNames):null;for(let f=0;f<l.length;f++){const h=l[f];if(!h)continue;const g=h.match(Bn);if(!g)continue;const[,m="",y=" ",v=""]=g,x=m.replace(/\t/g," ").length,S=m3(v);let T;if(u){T=[];for(const A of S){const j=u.get(A.slice(1).toLowerCase());j&&T.push(`@${j}`)}}else T=S;let k=v;for(const A of T){const j=A.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");k=k.replace(new RegExp(`(?:^|(?<=\\s|\\p{P}))${j}(?!\\w)`,"u"),"")}k=k.replace(/\s+/g," ").trim();const C={checked:y.toLowerCase()==="x",children:[],indent:x,line:f,mentions:T,text:k};for(;i.length>0;){const A=i[i.length-1];if(A&&A.indent<x)break;i.pop()}const E=i[i.length-1];E?E.children.push(C):o.push(C),i.push(C)}return o},h3=t=>{let r=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="",h=" "]=u,g=f.replace(/\t/g," ").length;for(;o.length>0;){const m=o[o.length-1];if(m&&m.indent<g)break;o.pop()}!o[o.length-1]&&h.toLowerCase()!=="x"&&(r+=1),o.push({indent:g})}return r},kM=t=>{if(t.children.length===0)return null;let r=0;for(const o of t.children)o.checked&&(r+=1);return{done:r,total:t.children.length}},oi=t=>t.includes(`\r
|
|
81
|
+
`)?`\r
|
|
82
|
+
`:`
|
|
83
|
+
`,g3=(t,r)=>{const o=oi(t),i=t.length>0&&!t.endsWith(`
|
|
84
|
+
`);return`${t}${i?o:""}- [ ] ${r}${o}`},v3=(t,r)=>{const o=t.split(/\r?\n/),i=o[r];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,(h,g,m,y)=>`${g}- [${u?" ":"x"}] ${y}`);return o[r]=f,o.join(oi(t))},px=t=>t.replace(/\r?\n/g," ").replace(/\s+/g," ").trim(),y3=(t,r,o)=>{const i=t.split(/\r?\n/),l=i[r];if(l===void 0||!l.match(Bn))return t;const f=px(o);if(!f)return t;const h=l.replace(Bn,(g,m,y)=>`${m}- [${y}] ${f}`);return i[r]=h,i.join(oi(t))},b3=(t,r)=>{const o=t.split(/\r?\n/),i=o[r];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=r+1;for(;f<o.length;){const h=o[f];if(h===void 0)break;const g=h.match(Bn);if(!g||(g[1]??"").replace(/\t/g," ").length<=u)break;f+=1}return o.splice(r,f-r),o.join(oi(t))},w3=(t,r,o)=>{const i=px(o);if(!i)return t;const l=t.split(/\r?\n/),u=l[r];if(u===void 0)return t;const f=u.match(Bn);if(!f)return t;const h=f[1]??"",g=h.replace(/\t/g," ").length;let m=r+1;for(;m<l.length;){const v=l[m];if(v===void 0)break;const x=v.match(Bn);if(!x||(x[1]??"").replace(/\t/g," ").length<=g)break;m+=1}const y=`${h} `;return l.splice(m,0,`${y}- [ ] ${i}`),l.join(oi(t))},x3=(t,r,o)=>t===r||t===o,k3=(t,r)=>{const[o,i]=b.useState(""),[l,u]=b.useState(!1),[f,h]=b.useState(!1),[g,m]=b.useState(null),y=b.useRef(!1),v=b.useRef(""),x=b.useRef(""),S=b.useCallback((k,C)=>{if(!y.current){v.current=k,x.current=k,i(k),h(!1),m(null);return}x3(k,v.current,C)||(m(k),h(!0))},[]);if(b.useEffect(()=>{if(!t){i(""),u(!1),h(!1),m(null),y.current=!1,v.current="",x.current="";return}let k=!1;return i(""),u(!1),h(!1),m(null),y.current=!1,v.current="",x.current="",wC(t).then(({content:C})=>{k||(v.current=C,y.current=!1,x.current=C,i(C),u(!0),h(!1),m(null))}).catch(C=>{k||(v.current="",y.current=!1,x.current="",i(""),u(!0),h(!1),console.error("[hive] swallowed:tasks.initialLoad",C),m(null))}),()=>{k=!0}},[t]),b.useEffect(()=>{if(!t)return;let k=!1,C=null,E=0,A=null;const j=()=>{if(k)return;const N=r0().openWebSocket(`/ws/tasks/${t}`);A=N,N.onmessage=O=>{if(k)return;const D=JSON.parse(String(O.data));D.type!=="tasks-snapshot"&&D.type!=="tasks-updated"||typeof D.content=="string"&&(E=0,S(D.content,x.current))},N.onclose=()=>{if(k)return;E+=1;const O=Math.min(3e4,500*2**(E-1));C=setTimeout(j,O)}};return j(),()=>{k=!0,C!==null&&(clearTimeout(C),C=null),A?.close()}},[S,t]),r!==void 0)return{content:r,hasConflict:!1,loaded:!0,onChange:k=>{},onKeepLocal:()=>{},onReload:()=>{},onSave:async()=>{},toggleTaskAtLine:async k=>{},appendTask:async k=>{},appendSubtask:async(k,C)=>{},updateTaskText:async(k,C)=>{},deleteTask:async k=>{}};const T=async(k,C)=>{if(!t)return;const E=x.current,A=k(E);if(A!==E){v.current=A,x.current=A,y.current=!1,i(A);try{const j=await Sl(t,{content:A});v.current=j.content,x.current=j.content,i(j.content)}catch(j){throw v.current=E,x.current=E,i(E),console.error(`[hive] swallowed:tasks.${C}`,j),j}}};return{content:o,hasConflict:f,loaded:l,onChange:k=>{y.current=k!==v.current,x.current=k,i(k)},onKeepLocal:()=>{h(!1),m(null)},onReload:()=>{const k=g??v.current;v.current=k,y.current=!1,x.current=k,i(k),h(!1),m(null)},onSave:async()=>{if(!t)return;const k=await Sl(t,{content:o});v.current=k.content,y.current=!1,x.current=k.content,i(k.content),h(!1),m(null)},toggleTaskAtLine:async k=>{if(!t)return;const C=x.current,E=v3(C,k);if(E!==C){v.current=E,x.current=E,y.current=!1,i(E);try{const A=await Sl(t,{content:E});v.current=A.content,x.current=A.content,i(A.content)}catch(A){throw v.current=C,x.current=C,i(C),A}}},appendTask:async k=>{const C=k.trim();if(!t||!C)return;const E=x.current,A=g3(E,C);v.current=A,x.current=A,y.current=!1,i(A);try{const j=await Sl(t,{content:A});v.current=j.content,x.current=j.content,i(j.content)}catch(j){throw v.current=E,x.current=E,i(E),j}},appendSubtask:async(k,C)=>{const E=C.trim();E&&await T(A=>w3(A,k,E),"appendSubtask")},updateTaskText:async(k,C)=>{const E=C.trim();E&&await T(A=>y3(A,k,E),"updateTaskText")},deleteTask:async k=>{await T(C=>b3(C,k),"deleteTask")}}},S3=3e3,hx=(t,r,o)=>{const i=new Set(t.map(u=>u.run_id)),l=new Set(t.map(u=>u.agent_id));return[...t,...r.filter(u=>i.has(u.run_id)?!1:o&&fc(u,o)?!0:!l.has(u.agent_id))]},E3=(t,r)=>{const[o,i]=b.useState({}),l=b.useRef(new Map);b.useEffect(()=>()=>{for(const m of l.current.values())window.clearTimeout(m);l.current.clear()},[]);const u=b.useCallback((m,y)=>{i(v=>({...v,[m]:(v[m]??[]).filter(x=>x.agent_id!==y)}))},[]),f=b.useCallback((m,y)=>{const v=l.current.get(y);v&&window.clearTimeout(v),l.current.delete(y),i(x=>({...x,[m]:(x[m]??[]).filter(S=>S.run_id!==y)}))},[]);b.useEffect(()=>{if(!t||r.length===0)return;const m=new Set(r.map(y=>y.run_id));i(y=>{const v=y[t]??[],x=v.filter(S=>{if(!m.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 x.length===v.length?y:{...y,[t]:x}})},[r,t]);const h=b.useCallback(({agentId:m,agentName:y,runId:v,status:x="starting",terminalInputProfile:S="default",workspaceId:T})=>{const k={agent_id:m,agent_name:y,run_id:v,status:x,terminal_input_profile:S};i(A=>{const j=fc(k,T),N=(A[T]??[]).filter(O=>O.run_id===k.run_id?!1:j?!0:O.agent_id!==k.agent_id);return{...A,[T]:[...N,k]}});const C=l.current.get(v);C&&window.clearTimeout(C);const E=window.setTimeout(()=>{i(A=>({...A,[T]:(A[T]??[]).filter(j=>j.run_id!==v)})),l.current.delete(v)},S3);l.current.set(v,E)},[]),g=b.useMemo(()=>hx(r,t?o[t]??[]:[],t),[r,o,t]);return{forgetOptimisticAgent:u,forgetOptimisticRun:f,optimisticRunsByWorkspaceId:o,recordOptimisticRun:h,terminalRuns:g}};let gx=null;const Zf=new Set,C3=t=>{gx=t;for(const r of Zf)r()},T3=t=>(Zf.add(t),()=>Zf.delete(t)),N3=()=>gx,A3=(t=typeof window<"u"?window.matchMedia.bind(window):void 0,r=typeof navigator<"u"?navigator.standalone:void 0)=>t?.("(display-mode: standalone)").matches?!0:r===!0,_3=t=>{if(!t||!(t instanceof HTMLElement))return!1;const r=t.tagName.toLowerCase();return!!(r==="input"||r==="textarea"||r==="select"||t.isContentEditable||t.closest(".xterm"))},j3=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform),R3=(t,r)=>r?t.metaKey:t.ctrlKey,O3=(t,r,o=j3)=>!(t.key.toLowerCase()!==r.key||(r.mod??!1)!==R3(t,o)||(r.alt??!1)!==t.altKey||(r.shift??!1)!==t.shiftKey),D3=t=>{b.useEffect(()=>{const r=o=>{if(!_3(o.target))for(const i of t){if(!O3(o,i))continue;i.handler(o)!==!1&&o.preventDefault();return}};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[t])},M3=({bootstrapError:t,onSelectWorkspace:r,onTriggerAddDialog:o,workspaces:i})=>{const l=b.useMemo(()=>{if(!A3())return[];const u=(i??[]).slice(0,9).map((f,h)=>({key:String(h+1),mod:!0,handler:()=>r(f.id)}));return[{key:"n",mod:!0,shift:!0,handler:()=>{t||o()}},...u]},[t,r,o,i]);D3(l)},L3=1100,z3=1e3,Xy="worker-card-shell--dispatch-pulse",Zy="orchestrator-pane--dispatch",H3=t=>typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(t):t.replace(/"/g,'\\"'),B3=(t,r)=>{const o=b.useRef(null),i=b.useRef(new Map);b.useEffect(()=>{const l=i.current;return()=>{for(const[u,f]of l)clearTimeout(f),u.classList.remove(Xy,Zy);l.clear()}},[]),b.useEffect(()=>{const l=o.current;if(t===void 0){o.current=null;return}if(o.current={workspaceId:t,pendingByWorkerId:new Map(r.map(g=>[g.id,g.pendingTaskCount]))},!l||l.workspaceId!==t||typeof document>"u")return;const u=r.filter(g=>{const m=l.pendingByWorkerId.get(g.id);return m!==void 0&&g.pendingTaskCount>m});if(u.length===0)return;const f=(g,m,y)=>{g.classList.remove(m),g.offsetWidth,g.classList.add(m);const v=i.current.get(g);v&&clearTimeout(v),i.current.set(g,setTimeout(()=>{g.classList.remove(m),i.current.delete(g)},y))};for(const g of u){const m=Array.from(document.querySelectorAll(`.worker-card-shell[data-worker-name="${H3(g.name)}"]`));for(const y of m)f(y,Xy,L3)}const h=document.querySelector(".orchestrator-pane-root");h&&f(h,Zy,z3)},[t,r])},W3=15e3,U3=async(t,r=W3)=>new Promise((o,i)=>{let l=!1;const u=window.setTimeout(()=>{l=!0,i(new Error("Hive runtime bootstrap timed out"))},r);t.then(f=>{l||(l=!0,window.clearTimeout(u),o(f))},f=>{l||(l=!0,window.clearTimeout(u),i(f))})}),I3=(t,r)=>r&&t.some(o=>o.id===r)?r:t[0]?.id??null,q3=(t,r)=>{if(t===null)return r;const o=new Map(t.map(i=>[i.id,i]));for(const i of r)o.set(i.id,i);return Array.from(o.values())},P3=(t,r,o)=>{b.useEffect(()=>{let i=!1;const l=s0().then(async()=>{const[u,f]=await Promise.all([$E(),eC().catch(()=>null)]);return{items:u,persistedId:f}});return U3(l).then(({items:u,persistedId:f})=>{i||t(h=>{const g=q3(h,u),m=I3(g,f);return r(m),f!==m&&l0(m).catch(y=>{console.error("[hive] swallowed:initSession.save",y)}),g})}).catch(u=>{i||(r(null),o&&o("Could not reach Hive runtime. Refresh once the runtime is back up.")),console.error("[hive] swallowed:initSession.bootstrap",u)}),()=>{i=!0}},[r,t,o])},F3=()=>{const t=b.useRef(null);return b.useCallback(r=>{if(typeof document>"u")return;const o=typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(r):r.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))},[])},K3=({onWorkspaceCreated:t,onError:r})=>{const{language:o}=ke(),[i,l]=b.useState({}),[u,f]=b.useState({}),h=b.useCallback((m,y)=>{l(v=>({...v,[m]:y.ok?null:y.error})),f(v=>({...v,[m]:y.ok?y.run_id:null}))},[]),g=b.useCallback(async m=>{try{const y=await XE({name:m.name,path:m.path,autostart_orchestrator:!0,command_preset_id:m.commandPresetId,startup_command:m.startupCommand??null,ui_language:o});return h(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 r?.(v),y}},[o,t,r,h]);return{orchestratorAutostartErrors:i,orchestratorAutostartRunIds:u,recordOrchestratorResult:h,createNewWorkspace:g}},Y3=(t,r)=>{const o=t.findIndex(l=>l.id===r),i=t.filter(l=>l.id!==r);return o<0?i[0]?.id??null:i[Math.min(o,i.length-1)]?.id??null},$3=({activeWorkspaceId:t,onActiveDeleted:r,selectWorkspace:o,setWorkersByWorkspaceId:i,setWorkspaces:l,workspaces:u})=>async f=>{const g=Y3(u??[],f.id);await ZE(f.id),l(m=>m?.filter(y=>y.id!==f.id)??m),i(m=>{const y={...m};return delete y[f.id],y}),f.id===t&&(r(),o(g))},V3=()=>{const[t,r]=b.useState(null),o=b.useRef(Promise.resolve());return{activeWorkspaceId:t,selectWorkspace:l=>{r(l),o.current=o.current.catch(Wr("selectWorkspace.prevQueue")).then(()=>l0(l)).catch(Wr("selectWorkspace.save"))},setActiveWorkspaceId:r}},vx=500,G3=5e3,X3=5e3,Z3=()=>({failureCount:0,inFlight:!1,lastSettledAt:null}),Q3=(t,r)=>Math.min((r?vx:G3)*2**t,X3),J3=(t,r)=>t.length!==r.length?!1:t.every((o,i)=>{const l=r[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}),Qy=(t,r)=>{const o=Object.keys(t),i=Object.keys(r);return o.length!==i.length?!1:i.every(l=>Object.hasOwn(t,l)&&J3(t[l]??[],r[l]??[]))},e4=(t,r={})=>{const o=t.join("\0"),i=b.useRef(r.activeWorkspaceId),l=b.useRef(new Map),u=b.useRef(null),[f,h]=b.useState({});return i.current=r.activeWorkspaceId,b.useEffect(()=>{if(!o){h({}),l.current.clear();return}let g=!1,m;const y=o.split("\0"),v=new Set(y);for(const E of l.current.keys())v.has(E)||l.current.delete(E);h(E=>{const A={};for(const j of y)A[j]=E[j]??[];return Qy(E,A)?E:A});const x=E=>{let A=l.current.get(E);return A||(A=Z3(),l.current.set(E,A)),A},S=E=>i.current===E,T=E=>{const A=x(E);A.inFlight||(A.inFlight=!0,iC(E).then(j=>{g||(A.failureCount=0,h(N=>{if(!v.has(E))return N;const O={};for(const D of y)O[D]=D===E?j:N[D]??[];return Qy(N,O)?N:O}))}).catch(j=>{g||(A.failureCount=Math.min(A.failureCount+1,4),console.error("[hive] swallowed:workspaceWorkers.list",j))}).finally(()=>{A.inFlight=!1,A.lastSettledAt=g?null:Date.now()}))},k=()=>{const E=Date.now();for(const A of y){const j=x(A);if(j.inFlight)continue;if(j.lastSettledAt===null){T(A);continue}const N=Q3(j.failureCount,S(A));E-j.lastSettledAt>=N&&T(A)}},C=(E=vx)=>{g||(m!==void 0&&window.clearTimeout(m),m=window.setTimeout(()=>{m=void 0,k(),C()},E))};return u.current=()=>{m!==void 0&&(window.clearTimeout(m),m=void 0),k(),C()},k(),C(),()=>{g=!0,m!==void 0&&window.clearTimeout(m),u.current&&(u.current=null)}},[o]),b.useEffect(()=>{const g=r.activeWorkspaceId;if(!g||!o.split("\0").includes(g))return;const m=l.current.get(g);m&&!m.inFlight&&(m.lastSettledAt=null,m.failureCount=0),u.current?.()},[r.activeWorkspaceId,o]),[f,h]},Qf="hive:terminal-visible-resize",t4=t=>new CustomEvent(Qf,{detail:{runId:t}}),n4="\x1B[200~",Jy="\x1B[201~",r4=(t,r)=>{const o=t.split(Jy).join("");return r?.modes?.bracketedPasteMode===!1?o:`${n4}${o}${Jy}`},Hn="\x1B",eb="\x07",a4=new RegExp(`${Hn}\\[[0-?]*[ -/]*[@-~]`,"gu"),o4=new RegExp(`${Hn}\\][^${eb}${Hn}]*(?:${eb}|${Hn}\\\\)`,"gu"),s4=new RegExp("[\0-]","gu"),i4=new RegExp(`${Hn}\\[([0135]) q`,"gu"),l4=new RegExp(`${Hn}\\[[0135] q`,"u"),c4=new RegExp(`${Hn}\\[[0-?]*K`,"u"),u4=t=>{switch(t){case"3":return"4";case"5":return"6";default:return"2"}},d4=t=>t.replace(o4,"").replace(a4,"").replace(s4,""),f4=t=>d4(t).trim().length>0,m4=t=>!f4(t)&&t.includes(`${Hn}[?2026`)&&t.includes(`${Hn}[?25`)&&l4.test(t)&&c4.test(t),tb=t=>({chunk:t.replace(i4,(r,o)=>`${Hn}[${u4(o)} q`),suppress:m4(t)}),p4=(t,r)=>{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,r.setComposing(!1)},0)},h=T=>T.data||t.value,g=T=>T.inputType==="insertText"||T.inputType==="insertFromComposition"||T.inputType==="insertReplacementText"||T.inputType==="insertDictationResult",m=()=>{i=!0,l=!1,r.setComposing(!0)},y=()=>{i=!0,r.setComposing(!0)},v=T=>{const C=T.data||t.value;!l&&C&&r.commit(C),u(),f()},x=T=>{const k=T;if(i||k.isComposing){if(g(k)){const C=h(k);C&&(r.commit(C),l=!0),u()}return}k.defaultPrevented&&g(k)&&u()},S={capture:!0};return t.addEventListener("compositionstart",m,S),t.addEventListener("compositionupdate",y,S),t.addEventListener("compositionend",v,S),t.addEventListener("input",x,S),()=>{o!==void 0&&clearTimeout(o),t.removeEventListener("compositionstart",m,S),t.removeEventListener("compositionupdate",y,S),t.removeEventListener("compositionend",v,S),t.removeEventListener("input",x,S)}},h4=()=>typeof navigator>"u"?!1:/Mac|iPhone|iPad/.test(navigator.platform),On={killToLineStart:"",lineStart:"",lineEnd:"",killWordBack:"\x1B",wordBack:"\x1Bb",wordForward:"\x1Bf",shiftEnter:"\x1B[13;2u"},g4=(t,r={})=>{const o=r.isMac??h4();if(t.key==="Enter"&&t.shiftKey)return t.type==="keypress"?{kind:"send",bytes:On.shiftEnter}:{kind:"block"};if(!o&&t.type==="keydown"&&t.ctrlKey&&!t.shiftKey&&!t.altKey&&!t.metaKey&&(t.key==="c"||t.key==="C")&&r.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:On.killToLineStart};case"ArrowLeft":return{kind:"send",bytes:On.lineStart};case"ArrowRight":return{kind:"send",bytes:On.lineEnd};case"k":case"K":return{kind:"clear"}}if(l)switch(t.key){case"Backspace":return{kind:"send",bytes:On.killWordBack};case"ArrowLeft":return{kind:"send",bytes:On.wordBack};case"ArrowRight":return{kind:"send",bytes:On.wordForward}}return{kind:"passthrough"}},v4=16,y4=.3,b4={up:"A",down:"B",right:"C",left:"D"},Jf=(t,r)=>{const o=b4[r];return t?`\x1BO${o}`:`\x1B[${o}`},w4=(t,r,o)=>r==="codex"||r==="grok"||r==="opencode"?o==="up"?"\x1B[5~":"\x1B[6~":Jf(t.modes?.applicationCursorKeysMode,o),x4=t=>t==="codex"||t==="grok"||t==="opencode",yx=(t,r="default")=>{let o=0;return i=>{if(t.buffer?.active?.type!=="alternate")return o=0,{handled:!1,input:null};if(!x4(r)&&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/=v4,Math.abs(i.deltaY)<50&&(l*=y4),o+=l,l=Math.trunc(o),o%=1):o=0,l===0?{handled:!0,input:null}:{handled:!0,input:w4(t,r,l<0?"up":"down")}}},k4=({element:t,profile:r="default",sendInput:o,terminal:i})=>{const l=yx(i,r),u=h=>{const{handled:g,input:m}=l(h);return g?(h.preventDefault(),h.stopPropagation(),m&&o(m),!1):!0};if(typeof i.attachCustomWheelEventHandler=="function")return i.attachCustomWheelEventHandler(u),()=>{};const f=h=>{u(h)||h.stopImmediatePropagation()};return t.addEventListener("wheel",f,{capture:!0,passive:!1}),()=>t.removeEventListener("wheel",f,{capture:!0})},S4=(t,r={})=>{switch(t){case"esc":return"\x1B";case"tab":return" ";case"enter":return"\r";case"arrowUp":return Jf(r.applicationCursorKeys,"up");case"arrowDown":return Jf(r.applicationCursorKeys,"down");case"arrowRight":return r.applicationCursorKeys?"\x1BOC":"\x1B[C";case"arrowLeft":return r.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 On.killToLineStart;case"ctrlA":return On.lineStart;case"ctrlE":return On.lineEnd;case"ctrlW":return""}},E4="Invalid terminal control message",C4=t=>{let r;try{r=JSON.parse(String(t))}catch{return null}if(!r||typeof r!="object")return null;const o=r;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},T4=({initialSize:t,onError:r,onExit:o,onOutput:i,onRestore:l,onClose:u,runId:f})=>{const h=crypto.randomUUID(),g={...t,clientId:h},m=r0(),y=m.openWebSocket(`/ws/terminal/${f}/io`,g),v=m.openWebSocket(`/ws/terminal/${f}/control`,g);let x=!1,S=!1,T=!1;const k=[];let C=null;const E=()=>{S||T||(T=!0,u?.())};y.onclose=E,v.onclose=E;const A=()=>{!C||v.readyState!==v.OPEN||(v.send(JSON.stringify({type:"resize",...C})),C=null)};return y.onmessage=j=>{const N=typeof j.data=="string"?j.data:"",O=D=>{v.readyState===v.OPEN&&v.send(JSON.stringify({type:"output_ack",bytes:D}))};if(!x){k.push({chunk:N,acknowledge:O});return}i(N,O)},v.onopen=()=>{A()},v.onmessage=j=>{const N=C4(j.data);if(!N){r(E4);return}if(N.type==="exit"&&o(N.code),N.type==="error"&&r(N.message),N.type==="restore"){l(N.snapshot),x=!0,v.readyState===v.OPEN&&v.send(JSON.stringify({type:"restore_complete"}));for(const O of k.splice(0))i(O.chunk,O.acknowledge)}},{dispose(){S=!0,y.close(),v.close()},resize(j,N,O,D){C={cols:j,rows:N},O!==void 0&&(C.pixelWidth=O),D!==void 0&&(C.pixelHeight=D),A()},sendBinaryInput(j){if(y.readyState!==y.OPEN)return;const N=new Uint8Array(j.length);for(let O=0;O<j.length;O++)N[O]=j.charCodeAt(O)&255;y.send(N)},sendInput(j){y.readyState===y.OPEN&&y.send(j)}}},N4=16,A4=.08,_4=.96,j4=.025,nb=5,R4=100,O4=8,D4=6,M4=4,L4=.5,z4=250,H4=24,B4=2,W4=".xterm-viewport",U4=".xterm-screen";function I4({element:t,profile:r="default",sendInput:o,terminal:i}){let l=null,u=0,f=0,h,g=0,m=null,y=0,v=!1,x=null,S=null,T=N4,k=0,C=0,E=null,A=[];const j=yx(i,r),N=()=>{m!==null&&(window.cancelAnimationFrame(m),m=null)},O=()=>{E!==null&&(window.cancelAnimationFrame(E),E=null)},D=()=>(x?.isConnected||(x=t.querySelector(W4)),x),L=()=>(S?.isConnected||(S=t.querySelector(U4)),S),B=()=>{const le=D(),ie=i.rows;if(!le||!ie||ie<=0)return;const ue=le.clientHeight/ie;ue>=6&&ue<=64&&(T=ue)},P=()=>{const le=L();le&&(le.style.transform=k!==0?`translateY(${-k}px)`:"")},re=()=>{k!==0&&(k=0,P())},ee=()=>{if(Math.abs(k)>=T/2){const le=D();if(le){const ie=le.scrollHeight-le.clientHeight,ue=k>0?T:-T;le.scrollTop=Math.min(ie,Math.max(0,le.scrollTop+ue))}}re()},Y=le=>{const ie=D();if(!ie)return"missing";const ue=ie.scrollHeight-ie.clientHeight;if(ue<=0)return re(),"stuck";const pe=k+le,Ne=Math.trunc(pe/T);let Ce=pe-Ne*T;const Se=ie.scrollTop,Je=Math.min(ue,Math.max(0,Se+Ne*T)),mt=Je!==Se;mt&&(ie.scrollTop=Je),(Je<=0&&pe<0||Je>=ue&&pe>0)&&(Ce=0);const en=Ce!==k;return k=Ce,en&&P(),mt||en?"moved":"stuck"},J=le=>{u+=le/T;const ie=Math.trunc(u);return u%=1,ie===0||i.scrollLines?.(ie),!0},G=(le,ie)=>{const ue=[];for(let pe=0;pe<ie;pe++){const{handled:Ne,input:Ce}=j({deltaMode:WheelEvent.DOM_DELTA_LINE,deltaY:le,shiftKey:!1});if(!Ne)break;Ce&&ue.push(Ce)}return ue.length>0&&o(ue.join("")),ue.length},V=le=>{f+=le/T;const ie=Math.trunc(f);if(f%=1,ie===0)return!1;const ue=r==="codex"||r==="opencode"?M4:D4;return G(ie<0?-1:1,Math.min(Math.abs(ie),ue))>0},M=le=>{const ie=i.buffer?.active?.type;return ie!==h&&(u=0,f=0,h=ie,re()),ie==="alternate"?{moved:V(le),normalBuffer:!1}:{moved:Y(le)==="moved"||J(le),normalBuffer:!0}},q=()=>{E=null;const le=C;C=0,le!==0&&(v=M(le).normalBuffer)},I=()=>{E===null&&(E=window.requestAnimationFrame(q))},Z=(le,ie)=>{A.push({t:le,y:ie}),A.length>O4&&A.shift()},F=le=>{const ie=le-R4,ue=A.filter(Je=>Je.t>=ie),pe=ue[0],Ne=ue[ue.length-1];if(!pe||!Ne||pe===Ne)return 0;const Ce=Ne.t-pe.t;if(Ce<=0)return 0;const Se=(pe.y-Ne.y)/Ce;return Math.max(-nb,Math.min(nb,Se))};let R=0;const W=()=>{if(m=null,R===0)return;if(i.buffer?.active?.type!=="alternate"){R=0;return}const le=R>0?1:-1,ie=Math.min(Math.abs(R),B4);if(G(le,ie)<ie){R=0;return}R-=le*ie,R!==0&&(m=window.requestAnimationFrame(W))},ne=le=>{const ie=Math.min(32,Math.max(1,le-y));y=le;const{moved:ue,normalBuffer:pe}=M(g*ie);if(!ue||!pe){m=null,u=0,g=0,ee();return}if(g*=_4**(ie/16.67),Math.abs(g)<j4){m=null,u=0,ee();return}m=window.requestAnimationFrame(ne)},ae=le=>{N(),R=0,O(),C=0,A=[],l=le.touches.length===1?le.touches[0]?.clientY??null:null,l!==null&&Z(le.timeStamp,l),g=0,v=!1,D(),B()},fe=le=>{if(l===null||le.touches.length!==1)return;const ie=le.touches[0]?.clientY??l,ue=l-ie;Math.abs(ue)<1||(l=ie,le.preventDefault(),C+=ue,Z(le.timeStamp,ie),I())},me=le=>{l=null,O(),q();const ie=F(le.timeStamp);if(A=[],v&&Math.abs(ie)>=A4){g=ie,y=performance.now(),m=window.requestAnimationFrame(ne);return}if(!v&&r!=="opencode"&&Math.abs(ie)>=L4&&i.buffer?.active?.type==="alternate"){const ue=Math.min(H4,Math.round(Math.abs(ie)*z4/T));if(ue>0){R=ie>0?ue:-ue,m=window.requestAnimationFrame(W);return}}g=0,u=0,ee()},ce=()=>{N(),R=0,O(),C=0,A=[],l=null,u=0,f=0,g=0,v=!1,re()};return t.addEventListener("touchstart",ae,{passive:!0}),t.addEventListener("touchmove",fe,{passive:!1}),t.addEventListener("touchend",me,{passive:!0}),t.addEventListener("touchcancel",ce,{passive:!0}),()=>{t.removeEventListener("touchstart",ae),t.removeEventListener("touchmove",fe),t.removeEventListener("touchend",me),t.removeEventListener("touchcancel",ce),N(),O(),re()}}const q4=(t=()=>typeof document<"u"?document.createElement("canvas"):null)=>{const r=t();if(!r||typeof r.getContext!="function")return!1;try{return!!(r.getContext("webgl2")||r.getContext("webgl"))}catch{return!1}},P4=t=>t instanceof Error&&t.message?`Terminal failed to load: ${t.message}`:"Terminal failed to load. Refresh this page and try again.",F4=new RegExp("\x1B\\[M([\\s\\S])([\\s\\S])([\\s\\S])","g"),K4=new TextEncoder,Y4=(t,r,o,i)=>{const l=r.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}`},$4=(t,r)=>{if(r!=="grok"&&r!=="opencode")return{binary:!0,chunk:t};const o=t.replace(F4,Y4);return{binary:o===t,chunk:o}},V4=(t,r="default")=>{const o=Nt(),i=b.useRef(null),[l,u]=b.useState(null),[f,h]=b.useState("connecting"),g=b.useRef("connecting"),[m,y]=b.useState(0),v=b.useRef(null),x=b.useRef(null),S=b.useRef(!1),[T,k]=b.useState("canvas"),[C,E]=b.useState(!1),A=b.useRef(!1),j=b.useCallback(B=>{k(B);const P=i.current;P&&(P.dataset.renderer=B)},[]),N=b.useCallback(B=>{S.current||v.current?.sendInput(B)},[]),O=b.useCallback(B=>{const P=x.current?.modes?.applicationCursorKeysMode;N(S4(B,P===void 0?{}:{applicationCursorKeys:P}))},[N]),D=b.useCallback(B=>{const P=r4(B,x.current??void 0);return v.current?.sendInput(P),P},[]),L=b.useCallback(()=>{const B=()=>{x.current?.scrollToBottom();const P=i.current?.querySelector(".xterm-viewport");P&&(P.scrollTop=P.scrollHeight)};B(),window.requestAnimationFrame(()=>{B(),window.requestAnimationFrame(B)}),window.setTimeout(B,80),A.current=!1,E(!1)},[]);return b.useEffect(()=>{if(!i.current)return;let B=!1,P,re,ee,Y,J,G,V,M,q,I,Z,F=null,R,W,ne,ae,fe;u(null),g.current="connecting",h("connecting"),A.current=!1,E(!1);const me=ce=>{g.current!==ce&&(g.current=ce,h(ce))};return Promise.all([Tt(()=>import("./xterm-B-qIQCd3.js"),[]),Tt(()=>import("./addon-fit-DX4qG4td.js"),[]),Tt(()=>import("./addon-unicode11-Bt8F3D7-.js"),[]),Tt(()=>import("./addon-clipboard-wHJhZAA4.js"),[])]).then(([ce,le,ie,ue])=>{if(B||!i.current)return;const pe=typeof window<"u"?getComputedStyle(document.documentElement):null,Ne=pe?.getPropertyValue("--bg-crust").trim()||"#0e0e0e",Ce=pe?.getPropertyValue("--text-primary").trim()||"#ebebeb",Se=new ce.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:Ne,foreground:Ce}}),Je=new le.FitAddon;Se.loadAddon(Je),Se.loadAddon(new ie.Unicode11Addon),Se.unicode.activeVersion="11",Se.loadAddon(new ue.ClipboardAddon),Se.open(i.current),j("canvas"),Je.fit(),G=Se,x.current=Se,V=Je;const mt=()=>{const de=Se.buffer.active,Te=de.viewportY<de.baseY;A.current!==Te&&(A.current=Te,E(Te))},en=()=>{ae===void 0&&(ae=window.requestAnimationFrame(()=>{ae=void 0,mt()}))};W=Se.onScroll(en),ne=Se.buffer.onBufferChange(en),I=k4({element:i.current,profile:r,sendInput:de=>J?.sendInput(de),terminal:Se}),o&&(Z=I4({element:i.current,profile:r,sendInput:de=>J?.sendInput(de),terminal:Se})),F=i.current.querySelector(".xterm-helper-textarea"),F&&(R=p4(F,{setComposing:de=>{S.current=de},commit:de=>J?.sendInput(de)})),typeof Se.attachCustomKeyEventHandler=="function"&&Se.attachCustomKeyEventHandler(de=>{const Te=g4(de,{hasSelection:Se.hasSelection()});switch(Te.kind){case"send":return de.preventDefault(),J?.sendInput(Te.bytes),!1;case"clear":return de.preventDefault(),Se.clear(),!1;case"copy":{de.preventDefault();const Ve=Se.getSelection();return Ve&&navigator.clipboard?.writeText(Ve).catch(()=>{}),Se.clearSelection(),!1}case"block":return!1;case"passthrough":return!0}});const Cn=()=>{const de=i.current;return de?.isConnected?!de.closest('[data-terminal-host-parked="true"]'):!1},pn=()=>{if(!i.current)return{};const de=i.current.clientWidth,Te=i.current.clientHeight,Ve={};return Te>0&&(Ve.pixelHeight=Te),de>0&&(Ve.pixelWidth=de),Ve},Tn=()=>{if(!i.current||!Cn())return;const de=pn();if(!de.pixelHeight||!de.pixelWidth||fe&&fe.pixelHeight===de.pixelHeight&&fe.pixelWidth===de.pixelWidth)return;V?.fit();const Te={cols:G?.cols??80,rows:G?.rows??24,...pn()};fe&&fe.cols===Te.cols&&fe.rows===Te.rows&&fe.pixelHeight===Te.pixelHeight&&fe.pixelWidth===Te.pixelWidth||(fe=Te,J?.resize(Te.cols,Te.rows,Te.pixelWidth,Te.pixelHeight))},tn=()=>{q&&window.clearTimeout(q),q=window.setTimeout(()=>{q=void 0,Tn()},50)};Tt(()=>import("./addon-web-links-DIbG5aQx.js"),[]).then(de=>{B||G!==Se||Se.loadAddon(new de.WebLinksAddon)}).catch(()=>{}),q4()&&Tt(()=>import("./addon-webgl-DCtw1yLn.js"),[]).then(de=>{if(!(B||G!==Se))try{const Te=new de.WebglAddon;Te.onContextLoss(()=>{Te.dispose(),j("canvas")}),Se.loadAddon(Te),j("webgl"),tn()}catch{j("canvas")}}).catch(()=>{j("canvas")}),J=T4({initialSize:{cols:Se.cols,rows:Se.rows,...pn()},onError(de){u(de)},onExit(){me("stopped")},onOutput(de,Te){me("running");const Ve=K4.encode(de).byteLength;if(r==="codex"){const Sa=tb(de);if(Sa.suppress){Te(Ve);return}Se.write(Sa.chunk,()=>Te(Ve));return}Se.write(de,()=>Te(Ve))},onRestore(de){me("running"),Se.write(r==="codex"?tb(de).chunk:de)},onClose(){B||y(de=>de+1)},runId:t}),v.current=J,Y=Se.onData(de=>{S.current||J?.sendInput(de)}),typeof Se.onBinary=="function"&&(ee=Se.onBinary(de=>{const Te=$4(de,r);Te.binary?J?.sendBinaryInput(Te.chunk):J?.sendInput(Te.chunk)})),Tn(),typeof ResizeObserver<"u"&&i.current&&(M=new ResizeObserver(tn),M.observe(i.current)),P=de=>{de.detail?.runId===t&&tn()},re=()=>tn(),window.addEventListener(Qf,P),window.addEventListener("resize",re)}).catch(ce=>{B||(u(P4(ce)),me("stopped"))}),()=>{B=!0,P&&window.removeEventListener(Qf,P),re&&window.removeEventListener("resize",re),M?.disconnect(),q&&window.clearTimeout(q),I?.(),Z?.(),R?.(),ae!==void 0&&window.cancelAnimationFrame(ae),W?.dispose(),ne?.dispose(),ee?.dispose(),Y?.dispose(),J?.dispose(),G?.dispose(),V?.dispose(),v.current=null,x.current=null}},[t,r,m]),{containerRef:i,error:l,status:f,sendInput:N,sendKey:O,beginPaste:D,renderer:T,isScrolledUp:C,scrollToBottom:L}},G4={connecting:"terminal.statusConnecting",running:"terminal.statusRunning",stopped:"common.stopped"},em="hive-terminal-parking-lot",X4=500,Z4=t=>[`worker-pty-${t}`,`orch-pty-${t}`,`shell-pty-${t}`],Q4=t=>{for(let r=t;r;r=r.parentElement){if(r.hidden||r.getAttribute("aria-hidden")==="true"||r.classList.contains("hidden"))return!0;const o=window.getComputedStyle?.(r);if(o?.display==="none"||o?.visibility==="hidden")return!0}return!1},J4=t=>{const r=Array.from(document.querySelectorAll("[data-pty-slot]")).filter(o=>o.id===t&&o.isConnected&&!Q4(o));return r[r.length-1]??null},eO=()=>{let t=document.getElementById(em);return t||(t=document.createElement("div"),t.id=em,t.hidden=!0,t.style.display="none",(document.body??document.documentElement).appendChild(t)),t},kf=()=>{const t=document.getElementById(em);t&&t.childElementCount===0&&t.remove()},Ul=new Set;let Hs,Bs;const rb=()=>{for(const t of Ul)t()},tO=()=>{Hs?.disconnect(),Hs=void 0,Bs!==void 0&&(window.clearInterval(Bs),Bs=void 0)},nO=()=>{if(Hs||Bs!==void 0)return;const t=document.body??document.documentElement;if(typeof MutationObserver<"u"&&t){Hs=new MutationObserver(rb),Hs.observe(t,{attributeFilter:["aria-hidden","class","data-pty-slot","hidden","id","style"],attributes:!0,childList:!0,subtree:!0});return}Bs=window.setInterval(rb,100)},rO=t=>(Ul.add(t),nO(),()=>{Ul.delete(t),Ul.size===0&&tO()}),aO=[50,150,300],oO=t=>{const r=[],o=[],i=()=>window.dispatchEvent(t4(t)),l=(u,f)=>{const h=window.setTimeout(()=>{const g=o.indexOf(h);g>=0&&o.splice(g,1),f()},u);o.push(h)};if(typeof window.requestAnimationFrame=="function"){const u=window.requestAnimationFrame(()=>{i();const f=window.requestAnimationFrame(i);r.push(f)});r.push(u)}else l(0,i);for(const u of aO)l(u,i);return()=>{for(const u of r)window.cancelAnimationFrame?.(u);for(const u of o)window.clearTimeout(u);r.length=0,o.length=0}},sO=t=>{const[r,o]=b.useState(null);return b.useEffect(()=>{const i=Z4(t),l=()=>{for(const f of i){const h=J4(f);if(h)return h}return null},u=()=>{const f=l();o(h=>h===f?h:f)};return u(),rO(u)},[t]),r},iO=(t,r)=>{const[o,i]=b.useState(!1),[l,u]=b.useState(null),f=b.useRef(void 0),h=b.useRef(null),g=b.useRef(void 0),m=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",h.current=v,u(v),()=>{m(),y(),v.remove(),h.current=null,kf()}},[m,y,t]),b.useLayoutEffect(()=>{if(r){m(),i(!0);return}if(!(!o||f.current!==void 0))return f.current=window.setTimeout(()=>{f.current=void 0,i(!1)},X4),m},[o,m,r]),b.useLayoutEffect(()=>{const v=h.current;if(!v)return;if(!o){y(),v.remove(),v.dataset.terminalHostParked="false",kf();return}const x=r??eO();if(v.parentElement===x)return;const S=v.parentElement!==null,T=document.activeElement;r||y(),!r&&T instanceof HTMLElement&&v.contains(T)&&T.blur(),v.dataset.terminalHostParked=r?"false":"true",x.appendChild(v),kf(),r&&S&&(y(),g.current=oO(t))},[o,y,t,r]),o?l:null},lO=({inputProfile:t="default",runId:r,startupBlockedReason:o,title:i})=>{const l=sO(r),u=iO(r,l);return u?pc.createPortal(c.jsx(cO,{inputProfile:t,runId:r,startupBlockedReason:o??null,title:i}),u):null},cO=({inputProfile:t,runId:r,startupBlockedReason:o,title:i})=>{const{t:l}=ke(),u=Nt(),{containerRef:f,error:h,status:g,isScrolledUp:m,scrollToBottom:y}=V4(r,t),v=G4[g],x=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}),h?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:h}):null,!h&&o==="first_run_setup"?c.jsx("p",{className:"mono shrink-0 break-words px-3 py-2 text-xs","data-testid":`terminal-startup-setup-${r}`,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-${r}`,ref:f,className:"bg-crust h-full min-h-0 w-full min-w-0 overflow-hidden"}),!h&&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&&m?c.jsx(uO,{label:l("terminal.scrollToBottom"),onJump:x}):null]})]})},uO=({label:t,onJump:r})=>{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,r())},[r]);return b.useEffect(()=>{const u=o.current;if(!u)return;const f=h=>{h.cancelable&&h.preventDefault(),h.stopImmediatePropagation(),l(h)};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})},dO=({hidden:t=!1,optimisticRuns:r=[],terminalRuns:o,workspaceId:i})=>{const{t:l}=ke(),u=hx(o,r,i);return c.jsx("section",{hidden:t,"aria-hidden":t||void 0,"aria-label":l("terminalPanels.aria"),children:u.map(f=>c.jsx(lO,{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))})},fO=[{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.","The Orchestrator pane now guides a fresh workspace into its first dispatch, and 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 the Memory drawer can review candidate memories without granting workers direct memory writes."],zh:["首次运行 CLI 出现信任、登录或确认提示时,Hive 现在会等待,不再把启动指令盲注入到 onboarding 屏幕里。","Orchestrator 面板新增首次派单引导;如果 Orchestrator 终端已离线,用户输入会明确返回投递失败,而不是假装成功。","内置角色契约和场景/派生成员默认值已支持语言感知,英文 workspace 默认收到英文 worker prompt。","Demo 改成本地自运行 Hive replay,直接展示任务进度、worker 状态变化和团队派单流,不再依赖外部视频。","发布检查新增本地 CLI 兼容报告,覆盖原生模块和 Tier-1 agent CLI。","Settings 增加本地留存诊断;Memory 抽屉可复核 candidate memory,但不放开 worker 直接写 memory。"]},{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 对原子保存编辑器也更宽容。"]}],ab=t=>{const[r="",o=""]=t.split("-",2),[i=0,l=0,u=0]=r.split(".").map(f=>Number.parseInt(f,10)||0);return{core:[i,l,u],prerelease:o}},Sf=(t,r)=>{const o=ab(t),i=ab(r);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},mO=(t,r,o=fO)=>{if(r===null)return{show:!1,entries:[],seedOnly:!0};if(Sf(t,r)<=0)return{show:!1,entries:[],seedOnly:!1};const i=o.filter(l=>Sf(l.version,r)>0&&Sf(l.version,t)<=0);return i.length===0?{show:!1,entries:[],seedOnly:!0}:{show:!0,entries:i,seedOnly:!1}},bx="hive.last-seen-version",pO="1.7.0",hO=(t,r)=>{try{const o=window.localStorage.getItem(bx);return o||(r?pO:null)}catch{return t}},ob=t=>{try{window.localStorage.setItem(bx,t)}catch{}},gO=({hasExistingWorkspace:t,wizardOpen:r})=>{const o=cx,[i,l]=b.useState(void 0);b.useEffect(()=>{i!==void 0||t===null||l(hO(o,t))},[t,i]);const u=b.useMemo(()=>i===void 0?{show:!1,entries:[],seedOnly:!1}:mO(o,i),[i]),[f,h]=b.useState(!1);b.useEffect(()=>{u.seedOnly&&ob(o)},[u.seedOnly]);const g=b.useCallback(()=>{ob(o),h(!0)},[]);return{open:u.show&&!f&&!r,entries:u.entries,close:g}},sb="hive.first-run-seen",vO=()=>{const[t,r]=b.useState(()=>{try{return window.localStorage.getItem(sb)==="1"}catch{return!0}}),o=b.useCallback(()=>{try{window.localStorage.setItem(sb,"1")}catch{}r(!0)},[]);return{seen:t,markSeen:o}},yO=t=>{const{seen:r,markSeen:o}=vO(),[i,l]=b.useState(!1);b.useEffect(()=>{!r&&t!==null&&t.length===0&&l(!0)},[r,t]);const u=b.useCallback((f=!0)=>{f&&o(),l(!1)},[o]);return{wizardOpen:i,closeWizard:u}},bO=(t,r)=>t.findIndex(i=>i.id===r.id)===-1?[...t,r]:t.map(i=>i.id===r.id?r:i),wx=t=>t==="codex"?"codex":t==="grok"?"grok":t==="opencode"?"opencode":"default",ib=(t,r)=>wx(t.find(o=>o.id===r)?.commandPresetId),wO=({activeWorkspaceId:t,onWorkerDeleted:r,onWorkerRunStarted:o,setWorkersByWorkspaceId:i,workers:l})=>{const{language:u}=ke(),f=b.useCallback(async({commandPresetId:v,name:x,role:S,roleDescription:T,startupCommand:k})=>{if(!t)return{error:"No active workspace",runId:null};const C=k.trim(),E=await gC(t,{autostart:!0,command_preset_id:v||null,description:T.trim(),name:x,role:S,startup_command:C||null,ui_language:u});return i(A=>({...A,[t]:bO(A[t]??[],E.worker)})),E.agentStart.ok&&E.agentStart.runId&&o?.({agentId:E.worker.id,agentName:E.worker.name,runId:E.agentStart.runId,terminalInputProfile:wx(v),workspaceId:t}),{error:E.agentStart.ok?null:E.agentStart.error,runId:E.agentStart.ok?E.agentStart.runId:null}},[t,u,o,i]),h=b.useCallback(async v=>{if(!t)throw new Error("No active workspace");await yC(t,v),i(x=>({...x,[t]:(x[t]??[]).filter(S=>S.id!==v)})),r?.(t,v)},[t,r,i]),g=b.useCallback(async v=>{if(!t)return{error:"No active workspace",runId:null};try{const x=await Kl(t,v);return o?.({agentId:v,agentName:v,runId:x.runId,terminalInputProfile:ib(l,v),workspaceId:t}),{error:null,runId:x.runId}}catch(x){return{error:x instanceof Error?x.message:String(x),runId:null}}},[t,o,l]),m=b.useCallback(async v=>{try{return await Yl(v),{error:null}}catch(x){return{error:x instanceof Error?x.message:String(x)}}},[]),y=b.useCallback(async(v,x)=>{if(!t)return{error:"No active workspace",runId:null};try{const S=await JE(t,v,x);return o?.({agentId:v,agentName:v,runId:S.runId,terminalInputProfile:ib(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:h,startWorker:g,stopWorkerRun:m,restartWorkerRun:y}},qm={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"]},xO=new Set(qm.mac),kO=t=>typeof t=="string"&&xO.has(t),xx=(t,r)=>qm[r].includes(t),kx=t=>t==="mac"||t==="windows"||t==="linux"?"finder":"vscode",SO="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",Ef="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",Sx="/assets/finder-C4Jmsb0B.png",EO="/assets/ghostty-D-Js4rdm.png",CO="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",TO="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",NO="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",AO="/assets/zed-C5BQT8X3.png",_O={mac:"openWorkspace.target.finder.mac",windows:"openWorkspace.target.finder.windows",linux:"openWorkspace.target.finder.linux",other:"openWorkspace.target.finder.linux"},jO={mac:Sx,windows:Ef,linux:Ef,other:Ef},Cc={vscode:{labelKey:"openWorkspace.target.vscode",iconSrc:TO},"vscode-insiders":{labelKey:"openWorkspace.target.vscodeInsiders",iconSrc:NO},cursor:{labelKey:"openWorkspace.target.cursor",iconSrc:SO},finder:{labelKey:"openWorkspace.target.finder.mac",iconSrc:Sx},terminal:{labelKey:"openWorkspace.target.terminal",iconSrc:CO},ghostty:{labelKey:"openWorkspace.target.ghostty",iconSrc:EO,iconScale:1.2},zed:{labelKey:"openWorkspace.target.zed",iconSrc:AO}},Ex=(t,r)=>t==="finder"?_O[r]:Cc[t].labelKey,Cx=(t,r)=>t==="finder"?jO[r]:Cc[t].iconSrc,Cf=(t,r)=>{const o=xx(t,r)?t:kx(r),i=Cc[o];return{id:o,iconSrc:Cx(o,r),labelKey:Ex(o,r),...i.iconScale!==void 0?{iconScale:i.iconScale}:{}}},RO=t=>qm[t].map(r=>{const o=Cc[r];return{id:r,iconSrc:Cx(r,t),labelKey:Ex(r,t),...o.iconScale!==void 0?{iconScale:o.iconScale}:{}}}),OO=()=>{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"},Tx="hive.openTarget.preferred",DO=()=>{try{return window.localStorage.getItem(Tx)}catch{return null}},MO=t=>{const r=kx(t);if(typeof window>"u")return r;const o=DO();if(!o)return r;const i=o==="ghostie"?"ghostty":o;return kO(i)&&xx(i,t)?i:r},LO=t=>{try{window.localStorage.setItem(Tx,t)}catch{}},zO={"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"},HO=({workspace:t})=>{const{t:r}=ke(),{mode:o}=lw(),i=Jt(),l=b.useMemo(()=>OO(),[]),u=RO(l),[f,h]=b.useState(()=>MO(l)),[g,m]=b.useState(!1),[y,v]=b.useState(!1),x=b.useRef(null),S=b.useRef(null),T=Cf(f,l),k=r(T.labelKey);b.useEffect(()=>{if(!g)return;const D=B=>{B.key==="Escape"&&m(!1)},L=B=>{const P=x.current;P&&!P.contains(B.target)&&m(!1)};return document.addEventListener("keydown",D),document.addEventListener("pointerdown",L),()=>{document.removeEventListener("keydown",D),document.removeEventListener("pointerdown",L)}},[g]);const C=b.useCallback(D=>{h(D),LO(D),m(!1),S.current?.focus()},[]),E=b.useCallback(async()=>{if(!(!t||y)){v(!0);try{const D=await xC(t.id,f);if(D.ok){if(o==="mobile"){const L=Cf(D.effectiveTargetId,l).labelKey;i.show({kind:"success",message:r("openWorkspace.opened",{app:r(L),workspace:t.name})})}}else{const L=Cf(D.effectiveTargetId,l).labelKey;i.show({kind:"error",message:r(zO[D.errorCode],{app:r(L)})})}}catch(D){const L=D instanceof Error?D.message:String(D);i.show({kind:"error",message:L})}finally{v(!1)}}},[y,o,l,f,r,i,t]),A=!t,j=r("openWorkspace.noWorkspace"),N=t?r("openWorkspace.openIn",{app:k,workspace:t.name}):j,O=t?r("openWorkspace.openInAria",{app:k,workspace:t.name}):j;return c.jsxs("div",{ref:x,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:A||y,onClick:()=>{E()},className:"open-workspace__main",children:[c.jsx("span",{className:"open-workspace__trigger-icon","aria-hidden":!0,children:y?c.jsx(ka,{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:r("openWorkspace.open")})]})})}),c.jsx(Qe,{label:r("openWorkspace.selectTarget"),children:c.jsx("button",{type:"button","aria-label":r("openWorkspace.selectTarget"),"aria-haspopup":"menu","aria-expanded":g,"data-testid":"topbar-open-workspace-chevron",disabled:A,onClick:()=>m(D=>!D),className:"open-workspace__chevron",children:c.jsx(To,{size:12,"aria-hidden":!0})})}),g?c.jsx("div",{role:"menu","aria-label":r("openWorkspace.selectTarget"),className:"open-workspace__menu elev-2","data-testid":"topbar-open-workspace-menu",children:u.map(D=>{const L=D.id===f;return c.jsxs("button",{role:"menuitemradio","aria-checked":L,type:"button",onClick:()=>C(D.id),className:"open-workspace__option","data-selected":L?"true":void 0,"data-testid":`topbar-open-workspace-option-${D.id}`,children:[c.jsx("span",{className:"open-workspace__option-icon","aria-hidden":!0,children:c.jsx("img",{src:D.iconSrc,alt:"",className:"open-workspace__option-img",style:{transform:D.iconScale?`scale(${D.iconScale})`:void 0}})}),c.jsx("span",{className:"flex-1",children:r(D.labelKey)}),c.jsx("span",{className:"open-workspace__check","aria-hidden":!0,children:L?c.jsx(xa,{size:13}):null})]},D.id)})}):null]})},BO=b.lazy(()=>Tt(()=>import("./WorkflowsDrawer-CVvGxxdR.js"),__vite__mapDeps([5,4])).then(t=>({default:t.WorkflowsDrawer}))),WO=b.lazy(()=>Tt(()=>import("./WorkspaceMemoryDrawer-BamHuJEp.js"),__vite__mapDeps([6,3])).then(t=>({default:t.WorkspaceMemoryDrawer}))),UO=()=>{const[t,r]=b.useState(null),{activeWorkspaceId:o,selectWorkspace:i,setActiveWorkspaceId:l}=V3(),{demoMode:u,enableDemo:f,exitDemo:h}=Xj(),g=u||!t?[]:t.map(({id:de})=>de),[m,y]=e4(g,{activeWorkspaceId:o}),[v,x]=b.useState(0),[S,T]=b.useState(!1),[k,C]=b.useState(!1),[E,A]=b.useState(!1),[j,N]=b.useState(null),[O,D]=b.useState("team"),L=SR(),B=Jt(),{wizardOpen:P,closeWizard:re}=yO(t),ee=gO({hasExistingWorkspace:t===null?null:t.length>0,wizardOpen:P}),J=sx().enabled;b.useEffect(()=>{J||(A(!1),D(de=>de==="flows"?"team":de))},[J]);const G=b.useCallback(()=>x(de=>de+1),[]),[V,M]=b.useState(null),q=b.useCallback(de=>{M(de),B.show({kind:"error",message:de})},[B]);P3(r,l,q);const I=K3({onWorkspaceCreated:de=>{r(Te=>Te===null?[de]:[...Te,de]),i(de.id),y(Te=>({...Te,[de.id]:[]}))},onError:de=>B.show({kind:"error",message:de})}),F=Zj({demoMode:u,workspaces:t,activeWorkspaceId:o,workersByWorkspaceId:m}),R=F.effectiveActiveWorkspace?.id,W=R?F.effectiveWorkersByWorkspaceId[R]??[]:[];b.useEffect(()=>{N(de=>de&&W.some(Te=>Te.id===de)?de:null)},[W]);const ne=E3(F.pollWorkspaceId,PA(F.pollWorkspaceId));GR(!0);const ae=k3(u?null:o??null,u?Gj:void 0),fe=b.useMemo(()=>F.effectiveActiveWorkspace?h3(ae.content):0,[F.effectiveActiveWorkspace,ae.content]),me=wO({activeWorkspaceId:o,onWorkerDeleted:ne.forgetOptimisticAgent,onWorkerRunStarted:ne.recordOptimisticRun,setWorkersByWorkspaceId:y,workers:W}),ce=$3({activeWorkspaceId:o,onActiveDeleted:()=>{C(!1),T(!1),A(!1)},selectWorkspace:i,setWorkersByWorkspaceId:y,setWorkspaces:r,workspaces:t});M3({bootstrapError:V,onSelectWorkspace:i,onTriggerAddDialog:G,workspaces:F.effectiveWorkspaces}),o3({onAddWorkspace:G,onTryDemo:f,ready:u||t!==null||V!==null});const le=F3();B3(R,W);const ie=V!==null&&!u&&t===null,ue=Nt(),pe=b.useSyncExternalStore(T3,N3),Ne=ue?c.jsx(TR,{status:pe}):null,Ce=R?ne.optimisticRunsByWorkspaceId[R]??[]:[],Je=!ie&&!u&&R!==void 0&&(ne.terminalRuns.length>0||Ce.length>0)?c.jsx(dO,{optimisticRuns:Ce,terminalRuns:ne.terminalRuns,workspaceId:R},`terminal-${R}`):null,mt=ie?c.jsx(ZR,{onTryDemo:f}):c.jsx($j,{activeId:R,activeWorkspace:F.effectiveActiveWorkspace,activeWorkerId:j,bootstrapError:V,demoMode:u,workspacesLoading:!u&&t===null,onActiveWorkerChange:N,onDeleteWorkspace:ce,onExitDemo:h,onRequestAddWorkspace:G,onShellRunClosed:ne.forgetOptimisticRun,onShellRunStarted:(de,Te)=>ne.recordOptimisticRun({agentId:Te.agent_id,agentName:Te.agent_name,runId:Te.run_id,status:Te.status,terminalInputProfile:Te.terminal_input_profile??"default",workspaceId:de}),onTryDemo:f,orchestratorAutostartErrors:I.orchestratorAutostartErrors,orchestratorAutostartRunIds:I.orchestratorAutostartRunIds,recordOrchestratorResult:I.recordOrchestratorResult,terminalRuns:ne.terminalRuns,workerActions:me,workers:W,showInlineActionCenter:ue}),en=c.jsx(X2,{addDialogTrigger:v,wizardOpen:P,whatsNewOpen:ee.open,whatsNewEntries:ee.entries,onCloseWhatsNew:ee.close,onAddWorkspace:G,onCloseTaskGraph:()=>T(!1),onCloseWizard:re,onCreateWorkspace:I.createNewWorkspace,onTryDemo:f,taskGraphOpen:S,tasksFile:ae,workspacePath:F.effectiveActiveWorkspace?.path??null,workers:W,onSelectOwner:le}),Cn=E&&!u&&J?c.jsx(b.Suspense,{fallback:null,children:c.jsx(BO,{open:!0,onClose:()=>A(!1),workspaceId:o??null})}):null,pn=k&&!u?c.jsx(b.Suspense,{fallback:null,children:c.jsx(WO,{open:!0,onClose:()=>C(!1),workspaceId:o??null})}):null,Tn=c.jsx(d3,{activeWorkspaceId:F.effectiveActiveWorkspaceId,collapsed:L.collapsed,createDisabledReason:V??void 0,onCreateClick:G,onDeleteWorkspace:ce,onSelectWorkspace:i,onToggleCollapse:L.toggleCollapsed,workersByWorkspaceId:F.effectiveWorkersByWorkspaceId,workspaces:F.effectiveWorkspaces}),tn=c.jsxs(c.Fragment,{children:[c.jsx(HO,{workspace:F.effectiveActiveWorkspace}),ie||u||!R?null:c.jsx(uA,{workspaceId:R,onOpenWorker:N},R)]});return ue?c.jsxs(c.Fragment,{children:[c.jsx(BR,{workspaceSwitcher:ie?void 0:c.jsx(FR,{activeWorkspaceId:F.effectiveActiveWorkspaceId,workspaces:F.effectiveWorkspaces,workersByWorkspaceId:F.effectiveWorkersByWorkspaceId,createDisabledReason:V??void 0,onCreateClick:G,onDeleteWorkspace:ce,onSelectWorkspace:i}),topbarActions:ie?void 0:c.jsx(c.Fragment,{children:c.jsx(lx,{})}),openTaskCount:fe,workingCount:W.filter(de=>de.status==="working").length,banner:Ne,terminalPanels:Je,fullBleed:ie?mt:void 0,team:ie?null:mt,tasks:ie?null:c.jsx(IR,{tasksFile:ae,workspacePath:F.effectiveActiveWorkspace?.path??null,workers:W,onSelectOwner:le,onAddWorkspace:G,demoMode:u}),settings:ie||!u?void 0:c.jsx(jR,{demoMode:u,onTryDemo:f,onExitDemo:h}),activeSection:O,onSectionChange:D,overlays:en}),c.jsx(Vy,{terminalRuns:ne.terminalRuns}),c.jsx(Gy,{})]}):c.jsxs(c.Fragment,{children:[c.jsxs(ER,{hideTopbarActions:!F.effectiveActiveWorkspace,memoryOpen:k,onToggleMemory:u?void 0:()=>C(de=>!de),onToggleTaskGraph:()=>T(de=>!de),openTaskCount:fe,topbarActions:tn,taskGraphOpen:S,onToggleWorkflows:u||!J?void 0:()=>A(de=>!de),workflowsOpen:E,sidebarResize:L,sidebar:Tn,children:[mt,Je,en,pn,Cn]}),c.jsx(Vy,{terminalRuns:ne.terminalRuns}),c.jsx(Gy,{}),c.jsx(VR,{})]})},IO={success:qb,warning:dc,error:TS},Tf={success:"var(--status-green)",warning:"var(--status-orange)",error:"var(--status-red)"},lb=({toast:t,api:r})=>{const{t:o}=ke(),i=IO[t.kind],l=r.getDuration(t.id);return c.jsxs("div",{"data-testid":"toast","data-kind":t.kind,onMouseEnter:()=>r.pauseDismiss(t.id),onMouseLeave:()=>r.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, ${Tf[t.kind]} 35%, var(--border))`},children:[c.jsx("span",{className:"mt-0.5 shrink-0",style:{color:Tf[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:()=>r.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(ya,{size:14,"aria-hidden":!0})}),l>0?c.jsx("span",{className:"toast-progress-bar",style:{background:Tf[t.kind],animationDuration:`${l}ms`},"aria-hidden":!0}):null]})},qO=()=>{const t=aA(),r=Jt(),o=Nt();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(lb,{toast:u,api:r},u.id))}),c.jsx("div",{role:"alert","aria-live":"assertive",className:"flex flex-col gap-2",children:i.map(u=>c.jsx(lb,{toast:u,api:r},u.id))})]})},PO=({children:t})=>c.jsx(Q0,{delayDuration:250,skipDelayDuration:150,children:c.jsx(BE,{children:c.jsx(rA,{children:c.jsx(kA,{children:c.jsx(pR,{children:c.jsx(fR,{children:c.jsxs(lR,{children:[t,c.jsx(qO,{})]})})})})})})}),FO=()=>c.jsx(vA,{children:c.jsx(PO,{children:c.jsx(UO,{})})}),cb="\0gw:",ga={Unauthorized:4401,Forbidden:4403,DaemonOffline:4404,Revoked:4410,InternalError:4500},Nx="hb:ping",Ax="hb:pong",KO=t=>t===ga.Unauthorized||t===ga.Revoked;function YO(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in t&&t.BYTES_PER_ELEMENT===1}function tm(t){if(typeof t!="boolean")throw new TypeError(`boolean expected, not ${t}`)}function yo(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 St(t,r,o=""){const i=YO(t),l=t?.length,u=r!==void 0;if(!i||u&&l!==r){const f=o&&`"${o}" `,h=u?` of length ${r}`:"",g=i?`length=${l}`:`type=${typeof t}`,m=f+"expected Uint8Array"+h+", got "+g;throw i?new RangeError(m):new TypeError(m)}return t}function ub(t,r=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(r&&t.finished)throw new Error("Hash#digest() has already been called")}function $O(t,r,o=!1){St(t,void 0,"output");const i=r.outputLen;if(t.length<i)throw new RangeError("digestInto() expects output buffer of length at least "+i);if(o&&!Ps(t))throw new Error("invalid output, must be aligned")}function or(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function qr(...t){for(let r=0;r<t.length;r++)t[r].fill(0)}function VO(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}const va=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,_x=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255,kt=va?t=>t:t=>_x(t)>>>0,GO=t=>{for(let r=0;r<t.length;r++)t[r]=_x(t[r]);return t},Ur=va?t=>t:GO;function XO(t,r){if(r==null||typeof r!="object")throw new Error("options must be defined");return Object.assign(t,r)}function ZO(t,r){if(t.length!==r.length)return!1;let o=0;for(let i=0;i<t.length;i++)o|=t[i]^r[i];return o===0}function QO(t,r,o){const i=r,l=(()=>[]),u=(h,g)=>i(g,...l(h)).update(h).digest(),f=i(new Uint8Array(t),...l(new Uint8Array(0)));return u.outputLen=f.outputLen,u.blockLen=f.blockLen,u.create=(h,...g)=>i(h,...g),u}const JO=(t,r)=>{function o(i,...l){if(St(i,void 0,"key"),t.nonceLength!==void 0){const y=l[0];St(y,t.varSizeNonce?void 0:t.nonceLength,"nonce")}const u=t.tagLength;u&&l[1]!==void 0&&St(l[1],void 0,"AAD");const f=r(i,...l),h=(y,v)=>{if(v!==void 0){if(y!==2)throw new Error("cipher output not supported");St(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,St(y),h(f.encrypt.length,v),f.encrypt(y,v)},decrypt(y,v){if(St(y),u&&y.length<u)throw new Error('"ciphertext" expected length bigger than tagLength='+u);return h(f.decrypt.length,v),f.decrypt(y,v)}}}return Object.assign(o,t),o};function nm(t,r,o=!0){if(r===void 0)return new Uint8Array(t);if(St(r,void 0,"output"),r.length!==t)throw new Error('"output" expected Uint8Array of length '+t+", got: "+r.length);if(o&&!Ps(r))throw new Error("invalid output, must be aligned");return r}function e5(t,r,o){yo(t),yo(r),tm(o);const i=new Uint8Array(16),l=VO(i);return l.setBigUint64(0,BigInt(r),o),l.setBigUint64(8,BigInt(t),o),i}function Ps(t){return t.byteOffset%4===0}function ec(t){return Uint8Array.from(St(t))}function jx(t=32){yo(t);const r=typeof globalThis=="object"?globalThis.crypto:null;if(typeof r?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");return r.getRandomValues(new Uint8Array(t))}const Rx=t=>Uint8Array.from(t.split(""),r=>r.charCodeAt(0)),t5=Ur(or(Rx("expand 16-byte k"))),n5=Ur(or(Rx("expand 32-byte k")));function ve(t,r){return t<<r|t>>>32-r}const _s=64,r5=16,rm=2**32-1,db=Uint32Array.of();function a5(t,r,o,i,l,u,f,h){const g=l.length,m=new Uint8Array(_s),y=or(m),v=va&&Ps(l)&&Ps(u),x=v?or(l):db,S=v?or(u):db;if(!va){for(let T=0;T<g;f++){if(t(r,o,i,y,f,h),Ur(y),f>=rm)throw new Error("arx: counter overflow");const k=Math.min(_s,g-T);for(let C=0,E;C<k;C++)E=T+C,u[E]=l[E]^m[C];T+=k}return}for(let T=0;T<g;f++){if(t(r,o,i,y,f,h),f>=rm)throw new Error("arx: counter overflow");const k=Math.min(_s,g-T);if(v&&k===_s){const C=T/4;if(T%4!==0)throw new Error("arx: invalid block position");for(let E=0,A;E<r5;E++)A=C+E,S[A]=x[A]^y[E];T+=_s;continue}for(let C=0,E;C<k;C++)E=T+C,u[E]=l[E]^m[C];T+=k}}function o5(t,r){const{allowShortKeys:o,extendNonceFn:i,counterLength:l,counterRight:u,rounds:f}=XO({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},r);if(typeof t!="function")throw new Error("core must be a function");return yo(l),yo(f),tm(u),tm(o),(h,g,m,y,v=0)=>{St(h,void 0,"key"),St(g,void 0,"nonce"),St(m,void 0,"data");const x=m.length;if(y=nm(x,y,!1),yo(v),v<0||v>=rm)throw new Error("arx: counter overflow");const S=[];let T=h.length,k,C;if(T===32)S.push(k=ec(h)),C=n5;else if(T===16&&o)k=new Uint8Array(32),k.set(h),k.set(h,16),C=t5,S.push(k);else throw St(h,32,"arx key"),new Error("invalid key size");(!va||!Ps(g))&&S.push(g=ec(g));let E=or(k);if(i){if(g.length!==24)throw new Error("arx: extended nonce must be 24 bytes");const N=g.subarray(0,16);if(va)i(C,E,or(N),E);else{const O=Ur(Uint32Array.from(C));i(O,E,or(N),E),qr(O),Ur(E)}g=g.subarray(16)}else va||Ur(E);const A=16-l;if(A!==g.length)throw new Error(`arx: nonce must be ${A} or 16 bytes`);if(A!==12){const N=new Uint8Array(12);N.set(g,u?0:12-g.length),g=N,S.push(g)}const j=Ur(or(g));try{return a5(t,C,E,j,m,y,v,f),y}finally{qr(...S)}}}function bt(t,r){return t[r++]&255|(t[r++]&255)<<8}class s5{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(r){r=ec(St(r,32,"key"));const o=bt(r,0),i=bt(r,2),l=bt(r,4),u=bt(r,6),f=bt(r,8),h=bt(r,10),g=bt(r,12),m=bt(r,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|h<<2)&8191,this.r[7]=(h>>>11|g<<5)&8065,this.r[8]=(g>>>8|m<<8)&8191,this.r[9]=m>>>5&127;for(let y=0;y<8;y++)this.pad[y]=bt(r,16+2*y)}process(r,o,i=!1){const l=i?0:2048,{h:u,r:f}=this,h=f[0],g=f[1],m=f[2],y=f[3],v=f[4],x=f[5],S=f[6],T=f[7],k=f[8],C=f[9],E=bt(r,o+0),A=bt(r,o+2),j=bt(r,o+4),N=bt(r,o+6),O=bt(r,o+8),D=bt(r,o+10),L=bt(r,o+12),B=bt(r,o+14);let P=u[0]+(E&8191),re=u[1]+((E>>>13|A<<3)&8191),ee=u[2]+((A>>>10|j<<6)&8191),Y=u[3]+((j>>>7|N<<9)&8191),J=u[4]+((N>>>4|O<<12)&8191),G=u[5]+(O>>>1&8191),V=u[6]+((O>>>14|D<<2)&8191),M=u[7]+((D>>>11|L<<5)&8191),q=u[8]+((L>>>8|B<<8)&8191),I=u[9]+(B>>>5|l),Z=0,F=Z+P*h+re*(5*C)+ee*(5*k)+Y*(5*T)+J*(5*S);Z=F>>>13,F&=8191,F+=G*(5*x)+V*(5*v)+M*(5*y)+q*(5*m)+I*(5*g),Z+=F>>>13,F&=8191;let R=Z+P*g+re*h+ee*(5*C)+Y*(5*k)+J*(5*T);Z=R>>>13,R&=8191,R+=G*(5*S)+V*(5*x)+M*(5*v)+q*(5*y)+I*(5*m),Z+=R>>>13,R&=8191;let W=Z+P*m+re*g+ee*h+Y*(5*C)+J*(5*k);Z=W>>>13,W&=8191,W+=G*(5*T)+V*(5*S)+M*(5*x)+q*(5*v)+I*(5*y),Z+=W>>>13,W&=8191;let ne=Z+P*y+re*m+ee*g+Y*h+J*(5*C);Z=ne>>>13,ne&=8191,ne+=G*(5*k)+V*(5*T)+M*(5*S)+q*(5*x)+I*(5*v),Z+=ne>>>13,ne&=8191;let ae=Z+P*v+re*y+ee*m+Y*g+J*h;Z=ae>>>13,ae&=8191,ae+=G*(5*C)+V*(5*k)+M*(5*T)+q*(5*S)+I*(5*x),Z+=ae>>>13,ae&=8191;let fe=Z+P*x+re*v+ee*y+Y*m+J*g;Z=fe>>>13,fe&=8191,fe+=G*h+V*(5*C)+M*(5*k)+q*(5*T)+I*(5*S),Z+=fe>>>13,fe&=8191;let me=Z+P*S+re*x+ee*v+Y*y+J*m;Z=me>>>13,me&=8191,me+=G*g+V*h+M*(5*C)+q*(5*k)+I*(5*T),Z+=me>>>13,me&=8191;let ce=Z+P*T+re*S+ee*x+Y*v+J*y;Z=ce>>>13,ce&=8191,ce+=G*m+V*g+M*h+q*(5*C)+I*(5*k),Z+=ce>>>13,ce&=8191;let le=Z+P*k+re*T+ee*S+Y*x+J*v;Z=le>>>13,le&=8191,le+=G*y+V*m+M*g+q*h+I*(5*C),Z+=le>>>13,le&=8191;let ie=Z+P*C+re*k+ee*T+Y*S+J*x;Z=ie>>>13,ie&=8191,ie+=G*v+V*y+M*m+q*g+I*h,Z+=ie>>>13,ie&=8191,Z=(Z<<2)+Z|0,Z=Z+F|0,F=Z&8191,Z=Z>>>13,R+=Z,u[0]=F,u[1]=R,u[2]=W,u[3]=ne,u[4]=ae,u[5]=fe,u[6]=me,u[7]=ce,u[8]=le,u[9]=ie}finalize(){const{h:r,pad:o}=this,i=new Uint16Array(10);let l=r[1]>>>13;r[1]&=8191;for(let h=2;h<10;h++)r[h]+=l,l=r[h]>>>13,r[h]&=8191;r[0]+=l*5,l=r[0]>>>13,r[0]&=8191,r[1]+=l,l=r[1]>>>13,r[1]&=8191,r[2]+=l,i[0]=r[0]+5,l=i[0]>>>13,i[0]&=8191;for(let h=1;h<10;h++)i[h]=r[h]+l,l=i[h]>>>13,i[h]&=8191;i[9]-=8192;let u=(l^1)-1;for(let h=0;h<10;h++)i[h]&=u;u=~u;for(let h=0;h<10;h++)r[h]=r[h]&u|i[h];r[0]=(r[0]|r[1]<<13)&65535,r[1]=(r[1]>>>3|r[2]<<10)&65535,r[2]=(r[2]>>>6|r[3]<<7)&65535,r[3]=(r[3]>>>9|r[4]<<4)&65535,r[4]=(r[4]>>>12|r[5]<<1|r[6]<<14)&65535,r[5]=(r[6]>>>2|r[7]<<11)&65535,r[6]=(r[7]>>>5|r[8]<<8)&65535,r[7]=(r[8]>>>8|r[9]<<5)&65535;let f=r[0]+o[0];r[0]=f&65535;for(let h=1;h<8;h++)f=(r[h]+o[h]|0)+(f>>>16)|0,r[h]=f&65535;qr(i)}update(r){ub(this),St(r),r=ec(r);const{buffer:o,blockLen:i}=this,l=r.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(r,u);continue}o.set(r.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,qr(this.h,this.r,this.buffer,this.pad)}digestInto(r){ub(this),$O(r,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++)r[u++]=i[f]>>>0,r[u++]=i[f]>>>8}digest(){const{buffer:r,outputLen:o}=this;this.digestInto(r);const i=r.slice(0,o);return this.destroy(),i}}const i5=QO(32,t=>new s5(t));function l5(t,r,o,i,l,u=20){let f=t[0],h=t[1],g=t[2],m=t[3],y=r[0],v=r[1],x=r[2],S=r[3],T=r[4],k=r[5],C=r[6],E=r[7],A=l,j=o[0],N=o[1],O=o[2],D=f,L=h,B=g,P=m,re=y,ee=v,Y=x,J=S,G=T,V=k,M=C,q=E,I=A,Z=j,F=N,R=O;for(let ne=0;ne<u;ne+=2)D=D+re|0,I=ve(I^D,16),G=G+I|0,re=ve(re^G,12),D=D+re|0,I=ve(I^D,8),G=G+I|0,re=ve(re^G,7),L=L+ee|0,Z=ve(Z^L,16),V=V+Z|0,ee=ve(ee^V,12),L=L+ee|0,Z=ve(Z^L,8),V=V+Z|0,ee=ve(ee^V,7),B=B+Y|0,F=ve(F^B,16),M=M+F|0,Y=ve(Y^M,12),B=B+Y|0,F=ve(F^B,8),M=M+F|0,Y=ve(Y^M,7),P=P+J|0,R=ve(R^P,16),q=q+R|0,J=ve(J^q,12),P=P+J|0,R=ve(R^P,8),q=q+R|0,J=ve(J^q,7),D=D+ee|0,R=ve(R^D,16),M=M+R|0,ee=ve(ee^M,12),D=D+ee|0,R=ve(R^D,8),M=M+R|0,ee=ve(ee^M,7),L=L+Y|0,I=ve(I^L,16),q=q+I|0,Y=ve(Y^q,12),L=L+Y|0,I=ve(I^L,8),q=q+I|0,Y=ve(Y^q,7),B=B+J|0,Z=ve(Z^B,16),G=G+Z|0,J=ve(J^G,12),B=B+J|0,Z=ve(Z^B,8),G=G+Z|0,J=ve(J^G,7),P=P+re|0,F=ve(F^P,16),V=V+F|0,re=ve(re^V,12),P=P+re|0,F=ve(F^P,8),V=V+F|0,re=ve(re^V,7);let W=0;i[W++]=f+D|0,i[W++]=h+L|0,i[W++]=g+B|0,i[W++]=m+P|0,i[W++]=y+re|0,i[W++]=v+ee|0,i[W++]=x+Y|0,i[W++]=S+J|0,i[W++]=T+G|0,i[W++]=k+V|0,i[W++]=C+M|0,i[W++]=E+q|0,i[W++]=A+I|0,i[W++]=j+Z|0,i[W++]=N+F|0,i[W++]=O+R|0}function c5(t,r,o,i){let l=kt(t[0]),u=kt(t[1]),f=kt(t[2]),h=kt(t[3]),g=kt(r[0]),m=kt(r[1]),y=kt(r[2]),v=kt(r[3]),x=kt(r[4]),S=kt(r[5]),T=kt(r[6]),k=kt(r[7]),C=kt(o[0]),E=kt(o[1]),A=kt(o[2]),j=kt(o[3]);for(let O=0;O<20;O+=2)l=l+g|0,C=ve(C^l,16),x=x+C|0,g=ve(g^x,12),l=l+g|0,C=ve(C^l,8),x=x+C|0,g=ve(g^x,7),u=u+m|0,E=ve(E^u,16),S=S+E|0,m=ve(m^S,12),u=u+m|0,E=ve(E^u,8),S=S+E|0,m=ve(m^S,7),f=f+y|0,A=ve(A^f,16),T=T+A|0,y=ve(y^T,12),f=f+y|0,A=ve(A^f,8),T=T+A|0,y=ve(y^T,7),h=h+v|0,j=ve(j^h,16),k=k+j|0,v=ve(v^k,12),h=h+v|0,j=ve(j^h,8),k=k+j|0,v=ve(v^k,7),l=l+m|0,j=ve(j^l,16),T=T+j|0,m=ve(m^T,12),l=l+m|0,j=ve(j^l,8),T=T+j|0,m=ve(m^T,7),u=u+y|0,C=ve(C^u,16),k=k+C|0,y=ve(y^k,12),u=u+y|0,C=ve(C^u,8),k=k+C|0,y=ve(y^k,7),f=f+v|0,E=ve(E^f,16),x=x+E|0,v=ve(v^x,12),f=f+v|0,E=ve(E^f,8),x=x+E|0,v=ve(v^x,7),h=h+g|0,A=ve(A^h,16),S=S+A|0,g=ve(g^S,12),h=h+g|0,A=ve(A^h,8),S=S+A|0,g=ve(g^S,7);let N=0;i[N++]=l,i[N++]=u,i[N++]=f,i[N++]=h,i[N++]=C,i[N++]=E,i[N++]=A,i[N++]=j,Ur(i)}const u5=o5(l5,{counterRight:!1,counterLength:8,extendNonceFn:c5,allowShortKeys:!1}),d5=new Uint8Array(16),fb=(t,r)=>{t.update(r);const o=r.length%16;o&&t.update(d5.subarray(o))},f5=new Uint8Array(32);function mb(t,r,o,i,l){l!==void 0&&St(l,void 0,"AAD");const u=t(r,o,f5),f=e5(i.length,l?l.length:0,!0),h=i5.create(u);l&&fb(h,l),fb(h,i),h.update(f);const g=h.digest();return qr(u,f),g}const m5=t=>(r,o,i)=>({encrypt(u,f){const h=u.length;f=nm(h+16,f,!1),f.set(u);const g=f.subarray(0,-16);t(r,o,g,g,1);const m=mb(t,r,o,g,i);return f.set(m,h),qr(m),f},decrypt(u,f){f=nm(u.length-16,f,!1);const h=u.subarray(0,-16),g=u.subarray(-16),m=mb(t,r,o,h,i);if(!ZO(g,m))throw qr(m),new Error("invalid tag");return f.set(u.subarray(0,-16)),t(r,o,f,f,1),qr(m),f}}),Ox=JO({blockSize:64,nonceLength:24,tagLength:16},m5(u5));function p5(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in t&&t.BYTES_PER_ELEMENT===1}function Eo(t,r=""){if(typeof t!="number"){const o=r&&`"${r}" `;throw new TypeError(`${o}expected number, got ${typeof t}`)}if(!Number.isSafeInteger(t)||t<0){const o=r&&`"${r}" `;throw new RangeError(`${o}expected integer >= 0, got ${t}`)}}function lr(t,r,o=""){const i=p5(t),l=t?.length,u=r!==void 0;if(!i||u&&l!==r){const f=o&&`"${o}" `,h=u?` of length ${r}`:"",g=i?`length=${l}`:`type=${typeof t}`,m=f+"expected Uint8Array"+h+", got "+g;throw i?new RangeError(m):new TypeError(m)}return t}function Pm(t){if(typeof t!="function"||typeof t.create!="function")throw new TypeError("Hash must wrapped by utils.createHasher");if(Eo(t.outputLen),Eo(t.blockLen),t.outputLen<1)throw new Error('"outputLen" must be >= 1');if(t.blockLen<1)throw new Error('"blockLen" must be >= 1')}function tc(t,r=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(r&&t.finished)throw new Error("Hash#digest() has already been called")}function Dx(t,r){lr(t,void 0,"digestInto() output");const o=r.outputLen;if(t.length<o)throw new RangeError('"digestInto() output" expected to be of length >='+o)}function Fs(...t){for(let r=0;r<t.length;r++)t[r].fill(0)}function Nf(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function Rn(t,r){return t<<32-r|t>>>r}const Mx=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",h5=Array.from({length:256},(t,r)=>r.toString(16).padStart(2,"0"));function Fm(t){if(lr(t),Mx)return t.toHex();let r="";for(let o=0;o<t.length;o++)r+=h5[t[o]];return r}const ar={_0:48,_9:57,A:65,F:70,a:97,f:102};function pb(t){if(t>=ar._0&&t<=ar._9)return t-ar._0;if(t>=ar.A&&t<=ar.F)return t-(ar.A-10);if(t>=ar.a&&t<=ar.f)return t-(ar.a-10)}function Km(t){if(typeof t!="string")throw new TypeError("hex string expected, got "+typeof t);if(Mx)try{return Uint8Array.fromHex(t)}catch(l){throw l instanceof SyntaxError?new RangeError(l.message):l}const r=t.length,o=r/2;if(r%2)throw new RangeError("hex string expected, got unpadded hex of length "+r);const i=new Uint8Array(o);for(let l=0,u=0;l<o;l++,u+=2){const f=pb(t.charCodeAt(u)),h=pb(t.charCodeAt(u+1));if(f===void 0||h===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+h}return i}function g5(t,r={}){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,r),Object.freeze(o)}function v5(t=32){Eo(t,"bytesLength");const r=typeof globalThis=="object"?globalThis.crypto:null;if(typeof r?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");if(t>65536)throw new RangeError(`"bytesLength" expected <= 65536, got ${t}`);return r.getRandomValues(new Uint8Array(t))}const y5=t=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,t])});function b5(t,r,o){return t&r^~t&o}function w5(t,r,o){return t&r^t&o^r&o}class x5{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(r,o,i,l){this.blockLen=r,this.outputLen=o,this.padOffset=i,this.isLE=l,this.buffer=new Uint8Array(r),this.view=Nf(this.buffer)}update(r){tc(this),lr(r);const{view:o,buffer:i,blockLen:l}=this,u=r.length;for(let f=0;f<u;){const h=Math.min(l-this.pos,u-f);if(h===l){const g=Nf(r);for(;l<=u-f;f+=l)this.process(g,f);continue}i.set(r.subarray(f,f+h),this.pos),this.pos+=h,f+=h,this.pos===l&&(this.process(o,0),this.pos=0)}return this.length+=r.length,this.roundClean(),this}digestInto(r){tc(this),Dx(r,this),this.finished=!0;const{buffer:o,view:i,blockLen:l,isLE:u}=this;let{pos:f}=this;o[f++]=128,Fs(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 h=Nf(r),g=this.outputLen;if(g%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const m=g/4,y=this.get();if(m>y.length)throw new Error("_sha2: outputLen bigger than state");for(let v=0;v<m;v++)h.setUint32(4*v,y[v],u)}digest(){const{buffer:r,outputLen:o}=this;this.digestInto(r);const i=r.slice(0,o);return this.destroy(),i}_cloneInto(r){r||=new this.constructor,r.set(...this.get());const{blockLen:o,buffer:i,length:l,finished:u,destroyed:f,pos:h}=this;return r.destroyed=f,r.finished=u,r.length=l,r.pos=h,l%o&&r.buffer.set(i),r}clone(){return this._cloneInto()}}const Lr=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),k5=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]),zr=new Uint32Array(64);class S5 extends x5{constructor(r){super(64,r,8,!1)}get(){const{A:r,B:o,C:i,D:l,E:u,F:f,G:h,H:g}=this;return[r,o,i,l,u,f,h,g]}set(r,o,i,l,u,f,h,g){this.A=r|0,this.B=o|0,this.C=i|0,this.D=l|0,this.E=u|0,this.F=f|0,this.G=h|0,this.H=g|0}process(r,o){for(let v=0;v<16;v++,o+=4)zr[v]=r.getUint32(o,!1);for(let v=16;v<64;v++){const x=zr[v-15],S=zr[v-2],T=Rn(x,7)^Rn(x,18)^x>>>3,k=Rn(S,17)^Rn(S,19)^S>>>10;zr[v]=k+zr[v-7]+T+zr[v-16]|0}let{A:i,B:l,C:u,D:f,E:h,F:g,G:m,H:y}=this;for(let v=0;v<64;v++){const x=Rn(h,6)^Rn(h,11)^Rn(h,25),S=y+x+b5(h,g,m)+k5[v]+zr[v]|0,k=(Rn(i,2)^Rn(i,13)^Rn(i,22))+w5(i,l,u)|0;y=m,m=g,g=h,h=f+S|0,f=u,u=l,l=i,i=S+k|0}i=i+this.A|0,l=l+this.B|0,u=u+this.C|0,f=f+this.D|0,h=h+this.E|0,g=g+this.F|0,m=m+this.G|0,y=y+this.H|0,this.set(i,l,u,f,h,g,m,y)}roundClean(){Fs(zr)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),Fs(this.buffer)}}class E5 extends S5{A=Lr[0]|0;B=Lr[1]|0;C=Lr[2]|0;D=Lr[3]|0;E=Lr[4]|0;F=Lr[5]|0;G=Lr[6]|0;H=Lr[7]|0;constructor(){super(32)}}const bo=g5(()=>new E5,y5(1));const Pr=(t,r,o)=>lr(t,r,o),Lx=Eo,zx=Fm,C5=t=>Km(t),T5=t=>v5(t),nc=BigInt(0),am=BigInt(1);function Hx(t,r=""){if(typeof t!="boolean"){const o=r&&`"${r}" `;throw new TypeError(o+"expected boolean, got type="+typeof t)}return t}function N5(t){if(typeof t=="bigint"){if(!Il(t))throw new RangeError("positive bigint expected, got "+t)}else Lx(t);return t}function hb(t,r=""){if(typeof t!="number"){const o=r&&`"${r}" `;throw new TypeError(o+"expected number, got type="+typeof t)}if(!Number.isSafeInteger(t)){const o=r&&`"${r}" `;throw new RangeError(o+"expected safe integer, got "+t)}}function Bx(t){if(typeof t!="string")throw new TypeError("hex string expected, got "+typeof t);return t===""?nc:BigInt("0x"+t)}function A5(t){return Bx(Fm(t))}function Ks(t){return Bx(Fm(Ys(lr(t)).reverse()))}function Wx(t,r){if(Eo(r),r===0)throw new RangeError("zero length");t=N5(t);const o=t.toString(16);if(o.length>r*2)throw new RangeError("number too large");return Km(o.padStart(r*2,"0"))}function Ux(t,r){return Wx(t,r).reverse()}function _5(t,r){if(t=Pr(t),r=Pr(r),t.length!==r.length)return!1;let o=0;for(let i=0;i<t.length;i++)o|=t[i]^r[i];return o===0}function Ys(t){return Uint8Array.from(Pr(t))}const Il=t=>typeof t=="bigint"&&nc<=t;function j5(t,r,o){return Il(t)&&Il(r)&&Il(o)&&r<=t&&t<o}function rc(t,r,o,i){if(!j5(r,o,i))throw new RangeError("expected valid "+t+": "+o+" <= n < "+i+", got "+r)}function R5(t){if(t<nc)throw new Error("expected non-negative bigint, got "+t);let r;for(r=0;t>nc;t>>=am,r+=1);return r}const O5=t=>(am<<BigInt(t))-am;function Ym(t,r={},o={}){if(Object.prototype.toString.call(t)!=="[object Object]")throw new TypeError("expected valid options object");function i(u,f,h){if(!h&&f!=="function"&&!Object.hasOwn(t,u))throw new TypeError(`param "${u}" is invalid: expected own property`);const g=t[u];if(h&&g===void 0)return;const m=typeof g;if(m!==f||g===null)throw new TypeError(`param "${u}" is invalid: expected ${f}, got ${m}`)}const l=(u,f)=>Object.entries(u).forEach(([h,g])=>i(h,g,f));l(r,!1),l(o,!0)}const gb=()=>{throw new Error("not implemented")};const Et=BigInt(0),wt=BigInt(1),pa=BigInt(2),Ix=BigInt(3),qx=BigInt(4),Px=BigInt(5),D5=BigInt(7),Fx=BigInt(8),M5=BigInt(9),Kx=BigInt(16);function at(t,r){if(r<=Et)throw new Error("mod: expected positive modulus, got "+r);const o=t%r;return o>=Et?o:r+o}function yn(t,r,o){if(r<Et)throw new Error("pow2: expected non-negative exponent, got "+r);let i=t;for(;r-- >Et;)i*=i,i%=o;return i}function vb(t,r){if(t===Et)throw new Error("invert: expected non-zero number");if(r<=Et)throw new Error("invert: expected positive modulus, got "+r);let o=at(t,r),i=r,l=Et,u=wt;for(;o!==Et;){const h=i/o,g=i-o*h,m=l-u*h;i=o,o=g,l=u,u=m}if(i!==wt)throw new Error("invert: does not exist");return at(l,r)}function $m(t,r,o){const i=t;if(!i.eql(i.sqr(r),o))throw new Error("Cannot find square root")}function Yx(t,r){const o=t,i=(o.ORDER+wt)/qx,l=o.pow(r,i);return $m(o,l,r),l}function L5(t,r){const o=t,i=(o.ORDER-Px)/Fx,l=o.mul(r,pa),u=o.pow(l,i),f=o.mul(r,u),h=o.mul(o.mul(f,pa),u),g=o.mul(f,o.sub(h,o.ONE));return $m(o,g,r),g}function z5(t){const r=Vm(t),o=$x(t),i=o(r,r.neg(r.ONE)),l=o(r,i),u=o(r,r.neg(i)),f=(t+D5)/Kx;return((h,g)=>{const m=h;let y=m.pow(g,f),v=m.mul(y,i);const x=m.mul(y,l),S=m.mul(y,u),T=m.eql(m.sqr(v),g),k=m.eql(m.sqr(x),g);y=m.cmov(y,v,T),v=m.cmov(S,x,k);const C=m.eql(m.sqr(v),g),E=m.cmov(y,v,C);return $m(m,E,g),E})}function $x(t){if(t<Ix)throw new Error("sqrt is not defined for small field");let r=t-wt,o=0;for(;r%pa===Et;)r/=pa,o++;let i=pa;const l=Vm(t);for(;yb(l,i)===1;)if(i++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(o===1)return Yx;let u=l.pow(i,r);const f=(r+wt)/pa;return function(g,m){const y=g;if(y.is0(m))return m;if(yb(y,m)!==1)throw new Error("Cannot find square root");let v=o,x=y.mul(y.ONE,u),S=y.pow(m,r),T=y.pow(m,f);for(;!y.eql(S,y.ONE);){if(y.is0(S))return y.ZERO;let k=1,C=y.sqr(S);for(;!y.eql(C,y.ONE);)if(k++,C=y.sqr(C),k===v)throw new Error("Cannot find square root");const E=wt<<BigInt(v-k-1),A=y.pow(x,E);v=k,x=y.sqr(A),S=y.mul(S,x),T=y.mul(T,A)}return T}}function H5(t){return t%qx===Ix?Yx:t%Fx===Px?L5:t%Kx===M5?z5(t):$x(t)}const fa=(t,r)=>(at(t,r)&wt)===wt,B5=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function W5(t){const r={ORDER:"bigint",BYTES:"number",BITS:"number"},o=B5.reduce((i,l)=>(i[l]="function",i),r);if(Ym(t,o),hb(t.BYTES,"BYTES"),hb(t.BITS,"BITS"),t.BYTES<1||t.BITS<1)throw new Error("invalid field: expected BYTES/BITS > 0");if(t.ORDER<=wt)throw new Error("invalid field: expected ORDER > 1, got "+t.ORDER);return t}function U5(t,r,o){const i=t;if(o<Et)throw new Error("invalid exponent, negatives unsupported");if(o===Et)return i.ONE;if(o===wt)return r;let l=i.ONE,u=r;for(;o>Et;)o&wt&&(l=i.mul(l,u)),u=i.sqr(u),o>>=wt;return l}function Vx(t,r,o=!1){const i=t,l=new Array(r.length).fill(o?i.ZERO:void 0),u=r.reduce((h,g,m)=>i.is0(g)?h:(l[m]=h,i.mul(h,g)),i.ONE),f=i.inv(u);return r.reduceRight((h,g,m)=>i.is0(g)?h:(l[m]=i.mul(h,l[m]),i.mul(h,g)),f),l}function yb(t,r){const o=t,i=(o.ORDER-wt)/pa,l=o.pow(r,i),u=o.eql(l,o.ONE),f=o.eql(l,o.ZERO),h=o.eql(l,o.neg(o.ONE));if(!u&&!f&&!h)throw new Error("invalid Legendre symbol result");return u?1:f?0:-1}function I5(t,r){if(r!==void 0&&Lx(r),t<=Et)throw new Error("invalid n length: expected positive n, got "+t);if(r!==void 0&&r<1)throw new Error("invalid n length: expected positive bit length, got "+r);const o=R5(t);if(r!==void 0&&r<o)throw new Error(`invalid n length: expected bit length (${o}) >= n.length (${r})`);const i=r!==void 0?r:o,l=Math.ceil(i/8);return{nBitLength:i,nByteLength:l}}const bb=new WeakMap;class Gx{ORDER;BITS;BYTES;isLE;ZERO=Et;ONE=wt;_lengths;_mod;constructor(r,o={}){if(r<=wt)throw new Error("invalid field: expected ORDER > 1, got "+r);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}=I5(r,i);if(u>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=r,this.BITS=l,this.BYTES=u,Object.freeze(this)}create(r){return at(r,this.ORDER)}isValid(r){if(typeof r!="bigint")throw new TypeError("invalid field element: expected bigint, got "+typeof r);return Et<=r&&r<this.ORDER}is0(r){return r===Et}isValidNot0(r){return!this.is0(r)&&this.isValid(r)}isOdd(r){return(r&wt)===wt}neg(r){return at(-r,this.ORDER)}eql(r,o){return r===o}sqr(r){return at(r*r,this.ORDER)}add(r,o){return at(r+o,this.ORDER)}sub(r,o){return at(r-o,this.ORDER)}mul(r,o){return at(r*o,this.ORDER)}pow(r,o){return U5(this,r,o)}div(r,o){return at(r*vb(o,this.ORDER),this.ORDER)}sqrN(r){return r*r}addN(r,o){return r+o}subN(r,o){return r-o}mulN(r,o){return r*o}inv(r){return vb(r,this.ORDER)}sqrt(r){let o=bb.get(this);return o||bb.set(this,o=H5(this.ORDER)),o(this,r)}toBytes(r){return this.isLE?Ux(r,this.BYTES):Wx(r,this.BYTES)}fromBytes(r,o=!1){Pr(r);const{_lengths:i,BYTES:l,isLE:u,ORDER:f,_mod:h}=this;if(i){if(r.length<1||!i.includes(r.length)||r.length>l)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+r.length);const m=new Uint8Array(l);m.set(r,u?0:m.length-r.length),r=m}if(r.length!==l)throw new Error("Field.fromBytes: expected "+l+" bytes, got "+r.length);let g=u?Ks(r):A5(r);if(h&&(g=at(g,f)),!o&&!this.isValid(g))throw new Error("invalid field element: outside of range 0..ORDER");return g}invertBatch(r){return Vx(this,r)}cmov(r,o,i){return Hx(i,"condition"),i?o:r}}Object.freeze(Gx.prototype);function Vm(t,r={}){return new Gx(t,r)}const ac=BigInt(0),om=BigInt(1);function wb(t,r){const o=r.negate();return t?o:r}function Af(t,r){const o=Vx(t.Fp,r.map(i=>i.Z));return r.map((i,l)=>t.fromAffine(i.toAffine(o[l])))}function Xx(t,r){if(!Number.isSafeInteger(t)||t<=0||t>r)throw new Error("invalid window size, expected [1.."+r+"], got W="+t)}function _f(t,r){Xx(t,r);const o=Math.ceil(r/t)+1,i=2**(t-1),l=2**t,u=O5(t),f=BigInt(t);return{windows:o,windowSize:i,mask:u,maxNumber:l,shiftBy:f}}function xb(t,r,o){const{windowSize:i,mask:l,maxNumber:u,shiftBy:f}=o;let h=Number(t&l),g=t>>f;h>i&&(h-=u,g+=om);const m=r*i,y=m+Math.abs(h)-1,v=h===0,x=h<0,S=r%2!==0;return{nextN:g,offset:y,isZero:v,isNeg:x,isNegF:S,offsetF:m}}const jf=new WeakMap,Zx=new WeakMap;function Rf(t){return Zx.get(t)||1}function kb(t){if(t!==ac)throw new Error("invalid wNAF")}class q5{BASE;ZERO;Fn;bits;constructor(r,o){this.BASE=r.BASE,this.ZERO=r.ZERO,this.Fn=r.Fn,this.bits=o}_unsafeLadder(r,o,i=this.ZERO){let l=r;for(;o>ac;)o&om&&(i=i.add(l)),l=l.double(),o>>=om;return i}precomputeWindow(r,o){const{windows:i,windowSize:l}=_f(o,this.bits),u=[];let f=r,h=f;for(let g=0;g<i;g++){h=f,u.push(h);for(let m=1;m<l;m++)h=h.add(f),u.push(h);f=h.double()}return u}wNAF(r,o,i){if(!this.Fn.isValid(i))throw new Error("invalid scalar");let l=this.ZERO,u=this.BASE;const f=_f(r,this.bits);for(let h=0;h<f.windows;h++){const{nextN:g,offset:m,isZero:y,isNeg:v,isNegF:x,offsetF:S}=xb(i,h,f);i=g,y?u=u.add(wb(x,o[S])):l=l.add(wb(v,o[m]))}return kb(i),{p:l,f:u}}wNAFUnsafe(r,o,i,l=this.ZERO){const u=_f(r,this.bits);for(let f=0;f<u.windows&&i!==ac;f++){const{nextN:h,offset:g,isZero:m,isNeg:y}=xb(i,f,u);if(i=h,!m){const v=o[g];l=l.add(y?v.negate():v)}}return kb(i),l}getPrecomputes(r,o,i){let l=jf.get(o);return l||(l=this.precomputeWindow(o,r),r!==1&&(typeof i=="function"&&(l=i(l)),jf.set(o,l))),l}cached(r,o,i){const l=Rf(r);return this.wNAF(l,this.getPrecomputes(l,r,i),o)}unsafe(r,o,i,l){const u=Rf(r);return u===1?this._unsafeLadder(r,o,l):this.wNAFUnsafe(u,this.getPrecomputes(u,r,i),o,l)}createCache(r,o){Xx(o,this.bits),Zx.set(r,o),jf.delete(r)}hasCache(r){return Rf(r)!==1}}function Sb(t,r,o){if(r){if(r.ORDER!==t)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return W5(r),r}else return Vm(t,{isLE:o})}function P5(t,r,o={},i){if(i===void 0&&(i=t==="edwards"),!r||typeof r!="object")throw new Error(`expected valid ${t} CURVE object`);for(const g of["p","n","h"]){const m=r[g];if(!(typeof m=="bigint"&&m>ac))throw new Error(`CURVE.${g} must be positive bigint`)}const l=Sb(r.p,o.Fp,i),u=Sb(r.n,o.Fn,i),h=["Gx","Gy","a","d"];for(const g of h)if(!l.isValid(r[g]))throw new Error(`CURVE.${g} must be valid field element of CURVE.Fp`);return r=Object.freeze(Object.assign({},r)),{CURVE:r,Fp:l,Fn:u}}function F5(t,r){return function(i){const l=t(i);return{secretKey:l,publicKey:r(l)}}}const Hr=BigInt(0),Lt=BigInt(1),Of=BigInt(2),K5=BigInt(8);function Y5(t,r,o,i){const l=t.sqr(o),u=t.sqr(i),f=t.add(t.mul(r.a,l),u),h=t.add(t.ONE,t.mul(r.d,t.mul(l,u)));return t.eql(f,h)}function $5(t,r={}){const o=r,i=P5("edwards",t,o,o.FpFnLE),{Fp:l,Fn:u}=i;let f=i.CURVE;const{h}=f;Ym(o,{},{uvRatio:"function"});const g=Of<<BigInt(u.BYTES*8)-Lt,m=k=>l.create(k),y=o.uvRatio===void 0?(k,C)=>{try{return{isValid:!0,value:l.sqrt(l.div(k,C))}}catch{return{isValid:!1,value:Hr}}}:o.uvRatio;if(!Y5(l,f,f.Gx,f.Gy))throw new Error("bad curve params: generator point");function v(k,C,E=!1){const A=E?Lt:Hr;return rc("coordinate "+k,C,A,g),C}function x(k){if(!(k instanceof S))throw new Error("EdwardsPoint expected")}class S{static BASE=new S(f.Gx,f.Gy,Lt,m(f.Gx*f.Gy));static ZERO=new S(Hr,Lt,Lt,Hr);static Fp=l;static Fn=u;X;Y;Z;T;constructor(C,E,A,j){this.X=v("x",C),this.Y=v("y",E),this.Z=v("z",A,!0),this.T=v("t",j),Object.freeze(this)}static CURVE(){return f}static fromAffine(C){if(C instanceof S)throw new Error("extended point not allowed");const{x:E,y:A}=C||{};return v("x",E),v("y",A),new S(E,A,Lt,m(E*A))}static fromBytes(C,E=!1){const A=l.BYTES,{a:j,d:N}=f;C=Ys(Pr(C,A,"point")),Hx(E,"zip215");const O=Ys(C),D=C[A-1];O[A-1]=D&-129;const L=Ks(O),B=E?g:l.ORDER;rc("point.y",L,Hr,B);const P=m(L*L),re=m(P-Lt),ee=m(N*P-j);let{isValid:Y,value:J}=y(re,ee);if(!Y)throw new Error("bad point: invalid y coordinate");const G=(J&Lt)===Lt,V=(D&128)!==0;if(!E&&J===Hr&&V)throw new Error("bad point: x=0 and x_0=1");return V!==G&&(J=m(-J)),S.fromAffine({x:J,y:L})}static fromHex(C,E=!1){return S.fromBytes(C5(C),E)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(C=8,E=!0){return T.createCache(this,C),E||this.multiply(Of),this}assertValidity(){const C=this,{a:E,d:A}=f;if(C.is0())throw new Error("bad point: ZERO");const{X:j,Y:N,Z:O,T:D}=C,L=m(j*j),B=m(N*N),P=m(O*O),re=m(P*P),ee=m(L*E),Y=m(P*m(ee+B)),J=m(re+m(A*m(L*B)));if(Y!==J)throw new Error("bad point: equation left != right (1)");const G=m(j*N),V=m(O*D);if(G!==V)throw new Error("bad point: equation left != right (2)")}equals(C){x(C);const{X:E,Y:A,Z:j}=this,{X:N,Y:O,Z:D}=C,L=m(E*D),B=m(N*j),P=m(A*D),re=m(O*j);return L===B&&P===re}is0(){return this.equals(S.ZERO)}negate(){return new S(m(-this.X),this.Y,this.Z,m(-this.T))}double(){const{a:C}=f,{X:E,Y:A,Z:j}=this,N=m(E*E),O=m(A*A),D=m(Of*m(j*j)),L=m(C*N),B=E+A,P=m(m(B*B)-N-O),re=L+O,ee=re-D,Y=L-O,J=m(P*ee),G=m(re*Y),V=m(P*Y),M=m(ee*re);return new S(J,G,M,V)}add(C){x(C);const{a:E,d:A}=f,{X:j,Y:N,Z:O,T:D}=this,{X:L,Y:B,Z:P,T:re}=C,ee=m(j*L),Y=m(N*B),J=m(D*A*re),G=m(O*P),V=m((j+N)*(L+B)-ee-Y),M=G-J,q=G+J,I=m(Y-E*ee),Z=m(V*M),F=m(q*I),R=m(V*I),W=m(M*q);return new S(Z,F,W,R)}subtract(C){return x(C),this.add(C.negate())}multiply(C){if(!u.isValidNot0(C))throw new RangeError("invalid scalar: expected 1 <= sc < curve.n");const{p:E,f:A}=T.cached(this,C,j=>Af(S,j));return Af(S,[E,A])[0]}multiplyUnsafe(C){if(!u.isValid(C))throw new RangeError("invalid scalar: expected 0 <= sc < curve.n");return C===Hr?S.ZERO:this.is0()||C===Lt?this:T.unsafe(this,C,E=>Af(S,E))}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){return T.unsafe(this,f.n).is0()}toAffine(C){const E=this;let A=C;const{X:j,Y:N,Z:O}=E,D=E.is0();A==null&&(A=D?K5:l.inv(O));const L=m(j*A),B=m(N*A),P=l.mul(O,A);if(D)return{x:Hr,y:Lt};if(P!==Lt)throw new Error("invZ was invalid");return{x:L,y:B}}clearCofactor(){return h===Lt?this:this.multiplyUnsafe(h)}toBytes(){const{x:C,y:E}=this.toAffine(),A=l.toBytes(E);return A[A.length-1]|=C&Lt?128:0,A}toHex(){return zx(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}const T=new q5(S,u.BITS);return u.BITS>=8&&S.BASE.precompute(8),Object.freeze(S.prototype),Object.freeze(S),S}class V5{static BASE;static ZERO;static Fp;static Fn;ep;constructor(r){this.ep=r}static fromBytes(r){gb()}static fromHex(r){gb()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(r){return this.ep.toAffine(r)}toHex(){return zx(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(r){return this.assertSame(r),this.init(this.ep.add(r.ep))}subtract(r){return this.assertSame(r),this.init(this.ep.subtract(r.ep))}multiply(r){return this.init(this.ep.multiply(r))}multiplyUnsafe(r){return this.init(this.ep.multiplyUnsafe(r))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(r,o){return this.ep.precompute(r,o),this}}const js=BigInt(0),po=BigInt(1),Rl=BigInt(2);function G5(t){return Ym(t,{P:"bigint",type:"string",adjustScalarBytes:"function",powPminus2:"function"},{randomBytes:"function"}),Object.freeze({...t})}function X5(t){const r=G5(t),{P:o,type:i,adjustScalarBytes:l,powPminus2:u,randomBytes:f}=r,h=i==="x25519";if(!h&&i!=="x448")throw new Error("invalid type");const g=f===void 0?T5:f,m=h?255:448,y=h?32:56,v=BigInt(h?9:5),x=BigInt(h?121665:39081),S=h?Rl**BigInt(254):Rl**BigInt(447),T=h?BigInt(8)*Rl**BigInt(251)-po:BigInt(4)*Rl**BigInt(445)-po,k=S+T+po,C=G=>at(G,o),E=A(v);function A(G){return Ux(C(G),y)}function j(G){const V=Ys(Pr(G,y,"uCoordinate"));return h&&(V[31]&=127),C(Ks(V))}function N(G){return Ks(l(Ys(Pr(G,y,"scalar"))))}function O(G,V){const M=re(j(V),N(G));if(M===js)throw new Error("invalid private or public key received");return A(M)}function D(G){return O(G,E)}const L=D,B=O;function P(G,V,M){const q=C(G*(V-M));return V=C(V-q),M=C(M+q),{x_2:V,x_3:M}}function re(G,V){rc("u",G,js,o),rc("scalar",V,S,k);const M=V,q=G;let I=po,Z=js,F=G,R=po,W=js;for(let ae=BigInt(m-1);ae>=js;ae--){const fe=M>>ae&po;W^=fe,{x_2:I,x_3:F}=P(W,I,F),{x_2:Z,x_3:R}=P(W,Z,R),W=fe;const me=I+Z,ce=C(me*me),le=I-Z,ie=C(le*le),ue=ce-ie,pe=F+R,Ne=F-R,Ce=C(Ne*me),Se=C(pe*le),Je=Ce+Se,mt=Ce-Se;F=C(Je*Je),R=C(q*C(mt*mt)),I=C(ce*ie),Z=C(ue*(ce+C(x*ue)))}({x_2:I,x_3:F}=P(W,I,F)),{x_2:Z,x_3:R}=P(W,Z,R);const ne=u(Z);return C(I*ne)}const ee={secretKey:y,publicKey:y,seed:y},Y=G=>(G=G===void 0?g(y):G,Pr(G,ee.seed,"seed"),G),J={randomSecretKey:Y};return Object.freeze(ee),Object.freeze(J),Object.freeze({keygen:F5(Y,L),getSharedSecret:B,getPublicKey:L,scalarMult:O,scalarMultBase:D,utils:J,GuBytes:E.slice(),lengths:ee})}const Z5=BigInt(0),Ws=BigInt(1),Eb=BigInt(2),Q5=BigInt(3),J5=BigInt(5),e6=BigInt(8),Co=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),Qx={p:Co,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:e6,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function Jx(t){const r=BigInt(10),o=BigInt(20),i=BigInt(40),l=BigInt(80),u=Co,h=t*t%u*t%u,g=yn(h,Eb,u)*h%u,m=yn(g,Ws,u)*t%u,y=yn(m,J5,u)*m%u,v=yn(y,r,u)*y%u,x=yn(v,o,u)*v%u,S=yn(x,i,u)*x%u,T=yn(S,l,u)*S%u,k=yn(T,l,u)*S%u,C=yn(k,r,u)*y%u;return{pow_p_5_8:yn(C,Eb,u)*t%u,b2:h}}function t6(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}const sm=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function e1(t,r){const o=Co,i=at(r*r*r,o),l=at(i*i*r,o),u=Jx(t*l).pow_p_5_8;let f=at(t*i*u,o);const h=at(r*f*f,o),g=f,m=at(f*sm,o),y=h===t,v=h===at(-t,o),x=h===at(-t*sm,o);return y&&(f=g),(v||x)&&(f=m),fa(f,o)&&(f=at(-f,o)),{isValid:y||v,value:f}}const ho=$5(Qx,{uvRatio:e1}),ma=ho.Fp,n6=ho.Fn,im=(()=>{const t=Co;return X5({P:t,type:"x25519",powPminus2:r=>{const{pow_p_5_8:o,b2:i}=Jx(r);return at(yn(o,Q5,t)*i,t)},adjustScalarBytes:t6})})(),Cb=sm,r6=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),Tb=t=>e1(Ws,t),a6=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),o6=t=>ma.create(Ks(t)&a6);class Gt extends V5{static BASE=new Gt(ho.BASE);static ZERO=new Gt(ho.ZERO);static Fp=ma;static Fn=n6;constructor(r){super(r)}static fromAffine(r){return new Gt(ho.fromAffine(r))}assertSame(r){if(!(r instanceof Gt))throw new Error("RistrettoPoint expected")}init(r){return new Gt(r)}static fromBytes(r){lr(r,32);const{a:o,d:i}=Qx,l=Co,u=N=>ma.create(N),f=o6(r);if(!_5(ma.toBytes(f),r)||fa(f,l))throw new Error("invalid ristretto255 encoding 1");const h=u(f*f),g=u(Ws+o*h),m=u(Ws-o*h),y=u(g*g),v=u(m*m),x=u(o*i*y-v),{isValid:S,value:T}=Tb(u(x*v)),k=u(T*m),C=u(T*k*x);let E=u((f+f)*k);fa(E,l)&&(E=u(-E));const A=u(g*C),j=u(E*A);if(!S||fa(j,l)||A===Z5)throw new Error("invalid ristretto255 encoding 2");return new Gt(new ho(E,A,Ws,j))}static fromHex(r){return Gt.fromBytes(Km(r))}toBytes(){let{X:r,Y:o,Z:i,T:l}=this.ep;const u=Co,f=C=>ma.create(C),h=f(f(i+o)*f(i-o)),g=f(r*o),m=f(g*g),{value:y}=Tb(f(h*m)),v=f(y*h),x=f(y*g),S=f(v*x*l);let T;if(fa(l*S,u)){let C=f(o*Cb),E=f(r*Cb);r=C,o=E,T=f(v*r6)}else T=x;fa(r*S,u)&&(o=f(-o));let k=f((i-o)*T);return fa(k,u)&&(k=f(-k)),ma.toBytes(k)}equals(r){this.assertSame(r);const{X:o,Y:i}=this.ep,{X:l,Y:u}=r.ep,f=m=>ma.create(m),h=f(o*u)===f(i*l),g=f(i*u)===f(o*l);return h||g}is0(){return this.equals(Gt.ZERO)}}Object.freeze(Gt.BASE);Object.freeze(Gt.ZERO);Object.freeze(Gt.prototype);Object.freeze(Gt);class Nb{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(r,o){if(Pm(r),lr(o,void 0,"key"),this.iHash=r.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?r.create().update(o).digest():o);for(let u=0;u<l.length;u++)l[u]^=54;this.iHash.update(l),this.oHash=r.create();for(let u=0;u<l.length;u++)l[u]^=106;this.oHash.update(l),Fs(l)}update(r){return tc(this),this.iHash.update(r),this}digestInto(r){tc(this),Dx(r,this),this.finished=!0;const o=r.subarray(0,this.outputLen);this.iHash.digestInto(o),this.oHash.update(o),this.oHash.digestInto(o),this.destroy()}digest(){const r=new Uint8Array(this.oHash.outputLen);return this.digestInto(r),r}_cloneInto(r){r||=Object.create(Object.getPrototypeOf(this),{});const{oHash:o,iHash:i,finished:l,destroyed:u,blockLen:f,outputLen:h}=this;return r=r,r.finished=l,r.destroyed=u,r.blockLen=f,r.outputLen=h,r.oHash=o._cloneInto(r.oHash),r.iHash=i._cloneInto(r.iHash),r}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const t1=(()=>{const t=((r,o,i)=>new Nb(r,o).update(i).digest());return t.create=(r,o)=>new Nb(r,o),t})();function s6(t,r,o){return Pm(t),o===void 0&&(o=new Uint8Array(t.outputLen)),t1(t,o,r)}const Df=Uint8Array.of(0),Ab=Uint8Array.of();function i6(t,r,o,i=32){Pm(t),Eo(i,"length"),lr(r,void 0,"prk");const l=t.outputLen;if(r.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:lr(o,void 0,"info");const f=new Uint8Array(u*l),h=t1.create(t,r),g=h._cloneInto(),m=new Uint8Array(h.outputLen);for(let y=0;y<u;y++)Df[0]=y+1,g.update(y===0?Ab:m).update(o).update(Df).digestInto(m),f.set(m,l*y),h._cloneInto(g);return h.destroy(),g.destroy(),Fs(m,Df),f.slice(0,i)}const $s=(t,r,o,i,l)=>i6(t,s6(t,r,o),i,l),wn=2,_b=32,l6=32,Ir=32,c6=24,lm=32,n1=32,u6=6,cm=32,r1="hive/remote/v1/pair",d6="hive/remote/v1/key/daemon->device",f6="hive/remote/v1/key/device->daemon",m6="hive/remote/v1/sas",p6="hive/remote/v1/transcript",h6="hive/remote/v2/conn/daemon->device",g6="hive/remote/v2/conn/device->daemon",v6="hive/remote/v2/conn-salt",y6=1,b6=2,w6=4,x6=8,a1=12,k6=new TextEncoder;function Zt(t){return k6.encode(t)}function Mn(...t){let r=0;for(const l of t)r+=l.length;const o=new Uint8Array(r);let i=0;for(const l of t)o.set(l,i),i+=l.length;return o}function Tc(t){if(!Number.isInteger(t)||t<0||t>4294967295)throw new RangeError(`u32be out of range: ${t}`);const r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,t),r}function Gm(t,r=0){if(t.length<r+4)throw new RangeError("u32beRead: buffer too short");return new DataView(t.buffer,t.byteOffset,t.byteLength).getUint32(r)}function S6(t){if(!Number.isSafeInteger(t)||t<0)throw new RangeError(`u64be out of range: ${t}`);const r=new Uint8Array(8),o=Math.floor(t/4294967296),i=t>>>0,l=new DataView(r.buffer);return l.setUint32(0,o),l.setUint32(4,i),r}function oc(t){if(t.length>65535)throw new RangeError("lp: value too long for u16 length prefix");const r=new Uint8Array(2+t.length);return new DataView(r.buffer).setUint16(0,t.length),r.set(t,2),r}function mn(t,r,o){if(t.length!==r)throw new RangeError(`${o} must be ${r} bytes, got ${t.length}`)}const bn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",E6=(()=>{const t=new Int16Array(128).fill(-1);for(let r=0;r<bn.length;r++)t[bn.charCodeAt(r)]=r;return t})();function ha(t){let r="",o=0;for(;o+3<=t.length;o+=3){const l=t[o],u=t[o+1],f=t[o+2];r+=bn[l>>2],r+=bn[(l&3)<<4|u>>4],r+=bn[(u&15)<<2|f>>6],r+=bn[f&63]}const i=t.length-o;if(i===1){const l=t[o];r+=bn[l>>2],r+=bn[(l&3)<<4]}else if(i===2){const l=t[o],u=t[o+1];r+=bn[l>>2],r+=bn[(l&3)<<4|u>>4],r+=bn[(u&15)<<2]}return r}function Vs(t){if(t.length%4===1)throw new RangeError("invalid base64url");const r=t.length>>2,o=t.length&3,i=r*3+(o===0?0:o-1),l=new Uint8Array(i),u=g=>{if(g>=128)throw new RangeError("invalid base64url");const m=E6[g];if(m<0)throw new RangeError("invalid base64url");return m};let f=0,h=0;for(;h+4<=t.length;h+=4){const g=u(t.charCodeAt(h)),m=u(t.charCodeAt(h+1)),y=u(t.charCodeAt(h+2)),v=u(t.charCodeAt(h+3));l[f++]=g<<2|m>>4,l[f++]=(m&15)<<4|y>>2,l[f++]=(y&3)<<6|v}if(o===2){const g=u(t.charCodeAt(h)),m=u(t.charCodeAt(h+1));l[f++]=g<<2|m>>4}else if(o===3){const g=u(t.charCodeAt(h)),m=u(t.charCodeAt(h+1)),y=u(t.charCodeAt(h+2));l[f++]=g<<2|m>>4,l[f++]=(m&15)<<4|y>>2}return l}function C6(t){return JSON.stringify(t)}function T6(t){let r;try{r=JSON.parse(t)}catch{throw new RangeError("invalid pairing payload: not JSON")}if(typeof r!="object"||r===null)throw new RangeError("invalid pairing payload: not an object");const o=r;if(o.v!==wn)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(Vs(o.pairingSecret).length!==lm)throw new RangeError(`pairingSecret must be ${lm} bytes`);return{v:o.v,gatewayUrl:o.gatewayUrl,daemonId:o.daemonId,pairingSecret:o.pairingSecret}}function N6(){const t=im.utils.randomSecretKey(),r=im.getPublicKey(t);return{secretKey:t,publicKey:r}}function A6(t){return{secretKey:ha(t.secretKey),publicKey:ha(t.publicKey)}}function _6(){return jx(n1)}function j6(t){mn(t.pairingSecret,lm,"pairingSecret"),mn(t.sessionSalt,n1,"sessionSalt"),mn(t.daemonPublicKey,_b,"daemonPublicKey"),mn(t.devicePublicKey,_b,"devicePublicKey");const r=im.getSharedSecret(t.localSecretKey,t.peerPublicKey);mn(r,l6,"sharedSecret");const o=Mn(t.pairingSecret,r),i=Mn(Zt(p6),Uint8Array.of(0),Tc(t.ids.protocolVersion),oc(Zt(t.ids.daemonId)),oc(Zt(t.ids.deviceId)),t.daemonPublicKey,t.devicePublicKey,t.sessionSalt),l=bo(i),u=Mn(Zt(r1),t.sessionSalt),f=$s(bo,o,u,Mn(Zt(d6),Uint8Array.of(0),l),Ir),h=$s(bo,o,u,Mn(Zt(f6),Uint8Array.of(0),l),Ir),g=M6(l,t.ids);return{d2p:f,p2d:h,sas:g,transcriptHash:l}}function R6(t){return j6({localSecretKey:t.deviceSecretKey,peerPublicKey:t.daemonPublicKey,daemonPublicKey:t.daemonPublicKey,devicePublicKey:t.devicePublicKey,pairingSecret:t.pairingSecret,sessionSalt:t.sessionSalt,ids:t.ids})}function O6(){return jx(cm)}function D6(t){mn(t.rootD2p,Ir,"rootD2p"),mn(t.rootP2d,Ir,"rootP2d"),mn(t.phoneConnSalt,cm,"phoneConnSalt"),mn(t.daemonConnSalt,cm,"daemonConnSalt");const r=Mn(Zt(v6),t.phoneConnSalt,t.daemonConnSalt),o=Mn(Uint8Array.of(0),Tc(t.ids.protocolVersion),oc(Zt(t.ids.daemonId)),oc(Zt(t.ids.deviceId)),t.phoneConnSalt,t.daemonConnSalt),i=$s(bo,t.rootD2p,r,Mn(Zt(h6),o),Ir),l=$s(bo,t.rootP2d,r,Mn(Zt(g6),o),Ir);return{d2p:i,p2d:l}}function M6(t,r){mn(t,32,"transcriptHash");const o=$s(bo,t,Zt(r1),Mn(Zt(m6),Uint8Array.of(0),Tc(r.protocolVersion)),4);return(Gm(o)%1e6).toString().padStart(u6,"0")}function o1(t,r,o){if(!Number.isInteger(r)||r<0||r>4294967295)throw new RangeError(`streamId out of range: ${r}`);const i=new Uint8Array(c6);return i[0]=t==="d2p"?y6:b6,i.set(Tc(r),1),i.set(S6(o),8),i}function s1(t){if(t.length<a1)throw new RangeError("headerBytes too short");return Gm(t,w6)}function Nc(t){if(t.length<a1)throw new RangeError("headerBytes too short");return Gm(t,x6)}function L6(t){mn(t.key,Ir,"key");const r=s1(t.headerBytes),o=Nc(t.headerBytes),i=o1(t.direction,r,o);return Ox(t.key,i,t.headerBytes).encrypt(t.payload)}function z6(t){mn(t.key,Ir,"key");const r=s1(t.headerBytes),o=Nc(t.headerBytes),i=o1(t.direction,r,o);return Ox(t.key,i,t.headerBytes).decrypt(t.ciphertext)}function H6(t){return{direction:t,nextSeq:0}}function B6(t){return{direction:t,lastSeq:-1}}function W6(t,r){const o=Nc(r.headerBytes);if(o!==t.nextSeq)throw new RangeError(`header seq ${o} does not match sealer.nextSeq ${t.nextSeq}`);const i=L6({key:r.key,direction:t.direction,headerBytes:r.headerBytes,payload:r.payload}),l=t.nextSeq;return t.nextSeq+=1,{seq:l,ciphertext:i}}function U6(t,r){if(r.seq!==t.lastSeq+1)throw new RangeError("out-of-order or replayed frame");if(Nc(r.headerBytes)!==r.seq)throw new RangeError("out-of-order or replayed frame");const i=z6({key:r.key,direction:t.direction,headerBytes:r.headerBytes,ciphertext:r.ciphertext});return t.lastSeq=r.seq,i}const I6=(t,r)=>{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(r)}`},q6=t=>typeof t=="object"&&t!==null&&typeof t.t=="string",P6=2e4,F6=1e4;function K6(t,r,o){const i=o.generateKeyPair??N6,l=o.generateSalt??_6,u=o.heartbeatMs??P6,f=o.heartbeatDeadlineMs??F6;let h="idle",g=null,m=null,y=null,v=!1,x=null,S=null,T=null,k=null,C=null,E=null,A="",j="",N=null;const O=F=>{h=F,r.onPhase(F)},D=()=>{S!==null&&(clearTimeout(S),S=null)},L=()=>{x!==null&&(clearInterval(x),x=null),D()},B=F=>{L(),x=setInterval(()=>{if(!v){try{F.send(Nx)}catch{}S===null&&(S=setTimeout(()=>{if(S=null,!v){try{F.close()}catch{}V()}},f))}},u)},P=()=>{T?.secretKey.fill(0),k?.fill(0),C&&(C.d2p.fill(0),C.p2d.fill(0),C.transcriptHash.fill(0)),T=null,k=null,C=null},re=F=>{if(!v){v=!0,L(),P();try{y?.close()}catch{}y=null,N?.(F)}},ee=(F,R)=>{if(v)return;const W={code:F,message:R};O(F==="rejected"?"rejected":F==="expired"?"expired":"error"),r.onFailure(W),re({ok:!1,failure:W})},Y=F=>{if(h!=="connecting"&&h!=="handshaking")return;if(F.protocolVersion!==wn){ee("protocol_version",`unsupported pairing protocol version ${F.protocolVersion}`);return}if(!T||!k){ee("pair_ack_invalid","pair-ack arrived before the phone keypair was ready");return}let R;try{R=Vs(F.daemonPublicKey)}catch{ee("pair_ack_invalid","pair-ack daemonPublicKey is not valid base64url");return}const W={daemonId:F.daemonId,deviceId:F.deviceId,protocolVersion:F.protocolVersion};try{C=R6({deviceSecretKey:T.secretKey,daemonPublicKey:R,devicePublicKey:T.publicKey,pairingSecret:I,sessionSalt:k,ids:W})}catch(ne){ee("pair_ack_invalid",`handshake derivation failed: ${ne.message}`);return}m=F.deviceId,j=F.daemonId,E=F.daemonPublicKey,g=C.sas,O("awaiting_confirm"),r.onSas(g)},J=()=>{if(!v){if(!C||!T||!m){ee("pair_ack_invalid","cannot mint before the handshake produced a session");return}O("minting"),o.mintSession(A,{daemonId:j,deviceId:m}).then(()=>{if(v||!T||!E||!m||!C)return;const F={v:2,gatewayUrl:A,daemonId:j,deviceId:m,deviceKeyPair:A6(T),daemonPublicKey:E,rootKeys:{d2p:ha(C.d2p),p2d:ha(C.p2d)},protocolVersion:wn,pairedAt:(o.now??Date.now)()};o.store.save(F);const R=m;O("paired"),re({ok:!0,deviceId:R})}).catch(F=>{F.status===403?ee("mint_forbidden","gateway refused to mint a device session (not confirmed)"):ee("mint_failed",`device session mint failed: ${F.message??"unknown"}`)})}},G=F=>{if(h==="awaiting_confirm"){if(!C||!T||!m||F.deviceId!==m){ee("pair_ack_invalid","confirmed for an unexpected device");return}J()}},V=()=>{if(!v){if(h==="awaiting_confirm"){J();return}h!=="minting"&&ee("socket_closed","pairing socket closed before the device was paired")}},M=F=>{if(v||typeof F!="string")return;if(F===Ax){D();return}let R;try{R=JSON.parse(F)}catch{return}if(q6(R))switch(h==="connecting"&&R.t==="pair-ack"&&O("handshaking"),R.t){case"pair-ack":Y(R);break;case"confirmed":G(R);break;case"rejected":{const W=R.reason;W==="expired"||W==="pairing_expired"?ee("expired","pairing code expired; generate a new pairing code"):ee("rejected",W??"pairing rejected at the desktop")}break}},q=T6(t),I=Vs(q.pairingSecret);return A=q.gatewayUrl,j=q.daemonId,{get phase(){return h},get sas(){return g},get deviceId(){return m},start:()=>v?Promise.resolve({ok:!1,failure:{code:"cancelled",message:"already settled"}}):new Promise(F=>{N=F,T=i(),k=l(),O("connecting");const R=I6(q.gatewayUrl,q.daemonId);try{y=o.openSocket(R)}catch(W){ee("socket_closed",`failed to open pairing socket: ${W.message}`);return}y.addEventListener("open",()=>{if(v||!y||!T||!k)return;B(y);const W={t:"hello",devicePublicKey:ha(T.publicKey),sessionSalt:ha(k),...o.proposedName?{proposedName:o.proposedName}:{},...o.boundJti?{boundJti:o.boundJti}:{}};y?.send(JSON.stringify(W))}),y.addEventListener("message",W=>{M(W.data)}),y.addEventListener("close",V),y.addEventListener("error",V)}),cancel:()=>{v||(O("rejected"),ee("cancelled","pairing cancelled"))},dispose:()=>{v?P():re({ok:!1,failure:{code:"cancelled",message:"disposed"}})}}}const Y6=t=>async(r,o)=>{const i=await t(`${r}/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 $6(t){const r=t.fetchImpl??globalThis.fetch.bind(globalThis),o=t.gatewayBaseUrl??window.location.origin,i=t.redirect??(T=>window.location.assign(T)),l=t.createPairing??K6,u=t.mintSession??Y6(r);let f=t.authProvider??"github",h="login",g=null;const m=T=>{h=T,t.onPhase?.(T)},y=T=>t.store.load(o,T),v=async T=>{T&&(f=T);const k=await r(`${o}/pair/machines`,{credentials:"include"});if(k.status===401){const A=encodeURIComponent(window.location.pathname+window.location.search);return m("login"),i(`${o}/auth/${f}?redirect=${A}`),{daemons:[],selfDeviceId:null}}if(!k.ok)throw new Error(`Failed to load machines: ${k.status}`);const C=await k.json(),E=C.daemons.map(A=>({id:A.id,name:A.name,lastSeen:A.lastSeen,revoked:A.revoked,online:A.online}));return m("machines"),{daemons:E,selfDeviceId:C.self.deviceId}},x=T=>{m("pairing");const C=l(T,{onPhase:E=>t.onPairingPhase?.(E),onSas:E=>t.onPairingSas?.(E),onFailure:E=>t.onPairingFailure?.(E)},{openSocket:(E,A)=>new WebSocket(E,A),store:t.store,mintSession:u,...t.proposedName?{proposedName:t.proposedName}:{},...t.boundJti?{boundJti:t.boundJti}:{}});return g=C,C.start()};return{get phase(){return h},get pairingClient(){return g},loadMachines:v,selectDaemon:async(T,k)=>{g=null;const C=y(T);if(C&&!k){const N=await t.connectTransport({daemonId:T,deviceId:C.deviceId,stored:C});return N.ok?(m("connected"),N):(!N.ok&&N.failure.code==="relay_revoked"&&t.store.clear(o,T),m("selecting"),N)}if(m("selecting"),!k)return{ok:!1,failure:{code:"needs_pairing",message:"this device is not paired with that computer — enter its pairing code first"}};const E=await x(k);if(!E.ok)return E;const A=y(T),j=await t.connectTransport({daemonId:T,deviceId:E.deviceId,stored:A});return j.ok?(m("connected"),j):(j.failure.code==="relay_revoked"&&t.store.clear(o,T),m("selecting"),j)}}}const i1="0123456789ABCDEFGHJKMNPQRSTVWXYZ",V6=12,G6="hive-remote-pairing-code-v1:",X6=t=>{const r=t.trim().toUpperCase().replace(/[\s-]+/g,"").replace(/O/g,"0").replace(/[IL]/g,"1");if(r.length!==V6)return null;for(const o of r)if(!i1.includes(o))return null;return r},Z6=new TextEncoder,Q6=t=>new URL(t).origin,J6=async t=>{const r=X6(t.code);if(!r)return null;const o=await crypto.subtle.digest("SHA-256",Z6.encode(`${G6}${r}`));return C6({v:wn,gatewayUrl:Q6(t.gatewayUrl),daemonId:t.daemonId,pairingSecret:ha(new Uint8Array(o))})},eD="hive.device-session.v2",tD="hive.device-session.v1",Mf=(t,r)=>`${eD}:${t}:${r}`,jb=(t,r)=>`${tD}:${t}:${r}`,nD=t=>{if(typeof t!="object"||t===null)return!1;const r=t;if(r.v!==2||typeof r.gatewayUrl!="string"||typeof r.daemonId!="string"||typeof r.deviceId!="string"||typeof r.daemonPublicKey!="string"||typeof r.protocolVersion!="number"||typeof r.pairedAt!="number")return!1;const o=r.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=r.rootKeys;if(typeof l!="object"||l===null)return!1;const u=l;return typeof u.d2p=="string"&&typeof u.p2d=="string"},rD=(t=globalThis.localStorage??null)=>({load:(r,o)=>{if(!t)return null;t.getItem(jb(r,o))!==null&&t.removeItem(jb(r,o));const i=t.getItem(Mf(r,o));if(i===null)return null;try{const l=JSON.parse(i);return nD(l)?l:null}catch{return null}},save:r=>{t&&t.setItem(Mf(r.gatewayUrl,r.daemonId),JSON.stringify(r))},clear:(r,o)=>{t&&t.removeItem(Mf(r,o))}}),l1=()=>{const t=window.location.hostname;return!(t==="127.0.0.1"||t==="localhost"||t==="[::1]"||t==="::1")},c1=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}},aD=(t,r)=>{const o=c1(r);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}},oD=t=>t==="select_failed"?"connect.error.selectFailed":t==="invalid_code"?"connect.error.invalidCode":t==="relay_revoked"?"connect.machines.revokedHint":null,sD=t=>{const r=Math.floor((Date.now()-t)/1e3);if(r<60)return null;const o=Math.floor(r/60);if(o<60)return`${o}m`;const i=Math.floor(o/60);return i<24?`${i}h`:`${Math.floor(i/24)}d`},iD={O:"0",I:"1",L:"1"},lD=t=>{const r=t.toUpperCase();let o="";for(const l of r){const u=iD[l]??l;if(i1.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("-")},cD=t=>t==="minting"||t==="paired",Ol=({children:t,className:r="",testId:o})=>c.jsx("div",{"data-testid":o,className:`connect-screen flex min-h-full flex-col p-6 ${r}`,children:t}),Rs=({primary:t,children:r,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:r}),uD=({flow:t,phase:r,machines:o,selectedMachineId:i,pairingPhase:l,pairingFailureCode:u,connectError:f,sas:h,isSigningIn:g=!1,pendingMachineId:m,loginError:y=!1,isGatewayBundle:v=!1,onRefreshMachines:x,onSelectProvider:S,onSelectMachine:T,onSubmitCode:k,onCancelPairing:C,onGoBack:E})=>{const{t:A}=ke(),[j,N]=b.useState(""),O=b.useRef(!1),D=aD(l,u),L=oD(f),B=c1(u)!=null,P=cD(l),re=h!=null&&h.length>0&&(l==="awaiting_confirm"||P),ee=V=>{const M=lD(V);N(M),M.replace(/-/g,"").length===12&&i&&!O.current&&(O.current=!0,k(i,M.trim()))},Y=j.replace(/-/g,"").length===12,J=!!i&&Y,G=v?"/brand/icon-192.png":"/logo.png";if(r==="login")return c.jsxs(Ol,{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:G,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:A("connect.login.heading")}),c.jsx("p",{className:"mt-2 text-sm text-ter",children:A("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:A("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:A("connect.login.signingIn")}):c.jsxs(c.Fragment,{children:[c.jsx(Rs,{primary:!0,testId:"connect-login-github",onClick:()=>S("github"),children:A("connect.login.github")}),c.jsx(Rs,{testId:"connect-login-google",onClick:()=>S("google"),children:A("connect.login.google")})]})})]});if(r==="machines"){const V=m!=null;return c.jsxs(Ol,{testId:"connect-machines",className:"gap-4",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("img",{src:G,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:A("connect.machines.heading")}),x?c.jsx("button",{type:"button","aria-label":A("common.refresh"),"data-testid":"connect-machines-refresh",onClick:x,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(gm,{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:A(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(Gd,{size:28})}),c.jsx("p",{"data-testid":"connect-machines-empty",className:"max-w-[280px] text-sm text-ter",children:A("connect.machines.empty")}),c.jsx("div",{className:"flex w-full max-w-[320px] flex-col gap-3 pt-2",children:c.jsx(Rs,{testId:"connect-machines-back",...E?{onClick:E}:{},children:A("connect.machines.back")})})]}):c.jsx("ul",{className:"flex flex-col gap-2.5",children:o.map(M=>{const q=m===M.id,I=!M.online||M.revoked||V;let Z,F="var(--text-tertiary)";if(M.revoked)Z=A("connect.machines.revoked"),F="var(--status-red)";else if(M.online)q?(Z=A("connect.machines.connecting"),F="var(--text-secondary)"):(Z=A("connect.machines.online"),F="var(--status-green)");else{const W=M.lastSeen!=null?sD(M.lastSeen):null;Z=W!=null?A("connect.machines.lastSeen",{ago:W}):A("connect.machines.offline")}const R=M.revoked?"var(--status-red)":M.online?"var(--status-green)":"var(--text-tertiary)";return c.jsx("li",{children:c.jsxs("button",{type:"button","data-testid":`connect-machine-${M.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:q?"var(--bg-2)":"var(--bg-1)",opacity:I&&!q?.55:1,cursor:I?"not-allowed":"pointer"},disabled:I,"aria-disabled":I,onClick:()=>T(M.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(Gd,{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:M.name}),c.jsx("span",{className:"mt-0.5 block text-xs",style:{color:F},children:Z})]}),q?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(lc,{size:18,className:"shrink-0 text-ter","aria-hidden":!0})]})},M.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:A("connect.machines.manageDevices")})}):null]})}if(r==="selecting"){const V=o.find(M=>M.id===i);return c.jsxs(Ol,{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:E,children:[c.jsx(pS,{size:16,"aria-hidden":!0}),A("connect.pair.back")]}),c.jsxs("div",{children:[c.jsx("h1",{className:"text-xl font-semibold text-pri",children:A("connect.pair.guideHeading")}),V?c.jsxs("p",{className:"mt-1 flex items-center gap-1.5 text-sm text-ter",children:[c.jsx(Gd,{size:14,"aria-hidden":!0,className:"shrink-0"}),c.jsx("span",{className:"truncate",children:V.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:A(L)}):null,c.jsx("ol",{className:"flex flex-col gap-3",children:["connect.pair.guideStep1","connect.pair.guideStep2","connect.pair.guideStep3"].map((M,q)=>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:q+1}),c.jsx("span",{className:"min-w-0 leading-relaxed",children:A(M)})]},M))}),c.jsxs("label",{className:"flex flex-col gap-2 text-xs uppercase tracking-wider text-ter",children:[A("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:j,onChange:M=>{O.current=!1,ee(M.target.value)},style:{fontSize:"18px",letterSpacing:"0.12em",minHeight:"52px"}})]}),c.jsx(Rs,{primary:!0,testId:"connect-code-submit",disabled:!J,onClick:()=>{i&&!O.current&&(O.current=!0,k(i,j.trim()))},children:A("connect.pair.submit")})]})}if(r==="pairing"){const V=B;return c.jsxs(Ol,{testId:"connect-pairing",className:"justify-center gap-6",children:[re&&!V?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:h}),c.jsx("p",{className:"text-center text-sm text-ter",style:{maxWidth:"280px"},children:A(P?"connect.pair.finalizing":"connect.pair.sasInstruction")}),P?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,D&&!re&&!V?c.jsx("p",{"data-testid":"connect-pairing-phase",className:"text-center text-sm text-ter",children:A(D)}):null,V&&D?c.jsx("p",{"data-testid":"connect-pairing-phase",className:"text-center text-sm",style:{color:"var(--status-red)"},children:A(D)}):null,P?null:c.jsx("div",{className:"flex flex-col gap-3",children:c.jsx(Rs,{primary:V,testId:"connect-pairing-cancel",onClick:()=>{N(""),O.current=!1,C?C():t.pairingClient?.cancel()},children:A(V?"connect.pair.startOver":"common.cancel")})})]})}return null},dD=()=>{if(typeof navigator>"u")return"Phone";const t=navigator.userAgent??"";let r="Phone";/iPad/.test(t)?r="iPad":/iPhone/.test(t)?r="iPhone":/Android/.test(t)&&(r="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"),`${r} · ${o}`.slice(0,48)},fD=({children:t,connectTransport:r,createFlow:o=$6,store:i,gatewayBaseUrl:l,isGateway:u=l1})=>{const f=u(),[h,g]=b.useState("login"),[m,y]=b.useState([]),[v,x]=b.useState(null),[S,T]=b.useState(void 0),[k,C]=b.useState(null),[E,A]=b.useState(null),[j,N]=b.useState(null),[O,D]=b.useState(null),[L,B]=b.useState(!1),[P,re]=b.useState(null),[ee,Y]=b.useState(!1),[J,G]=b.useState(!0),V=b.useMemo(()=>o({store:i??rD(),connectTransport:r,...l?{gatewayBaseUrl:l}:{},proposedName:dD(),onPhase:g,onPairingPhase:ce=>{C(ce),ce!=="error"&&ce!=="expired"&&ce!=="rejected"&&A(null)},onPairingSas:D,onPairingFailure:ce=>A(ce.code)}),[o,i,r,l]),M=b.useRef(V);M.current=V;const q=b.useRef(0),I=b.useCallback(()=>{C(null),A(null),D(null)},[]),Z=b.useCallback(()=>(q.current+=1,q.current),[]),F=b.useCallback(ce=>q.current===ce,[]);b.useEffect(()=>{let ce=!1;return M.current.loadMachines().then(({daemons:le,selfDeviceId:ie})=>{ce||(y(le),x(ie))}).catch(()=>{}).finally(()=>{ce||G(!1)}),()=>{ce=!0}},[]);const R=b.useCallback(()=>{const ce=Z();N(null),I(),B(!0),M.current.loadMachines().then(({daemons:le,selfDeviceId:ie})=>{F(ce)&&(y(le),x(ie))}).finally(()=>{F(ce)&&B(!1)})},[I,F,Z]),W=b.useCallback(ce=>{const le=Z();N(null),I(),Y(!1),B(!0),M.current.loadMachines(ce).then(({daemons:ie,selfDeviceId:ue})=>{F(le)&&(y(ie),x(ue))}).catch(()=>{F(le)&&Y(!0)}).finally(()=>{F(le)&&B(!1)})},[I,F,Z]),ne=b.useCallback(ce=>{const le=Z();T(ce),N(null),I(),re(ce),(async()=>{const ie=await M.current.selectDaemon(ce);F(le)&&(re(null),!ie.ok&&ie.failure.code==="select_failed"&&N("select_failed"),!ie.ok&&ie.failure.code==="relay_revoked"&&N("relay_revoked"))})()},[I,F,Z]),ae=b.useCallback((ce,le)=>{const ie=Z();N(null),I(),(async()=>{const ue=await J6({code:le,daemonId:ce,gatewayUrl:l??window.location.origin});if(!F(ie))return;if(!ue){N("invalid_code");return}const pe=await M.current.selectDaemon(ce,ue);F(ie)&&(!pe.ok&&pe.failure.code==="select_failed"&&N("select_failed"),!pe.ok&&pe.failure.code==="relay_revoked"&&N("relay_revoked"))})()},[I,l,F,Z]),fe=b.useCallback(()=>{Z(),M.current.pairingClient?.cancel(),I(),N(null),g(S?"selecting":"machines")},[I,Z,S]),me=b.useCallback(()=>{Z(),N(null),I(),g("machines")},[I,Z]);return h==="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(uD,{flow:V,phase:h,machines:m,selfDeviceId:v,...S?{selectedMachineId:S}:{},pairingPhase:k,pairingFailureCode:E,connectError:j,sas:O,isSigningIn:L,pendingMachineId:P,loginError:ee,isGatewayBundle:f,onRefreshMachines:R,onSelectProvider:W,onSelectMachine:ne,onSubmitCode:ae,onCancelPairing:fe,onGoBack:me})},mD=(t,r,o)=>t.mode==="tunnel"?c.jsx(o,{connectTransport:t.connectTransport,children:c.jsx(r,{})}):c.jsx(r,{}),$e={Open:1,Data:2,End:3,Reset:4,Ping:5,Ack:6},sc={Http:1,Ws:2},Ht={ProtocolError:1,VersionMismatch:4},Rb={INITIAL_WINDOW:256*1024,ACK_THRESHOLD:32*1024},ic=12,Ob=0,um=4294967295,u1=4294967295,pD=0,d1=1;class Bt extends Error{code;constructor(r,o){super(r),this.name="ProtocolError",this.code=o}}const hD=new TextEncoder,gD=new TextDecoder;function f1(t){return hD.encode(t)}function Ac(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function dm(t,r){if(!Number.isInteger(t)||t<0||t>u1)throw new RangeError(`${r} out of u32 range: ${t}`)}function m1(t){return t===$e.Open||t===$e.Data||t===$e.End||t===$e.Reset||t===$e.Ping||t===$e.Ack}function p1(t){return(t&-2)===0}function Db(t){if(t.version!==wn)throw new RangeError(`version must be ${wn}`);if(!m1(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===$e.Data){if(!p1(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");dm(t.streamId,"streamId"),dm(t.seq,"seq");const r=new Uint8Array(ic),o=Ac(r);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),r}function vD(t){if(t.length<ic)throw new Bt("header too short",Ht.ProtocolError);const r=Ac(t),o=r.getUint8(0);if(o!==wn)throw new Bt(`bad version ${o}`,Ht.VersionMismatch);const i=r.getUint8(1);if(!m1(i))throw new Bt(`unknown kind ${i}`,Ht.ProtocolError);const l=r.getUint16(2);if(i===$e.Data){if(!p1(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=r.getUint32(4),f=r.getUint32(8);return{version:o,kind:i,flags:l,streamId:u,seq:f}}function Mb(t){let r;if(t.transport===sc.Http){if(!t.http)throw new RangeError("http meta required for Http transport");r=t.http}else if(t.transport===sc.Ws){if(!t.ws)throw new RangeError("ws meta required for Ws transport");r=t.ws}else throw new RangeError(`unknown transport: ${t.transport}`);const o=f1(JSON.stringify(r));if(o.length>65535)throw new RangeError("open meta too large");const i=new Uint8Array(3+o.length);return i[0]=t.transport,Ac(i).setUint16(1,o.length),i.set(o,3),i}function yD(t){if(!Array.isArray(t))return!1;for(const r of t)if(!Array.isArray(r)||r.length!==2||typeof r[0]!="string"||typeof r[1]!="string")return!1;return!0}const _c={ConnSalt:1,Hello:2},fm={daemon:1,device:2},bD=34;function wD(t){if(t.salt.length!==32)throw new RangeError(`conn salt must be 32 bytes, got ${t.salt.length}`);const r=new Uint8Array(34);return r[0]=_c.ConnSalt,r[1]=fm.device,r.set(t.salt,2),r}function xD(t){if(t.length!==bD)throw new Bt("conn salt must be 34 bytes",Ht.ProtocolError);if(t[0]!==_c.ConnSalt)throw new Bt("not a ConnSalt frame",Ht.ProtocolError);const r=t[1],o=r===fm.daemon?"daemon":r===fm.device?"device":null;if(o===null)throw new Bt("bad conn salt role",Ht.ProtocolError);return{role:o,salt:t.slice(2)}}function kD(t){return t.length>=1&&t[0]===_c.ConnSalt}function SD(t){if(t.role!=="daemon"&&t.role!=="device")throw new RangeError(`bad role: ${t.role}`);const r=f1(JSON.stringify(t)),o=new Uint8Array(1+r.length);return o[0]=_c.Hello,o.set(r,1),o}function ED(t){dm(t,"cumulativeBytes");const r=new Uint8Array(4);return Ac(r).setUint32(0,t),r}function CD(t,r){const o=new Uint8Array(1+t.length);return o[0]=r?1:0,o.set(t,1),o}function TD(t){if(t.length<1)throw new Bt("ws message too short",Ht.ProtocolError);const r=t[0];if(r!==0&&r!==1)throw new Bt("bad ws isText flag",Ht.ProtocolError);return{data:t.slice(1),isText:r===1}}function Lb(t){const r=new Uint8Array(1+t.length);return r[0]=d1,r.set(t,1),r}function ND(t){if(t.length<1)throw new Bt("http data too short",Ht.ProtocolError);const r=t[0];if(r===pD){let o;try{o=JSON.parse(gD.decode(t.subarray(1)))}catch{throw new Bt("http head not JSON",Ht.ProtocolError)}const i=o;if(typeof i.status!="number"||!yD(i.headers))throw new Bt("bad http head",Ht.ProtocolError);return{kind:"head",head:{status:i.status,headers:i.headers}}}if(r===d1)return{kind:"body",data:t.slice(1)};throw new Bt(`unknown http disc ${r}`,Ht.ProtocolError)}function zb(t){let r=1;return()=>{r===um&&(r+=2);const o=r;if(r+=2,r>u1)throw new RangeError("stream id space exhausted; re-handshake required");return o}}const AD={ok:!0};function Hb(t=Rb.INITIAL_WINDOW,r=Rb.ACK_THRESHOLD){let o=0,i=0,l=0,u=0;const f=()=>o-i,h=()=>f()>=t;return{trySend(g){return f()+g>t?{ok:!1,reason:"WindowExhausted"}:(o+=g,AD)},applyAck(g){const m=h();return g<=i?{resumed:!1}:(i=Math.min(g,o),{resumed:m&&!h()})},onConsume(g){return l+=g,l-u>=r?(u=l,{ackCumulative:l}):null},flushAck(){return u=l,{ackCumulative:l}},isPaused:()=>h()}}const _D=1,Lf=256*1024,mm=new TextEncoder,jD=new TextDecoder,RD=t=>{let r=0;for(const l of t)r+=l.length;const o=new Uint8Array(r);let i=0;for(const l of t)o.set(l,i),i+=l.length;return o},OD=t=>{if(typeof t=="string")return{bytes:mm.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 r=t;return{bytes:new Uint8Array(r.buffer,r.byteOffset,r.byteLength),isText:!1}},DD=t=>{const r=t.generateConnSalt??O6;let o=null,i=null,l=null,u=null,f=null,h=zb();const g=new Map,m=(j,N)=>{if(j.length!==N.length)return!1;for(let O=0;O<j.length;O++)if(j[O]!==N[O])return!1;return!0},y=(j,N,O,D=0)=>{if(!i||!o)throw new Error("frame-mux: seal before channel handshake complete");const L=Db({version:wn,kind:j,flags:D,streamId:N,seq:i.nextSeq});t.onSeal?.({key:o.p2d,direction:"p2d",headerBytes:L});const{ciphertext:B}=W6(i,{key:o.p2d,headerBytes:L,payload:O}),P=new Uint8Array(L.length+B.length);return P.set(L,0),P.set(B,L.length),P},v=()=>{t.send(y($e.Data,Ob,SD({protocolVersion:wn,role:"device",daemonId:t.daemonId,deviceId:t.deviceId})))},x=j=>{u&&(f&&m(f,j)||(o=D6({rootD2p:t.roots.d2p,rootP2d:t.roots.p2d,phoneConnSalt:u,daemonConnSalt:j,ids:{daemonId:t.daemonId,deviceId:t.deviceId,protocolVersion:wn}}),i=H6("p2d"),l=B6("d2p"),f=Uint8Array.from(j),v(),t.onReady?.()))},S=(j,N)=>{t.send(y($e.Ack,j,ED(N)))},T=(j,N)=>{if(!o)return Promise.reject(new Error("tunnel: channel not ready"));const O=h(),D=(N?.method??"GET").toUpperCase(),L=[];N?.headers&&new Headers(N.headers).forEach((ee,Y)=>{L.push([Y,ee])});const B=N?.body===void 0||N.body===null?void 0:MD(N.body),P=B!==void 0&&B.length>0;return new Promise((re,ee)=>{const Y={kind:"http",body:[],recvFlow:Hb(),resolve:re,reject:ee,settled:!1};g.set(O,Y),t.send(y($e.Open,O,Mb({transport:sc.Http,http:{method:D,path:j,headers:L,hasBody:P}}))),P&&B?B.length<=Lf?(t.send(y($e.Data,O,Lb(B))),t.send(y($e.End,O,new Uint8Array(0)))):k(O,Y,B):t.send(y($e.End,O,new Uint8Array(0)))})},k=async(j,N,O)=>{try{for(let D=0;D<O.length;D+=Lf){if(D>0&&t.awaitDrain&&await t.awaitDrain(),N.settled)return;t.send(y($e.Data,j,Lb(O.subarray(D,D+Lf))))}if(N.settled)return;t.send(y($e.End,j,new Uint8Array(0)))}catch(D){if(N.settled)return;N.settled=!0,g.delete(j),N.reject(D)}},C=(j,N)=>{if(N.settled)return;N.settled=!0,g.delete(j);const O=N.head,D=RD(N.body);if(!O){N.reject(new Error("tunnel: stream ended without an HTTP head"));return}let L=null;if(D.length>0){const B=new ArrayBuffer(D.length);new Uint8Array(B).set(D),L=B}N.resolve(new Response(L,{status:O.status,headers:O.headers}))};class E{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:D}=OD(N);t.send(y($e.Data,this.streamId,CD(O,D)))}close(N,O){if(this.readyState===3)return;const D=this.readyState===this.OPEN;this.readyState=3,D&&t.send(y($e.End,this.streamId,new Uint8Array(0))),g.delete(this.streamId)}_deliver(N,O){this.onmessage&&this.onmessage({data:O?jD.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=r(),o=null,i=null,l=null,f=null,this.resetAll("rekey"),h=zb();const j=Db({version:wn,kind:$e.Data,flags:0,streamId:um,seq:0}),N=wD({salt:u}),O=new Uint8Array(j.length+N.length);O.set(j,0),O.set(N,j.length),t.send(O)},onFrame(j){const N=j.subarray(0,ic),O=j.subarray(ic),D=vD(N);if(D.streamId===um&&kD(O)){const{role:P,salt:re}=xD(O);P==="daemon"&&x(re);return}if(!l||!o)return;const L=U6(l,{key:o.d2p,headerBytes:N,ciphertext:O,seq:D.seq});if(D.streamId===Ob)return;const B=g.get(D.streamId);if(B){if(B.kind==="http"){if(D.kind===$e.Reset){B.settled||(B.settled=!0,g.delete(D.streamId),B.reject(new Error("tunnel: HTTP stream reset by daemon")));return}if(D.kind===$e.Data){const P=ND(L);if(P.kind==="head")B.head=P.head;else{B.body.push(P.data);const re=B.recvFlow.onConsume(P.data.length);re&&S(D.streamId,re.ackCumulative)}(D.flags&_D)!==0&&C(D.streamId,B);return}if(D.kind===$e.End){C(D.streamId,B);return}return}if(D.kind===$e.Data){const P=TD(L),re=B.recvFlow.onConsume(P.data.length);re&&S(D.streamId,re.ackCumulative),B.socket._deliver(P.data,P.isText);return}if(D.kind===$e.End||D.kind===$e.Reset){B.socket._remoteClose(D.kind===$e.Reset?1011:1e3);return}}},fetch:T,openWebSocket:(j,N)=>{if(!o){const B=new E(-1);return queueMicrotask(()=>B._remoteClose(1011,"tunnel: channel not ready")),B}const O=h(),D=[];if(N)for(const[B,P]of Object.entries(N))P!==void 0&&D.push([B,String(P)]);const L=new E(O);return g.set(O,{kind:"ws",recvFlow:Hb(),socket:L}),t.send(y($e.Open,O,Mb({transport:sc.Ws,ws:D.length>0?{path:j,query:D}:{path:j}}))),queueMicrotask(()=>{L.readyState===0&&(L.readyState=L.OPEN,L.onopen?.())}),L},resetAll(j){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 (${j})`))):O.socket._remoteClose(1006,j)}}},MD=t=>typeof t=="string"?mm.encode(t):t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):mm.encode(String(t)),LD=2e4,zD=1e4,HD=6,BD=()=>{let t=0;return{next(){t+=1;const r=Math.min(3e4,500*2**(t-1));return Math.floor(r/2+Math.random()*(r/2))},reset(){t=0}}},WD=(t,r)=>!r&&(t===ga.Forbidden||t===ga.Unauthorized),UD=(t,r)=>{const o=t.WebSocketImpl??WebSocket,i=t.setTimer??((ee,Y)=>setTimeout(ee,Y)),l=t.clearTimer??(ee=>clearTimeout(ee)),u=t.backoff??BD(),f=t.heartbeatMs??LD,h=t.heartbeatDeadlineMs??zD,g=t.maxOfflineRetries??HD;let m=null,y=0,v=!1,x=!1,S=!1,T=0,k=null,C=null,E=null;const A=`${t.gatewayUrl}/relay?daemonId=${encodeURIComponent(t.daemonId)}`,j=()=>{E!==null&&(l(E),E=null)},N=()=>{C!==null&&(clearInterval(C),C=null),j()},O=(ee,Y)=>{N(),C=setInterval(()=>{if(ee.readyState===ee.OPEN){try{ee.send(Nx)}catch{}E===null&&(E=i(()=>{if(E=null,!(Y!==y||x)){N();try{ee.close()}catch{}}},h))}},f)},D=()=>{if(x||v||S)return;const ee=++y;let Y=!1;const J=new o(A,[`bearer.${t.phoneSessionToken}`]);J.binaryType="arraybuffer",m=J,J.onopen=()=>{ee!==y||x||(Y=!0,u.reset(),T=0,O(J,ee),r.onUp())},J.onmessage=G=>{if(ee!==y||x)return;const V=G.data;if(typeof V=="string"){if(V.startsWith(cb)){let q;try{q=JSON.parse(V.slice(cb.length))}catch{return}if(q.t==="revoked"){L(ga.Revoked),r.onControl(q);return}r.onControl(q);return}V===Ax&&j();return}const M=V instanceof ArrayBuffer?new Uint8Array(V):new Uint8Array(V);r.onFrame(M)},J.onerror=()=>{},J.onclose=G=>{if(ee!==y||x)return;N(),m=null;const V=G.code??ga.InternalError;if(KO(V)||WD(V,Y)){L(V);return}if(V===ga.DaemonOffline){if(T+=1,T>=g){S=!0,r.onDown({code:V,authFatal:!1,daemonOffline:!0});return}}else T=0;const M=u.next();r.onDown({code:V,authFatal:!1,nextRetryInMs:M}),k=i(()=>{k=null,D()},M)}},L=ee=>{v||(v=!0,N(),k!==null&&(l(k),k=null),r.onDown({code:ee,authFatal:!0}))},B=()=>{x||v||S||m!==null&&(m.readyState===m.OPEN||m.readyState===WebSocket.CONNECTING)||(k!==null&&(l(k),k=null),D())},P=()=>{typeof document<"u"&&document.visibilityState==="visible"&&B()},re=()=>B();return typeof document<"u"&&document.addEventListener("visibilitychange",P),typeof window<"u"&&window.addEventListener("online",re),D(),{send(ee){m&&m.readyState===m.OPEN&&m.send(ee)},bufferedAmount:()=>m&&m.readyState===m.OPEN?m.bufferedAmount:0,isOpen:()=>m!==null&&m.readyState===m.OPEN,resume(){x||v||!S||(S=!1,T=0,u.reset(),D())},close(){if(x=!0,y+=1,N(),k!==null&&(l(k),k=null),m){try{m.close()}catch{}m=null}typeof document<"u"&&document.removeEventListener("visibilitychange",P),typeof window<"u"&&window.removeEventListener("online",re)}}};function ID(t){const r=t.session??t.persistedSession?.()??null;if(!r)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,h=!1;const g=new Set,m=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()},x=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||(h=!1,f=!1,u=!0,i("online"),v())},k=()=>{h=!0,u=!1,j.beginChannel()},C=4*1024*1024,E=50,A=()=>new Promise(N=>{const O=()=>{if(!l||l.bufferedAmount()<=C){N();return}m(O,E)};O()}),j=DD({roots:r.roots,daemonId:r.daemonId,deviceId:r.deviceId,send:N=>l?.send(N),onReady:T,awaitDrain:A});return l=UD({gatewayUrl:r.gatewayUrl,daemonId:r.daemonId,phoneSessionToken:r.phoneSessionToken,...t.WebSocketImpl?{WebSocketImpl:t.WebSocketImpl}:{},...t.setTimer?{setTimer:t.setTimer}:{},...t.clearTimer?{clearTimer:t.clearTimer}:{},...t.backoff?{backoff:t.backoff}:{}},{onFrame:N=>{try{j.onFrame(N)}catch{j.resetAll("frame_open_failed"),l?.close(),i("disconnected",{reason:"integrity"})}},onControl:N=>{if(N.t==="peer-offline"&&N.role==="daemon")f=!0,h=!1,S(),j.resetAll("peer_offline"),i("reconnecting");else if(N.t==="peer-online"&&N.role==="daemon"){if(u||h||!f)return;f=!1,k()}else N.t==="revoked"&&(f=!1,h=!1,S(),j.resetAll("revoked"),x(N.reason??"revoked"),i("revoked",{reason:N.reason}))},onUp:()=>{f=!1,k()},onDown:N=>{f=!1,h=!1,S(),j.resetAll(N.authFatal?"auth_fatal":N.daemonOffline?"daemon_offline":"transient"),N.authFatal?(x("auth_fatal"),i("revoked")):N.daemonOffline?(x("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)=>j.fetch(N,O),openWebSocket:(N,O)=>j.openWebSocket(N,O),status:()=>o,ready:(N={})=>{if(u)return Promise.resolve();const O=N.timeoutMs??1e4;return new Promise((D,L)=>{const B={resolve:D,reject:L,timer:null};B.timer=m(()=>{g.delete(B),L(new Error("tunnel: channel ready timed out"))},O),g.add(B)})},dispose:()=>{f=!1,h=!1,S(),l?.close(),l=null,j.resetAll("disposed"),x("disposed")}}}const qD=t=>{const r=t.onStatus??(()=>{});return async({daemonId:o,deviceId:i,stored:l})=>{let u;try{u=await t.resolveSession({daemonId:o,deviceId:i,stored:l})}catch(h){return h.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}: ${h.message}`}}}const f=ID({session:u,onStatus:r,...t.WebSocketImpl?{WebSocketImpl:t.WebSocketImpl}:{}});try{await f.ready({timeoutMs:t.readyTimeoutMs??1e4})}catch(h){return f.dispose(),{ok:!1,failure:{code:"select_failed",message:`could not open a ready tunnel for ${o}: ${h.message}`}}}return FE(f),{ok:!0}}},PD=(t={})=>{if(!(t.isGateway??l1)())return{mode:"direct"};if(!t.resolveSession)throw new Error("bootTransport: a gateway bundle requires resolveSession to build the tunnel");return{mode:"tunnel",connectTransport:qD({resolveSession:t.resolveSession,...t.onStatus?{onStatus:t.onStatus}:{},...t.WebSocketImpl?{WebSocketImpl:t.WebSocketImpl}:{},...t.readyTimeoutMs!==void 0?{readyTimeoutMs:t.readyTimeoutMs}:{}})}},FD=async({stored:t})=>{if(!t)throw new Error("mobileResolveSession: no persisted device session for the selected daemon");const r=window.location.origin,o=r.replace(/^http/,"ws"),i=await fetch(`${r}/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:Vs(t.rootKeys.d2p),p2d:Vs(t.rootKeys.p2d)},deviceId:t.deviceId,daemonId:t.daemonId,gatewayUrl:o,phoneSessionToken:l}},h1=document.getElementById("root");if(!h1)throw new Error("Root element not found");const KD=PD({resolveSession:FD,onStatus:C3});P2.createRoot(h1).render(c.jsx(b.StrictMode,{children:mD(KD,FO,fD)}));n3();export{nM as $,ql as A,cM as B,To as C,iM as D,Qs as E,JD as F,aM as G,Xb as H,Kb as I,ai as J,oM as K,ka as L,JS as M,lM as N,ti as O,ei as P,vm as Q,Js as R,pE as S,Qe as T,HS as U,sM as V,Qb as W,ya as X,eM as Y,tM as Z,rM as _,dM as a,Wr as a0,cc as a1,Ec as a2,ZA as a3,XD as a4,ZD as a5,lC as a6,QD as a7,dc as a8,lw as a9,gm as aa,xM as ab,Yb as ac,WS as ad,Ms as ae,AS as af,kM as ag,$b as ah,zj as ai,bM as aj,Tt as ak,ow as al,Zw as am,wM as an,fA as ao,Pb as ap,VD as aq,GD as ar,pS as as,lc as b,we as c,qb as d,Jt as e,mM as f,YD as g,gE as h,Nt as i,c as j,ni as k,uM as l,ri as m,TS as n,pM as o,hM as p,No as q,b as r,$D as s,uc as t,ke as u,gM as v,fM as w,xa as x,Gs as y,yM as z};
|