@shanesaravia/hive 0.2.0 → 0.2.1

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.
@@ -0,0 +1,11 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=o((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.iterator;function p(e){return typeof e!=`object`||!e?null:(e=f&&e[f]||e[`@@iterator`],typeof e==`function`?e:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,g={};function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`setState(...): takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function v(){}v.prototype=_.prototype;function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}var b=y.prototype=new v;b.constructor=y,h(b,_.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S=Object.prototype.hasOwnProperty,C={current:null},w={key:!0,ref:!0,__self:!0,__source:!0};function T(e,n,r){var i,a={},o=null,s=null;if(n!=null)for(i in n.ref!==void 0&&(s=n.ref),n.key!==void 0&&(o=``+n.key),n)S.call(n,i)&&!w.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(c===1)a.children=r;else if(1<c){for(var l=Array(c),u=0;u<c;u++)l[u]=arguments[u+2];a.children=l}if(e&&e.defaultProps)for(i in c=e.defaultProps,c)a[i]===void 0&&(a[i]=c[i]);return{$$typeof:t,type:e,key:o,ref:s,props:a,_owner:C.current}}function E(e,n){return{$$typeof:t,type:e.type,key:n,ref:e.ref,props:e.props,_owner:e._owner}}function D(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function O(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var k=/\/+/g;function A(e,t){return typeof e==`object`&&e&&e.key!=null?O(``+e.key):t.toString(36)}function j(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0}}if(c)return c=e,o=o(c),e=a===``?`.`+A(c,0):a,x(o)?(i=``,e!=null&&(i=e.replace(k,`$&/`)+`/`),j(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=E(o,i+(!o.key||c&&c.key===o.key?``:(``+o.key).replace(k,`$&/`)+`/`)+e)),r.push(o)),1;if(c=0,a=a===``?`.`:a+`:`,x(e))for(var l=0;l<e.length;l++){s=e[l];var u=a+A(s,l);c+=j(s,r,i,u,o)}else if(u=p(e),typeof u==`function`)for(e=u.call(e),l=0;!(s=e.next()).done;)s=s.value,u=a+A(s,l++),c+=j(s,r,i,u,o);else if(s===`object`)throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`);return c}function M(e,t,n){if(e==null)return e;var r=[],i=0;return j(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function N(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var P={current:null},F={transition:null},I={ReactCurrentDispatcher:P,ReactCurrentBatchConfig:F,ReactCurrentOwner:C};function ee(){throw Error(`act(...) is not supported in production builds of React.`)}e.Children={map:M,forEach:function(e,t,n){M(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return M(e,function(){t++}),t},toArray:function(e){return M(e,function(e){return e})||[]},only:function(e){if(!D(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}},e.Component=_,e.Fragment=r,e.Profiler=a,e.PureComponent=y,e.StrictMode=i,e.Suspense=l,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=I,e.act=ee,e.cloneElement=function(e,n,r){if(e==null)throw Error(`React.cloneElement(...): The argument must be a React element, but you passed `+e+`.`);var i=h({},e.props),a=e.key,o=e.ref,s=e._owner;if(n!=null){if(n.ref!==void 0&&(o=n.ref,s=C.current),n.key!==void 0&&(a=``+n.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(l in n)S.call(n,l)&&!w.hasOwnProperty(l)&&(i[l]=n[l]===void 0&&c!==void 0?c[l]:n[l])}var l=arguments.length-2;if(l===1)i.children=r;else if(1<l){c=Array(l);for(var u=0;u<l;u++)c[u]=arguments[u+2];i.children=c}return{$$typeof:t,type:e.type,key:a,ref:o,props:i,_owner:s}},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:o,_context:e},e.Consumer=e},e.createElement=T,e.createFactory=function(e){var t=T.bind(null,e);return t.type=e,t},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=D,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:N}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=F.transition;F.transition={};try{e()}finally{F.transition=t}},e.unstable_act=ee,e.useCallback=function(e,t){return P.current.useCallback(e,t)},e.useContext=function(e){return P.current.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e){return P.current.useDeferredValue(e)},e.useEffect=function(e,t){return P.current.useEffect(e,t)},e.useId=function(){return P.current.useId()},e.useImperativeHandle=function(e,t,n){return P.current.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return P.current.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return P.current.useLayoutEffect(e,t)},e.useMemo=function(e,t){return P.current.useMemo(e,t)},e.useReducer=function(e,t,n){return P.current.useReducer(e,t,n)},e.useRef=function(e){return P.current.useRef(e)},e.useState=function(e){return P.current.useState(e)},e.useSyncExternalStore=function(e,t,n){return P.current.useSyncExternalStore(e,t,n)},e.useTransition=function(){return P.current.useTransition()},e.version=`18.3.1`})),u=o(((e,t)=>{t.exports=l()})),d=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function b(e){if(h=!1,y(e),!m){if(n(c)!==null)m=!0,M(x);else{var t=n(l);t!==null&&N(b,t.startTime-e)}}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&N(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function D(){return!(e.unstable_now()-E<T)}function O(){if(C!==null){var t=e.unstable_now();E=t;var n=!0;try{n=C(!0,t)}finally{n?k():(S=!1,C=null)}}else S=!1}var k;if(typeof v==`function`)k=function(){v(O)};else if(typeof MessageChannel<`u`){var A=new MessageChannel,j=A.port2;A.port1.onmessage=O,k=function(){j.postMessage(null)}}else k=function(){g(O,0)};function M(e){C=e,S||(S=!0,k())}function N(t,n){w=g(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){m||p||(m=!0,M(x))},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):T=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(w),w=-1):h=!0,N(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,M(x))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),f=o(((e,t)=>{t.exports=d()})),p=o((e=>{var t=u(),n=f();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n]);return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}var i=new Set,a={};function o(e,t){s(e,t),s(e+`Capture`,t)}function s(e,t){for(a[e]=t,e=0;e<t.length;e++)i.add(t[e])}var c=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),l=Object.prototype.hasOwnProperty,d=/^[: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]*$/,p={},m={};function h(e){return l.call(m,e)?!0:l.call(p,e)?!1:d.test(e)?m[e]=!0:(p[e]=!0,!1)}function g(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case`function`:case`symbol`:return!0;case`boolean`:return r?!1:n===null?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function _(e,t,n,r){if(t==null||g(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function v(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var y={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){y[e]=new v(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];y[t]=new v(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){y[e]=new v(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){y[e]=new v(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){y[e]=new v(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){y[e]=new v(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){y[e]=new v(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){y[e]=new v(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){y[e]=new v(e,5,!1,e.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function x(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!1,!1)}),y.xlinkHref=new v(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!0,!0)});function S(e,t,n,r){var i=y.hasOwnProperty(t)?y[t]:null;(i===null?r||!(2<t.length)||t[0]!==`o`&&t[0]!==`O`||t[1]!==`n`&&t[1]!==`N`:i.type!==0)&&(_(t,n,i,r)&&(n=null),r||i===null?h(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,``+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type!==3&&``:n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&!0===n?``:``+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var C=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,w=Symbol.for(`react.element`),T=Symbol.for(`react.portal`),E=Symbol.for(`react.fragment`),D=Symbol.for(`react.strict_mode`),O=Symbol.for(`react.profiler`),k=Symbol.for(`react.provider`),A=Symbol.for(`react.context`),j=Symbol.for(`react.forward_ref`),M=Symbol.for(`react.suspense`),N=Symbol.for(`react.suspense_list`),P=Symbol.for(`react.memo`),F=Symbol.for(`react.lazy`),I=Symbol.for(`react.offscreen`),ee=Symbol.iterator;function te(e){return typeof e!=`object`||!e?null:(e=ee&&e[ee]||e[`@@iterator`],typeof e==`function`?e:null)}var L=Object.assign,ne;function R(e){if(ne===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ne=t&&t[1]||``}return`
2
+ `+ne+e}var re=!1;function z(e,t){if(!e||re)return``;re=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t){if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var r=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){r=e}e.call(t.prototype)}}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&typeof t.stack==`string`){for(var i=t.stack.split(`
3
+ `),a=r.stack.split(`
4
+ `),o=i.length-1,s=a.length-1;1<=o&&0<=s&&i[o]!==a[s];)s--;for(;1<=o&&0<=s;o--,s--)if(i[o]!==a[s]){if(o!==1||s!==1)do if(o--,s--,0>s||i[o]!==a[s]){var c=`
5
+ `+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(`<anonymous>`)&&(c=c.replace(`<anonymous>`,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{re=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?R(e):``}function ie(e){switch(e.tag){case 5:return R(e.type);case 16:return R(`Lazy`);case 13:return R(`Suspense`);case 19:return R(`SuspenseList`);case 0:case 2:case 15:return e=z(e.type,!1),e;case 11:return e=z(e.type.render,!1),e;case 1:return e=z(e.type,!0),e;default:return``}}function B(e){if(e==null)return null;if(typeof e==`function`)return e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case E:return`Fragment`;case T:return`Portal`;case O:return`Profiler`;case D:return`StrictMode`;case M:return`Suspense`;case N:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case A:return(e.displayName||`Context`)+`.Consumer`;case k:return(e._context.displayName||`Context`)+`.Provider`;case j:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case P:return t=e.displayName||null,t===null?B(e.type)||`Memo`:t;case F:t=e._payload,e=e._init;try{return B(e(t))}catch{}}return null}function ae(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return B(t);case 8:return t===D?`StrictMode`:`Mode`;case 22:return`Offscreen`;case 12:return`Profiler`;case 21:return`Scope`;case 13:return`Suspense`;case 19:return`SuspenseList`;case 25:return`TracingMarker`;case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==`function`)return t.displayName||t.name||null;if(typeof t==`string`)return t}return null}function oe(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function se(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function ce(e){var t=se(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function le(e){e._valueTracker||=ce(e)}function ue(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=se(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function de(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function fe(e,t){var n=t.checked;return L({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function pe(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=oe(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function me(e,t){t=t.checked,t!=null&&S(e,`checked`,t,!1)}function he(e,t){me(e,t);var n=oe(t.value),r=t.type;if(n!=null)r===`number`?(n===0&&e.value===``||e.value!=n)&&(e.value=``+n):e.value!==``+n&&(e.value=``+n);else if(r===`submit`||r===`reset`){e.removeAttribute(`value`);return}t.hasOwnProperty(`value`)?_e(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&_e(e,t.type,oe(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ge(e,t,n){if(t.hasOwnProperty(`value`)||t.hasOwnProperty(`defaultValue`)){var r=t.type;if(!(r!==`submit`&&r!==`reset`||t.value!==void 0&&t.value!==null))return;t=``+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==``&&(e.name=``),e.defaultChecked=!!e._wrapperState.initialChecked,n!==``&&(e.name=n)}function _e(e,t,n){(t!==`number`||de(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var ve=Array.isArray;function ye(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+oe(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function be(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(r(91));return L({},t,{value:void 0,defaultValue:void 0,children:``+e._wrapperState.initialValue})}function xe(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(r(92));if(ve(n)){if(1<n.length)throw Error(r(93));n=n[0]}t=n}t??=``,n=t}e._wrapperState={initialValue:oe(n)}}function Se(e,t){var n=oe(t.value),r=oe(t.defaultValue);n!=null&&(n=``+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=``+r)}function Ce(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==``&&t!==null&&(e.value=t)}function we(e){switch(e){case`svg`:return`http://www.w3.org/2000/svg`;case`math`:return`http://www.w3.org/1998/Math/MathML`;default:return`http://www.w3.org/1999/xhtml`}}function Te(e,t){return e==null||e===`http://www.w3.org/1999/xhtml`?we(t):e===`http://www.w3.org/2000/svg`&&t===`foreignObject`?`http://www.w3.org/1999/xhtml`:e}var Ee,De=function(e){return typeof MSApp<`u`&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!==`http://www.w3.org/2000/svg`||`innerHTML`in e)e.innerHTML=t;else{for(Ee||=document.createElement(`div`),Ee.innerHTML=`<svg>`+t.valueOf().toString()+`</svg>`,t=Ee.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Oe(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ke={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ae=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(ke).forEach(function(e){Ae.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ke[t]=ke[e]})});function je(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||ke.hasOwnProperty(e)&&ke[e]?(``+t).trim():t+`px`}function Me(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=je(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var Ne=L({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Pe(e,t){if(t){if(Ne[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(r(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(r(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(r(62))}}function Fe(e,t){if(e.indexOf(`-`)===-1)return typeof t.is==`string`;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 Ie=null;function Le(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Re=null,ze=null,Be=null;function Ve(e){if(e=Li(e)){if(typeof Re!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=zi(t),Re(e.stateNode,e.type,t))}}function He(e){ze?Be?Be.push(e):Be=[e]:ze=e}function Ue(){if(ze){var e=ze,t=Be;if(Be=ze=null,Ve(e),t)for(e=0;e<t.length;e++)Ve(t[e])}}function We(e,t){return e(t)}function Ge(){}var Ke=!1;function qe(e,t,n){if(Ke)return e(t,n);Ke=!0;try{return We(e,t,n)}finally{Ke=!1,(ze!==null||Be!==null)&&(Ge(),Ue())}}function Je(e,t){var n=e.stateNode;if(n===null)return null;var i=zi(n);if(i===null)return null;n=i[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(i=!i.disabled)||(e=e.type,i=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!i;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(r(231,t,typeof n));return n}var Ye=!1;if(c)try{var Xe={};Object.defineProperty(Xe,"passive",{get:function(){Ye=!0}}),window.addEventListener(`test`,Xe,Xe),window.removeEventListener(`test`,Xe,Xe)}catch{Ye=!1}function Ze(e,t,n,r,i,a,o,s,c){var l=Array.prototype.slice.call(arguments,3);try{t.apply(n,l)}catch(e){this.onError(e)}}var Qe=!1,$e=null,et=!1,tt=null,nt={onError:function(e){Qe=!0,$e=e}};function rt(e,t,n,r,i,a,o,s,c){Qe=!1,$e=null,Ze.apply(nt,arguments)}function it(e,t,n,i,a,o,s,c,l){if(rt.apply(this,arguments),Qe){if(Qe){var u=$e;Qe=!1,$e=null}else throw Error(r(198));et||(et=!0,tt=u)}}function at(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function ot(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function st(e){if(at(e)!==e)throw Error(r(188))}function ct(e){var t=e.alternate;if(!t){if(t=at(e),t===null)throw Error(r(188));return t===e?e:null}for(var n=e,i=t;;){var a=n.return;if(a===null)break;var o=a.alternate;if(o===null){if(i=a.return,i!==null){n=i;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return st(a),e;if(o===i)return st(a),t;o=o.sibling}throw Error(r(188))}if(n.return!==i.return)n=a,i=o;else{for(var s=!1,c=a.child;c;){if(c===n){s=!0,n=a,i=o;break}if(c===i){s=!0,i=a,n=o;break}c=c.sibling}if(!s){for(c=o.child;c;){if(c===n){s=!0,n=o,i=a;break}if(c===i){s=!0,i=o,n=a;break}c=c.sibling}if(!s)throw Error(r(189))}}if(n.alternate!==i)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function lt(e){return e=ct(e),e===null?null:ut(e)}function ut(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=ut(e);if(t!==null)return t;e=e.sibling}return null}var V=n.unstable_scheduleCallback,dt=n.unstable_cancelCallback,H=n.unstable_shouldYield,ft=n.unstable_requestPaint,U=n.unstable_now,pt=n.unstable_getCurrentPriorityLevel,mt=n.unstable_ImmediatePriority,ht=n.unstable_UserBlockingPriority,gt=n.unstable_NormalPriority,_t=n.unstable_LowPriority,vt=n.unstable_IdlePriority,yt=null,bt=null;function xt(e){if(bt&&typeof bt.onCommitFiberRoot==`function`)try{bt.onCommitFiberRoot(yt,e,void 0,(e.current.flags&128)==128)}catch{}}var St=Math.clz32?Math.clz32:Tt,Ct=Math.log,wt=Math.LN2;function Tt(e){return e>>>=0,e===0?32:31-(Ct(e)/wt|0)|0}var Et=64,Dt=4194304;function Ot(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function kt(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=Ot(a))):r=Ot(s)}else o=n&~i,o===0?a!==0&&(r=Ot(a)):r=Ot(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-St(t),i=1<<n,r|=e[n],t&=~i;return r}function At(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64: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 t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function jt(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-St(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=At(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}}function Mt(e){return e=e.pendingLanes&-1073741825,e===0?e&1073741824?1073741824:0:e}function Nt(){var e=Et;return Et<<=1,!(Et&4194240)&&(Et=64),e}function Pt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ft(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-St(t),e[t]=n}function It(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-St(n),a=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~a}}function Lt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-St(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var W=0;function Rt(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var zt,Bt,Vt,Ht,Ut,Wt=!1,Gt=[],Kt=null,qt=null,Jt=null,Yt=new Map,Xt=new Map,Zt=[],Qt=`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 submit`.split(` `);function $t(e,t){switch(e){case`focusin`:case`focusout`:Kt=null;break;case`dragenter`:case`dragleave`:qt=null;break;case`mouseover`:case`mouseout`:Jt=null;break;case`pointerover`:case`pointerout`:Yt.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Xt.delete(t.pointerId)}}function en(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Li(t),t!==null&&Bt(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function tn(e,t,n,r,i){switch(t){case`focusin`:return Kt=en(Kt,e,t,n,r,i),!0;case`dragenter`:return qt=en(qt,e,t,n,r,i),!0;case`mouseover`:return Jt=en(Jt,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Yt.set(a,en(Yt.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Xt.set(a,en(Xt.get(a)||null,e,t,n,r,i)),!0}return!1}function nn(e){var t=Ii(e.target);if(t!==null){var n=at(t);if(n!==null){if(t=n.tag,t===13){if(t=ot(n),t!==null){e.blockedOn=t,Ut(e.priority,function(){Vt(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function rn(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=hn(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ie=r,n.target.dispatchEvent(r),Ie=null}else return t=Li(n),t!==null&&Bt(t),e.blockedOn=n,!1;t.shift()}return!0}function an(e,t,n){rn(e)&&n.delete(t)}function on(){Wt=!1,Kt!==null&&rn(Kt)&&(Kt=null),qt!==null&&rn(qt)&&(qt=null),Jt!==null&&rn(Jt)&&(Jt=null),Yt.forEach(an),Xt.forEach(an)}function sn(e,t){e.blockedOn===t&&(e.blockedOn=null,Wt||(Wt=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,on)))}function cn(e){function t(t){return sn(t,e)}if(0<Gt.length){sn(Gt[0],e);for(var n=1;n<Gt.length;n++){var r=Gt[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Kt!==null&&sn(Kt,e),qt!==null&&sn(qt,e),Jt!==null&&sn(Jt,e),Yt.forEach(t),Xt.forEach(t),n=0;n<Zt.length;n++)r=Zt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Zt.length&&(n=Zt[0],n.blockedOn===null);)nn(n),n.blockedOn===null&&Zt.shift()}var ln=C.ReactCurrentBatchConfig,un=!0;function dn(e,t,n,r){var i=W,a=ln.transition;ln.transition=null;try{W=1,pn(e,t,n,r)}finally{W=i,ln.transition=a}}function fn(e,t,n,r){var i=W,a=ln.transition;ln.transition=null;try{W=4,pn(e,t,n,r)}finally{W=i,ln.transition=a}}function pn(e,t,n,r){if(un){var i=hn(e,t,n,r);if(i===null)ci(e,t,r,mn,n),$t(e,r);else if(tn(i,e,t,n,r))r.stopPropagation();else if($t(e,r),t&4&&-1<Qt.indexOf(e)){for(;i!==null;){var a=Li(i);if(a!==null&&zt(a),a=hn(e,t,n,r),a===null&&ci(e,t,r,mn,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else ci(e,t,r,null,n)}}var mn=null;function hn(e,t,n,r){if(mn=null,e=Le(r),e=Ii(e),e!==null){if(t=at(e),t===null)e=null;else if(n=t.tag,n===13){if(e=ot(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}return mn=e,null}function gn(e){switch(e){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`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 1;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`toggle`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 4;case`message`:switch(pt()){case mt:return 1;case ht:return 4;case gt:case _t:return 16;case vt:return 536870912;default:return 16}default:return 16}}var _n=null,vn=null,yn=null;function bn(){if(yn)return yn;var e,t=vn,n=t.length,r,i=`value`in _n?_n.value:_n.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return yn=i.slice(e,1<r?1-r:void 0)}function xn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Sn(){return!0}function Cn(){return!1}function wn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?Sn:Cn,this.isPropagationStopped=Cn,this}return L(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=Sn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Sn)},persist:function(){},isPersistent:Sn}),t}var Tn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},En=wn(Tn),Dn=L({},Tn,{view:0,detail:0}),On=wn(Dn),kn,An,jn,Mn=L({},Dn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Un,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!==jn&&(jn&&e.type===`mousemove`?(kn=e.screenX-jn.screenX,An=e.screenY-jn.screenY):An=kn=0,jn=e),kn)},movementY:function(e){return`movementY`in e?e.movementY:An}}),Nn=wn(Mn),Pn=wn(L({},Mn,{dataTransfer:0})),Fn=wn(L({},Dn,{relatedTarget:0})),In=wn(L({},Tn,{animationName:0,elapsedTime:0,pseudoElement:0})),Ln=wn(L({},Tn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Rn=wn(L({},Tn,{data:0})),zn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Bn={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`},Vn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Hn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Vn[e])?!!t[e]:!1}function Un(){return Hn}var Wn=wn(L({},Dn,{key:function(e){if(e.key){var t=zn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=xn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Bn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Un,charCode:function(e){return e.type===`keypress`?xn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?xn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Gn=wn(L({},Mn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Kn=wn(L({},Dn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Un})),qn=wn(L({},Tn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Jn=wn(L({},Mn,{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})),Yn=[9,13,27,32],Xn=c&&`CompositionEvent`in window,Zn=null;c&&`documentMode`in document&&(Zn=document.documentMode);var Qn=c&&`TextEvent`in window&&!Zn,$n=c&&(!Xn||Zn&&8<Zn&&11>=Zn),er=` `,tr=!1;function nr(e,t){switch(e){case`keyup`:return Yn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function rr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var ir=!1;function ar(e,t){switch(e){case`compositionend`:return rr(t);case`keypress`:return t.which===32?(tr=!0,er):null;case`textInput`:return e=t.data,e===er&&tr?null:e;default:return null}}function or(e,t){if(ir)return e===`compositionend`||!Xn&&nr(e,t)?(e=bn(),yn=vn=_n=null,ir=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return $n&&t.locale!==`ko`?null:t.data;default:return null}}var sr={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 cr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!sr[e.type]:t===`textarea`}function lr(e,t,n,r){He(r),t=ui(t,`onChange`),0<t.length&&(n=new En(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var ur=null,dr=null;function fr(e){ri(e,0)}function pr(e){if(ue(Ri(e)))return e}function mr(e,t){if(e===`change`)return t}var hr=!1;if(c){var gr;if(c){var _r=`oninput`in document;if(!_r){var vr=document.createElement(`div`);vr.setAttribute(`oninput`,`return;`),_r=typeof vr.oninput==`function`}gr=_r}else gr=!1;hr=gr&&(!document.documentMode||9<document.documentMode)}function yr(){ur&&(ur.detachEvent(`onpropertychange`,br),dr=ur=null)}function br(e){if(e.propertyName===`value`&&pr(dr)){var t=[];lr(t,dr,e,Le(e)),qe(fr,t)}}function xr(e,t,n){e===`focusin`?(yr(),ur=t,dr=n,ur.attachEvent(`onpropertychange`,br)):e===`focusout`&&yr()}function Sr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return pr(dr)}function Cr(e,t){if(e===`click`)return pr(t)}function wr(e,t){if(e===`input`||e===`change`)return pr(t)}function Tr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Er=typeof Object.is==`function`?Object.is:Tr;function Dr(e,t){if(Er(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!l.call(t,i)||!Er(e[i],t[i]))return!1}return!0}function Or(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function kr(e,t){var n=Or(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Or(n)}}function Ar(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ar(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function jr(){for(var e=window,t=de();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=de(e.document)}return t}function Mr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}function Nr(e){var t=jr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Ar(n.ownerDocument.documentElement,n)){if(r!==null&&Mr(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),`selectionStart`in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=kr(n,a);var o=kr(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus==`function`&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Pr=c&&`documentMode`in document&&11>=document.documentMode,Fr=null,Ir=null,Lr=null,Rr=!1;function zr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Rr||Fr==null||Fr!==de(r)||(r=Fr,`selectionStart`in r&&Mr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Lr&&Dr(Lr,r)||(Lr=r,r=ui(Ir,`onSelect`),0<r.length&&(t=new En(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Fr)))}function Br(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Vr={animationend:Br(`Animation`,`AnimationEnd`),animationiteration:Br(`Animation`,`AnimationIteration`),animationstart:Br(`Animation`,`AnimationStart`),transitionend:Br(`Transition`,`TransitionEnd`)},Hr={},Ur={};c&&(Ur=document.createElement(`div`).style,`AnimationEvent`in window||(delete Vr.animationend.animation,delete Vr.animationiteration.animation,delete Vr.animationstart.animation),`TransitionEvent`in window||delete Vr.transitionend.transition);function Wr(e){if(Hr[e])return Hr[e];if(!Vr[e])return e;var t=Vr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Ur)return Hr[e]=t[n];return e}var Gr=Wr(`animationend`),Kr=Wr(`animationiteration`),qr=Wr(`animationstart`),Jr=Wr(`transitionend`),Yr=new Map,Xr=`abort auxClick 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(` `);function Zr(e,t){Yr.set(e,t),o(t,[e])}for(var Qr=0;Qr<Xr.length;Qr++){var $r=Xr[Qr];Zr($r.toLowerCase(),`on`+($r[0].toUpperCase()+$r.slice(1)))}Zr(Gr,`onAnimationEnd`),Zr(Kr,`onAnimationIteration`),Zr(qr,`onAnimationStart`),Zr(`dblclick`,`onDoubleClick`),Zr(`focusin`,`onFocus`),Zr(`focusout`,`onBlur`),Zr(Jr,`onTransitionEnd`),s(`onMouseEnter`,[`mouseout`,`mouseover`]),s(`onMouseLeave`,[`mouseout`,`mouseover`]),s(`onPointerEnter`,[`pointerout`,`pointerover`]),s(`onPointerLeave`,[`pointerout`,`pointerover`]),o(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),o(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),o(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),o(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var ei=`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(` `),ti=new Set(`cancel close invalid load scroll toggle`.split(` `).concat(ei));function ni(e,t,n){var r=e.type||`unknown-event`;e.currentTarget=n,it(r,t,void 0,e),e.currentTarget=null}function ri(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;ni(i,s,l),a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;ni(i,s,l),a=c}}}if(et)throw e=tt,et=!1,tt=null,e}function G(e,t){var n=t[Ni];n===void 0&&(n=t[Ni]=new Set);var r=e+`__bubble`;n.has(r)||(si(t,e,2,!1),n.add(r))}function ii(e,t,n){var r=0;t&&(r|=4),si(n,e,r,t)}var ai=`_reactListening`+Math.random().toString(36).slice(2);function oi(e){if(!e[ai]){e[ai]=!0,i.forEach(function(t){t!==`selectionchange`&&(ti.has(t)||ii(t,!1,e),ii(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ai]||(t[ai]=!0,ii(`selectionchange`,!1,t))}}function si(e,t,n,r){switch(gn(t)){case 1:var i=dn;break;case 4:i=fn;break;default:i=pn}n=i.bind(null,t,n,e),i=void 0,!Ye||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function ci(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i||s.nodeType===8&&s.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;o=o.return}for(;s!==null;){if(o=Ii(s),o===null)return;if(c=o.tag,c===5||c===6){r=a=o;continue a}s=s.parentNode}}r=r.return}qe(function(){var r=a,i=Le(n),o=[];a:{var s=Yr.get(e);if(s!==void 0){var c=En,l=e;switch(e){case`keypress`:if(xn(n)===0)break a;case`keydown`:case`keyup`:c=Wn;break;case`focusin`:l=`focus`,c=Fn;break;case`focusout`:l=`blur`,c=Fn;break;case`beforeblur`:case`afterblur`:c=Fn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:c=Nn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=Pn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=Kn;break;case Gr:case Kr:case qr:c=In;break;case Jr:c=qn;break;case`scroll`:c=On;break;case`wheel`:c=Jn;break;case`copy`:case`cut`:case`paste`:c=Ln;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=Gn}var u=!!(t&4),d=!u&&e===`scroll`,f=u?s===null?null:s+`Capture`:s;u=[];for(var p=r,m;p!==null;){m=p;var h=m.stateNode;if(m.tag===5&&h!==null&&(m=h,f!==null&&(h=Je(p,f),h!=null&&u.push(li(p,h,m)))),d)break;p=p.return}0<u.length&&(s=new c(s,l,null,n,i),o.push({event:s,listeners:u}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,s&&n!==Ie&&(l=n.relatedTarget||n.fromElement)&&(Ii(l)||l[Mi]))break a;if((c||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?Ii(l):null,l!==null&&(d=at(l),l!==d||l.tag!==5&&l.tag!==6)&&(l=null)):(c=null,l=r),c!==l)){if(u=Nn,h=`onMouseLeave`,f=`onMouseEnter`,p=`mouse`,(e===`pointerout`||e===`pointerover`)&&(u=Gn,h=`onPointerLeave`,f=`onPointerEnter`,p=`pointer`),d=c==null?s:Ri(c),m=l==null?s:Ri(l),s=new u(h,p+`leave`,c,n,i),s.target=d,s.relatedTarget=m,h=null,Ii(i)===r&&(u=new u(f,p+`enter`,l,n,i),u.target=m,u.relatedTarget=d,h=u),d=h,c&&l)b:{for(u=c,f=l,p=0,m=u;m;m=di(m))p++;for(m=0,h=f;h;h=di(h))m++;for(;0<p-m;)u=di(u),p--;for(;0<m-p;)f=di(f),m--;for(;p--;){if(u===f||f!==null&&u===f.alternate)break b;u=di(u),f=di(f)}u=null}else u=null;c!==null&&fi(o,s,c,u,!1),l!==null&&d!==null&&fi(o,d,l,u,!0)}}a:{if(s=r?Ri(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var g=mr;else if(cr(s)){if(hr)g=wr;else{g=Sr;var _=xr}}else(c=s.nodeName)&&c.toLowerCase()===`input`&&(s.type===`checkbox`||s.type===`radio`)&&(g=Cr);if(g&&=g(e,r)){lr(o,g,n,i);break a}_&&_(e,s,r),e===`focusout`&&(_=s._wrapperState)&&_.controlled&&s.type===`number`&&_e(s,`number`,s.value)}switch(_=r?Ri(r):window,e){case`focusin`:(cr(_)||_.contentEditable===`true`)&&(Fr=_,Ir=r,Lr=null);break;case`focusout`:Lr=Ir=Fr=null;break;case`mousedown`:Rr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Rr=!1,zr(o,n,i);break;case`selectionchange`:if(Pr)break;case`keydown`:case`keyup`:zr(o,n,i)}var v;if(Xn)b:{switch(e){case`compositionstart`:var y=`onCompositionStart`;break b;case`compositionend`:y=`onCompositionEnd`;break b;case`compositionupdate`:y=`onCompositionUpdate`;break b}y=void 0}else ir?nr(e,n)&&(y=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(y=`onCompositionStart`);y&&($n&&n.locale!==`ko`&&(ir||y!==`onCompositionStart`?y===`onCompositionEnd`&&ir&&(v=bn()):(_n=i,vn=`value`in _n?_n.value:_n.textContent,ir=!0)),_=ui(r,y),0<_.length&&(y=new Rn(y,e,null,n,i),o.push({event:y,listeners:_}),v?y.data=v:(v=rr(n),v!==null&&(y.data=v)))),(v=Qn?ar(e,n):or(e,n))&&(r=ui(r,`onBeforeInput`),0<r.length&&(i=new Rn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:i,listeners:r}),i.data=v))}ri(o,t)})}function li(e,t,n){return{instance:e,listener:t,currentTarget:n}}function ui(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;i.tag===5&&a!==null&&(i=a,a=Je(e,n),a!=null&&r.unshift(li(e,a,i)),a=Je(e,t),a!=null&&r.push(li(e,a,i))),e=e.return}return r}function di(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function fi(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(c!==null&&c===r)break;s.tag===5&&l!==null&&(s=l,i?(c=Je(n,a),c!=null&&o.unshift(li(n,c,s))):i||(c=Je(n,a),c!=null&&o.push(li(n,c,s)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var pi=/\r\n?/g,mi=/\u0000|\uFFFD/g;function hi(e){return(typeof e==`string`?e:``+e).replace(pi,`
6
+ `).replace(mi,``)}function gi(e,t,n){if(t=hi(t),hi(e)!==t&&n)throw Error(r(425))}function _i(){}var vi=null,yi=null;function bi(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var xi=typeof setTimeout==`function`?setTimeout:void 0,Si=typeof clearTimeout==`function`?clearTimeout:void 0,Ci=typeof Promise==`function`?Promise:void 0,wi=typeof queueMicrotask==`function`?queueMicrotask:Ci===void 0?xi:function(e){return Ci.resolve(null).then(e).catch(Ti)};function Ti(e){setTimeout(function(){throw e})}function Ei(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`){if(r===0){e.removeChild(i),cn(t);return}r--}else n!==`$`&&n!==`$?`&&n!==`$!`||r++}n=i}while(n);cn(t)}function Di(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`)break;if(t===`/$`)return null}}return e}function Oi(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`){if(t===0)return e;t--}else n===`/$`&&t++}e=e.previousSibling}return null}var ki=Math.random().toString(36).slice(2),Ai=`__reactFiber$`+ki,ji=`__reactProps$`+ki,Mi=`__reactContainer$`+ki,Ni=`__reactEvents$`+ki,Pi=`__reactListeners$`+ki,Fi=`__reactHandles$`+ki;function Ii(e){var t=e[Ai];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Mi]||n[Ai]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Oi(e);e!==null;){if(n=e[Ai])return n;e=Oi(e)}return t}e=n,n=e.parentNode}return null}function Li(e){return e=e[Ai]||e[Mi],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Ri(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function zi(e){return e[ji]||null}var Bi=[],Vi=-1;function Hi(e){return{current:e}}function K(e){0>Vi||(e.current=Bi[Vi],Bi[Vi]=null,Vi--)}function q(e,t){Vi++,Bi[Vi]=e.current,e.current=t}var Ui={},Wi=Hi(Ui),Gi=Hi(!1),Ki=Ui;function qi(e,t){var n=e.type.contextTypes;if(!n)return Ui;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Ji(e){return e=e.childContextTypes,e!=null}function Yi(){K(Gi),K(Wi)}function Xi(e,t,n){if(Wi.current!==Ui)throw Error(r(168));q(Wi,t),q(Gi,n)}function Zi(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,ae(e)||`Unknown`,a));return L({},n,i)}function Qi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ui,Ki=Wi.current,q(Wi,e),q(Gi,Gi.current),!0}function $i(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=Zi(e,t,Ki),i.__reactInternalMemoizedMergedChildContext=e,K(Gi),K(Wi),q(Wi,e)):K(Gi),q(Gi,n)}var ea=null,ta=!1,na=!1;function ra(e){ea===null?ea=[e]:ea.push(e)}function ia(e){ta=!0,ra(e)}function aa(){if(!na&&ea!==null){na=!0;var e=0,t=W;try{var n=ea;for(W=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}ea=null,ta=!1}catch(t){throw ea!==null&&(ea=ea.slice(e+1)),V(mt,aa),t}finally{W=t,na=!1}}return null}var oa=[],sa=0,ca=null,la=0,ua=[],da=0,fa=null,pa=1,ma=``;function ha(e,t){oa[sa++]=la,oa[sa++]=ca,ca=e,la=t}function ga(e,t,n){ua[da++]=pa,ua[da++]=ma,ua[da++]=fa,fa=e;var r=pa;e=ma;var i=32-St(r)-1;r&=~(1<<i),n+=1;var a=32-St(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,pa=1<<32-St(t)+i|n<<i|r,ma=a+e}else pa=1<<a|n<<i|r,ma=e}function _a(e){e.return!==null&&(ha(e,1),ga(e,1,0))}function va(e){for(;e===ca;)ca=oa[--sa],oa[sa]=null,la=oa[--sa],oa[sa]=null;for(;e===fa;)fa=ua[--da],ua[da]=null,ma=ua[--da],ua[da]=null,pa=ua[--da],ua[da]=null}var ya=null,ba=null,J=!1,xa=null;function Sa(e,t){var n=Kl(5,null,null,0);n.elementType=`DELETED`,n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Ca(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null&&(e.stateNode=t,ya=e,ba=Di(t.firstChild),!0);case 6:return t=e.pendingProps===``||t.nodeType!==3?null:t,t!==null&&(e.stateNode=t,ya=e,ba=null,!0);case 13:return t=t.nodeType===8?t:null,t!==null&&(n=fa===null?null:{id:pa,overflow:ma},e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Kl(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,ya=e,ba=null,!0);default:return!1}}function wa(e){return!!(e.mode&1)&&!(e.flags&128)}function Ta(e){if(J){var t=ba;if(t){var n=t;if(!Ca(e,t)){if(wa(e))throw Error(r(418));t=Di(n.nextSibling);var i=ya;t&&Ca(e,t)?Sa(i,n):(e.flags=e.flags&-4097|2,J=!1,ya=e)}}else{if(wa(e))throw Error(r(418));e.flags=e.flags&-4097|2,J=!1,ya=e}}}function Ea(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;ya=e}function Da(e){if(e!==ya)return!1;if(!J)return Ea(e),J=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!==`head`&&t!==`body`&&!bi(e.type,e.memoizedProps)),t&&=ba){if(wa(e))throw Oa(),Error(r(418));for(;t;)Sa(e,t),t=Di(t.nextSibling)}if(Ea(e),e.tag===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(r(317));a:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`){if(t===0){ba=Di(e.nextSibling);break a}t--}else n!==`$`&&n!==`$!`&&n!==`$?`||t++}e=e.nextSibling}ba=null}}else ba=ya?Di(e.stateNode.nextSibling):null;return!0}function Oa(){for(var e=ba;e;)e=Di(e.nextSibling)}function ka(){ba=ya=null,J=!1}function Aa(e){xa===null?xa=[e]:xa.push(e)}var ja=C.ReactCurrentBatchConfig;function Ma(e,t,n){if(e=n.ref,e!==null&&typeof e!=`function`&&typeof e!=`object`){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(r(309));var i=n.stateNode}if(!i)throw Error(r(147,e));var a=i,o=``+e;return t!==null&&t.ref!==null&&typeof t.ref==`function`&&t.ref._stringRef===o?t.ref:(t=function(e){var t=a.refs;e===null?delete t[o]:t[o]=e},t._stringRef=o,t)}if(typeof e!=`string`)throw Error(r(284));if(!n._owner)throw Error(r(290,e))}return e}function Na(e,t){throw e=Object.prototype.toString.call(t),Error(r(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e))}function Pa(e){var t=e._init;return t(e._payload)}function Fa(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function i(e,t){for(e=new Map;t!==null;)t.key===null?e.set(t.index,t):e.set(t.key,t),t=t.sibling;return e}function a(e,t){return e=Yl(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=2,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=2),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=$l(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===E?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===F&&Pa(i)===t.type)?(r=a(t,n.props),r.ref=Ma(e,t,n),r.return=e,r):(r=Xl(n.type,n.key,n.props,null,e.mode,r),r.ref=Ma(e,t,n),r.return=e,r)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=eu(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=Zl(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`)return t=$l(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case w:return n=Xl(t.type,t.key,t.props,null,e.mode,n),n.ref=Ma(e,null,t),n.return=e,n;case T:return t=eu(t,e.mode,n),t.return=e,t;case F:var r=t._init;return f(e,r(t._payload),n)}if(ve(t)||te(t))return t=Zl(t,e.mode,n,null),t.return=e,t;Na(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case w:return n.key===i?l(e,t,n,r):null;case T:return n.key===i?u(e,t,n,r):null;case F:return i=n._init,p(e,t,i(n._payload),r)}if(ve(n)||te(n))return i===null?d(e,t,n,r,null):null;Na(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case w:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case T:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case F:var a=r._init;return m(e,t,n,a(r._payload),i)}if(ve(r)||te(r))return e=e.get(n)||null,d(t,e,r,i,null);Na(t,r)}return null}function h(r,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(r,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(r,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(r,d),J&&ha(r,h),l;if(d===null){for(;h<s.length;h++)d=f(r,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return J&&ha(r,h),l}for(d=i(r,d);h<s.length;h++)g=m(d,r,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(r,e)}),J&&ha(r,h),l}function g(a,s,c,l){var u=te(c);if(typeof u!=`function`)throw Error(r(150));if(c=u.call(c),c==null)throw Error(r(151));for(var d=u=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),J&&ha(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return J&&ha(a,g),u}for(h=i(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),J&&ha(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===E&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case w:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===E){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===F&&Pa(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=Ma(e,l,i),r.return=e,e=r;break a}n(e,l);break}t(e,l),l=l.sibling}i.type===E?(r=Zl(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=Xl(i.type,i.key,i.props,null,e.mode,o),o.ref=Ma(e,r,i),o.return=e,e=o)}return s(e);case T:a:{for(l=i.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}n(e,r);break}t(e,r),r=r.sibling}r=eu(i,e.mode,o),r.return=e,e=r}return s(e);case F:return l=i._init,_(e,r,l(i._payload),o)}if(ve(i))return h(e,r,i,o);if(te(i))return g(e,r,i,o);Na(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=$l(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Ia=Fa(!0),La=Fa(!1),Ra=Hi(null),za=null,Ba=null,Va=null;function Ha(){Va=Ba=za=null}function Ua(e){var t=Ra.current;K(Ra),e._currentValue=t}function Wa(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Ga(e,t){za=e,Va=Ba=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Ns=!0),e.firstContext=null)}function Ka(e){var t=e._currentValue;if(Va!==e){if(e={context:e,memoizedValue:t,next:null},Ba===null){if(za===null)throw Error(r(308));Ba=e,za.dependencies={lanes:0,firstContext:e}}else Ba=Ba.next=e}return t}var qa=null;function Ja(e){qa===null?qa=[e]:qa.push(e)}function Ya(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Ja(t)):(n.next=i.next,i.next=n),t.interleaved=n,Xa(e,r)}function Xa(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Za=!1;function Qa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function $a(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function eo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function to(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Q&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Xa(e,n)}return i=r.interleaved,i===null?(t.next=t,Ja(r)):(t.next=i.next,i.next=t),r.interleaved=t,Xa(e,n)}function no(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Lt(e,n)}}function ro(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function io(e,t,n,r){var i=e.updateQueue;Za=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=L({},d,f);break a;case 2:Za=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);Yc|=o,e.lanes=o,e.memoizedState=d}}function ao(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var i=e[t],a=i.callback;if(a!==null){if(i.callback=null,i=n,typeof a!=`function`)throw Error(r(191,a));a.call(i)}}}var oo={},so=Hi(oo),co=Hi(oo),lo=Hi(oo);function uo(e){if(e===oo)throw Error(r(174));return e}function fo(e,t){switch(q(lo,t),q(co,e),q(so,oo),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Te(null,``);break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Te(t,e)}K(so),q(so,t)}function po(){K(so),K(co),K(lo)}function mo(e){uo(lo.current);var t=uo(so.current),n=Te(t,e.type);t!==n&&(q(co,e),q(so,n))}function ho(e){co.current===e&&(K(so),K(co))}var Y=Hi(0);function go(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data===`$?`||n.data===`$!`))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var _o=[];function vo(){for(var e=0;e<_o.length;e++)_o[e]._workInProgressVersionPrimary=null;_o.length=0}var yo=C.ReactCurrentDispatcher,bo=C.ReactCurrentBatchConfig,xo=0,X=null,So=null,Co=null,wo=!1,To=!1,Eo=0,Do=0;function Oo(){throw Error(r(321))}function ko(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Er(e[n],t[n]))return!1;return!0}function Ao(e,t,n,i,a,o){if(xo=o,X=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,yo.current=e===null||e.memoizedState===null?ps:ms,e=n(i,a),To){o=0;do{if(To=!1,Eo=0,25<=o)throw Error(r(301));o+=1,Co=So=null,t.updateQueue=null,yo.current=hs,e=n(i,a)}while(To)}if(yo.current=fs,t=So!==null&&So.next!==null,xo=0,Co=So=X=null,wo=!1,t)throw Error(r(300));return e}function jo(){var e=Eo!==0;return Eo=0,e}function Mo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Co===null?X.memoizedState=Co=e:Co=Co.next=e,Co}function No(){if(So===null){var e=X.alternate;e=e===null?null:e.memoizedState}else e=So.next;var t=Co===null?X.memoizedState:Co.next;if(t!==null)Co=t,So=e;else{if(e===null)throw Error(r(310));So=e,e={memoizedState:So.memoizedState,baseState:So.baseState,baseQueue:So.baseQueue,queue:So.queue,next:null},Co===null?X.memoizedState=Co=e:Co=Co.next=e}return Co}function Po(e,t){return typeof t==`function`?t(e):t}function Fo(e){var t=No(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=So,a=i.baseQueue,o=n.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}i.baseQueue=a=o,n.pending=null}if(a!==null){o=a.next,i=i.baseState;var c=s=null,l=null,u=o;do{var d=u.lane;if((xo&d)===d)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),i=u.hasEagerState?u.eagerState:e(i,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(c=l=f,s=i):l=l.next=f,X.lanes|=d,Yc|=d}u=u.next}while(u!==null&&u!==o);l===null?s=i:l.next=c,Er(i,t.memoizedState)||(Ns=!0),t.memoizedState=i,t.baseState=s,t.baseQueue=l,n.lastRenderedState=i}if(e=n.interleaved,e!==null){a=e;do o=a.lane,X.lanes|=o,Yc|=o,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Io(e){var t=No(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Er(o,t.memoizedState)||(Ns=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function Lo(){}function Ro(e,t){var n=X,i=No(),a=t(),o=!Er(i.memoizedState,a);if(o&&(i.memoizedState=a,Ns=!0),i=i.queue,Xo(Vo.bind(null,n,i,e),[e]),i.getSnapshot!==t||o||Co!==null&&Co.memoizedState.tag&1){if(n.flags|=2048,Go(9,Bo.bind(null,n,i,a,t),void 0,null),Hc===null)throw Error(r(349));xo&30||zo(n,t,a)}return a}function zo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=X.updateQueue,t===null?(t={lastEffect:null,stores:null},X.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Bo(e,t,n,r){t.value=n,t.getSnapshot=r,Ho(t)&&Uo(e)}function Vo(e,t,n){return n(function(){Ho(t)&&Uo(e)})}function Ho(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Er(e,n)}catch{return!0}}function Uo(e){var t=Xa(e,1);t!==null&&hl(t,e,1,-1)}function Wo(e){var t=Mo();return typeof e==`function`&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Po,lastRenderedState:e},t.queue=e,e=e.dispatch=cs.bind(null,X,e),[t.memoizedState,e]}function Go(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=X.updateQueue,t===null?(t={lastEffect:null,stores:null},X.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function Ko(){return No().memoizedState}function qo(e,t,n,r){var i=Mo();X.flags|=e,i.memoizedState=Go(1|t,n,void 0,r===void 0?null:r)}function Jo(e,t,n,r){var i=No();r=r===void 0?null:r;var a=void 0;if(So!==null){var o=So.memoizedState;if(a=o.destroy,r!==null&&ko(r,o.deps)){i.memoizedState=Go(t,n,a,r);return}}X.flags|=e,i.memoizedState=Go(1|t,n,a,r)}function Yo(e,t){return qo(8390656,8,e,t)}function Xo(e,t){return Jo(2048,8,e,t)}function Zo(e,t){return Jo(4,2,e,t)}function Qo(e,t){return Jo(4,4,e,t)}function $o(e,t){if(typeof t==`function`)return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function es(e,t,n){return n=n==null?null:n.concat([e]),Jo(4,4,$o.bind(null,t,e),n)}function ts(){}function ns(e,t){var n=No();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&ko(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function rs(e,t){var n=No();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&ko(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function is(e,t,n){return xo&21?(Er(n,t)||(n=Nt(),X.lanes|=n,Yc|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Ns=!0),e.memoizedState=n)}function as(e,t){var n=W;W=n!==0&&4>n?n:4,e(!0);var r=bo.transition;bo.transition={};try{e(!1),t()}finally{W=n,bo.transition=r}}function os(){return No().memoizedState}function ss(e,t,n){var r=ml(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ls(e))us(t,n);else if(n=Ya(e,t,n,r),n!==null){var i=pl();hl(n,e,r,i),ds(n,t,r)}}function cs(e,t,n){var r=ml(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ls(e))us(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Er(s,o)){var c=t.interleaved;c===null?(i.next=i,Ja(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=Ya(e,t,i,r),n!==null&&(i=pl(),hl(n,e,r,i),ds(n,t,r))}}function ls(e){var t=e.alternate;return e===X||t!==null&&t===X}function us(e,t){To=wo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ds(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Lt(e,n)}}var fs={readContext:Ka,useCallback:Oo,useContext:Oo,useEffect:Oo,useImperativeHandle:Oo,useInsertionEffect:Oo,useLayoutEffect:Oo,useMemo:Oo,useReducer:Oo,useRef:Oo,useState:Oo,useDebugValue:Oo,useDeferredValue:Oo,useTransition:Oo,useMutableSource:Oo,useSyncExternalStore:Oo,useId:Oo,unstable_isNewReconciler:!1},ps={readContext:Ka,useCallback:function(e,t){return Mo().memoizedState=[e,t===void 0?null:t],e},useContext:Ka,useEffect:Yo,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),qo(4194308,4,$o.bind(null,t,e),n)},useLayoutEffect:function(e,t){return qo(4194308,4,e,t)},useInsertionEffect:function(e,t){return qo(4,2,e,t)},useMemo:function(e,t){var n=Mo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Mo();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=ss.bind(null,X,e),[r.memoizedState,e]},useRef:function(e){var t=Mo();return e={current:e},t.memoizedState=e},useState:Wo,useDebugValue:ts,useDeferredValue:function(e){return Mo().memoizedState=e},useTransition:function(){var e=Wo(!1),t=e[0];return e=as.bind(null,e[1]),Mo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=X,a=Mo();if(J){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Hc===null)throw Error(r(349));xo&30||zo(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Yo(Vo.bind(null,i,o,e),[e]),i.flags|=2048,Go(9,Bo.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=Mo(),t=Hc.identifierPrefix;if(J){var n=ma,r=pa;n=(r&~(1<<32-St(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=Eo++,0<n&&(t+=`H`+n.toString(32)),t+=`:`}else n=Do++,t=`:`+t+`r`+n.toString(32)+`:`;return e.memoizedState=t},unstable_isNewReconciler:!1},ms={readContext:Ka,useCallback:ns,useContext:Ka,useEffect:Xo,useImperativeHandle:es,useInsertionEffect:Zo,useLayoutEffect:Qo,useMemo:rs,useReducer:Fo,useRef:Ko,useState:function(){return Fo(Po)},useDebugValue:ts,useDeferredValue:function(e){return is(No(),So.memoizedState,e)},useTransition:function(){return[Fo(Po)[0],No().memoizedState]},useMutableSource:Lo,useSyncExternalStore:Ro,useId:os,unstable_isNewReconciler:!1},hs={readContext:Ka,useCallback:ns,useContext:Ka,useEffect:Xo,useImperativeHandle:es,useInsertionEffect:Zo,useLayoutEffect:Qo,useMemo:rs,useReducer:Io,useRef:Ko,useState:function(){return Io(Po)},useDebugValue:ts,useDeferredValue:function(e){var t=No();return So===null?t.memoizedState=e:is(t,So.memoizedState,e)},useTransition:function(){return[Io(Po)[0],No().memoizedState]},useMutableSource:Lo,useSyncExternalStore:Ro,useId:os,unstable_isNewReconciler:!1};function gs(e,t){if(e&&e.defaultProps){for(var n in t=L({},t),e=e.defaultProps,e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function _s(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:L({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var vs={isMounted:function(e){return(e=e._reactInternals)?at(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=pl(),i=ml(e),a=eo(r,i);a.payload=t,n!=null&&(a.callback=n),t=to(e,a,i),t!==null&&(hl(t,e,i,r),no(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=pl(),i=ml(e),a=eo(r,i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=to(e,a,i),t!==null&&(hl(t,e,i,r),no(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=pl(),r=ml(e),i=eo(n,r);i.tag=2,t!=null&&(i.callback=t),t=to(e,i,r),t!==null&&(hl(t,e,r,n),no(t,e,r))}};function ys(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Dr(n,r)||!Dr(i,a):!0}function bs(e,t,n){var r=!1,i=Ui,a=t.contextType;return typeof a==`object`&&a?a=Ka(a):(i=Ji(t)?Ki:Wi.current,r=t.contextTypes,a=(r=r!=null)?qi(e,i):Ui),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=vs,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function xs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&vs.enqueueReplaceState(t,t.state,null)}function Ss(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},Qa(e);var a=t.contextType;typeof a==`object`&&a?i.context=Ka(a):(a=Ji(t)?Ki:Wi.current,i.context=qi(e,a)),i.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a==`function`&&(_s(e,t,a,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps==`function`||typeof i.getSnapshotBeforeUpdate==`function`||typeof i.UNSAFE_componentWillMount!=`function`&&typeof i.componentWillMount!=`function`||(t=i.state,typeof i.componentWillMount==`function`&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount==`function`&&i.UNSAFE_componentWillMount(),t!==i.state&&vs.enqueueReplaceState(i,i.state,null),io(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount==`function`&&(e.flags|=4194308)}function Cs(e,t){try{var n=``,r=t;do n+=ie(r),r=r.return;while(r);var i=n}catch(e){i=`
7
+ Error generating stack: `+e.message+`
8
+ `+e.stack}return{value:e,source:t,stack:i,digest:null}}function ws(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Ts(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var Es=typeof WeakMap==`function`?WeakMap:Map;function Ds(e,t,n){n=eo(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){rl||(rl=!0,il=r),Ts(e,t)},n}function Os(e,t,n){n=eo(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r==`function`){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){Ts(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){Ts(e,t),typeof r!=`function`&&(al===null?al=new Set([this]):al.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:n===null?``:n})}),n}function ks(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Es;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=zl.bind(null,e,t,n),t.then(e,e))}function As(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t===null||t.dehydrated!==null),t)return e;e=e.return}while(e!==null);return null}function js(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=eo(-1,1),t.tag=2,to(n,t,1))),n.lanes|=1),e)}var Ms=C.ReactCurrentOwner,Ns=!1;function Ps(e,t,n,r){t.child=e===null?La(t,null,n,r):Ia(t,e.child,n,r)}function Fs(e,t,n,r,i){n=n.render;var a=t.ref;return Ga(t,i),r=Ao(e,t,n,r,a,i),n=jo(),e!==null&&!Ns?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,tc(e,t,i)):(J&&n&&_a(t),t.flags|=1,Ps(e,t,r,i),t.child)}function Is(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ql(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,Ls(e,t,a,r,i)):(e=Xl(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,(e.lanes&i)===0){var o=a.memoizedProps;if(n=n.compare,n=n===null?Dr:n,n(o,r)&&e.ref===t.ref)return tc(e,t,i)}return t.flags|=1,e=Yl(a,r),e.ref=t.ref,e.return=t,t.child=e}function Ls(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Dr(a,r)&&e.ref===t.ref){if(Ns=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Ns=!0);else return t.lanes=e.lanes,tc(e,t,i)}}return Bs(e,t,n,r,i)}function Rs(e,t,n){var r=t.pendingProps,i=r.children,a=e===null?null:e.memoizedState;if(r.mode===`hidden`){if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},q(Kc,Gc),Gc|=n;else{if(!(n&1073741824))return e=a===null?n:a.baseLanes|n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,q(Kc,Gc),Gc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,q(Kc,Gc),Gc|=r}}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),q(Kc,Gc),Gc|=r;return Ps(e,t,i,n),t.child}function zs(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Bs(e,t,n,r,i){var a=Ji(n)?Ki:Wi.current;return a=qi(t,a),Ga(t,i),n=Ao(e,t,n,r,a,i),r=jo(),e!==null&&!Ns?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,tc(e,t,i)):(J&&r&&_a(t),t.flags|=1,Ps(e,t,n,i),t.child)}function Vs(e,t,n,r,i){if(Ji(n)){var a=!0;Qi(t)}else a=!1;if(Ga(t,i),t.stateNode===null)ec(e,t),bs(t,n,r),Ss(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,s=t.memoizedProps;o.props=s;var c=o.context,l=n.contextType;typeof l==`object`&&l?l=Ka(l):(l=Ji(n)?Ki:Wi.current,l=qi(t,l));var u=n.getDerivedStateFromProps,d=typeof u==`function`||typeof o.getSnapshotBeforeUpdate==`function`;d||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==r||c!==l)&&xs(t,o,r,l),Za=!1;var f=t.memoizedState;o.state=f,io(t,r,o,i),c=t.memoizedState,s!==r||f!==c||Gi.current||Za?(typeof u==`function`&&(_s(t,n,u,r),c=t.memoizedState),(s=Za||ys(t,n,s,r,f,c,l))?(d||typeof o.UNSAFE_componentWillMount!=`function`&&typeof o.componentWillMount!=`function`||(typeof o.componentWillMount==`function`&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==`function`&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount==`function`&&(t.flags|=4194308)):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=l,r=s):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,$a(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:gs(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=Ka(c):(c=Ji(n)?Ki:Wi.current,c=qi(t,c));var p=n.getDerivedStateFromProps;(u=typeof p==`function`||typeof o.getSnapshotBeforeUpdate==`function`)||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==d||f!==c)&&xs(t,o,r,c),Za=!1,f=t.memoizedState,o.state=f,io(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||Gi.current||Za?(typeof p==`function`&&(_s(t,n,p,r),m=t.memoizedState),(l=Za||ys(t,n,l,r,f,m,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!=`function`&&typeof o.componentWillUpdate!=`function`||(typeof o.componentWillUpdate==`function`&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate==`function`&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate==`function`&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=l):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Hs(e,t,n,r,a,i)}function Hs(e,t,n,r,i,a){zs(e,t);var o=!!(t.flags&128);if(!r&&!o)return i&&$i(t,n,!1),tc(e,t,a);r=t.stateNode,Ms.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Ia(t,e.child,null,a),t.child=Ia(t,null,s,a)):Ps(e,t,s,a),t.memoizedState=r.state,i&&$i(t,n,!0),t.child}function Us(e){var t=e.stateNode;t.pendingContext?Xi(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Xi(e,t.context,!1),fo(e,t.containerInfo)}function Ws(e,t,n,r,i){return ka(),Aa(i),t.flags|=256,Ps(e,t,n,r),t.child}var Gs={dehydrated:null,treeContext:null,retryLane:0};function Ks(e){return{baseLanes:e,cachePool:null,transitions:null}}function qs(e,t,n){var r=t.pendingProps,i=Y.current,a=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(i&2)),s?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),q(Y,i&1),e===null)return Ta(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.lanes=t.mode&1?e.data===`$!`?8:1073741824:1,null):(o=r.children,e=r.fallback,a?(r=t.mode,a=t.child,o={mode:`hidden`,children:o},!(r&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=Ql(o,r,0,null),e=Zl(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Ks(n),t.memoizedState=Gs,e):Js(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return Xs(e,t,o,r,s,i,n);if(a){a=r.fallback,o=t.mode,i=e.child,s=i.sibling;var c={mode:`hidden`,children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Yl(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s===null?(a=Zl(a,o,n,null),a.flags|=2):a=Yl(s,a),a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,o=e.child.memoizedState,o=o===null?Ks(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=Gs,r}return a=e.child,e=a.sibling,r=Yl(a,{mode:`visible`,children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Js(e,t){return t=Ql({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function Ys(e,t,n,r){return r!==null&&Aa(r),Ia(t,e.child,null,n),e=Js(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Xs(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=ws(Error(r(422))),Ys(e,t,s,i)):t.memoizedState===null?(o=i.fallback,a=t.mode,i=Ql({mode:`visible`,children:i.children},a,0,null),o=Zl(o,a,s,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,t.mode&1&&Ia(t,e.child,null,s),t.child.memoizedState=Ks(s),t.memoizedState=Gs,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return Ys(e,t,s,null);if(a.data===`$!`){if(i=a.nextSibling&&a.nextSibling.dataset,i)var c=i.dgst;return i=c,o=Error(r(419)),i=ws(o,i,void 0),Ys(e,t,s,i)}if(c=(s&e.childLanes)!==0,Ns||c){if(i=Hc,i!==null){switch(s&-s){case 4:a=2;break;case 16:a=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=(a&(i.suspendedLanes|s))===0?a:0,a!==0&&a!==o.retryLane&&(o.retryLane=a,Xa(e,a),hl(i,e,a,-1))}return kl(),i=ws(Error(r(421))),Ys(e,t,s,i)}return a.data===`$?`?(t.flags|=128,t.child=e.child,t=Vl.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,ba=Di(a.nextSibling),ya=t,J=!0,xa=null,e!==null&&(ua[da++]=pa,ua[da++]=ma,ua[da++]=fa,pa=e.id,ma=e.overflow,fa=t),t=Js(t,i.children),t.flags|=4096,t)}function Zs(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Wa(e.return,t,n)}function Qs(e,t,n,r,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i)}function $s(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(Ps(e,t,r.children,n),r=Y.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Zs(e,n,t);else if(e.tag===19)Zs(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(q(Y,r),!(t.mode&1))t.memoizedState=null;else switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&go(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Qs(t,!1,i,n,a);break;case`backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&go(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Qs(t,!0,n,null,a);break;case`together`:Qs(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ec(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function tc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Yc|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=Yl(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Yl(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function nc(e,t,n){switch(t.tag){case 3:Us(t),ka();break;case 5:mo(t);break;case 1:Ji(t.type)&&Qi(t);break;case 4:fo(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;q(Ra,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(q(Y,Y.current&1),e=tc(e,t,n),e===null?null:e.sibling):qs(e,t,n):(q(Y,Y.current&1),t.flags|=128,null);q(Y,Y.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return $s(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),q(Y,Y.current),r)break;return null;case 22:case 23:return t.lanes=0,Rs(e,t,n)}return tc(e,t,n)}var rc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},ic=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,uo(so.current);var o=null;switch(n){case`input`:i=fe(e,i),r=fe(e,r),o=[];break;case`select`:i=L({},i,{value:void 0}),r=L({},r,{value:void 0}),o=[];break;case`textarea`:i=be(e,i),r=be(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=_i)}Pe(n,r);var s;for(u in n=null,i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null){if(u===`style`){var c=i[u];for(s in c)c.hasOwnProperty(s)&&(n||={},n[s]=``)}else u!==`dangerouslySetInnerHTML`&&u!==`children`&&u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&u!==`autoFocus`&&(a.hasOwnProperty(u)?o||=[]:(o||=[]).push(u,null))}for(u in r){var l=r[u];if(c=i?.[u],r.hasOwnProperty(u)&&l!==c&&(l!=null||c!=null)){if(u===`style`){if(c){for(s in c)!c.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||={},n[s]=``);for(s in l)l.hasOwnProperty(s)&&c[s]!==l[s]&&(n||={},n[s]=l[s])}else n||(o||=[],o.push(u,n)),n=l}else u===`dangerouslySetInnerHTML`?(l=l?l.__html:void 0,c=c?c.__html:void 0,l!=null&&c!==l&&(o||=[]).push(u,l)):u===`children`?typeof l!=`string`&&typeof l!=`number`||(o||=[]).push(u,``+l):u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&(a.hasOwnProperty(u)?(l!=null&&u===`onScroll`&&G(`scroll`,e),o||c===l||(o=[])):(o||=[]).push(u,l))}}n&&(o||=[]).push(`style`,n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},ac=function(e,t,n,r){n!==r&&(t.flags|=4)};function oc(e,t){if(!J)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function sc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function cc(e,t,n){var i=t.pendingProps;switch(va(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return sc(t),null;case 1:return Ji(t.type)&&Yi(),sc(t),null;case 3:return i=t.stateNode,po(),K(Gi),K(Wi),vo(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Da(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,xa!==null&&(yl(xa),xa=null))),sc(t),null;case 5:ho(t);var o=uo(lo.current);if(n=t.type,e!==null&&t.stateNode!=null)ic(e,t,n,i,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!i){if(t.stateNode===null)throw Error(r(166));return sc(t),null}if(e=uo(so.current),Da(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[Ai]=t,i[ji]=s,e=!!(t.mode&1),n){case`dialog`:G(`cancel`,i),G(`close`,i);break;case`iframe`:case`object`:case`embed`:G(`load`,i);break;case`video`:case`audio`:for(o=0;o<ei.length;o++)G(ei[o],i);break;case`source`:G(`error`,i);break;case`img`:case`image`:case`link`:G(`error`,i),G(`load`,i);break;case`details`:G(`toggle`,i);break;case`input`:pe(i,s),G(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},G(`invalid`,i);break;case`textarea`:xe(i,s),G(`invalid`,i)}for(var c in Pe(n,s),o=null,s)if(s.hasOwnProperty(c)){var l=s[c];c===`children`?typeof l==`string`?i.textContent!==l&&(!0!==s.suppressHydrationWarning&&gi(i.textContent,l,e),o=[`children`,l]):typeof l==`number`&&i.textContent!==``+l&&(!0!==s.suppressHydrationWarning&&gi(i.textContent,l,e),o=[`children`,``+l]):a.hasOwnProperty(c)&&l!=null&&c===`onScroll`&&G(`scroll`,i)}switch(n){case`input`:le(i),ge(i,s,!0);break;case`textarea`:le(i),Ce(i);break;case`select`:case`option`:break;default:typeof s.onClick==`function`&&(i.onclick=_i)}i=o,t.updateQueue=i,i!==null&&(t.flags|=4)}else{c=o.nodeType===9?o:o.ownerDocument,e===`http://www.w3.org/1999/xhtml`&&(e=we(n)),e===`http://www.w3.org/1999/xhtml`?n===`script`?(e=c.createElement(`div`),e.innerHTML=`<script><\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[Ai]=t,e[ji]=i,rc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Fe(n,i),n){case`dialog`:G(`cancel`,e),G(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:G(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<ei.length;o++)G(ei[o],e);o=i;break;case`source`:G(`error`,e),o=i;break;case`img`:case`image`:case`link`:G(`error`,e),G(`load`,e),o=i;break;case`details`:G(`toggle`,e),o=i;break;case`input`:pe(e,i),o=fe(e,i),G(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=L({},i,{value:void 0}),G(`invalid`,e);break;case`textarea`:xe(e,i),o=be(e,i),G(`invalid`,e);break;default:o=i}for(s in Pe(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?Me(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&De(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&Oe(e,u):typeof u==`number`&&Oe(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&G(`scroll`,e):u!=null&&S(e,s,u,c))}switch(n){case`input`:le(e),ge(e,i,!1);break;case`textarea`:le(e),Ce(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+oe(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&ye(e,!!i.multiple,i.defaultValue,!0):ye(e,!!i.multiple,s,!1);break;default:typeof o.onClick==`function`&&(e.onclick=_i)}switch(n){case`button`:case`input`:case`select`:case`textarea`:i=!!i.autoFocus;break a;case`img`:i=!0;break a;default:i=!1}}i&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return sc(t),null;case 6:if(e&&t.stateNode!=null)ac(e,t,e.memoizedProps,i);else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(n=uo(lo.current),uo(so.current),Da(t)){if(i=t.stateNode,n=t.memoizedProps,i[Ai]=t,(s=i.nodeValue!==n)&&(e=ya,e!==null))switch(e.tag){case 3:gi(i.nodeValue,n,!!(e.mode&1));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&gi(i.nodeValue,n,!!(e.mode&1))}s&&(t.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[Ai]=t,t.stateNode=i}return sc(t),null;case 13:if(K(Y),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(J&&ba!==null&&t.mode&1&&!(t.flags&128))Oa(),ka(),t.flags|=98560,s=!1;else if(s=Da(t),i!==null&&i.dehydrated!==null){if(e===null){if(!s)throw Error(r(318));if(s=t.memoizedState,s=s===null?null:s.dehydrated,!s)throw Error(r(317));s[Ai]=t}else ka(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;sc(t),s=!1}else xa!==null&&(yl(xa),xa=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(i=i!==null,i!==(e!==null&&e.memoizedState!==null)&&i&&(t.child.flags|=8192,t.mode&1&&(e===null||Y.current&1?qc===0&&(qc=3):kl())),t.updateQueue!==null&&(t.flags|=4),sc(t),null);case 4:return po(),e===null&&oi(t.stateNode.containerInfo),sc(t),null;case 10:return Ua(t.type._context),sc(t),null;case 17:return Ji(t.type)&&Yi(),sc(t),null;case 19:if(K(Y),s=t.memoizedState,s===null)return sc(t),null;if(i=!!(t.flags&128),c=s.rendering,c===null){if(i)oc(s,!1);else{if(qc!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=go(e),c!==null){for(t.flags|=128,oc(s,!1),i=c.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),t.subtreeFlags=0,i=n,n=t.child;n!==null;)s=n,e=i,s.flags&=14680066,c=s.alternate,c===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,e=c.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return q(Y,Y.current&1|2),t.child}e=e.sibling}s.tail!==null&&U()>tl&&(t.flags|=128,i=!0,oc(s,!1),t.lanes=4194304)}}else{if(!i){if(e=go(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),oc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!J)return sc(t),null}else 2*U()-s.renderingStartTime>tl&&n!==1073741824&&(t.flags|=128,i=!0,oc(s,!1),t.lanes=4194304)}s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(sc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=U(),t.sibling=null,n=Y.current,q(Y,i?n&1|2:n&1),t);case 22:case 23:return Tl(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Gc&1073741824&&(sc(t),t.subtreeFlags&6&&(t.flags|=8192)):sc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function lc(e,t){switch(va(t),t.tag){case 1:return Ji(t.type)&&Yi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return po(),K(Gi),K(Wi),vo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return ho(t),null;case 13:if(K(Y),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));ka()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return K(Y),null;case 4:return po(),null;case 10:return Ua(t.type._context),null;case 22:case 23:return Tl(),null;case 24:return null;default:return null}}var uc=!1,dc=!1,fc=typeof WeakSet==`function`?WeakSet:Set,Z=null;function pc(e,t){var n=e.ref;if(n!==null){if(typeof n==`function`)try{n(null)}catch(n){$(e,t,n)}else n.current=null}}function mc(e,t,n){try{n()}catch(n){$(e,t,n)}}var hc=!1;function gc(e,t){if(vi=un,e=jr(),Mr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(yi={focusedElem:e,selectionRange:n},un=!1,Z=t;Z!==null;)if(t=Z,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,Z=e;else for(;Z!==null;){t=Z;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:gs(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){$(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,Z=e;break}Z=t.return}return h=hc,hc=!1,h}function _c(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&mc(t,n,a)}i=i.next}while(i!==r)}}function vc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function yc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function bc(e){var t=e.alternate;t!==null&&(e.alternate=null,bc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ai],delete t[ji],delete t[Ni],delete t[Pi],delete t[Fi])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function xc(e){return e.tag===5||e.tag===3||e.tag===4}function Sc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||xc(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.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Cc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=_i));else if(r!==4&&(e=e.child,e!==null))for(Cc(e,t,n),e=e.sibling;e!==null;)Cc(e,t,n),e=e.sibling}function wc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(wc(e,t,n),e=e.sibling;e!==null;)wc(e,t,n),e=e.sibling}var Tc=null,Ec=!1;function Dc(e,t,n){for(n=n.child;n!==null;)Oc(e,t,n),n=n.sibling}function Oc(e,t,n){if(bt&&typeof bt.onCommitFiberUnmount==`function`)try{bt.onCommitFiberUnmount(yt,n)}catch{}switch(n.tag){case 5:dc||pc(n,t);case 6:var r=Tc,i=Ec;Tc=null,Dc(e,t,n),Tc=r,Ec=i,Tc!==null&&(Ec?(e=Tc,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Tc.removeChild(n.stateNode));break;case 18:Tc!==null&&(Ec?(e=Tc,n=n.stateNode,e.nodeType===8?Ei(e.parentNode,n):e.nodeType===1&&Ei(e,n),cn(e)):Ei(Tc,n.stateNode));break;case 4:r=Tc,i=Ec,Tc=n.stateNode.containerInfo,Ec=!0,Dc(e,t,n),Tc=r,Ec=i;break;case 0:case 11:case 14:case 15:if(!dc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&mc(n,t,o),i=i.next}while(i!==r)}Dc(e,t,n);break;case 1:if(!dc&&(pc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){$(n,t,e)}Dc(e,t,n);break;case 21:Dc(e,t,n);break;case 22:n.mode&1?(dc=(r=dc)||n.memoizedState!==null,Dc(e,t,n),dc=r):Dc(e,t,n);break;default:Dc(e,t,n)}}function kc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new fc),t.forEach(function(t){var r=Hl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Ac(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i];try{var o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 5:Tc=c.stateNode,Ec=!1;break a;case 3:Tc=c.stateNode.containerInfo,Ec=!0;break a;case 4:Tc=c.stateNode.containerInfo,Ec=!0;break a}c=c.return}if(Tc===null)throw Error(r(160));Oc(o,s,a),Tc=null,Ec=!1;var l=a.alternate;l!==null&&(l.return=null),a.return=null}catch(e){$(a,t,e)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)jc(t,e),t=t.sibling}function jc(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Ac(t,e),Mc(e),i&4){try{_c(3,e,e.return),vc(3,e)}catch(t){$(e,e.return,t)}try{_c(5,e,e.return)}catch(t){$(e,e.return,t)}}break;case 1:Ac(t,e),Mc(e),i&512&&n!==null&&pc(n,n.return);break;case 5:if(Ac(t,e),Mc(e),i&512&&n!==null&&pc(n,n.return),e.flags&32){var a=e.stateNode;try{Oe(a,``)}catch(t){$(e,e.return,t)}}if(i&4&&(a=e.stateNode,a!=null)){var o=e.memoizedProps,s=n===null?o:n.memoizedProps,c=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{c===`input`&&o.type===`radio`&&o.name!=null&&me(a,o),Fe(c,s);var u=Fe(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?Me(a,f):d===`dangerouslySetInnerHTML`?De(a,f):d===`children`?Oe(a,f):S(a,d,f,u)}switch(c){case`input`:he(a,o);break;case`textarea`:Se(a,o);break;case`select`:var p=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var m=o.value;m==null?p!==!!o.multiple&&(o.defaultValue==null?ye(a,!!o.multiple,o.multiple?[]:``,!1):ye(a,!!o.multiple,o.defaultValue,!0)):ye(a,!!o.multiple,m,!1)}a[ji]=o}catch(t){$(e,e.return,t)}}break;case 6:if(Ac(t,e),Mc(e),i&4){if(e.stateNode===null)throw Error(r(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){$(e,e.return,t)}}break;case 3:if(Ac(t,e),Mc(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{cn(t.containerInfo)}catch(t){$(e,e.return,t)}break;case 4:Ac(t,e),Mc(e);break;case 13:Ac(t,e),Mc(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||(el=U())),i&4&&kc(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(dc=(u=dc)||d,Ac(t,e),dc=u):Ac(t,e),Mc(e),i&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(Z=e,d=e.child;d!==null;){for(f=Z=d;Z!==null;){switch(p=Z,m=p.child,p.tag){case 0:case 11:case 14:case 15:_c(4,p,p.return);break;case 1:pc(p,p.return);var h=p.stateNode;if(typeof h.componentWillUnmount==`function`){i=p,n=p.return;try{t=i,h.props=t.memoizedProps,h.state=t.memoizedState,h.componentWillUnmount()}catch(e){$(i,n,e)}}break;case 5:pc(p,p.return);break;case 22:if(p.memoizedState!==null){Ic(f);continue}}m===null?Ic(f):(m.return=p,Z=m)}d=d.sibling}a:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{a=f.stateNode,u?(o=a.style,typeof o.setProperty==`function`?o.setProperty(`display`,`none`,`important`):o.display=`none`):(c=f.stateNode,l=f.memoizedProps.style,s=l!=null&&l.hasOwnProperty(`display`)?l.display:null,c.style.display=je(`display`,s))}catch(t){$(e,e.return,t)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?``:f.memoizedProps}catch(t){$(e,e.return,t)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break a;for(;f.sibling===null;){if(f.return===null||f.return===e)break a;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Ac(t,e),Mc(e),i&4&&kc(e);break;case 21:break;default:Ac(t,e),Mc(e)}}function Mc(e){var t=e.flags;if(t&2){try{a:{for(var n=e.return;n!==null;){if(xc(n)){var i=n;break a}n=n.return}throw Error(r(160))}switch(i.tag){case 5:var a=i.stateNode;i.flags&32&&(Oe(a,``),i.flags&=-33),wc(e,Sc(e),a);break;case 3:case 4:var o=i.stateNode.containerInfo;Cc(e,Sc(e),o);break;default:throw Error(r(161))}}catch(t){$(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Nc(e,t,n){Z=e,Pc(e,t,n)}function Pc(e,t,n){for(var r=!!(e.mode&1);Z!==null;){var i=Z,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||uc;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||dc;s=uc;var l=dc;if(uc=o,(dc=c)&&!l)for(Z=i;Z!==null;)o=Z,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?Lc(i):(c.return=o,Z=c);for(;a!==null;)Z=a,Pc(a,t,n),a=a.sibling;Z=i,uc=s,dc=l}Fc(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,Z=a):Fc(e,t,n)}}function Fc(e){for(;Z!==null;){var t=Z;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:dc||vc(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!dc){if(n===null)i.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:gs(t.type,n.memoizedProps);i.componentDidUpdate(a,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}}var o=t.updateQueue;o!==null&&ao(t,o,i);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}ao(t,s,n)}break;case 5:var c=t.stateNode;if(n===null&&t.flags&4){n=c;var l=t.memoizedProps;switch(t.type){case`button`:case`input`:case`select`:case`textarea`:l.autoFocus&&n.focus();break;case`img`:l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&cn(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}dc||t.flags&512&&yc(t)}catch(e){$(t,t.return,e)}}if(t===e){Z=null;break}if(n=t.sibling,n!==null){n.return=t.return,Z=n;break}Z=t.return}}function Ic(e){for(;Z!==null;){var t=Z;if(t===e){Z=null;break}var n=t.sibling;if(n!==null){n.return=t.return,Z=n;break}Z=t.return}}function Lc(e){for(;Z!==null;){var t=Z;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{vc(4,t)}catch(e){$(t,n,e)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount==`function`){var i=t.return;try{r.componentDidMount()}catch(e){$(t,i,e)}}var a=t.return;try{yc(t)}catch(e){$(t,a,e)}break;case 5:var o=t.return;try{yc(t)}catch(e){$(t,o,e)}}}catch(e){$(t,t.return,e)}if(t===e){Z=null;break}var s=t.sibling;if(s!==null){s.return=t.return,Z=s;break}Z=t.return}}var Rc=Math.ceil,zc=C.ReactCurrentDispatcher,Bc=C.ReactCurrentOwner,Vc=C.ReactCurrentBatchConfig,Q=0,Hc=null,Uc=null,Wc=0,Gc=0,Kc=Hi(0),qc=0,Jc=null,Yc=0,Xc=0,Zc=0,Qc=null,$c=null,el=0,tl=1/0,nl=null,rl=!1,il=null,al=null,ol=!1,sl=null,cl=0,ll=0,ul=null,dl=-1,fl=0;function pl(){return Q&6?U():dl===-1?dl=U():dl}function ml(e){return e.mode&1?Q&2&&Wc!==0?Wc&-Wc:ja.transition===null?(e=W,e===0?(e=window.event,e=e===void 0?16:gn(e.type),e):e):(fl===0&&(fl=Nt()),fl):1}function hl(e,t,n,i){if(50<ll)throw ll=0,ul=null,Error(r(185));Ft(e,n,i),(!(Q&2)||e!==Hc)&&(e===Hc&&(!(Q&2)&&(Xc|=n),qc===4&&xl(e,Wc)),gl(e,i),n===1&&Q===0&&!(t.mode&1)&&(tl=U()+500,ta&&aa()))}function gl(e,t){var n=e.callbackNode;jt(e,t);var r=kt(e,e===Hc?Wc:0);if(r===0)n!==null&&dt(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&dt(n),t===1)e.tag===0?ia(Sl.bind(null,e)):ra(Sl.bind(null,e)),wi(function(){!(Q&6)&&aa()}),n=null;else{switch(Rt(r)){case 1:n=mt;break;case 4:n=ht;break;case 16:n=gt;break;case 536870912:n=vt;break;default:n=gt}n=Wl(n,_l.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function _l(e,t){if(dl=-1,fl=0,Q&6)throw Error(r(327));var n=e.callbackNode;if(Ll()&&e.callbackNode!==n)return null;var i=kt(e,e===Hc?Wc:0);if(i===0)return null;if(i&30||(i&e.expiredLanes)!==0||t)t=Al(e,i);else{t=i;var a=Q;Q|=2;var o=Ol();(Hc!==e||Wc!==t)&&(nl=null,tl=U()+500,El(e,t));do try{Ml();break}catch(t){Dl(e,t)}while(1);Ha(),zc.current=o,Q=a,Uc===null?(Hc=null,Wc=0,t=qc):t=0}if(t!==0){if(t===2&&(a=Mt(e),a!==0&&(i=a,t=vl(e,a))),t===1)throw n=Jc,El(e,0),xl(e,i),gl(e,U()),n;if(t===6)xl(e,i);else{if(a=e.current.alternate,!(i&30)&&!bl(a)&&(t=Al(e,i),t===2&&(o=Mt(e),o!==0&&(i=o,t=vl(e,o))),t===1))throw n=Jc,El(e,0),xl(e,i),gl(e,U()),n;switch(e.finishedWork=a,e.finishedLanes=i,t){case 0:case 1:throw Error(r(345));case 2:Fl(e,$c,nl);break;case 3:if(xl(e,i),(i&130023424)===i&&(t=el+500-U(),10<t)){if(kt(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){pl(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=xi(Fl.bind(null,e,$c,nl),t);break}Fl(e,$c,nl);break;case 4:if(xl(e,i),(i&4194240)===i)break;for(t=e.eventTimes,a=-1;0<i;){var s=31-St(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=U()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Rc(i/1960))-i,10<i){e.timeoutHandle=xi(Fl.bind(null,e,$c,nl),i);break}Fl(e,$c,nl);break;case 5:Fl(e,$c,nl);break;default:throw Error(r(329))}}}return gl(e,U()),e.callbackNode===n?_l.bind(null,e):null}function vl(e,t){var n=Qc;return e.current.memoizedState.isDehydrated&&(El(e,t).flags|=256),e=Al(e,t),e!==2&&(t=$c,$c=n,t!==null&&yl(t)),e}function yl(e){$c===null?$c=e:$c.push.apply($c,e)}function bl(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Er(a(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function xl(e,t){for(t&=~Zc,t&=~Xc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-St(t),r=1<<n;e[n]=-1,t&=~r}}function Sl(e){if(Q&6)throw Error(r(327));Ll();var t=kt(e,0);if(!(t&1))return gl(e,U()),null;var n=Al(e,t);if(e.tag!==0&&n===2){var i=Mt(e);i!==0&&(t=i,n=vl(e,i))}if(n===1)throw n=Jc,El(e,0),xl(e,t),gl(e,U()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Fl(e,$c,nl),gl(e,U()),null}function Cl(e,t){var n=Q;Q|=1;try{return e(t)}finally{Q=n,Q===0&&(tl=U()+500,ta&&aa())}}function wl(e){sl!==null&&sl.tag===0&&!(Q&6)&&Ll();var t=Q;Q|=1;var n=Vc.transition,r=W;try{if(Vc.transition=null,W=1,e)return e()}finally{W=r,Vc.transition=n,Q=t,!(Q&6)&&aa()}}function Tl(){Gc=Kc.current,K(Kc)}function El(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Si(n)),Uc!==null)for(n=Uc.return;n!==null;){var r=n;switch(va(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Yi();break;case 3:po(),K(Gi),K(Wi),vo();break;case 5:ho(r);break;case 4:po();break;case 13:K(Y);break;case 19:K(Y);break;case 10:Ua(r.type._context);break;case 22:case 23:Tl()}n=n.return}if(Hc=e,Uc=e=Yl(e.current,null),Wc=Gc=t,qc=0,Jc=null,Zc=Xc=Yc=0,$c=Qc=null,qa!==null){for(t=0;t<qa.length;t++)if(n=qa[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,a=n.pending;if(a!==null){var o=a.next;a.next=i,r.next=o}n.pending=r}qa=null}return e}function Dl(e,t){do{var n=Uc;try{if(Ha(),yo.current=fs,wo){for(var i=X.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}wo=!1}if(xo=0,Co=So=X=null,To=!1,Eo=0,Bc.current=null,n===null||n.return===null){qc=1,Jc=t,Uc=null;break}a:{var o=e,s=n.return,c=n,l=t;if(t=Wc,c.flags|=32768,typeof l==`object`&&l&&typeof l.then==`function`){var u=l,d=c,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var m=As(s);if(m!==null){m.flags&=-257,js(m,s,c,o,t),m.mode&1&&ks(o,u,t),t=m,l=u;var h=t.updateQueue;if(h===null){var g=new Set;g.add(l),t.updateQueue=g}else h.add(l);break a}if(!(t&1)){ks(o,u,t),kl();break a}l=Error(r(426))}else if(J&&c.mode&1){var _=As(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),js(_,s,c,o,t),Aa(Cs(l,c));break a}}o=l=Cs(l,c),qc!==4&&(qc=2),Qc===null?Qc=[o]:Qc.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var v=Ds(o,l,t);ro(o,v);break a;case 1:c=l;var y=o.type,b=o.stateNode;if(!(o.flags&128)&&(typeof y.getDerivedStateFromError==`function`||b!==null&&typeof b.componentDidCatch==`function`&&(al===null||!al.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var x=Os(o,c,t);ro(o,x);break a}}o=o.return}while(o!==null)}Pl(n)}catch(e){t=e,Uc===n&&n!==null&&(Uc=n=n.return);continue}break}while(1)}function Ol(){var e=zc.current;return zc.current=fs,e===null?fs:e}function kl(){(qc===0||qc===3||qc===2)&&(qc=4),Hc===null||!(Yc&268435455)&&!(Xc&268435455)||xl(Hc,Wc)}function Al(e,t){var n=Q;Q|=2;var i=Ol();(Hc!==e||Wc!==t)&&(nl=null,El(e,t));do try{jl();break}catch(t){Dl(e,t)}while(1);if(Ha(),Q=n,zc.current=i,Uc!==null)throw Error(r(261));return Hc=null,Wc=0,qc}function jl(){for(;Uc!==null;)Nl(Uc)}function Ml(){for(;Uc!==null&&!H();)Nl(Uc)}function Nl(e){var t=Ul(e.alternate,e,Gc);e.memoizedProps=e.pendingProps,t===null?Pl(e):Uc=t,Bc.current=null}function Pl(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=lc(n,t),n!==null){n.flags&=32767,Uc=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{qc=6,Uc=null;return}}else if(n=cc(n,t,Gc),n!==null){Uc=n;return}if(t=t.sibling,t!==null){Uc=t;return}Uc=t=e}while(t!==null);qc===0&&(qc=5)}function Fl(e,t,n){var r=W,i=Vc.transition;try{Vc.transition=null,W=1,Il(e,t,n,r)}finally{Vc.transition=i,W=r}return null}function Il(e,t,n,i){do Ll();while(sl!==null);if(Q&6)throw Error(r(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(r(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(It(e,o),e===Hc&&(Uc=Hc=null,Wc=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||ol||(ol=!0,Wl(gt,function(){return Ll(),null})),o=!!(n.flags&15990),n.subtreeFlags&15990||o){o=Vc.transition,Vc.transition=null;var s=W;W=1;var c=Q;Q|=4,Bc.current=null,gc(e,n),jc(n,e),Nr(yi),un=!!vi,yi=vi=null,e.current=n,Nc(n,e,a),ft(),Q=c,W=s,Vc.transition=o}else e.current=n;if(ol&&(ol=!1,sl=e,cl=a),o=e.pendingLanes,o===0&&(al=null),xt(n.stateNode,i),gl(e,U()),t!==null)for(i=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],i(a.value,{componentStack:a.stack,digest:a.digest});if(rl)throw rl=!1,e=il,il=null,e;return cl&1&&e.tag!==0&&Ll(),o=e.pendingLanes,o&1?e===ul?ll++:(ll=0,ul=e):ll=0,aa(),null}function Ll(){if(sl!==null){var e=Rt(cl),t=Vc.transition,n=W;try{if(Vc.transition=null,W=16>e?16:e,sl===null)var i=!1;else{if(e=sl,sl=null,cl=0,Q&6)throw Error(r(331));var a=Q;for(Q|=4,Z=e.current;Z!==null;){var o=Z,s=o.child;if(Z.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(Z=u;Z!==null;){var d=Z;switch(d.tag){case 0:case 11:case 15:_c(8,d,o)}var f=d.child;if(f!==null)f.return=d,Z=f;else for(;Z!==null;){d=Z;var p=d.sibling,m=d.return;if(bc(d),d===u){Z=null;break}if(p!==null){p.return=m,Z=p;break}Z=m}}}var h=o.alternate;if(h!==null){var g=h.child;if(g!==null){h.child=null;do{var _=g.sibling;g.sibling=null,g=_}while(g!==null)}}Z=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,Z=s;else b:for(;Z!==null;){if(o=Z,o.flags&2048)switch(o.tag){case 0:case 11:case 15:_c(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,Z=v;break b}Z=o.return}}var y=e.current;for(Z=y;Z!==null;){s=Z;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,Z=b;else b:for(s=y;Z!==null;){if(c=Z,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:vc(9,c)}}catch(e){$(c,c.return,e)}if(c===s){Z=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,Z=x;break b}Z=c.return}}if(Q=a,aa(),bt&&typeof bt.onPostCommitFiberRoot==`function`)try{bt.onPostCommitFiberRoot(yt,e)}catch{}i=!0}return i}finally{W=n,Vc.transition=t}}return!1}function Rl(e,t,n){t=Cs(n,t),t=Ds(e,t,1),e=to(e,t,1),t=pl(),e!==null&&(Ft(e,1,t),gl(e,t))}function $(e,t,n){if(e.tag===3)Rl(e,e,n);else for(;t!==null;){if(t.tag===3){Rl(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(al===null||!al.has(r))){e=Cs(n,e),e=Os(t,e,1),t=to(t,e,1),e=pl(),t!==null&&(Ft(t,1,e),gl(t,e));break}}t=t.return}}function zl(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=pl(),e.pingedLanes|=e.suspendedLanes&n,Hc===e&&(Wc&n)===n&&(qc===4||qc===3&&(Wc&130023424)===Wc&&500>U()-el?El(e,0):Zc|=n),gl(e,t)}function Bl(e,t){t===0&&(e.mode&1?(t=Dt,Dt<<=1,!(Dt&130023424)&&(Dt=4194304)):t=1);var n=pl();e=Xa(e,t),e!==null&&(Ft(e,t,n),gl(e,n))}function Vl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Bl(e,n)}function Hl(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),Bl(e,n)}var Ul=function(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps||Gi.current)Ns=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Ns=!1,nc(e,t,n);Ns=!!(e.flags&131072)}}else Ns=!1,J&&t.flags&1048576&&ga(t,la,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;ec(e,t),e=t.pendingProps;var a=qi(t,Wi.current);Ga(t,n),a=Ao(null,t,i,e,a,n);var o=jo();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ji(i)?(o=!0,Qi(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,Qa(t),a.updater=vs,t.stateNode=a,a._reactInternals=t,Ss(t,i,e,n),t=Hs(null,t,i,!0,o,n)):(t.tag=0,J&&o&&_a(t),Ps(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(ec(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=Jl(i),e=gs(i,e),a){case 0:t=Bs(null,t,i,e,n);break a;case 1:t=Vs(null,t,i,e,n);break a;case 11:t=Fs(null,t,i,e,n);break a;case 14:t=Is(null,t,i,gs(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:gs(i,a),Bs(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:gs(i,a),Vs(e,t,i,a,n);case 3:a:{if(Us(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,$a(e,t),io(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated){if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Cs(Error(r(423)),t),t=Ws(e,t,i,n,a);break a}if(i!==a){a=Cs(Error(r(424)),t),t=Ws(e,t,i,n,a);break a}for(ba=Di(t.stateNode.containerInfo.firstChild),ya=t,J=!0,xa=null,n=La(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(ka(),i===a){t=tc(e,t,n);break a}Ps(e,t,i,n)}t=t.child}return t;case 5:return mo(t),e===null&&Ta(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,bi(i,a)?s=null:o!==null&&bi(i,o)&&(t.flags|=32),zs(e,t),Ps(e,t,s,n),t.child;case 6:return e===null&&Ta(t),null;case 13:return qs(e,t,n);case 4:return fo(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Ia(t,null,i,n):Ps(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:gs(i,a),Fs(e,t,i,a,n);case 7:return Ps(e,t,t.pendingProps,n),t.child;case 8:return Ps(e,t,t.pendingProps.children,n),t.child;case 12:return Ps(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,q(Ra,i._currentValue),i._currentValue=s,o!==null){if(Er(o.value,s)){if(o.children===a.children&&!Gi.current){t=tc(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=eo(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Wa(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Wa(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}}Ps(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,Ga(t,n),a=Ka(a),i=i(a),t.flags|=1,Ps(e,t,i,n),t.child;case 14:return i=t.type,a=gs(i,t.pendingProps),a=gs(i.type,a),Is(e,t,i,a,n);case 15:return Ls(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:gs(i,a),ec(e,t),t.tag=1,Ji(i)?(e=!0,Qi(t)):e=!1,Ga(t,n),bs(t,i,a),Ss(t,i,a,n),Hs(null,t,i,!0,e,n);case 19:return $s(e,t,n);case 22:return Rs(e,t,n)}throw Error(r(156,t.tag))};function Wl(e,t){return V(e,t)}function Gl(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Kl(e,t,n,r){return new Gl(e,t,n,r)}function ql(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Jl(e){if(typeof e==`function`)return+!!ql(e);if(e!=null){if(e=e.$$typeof,e===j)return 11;if(e===P)return 14}return 2}function Yl(e,t){var n=e.alternate;return n===null?(n=Kl(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Xl(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)ql(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case E:return Zl(n.children,a,o,t);case D:s=8,a|=8;break;case O:return e=Kl(12,n,t,a|2),e.elementType=O,e.lanes=o,e;case M:return e=Kl(13,n,t,a),e.elementType=M,e.lanes=o,e;case N:return e=Kl(19,n,t,a),e.elementType=N,e.lanes=o,e;case I:return Ql(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case k:s=10;break a;case A:s=9;break a;case j:s=11;break a;case P:s=14;break a;case F:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=Kl(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function Zl(e,t,n,r){return e=Kl(7,e,r,t),e.lanes=n,e}function Ql(e,t,n,r){return e=Kl(22,e,r,t),e.elementType=I,e.lanes=n,e.stateNode={isHidden:!1},e}function $l(e,t,n){return e=Kl(6,e,null,t),e.lanes=n,e}function eu(e,t,n){return t=Kl(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function tu(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Pt(0),this.expirationTimes=Pt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Pt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function nu(e,t,n,r,i,a,o,s,c){return e=new tu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Kl(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Qa(a),e}function ru(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}function iu(e){if(!e)return Ui;e=e._reactInternals;a:{if(at(e)!==e||e.tag!==1)throw Error(r(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break a;case 1:if(Ji(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break a}}t=t.return}while(t!==null);throw Error(r(171))}if(e.tag===1){var n=e.type;if(Ji(n))return Zi(e,n,t)}return t}function au(e,t,n,r,i,a,o,s,c){return e=nu(n,r,!0,e,i,a,o,s,c),e.context=iu(null),n=e.current,r=pl(),i=ml(n),a=eo(r,i),a.callback=t??null,to(n,a,i),e.current.lanes=i,Ft(e,i,r),gl(e,r),e}function ou(e,t,n,r){var i=t.current,a=pl(),o=ml(i);return n=iu(n),t.context===null?t.context=n:t.pendingContext=n,t=eo(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=to(i,t,o),e!==null&&(hl(e,i,o,a),no(e,i,o)),o}function su(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function cu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function lu(e,t){cu(e,t),(e=e.alternate)&&cu(e,t)}function uu(){return null}var du=typeof reportError==`function`?reportError:function(e){console.error(e)};function fu(e){this._internalRoot=e}pu.prototype.render=fu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));ou(e,t,null,null)},pu.prototype.unmount=fu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;wl(function(){ou(null,e,null,null)}),t[Mi]=null}};function pu(e){this._internalRoot=e}pu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ht();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Zt.length&&t!==0&&t<Zt[n].priority;n++);Zt.splice(n,0,e),n===0&&nn(e)}};function mu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function hu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==` react-mount-point-unstable `))}function gu(){}function _u(e,t,n,r,i){if(i){if(typeof r==`function`){var a=r;r=function(){var e=su(o);a.call(e)}}var o=au(t,r,e,0,null,!1,!1,``,gu);return e._reactRootContainer=o,e[Mi]=o.current,oi(e.nodeType===8?e.parentNode:e),wl(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r==`function`){var s=r;r=function(){var e=su(c);s.call(e)}}var c=nu(e,0,!1,null,null,!1,!1,``,gu);return e._reactRootContainer=c,e[Mi]=c.current,oi(e.nodeType===8?e.parentNode:e),wl(function(){ou(t,c,n,r)}),c}function vu(e,t,n,r,i){var a=n._reactRootContainer;if(a){var o=a;if(typeof i==`function`){var s=i;i=function(){var e=su(o);s.call(e)}}ou(t,o,e,i)}else o=_u(n,t,e,i,r);return su(o)}zt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Ot(t.pendingLanes);n!==0&&(Lt(t,n|1),gl(t,U()),!(Q&6)&&(tl=U()+500,aa()))}break;case 13:wl(function(){var t=Xa(e,1);t!==null&&hl(t,e,1,pl())}),lu(e,1)}},Bt=function(e){if(e.tag===13){var t=Xa(e,134217728);t!==null&&hl(t,e,134217728,pl()),lu(e,134217728)}},Vt=function(e){if(e.tag===13){var t=ml(e),n=Xa(e,t);n!==null&&hl(n,e,t,pl()),lu(e,t)}},Ht=function(){return W},Ut=function(e,t){var n=W;try{return W=e,t()}finally{W=n}},Re=function(e,t,n){switch(t){case`input`:if(he(e,n),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name=`+JSON.stringify(``+t)+`][type="radio"]`),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var a=zi(i);if(!a)throw Error(r(90));ue(i),he(i,a)}}}break;case`textarea`:Se(e,n);break;case`select`:t=n.value,t!=null&&ye(e,!!n.multiple,t,!1)}},We=Cl,Ge=wl;var yu={usingClientEntryPoint:!1,Events:[Li,Ri,zi,He,Ue,Cl]},bu={findFiberByHostInstance:Ii,bundleType:0,version:`18.3.1`,rendererPackageName:`react-dom`},xu={bundleType:bu.bundleType,version:bu.version,rendererPackageName:bu.rendererPackageName,rendererConfig:bu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=lt(e),e===null?null:e.stateNode},findFiberByHostInstance:bu.findFiberByHostInstance||uu,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:`18.3.1-next-f1338f8080-20240426`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Su=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Su.isDisabled&&Su.supportsFiber)try{yt=Su.inject(xu),bt=Su}catch{}}e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=yu,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!mu(t))throw Error(r(200));return ru(e,t,null,n)},e.createRoot=function(e,t){if(!mu(e))throw Error(r(299));var n=!1,i=``,a=du;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=nu(e,1,!1,null,null,n,!1,i,a),e[Mi]=t.current,oi(e.nodeType===8?e.parentNode:e),new fu(t)},e.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(r(188)):(e=Object.keys(e).join(`,`),Error(r(268,e)));return e=lt(t),e=e===null?null:e.stateNode,e},e.flushSync=function(e){return wl(e)},e.hydrate=function(e,t,n){if(!hu(t))throw Error(r(200));return vu(null,e,t,!0,n)},e.hydrateRoot=function(e,t,n){if(!mu(e))throw Error(r(405));var i=n!=null&&n.hydratedSources||null,a=!1,o=``,s=du;if(n!=null&&(!0===n.unstable_strictMode&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=au(t,null,e,1,n??null,a,!1,o,s),e[Mi]=t.current,oi(e),i)for(e=0;e<i.length;e++)n=i[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new pu(t)},e.render=function(e,t,n){if(!hu(t))throw Error(r(200));return vu(null,e,t,!1,n)},e.unmountComponentAtNode=function(e){if(!hu(e))throw Error(r(40));return e._reactRootContainer?(wl(function(){vu(null,null,e,!1,function(){e._reactRootContainer=null,e[Mi]=null})}),!0):!1},e.unstable_batchedUpdates=Cl,e.unstable_renderSubtreeIntoContainer=function(e,t,n,i){if(!hu(n))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return vu(e,t,n,!1,i)},e.version=`18.3.1-next-f1338f8080-20240426`})),m=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=p()})),h=c(o((e=>{var t=m();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}))(),1),g=c(u(),1);function _(){let e=window.location;return`${e.protocol===`https:`?`wss:`:`ws:`}//${e.host}/ws`}function v(){let[e,t]=(0,g.useState)(null),[n,r]=(0,g.useState)(!1),[i,a]=(0,g.useState)(),o=(0,g.useRef)(),s=(0,g.useRef)(()=>void 0);return(0,g.useEffect)(()=>{let e=!1,n;function i(){o.current&&clearTimeout(o.current),n=new WebSocket(_()),n.onopen=()=>{r(!0),a(void 0)},n.onclose=()=>{r(!1),a(Date.now()),e||(o.current=setTimeout(i,1500))},n.onmessage=e=>{let n=JSON.parse(e.data);n.type===`roster`&&n.snapshot&&t(n.snapshot)}}return s.current=()=>{n?.readyState===WebSocket.OPEN||n?.readyState===WebSocket.CONNECTING?n.close():i()},i(),()=>{e=!0,o.current&&clearTimeout(o.current),n?.close()}},[]),{snapshot:e,connected:n,lastDisconnectedAt:i,reconnect:()=>s.current()}}var y=o((e=>{var t=u(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),b=o(((e,t)=>{t.exports=y()}))(),x={working:{label:`Working`,className:`bg-amber-500/15 text-amber-400 ring-amber-500/30`,pulse:!0},idle:{label:`Idle`,className:`bg-slate-500/15 text-slate-400 ring-slate-500/30`,pulse:!1},stalled:{label:`Stalled`,className:`bg-orange-500/10 text-orange-400 ring-orange-500/50 ring-2 ring-dashed`,pulse:!0},offline:{label:`Offline`,className:`bg-slate-700/20 text-slate-500 ring-slate-600/30`,pulse:!1},waiting_on_you:{label:`Needs you`,className:`bg-rose-500/15 text-rose-400 ring-rose-500/40`,pulse:!0},done:{label:`Done`,className:`bg-emerald-500/15 text-emerald-400 ring-emerald-500/30`,pulse:!1},error:{label:`Stale`,className:`bg-red-500/10 text-red-400 ring-red-500/50 ring-2 ring-dashed`,pulse:!1}};function S({status:e}){let t=x[e];return(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium ring-1 ${t.className}`,children:[(0,b.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-current ${t.pulse?`hive-pulse`:``}`}),t.label]})}var C=``;async function w(e){let t=await fetch(`${C}${e}`),n=await t.json();if(!t.ok)throw Error(n.error??`Request failed: ${t.status}`);return n}async function T(e,t){let n=await fetch(`${C}${e}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),r=await n.json();if(!n.ok)throw Error(r.error??`Request failed: ${n.status}`);return r}async function E(e){let t=await fetch(`${C}${e}`,{method:`DELETE`}),n=await t.json();if(!t.ok)throw Error(n.error??`Request failed: ${t.status}`);return n}async function D(e,t){let n=await fetch(`${C}${e}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),r=await n.json();if(!n.ok)throw Error(r.error??`Request failed: ${n.status}`);return r}function O(e){return T(`/api/orchestrator/start`,e)}function k(e,t=`claude`){return T(`/api/skills/discover`,{cwd:e,provider:t})}function A(e){return T(`/api/templates/discover`,{cwd:e})}function j(e,t,n){return T(`/api/templates`,{template:e,source:t,cwd:n})}function M(e,t){if(e.source===`built-in`)throw Error(`built-in templates are read-only`);return D(`/api/templates/${e.source}/${encodeURIComponent(e.id)}`,{template:e,cwd:t})}function N(e,t){if(e.source===`built-in`)throw Error(`built-in templates cannot be deleted`);let n=t?`?cwd=${encodeURIComponent(t)}`:``;return E(`/api/templates/${e.source}/${encodeURIComponent(e.id)}${n}`)}function P(e){return T(`/api/directories/suggest`,{input:e})}function F(e){return T(`/api/paths/inspect`,{input:e})}function I(e,t){return T(`/api/mission/${encodeURIComponent(e)}/message`,{text:t})}function ee(e,t,n){return T(`/api/mission/${encodeURIComponent(e)}/decision/${encodeURIComponent(t)}/answer`,{answer:n})}function te(e,t){return T(`/api/mission/${encodeURIComponent(e)}/rename`,{name:t})}function L(e,t){return T(`/api/mission/${encodeURIComponent(e)}/status`,{status:t})}function ne(){return T(`/api/direct-studio/clear-completed`,{})}function R(e){return E(`/api/mission/${encodeURIComponent(e)}`)}function re(e,t){return T(`/api/mission/${encodeURIComponent(e)}/action`,{action:t})}function z(e,t,n){return T(`/api/mission/${encodeURIComponent(e)}/gate/${encodeURIComponent(t)}/waive`,{reason:n})}function ie(e,t){return T(`/api/mission/${encodeURIComponent(e)}/gate`,t)}function B(e,t,n){return D(`/api/mission/${encodeURIComponent(e)}/gate/${encodeURIComponent(t)}`,n)}function ae(e,t){return E(`/api/mission/${encodeURIComponent(e)}/gate/${encodeURIComponent(t)}`)}function oe(e){return w(`/api/mission/${encodeURIComponent(e)}/plan/revisions`)}function se(e,t,n){return T(`/api/mission/${encodeURIComponent(e)}/plan/approval`,{status:t,reason:n})}function ce(e,t,n,r){return T(`/api/mission/${encodeURIComponent(e)}/task/${encodeURIComponent(t)}/action`,{action:n,detail:r})}function le(e,t){return T(`/api/mission/${encodeURIComponent(e)}/task`,{description:t})}function ue(e,t={}){let n=new URLSearchParams;t.before!==void 0&&n.set(`before`,String(t.before)),t.limit!==void 0&&n.set(`limit`,String(t.limit));let r=n.size?`?${n}`:``;return w(`/api/mission/${encodeURIComponent(e)}/messages${r}`)}function de(e){return w(`/api/mission/${encodeURIComponent(e)}/context`)}function fe(e){return T(`/api/mission/${encodeURIComponent(e)}/handoff`,{})}function pe(e,t){return`${C}/api/mission/${encodeURIComponent(e)}/report?format=${t}`}function me(e,t,n){return T(`/api/mission/${encodeURIComponent(e)}/report/github`,{kind:t,target:n,confirmed:!0})}function he(){return w(`/api/policies`)}function ge(e){return D(`/api/policies`,e)}function _e(e,t){return D(`/api/mission/${encodeURIComponent(e)}/policy`,{policy:t,confirmed:!0})}function ve(){return w(`/api/providers/models`)}function ye(e,t=!1){return T(`/api/session/${e}/stop`,{force:t})}function be(e,t){return T(`/api/session/${encodeURIComponent(e)}/adopt`,{name:t})}function xe({value:e,onChange:t,skills:n,placeholder:r,rows:i=3,onSubmit:a,className:o=``,suggestionsPlacement:s=`above`,autoFocus:c=!1,focusCaret:l}){let u=(0,g.useMemo)(()=>new Map(n.map(e=>[e.name,e.source])),[n]),d=e=>u.get(e)===`claude`?`text-sky-300`:`text-violet-300`,[f,p]=(0,g.useState)(()=>l===`end`?e.length:0),[m,h]=(0,g.useState)(0),_=(0,g.useRef)(null),v=(0,g.useRef)(null),y=e.slice(0,f).match(/(?:^|\s)\/([\w:-]*)$/),x=y?n.filter(e=>e.name.toLowerCase().startsWith(y[1].toLowerCase())).slice(0,8):[];(0,g.useEffect)(()=>{if(!c||!l)return;let t=l===`end`?e.length:0,n=requestAnimationFrame(()=>{_.current?.focus(),_.current?.setSelectionRange(t,t),p(t)});return()=>cancelAnimationFrame(n)},[]);function S(n){if(!y)return;let r=f-y[1].length-1,i=`${e.slice(0,r)}/${n.name} ${e.slice(f)}`,a=r+n.name.length+2;t(i),p(a),h(0),requestAnimationFrame(()=>{_.current?.focus(),_.current?.setSelectionRange(a,a)})}function C(e){v.current&&(v.current.scrollTop=e.scrollTop,v.current.scrollLeft=e.scrollLeft)}return(0,b.jsxs)(`div`,{className:`relative ${o}`,children:[(0,b.jsx)(`div`,{ref:v,"aria-hidden":!0,className:`pointer-events-none absolute inset-0 whitespace-pre-wrap break-words overflow-hidden rounded-lg border border-transparent py-1.5 pl-2 pr-6 text-sm leading-5`,children:e.split(/(\/[\w:-]+)/g).map((e,t)=>e.startsWith(`/`)&&u.has(e.slice(1))?(0,b.jsx)(`span`,{className:d(e.slice(1)),children:e},t):(0,b.jsx)(`span`,{className:`text-white`,children:e},t))}),(0,b.jsx)(`textarea`,{ref:_,value:e,onScroll:e=>C(e.currentTarget),onChange:e=>{t(e.target.value),p(e.target.selectionStart),h(0),requestAnimationFrame(()=>C(e.target))},onClick:e=>p(e.currentTarget.selectionStart),onKeyUp:e=>p(e.currentTarget.selectionStart),onKeyDown:e=>{if(x.length){if(e.key===`ArrowDown`){e.preventDefault(),h((m+1)%x.length);return}if(e.key===`ArrowUp`){e.preventDefault(),h((m-1+x.length)%x.length);return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault(),S(x[m]);return}}a&&e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),a())},rows:i,placeholder:r,autoFocus:c,className:`relative w-full resize-none overflow-y-auto bg-transparent py-1.5 pl-2 pr-6 text-sm leading-5 text-transparent caret-white outline-none placeholder:text-white/25`}),x.length>0&&(0,b.jsx)(`div`,{className:`absolute left-0 right-0 z-30 overflow-hidden rounded-lg border border-white/10 bg-[#17171c] shadow-2xl ${s===`above`?`bottom-full mb-2`:`top-full mt-2`}`,children:x.map((e,t)=>(0,b.jsxs)(`button`,{type:`button`,onMouseDown:t=>{t.preventDefault(),S(e)},className:`flex w-full items-start justify-between gap-4 px-3 py-2 text-left ${t===m?`bg-violet-400/10`:`hover:bg-white/5`}`,children:[(0,b.jsxs)(`span`,{className:`min-w-0`,children:[(0,b.jsxs)(`span`,{className:`text-sm ${e.source===`claude`?`text-sky-300`:`text-violet-300`}`,children:[`/`,e.name]}),e.argumentHint&&(0,b.jsx)(`span`,{className:`ml-1.5 font-mono text-[10px] text-amber-200/45`,children:e.argumentHint}),e.description&&(0,b.jsx)(`span`,{className:`mt-0.5 block line-clamp-1 text-[11px] text-white/35`,children:e.description})]}),(0,b.jsx)(`span`,{className:`shrink-0 text-[10px] uppercase text-white/20`,children:e.source})]},`${e.source}:${e.name}`))})]})}function Se(e){let t=(0,g.useRef)(!1);return{onMouseDown:e=>{t.current=e.target===e.currentTarget},onClick:n=>{t.current&&n.target===n.currentTarget&&e(),t.current=!1}}}function Ce({value:e,onChange:t}){return(0,b.jsxs)(`div`,{className:`space-y-3`,children:[(0,b.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:[[`networkAccess`,`Network access`],[`commits`,`Git commits`],[`pushes`,`Git pushes`],[`pullRequests`,`Pull requests`],[`releases`,`Releases / publishing`],[`destructiveActions`,`Destructive commands`]].map(([n,r])=>(0,b.jsxs)(`label`,{className:`flex items-center gap-2 rounded-lg border border-white/[0.07] px-3 py-2 text-xs text-white/45`,children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:!!e[n],onChange:r=>t({...e,[n]:r.target.checked})}),r]},n))}),(0,b.jsxs)(`label`,{className:`block text-[10px] text-white/35`,children:[`Allowed repository roots `,(0,b.jsx)(`span`,{className:`text-white/20`,children:`(one per line; blank allows any directory)`}),(0,b.jsx)(`textarea`,{rows:2,value:e.allowedRoots.join(`
9
+ `),onChange:n=>t({...e,allowedRoots:n.target.value.split(`
10
+ `).map(e=>e.trim()).filter(Boolean)}),className:`mt-1 w-full rounded-lg border border-white/10 bg-black/20 p-2 font-mono text-xs text-white/60 outline-none`})]}),(0,b.jsxs)(`label`,{className:`block text-[10px] text-white/35`,children:[`Allowed Claude tools `,(0,b.jsx)(`span`,{className:`text-white/20`,children:`(comma separated; blank uses normal CLI availability)`}),(0,b.jsx)(`input`,{value:e.allowedTools.join(`, `),onChange:n=>t({...e,allowedTools:n.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)}),className:`mt-1 w-full rounded-lg border border-white/10 bg-black/20 p-2 font-mono text-xs text-white/60 outline-none`})]})]})}var we=e=>typeof window>`u`?null:localStorage.getItem(e);function Te({onClose:e,initialDraft:t}){let n=Se(e),[r,i]=(0,g.useState)(t?.task??``),[a,o]=(0,g.useState)(``),[s,c]=(0,g.useState)(()=>t?.cwd??we(`hive:last-cwd`)??``),[l,u]=(0,g.useState)(()=>t?.mode??(we(`hive:last-mode`)||`direct`)),[d,f]=(0,g.useState)(t?.provider??`claude`),[p,m]=(0,g.useState)(t?.model??``),[h,_]=(0,g.useState)(()=>t?.worktree??(we(`hive:last-mode`)||`direct`)===`orchestrated`),v=(0,g.useRef)(t?.worktree!==void 0);function y(e){u(e),v.current||_(e===`orchestrated`)}let[x,S]=(0,g.useState)(!1),[C,w]=(0,g.useState)(null),[T,E]=(0,g.useState)([]),[D,j]=(0,g.useState)(null),[M,N]=(0,g.useState)([]),[I,ee]=(0,g.useState)([]),[te,L]=(0,g.useState)(!1),[ne,R]=(0,g.useState)(!1),re=(0,g.useRef)(null),[z,ie]=(0,g.useState)(),[B,ae]=(0,g.useState)(!1),[oe,se]=(0,g.useState)(!1),[ce,le]=(0,g.useState)({}),[ue,de]=(0,g.useState)([]),[fe,pe]=(0,g.useState)(``),[me,ge]=(0,g.useState)([]),[_e,ye]=(0,g.useState)(),[be,Te]=(0,g.useState)(),[Ee,De]=(0,g.useState)(!1),[Oe,ke]=(0,g.useState)(t?.planFirst??!1);(0,g.useEffect)(()=>{let t=t=>{t.key===`Escape`&&e()};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e]),(0,g.useEffect)(()=>{if(!te)return;let e=e=>{re.current?.contains(e.target)||L(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[te]),(0,g.useEffect)(()=>{ve().then(({providers:e})=>ge(e)).catch(()=>ge([]))},[]),(0,g.useEffect)(()=>{he().then(({policy:e})=>{ye(e),Te(e)}).catch(()=>void 0)},[]),(0,g.useEffect)(()=>{P(``).then(({directories:e})=>{ee(e),!s.trim()&&e[0]&&c(e[0].path)}).catch(()=>ee([]))},[]),(0,g.useEffect)(()=>{s&&z?.exists&&!z.repositoryRoot&&R(!0)},[s,z]),(0,g.useEffect)(()=>{let e=setTimeout(()=>{Promise.allSettled([k(s.trim()||void 0,d),P(s),F(s.trim()||void 0),A(s.trim()||void 0)]).then(([e,t,n,r])=>{e.status===`fulfilled`?(E(e.value.skills),j(null)):(E([]),j(e.reason.message)),t.status===`fulfilled`&&N(t.value.directories),n.status===`fulfilled`&&ie(n.value),r.status===`fulfilled`&&de(r.value.templates)})},250);return()=>clearTimeout(e)},[s,d]);async function Ae(){if(r.trim()){S(!0),w(null);try{await O({task:r,name:a.trim()||void 0,worktree:d===`claude`&&h,cwd:s.trim()||void 0,mode:l,budgets:ce,templateId:fe||void 0,provider:d,model:p.trim()||void 0,policy:Ee?be:void 0,planFirst:l===`orchestrated`&&Oe});try{s.trim()&&localStorage.setItem(`hive:last-cwd`,s.trim()),localStorage.setItem(`hive:last-mode`,l)}catch{}e()}catch(e){w(e.message)}finally{S(!1)}}}let je=me.find(e=>e.provider===d),Me=ue.find(e=>e.id===fe),Ne=z?.repositoryRoot?.split(`/`).filter(Boolean).at(-1)??s.split(`/`).filter(Boolean).at(-1)??`working directory`,Pe=p?je?.models.find(e=>e.id===p)?.label??p:je?.defaultModel?.label?`Default (${je.defaultModel.label})`:`CLI default`,Fe=[l===`orchestrated`?`Orchestrated`:`Direct`,`${d===`claude`?`Claude`:`Codex`} ${Pe}`,Ne,d===`claude`&&h&&z?.repositoryRoot?`isolated worktree`:`current checkout`,l===`orchestrated`&&Oe?`plan approval required`:void 0].filter(Boolean).join(` · `);return(0,b.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,...n,children:(0,b.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`new-mission-title`,className:`relative max-h-[calc(100dvh-2rem)] w-full max-w-xl overflow-y-auto overscroll-contain rounded-xl border border-white/10 bg-[#0f0f12] p-5 shadow-2xl shadow-black/40`,onClick:e=>e.stopPropagation(),children:[(0,b.jsxs)(`div`,{className:`mb-5 flex items-center justify-between`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h2`,{id:`new-mission-title`,className:`text-sm font-medium text-white`,children:`New mission`}),(0,b.jsx)(`p`,{className:`mt-1 text-[10px] text-white/25`,children:`Define the work, choose how it runs, then launch.`})]}),(0,b.jsx)(`button`,{type:`button`,onClick:e,"aria-label":`Close new mission dialog`,className:`rounded-lg border border-transparent px-2.5 py-1.5 text-sm text-white/35 transition hover:border-white/10 hover:bg-white/5 hover:text-white/75`,children:`×`})]}),(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`p`,{className:`mb-3 text-[9px] font-semibold uppercase tracking-[0.18em] text-amber-200/40`,children:`Mission`}),(0,b.jsx)(`label`,{className:`mb-1 block text-xs text-white/40`,children:`Task`}),(0,b.jsx)(`div`,{className:`rounded-lg border border-white/10 bg-transparent p-1 focus-within:border-white/25`,children:(0,b.jsx)(xe,{value:r,onChange:i,skills:T,rows:4,suggestionsPlacement:`below`,placeholder:`What should this mission accomplish? Type / to use a skill.`,autoFocus:!0,focusCaret:t?.task?`end`:void 0,onSubmit:Ae})}),(0,b.jsx)(`p`,{className:`mb-3 mt-1.5 text-[10px] text-white/22`,children:`Enter to launch · Shift+Enter for a new line · / for skills`}),(0,b.jsxs)(`label`,{className:`mb-1 block text-xs text-white/40`,children:[`Name `,(0,b.jsx)(`span`,{className:`text-white/20`,children:`(optional)`})]}),(0,b.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),placeholder:`e.g. billing-refactor`,className:`mb-3 w-full rounded-lg border border-white/10 bg-white/[0.03] p-2.5 text-sm text-white placeholder:text-white/25 focus:border-white/25 focus:outline-none`}),ne?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`mb-1 flex items-center justify-between`,children:[(0,b.jsx)(`label`,{className:`text-xs text-white/40`,children:`Custom working directory`}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>{R(!1),I[0]&&c(I[0].path),L(!1)},className:`text-[10px] text-violet-300/45 hover:text-violet-200`,children:`Choose a repository instead`})]}),(0,b.jsxs)(`div`,{ref:re,className:`relative`,children:[(0,b.jsx)(`input`,{value:s,onFocus:()=>L(!0),onChange:e=>c(e.target.value),placeholder:`~/Development/project or /absolute/path`,className:`w-full rounded-lg border border-white/10 bg-white/[0.03] p-2.5 font-mono text-xs text-white placeholder:text-white/25 focus:border-white/25 focus:outline-none`}),te&&M.length>0&&(0,b.jsx)(`div`,{className:`absolute left-0 right-0 top-full z-20 mt-1 max-h-56 overflow-y-auto rounded-lg border border-white/10 bg-[#17171c] p-1 shadow-2xl`,children:M.map(e=>(0,b.jsxs)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>{c(e.path),L(!1)},className:`block w-full rounded-md px-3 py-2 text-left hover:bg-white/5`,children:[(0,b.jsx)(`span`,{className:`block font-mono text-xs text-white/75`,children:e.path}),e.path!==e.resolvedPath&&(0,b.jsx)(`span`,{className:`mt-0.5 block truncate font-mono text-[10px] text-white/25`,children:e.resolvedPath})]},e.resolvedPath))})]})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`mb-1 flex items-center justify-between`,children:[(0,b.jsx)(`label`,{className:`text-xs text-white/40`,children:`Repository`}),(0,b.jsx)(`span`,{className:`text-[10px] text-white/20`,children:`Recent Git repositories`})]}),(0,b.jsxs)(`select`,{value:s,onChange:e=>{e.target.value===`__custom__`?(R(!0),L(!1)):c(e.target.value)},className:`w-full rounded-lg border border-white/10 bg-[#151519] p-2.5 font-mono text-xs text-white/70 outline-none focus:border-white/25`,children:[s&&!I.some(e=>e.path===s||e.resolvedPath===s)&&(0,b.jsx)(`option`,{value:s,children:s}),I.map(e=>(0,b.jsx)(`option`,{value:e.path,children:e.path},e.resolvedPath)),(0,b.jsx)(`option`,{value:`__custom__`,children:`Custom working directory…`})]})]}),z&&(0,b.jsx)(`div`,{className:`mt-2 rounded-lg border px-3 py-2 ${z.exists?`border-white/[0.06] bg-white/[0.018]`:`border-rose-400/15 bg-rose-400/[0.04]`}`,children:z.exists?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-[10px]`,children:[(0,b.jsx)(`span`,{className:`font-mono text-white/45`,children:Ne}),(0,b.jsx)(`span`,{className:z.repositoryRoot?`text-emerald-300/45`:`text-amber-200/45`,children:z.repositoryRoot?`Git repository`:`Non-Git directory`}),z.branch&&(0,b.jsx)(`span`,{className:`text-violet-300/50`,children:z.branch}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>se(!oe),className:`ml-auto text-white/25 hover:text-white/50`,children:oe?`Hide details`:`View project details`})]}),oe&&(0,b.jsxs)(`div`,{className:`mt-2 border-t border-white/[0.05] pt-2`,children:[(0,b.jsx)(`p`,{className:`break-all font-mono text-[9px] text-white/25`,children:z.resolvedPath}),(0,b.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:z.configuration.map(e=>(0,b.jsxs)(`span`,{className:`rounded px-1.5 py-0.5 text-[9px] ${e.available?`bg-emerald-300/[0.07] text-emerald-200/45`:`bg-white/[0.025] text-white/18`}`,children:[e.available?`✓`:`—`,` `,e.label]},e.label))})]})]}):(0,b.jsxs)(`p`,{className:`text-[11px] text-rose-300/70`,children:[`Directory not found: `,(0,b.jsx)(`span`,{className:`font-mono`,children:z.resolvedPath})]})}),(0,b.jsx)(`p`,{className:`mt-2 text-[10px] ${D?`text-rose-400`:`text-white/22`}`,children:D??`${T.length} skill${T.length===1?``:`s`} available`})]}),(0,b.jsxs)(`section`,{className:`mt-5 border-t border-white/[0.06] pt-5`,children:[(0,b.jsx)(`p`,{className:`mb-3 text-[9px] font-semibold uppercase tracking-[0.18em] text-violet-200/40`,children:`Execution`}),(0,b.jsx)(`div`,{className:`mb-3 grid grid-cols-2 gap-2`,children:[`direct`,`orchestrated`].map(e=>(0,b.jsxs)(`button`,{type:`button`,"aria-pressed":l===e,onClick:()=>y(e),className:`rounded-lg border p-3 text-left transition hover:-translate-y-0.5 ${l===e?`border-violet-400/40 bg-violet-400/10`:`border-white/10 bg-white/[0.02] hover:bg-white/[0.04]`}`,children:[(0,b.jsx)(`span`,{className:`block text-sm font-medium capitalize text-white/85`,children:e}),(0,b.jsx)(`span`,{className:`mt-1 block text-[10px] leading-relaxed text-white/32`,children:e===`direct`?`One agent for focused work.`:`A manager coordinates parallel workers.`})]},e))}),(0,b.jsx)(`div`,{className:`mb-3 grid grid-cols-2 gap-2`,children:[`claude`,`codex`].map(e=>{let t=me.find(t=>t.provider===e)?.available===!1;return(0,b.jsxs)(`button`,{type:`button`,disabled:t,"aria-pressed":d===e,onClick:()=>{f(e),m(``)},className:`rounded-lg border px-3 py-2.5 text-left transition disabled:cursor-not-allowed disabled:opacity-35 ${d===e?e===`codex`?`border-emerald-300/35 bg-emerald-300/[0.08]`:`border-violet-300/35 bg-violet-300/[0.08]`:`border-white/10 bg-white/[0.02] hover:bg-white/[0.04]`}`,children:[(0,b.jsx)(`span`,{className:`text-xs font-medium capitalize text-white/75`,children:e}),t&&(0,b.jsx)(`span`,{className:`ml-2 text-[8px] uppercase text-rose-300/60`,children:`Not detected`})]},e)})}),(0,b.jsx)(`label`,{className:`mb-1 block text-xs text-white/40`,children:`Model`}),(0,b.jsxs)(`select`,{value:p,onChange:e=>m(e.target.value),className:`mb-3 w-full rounded-lg border border-white/10 bg-[#151519] p-2.5 font-mono text-xs text-white/70 outline-none focus:border-white/25`,children:[(0,b.jsxs)(`option`,{value:``,children:[`CLI default`,je?.defaultModel?` (${je.defaultModel.label})`:``,` · recommended`]}),(je?.models??[]).map(e=>(0,b.jsxs)(`option`,{value:e.id,children:[e.label,` · `,e.description??e.id]},e.id))]}),(0,b.jsx)(`p`,{className:`mb-2 text-[10px] font-medium text-white/30`,children:`Launch options`}),(0,b.jsxs)(`div`,{className:`mb-3 grid gap-2 ${l===`orchestrated`?`sm:grid-cols-2`:``}`,children:[(0,b.jsxs)(`label`,{className:`flex items-start gap-2 rounded-lg border px-3 py-2.5 ${d===`claude`&&z?.repositoryRoot?`cursor-pointer border-white/[0.07] bg-white/[0.015]`:`cursor-not-allowed border-white/[0.04] bg-white/[0.008] opacity-45`}`,children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:d===`claude`&&!!z?.repositoryRoot&&h,disabled:d!==`claude`||!z?.repositoryRoot,onChange:e=>{v.current=!0,_(e.target.checked)},className:`mt-0.5 accent-violet-400`}),(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`span`,{className:`block text-xs text-white/60`,children:`Isolated worktree`}),(0,b.jsx)(`span`,{className:`mt-0.5 block text-[9px] text-white/25`,children:`Separate checkout for this mission.`})]})]}),l===`orchestrated`&&(0,b.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-lg border px-3 py-2.5 ${Oe?`border-amber-300/25 bg-amber-300/[0.05]`:`border-white/[0.07] bg-white/[0.015]`}`,children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:Oe,onChange:e=>ke(e.target.checked),className:`mt-0.5 accent-amber-300`}),(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`span`,{className:`block text-xs text-white/60`,children:`Plan first`}),(0,b.jsx)(`span`,{className:`mt-0.5 block text-[9px] text-white/25`,children:`Approve the plan before workers begin.`})]})]})]}),(0,b.jsx)(`label`,{className:`mb-1 block text-xs text-white/40`,children:`Mission template`}),(0,b.jsxs)(`select`,{value:fe,onChange:e=>{let t=e.target.value;pe(t);let n=ue.find(e=>e.id===t);n&&(u(n.mode),v.current=!0,_(n.worktree),le(n.budgets??{}))},className:`w-full rounded-lg border border-white/10 bg-[#151519] px-3 py-2.5 text-xs text-white/60`,children:[(0,b.jsx)(`option`,{value:``,children:`No template`}),ue.map(e=>(0,b.jsxs)(`option`,{value:e.id,children:[e.name,` · v`,e.version,` · `,e.source]},`${e.source}:${e.id}`))]}),Me&&(0,b.jsxs)(`div`,{className:`mt-2 rounded-lg border border-violet-300/10 bg-violet-300/[0.03] px-3 py-2`,children:[(0,b.jsx)(`p`,{className:`text-[10px] text-white/45`,children:Me.description}),(0,b.jsxs)(`p`,{className:`mt-1 truncate text-[9px] text-white/22`,children:[Me.stages.map(e=>e.title).join(` → `),` · `,Me.gates.length,` required gate`,Me.gates.length===1?``:`s`]})]})]}),(0,b.jsxs)(`section`,{className:`mt-4 rounded-lg border border-white/[0.06] bg-white/[0.012]`,children:[(0,b.jsxs)(`button`,{type:`button`,onClick:()=>ae(!B),className:`flex w-full items-center justify-between px-3 py-3 text-left`,children:[(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`span`,{className:`block text-xs font-medium text-white/50`,children:`Advanced settings`}),(0,b.jsx)(`span`,{className:`mt-0.5 block text-[10px] text-white/22`,children:`Permission policy and mission budgets`})]}),(0,b.jsx)(`span`,{className:`text-xs text-white/25`,children:B?`−`:`+`})]}),B&&(0,b.jsxs)(`div`,{className:`space-y-5 border-t border-white/[0.05] p-3`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-white/50`,children:`Permission policy`}),(0,b.jsx)(`p`,{className:`mt-0.5 text-[9px] text-white/22`,children:Ee?`Custom mission override`:`Workspace defaults and template restrictions`})]}),Ee&&_e&&(0,b.jsx)(`button`,{type:`button`,onClick:()=>{Te(_e),De(!1)},className:`text-[9px] text-white/25 hover:text-white/50`,children:`Reset`})]}),be?(0,b.jsx)(Ce,{value:be,onChange:e=>{Te(e),De(!0)}}):(0,b.jsx)(`p`,{className:`text-xs text-white/25`,children:`Loading policy…`})]}),(0,b.jsxs)(`div`,{className:`border-t border-white/[0.05] pt-4`,children:[(0,b.jsxs)(`p`,{className:`mb-3 text-xs font-medium text-white/50`,children:[`Mission budgets `,(0,b.jsx)(`span`,{className:`font-normal text-white/20`,children:`· optional soft limits`})]}),(0,b.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:[[`maxWorkers`,`Maximum workers`,`e.g. 8`],[`maxConcurrentWorkers`,`Concurrent workers`,`e.g. 4`],[`maxTokens`,`Token budget`,`e.g. 100000`],[`maxElapsedMinutes`,`Time budget (minutes)`,`e.g. 120`]].map(([e,t,n])=>(0,b.jsxs)(`label`,{className:`text-[10px] text-white/35`,children:[t,(0,b.jsx)(`input`,{type:`number`,min:`1`,value:ce[e]??``,onChange:t=>le(n=>({...n,[e]:t.target.value?Math.max(1,Number(t.target.value)):void 0})),placeholder:n,className:`mt-1 w-full rounded-md border border-white/10 bg-black/20 px-2 py-1.5 text-xs text-white/65 outline-none focus:border-amber-300/25`})]},e))})]})]})]}),C&&(0,b.jsx)(`p`,{className:`mt-3 text-xs text-rose-400`,children:C}),(0,b.jsxs)(`div`,{className:`mt-4 border-t border-white/[0.06] pt-4`,children:[(0,b.jsx)(`p`,{className:`mb-3 truncate text-[10px] text-white/28`,title:Fe,children:Fe}),(0,b.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,b.jsx)(`button`,{onClick:e,className:`rounded-lg px-3 py-1.5 text-sm text-white/45 hover:text-white/75`,children:`Cancel`}),(0,b.jsx)(`button`,{onClick:Ae,disabled:x||!r.trim()||!!D||z?.exists===!1,className:`rounded-lg bg-white/90 px-3 py-1.5 text-sm font-medium text-black disabled:opacity-40`,children:x?`Starting…`:`Start ${l} mission`})]})]})]})})}function Ee({missionId:e,name:t,large:n=!1}){let[r,i]=(0,g.useState)(!1),[a,o]=(0,g.useState)(t),[s,c]=(0,g.useState)(!1),l=(0,g.useRef)(null);(0,g.useEffect)(()=>o(t),[t]),(0,g.useEffect)(()=>{r&&l.current?.select()},[r]);async function u(){let n=a.trim();if(!n||n===t){o(t),i(!1);return}c(!0);try{await te(e,n),i(!1)}finally{c(!1)}}return r?(0,b.jsx)(`input`,{ref:l,value:a,disabled:s,onChange:e=>o(e.target.value),onClick:e=>e.stopPropagation(),onBlur:u,onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`&&u(),e.key===`Escape`&&(o(t),i(!1))},className:`${n?`text-xl`:`text-sm`} min-w-0 max-w-full rounded border border-violet-400/40 bg-black/30 px-1.5 py-0.5 font-semibold text-white outline-none`}):(0,b.jsxs)(`div`,{className:`group/name flex min-w-0 items-center gap-1.5`,children:[(0,b.jsx)(`span`,{className:`${n?`text-xl`:`text-sm`} truncate font-semibold text-white`,children:t}),(0,b.jsx)(`button`,{type:`button`,title:`Rename mission`,onClick:e=>{e.stopPropagation(),i(!0)},className:`shrink-0 rounded p-1 text-white/25 opacity-0 transition hover:bg-white/10 hover:text-white/70 group-hover/name:opacity-100`,children:`✎`})]})}function De({compact:e=!1}){return(0,b.jsx)(`div`,{className:`hive-mark ${e?`h-8 w-8`:`h-10 w-10`}`,"aria-hidden":`true`,children:(0,b.jsxs)(`svg`,{viewBox:`0 0 48 48`,fill:`none`,className:`h-full w-full`,children:[(0,b.jsx)(`path`,{d:`M24 3.5 41.75 13.75v20.5L24 44.5 6.25 34.25v-20.5L24 3.5Z`,fill:`url(#hive-fill)`,stroke:`url(#hive-stroke)`,strokeWidth:`1.5`}),(0,b.jsx)(`path`,{d:`M17.5 19.2c-4.8-4.4-8.7.4-4.5 4.3 1.7 1.6 4 1.8 6.2 1M30.5 19.2c4.8-4.4 8.7.4 4.5 4.3-1.7 1.6-4 1.8-6.2 1`,fill:`#f7b93e`,fillOpacity:`.2`,stroke:`#f7c65a`,strokeWidth:`1.4`,strokeLinecap:`round`}),(0,b.jsx)(`path`,{d:`M18.5 22.5c0-3 2.45-5.5 5.5-5.5s5.5 2.5 5.5 5.5v4c0 3.6-2.45 6.5-5.5 6.5s-5.5-2.9-5.5-6.5v-4Z`,fill:`#f7b93e`}),(0,b.jsx)(`path`,{d:`M19 23h10M18.7 27.5h10.6`,stroke:`#30230b`,strokeWidth:`2.4`}),(0,b.jsx)(`path`,{d:`m21 32.1 3 3 3-3`,fill:`#f7b93e`}),(0,b.jsx)(`circle`,{cx:`22`,cy:`20.5`,r:`.8`,fill:`#30230b`}),(0,b.jsx)(`circle`,{cx:`26`,cy:`20.5`,r:`.8`,fill:`#30230b`}),(0,b.jsxs)(`defs`,{children:[(0,b.jsxs)(`linearGradient`,{id:`hive-fill`,x1:`9`,y1:`7`,x2:`39`,y2:`42`,gradientUnits:`userSpaceOnUse`,children:[(0,b.jsx)(`stop`,{stopColor:`#F9C74F`,stopOpacity:`.22`}),(0,b.jsx)(`stop`,{offset:`1`,stopColor:`#7C3AED`,stopOpacity:`.1`})]}),(0,b.jsxs)(`linearGradient`,{id:`hive-stroke`,x1:`8`,y1:`8`,x2:`40`,y2:`41`,gradientUnits:`userSpaceOnUse`,children:[(0,b.jsx)(`stop`,{stopColor:`#FFD875`}),(0,b.jsx)(`stop`,{offset:`1`,stopColor:`#A78BFA`,stopOpacity:`.55`})]})]})]})})}function Oe({subtitle:e}){return(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,b.jsx)(De,{}),(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`h1`,{className:`hive-wordmark text-xl text-white`,children:`Hive`}),(0,b.jsx)(`span`,{className:`rounded-full border border-amber-300/15 bg-amber-300/[0.06] px-1.5 py-0.5 text-[8px] font-bold uppercase tracking-[0.18em] text-amber-200/55`,children:`Mission control`})]}),e&&(0,b.jsx)(`p`,{className:`mt-0.5 text-xs text-white/35`,children:e})]})]})}function ke({label:e,eyebrow:t,title:n,subtitle:r,accent:i=`amber`,onClose:a,closeLabel:o,children:s,afterHeader:c}){(0,g.useEffect)(()=>{let e=e=>{e.key===`Escape`&&a()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[a]);let l=Se(a),u=i===`fuchsia`?`text-fuchsia-300/60`:`text-amber-300/55`;return(0,b.jsx)(`div`,{className:`fixed inset-0 z-50 flex justify-end bg-black/55`,role:`presentation`,...l,children:(0,b.jsxs)(`aside`,{role:`dialog`,"aria-modal":`true`,"aria-label":e,onMouseDown:e=>e.stopPropagation(),className:`flex h-full w-full max-w-[480px] flex-col border-l border-white/10 bg-[#0d0d10] shadow-2xl`,children:[(0,b.jsxs)(`div`,{className:`sticky top-0 z-10 flex shrink-0 items-start justify-between gap-4 border-b border-white/8 bg-[#0d0d10]/95 px-6 py-5 backdrop-blur`,children:[(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(`p`,{className:`text-[10px] font-medium uppercase tracking-[0.16em] ${u}`,children:t}),(0,b.jsx)(`h2`,{className:`mt-1 text-lg font-semibold text-white`,children:n}),r&&(0,b.jsx)(`p`,{className:`mt-1 text-[11px] text-white/25`,children:r})]}),(0,b.jsx)(`button`,{type:`button`,onClick:a,"aria-label":o,className:`shrink-0 cursor-pointer rounded-lg border border-white/10 px-2.5 py-1.5 text-sm text-white/40 hover:bg-white/5 hover:text-white`,children:`×`})]}),c,(0,b.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:s})]})})}function Ae({decisions:e,onOpenMission:t,showMission:n=!0,compact:r=!1,presentation:i=`inline`,openToken:a,className:o}){let[s,c]=(0,g.useState)({}),[l,u]=(0,g.useState)(null),[d,f]=(0,g.useState)({}),[p,m]=(0,g.useState)(!1),[h,_]=(0,g.useState)(0),v=(0,g.useMemo)(()=>[...e].sort((e,t)=>je(e)-je(t)||e.createdAt-t.createdAt),[e]);if((0,g.useEffect)(()=>{_(e=>Math.min(e,Math.max(0,v.length-1)))},[v.length]),(0,g.useEffect)(()=>{a&&i===`drawer`&&m(!0)},[a,i]),!e.length)return null;async function y(e,t){let n=(t??s[e.id]??``).trim();if(!(!n||l)){u(e.id),f(t=>({...t,[e.id]:``}));try{await ee(e.missionId,e.id,n)}catch(t){f(n=>({...n,[e.id]:t.message}))}finally{u(null)}}}let x=e=>(0,b.jsxs)(`article`,{className:`p-5`,children:[n&&(0,b.jsxs)(`div`,{className:`mb-2.5 rounded-lg border border-violet-300/10 bg-violet-300/[0.03] px-3 py-2`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsxs)(`button`,{onClick:()=>{m(!1),t(e.missionId)},className:`cursor-pointer text-xs font-semibold text-violet-300/80 hover:text-violet-200`,children:[e.missionName,` ↗`]}),e.repository&&(0,b.jsx)(`span`,{className:`mono rounded bg-white/[0.04] px-1.5 py-0.5 text-[9px] text-white/35`,title:e.repository,children:e.repository.split(`/`).at(-1)})]}),e.missionObjective&&(0,b.jsxs)(`p`,{className:`mt-1 truncate text-[11px] text-white/40`,title:e.missionObjective,children:[(0,b.jsx)(`span`,{className:`text-white/20`,children:`Mission goal:`}),` `,e.missionObjective]})]}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(`h3`,{className:`text-sm font-medium leading-relaxed text-white/80`,children:e.question}),e.context&&(0,b.jsx)(`p`,{className:`mt-1.5 text-xs leading-relaxed text-white/35`,children:e.context})]}),(0,b.jsx)(`span`,{className:`rounded-md border border-white/8 px-2 py-1 text-[9px] uppercase tracking-wide text-white/30`,children:e.kind})]}),(e.recommendation||e.impact)&&(0,b.jsxs)(`div`,{className:`mt-3 grid gap-2 ${r||i===`drawer`?``:`sm:grid-cols-2`}`,children:[e.recommendation&&(0,b.jsxs)(`p`,{className:`rounded-lg bg-emerald-300/[0.04] px-3 py-2 text-[11px] text-emerald-100/50`,children:[(0,b.jsx)(`span`,{className:`font-medium`,children:`Recommended:`}),` `,e.recommendation]}),e.impact&&(0,b.jsxs)(`p`,{className:`rounded-lg bg-white/[0.025] px-3 py-2 text-[11px] text-white/35`,children:[(0,b.jsx)(`span`,{className:`font-medium text-white/45`,children:`While waiting:`}),` `,e.impact]})]}),e.choices.length>0&&(0,b.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:e.choices.map(t=>(0,b.jsx)(`button`,{disabled:!!l,onClick:()=>y(e,t),className:`cursor-pointer rounded-lg border border-amber-200/15 bg-amber-200/[0.06] px-3 py-1.5 text-xs text-amber-100/65 hover:bg-amber-200/10 disabled:opacity-40`,children:t},t))}),(0,b.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,b.jsx)(`input`,{value:s[e.id]??``,onChange:t=>c(n=>({...n,[e.id]:t.target.value})),onKeyDown:t=>{t.key===`Enter`&&y(e)},placeholder:`Or write a custom answer…`,className:`min-w-0 flex-1 rounded-lg border border-white/10 bg-black/15 px-3 py-2 text-xs text-white/70 outline-none placeholder:text-white/20 focus:border-amber-300/25`}),(0,b.jsx)(`button`,{onClick:()=>y(e),disabled:!s[e.id]?.trim()||!!l,className:`cursor-pointer rounded-lg bg-amber-300 px-3 py-2 text-xs font-semibold text-[#291b05] disabled:opacity-35`,children:l===e.id?`Sending…`:`Answer`})]}),d[e.id]&&(0,b.jsx)(`p`,{className:`mt-2 text-[10px] text-rose-400`,children:d[e.id]})]},e.id);if(i===`drawer`){let t=v[h],n=new Set(e.map(e=>e.missionId)).size;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`button`,{type:`button`,onClick:()=>m(!0),"aria-expanded":p,className:`group flex w-full cursor-pointer items-center justify-between gap-4 rounded-xl border border-fuchsia-300/15 bg-fuchsia-300/[0.035] px-4 py-3 text-left transition hover:border-fuchsia-300/30 hover:bg-fuchsia-300/[0.055] ${o??`mb-6`}`,children:[(0,b.jsxs)(`span`,{className:`flex min-w-0 items-center gap-3`,children:[(0,b.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-fuchsia-300/10 text-sm font-bold text-fuchsia-200/80`,children:`?`}),(0,b.jsxs)(`span`,{className:`min-w-0`,children:[(0,b.jsxs)(`span`,{className:`block text-sm font-semibold text-fuchsia-100/80`,children:[`Needs you · `,e.length,` pending`]}),(0,b.jsxs)(`span`,{className:`block truncate text-[11px] text-white/35`,children:[`Across `,n,` mission`,n===1?``:`s`,` · `,v[0].missionName,`: `,v[0].question]})]})]}),(0,b.jsx)(`span`,{className:`shrink-0 text-xs font-medium text-fuchsia-200/55 group-hover:text-fuchsia-100/80`,children:`Review →`})]}),p&&(0,b.jsx)(ke,{label:`Pending mission decisions`,eyebrow:`Needs you`,accent:`fuchsia`,title:`${e.length} pending decision${e.length===1?``:`s`}`,subtitle:`Across ${n} mission${n===1?``:`s`} · Esc to close`,onClose:()=>m(!1),closeLabel:`Close pending decisions`,afterHeader:v.length>1?(0,b.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-white/[0.06] px-6 py-2.5`,children:[(0,b.jsx)(`button`,{type:`button`,disabled:h===0,onClick:()=>_(e=>e-1),className:`cursor-pointer text-xs text-white/40 hover:text-white/70 disabled:cursor-not-allowed disabled:opacity-20`,children:`← Previous`}),(0,b.jsxs)(`span`,{className:`text-[10px] font-medium text-white/30`,children:[h+1,` of `,v.length]}),(0,b.jsx)(`button`,{type:`button`,disabled:h===v.length-1,onClick:()=>_(e=>e+1),className:`cursor-pointer text-xs text-white/40 hover:text-white/70 disabled:cursor-not-allowed disabled:opacity-20`,children:`Next →`})]}):void 0,children:x(t)})]})}return(0,b.jsxs)(`section`,{className:`mb-8 overflow-hidden rounded-2xl border border-amber-300/15 bg-amber-300/[0.035]`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between border-b border-amber-300/10 px-5 py-4`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h2`,{className:`text-sm font-semibold text-amber-100/85`,children:`Needs you`}),(0,b.jsx)(`p`,{className:`mt-0.5 text-xs text-white/35`,children:`Answer mission and skill prompts without leaving Hive.`})]}),(0,b.jsxs)(`span`,{className:`rounded-full bg-amber-300/10 px-2.5 py-1 text-[10px] font-semibold text-amber-200/70`,children:[e.length,` pending`]})]}),(0,b.jsx)(`div`,{className:`divide-y divide-amber-300/10`,children:e.map(x)})]})}function je(e){return e.kind===`destructive`||e.kind===`permission`?0:e.kind===`merge`||e.kind===`scope`?1:2}function Me({pid:e,status:t,force:n=!1,label:r=`Stop`}){let[i,a]=(0,g.useState)(!1),[o,s]=(0,g.useState)(!1),[c,l]=(0,g.useState)(null),[u,d]=(0,g.useState)(!1);if(e<0||t===`done`||t===`offline`)return null;async function f(){if(!i){a(!0),setTimeout(()=>a(!1),3e3);return}s(!0),l(null);let t=n||u;try{await ye(e,t),a(!1)}catch(e){l(e.message),a(!1),t||d(!0)}finally{s(!1)}}let p=u&&!n?`Force stop`:r;return(0,b.jsxs)(`span`,{className:`relative inline-flex`,children:[(0,b.jsx)(`button`,{disabled:o,onClick:f,title:n||u?`Force stops this local Claude process after confirmation`:`Gracefully stops the Claude job while preserving its conversation`,className:`rounded-lg border px-3 py-1.5 text-xs font-medium transition disabled:opacity-40 ${i||u?`border-rose-500/40 bg-rose-500/10 text-rose-300`:`border-white/10 text-white/40 hover:bg-white/5 hover:text-white/70`}`,children:o?`Stopping…`:i?`Confirm ${p.toLowerCase()}`:p}),c&&(0,b.jsxs)(`span`,{className:`absolute right-0 top-full z-20 mt-1 whitespace-nowrap rounded bg-[#18181d] px-2 py-1 text-[10px] text-rose-400 shadow-xl`,children:[c,u&&!n?` · Force stop is now available.`:``]})]})}var Ne=[`investigation`,`implementation`,`testing`,`review`,`browser_qa`,`documentation`,`custom`],Pe=[`test`,`typecheck`,`lint`,`ci`,`review`,`pr`,`screenshot`,`documentation`,`user_approval`,`custom`],Fe=[`commits`,`pushes`,`pullRequests`,`releases`,`destructiveActions`,`network`],Ie=e=>e.toLowerCase().trim().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``).slice(0,63);function Le(e){return{id:`new-template`,name:`New template`,description:`Describe when this workflow should be used.`,version:1,source:e,mode:`orchestrated`,worktree:!0,managerInstructions:`Delegate independent work, report evidence, and stop for approval before external or destructive actions.`,stages:[{id:`stage-1`,title:`Investigation`,role:`investigation`}],gates:[{id:`gate-review`,label:`Review complete`,type:`review`,status:`pending`,required:!0,evidence:[]}],budgets:{maxWorkers:8,maxConcurrentWorkers:4},permissions:{commits:!0,pushes:!1,pullRequests:!1,releases:!1,destructiveActions:!1,network:!0}}}function Re({initial:e,cwd:t,onCancel:n,onSaved:r}){let i=!!e,[a,o]=(0,g.useState)(()=>e?structuredClone(e):Le(`user`)),[s,c]=(0,g.useState)(!1),[l,u]=(0,g.useState)(null),d=(0,g.useMemo)(()=>{let e=[];return a.id.match(/^[a-z0-9][a-z0-9-]{1,62}$/)||e.push(`Use a 2–63 character lowercase template ID.`),(!a.name.trim()||!a.description.trim()||!a.managerInstructions.trim())&&e.push(`Name, description, and manager instructions are required.`),a.stages.length||e.push(`Add at least one mission stage.`),new Set(a.stages.map(e=>e.id)).size!==a.stages.length&&e.push(`Stage IDs must be unique.`),e},[a]),f=`w-full rounded-lg border border-white/10 bg-black/20 px-3 py-2 text-xs text-white/65 outline-none focus:border-amber-300/20`;async function p(){if(!(d.length||s)){c(!0),u(null);try{r((i?await M(a,t):await j(a,a.source,t)).template)}catch(e){u(e.message)}finally{c(!1)}}}return(0,b.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-y-auto p-6`,children:[(0,b.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-[10px] font-medium uppercase tracking-[0.16em] text-amber-300/55`,children:i?`Edit workflow`:`Create workflow`}),(0,b.jsx)(`h2`,{className:`mt-1 text-xl font-semibold text-white`,children:a.name||`Untitled template`})]}),(0,b.jsxs)(`div`,{className:`flex gap-2`,children:[(0,b.jsx)(`button`,{onClick:n,className:`rounded-lg px-3 py-2 text-xs text-white/40 hover:text-white/70`,children:`Cancel`}),(0,b.jsx)(`button`,{onClick:()=>void p(),disabled:s||d.length>0||a.source===`repository`&&!t,className:`rounded-lg bg-amber-300 px-3 py-2 text-xs font-semibold text-[#291a04] hover:bg-amber-200 disabled:opacity-35`,children:s?`Saving…`:i?`Save template`:`Create template`})]})]}),(l||d.length>0)&&(0,b.jsx)(`div`,{className:`mt-4 rounded-lg border border-rose-300/10 bg-rose-300/[0.035] px-3 py-2 text-xs text-rose-200/60`,children:l??d.join(` `)}),(0,b.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,b.jsxs)(`label`,{className:`text-[10px] text-white/35`,children:[`Name`,(0,b.jsx)(`input`,{className:f,value:a.name,onChange:e=>o({...a,name:e.target.value,...!i&&a.id===`new-template`?{id:Ie(e.target.value)}:{}})})]}),(0,b.jsxs)(`label`,{className:`text-[10px] text-white/35`,children:[`Template ID`,(0,b.jsx)(`input`,{disabled:i,className:`${f} font-mono disabled:opacity-40`,value:a.id,onChange:e=>o({...a,id:Ie(e.target.value)})})]}),(0,b.jsxs)(`label`,{className:`text-[10px] text-white/35`,children:[`Version`,(0,b.jsx)(`input`,{type:`number`,min:`1`,className:f,value:a.version,onChange:e=>o({...a,version:Math.max(1,Number(e.target.value))})})]}),(0,b.jsxs)(`label`,{className:`text-[10px] text-white/35`,children:[`Ownership`,(0,b.jsxs)(`select`,{disabled:i,className:`${f} disabled:opacity-40`,value:a.source,onChange:e=>o({...a,source:e.target.value}),children:[(0,b.jsx)(`option`,{value:`user`,children:`My templates`}),(0,b.jsx)(`option`,{value:`repository`,children:`This repository`})]})]})]}),a.source===`repository`&&(0,b.jsxs)(`p`,{className:`mt-2 text-[10px] text-violet-200/40`,children:[`Repository scope: `,t||`Select a repository in the library first.`]}),(0,b.jsxs)(`label`,{className:`mt-4 block text-[10px] text-white/35`,children:[`Purpose`,(0,b.jsx)(`textarea`,{rows:2,className:f,value:a.description,onChange:e=>o({...a,description:e.target.value})})]}),(0,b.jsxs)(`label`,{className:`mt-3 block text-[10px] text-white/35`,children:[`Manager instructions`,(0,b.jsx)(`textarea`,{rows:4,className:f,value:a.managerInstructions,onChange:e=>o({...a,managerInstructions:e.target.value})})]}),(0,b.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-3`,children:[(0,b.jsxs)(`label`,{className:`text-[10px] text-white/35`,children:[`Execution mode`,(0,b.jsxs)(`select`,{className:f,value:a.mode,onChange:e=>o({...a,mode:e.target.value}),children:[(0,b.jsx)(`option`,{value:`orchestrated`,children:`Orchestrated`}),(0,b.jsx)(`option`,{value:`direct`,children:`Direct`})]})]}),(0,b.jsxs)(`label`,{className:`flex items-end gap-2 pb-2 text-xs text-white/50`,children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:a.worktree,onChange:e=>o({...a,worktree:e.target.checked})}),`Create a worktree`]})]}),(0,b.jsxs)(`section`,{className:`mt-5 rounded-xl border border-white/8 bg-white/[0.018] p-4`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h3`,{className:`text-xs font-semibold text-white/60`,children:`Mission stages`}),(0,b.jsx)(`p`,{className:`mt-0.5 text-[10px] text-white/25`,children:`Stages become the initial phased plan; dependencies control which may start in parallel.`})]}),(0,b.jsx)(`button`,{onClick:()=>o({...a,stages:[...a.stages,{id:`stage-${a.stages.length+1}`,title:`New stage`,role:`implementation`,dependsOn:a.stages.length?[a.stages.at(-1).id]:[]}]}),className:`rounded-lg border border-white/10 px-2.5 py-1.5 text-[10px] text-white/40 hover:bg-white/5`,children:`+ Stage`})]}),(0,b.jsx)(`div`,{className:`mt-3 space-y-2`,children:a.stages.map((e,t)=>(0,b.jsxs)(`div`,{className:`grid grid-cols-[1fr_1fr_1fr_34px] gap-2`,children:[(0,b.jsx)(`input`,{"aria-label":`Stage title`,className:f,value:e.title,onChange:n=>{let r=[...a.stages],s=e.id,c=i?e.id:Ie(n.target.value)||`stage-${t+1}`;if(r[t]={...e,title:n.target.value,id:c},c!==s)for(let e=0;e<r.length;e++)r[e]={...r[e],dependsOn:r[e].dependsOn?.map(e=>e===s?c:e)};o({...a,stages:r})}}),(0,b.jsx)(`select`,{"aria-label":`Worker role`,className:f,value:e.role,onChange:n=>{let r=[...a.stages];r[t]={...e,role:n.target.value},o({...a,stages:r})},children:Ne.map(e=>(0,b.jsx)(`option`,{value:e,children:e.replaceAll(`_`,` `)},e))}),(0,b.jsxs)(`select`,{"aria-label":`Stage dependency`,className:f,value:e.dependsOn?.[0]??``,onChange:n=>{let r=[...a.stages];r[t]={...e,dependsOn:n.target.value?[n.target.value]:[]},o({...a,stages:r})},children:[(0,b.jsx)(`option`,{value:``,children:`No dependency`}),a.stages.filter(t=>t.id!==e.id).map(e=>(0,b.jsxs)(`option`,{value:e.id,children:[`After `,e.title]},e.id))]}),(0,b.jsx)(`button`,{"aria-label":`Remove stage`,onClick:()=>{let n=e.id;o({...a,stages:a.stages.filter((e,n)=>n!==t).map(e=>({...e,dependsOn:e.dependsOn?.filter(e=>e!==n)}))})},className:`rounded-lg border border-white/8 text-white/25 hover:bg-rose-300/[0.05] hover:text-rose-200`,children:`×`})]},t))})]}),(0,b.jsxs)(`section`,{className:`mt-4 rounded-xl border border-white/8 bg-white/[0.018] p-4`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h3`,{className:`text-xs font-semibold text-white/60`,children:`Completion gates`}),(0,b.jsx)(`p`,{className:`mt-0.5 text-[10px] text-white/25`,children:`Required evidence before the mission can appear complete.`})]}),(0,b.jsx)(`button`,{onClick:()=>o({...a,gates:[...a.gates,{id:`gate-${a.gates.length+1}`,label:`New gate`,type:`custom`,status:`pending`,required:!0,evidence:[]}]}),className:`rounded-lg border border-white/10 px-2.5 py-1.5 text-[10px] text-white/40 hover:bg-white/5`,children:`+ Gate`})]}),(0,b.jsx)(`div`,{className:`mt-3 space-y-2`,children:a.gates.map((e,t)=>(0,b.jsxs)(`div`,{className:`grid grid-cols-[1fr_1fr_auto_34px] gap-2`,children:[(0,b.jsx)(`input`,{"aria-label":`Gate label`,className:f,value:e.label,onChange:n=>{let r=[...a.gates];r[t]={...e,label:n.target.value,id:i?e.id:`gate-${Ie(n.target.value)||t+1}`},o({...a,gates:r})}}),(0,b.jsx)(`select`,{"aria-label":`Gate type`,className:f,value:e.type,onChange:n=>{let r=[...a.gates];r[t]={...e,type:n.target.value},o({...a,gates:r})},children:Pe.map(e=>(0,b.jsx)(`option`,{value:e,children:e.replaceAll(`_`,` `)},e))}),(0,b.jsxs)(`label`,{className:`flex items-center gap-1 text-[10px] text-white/35`,children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:e.required,onChange:n=>{let r=[...a.gates];r[t]={...e,required:n.target.checked},o({...a,gates:r})}}),`Required`]}),(0,b.jsx)(`button`,{"aria-label":`Remove gate`,onClick:()=>o({...a,gates:a.gates.filter((e,n)=>n!==t)}),className:`rounded-lg border border-white/8 text-white/25 hover:bg-rose-300/[0.05] hover:text-rose-200`,children:`×`})]},t))})]}),(0,b.jsxs)(`div`,{className:`mt-4 grid gap-4 lg:grid-cols-2`,children:[(0,b.jsxs)(`section`,{className:`rounded-xl border border-white/8 bg-white/[0.018] p-4`,children:[(0,b.jsx)(`h3`,{className:`text-xs font-semibold text-white/60`,children:`Budgets`}),(0,b.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-2`,children:[`maxWorkers`,`maxConcurrentWorkers`,`maxTokens`,`maxElapsedMinutes`].map(e=>(0,b.jsxs)(`label`,{className:`text-[9px] text-white/30`,children:[e.replace(/([A-Z])/g,` $1`),(0,b.jsx)(`input`,{type:`number`,min:`1`,className:f,value:a.budgets?.[e]??``,onChange:t=>o({...a,budgets:{...a.budgets,[e]:t.target.value?Number(t.target.value):void 0}})})]},e))})]}),(0,b.jsxs)(`section`,{className:`rounded-xl border border-white/8 bg-white/[0.018] p-4`,children:[(0,b.jsx)(`h3`,{className:`text-xs font-semibold text-white/60`,children:`Permissions`}),(0,b.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-2`,children:Fe.map(e=>(0,b.jsxs)(`label`,{className:`flex items-center gap-2 rounded-lg border border-white/[0.06] px-2 py-2 text-[10px] text-white/40`,children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:a.permissions[e],onChange:t=>o({...a,permissions:{...a.permissions,[e]:t.target.checked}})}),`Allow `,e.replace(/([A-Z])/g,` $1`)]},e))})]})]}),(0,b.jsxs)(`section`,{className:`mt-4 rounded-xl border border-violet-300/10 bg-violet-300/[0.025] p-4`,children:[(0,b.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-wider text-violet-200/45`,children:`Live mission preview`}),(0,b.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-white/50`,children:a.managerInstructions||`Manager instructions will appear here.`}),(0,b.jsx)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:a.stages.map((e,t)=>(0,b.jsxs)(`span`,{className:`text-[10px] text-white/40`,children:[(0,b.jsxs)(`span`,{className:`rounded bg-white/[0.05] px-2 py-1`,children:[e.title||`Untitled stage`,e.dependsOn?.length?` · after ${e.dependsOn.join(`, `)}`:` · parallel-ready`]}),t<a.stages.length-1&&(0,b.jsx)(`span`,{className:`ml-2 text-white/15`,children:`→`})]},`${e.id}:${t}`))}),(0,b.jsxs)(`p`,{className:`mt-3 text-[10px] text-white/25`,children:[`Completion requires: `,a.gates.filter(e=>e.required).map(e=>e.label).join(`, `)||`no required gates`,`.`]})]})]})}function ze(e){return e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase())}function Be({template:e,repository:t,onDuplicate:n,onEdit:r,onDelete:i}){return(0,b.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-y-auto p-6`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`h2`,{className:`text-xl font-semibold text-white`,children:e.name}),(0,b.jsx)(`span`,{className:`rounded-full border border-white/10 px-2 py-0.5 text-[9px] uppercase text-white/35`,children:e.source}),(0,b.jsxs)(`span`,{className:`text-[10px] text-white/25`,children:[`v`,e.version]})]}),(0,b.jsx)(`p`,{className:`mt-2 max-w-2xl text-sm leading-relaxed text-white/50`,children:e.description}),(0,b.jsxs)(`p`,{className:`mt-2 text-[10px] text-white/25`,children:[e.source===`built-in`?`Built into Hive · read-only`:e.source===`user`?`Owned by you · available across repositories`:`Owned by repository · ${t??`current repository`}`,`. Repository templates override personal templates with the same ID; personal templates override built-ins. Existing missions retain their original version.`]})]}),(0,b.jsxs)(`div`,{className:`flex gap-2`,children:[e.source!==`built-in`&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`button`,{onClick:r,className:`rounded-lg border border-white/10 px-3 py-2 text-xs text-white/45 transition hover:bg-white/5 hover:text-white/70`,children:`Edit`}),(0,b.jsx)(`button`,{onClick:i,className:`rounded-lg border border-rose-300/10 px-3 py-2 text-xs text-rose-200/40 transition hover:bg-rose-300/[0.05] hover:text-rose-200/65`,children:`Delete`})]}),(0,b.jsx)(`button`,{onClick:n,className:`rounded-lg border border-amber-300/15 bg-amber-300/[0.05] px-3 py-2 text-xs text-amber-200/65 transition hover:border-amber-300/30 hover:bg-amber-300/[0.09]`,children:`Duplicate template`})]})]}),(0,b.jsxs)(`div`,{className:`mt-6 grid gap-4 lg:grid-cols-2`,children:[(0,b.jsxs)(`section`,{className:`rounded-xl border border-white/8 bg-white/[0.02] p-4`,children:[(0,b.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-wider text-white/30`,children:`Manager instructions`}),(0,b.jsx)(`p`,{className:`mt-3 whitespace-pre-wrap text-xs leading-relaxed text-white/55`,children:e.managerInstructions})]}),(0,b.jsxs)(`section`,{className:`rounded-xl border border-white/8 bg-white/[0.02] p-4`,children:[(0,b.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-wider text-white/30`,children:`Launch configuration`}),(0,b.jsxs)(`dl`,{className:`mt-3 grid grid-cols-[110px_1fr] gap-y-2 text-xs`,children:[(0,b.jsx)(`dt`,{className:`text-white/25`,children:`Mode`}),(0,b.jsx)(`dd`,{className:`capitalize text-white/55`,children:e.mode}),(0,b.jsx)(`dt`,{className:`text-white/25`,children:`Worktree`}),(0,b.jsx)(`dd`,{className:`text-white/55`,children:e.worktree?`Create isolated worktree`:`Use working directory`}),(0,b.jsx)(`dt`,{className:`text-white/25`,children:`Source`}),(0,b.jsx)(`dd`,{className:`capitalize text-white/55`,children:e.source}),(0,b.jsx)(`dt`,{className:`text-white/25`,children:`Template ID`}),(0,b.jsx)(`dd`,{className:`font-mono text-white/45`,children:e.id})]})]})]}),(0,b.jsxs)(`section`,{className:`mt-4 rounded-xl border border-white/8 bg-white/[0.02] p-4`,children:[(0,b.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-wider text-white/30`,children:`Mission stages`}),(0,b.jsx)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:e.stages.map((t,n)=>(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsxs)(`div`,{className:`rounded-lg border border-violet-300/10 bg-violet-300/[0.035] px-3 py-2`,children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-white/65`,children:t.title}),(0,b.jsx)(`p`,{className:`mt-0.5 text-[9px] uppercase text-violet-300/45`,children:ze(t.role)})]}),n<e.stages.length-1&&(0,b.jsx)(`span`,{className:`text-white/15`,children:`→`})]},t.id))})]}),(0,b.jsxs)(`div`,{className:`mt-4 grid gap-4 lg:grid-cols-2`,children:[(0,b.jsxs)(`section`,{className:`rounded-xl border border-white/8 bg-white/[0.02] p-4`,children:[(0,b.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-wider text-white/30`,children:`Completion gates`}),(0,b.jsx)(`div`,{className:`mt-3 space-y-2`,children:e.gates.length?e.gates.map(e=>(0,b.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-white/[0.06] px-3 py-2`,children:[(0,b.jsx)(`span`,{className:`text-xs text-white/55`,children:e.label}),(0,b.jsxs)(`span`,{className:`text-[9px] uppercase text-white/25`,children:[ze(e.type),e.required?` · required`:``]})]},e.id)):(0,b.jsx)(`p`,{className:`text-xs text-white/25`,children:`No completion gates.`})})]}),(0,b.jsxs)(`section`,{className:`rounded-xl border border-white/8 bg-white/[0.02] p-4`,children:[(0,b.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-wider text-white/30`,children:`Budgets and permissions`}),(0,b.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:Object.entries(e.budgets??{}).map(([e,t])=>(0,b.jsxs)(`span`,{className:`rounded bg-white/[0.04] px-2 py-1 text-[10px] text-white/40`,children:[ze(e),`: `,t?.toLocaleString()]},e))}),(0,b.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-2`,children:Object.entries(e.permissions).map(([e,t])=>(0,b.jsxs)(`div`,{className:`rounded-lg border px-2.5 py-2 text-[10px] ${t?`border-emerald-300/10 bg-emerald-300/[0.035] text-emerald-200/50`:`border-amber-300/10 bg-amber-300/[0.025] text-amber-200/45`}`,children:[t?`✓ Allowed`:`Approval required`,` · `,ze(e)]},e))})]})]})]})}function Ve({repositories:e,onClose:t}){let n=Se(t),[r,i]=(0,g.useState)(e[0]??``),[a,o]=(0,g.useState)([]),[s,c]=(0,g.useState)(``),[l,u]=(0,g.useState)(!0),[d,f]=(0,g.useState)(null),[p,m]=(0,g.useState)(!1),[h,_]=(0,g.useState)(``),[v,y]=(0,g.useState)(``),[x,S]=(0,g.useState)(`user`),[C,w]=(0,g.useState)(!1),[T,E]=(0,g.useState)(null),[D,O]=(0,g.useState)([]),k=(0,g.useMemo)(()=>a.find(e=>e.id===s)??a[0],[a,s]);async function M(){u(!0),f(null);try{let e=await A(r||void 0);o(e.templates),O(e.diagnostics??[]),c(t=>e.templates.some(e=>e.id===t)?t:e.templates[0]?.id??``)}catch(e){f(e.message),O([])}finally{u(!1)}}(0,g.useEffect)(()=>{M()},[r]),(0,g.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[t]);function P(){k&&(_(`${k.name} copy`),y(`${k.id}-copy`),m(!0),f(null))}async function F(){if(!(!k||!h.trim()||!v.trim())){w(!0),f(null);try{let e={...k,id:v.trim().toLowerCase().replace(/[^a-z0-9-]+/g,`-`),name:h.trim(),version:1,source:x};await j(e,x,r||void 0),m(!1),await M(),c(e.id)}catch(e){f(e.message)}finally{w(!1)}}}async function I(){if(!(!k||k.source===`built-in`||!window.confirm(`Delete ${k.name}? Existing missions will keep their retained template configuration, but this template will no longer be available for new missions.`))){f(null);try{await N(k,r||void 0),c(``),await M()}catch(e){f(e.message)}}}return(0,b.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4`,...n,children:(0,b.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Template library`,onMouseDown:e=>e.stopPropagation(),className:`flex h-[min(820px,92vh)] w-full max-w-6xl flex-col overflow-hidden rounded-2xl border border-white/10 bg-[#0e0e12] shadow-2xl`,children:[(0,b.jsxs)(`header`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-white/8 px-5 py-4`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-[10px] font-medium uppercase tracking-[0.18em] text-amber-300/55`,children:`Hive workflows`}),(0,b.jsx)(`h1`,{className:`mt-0.5 text-lg font-semibold text-white`,children:`Template library`})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.length>0&&(0,b.jsxs)(`select`,{value:r,onChange:e=>{i(e.target.value),E(null)},className:`max-w-64 rounded-lg border border-white/10 bg-[#17171c] px-3 py-2 text-xs text-white/50`,children:[(0,b.jsx)(`option`,{value:``,children:`Current Hive repository`}),e.map(e=>(0,b.jsxs)(`option`,{value:e,children:[e.split(`/`).at(-1),` · `,e]},e))]}),(0,b.jsx)(`button`,{onClick:()=>{E(`new`),m(!1)},className:`rounded-lg border border-amber-300/15 bg-amber-300/[0.05] px-3 py-2 text-xs text-amber-200/60 hover:bg-amber-300/[0.09]`,children:`+ New template`}),(0,b.jsx)(`button`,{onClick:t,"aria-label":`Close template library`,className:`rounded-lg border border-white/10 px-2.5 py-1.5 text-white/40 hover:bg-white/5 hover:text-white`,children:`×`})]})]}),d&&(0,b.jsxs)(`div`,{className:`border-b border-rose-300/10 bg-rose-300/[0.04] px-5 py-2.5 text-xs text-rose-200/65`,children:[d,` `,(0,b.jsx)(`button`,{onClick:()=>void M(),className:`ml-2 underline hover:text-white`,children:`Retry`})]}),D.length>0&&(0,b.jsxs)(`details`,{className:`border-b border-amber-300/10 bg-amber-300/[0.035] px-5 py-2.5 text-xs text-amber-100/55`,children:[(0,b.jsxs)(`summary`,{className:`cursor-pointer`,children:[D.length,` malformed template file`,D.length===1?` was`:`s were`,` skipped · View recovery details`]}),(0,b.jsx)(`div`,{className:`mt-2 space-y-1`,children:D.map(e=>(0,b.jsxs)(`p`,{children:[(0,b.jsx)(`span`,{className:`font-mono text-amber-200/45`,children:e.file}),` — `,e.error,`. Fix or remove this JSON file, then reload.`]},e.file))})]}),(0,b.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,b.jsx)(`aside`,{className:`w-64 shrink-0 overflow-y-auto border-r border-white/8 p-3`,children:l?(0,b.jsx)(`p`,{className:`p-3 text-xs text-white/25`,children:`Loading templates…`}):a.length?a.map(e=>(0,b.jsxs)(`button`,{onClick:()=>{c(e.id),m(!1),E(null)},className:`mb-1 w-full rounded-lg border px-3 py-2.5 text-left transition ${k?.id===e.id&&!T?`border-amber-300/15 bg-amber-300/[0.06]`:`border-transparent hover:border-white/8 hover:bg-white/[0.03]`}`,children:[(0,b.jsx)(`p`,{className:`truncate text-xs font-medium text-white/65`,children:e.name}),(0,b.jsxs)(`p`,{className:`mt-1 text-[9px] uppercase tracking-wide text-white/25`,children:[e.source,` · v`,e.version]})]},`${e.source}:${e.id}`)):(0,b.jsx)(`p`,{className:`rounded-lg border border-dashed border-white/8 p-4 text-center text-xs text-white/25`,children:`No templates found for this repository.`})}),T?(0,b.jsx)(Re,{initial:T===`edit`?k:void 0,cwd:r||void 0,onCancel:()=>E(null),onSaved:e=>{E(null),M().then(()=>c(e.id))}}):k?(0,b.jsx)(Be,{template:k,repository:r||void 0,onDuplicate:P,onEdit:()=>E(`edit`),onDelete:()=>void I()}):!l&&(0,b.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-white/25`,children:`Choose a repository or create its first template.`})]}),p&&k&&(0,b.jsxs)(`div`,{className:`border-t border-white/8 bg-[#121217] p-4`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,b.jsxs)(`label`,{className:`min-w-48 flex-1 text-[10px] text-white/35`,children:[`Template name`,(0,b.jsx)(`input`,{value:h,onChange:e=>_(e.target.value),className:`mt-1 w-full rounded-lg border border-white/10 bg-black/20 px-3 py-2 text-xs text-white/65 outline-none focus:border-amber-300/20`})]}),(0,b.jsxs)(`label`,{className:`min-w-40 flex-1 text-[10px] text-white/35`,children:[`Template ID`,(0,b.jsx)(`input`,{value:v,onChange:e=>y(e.target.value),className:`mt-1 w-full rounded-lg border border-white/10 bg-black/20 px-3 py-2 font-mono text-xs text-white/65 outline-none focus:border-amber-300/20`})]}),(0,b.jsxs)(`label`,{className:`text-[10px] text-white/35`,children:[`Save to`,(0,b.jsxs)(`select`,{value:x,onChange:e=>S(e.target.value),className:`mt-1 block rounded-lg border border-white/10 bg-[#17171c] px-3 py-2 text-xs text-white/55`,children:[(0,b.jsx)(`option`,{value:`user`,children:`My templates`}),(0,b.jsx)(`option`,{value:`repository`,children:`This repository`})]})]}),(0,b.jsx)(`button`,{onClick:()=>m(!1),className:`rounded-lg px-3 py-2 text-xs text-white/35 hover:text-white/65`,children:`Cancel`}),(0,b.jsx)(`button`,{onClick:()=>void F(),disabled:C||!h.trim()||!v.trim()||x===`repository`&&!r,className:`rounded-lg bg-amber-300 px-3 py-2 text-xs font-semibold text-[#2a1a04] hover:bg-amber-200 disabled:opacity-35`,children:C?`Saving…`:`Create copy`})]}),x===`repository`&&!r&&(0,b.jsx)(`p`,{className:`mt-2 text-[10px] text-amber-200/45`,children:`Select a repository before saving a repository template.`})]})]})})}function He({onClose:e}){let t=Se(e),[n,r]=(0,g.useState)(),[i,a]=(0,g.useState)(),[o,s]=(0,g.useState)(!1);(0,g.useEffect)(()=>{he().then(({policy:e})=>r(e)).catch(e=>a(e.message))},[]),(0,g.useEffect)(()=>{let t=t=>{t.key===`Escape`&&e()};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e]);async function c(){if(n){s(!0);try{await ge(n),e()}catch(e){a(e.message)}finally{s(!1)}}}return(0,b.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/65 p-4`,...t,children:(0,b.jsxs)(`div`,{className:`w-full max-w-xl rounded-2xl border border-white/10 bg-[#101014] p-5`,onClick:e=>e.stopPropagation(),children:[(0,b.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Workspace policy`}),(0,b.jsx)(`p`,{className:`mt-1 text-[10px] text-white/30`,children:`Defaults copied into every new mission. Mission overrides remain durable.`})]}),(0,b.jsx)(`button`,{onClick:e,className:`px-2 text-white/40`,children:`×`})]}),n&&(0,b.jsx)(Ce,{value:n,onChange:r}),i&&(0,b.jsx)(`p`,{className:`mt-3 text-xs text-rose-300`,children:i}),(0,b.jsx)(`p`,{className:`mt-3 text-[10px] text-amber-100/35`,children:`Disabled tools and actions are passed to Claude CLI as hard restrictions where supported. The manager requests your approval before a policy boundary is expanded.`}),(0,b.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,b.jsx)(`button`,{onClick:e,className:`px-3 py-2 text-xs text-white/40`,children:`Cancel`}),(0,b.jsx)(`button`,{disabled:!n||o,onClick:()=>void c(),className:`rounded-lg bg-amber-300 px-3 py-2 text-xs font-semibold text-black disabled:opacity-40`,children:o?`Saving…`:`Save defaults`})]})]})})}var Ue=[`active`,`waiting_on_you`,`working`,`stalled`,`failed`,`ready_for_review`,`paused`,`completed`,`archived`];function We({value:e,onChange:t,repositories:n,templates:r,shown:i,total:a}){let o=(n,r)=>t({...e,[n]:r}),s=`rounded-lg border border-white/10 bg-[#141418] px-2.5 py-2 text-xs text-white/45`;return(0,b.jsxs)(`div`,{className:`mb-6 rounded-xl border border-white/[0.07] bg-white/[0.018] p-3`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[(0,b.jsx)(`input`,{value:e.query,onChange:e=>o(`query`,e.target.value),placeholder:`Search missions, messages, workers, files, errors, PRs…`,className:`min-w-0 flex-1 rounded-lg border border-white/10 bg-black/15 px-3 py-2 text-xs text-white/70 outline-none placeholder:text-white/20 focus:border-amber-300/25`}),(0,b.jsxs)(`select`,{value:e.status,onChange:e=>o(`status`,e.target.value),className:s,children:[(0,b.jsx)(`option`,{value:`all`,children:`All statuses`}),Ue.map(e=>(0,b.jsx)(`option`,{value:e,children:e===`ready_for_review`?`awaiting acceptance`:e.replaceAll(`_`,` `)},e))]}),(0,b.jsxs)(`select`,{value:e.repository,onChange:e=>o(`repository`,e.target.value),className:`${s} max-w-52`,children:[(0,b.jsx)(`option`,{value:`all`,children:`All repositories`}),n.map(e=>(0,b.jsx)(`option`,{value:e,children:e.split(`/`).at(-1)},e))]}),(0,b.jsxs)(`select`,{value:e.template,onChange:e=>o(`template`,e.target.value),className:s,children:[(0,b.jsx)(`option`,{value:`all`,children:`All templates`}),r.map(([e,t])=>(0,b.jsx)(`option`,{value:e,children:t},e))]}),(0,b.jsxs)(`select`,{value:e.date,onChange:e=>o(`date`,e.target.value),className:s,children:[(0,b.jsx)(`option`,{value:`all`,children:`Any date`}),(0,b.jsx)(`option`,{value:`24h`,children:`Last 24 hours`}),(0,b.jsx)(`option`,{value:`7d`,children:`Last 7 days`}),(0,b.jsx)(`option`,{value:`30d`,children:`Last 30 days`})]})]}),i!==a&&(0,b.jsxs)(`p`,{className:`mt-2 text-[10px] text-white/25`,children:[`Showing `,i,` of `,a,` missions.`]})]})}function Ge(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m ${t%60}s`:`${Math.floor(n/60)}h ${n%60}m`}function Ke(e){return e.doneAt?`complete`:e.jobState===`working`||e.jobState===`busy`?`working`:`ended`}function qe({workers:e,compact:t=!1,narrow:n=!1,onSelect:r}){let[i,a]=(0,g.useState)(Date.now());if((0,g.useEffect)(()=>{let e=setInterval(()=>a(Date.now()),1e3);return()=>clearInterval(e)},[]),!e.length)return t?null:(0,b.jsxs)(`div`,{className:`rounded-xl border border-dashed border-white/10 py-10 text-center`,children:[(0,b.jsx)(`p`,{className:`text-sm text-white/35`,children:`No workers have been delegated yet.`}),(0,b.jsx)(`p`,{className:`mt-1 text-xs text-white/20`,children:`Workers appear here as the orchestrator fans out work.`})]});if(t){let t=e.filter(e=>Ke(e)===`working`).length,n=e.filter(e=>Ke(e)===`complete`).length;return(0,b.jsxs)(`div`,{className:`mt-4 flex items-center gap-3 text-xs text-white/40`,children:[(0,b.jsxs)(`span`,{children:[e.length,` worker`,e.length===1?``:`s`]}),t>0&&(0,b.jsxs)(`span`,{className:`text-amber-300`,children:[`● `,t,` active`]}),n>0&&(0,b.jsxs)(`span`,{className:`text-emerald-300`,children:[`✓ `,n,` done`]})]})}return(0,b.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>{let t=Ke(e),a=e.doneAt??(t===`working`?i:e.jobUpdatedAt??i),o=Math.max(e.updatedAt??0,e.jobUpdatedAt??0);return(0,b.jsx)(`button`,{type:`button`,onClick:()=>r?.(e),className:`group w-full min-w-0 overflow-hidden rounded-xl border border-white/8 bg-white/[0.025] px-4 py-3.5 text-left transition hover:-translate-y-px hover:border-amber-300/20 hover:bg-white/[0.045] hover:shadow-lg hover:shadow-black/15`,children:(0,b.jsxs)(`div`,{className:`flex gap-3 ${n?`flex-col`:`items-start justify-between gap-4`}`,children:[(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${t===`working`?`hive-pulse bg-amber-400`:t===`complete`?`bg-emerald-400`:`bg-white/25`}`}),(0,b.jsx)(`p`,{className:`${n?`whitespace-normal break-words [overflow-wrap:anywhere]`:`truncate`} min-w-0 text-sm font-medium text-white/85`,title:e.label,children:e.label})]}),(0,b.jsxs)(`div`,{className:`ml-4 mt-1.5 flex flex-wrap items-center gap-2 text-[11px] text-white/30`,children:[(0,b.jsx)(`span`,{className:`rounded bg-white/5 px-1.5 py-0.5 uppercase tracking-wide`,children:e.kind}),(0,b.jsx)(`span`,{className:`mono`,children:e.id.slice(0,8)}),e.tokens!==void 0&&(0,b.jsxs)(`span`,{children:[e.tokens.toLocaleString(),` tokens`]}),o>0&&(0,b.jsxs)(`span`,{title:new Date(o).toLocaleString(),children:[`updated `,Ge(i-o),` ago`]})]})]}),(0,b.jsxs)(`div`,{className:`shrink-0 ${n?`ml-4 flex items-center gap-2 text-left`:`text-right`}`,children:[(0,b.jsx)(`p`,{className:`text-xs font-medium capitalize ${t===`working`?`text-amber-300`:t===`complete`?`text-emerald-300`:`text-white/35`}`,children:t}),(0,b.jsx)(`p`,{className:`mono mt-1 text-[11px] text-white/30`,children:Ge(a-e.startedAt)})]})]})},`${e.jobId}:${e.id}`)})})}var Je={active:`bg-violet-500/10 text-violet-300 ring-violet-500/25`,ready_for_review:`bg-amber-500/10 text-amber-300 ring-amber-500/30`,paused:`bg-sky-500/10 text-sky-300 ring-sky-500/25`,completed:`bg-emerald-500/10 text-emerald-300 ring-emerald-500/25`,failed:`bg-red-500/10 text-red-300 ring-red-500/25`,archived:`bg-slate-500/10 text-slate-400 ring-slate-500/25`};function Ye({status:e}){return(0,b.jsx)(`span`,{className:`inline-flex items-center justify-center whitespace-nowrap rounded-full px-2.5 py-1 text-center text-xs font-medium capitalize ring-1 ${Je[e]}`,children:e===`ready_for_review`?`Awaiting acceptance`:e})}function Xe(e){let t=Math.max(0,Math.floor(e/6e4));return t<1?`<1m`:t<60?`${t}m`:`${Math.floor(t/60)}h ${t%60}m`}function Ze({node:e,onSelect:t}){let[n,r]=(0,g.useState)(Date.now());(0,g.useEffect)(()=>{let e=setInterval(()=>r(Date.now()),3e4);return()=>clearInterval(e)},[]);let i={critical:0,warning:1,info:2},a=[...e.alerts??[]].sort((e,t)=>i[e.severity]-i[t.severity]),o=a[0],s=e.lifecycleStatus===`completed`||e.lifecycleStatus===`archived`,c=e.lifecycleStatus===`ready_for_review`?{text:`Ready for your acceptance · review the evidence, accept completion, or request changes.`,tone:`acceptance`,more:0}:o?{text:`${o.title}${o.id===`idle-after-workers`?` · ${Xe(e.inactiveForMs)}`:``}`,tone:o.severity===`critical`?`critical`:`warning`,more:a.length-1}:e.waitingFor?{text:`Waiting: ${e.waitingFor}`,tone:`critical`,more:0}:e.activityStatus===`stalled`?{text:`Expected work has had no meaningful activity for ${Xe(e.inactiveForMs)}. Open for recovery options.`,tone:`warning`,more:0}:e.activityStatus===`idle`&&e.lifecycleStatus===`active`?{text:e.turnCompleted?`Latest turn finished · mission remains open for follow-up.`:`Mission is open with no current orchestrator or worker activity.`,tone:`idle`,more:0}:void 0;return(0,b.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:t,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&t()},className:`group flex w-full cursor-pointer flex-col rounded-2xl border border-white/10 bg-gradient-to-br from-white/[0.05] via-white/[0.025] to-amber-300/[0.018] p-5 text-left transition hover:-translate-y-0.5 hover:border-amber-300/20 hover:shadow-xl hover:shadow-amber-950/10`,children:[(0,b.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(Ee,{missionId:e.missionId,name:e.name}),(0,b.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-center gap-1.5`,children:[(0,b.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-wide ${e.mission.provider===`codex`?`bg-emerald-300/[0.09] text-emerald-200/60`:`bg-violet-300/[0.09] text-violet-200/60`}`,children:e.mission.provider??`claude`}),(0,b.jsx)(`span`,{className:`mono truncate rounded bg-white/[0.04] px-1.5 py-0.5 text-[9px] text-white/35`,children:e.mission.model??`CLI default`}),e.mission.planFirst&&(0,b.jsx)(`span`,{className:`shrink-0 rounded bg-amber-300/[0.08] px-1.5 py-0.5 text-[8px] font-semibold uppercase text-amber-200/55`,children:`Plan first`}),(0,b.jsxs)(`span`,{className:`mono truncate text-[11px] text-white/25`,children:[e.mission.mode,` · `,e.jobIds.length,` turn`,e.jobIds.length===1?``:`s`]})]})]}),(0,b.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,b.jsx)(Ye,{status:e.lifecycleStatus}),!s&&(0,b.jsx)(S,{status:e.activityStatus})]})]}),(0,b.jsx)(`p`,{className:`mt-4 line-clamp-2 min-h-10 text-sm leading-relaxed text-white/50`,children:e.detail??e.intent??`Waiting for activity`}),e.plan&&(0,b.jsxs)(`div`,{className:`mt-3`,children:[(0,b.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between text-[10px] uppercase tracking-wide text-white/25`,children:[(0,b.jsx)(`span`,{children:`Plan progress`}),(0,b.jsxs)(`span`,{className:`text-amber-200/60`,children:[e.plan.progress.percent??`—`,e.plan.progress.percent!==void 0&&`%`]})]}),(0,b.jsx)(`div`,{className:`h-1 overflow-hidden rounded-full bg-white/[0.06]`,children:(0,b.jsx)(`div`,{className:`h-full rounded-full bg-gradient-to-r from-amber-400 to-violet-400`,style:{width:`${e.plan.progress.percent??0}%`}})})]}),(0,b.jsxs)(`div`,{className:`mt-4 grid grid-cols-3 gap-2 border-y border-white/7 py-3 text-center`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-sm font-semibold text-white/80`,children:Xe((e.status===`working`?n:e.updatedAt)-e.runStartedAt)}),(0,b.jsx)(`p`,{className:`text-[10px] uppercase tracking-wide text-white/25`,children:`this turn`})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-sm font-semibold text-white/80`,children:e.workers.length}),(0,b.jsx)(`p`,{className:`text-[10px] uppercase tracking-wide text-white/25`,children:`workers`})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-sm font-semibold text-white/80`,children:e.tokens.toLocaleString()}),(0,b.jsx)(`p`,{className:`text-[10px] uppercase tracking-wide text-white/25`,children:`tokens`})]})]}),(0,b.jsx)(qe,{workers:e.workers,compact:!0}),c&&(0,b.jsxs)(`p`,{className:`mt-3 rounded-lg border px-3 py-2 text-xs ${c.tone===`acceptance`?`border-amber-300/20 bg-amber-300/[0.06] text-amber-100/75`:c.tone===`critical`?`border-rose-400/20 bg-rose-400/[0.06] text-rose-200/75`:c.tone===`warning`?`border-orange-400/15 bg-orange-400/[0.05] text-orange-200/70`:`border-slate-400/10 bg-slate-400/[0.04] text-slate-300/65`}`,children:[c.text,c.more>0&&(0,b.jsxs)(`span`,{className:`ml-1 text-white/30`,children:[`+`,c.more,` more`]})]})]})}function Qe({title:e,description:t,missions:n,onSelect:r,collapsedByDefault:i=!1}){let[a,o]=(0,g.useState)(i);return n.length?(0,b.jsxs)(`section`,{className:`mb-8`,children:[(0,b.jsxs)(`button`,{type:`button`,onClick:()=>o(!a),className:`mb-3 flex w-full items-center justify-between text-left`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`h2`,{className:`text-sm font-medium uppercase tracking-wide text-white/40`,children:[e,` `,(0,b.jsx)(`span`,{className:`ml-1 text-white/20`,children:n.length})]}),t&&(0,b.jsx)(`p`,{className:`mt-1 text-xs text-white/25`,children:t})]}),(0,b.jsx)(`span`,{className:`rounded-md border border-white/8 px-2 py-1 text-xs text-white/30`,children:a?`+`:`−`})]}),!a&&(0,b.jsx)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:n.map(e=>(0,b.jsx)(Ze,{node:e,onSelect:()=>r(e.missionId)},e.missionId))})]}):null}var $e={queued:`Queued`,working:`In progress`,blocked:`Blocked`,reviewing:`Reviewing`,completed:`Complete`,failed:`Failed`,cancelled:`Cancelled`};function et(e){return $e[e]??e}function tt(e){return e.flatMap(e=>[e,...tt(e.subtasks??[])])}function nt(e){return e.flatMap(e=>e.subtasks?.length?nt(e.subtasks):[e])}function rt(e){return e?.phases.flatMap(e=>tt(e.tasks))??[]}var it={query:``,status:`all`,repository:`all`,template:`all`,date:`all`},at={waiting_on_you:0,error:1,working:2,stalled:3,idle:4,offline:5,done:6};function ot(e,t){let n=rt(e.plan),r=t.decisions.filter(t=>t.missionId===e.missionId);return[e.name,e.mission.provider,e.mission.model,e.mission.objective,e.mission.compactSummary,e.mission.currentState,e.mission.repository,e.mission.template?.name,...e.messages.map(e=>e.text),...e.workers.flatMap(e=>[e.id,e.label]),...n.flatMap(e=>[e.title,e.description,e.assignment,e.context,e.owner,e.workerId,e.branch,e.worktree,...e.changedFiles??[],...e.evidence]),...e.recentEvents.flatMap(e=>[e.detail,e.filePath,e.command,e.artifactPath,e.targetWorker,e.targetTask]),...e.alerts.flatMap(e=>[e.title,e.explanation,e.evidence]),...e.prs.flatMap(e=>[e.id,e.href,e.kind]),...r.flatMap(e=>[e.question,e.context,e.answer,e.recommendation])].filter(Boolean).join(` `).toLowerCase()}function st(e,t){return e===`24h`?t-864e5:e===`7d`?t-6048e5:e===`30d`?t-2592e6:0}function ct(e,t,n=Date.now()){let r=[...new Set(e.orchestrators.map(e=>e.mission.repository).filter(e=>!!e))].sort(),i=[...new Map(e.orchestrators.flatMap(e=>e.mission.template?[[e.mission.template.id,e.mission.template.name]]:[])).entries()],a=t.query.trim().toLowerCase().split(/\s+/).filter(Boolean),o=st(t.date,n),s=e.orchestrators.filter(n=>a.length&&!a.every(t=>ot(n,e).includes(t))||t.status!==`all`&&n.lifecycleStatus!==t.status&&n.activityStatus!==t.status||t.repository!==`all`&&n.mission.repository!==t.repository||t.template!==`all`&&n.mission.template?.id!==t.template?!1:!o||n.updatedAt>=o),c=s.filter(e=>e.lifecycleStatus===`active`||e.lifecycleStatus===`failed`).sort((e,t)=>at[e.activityStatus]-at[t.activityStatus]||t.updatedAt-e.updatedAt),l=s.filter(e=>e.lifecycleStatus===`ready_for_review`).sort((e,t)=>t.updatedAt-e.updatedAt);return{filtered:s,sections:{review:l,operational:c,paused:s.filter(e=>e.lifecycleStatus===`paused`).sort((e,t)=>t.updatedAt-e.updatedAt),completed:s.filter(e=>e.lifecycleStatus===`completed`).sort((e,t)=>t.updatedAt-e.updatedAt),archived:s.filter(e=>e.lifecycleStatus===`archived`).sort((e,t)=>t.updatedAt-e.updatedAt)},repositories:r,templates:i,operationalCount:c.length+l.length}}function lt({value:e,onChange:t}){return(0,b.jsx)(`div`,{className:`inline-flex rounded-lg border border-white/[0.08] bg-black/20 p-1`,role:`group`,"aria-label":`Fleet presentation`,children:[`cards`,`office`].map(n=>(0,b.jsx)(`button`,{type:`button`,"aria-pressed":e===n,onClick:()=>t(n),className:`rounded-md px-3 py-1.5 text-xs font-medium capitalize transition ${e===n?`bg-amber-300/[0.12] text-amber-100/80 shadow-sm`:`text-white/35 hover:bg-white/[0.04] hover:text-white/60`}`,children:n===`cards`?`▦ Cards`:`⌂ Office`},n))})}var ut={tileWidth:58,tileHeight:52,skewX:-16,riseX:7,originX:140,originY:90};function V(e,t,n=0,r=ut){return{x:r.originX+e*r.tileWidth+t*r.skewX,y:r.originY+e*r.riseX+t*r.tileHeight-n}}function dt(e,t=0){return[V(e.x,e.y,t),V(e.x+e.width,e.y,t),V(e.x+e.width,e.y+e.depth,t),V(e.x,e.y+e.depth,t)]}function H(e){return e.map(({x:e,y:t})=>`${e},${t}`).join(` `)}function ft(e,t=0){return V(e.x+e.width/2,e.y+e.depth/2,t)}var U=5,pt={width:4.2,depth:2.8},mt=[[.58,.82],[1.78,.92],[2.78,.92],[1.55,1.78],[2.65,1.78]];function ht(e){return mt.map(([t,n])=>[e.x+t/pt.width*e.width,e.y+n/pt.depth*e.depth])}var gt=[{id:`direct-studio`,label:`Direct studio`,shortLabel:`DIRECT STUDIO`,kind:`direct`,capacity:8,x:0,y:0,width:3.5,depth:6.3},{id:`standard-a`,label:`Orchestration room A`,shortLabel:`ORCH A`,kind:`standard`,capacity:U,x:3.5,y:0,width:4.2,depth:2.8},{id:`standard-b`,label:`Orchestration room B`,shortLabel:`ORCH B`,kind:`standard`,capacity:U,x:7.7,y:0,width:4.2,depth:2.8},{id:`standard-c`,label:`Orchestration room C`,shortLabel:`ORCH C`,kind:`standard`,capacity:U,x:3.5,y:3.5,width:4.2,depth:2.8},{id:`review`,label:`Review hall`,shortLabel:`REVIEW HALL`,kind:`large`,capacity:8,x:7.7,y:3.5,width:4.2,depth:2.8}],_t=11.9/3,vt=[...[`a`,`b`,`c`].map((e,t)=>({id:`standard-${e}`,label:`Orchestration room ${e.toUpperCase()}`,shortLabel:`ORCH ${e.toUpperCase()}`,kind:`standard`,capacity:U,x:t*_t,y:0,width:_t,depth:2.8})),...[`d`,`e`,`f`].map((e,t)=>({id:`standard-${e}`,label:`Orchestration room ${e.toUpperCase()}`,shortLabel:`ORCH ${e.toUpperCase()}`,kind:`standard`,capacity:U,x:t*_t,y:3.5,width:_t,depth:2.8}))],yt=e=>e===`operations`?vt:gt,bt=e=>e>0&&e<1e3?`operations`:`headquarters`,xt=e=>e===0?`Headquarters`:e>=1e3?`Headquarters annex ${e-999}`:`Operations ${e}`,St=[`#f0c7a3`,`#dca77e`,`#b97855`,`#87543d`,`#68402f`],Ct=[`#211b1a`,`#51372a`,`#875f35`,`#c1a17a`,`#3b3037`],wt=[`#42667a`,`#65527d`,`#477164`,`#80595b`,`#6d6547`],Tt=[`short`,`side`,`crop`,`long`,`ponytail`,`bun`,`curls`],Et=[`tee`,`hoodie`,`jacket`,`sweater`];function Dt(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function Ot(e){let t=Dt(e);return{skin:St[t%St.length],hair:Ct[(t>>>4)%Ct.length],clothing:wt[(t>>>8)%wt.length],variant:(t>>>12)%3,hairStyle:Tt[(t>>>14)%Tt.length],outfit:Et[(t>>>18)%Et.length],offset:t%1200,gesture:(t>>>22)%2?`notes`:`monitor`}}var kt=new Set([`done`,`completed`,`stopped`,`failed`,`error`,`cancelled`,`canceled`]);function At(e){return!!e.doneAt||kt.has(e.jobState.toLowerCase())}function jt(e){return!At(e)}function Mt(e,t){return e.jobState===`failed`||e.jobState===`error`?`failed`:At(e)?`completed`:t.lifecycleStatus===`paused`?`paused`:e.jobState===`blocked`?`blocked`:e.jobState===`failed`||e.jobState===`error`?`failed`:e.jobState===`working`||e.jobState===`busy`?`working`:`idle`}function Nt(e){return e.lifecycleStatus===`paused`?`paused`:e.lifecycleStatus===`failed`||e.activityStatus===`error`?`failed`:e.activityStatus===`stalled`?`blocked`:e.activityStatus===`waiting_on_you`?`waiting`:e.activityStatus===`working`||e.messages.at(-1)?.role===`user`?`working`:`idle`}function Pt(e,t){let n={};for(let r of e.filter(e=>e.kind===`orchestrated`)){let e=r.mission.workers.filter(jt).sort((e,t)=>e.startedAt-t.startedAt||e.id.localeCompare(t.id)),i=new Set;for(let a of e){let e=`${r.mission.missionId}:${a.id}`,o=t[e];Number.isInteger(o)&&o>=0&&o<4&&!i.has(o)&&(n[e]=o,i.add(o))}for(let t of e){let e=`${r.mission.missionId}:${t.id}`;if(n[e]!==void 0)continue;let a=Array.from({length:4},(e,t)=>t).find(e=>!i.has(e));a!==void 0&&(n[e]=a,i.add(a))}}return n}function Ft(e,t){let n=Object.entries(e);return n.length===Object.keys(t).length&&n.every(([e,n])=>t[e]===n)}function It(e,t=6){let n=[];for(let t of e)if(Nt(t.mission)===`working`&&n.push(t.mission.missionId),t.kind===`orchestrated`)for(let e of t.mission.workers.filter(jt))Mt(e,t.mission)===`working`&&n.push(`${t.mission.missionId}:${e.id}`);return new Set(n.sort((e,t)=>Dt(e)-Dt(t)||e.localeCompare(t)).slice(0,Math.max(0,t)))}function Lt(e,t){return e.targetWorker===t.id||e.targetWorker===t.label||e.jobId===t.jobId}function W(e){if(!e)return;if(e.outcome===`failure`)return`failed`;let t=`${e.activityKind??``} ${e.toolName??``} ${e.detail} ${e.filePath??``}`.toLowerCase();return e.activityKind===`test`||/\b(test|spec|vitest|jest|playwright|pytest)\b/.test(t)?e.outcome===`success`?`test-passed`:`testing`:/websearch|webfetch|browser|https?:|research|documentation lookup/.test(t)?`research`:e.activityKind===`file_write`||/write|edit|patch|document|markdown|readme/.test(t)?`writing`:`active`}function Rt(e,t){if(!e)return`vacant`;let n=t?Mt(t,e):Nt(e);return n===`failed`?`failed`:n===`waiting`||n===`blocked`?`waiting`:n===`idle`||n===`paused`||n===`completed`?`idle`:W((t?e.recentEvents.filter(e=>Lt(e,t)):e.recentEvents.filter(t=>!e.workers.some(e=>Lt(t,e)))).at(-1))??`active`}function zt(e,t){return t===`room-activate`||t===`desk-reserved`||t===`entering`?`idle`:t===`arrived`||t===`working`?`active`:(t===`reporting`||t===`exiting`)&&e!==`failed`?`test-passed`:e}function Bt(e,t,n){return{state:n===`working`||n===`arrived`?`working`:t?Mt(t,e):Nt(e),monitor:zt(Rt(e,t),n)}}function Vt(e){return e.length?e.some(e=>e.lifecycleStatus===`failed`||e.activityStatus===`error`)?`failed`:e.some(e=>e.activityStatus===`stalled`)?`blocked`:e.some(e=>e.activityStatus===`waiting_on_you`)?`waiting`:e.some(e=>e.lifecycleStatus===`ready_for_review`)?`review`:e.some(e=>Nt(e)===`working`||e.workers.some(t=>jt(t)&&Mt(t,e)===`working`))?`active`:e.every(e=>e.lifecycleStatus===`paused`)?`paused`:`idle`:`vacant`}var Ht={vacant:`#77717e`,idle:`#8b8792`,active:`#f1c75b`,waiting:`#f472b6`,blocked:`#fb923c`,failed:`#fb7185`,review:`#e6bd62`,paused:`#7dd3fc`};function Ut(e,t,n=`worker`){let r=n===`manager`;return{x:e,y:t,width:r?.88:.72,depth:r?.52:.46}}function Wt(e,t,n=`worker`){let r=Ut(e,t,n),i=dt(r,17),a=dt(r,0);return H([i[0],i[1],i[2],a[2],a[3],i[3]])}function Gt({x:e,y:t,role:n=`worker`,occupied:r=!1,visualState:i,monitor:a=r?`active`:`vacant`,transition:o,selected:s=!1}){let c=n===`manager`,l=o===`room-activate`||o===`entering`||o===`desk-reserved`||o===`exiting`||o===`accepted-completion`,u=l?`idle`:i,d=l?`idle`:a,f=c?`#856a43`:n===`direct`?`#536b67`:`#7c6a53`,p=dt(Ut(e,t,n),17),m=p[3],h=p[2],g=dt({x:e+.18,y:t+.29,width:.28,depth:.1},19),_=V(e+.54,t+.34,19),v=u===`working`?`#f1c75b`:u===`idle`?`#8b8792`:u===`waiting`?`#f472b6`:u===`completed`?`#4ade80`:u===`blocked`?`#fb923c`:u===`failed`?`#fb7185`:`#7dd3fc`;return(0,b.jsxs)(`g`,{"aria-hidden":`true`,"data-seat-role":n,"data-seat-occupied":r?`true`:`false`,"data-seat-state":u,"data-seat-selected":s?`true`:void 0,"data-office-transition":o,className:s?`office-station-selected`:void 0,filter:s?`url(#direct-station-glow)`:void 0,children:[s&&(0,b.jsx)(`polygon`,{points:H(p),fill:`#55c7b3`,fillOpacity:`.18`,stroke:`#6ee7d2`,strokeOpacity:`.8`,strokeWidth:`3`}),(0,b.jsx)(`polygon`,{points:H(p),fill:f,stroke:r?v:c?`#e6bd62`:`#bda77e`,strokeOpacity:r?`.9`:c?`.58`:`.25`,strokeWidth:s?2.4:r?2:c?1.5:1}),(0,b.jsx)(`polygon`,{points:H(g),fill:`#242831`,stroke:`#9eb6c0`,strokeOpacity:`.35`}),(0,b.jsx)(`path`,{d:`M ${g[0].x+4} ${g[0].y+1}l14 2`,stroke:`#d7dde2`,strokeOpacity:`.18`}),(0,b.jsxs)(`g`,{transform:`rotate(7 ${_.x} ${_.y})`,children:[(0,b.jsx)(`rect`,{x:_.x-3.6,y:_.y-2.6,width:`7.2`,height:`5.2`,rx:`2.5`,fill:`#252a31`,stroke:`#9eb6c0`,strokeOpacity:`.38`}),(0,b.jsx)(`path`,{d:`M ${_.x} ${_.y-2}v2.2`,stroke:`#9eb6c0`,strokeOpacity:`.5`,strokeWidth:`.8`})]}),(0,b.jsx)(`polygon`,{points:`${m.x},${m.y} ${h.x},${h.y} ${h.x},${h.y+12} ${m.x},${m.y+12}`,fill:c?`#463824`:`#342b24`}),(0,b.jsx)(`path`,{d:`M ${m.x+4} ${m.y+9}v20 M ${h.x-4} ${h.y+9}v20`,stroke:`#28252a`,strokeWidth:`4`}),(0,b.jsx)(Zt,{x:e+(c?.43:.35),y:t+.22,activity:d,color:v}),(0,b.jsx)(Kt,{x:e+.17,y:t+(c?.63:.57),facing:`south`,seatType:c?`manager`:n===`direct`?`direct`:`worker`,occupied:r})]})}function Kt({x:e,y:t,facing:n,seatType:r=`review`,occupied:i=!1}){let a=r===`manager`,o=a?{x:e-.04,y:t-.025,width:.46,depth:.35}:{x:e,y:t,width:.38,depth:.3},s=dt(o,8),c=ft(o,8),l=n===`north`?[s[0],s[1]]:n===`south`?[s[3],s[2]]:n===`west`?[s[0],s[3]]:[s[1],s[2]],u=a?27:19,d=[l[0],l[1],{x:l[1].x,y:l[1].y-u},{x:l[0].x,y:l[0].y-u}],f=r===`review`?{"data-review-seat":i?`occupied`:`empty`}:r===`manager`?{"data-manager-seat":i?`occupied`:`empty`}:r===`direct`?{"data-direct-seat":i?`occupied`:`empty`}:{"data-worker-seat":i?`occupied`:`empty`},p=r===`review`?`#443849`:a?`#34343b`:r===`direct`?`#2f4140`:`#302f38`,m=r===`review`?`#5b4960`:a?`#484850`:r===`direct`?`#3c5753`:`#41404b`;return(0,b.jsxs)(`g`,{"aria-hidden":`true`,...f,children:[(0,b.jsx)(`polygon`,{points:H(s),fill:p,stroke:a?`#d5d1c8`:`#cbb6d0`,strokeOpacity:a?`.48`:`.25`}),(0,b.jsx)(`polygon`,{points:H(d),fill:m,stroke:a?`#d5d1c8`:`#ddd2e0`,strokeOpacity:a?`.48`:`.42`,strokeWidth:a?1.5:1}),a&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`path`,{d:`M ${s[0].x} ${s[0].y-1}v-7M ${s[0].x} ${s[0].y-7}l${s[3].x-s[0].x} ${s[3].y-s[0].y}`,stroke:`#b9b5ad`,strokeWidth:`2.5`,strokeLinecap:`round`}),(0,b.jsx)(`path`,{d:`M ${s[1].x} ${s[1].y-1}v-7M ${s[1].x} ${s[1].y-7}l${s[2].x-s[1].x} ${s[2].y-s[1].y}`,stroke:`#b9b5ad`,strokeWidth:`2.5`,strokeLinecap:`round`})]}),(0,b.jsx)(`path`,{d:`M ${c.x} ${c.y+3}v11M ${c.x-8} ${c.y+14}h16M ${c.x-6} ${c.y+14}l-4 4M ${c.x+6} ${c.y+14}l4 4`,stroke:`#25242b`,strokeWidth:`2`,strokeLinecap:`round`}),(0,b.jsx)(`circle`,{cx:c.x,cy:c.y+14,r:`2.5`,fill:`#292830`})]})}function qt({x:e,y:t,occupiedCount:n=0,dimmedSeatIndexes:r=new Set}){let i={x:e+.78,y:t+.82,width:2.55,depth:1.12},a=dt(i,15),o=a[3],s=a[2],c=[[.82,.38],[1.47,.38],[2.12,.38],[2.77,.38],[.82,2.16],[1.47,2.16],[2.12,2.16],[2.77,2.16]];return(0,b.jsxs)(`g`,{"aria-hidden":`true`,children:[c.slice(0,4).map(([i,a],o)=>(0,b.jsx)(`g`,{"data-filter-match":o<n?String(!r.has(o)):void 0,opacity:r.has(o)?.2:1,children:(0,b.jsx)(Kt,{x:e+i,y:t+a,facing:`north`,occupied:o<n})},`north-${o}`)),(0,b.jsx)(`polygon`,{points:H(a),fill:`#6e5947`,stroke:`#e6bd62`,strokeOpacity:`.34`}),(0,b.jsx)(`polygon`,{points:`${o.x},${o.y} ${s.x},${s.y} ${s.x},${s.y+11} ${o.x},${o.y+11}`,fill:`#352b27`}),(0,b.jsx)(`path`,{d:`M ${o.x+14} ${o.y+8}v16M ${s.x-14} ${s.y+8}v16`,stroke:`#29252a`,strokeWidth:`5`}),(0,b.jsx)(`path`,{d:`M ${ft(i,16).x-22} ${ft(i,16).y}h44`,stroke:`#e6bd62`,strokeOpacity:`.16`,strokeWidth:`2`}),(0,b.jsxs)(`g`,{transform:`rotate(6.88 ${ft(i,18).x} ${ft(i,18).y})`,children:[(0,b.jsx)(`rect`,{x:ft(i,18).x-16,y:ft(i,18).y-8,width:`32`,height:`16`,rx:`8`,fill:`#242831`,stroke:`#b8c2cb`,strokeOpacity:`.32`}),(0,b.jsx)(`circle`,{cx:ft(i,18).x-6,cy:ft(i,18).y,r:`2`,fill:`#101318`}),(0,b.jsx)(`circle`,{cx:ft(i,18).x,cy:ft(i,18).y,r:`2`,fill:`#101318`}),(0,b.jsx)(`circle`,{cx:ft(i,18).x+6,cy:ft(i,18).y,r:`2`,fill:`#101318`}),(0,b.jsx)(`circle`,{cx:ft(i,18).x+12,cy:ft(i,18).y-3,r:`1.5`,fill:`#55c7b3`,opacity:`.7`})]}),c.slice(4).map(([i,a],o)=>{let s=o+4;return(0,b.jsx)(`g`,{"data-filter-match":s<n?String(!r.has(s)):void 0,opacity:r.has(s)?.2:1,children:(0,b.jsx)(Kt,{x:e+i,y:t+a,facing:`south`,occupied:s<n})},`south-${o}`)})]})}function Jt({x:e,y:t}){let n=V(e,t,5),r=V(e+.7,t,5),i=V(e,t,28),a=V(e+.7,t,28),o=V(e,t,13),s=V(e+.7,t,13),c=V(e,t,21),l=V(e+.7,t,21);return(0,b.jsxs)(`g`,{"aria-hidden":`true`,children:[(0,b.jsx)(`polygon`,{points:H([n,r,a,i]),fill:`#29272d`,stroke:`#9c8b70`,strokeOpacity:`.34`}),(0,b.jsx)(`path`,{d:`M ${o.x} ${o.y}L ${s.x} ${s.y}M ${c.x} ${c.y}L ${l.x} ${l.y}`,stroke:`#8d7657`,strokeOpacity:`.5`}),(0,b.jsx)(`path`,{d:`M ${i.x+9} ${i.y+8}v7M ${i.x+17} ${i.y+9}v6M ${i.x+25} ${i.y+7}v8`,stroke:`#55c7b3`,strokeOpacity:`.42`,strokeWidth:`4`})]})}function Yt({x:e,y:t}){let n=V(e,t,5),r=V(e+.82,t,5),i=V(e,t,28),a=V(e+.82,t,28);return(0,b.jsxs)(`g`,{"aria-hidden":`true`,children:[(0,b.jsx)(`polygon`,{points:H([n,r,a,i]),fill:`#d8d5cf`,fillOpacity:`.1`,stroke:`#a78bfa`,strokeOpacity:`.42`}),(0,b.jsx)(`path`,{d:`M ${i.x+10} ${i.y+10}l18 2M ${i.x+9} ${i.y+17}l31 4M ${i.x+8} ${i.y+24}l14 2`,stroke:`#a78bfa`,strokeOpacity:`.3`,strokeWidth:`2`})]})}function Xt({x:e,y:t}){let n={x:e,y:t,width:.62,depth:.48},r=dt(n),i=dt(n,18),a={x:e+.12,y:t+.1,width:.38,depth:.26},o=dt(a,18),s=dt(a,33),c=ft(a,25);return(0,b.jsxs)(`g`,{"aria-hidden":`true`,children:[(0,b.jsx)(`polygon`,{points:H([i[3],i[2],r[2],r[3]]),fill:`#382f2a`}),(0,b.jsx)(`polygon`,{points:H([i[1],i[2],r[2],r[1]]),fill:`#2d2928`}),(0,b.jsx)(`polygon`,{points:H(i),fill:`#65513e`,stroke:`#c4a77d`,strokeOpacity:`.3`}),(0,b.jsx)(`polygon`,{points:H([s[3],s[2],o[2],o[3]]),fill:`#171a20`}),(0,b.jsx)(`polygon`,{points:H([s[1],s[2],o[2],o[1]]),fill:`#11141a`}),(0,b.jsx)(`polygon`,{points:H(s),fill:`#292d35`,stroke:`#55c7b3`,strokeOpacity:`.3`}),(0,b.jsx)(`circle`,{cx:c.x+6,cy:c.y-2,r:`2`,fill:`#e6bd62`,opacity:`.65`}),(0,b.jsx)(`path`,{d:`M ${c.x} ${c.y+4}v7h6`,stroke:`#b7a58d`,strokeOpacity:`.5`,strokeWidth:`2`}),(0,b.jsx)(`ellipse`,{cx:c.x+6,cy:c.y+12,rx:`5`,ry:`2.5`,fill:`#d7d2c8`,fillOpacity:`.45`})]})}function Zt({x:e,y:t,activity:n=`vacant`,color:r=`#f1c75b`}){let i=V(e,t,24),a=n!==`vacant`&&n!==`idle`,o=n===`failed`?`#fb7185`:n===`waiting`?`#f4b942`:n===`test-passed`?`#4ade80`:r;return(0,b.jsxs)(`g`,{"aria-hidden":`true`,"data-monitor-activity":n,children:[(0,b.jsx)(`rect`,{x:i.x-10,y:i.y-17,width:`20`,height:`14`,rx:`2`,fill:`#151921`,stroke:a?o:`#8bb5c8`,strokeOpacity:a?`.8`:`.3`}),(0,b.jsx)(`rect`,{x:i.x-7,y:i.y-14,width:`14`,height:`8`,rx:`1`,fill:a?o:`#53616a`,opacity:a?`.2`:`.11`}),n===`active`&&(0,b.jsx)(`path`,{d:`M ${i.x-5} ${i.y-12}h8M ${i.x-5} ${i.y-9}h11M ${i.x-5} ${i.y-6}h6`,stroke:o,strokeWidth:`1`,opacity:`.75`,className:`office-monitor-scroll`}),n===`writing`&&(0,b.jsx)(`path`,{d:`M ${i.x-5} ${i.y-12}h10M ${i.x-5} ${i.y-9}h7M ${i.x-5} ${i.y-6}h11`,stroke:`#d9e2ea`,strokeWidth:`1`,opacity:`.62`}),n===`research`&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`rect`,{x:i.x-5.5,y:i.y-12.5,width:`11`,height:`6.5`,rx:`.8`,fill:`none`,stroke:`#7dd3fc`,opacity:`.68`}),(0,b.jsx)(`path`,{d:`M ${i.x-5} ${i.y-10.5}h10`,stroke:`#7dd3fc`,opacity:`.48`})]}),n===`testing`&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`circle`,{cx:i.x-3.5,cy:i.y-9.5,r:`1.2`,fill:`#f1c75b`}),(0,b.jsx)(`circle`,{cx:i.x,cy:i.y-9.5,r:`1.2`,fill:`#f1c75b`,opacity:`.65`}),(0,b.jsx)(`circle`,{cx:i.x+3.5,cy:i.y-9.5,r:`1.2`,fill:`#f1c75b`,opacity:`.3`})]}),n===`test-passed`&&(0,b.jsx)(`path`,{d:`m ${i.x-4} ${i.y-9} 3 3 6-7`,fill:`none`,stroke:`#4ade80`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`}),n===`failed`&&(0,b.jsx)(`path`,{d:`M ${i.x-4} ${i.y-12}l8 7M ${i.x+4} ${i.y-12}l-8 7`,stroke:`#fb7185`,strokeWidth:`1.5`}),n===`waiting`&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`circle`,{cx:i.x,cy:i.y-10,r:`3.2`,fill:`none`,stroke:`#f4b942`,opacity:`.78`}),(0,b.jsx)(`path`,{d:`M ${i.x} ${i.y-12}v2.5l2 1`,stroke:`#f4b942`,strokeWidth:`1`})]}),n===`idle`&&(0,b.jsx)(`path`,{d:`M ${i.x-4} ${i.y-8}h8`,stroke:`#8bb5c8`,opacity:`.25`}),(0,b.jsx)(`path`,{d:`M ${i.x} ${i.y-3}v7`,stroke:`#5c5961`,strokeWidth:`2`})]})}function Qt({x:e,y:t,atmosphere:n}){let r=V(e,t,17),i=Ht[n],a=n===`idle`?`#e2c477`:i,o=n!==`vacant`,s=n===`active`?.17:n===`idle`||n===`paused`?.075:.13;return(0,b.jsxs)(`g`,{"aria-hidden":`true`,"data-room-bulb":n,"data-room-bulb-powered":o?`true`:`false`,children:[o&&(0,b.jsx)(`ellipse`,{cx:r.x+1,cy:r.y+4,rx:`17`,ry:`11`,fill:a,opacity:s,className:n===`active`?`office-room-light-pulse`:void 0}),(0,b.jsxs)(`g`,{transform:`rotate(6.88 ${r.x} ${r.y})`,children:[(0,b.jsx)(`rect`,{x:r.x-7,y:r.y-7,width:`14`,height:`13`,rx:`3`,fill:`#2a2930`,stroke:`#8d8993`,strokeOpacity:`.58`}),(0,b.jsx)(`path`,{d:`M ${r.x} ${r.y+3}v5`,stroke:`#aaa5ad`,strokeWidth:`2.2`,strokeLinecap:`round`}),(0,b.jsx)(`path`,{d:`M ${r.x-5} ${r.y+11}Q ${r.x} ${r.y+5} ${r.x+5} ${r.y+11}`,fill:o?a:`#35343b`,stroke:o?a:`#706d76`,strokeOpacity:o?`.9`:`.38`}),(0,b.jsx)(`ellipse`,{cx:r.x,cy:r.y+11,rx:`5`,ry:`2.2`,fill:o?a:`#2b2a30`,opacity:o?`.9`:`.65`})]})]})}function $t({floor:e,doorway:t,center:n,atmosphere:r,occupied:i=r!==`vacant`,scope:a=`fleet`}){let o=a===`detail`,s=Ht[r],c={vacant:.2,idle:.018,active:o?.052:.045,waiting:.028,blocked:.038,failed:.045,paused:.04},l=r===`vacant`?`#05060a`:s;return(0,b.jsxs)(`g`,{"aria-hidden":`true`,"data-room-lighting":r,"data-lighting-scope":a,pointerEvents:`none`,children:[c[r]!==void 0&&(0,b.jsx)(`polygon`,{points:H(e),fill:l,opacity:c[r]}),i&&r!==`review`&&(0,b.jsx)(`ellipse`,{cx:n.x,cy:n.y,rx:o?92:58,ry:o?40:25,fill:`#f1c75b`,opacity:r===`active`?o?.055:.045:o?.04:.032,className:r===`active`?`office-room-light-pulse`:void 0,"data-occupied-warmth":`true`,"data-light-motion":r===`active`?`breathing`:`steady`}),t&&r===`waiting`&&(0,b.jsx)(`polygon`,{points:H(t),fill:s,opacity:o?.34:.3,"data-doorway-light":`waiting`,className:`office-doorway-waiting`}),r===`review`&&(0,b.jsx)(`ellipse`,{cx:n.x,cy:n.y,rx:o?112:75,ry:o?52:34,fill:s,opacity:o?.11:.1,"data-review-spotlight":`true`})]})}function en({rect:e,label:t,capacity:n,occupied:r=0,accent:i,z:a=25}){let o=ft(e,a);return(0,b.jsxs)(`g`,{"aria-hidden":`true`,children:[(0,b.jsx)(`rect`,{x:o.x-47,y:o.y-17,width:`94`,height:`24`,rx:`5`,fill:`#111318`,stroke:i,strokeOpacity:`.48`}),(0,b.jsx)(`circle`,{cx:o.x-39,cy:o.y-5,r:`2.3`,fill:i,opacity:`.72`}),(0,b.jsx)(`text`,{x:o.x-32,y:o.y-2,fill:`#e7e3ec`,fillOpacity:`.76`,fontFamily:`ui-monospace, monospace`,fontSize:`5.8`,fontWeight:`700`,letterSpacing:`.3`,children:t}),(0,b.jsx)(`path`,{d:`M ${o.x+19} ${o.y-12}v13`,stroke:i,strokeOpacity:`.14`}),(0,b.jsx)(`rect`,{x:o.x+24,y:o.y-11,width:`18`,height:`11`,rx:`3`,fill:i,fillOpacity:`.11`}),(0,b.jsxs)(`text`,{x:o.x+33,y:o.y-3,textAnchor:`middle`,fill:i,fillOpacity:`.9`,fontFamily:`ui-monospace, monospace`,fontSize:`5.4`,fontWeight:`700`,children:[r,`/`,n]})]})}function tn({x:e,y:t}){let n=V(e,t,4);return(0,b.jsxs)(`g`,{"aria-hidden":`true`,children:[(0,b.jsx)(`path`,{d:`M ${n.x} ${n.y}c-2-18-15-18-9-29 8 2 11 8 10 16 4-18 17-16 16-5-4 5-10 7-14 8`,fill:`#47735c`,opacity:`.75`}),(0,b.jsx)(`path`,{d:`M ${n.x-8} ${n.y}h16l-3 13h-10z`,fill:`#6a4d35`})]})}var nn={direct:[`On it — getting started!`,`I’m on the case.`,`Let’s get this moving.`,`Starting a focused pass.`,`I’ve got this one.`,`Time to dig in.`,`Opening the task now.`,`Let’s make it happen.`,`Getting straight to work.`,`I’m picking this up.`,`Starting with the essentials.`,`Let’s see what we’ve got.`,`Kicking off the first pass.`,`I’ll take it from here.`,`Settling in and starting.`,`Focus mode: activated.`,`Starting clean and simple.`,`I’m diving into the details.`,`Let’s build something solid.`,`Beginning the work now.`,`Task received — moving.`,`All right, here we go.`,`Starting with a quick scan.`,`I’m getting oriented.`,`Let’s knock this out.`],manager:[`Team assembled — starting now!`,`I’m briefing the team.`,`Let’s coordinate the first pass.`,`Assignments are going out.`,`The team is getting started.`,`Kicking off the mission plan.`,`I’m lining up the work.`,`Let’s divide and conquer.`,`Starting the team sync now.`,`The mission is underway.`,`I’m setting the team in motion.`,`Delegation mode: engaged.`,`Let’s get everyone aligned.`,`I’m mapping the first moves.`,`The swarm is on the case.`,`Launching the coordinated pass.`,`I’m handing out assignments.`,`Let’s make parallel progress.`,`The plan is leaving the runway.`,`I’m organizing the opening move.`,`Team, we have a mission.`,`Starting with a clean handoff.`,`Let’s put the plan to work.`,`I’m coordinating the kickoff.`,`Everyone has their heading.`],worker:[`Ready to work!`,`I’ve got my assignment.`,`Starting my piece now.`,`I’m on this part.`,`Task received — digging in.`,`I’ll take this one.`,`Getting started over here.`,`I’m opening the relevant files.`,`Time for a focused pass.`,`I’m picking up this thread.`,`Starting with a quick review.`,`I know what to do.`,`Let’s get this piece done.`,`I’m diving into my task.`,`My part is underway.`,`I’m getting the context now.`,`Beginning the first pass.`,`I’ll report back shortly.`,`I’m tracing this section.`,`Starting carefully.`,`I have the brief.`,`Let me work through this.`,`I’m taking the next step.`,`Assignment accepted.`,`I’m moving on it now.`]};function rn(e,t,n){return dn(nn[e],`${e}:${t}:${n}:arrival`)}var an=[`Checking`,`Reviewing`,`Tracing`,`Inspecting`,`Polishing`,`Updating`,`Validating`,`Testing`,`Tuning`,`Refining`,`Mapping`,`Auditing`,`Building`,`Comparing`,`Verifying`,`Cleaning up`,`Wiring up`,`Working through`,`Taking a look at`,`Digging into`],on={web:[`the latest docs`,`the web results`,`the source material`,`a few references`,`the external details`,`the relevant pages`,`the current guidance`,`the research trail`,`the available evidence`,`the upstream documentation`],read:[`the surrounding code`,`the existing flow`,`the current implementation`,`the relevant files`,`the data path`,`the component structure`,`the nearby logic`,`the repository context`,`the interfaces`,`how this fits together`],write:[`the implementation`,`a focused change`,`the UI details`,`the data flow`,`the edge cases`,`the integration`,`the new behavior`,`the component`,`the finishing touches`,`a small improvement`],test:[`the test suite`,`the tricky cases`,`the new behavior`,`the regression checks`,`the happy path`,`the failure path`,`the browser flow`,`the acceptance criteria`,`the final checks`,`the build`],command:[`a local command`,`the build output`,`the runtime state`,`the development setup`,`the generated output`,`the package scripts`,`the diagnostics`,`the environment`,`the logs`,`the verification command`],agent:[`the delegated work`,`the worker reports`,`the parallel tasks`,`the handoff`,`the team output`,`the remaining assignments`,`the work split`,`the incoming results`,`the task queue`,`the next delegation`],decision:[`the available options`,`the tradeoffs`,`the acceptance gate`,`the requested decision`,`the safest path`,`the review feedback`,`the open question`,`the approval state`,`the user preference`,`the next move`],output:[`the latest result`,`the generated output`,`the implementation summary`,`the reported progress`,`the final evidence`,`the changed files`,`the current result`,`the deliverable`,`the completion notes`,`the latest update`],lifecycle:[`the mission state`,`the current phase`,`the next milestone`,`the plan progress`,`the review handoff`,`the completion state`,`the active phase`,`the remaining work`,`the mission timeline`,`the current checkpoint`],tool:[`the current task`,`the tool output`,`the next step`,`the implementation details`,`the active work`,`the latest change`,`the underlying issue`,`the requested update`,`the current approach`,`the result`],design:[`the visual details`,`the spacing`,`the color treatment`,`the interaction states`,`the responsive layout`,`the component styling`,`the interface polish`,`the animation timing`,`the visual hierarchy`,`the user flow`],api:[`the API flow`,`the request handling`,`the server path`,`the response shape`,`the endpoint behavior`,`the integration boundary`,`the error handling`,`the runtime contract`,`the provider adapter`,`the backend logic`],docs:[`the documentation`,`the setup guide`,`the usage notes`,`the examples`,`the installation steps`,`the project overview`,`the troubleshooting notes`,`the contributor guidance`,`the release notes`,`the written instructions`],data:[`the persisted state`,`the data model`,`the storage path`,`the migration behavior`,`the saved preferences`,`the state reconciliation`,`the cached data`,`the mission record`,`the event history`,`the durable snapshot`]},sn=[`now`,`carefully`,`before moving on`,`one step at a time`,`to make sure it holds up`,`and checking the edges`,`with fresh eyes`,`for anything surprising`,`before the final pass`,`and keeping it tidy`,`against the plan`,`to keep things moving`],cn=`Let’s keep the swarm moving.(Tiny sync, then onward.(I love a clean handoff.(Delegation is my cardio.(Let’s not overcomplicate it.(One dependency at a time.(Keeping an eye on the edges.(The plan is coming together.(I brought a checklist.(Time for a quick status sweep.(Everybody has context, right?(A crisp brief saves a long meeting.(Let’s close the loop.(I can smell a milestone.(No blockers on my watch.(Coordination mode: engaged.(The queue looks manageable.(A little structure goes a long way.(I’m aligning the moving pieces.(Let’s make the handoff boring.(Quiet office, busy team.(I’ll take the big picture.(Keeping scope in its lane.(Good work deserves good evidence.(Let’s leave clear notes.(Progress loves a checklist.(I have a meeting with the plan.(Status reports, assemble.(Another day, another dependency.(I’m professionally circling back.(The roadmap says hello.(Let’s make future-us happy.(Calm plan, fast team.(I’m counting green checks.(No mystery meat handoffs.(The mission has a pulse.(I’ll coordinate; you create.(Keeping the context warm.(The board is looking healthier.(Let’s ship something sturdy.(I believe in short meetings.(This could be a concise update.(Manager hat: firmly on.(I’m herding very capable cats.(All signal, minimal ceremony.(A plan with receipts—lovely.(Let’s turn motion into progress.(The swarm knows the assignment.(I’ll watch the critical path.(Coffee, context, coordination.`.split(`(`),ln=`One more tiny fix…(Coffee would understand.(Making pixels behave.(I found the weird edge case.(This function has opinions.(Saving future-me a headache.(The bug blinked first.(Just tidying the corners.(I speak fluent stack trace.(This should be straightforward™.(Adding a little polish.(The tests are judging me.(I brought extra semicolons.(Compiling my thoughts.(The cache remembers everything.(One clean diff, coming up.(I definitely read the docs.(Making the happy path happier.(Negotiating with TypeScript.(The linter and I are talking.(Rubber duck unavailable.(No magic numbers on my watch.(Turning coffee into commits.(This edge case is ambitious.(I found a suspicious boolean.(Small change, big feelings.(Keeping the diff civilized.(The browser has entered the chat.(I enjoy reproducible bugs.(Just one more assertion.(The logs are telling a story.(Naming things: final boss.(I’m in the flow now.(Future maintainers, you’re welcome.(I see what the code meant.(The pixels have unionized.(Making this less surprising.(Today we choose clarity.(A tidy interface is a happy interface.(I have located the vibes.(The build is thinking about it.(Tests first, victory later.(I’m giving this a careful squint.(The TODO looked lonely.(I came, I saw, I refactored.(The abstraction is behaving now.(I’m following the breadcrumbs.(A breakpoint would be nice.(This comment earned its keep.(The component needed boundaries.(I’m reducing future confusion.(The diff is almost photogenic.(It works locally—promising start.(I’m asking the code politely.(This path could use a map.(I found the missing piece.(Keeping complexity on a leash.(The state machine sends regards.(I’m making errors more useful.(One deterministic step at a time.(The UI deserves nice spacing.(I’m adding guardrails.(This deserves a regression test.(The types caught something sneaky.(No tokens were harmed here.(The terminal says maybe.(I’m on speaking terms with the API.(That selector was oddly specific.(A clean build sparks joy.(I’m untangling this gently.(The data has arrived safely.(Making the invisible state visible.(The layout is finding balance.(I’ll keep the cleverness modest.(This branch has character.(I see a green check approaching.(The error message can do better.(This needs exactly one helper.(I’m keeping the scope honest.(The final 10% has entered the room.`.split(`(`),un={waiting:[`I need your decision.`,`Waiting on your call.`,`A choice is blocking progress.`,`Your input unlocks the next step.`,`I’m paused at a decision point.`,`Ready when you are.`,`One answer and we can continue.`,`The next move is yours.`,`I need a quick direction check.`,`Holding here for your input.`],blocked:[`I hit a blocker.`,`Something needs attention.`,`The path forward is blocked.`,`I found an obstacle.`,`Progress is paused on an issue.`,`This needs a recovery step.`,`I can’t safely continue yet.`,`The current approach is stuck.`,`A dependency is holding us up.`,`I need help clearing this path.`],failed:[`That step failed.`,`I found a failure to investigate.`,`The latest attempt didn’t pass.`,`Something broke during verification.`,`The result needs another look.`,`I have an error to resolve.`,`The check came back red.`,`That path didn’t work.`,`The runtime reported a failure.`,`I’m stopping on a real error.`],review:[`Ready for your review!`,`The evidence is ready.`,`This is ready for acceptance.`,`The work is ready to inspect.`,`I’ve reached the review gate.`,`Ready for the final check.`,`The result is waiting for you.`,`Review package is ready.`,`All set for acceptance.`,`Your review is the next step.`],paused:[`Mission paused.`,`Holding the current state.`,`Everything is safely paused.`,`Standing by with context intact.`,`Work is paused for now.`,`I’ll keep our place here.`,`Paused and ready to resume.`,`The mission is on hold.`,`Context saved; standing by.`,`Waiting for the restart signal.`]};function dn(e,t){return e[Dt(t)%e.length]}var fn=[`methodical`,`energetic`,`thoughtful`,`social`,`quiet`];function pn(e){return dn(fn,`${e}:personality`)}function mn(e,t,n){let r=pn(e),i=dn(t?ln:cn,`${e}:ambient:${n}`),a={methodical:[`Checklist update:`,`Careful pass:`],energetic:[`Quick update!`,`Making moves!`],thoughtful:[`Thinking aloud:`,`One consideration:`],social:[`Team thought:`,`Quick office note:`]};return a[r]&&Dt(`${e}:${n}:prefix`)%3==0?`${dn(a[r],`${e}:${n}:prefix-pick`)} ${i}`:i}function hn(e){let t=`${e.toolName??``} ${e.detail} ${e.filePath??``}`.toLowerCase();return t.includes(`websearch`)||t.includes(`webfetch`)||t.includes(`browser`)||t.includes(`http`)?`web`:/css|style|layout|color|colour|ui|ux|component|animation|hover|responsive/.test(t)?`design`:/api|server|endpoint|request|response|route|provider/.test(t)?`api`:/readme|documentation|\.md\b|guide|docs/.test(t)?`docs`:/database|sqlite|migration|persist|storage|cache|snapshot/.test(t)?`data`:e.activityKind&&e.activityKind in on?e.activityKind:`tool`}function gn(e,t){let n=hn(e),r=`${t}:${e.ts}:${e.toolName??e.detail}`;return`${dn(an,`${r}:open`)} ${dn(on[n],`${r}:object`)} ${dn(sn,`${r}:close`)}.`}function _n(e,t){return e.targetWorker?e.targetWorker===t.id||e.targetWorker===t.label:e.jobId===t.jobId}function vn(e,t){if(t&&[`failed`,`error`].includes(t.jobState.toLowerCase()))return`failed`;if(t?.jobState.toLowerCase()===`blocked`)return`blocked`;if(e.lifecycleStatus===`ready_for_review`)return`review`;if(e.lifecycleStatus===`paused`)return`paused`;if(e.activityStatus===`error`)return`failed`;if(e.activityStatus===`stalled`)return`blocked`;if(e.activityStatus===`waiting_on_you`)return`waiting`}function yn(e,t,n){if(t===`off`)return[];let r=[],i=e=>`${e.floorIndex}:${e.spaceId}`,a=[...new Set(e.map(i))].sort(),o=e.reduce((e,t)=>e+1+(t.kind===`orchestrated`?t.mission.workers.filter(jt).length:0),0),s=o<=2?28e3:o<=5?22e3:o<=9?18e3:15e3,c=o<=5?1:o<=10?2:3,l=(n%s+s)%s,u=s/Math.max(1,a.length),d=Math.floor(n/s);for(let o of e){let e=o.mission,c=i(o),f=(l-a.indexOf(c)*u+s)%s,p=f<4800,m=(i,a)=>{let o=e.recentEvents.filter(t=>a?_n(t,a):!e.workers.some(e=>_n(t,e))),l=o.at(-1),u=l?.phase===`delegating`||l?.phase===`worker_started`||l?.phase===`worker_reported`,m=n-f,h=u?l:o.find(e=>e.ts>=m)??l,g=vn(e,a),_=g===`failed`||g===`blocked`||g===`waiting`,v=o.slice(-5).some(e=>n-e.ts<12e4&&/security|secret|credential|password|token|auth|vulnerab/i.test(`${e.detail} ${e.filePath??``}`)),y=h?.phase===`delegating`||h?.phase===`worker_started`?`delegating`:h?.phase===`worker_reported`?`reporting`:void 0,b=y===`delegating`&&a?Math.max(h?.ts??0,a.startedAt+5400):h?.ts??0,x=h&&n>=b&&n-b<9e3&&(!!y||p),S=!l||n-l.ts>=Math.max(14e3,s/2);_&&p?r.push({targetId:i,missionId:e.missionId,workerId:a?.id,text:dn(un[g],`${i}:${g}:${d}`),kind:`alert`,priority:100,room:c,freshness:n-f,scheduled:!0}):x?r.push({targetId:i,missionId:e.missionId,workerId:a?.id,text:y===`delegating`?`Assignment: ${h.detail}`:y===`reporting`?`Results delivered: ${h.detail}`:h.outcome===`failure`?dn(un.failed,`${i}:event-failed:${h.ts}`):gn(h,i),kind:h.outcome===`failure`?`alert`:y===`reporting`?`output`:`speech`,interaction:y,priority:h.outcome===`failure`?100:y?90:80,room:c,freshness:b,scheduled:!1}):g&&p?r.push({targetId:i,missionId:e.missionId,workerId:a?.id,text:dn(un[g],`${i}:${g}:${d}`),kind:_?`alert`:g===`review`?`output`:`speech`,priority:75,room:c,freshness:n-f,scheduled:!0}):t===`work_personality`&&p&&S&&!g&&!v&&e.lifecycleStatus===`active`&&r.push({targetId:i,missionId:e.missionId,workerId:a?.id,text:mn(i,!!a,d),kind:`thought`,priority:20,room:c,freshness:n-f,scheduled:!0})};if(m(e.missionId),o.kind===`orchestrated`)for(let t of e.workers.filter(t=>jt(t)||e.recentEvents.some(e=>e.phase===`worker_reported`&&_n(e,t)&&n-e.ts<18e3)))m(`${e.missionId}:${t.id}`,t)}let f=new Map;for(let e of r.sort((e,t)=>t.priority-e.priority||t.freshness-e.freshness||Dt(e.targetId)-Dt(t.targetId)))f.has(e.room)||f.set(e.room,e);let p=[...f.values()].sort((e,t)=>t.priority-e.priority||t.freshness-e.freshness),m=p.filter(e=>e.scheduled).slice(0,c);for(let e of p)m.length<c&&!m.includes(e)&&m.push(e);return m.map(({room:e,freshness:t,scheduled:n,...r})=>r)}function bn({identity:e,x:t,y:n,role:r,provider:i,state:a,transition:o,activeMotion:s=!0,reviewing:c=!1,needsAttention:l=!1,route:u,transferOrigin:d,interaction:f,interactionTarget:p}){let m=Ot(e),h=V(t,n,26),g=r===`manager`||r===`review`,_=i===`codex`?`#55c7b3`:`#a78bfa`,v=V(u?.entrance?.x??12.28,u?.entrance?.y??2.9,26),y=V(u?.lobby?.x??12.28,u?.lobby?.y??3.18,26),x=u??(r===`direct`?{doorway:{x:3.62,y:3.15},inside:{x:3.18,y:3.15}}:void 0),S=x?V(x.doorway.x,x.doorway.y,26):void 0,C=x?V(x.inside.x,x.inside.y,26):void 0,w=d?V(d.position.x,d.position.y,26):void 0,T=d?V(d.doorway.x,d.doorway.y,26):void 0,E=d?V(d.inside.x,d.inside.y,26):void 0,D=p?V(p.x,p.y,26):void 0,O={"--avatar-offset":`${m.offset}ms`,...D?{"--interaction-x":`${(D.x-h.x)*.72}px`,"--interaction-y":`${(D.y-h.y)*.72}px`}:{},...S&&C?{"--office-start-x":`${v.x-h.x}px`,"--office-start-y":`${v.y-h.y}px`,"--office-lobby-x":`${y.x-h.x}px`,"--office-lobby-y":`${y.y-h.y}px`,"--office-door-x":`${S.x-h.x}px`,"--office-door-y":`${S.y-h.y}px`,"--office-inside-x":`${C.x-h.x}px`,"--office-inside-y":`${C.y-h.y}px`}:{},...w&&T&&E?{"--office-origin-x":`${w.x-h.x}px`,"--office-origin-y":`${w.y-h.y}px`,"--office-origin-door-x":`${T.x-h.x}px`,"--office-origin-door-y":`${T.y-h.y}px`,"--office-origin-inside-x":`${E.x-h.x}px`,"--office-origin-inside-y":`${E.y-h.y}px`}:{}},k=m.hairStyle===`long`?(0,b.jsx)(`path`,{d:`M ${h.x-8} ${h.y-7}q8-10 16 0l-1 15-5-5h-10l-5 5z`,fill:m.hair}):m.hairStyle===`ponytail`?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`circle`,{cx:h.x+8,cy:h.y-3,r:`4.5`,fill:m.hair}),(0,b.jsx)(`path`,{d:`M ${h.x+7} ${h.y-5}q8 5 3 13-1-6-6-8z`,fill:m.hair})]}):m.hairStyle===`bun`?(0,b.jsx)(`circle`,{cx:h.x+1,cy:h.y-14,r:`4.5`,fill:m.hair}):null,A=m.hairStyle===`short`?(0,b.jsx)(`path`,{d:`M ${h.x-7} ${h.y-7}q7-9 14 0v3q-7-4-14 0z`,fill:m.hair}):m.hairStyle===`side`?(0,b.jsx)(`path`,{d:`M ${h.x-8} ${h.y-6}q2-10 9-8 7 2 7 9-8-4-16-1z`,fill:m.hair}):m.hairStyle===`crop`?(0,b.jsx)(`path`,{d:`M ${h.x-7} ${h.y-7}q7-7 14 0l-2 2q-6-3-12 1z`,fill:m.hair}):m.hairStyle===`curls`?(0,b.jsxs)(`g`,{fill:m.hair,children:[[-6,-3,0,3,6].map((e,t)=>(0,b.jsx)(`circle`,{cx:h.x+e,cy:h.y-10+Math.abs(t-2)*1.2,r:`3.4`},e)),(0,b.jsx)(`circle`,{cx:h.x-7,cy:h.y-5,r:`3`}),(0,b.jsx)(`circle`,{cx:h.x+7,cy:h.y-5,r:`3`})]}):(0,b.jsx)(`path`,{d:`M ${h.x-7.5} ${h.y-7}q7.5-10 15 0v4q-4-3-7-3l-2 5-2-5q-3 0-6 3z`,fill:m.hair});return(0,b.jsx)(`g`,{"aria-hidden":`true`,pointerEvents:`none`,"data-avatar-id":e,"data-avatar-role":r,"data-avatar-state":a,"data-avatar-hair":m.hairStyle,"data-avatar-outfit":g?`suit`:m.outfit,"data-avatar-behavior":c?`reviewing`:void 0,"data-avatar-personality":pn(e),"data-avatar-gesture":m.gesture,"data-avatar-motion":a!==`working`||s?`active`:`rest`,"data-avatar-interaction":f,"data-avatar-reported":r===`worker`&&o===`exiting`&&p?`true`:void 0,"data-office-route":x?`hallway`:void 0,"data-office-transfer":d?`review`:void 0,"data-office-transition":o,style:O,children:(0,b.jsxs)(`g`,{className:`office-avatar-pose`,children:[(0,b.jsx)(`ellipse`,{cx:h.x,cy:h.y+19,rx:g?9:8,ry:`3.5`,fill:`#000`,opacity:`.32`}),(0,b.jsxs)(`g`,{className:`office-avatar-body`,children:[(0,b.jsx)(`path`,{d:`M ${h.x-(g?8:7)} ${h.y+3}Q ${h.x} ${h.y-2} ${h.x+(g?8:7)} ${h.y+3}L ${h.x+6} ${h.y+18}H ${h.x-6}Z`,fill:g?`#202938`:m.clothing,stroke:_,strokeOpacity:g?`.68`:`.3`}),g&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`path`,{d:`M ${h.x-2.7} ${h.y+2}H ${h.x+2.7}L ${h.x+1.4} ${h.y+10}H ${h.x-1.4}Z`,fill:`#e7e9ed`,opacity:`.9`}),(0,b.jsx)(`path`,{d:`M ${h.x-7} ${h.y+3}L ${h.x-2.6} ${h.y+2}L ${h.x-.8} ${h.y+11}L ${h.x-5} ${h.y+7}ZM ${h.x+7} ${h.y+3}L ${h.x+2.6} ${h.y+2}L ${h.x+.8} ${h.y+11}L ${h.x+5} ${h.y+7}Z`,fill:`#39465a`}),(0,b.jsx)(`path`,{d:`M ${h.x} ${h.y+4}l2 3-2 7-2-7z`,fill:`#d6aa4b`})]}),!g&&m.outfit===`hoodie`&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`path`,{d:`M ${h.x-6} ${h.y+4}q6-7 12 0`,fill:`none`,stroke:`#d8dde2`,strokeOpacity:`.42`,strokeWidth:`2.2`}),(0,b.jsx)(`path`,{d:`M ${h.x-2} ${h.y+4}v7M ${h.x+2} ${h.y+4}v7`,stroke:`#e7e9ed`,strokeOpacity:`.6`,strokeWidth:`.8`}),(0,b.jsx)(`path`,{d:`M ${h.x-3} ${h.y+15}h6`,stroke:`#252a31`,strokeOpacity:`.45`})]}),!g&&m.outfit===`jacket`&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`path`,{d:`M ${h.x-6} ${h.y+4}l5 5 1-7M ${h.x+6} ${h.y+4}l-5 5-1-7`,fill:`none`,stroke:`#e2e6ea`,strokeOpacity:`.6`,strokeWidth:`1.2`}),(0,b.jsx)(`path`,{d:`M ${h.x} ${h.y+8}v10`,stroke:`#20242a`,strokeOpacity:`.65`})]}),!g&&m.outfit===`sweater`&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`path`,{d:`M ${h.x-6} ${h.y+10}h12M ${h.x-5.5} ${h.y+13}h11`,stroke:`#f3e4c5`,strokeOpacity:`.35`,strokeWidth:`1.5`}),(0,b.jsx)(`path`,{d:`M ${h.x-3} ${h.y+3}q3 3 6 0`,fill:`none`,stroke:`#ede7dc`,strokeOpacity:`.45`})]}),!g&&m.outfit===`tee`&&(0,b.jsx)(`path`,{d:`M ${h.x-3} ${h.y+3}q3 4 6 0`,fill:`none`,stroke:`#f4f6f8`,strokeOpacity:`.38`,strokeWidth:`1.2`}),(0,b.jsxs)(`g`,{className:`office-avatar-arms-rest`,children:[(0,b.jsx)(`path`,{d:`M ${h.x-5} ${h.y+7}l-5 8`,stroke:m.skin,strokeWidth:`3`,strokeLinecap:`round`}),(0,b.jsx)(`path`,{d:`M ${h.x+5} ${h.y+7}l5 8`,stroke:m.skin,strokeWidth:`3`,strokeLinecap:`round`})]}),(0,b.jsxs)(`g`,{className:`office-avatar-arms-working`,"data-avatar-hands":`keyboard`,children:[(0,b.jsx)(`path`,{className:`office-avatar-arm office-avatar-arm-left`,d:`M ${h.x-5} ${h.y+7}Q ${h.x-7} ${h.y} ${h.x+1} ${h.y-(g?14:11)}`,stroke:m.skin,strokeWidth:`3`,strokeLinecap:`round`,fill:`none`}),(0,b.jsx)(`path`,{className:`office-avatar-arm office-avatar-arm-right`,d:`M ${h.x+5} ${h.y+7}Q ${h.x+8} ${h.y} ${h.x+7} ${h.y-(g?14:11)}`,stroke:m.skin,strokeWidth:`3`,strokeLinecap:`round`,fill:`none`})]}),(0,b.jsxs)(`g`,{className:`office-avatar-note`,children:[(0,b.jsx)(`rect`,{x:h.x+7,y:h.y+8,width:`8`,height:`6`,rx:`1`,fill:`#efe9d8`,stroke:`#d6aa4b`,strokeWidth:`.7`}),(0,b.jsx)(`path`,{d:`M ${h.x+9} ${h.y+10}h4M ${h.x+9} ${h.y+12}h3`,stroke:`#635b50`,strokeWidth:`.6`})]})]}),(0,b.jsxs)(`g`,{className:`office-avatar-head`,children:[k,(0,b.jsx)(`circle`,{cx:h.x,cy:h.y-5,r:g?8:7.5,fill:m.skin,stroke:`#f8e4d1`,strokeOpacity:`.24`}),A]}),l&&(0,b.jsxs)(`g`,{className:`office-attention-badge`,children:[(0,b.jsx)(`circle`,{cx:h.x+10,cy:h.y-18,r:`6.5`,fill:`#3a162e`,stroke:`#f472b6`,strokeWidth:`1.2`}),(0,b.jsx)(`text`,{x:h.x+10,y:h.y-15.4,textAnchor:`middle`,fill:`#f9a8d4`,fontSize:`8`,fontWeight:`900`,children:`?`})]})]})})}function xn({x:e,y:t,text:n,delayMs:r=5300,kind:i=`speech`,targetId:a,onClick:o}){let s=V(e,t,26),c=n.length>40?`${n.slice(0,39)}…`:n,l=Math.min(164,Math.max(104,24+c.length*4.15)),u=i===`alert`?`#fb7185`:i===`thought`?`#a78bfa`:i===`output`?`#e6bd62`:`#55c7b3`;return(0,b.jsxs)(`g`,{"aria-hidden":o?void 0:`true`,role:o?`button`:void 0,tabIndex:o?0:void 0,"aria-label":o?`${n} Open details`:void 0,pointerEvents:o?`all`:`none`,"data-office-speech":`true`,"data-office-speech-kind":i,"data-office-speech-target":a,className:`office-speech-bubble ${o?`cursor-pointer`:``}`,onClick:o?e=>{e.stopPropagation(),o()}:void 0,onKeyDown:o?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),o())}:void 0,style:{"--office-speech-delay":`${r}ms`},children:[(0,b.jsx)(`rect`,{x:s.x-l/2,y:s.y-58,width:l,height:`29`,rx:i===`thought`?14:9,fill:i===`alert`?`#fff3f3`:`#f5f1e8`,stroke:u,strokeWidth:i===`alert`?1.4:1,strokeOpacity:`.75`}),i===`thought`?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`circle`,{cx:s.x-3,cy:s.y-25,r:`3.5`,fill:`#f5f1e8`,stroke:u,strokeOpacity:`.65`}),(0,b.jsx)(`circle`,{cx:s.x+2,cy:s.y-19,r:`2`,fill:`#f5f1e8`,stroke:u,strokeOpacity:`.55`})]}):(0,b.jsx)(`path`,{d:`M ${s.x-7} ${s.y-31}l7 9 8-9z`,fill:i===`alert`?`#fff3f3`:`#f5f1e8`}),i===`alert`&&(0,b.jsx)(`text`,{x:s.x-l/2+10,y:s.y-40,fill:u,fontSize:`9`,fontWeight:`900`,children:`!`}),i===`output`&&(0,b.jsx)(`path`,{d:`M ${s.x-l/2+7} ${s.y-47}h8l2 3h8v11h-18z`,fill:`none`,stroke:u,strokeWidth:`1.2`}),(0,b.jsx)(`text`,{x:s.x+(i===`alert`||i===`output`?8:0),y:s.y-41,textAnchor:`middle`,fill:`#202529`,fontFamily:`ui-sans-serif, system-ui`,fontSize:`7`,fontWeight:`700`,children:c})]})}var Sn={direct:`#17171d`,standard:`#15161c`,large:`#19171b`},Cn={direct:`#55c7b3`,standard:`#a78bfa`,large:`#e6bd62`};function wn({room:e,occupants:t,visibleMissionIds:n,attentionMissionIds:r=new Set,workerSeatAssignments:i,animatedActors:a=new Set,transitions:o,transferOrigins:s={},bubbles:c=[],announcement:l,selected:u,focused:d,dimmed:f,onSelect:p,onOpenMission:m,onOpenWorker:h,onFocus:g,onBlur:_,layer:v}){let y=dt(e),x=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),p())},S=e=>{e.stopPropagation(),p()},C=e.kind===`direct`?[[.55,.72],[1.65,.72],[.55,2.05],[1.65,2.05],[.55,3.38],[1.65,3.38],[.55,4.71],[1.65,4.71]]:e.kind===`large`?[]:mt,w=t[0],T=Vt(t.map(e=>e.mission)),E=f||T===`vacant`?.42:1,D=e=>n.has(e.mission.missionId),O=e.kind===`standard`&&w?Math.min(e.capacity,1+w.mission.workers.filter(jt).length):t.length,k=w?.mission.lifecycleStatus===`ready_for_review`?`#e6bd62`:w?.mission.lifecycleStatus===`failed`||w?.mission.activityStatus===`error`?`#fb7185`:w?.mission.activityStatus===`stalled`?`#fb923c`:w?.mission.activityStatus===`waiting_on_you`?`#f472b6`:w?.mission.lifecycleStatus===`paused`?`#7dd3fc`:w?.mission.activityStatus===`working`?`#f1c75b`:Cn[e.kind];if(v===`plaque`){let t=e.y===0?-.58:6.8,n=e.kind===`standard`&&w?w.mission.name.slice(0,12).toUpperCase():e.shortLabel,r=e.kind===`standard`&&w?`${e.label}: ${w.mission.name}`:e.kind===`direct`?`${e.label}: hover an occupied desk to see its mission`:e.label;return(0,b.jsxs)(`g`,{"aria-label":r,pointerEvents:`visiblePainted`,opacity:E,style:{transition:`opacity 180ms ease`},children:[(0,b.jsx)(`title`,{children:r}),(0,b.jsx)(en,{rect:{x:e.x+e.width/2-.1,y:t,width:.2,depth:.1},label:n,capacity:e.capacity,occupied:O,accent:k,z:0})]})}if(v===`contents`||v===`furniture`||v===`people`){let n=v===`contents`||v===`furniture`,u=v===`contents`||v===`people`,d=new Map;if(w)for(let e of w.mission.workers){let t=`${w.mission.missionId}:${e.id}`,n=i[t];n!==void 0&&o[t]!==`room-activate`&&d.set(n,e)}let f=[[.82,.38],[1.47,.38],[2.12,.38],[2.77,.38],[.82,2.16],[1.47,2.16],[2.12,2.16],[2.77,2.16]],p=(e,t)=>{e.stopPropagation(),!(`key`in e&&e.key!==`Enter`&&e.key!==` `)&&(`key`in e&&e.preventDefault(),t())},g=e=>c.find(t=>t.targetId===e),_=(e,t,n)=>e?(0,b.jsx)(xn,{x:t,y:n,text:e.text,kind:e.kind,targetId:e.targetId,delayMs:0,onClick:e.kind===`thought`?void 0:()=>e.workerId?h(e.missionId,e.workerId):m(e.missionId)},`dialogue:${e.targetId}`):null,y=e.kind===`standard`&&w?[...d.entries()].find(([,e])=>o[`${w.mission.missionId}:${e.id}`]===`reporting`):void 0,x=y?.[0],S=e.kind===`standard`&&w?{x:e.x+C[0][0]+.36,y:e.y+C[0][1]+.78}:void 0,O=x===void 0?void 0:{x:e.x+C[x+1][0]+.36,y:e.y+C[x+1][1]+.72},k=e.x+e.width*.83,A=e.kind===`direct`?void 0:{doorway:{x:k,y:3.15},inside:{x:k,y:e.y===0?2.55:3.75}};return(0,b.jsxs)(`g`,{opacity:E,"data-office-transition":w?o[w.mission.missionId]:void 0,style:{transition:`opacity 180ms ease`},children:[n&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(Qt,{x:e.x+e.width*.52,y:e.y+.12,atmosphere:T}),(e.id===`direct-studio`||e.id===`standard-a`||e.id===`review`)&&(0,b.jsx)(tn,{x:e.x+.35,y:e.y+.35}),e.id===`direct-studio`&&(0,b.jsx)(Jt,{x:e.x+2.45,y:e.y}),e.id===`standard-b`&&(0,b.jsx)(Xt,{x:e.x+.18,y:e.y+2.18}),e.id===`standard-c`&&(0,b.jsx)(Yt,{x:e.x+.2,y:e.y}),e.kind===`large`?(0,b.jsx)(qt,{x:e.x,y:e.y,occupiedCount:t.length,dimmedSeatIndexes:new Set(t.filter(e=>!D(e)).map(e=>e.seatIndex))}):C.map(([n,r],i)=>{let a=e.kind===`direct`?t.find(e=>e.seatIndex===i):i===0?w:void 0,s=e.kind===`standard`&&i>0?d.get(i-1):void 0,c=s&&w?`${w.mission.missionId}:${s.id}`:a?.mission.missionId,l=c?o[c]:void 0,u=s&&w?Bt(w.mission,s,l):a?Bt(a.mission,void 0,l):void 0,f=e.kind===`direct`&&a&&!D(a);return(0,b.jsx)(`g`,{"data-filter-match":f?`false`:a?`true`:void 0,opacity:f?.2:1,style:{transition:`opacity 180ms ease`},children:(0,b.jsx)(Gt,{x:e.x+n,y:e.y+r,role:e.kind===`direct`?`direct`:i===0?`manager`:`worker`,occupied:!!(e.kind===`direct`?a:i===0?w:s),visualState:u?.state,monitor:u?.monitor??`vacant`,transition:l})},i)})]}),u&&(0,b.jsxs)(b.Fragment,{children:[e.kind===`direct`&&t.map(t=>{let[n,i]=C[t.seatIndex],s=D(t);return(0,b.jsx)(`g`,{"data-filter-match":String(s),opacity:s?1:.2,style:{transition:`opacity 180ms ease`},children:(0,b.jsx)(bn,{identity:t.mission.missionId,x:e.x+n+.36,y:e.y+i+.72,role:`direct`,provider:t.mission.mission.provider,state:Nt(t.mission),needsAttention:r.has(t.mission.missionId),activeMotion:a.has(t.mission.missionId),transition:o[t.mission.missionId]})},t.mission.missionId)}),e.kind===`direct`&&l&&t.map(t=>{if(t.mission.missionId!==l.id)return null;let[n,r]=C[t.seatIndex];return(0,b.jsx)(xn,{x:e.x+n+.36,y:e.y+r+.72,text:rn(`direct`,t.mission.missionId,t.mission.missionId)},`speech:${t.mission.missionId}`)}),e.kind===`direct`&&t.map(t=>{if(l?.id===t.mission.missionId||o[t.mission.missionId]!==`arrived`)return null;let[n,r]=C[t.seatIndex];return(0,b.jsx)(xn,{x:e.x+n+.36,y:e.y+r+.72,text:rn(`direct`,t.mission.missionId,t.mission.missionId)},`arrived:${t.mission.missionId}`)}),e.kind===`direct`&&t.map(t=>{let n=o[t.mission.missionId];if(!D(t)||l?.id===t.mission.missionId||n===`arrived`||n===`room-activate`||n===`desk-reserved`||n===`entering`||n===`exiting`)return null;let[r,i]=C[t.seatIndex];return _(g(t.mission.missionId),e.x+r+.36,e.y+i+.72)}),e.kind===`standard`&&w&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(bn,{identity:w.mission.missionId,x:e.x+C[0][0]+.36,y:e.y+C[0][1]+.78,role:`manager`,provider:w.mission.mission.provider,state:Nt(w.mission),needsAttention:r.has(w.mission.missionId),activeMotion:a.has(w.mission.missionId),reviewing:w.mission.activityStatus===`idle`&&w.mission.workers.some(e=>!jt(e)),transition:o[w.mission.missionId],route:A,interaction:y?`receiving-report`:void 0,interactionTarget:O}),[...d.entries()].map(([t,n])=>{let r=`${w.mission.missionId}:${n.id}`,i=o[r],s=y?.[1].id===n.id,c=i===`exiting`,l=i===`arrived`||i===`working`?`working`:Mt(n,w.mission);return(0,b.jsx)(bn,{identity:r,x:e.x+C[t+1][0]+.36,y:e.y+C[t+1][1]+.72,role:`worker`,provider:w.mission.mission.provider,state:l,activeMotion:a.has(r)||l===`working`,transition:i,route:A,interaction:s?`reporting`:void 0,interactionTarget:s||c?S:void 0},n.id)}),y&&S&&O&&(()=>{let e=V(S.x,S.y,34);return(0,b.jsxs)(`g`,{className:`office-handoff-document`,"aria-hidden":`true`,children:[(0,b.jsx)(`rect`,{x:e.x+8,y:e.y-18,width:`12`,height:`15`,rx:`1.5`,fill:`#f5f1e8`,stroke:`#e6bd62`}),(0,b.jsx)(`path`,{d:`M ${e.x+11} ${e.y-13}h6M ${e.x+11} ${e.y-10}h6M ${e.x+11} ${e.y-7}h4`,stroke:`#665f51`,strokeWidth:`1`})]})})()]}),e.kind===`standard`&&w&&l?.id===w.mission.missionId&&(0,b.jsx)(xn,{x:e.x+C[0][0]+.36,y:e.y+C[0][1]+.78,text:rn(`manager`,w.mission.missionId,w.mission.missionId)}),e.kind===`standard`&&w&&o[w.mission.missionId]===`arrived`&&l?.id!==w.mission.missionId&&(0,b.jsx)(xn,{x:e.x+C[0][0]+.36,y:e.y+C[0][1]+.78,text:rn(`manager`,w.mission.missionId,w.mission.missionId),delayMs:0}),e.kind===`standard`&&w&&[...d.entries()].map(([t,n])=>{let r=`${w.mission.missionId}:${n.id}`;return o[r]===`arrived`?(0,b.jsx)(xn,{x:e.x+C[t+1][0]+.36,y:e.y+C[t+1][1]+.72,text:rn(`worker`,r,w.mission.missionId),delayMs:0},`speech:${r}`):null}),e.kind===`standard`&&w&&l?.id!==w.mission.missionId&&![`room-activate`,`desk-reserved`,`entering`,`arrived`,`moving-to-review`,`exiting`].includes(o[w.mission.missionId]??``)&&_(g(w.mission.missionId),e.x+C[0][0]+.36,e.y+C[0][1]+.78),e.kind===`standard`&&w&&[...d.entries()].map(([t,n])=>{let r=`${w.mission.missionId}:${n.id}`,i=o[r],a=g(r);if(i===`arrived`||i===`desk-reserved`||i===`entering`||a?.interaction===`reporting`&&i!==`reporting`)return null;let s=i===`reporting`&&S?S:{x:e.x+C[t+1][0]+.36,y:e.y+C[t+1][1]+.72};return _(a,s.x,s.y)}),e.kind===`large`&&t.map(t=>{let[n,i]=f[t.seatIndex],a=D(t);return(0,b.jsx)(`g`,{"data-filter-match":String(a),opacity:a?1:.2,style:{transition:`opacity 180ms ease`},children:(0,b.jsx)(bn,{identity:t.mission.missionId,x:e.x+n+.19,y:e.y+i+.15,role:`review`,provider:t.mission.mission.provider,state:Nt(t.mission),needsAttention:r.has(t.mission.missionId),transition:o[t.mission.missionId],route:A,transferOrigin:s[t.mission.missionId]})},t.mission.missionId)}),e.kind===`large`&&t.map(t=>{if(!D(t))return null;let[n,r]=f[t.seatIndex];return _(g(t.mission.missionId),e.x+n+.19,e.y+r+.15)}),e.kind===`direct`&&t.map(t=>{let[n,r]=C[t.seatIndex],i=V(e.x+n+.36,e.y+r+.72,26);return(0,b.jsxs)(`g`,{role:`button`,tabIndex:0,"aria-label":`Open direct mission ${t.mission.name}`,onClick:e=>p(e,()=>m(t.mission.missionId)),onKeyDown:e=>p(e,()=>m(t.mission.missionId)),className:`cursor-pointer outline-none`,children:[(0,b.jsx)(`title`,{children:t.mission.name}),(0,b.jsx)(`polygon`,{"data-hit-target":`desk`,points:Wt(e.x+n,e.y+r,`direct`),fill:`transparent`,pointerEvents:`all`}),(0,b.jsx)(`circle`,{cx:i.x,cy:i.y,r:`22`,fill:`transparent`,pointerEvents:`all`})]},`target:${t.mission.missionId}`)}),e.kind===`standard`&&w&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`g`,{role:`button`,tabIndex:0,"aria-label":`Open manager for ${w.mission.name}`,onClick:e=>p(e,()=>m(w.mission.missionId)),onKeyDown:e=>p(e,()=>m(w.mission.missionId)),className:`cursor-pointer outline-none`,children:[(0,b.jsx)(`title`,{children:w.mission.name}),(0,b.jsx)(`polygon`,{"data-hit-target":`desk`,points:Wt(e.x+C[0][0],e.y+C[0][1],`manager`),fill:`transparent`,pointerEvents:`all`}),(0,b.jsx)(`circle`,{...(()=>{let t=V(e.x+C[0][0]+.36,e.y+C[0][1]+.78,26);return{cx:t.x,cy:t.y}})(),r:`24`,fill:`transparent`,pointerEvents:`all`})]}),[...d.entries()].map(([t,n])=>{let r=V(e.x+C[t+1][0]+.36,e.y+C[t+1][1]+.72,26);return(0,b.jsxs)(`g`,{role:`button`,tabIndex:0,"aria-label":`Inspect worker ${n.label} in ${w.mission.name}`,onClick:e=>p(e,()=>h(w.mission.missionId,n.id)),onKeyDown:e=>p(e,()=>h(w.mission.missionId,n.id)),className:`cursor-pointer outline-none`,children:[(0,b.jsx)(`polygon`,{"data-hit-target":`desk`,points:Wt(e.x+C[t+1][0],e.y+C[t+1][1],`worker`),fill:`transparent`,pointerEvents:`all`}),(0,b.jsx)(`circle`,{cx:r.x,cy:r.y,r:`22`,fill:`transparent`,pointerEvents:`all`})]},`target:${n.id}`)})]}),e.kind===`large`&&t.map(t=>{let[n,r]=f[t.seatIndex],i=V(e.x+n+.19,e.y+r+.15,26);return(0,b.jsx)(`g`,{role:`button`,tabIndex:0,"aria-label":`Open review mission ${t.mission.name}`,onClick:e=>p(e,()=>m(t.mission.missionId)),onKeyDown:e=>p(e,()=>m(t.mission.missionId)),className:`cursor-pointer outline-none`,children:(0,b.jsx)(`circle`,{cx:i.x,cy:i.y,r:`22`,fill:`transparent`,pointerEvents:`all`})},`target:${t.mission.missionId}`)})]})]})}let A=u||d,j=dt({x:e.x+e.width*.76,y:e.y+e.depth-.16,width:.72,depth:.28},2),M=V(e.x+e.width/2,e.y+e.depth/2,2);return(0,b.jsxs)(`g`,{role:`button`,tabIndex:0,"data-room-atmosphere":T,"data-office-transition":w?o[w.mission.missionId]:void 0,"aria-label":`${e.label}, ${t.length?`${t.length} mission${t.length===1?``:`s`}`:`empty`}, ${O} of ${e.capacity} ${e.capacity===1?`seat`:`seats`} occupied`,"aria-pressed":u,onClick:S,onKeyDown:x,onFocus:g,onBlur:_,opacity:E,className:`office-room cursor-pointer outline-none`,children:[(0,b.jsx)(`title`,{children:`${e.label} · ${t.length?`${t.length} mission${t.length===1?``:`s`}`:`empty`} · capacity ${e.capacity}`}),(0,b.jsx)(`polygon`,{points:H(y),fill:Sn[e.kind],stroke:A||t.length?k:`#77717e`,strokeOpacity:A?`.95`:t.length?`.48`:`.24`,strokeWidth:A?2.5:t.length?1.5:1}),(0,b.jsx)(`polygon`,{points:H(y),fill:`url(#office-floor-${e.kind})`,opacity:A?`.8`:`.48`,pointerEvents:`none`}),(0,b.jsx)($t,{floor:y,doorway:j,center:M,atmosphere:T,occupied:t.length>0}),(0,b.jsx)(`polygon`,{points:H(y),fill:`none`,stroke:`#fde68a`,strokeOpacity:`0`,strokeWidth:`2`,pointerEvents:`none`,className:`office-room-hover-outline`,"data-room-hover-outline":`true`})]})}var Tn=30;function En(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Dn({start:e,end:t,height:n=Tn}){let r=[e,t,{x:t.x,y:t.y-n},{x:e.x,y:e.y-n}];return(0,b.jsx)(`polygon`,{points:H(r),fill:`#24242c`,stroke:`#696472`,strokeOpacity:`.34`,strokeWidth:`1`})}function On({start:e,end:t,opensToward:n,opening:r=[.78,.88]}){let i=En(e,t,r[0]),a=En(e,t,r[1]);return(0,b.jsxs)(`g`,{"aria-hidden":`true`,pointerEvents:`none`,"data-office-entrance":n,children:[(0,b.jsx)(Dn,{start:e,end:i}),(0,b.jsx)(Dn,{start:a,end:t}),(0,b.jsx)(`path`,{d:`M ${i.x} ${i.y}L ${a.x} ${a.y}`,stroke:`#e6bd62`,strokeOpacity:`.44`,strokeWidth:`2.5`})]})}function kn(e,t,n){return{start:V(e,t),end:V(e+n,t)}}function An(e,t,n){return{start:V(e,t),end:V(e,t+n)}}function jn({action:e,floorLabel:t,layer:n}){let r=V(11.82,2.78),i=V(12.76,2.78),a=En(r,i,.08),o=En(r,i,.5),s=En(r,i,.92),c=(e,t)=>({x:e.x,y:e.y-t}),l=dt({x:11.78,y:2.78,width:1.02,depth:.72}),u=En(r,i,.5);return n===`lobby`?(0,b.jsx)(`polygon`,{"data-office-elevator-lobby":`true`,points:H(l),fill:`#24242b`,stroke:`#d9b65d`,strokeOpacity:`.18`}):(0,b.jsxs)(`g`,{"data-office-elevator":`true`,"data-elevator-action":e,children:[(0,b.jsx)(Dn,{start:r,end:i,height:44}),(0,b.jsx)(`polygon`,{className:`office-elevator-door office-elevator-door-left`,points:H([a,o,c(o,34),c(a,34)]),fill:`#555b66`,stroke:`#c7ccd5`,strokeOpacity:`.62`}),(0,b.jsx)(`polygon`,{className:`office-elevator-door office-elevator-door-right`,points:H([o,s,c(s,34),c(o,34)]),fill:`#474c56`,stroke:`#c7ccd5`,strokeOpacity:`.62`}),(0,b.jsx)(`path`,{d:`M ${o.x} ${o.y}V ${o.y-34}`,stroke:`#15171c`,strokeWidth:`1.6`,opacity:`.9`}),(0,b.jsx)(`path`,{d:`M ${a.x} ${a.y-35}L ${s.x} ${s.y-35}`,stroke:`#d8bd78`,strokeOpacity:`.35`,strokeWidth:`2`}),(0,b.jsx)(`rect`,{x:u.x-11,y:u.y-43,width:`22`,height:`8`,rx:`2`,fill:`#101218`,stroke:`#d9b65d`,strokeOpacity:`.5`}),(0,b.jsxs)(`text`,{className:`office-elevator-indicator`,x:u.x,y:u.y-37,textAnchor:`middle`,fill:`#f2c75c`,fontSize:`6`,fontWeight:`800`,children:[`◆ `,t]}),(0,b.jsx)(`rect`,{x:s.x+5,y:s.y-24,width:`7`,height:`14`,rx:`2`,fill:`#171920`,stroke:`#aeb4c0`,strokeOpacity:`.5`}),(0,b.jsx)(`circle`,{className:`office-elevator-call`,cx:s.x+8.5,cy:s.y-19,r:`1.5`,fill:`#f2c75c`}),(0,b.jsx)(`path`,{d:`M ${s.x+6.5} ${s.y-14}h4`,stroke:`#737986`,strokeWidth:`1`}),(0,b.jsx)(`text`,{x:u.x,y:u.y-48,textAnchor:`middle`,fill:`#d8dbe2`,fillOpacity:`.52`,fontSize:`4.8`,fontWeight:`700`,letterSpacing:`1.2`,children:`ELEVATOR`})]})}function Mn({rooms:e,elevatorAction:t,floorIndex:n=0}){let r=3.5,i=6.3;return(0,b.jsxs)(`g`,{"aria-hidden":`true`,pointerEvents:`none`,children:[(0,b.jsx)(Dn,{...kn(0,0,11.9)}),(0,b.jsx)(Dn,{...kn(0,i,11.9)}),(0,b.jsx)(Dn,{...An(0,0,i)}),[...new Set(e.flatMap(e=>[e.x,e.x+e.width]).filter(t=>t>0&&t<11.9&&!(e.some(e=>e.kind===`direct`)&&t===3.5)))].map(e=>(0,b.jsxs)(`g`,{children:[(0,b.jsx)(Dn,{...An(e,0,2.8)}),(0,b.jsx)(Dn,{...An(e,r,2.8)})]},`column-${e}`)),e.some(e=>e.kind===`direct`)&&(0,b.jsx)(On,{...An(3.5,0,i),opensToward:`up`,opening:[.45,.55]}),e.filter(e=>e.kind!==`direct`&&e.y===0).map(e=>(0,b.jsx)(On,{...kn(e.x,e.y+e.depth,e.width),opensToward:`up`},`${e.id}-door`)),e.filter(e=>e.y===r).map(e=>(0,b.jsx)(On,{...kn(e.x,e.y,e.width),opensToward:`down`},`${e.id}-door`)),(0,b.jsx)(jn,{action:t,floorLabel:n>=1e3?`A${n-999}`:String(n+1).padStart(2,`0`),layer:`lobby`}),(0,b.jsxs)(`g`,{"data-office-perimeter":`right`,children:[(0,b.jsx)(Dn,{...An(11.9,0,2.8)}),(0,b.jsx)(Dn,{...An(11.9,r,2.8)})]}),(0,b.jsx)(jn,{action:t,floorLabel:n>=1e3?`A${n-999}`:String(n+1).padStart(2,`0`),layer:`cab`})]})}function Nn({floorIndex:e,placements:t,workerSeatAssignments:n,visibleMissionIds:r,attentionMissionIds:i=new Set,transitions:a,transferOrigins:o,bubbles:s,announcement:c,motion:l,active:u=!0,onOpenMission:d,onOpenWorker:f,onOpenDirectStudio:p}){let[m,h]=(0,g.useState)(null),[_,v]=(0,g.useState)(null),y=bt(e),x=yt(y);(0,g.useEffect)(()=>{h(null),v(null)},[e]);let S=x.find(e=>e.id===m),C=dt({x:-.45,y:-.95,width:13.55,depth:8.2}),w=dt(y===`headquarters`?{x:3.35,y:2.82,width:9.45,depth:.66}:{x:-.15,y:2.82,width:12.95,depth:.66}),T=V(12.7,7.08),E=e=>t.filter(t=>t.spaceId===e),D=e=>{let t=x.find(t=>t.id===e),n=E(e);if(!t||n.length===0){h(null);return}if(t.kind===`direct`){p();return}if(t.kind===`standard`||n.length===1){d(n[0].mission.missionId);return}h(t=>t===e?null:e)},O=S?E(S.id):[],k=S?.kind===`standard`&&O[0]?Math.min(S.capacity,1+O[0].mission.workers.filter(jt).length):O.length,A=new Set(t.map(e=>e.spaceId)).size,j=It(t),M=Object.values(a).find(e=>e===`entering`||e===`exiting`||e===`accepted-completion`||e===`moving-to-review`),N=()=>{h(null),v(null),document.activeElement?.blur?.()};(0,g.useEffect)(()=>{if(typeof performance>`u`||typeof requestAnimationFrame>`u`)return;let t=`hive-office-floor-${e}`;performance.mark(`${t}:commit`);let n=requestAnimationFrame(()=>{performance.mark(`${t}:paint`),performance.measure(`hive-office-render`,`${t}:commit`,`${t}:paint`),performance.clearMarks(`${t}:commit`),performance.clearMarks(`${t}:paint`)});return()=>cancelAnimationFrame(n)},[e,t.length]);let P=x.map(e=>{let t=E(e.id);return{room:e,occupants:t,seatCount:e.kind===`standard`&&t[0]?Math.min(e.capacity,1+t[0].mission.workers.filter(jt).length):t.length}});return(0,b.jsxs)(`div`,{"data-office-motion":l,"data-office-active":u?`true`:`false`,"data-office-room-count":x.length,"data-office-mission-count":t.length,className:`overflow-hidden rounded-2xl border border-white/[0.08] bg-[radial-gradient(circle_at_48%_30%,rgba(245,190,76,0.07),transparent_40%),#0b0b0e]`,children:[(0,b.jsxs)(`div`,{className:`flex min-h-[58px] flex-wrap items-center justify-between gap-3 border-b border-white/[0.06] px-4 py-2.5`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-[10px] font-medium uppercase tracking-[0.2em] text-amber-200/40`,children:xt(e)}),(0,b.jsxs)(`p`,{className:`mt-0.5 text-xs text-white/30`,children:[A,`/`,x.length,` spaces active · `,t.length,` mission`,t.length===1?``:`s`,` placed`]})]}),S?(0,b.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-white/[0.07] bg-white/[0.025] px-3 py-2 text-right`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-[9px] font-semibold text-white/65`,children:S.label}),(0,b.jsxs)(`p`,{className:`mt-0.5 text-[8px] text-white/28`,children:[S.kind===`large`?`Review`:`Direct`,` · `,k,`/`,S.capacity,` occupied`]})]}),(0,b.jsx)(`span`,{className:`rounded-full border border-white/[0.07] px-2 py-1 text-[8px] uppercase tracking-wider text-white/28`,children:`Choose an occupant`})]}):(0,b.jsx)(`p`,{className:`text-[10px] text-white/22`,children:`Click an occupied room, manager, or worker to inspect it`})]}),(0,b.jsx)(`div`,{className:`grid gap-2 p-3 sm:hidden`,"aria-label":`${xt(e)} room directory`,children:P.map(({room:e,occupants:t,seatCount:n})=>(0,b.jsxs)(`button`,{type:`button`,disabled:!t.length,onClick:()=>D(e.id),className:`flex items-center justify-between gap-3 rounded-xl border border-white/[0.08] bg-white/[0.025] px-3 py-3 text-left enabled:hover:border-amber-300/25 disabled:cursor-default disabled:opacity-45`,children:[(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`span`,{className:`block text-xs font-medium text-white/70`,children:e.label}),(0,b.jsx)(`span`,{className:`mt-1 block text-[10px] text-white/35`,children:t.length?t.map(e=>e.mission.name).join(`, `):`Vacant`})]}),(0,b.jsxs)(`span`,{className:`shrink-0 rounded-full border border-white/[0.08] px-2 py-1 text-[9px] text-white/40`,children:[n,`/`,e.capacity]})]},e.id))}),(0,b.jsx)(`div`,{"data-testid":`office-canvas`,className:`relative hidden min-h-[560px] sm:block lg:min-h-[640px]`,onClick:N,children:(0,b.jsxs)(`svg`,{viewBox:`0 0 1100 620`,className:`absolute inset-0 h-full w-full`,role:`img`,"aria-labelledby":`office-floor-title office-floor-description`,preserveAspectRatio:`xMidYMid meet`,children:[(0,b.jsx)(`title`,{id:`office-floor-title`,children:`Hive visual office floor`}),(0,b.jsxs)(`desc`,{id:`office-floor-description`,children:[`An elevated overhead `,y===`operations`?`operations floor with six orchestration rooms`:`headquarters with a shared direct studio, three orchestration rooms, and a review hall`,`. Use Tab to focus rooms and Enter to select one.`]}),(0,b.jsxs)(`defs`,{children:[(0,b.jsx)(`filter`,{id:`office-shadow`,x:`-30%`,y:`-30%`,width:`160%`,height:`180%`,children:(0,b.jsx)(`feDropShadow`,{dx:`0`,dy:`14`,stdDeviation:`14`,floodColor:`#000`,floodOpacity:`.6`})}),(0,b.jsx)(`pattern`,{id:`office-grid`,width:`28`,height:`16`,patternUnits:`userSpaceOnUse`,children:(0,b.jsx)(`path`,{d:`M0 8 14 0l14 8-14 8z`,fill:`none`,stroke:`#f1c15a`,strokeOpacity:`.03`})}),(0,b.jsx)(`pattern`,{id:`office-floor-direct`,width:`22`,height:`22`,patternUnits:`userSpaceOnUse`,children:(0,b.jsx)(`path`,{d:`M0 11h22M11 0v22`,stroke:`#55c7b3`,strokeOpacity:`.055`})}),(0,b.jsxs)(`pattern`,{id:`office-floor-standard`,width:`18`,height:`18`,patternUnits:`userSpaceOnUse`,children:[(0,b.jsx)(`circle`,{cx:`9`,cy:`9`,r:`1.2`,fill:`#a78bfa`,fillOpacity:`.09`}),(0,b.jsx)(`path`,{d:`M0 0h18v18H0z`,fill:`none`,stroke:`#a78bfa`,strokeOpacity:`.035`})]}),(0,b.jsx)(`pattern`,{id:`office-floor-large`,width:`24`,height:`14`,patternUnits:`userSpaceOnUse`,children:(0,b.jsx)(`path`,{d:`M0 7 12 0l12 7-12 7z`,fill:`none`,stroke:`#e6bd62`,strokeOpacity:`.07`})})]}),(0,b.jsx)(`rect`,{"data-testid":`office-background`,width:`1100`,height:`600`,fill:`url(#office-grid)`,onClick:N}),(0,b.jsxs)(`g`,{transform:`translate(42 -24) scale(1.16)`,filter:`url(#office-shadow)`,children:[(0,b.jsx)(`polygon`,{points:H(C),fill:`#101015`,stroke:`#d6b464`,strokeOpacity:`.16`,strokeWidth:`2`}),(0,b.jsx)(`polygon`,{points:H(w),fill:`#28252a`,stroke:`#e8be62`,strokeOpacity:`.16`}),x.map(e=>{let t=E(e.id),i=t.length>0&&!t.some(e=>r.has(e.mission.missionId));return(0,b.jsx)(wn,{room:e,occupants:t,visibleMissionIds:r,workerSeatAssignments:n,transitions:a,selected:m===e.id,focused:_===e.id,dimmed:i||m!==null&&m!==e.id&&_!==e.id,onSelect:()=>D(e.id),onOpenMission:d,onOpenWorker:f,onFocus:()=>v(e.id),onBlur:()=>v(null),layer:`floor`},`${e.id}-floor`)}),(0,b.jsx)(Mn,{rooms:x,elevatorAction:M,floorIndex:e}),x.map(e=>{let t=E(e.id),i=t.length>0&&!t.some(e=>r.has(e.mission.missionId));return(0,b.jsx)(wn,{room:e,occupants:t,visibleMissionIds:r,workerSeatAssignments:n,transitions:a,selected:m===e.id,focused:_===e.id,dimmed:i||m!==null&&m!==e.id&&_!==e.id,onSelect:()=>D(e.id),onOpenMission:d,onOpenWorker:f,onFocus:()=>void 0,onBlur:()=>void 0,layer:`furniture`},`${e.id}-furniture`)}),x.map(e=>{let t=E(e.id),i=t.length>0&&!t.some(e=>r.has(e.mission.missionId));return(0,b.jsx)(wn,{room:e,occupants:t,visibleMissionIds:r,workerSeatAssignments:n,transitions:a,selected:m===e.id,focused:_===e.id,dimmed:i||m!==null&&m!==e.id&&_!==e.id,onSelect:()=>void 0,onOpenMission:d,onOpenWorker:f,onFocus:()=>void 0,onBlur:()=>void 0,layer:`plaque`},`${e.id}-plaque`)}),x.map(e=>{let t=E(e.id),l=t.length>0&&!t.some(e=>r.has(e.mission.missionId));return(0,b.jsx)(wn,{room:e,occupants:t,visibleMissionIds:r,attentionMissionIds:i,workerSeatAssignments:n,animatedActors:j,transitions:a,transferOrigins:o,bubbles:s,announcement:c,selected:m===e.id,focused:_===e.id,dimmed:l||m!==null&&m!==e.id&&_!==e.id,onSelect:()=>D(e.id),onOpenMission:e.kind===`direct`?e=>p(e):d,onOpenWorker:f,onFocus:()=>void 0,onBlur:()=>void 0,layer:`people`},`${e.id}-people`)}),(0,b.jsxs)(`text`,{x:T.x,y:T.y,textAnchor:`end`,transform:`rotate(6.88 ${T.x} ${T.y})`,fill:`#e6bd62`,fillOpacity:`.58`,fontFamily:`ui-monospace, monospace`,fontSize:`6.2`,fontWeight:`700`,letterSpacing:`1.2`,pointerEvents:`none`,children:[`HIVE · `,xt(e).toUpperCase()]})]})]})}),(0,b.jsx)(`ul`,{className:`sr-only`,"aria-label":`${xt(e)} room summaries`,children:P.map(({room:e,occupants:t,seatCount:n})=>(0,b.jsxs)(`li`,{children:[e.label,`: `,t.length?t.map(e=>e.mission.name).join(`, `):`vacant`,`; `,n,` of `,e.capacity,` seats occupied.`]},e.id))}),S&&O.length>1&&(0,b.jsx)(`div`,{className:`border-t border-white/[0.06] px-4 py-3`,children:(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`p`,{className:`mr-1 text-[9px] font-semibold uppercase tracking-wider text-white/25`,children:`Choose an occupant`}),O.map(e=>(0,b.jsxs)(`button`,{type:`button`,onClick:()=>d(e.mission.missionId),className:`rounded-lg border border-white/[0.08] bg-white/[0.025] px-3 py-2 text-left transition hover:border-amber-300/25 hover:bg-amber-300/[0.04]`,children:[(0,b.jsx)(`span`,{className:`block max-w-48 truncate text-[10px] font-medium text-white/65`,children:e.mission.name}),(0,b.jsxs)(`span`,{className:`mt-0.5 block text-[8px] uppercase tracking-wider text-white/25`,children:[e.mission.lifecycleStatus===`ready_for_review`?`Awaiting acceptance`:e.mission.activityStatus.replaceAll(`_`,` `),` · Open room`]})]},e.mission.missionId))]})})]})}var Pn=Array.from({length:8},(e,t)=>({id:`direct-studio:${t}`,spaceId:`direct-studio`,seatIndex:t,kind:`direct`})),Fn=[`standard-a`,`standard-b`,`standard-c`].map(e=>({id:e,spaceId:e,seatIndex:0,kind:`orchestrated`})),In=[`standard-a`,`standard-b`,`standard-c`,`standard-d`,`standard-e`,`standard-f`].map(e=>({id:e,spaceId:e,seatIndex:0,kind:`orchestrated`})),Ln=Array.from({length:10},(e,t)=>({id:`review:${t}`,spaceId:`review`,seatIndex:t,kind:`review`})),Rn=[...Pn,...In,...Ln];function zn(e){return(e===0?[...Pn,...Fn,...Ln]:e>=1e3?[...Pn,...Ln]:In).map(t=>({...t,id:`floor:${e}:${t.id}`,floorIndex:e}))}zn(0);function Bn(e){let t=/^floor:(\d+):(.+)$/.exec(e),n=t?Number(t[1]):0,r=t?.[2]??e,i=Rn.find(e=>e.id===r);return i&&Number.isSafeInteger(n)&&n>=0&&zn(n).some(e=>e.id.endsWith(`:${i.id}`))?{...i,id:`floor:${n}:${i.id}`,floorIndex:n}:void 0}function Vn(e){return e.lifecycleStatus===`completed`||e.lifecycleStatus===`archived`?null:e.lifecycleStatus===`ready_for_review`?`review`:e.mission.mode===`direct`?`direct`:`orchestrated`}function Hn(e,t){let n=e.filter(e=>Vn(e)!==null),r=new Map(n.map(e=>[e.missionId,e])),i={},a=new Set;for(let[e,n]of Object.entries(t)){let t=r.get(e),o=Bn(n);!t||!o||o.kind!==Vn(t)||a.has(o.id)||(i[e]=o.id,a.add(o.id))}let o=[...n].sort((e,t)=>e.createdAt-t.createdAt||e.missionId.localeCompare(t.missionId));for(let e of o){if(i[e.missionId])continue;let n=Vn(e);if(!n)continue;let r=Bn(t[e.missionId]??``)?.floorIndex,o=n===`orchestrated`?function*(){yield 0;for(let e=1;;e+=1)yield e}():function*(){yield 0;for(let e=1e3;;e+=1)yield e}(),s=r===void 0?o:function*(){yield r;for(let e of o)e!==r&&(yield e)}(),c;for(let e of s)if(c=zn(e).find(e=>e.kind===n&&!a.has(e.id)),c)break;c&&(i[e.missionId]=c.id,a.add(c.id))}return{assignments:i,placements:Object.entries(i).flatMap(([e,t])=>{let n=r.get(e),i=Bn(t);return n&&i?[{mission:n,slotId:t,spaceId:i.spaceId,seatIndex:i.seatIndex,kind:i.kind,floorIndex:i.floorIndex}]:[]}),unplaced:n.filter(e=>!i[e.missionId])}}function Un(e,t){let n=Object.entries(e),r=Object.entries(t);return n.length===r.length&&n.every(([e,n])=>t[e]===n)}var Wn=5200,Gn=5200,Kn=new Set([`done`,`completed`,`stopped`,`failed`,`error`,`cancelled`,`canceled`]);function qn(e){return!!e.doneAt||Kn.has(e.jobState.toLowerCase())}function Jn(e){let t=new Map;for(let n of e)for(let e of n.workers)t.set(`${n.missionId}:${e.id}`,{mission:n,worker:e});return t}function Yn(e,t,n,r){let i=`${e}:${t}`;return[{id:`${n}:desk`,targetId:i,missionId:e,workerId:t,action:`desk-reserved`,startsAt:r,duration:720},{id:`${n}:enter`,targetId:i,missionId:e,workerId:t,action:`entering`,startsAt:r+180,duration:Wn},{id:`${n}:arrive`,targetId:i,missionId:e,workerId:t,action:`arrived`,startsAt:r+180+Wn,duration:2e3}]}function Xn(e,t,n,r){let i=`${e}:${t}`;return[{id:`${n}:report`,targetId:i,missionId:e,workerId:t,action:`reporting`,startsAt:r,duration:Gn},{id:`${n}:exit`,targetId:i,missionId:e,workerId:t,action:`exiting`,startsAt:r+Gn,duration:Wn}]}function Zn(e,t,n){let r=new Map(e.map(e=>[e.missionId,e])),i=new Map(t.map(e=>[e.missionId,e])),a=[],o=(e,t,r,i,o=0,s=720)=>a.push({id:`${t}:${r}:${n}`,targetId:t,missionId:e,workerId:i,action:r,startsAt:n+o,duration:s});for(let e of t){let t=r.get(e.missionId);if(!t){o(e.missionId,e.missionId,`room-activate`),o(e.missionId,e.missionId,`entering`,void 0,180,Wn),o(e.missionId,e.missionId,`arrived`,void 0,5380,2e3);continue}if(t.lifecycleStatus!==e.lifecycleStatus)e.lifecycleStatus===`paused`?o(e.missionId,e.missionId,`paused`):t.lifecycleStatus===`paused`&&e.lifecycleStatus===`active`?o(e.missionId,e.missionId,`resumed`):e.lifecycleStatus===`ready_for_review`?o(e.missionId,e.missionId,e.mission.mode===`orchestrated`?`moving-to-review`:`awaiting-acceptance`,void 0,0,e.mission.mode===`orchestrated`?Wn:720):(e.lifecycleStatus===`completed`||e.lifecycleStatus===`archived`)&&o(e.missionId,e.missionId,`accepted-completion`);else if(t.activityStatus!==e.activityStatus){let t=e.activityStatus===`working`?`working`:e.activityStatus===`waiting_on_you`?`waiting`:e.activityStatus===`stalled`?`blocked`:e.activityStatus===`error`?`failed`:`waiting`;o(e.missionId,e.missionId,t)}}for(let t of e)i.has(t.missionId)||o(t.missionId,t.missionId,`accepted-completion`,void 0,0,Wn);let s=Jn(e),c=Jn(t);for(let[e,t]of c){let n=s.get(e);n?!qn(n.worker)&&qn(t.worker)&&(o(t.mission.missionId,e,`reporting`,t.worker.id,0,Gn),o(t.mission.missionId,e,`exiting`,t.worker.id,Gn,Wn)):(o(t.mission.missionId,e,`desk-reserved`,t.worker.id),o(t.mission.missionId,e,`entering`,t.worker.id,180,Wn),o(t.mission.missionId,e,`arrived`,t.worker.id,5380,2e3),qn(t.worker)&&(o(t.mission.missionId,e,`reporting`,t.worker.id,7380,Gn),o(t.mission.missionId,e,`exiting`,t.worker.id,12580,Wn)))}for(let[e,t]of s)c.has(e)||qn(t.worker)||(o(t.mission.missionId,e,`reporting`,t.worker.id,0,Gn),o(t.mission.missionId,e,`exiting`,t.worker.id,Gn,Wn));return a}function Qn(e,t,n){let r=e.filter(e=>e.startsAt+e.duration>n),i=new Set(r.map(e=>e.id)),a=new Set(r.map(e=>`${e.targetId}:${e.action}`)),o=t.filter(e=>!i.has(e.id)&&!a.has(`${e.targetId}:${e.action}`)),s=Math.max(n,...r.map(e=>e.startsAt+e.duration)),c=new Map;for(let e of o)c.set(e.targetId,[...c.get(e.targetId)??[],e]);let l=[...c.values()].sort((e,t)=>Math.min(...e.map(e=>e.startsAt))-Math.min(...t.map(e=>e.startsAt))||e[0].id.localeCompare(t[0].id)).flatMap(e=>{let t=Math.min(...e.map(e=>e.startsAt)),n=Math.max(0,s-t),r=n?e.map(e=>({...e,startsAt:e.startsAt+n})):e;return s=Math.max(...r.map(e=>e.startsAt+e.duration)),r});return[...r,...l].slice(0,96)}function $n(e,t){let n={};for(let r of e)r.startsAt<=t&&r.startsAt+r.duration>t&&(n[r.targetId]=r.action);return n}var er=typeof window>`u`?g.useEffect:g.useLayoutEffect,tr=3e4,nr=15e3,rr=new Set([`room-activate`,`desk-reserved`,`entering`,`arrived`]);function ir(e,t,n,r,i=0,a=!1){let o=(0,g.useMemo)(()=>e.map(e=>e.mission),[e]),s=(0,g.useRef)(),c=(0,g.useRef)([]),[l,u]=(0,g.useState)([]),[d,f]=(0,g.useState)(()=>Date.now()),[p,m]=(0,g.useState)([]),[h,_]=(0,g.useState)({}),v=(0,g.useRef)({}),[y,b]=(0,g.useState)({}),x=(0,g.useRef)(new Map),S=(0,g.useRef)(new Set),C=(0,g.useRef)(new Map),w=(0,g.useRef)(new Set),[T,E]=(0,g.useState)({}),[D,O]=(0,g.useState)(()=>typeof window<`u`&&window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches);(0,g.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>O(e.matches);return t(),e.addEventListener?.(`change`,t),()=>e.removeEventListener?.(`change`,t)},[]);let k=r===`full`||r===`system`&&!D;return er(()=>{if(a){s.current||(s.current=o,c.current=e);return}let n=Date.now();if(!s.current||!k){m([]),v.current={},_({}),b({}),x.current.clear(),E({}),w.current.clear(),S.current=new Set(o.flatMap(e=>e.recentEvents.map(e=>`${e.sessionId}:${e.jobId??``}:${e.ts}:${e.hookEventName??``}:${e.toolName??``}:${e.targetWorker??``}`))),C.current.clear();for(let e of o)for(let t of e.workers)C.current.set(`${e.missionId}:${t.id}`,{missionId:e.missionId,workerId:t.id,launched:!0,stopped:!!t.doneAt,completionQueued:!!t.doneAt,exited:!!t.doneAt});if(!k)u([]);else{let r=new Map(e.map(e=>[e.mission.missionId,e.floorIndex])),a=new Map;for(let e of o)if(r.get(e.missionId)===i){for(let t of e.workers){if(n-t.startedAt>nr)continue;let r=`${e.missionId}:${t.id}`;a.set(r,{missionId:e.missionId,workerId:t.id,started:!0,stopped:!!t.doneAt})}for(let t of e.recentEvents){if(!t.targetWorker||t.targetWorker===`hive-orchestrator`||n-t.ts>nr)continue;let r=t.hookEventName===`SubagentStart`||t.hookEventName===`PostToolUse`&&t.toolName===`Agent`,i=t.hookEventName===`SubagentStop`;if(!r&&!i)continue;let o=`${e.missionId}:${t.targetWorker}`,s=a.get(o)??{missionId:e.missionId,workerId:t.targetWorker,started:!1,stopped:!1};r&&(s.started=!0),i&&(s.stopped=!0),a.set(o,s)}}let s=[],c={};for(let[e,r]of a){if(!r.started)continue;s=Qn(s,Yn(r.missionId,r.workerId,`worker:${e}:hydrate`,n),n),r.stopped&&(s=Qn(s,Xn(r.missionId,r.workerId,`worker:${e}:hydrate-complete`,n),n)),C.current.set(e,{missionId:r.missionId,workerId:r.workerId,launched:!0,stopped:r.stopped,completionQueued:r.stopped,exited:!1});let i=new Set([...Object.entries(t),...Object.entries(c)].filter(([t])=>t.startsWith(`${r.missionId}:`)&&t!==e).map(([,e])=>e)),a=t[e]??Array.from({length:4},(e,t)=>t).find(e=>!i.has(e));a!==void 0&&(c[e]=a)}v.current=c,_(c),u(s)}}else{let r=e=>e.map(e=>({...e,workers:[],activityStatus:`idle`})),a=Zn(r(s.current),r(o),n),l=Zn(s.current,o,n).filter(e=>e.workerId&&(e.action===`desk-reserved`||e.action===`entering`||e.action===`arrived`||e.action===`reporting`||e.action===`exiting`)),d=new Set(s.current.map(e=>e.missionId)),f=a.filter(e=>!d.has(e.missionId)),p=a.filter(e=>d.has(e.missionId)&&[`moving-to-review`,`awaiting-acceptance`,`accepted-completion`,`paused`,`resumed`].includes(e.action)),h=new Map(e.map(e=>[e.mission.missionId,e.floorIndex])),g=o.flatMap(e=>e.recentEvents.map(t=>({mission:e,event:t}))).filter(({mission:e})=>h.get(e.missionId)===i).filter(({event:e})=>e.targetWorker&&e.targetWorker!==`hive-orchestrator`&&(e.hookEventName===`SubagentStart`||e.hookEventName===`SubagentStop`||e.hookEventName===`PostToolUse`&&e.toolName===`Agent`)).sort((e,t)=>e.event.ts-t.event.ts).filter(({event:e})=>{let t=`${e.sessionId}:${e.jobId??``}:${e.ts}:${e.hookEventName??``}:${e.toolName??``}:${e.targetWorker??``}`;return!S.current.has(t)&&(S.current.add(t),!0)}),y=[...f,...p],w=new Map(c.current.map(e=>[e.mission.missionId,e])),T=[];for(let e of y){let t=h.get(e.missionId),r=w.get(e.missionId)?.floorIndex;if(e.action===`moving-to-review`&&t!==void 0&&r!==void 0&&t!==r){if(i===r&&T.push({...e,id:`${e.id}:source`}),i===t)T.push({...e,id:`${e.id}:destination`});else{let r=x.current.get(t)??{queuedAt:n,transitions:[]};r.transitions=[...r.transitions,{...e,id:`${e.id}:destination`}].slice(-32),x.current.set(t,r)}continue}if(t!==void 0&&t!==i&&rr.has(e.action)){let r=x.current.get(t)??{queuedAt:n,transitions:[]};r.transitions=[...r.transitions,e].slice(-32),x.current.set(t,r)}else T.push(e)}let D=x.current.get(i);if(D&&(x.current.delete(i),n-D.queuedAt<=tr)){let e=Math.min(...D.transitions.map(e=>e.startsAt));T.push(...D.transitions.map(t=>({...t,startsAt:n+t.startsAt-e})))}for(let[e,t]of x.current)n-t.queuedAt>tr&&x.current.delete(e);E(Object.fromEntries([...x.current].map(([e,t])=>[e,new Set(t.transitions.map(e=>e.targetId)).size])));let O=f.filter(e=>h.get(e.missionId)===i),k=l.filter(e=>h.get(e.missionId)===i),A=T.filter(e=>p.some(t=>t.missionId===e.missionId&&t.action===e.action));u(e=>{let t=Qn(e,[...O,...k],n);for(let e of k)!e.workerId||C.current.has(e.targetId)||C.current.set(e.targetId,{missionId:e.missionId,workerId:e.workerId,launched:!0,stopped:!1,completionQueued:!1,exited:!1});let r=(e,r)=>{r.completionQueued||r.exited||(t=Qn(t,Xn(r.missionId,r.workerId,`worker:${e}:complete`,n),n),r.completionQueued=!0)};for(let{mission:e,event:i}of g){let a=i.targetWorker,o=`${e.missionId}:${a}`,s=C.current.get(o)??{missionId:e.missionId,workerId:a,launched:!1,stopped:!1,completionQueued:!1,exited:!1};if(i.hookEventName===`SubagentStart`||i.hookEventName===`PostToolUse`&&i.toolName===`Agent`){if(s.launched)s.exited||s.completionQueued?(t=Qn(t,Yn(e.missionId,a,`worker:${i.jobId??i.sessionId}:${a}:reenter:${i.ts}`,n),n),s.stopped=!1,s.completionQueued=!1,s.exited=!1):s.stopped&&=!1;else{for(let[t,n]of C.current)n.missionId===e.missionId&&t!==o&&n.stopped&&r(t,n);t=Qn(t,Yn(e.missionId,a,`worker:${i.jobId??i.sessionId}:${a}:launch`,n),n),s.launched=!0,s.exited=!1}}else i.hookEventName===`SubagentStop`&&s.launched&&(s.stopped=!0,r(o,s));C.current.set(o,s)}let a=new Set(A.filter(e=>e.action===`moving-to-review`||e.action===`awaiting-acceptance`).map(e=>e.missionId)),c=new Map(s.current.map(e=>[e.missionId,e])),l=new Set(o.filter(e=>h.get(e.missionId)===i&&e.turnCompleted&&!c.get(e.missionId)?.turnCompleted).map(e=>e.missionId));for(let[e,t]of C.current)(a.has(t.missionId)||l.has(t.missionId))&&t.stopped&&r(e,t);return Qn(t,A,n)});let j=new Set(e.map(e=>e.mission.missionId)),M=c.current.filter(e=>!j.has(e.mission.missionId)),N=c.current.filter(t=>e.some(e=>e.mission.missionId===t.mission.missionId&&e.floorIndex!==t.floorIndex));m(t=>{let n=new Set(e.map(e=>e.slotId)),r=t.filter(e=>!n.has(e.slotId)),i=new Set(r.map(e=>e.slotId));return[...r,...[...M,...N].filter(e=>!i.has(e.slotId))]});let P=new Map(c.current.map(e=>[e.mission.missionId,e])),F=[];for(let t of e){let e=P.get(t.mission.missionId);if(t.kind!==`review`||e?.kind!==`orchestrated`)continue;let n=yt(bt(e.floorIndex)).find(t=>t.id===e.spaceId);if(!n)continue;if(e.floorIndex!==t.floorIndex){F.push([t.mission.missionId,{position:{x:12.28,y:2.9},doorway:{x:11.9,y:3.18},inside:{x:12.28,y:3.18}}]);continue}let r=n.x+n.width*.83;F.push([t.mission.missionId,{position:{x:n.x+.94,y:n.y+1.6},doorway:{x:r,y:3.15},inside:{x:r,y:n.y===0?2.55:3.75}}])}F.length&&b(e=>({...e,...Object.fromEntries(F)}));let I={},ee=new Set(g.map(({mission:e,event:t})=>`${e.missionId}:${t.targetWorker}`));for(let e of ee){if(v.current[e]!==void 0)continue;let n=e.slice(0,e.lastIndexOf(`:`)),r=new Set([...Object.entries(t),...Object.entries(v.current),...Object.entries(I)].filter(([t])=>t!==e&&t.startsWith(`${n}:`)).map(([,e])=>e)),i=t[e],a=i!==void 0&&!r.has(i)?i:Array.from({length:4},(e,t)=>t).find(e=>!r.has(e));a!==void 0&&(I[e]=a)}Object.keys(I).length&&(v.current={...v.current,...I},_(v.current))}s.current=o,c.current=e,f(n)},[k,n,o,e,i,a,t]),(0,g.useEffect)(()=>{if(!Object.keys(T).length)return;let e=Math.min(...[...x.current.values()].map(e=>e.queuedAt+tr)),t=window.setTimeout(()=>{let e=Date.now();for(let[t,n]of x.current)e-n.queuedAt>=tr&&x.current.delete(t);E(Object.fromEntries([...x.current].map(([e,t])=>[e,new Set(t.transitions.map(e=>e.targetId)).size])))},Math.max(16,e-Date.now()+8));return()=>window.clearTimeout(t)},[T]),(0,g.useEffect)(()=>{if(!l.length)return;let e=Math.min(...l.map(e=>e.startsAt>d?e.startsAt:e.startsAt+e.duration)),t=window.setTimeout(()=>{let e=Date.now();f(e),u(t=>{let n=t.filter(t=>t.action===`arrived`&&t.startsAt+t.duration<=e).map(e=>e.targetId);for(let e of n)w.current.add(e);let r=t.filter(t=>t.workerId&&t.action===`exiting`&&t.startsAt+t.duration<=e).map(e=>e.targetId);if(r.length){let n={...v.current};for(let i of r){let r=t.some(t=>t.targetId===i&&t.action===`entering`&&t.startsAt>e);r||delete n[i],w.current.delete(i);let a=C.current.get(i);a&&(a.exited=!r)}v.current=n,_(n)}let i=Qn(t,[],e);return i.length||(m([]),b({})),i})},Math.max(16,e-Date.now()+8));return()=>window.clearTimeout(t)},[d,l]),(0,g.useMemo)(()=>{let n=new Set(e.map(e=>e.mission.missionId)),r=$n(l,d);for(let e of l)!r[e.targetId]&&e.startsAt>d&&!w.current.has(e.targetId)&&(e.action===`room-activate`||e.action===`entering`)&&(r[e.targetId]=`room-activate`);for(let[e,t]of C.current)t.exited&&(r[e]=`room-activate`);for(let e of Object.keys(h))r[e]||(r[e]=w.current.has(e)?`working`:`desk-reserved`);let i=new Set(p.map(e=>e.mission.missionId)),a=e.filter(e=>!i.has(e.mission.missionId));return{transitions:r,animated:k,placements:[...a,...p.filter(t=>!n.has(t.mission.missionId)||e.some(e=>e.mission.missionId===t.mission.missionId&&e.slotId!==t.slotId))],workerSeats:{...t,...h},transferOrigins:y,pendingArrivals:T}},[k,d,T,e,l,p,h,y,t])}function ar(){let e=(0,g.useRef)(null),[t,n]=(0,g.useState)(()=>typeof document>`u`||document.visibilityState!==`hidden`),[r,i]=(0,g.useState)(!0);return(0,g.useEffect)(()=>{let e=()=>n(document.visibilityState!==`hidden`);return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),(0,g.useEffect)(()=>{let t=e.current;if(!t||typeof IntersectionObserver>`u`)return;let n=new IntersectionObserver(([e])=>i(e?.isIntersecting??!0),{rootMargin:`120px`});return n.observe(t),()=>n.disconnect()},[]),{sceneRef:e,active:t&&r}}function or({missions:e,allMissions:t,roomAssignments:n,workerSeatAssignments:r,announcement:i,onAssignmentsChange:a,connected:o,suspended:s=!1,selectedFloor:c=0,onSelectedFloorChange:l=()=>void 0,motion:u=`system`,onMotionChange:d=()=>void 0,dialogue:f=`work_personality`,onDialogueChange:p=()=>void 0,attentionMissionIds:m=new Set,onSelectMission:h,onSelectWorker:_=()=>void 0,onSelectDirectStudio:v=()=>void 0}){let y=(0,g.useMemo)(()=>Hn(t,n),[t,n]),x=(0,g.useMemo)(()=>Pt(y.placements,r),[y.placements,r]);(0,g.useEffect)(()=>{(!Un(n,y.assignments)||!Ft(r,x))&&a(y.assignments,x)},[a,y.assignments,n,r,x]);let C=(0,g.useMemo)(()=>new Set(e.map(e=>e.missionId)),[e]),w=(0,g.useMemo)(()=>[...new Set([0,c,...y.placements.map(e=>e.floorIndex)])].sort((e,t)=>e-t),[y.placements,c]),T=w.includes(c)?c:0,E=ir(y.placements,x,o,u,T,s),D=ar();(0,g.useEffect)(()=>{T!==c&&l(T)},[T,l,c]);let O=(0,g.useMemo)(()=>w.map(e=>{let t=y.placements.filter(t=>t.floorIndex===e),n=t.filter(({mission:e})=>e.lifecycleStatus===`ready_for_review`||e.activityStatus===`waiting_on_you`||e.activityStatus===`stalled`||e.activityStatus===`error`).length;return{floorIndex:e,occupied:t.length,attention:n}}),[w,y.placements]),k=E.placements.filter(e=>e.floorIndex===T),[A,j]=(0,g.useState)(()=>Date.now());(0,g.useEffect)(()=>{if(f===`off`||!D.active)return;let e=window.setInterval(()=>j(Date.now()),2e3);return()=>window.clearInterval(e)},[f,D.active]);let M=(0,g.useMemo)(()=>yn(E.placements,f,A),[f,A,E.placements]),N=y.unplaced.filter(e=>C.has(e.missionId));return(0,b.jsxs)(`section`,{ref:D.sceneRef,"aria-label":`Visual office`,className:`space-y-4`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-[10px] font-medium uppercase tracking-[0.22em] text-amber-200/40`,children:`Visual office`}),(0,b.jsx)(`h2`,{className:`mt-1 text-lg font-semibold text-white/75`,children:`Hive headquarters`}),(0,b.jsx)(`p`,{className:`mt-1 text-xs text-white/30`,children:`Live missions remain in stable desks and rooms until their lifecycle releases them.`})]}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,b.jsxs)(`div`,{className:`flex gap-2.5 text-[9px] text-white/35`,children:[(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`b`,{className:`text-[#55c7b3]`,children:`◆`}),` Direct`]}),(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`b`,{className:`text-[#a78bfa]`,children:`◆`}),` Orchestrated`]}),(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`b`,{className:`text-[#e6bd62]`,children:`◆`}),` Review`]})]}),(0,b.jsxs)(`label`,{className:`flex items-center gap-1.5 rounded-full border border-white/[0.08] bg-black/15 px-2.5 py-1 text-[9px] text-white/35`,children:[(0,b.jsx)(`span`,{children:`Talk`}),(0,b.jsxs)(`select`,{"aria-label":`Office dialogue`,value:f,onChange:e=>p(e.target.value),className:`bg-transparent text-[9px] text-white/55 outline-none`,children:[(0,b.jsx)(`option`,{value:`off`,children:`Off`}),(0,b.jsx)(`option`,{value:`work`,children:`Work only`}),(0,b.jsx)(`option`,{value:`work_personality`,children:`Work + personality`})]})]}),(0,b.jsxs)(`label`,{className:`flex items-center gap-1.5 rounded-full border border-white/[0.08] bg-black/15 px-2.5 py-1 text-[9px] text-white/35`,children:[(0,b.jsx)(`span`,{children:`Motion`}),(0,b.jsxs)(`select`,{"aria-label":`Office motion`,value:u,onChange:e=>d(e.target.value),className:`bg-transparent text-[9px] text-white/55 outline-none`,children:[(0,b.jsx)(`option`,{value:`system`,children:`System`}),(0,b.jsx)(`option`,{value:`full`,children:`On`}),(0,b.jsx)(`option`,{value:`reduced`,children:`Reduced`})]})]}),(0,b.jsx)(`span`,{className:`rounded-full border px-2.5 py-1 text-[10px] ${o?`border-emerald-300/15 bg-emerald-300/[0.05] text-emerald-200/55`:`border-orange-300/20 bg-orange-300/[0.06] text-orange-100/65`}`,children:o?`Live`:`Last durable snapshot`})]})]}),Object.keys(E.pendingArrivals).length>0&&(0,b.jsxs)(`div`,{"aria-live":`polite`,className:`flex flex-wrap items-center gap-2 rounded-xl border border-emerald-300/15 bg-emerald-300/[0.045] px-3 py-2`,children:[(0,b.jsx)(`span`,{className:`text-[10px] font-medium text-emerald-100/65`,children:`New arrival elsewhere:`}),Object.entries(E.pendingArrivals).map(([e,t])=>(0,b.jsxs)(`button`,{type:`button`,onClick:()=>l(Number(e)),className:`rounded-lg border border-emerald-200/15 bg-emerald-200/[0.06] px-2.5 py-1 text-[10px] text-emerald-100/70 transition hover:border-emerald-200/30 hover:bg-emerald-200/[0.1]`,children:[t,` new agent`,t===1?``:`s`,` in `,xt(Number(e)),` · View`]},e))]}),w.length>1&&(0,b.jsx)(`nav`,{"aria-label":`Office floors`,className:`flex gap-2 overflow-x-auto rounded-xl border border-white/[0.07] bg-black/15 p-2`,children:O.map(e=>{let t=E.pendingArrivals[e.floorIndex]??0;return(0,b.jsxs)(`button`,{type:`button`,"aria-current":T===e.floorIndex?`page`:void 0,onClick:()=>l(e.floorIndex),className:`min-w-36 rounded-lg border px-3 py-2 text-left transition ${T===e.floorIndex?`border-amber-300/25 bg-amber-300/[0.08]`:t?`animate-pulse border-emerald-300/30 bg-emerald-300/[0.07] hover:bg-emerald-300/[0.11]`:`border-white/[0.06] bg-white/[0.02] hover:border-white/15 hover:bg-white/[0.04]`}`,children:[(0,b.jsxs)(`span`,{className:`flex items-center justify-between gap-2 text-[10px] font-semibold uppercase tracking-wider text-white/65`,children:[(0,b.jsx)(`span`,{children:xt(e.floorIndex)}),t>0&&(0,b.jsx)(`span`,{className:`rounded-full bg-emerald-300/15 px-1.5 py-0.5 text-[8px] text-emerald-100/75`,children:`New`})]}),(0,b.jsxs)(`span`,{className:`mt-1 block text-[9px] text-white/28`,children:[e.occupied,` occupied`,e.attention?` · ${e.attention} attention`:``]})]},e.floorIndex)})}),(0,b.jsx)(Nn,{floorIndex:T,placements:k,workerSeatAssignments:E.workerSeats,visibleMissionIds:C,attentionMissionIds:m,transitions:E.transitions,transferOrigins:E.transferOrigins,bubbles:M,announcement:i,motion:u,active:D.active,onOpenMission:h,onOpenWorker:_,onOpenDirectStudio:v}),t.length===0?(0,b.jsxs)(`div`,{className:`rounded-xl border border-dashed border-white/8 px-4 py-5 text-center`,children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-white/45`,children:`The office is ready for its first mission`}),(0,b.jsx)(`p`,{className:`mt-1 text-[10px] text-white/25`,children:`Start a mission above and Hive will assign a compatible workspace.`})]}):e.length===0?(0,b.jsx)(`div`,{className:`rounded-xl border border-dashed border-white/8 px-4 py-5 text-center text-xs text-white/30`,children:`No missions match the current fleet filters. Existing assignments are preserved.`}):N.length>0?(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,b.jsx)(`p`,{className:`text-[10px] font-medium uppercase tracking-wider text-orange-200/45`,children:`Waiting for compatible space`}),(0,b.jsxs)(`p`,{className:`text-[10px] text-white/20`,children:[N.length,` overflow`]})]}),(0,b.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-3`,children:N.map(e=>(0,b.jsxs)(`button`,{type:`button`,onClick:()=>h(e.missionId),"aria-label":`Open ${e.name} mission`,className:`group rounded-xl border border-orange-300/[0.12] bg-orange-300/[0.025] p-3 text-left hover:border-orange-300/25`,children:[(0,b.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,b.jsx)(`h3`,{className:`truncate text-xs font-medium text-white/55 group-hover:text-white/75`,children:e.name}),(0,b.jsxs)(`div`,{className:`flex gap-1`,children:[(0,b.jsx)(Ye,{status:e.lifecycleStatus}),(0,b.jsx)(S,{status:e.activityStatus})]})]}),(0,b.jsxs)(`p`,{className:`mt-2 text-[9px] text-white/22`,children:[e.mission.mode,` · no compatible space on Floor 1`]})]},e.missionId))})]}):null]})}function sr({session:e,onHide:t}){let[n,r]=(0,g.useState)(!1),[i,a]=(0,g.useState)(null);async function o(){r(!0),a(null);try{await be(e.sessionId,e.name)}catch(e){a(e.message)}finally{r(!1)}}return(0,b.jsxs)(`div`,{className:`rounded-lg border border-white/10 bg-white/[0.02] px-4 py-3`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(Ee,{missionId:`session:${e.sessionId}`,name:e.name}),(0,b.jsx)(`p`,{className:`mono truncate text-xs text-white/30`,children:e.cwd})]}),(0,b.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,b.jsx)(S,{status:e.status}),e.jobId&&(0,b.jsx)(`button`,{disabled:n,onClick:o,className:`rounded-lg border border-violet-300/15 px-3 py-1.5 text-xs text-violet-200/60 hover:bg-violet-300/[0.06] disabled:opacity-40`,children:n?`Adopting…`:`Adopt`}),(0,b.jsx)(`button`,{onClick:t,className:`rounded-lg border border-white/8 px-3 py-1.5 text-xs text-white/35 hover:bg-white/5`,children:`Hide`}),(0,b.jsx)(Me,{pid:e.pid,status:e.status,force:!e.jobId,label:`End`})]})]}),i&&(0,b.jsx)(`p`,{className:`mt-2 text-[10px] text-rose-400`,children:i}),!e.jobId&&(0,b.jsx)(`p`,{className:`mt-2 text-[10px] text-white/20`,children:`Interactive process · no background-job identity to adopt safely`})]})}function cr({onStarted:e,onConfigure:t}){let[n,r]=(0,g.useState)(``),[i,a]=(0,g.useState)(!1),[o,s]=(0,g.useState)(null),[c,l]=(0,g.useState)([]),[u,d]=(0,g.useState)([]),[f,p]=(0,g.useState)(),[m,h]=(0,g.useState)([]),[_,v]=(0,g.useState)(()=>(typeof window>`u`?null:localStorage.getItem(`hive:quick-provider`))===`codex`?`codex`:`claude`),[y,x]=(0,g.useState)(()=>typeof window>`u`?``:localStorage.getItem(`hive:quick-model:${localStorage.getItem(`hive:quick-provider`)===`codex`?`codex`:`claude`}`)??``),[S,C]=(0,g.useState)(()=>typeof window>`u`||localStorage.getItem(`hive:quick-worktree`)!==`false`),[w,T]=(0,g.useState)(()=>typeof window>`u`?``:localStorage.getItem(`hive:last-cwd`)??``);(0,g.useEffect)(()=>{l([]),k(w||void 0,_).then(({skills:e})=>l(e)).catch(()=>l([]))},[w,_]),(0,g.useEffect)(()=>{F(w||void 0).then(p).catch(()=>p(void 0))},[w]),(0,g.useEffect)(()=>{P(``).then(({directories:e})=>h(e)).catch(()=>h([]))},[]),(0,g.useEffect)(()=>{ve().then(({providers:e})=>{if(d(e),e.find(e=>e.provider===_)?.available===!1){let t=e.find(e=>e.available);t&&E(t.provider)}else if(y&&!e.find(e=>e.provider===_)?.models.some(e=>e.id===y)){x(``);try{localStorage.removeItem(`hive:quick-model:${_}`)}catch{}}}).catch(()=>d([]))},[]);function E(e){v(e);let t=typeof window>`u`?``:localStorage.getItem(`hive:quick-model:${e}`)??``,n=u.find(t=>t.provider===e)?.models??[];x(t&&n.some(e=>e.id===t)?t:``);try{localStorage.setItem(`hive:quick-provider`,e)}catch{}}function D(e){x(e);try{localStorage.setItem(`hive:quick-model:${_}`,e)}catch{}}function A(e){C(e);try{localStorage.setItem(`hive:quick-worktree`,String(e))}catch{}}function j(e){T(e);try{localStorage.setItem(`hive:last-cwd`,e)}catch{}}function M(e){t({task:n,cwd:w||void 0,mode:e,provider:_,model:y||void 0,worktree:_===`claude`&&S})}async function N(){let t=n.trim();if(!(!t||i)){a(!0),s(null);try{let n=await O({task:t,mode:`direct`,worktree:_===`claude`&&!!f?.repositoryRoot&&S,cwd:w||void 0,provider:_,model:y||void 0});r(``),e(n.missionId,t)}catch(e){s(e.message)}finally{a(!1)}}}return(0,b.jsxs)(`div`,{className:`mb-4 rounded-xl border border-violet-300/15 bg-violet-300/[0.03] p-3`,children:[(0,b.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,b.jsx)(`div`,{className:`min-w-0 flex-1 rounded-lg border border-white/10 bg-black/20 p-1 focus-within:border-violet-300/35`,children:(0,b.jsx)(xe,{value:n,onChange:r,skills:c,onSubmit:N,rows:1,suggestionsPlacement:`below`,placeholder:`Ask anything — Enter starts a direct mission, / for skills…`,className:`min-h-9`})}),(0,b.jsx)(`button`,{onClick:()=>void N(),disabled:i||!n.trim(),className:`shrink-0 rounded-lg bg-violet-500 px-4 py-2 text-sm font-semibold text-white transition hover:bg-violet-400 disabled:opacity-35`,children:i?`Starting…`:`Ask`})]}),(0,b.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 px-1`,children:[(0,b.jsxs)(`label`,{className:`flex min-w-0 items-center gap-1.5 text-[10px] text-white/30`,children:[(0,b.jsx)(`span`,{children:`Repository`}),(0,b.jsxs)(`select`,{"aria-label":`Quick mission repository`,value:w,onChange:e=>j(e.target.value),className:`max-w-44 rounded-md border border-white/10 bg-[#151519] px-2 py-1 text-[11px] text-white/65 outline-none transition hover:border-white/20 focus:border-violet-300/30`,children:[w&&!m.some(e=>e.path===w||e.resolvedPath===w)&&(0,b.jsx)(`option`,{value:w,children:w.split(`/`).filter(Boolean).at(-1)??w}),m.map(e=>(0,b.jsx)(`option`,{value:e.path,children:e.path.split(`/`).filter(Boolean).at(-1)??e.path},e.resolvedPath))]})]}),(0,b.jsxs)(`label`,{className:`flex items-center gap-1.5 text-[10px] text-white/30`,children:[(0,b.jsx)(`span`,{children:`Provider`}),(0,b.jsx)(`select`,{"aria-label":`Quick mission provider`,value:_,onChange:e=>E(e.target.value),className:`rounded-md border border-white/10 bg-[#151519] px-2 py-1 text-[11px] capitalize text-white/65 outline-none transition hover:border-white/20 focus:border-violet-300/30`,children:[`claude`,`codex`].map(e=>(0,b.jsx)(`option`,{value:e,disabled:u.find(t=>t.provider===e)?.available===!1,children:e},e))})]}),(0,b.jsxs)(`label`,{className:`flex min-w-0 items-center gap-1.5 text-[10px] text-white/30`,children:[(0,b.jsx)(`span`,{children:`Model`}),(0,b.jsxs)(`select`,{"aria-label":`Quick mission model`,value:y,onChange:e=>D(e.target.value),className:`max-w-56 rounded-md border border-white/10 bg-[#151519] px-2 py-1 text-[11px] text-white/65 outline-none transition hover:border-white/20 focus:border-violet-300/30`,children:[(0,b.jsxs)(`option`,{value:``,children:[`CLI default`,u.find(e=>e.provider===_)?.defaultModel?` (${u.find(e=>e.provider===_).defaultModel.label})`:``]}),(u.find(e=>e.provider===_)?.models??[]).map(e=>(0,b.jsx)(`option`,{value:e.id,children:e.label},e.id))]})]}),(0,b.jsxs)(`label`,{title:_===`codex`?`Hive-created worktrees are not yet available for Codex`:f?.repositoryRoot?`Run this direct mission in an isolated Git worktree`:`Worktrees require a Git repository`,className:`flex items-center gap-1.5 text-[10px] ${_===`claude`&&f?.repositoryRoot?`cursor-pointer text-white/40`:`cursor-not-allowed text-white/18`}`,children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:_===`claude`&&!!f?.repositoryRoot&&S,disabled:_!==`claude`||!f?.repositoryRoot,onChange:e=>A(e.target.checked),className:`accent-violet-400`}),(0,b.jsx)(`span`,{children:`Isolated worktree`})]}),(0,b.jsxs)(`span`,{className:`ml-auto text-[10px] text-white/22`,children:[`Direct`,_===`codex`?` · Codex uses the selected repository`:S&&f?.repositoryRoot?` · new worktree`:` · current checkout`]})]}),(0,b.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-3 px-1 text-[10px]`,children:[(0,b.jsx)(`button`,{type:`button`,onClick:()=>M(`direct`),className:`text-white/30 transition hover:text-white/60`,children:`More options`}),(0,b.jsx)(`span`,{className:`text-white/10`,children:`·`}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>M(`orchestrated`),className:`text-amber-200/45 transition hover:text-amber-100/75`,children:`Need parallel workers? Use an orchestrator →`})]}),o&&(0,b.jsx)(`p`,{className:`mt-1 px-1 text-xs text-rose-400`,children:o})]})}function lr({snapshot:e,connected:t,officePreferences:n,setOfficePreferences:r,onPresentationChange:i,onSelectOrchestrator:a,onSelectDirectStudio:o,notifications:s,sounds:c}){let[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(),[p,m]=(0,g.useState)(!1),[h,_]=(0,g.useState)(!1),[v,y]=(0,g.useState)(!1),[x,S]=(0,g.useState)(null),[C,w]=(0,g.useState)(it),[T,E]=(0,g.useState)(()=>{try{return new Set(JSON.parse(localStorage.getItem(`hive:hidden-sessions`)??`[]`))}catch{return new Set}}),D=e=>E(t=>{let n=new Set(t).add(e);return localStorage.setItem(`hive:hidden-sessions`,JSON.stringify([...n])),n}),O=e.other.filter(e=>!T.has(e.sessionId)),k=ct(e,C),{filtered:A,repositories:j,templates:M,operationalCount:N}=k,{operational:P,review:F,paused:I,completed:ee,archived:te}=k.sections;return(0,g.useEffect)(()=>{if(!x)return;let e=window.setTimeout(()=>S(e=>e?.id===x.id?null:e),11e3);return()=>window.clearTimeout(e)},[x]),(0,b.jsxs)(`div`,{className:`mx-auto max-w-6xl px-4 py-6 sm:px-6 sm:py-10`,children:[(0,b.jsxs)(`header`,{className:`mb-8 flex flex-wrap items-center justify-between gap-4`,children:[(0,b.jsx)(Oe,{subtitle:`${P.length+F.length} operational · ${e.orchestrators.length} total missions`}),(0,b.jsxs)(`div`,{className:`flex max-w-full flex-wrap items-center justify-end gap-2`,children:[(0,b.jsx)(lt,{value:n.fleetPresentation,onChange:i}),c&&(0,b.jsx)(`button`,{onClick:c.toggle,title:`Sound alerts: one chime when a mission needs your input, another when work awaits your acceptance`,"aria-label":c.enabled?`Disable sound alerts`:`Enable sound alerts`,className:`rounded-lg border px-3 py-2 text-xs ${c.enabled?`border-amber-300/20 bg-amber-300/[0.07] text-amber-200/65`:`border-white/10 text-white/35 hover:text-white/60`}`,children:c.enabled?`🔊`:`🔇`}),s.supported&&(0,b.jsx)(`button`,{onClick:()=>void s.toggle(),title:`Desktop notifications for new decisions`,className:`rounded-lg border px-3 py-2 text-xs ${s.enabled?`border-amber-300/20 bg-amber-300/[0.07] text-amber-200/65`:`border-white/10 text-white/35 hover:text-white/60`}`,children:s.enabled?`Notifications on`:`Notifications off`}),(0,b.jsx)(`button`,{onClick:()=>_(!0),className:`rounded-lg border border-white/10 px-3 py-2 text-xs text-white/45 transition hover:border-amber-300/15 hover:bg-amber-300/[0.04] hover:text-amber-100/70`,children:`Policies`}),(0,b.jsx)(`button`,{onClick:()=>m(!0),className:`rounded-lg border border-white/10 px-3 py-2 text-xs text-white/45 transition hover:border-amber-300/15 hover:bg-amber-300/[0.04] hover:text-amber-100/70`,children:`Templates`}),(0,b.jsx)(`button`,{onClick:()=>{f(void 0),u(!0)},className:`rounded-lg border border-amber-200/20 bg-gradient-to-b from-amber-200 to-amber-400 px-3.5 py-2 text-sm font-semibold text-[#241704] shadow-lg shadow-amber-950/15 transition hover:-translate-y-px hover:from-amber-100 hover:to-amber-300`,children:`+ New mission`})]})]}),l&&(0,b.jsx)(Te,{initialDraft:d,onClose:()=>u(!1)}),p&&(0,b.jsx)(Ve,{repositories:j,onClose:()=>m(!1)}),h&&(0,b.jsx)(He,{onClose:()=>_(!1)}),(0,b.jsx)(cr,{onStarted:(e,t)=>S({id:e,task:t}),onConfigure:e=>{f(e),u(!0)}}),(0,b.jsx)(We,{value:C,onChange:w,repositories:j,templates:M,shown:A.length,total:e.orchestrators.length}),(0,b.jsx)(Ae,{decisions:e.decisions??[],onOpenMission:e=>a(e,n.fleetPresentation===`office`?`room`:`details`),presentation:`drawer`}),n.fleetPresentation===`office`?(0,b.jsx)(or,{missions:A,allMissions:e.orchestrators,roomAssignments:n.roomAssignments,workerSeatAssignments:n.workerSeatAssignments,announcement:x,onAssignmentsChange:(e,t)=>r(n=>({...n,roomAssignments:e,workerSeatAssignments:t})),connected:t,suspended:l,selectedFloor:n.selectedFloor,onSelectedFloorChange:e=>r(t=>({...t,selectedFloor:e})),motion:n.motion,onMotionChange:e=>r(t=>({...t,motion:e})),dialogue:n.dialogue,onDialogueChange:e=>r(t=>({...t,dialogue:e})),attentionMissionIds:new Set((e.decisions??[]).map(e=>e.missionId)),onSelectMission:e=>a(e,`room`),onSelectWorker:(e,t)=>a(e,`room`,t),onSelectDirectStudio:o}):(0,b.jsxs)(b.Fragment,{children:[e.orchestrators.length===0&&(0,b.jsx)(`p`,{className:`mb-8 rounded-xl border border-dashed border-white/10 py-8 text-center text-sm text-white/35`,children:`No Hive missions yet. Start one above or adopt a discovered background job.`}),e.orchestrators.length>0&&A.length===0&&(0,b.jsx)(`p`,{className:`mb-8 rounded-xl border border-dashed border-white/10 py-8 text-center text-sm text-white/35`,children:`No missions match these filters.`}),(0,b.jsx)(Qe,{title:`Awaiting acceptance`,description:`The orchestrator reports that work and required verification are complete. Accept the result or request changes.`,missions:F,onSelect:a}),(0,b.jsx)(Qe,{title:`Active missions`,description:`Work in progress, idle, stalled, or failed.`,missions:P,onSelect:a}),(0,b.jsx)(Qe,{title:`Paused`,missions:I,onSelect:a}),(0,b.jsx)(Qe,{title:`Completed`,description:`Finished work retained for review, follow-ups, or reopening.`,missions:ee,onSelect:a,collapsedByDefault:!0}),(0,b.jsx)(Qe,{title:`Archive`,description:`Missions intentionally removed from the operational fleet.`,missions:te,onSelect:a,collapsedByDefault:!0}),e.other.length>0&&(0,b.jsxs)(`section`,{className:`mt-10 border-t border-white/[0.06] pt-6`,children:[(0,b.jsxs)(`button`,{onClick:()=>y(!v),className:`flex w-full items-center justify-between text-left`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`h2`,{className:`text-sm font-medium uppercase tracking-wide text-white/30`,children:[`Discovered local sessions `,(0,b.jsx)(`span`,{className:`ml-1 text-white/15`,children:O.length})]}),(0,b.jsx)(`p`,{className:`mt-1 text-xs text-white/20`,children:`Claude processes started outside Hive. Adopt a background job, end it, or hide it locally.`})]}),(0,b.jsx)(`span`,{className:`rounded-md border border-white/8 px-2 py-1 text-xs text-white/30`,children:v?`−`:`+`})]}),v&&(0,b.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2`,children:[T.size>0&&(0,b.jsx)(`div`,{className:`flex justify-end`,children:(0,b.jsxs)(`button`,{onClick:()=>{E(new Set),localStorage.removeItem(`hive:hidden-sessions`)},className:`text-[10px] text-white/25 hover:text-white/50`,children:[`Restore `,T.size,` hidden session`,T.size===1?``:`s`]})}),O.map(e=>(0,b.jsx)(sr,{session:e,onHide:()=>D(e.sessionId)},e.sessionId)),!O.length&&(0,b.jsx)(`p`,{className:`rounded-lg border border-dashed border-white/8 py-5 text-center text-xs text-white/25`,children:`All discovered sessions are hidden.`})]})]})]})]})}var ur=/https:\/\/claude\.ai\/code\/artifact\/[\w-]+/g,dr=/https?:\/\/[^\s<>"')\]]+\/-\/merge_requests\/(\d+)/g,fr=/https?:\/\/github\.com\/[^\s<>"')\]]+\/pull\/(\d+)/g,pr=/https?:\/\/[\w.-]+(?:\.atlassian\.net|\/jira)\/browse\/([A-Z][A-Z0-9]*-\d+)/g;function mr(e){let t=e.match(/\/-\/merge_requests\/(\d+)/);if(t)return`MR !${t[1]}`;let n=e.match(/github\.com\/.+\/pull\/(\d+)/);if(n)return`PR #${n[1]}`;if(/claude\.ai\/code\/artifact\//.test(e))return`Artifact`}function hr(e,t){let n=new Map;for(let t of e)n.set(t.href,mr(t.href)??`${(t.kind||`PR`).toUpperCase()} ${t.id}`);let r=t.map(e=>e.text).join(`
11
+ `);for(let e of r.matchAll(dr))n.set(e[0],`MR !${e[1]}`);for(let e of r.matchAll(fr))n.set(e[0],`PR #${e[1]}`);for(let e of r.matchAll(pr))n.set(e[0],e[1]);let i=[...new Set([...r.matchAll(ur)].map(e=>e[0]))];return i.forEach((e,t)=>n.set(e,i.length>1?`Artifact ${t+1}`:`Artifact`)),[...n.entries()].map(([e,t])=>({href:e,label:t}))}function gr({prs:e,messages:t}){let n=(0,g.useMemo)(()=>hr(e,t),[e,t]);return n.length?(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-xl border border-emerald-300/10 bg-emerald-300/[0.025] px-3 py-2.5`,children:[(0,b.jsx)(`span`,{className:`text-[9px] font-semibold uppercase tracking-[0.16em] text-emerald-200/50`,children:`Outputs`}),n.map(e=>(0,b.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,title:e.href,className:`rounded-lg border border-white/10 bg-white/[0.03] px-2.5 py-1 text-[11px] text-violet-300 transition hover:border-violet-400/30 hover:text-violet-200`,children:[e.label,` ↗`]},e.href))]}):null}var _r=[{id:`all`,label:`All`},{id:`manager`,label:`Manager`},{id:`worker`,label:`Workers`},{id:`task`,label:`Tasks`},{id:`tool`,label:`Tools`},{id:`errors`,label:`Errors`},{id:`outputs`,label:`Outputs`}];function vr(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function yr(e){return e.activityKind?e.activityKind:e.source===`custom`?e.phase===`delegating`||e.phase===`worker_started`||e.phase===`worker_reported`?`agent`:e.phase===`ready_for_review`?`output`:e.phase===`blocked_on_user`?`decision`:`lifecycle`:`tool`}function br(e){let t=yr(e);return t===`file_read`?`Read file`:t===`file_write`?`Changed file`:t===`command`?`Ran command`:t===`test`?`Ran tests`:t===`output`?`Produced output`:e.phase===`delegating`?`Manager delegated`:e.phase===`worker_started`?`Worker started`:e.phase===`worker_reported`?`Worker reported`:e.phase===`reviewing`?`Manager reviewing`:e.phase===`plan_updated`?`Plan revised`:e.phase===`ready_for_review`?`Awaiting acceptance`:e.hookEventName===`TaskCreated`?`Task created`:e.hookEventName===`TaskCompleted`?`Task completed`:e.hookEventName===`TeammateIdle`?`Worker became idle`:e.hookEventName===`PermissionRequest`?`Permission requested`:e.hookEventName===`PermissionDenied`?`Permission denied`:e.hookEventName===`PostToolUseFailure`?`Tool failed`:e.hookEventName===`StopFailure`?`Turn failed`:e.hookEventName===`PreCompact`?`Compacting context`:e.hookEventName===`PostCompact`?`Context compacted`:e.hookEventName===`WorktreeCreate`?`Worktree created`:e.hookEventName===`WorktreeRemove`?`Worktree removed`:e.hookEventName===`InstructionsLoaded`?`Instructions loaded`:e.hookEventName===`ConfigChange`?`Configuration changed`:e.hookEventName===`CwdChanged`?`Working directory changed`:e.hookEventName===`Elicitation`?`MCP needs input`:e.hookEventName===`ElicitationResult`?`MCP input answered`:t===`agent`?`Worker activity`:t===`decision`?e.phase===`decision_resolved`?`Decision answered`:`Needs you`:e.outcome===`failure`?`Tool failed`:e.phase?.replaceAll(`_`,` `)??e.hookEventName??`Activity`}function xr(e,t){let n=!e.targetWorker||e.targetWorker===`hive-orchestrator`;return t===`all`?!0:t===`manager`?n&&e.phase!==`worker_started`&&e.phase!==`worker_reported`:t===`worker`?!n&&!!e.targetWorker||e.phase===`worker_started`||e.phase===`worker_reported`:t===`task`?!!e.targetTask||e.phase===`plan_updated`:t===`tool`?e.source===`hook`&&!!e.toolName:t===`errors`?e.outcome===`failure`:yr(e)===`output`||e.phase===`ready_for_review`}function Sr(e){let t=Math.floor(e/6e4);return t<60?`${t}m`:`${Math.floor(t/60)}h ${t%60}m`}function Cr(e){return[yr(e),e.targetWorker,e.filePath,e.command,e.artifactPath,e.phase,e.detail].join(`|`)}function wr(e){let t=[];for(let n of[...e].sort((e,t)=>t.ts-e.ts)){let e=t.at(-1);e&&Cr(e.event)===Cr(n)&&Math.abs(e.event.ts-n.ts)<1e4?e.count+=1:t.push({event:n,count:1})}return t}function Tr({events:e,compact:t=!1}){let[n,r]=(0,g.useState)(`all`),i=(0,g.useMemo)(()=>wr(e.filter(e=>xr(e,n))),[e,n]);return e.length?(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`mb-3 flex flex-wrap gap-1.5`,role:`group`,"aria-label":`Activity filters`,children:_r.map(e=>(0,b.jsx)(`button`,{type:`button`,onClick:()=>r(e.id),className:`rounded-full border px-2.5 py-1 text-[10px] transition ${n===e.id?`border-amber-300/25 bg-amber-300/10 text-amber-100/75`:`border-white/8 text-white/30 hover:bg-white/5 hover:text-white/55`}`,children:e.label},e.id))}),i.length?(0,b.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:i.map(({event:e,count:n},r)=>(0,b.jsxs)(g.Fragment,{children:[(0,b.jsxs)(`li`,{className:`flex gap-2 rounded-lg px-1 py-1.5 text-sm hover:bg-white/[0.02] ${t?`flex-wrap items-center`:`items-start`}`,children:[(0,b.jsx)(`span`,{className:`mono mt-0.5 shrink-0 text-xs text-white/25`,children:vr(e.ts)}),(0,b.jsx)(`span`,{className:`mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full ${e.source===`custom`?`bg-violet-400`:yr(e)===`test`?`bg-emerald-400`:yr(e)===`decision`?`bg-amber-400`:`bg-white/25`}`}),(0,b.jsxs)(`span`,{className:`min-w-0 text-white/65 ${t?`basis-full pl-5`:``}`,children:[(0,b.jsx)(`span`,{className:`font-medium text-white/45`,children:br(e)}),e.targetWorker&&(0,b.jsxs)(`span`,{className:`ml-1 text-violet-300/55`,children:[`· `,e.targetWorker]}),e.targetTask&&(0,b.jsxs)(`span`,{className:`ml-1 text-sky-300/50`,children:[`· task `,e.targetTask]}),n>1&&(0,b.jsxs)(`span`,{className:`ml-1 rounded bg-white/5 px-1 text-[10px] text-white/25`,children:[`×`,n]}),(0,b.jsx)(`span`,{className:`ml-1 break-words`,children:e.filePath??e.command??e.artifactPath??e.detail}),e.rawPayload!==void 0&&(0,b.jsxs)(`details`,{className:`mt-1.5 rounded border border-white/[0.06] bg-black/20 px-2 py-1`,children:[(0,b.jsx)(`summary`,{className:`cursor-pointer text-[9px] uppercase tracking-wider text-white/25 hover:text-white/45`,children:`Raw event`}),(0,b.jsx)(`pre`,{className:`mono mt-2 max-h-64 overflow-auto whitespace-pre-wrap break-all text-[9px] leading-relaxed text-white/35`,children:JSON.stringify(e.rawPayload,null,2)})]})]})]}),i[r+1]&&e.ts-i[r+1].event.ts>=3e5&&(0,b.jsxs)(`li`,{className:`ml-16 flex items-center gap-2 py-1 text-[9px] uppercase tracking-wider text-white/18`,children:[(0,b.jsx)(`span`,{className:`h-px w-8 bg-white/8`}),`Idle gap · `,Sr(e.ts-i[r+1].event.ts)]})]},`${e.ts}:${r}`))}):(0,b.jsx)(`p`,{className:`rounded-lg border border-dashed border-white/8 py-5 text-center text-xs text-white/25`,children:`No activity in this category.`})]}):(0,b.jsx)(`p`,{className:`text-sm text-white/40`,children:`No activity yet.`})}var Er=[{name:`usage`,description:`Show subscription usage limits and what is consuming them`,scope:`account`},{name:`cost`,description:`Show the cost and duration breakdown for Claude usage`,scope:`account`},{name:`context`,description:`Show this mission session's context window usage`,scope:`session`}],Dr=new Set([`idle`,`done`,`offline`]);function Or(e){return e.mission.mode!==`direct`||e.lifecycleStatus!==`active`||!Dr.has(e.activityStatus)||e.inFlight.tasks>0||e.inFlight.queued>0||e.workers.some(e=>!e.doneAt&&(e.jobState===`working`||e.jobState===`busy`))||e.alerts.length>0?!1:!(e.plan?.gates??[]).some(e=>e.required&&e.status!==`satisfied`&&e.status!==`waived`)}var kr=Er.map(e=>({name:e.name,description:e.description,source:`claude`})),Ar=typeof window>`u`?g.useEffect:g.useLayoutEffect;function jr(e){return new Date(e).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`})}var Mr=/https?:\/\/[^\s<>"')\]]+/g,Nr=/\b(MR|PR)\s*[#!]\s*(\d+)\b/g;function Pr(e,t){return e.find(e=>e.id===t||RegExp(`/(merge_requests|pull)/${t}$`).test(e.href))?.href}function Fr(e,t,n){return e.some(e=>e.role===`user`&&e.text===t.text&&!n.has(e.id))}function Ir(e,t){return e.some(e=>e.role===`assistant`&&!t.has(e.id))}function Lr(e,t,n){if(!t.length)return[e];let r=[],i=0;for(let a of e.matchAll(Nr)){let o=Pr(t,a[2]);o&&(a.index>i&&r.push(e.slice(i,a.index)),r.push((0,b.jsx)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,className:`underline underline-offset-2 transition-colors ${n}`,children:a[0]},`${o}:${a.index}`)),i=a.index+a[0].length)}return i<e.length&&r.push(e.slice(i)),r}function Rr({text:e,role:t,prs:n=[]}){let r=t===`user`?`text-sky-200 hover:text-white`:`text-violet-300 hover:text-violet-200`,i=[],a=0;for(let t of e.matchAll(Mr)){let n=t[0].replace(/[.,;:!?*]+$/,``);t.index>a&&i.push(e.slice(a,t.index)),i.push({url:n}),a=t.index+n.length}return a<e.length&&i.push(e.slice(a)),(0,b.jsx)(`p`,{className:`whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:i.map((e,t)=>typeof e==`string`?(0,b.jsx)(`span`,{children:Lr(e,n,r)},t):(0,b.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`break-all underline underline-offset-2 transition-colors ${r}`,children:e.url},t))})}function zr({missionId:e,messages:t,hasMoreMessages:n,repository:r,provider:i=`claude`,live:a,contained:o=!1,onOpenDecisions:s}){let[c,l]=(0,g.useState)(``),[u,d]=(0,g.useState)(!1),[f,p]=(0,g.useState)(null),[m,h]=(0,g.useState)(null),[_,v]=(0,g.useState)(!1),[y,x]=(0,g.useState)([]),[S,C]=(0,g.useState)(!!n),[w,T]=(0,g.useState)(!1),[E,D]=(0,g.useState)([]),O=(0,g.useRef)(null),A=(0,g.useRef)(null),j=(0,g.useRef)(new Set),M=(0,g.useRef)(new Set),N=(0,g.useRef)(!1),P=Array.isArray(t)?t:[],F=[...y,...P].filter((e,t,n)=>n.findIndex(t=>t.id===e.id)===t);(0,g.useEffect)(()=>{x([]),C(!!n),h(null),v(!1),j.current.clear(),M.current.clear(),N.current=!1},[e]),(0,g.useEffect)(()=>{D([]),k(r,i).then(({skills:e})=>D(e)).catch(()=>D([]))},[i,r]),(0,g.useEffect)(()=>{n&&C(!0)},[n]),(0,g.useEffect)(()=>{m&&Fr(F,m,j.current)&&h(null)},[F,m]),(0,g.useEffect)(()=>{if(_){if(Ir(F,M.current)){v(!1),N.current=!1;return}a?.status===`working`?N.current=!0:(N.current||a?.status===`error`||a?.lifecycle===`failed`||a?.lifecycle===`paused`)&&(v(!1),N.current=!1)}},[_,F,a?.lifecycle,a?.status]);async function ee(){let t=F[0];if(!(!t||w)){T(!0),p(null);try{let n=await ue(e,{before:t.createdAt,limit:30});x(e=>[...n.messages,...e]),C(n.hasMore)}catch(e){p(e.message)}finally{T(!1)}}}async function te(){let t=c.trim();if(!t||u)return;let n=new Set(F.map(e=>e.id));j.current=n,M.current=n,N.current=a?.status===`working`,d(!0),v(!0),p(null),h({id:`pending:${Date.now()}`,role:`user`,text:t,createdAt:Date.now(),jobId:`pending`}),l(``);try{await I(e,t)}catch(e){h(null),v(!1),N.current=!1,l(t),p(e.message)}finally{d(!1)}}let L=m?[...F,m]:F,ne=L.at(-1)?.id,R=a?.workers.filter(e=>!e.doneAt)??[],re=a?.status===`working`||_,z=!re&&a?.lifecycle===`active`&&a?.status===`waiting_on_you`,ie=m?`Delivering your message…`:_&&a?.status!==`working`?`Starting response…`:a?.detail?.trim()||`Orchestrator is working…`;return Ar(()=>{let t=O.current;if(A.current!==e){A.current=e,t&&(t.scrollTop=t.scrollHeight);return}t&&ne&&t.scrollTo({top:t.scrollHeight,behavior:`smooth`})},[e,ne,re,z]),(0,b.jsxs)(`div`,{className:`overflow-hidden rounded-2xl border border-white/10 bg-[#101014] ${o?`xl:flex xl:min-h-0 xl:flex-1 xl:flex-col`:``}`,children:[!o&&(0,b.jsx)(`div`,{className:`border-b border-white/8 px-5 py-3.5`,children:(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Conversation`}),(0,b.jsx)(`p`,{className:`mt-0.5 text-xs text-white/35`,children:`Context carries forward across every follow-up`})]})}),(0,b.jsxs)(`div`,{ref:O,className:`min-h-48 space-y-4 overflow-y-auto px-5 py-5 ${o?`max-h-[460px] xl:min-h-0 xl:max-h-none xl:flex-1`:`max-h-[460px]`}`,children:[S&&(0,b.jsx)(`div`,{className:`text-center`,children:(0,b.jsx)(`button`,{onClick:ee,disabled:w,className:`rounded-full border border-white/10 px-3 py-1.5 text-xs text-white/40 hover:bg-white/5 hover:text-white/70 disabled:opacity-40`,children:w?`Loading…`:`Load older messages`})}),L.length===0&&(0,b.jsx)(`p`,{className:`py-12 text-center text-sm text-white/30`,children:`Send a message to continue this mission.`}),L.map(e=>(0,b.jsx)(`div`,{className:`flex ${e.role===`user`?`justify-end`:`justify-start`}`,children:(0,b.jsxs)(`div`,{className:`min-w-0 max-w-[85%] break-words rounded-2xl px-4 py-3 text-sm leading-relaxed [overflow-wrap:anywhere] ${e.role===`user`?`rounded-br-md bg-violet-500 text-white`:`rounded-bl-md border border-white/8 bg-white/[0.045] text-white/80`} ${e.jobId===`pending`?`opacity-70`:``}`,children:[(0,b.jsx)(Rr,{text:e.text,role:e.role,prs:a?.prs}),(0,b.jsx)(`p`,{className:`mt-1.5 text-[10px] ${e.role===`user`?`text-white/55`:`text-white/25`}`,children:e.jobId===`pending`?`Sending…`:jr(e.createdAt)})]})},e.id)),re&&(0,b.jsx)(`div`,{className:`flex justify-start`,children:(0,b.jsxs)(`div`,{className:`max-w-[85%] rounded-2xl rounded-bl-md border border-violet-300/15 bg-violet-400/[0.06] px-4 py-3`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,b.jsx)(`span`,{className:`flex gap-1`,children:[0,1,2].map(e=>(0,b.jsx)(`span`,{className:`h-1.5 w-1.5 animate-bounce rounded-full bg-violet-300/80`,style:{animationDelay:`${e*.18}s`}},e))}),(0,b.jsx)(`span`,{className:`text-xs text-violet-200/75`,children:ie})]}),(R.length>0||(a?.inFlight.tasks??0)>0)&&(0,b.jsx)(`p`,{className:`mt-1.5 text-[11px] text-white/35`,children:R.length>0?`${R.length} worker${R.length===1?``:`s`} running: ${R.slice(0,3).map(e=>e.label).join(`, `)}${R.length>3?`…`:``}`:`${a.inFlight.tasks} task${a.inFlight.tasks===1?``:`s`} in flight${a.inFlight.queued?`, ${a.inFlight.queued} queued`:``}`})]})}),z&&(0,b.jsx)(`div`,{className:`flex justify-center`,children:a?.lifecycle===`ready_for_review`?(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full border border-emerald-300/20 bg-emerald-300/[0.06] px-3 py-1 text-[11px] text-emerald-200/75`,children:[(0,b.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-emerald-300/80`}),`Work complete — awaiting your acceptance`]}):s?(0,b.jsxs)(`button`,{type:`button`,onClick:s,className:`inline-flex cursor-pointer items-center gap-1.5 rounded-full border border-amber-300/20 bg-amber-300/[0.06] px-3 py-1 text-[11px] text-amber-200/70 transition hover:border-amber-300/40 hover:bg-amber-300/10`,children:[(0,b.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-amber-300/80`}),`Needs you — open pending decisions ↗`]}):(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full border border-amber-300/20 bg-amber-300/[0.06] px-3 py-1 text-[11px] text-amber-200/70`,children:[(0,b.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-amber-300/80`}),`Needs you — waiting on your reply`]})})]}),(0,b.jsxs)(`div`,{className:`border-t border-white/8 p-3`,children:[(0,b.jsxs)(`div`,{className:`flex items-end gap-2 rounded-xl border border-white/10 bg-white/[0.035] p-2 focus-within:border-violet-400/35`,children:[(0,b.jsx)(xe,{value:c,onChange:l,skills:i===`claude`?[...kr,...E]:E,onSubmit:te,rows:2,placeholder:`Ask a follow-up, request a change, or type / for skills…`,className:`min-h-12 flex-1`}),(0,b.jsx)(`button`,{onClick:te,disabled:u||!c.trim(),className:`rounded-lg bg-violet-500 px-4 py-2 text-sm font-semibold text-white transition hover:bg-violet-400 disabled:opacity-35`,children:u?`Sending…`:`Send`})]}),f&&(0,b.jsx)(`p`,{className:`mt-2 px-2 text-xs text-rose-400`,children:f})]})]})}function Br({missionId:e,status:t,onDeleted:n}){let[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)(!1),[s,c]=(0,g.useState)(null),[l,u]=(0,g.useState)(!1),d=(0,g.useRef)(null);(0,g.useEffect)(()=>{if(!a)return;let e=e=>{d.current?.contains(e.target)||(o(!1),u(!1))},t=e=>{e.key===`Escape`&&(o(!1),u(!1))};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[a]);async function f(t){i(t),c(null);try{await L(e,t),o(!1)}catch(e){c(e.message)}finally{i(null)}}async function p(t){i(t),c(null);try{await re(e,t),o(!1)}catch(e){c(e.message)}finally{i(null)}}async function m(){i(`archived`),c(null);try{await R(e),n?.()}catch(e){c(e.message)}finally{i(null),u(!1)}}let h=t===`ready_for_review`?{label:`Accept & complete`,status:`completed`}:t===`paused`?{label:`Resume mission`,status:`active`}:t===`completed`||t===`failed`||t===`archived`?{label:`Reopen mission`,status:`active`}:{label:`Pause mission`,status:`paused`};return(0,b.jsxs)(`div`,{ref:d,className:`relative flex items-center gap-1.5`,children:[(0,b.jsx)(`button`,{disabled:!!r,onClick:()=>f(h.status),className:`rounded-lg border border-white/10 bg-white/[0.035] px-3 py-1.5 text-xs font-medium text-white/55 transition hover:border-amber-300/20 hover:text-amber-200 disabled:opacity-40`,children:r===h.status?`Updating…`:h.label}),(0,b.jsx)(`button`,{"aria-label":`More mission actions`,"aria-expanded":a,onClick:()=>o(!a),className:`rounded-lg border border-white/10 bg-white/[0.035] px-2.5 py-1.5 text-xs text-white/45 hover:text-white`,children:`•••`}),a&&(0,b.jsxs)(`div`,{role:`menu`,className:`absolute right-0 top-full z-30 mt-1 min-w-56 rounded-lg border border-white/10 bg-[#18181d] p-1 shadow-2xl`,children:[(t===`active`||t===`ready_for_review`)&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`p`,{className:`px-3 pb-1 pt-2 text-[9px] font-medium uppercase tracking-wider text-white/20`,children:`Ask orchestrator`}),[[`status_summary`,`Request status summary`],[`plan_revision`,`Revise plan`],[`review`,`Request fresh review`],[`test_pass`,`Run verification pass`]].map(([e,t])=>(0,b.jsx)(`button`,{disabled:!!r,onClick:()=>p(e),className:`block w-full rounded-md px-3 py-2 text-left text-xs text-white/60 hover:bg-white/5 hover:text-white disabled:opacity-35`,children:r===e?`Sending…`:t},e)),(0,b.jsx)(`div`,{className:`my-1 border-t border-white/[0.06]`})]}),t===`ready_for_review`&&(0,b.jsx)(`button`,{onClick:()=>f(`active`),className:`block w-full rounded-md px-3 py-2 text-left text-xs text-white/60 hover:bg-white/5 hover:text-white`,children:`Request changes`}),t===`active`&&(0,b.jsx)(`button`,{onClick:()=>f(`completed`),className:`block w-full rounded-md px-3 py-2 text-left text-xs text-white/60 hover:bg-white/5 hover:text-white`,children:`Mark complete`}),t!==`archived`&&(0,b.jsx)(`button`,{onClick:()=>f(`archived`),className:`block w-full rounded-md px-3 py-2 text-left text-xs text-white/60 hover:bg-white/5 hover:text-white`,children:`Archive mission`}),(0,b.jsx)(`div`,{className:`my-1 border-t border-white/[0.06]`}),l?(0,b.jsxs)(`div`,{className:`p-2`,children:[(0,b.jsx)(`p`,{className:`text-[10px] leading-relaxed text-rose-200/60`,children:`Permanently remove this mission, its conversation, and plan? Claude jobs are hidden but not deleted from disk.`}),(0,b.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,b.jsx)(`button`,{onClick:()=>u(!1),className:`px-2 py-1 text-[10px] text-white/35`,children:`Cancel`}),(0,b.jsx)(`button`,{disabled:!!r,onClick:m,className:`rounded-md bg-rose-500/70 px-2 py-1 text-[10px] text-white`,children:`Delete permanently`})]})]}):(0,b.jsx)(`button`,{onClick:()=>u(!0),className:`block w-full rounded-md px-3 py-2 text-left text-xs text-rose-300/55 hover:bg-rose-400/[0.06] hover:text-rose-200`,children:`Delete mission…`})]}),s&&(0,b.jsx)(`span`,{className:`absolute right-0 top-full mt-2 whitespace-nowrap text-[10px] text-rose-400`,children:s})]})}var Vr={pending:`text-amber-200/65 bg-amber-300/[0.06]`,satisfied:`text-emerald-200/65 bg-emerald-300/[0.06]`,failed:`text-rose-200/70 bg-rose-300/[0.06]`,waived:`text-slate-300/50 bg-slate-300/[0.05]`};function Hr({missionId:e,gates:t}){let[n,r]=(0,g.useState)(null),[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(!1),[c,l]=(0,g.useState)(null),[u,d]=(0,g.useState)(null),[f,p]=(0,g.useState)({label:``,type:`test`,required:!0});async function m(t){if(i.trim()){s(!0),l(null);try{await z(e,t,i),r(null),a(``)}catch(e){l(e.message)}finally{s(!1)}}}function h(e){d(e?.id??`new`),p(e?{label:e.label,type:e.type,required:e.required}:{label:``,type:`test`,required:!0}),l(null)}async function _(){if(!(!f.label.trim()||!u)){s(!0),l(null);try{let t=u===`new`?await ie(e,{...f,label:f.label.trim()}):await B(e,u,{...f,label:f.label.trim()});d(null),t.notified||l(`Gate saved, but the current manager could not be notified. Send a follow-up when the mission is resumable.`)}catch(e){l(e.message)}finally{s(!1)}}}async function v(t){if(window.confirm(`Remove completion gate “${t.label}”?`)){s(!0),l(null);try{(await ae(e,t.id)).notified||l(`Gate removed, but the current manager could not be notified.`)}catch(e){l(e.message)}finally{s(!1)}}}let y=(0,b.jsxs)(`div`,{className:`rounded-lg border border-amber-300/10 bg-amber-300/[0.025] p-3`,children:[(0,b.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[1fr_140px]`,children:[(0,b.jsx)(`input`,{autoFocus:!0,value:f.label,onChange:e=>p({...f,label:e.target.value}),placeholder:`Gate name, e.g. Tests pass`,className:`min-w-0 rounded-md border border-white/10 bg-black/20 px-2.5 py-2 text-xs text-white/65 outline-none focus:border-amber-300/25`}),(0,b.jsx)(`select`,{value:f.type,onChange:e=>p({...f,type:e.target.value}),className:`rounded-md border border-white/10 bg-[#151519] px-2 py-2 text-xs text-white/55`,children:[`test`,`typecheck`,`lint`,`ci`,`review`,`pr`,`screenshot`,`documentation`,`user_approval`,`custom`].map(e=>(0,b.jsx)(`option`,{value:e,children:e.replaceAll(`_`,` `)},e))})]}),(0,b.jsxs)(`label`,{className:`mt-2 flex cursor-pointer items-center gap-2 text-[10px] text-white/35`,children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:f.required,onChange:e=>p({...f,required:e.target.checked})}),`Required before mission completion`]}),(0,b.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,b.jsx)(`button`,{onClick:()=>d(null),className:`px-2 py-1 text-[10px] text-white/30`,children:`Cancel`}),(0,b.jsx)(`button`,{disabled:!f.label.trim()||o,onClick:()=>void _(),className:`rounded-md bg-amber-300 px-2.5 py-1.5 text-[10px] font-semibold text-black disabled:opacity-35`,children:o?`Saving…`:`Save gate`})]})]});return(0,b.jsxs)(`div`,{className:`border-t border-white/[0.06] px-5 py-4`,children:[(0,b.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-white/40`,children:`Completion gates`}),(0,b.jsx)(`p`,{className:`mt-1 text-[10px] text-white/22`,children:`Verification gates must be resolved before completion. User-created gates persist across orchestrator plan revisions.`})]}),(0,b.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,b.jsxs)(`span`,{className:`text-[10px] text-white/25`,children:[t.filter(e=>e.status===`satisfied`||e.status===`waived`).length,`/`,t.length,` resolved`]}),(0,b.jsx)(`button`,{onClick:()=>h(),className:`rounded-md border border-amber-300/15 px-2 py-1 text-[10px] text-amber-200/55 hover:bg-amber-300/[0.05]`,children:`+ Add gate`})]})]}),u===`new`&&(0,b.jsx)(`div`,{className:`mb-2`,children:y}),!t.length&&u!==`new`&&(0,b.jsx)(`p`,{className:`rounded-lg border border-dashed border-white/8 px-3 py-4 text-center text-[10px] text-white/22`,children:`No completion gates yet. Add one to define a durable requirement.`}),(0,b.jsx)(`div`,{className:`space-y-2`,children:t.map(e=>u===e.id?(0,b.jsx)(`div`,{children:y},e.id):(0,b.jsxs)(`div`,{className:`rounded-lg border border-white/[0.06] bg-black/10 px-3 py-2.5`,children:[(0,b.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-white/65`,children:e.label}),e.required&&(0,b.jsx)(`span`,{className:`text-[8px] uppercase tracking-wider text-white/20`,children:`required`}),(0,b.jsx)(`span`,{className:`rounded bg-white/[0.035] px-1.5 py-0.5 text-[8px] uppercase tracking-wider text-white/22`,children:e.source===`user`?`Added by you`:e.source===`template`?`From template`:`Orchestrator`})]}),(0,b.jsx)(`p`,{className:`mt-1 text-[9px] uppercase tracking-wide text-white/22`,children:e.type.replaceAll(`_`,` `)})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,b.jsx)(`span`,{className:`rounded-full px-2 py-1 text-[9px] font-medium uppercase ${Vr[e.status]}`,children:e.status}),e.source===`user`&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`button`,{onClick:()=>h(e),className:`rounded px-1.5 py-1 text-[9px] text-white/25 hover:bg-white/5 hover:text-white/50`,children:`Edit`}),(0,b.jsx)(`button`,{onClick:()=>void v(e),className:`rounded px-1.5 py-1 text-[9px] text-rose-300/35 hover:bg-rose-300/[0.05] hover:text-rose-200/60`,children:`Remove`})]})]})]}),e.evidence.length>0&&(0,b.jsx)(`ul`,{className:`mt-2 space-y-1 border-t border-white/[0.05] pt-2`,children:e.evidence.map((e,t)=>(0,b.jsxs)(`li`,{className:`text-[10px] text-emerald-100/40`,children:[`✓ `,e]},t))}),e.waiver&&(0,b.jsxs)(`p`,{className:`mt-2 text-[10px] text-white/30`,children:[`Waived: `,e.waiver.reason]}),e.type===`user_approval`&&e.status!==`satisfied`&&e.status!==`waived`&&(0,b.jsx)(`p`,{className:`mt-2 text-[10px] text-amber-100/45`,children:`This resolves automatically when you choose Accept & complete.`}),e.type!==`user_approval`&&e.required&&e.status!==`satisfied`&&e.status!==`waived`&&(n===e.id?(0,b.jsx)(`div`,{className:`mt-2`,children:(0,b.jsxs)(`div`,{className:`flex gap-2`,children:[(0,b.jsx)(`input`,{autoFocus:!0,value:i,onChange:e=>a(e.target.value),placeholder:`Required reason…`,className:`min-w-0 flex-1 rounded-md border border-white/10 bg-black/20 px-2 py-1.5 text-[10px] text-white/60 outline-none`}),(0,b.jsx)(`button`,{disabled:!i.trim()||o,onClick:()=>m(e.id),className:`rounded-md bg-slate-600 px-2 py-1.5 text-[10px] text-white disabled:opacity-35`,children:`Confirm waiver`}),(0,b.jsx)(`button`,{onClick:()=>{r(null),a(``)},className:`text-[10px] text-white/25`,children:`Cancel`})]})}):(0,b.jsx)(`button`,{onClick:()=>{r(e.id),l(null)},className:`mt-2 text-[10px] text-white/25 hover:text-white/50`,children:`Waive with reason`}))]},e.id))}),c&&(0,b.jsx)(`p`,{className:`mt-2 text-[10px] text-rose-400`,children:c})]})}function Ur(e,t){if(!t)return[`Initial plan: ${e.phases.length} phase${e.phases.length===1?``:`s`}, ${e.progress.totalTasks} task${e.progress.totalTasks===1?``:`s`}`];let n=[],r=e=>new Map(e.phases.flatMap((e,t)=>[[e.id,{label:e.title,status:e.status,description:e.description,order:t,kind:`phase`}],...tt(e.tasks).map((e,n)=>[e.id,{label:e.title,status:e.status,description:e.description??e.assignment,order:t*1e3+n,kind:`task`}])])),i=r(t),a=r(e);for(let[e,t]of a){let r=i.get(e);r?((r.label!==t.label||r.description!==t.description)&&n.push(`Rescoped ${t.kind}: ${r.label} → ${t.label}`),r.status!==t.status&&n.push(`${t.label}: ${et(r.status).toLowerCase()} → ${et(t.status).toLowerCase()}`),r.order!==t.order&&n.push(`Reordered ${t.kind}: ${t.label}`)):n.push(`Added ${t.kind}: ${t.label}`)}for(let[e,t]of i)a.has(e)||n.push(`Removed ${t.kind}: ${t.label}`);let o=new Map((t.gates??[]).map(e=>[e.id,e]));for(let t of e.gates??[]){let e=o.get(t.id);e?e.status!==t.status&&n.push(`${t.label}: ${e.status} → ${t.status}`):n.push(`Added gate: ${t.label}`)}return(t.approvalStatus??`proposed`)!==(e.approvalStatus??`proposed`)&&n.push(`Plan approval: ${t.approvalStatus??`proposed`} → ${e.approvalStatus}`),n.length?n:[`Metadata-only revision; no task, phase, or gate changes.`]}function Wr({missionId:e,currentRevision:t}){let[n,r]=(0,g.useState)(!1),[i,a]=(0,g.useState)([]),[o,s]=(0,g.useState)(null),[c,l]=(0,g.useState)(!1);async function u(){if(n){r(!1);return}if(r(!0),!i.length){l(!0);try{a((await oe(e)).revisions)}catch(e){s(e.message)}finally{l(!1)}}}return(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`button`,{onClick:u,className:`rounded-full border border-white/8 px-2 py-0.5 text-[9px] uppercase tracking-wider text-white/30 hover:text-white/55`,children:[`Revision `,t,` · `,n?`hide history`:`history`]}),n&&(0,b.jsxs)(`div`,{className:`mt-3 max-h-72 space-y-2 overflow-y-auto rounded-xl border border-white/[0.06] bg-black/15 p-3`,children:[c&&(0,b.jsx)(`p`,{className:`text-xs text-white/25`,children:`Loading revisions…`}),o&&(0,b.jsx)(`p`,{className:`text-xs text-rose-400`,children:o}),i.map((e,t)=>(0,b.jsxs)(`div`,{className:`rounded-lg border border-white/[0.05] bg-white/[0.018] p-3`,children:[(0,b.jsxs)(`div`,{className:`flex justify-between text-[10px]`,children:[(0,b.jsxs)(`span`,{className:`font-medium text-white/50`,children:[`Revision `,e.revision]}),(0,b.jsx)(`span`,{className:`text-white/20`,children:new Date(e.updatedAt).toLocaleString()})]}),(0,b.jsx)(`ul`,{className:`mt-2 space-y-1`,children:Ur(e,i[t+1]).map((e,t)=>(0,b.jsxs)(`li`,{className:`text-[10px] leading-relaxed text-white/35`,children:[`• `,e]},t))})]},e.revision))]})]})}function Gr({missionId:e,plan:t,required:n=!1}){let r=t.approvalStatus??`proposed`,i=t.phases.some(e=>e.status!==`queued`||e.tasks.some(function e(t){return t.status!==`queued`||(t.subtasks??[]).some(e)})),[a,o]=(0,g.useState)(!1),[s,c]=(0,g.useState)(``),[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(null);async function p(t){u(!0),f(null);try{await se(e,t,t===`rejected`?s:void 0),o(!1),c(``)}catch(e){f(e.message)}finally{u(!1)}}return i&&r===`proposed`&&!n?null:(0,b.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`rounded-full px-2 py-1 text-[9px] font-medium uppercase ${r===`approved`?`bg-emerald-300/10 text-emerald-200/60`:r===`rejected`?`bg-rose-300/10 text-rose-200/65`:`bg-amber-300/10 text-amber-200/60`}`,children:r===`approved`?`Plan approved`:r===`rejected`?`Plan changes requested`:n?`Approval required`:`Optional plan checkpoint`}),r===`proposed`&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{className:`text-[10px] text-white/25`,children:n?`Implementation and worker delegation are paused until you approve this plan.`:`Approve the approach before implementation, or let the autonomous mission continue.`}),(0,b.jsx)(`button`,{disabled:l,onClick:()=>p(`approved`),className:`cursor-pointer rounded-md border border-emerald-300/15 px-2 py-1 text-[10px] text-emerald-200/55 hover:bg-emerald-300/[0.06]`,children:l?`Approving…`:`Approve & begin`}),(0,b.jsx)(`button`,{onClick:()=>o(!a),className:`cursor-pointer rounded-md border border-rose-300/15 px-2 py-1 text-[10px] text-rose-200/50 hover:bg-rose-300/[0.05]`,children:`Request changes`})]}),t.approvalReason&&(0,b.jsx)(`span`,{className:`text-[10px] text-white/30`,children:t.approvalReason}),a&&(0,b.jsxs)(`div`,{className:`flex w-full gap-2`,children:[(0,b.jsx)(`input`,{autoFocus:!0,value:s,onChange:e=>c(e.target.value),placeholder:`What should change before implementation?`,className:`min-w-0 flex-1 rounded-md border border-white/10 bg-black/20 px-2 py-1.5 text-[10px] text-white/60 outline-none`}),(0,b.jsx)(`button`,{disabled:!s.trim()||l,onClick:()=>p(`rejected`),className:`cursor-pointer rounded-md bg-rose-500/60 px-2 py-1.5 text-[10px] text-white disabled:opacity-35`,children:`Request plan revision`})]}),d&&(0,b.jsx)(`p`,{className:`w-full text-[10px] text-rose-400`,children:d})]})}function Kr({missionId:e,task:t}){let[n,r]=(0,g.useState)(!1),[i,a]=(0,g.useState)(null),[o,s]=(0,g.useState)(``),[c,l]=(0,g.useState)(!1),[u,d]=(0,g.useState)(null);if(t.status===`completed`||t.status===`cancelled`)return null;async function f(n=i){if(n){l(!0),d(null);try{await ce(e,t.id,n,o),r(!1),a(null),s(``)}catch(e){d(e.message)}finally{l(!1)}}}let p=e=>{e===`retry`?(a(e),f(e)):(a(e),s(e===`priority`?`high`:``))},m=[[`retry`,`Retry remaining work`],[`cancel`,`Cancel task / worker`],[`replace_worker`,`Replace worker`],[`reassign`,`Reassign`],[`priority`,`Change priority`]];return(0,b.jsxs)(`div`,{className:`relative ml-auto`,children:[(0,b.jsx)(`button`,{onClick:()=>r(!n),"aria-label":`Task controls for ${t.title}`,className:`rounded-md border border-white/8 px-1.5 py-0.5 text-[10px] text-white/25 hover:text-white/55`,children:`•••`}),n&&(0,b.jsxs)(`div`,{className:`absolute right-0 top-full z-30 mt-1 w-64 rounded-lg border border-white/10 bg-[#18181d] p-1 shadow-2xl`,children:[!i&&m.filter(([e])=>e!==`retry`||t.status===`failed`).map(([e,t])=>(0,b.jsx)(`button`,{disabled:c,onClick:()=>p(e),className:`block w-full rounded-md px-3 py-2 text-left text-xs hover:bg-white/5 ${e===`cancel`?`text-rose-300/60`:`text-white/60`}`,children:t},e)),i&&i!==`retry`&&(0,b.jsxs)(`div`,{className:`p-2`,children:[(0,b.jsx)(`p`,{className:`mb-2 text-[10px] font-medium uppercase tracking-wide text-white/30`,children:m.find(([e])=>e===i)?.[1]}),i===`priority`?(0,b.jsxs)(`select`,{value:o,onChange:e=>s(e.target.value),className:`w-full rounded-md border border-white/10 bg-black/30 px-2 py-1.5 text-xs text-white/60`,children:[(0,b.jsx)(`option`,{value:`high`,children:`High`}),(0,b.jsx)(`option`,{value:`normal`,children:`Normal`}),(0,b.jsx)(`option`,{value:`low`,children:`Low`})]}):(0,b.jsx)(`textarea`,{autoFocus:!0,value:o,onChange:e=>s(e.target.value),rows:2,placeholder:i===`reassign`?`New owner or assignment guidance…`:i===`cancel`?`Reason for cancellation…`:`Context for the replacement worker…`,className:`w-full resize-none rounded-md border border-white/10 bg-black/20 p-2 text-xs text-white/60 outline-none placeholder:text-white/20`}),(0,b.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,b.jsx)(`button`,{onClick:()=>{a(null),s(``)},className:`text-[10px] text-white/30`,children:`Back`}),(0,b.jsx)(`button`,{disabled:c||i===`reassign`&&!o.trim(),onClick:()=>f(),className:`rounded-md px-2 py-1.5 text-[10px] text-white disabled:opacity-35 ${i===`cancel`?`bg-rose-500/60`:`bg-violet-500/70`}`,children:c?`Sending…`:i===`cancel`?`Confirm cancel`:`Send control`})]})]}),u&&(0,b.jsx)(`p`,{className:`px-3 py-2 text-[10px] text-rose-400`,children:u})]})]})}function qr({missionId:e}){let[t,n]=(0,g.useState)(!1),[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)(!1),[s,c]=(0,g.useState)(null);async function l(){if(r.trim()){o(!0),c(null);try{await le(e,r),n(!1),i(``)}catch(e){c(e.message)}finally{o(!1)}}}return(0,b.jsxs)(`div`,{className:`relative`,children:[(0,b.jsx)(`button`,{onClick:()=>n(!t),className:`rounded-md border border-white/8 px-2 py-1 text-[10px] text-white/35 hover:text-white/60`,children:`+ Add task`}),t&&(0,b.jsxs)(`div`,{className:`absolute left-0 top-full z-30 mt-1 w-72 rounded-lg border border-white/10 bg-[#18181d] p-3 shadow-2xl`,children:[(0,b.jsx)(`textarea`,{autoFocus:!0,value:r,onChange:e=>i(e.target.value),rows:3,placeholder:`Describe the task, outcome, or changed priority…`,className:`w-full resize-none rounded-md border border-white/10 bg-black/20 p-2 text-xs text-white/60 outline-none placeholder:text-white/20`}),(0,b.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,b.jsx)(`button`,{onClick:()=>n(!1),className:`text-[10px] text-white/30`,children:`Cancel`}),(0,b.jsx)(`button`,{disabled:!r.trim()||a,onClick:l,className:`rounded-md bg-violet-500/70 px-2 py-1.5 text-[10px] text-white disabled:opacity-35`,children:a?`Sending…`:`Add through orchestrator`})]}),s&&(0,b.jsx)(`p`,{className:`mt-2 text-[10px] text-rose-400`,children:s})]})]})}var Jr={queued:`#64748b`,working:`#fbbf24`,blocked:`#fb7185`,reviewing:`#a78bfa`,completed:`#34d399`,failed:`#ef4444`,cancelled:`#475569`};function Yr(e){return e.phases.flatMap(e=>tt(e.tasks).map(t=>({id:t.id,title:t.title,status:t.status,dependsOn:t.dependsOn,worker:t.owner??t.workerId,weight:t.weight,phase:e.title})))}function Xr({plan:e}){let t=(0,g.useMemo)(()=>Yr(e),[e]),[n,r]=(0,g.useState)(),i=(0,g.useMemo)(()=>{let e=new Map(t.map(e=>[e.id,e])),n=new Map,r=new Set,i=t=>{if(n.has(t))return n.get(t);if(r.has(t))return 0;r.add(t);let a=e.get(t),o=a?.dependsOn.length?1+Math.max(0,...a.dependsOn.filter(t=>e.has(t)).map(i)):0;return r.delete(t),n.set(t,o),o},a=new Map;t.forEach(e=>{let t=i(e.id);a.set(t,[...a.get(t)??[],e])});let o=new Map;[...a].sort(([e],[t])=>e-t).forEach(([e,t])=>t.forEach((t,n)=>o.set(t.id,{x:30+e*230,y:30+n*92})));let s=new Map,c=new Map;[...t].sort((e,t)=>i(e.id)-i(t.id)).forEach(e=>{let t=0;for(let n of e.dependsOn)(s.get(n)??0)>t&&(t=s.get(n),c.set(e.id,n));s.set(e.id,t+Math.max(1,e.weight))});let l=[...t].sort((e,t)=>(s.get(t.id)??0)-(s.get(e.id)??0))[0]?.id,u=new Set;for(;l;)u.add(l),l=c.get(l);return{byId:e,positions:o,critical:u,width:Math.max(480,60+(Math.max(0,...a.keys())+1)*230),height:Math.max(160,60+Math.max(1,...[...a.values()].map(e=>e.length))*92)}},[t]),a=n?i.byId.get(n):void 0;return t.length?(0,b.jsxs)(`div`,{className:`px-5 py-4`,children:[(0,b.jsxs)(`div`,{className:`mb-2 flex flex-wrap gap-3 text-[9px] text-white/25`,children:[(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`span`,{className:`text-amber-300`,children:`━`}),` critical path`]}),(0,b.jsx)(`span`,{children:`Click a task for details`})]}),(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-white/[0.06] bg-black/15`,children:(0,b.jsxs)(`svg`,{width:i.width,height:i.height,role:`img`,"aria-label":`Task dependency graph`,children:[t.flatMap(e=>e.dependsOn.map(t=>{let n=i.positions.get(t),r=i.positions.get(e.id);if(!n||!r)return null;let a=i.critical.has(t)&&i.critical.has(e.id);return(0,b.jsx)(`path`,{d:`M ${n.x+174} ${n.y+26} C ${n.x+202} ${n.y+26}, ${r.x-28} ${r.y+26}, ${r.x} ${r.y+26}`,fill:`none`,stroke:a?`#fbbf24`:`rgba(255,255,255,.12)`,strokeWidth:a?2:1},`${t}:${e.id}`)})),t.map(e=>{let t=i.positions.get(e.id),a=n===e.id;return(0,b.jsxs)(`g`,{transform:`translate(${t.x} ${t.y})`,onClick:()=>r(e.id),className:`cursor-pointer`,children:[(0,b.jsx)(`rect`,{width:`174`,height:`54`,rx:`10`,fill:a?`rgba(255,255,255,.08)`:`#15151a`,stroke:i.critical.has(e.id)?`#fbbf24`:a?`#a78bfa`:`rgba(255,255,255,.1)`}),(0,b.jsx)(`circle`,{cx:`12`,cy:`16`,r:`3`,fill:Jr[e.status]}),(0,b.jsx)(`text`,{x:`21`,y:`19`,fill:`rgba(255,255,255,.72)`,fontSize:`11`,children:e.title.length>22?`${e.title.slice(0,21)}…`:e.title}),(0,b.jsxs)(`text`,{x:`12`,y:`39`,fill:`rgba(255,255,255,.25)`,fontSize:`9`,children:[e.worker?`${e.worker} · `:``,et(e.status).toLowerCase()]})]},e.id)})]})}),a&&(0,b.jsxs)(`div`,{className:`mt-3 rounded-lg border border-violet-300/10 bg-violet-300/[0.025] px-3 py-2 text-[10px] text-white/40`,children:[(0,b.jsx)(`span`,{className:`font-medium text-white/65`,children:a.title}),` · `,a.phase,` · weight `,a.weight,a.worker?` · ${a.worker}`:``,a.dependsOn.length?` · blocked by ${a.dependsOn.map(e=>i.byId.get(e)?.title??e).join(`, `)}`:` · no dependencies`,i.critical.has(a.id)?` · critical path`:``]})]}):(0,b.jsx)(`p`,{className:`px-5 py-8 text-center text-xs text-white/25`,children:`Add tasks to see their dependency graph.`})}var Zr={queued:`bg-slate-500`,working:`bg-amber-400`,blocked:`bg-rose-400`,reviewing:`bg-violet-400`,completed:`bg-emerald-400`,failed:`bg-red-500`,cancelled:`bg-slate-600`},Qr={queued:`border-l-slate-500/45`,working:`border-l-amber-400/70`,blocked:`border-l-rose-400/70`,reviewing:`border-l-violet-400/70`,completed:`border-l-emerald-400/45`,failed:`border-l-red-500/70`,cancelled:`border-l-slate-600/45`};function $r({status:e}){return(0,b.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1.5 text-[10px] font-medium uppercase tracking-wide text-white/35`,children:[(0,b.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full ${Zr[e]}`}),et(e)]})}function ei(e){let t=nt(e.tasks).filter(e=>e.status!==`cancelled`),n=t.reduce((e,t)=>e+t.weight,0),r=t.filter(e=>e.status===`completed`).reduce((e,t)=>e+t.weight,0);return{completed:t.filter(e=>e.status===`completed`).length,total:t.length,percent:n?Math.round(r/n*100):void 0}}function ti(e){if(!e.startedAt)return;let t=e.updatedAt??Date.now(),n=Math.max(0,Math.floor((t-e.startedAt)/6e4));return n<60?`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function ni(e){let t=Math.max(0,Math.floor((Date.now()-e)/1e3));if(t<60)return`just now`;let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function ri(e,t){return t.get(e)?.title??e}function G({id:e,lookup:t,indexById:n}){let r=t.get(e),i=r?.status===`completed`||r?.status===`cancelled`,a=n.get(e);return(0,b.jsxs)(`span`,{title:r?.title??e,className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 font-mono text-[9px] ${i?`bg-emerald-300/[0.06] text-emerald-200/45`:`bg-white/[0.05] text-white/45`}`,children:[i?`✓`:`○`,` `,a===void 0?e:`#${a}`]})}function ii({missionId:e,task:t,lookup:n,indexById:r,compact:i=!1}){let a=ti(t),o=[...n.values()].filter(e=>e.dependsOn.includes(t.id)),s=t.assignment??t.description,c=t.dependsOn.filter(e=>{let t=n.get(e);return t&&t.status!==`completed`&&t.status!==`cancelled`}).length,l=!!(t.role||a||t.updatedAt||t.branch||t.worktree||t.testState||t.dependsOn.length||o.length||t.changedFiles?.length||t.evidence.length);return(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{className:`rounded-lg border border-l-2 px-3 py-2.5 ${Qr[t.status]} ${t.status===`blocked`||t.status===`failed`?`border-rose-400/15 bg-rose-400/[0.025]`:`border-white/[0.06] bg-white/[0.018]`}`,children:[(0,b.jsxs)(`div`,{className:`flex gap-3 ${i?`flex-col`:`items-start justify-between`}`,children:[(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsxs)(`p`,{className:`text-xs font-medium ${t.status===`completed`?`text-white/35 line-through`:`text-white/70`}`,children:[(0,b.jsxs)(`span`,{title:`Task ${r.get(t.id)} of ${r.size} (numbered across all phases)`,className:`mr-1.5 font-mono text-[9px] font-normal text-white/25`,children:[`#`,r.get(t.id)]}),t.title]}),s&&(0,b.jsxs)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-white/32`,children:[(0,b.jsx)(`span`,{className:`text-white/20`,children:`Deliverable:`}),` `,s]})]}),(0,b.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,b.jsx)($r,{status:t.status}),(0,b.jsx)(Kr,{missionId:e,task:t})]})]}),(0,b.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-[10px] text-white/30`,children:[t.owner||t.workerId?(0,b.jsxs)(`span`,{className:`text-violet-200/55`,children:[`Owner: `,t.owner??t.workerId]}):(0,b.jsx)(`span`,{children:`Unassigned`}),t.dependsOn.length>0&&(0,b.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-1`,children:[t.status!==`completed`&&c>0?`Waiting on ${c} of`:`After`,t.dependsOn.map(e=>(0,b.jsx)(G,{id:e,lookup:n,indexById:r},e))]}),o.length>0&&(0,b.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-1`,children:[`Unblocks →`,o.map(e=>(0,b.jsx)(G,{id:e.id,lookup:n,indexById:r},e.id))]}),t.updatedAt&&(0,b.jsxs)(`span`,{children:[`Updated `,ni(t.updatedAt)]})]}),t.status===`blocked`&&(0,b.jsxs)(`div`,{className:`mt-2 rounded-md border border-rose-400/10 bg-rose-400/[0.04] px-2.5 py-2 text-[10px] leading-relaxed`,children:[(0,b.jsx)(`p`,{className:`text-rose-200/65`,children:t.blocker??`This task is blocked.`}),t.unblock&&(0,b.jsxs)(`p`,{className:`mt-1 text-white/35`,children:[`To unblock: `,t.unblock]})]}),l&&(0,b.jsxs)(`details`,{className:`mt-2 border-t border-white/[0.05] pt-2`,children:[(0,b.jsx)(`summary`,{className:`cursor-pointer select-none text-[10px] text-white/25 transition hover:text-white/50`,children:`Operational details`}),(0,b.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1 text-[9px] text-white/28`,children:[t.role&&(0,b.jsxs)(`span`,{children:[`Role: `,t.role.replaceAll(`_`,` `)]}),a&&(0,b.jsxs)(`span`,{children:[`Duration: `,a]}),t.branch&&(0,b.jsxs)(`span`,{className:`mono`,children:[`Branch: `,t.branch]}),t.worktree&&(0,b.jsxs)(`span`,{className:`mono truncate`,title:t.worktree,children:[`Worktree: `,t.worktree]}),t.testState&&(0,b.jsxs)(`span`,{className:t.testState===`passed`?`text-emerald-300/50`:t.testState===`failed`?`text-rose-300/55`:``,children:[`Tests: `,t.testState.replaceAll(`_`,` `)]})]}),t.changedFiles?.length?(0,b.jsx)(`div`,{className:`mono mt-2 flex flex-wrap gap-1`,children:t.changedFiles.map(e=>(0,b.jsx)(`span`,{title:e,className:`max-w-56 truncate rounded bg-white/[0.035] px-1.5 py-1 text-[9px] text-white/30`,children:e},e))}):null,t.evidence.length>0&&(0,b.jsx)(`ul`,{className:`mt-2 space-y-1`,children:t.evidence.map((e,t)=>(0,b.jsxs)(`li`,{className:`text-[10px] text-emerald-100/45`,children:[`✓ `,e]},t))})]})]}),t.subtasks?.length?(0,b.jsx)(`div`,{className:`ml-4 mt-1 space-y-1 border-l border-white/[0.07] pl-3`,children:t.subtasks.map(t=>(0,b.jsx)(ii,{missionId:e,task:t,lookup:n,indexById:r,compact:i},t.id))}):null]})}function ai({title:e,tone:t,empty:n,tasks:r,lookup:i}){return(0,b.jsxs)(`div`,{className:`min-w-0 rounded-xl border p-3 ${{amber:`border-amber-300/10 bg-amber-300/[0.025] text-amber-200/60`,violet:`border-violet-300/10 bg-violet-300/[0.025] text-violet-200/60`,rose:`border-rose-300/10 bg-rose-300/[0.025] text-rose-200/65`}[t]}`,children:[(0,b.jsx)(`p`,{className:`text-[9px] font-semibold uppercase tracking-[0.16em]`,children:e}),r.length?(0,b.jsx)(`ul`,{className:`mt-2 space-y-2`,children:r.slice(0,3).map(e=>(0,b.jsxs)(`li`,{className:`text-[11px] leading-snug text-white/60`,children:[(0,b.jsx)(`span`,{className:`font-medium text-white/75`,children:e.title}),(e.owner||e.workerId)&&(0,b.jsx)(`span`,{className:`block text-[9px] text-white/28`,children:e.owner??e.workerId}),t===`rose`&&(0,b.jsx)(`span`,{className:`block text-[9px] text-rose-200/45`,children:e.blocker??(e.status===`failed`?`Task failed`:e.dependsOn.length?`Waiting for ${e.dependsOn.map(e=>ri(e,i)).join(`, `)}`:`Needs intervention`)})]},e.id))}):(0,b.jsx)(`p`,{className:`mt-2 text-[10px] text-white/25`,children:n}),r.length>3&&(0,b.jsxs)(`p`,{className:`mt-2 text-[9px] text-white/20`,children:[`+`,r.length-3,` more`]})]})}function oi({missionId:e,plan:t,objective:n,missionAcceptanceCriteria:r=[],workers:i=[],missionUpdatedAt:a,compact:o=!1,approvalRequired:s=!1}){let[c,l]=(0,g.useState)(()=>new Set(t?.phases.filter(e=>e.status===`completed`||e.status===`queued`).map(e=>e.id)??[])),[u,d]=(0,g.useState)(`plan`),f=(0,g.useMemo)(()=>rt(t),[t]),p=(0,g.useMemo)(()=>new Map(f.map(e=>[e.id,e])),[f]),m=(0,g.useMemo)(()=>new Map(f.map((e,t)=>[e.id,t+1])),[f]);if(!t)return(0,b.jsxs)(`section`,{className:`mb-6 overflow-hidden rounded-2xl border border-dashed border-white/10 bg-white/[0.018]`,children:[(0,b.jsx)(`div`,{className:`px-5 py-5`,children:(0,b.jsxs)(`div`,{className:`flex gap-4 ${o?`flex-col items-start`:`items-center justify-between`}`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h2`,{className:`text-sm font-semibold text-white/75`,children:`Mission plan`}),(0,b.jsx)(`p`,{className:`mt-1 text-xs text-white/30`,children:`Waiting for the orchestrator to publish a structured plan.`}),n&&(0,b.jsxs)(`p`,{className:`mt-3 text-sm leading-relaxed text-white/55`,children:[(0,b.jsx)(`span`,{className:`text-white/25`,children:`Goal:`}),` `,n]})]}),(0,b.jsx)(`span`,{className:`rounded-full bg-white/[0.04] px-2.5 py-1 text-[10px] uppercase tracking-wider text-white/25`,children:`Not published`})]})}),(0,b.jsx)(Hr,{missionId:e,gates:[]})]});let h=t.phases.find(e=>e.status===`working`||e.status===`reviewing`||e.status===`blocked`),_=t.phases.find(e=>e.status===`queued`),v=f.filter(e=>e.status===`working`||e.status===`reviewing`),y=f.filter(e=>e.status===`queued`&&e.dependsOn.every(e=>p.get(e)?.status===`completed`)),x=f.filter(e=>e.status===`blocked`||e.status===`failed`),S=t.phases.filter(e=>e.status===`completed`).length,C=(t.gates??[]).filter(e=>e.status===`satisfied`||e.status===`waived`).length,w=i.filter(e=>!e.doneAt&&(e.jobState===`working`||e.jobState===`busy`)),T=new Set(v.flatMap(e=>[e.workerId,e.owner].filter(Boolean))),E=w.filter(e=>!T.has(e.id)&&!T.has(e.jobId)),D=w.length>0&&a&&a>t.updatedAt+3e5,O=E.length>0?`${E.length} active worker${E.length===1?` is`:`s are`} not represented in current plan activity.`:D?`Mission activity is newer than this plan; a revision may be needed.`:void 0,k=f.flatMap(e=>e.evidence.map(t=>({task:e.title,item:t}))).slice(-5).reverse();return(0,b.jsxs)(`section`,{className:`mb-6 overflow-hidden rounded-2xl border border-white/10 bg-[#101014]`,children:[(0,b.jsxs)(`div`,{className:`border-b border-white/8 px-5 py-4`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Plan at a glance`}),(0,b.jsx)(Wr,{missionId:e,currentRevision:t.revision}),(0,b.jsx)(qr,{missionId:e})]}),(0,b.jsxs)(`p`,{className:`mt-3 max-w-4xl text-sm leading-relaxed text-white/65`,children:[(0,b.jsx)(`span`,{className:`mr-2 text-[10px] font-semibold uppercase tracking-wider text-amber-200/45`,children:`Goal`}),n??`No mission objective has been recorded.`]}),(0,b.jsx)(Gr,{missionId:e,plan:t,required:s})]}),(0,b.jsxs)(`div`,{className:`shrink-0 text-right`,children:[(0,b.jsxs)(`p`,{className:`text-2xl font-semibold text-amber-300`,children:[t.progress.percent??`—`,t.progress.percent!==void 0&&`%`]}),(0,b.jsx)(`p`,{className:`text-[9px] uppercase tracking-wider text-white/25`,children:`weighted progress`})]})]}),(0,b.jsx)(`div`,{className:`mt-4 h-1.5 overflow-hidden rounded-full bg-white/[0.06]`,children:(0,b.jsx)(`div`,{className:`h-full rounded-full bg-gradient-to-r from-amber-400 to-violet-400 transition-all`,style:{width:`${t.progress.percent??0}%`}})}),(0,b.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-4 gap-y-1 text-[10px] text-white/30`,children:[(0,b.jsxs)(`span`,{children:[t.progress.completedTasks,`/`,t.progress.totalTasks,` tasks`]}),(0,b.jsxs)(`span`,{children:[S,`/`,t.phases.length,` phases`]}),(0,b.jsxs)(`span`,{children:[C,`/`,t.gates?.length??0,` gates`]}),(0,b.jsxs)(`span`,{children:[`Current: `,h?.title??(t.progress.percent===100?`Complete`:`None active`)]}),(0,b.jsxs)(`span`,{children:[`Next: `,_?.milestone??_?.title??`Not scheduled`]})]}),(0,b.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-[10px] text-white/25`,children:[(0,b.jsxs)(`span`,{children:[`Updated `,ni(t.updatedAt)]}),(0,b.jsx)(`span`,{children:`·`}),(0,b.jsxs)(`span`,{children:[`Revision `,t.revision]}),O&&(0,b.jsxs)(`span`,{className:`rounded-md border border-amber-300/10 bg-amber-300/[0.04] px-2 py-1 text-amber-100/50`,children:[`⚠ `,O]})]}),(0,b.jsx)(`div`,{className:`inline-flex rounded-lg border border-white/[0.06] bg-black/15 p-0.5`,children:[[`plan`,`Plan`],[`dependencies`,`Dependencies`]].map(([e,t])=>(0,b.jsx)(`button`,{onClick:()=>d(e),className:`cursor-pointer rounded-md px-2.5 py-1 text-[9px] font-medium uppercase tracking-wider transition ${u===e?`bg-white/[0.08] text-white/65`:`text-white/25 hover:bg-white/[0.03] hover:text-white/45`}`,children:t},e))})]})]}),(0,b.jsxs)(`div`,{className:`grid gap-2 border-b border-white/[0.06] p-4 ${o?``:`md:grid-cols-3`}`,children:[(0,b.jsx)(ai,{title:`Now`,tone:`amber`,tasks:v,empty:`No task is actively running.`,lookup:p}),(0,b.jsx)(ai,{title:`Next`,tone:`violet`,tasks:y,empty:t.progress.percent===100?`All planned work is complete.`:`No unblocked task is queued.`,lookup:p}),(0,b.jsx)(ai,{title:`Needs attention`,tone:`rose`,tasks:x,empty:`No blockers or failed tasks.`,lookup:p})]}),u===`dependencies`&&(0,b.jsx)(Xr,{plan:t}),u===`plan`&&(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b border-white/[0.06] px-5 pt-4 pb-2`,children:[(0,b.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-wider text-white/35`,children:t.layout===`flat`?`Tasks`:`Phases`}),(0,b.jsx)(`p`,{className:`text-[9px] text-white/20`,children:t.layout===`flat`?`${f.length} task${f.length===1?``:`s`}`:`${t.phases.length} phase${t.phases.length===1?``:`s`} · tasks numbered #1–#${f.length} across all phases`})]}),u===`plan`&&(0,b.jsx)(`div`,{className:`divide-y divide-white/[0.06]`,children:t.phases.map((n,r)=>{let i=c.has(n.id),a=ei(n);return t.layout===`flat`?(0,b.jsxs)(`div`,{className:`space-y-1 px-5 py-4`,children:[n.tasks.map(t=>(0,b.jsx)(ii,{missionId:e,task:t,lookup:p,indexById:m,compact:o},t.id)),n.tasks.length===0&&(0,b.jsx)(`p`,{className:`py-2 text-xs text-white/25`,children:`No tasks yet.`})]},n.id):(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`button`,{onClick:()=>l(e=>{let t=new Set(e);return t.has(n.id)?t.delete(n.id):t.add(n.id),t}),className:`flex w-full cursor-pointer items-center justify-between gap-4 px-5 py-3.5 text-left transition hover:bg-white/[0.025]`,children:[(0,b.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,b.jsx)(`span`,{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-amber-300/[0.07] text-[10px] font-semibold text-amber-200/60`,children:r+1}),(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`p`,{className:`truncate text-sm font-medium text-white/80`,children:n.title}),n.milestone&&(0,b.jsxs)(`span`,{className:`truncate rounded-full border border-amber-300/10 bg-amber-300/[0.04] px-2 py-0.5 text-[9px] text-amber-200/45`,children:[`◆ `,n.milestone]})]}),(0,b.jsxs)(`div`,{className:`mt-1 flex items-center gap-2`,children:[(0,b.jsx)(`div`,{className:`h-1 w-20 overflow-hidden rounded-full bg-white/[0.06]`,children:(0,b.jsx)(`div`,{className:`h-full rounded-full bg-amber-300/60`,style:{width:`${a.percent??0}%`}})}),(0,b.jsxs)(`p`,{className:`text-[10px] text-white/25`,children:[a.completed,`/`,a.total,` tasks`,a.percent===void 0?``:` · ${a.percent}%`]})]})]})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,b.jsx)($r,{status:n.status}),(0,b.jsx)(`span`,{className:`text-xs text-white/25`,children:i?`+`:`−`})]})]}),!i&&(0,b.jsxs)(`div`,{className:o?`px-4 pb-4`:`px-5 pb-4 pl-14`,children:[n.description&&(0,b.jsx)(`p`,{className:`mb-3 text-xs leading-relaxed text-white/40`,children:n.description}),n.acceptanceCriteria.length>0&&(0,b.jsxs)(`div`,{className:`mb-3 rounded-lg border border-emerald-300/10 bg-emerald-300/[0.02] p-3`,children:[(0,b.jsx)(`p`,{className:`text-[9px] font-semibold uppercase tracking-wider text-emerald-200/45`,children:`Definition of done`}),(0,b.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:n.acceptanceCriteria.map((e,t)=>(0,b.jsxs)(`li`,{className:`flex gap-2 text-[10px] leading-relaxed text-white/45`,children:[(0,b.jsx)(`span`,{className:n.status===`completed`?`text-emerald-300/70`:`text-white/20`,children:n.status===`completed`?`✓`:`○`}),e]},t))})]}),(0,b.jsxs)(`div`,{className:`space-y-1`,children:[n.tasks.map(t=>(0,b.jsx)(ii,{missionId:e,task:t,lookup:p,indexById:m,compact:o},t.id)),n.tasks.length===0&&(0,b.jsx)(`p`,{className:`py-2 text-xs text-white/25`,children:`No tasks in this phase.`})]})]})]},n.id)})}),r.length>0&&(0,b.jsxs)(`div`,{className:`border-t border-white/[0.06] px-5 py-4`,children:[(0,b.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-wider text-white/35`,children:`Mission acceptance criteria`}),(0,b.jsx)(`ul`,{className:`mt-2 grid gap-1.5 ${o?``:`sm:grid-cols-2`}`,children:r.map((e,t)=>(0,b.jsxs)(`li`,{className:`flex gap-2 text-[11px] text-white/45`,children:[(0,b.jsx)(`span`,{className:`text-amber-200/40`,children:`◇`}),e]},t))})]}),(0,b.jsx)(Hr,{missionId:e,gates:t.gates??[]}),k.length>0&&(0,b.jsxs)(`div`,{className:`border-t border-white/[0.06] px-5 py-4`,children:[(0,b.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,b.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-wider text-emerald-300/50`,children:`Recent evidence`}),(0,b.jsx)(`span`,{className:`text-[9px] text-white/20`,children:`Reported by the plan`})]}),(0,b.jsx)(`ul`,{className:`space-y-1.5`,children:k.map(({task:e,item:t},n)=>(0,b.jsxs)(`li`,{className:`flex gap-2 text-[11px] leading-relaxed text-white/45`,children:[(0,b.jsx)(`span`,{className:`text-emerald-400/70`,children:`✓`}),(0,b.jsxs)(`span`,{children:[(0,b.jsxs)(`span`,{className:`text-white/25`,children:[e,`:`]}),` `,t]})]},`${e}:${t}:${n}`))})]})]})}function si(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m ${t%60}s`:`${Math.floor(n/60)}h ${n%60}m`}function ci(e,t){if(!e)return!1;let n=e.toLowerCase();return n===t.id.toLowerCase()||n===t.label.toLowerCase()||t.id.toLowerCase().startsWith(n)||t.label.toLowerCase().includes(n)}function li(e,t){let n=rt(e);return n.find(e=>ci(e.workerId,t))??n.find(e=>e.title.toLowerCase()===t.label.toLowerCase())}function ui({missionId:e,worker:t,plan:n,events:r,onClose:i}){let[a,o]=(0,g.useState)(Date.now()),[s,c]=(0,g.useState)(``),[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(null);(0,g.useEffect)(()=>{let e=setInterval(()=>o(Date.now()),1e3);return()=>clearInterval(e)},[]);let p=(0,g.useMemo)(()=>li(n,t),[n,t]),m=(0,g.useMemo)(()=>r.filter(e=>ci(e.targetWorker,t)).sort((e,t)=>t.ts-e.ts),[r,t]),h=(0,g.useMemo)(()=>({filesRead:[...new Set(m.filter(e=>e.activityKind===`file_read`).map(e=>e.filePath).filter(e=>!!e))],filesChanged:[...new Set(m.filter(e=>e.activityKind===`file_write`).map(e=>e.filePath).filter(e=>!!e))],commands:[...new Set(m.filter(e=>e.activityKind===`command`).map(e=>e.command).filter(e=>!!e))],tests:[...new Set(m.filter(e=>e.activityKind===`test`).map(e=>e.command).filter(e=>!!e))],outputs:[...new Set(m.filter(e=>e.activityKind===`output`).map(e=>e.artifactPath??e.detail).filter(Boolean))]}),[m]),_=m[0],v=t.doneAt??(t.jobState===`working`||t.jobState===`busy`?a:t.jobUpdatedAt??a),y=t.doneAt?`Completed`:t.jobState===`working`||t.jobState===`busy`?`Working`:`Ended`,x=Math.max(t.updatedAt??0,t.jobUpdatedAt??0,_?.ts??0),S=t.terminationReason??(t.doneAt?`Worker reported completion`:y===`Working`?`Still running`:`Parent job ended with state: ${t.jobState}`);async function C(){let n=s.trim();if(!n||l)return;u(!0),f(null);let r=p?`worker ${t.label} on plan task ${p.id} (${p.title})`:`worker ${t.label} (${t.id})`;try{await I(e,`Guidance for ${r}:\n\n${n}`),c(``)}catch(e){f(e.message)}finally{u(!1)}}return(0,b.jsx)(ke,{label:`Worker details: ${t.label}`,eyebrow:`Worker inspection`,title:t.label,subtitle:(0,b.jsxs)(`span`,{className:`mono`,children:[t.id,` · job `,t.jobId.slice(0,8)]}),onClose:i,closeLabel:`Close worker details`,children:(0,b.jsxs)(`div`,{className:`space-y-5 p-6`,children:[(0,b.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[`State`,y],[`Elapsed`,si(v-t.startedAt)],[`Role`,p?.role?.replaceAll(`_`,` `)??t.kind]].map(([e,t])=>(0,b.jsxs)(`div`,{className:`rounded-xl border border-white/8 bg-white/[0.025] p-3`,children:[(0,b.jsx)(`p`,{className:`truncate text-sm font-semibold capitalize text-white/75`,title:t,children:t}),(0,b.jsx)(`p`,{className:`mt-1 text-[9px] uppercase tracking-wider text-white/25`,children:e})]},e))}),(0,b.jsxs)(`section`,{className:`rounded-xl border border-white/8 bg-white/[0.02] p-4`,children:[(0,b.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-white/40`,children:`Assignment`}),p?(0,b.jsxs)(`div`,{className:`mt-3`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-violet-200/75`,children:p.title}),(0,b.jsx)(`span`,{className:`text-[9px] uppercase text-white/25`,children:p.status})]}),(0,b.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-white/55`,children:p.assignment??p.description??t.label}),p.context&&(0,b.jsxs)(`div`,{className:`mt-3 border-t border-white/[0.06] pt-3`,children:[(0,b.jsx)(`p`,{className:`text-[9px] uppercase tracking-wide text-white/25`,children:`Delegated context`}),(0,b.jsx)(`p`,{className:`mt-1.5 text-xs leading-relaxed text-white/40`,children:p.context})]}),p.status===`blocked`&&(p.blocker||p.unblock)&&(0,b.jsxs)(`div`,{className:`mt-3 rounded-lg border border-rose-400/10 bg-rose-400/[0.04] p-2.5`,children:[(0,b.jsx)(`p`,{className:`text-xs text-rose-200/60`,children:p.blocker??`Task is blocked`}),p.unblock&&(0,b.jsxs)(`p`,{className:`mt-1 text-[10px] text-white/35`,children:[`Unblock by: `,p.unblock]})]}),p.dependsOn.length>0&&(0,b.jsxs)(`p`,{className:`mt-2 text-[10px] text-white/25`,children:[`Depends on: `,p.dependsOn.join(`, `)]})]}):(0,b.jsx)(`p`,{className:`mt-3 text-xs text-white/25`,children:`No structured plan task is linked to this worker yet.`})]}),(0,b.jsxs)(`section`,{className:`rounded-xl border border-white/8 bg-white/[0.02] p-4`,children:[(0,b.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-white/40`,children:`Runtime`}),(0,b.jsxs)(`dl`,{className:`mt-3 grid grid-cols-[110px_1fr] gap-y-2 text-xs`,children:[(0,b.jsx)(`dt`,{className:`text-white/25`,children:`Started`}),(0,b.jsx)(`dd`,{className:`text-white/55`,children:new Date(t.startedAt).toLocaleString()}),(0,b.jsx)(`dt`,{className:`text-white/25`,children:`Elapsed`}),(0,b.jsx)(`dd`,{className:`text-white/55`,children:si(v-t.startedAt)}),(0,b.jsx)(`dt`,{className:`text-white/25`,children:`Last update`}),(0,b.jsx)(`dd`,{className:`text-white/55`,children:x?`${new Date(x).toLocaleString()} · ${si(a-x)} ago`:`Not reported`}),(0,b.jsx)(`dt`,{className:`text-white/25`,children:`Latest activity`}),(0,b.jsx)(`dd`,{className:`text-white/55`,children:_?_.command??_.filePath??_.detail:`No targeted report`}),(0,b.jsx)(`dt`,{className:`text-white/25`,children:`Termination`}),(0,b.jsx)(`dd`,{className:`text-white/55`,children:S}),(0,b.jsx)(`dt`,{className:`text-white/25`,children:`Token usage`}),(0,b.jsx)(`dd`,{className:t.tokens===void 0?`text-white/30`:`text-white/55`,children:t.tokens===void 0?`Not exposed per worker by this Claude CLI record`:t.tokens.toLocaleString()})]})]}),p?.evidence.length?(0,b.jsxs)(`section`,{className:`rounded-xl border border-emerald-400/10 bg-emerald-400/[0.025] p-4`,children:[(0,b.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-emerald-300/55`,children:`Evidence`}),(0,b.jsx)(`ul`,{className:`mt-3 space-y-2`,children:p.evidence.map((e,t)=>(0,b.jsxs)(`li`,{className:`flex gap-2 text-xs leading-relaxed text-white/55`,children:[(0,b.jsx)(`span`,{className:`text-emerald-400`,children:`✓`}),e]},t))})]}):null,(0,b.jsxs)(`section`,{className:`rounded-xl border border-white/8 bg-white/[0.02] p-4`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,b.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-white/40`,children:`Observed work`}),(0,b.jsx)(`span`,{className:`text-[10px] text-white/20`,children:`From attributed hooks`})]}),(0,b.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-2`,children:[[`Files read`,h.filesRead],[`Files changed`,h.filesChanged],[`Commands`,h.commands],[`Tests`,h.tests],[`Outputs`,h.outputs]].map(([e,t])=>(0,b.jsxs)(`div`,{className:`${e===`Outputs`?`col-span-2`:``} rounded-lg border border-white/[0.06] bg-black/10 p-3`,children:[(0,b.jsxs)(`p`,{className:`text-[9px] font-medium uppercase tracking-wide text-white/25`,children:[e,` · `,t.length]}),t.length?(0,b.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:t.slice(0,6).map(e=>(0,b.jsx)(`li`,{title:e,className:`mono truncate text-[10px] text-white/50`,children:e},e))}):(0,b.jsx)(`p`,{className:`mt-2 text-[10px] text-white/18`,children:`None reported`})]},e))})]}),(0,b.jsxs)(`section`,{children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,b.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-white/40`,children:`Worker activity`}),(0,b.jsxs)(`span`,{className:`text-[10px] text-white/20`,children:[m.length,` events`]})]}),m.length?(0,b.jsx)(`div`,{className:`mt-3 space-y-2`,children:m.map((e,t)=>(0,b.jsxs)(`div`,{className:`rounded-lg border border-white/[0.06] bg-white/[0.018] p-3`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between text-[9px] uppercase tracking-wide text-white/25`,children:[(0,b.jsx)(`span`,{children:e.phase??e.hookEventName??`activity`}),(0,b.jsx)(`span`,{children:new Date(e.ts).toLocaleTimeString()})]}),(0,b.jsx)(`p`,{className:`mt-1.5 text-xs leading-relaxed text-white/55`,children:e.detail})]},`${e.ts}:${t}`))}):(0,b.jsx)(`p`,{className:`mt-3 rounded-lg border border-dashed border-white/8 px-3 py-5 text-center text-xs text-white/25`,children:`No targeted activity reports were recorded for this worker.`})]}),(0,b.jsxs)(`section`,{className:`rounded-xl border border-violet-400/10 bg-violet-400/[0.025] p-4`,children:[(0,b.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-violet-300/55`,children:`Guide this worker`}),(0,b.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-white/30`,children:`Guidance is sent through the orchestrator, which remains responsible for relaying or revising the task.`}),(0,b.jsx)(`textarea`,{value:s,onChange:e=>c(e.target.value),rows:3,placeholder:`Clarify scope, suggest an approach, or change a requirement…`,className:`mt-3 w-full resize-none rounded-lg border border-white/10 bg-black/20 p-2.5 text-xs text-white/70 outline-none placeholder:text-white/20 focus:border-violet-400/25`}),(0,b.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-3`,children:[d?(0,b.jsx)(`p`,{className:`text-[10px] text-rose-400`,children:d}):(0,b.jsx)(`span`,{}),(0,b.jsx)(`button`,{onClick:C,disabled:!s.trim()||l,className:`rounded-lg bg-violet-500 px-3 py-1.5 text-xs font-semibold text-white hover:bg-violet-400 disabled:opacity-35`,children:l?`Sending…`:`Send through orchestrator`})]})]})]})})}var di={info:`border-sky-400/15 bg-sky-400/[0.04] text-sky-200/75`,warning:`border-orange-400/20 bg-orange-400/[0.055] text-orange-200/80`,critical:`border-rose-400/25 bg-rose-400/[0.06] text-rose-200/85`};function fi({alerts:e,missionName:t,onNavigate:n}){return e.length?(0,b.jsx)(`section`,{className:`mb-5 space-y-2`,"aria-label":`Mission health alerts`,children:e.map(e=>(0,b.jsxs)(`details`,{className:`rounded-xl border px-4 py-3 ${di[e.severity]}`,children:[(0,b.jsxs)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:[(0,b.jsx)(`span`,{className:`mr-2 text-[9px] uppercase tracking-wider opacity-60`,children:e.severity}),t&&(0,b.jsxs)(`span`,{className:`mr-1.5 text-white/85`,children:[t,` ·`]}),e.title]}),(0,b.jsxs)(`div`,{className:`mt-2 space-y-1.5 pl-12 text-xs leading-relaxed`,children:[(0,b.jsx)(`p`,{className:`text-white/50`,children:e.explanation}),(0,b.jsxs)(`p`,{className:`text-white/30`,children:[(0,b.jsx)(`span`,{className:`font-medium text-white/40`,children:`Evidence:`}),` `,e.evidence]}),(0,b.jsxs)(`p`,{className:`text-white/40`,children:[(0,b.jsx)(`span`,{className:`font-medium text-white/50`,children:`Suggested recovery:`}),` `,e.recovery]}),n&&(0,b.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:`mt-1 cursor-pointer rounded-md border border-current/15 px-2.5 py-1.5 text-[10px] font-medium opacity-70 transition hover:bg-white/[0.05] hover:opacity-100`,children:[`Open `,e.workerId?`worker`:`mission`,` →`]})]})]},e.id))}):null}function pi(e){let t=Math.max(0,Math.round(e/6e4));return t<60?`${t}m`:`${Math.floor(t/60)}h ${t%60}m`}function mi({events:e,workers:t,plan:n,compact:r=!1}){let i=(0,g.useMemo)(()=>{let r=Date.now(),i=[...e.map(e=>e.ts),...t.flatMap(e=>[e.startedAt,e.doneAt??e.jobUpdatedAt??r])],a=Math.min(...i),o=Math.max(...i,a+6e4),s=Math.max(1,o-a),c=e=>Math.max(0,Math.min(100,(e-a)/s*100)),l=[...e].sort((e,t)=>e.ts-t.ts),u=l.slice(1).map((e,t)=>({start:l[t].ts,end:e.ts})).filter(e=>e.end-e.start>=3e5),d=rt(n),f=new Map(d.map(e=>[e.id,e])),p=new Map,m=new Map,h=[...d];for(let e=0;e<d.length+1&&h.length;e+=1)for(let e=h.length-1;e>=0;--e){let t=h[e],n=t.dependsOn.filter(e=>f.has(e));if(n.some(e=>!p.has(e)))continue;let r=0;for(let e of n)(p.get(e)??0)>r&&(r=p.get(e),m.set(t.id,e));p.set(t.id,r+t.weight),h.splice(e,1)}let g=[...d].sort((e,t)=>(p.get(t.id)??0)-(p.get(e.id)??0))[0]?.id,_=new Set;for(;g;)_.add(g),g=m.get(g);return{start:a,end:o,span:s,x:c,gaps:u,criticalWorkers:new Set(d.filter(e=>_.has(e.id)).map(e=>e.workerId??e.owner).filter(e=>!!e))}},[e,t,n]);if(!e.length&&!t.length)return(0,b.jsx)(`p`,{className:`text-sm text-white/40`,children:`No runtime data yet.`});let a=[{id:`manager`,label:`Manager`,events:e.filter(e=>!e.targetWorker||e.targetWorker===`hive-orchestrator`)},...t.map(t=>({id:`${t.jobId}:${t.id}`,label:t.label,worker:t,events:e.filter(e=>e.targetWorker&&e.targetWorker!==`hive-orchestrator`&&(e.targetWorker===t.id||t.label.toLowerCase().includes(e.targetWorker.toLowerCase())))}))],o=r?`grid-cols-[90px_minmax(0,1fr)]`:`grid-cols-[150px_1fr]`;return(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{className:`mb-3 flex flex-wrap gap-3 text-[9px] text-white/25`,children:[(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`span`,{className:`text-amber-300`,children:`━`}),` critical path worker`]}),(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`span`,{className:`text-rose-300`,children:`▧`}),` blocked/bottleneck`]}),(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`span`,{className:`text-white/20`,children:`▧`}),` idle gap ≥5m`]})]}),(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-white/[0.06] bg-black/15`,children:(0,b.jsxs)(`div`,{className:r?`min-w-0`:`min-w-[680px]`,children:[(0,b.jsxs)(`div`,{className:`grid ${o} border-b border-white/[0.06] px-3 py-2 text-[9px] text-white/20`,children:[(0,b.jsx)(`span`,{children:`Lane`}),(0,b.jsxs)(`div`,{className:`flex justify-between`,children:[(0,b.jsx)(`span`,{children:new Date(i.start).toLocaleTimeString()}),(0,b.jsx)(`span`,{children:pi(i.span)}),(0,b.jsx)(`span`,{children:new Date(i.end).toLocaleTimeString()})]})]}),a.map(e=>{let t=`worker`in e?e.worker:void 0,n=t?t.doneAt??t.jobUpdatedAt??Date.now():void 0,r=t?i.criticalWorkers.has(t.id)||i.criticalWorkers.has(t.label):!1,a=t?.jobState===`blocked`||e.events.some(e=>e.outcome===`failure`);return(0,b.jsxs)(`div`,{className:`grid min-h-12 ${o} border-b border-white/[0.04] px-3 last:border-0`,children:[(0,b.jsxs)(`div`,{className:`flex min-w-0 items-center pr-3`,children:[(0,b.jsx)(`span`,{className:`truncate text-[10px] text-white/45`,title:e.label,children:e.label}),r&&(0,b.jsx)(`span`,{className:`ml-1 text-amber-300`,children:`◆`})]}),(0,b.jsxs)(`div`,{className:`relative my-2 overflow-hidden rounded bg-white/[0.015]`,children:[i.gaps.map((e,t)=>(0,b.jsx)(`span`,{className:`absolute inset-y-0 bg-white/[0.025]`,style:{left:`${i.x(e.start)}%`,width:`${i.x(e.end)-i.x(e.start)}%`},title:`Idle gap ${pi(e.end-e.start)}`},t)),t&&(0,b.jsx)(`span`,{className:`absolute top-1/2 h-2 -translate-y-1/2 rounded-full ${a?`bg-rose-400/60`:r?`bg-amber-300/65`:t.doneAt?`bg-emerald-400/45`:`bg-violet-400/50`}`,style:{left:`${i.x(t.startedAt)}%`,width:`${Math.max(.7,i.x(n)-i.x(t.startedAt))}%`},title:`${t.label}: ${pi(n-t.startedAt)}`}),e.events.map((e,t)=>(0,b.jsx)(`span`,{className:`absolute top-1/2 h-2 w-2 -translate-x-1/2 -translate-y-1/2 rounded-full border border-black/40 ${e.outcome===`failure`?`bg-rose-400`:e.source===`custom`?`bg-violet-400`:`bg-white/45`}`,style:{left:`${i.x(e.ts)}%`},title:`${new Date(e.ts).toLocaleTimeString()} · ${e.detail}`},`${e.ts}:${t}`))]})]},e.id)})]})})]})}var hi=/(?:^|\s)\/([\w:-]+)/g;function gi(e){return e?[...e.matchAll(hi)].map(e=>e[1]):[]}function _i({messages:e,plan:t}){let n=[...new Map(e.flatMap(e=>gi(e.text).map(t=>[`${e.role}:${t}`,{skill:t,role:e.role}]))).values()],r=rt(t).flatMap(e=>[...new Set([...gi(e.assignment),...gi(e.context),...gi(e.description)])].map(t=>({skill:t,task:e.title,worker:e.owner??e.workerId})));return!n.length&&!r.length?null:(0,b.jsxs)(`section`,{className:`rounded-2xl border border-white/10 bg-[#101014] p-4`,children:[(0,b.jsxs)(`div`,{className:`mb-3`,children:[(0,b.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Skills`}),(0,b.jsx)(`p`,{className:`mt-0.5 text-xs text-white/30`,children:`Explicit slash skills observed in requests and assignments`})]}),n.length>0&&(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-[9px] font-medium uppercase tracking-wider text-white/20`,children:`Invoked in conversation`}),(0,b.jsx)(`div`,{className:`mt-1.5 flex flex-wrap gap-1.5`,children:n.map(e=>(0,b.jsxs)(`span`,{className:`rounded-md border border-violet-300/10 bg-violet-300/[0.05] px-2 py-1 font-mono text-[10px] text-violet-200/55`,children:[`/`,e.skill,` `,(0,b.jsx)(`span`,{className:`ml-1 font-sans uppercase text-white/20`,children:e.role===`assistant`?`manager`:`you`})]},`${e.role}:${e.skill}`))})]}),r.length>0&&(0,b.jsxs)(`div`,{className:n.length?`mt-3`:``,children:[(0,b.jsx)(`p`,{className:`text-[9px] font-medium uppercase tracking-wider text-white/20`,children:`Assigned to workers`}),(0,b.jsx)(`ul`,{className:`mt-1.5 space-y-1.5`,children:r.map((e,t)=>(0,b.jsxs)(`li`,{className:`flex items-center gap-2 rounded-md bg-white/[0.02] px-2 py-1.5 text-[10px]`,children:[(0,b.jsxs)(`span`,{className:`font-mono text-violet-200/55`,children:[`/`,e.skill]}),(0,b.jsx)(`span`,{className:`truncate text-white/35`,children:e.task}),e.worker&&(0,b.jsx)(`span`,{className:`ml-auto shrink-0 text-amber-200/35`,children:e.worker})]},`${e.skill}:${e.task}:${t}`))})]})]})}function vi(e){return e>=100?`bg-rose-400`:e>=80?`bg-amber-400`:`bg-emerald-400`}function yi(e){return e<60?`${Math.round(e)}m`:`${Math.floor(e/60)}h ${Math.round(e%60)}m`}function bi({budgets:e,tokens:t,workers:n,elapsedMs:r}){if(!e||!Object.values(e).some(Boolean))return null;let i=n.filter(e=>!e.doneAt&&(e.jobState===`working`||e.jobState===`busy`)).length,a=[e.maxTokens?{label:`Tokens`,used:t,limit:e.maxTokens,display:`${t.toLocaleString()} / ${e.maxTokens.toLocaleString()}`}:void 0,e.maxElapsedMinutes?{label:`Elapsed`,used:r/6e4,limit:e.maxElapsedMinutes,display:`${yi(r/6e4)} / ${yi(e.maxElapsedMinutes)}`}:void 0,e.maxWorkers?{label:`Workers`,used:n.length,limit:e.maxWorkers,display:`${n.length} / ${e.maxWorkers}`}:void 0,e.maxConcurrentWorkers?{label:`Concurrent`,used:i,limit:e.maxConcurrentWorkers,display:`${i} / ${e.maxConcurrentWorkers}`}:void 0].filter(e=>!!e),o=r>6e4?t/(r/6e4):0,s=e.maxTokens&&o>0?Math.max(0,(e.maxTokens-t)/o):void 0;return(0,b.jsxs)(`section`,{className:`rounded-2xl border border-white/10 bg-[#101014] p-4`,children:[(0,b.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Mission budgets`}),(0,b.jsx)(`p`,{className:`mt-0.5 text-xs text-white/30`,children:`Soft limits requiring approval to exceed`})]}),a.some(e=>e.used>=e.limit)&&(0,b.jsx)(`span`,{className:`rounded-full bg-rose-400/10 px-2 py-1 text-[9px] uppercase text-rose-200/65`,children:`Limit reached`})]}),(0,b.jsx)(`div`,{className:`space-y-3`,children:a.map(e=>{let t=Math.round(e.used/e.limit*100);return(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{className:`mb-1 flex justify-between text-[10px]`,children:[(0,b.jsx)(`span`,{className:`text-white/35`,children:e.label}),(0,b.jsxs)(`span`,{className:t>=100?`text-rose-300/70`:`text-white/45`,children:[e.display,` · `,t,`%`]})]}),(0,b.jsx)(`div`,{className:`h-1.5 overflow-hidden rounded-full bg-white/[0.06]`,children:(0,b.jsx)(`div`,{className:`h-full rounded-full ${vi(t)}`,style:{width:`${Math.min(100,t)}%`}})})]},e.label)})}),s!==void 0&&(0,b.jsxs)(`p`,{className:`mt-3 border-t border-white/[0.05] pt-2 text-[10px] text-white/25`,children:[`At the current average rate, the token budget has about `,yi(s),` remaining.`]})]})}function xi({jobs:e}){return e?.length?(0,b.jsxs)(`details`,{className:`rounded-2xl border border-white/10 bg-[#101014] p-4`,children:[(0,b.jsxs)(`summary`,{className:`flex items-center justify-between text-sm font-semibold text-white/65`,children:[(0,b.jsx)(`span`,{children:`Claude job history`}),(0,b.jsxs)(`span`,{className:`font-normal text-[10px] text-white/25`,children:[e.length,` turn`,e.length===1?``:`s`]})]}),(0,b.jsx)(`p`,{className:`mt-2 text-[10px] leading-relaxed text-white/25`,children:`Advanced runtime lineage. Each follow-up creates a new Claude job while remaining part of this Hive mission.`}),(0,b.jsx)(`ol`,{className:`mt-3 space-y-2 border-l border-white/[0.07] pl-3`,children:e.map((e,t)=>(0,b.jsxs)(`li`,{className:`relative rounded-lg border border-white/[0.05] bg-black/10 px-3 py-2 before:absolute before:-left-[17px] before:top-3 before:h-2 before:w-2 before:rounded-full before:bg-violet-400/60`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,b.jsxs)(`span`,{className:`font-mono text-[10px] text-white/50`,children:[t+1,`. `,e.jobId.slice(0,12)]}),(0,b.jsx)(`span`,{className:`text-[9px] uppercase text-white/25`,children:e.state})]}),(0,b.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-x-3 gap-y-1 text-[9px] text-white/22`,children:[e.createdAt&&(0,b.jsx)(`span`,{children:new Date(e.createdAt).toLocaleString()}),(0,b.jsxs)(`span`,{children:[e.tokens.toLocaleString(),` tokens`]}),e.sessionId&&(0,b.jsxs)(`span`,{className:`font-mono`,children:[`session `,e.sessionId.slice(0,8)]}),e.resumedFrom&&(0,b.jsxs)(`span`,{className:`font-mono text-violet-300/35`,children:[`resumed `,e.resumedFrom.slice(0,8)]})]})]},e.jobId))})]}):null}function Si({missionId:e}){let[t,n]=(0,g.useState)(!1),[r,i]=(0,g.useState)(),[a,o]=(0,g.useState)(!1),[s,c]=(0,g.useState)(),[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(!1);async function p(){if(t){n(!1);return}if(n(!0),!r){o(!0);try{i(await de(e))}catch(e){c(e.message)}finally{o(!1)}}}async function m(){f(!0),c(void 0);try{await fe(e),u(!1),i(void 0)}catch(e){c(e.message)}finally{f(!1)}}return(0,b.jsxs)(`section`,{className:`rounded-2xl border border-white/10 bg-[#101014] p-4`,children:[(0,b.jsxs)(`button`,{onClick:p,className:`flex w-full items-center justify-between text-left`,children:[(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`span`,{className:`block text-sm font-semibold text-white/65`,children:`Manager handoff context`}),(0,b.jsx)(`span`,{className:`mt-0.5 block text-xs text-white/30`,children:`Preview the bounded history a replacement manager receives`})]}),(0,b.jsx)(`span`,{className:`text-xs text-white/25`,children:t?`−`:`+`})]}),t&&(0,b.jsxs)(`div`,{className:`mt-3 border-t border-white/[0.06] pt-3`,children:[a&&(0,b.jsx)(`p`,{className:`text-xs text-white/25`,children:`Building preview…`}),s&&(0,b.jsx)(`p`,{className:`text-xs text-rose-400`,children:s}),r&&(0,b.jsxs)(`div`,{className:`space-y-3`,children:[(0,b.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[`Summary`,r.estimatedTokens.summary,r.budgets.summaryTokens],[`Recent`,r.estimatedTokens.recent,r.budgets.recentTokens],[`Retrieved`,r.estimatedTokens.retrieved,r.budgets.retrievedTokens]].map(([e,t,n])=>(0,b.jsxs)(`div`,{className:`rounded-lg bg-white/[0.025] p-2`,children:[(0,b.jsxs)(`p`,{className:`text-xs font-medium text-white/55`,children:[`~`,t,` / `,n]}),(0,b.jsxs)(`p`,{className:`mt-0.5 text-[8px] uppercase tracking-wider text-white/20`,children:[e,` tokens`]})]},e))}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-[9px] uppercase tracking-wider text-white/20`,children:`Compact mission state`}),(0,b.jsxs)(`p`,{className:`mt-1.5 whitespace-pre-wrap text-[10px] leading-relaxed text-white/40`,children:[r.mission.compactSummary??`No checkpoint summary published yet.`,r.mission.currentState?`\nCurrent state: ${r.mission.currentState}`:``]})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`p`,{className:`text-[9px] uppercase tracking-wider text-white/20`,children:[`Recent messages · `,r.recentMessages.length]}),(0,b.jsx)(`ul`,{className:`mt-1 space-y-1`,children:r.recentMessages.map(e=>(0,b.jsxs)(`li`,{className:`line-clamp-2 text-[10px] text-white/30`,children:[(0,b.jsxs)(`span`,{className:`text-white/18`,children:[e.role,`:`]}),` `,e.text]},e.id))})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`p`,{className:`text-[9px] uppercase tracking-wider text-white/20`,children:[`Relevant older messages · `,r.retrievedMessages.length]}),r.retrievedMessages.length?(0,b.jsx)(`ul`,{className:`mt-1 space-y-1`,children:r.retrievedMessages.map(e=>(0,b.jsxs)(`li`,{className:`line-clamp-2 text-[10px] text-white/30`,children:[(0,b.jsxs)(`span`,{className:`text-white/18`,children:[e.role,`:`]}),` `,e.text]},e.id))}):(0,b.jsx)(`p`,{className:`mt-1 text-[10px] text-white/20`,children:`No older messages were relevant enough to include.`})]}),(0,b.jsx)(`div`,{className:`border-t border-white/[0.06] pt-3`,children:l?(0,b.jsxs)(`div`,{className:`rounded-lg border border-amber-300/10 bg-amber-300/[0.035] p-2.5`,children:[(0,b.jsx)(`p`,{className:`text-[10px] leading-relaxed text-amber-100/55`,children:`Gracefully stop the current manager if it is active and start a fresh manager with exactly the context shown above? Mission identity, plan, conversation, and outputs remain unchanged.`}),(0,b.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,b.jsx)(`button`,{onClick:()=>u(!1),className:`px-2 py-1 text-[10px] text-white/35`,children:`Cancel`}),(0,b.jsx)(`button`,{disabled:d,onClick:m,className:`rounded-md bg-amber-300 px-2 py-1.5 text-[10px] font-semibold text-[#291b05] disabled:opacity-40`,children:d?`Replacing…`:`Confirm handoff`})]})]}):(0,b.jsx)(`button`,{onClick:()=>u(!0),className:`rounded-md border border-amber-300/15 px-2.5 py-1.5 text-[10px] text-amber-200/55 hover:bg-amber-300/[0.05]`,children:`Replace manager with this context`})})]})]})]})}function Ci({missionId:e}){let[t,n]=(0,g.useState)(!1),[r,i]=(0,g.useState)(!1),[a,o]=(0,g.useState)(`pr`),[s,c]=(0,g.useState)(``),[l,u]=(0,g.useState)(null),[d,f]=(0,g.useState)(!1);async function p(){if(!(!s.trim()||t)){n(!0),u(null),f(!1);try{await me(e,a,s.trim()),f(!0),i(!1)}catch(e){u(e.message)}finally{n(!1)}}}return(0,b.jsxs)(`section`,{className:`rounded-2xl border border-white/10 bg-[#101014] p-4`,children:[(0,b.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Mission report`}),(0,b.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-white/30`,children:`Export the request, plan, decisions, workers, changes, verification, outputs, usage, conversation, and remaining risks. Reports include a deep link back to this mission.`}),(0,b.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,b.jsx)(`a`,{href:pe(e,`markdown`),download:!0,className:`rounded-lg border border-white/10 bg-white/[0.025] px-3 py-2 text-xs text-white/50 hover:border-amber-300/15 hover:text-amber-200`,children:`Download Markdown`}),(0,b.jsx)(`a`,{href:pe(e,`json`),download:!0,className:`rounded-lg border border-white/10 bg-white/[0.025] px-3 py-2 text-xs text-white/50 hover:border-violet-300/15 hover:text-violet-200`,children:`Download JSON`}),(0,b.jsx)(`button`,{onClick:()=>{i(!r),u(null),f(!1)},className:`rounded-lg border border-sky-300/10 bg-sky-300/[0.025] px-3 py-2 text-xs text-sky-200/50 hover:border-sky-300/20 hover:text-sky-200/75`,children:`Post to GitHub…`})]}),r&&(0,b.jsxs)(`div`,{className:`mt-3 rounded-xl border border-amber-300/10 bg-amber-300/[0.025] p-3`,children:[(0,b.jsxs)(`p`,{className:`text-[10px] leading-relaxed text-amber-100/50`,children:[`This is externally visible. Hive will use your locally authenticated `,(0,b.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI and record both approval and outcome in the mission timeline.`]}),(0,b.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,b.jsxs)(`select`,{value:a,onChange:e=>o(e.target.value),className:`rounded-lg border border-white/10 bg-[#17171c] px-2 py-2 text-xs text-white/55`,children:[(0,b.jsx)(`option`,{value:`pr`,children:`Pull request`}),(0,b.jsx)(`option`,{value:`issue`,children:`Issue`})]}),(0,b.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:`#123 or GitHub URL`,className:`min-w-0 flex-1 rounded-lg border border-white/10 bg-black/20 px-3 py-2 text-xs text-white/65 outline-none placeholder:text-white/20 focus:border-amber-300/20`}),(0,b.jsx)(`button`,{onClick:()=>i(!1),className:`px-2 text-xs text-white/30`,children:`Cancel`}),(0,b.jsx)(`button`,{onClick:()=>void p(),disabled:!s.trim()||t,className:`rounded-lg bg-amber-300 px-3 py-2 text-xs font-semibold text-[#291a04] disabled:opacity-35`,children:t?`Publishing…`:`Confirm publish`})]})]}),l&&(0,b.jsxs)(`p`,{className:`mt-2 text-[10px] text-rose-400`,children:[`Publish failed: `,l,`. Verify `,(0,b.jsx)(`span`,{className:`font-mono`,children:`gh auth status`}),`, the target, and repository access, then retry.`]}),d&&(0,b.jsx)(`p`,{className:`mt-2 text-[10px] text-emerald-300/60`,children:`Report published and recorded in the mission timeline.`})]})}function wi({missionId:e,initial:t}){let[n,r]=(0,g.useState)(t),[i,a]=(0,g.useState)(!1),[o,s]=(0,g.useState)();if(!n)return(0,b.jsxs)(`section`,{className:`rounded-2xl border border-white/10 bg-[#101014] p-4`,children:[(0,b.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Permission policy`}),(0,b.jsx)(`p`,{className:`mt-2 text-xs text-white/30`,children:`This recovered mission predates mission policies. Its next handoff can adopt the workspace defaults.`})]});async function c(){if(window.confirm(`Apply these permission changes to future turns of this mission? Expanding access is an explicit approval.`))try{let t=await _e(e,n);r(t.policy),a(!1)}catch(e){s(e.message)}}let l=[[`Network`,n.networkAccess],[`Commits`,n.commits],[`Pushes`,n.pushes],[`PRs`,n.pullRequests],[`Releases`,n.releases],[`Destructive`,n.destructiveActions]];return(0,b.jsxs)(`section`,{className:`rounded-2xl border border-white/10 bg-[#101014] p-4`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,b.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Permission policy`}),(0,b.jsx)(`button`,{onClick:()=>a(!i),className:`rounded-lg border border-white/10 px-2.5 py-1 text-[10px] text-white/45 hover:bg-white/5`,children:i?`Cancel`:`Edit override`})]}),i?(0,b.jsxs)(`div`,{className:`mt-4`,children:[(0,b.jsx)(Ce,{value:n,onChange:r}),o&&(0,b.jsx)(`p`,{className:`mt-2 text-xs text-rose-300`,children:o}),(0,b.jsx)(`button`,{onClick:()=>void c(),className:`mt-3 rounded-lg bg-amber-300 px-3 py-2 text-xs font-semibold text-black`,children:`Review and apply`})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:l.map(([e,t])=>(0,b.jsxs)(`span`,{className:`rounded px-2 py-1 text-[10px] ${t?`bg-emerald-300/[0.07] text-emerald-200/50`:`bg-white/[0.03] text-white/25`}`,children:[e,`: `,t?`allowed`:`blocked`]},e))}),(0,b.jsxs)(`p`,{className:`mt-3 text-[10px] text-white/25`,children:[n.allowedRoots.length?`Restricted to ${n.allowedRoots.join(`, `)}`:`Any working directory`,` · `,n.allowedTools.length?`${n.allowedTools.length} explicitly allowed tools`:`normal tool set`]})]})]})}var Ti=[[`conversation`,`Conversation`],[`plan`,`Plan`],[`workers`,`Workers`],[`activity`,`Activity`],[`technical`,`Technical`]];function Ei({onBack:e,header:t,notices:n,metrics:r,presentation:i,onPresentationChange:a,view:o,onViewChange:s,activeWorkers:c,children:l}){return(0,b.jsx)(`div`,{className:`min-h-screen bg-[radial-gradient(circle_at_top_left,rgba(124,58,237,0.08),transparent_35%)]`,children:(0,b.jsxs)(`div`,{className:`mx-auto max-w-7xl px-5 py-8 lg:px-8`,children:[(0,b.jsxs)(`div`,{className:`sticky top-3 z-30 mb-4 flex flex-wrap items-center justify-between gap-3 rounded-xl border border-white/[0.07] bg-[#0d0d11]/90 p-1.5 shadow-lg shadow-black/20 backdrop-blur`,children:[(0,b.jsxs)(`button`,{onClick:e,className:`flex cursor-pointer items-center gap-2 rounded-lg px-2.5 py-1.5 text-xs text-white/40 transition hover:bg-white/[0.04] hover:text-amber-200/80`,children:[(0,b.jsx)(De,{compact:!0}),(0,b.jsx)(`span`,{children:`← Fleet`})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,b.jsx)(`p`,{className:`hidden text-[10px] text-white/22 sm:block`,children:i===`room`?`Spatial mission control`:`Full operational detail`}),(0,b.jsx)(lt,{value:i===`room`?`office`:`cards`,onChange:a})]})]}),t,n,r,i===`details`&&(0,b.jsx)(`nav`,{"aria-label":`Mission views`,className:`mb-6 flex w-fit max-w-full overflow-x-auto rounded-xl border border-white/[0.07] bg-black/15 p-1`,children:Ti.map(([e,t])=>(0,b.jsxs)(`button`,{onClick:()=>s(e),"aria-current":o===e?`page`:void 0,className:`whitespace-nowrap rounded-lg px-4 py-2 text-xs font-medium transition ${o===e?`bg-amber-300/[0.1] text-amber-100/75 shadow-inner`:`text-white/30 hover:bg-white/[0.035] hover:text-white/55`}`,children:[t,e===`workers`&&c>0?` · ${c} active`:``]},e))}),(0,b.jsx)(`div`,{className:`mission-presentation-enter`,children:l},i)]})})}var Di=`hive:office-preferences`,Oi={version:1,fleetPresentation:`cards`,missionPresentation:`details`,motion:`system`,dialogue:`work_personality`,selectedFloor:0,roomAssignments:{},workerSeatAssignments:{}};function ki(e){if(!e)return Oi;try{let t=JSON.parse(e);if(t.version!==1||t.fleetPresentation!==`cards`&&t.fleetPresentation!==`office`)return Oi;let n=t.roomAssignments&&typeof t.roomAssignments==`object`&&!Array.isArray(t.roomAssignments)?Object.fromEntries(Object.entries(t.roomAssignments).filter(e=>typeof e[1]==`string`)):{},r=t.workerSeatAssignments&&typeof t.workerSeatAssignments==`object`&&!Array.isArray(t.workerSeatAssignments)?Object.fromEntries(Object.entries(t.workerSeatAssignments).filter(e=>Number.isInteger(e[1])&&Number(e[1])>=0)):{};return{version:1,fleetPresentation:t.fleetPresentation,missionPresentation:t.missionPresentation===`room`?`room`:`details`,motion:t.motion===`reduced`||t.motion===`full`?t.motion:`system`,dialogue:t.dialogue===`off`||t.dialogue===`work`?t.dialogue:`work_personality`,selectedFloor:typeof t.selectedFloor==`number`&&Number.isInteger(t.selectedFloor)&&t.selectedFloor>=0?t.selectedFloor:0,roomAssignments:n,workerSeatAssignments:r}}catch{return Oi}}function Ai(){let[e,t]=(0,g.useState)(()=>typeof window>`u`?Oi:ki(localStorage.getItem(Di)));return[e,e=>{t(t=>{let n=typeof e==`function`?e(t):e;try{localStorage.setItem(Di,JSON.stringify(n))}catch{}return n})}]}var ji=e=>`${e.sessionId}:${e.jobId??``}:${e.ts}:${e.hookEventName??``}:${e.toolName??``}:${e.targetWorker??``}`;function Mi(e){return e.hookEventName===`SubagentStart`||e.hookEventName===`PostToolUse`&&e.toolName===`Agent`}function Ni(e){return e.recentEvents.filter(e=>e.targetWorker&&e.targetWorker!==`hive-orchestrator`&&(Mi(e)||e.hookEventName===`SubagentStop`)).sort((e,t)=>e.ts-t.ts)}function Pi(e,t,n){return!t||n!==e.missionId?[]:Ni(e).filter(e=>Mi(e)&&!t.has(ji(e))).map(e=>e.targetWorker)}function Fi(e){let t=(0,g.useRef)(),n=(0,g.useRef)(),r=(0,g.useRef)(new Map),[i,a]=(0,g.useState)([]),[o,s]=(0,g.useState)(()=>Date.now());return(0,g.useEffect)(()=>{if(!t.current||n.current!==e.missionId){n.current=e.missionId,t.current=new Set(e.recentEvents.map(ji)),r.current.clear();for(let t of e.workers)r.current.set(t.id,{stopped:!!t.doneAt,completionQueued:!!t.doneAt});a([]);return}let i=Date.now(),o=Ni(e).filter(e=>{let n=ji(e);return!t.current.has(n)&&(t.current.add(n),!0)});!o.length&&!e.turnCompleted&&e.lifecycleStatus!==`ready_for_review`||(a(t=>{let n=t,a=t=>{let a=r.current.get(t);!a||a.completionQueued||(n=Qn(n,Xn(e.missionId,t,`detail:${e.missionId}:${t}:complete`,i),i),a.completionQueued=!0)};for(let t of o){let o=t.targetWorker,s=r.current.get(o),c=Mi(t);if(c&&!s){for(let[e,t]of r.current)t.stopped&&a(e);r.current.set(o,{stopped:!1,completionQueued:!1}),n=Qn(n,Yn(e.missionId,o,`detail:${e.missionId}:${o}:arrival`,i),i)}else c&&s?s.stopped=!1:t.hookEventName===`SubagentStop`&&s&&(s.stopped=!0,a(o))}if(e.turnCompleted||e.lifecycleStatus===`ready_for_review`)for(let[e,t]of r.current)t.stopped&&a(e);return n}),s(i))},[e.lifecycleStatus,e.missionId,e.recentEvents,e.turnCompleted,e.workers]),(0,g.useEffect)(()=>{if(!i.length)return;let e=Math.min(...i.map(e=>e.startsAt>o?e.startsAt:e.startsAt+e.duration)),t=window.setTimeout(()=>{let e=Date.now();s(e),a(t=>Qn(t,[],e))},Math.max(16,e-Date.now()+8));return()=>window.clearTimeout(t)},[o,i]),(0,g.useMemo)(()=>{let r=$n(i,o);for(let i of Pi(e,t.current,n.current))r[`${e.missionId}:${i}`]??=`desk-reserved`;let a=new Set(i.filter(e=>e.workerId).map(e=>e.workerId));return{transitions:r,workers:e.workers.filter(e=>Ii(e.doneAt,a.has(e.id)))}},[o,e.workers,i])}function Ii(e,t){return!e||t}var Li=[[.45,.85],[1.7,.85],[2.95,.85],[4.2,.85],[.45,3.1],[1.7,3.1],[2.95,3.1],[4.2,3.1]],Ri=[[1.57,1.78],[2.22,1.78],[2.87,1.78],[3.52,1.78],[1.57,3.56],[2.22,3.56],[2.87,3.56],[3.52,3.56]];function zi(e){let t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/60);return n>=60?`${Math.floor(n/60)}h ${n%60}m`:n?`${n}m ${t%60}s`:`${t}s`}function Bi({label:e,value:t,detail:n,tone:r=`white`,onClick:i}){let a=(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,b.jsx)(`p`,{className:`text-base font-semibold leading-tight ${{white:`text-white/75`,amber:`text-amber-200/80`,emerald:`text-emerald-200/75`,rose:`text-rose-200/80`}[r]}`,children:t}),i&&(0,b.jsx)(`span`,{"aria-hidden":`true`,className:`text-[9px] text-amber-200/0 transition group-hover:text-amber-200/50`,children:`→`})]}),(0,b.jsx)(`p`,{className:`mt-0.5 text-[9px] font-semibold uppercase tracking-[0.16em] text-white/25`,children:e}),(0,b.jsx)(`p`,{className:`mt-1 truncate text-[10px] text-white/32`,title:n,children:n})]});return i?(0,b.jsx)(`button`,{type:`button`,onClick:i,"aria-label":`${t} ${e} — ${n}. Open ${e.toLowerCase()}`,className:`group min-w-0 rounded-xl border border-white/[0.07] bg-white/[0.02] px-3 py-2 text-left transition hover:border-amber-300/20 hover:bg-white/[0.035] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-amber-300/35`,children:a}):(0,b.jsx)(`div`,{className:`min-w-0 rounded-xl border border-white/[0.07] bg-white/[0.02] px-3 py-2 text-left`,children:a})}function Vi({node:e,fleetMissions:t,decisions:n,onOpenDecisions:r,onSelectWorker:i,onReviewMissionSelect:a,studioMissions:o,selectedStudioMissionId:s,onStudioMissionSelect:c,onStudioClear:l,requestedPanel:u}){let d=Fi(e),[f,p]=(0,g.useState)(`conversation`),[m,h]=(0,g.useState)(!1);(0,g.useEffect)(()=>{u&&p(u.panel)},[u]);let[_,v]=(0,g.useState)(`feed`),[y,x]=(0,g.useState)(!1),[S,C]=(0,g.useState)(!1),[w,T]=(0,g.useState)(),[E,D]=Ai(),[O,k]=(0,g.useState)(()=>Date.now());(0,g.useEffect)(()=>{if(E.dialogue===`off`)return;let e=window.setInterval(()=>k(Date.now()),2e3);return()=>window.clearInterval(e)},[E.dialogue]);let A=rt(e.plan),j=A.filter(e=>e.status===`completed`).length,M=A.filter(e=>e.status===`blocked`||e.status===`failed`),N=e.plan?.gates??[],P=N.filter(e=>e.status===`satisfied`||e.status===`waived`).length,F=!!o,I=e.mission.mode===`direct`,ee=!F&&e.lifecycleStatus===`ready_for_review`,te={x:.3,y:.25,width:5.2,depth:5.25},L=ht(te),R=I?Li:L,re=e.workers.filter(jt),z=I?[]:d.workers.slice(0,4),ie=I?0:Math.max(0,d.workers.length-z.length),B=dt(te,0),ae=dt({x:4.45,y:5.1,width:.76,depth:.24},2),oe=[B[0],B[1],{x:B[1].x,y:B[1].y-48},{x:B[0].x,y:B[0].y-48}],se=[B[0],B[3],{x:B[3].x,y:B[3].y-48},{x:B[0].x,y:B[0].y-48}],ce=Nt(e),le=V(R[0][0]+.36,R[0][1]+.78,26),ue=(0,g.useMemo)(()=>Hn(t,E.roomAssignments).placements,[t,E.roomAssignments]),de=F?ue.filter(e=>e.floorIndex===0&&e.spaceId===`direct-studio`&&o?.some(t=>t.missionId===e.mission.missionId)):[],fe=ee?ue.filter(e=>e.floorIndex===0&&e.spaceId===`review`).slice(0,8):[],pe={entrance:{x:5.42,y:5.28},lobby:{x:5.16,y:5.18},doorway:{x:4.82,y:5.02},inside:{x:4.36,y:4.62}},me=Vt(F?de.map(e=>e.mission):[e]),he=(0,g.useMemo)(()=>yn(ue,E.dialogue,O),[O,ue,E.dialogue]),ge=e=>he.find(t=>t.targetId===e),_e=(e,t,n,r)=>e?(0,b.jsx)(xn,{x:t,y:n,text:e.text,kind:e.kind,targetId:e.targetId,delayMs:0,onClick:e.kind===`thought`?void 0:()=>r?i(r):p(`conversation`)},`detail-dialogue:${e.targetId}`):null,ve=F?void 0:he.find(t=>t.missionId===e.missionId&&t.workerId&&t.interaction),ye=ve?z.findIndex(e=>e.id===ve.workerId||e.label===ve.workerId):-1,be={x:R[0][0]+.36,y:R[0][1]+.78},xe=ye>=0?{x:R[ye+1][0]+.36,y:R[ye+1][1]+.72}:void 0,Se=e.workers.filter(e=>!e.doneAt&&(e.jobState===`working`||e.jobState===`busy`)).length,Ce=[[`conversation`,`Conversation`],[`plan`,`Plan`],[`workers`,`Workers`],[`activity`,`Activity`],[`technical`,`Technical`]],we=F&&!s,Te=o?.filter(e=>e.activityStatus===`working`).length??0,De=o?.filter(e=>e.activityStatus===`waiting_on_you`||e.activityStatus===`error`||e.activityStatus===`stalled`).length??0,Oe=(o??[]).reduce((e,t)=>e+t.tokens,0),ke=(o??[]).filter(Or),Ae=(o?.length??0)-ke.length,je=e.activityStatus===`working`?Date.now():e.updatedAt,Me=(0,b.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6`,children:[(0,b.jsx)(Bi,{label:`Occupied`,value:`${o?.length??0}/8`,detail:`Direct-agent desks in use`,tone:`emerald`}),(0,b.jsx)(Bi,{label:`Working`,value:`${Te}`,detail:`Agents active right now`,tone:Te?`amber`:`white`}),(0,b.jsx)(Bi,{label:`Attention`,value:`${De}`,detail:`Waiting, stalled, or failed`,tone:De?`rose`:`emerald`}),(0,b.jsx)(Bi,{label:`Available`,value:`${Math.max(0,8-(o?.length??0))}`,detail:`Desks ready for new missions`}),(0,b.jsx)(Bi,{label:`Tokens`,value:Oe.toLocaleString(),detail:`Combined studio usage`}),(0,b.jsx)(Bi,{label:`Providers`,value:`${new Set((o??[]).map(e=>e.mission.provider??`claude`)).size}`,detail:[...new Set((o??[]).map(e=>e.mission.provider??`claude`))].join(` · `)||`No active agents`})]});async function Ne(){C(!0),T(void 0);try{await ne(),x(!1)}catch(e){T(e.message)}finally{C(!1)}}let Pe=(0,b.jsxs)(`section`,{className:`rounded-xl border border-white/[0.07] bg-white/[0.018] p-3`,children:[(0,b.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h3`,{className:`text-xs font-semibold text-white/65`,children:`Direct agents`}),(0,b.jsx)(`p`,{className:`mt-0.5 text-[10px] text-white/28`,children:`Select an agent to open its mission workspace.`})]}),(0,b.jsxs)(`button`,{type:`button`,disabled:!ke.length||S,onClick:()=>x(!0),className:`shrink-0 rounded-lg border border-emerald-300/15 bg-emerald-300/[0.045] px-2.5 py-1.5 text-[9px] font-medium text-emerald-100/55 transition hover:border-emerald-300/30 hover:bg-emerald-300/[0.08] disabled:cursor-not-allowed disabled:border-white/[0.05] disabled:bg-white/[0.02] disabled:text-white/20`,children:[`Clear completed desks · `,ke.length]})]}),y&&(0,b.jsxs)(`div`,{className:`mb-3 rounded-lg border border-amber-300/15 bg-amber-300/[0.035] p-3`,children:[(0,b.jsxs)(`p`,{className:`text-[10px] leading-relaxed text-amber-50/60`,children:[`Clear `,ke.length,` finished direct `,ke.length===1?`mission`:`missions`,`? `,Ae,` active or attention `,Ae===1?`mission`:`missions`,` will remain untouched.`]}),(0,b.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,b.jsx)(`button`,{type:`button`,disabled:S,onClick:()=>x(!1),className:`px-2 py-1 text-[9px] text-white/35 hover:text-white/60`,children:`Cancel`}),(0,b.jsx)(`button`,{type:`button`,disabled:S||!ke.length,onClick:Ne,className:`rounded-md bg-emerald-400/15 px-2.5 py-1 text-[9px] font-medium text-emerald-100/65 hover:bg-emerald-400/25 disabled:opacity-40`,children:S?`Clearing…`:`Clear ${ke.length} desks`})]})]}),w&&(0,b.jsx)(`p`,{className:`mb-3 rounded-lg border border-rose-300/15 bg-rose-300/[0.04] px-3 py-2 text-[10px] text-rose-200/65`,children:w}),(0,b.jsx)(`div`,{className:`space-y-2`,children:de.map(({mission:e,seatIndex:t})=>(0,b.jsxs)(`button`,{type:`button`,onClick:()=>c?.(e.missionId),className:`flex w-full items-start justify-between gap-3 rounded-lg border border-white/[0.06] bg-black/15 px-3 py-2 text-left transition hover:border-emerald-300/20 hover:bg-emerald-300/[0.035]`,children:[(0,b.jsxs)(`span`,{className:`min-w-0`,children:[(0,b.jsx)(`span`,{className:`block truncate text-[11px] font-medium text-white/65`,children:e.name}),(0,b.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-[9px] leading-relaxed text-white/28`,children:e.mission.objective})]}),(0,b.jsxs)(`span`,{className:`shrink-0 text-[9px] uppercase tracking-wider text-white/25`,children:[`Desk `,t+1,` · `,e.activityStatus.replaceAll(`_`,` `)]})]},e.missionId))})]}),Fe=(0,b.jsx)(`div`,{className:`flex w-full max-w-full overflow-x-auto rounded-xl border border-white/[0.07] bg-black/20 p-1`,"aria-label":`Room workspace`,children:Ce.map(([e,t])=>(0,b.jsx)(`button`,{type:`button`,onClick:()=>p(e),"aria-pressed":f===e,className:`min-w-0 flex-1 whitespace-nowrap rounded-lg px-2 py-1.5 text-[10px] font-medium transition ${f===e?`bg-amber-300/[0.1] text-amber-100/75`:`text-white/28 hover:bg-white/[0.035] hover:text-white/55`}`,children:t},e))}),Ie=(0,b.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6`,children:[(0,b.jsx)(Bi,{label:`Plan`,value:e.plan?.progress.percent===void 0?`—`:`${e.plan.progress.percent}%`,detail:A.length?`${j} of ${A.length} tasks complete`:`Waiting for a structured plan`,tone:`amber`,onClick:()=>p(`plan`)}),(0,b.jsx)(Bi,{label:I?`Status`:`Workers`,value:I?e.activityStatus.replaceAll(`_`,` `):`${e.workers.length}`,detail:I?`${e.mission.provider??`claude`} direct agent`:`${Se} active · ${re.length} present`,onClick:()=>p(I?`activity`:`workers`)}),(0,b.jsx)(Bi,{label:`Gates`,value:`${P}/${N.length}`,detail:N.length?`Completion requirements resolved`:`No completion gates published`,tone:P===N.length&&N.length?`emerald`:`white`,onClick:()=>p(`plan`)}),(0,b.jsx)(Bi,{label:`Health`,value:M.length||e.alerts.length?`${M.length+e.alerts.length}`:`Clear`,detail:M.length?`${M.length} blocked or failed tasks`:e.alerts.length?`${e.alerts.length} mission alerts`:`No reported blockers or alerts`,tone:M.length||e.alerts.length?`rose`:`emerald`,onClick:()=>p(`activity`)}),(0,b.jsx)(Bi,{label:`This turn`,value:zi(je-e.runStartedAt),detail:e.activityStatus.replaceAll(`_`,` `)}),(0,b.jsx)(Bi,{label:`Tokens`,value:e.tokens.toLocaleString(),detail:`${e.jobIds.length} job turn${e.jobIds.length===1?``:`s`}`})]}),Le=we?Pe:f===`conversation`?(0,b.jsxs)(`div`,{className:`space-y-3 xl:flex xl:h-full xl:min-h-0 xl:flex-col xl:space-y-0 xl:gap-3`,children:[(0,b.jsx)(gr,{prs:e.prs,messages:e.messages}),(0,b.jsx)(zr,{missionId:e.missionId,repository:e.mission.repository,provider:e.mission.provider,messages:e.messages,hasMoreMessages:e.hasMoreMessages,contained:!0,onOpenDecisions:r,live:{status:e.activityStatus,lifecycle:e.lifecycleStatus,detail:e.detail,waitingFor:e.waitingFor,workers:e.workers,inFlight:e.inFlight,prs:e.prs}})]}):f===`plan`?(0,b.jsxs)(`div`,{children:[(0,b.jsx)(oi,{missionId:e.missionId,plan:e.plan,objective:e.mission.objective,missionAcceptanceCriteria:e.mission.acceptanceCriteria,workers:e.workers,missionUpdatedAt:e.updatedAt,compact:!0,approvalRequired:e.mission.planFirst}),(0,b.jsx)(_i,{messages:e.messages,plan:e.plan})]}):f===`workers`?(0,b.jsxs)(`div`,{className:`space-y-4`,children:[(0,b.jsx)(bi,{budgets:e.mission.budgets,tokens:e.tokens,workers:e.workers,elapsedMs:Math.max(0,Date.now()-e.createdAt)}),(0,b.jsxs)(`section`,{className:`rounded-2xl border border-white/10 bg-[#101014] p-4`,children:[(0,b.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-2`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h3`,{className:`text-sm font-semibold text-white`,children:`Workers`}),(0,b.jsx)(`p`,{className:`mt-0.5 text-xs text-white/30`,children:`Select a worker here or at their desk.`})]}),Se>0&&(0,b.jsxs)(`span`,{className:`rounded-full bg-amber-400/10 px-2 py-1 text-[10px] text-amber-300`,children:[Se,` active`]})]}),(0,b.jsx)(qe,{workers:e.workers,onSelect:i,narrow:!0})]}),(0,b.jsx)(gr,{prs:e.prs,messages:e.messages})]}):f===`activity`?(0,b.jsxs)(`div`,{className:`space-y-3`,children:[e.detail&&(0,b.jsxs)(`section`,{className:`rounded-xl border border-white/[0.07] bg-white/[0.018] px-4 py-3`,children:[(0,b.jsx)(`p`,{className:`text-[9px] font-semibold uppercase tracking-[0.14em] text-white/25`,children:`Latest runtime note`}),(0,b.jsx)(`p`,{className:`mt-1.5 text-xs leading-relaxed text-white/45`,children:e.detail})]}),(0,b.jsxs)(`section`,{className:`rounded-2xl border border-white/10 bg-[#101014] p-4`,children:[(0,b.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-start justify-between gap-3`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h3`,{className:`text-sm font-semibold text-white`,children:`Activity timeline`}),(0,b.jsx)(`p`,{className:`mt-0.5 text-xs text-white/30`,children:`Live work, transitions, gaps, and bottlenecks`})]}),(0,b.jsx)(`div`,{className:`inline-flex rounded-lg border border-white/[0.06] bg-black/15 p-0.5`,children:[`feed`,`parallel`].map(e=>(0,b.jsx)(`button`,{type:`button`,onClick:()=>v(e),className:`rounded-md px-2.5 py-1 text-[9px] font-medium uppercase tracking-wider ${_===e?`bg-white/[0.08] text-white/65`:`text-white/25 hover:text-white/45`}`,children:e},e))})]}),_===`feed`?(0,b.jsx)(Tr,{events:e.recentEvents,compact:!0}):(0,b.jsx)(mi,{events:e.recentEvents,workers:e.workers,plan:e.plan,compact:!0})]})]}):(0,b.jsxs)(`div`,{className:`grid gap-4`,children:[(0,b.jsx)(wi,{missionId:e.missionId,initial:e.mission.policy}),(0,b.jsx)(xi,{jobs:e.jobHistory}),(0,b.jsx)(Si,{missionId:e.missionId}),(0,b.jsx)(Ci,{missionId:e.missionId})]});return(0,b.jsx)(`div`,{className:`space-y-5`,children:(0,b.jsxs)(`section`,{className:`overflow-hidden rounded-2xl border border-white/10 bg-[#0e0f13]`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 border-b border-white/[0.07] px-5 py-3`,children:[(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(`p`,{className:`text-[9px] font-semibold uppercase tracking-[0.2em] text-amber-200/45`,children:F?`Shared direct-agent workspace`:`Mission room`}),we?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`h2`,{className:`mt-1 text-base font-semibold text-white/75`,children:`Direct Studio overview`}),(0,b.jsx)(`p`,{className:`mt-1 max-w-2xl text-xs leading-relaxed text-white/35`,children:`All direct missions remain visible. Select a desk to inspect its agent.`})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{className:`mt-1 max-w-md`,children:(0,b.jsx)(Ee,{missionId:e.missionId,name:e.name})}),e.mission.objective&&(0,b.jsxs)(`button`,{type:`button`,onClick:()=>h(e=>!e),"aria-expanded":m,className:`mt-1 flex max-w-2xl cursor-pointer items-start gap-1.5 text-left text-xs leading-relaxed text-white/35 hover:text-white/55`,children:[(0,b.jsx)(`span`,{"aria-hidden":`true`,className:`mt-px shrink-0 text-[9px] text-white/25`,children:m?`▾`:`▸`}),(0,b.jsxs)(`span`,{className:m?``:`truncate`,children:[(0,b.jsx)(`span`,{className:`text-white/20`,children:`Goal:`}),` `,e.mission.objective]})]})]})]}),(0,b.jsxs)(`label`,{className:`flex items-center gap-1.5 rounded-lg border border-white/[0.07] bg-black/20 px-2.5 py-1.5 text-[9px] text-white/35`,children:[(0,b.jsx)(`span`,{children:`Talk`}),(0,b.jsxs)(`select`,{"aria-label":`Room dialogue`,value:E.dialogue,onChange:e=>D(t=>({...t,dialogue:e.target.value})),className:`bg-transparent text-[9px] text-white/55 outline-none`,children:[(0,b.jsx)(`option`,{value:`off`,children:`Off`}),(0,b.jsx)(`option`,{value:`work`,children:`Work only`}),(0,b.jsx)(`option`,{value:`work_personality`,children:`Work + personality`})]})]})]}),(0,b.jsx)(`div`,{className:`border-b border-white/[0.06] bg-black/[0.08] px-4 py-2.5`,children:we?Me:Ie}),(0,b.jsxs)(`div`,{className:`grid xl:grid-cols-[minmax(0,1fr)_480px]`,children:[(0,b.jsxs)(`div`,{className:`relative h-[520px] bg-[radial-gradient(circle_at_center,rgba(167,139,250,0.065),transparent_58%)] lg:h-[clamp(600px,calc(100vh_-_500px),730px)]`,children:[(0,b.jsxs)(`svg`,{viewBox:`4 -6 452 450`,role:`img`,"aria-label":F?`Spatial Direct Studio`:`Spatial room for ${e.name}`,className:`h-full w-full`,onClick:()=>{F&&l?.()},children:[(0,b.jsx)(`defs`,{children:(0,b.jsxs)(`filter`,{id:`direct-station-glow`,x:`-80%`,y:`-80%`,width:`260%`,height:`260%`,children:[(0,b.jsx)(`feGaussianBlur`,{stdDeviation:`4.5`,result:`blur`}),(0,b.jsx)(`feFlood`,{floodColor:`#55c7b3`,floodOpacity:`.48`,result:`color`}),(0,b.jsx)(`feComposite`,{in:`color`,in2:`blur`,operator:`in`,result:`glow`}),(0,b.jsxs)(`feMerge`,{children:[(0,b.jsx)(`feMergeNode`,{in:`glow`}),(0,b.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]})}),(0,b.jsxs)(`g`,{transform:`translate(-65 -45) scale(1.12)`,children:[(0,b.jsx)(`polygon`,{points:H(B),fill:`#17181f`,stroke:F?`#55c7b3`:`#a78bfa`,strokeOpacity:`.28`,strokeWidth:`2`}),(0,b.jsx)($t,{floor:B,doorway:ae,center:V(2.9,2.85,2),atmosphere:me,occupied:!F||de.length>0,scope:`detail`}),(0,b.jsx)(`polygon`,{points:H(oe),fill:`#23242d`,stroke:`#a78bfa`,strokeOpacity:`.22`}),(0,b.jsx)(`polygon`,{points:H(se),fill:`#1d1e26`,stroke:`#a78bfa`,strokeOpacity:`.18`}),(0,b.jsx)(tn,{x:.55,y:.55}),(0,b.jsx)(Yt,{x:3.75,y:.25}),(0,b.jsx)(Qt,{x:2.9,y:.35,atmosphere:me}),ee?(0,b.jsx)(qt,{x:.55,y:1.2,occupiedCount:fe.length}):R.map(([t,n],r)=>{let i=F?de.find(e=>e.seatIndex===r):void 0,a=!I&&r?z[r-1]:void 0,o=i?d.transitions[i.mission.missionId]:a?d.transitions[`${e.missionId}:${a.id}`]:!F&&r===0?d.transitions[e.missionId]:void 0,c=F?!!i:r===0||!!a,l=i?Bt(i.mission,void 0,o):a?Bt(e,a,o):!F&&r===0?Bt(e,void 0,o):void 0;return(0,b.jsx)(Gt,{x:t,y:n,role:I?`direct`:r===0?`manager`:`worker`,occupied:c,visualState:l?.state,monitor:l?.monitor??`vacant`,transition:o,selected:!!(i&&i.mission.missionId===s)},r)}),ee?fe.map((t,r)=>{let[i,o]=Ri[r],s=V(i,o,26);return(0,b.jsxs)(`g`,{role:`button`,tabIndex:0,"aria-label":`Open review mission ${t.mission.name}`,onClick:()=>a?.(t.mission.missionId),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&a?.(t.mission.missionId)},className:`cursor-pointer outline-none`,children:[(0,b.jsx)(`circle`,{cx:s.x,cy:s.y,r:`26`,fill:`transparent`,pointerEvents:`all`}),(0,b.jsx)(bn,{identity:t.mission.missionId,x:i,y:o,role:`review`,provider:t.mission.mission.provider,state:Nt(t.mission),needsAttention:t.mission.missionId===e.missionId&&n.length>0})]},t.mission.missionId)}):!F&&(0,b.jsxs)(`g`,{role:`button`,tabIndex:0,"aria-label":I?`Open direct mission ${e.name}`:`Open orchestrator for ${e.name}`,onClick:()=>p(`conversation`),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&p(`conversation`)},className:`cursor-pointer outline-none`,children:[(0,b.jsx)(`title`,{children:e.name}),(0,b.jsx)(`polygon`,{"data-hit-target":`desk`,points:Wt(R[0][0],R[0][1],I?`direct`:`manager`),fill:`transparent`,pointerEvents:`all`}),(0,b.jsx)(`circle`,{cx:le.x,cy:le.y,r:`28`,fill:`transparent`,pointerEvents:`all`}),(0,b.jsx)(bn,{identity:e.missionId,x:R[0][0]+.36,y:R[0][1]+.78,role:I?`direct`:`manager`,provider:e.mission.provider,state:ce,needsAttention:n.length>0,interaction:ve?.interaction===`delegating`?`delegating`:ve?.interaction===`reporting`?`receiving-report`:void 0,interactionTarget:xe})]}),F&&de.map(({mission:e,seatIndex:t})=>{let[n,r]=R[t],i=V(n+.36,r+.72,26),a=e.missionId===s;return(0,b.jsxs)(`g`,{role:`button`,tabIndex:0,"aria-label":`Inspect direct agent ${e.name}`,"data-agent-selected":a?`true`:void 0,onClick:t=>{t.stopPropagation(),c?.(e.missionId),p(`conversation`)},onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),t.stopPropagation(),c?.(e.missionId),p(`conversation`))},className:`cursor-pointer outline-none`,children:[(0,b.jsx)(`title`,{children:e.name}),(0,b.jsx)(`polygon`,{"data-hit-target":`desk`,points:Wt(n,r,`direct`),fill:`transparent`,pointerEvents:`all`}),(0,b.jsx)(`circle`,{cx:i.x,cy:i.y,r:`27`,fill:`transparent`,pointerEvents:`all`}),(0,b.jsx)(bn,{identity:e.missionId,x:n+.36,y:r+.72,role:`direct`,provider:e.mission.provider,state:Nt(e)})]},e.missionId)}),!ee&&z.map((t,n)=>{let[r,a]=R[n+1],o=V(r+.36,a+.72,26),s=d.transitions[`${e.missionId}:${t.id}`],c=s===`reporting`||s===`exiting`||n===ye;return(0,b.jsxs)(`g`,{role:`button`,tabIndex:0,"aria-label":`Inspect worker ${t.label}`,onClick:()=>i(t),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&i(t)},className:`cursor-pointer outline-none`,children:[(0,b.jsx)(`polygon`,{"data-hit-target":`desk`,points:Wt(r,a,`worker`),fill:`transparent`,pointerEvents:`all`}),(0,b.jsx)(`circle`,{cx:o.x,cy:o.y,r:`26`,fill:`transparent`,pointerEvents:`all`}),(0,b.jsx)(bn,{identity:`${e.missionId}:${t.id}`,x:r+.36,y:a+.72,role:`worker`,provider:e.mission.provider,state:s===`working`||s===`arrived`?`working`:Mt(t,e),transition:s,route:pe,interaction:s===`reporting`?`reporting`:c&&ve?.interaction!==`reporting`?`receiving-assignment`:void 0,interactionTarget:c?be:void 0})]},t.id)}),!ee&&z.some(t=>d.transitions[`${e.missionId}:${t.id}`]===`reporting`)&&(()=>{let e=V(be.x,be.y,34);return(0,b.jsxs)(`g`,{className:`office-handoff-document`,"aria-hidden":`true`,children:[(0,b.jsx)(`rect`,{x:e.x+8,y:e.y-18,width:`12`,height:`15`,rx:`1.5`,fill:`#f5f1e8`,stroke:`#e6bd62`}),(0,b.jsx)(`path`,{d:`M ${e.x+11} ${e.y-13}h6M ${e.x+11} ${e.y-10}h6M ${e.x+11} ${e.y-7}h4`,stroke:`#665f51`,strokeWidth:`1`})]})})(),!F&&_e(ge(e.missionId),R[0][0]+.36,R[0][1]+.78),F&&de.map(({mission:e,seatIndex:t})=>{let[n,r]=R[t];return _e(ge(e.missionId),n+.36,r+.72)}),!ee&&z.map((t,n)=>{let r=d.transitions[`${e.missionId}:${t.id}`];if([`room-activate`,`desk-reserved`,`entering`].includes(r??``))return null;let[i,a]=R[n+1];return _e(ge(`${e.missionId}:${t.id}`),i+.36,a+.72,t)})]})]}),(0,b.jsxs)(`div`,{className:`pointer-events-none absolute bottom-4 left-4 flex flex-wrap gap-2 text-[9px]`,children:[(0,b.jsx)(`span`,{className:`rounded-full border border-amber-300/15 bg-black/35 px-2.5 py-1 text-amber-100/55`,children:F?`Agents · click a desk to inspect`:`${I?`Direct agent`:`Manager`} · click to converse`}),!I&&(0,b.jsx)(`span`,{className:`rounded-full border border-violet-300/15 bg-black/35 px-2.5 py-1 text-violet-100/55`,children:`Workers · click to inspect`}),ie>0&&(0,b.jsxs)(`span`,{className:`rounded-full border border-orange-300/15 bg-black/35 px-2.5 py-1 text-orange-100/60`,children:[`+`,ie,` workers outside visible capacity`]})]})]}),(0,b.jsxs)(`aside`,{className:`room-sidebar min-w-0 break-words border-t border-white/[0.06] bg-black/[0.08] p-4 [overflow-wrap:anywhere] sm:p-5 xl:max-h-[clamp(600px,calc(100vh_-_500px),730px)] xl:border-l xl:border-t-0 ${!we&&f===`conversation`?`xl:flex xl:h-[clamp(600px,calc(100vh_-_500px),730px)] xl:flex-col xl:overflow-hidden`:`xl:overflow-y-auto`}`,children:[!we&&(0,b.jsx)(`div`,{className:`mb-2 shrink-0`,children:Fe}),we&&(0,b.jsxs)(`div`,{className:`mb-3 flex shrink-0 items-center justify-between gap-3`,children:[(0,b.jsx)(`p`,{className:`text-[9px] font-semibold uppercase tracking-[0.18em] text-white/25`,children:`Direct Studio`}),(0,b.jsx)(`p`,{className:`text-[9px] text-white/18`,children:`Select a desk`})]}),(0,b.jsx)(`div`,{className:`mission-presentation-enter ${!we&&f===`conversation`?`xl:min-h-0 xl:flex-1`:``}`,children:Le},we?`studio`:`${e.missionId}:${f}`)]})]})]})})}function Hi(e){let t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t%3600/60);return n?`${n}h ${r}m`:`${r}m ${t%60}s`}function K(e){return e.workerId?`workers`:e.id===`unclear-wait`?`conversation`:`activity`}function q({mission:e,tone:t,title:n,detail:r,onOpen:i}){return(0,b.jsxs)(`button`,{type:`button`,onClick:i,className:`mb-3 flex w-full cursor-pointer items-center justify-between gap-4 rounded-xl border px-4 py-3 text-left transition hover:brightness-125 ${t===`rose`?`border-rose-400/20 bg-rose-400/[0.06] text-rose-100/80`:t===`orange`?`border-orange-400/20 bg-orange-400/[0.06] text-orange-100/80`:t===`amber`?`border-amber-300/20 bg-amber-300/[0.06] text-amber-100/80`:`border-slate-400/10 bg-slate-400/[0.04] text-slate-200/70`}`,children:[(0,b.jsxs)(`span`,{className:`min-w-0`,children:[(0,b.jsxs)(`span`,{className:`block text-sm font-medium`,children:[(0,b.jsx)(`span`,{className:`text-white/90`,children:e.name}),` · `,n]}),(0,b.jsx)(`span`,{className:`mt-1 block text-xs leading-relaxed opacity-65`,children:r})]}),(0,b.jsx)(`span`,{className:`shrink-0 text-[10px] font-medium opacity-55`,children:`Open →`})]})}function Ui({label:e,value:t,accent:n}){return(0,b.jsxs)(`div`,{className:`rounded-xl border border-white/8 bg-white/[0.025] px-4 py-3`,children:[(0,b.jsx)(`p`,{className:`text-lg font-semibold ${n??`text-white/85`}`,children:t}),(0,b.jsx)(`p`,{className:`mt-0.5 text-[10px] font-medium uppercase tracking-wider text-white/25`,children:e})]})}function Wi(e){return e.split(`/.claude/worktrees/`)[0].split(`/`).at(-1)??e}function Gi({node:e,fleetMissions:t=[e],decisions:n=[],onBack:r,initialPresentation:i=`details`,presentation:a=i,onPresentationChange:o=()=>void 0,initialWorkerId:s,onWorkerClose:c,onReviewMissionSelect:l,studioMissions:u,selectedStudioMissionId:d,onStudioMissionSelect:f,onStudioClear:p}){let[m,h]=(0,g.useState)({});(0,g.useEffect)(()=>{ve().then(({providers:e})=>h(Object.fromEntries(e.flatMap(e=>e.defaultModel?[[e.provider,e.defaultModel.label]]:[])))).catch(()=>h({}))},[]);let _=m[e.mission.provider??`claude`],[v,y]=(0,g.useState)(Date.now()),[x,C]=(0,g.useState)(()=>e.workers.find(e=>e.id===s)??null),[w,T]=(0,g.useState)(`feed`),[E,D]=(0,g.useState)(`conversation`),[O,k]=(0,g.useState)(),[A,j]=(0,g.useState)(),M=()=>j(Date.now()),N=n.length>0,P=(0,g.useRef)(null),F=e.lifecycleStatus===`completed`||e.lifecycleStatus===`archived`;(0,g.useEffect)(()=>{let e=setInterval(()=>y(Date.now()),1e3);return()=>clearInterval(e)},[]);let I=e.workers.filter(e=>!e.doneAt&&(e.jobState===`working`||e.jobState===`busy`)).length,ee=e.status===`working`?v:e.updatedAt,te=!!u,L=u?.filter(e=>e.activityStatus===`working`).length??0,ne=u?.filter(e=>e.activityStatus===`waiting_on_you`||e.activityStatus===`error`||e.activityStatus===`stalled`).length??0,R=(t,n,r)=>{if(te&&t.missionId!==d&&f?.(t.missionId),D(n),k({panel:n,token:Date.now()}),r){let n=t.workers.find(e=>e.id===r);n&&t.missionId===e.missionId&&C(n)}window.requestAnimationFrame(()=>P.current?.scrollIntoView({behavior:`smooth`,block:`start`}))},re=te?(0,b.jsxs)(`header`,{className:`mb-6`,children:[(0,b.jsx)(`p`,{className:`text-[10px] font-semibold uppercase tracking-[0.2em] text-emerald-200/45`,children:`Shared workspace`}),(0,b.jsx)(`h1`,{className:`mt-1 text-2xl font-semibold text-white/85`,children:`Direct Studio`}),(0,b.jsx)(`p`,{className:`mt-2 max-w-2xl text-sm leading-relaxed text-white/35`,children:`Independent direct agents share this room. Select a desk to inspect and converse with that mission.`})]}):(0,b.jsxs)(`header`,{className:`mb-6 flex flex-wrap items-start justify-between gap-4`,children:[(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(Ee,{missionId:e.missionId,name:e.name,large:!0}),(0,b.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-white/30`,children:[(0,b.jsxs)(`span`,{className:`mono`,children:[`mission `,e.missionId.slice(0,8)]}),(0,b.jsx)(`span`,{children:`·`}),(0,b.jsx)(`span`,{className:`capitalize`,children:e.mission.mode}),(0,b.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[9px] font-semibold uppercase ${e.mission.provider===`codex`?`bg-emerald-300/[0.09] text-emerald-200/60`:`bg-violet-300/[0.09] text-violet-200/60`}`,children:e.mission.provider??`claude`}),(0,b.jsx)(`span`,{className:`mono rounded bg-white/[0.04] px-1.5 py-0.5 text-[10px] text-white/40`,children:e.mission.model??(_?`CLI default (${_})`:`CLI default`)}),e.mission.repository&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{children:`·`}),(0,b.jsx)(`span`,{className:`mono text-white/40`,title:e.mission.repository,children:Wi(e.mission.repository)})]}),e.mission.additionalRepositories?.map(e=>(0,b.jsxs)(`span`,{className:`mono rounded bg-sky-300/[0.06] px-1.5 py-0.5 text-[10px] text-sky-200/50`,title:e,children:[`+ `,Wi(e)]},e)),e.mission.template&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{children:`·`}),(0,b.jsxs)(`span`,{className:`text-amber-200/50`,children:[e.mission.template.name,` v`,e.mission.template.version,` · `,e.mission.template.source]})]}),e.mission.planFirst&&(0,b.jsx)(`span`,{className:`rounded bg-amber-300/[0.08] px-1.5 py-0.5 text-[9px] font-semibold uppercase text-amber-200/55`,children:`Plan first`}),e.worktreeBranch&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{children:`·`}),(0,b.jsx)(`span`,{className:`mono text-violet-300/60`,children:e.worktreeBranch})]})]})]}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,b.jsx)(Ye,{status:e.lifecycleStatus}),!F&&(0,b.jsx)(S,{status:e.activityStatus}),!F&&(0,b.jsx)(Me,{pid:e.pid,status:e.activityStatus}),(0,b.jsx)(Br,{missionId:e.missionId,status:e.lifecycleStatus,onDeleted:r})]})]}),z=(t,n=!0)=>(0,b.jsxs)(`div`,{children:[t.activityStatus===`waiting_on_you`&&!(N&&t.missionId===e.missionId)&&(0,b.jsx)(q,{mission:t,tone:`rose`,title:`Waiting for your reply`,detail:t.waitingFor??`Open the conversation to review what this agent needs.`,onOpen:()=>R(t,`conversation`)}),t.activityStatus===`stalled`&&(0,b.jsx)(q,{mission:t,tone:`orange`,title:`Work appears stalled`,detail:`No meaningful activity for ${Hi(t.inactiveForMs)}. Open activity to inspect the evidence and recovery options.`,onOpen:()=>R(t,`activity`)}),t.activityStatus===`error`&&(0,b.jsx)(q,{mission:t,tone:`rose`,title:`Runtime needs attention`,detail:`Open activity to inspect the failure and recent execution evidence.`,onOpen:()=>R(t,`activity`)}),n&&t.activityStatus===`idle`&&t.lifecycleStatus===`active`&&(0,b.jsx)(q,{mission:t,tone:`slate`,title:t.turnCompleted?`Latest turn finished`:`Mission is idle`,detail:t.turnCompleted?`The mission remains open for follow-up or manual completion.`:`No orchestrator or worker is currently doing work.`,onOpen:()=>R(t,`conversation`)}),t.lifecycleStatus===`ready_for_review`&&(0,b.jsx)(q,{mission:t,tone:`amber`,title:`Ready for your acceptance`,detail:`Review the plan evidence, accept completion, or request changes.`,onOpen:()=>R(t,`plan`)}),(0,b.jsx)(fi,{alerts:t.alerts??[],missionName:t.name,onNavigate:e=>R(t,K(e),e.workerId)})]},`notices:${t.missionId}`),ie=(0,b.jsxs)(b.Fragment,{children:[N&&!F?(0,b.jsx)(Ae,{decisions:n,onOpenMission:()=>void 0,showMission:!1,presentation:`drawer`,openToken:A,className:`mb-3`}):null,te?u?.map(e=>z(e,!1)):z(e)]}),B=te?(0,b.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[(0,b.jsx)(Ui,{label:`Occupied desks`,value:`${u?.length??0}/8`}),(0,b.jsx)(Ui,{label:`Working`,value:`${L}`,accent:L?`text-amber-300`:void 0}),(0,b.jsx)(Ui,{label:`Needs attention`,value:`${ne}`,accent:ne?`text-rose-300`:void 0}),(0,b.jsx)(Ui,{label:`Total tokens`,value:`${(u??[]).reduce((e,t)=>e+t.tokens,0).toLocaleString()}`})]}):(0,b.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[(0,b.jsx)(Ui,{label:`This turn`,value:Hi(ee-e.runStartedAt)}),(0,b.jsx)(Ui,{label:`Workers`,value:`${e.workers.length}`,accent:I?`text-amber-300`:void 0}),(0,b.jsx)(Ui,{label:`Active now`,value:`${I}`,accent:I?`text-amber-300`:void 0}),(0,b.jsx)(Ui,{label:`Tokens`,value:e.tokens.toLocaleString()})]});return(0,b.jsx)(Ei,{onBack:r,header:re,notices:ie,metrics:a===`details`?B:null,presentation:a,onPresentationChange:o,view:E,onViewChange:D,activeWorkers:I,children:(0,b.jsxs)(`div`,{ref:P,className:`scroll-mt-4`,children:[a===`room`&&(0,b.jsx)(Vi,{node:e,fleetMissions:t,decisions:n,onOpenDecisions:N?M:void 0,onSelectWorker:C,onReviewMissionSelect:l,studioMissions:u,selectedStudioMissionId:d,onStudioMissionSelect:f,onStudioClear:p,requestedPanel:O}),a===`details`&&(0,b.jsxs)(b.Fragment,{children:[E===`conversation`&&(0,b.jsxs)(`div`,{className:`space-y-4`,children:[(0,b.jsx)(gr,{prs:e.prs,messages:e.messages}),(0,b.jsx)(zr,{missionId:e.missionId,repository:e.mission.repository,provider:e.mission.provider,messages:e.messages,hasMoreMessages:e.hasMoreMessages,onOpenDecisions:N?M:void 0,live:{status:e.activityStatus,lifecycle:e.lifecycleStatus,detail:e.detail,waitingFor:e.waitingFor,workers:e.workers,inFlight:e.inFlight,prs:e.prs}})]}),E===`plan`&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(oi,{missionId:e.missionId,plan:e.plan,objective:e.mission.objective,missionAcceptanceCriteria:e.mission.acceptanceCriteria,workers:e.workers,missionUpdatedAt:e.updatedAt,approvalRequired:e.mission.planFirst}),(0,b.jsx)(_i,{messages:e.messages,plan:e.plan})]}),E===`workers`&&(0,b.jsxs)(`div`,{className:`grid items-start gap-6 lg:grid-cols-2`,children:[(0,b.jsxs)(`div`,{className:`space-y-6`,children:[(0,b.jsx)(bi,{budgets:e.mission.budgets,tokens:e.tokens,workers:e.workers,elapsedMs:Math.max(0,ee-e.createdAt)}),(0,b.jsxs)(`section`,{className:`rounded-2xl border border-white/10 bg-[#101014] p-4`,children:[(0,b.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Workers`}),(0,b.jsx)(`p`,{className:`mt-0.5 text-xs text-white/30`,children:`Delegated tasks and runtime`})]}),I>0&&(0,b.jsxs)(`span`,{className:`rounded-full bg-amber-400/10 px-2 py-1 text-[10px] font-medium text-amber-300`,children:[I,` active`]})]}),(0,b.jsx)(qe,{workers:e.workers,onSelect:C}),(e.inFlight.tasks>0||e.inFlight.queued>0)&&(0,b.jsxs)(`div`,{className:`mt-3 flex gap-3 rounded-lg bg-white/[0.03] px-3 py-2 text-xs text-white/35`,children:[(0,b.jsxs)(`span`,{children:[e.inFlight.tasks,` in flight`]}),(0,b.jsxs)(`span`,{children:[e.inFlight.queued,` queued`]})]})]})]}),(0,b.jsx)(`div`,{className:`space-y-6`,children:(0,b.jsx)(gr,{prs:e.prs,messages:e.messages})})]}),E===`activity`&&(0,b.jsxs)(`div`,{className:`space-y-4`,children:[e.detail&&(0,b.jsxs)(`section`,{className:`rounded-xl border border-white/[0.07] bg-white/[0.018] px-4 py-3`,children:[(0,b.jsx)(`p`,{className:`text-[9px] font-semibold uppercase tracking-[0.14em] text-white/25`,children:`Latest runtime note`}),(0,b.jsx)(`p`,{className:`mt-1.5 text-xs leading-relaxed text-white/45`,children:e.detail})]}),(0,b.jsxs)(`section`,{className:`rounded-2xl border border-white/10 bg-[#101014] p-5`,children:[(0,b.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-start justify-between gap-3`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Activity timeline`}),(0,b.jsx)(`p`,{className:`mt-0.5 text-xs text-white/30`,children:`Orchestrator transitions, tools, workers, gaps, and bottlenecks`})]}),(0,b.jsx)(`div`,{className:`inline-flex rounded-lg border border-white/[0.06] bg-black/15 p-0.5`,children:[`feed`,`parallel`].map(e=>(0,b.jsx)(`button`,{onClick:()=>T(e),className:`rounded-md px-2.5 py-1 text-[9px] font-medium uppercase tracking-wider ${w===e?`bg-white/[0.08] text-white/65`:`text-white/25 hover:text-white/45`}`,children:e},e))})]}),w===`feed`?(0,b.jsx)(Tr,{events:e.recentEvents}):(0,b.jsx)(mi,{events:e.recentEvents,workers:e.workers,plan:e.plan})]})]}),E===`technical`&&(0,b.jsxs)(`div`,{className:`grid items-start gap-6 lg:grid-cols-2`,children:[(0,b.jsxs)(`div`,{className:`space-y-6`,children:[(0,b.jsxs)(`section`,{className:`rounded-2xl border border-white/10 bg-[#101014] p-4`,children:[(0,b.jsx)(`h2`,{className:`text-sm font-semibold text-white`,children:`Runtime identity`}),(0,b.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-white/35`,children:`Hive keeps one durable mission while Claude creates a new background job for each follow-up turn. These identifiers are diagnostic details and do not change the conversation.`}),(0,b.jsxs)(`dl`,{className:`mt-3 grid grid-cols-[110px_1fr] gap-y-2 text-xs`,children:[(0,b.jsx)(`dt`,{className:`text-white/25`,children:`Mission ID`}),(0,b.jsx)(`dd`,{className:`font-mono text-white/50`,children:e.missionId}),(0,b.jsx)(`dt`,{className:`text-white/25`,children:`Current job`}),(0,b.jsx)(`dd`,{className:`font-mono text-white/50`,children:e.jobId}),(0,b.jsx)(`dt`,{className:`text-white/25`,children:`Process ID`}),(0,b.jsx)(`dd`,{className:`font-mono text-white/50`,children:e.pid>=0?e.pid:`not running`}),(0,b.jsx)(`dt`,{className:`text-white/25`,children:`Job turns`}),(0,b.jsx)(`dd`,{className:`text-white/50`,children:e.jobIds.length})]})]}),(0,b.jsx)(wi,{missionId:e.missionId,initial:e.mission.policy}),(0,b.jsx)(xi,{jobs:e.jobHistory})]}),(0,b.jsxs)(`div`,{className:`space-y-6`,children:[(0,b.jsx)(Si,{missionId:e.missionId}),(0,b.jsx)(Ci,{missionId:e.missionId})]})]})]}),x&&(0,b.jsx)(ui,{missionId:e.missionId,worker:e.workers.find(e=>e.id===x.id&&e.jobId===x.jobId)??x,plan:e.plan,events:e.recentEvents,onClose:()=>{C(null),c?.()}})]})})}function Ki(e){let t=typeof Notification<`u`,[n,r]=(0,g.useState)(()=>t&&Notification.permission===`granted`&&localStorage.getItem(`hive:decision-notifications`)===`on`),i=(0,g.useRef)(null);(0,g.useEffect)(()=>{if(!i.current){i.current=new Set(e.map(e=>e.id));return}for(let t of e)i.current.has(t.id)||(i.current.add(t.id),n&&Notification.permission===`granted`&&new Notification(`Hive · ${t.missionName}`,{body:t.question,tag:`hive-decision:${t.id}`}))},[e,n]);async function a(){if(t){if(n){r(!1),localStorage.setItem(`hive:decision-notifications`,`off`);return}(Notification.permission===`granted`?`granted`:await Notification.requestPermission())===`granted`&&(r(!0),localStorage.setItem(`hive:decision-notifications`,`on`))}}return{supported:t,enabled:n,toggle:a}}var qi;function Ji(){try{return qi??=new AudioContext,qi.state===`suspended`&&qi.resume(),qi}catch{return}}function Yi(e,t,n,r){let i=e.createOscillator(),a=e.createGain();i.type=`sine`,i.frequency.value=t,a.gain.setValueAtTime(0,n),a.gain.linearRampToValueAtTime(.07,n+.015),a.gain.exponentialRampToValueAtTime(5e-4,n+r),i.connect(a).connect(e.destination),i.start(n),i.stop(n+r+.05)}function Xi(){let e=Ji();if(!e)return;let t=e.currentTime;Yi(e,659.25,t,.16),Yi(e,880,t+.14,.22)}function Zi(){let e=Ji();if(!e)return;let t=e.currentTime;Yi(e,523.25,t,.18),Yi(e,659.25,t+.13,.18),Yi(e,783.99,t+.26,.3)}function Qi(e){let[t,n]=(0,g.useState)(()=>typeof window<`u`&&localStorage.getItem(`hive:sounds`)===`on`),r=(0,g.useRef)(null);return(0,g.useEffect)(()=>{if(!e)return;let n=new Map(e.orchestrators.map(e=>[e.missionId,{activity:e.activityStatus,lifecycle:e.lifecycleStatus}])),i=r.current;if(r.current=n,!i||!t)return;let a=!1,o=!1;for(let[e,t]of n){let n=i.get(e);t.lifecycle===`ready_for_review`&&n?.lifecycle!==`ready_for_review`?o=!0:t.lifecycle===`active`&&t.activity===`waiting_on_you`&&n?.activity!==`waiting_on_you`&&(a=!0)}o&&Zi(),a&&window.setTimeout(Xi,o?700:0)},[e,t]),{enabled:t,toggle:()=>n(e=>{let t=!e;try{localStorage.setItem(`hive:sounds`,t?`on`:`off`)}catch{}return t&&Xi(),t})}}function $i(){let{snapshot:e,connected:t,lastDisconnectedAt:n,reconnect:r}=v(),[i,a]=Ai(),[o,s]=(0,g.useState)(()=>typeof window>`u`?null:new URLSearchParams(window.location.search).get(`mission`)),[c,l]=(0,g.useState)(()=>typeof window<`u`&&new URLSearchParams(window.location.search).get(`presentation`)===`room`?`room`:i.missionPresentation),[u,d]=(0,g.useState)(()=>typeof window>`u`?null:new URLSearchParams(window.location.search).get(`worker`)),[f,p]=(0,g.useState)(()=>typeof window<`u`&&new URLSearchParams(window.location.search).get(`space`)===`direct-studio`),m=Ki(e?.decisions??[]),h=Qi(e??void 0),_=(e,t,n)=>{let r=t??i.missionPresentation;if(s(e),l(r),d(n??null),typeof window<`u`){let t=new URL(window.location.href);e?t.searchParams.set(`mission`,e):t.searchParams.delete(`mission`),e&&r===`room`?t.searchParams.set(`presentation`,`room`):t.searchParams.delete(`presentation`),e&&n?t.searchParams.set(`worker`,n):t.searchParams.delete(`worker`),window.history.replaceState({},``,t)}},y=()=>{if(d(null),typeof window<`u`){let e=new URL(window.location.href);e.searchParams.delete(`worker`),window.history.replaceState({},``,e)}},x=e=>{if(p(!0),s(e??null),d(null),l(`room`),typeof window<`u`){let t=new URL(window.location.href);t.searchParams.set(`space`,`direct-studio`),t.searchParams.set(`presentation`,`room`),e?t.searchParams.set(`mission`,e):t.searchParams.delete(`mission`),t.searchParams.delete(`worker`),window.history.replaceState({},``,t)}},S=()=>{if(p(!1),s(null),typeof window<`u`){let e=new URL(window.location.href);e.searchParams.delete(`space`),e.searchParams.delete(`mission`),e.searchParams.delete(`presentation`),window.history.replaceState({},``,e)}},C=e=>{let t=e===`office`?`room`:`details`;if(a(n=>({...n,fleetPresentation:e,missionPresentation:t})),l(t),typeof window<`u`){let e=new URL(window.location.href);(o||f)&&t===`room`?e.searchParams.set(`presentation`,`room`):e.searchParams.delete(`presentation`),f&&t===`details`&&e.searchParams.delete(`space`),window.history.replaceState({},``,e)}f&&t===`details`&&p(!1)};if(!e)return(0,b.jsx)(`div`,{className:`flex h-screen items-center justify-center px-6`,children:(0,b.jsxs)(`div`,{className:`max-w-md rounded-2xl border border-white/10 bg-white/[0.025] p-6 text-center`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-white/55`,children:t?`Loading fleet…`:`Connecting to Hive…`}),(0,b.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-white/25`,children:t?`The server is connected and preparing the durable mission snapshot.`:`Make sure npm run dev is running. Hive will retry automatically.`}),!t&&(0,b.jsx)(`button`,{onClick:r,className:`mt-4 rounded-lg border border-amber-300/15 bg-amber-300/[0.05] px-3 py-2 text-xs text-amber-200/60 hover:bg-amber-300/[0.09]`,children:`Retry now`})]})});let w=o?e.orchestrators.find(e=>e.missionId===o):void 0,T=Hn(e.orchestrators,i.roomAssignments).placements.filter(e=>e.floorIndex===0&&e.spaceId===`direct-studio`).sort((e,t)=>e.seatIndex-t.seatIndex).map(e=>e.mission);if(f&&T.length){let i=T.find(e=>e.missionId===o);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(ea,{connected:t,lastDisconnectedAt:n,reconnect:r}),(0,b.jsx)(Gi,{node:i??T[0],fleetMissions:e.orchestrators,decisions:i?(e.decisions??[]).filter(e=>e.missionId===i.missionId):[],initialPresentation:`room`,presentation:`room`,onPresentationChange:C,studioMissions:T,selectedStudioMissionId:i?.missionId,onStudioMissionSelect:e=>x(e),onStudioClear:()=>x(),onBack:S})]})}return w?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(ea,{connected:t,lastDisconnectedAt:n,reconnect:r}),(0,b.jsx)(Gi,{node:w,fleetMissions:e.orchestrators,decisions:(e.decisions??[]).filter(e=>e.missionId===w.missionId),initialPresentation:c,presentation:c,onPresentationChange:C,initialWorkerId:u??void 0,onWorkerClose:y,onReviewMissionSelect:e=>_(e,`room`),onBack:()=>_(null)},w.missionId)]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(ea,{connected:t,lastDisconnectedAt:n,reconnect:r}),(0,b.jsx)(lr,{snapshot:e,connected:t,officePreferences:i,setOfficePreferences:a,onPresentationChange:C,onSelectOrchestrator:(e,t,n)=>_(e,t,n),onSelectDirectStudio:x,notifications:m,sounds:h})]})}function ea({connected:e,lastDisconnectedAt:t,reconnect:n}){return e?null:(0,b.jsxs)(`div`,{role:`status`,className:`sticky top-0 z-40 flex flex-wrap items-center justify-center gap-2 border-b border-orange-300/15 bg-[#261a0f]/95 px-4 py-2 text-xs text-orange-100/65 backdrop-blur`,children:[(0,b.jsxs)(`span`,{children:[`Live updates disconnected`,t?` at ${new Date(t).toLocaleTimeString()}`:``,`. Showing the last durable snapshot.`]}),(0,b.jsx)(`button`,{onClick:n,className:`rounded-md border border-orange-200/15 px-2 py-1 text-[10px] font-medium text-orange-100/70 hover:bg-orange-200/[0.08]`,children:`Reconnect now`}),(0,b.jsx)(`span`,{className:`text-orange-100/30`,children:`If this persists, restart npm run dev; mission data remains on disk.`})]})}h.createRoot(document.getElementById(`root`)).render((0,b.jsx)(g.StrictMode,{children:(0,b.jsx)($i,{})}));