@software-dlc/cli 0.192.16 → 0.192.17

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,394 @@
1
+ function W1(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&&!Array.isArray(a)){for(const r in a)if(r!=="default"&&!(r in e)){const l=Object.getOwnPropertyDescriptor(a,r);l&&Object.defineProperty(e,r,l.get?l:{enumerable:!0,get:()=>a[r]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function Ay(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var My={exports:{}},Uu={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var Z1=Symbol.for("react.transitional.element"),J1=Symbol.for("react.fragment");function $y(e,t,n){var a=null;if(n!==void 0&&(a=""+n),t.key!==void 0&&(a=""+t.key),"key"in t){n={};for(var r in t)r!=="key"&&(n[r]=t[r])}else n=t;return t=n.ref,{$$typeof:Z1,type:e,key:a,ref:t!==void 0?t:null,props:n}}Uu.Fragment=J1;Uu.jsx=$y;Uu.jsxs=$y;My.exports=Uu;var s=My.exports,Oy={exports:{}},Ae={};/**
10
+ * @license React
11
+ * react.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var Nm=Symbol.for("react.transitional.element"),eS=Symbol.for("react.portal"),tS=Symbol.for("react.fragment"),nS=Symbol.for("react.strict_mode"),sS=Symbol.for("react.profiler"),aS=Symbol.for("react.consumer"),rS=Symbol.for("react.context"),lS=Symbol.for("react.forward_ref"),iS=Symbol.for("react.suspense"),oS=Symbol.for("react.memo"),Dy=Symbol.for("react.lazy"),Gx=Symbol.iterator;function cS(e){return e===null||typeof e!="object"?null:(e=Gx&&e[Gx]||e["@@iterator"],typeof e=="function"?e:null)}var zy={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ly=Object.assign,Uy={};function Sl(e,t,n){this.props=e,this.context=t,this.refs=Uy,this.updater=n||zy}Sl.prototype.isReactComponent={};Sl.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Sl.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function By(){}By.prototype=Sl.prototype;function km(e,t,n){this.props=e,this.context=t,this.refs=Uy,this.updater=n||zy}var Sm=km.prototype=new By;Sm.constructor=km;Ly(Sm,Sl.prototype);Sm.isPureReactComponent=!0;var Vx=Array.isArray,ot={H:null,A:null,T:null,S:null,V:null},Hy=Object.prototype.hasOwnProperty;function Cm(e,t,n,a,r,l){return n=l.ref,{$$typeof:Nm,type:e,key:t,ref:n!==void 0?n:null,props:l}}function uS(e,t){return Cm(e.type,t,void 0,void 0,void 0,e.props)}function Rm(e){return typeof e=="object"&&e!==null&&e.$$typeof===Nm}function dS(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Yx=/\/+/g;function Gd(e,t){return typeof e=="object"&&e!==null&&e.key!=null?dS(""+e.key):t.toString(36)}function Fx(){}function fS(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(Fx,Fx):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function Or(e,t,n,a,r){var l=typeof e;(l==="undefined"||l==="boolean")&&(e=null);var i=!1;if(e===null)i=!0;else switch(l){case"bigint":case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case Nm:case eS:i=!0;break;case Dy:return i=e._init,Or(i(e._payload),t,n,a,r)}}if(i)return r=r(e),i=a===""?"."+Gd(e,0):a,Vx(r)?(n="",i!=null&&(n=i.replace(Yx,"$&/")+"/"),Or(r,t,n,"",function(d){return d})):r!=null&&(Rm(r)&&(r=uS(r,n+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(Yx,"$&/")+"/")+i)),t.push(r)),1;i=0;var o=a===""?".":a+":";if(Vx(e))for(var c=0;c<e.length;c++)a=e[c],l=o+Gd(a,c),i+=Or(a,t,n,l,r);else if(c=cS(e),typeof c=="function")for(e=c.call(e),c=0;!(a=e.next()).done;)a=a.value,l=o+Gd(a,c++),i+=Or(a,t,n,l,r);else if(l==="object"){if(typeof e.then=="function")return Or(fS(e),t,n,a,r);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return i}function Po(e,t,n){if(e==null)return e;var a=[],r=0;return Or(e,a,"","",function(l){return t.call(n,l,r++)}),a}function hS(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Kx=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)};function mS(){}Ae.Children={map:Po,forEach:function(e,t,n){Po(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Po(e,function(){t++}),t},toArray:function(e){return Po(e,function(t){return t})||[]},only:function(e){if(!Rm(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ae.Component=Sl;Ae.Fragment=tS;Ae.Profiler=sS;Ae.PureComponent=km;Ae.StrictMode=nS;Ae.Suspense=iS;Ae.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=ot;Ae.__COMPILER_RUNTIME={__proto__:null,c:function(e){return ot.H.useMemoCache(e)}};Ae.cache=function(e){return function(){return e.apply(null,arguments)}};Ae.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var a=Ly({},e.props),r=e.key,l=void 0;if(t!=null)for(i in t.ref!==void 0&&(l=void 0),t.key!==void 0&&(r=""+t.key),t)!Hy.call(t,i)||i==="key"||i==="__self"||i==="__source"||i==="ref"&&t.ref===void 0||(a[i]=t[i]);var i=arguments.length-2;if(i===1)a.children=n;else if(1<i){for(var o=Array(i),c=0;c<i;c++)o[c]=arguments[c+2];a.children=o}return Cm(e.type,r,void 0,void 0,l,a)};Ae.createContext=function(e){return e={$$typeof:rS,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:aS,_context:e},e};Ae.createElement=function(e,t,n){var a,r={},l=null;if(t!=null)for(a in t.key!==void 0&&(l=""+t.key),t)Hy.call(t,a)&&a!=="key"&&a!=="__self"&&a!=="__source"&&(r[a]=t[a]);var i=arguments.length-2;if(i===1)r.children=n;else if(1<i){for(var o=Array(i),c=0;c<i;c++)o[c]=arguments[c+2];r.children=o}if(e&&e.defaultProps)for(a in i=e.defaultProps,i)r[a]===void 0&&(r[a]=i[a]);return Cm(e,l,void 0,void 0,null,r)};Ae.createRef=function(){return{current:null}};Ae.forwardRef=function(e){return{$$typeof:lS,render:e}};Ae.isValidElement=Rm;Ae.lazy=function(e){return{$$typeof:Dy,_payload:{_status:-1,_result:e},_init:hS}};Ae.memo=function(e,t){return{$$typeof:oS,type:e,compare:t===void 0?null:t}};Ae.startTransition=function(e){var t=ot.T,n={};ot.T=n;try{var a=e(),r=ot.S;r!==null&&r(n,a),typeof a=="object"&&a!==null&&typeof a.then=="function"&&a.then(mS,Kx)}catch(l){Kx(l)}finally{ot.T=t}};Ae.unstable_useCacheRefresh=function(){return ot.H.useCacheRefresh()};Ae.use=function(e){return ot.H.use(e)};Ae.useActionState=function(e,t,n){return ot.H.useActionState(e,t,n)};Ae.useCallback=function(e,t){return ot.H.useCallback(e,t)};Ae.useContext=function(e){return ot.H.useContext(e)};Ae.useDebugValue=function(){};Ae.useDeferredValue=function(e,t){return ot.H.useDeferredValue(e,t)};Ae.useEffect=function(e,t,n){var a=ot.H;if(typeof n=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return a.useEffect(e,t)};Ae.useId=function(){return ot.H.useId()};Ae.useImperativeHandle=function(e,t,n){return ot.H.useImperativeHandle(e,t,n)};Ae.useInsertionEffect=function(e,t){return ot.H.useInsertionEffect(e,t)};Ae.useLayoutEffect=function(e,t){return ot.H.useLayoutEffect(e,t)};Ae.useMemo=function(e,t){return ot.H.useMemo(e,t)};Ae.useOptimistic=function(e,t){return ot.H.useOptimistic(e,t)};Ae.useReducer=function(e,t,n){return ot.H.useReducer(e,t,n)};Ae.useRef=function(e){return ot.H.useRef(e)};Ae.useState=function(e){return ot.H.useState(e)};Ae.useSyncExternalStore=function(e,t,n){return ot.H.useSyncExternalStore(e,t,n)};Ae.useTransition=function(){return ot.H.useTransition()};Ae.version="19.1.0";Oy.exports=Ae;var u=Oy.exports;const oa=Ay(u),Iy=W1({__proto__:null,default:oa},[u]);var Py={exports:{}},Bu={},qy={exports:{}},Gy={};/**
18
+ * @license React
19
+ * scheduler.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */(function(e){function t(R,E){var k=R.length;R.push(E);e:for(;0<k;){var M=k-1>>>1,K=R[M];if(0<r(K,E))R[M]=E,R[k]=K,k=M;else break e}}function n(R){return R.length===0?null:R[0]}function a(R){if(R.length===0)return null;var E=R[0],k=R.pop();if(k!==E){R[0]=k;e:for(var M=0,K=R.length,T=K>>>1;M<T;){var B=2*(M+1)-1,F=R[B],J=B+1,he=R[J];if(0>r(F,k))J<K&&0>r(he,F)?(R[M]=he,R[J]=k,M=J):(R[M]=F,R[B]=k,M=B);else if(J<K&&0>r(he,k))R[M]=he,R[J]=k,M=J;else break e}}return E}function r(R,E){var k=R.sortIndex-E.sortIndex;return k!==0?k:R.id-E.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var i=Date,o=i.now();e.unstable_now=function(){return i.now()-o}}var c=[],d=[],f=1,h=null,m=3,x=!1,b=!1,v=!1,y=!1,g=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function w(R){for(var E=n(d);E!==null;){if(E.callback===null)a(d);else if(E.startTime<=R)a(d),E.sortIndex=E.expirationTime,t(c,E);else break;E=n(d)}}function N(R){if(v=!1,w(R),!b)if(n(c)!==null)b=!0,C||(C=!0,V());else{var E=n(d);E!==null&&A(N,E.startTime-R)}}var C=!1,_=-1,S=5,$=-1;function O(){return y?!0:!(e.unstable_now()-$<S)}function G(){if(y=!1,C){var R=e.unstable_now();$=R;var E=!0;try{e:{b=!1,v&&(v=!1,p(_),_=-1),x=!0;var k=m;try{t:{for(w(R),h=n(c);h!==null&&!(h.expirationTime>R&&O());){var M=h.callback;if(typeof M=="function"){h.callback=null,m=h.priorityLevel;var K=M(h.expirationTime<=R);if(R=e.unstable_now(),typeof K=="function"){h.callback=K,w(R),E=!0;break t}h===n(c)&&a(c),w(R)}else a(c);h=n(c)}if(h!==null)E=!0;else{var T=n(d);T!==null&&A(N,T.startTime-R),E=!1}}break e}finally{h=null,m=k,x=!1}E=void 0}}finally{E?V():C=!1}}}var V;if(typeof j=="function")V=function(){j(G)};else if(typeof MessageChannel<"u"){var L=new MessageChannel,U=L.port2;L.port1.onmessage=G,V=function(){U.postMessage(null)}}else V=function(){g(G,0)};function A(R,E){_=g(function(){R(e.unstable_now())},E)}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(R){R.callback=null},e.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):S=0<R?Math.floor(1e3/R):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_next=function(R){switch(m){case 1:case 2:case 3:var E=3;break;default:E=m}var k=m;m=E;try{return R()}finally{m=k}},e.unstable_requestPaint=function(){y=!0},e.unstable_runWithPriority=function(R,E){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var k=m;m=R;try{return E()}finally{m=k}},e.unstable_scheduleCallback=function(R,E,k){var M=e.unstable_now();switch(typeof k=="object"&&k!==null?(k=k.delay,k=typeof k=="number"&&0<k?M+k:M):k=M,R){case 1:var K=-1;break;case 2:K=250;break;case 5:K=1073741823;break;case 4:K=1e4;break;default:K=5e3}return K=k+K,R={id:f++,callback:E,priorityLevel:R,startTime:k,expirationTime:K,sortIndex:-1},k>M?(R.sortIndex=k,t(d,R),n(c)===null&&R===n(d)&&(v?(p(_),_=-1):v=!0,A(N,k-M))):(R.sortIndex=K,t(c,R),b||x||(b=!0,C||(C=!0,V()))),R},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(R){var E=m;return function(){var k=m;m=E;try{return R.apply(this,arguments)}finally{m=k}}}})(Gy);qy.exports=Gy;var pS=qy.exports,Vy={exports:{}},Wt={};/**
26
+ * @license React
27
+ * react-dom.production.js
28
+ *
29
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var xS=u;function Yy(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;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."}function aa(){}var Kt={d:{f:aa,r:function(){throw Error(Yy(522))},D:aa,C:aa,L:aa,m:aa,X:aa,S:aa,M:aa},p:0,findDOMNode:null},gS=Symbol.for("react.portal");function vS(e,t,n){var a=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:gS,key:a==null?null:""+a,children:e,containerInfo:t,implementation:n}}var vi=xS.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function Hu(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}Wt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Kt;Wt.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(Yy(299));return vS(e,t,null,n)};Wt.flushSync=function(e){var t=vi.T,n=Kt.p;try{if(vi.T=null,Kt.p=2,e)return e()}finally{vi.T=t,Kt.p=n,Kt.d.f()}};Wt.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,Kt.d.C(e,t))};Wt.prefetchDNS=function(e){typeof e=="string"&&Kt.d.D(e)};Wt.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,a=Hu(n,t.crossOrigin),r=typeof t.integrity=="string"?t.integrity:void 0,l=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?Kt.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:a,integrity:r,fetchPriority:l}):n==="script"&&Kt.d.X(e,{crossOrigin:a,integrity:r,fetchPriority:l,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};Wt.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=Hu(t.as,t.crossOrigin);Kt.d.M(e,{crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0})}}else t==null&&Kt.d.M(e)};Wt.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,a=Hu(n,t.crossOrigin);Kt.d.L(e,n,{crossOrigin:a,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0,type:typeof t.type=="string"?t.type:void 0,fetchPriority:typeof t.fetchPriority=="string"?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy=="string"?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet=="string"?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes=="string"?t.imageSizes:void 0,media:typeof t.media=="string"?t.media:void 0})}};Wt.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=Hu(t.as,t.crossOrigin);Kt.d.m(e,{as:typeof t.as=="string"&&t.as!=="script"?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0})}else Kt.d.m(e)};Wt.requestFormReset=function(e){Kt.d.r(e)};Wt.unstable_batchedUpdates=function(e,t){return e(t)};Wt.useFormState=function(e,t,n){return vi.H.useFormState(e,t,n)};Wt.useFormStatus=function(){return vi.H.useHostTransitionStatus()};Wt.version="19.1.0";function Fy(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Fy)}catch(e){console.error(e)}}Fy(),Vy.exports=Wt;var Cl=Vy.exports;const yS=Ay(Cl);/**
34
+ * @license React
35
+ * react-dom-client.production.js
36
+ *
37
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
38
+ *
39
+ * This source code is licensed under the MIT license found in the
40
+ * LICENSE file in the root directory of this source tree.
41
+ */var Ot=pS,Ky=u,jS=Cl;function Z(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;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."}function Xy(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function oo(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 Qy(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 Xx(e){if(oo(e)!==e)throw Error(Z(188))}function bS(e){var t=e.alternate;if(!t){if(t=oo(e),t===null)throw Error(Z(188));return t!==e?null:e}for(var n=e,a=t;;){var r=n.return;if(r===null)break;var l=r.alternate;if(l===null){if(a=r.return,a!==null){n=a;continue}break}if(r.child===l.child){for(l=r.child;l;){if(l===n)return Xx(r),e;if(l===a)return Xx(r),t;l=l.sibling}throw Error(Z(188))}if(n.return!==a.return)n=r,a=l;else{for(var i=!1,o=r.child;o;){if(o===n){i=!0,n=r,a=l;break}if(o===a){i=!0,a=r,n=l;break}o=o.sibling}if(!i){for(o=l.child;o;){if(o===n){i=!0,n=l,a=r;break}if(o===a){i=!0,a=l,n=r;break}o=o.sibling}if(!i)throw Error(Z(189))}}if(n.alternate!==a)throw Error(Z(190))}if(n.tag!==3)throw Error(Z(188));return n.stateNode.current===n?e:t}function Wy(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=Wy(e),t!==null)return t;e=e.sibling}return null}var at=Object.assign,wS=Symbol.for("react.element"),qo=Symbol.for("react.transitional.element"),ii=Symbol.for("react.portal"),Ur=Symbol.for("react.fragment"),Zy=Symbol.for("react.strict_mode"),Jf=Symbol.for("react.profiler"),_S=Symbol.for("react.provider"),Jy=Symbol.for("react.consumer"),Us=Symbol.for("react.context"),Tm=Symbol.for("react.forward_ref"),eh=Symbol.for("react.suspense"),th=Symbol.for("react.suspense_list"),Em=Symbol.for("react.memo"),da=Symbol.for("react.lazy"),nh=Symbol.for("react.activity"),NS=Symbol.for("react.memo_cache_sentinel"),Qx=Symbol.iterator;function Xl(e){return e===null||typeof e!="object"?null:(e=Qx&&e[Qx]||e["@@iterator"],typeof e=="function"?e:null)}var kS=Symbol.for("react.client.reference");function sh(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===kS?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ur:return"Fragment";case Jf:return"Profiler";case Zy:return"StrictMode";case eh:return"Suspense";case th:return"SuspenseList";case nh:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case ii:return"Portal";case Us:return(e.displayName||"Context")+".Provider";case Jy:return(e._context.displayName||"Context")+".Consumer";case Tm:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Em:return t=e.displayName||null,t!==null?t:sh(e.type)||"Memo";case da:t=e._payload,e=e._init;try{return sh(e(t))}catch{}}return null}var oi=Array.isArray,Ce=Ky.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ve=jS.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Wa={pending:!1,data:null,method:null,action:null},ah=[],Br=-1;function ks(e){return{current:e}}function Bt(e){0>Br||(e.current=ah[Br],ah[Br]=null,Br--)}function ct(e,t){Br++,ah[Br]=e.current,e.current=t}var gs=ks(null),zi=ks(null),_a=ks(null),Ic=ks(null);function Pc(e,t){switch(ct(_a,t),ct(zi,e),ct(gs,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?tv(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=tv(t),e=x0(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Bt(gs),ct(gs,e)}function dl(){Bt(gs),Bt(zi),Bt(_a)}function rh(e){e.memoizedState!==null&&ct(Ic,e);var t=gs.current,n=x0(t,e.type);t!==n&&(ct(zi,e),ct(gs,n))}function qc(e){zi.current===e&&(Bt(gs),Bt(zi)),Ic.current===e&&(Bt(Ic),Yi._currentValue=Wa)}var lh=Object.prototype.hasOwnProperty,Am=Ot.unstable_scheduleCallback,Vd=Ot.unstable_cancelCallback,SS=Ot.unstable_shouldYield,CS=Ot.unstable_requestPaint,vs=Ot.unstable_now,RS=Ot.unstable_getCurrentPriorityLevel,ej=Ot.unstable_ImmediatePriority,tj=Ot.unstable_UserBlockingPriority,Gc=Ot.unstable_NormalPriority,TS=Ot.unstable_LowPriority,nj=Ot.unstable_IdlePriority,ES=Ot.log,AS=Ot.unstable_setDisableYieldValue,co=null,Nn=null;function ga(e){if(typeof ES=="function"&&AS(e),Nn&&typeof Nn.setStrictMode=="function")try{Nn.setStrictMode(co,e)}catch{}}var kn=Math.clz32?Math.clz32:OS,MS=Math.log,$S=Math.LN2;function OS(e){return e>>>=0,e===0?32:31-(MS(e)/$S|0)|0}var Go=256,Vo=4194304;function Fa(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194048;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Iu(e,t,n){var a=e.pendingLanes;if(a===0)return 0;var r=0,l=e.suspendedLanes,i=e.pingedLanes;e=e.warmLanes;var o=a&134217727;return o!==0?(a=o&~l,a!==0?r=Fa(a):(i&=o,i!==0?r=Fa(i):n||(n=o&~e,n!==0&&(r=Fa(n))))):(o=a&~l,o!==0?r=Fa(o):i!==0?r=Fa(i):n||(n=a&~e,n!==0&&(r=Fa(n)))),r===0?0:t!==0&&t!==r&&!(t&l)&&(l=r&-r,n=t&-t,l>=n||l===32&&(n&4194048)!==0)?t:r}function uo(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function DS(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function sj(){var e=Go;return Go<<=1,!(Go&4194048)&&(Go=256),e}function aj(){var e=Vo;return Vo<<=1,!(Vo&62914560)&&(Vo=4194304),e}function Yd(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function fo(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function zS(e,t,n,a,r,l){var i=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var o=e.entanglements,c=e.expirationTimes,d=e.hiddenUpdates;for(n=i&~n;0<n;){var f=31-kn(n),h=1<<f;o[f]=0,c[f]=-1;var m=d[f];if(m!==null)for(d[f]=null,f=0;f<m.length;f++){var x=m[f];x!==null&&(x.lane&=-536870913)}n&=~h}a!==0&&rj(e,a,0),l!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=l&~(i&~t))}function rj(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var a=31-kn(t);e.entangledLanes|=t,e.entanglements[a]=e.entanglements[a]|1073741824|n&4194090}function lj(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var a=31-kn(n),r=1<<a;r&t|e[a]&t&&(e[a]|=t),n&=~r}}function Mm(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function $m(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function ij(){var e=Ve.p;return e!==0?e:(e=window.event,e===void 0?32:S0(e.type))}function LS(e,t){var n=Ve.p;try{return Ve.p=e,t()}finally{Ve.p=n}}var Ua=Math.random().toString(36).slice(2),qt="__reactFiber$"+Ua,on="__reactProps$"+Ua,Rl="__reactContainer$"+Ua,ih="__reactEvents$"+Ua,US="__reactListeners$"+Ua,BS="__reactHandles$"+Ua,Wx="__reactResources$"+Ua,ho="__reactMarker$"+Ua;function Om(e){delete e[qt],delete e[on],delete e[ih],delete e[US],delete e[BS]}function Hr(e){var t=e[qt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Rl]||n[qt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=av(e);e!==null;){if(n=e[qt])return n;e=av(e)}return t}e=n,n=e.parentNode}return null}function Tl(e){if(e=e[qt]||e[Rl]){var t=e.tag;if(t===5||t===6||t===13||t===26||t===27||t===3)return e}return null}function ci(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(Z(33))}function Wr(e){var t=e[Wx];return t||(t=e[Wx]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Lt(e){e[ho]=!0}var oj=new Set,cj={};function pr(e,t){fl(e,t),fl(e+"Capture",t)}function fl(e,t){for(cj[e]=t,e=0;e<t.length;e++)oj.add(t[e])}var HS=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Zx={},Jx={};function IS(e){return lh.call(Jx,e)?!0:lh.call(Zx,e)?!1:HS.test(e)?Jx[e]=!0:(Zx[e]=!0,!1)}function yc(e,t,n){if(IS(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var a=t.toLowerCase().slice(0,5);if(a!=="data-"&&a!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function Yo(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+n)}}function Es(e,t,n,a){if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+a)}}var Fd,eg;function Dr(e){if(Fd===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Fd=t&&t[1]||"",eg=-1<n.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+Fd+e+eg}var Kd=!1;function Xd(e,t){if(!e||Kd)return"";Kd=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var a={DetermineComponentFrameRoot:function(){try{if(t){var h=function(){throw Error()};if(Object.defineProperty(h.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(h,[])}catch(x){var m=x}Reflect.construct(e,[],h)}else{try{h.call()}catch(x){m=x}e.call(h.prototype)}}else{try{throw Error()}catch(x){m=x}(h=e())&&typeof h.catch=="function"&&h.catch(function(){})}}catch(x){if(x&&m&&typeof x.stack=="string")return[x.stack,m.stack]}return[null,null]}};a.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var r=Object.getOwnPropertyDescriptor(a.DetermineComponentFrameRoot,"name");r&&r.configurable&&Object.defineProperty(a.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var l=a.DetermineComponentFrameRoot(),i=l[0],o=l[1];if(i&&o){var c=i.split(`
44
+ `),d=o.split(`
45
+ `);for(r=a=0;a<c.length&&!c[a].includes("DetermineComponentFrameRoot");)a++;for(;r<d.length&&!d[r].includes("DetermineComponentFrameRoot");)r++;if(a===c.length||r===d.length)for(a=c.length-1,r=d.length-1;1<=a&&0<=r&&c[a]!==d[r];)r--;for(;1<=a&&0<=r;a--,r--)if(c[a]!==d[r]){if(a!==1||r!==1)do if(a--,r--,0>r||c[a]!==d[r]){var f=`
46
+ `+c[a].replace(" at new "," at ");return e.displayName&&f.includes("<anonymous>")&&(f=f.replace("<anonymous>",e.displayName)),f}while(1<=a&&0<=r);break}}}finally{Kd=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Dr(n):""}function PS(e){switch(e.tag){case 26:case 27:case 5:return Dr(e.type);case 16:return Dr("Lazy");case 13:return Dr("Suspense");case 19:return Dr("SuspenseList");case 0:case 15:return Xd(e.type,!1);case 11:return Xd(e.type.render,!1);case 1:return Xd(e.type,!0);case 31:return Dr("Activity");default:return""}}function tg(e){try{var t="";do t+=PS(e),e=e.return;while(e);return t}catch(n){return`
47
+ Error generating stack: `+n.message+`
48
+ `+n.stack}}function On(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function uj(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function qS(e){var t=uj(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),a=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var r=n.get,l=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(i){a=""+i,l.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return a},setValue:function(i){a=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Vc(e){e._valueTracker||(e._valueTracker=qS(e))}function dj(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),a="";return e&&(a=uj(e)?e.checked?"true":"false":e.value),e=a,e!==n?(t.setValue(e),!0):!1}function Yc(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var GS=/[\n"\\]/g;function Ln(e){return e.replace(GS,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function oh(e,t,n,a,r,l,i,o){e.name="",i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"?e.type=i:e.removeAttribute("type"),t!=null?i==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+On(t)):e.value!==""+On(t)&&(e.value=""+On(t)):i!=="submit"&&i!=="reset"||e.removeAttribute("value"),t!=null?ch(e,i,On(t)):n!=null?ch(e,i,On(n)):a!=null&&e.removeAttribute("value"),r==null&&l!=null&&(e.defaultChecked=!!l),r!=null&&(e.checked=r&&typeof r!="function"&&typeof r!="symbol"),o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?e.name=""+On(o):e.removeAttribute("name")}function fj(e,t,n,a,r,l,i,o){if(l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"&&(e.type=l),t!=null||n!=null){if(!(l!=="submit"&&l!=="reset"||t!=null))return;n=n!=null?""+On(n):"",t=t!=null?""+On(t):n,o||t===e.value||(e.value=t),e.defaultValue=t}a=a??r,a=typeof a!="function"&&typeof a!="symbol"&&!!a,e.checked=o?e.checked:!!a,e.defaultChecked=!!a,i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(e.name=i)}function ch(e,t,n){t==="number"&&Yc(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Zr(e,t,n,a){if(e=e.options,t){t={};for(var r=0;r<n.length;r++)t["$"+n[r]]=!0;for(n=0;n<e.length;n++)r=t.hasOwnProperty("$"+e[n].value),e[n].selected!==r&&(e[n].selected=r),r&&a&&(e[n].defaultSelected=!0)}else{for(n=""+On(n),t=null,r=0;r<e.length;r++){if(e[r].value===n){e[r].selected=!0,a&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function hj(e,t,n){if(t!=null&&(t=""+On(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+On(n):""}function mj(e,t,n,a){if(t==null){if(a!=null){if(n!=null)throw Error(Z(92));if(oi(a)){if(1<a.length)throw Error(Z(93));a=a[0]}n=a}n==null&&(n=""),t=n}n=On(t),e.defaultValue=n,a=e.textContent,a===n&&a!==""&&a!==null&&(e.value=a)}function hl(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var VS=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function ng(e,t,n){var a=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?a?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":a?e.setProperty(t,n):typeof n!="number"||n===0||VS.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function pj(e,t,n){if(t!=null&&typeof t!="object")throw Error(Z(62));if(e=e.style,n!=null){for(var a in n)!n.hasOwnProperty(a)||t!=null&&t.hasOwnProperty(a)||(a.indexOf("--")===0?e.setProperty(a,""):a==="float"?e.cssFloat="":e[a]="");for(var r in t)a=t[r],t.hasOwnProperty(r)&&n[r]!==a&&ng(e,r,a)}else for(var l in t)t.hasOwnProperty(l)&&ng(e,l,t[l])}function Dm(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var YS=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),FS=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function jc(e){return FS.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}var uh=null;function zm(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ir=null,Jr=null;function sg(e){var t=Tl(e);if(t&&(e=t.stateNode)){var n=e[on]||null;e:switch(e=t.stateNode,t.type){case"input":if(oh(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Ln(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var a=n[t];if(a!==e&&a.form===e.form){var r=a[on]||null;if(!r)throw Error(Z(90));oh(a,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name)}}for(t=0;t<n.length;t++)a=n[t],a.form===e.form&&dj(a)}break e;case"textarea":hj(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Zr(e,!!n.multiple,t,!1)}}}var Qd=!1;function xj(e,t,n){if(Qd)return e(t,n);Qd=!0;try{var a=e(t);return a}finally{if(Qd=!1,(Ir!==null||Jr!==null)&&(Wu(),Ir&&(t=Ir,e=Jr,Jr=Ir=null,sg(t),e)))for(t=0;t<e.length;t++)sg(e[t])}}function Li(e,t){var n=e.stateNode;if(n===null)return null;var a=n[on]||null;if(a===null)return null;n=a[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(a=!a.disabled)||(e=e.type,a=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!a;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(Z(231,t,typeof n));return n}var Vs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),dh=!1;if(Vs)try{var Ql={};Object.defineProperty(Ql,"passive",{get:function(){dh=!0}}),window.addEventListener("test",Ql,Ql),window.removeEventListener("test",Ql,Ql)}catch{dh=!1}var va=null,Lm=null,bc=null;function gj(){if(bc)return bc;var e,t=Lm,n=t.length,a,r="value"in va?va.value:va.textContent,l=r.length;for(e=0;e<n&&t[e]===r[e];e++);var i=n-e;for(a=1;a<=i&&t[n-a]===r[l-a];a++);return bc=r.slice(e,1<a?1-a:void 0)}function wc(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 Fo(){return!0}function ag(){return!1}function cn(e){function t(n,a,r,l,i){this._reactName=n,this._targetInst=r,this.type=a,this.nativeEvent=l,this.target=i,this.currentTarget=null;for(var o in e)e.hasOwnProperty(o)&&(n=e[o],this[o]=n?n(l):l[o]);return this.isDefaultPrevented=(l.defaultPrevented!=null?l.defaultPrevented:l.returnValue===!1)?Fo:ag,this.isPropagationStopped=ag,this}return at(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Fo)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Fo)},persist:function(){},isPersistent:Fo}),t}var xr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Pu=cn(xr),mo=at({},xr,{view:0,detail:0}),KS=cn(mo),Wd,Zd,Wl,qu=at({},mo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Um,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!==Wl&&(Wl&&e.type==="mousemove"?(Wd=e.screenX-Wl.screenX,Zd=e.screenY-Wl.screenY):Zd=Wd=0,Wl=e),Wd)},movementY:function(e){return"movementY"in e?e.movementY:Zd}}),rg=cn(qu),XS=at({},qu,{dataTransfer:0}),QS=cn(XS),WS=at({},mo,{relatedTarget:0}),Jd=cn(WS),ZS=at({},xr,{animationName:0,elapsedTime:0,pseudoElement:0}),JS=cn(ZS),e2=at({},xr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),t2=cn(e2),n2=at({},xr,{data:0}),lg=cn(n2),s2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},a2={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"},r2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function l2(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=r2[e])?!!t[e]:!1}function Um(){return l2}var i2=at({},mo,{key:function(e){if(e.key){var t=s2[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=wc(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?a2[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Um,charCode:function(e){return e.type==="keypress"?wc(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?wc(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),o2=cn(i2),c2=at({},qu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ig=cn(c2),u2=at({},mo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Um}),d2=cn(u2),f2=at({},xr,{propertyName:0,elapsedTime:0,pseudoElement:0}),h2=cn(f2),m2=at({},qu,{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}),p2=cn(m2),x2=at({},xr,{newState:0,oldState:0}),g2=cn(x2),v2=[9,13,27,32],Bm=Vs&&"CompositionEvent"in window,yi=null;Vs&&"documentMode"in document&&(yi=document.documentMode);var y2=Vs&&"TextEvent"in window&&!yi,vj=Vs&&(!Bm||yi&&8<yi&&11>=yi),og=" ",cg=!1;function yj(e,t){switch(e){case"keyup":return v2.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function jj(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Pr=!1;function j2(e,t){switch(e){case"compositionend":return jj(t);case"keypress":return t.which!==32?null:(cg=!0,og);case"textInput":return e=t.data,e===og&&cg?null:e;default:return null}}function b2(e,t){if(Pr)return e==="compositionend"||!Bm&&yj(e,t)?(e=gj(),bc=Lm=va=null,Pr=!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 vj&&t.locale!=="ko"?null:t.data;default:return null}}var w2={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 ug(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!w2[e.type]:t==="textarea"}function bj(e,t,n,a){Ir?Jr?Jr.push(a):Jr=[a]:Ir=a,t=uu(t,"onChange"),0<t.length&&(n=new Pu("onChange","change",null,n,a),e.push({event:n,listeners:t}))}var ji=null,Ui=null;function _2(e){h0(e,0)}function Gu(e){var t=ci(e);if(dj(t))return e}function dg(e,t){if(e==="change")return t}var wj=!1;if(Vs){var ef;if(Vs){var tf="oninput"in document;if(!tf){var fg=document.createElement("div");fg.setAttribute("oninput","return;"),tf=typeof fg.oninput=="function"}ef=tf}else ef=!1;wj=ef&&(!document.documentMode||9<document.documentMode)}function hg(){ji&&(ji.detachEvent("onpropertychange",_j),Ui=ji=null)}function _j(e){if(e.propertyName==="value"&&Gu(Ui)){var t=[];bj(t,Ui,e,zm(e)),xj(_2,t)}}function N2(e,t,n){e==="focusin"?(hg(),ji=t,Ui=n,ji.attachEvent("onpropertychange",_j)):e==="focusout"&&hg()}function k2(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Gu(Ui)}function S2(e,t){if(e==="click")return Gu(t)}function C2(e,t){if(e==="input"||e==="change")return Gu(t)}function R2(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Tn=typeof Object.is=="function"?Object.is:R2;function Bi(e,t){if(Tn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),a=Object.keys(t);if(n.length!==a.length)return!1;for(a=0;a<n.length;a++){var r=n[a];if(!lh.call(t,r)||!Tn(e[r],t[r]))return!1}return!0}function mg(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function pg(e,t){var n=mg(e);e=0;for(var a;n;){if(n.nodeType===3){if(a=e+n.textContent.length,e<=t&&a>=t)return{node:n,offset:t-e};e=a}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=mg(n)}}function Nj(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Nj(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function kj(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Yc(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Yc(e.document)}return t}function Hm(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")}var T2=Vs&&"documentMode"in document&&11>=document.documentMode,qr=null,fh=null,bi=null,hh=!1;function xg(e,t,n){var a=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;hh||qr==null||qr!==Yc(a)||(a=qr,"selectionStart"in a&&Hm(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),bi&&Bi(bi,a)||(bi=a,a=uu(fh,"onSelect"),0<a.length&&(t=new Pu("onSelect","select",null,t,n),e.push({event:t,listeners:a}),t.target=qr)))}function Va(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Gr={animationend:Va("Animation","AnimationEnd"),animationiteration:Va("Animation","AnimationIteration"),animationstart:Va("Animation","AnimationStart"),transitionrun:Va("Transition","TransitionRun"),transitionstart:Va("Transition","TransitionStart"),transitioncancel:Va("Transition","TransitionCancel"),transitionend:Va("Transition","TransitionEnd")},nf={},Sj={};Vs&&(Sj=document.createElement("div").style,"AnimationEvent"in window||(delete Gr.animationend.animation,delete Gr.animationiteration.animation,delete Gr.animationstart.animation),"TransitionEvent"in window||delete Gr.transitionend.transition);function gr(e){if(nf[e])return nf[e];if(!Gr[e])return e;var t=Gr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Sj)return nf[e]=t[n];return e}var Cj=gr("animationend"),Rj=gr("animationiteration"),Tj=gr("animationstart"),E2=gr("transitionrun"),A2=gr("transitionstart"),M2=gr("transitioncancel"),Ej=gr("transitionend"),Aj=new Map,mh="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");mh.push("scrollEnd");function rs(e,t){Aj.set(e,t),pr(t,[e])}var gg=new WeakMap;function Un(e,t){if(typeof e=="object"&&e!==null){var n=gg.get(e);return n!==void 0?n:(t={value:e,source:t,stack:tg(t)},gg.set(e,t),t)}return{value:e,source:t,stack:tg(t)}}var $n=[],Vr=0,Im=0;function Vu(){for(var e=Vr,t=Im=Vr=0;t<e;){var n=$n[t];$n[t++]=null;var a=$n[t];$n[t++]=null;var r=$n[t];$n[t++]=null;var l=$n[t];if($n[t++]=null,a!==null&&r!==null){var i=a.pending;i===null?r.next=r:(r.next=i.next,i.next=r),a.pending=r}l!==0&&Mj(n,r,l)}}function Yu(e,t,n,a){$n[Vr++]=e,$n[Vr++]=t,$n[Vr++]=n,$n[Vr++]=a,Im|=a,e.lanes|=a,e=e.alternate,e!==null&&(e.lanes|=a)}function Pm(e,t,n,a){return Yu(e,t,n,a),Fc(e)}function El(e,t){return Yu(e,null,null,t),Fc(e)}function Mj(e,t,n){e.lanes|=n;var a=e.alternate;a!==null&&(a.lanes|=n);for(var r=!1,l=e.return;l!==null;)l.childLanes|=n,a=l.alternate,a!==null&&(a.childLanes|=n),l.tag===22&&(e=l.stateNode,e===null||e._visibility&1||(r=!0)),e=l,l=l.return;return e.tag===3?(l=e.stateNode,r&&t!==null&&(r=31-kn(n),e=l.hiddenUpdates,a=e[r],a===null?e[r]=[t]:a.push(t),t.lane=n|536870912),l):null}function Fc(e){if(50<Ai)throw Ai=0,Dh=null,Error(Z(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Yr={};function $2(e,t,n,a){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function _n(e,t,n,a){return new $2(e,t,n,a)}function qm(e){return e=e.prototype,!(!e||!e.isReactComponent)}function qs(e,t){var n=e.alternate;return n===null?(n=_n(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&65011712,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.refCleanup=e.refCleanup,n}function $j(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function _c(e,t,n,a,r,l){var i=0;if(a=e,typeof e=="function")qm(e)&&(i=1);else if(typeof e=="string")i=DC(e,n,gs.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case nh:return e=_n(31,n,t,r),e.elementType=nh,e.lanes=l,e;case Ur:return Za(n.children,r,l,t);case Zy:i=8,r|=24;break;case Jf:return e=_n(12,n,t,r|2),e.elementType=Jf,e.lanes=l,e;case eh:return e=_n(13,n,t,r),e.elementType=eh,e.lanes=l,e;case th:return e=_n(19,n,t,r),e.elementType=th,e.lanes=l,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case _S:case Us:i=10;break e;case Jy:i=9;break e;case Tm:i=11;break e;case Em:i=14;break e;case da:i=16,a=null;break e}i=29,n=Error(Z(130,e===null?"null":typeof e,"")),a=null}return t=_n(i,n,t,r),t.elementType=e,t.type=a,t.lanes=l,t}function Za(e,t,n,a){return e=_n(7,e,a,t),e.lanes=n,e}function sf(e,t,n){return e=_n(6,e,null,t),e.lanes=n,e}function af(e,t,n){return t=_n(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Fr=[],Kr=0,Kc=null,Xc=0,Dn=[],zn=0,Ja=null,Bs=1,Hs="";function Ka(e,t){Fr[Kr++]=Xc,Fr[Kr++]=Kc,Kc=e,Xc=t}function Oj(e,t,n){Dn[zn++]=Bs,Dn[zn++]=Hs,Dn[zn++]=Ja,Ja=e;var a=Bs;e=Hs;var r=32-kn(a)-1;a&=~(1<<r),n+=1;var l=32-kn(t)+r;if(30<l){var i=r-r%5;l=(a&(1<<i)-1).toString(32),a>>=i,r-=i,Bs=1<<32-kn(t)+r|n<<r|a,Hs=l+e}else Bs=1<<l|n<<r|a,Hs=e}function Gm(e){e.return!==null&&(Ka(e,1),Oj(e,1,0))}function Vm(e){for(;e===Kc;)Kc=Fr[--Kr],Fr[Kr]=null,Xc=Fr[--Kr],Fr[Kr]=null;for(;e===Ja;)Ja=Dn[--zn],Dn[zn]=null,Hs=Dn[--zn],Dn[zn]=null,Bs=Dn[--zn],Dn[zn]=null}var Ft=null,pt=null,Ge=!1,er=null,ds=!1,ph=Error(Z(519));function rr(e){var t=Error(Z(418,""));throw Hi(Un(t,e)),ph}function vg(e){var t=e.stateNode,n=e.type,a=e.memoizedProps;switch(t[qt]=e,t[on]=a,n){case"dialog":ze("cancel",t),ze("close",t);break;case"iframe":case"object":case"embed":ze("load",t);break;case"video":case"audio":for(n=0;n<qi.length;n++)ze(qi[n],t);break;case"source":ze("error",t);break;case"img":case"image":case"link":ze("error",t),ze("load",t);break;case"details":ze("toggle",t);break;case"input":ze("invalid",t),fj(t,a.value,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name,!0),Vc(t);break;case"select":ze("invalid",t);break;case"textarea":ze("invalid",t),mj(t,a.value,a.defaultValue,a.children),Vc(t)}n=a.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||a.suppressHydrationWarning===!0||p0(t.textContent,n)?(a.popover!=null&&(ze("beforetoggle",t),ze("toggle",t)),a.onScroll!=null&&ze("scroll",t),a.onScrollEnd!=null&&ze("scrollend",t),a.onClick!=null&&(t.onclick=ed),t=!0):t=!1,t||rr(e)}function yg(e){for(Ft=e.return;Ft;)switch(Ft.tag){case 5:case 13:ds=!1;return;case 27:case 3:ds=!0;return;default:Ft=Ft.return}}function Zl(e){if(e!==Ft)return!1;if(!Ge)return yg(e),Ge=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||Ih(e.type,e.memoizedProps)),n=!n),n&&pt&&rr(e),yg(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Z(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8)if(n=e.data,n==="/$"){if(t===0){pt=Zn(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++;e=e.nextSibling}pt=null}}else t===27?(t=pt,Ba(e.type)?(e=Gh,Gh=null,pt=e):pt=t):pt=Ft?Zn(e.stateNode.nextSibling):null;return!0}function po(){pt=Ft=null,Ge=!1}function jg(){var e=er;return e!==null&&(rn===null?rn=e:rn.push.apply(rn,e),er=null),e}function Hi(e){er===null?er=[e]:er.push(e)}var xh=ks(null),vr=null,Is=null;function ha(e,t,n){ct(xh,t._currentValue),t._currentValue=n}function Gs(e){e._currentValue=xh.current,Bt(xh)}function gh(e,t,n){for(;e!==null;){var a=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,a!==null&&(a.childLanes|=t)):a!==null&&(a.childLanes&t)!==t&&(a.childLanes|=t),e===n)break;e=e.return}}function vh(e,t,n,a){var r=e.child;for(r!==null&&(r.return=e);r!==null;){var l=r.dependencies;if(l!==null){var i=r.child;l=l.firstContext;e:for(;l!==null;){var o=l;l=r;for(var c=0;c<t.length;c++)if(o.context===t[c]){l.lanes|=n,o=l.alternate,o!==null&&(o.lanes|=n),gh(l.return,n,e),a||(i=null);break e}l=o.next}}else if(r.tag===18){if(i=r.return,i===null)throw Error(Z(341));i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),gh(i,n,e),i=null}else i=r.child;if(i!==null)i.return=r;else for(i=r;i!==null;){if(i===e){i=null;break}if(r=i.sibling,r!==null){r.return=i.return,i=r;break}i=i.return}r=i}}function xo(e,t,n,a){e=null;for(var r=t,l=!1;r!==null;){if(!l){if(r.flags&524288)l=!0;else if(r.flags&262144)break}if(r.tag===10){var i=r.alternate;if(i===null)throw Error(Z(387));if(i=i.memoizedProps,i!==null){var o=r.type;Tn(r.pendingProps.value,i.value)||(e!==null?e.push(o):e=[o])}}else if(r===Ic.current){if(i=r.alternate,i===null)throw Error(Z(387));i.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(Yi):e=[Yi])}r=r.return}e!==null&&vh(t,e,n,a),t.flags|=262144}function Qc(e){for(e=e.firstContext;e!==null;){if(!Tn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function lr(e){vr=e,Is=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Gt(e){return Dj(vr,e)}function Ko(e,t){return vr===null&&lr(e),Dj(e,t)}function Dj(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Is===null){if(e===null)throw Error(Z(308));Is=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Is=Is.next=t;return n}var O2=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,a){e.push(a)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},D2=Ot.unstable_scheduleCallback,z2=Ot.unstable_NormalPriority,Mt={$$typeof:Us,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ym(){return{controller:new O2,data:new Map,refCount:0}}function go(e){e.refCount--,e.refCount===0&&D2(z2,function(){e.controller.abort()})}var wi=null,yh=0,ml=0,el=null;function L2(e,t){if(wi===null){var n=wi=[];yh=0,ml=pp(),el={status:"pending",value:void 0,then:function(a){n.push(a)}}}return yh++,t.then(bg,bg),t}function bg(){if(--yh===0&&wi!==null){el!==null&&(el.status="fulfilled");var e=wi;wi=null,ml=0,el=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function U2(e,t){var n=[],a={status:"pending",value:null,reason:null,then:function(r){n.push(r)}};return e.then(function(){a.status="fulfilled",a.value=t;for(var r=0;r<n.length;r++)(0,n[r])(t)},function(r){for(a.status="rejected",a.reason=r,r=0;r<n.length;r++)(0,n[r])(void 0)}),a}var wg=Ce.S;Ce.S=function(e,t){typeof t=="object"&&t!==null&&typeof t.then=="function"&&L2(e,t),wg!==null&&wg(e,t)};var tr=ks(null);function Fm(){var e=tr.current;return e!==null?e:nt.pooledCache}function Nc(e,t){t===null?ct(tr,tr.current):ct(tr,t.pool)}function zj(){var e=Fm();return e===null?null:{parent:Mt._currentValue,pool:e}}var vo=Error(Z(460)),Lj=Error(Z(474)),Fu=Error(Z(542)),jh={then:function(){}};function _g(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Xo(){}function Uj(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Xo,Xo),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,kg(e),e;default:if(typeof t.status=="string")t.then(Xo,Xo);else{if(e=nt,e!==null&&100<e.shellSuspendCounter)throw Error(Z(482));e=t,e.status="pending",e.then(function(a){if(t.status==="pending"){var r=t;r.status="fulfilled",r.value=a}},function(a){if(t.status==="pending"){var r=t;r.status="rejected",r.reason=a}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,kg(e),e}throw _i=t,vo}}var _i=null;function Ng(){if(_i===null)throw Error(Z(459));var e=_i;return _i=null,e}function kg(e){if(e===vo||e===Fu)throw Error(Z(483))}var fa=!1;function Km(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function bh(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Na(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ka(e,t,n){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,Qe&2){var r=a.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),a.pending=t,t=Fc(e),Mj(e,null,n),t}return Yu(e,a,t,n),Fc(e)}function Ni(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,lj(e,n)}}function rf(e,t){var n=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,n===a)){var r=null,l=null;if(n=n.firstBaseUpdate,n!==null){do{var i={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};l===null?r=l=i:l=l.next=i,n=n.next}while(n!==null);l===null?r=l=t:l=l.next=t}else r=l=t;n={baseState:a.baseState,firstBaseUpdate:r,lastBaseUpdate:l,shared:a.shared,callbacks:a.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var wh=!1;function ki(){if(wh){var e=el;if(e!==null)throw e}}function Si(e,t,n,a){wh=!1;var r=e.updateQueue;fa=!1;var l=r.firstBaseUpdate,i=r.lastBaseUpdate,o=r.shared.pending;if(o!==null){r.shared.pending=null;var c=o,d=c.next;c.next=null,i===null?l=d:i.next=d,i=c;var f=e.alternate;f!==null&&(f=f.updateQueue,o=f.lastBaseUpdate,o!==i&&(o===null?f.firstBaseUpdate=d:o.next=d,f.lastBaseUpdate=c))}if(l!==null){var h=r.baseState;i=0,f=d=c=null,o=l;do{var m=o.lane&-536870913,x=m!==o.lane;if(x?(Ie&m)===m:(a&m)===m){m!==0&&m===ml&&(wh=!0),f!==null&&(f=f.next={lane:0,tag:o.tag,payload:o.payload,callback:null,next:null});e:{var b=e,v=o;m=t;var y=n;switch(v.tag){case 1:if(b=v.payload,typeof b=="function"){h=b.call(y,h,m);break e}h=b;break e;case 3:b.flags=b.flags&-65537|128;case 0:if(b=v.payload,m=typeof b=="function"?b.call(y,h,m):b,m==null)break e;h=at({},h,m);break e;case 2:fa=!0}}m=o.callback,m!==null&&(e.flags|=64,x&&(e.flags|=8192),x=r.callbacks,x===null?r.callbacks=[m]:x.push(m))}else x={lane:m,tag:o.tag,payload:o.payload,callback:o.callback,next:null},f===null?(d=f=x,c=h):f=f.next=x,i|=m;if(o=o.next,o===null){if(o=r.shared.pending,o===null)break;x=o,o=x.next,x.next=null,r.lastBaseUpdate=x,r.shared.pending=null}}while(!0);f===null&&(c=h),r.baseState=c,r.firstBaseUpdate=d,r.lastBaseUpdate=f,l===null&&(r.shared.lanes=0),Oa|=i,e.lanes=i,e.memoizedState=h}}function Bj(e,t){if(typeof e!="function")throw Error(Z(191,e));e.call(t)}function Hj(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Bj(n[e],t)}var pl=ks(null),Wc=ks(0);function Sg(e,t){e=Ks,ct(Wc,e),ct(pl,t),Ks=e|t.baseLanes}function _h(){ct(Wc,Ks),ct(pl,pl.current)}function Xm(){Ks=Wc.current,Bt(pl),Bt(Wc)}var Ma=0,Oe=null,et=null,St=null,Zc=!1,tl=!1,ir=!1,Jc=0,Ii=0,nl=null,B2=0;function bt(){throw Error(Z(321))}function Qm(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Tn(e[n],t[n]))return!1;return!0}function Wm(e,t,n,a,r,l){return Ma=l,Oe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Ce.H=e===null||e.memoizedState===null?gb:vb,ir=!1,l=n(a,r),ir=!1,tl&&(l=Pj(t,n,a,r)),Ij(e),l}function Ij(e){Ce.H=eu;var t=et!==null&&et.next!==null;if(Ma=0,St=et=Oe=null,Zc=!1,Ii=0,nl=null,t)throw Error(Z(300));e===null||Ut||(e=e.dependencies,e!==null&&Qc(e)&&(Ut=!0))}function Pj(e,t,n,a){Oe=e;var r=0;do{if(tl&&(nl=null),Ii=0,tl=!1,25<=r)throw Error(Z(301));if(r+=1,St=et=null,e.updateQueue!=null){var l=e.updateQueue;l.lastEffect=null,l.events=null,l.stores=null,l.memoCache!=null&&(l.memoCache.index=0)}Ce.H=Y2,l=t(n,a)}while(tl);return l}function H2(){var e=Ce.H,t=e.useState()[0];return t=typeof t.then=="function"?yo(t):t,e=e.useState()[0],(et!==null?et.memoizedState:null)!==e&&(Oe.flags|=1024),t}function Zm(){var e=Jc!==0;return Jc=0,e}function Jm(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function ep(e){if(Zc){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Zc=!1}Ma=0,St=et=Oe=null,tl=!1,Ii=Jc=0,nl=null}function sn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return St===null?Oe.memoizedState=St=e:St=St.next=e,St}function Tt(){if(et===null){var e=Oe.alternate;e=e!==null?e.memoizedState:null}else e=et.next;var t=St===null?Oe.memoizedState:St.next;if(t!==null)St=t,et=e;else{if(e===null)throw Oe.alternate===null?Error(Z(467)):Error(Z(310));et=e,e={memoizedState:et.memoizedState,baseState:et.baseState,baseQueue:et.baseQueue,queue:et.queue,next:null},St===null?Oe.memoizedState=St=e:St=St.next=e}return St}function tp(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function yo(e){var t=Ii;return Ii+=1,nl===null&&(nl=[]),e=Uj(nl,e,t),t=Oe,(St===null?t.memoizedState:St.next)===null&&(t=t.alternate,Ce.H=t===null||t.memoizedState===null?gb:vb),e}function Ku(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return yo(e);if(e.$$typeof===Us)return Gt(e)}throw Error(Z(438,String(e)))}function np(e){var t=null,n=Oe.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var a=Oe.alternate;a!==null&&(a=a.updateQueue,a!==null&&(a=a.memoCache,a!=null&&(t={data:a.data.map(function(r){return r.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=tp(),Oe.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),a=0;a<e;a++)n[a]=NS;return t.index++,n}function Ys(e,t){return typeof t=="function"?t(e):t}function kc(e){var t=Tt();return sp(t,et,e)}function sp(e,t,n){var a=e.queue;if(a===null)throw Error(Z(311));a.lastRenderedReducer=n;var r=e.baseQueue,l=a.pending;if(l!==null){if(r!==null){var i=r.next;r.next=l.next,l.next=i}t.baseQueue=r=l,a.pending=null}if(l=e.baseState,r===null)e.memoizedState=l;else{t=r.next;var o=i=null,c=null,d=t,f=!1;do{var h=d.lane&-536870913;if(h!==d.lane?(Ie&h)===h:(Ma&h)===h){var m=d.revertLane;if(m===0)c!==null&&(c=c.next={lane:0,revertLane:0,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),h===ml&&(f=!0);else if((Ma&m)===m){d=d.next,m===ml&&(f=!0);continue}else h={lane:0,revertLane:d.revertLane,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null},c===null?(o=c=h,i=l):c=c.next=h,Oe.lanes|=m,Oa|=m;h=d.action,ir&&n(l,h),l=d.hasEagerState?d.eagerState:n(l,h)}else m={lane:h,revertLane:d.revertLane,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null},c===null?(o=c=m,i=l):c=c.next=m,Oe.lanes|=h,Oa|=h;d=d.next}while(d!==null&&d!==t);if(c===null?i=l:c.next=o,!Tn(l,e.memoizedState)&&(Ut=!0,f&&(n=el,n!==null)))throw n;e.memoizedState=l,e.baseState=i,e.baseQueue=c,a.lastRenderedState=l}return r===null&&(a.lanes=0),[e.memoizedState,a.dispatch]}function lf(e){var t=Tt(),n=t.queue;if(n===null)throw Error(Z(311));n.lastRenderedReducer=e;var a=n.dispatch,r=n.pending,l=t.memoizedState;if(r!==null){n.pending=null;var i=r=r.next;do l=e(l,i.action),i=i.next;while(i!==r);Tn(l,t.memoizedState)||(Ut=!0),t.memoizedState=l,t.baseQueue===null&&(t.baseState=l),n.lastRenderedState=l}return[l,a]}function qj(e,t,n){var a=Oe,r=Tt(),l=Ge;if(l){if(n===void 0)throw Error(Z(407));n=n()}else n=t();var i=!Tn((et||r).memoizedState,n);i&&(r.memoizedState=n,Ut=!0),r=r.queue;var o=Yj.bind(null,a,r,e);if(jo(2048,8,o,[e]),r.getSnapshot!==t||i||St!==null&&St.memoizedState.tag&1){if(a.flags|=2048,xl(9,Xu(),Vj.bind(null,a,r,n,t),null),nt===null)throw Error(Z(349));l||Ma&124||Gj(a,t,n)}return n}function Gj(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Oe.updateQueue,t===null?(t=tp(),Oe.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Vj(e,t,n,a){t.value=n,t.getSnapshot=a,Fj(t)&&Kj(e)}function Yj(e,t,n){return n(function(){Fj(t)&&Kj(e)})}function Fj(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Tn(e,n)}catch{return!0}}function Kj(e){var t=El(e,2);t!==null&&Cn(t,e,2)}function Nh(e){var t=sn();if(typeof e=="function"){var n=e;if(e=n(),ir){ga(!0);try{n()}finally{ga(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ys,lastRenderedState:e},t}function Xj(e,t,n,a){return e.baseState=n,sp(e,et,typeof a=="function"?a:Ys)}function I2(e,t,n,a,r){if(Qu(e))throw Error(Z(485));if(e=t.action,e!==null){var l={payload:r,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(i){l.listeners.push(i)}};Ce.T!==null?n(!0):l.isTransition=!1,a(l),n=t.pending,n===null?(l.next=t.pending=l,Qj(t,l)):(l.next=n.next,t.pending=n.next=l)}}function Qj(e,t){var n=t.action,a=t.payload,r=e.state;if(t.isTransition){var l=Ce.T,i={};Ce.T=i;try{var o=n(r,a),c=Ce.S;c!==null&&c(i,o),Cg(e,t,o)}catch(d){kh(e,t,d)}finally{Ce.T=l}}else try{l=n(r,a),Cg(e,t,l)}catch(d){kh(e,t,d)}}function Cg(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(a){Rg(e,t,a)},function(a){return kh(e,t,a)}):Rg(e,t,n)}function Rg(e,t,n){t.status="fulfilled",t.value=n,Wj(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Qj(e,n)))}function kh(e,t,n){var a=e.pending;if(e.pending=null,a!==null){a=a.next;do t.status="rejected",t.reason=n,Wj(t),t=t.next;while(t!==a)}e.action=null}function Wj(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Zj(e,t){return t}function Tg(e,t){if(Ge){var n=nt.formState;if(n!==null){e:{var a=Oe;if(Ge){if(pt){t:{for(var r=pt,l=ds;r.nodeType!==8;){if(!l){r=null;break t}if(r=Zn(r.nextSibling),r===null){r=null;break t}}l=r.data,r=l==="F!"||l==="F"?r:null}if(r){pt=Zn(r.nextSibling),a=r.data==="F!";break e}}rr(a)}a=!1}a&&(t=n[0])}}return n=sn(),n.memoizedState=n.baseState=t,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zj,lastRenderedState:t},n.queue=a,n=mb.bind(null,Oe,a),a.dispatch=n,a=Nh(!1),l=ip.bind(null,Oe,!1,a.queue),a=sn(),r={state:t,dispatch:null,action:e,pending:null},a.queue=r,n=I2.bind(null,Oe,r,l,n),r.dispatch=n,a.memoizedState=e,[t,n,!1]}function Eg(e){var t=Tt();return Jj(t,et,e)}function Jj(e,t,n){if(t=sp(e,t,Zj)[0],e=kc(Ys)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var a=yo(t)}catch(i){throw i===vo?Fu:i}else a=t;t=Tt();var r=t.queue,l=r.dispatch;return n!==t.memoizedState&&(Oe.flags|=2048,xl(9,Xu(),P2.bind(null,r,n),null)),[a,l,e]}function P2(e,t){e.action=t}function Ag(e){var t=Tt(),n=et;if(n!==null)return Jj(t,n,e);Tt(),t=t.memoizedState,n=Tt();var a=n.queue.dispatch;return n.memoizedState=e,[t,a,!1]}function xl(e,t,n,a){return e={tag:e,create:n,deps:a,inst:t,next:null},t=Oe.updateQueue,t===null&&(t=tp(),Oe.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(a=n.next,n.next=e,e.next=a,t.lastEffect=e),e}function Xu(){return{destroy:void 0,resource:void 0}}function eb(){return Tt().memoizedState}function Sc(e,t,n,a){var r=sn();a=a===void 0?null:a,Oe.flags|=e,r.memoizedState=xl(1|t,Xu(),n,a)}function jo(e,t,n,a){var r=Tt();a=a===void 0?null:a;var l=r.memoizedState.inst;et!==null&&a!==null&&Qm(a,et.memoizedState.deps)?r.memoizedState=xl(t,l,n,a):(Oe.flags|=e,r.memoizedState=xl(1|t,l,n,a))}function Mg(e,t){Sc(8390656,8,e,t)}function tb(e,t){jo(2048,8,e,t)}function nb(e,t){return jo(4,2,e,t)}function sb(e,t){return jo(4,4,e,t)}function ab(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function rb(e,t,n){n=n!=null?n.concat([e]):null,jo(4,4,ab.bind(null,t,e),n)}function ap(){}function lb(e,t){var n=Tt();t=t===void 0?null:t;var a=n.memoizedState;return t!==null&&Qm(t,a[1])?a[0]:(n.memoizedState=[e,t],e)}function ib(e,t){var n=Tt();t=t===void 0?null:t;var a=n.memoizedState;if(t!==null&&Qm(t,a[1]))return a[0];if(a=e(),ir){ga(!0);try{e()}finally{ga(!1)}}return n.memoizedState=[a,t],a}function rp(e,t,n){return n===void 0||Ma&1073741824?e.memoizedState=t:(e.memoizedState=n,e=Wb(),Oe.lanes|=e,Oa|=e,n)}function ob(e,t,n,a){return Tn(n,t)?n:pl.current!==null?(e=rp(e,n,a),Tn(e,t)||(Ut=!0),e):Ma&42?(e=Wb(),Oe.lanes|=e,Oa|=e,t):(Ut=!0,e.memoizedState=n)}function cb(e,t,n,a,r){var l=Ve.p;Ve.p=l!==0&&8>l?l:8;var i=Ce.T,o={};Ce.T=o,ip(e,!1,t,n);try{var c=r(),d=Ce.S;if(d!==null&&d(o,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var f=U2(c,a);Ci(e,t,f,Sn(e))}else Ci(e,t,a,Sn(e))}catch(h){Ci(e,t,{then:function(){},status:"rejected",reason:h},Sn())}finally{Ve.p=l,Ce.T=i}}function q2(){}function Sh(e,t,n,a){if(e.tag!==5)throw Error(Z(476));var r=ub(e).queue;cb(e,r,t,Wa,n===null?q2:function(){return db(e),n(a)})}function ub(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Wa,baseState:Wa,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ys,lastRenderedState:Wa},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ys,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function db(e){var t=ub(e).next.queue;Ci(e,t,{},Sn())}function lp(){return Gt(Yi)}function fb(){return Tt().memoizedState}function hb(){return Tt().memoizedState}function G2(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Sn();e=Na(n);var a=ka(t,e,n);a!==null&&(Cn(a,t,n),Ni(a,t,n)),t={cache:Ym()},e.payload=t;return}t=t.return}}function V2(e,t,n){var a=Sn();n={lane:a,revertLane:0,action:n,hasEagerState:!1,eagerState:null,next:null},Qu(e)?pb(t,n):(n=Pm(e,t,n,a),n!==null&&(Cn(n,e,a),xb(n,t,a)))}function mb(e,t,n){var a=Sn();Ci(e,t,n,a)}function Ci(e,t,n,a){var r={lane:a,revertLane:0,action:n,hasEagerState:!1,eagerState:null,next:null};if(Qu(e))pb(t,r);else{var l=e.alternate;if(e.lanes===0&&(l===null||l.lanes===0)&&(l=t.lastRenderedReducer,l!==null))try{var i=t.lastRenderedState,o=l(i,n);if(r.hasEagerState=!0,r.eagerState=o,Tn(o,i))return Yu(e,t,r,0),nt===null&&Vu(),!1}catch{}finally{}if(n=Pm(e,t,r,a),n!==null)return Cn(n,e,a),xb(n,t,a),!0}return!1}function ip(e,t,n,a){if(a={lane:2,revertLane:pp(),action:a,hasEagerState:!1,eagerState:null,next:null},Qu(e)){if(t)throw Error(Z(479))}else t=Pm(e,n,a,2),t!==null&&Cn(t,e,2)}function Qu(e){var t=e.alternate;return e===Oe||t!==null&&t===Oe}function pb(e,t){tl=Zc=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function xb(e,t,n){if(n&4194048){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,lj(e,n)}}var eu={readContext:Gt,use:Ku,useCallback:bt,useContext:bt,useEffect:bt,useImperativeHandle:bt,useLayoutEffect:bt,useInsertionEffect:bt,useMemo:bt,useReducer:bt,useRef:bt,useState:bt,useDebugValue:bt,useDeferredValue:bt,useTransition:bt,useSyncExternalStore:bt,useId:bt,useHostTransitionStatus:bt,useFormState:bt,useActionState:bt,useOptimistic:bt,useMemoCache:bt,useCacheRefresh:bt},gb={readContext:Gt,use:Ku,useCallback:function(e,t){return sn().memoizedState=[e,t===void 0?null:t],e},useContext:Gt,useEffect:Mg,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Sc(4194308,4,ab.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Sc(4194308,4,e,t)},useInsertionEffect:function(e,t){Sc(4,2,e,t)},useMemo:function(e,t){var n=sn();t=t===void 0?null:t;var a=e();if(ir){ga(!0);try{e()}finally{ga(!1)}}return n.memoizedState=[a,t],a},useReducer:function(e,t,n){var a=sn();if(n!==void 0){var r=n(t);if(ir){ga(!0);try{n(t)}finally{ga(!1)}}}else r=t;return a.memoizedState=a.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},a.queue=e,e=e.dispatch=V2.bind(null,Oe,e),[a.memoizedState,e]},useRef:function(e){var t=sn();return e={current:e},t.memoizedState=e},useState:function(e){e=Nh(e);var t=e.queue,n=mb.bind(null,Oe,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ap,useDeferredValue:function(e,t){var n=sn();return rp(n,e,t)},useTransition:function(){var e=Nh(!1);return e=cb.bind(null,Oe,e.queue,!0,!1),sn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var a=Oe,r=sn();if(Ge){if(n===void 0)throw Error(Z(407));n=n()}else{if(n=t(),nt===null)throw Error(Z(349));Ie&124||Gj(a,t,n)}r.memoizedState=n;var l={value:n,getSnapshot:t};return r.queue=l,Mg(Yj.bind(null,a,l,e),[e]),a.flags|=2048,xl(9,Xu(),Vj.bind(null,a,l,n,t),null),n},useId:function(){var e=sn(),t=nt.identifierPrefix;if(Ge){var n=Hs,a=Bs;n=(a&~(1<<32-kn(a)-1)).toString(32)+n,t="«"+t+"R"+n,n=Jc++,0<n&&(t+="H"+n.toString(32)),t+="»"}else n=B2++,t="«"+t+"r"+n.toString(32)+"»";return e.memoizedState=t},useHostTransitionStatus:lp,useFormState:Tg,useActionState:Tg,useOptimistic:function(e){var t=sn();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=ip.bind(null,Oe,!0,n),n.dispatch=t,[e,t]},useMemoCache:np,useCacheRefresh:function(){return sn().memoizedState=G2.bind(null,Oe)}},vb={readContext:Gt,use:Ku,useCallback:lb,useContext:Gt,useEffect:tb,useImperativeHandle:rb,useInsertionEffect:nb,useLayoutEffect:sb,useMemo:ib,useReducer:kc,useRef:eb,useState:function(){return kc(Ys)},useDebugValue:ap,useDeferredValue:function(e,t){var n=Tt();return ob(n,et.memoizedState,e,t)},useTransition:function(){var e=kc(Ys)[0],t=Tt().memoizedState;return[typeof e=="boolean"?e:yo(e),t]},useSyncExternalStore:qj,useId:fb,useHostTransitionStatus:lp,useFormState:Eg,useActionState:Eg,useOptimistic:function(e,t){var n=Tt();return Xj(n,et,e,t)},useMemoCache:np,useCacheRefresh:hb},Y2={readContext:Gt,use:Ku,useCallback:lb,useContext:Gt,useEffect:tb,useImperativeHandle:rb,useInsertionEffect:nb,useLayoutEffect:sb,useMemo:ib,useReducer:lf,useRef:eb,useState:function(){return lf(Ys)},useDebugValue:ap,useDeferredValue:function(e,t){var n=Tt();return et===null?rp(n,e,t):ob(n,et.memoizedState,e,t)},useTransition:function(){var e=lf(Ys)[0],t=Tt().memoizedState;return[typeof e=="boolean"?e:yo(e),t]},useSyncExternalStore:qj,useId:fb,useHostTransitionStatus:lp,useFormState:Ag,useActionState:Ag,useOptimistic:function(e,t){var n=Tt();return et!==null?Xj(n,et,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:np,useCacheRefresh:hb},sl=null,Pi=0;function Qo(e){var t=Pi;return Pi+=1,sl===null&&(sl=[]),Uj(sl,e,t)}function Jl(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Wo(e,t){throw t.$$typeof===wS?Error(Z(525)):(e=Object.prototype.toString.call(t),Error(Z(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function $g(e){var t=e._init;return t(e._payload)}function yb(e){function t(g,p){if(e){var j=g.deletions;j===null?(g.deletions=[p],g.flags|=16):j.push(p)}}function n(g,p){if(!e)return null;for(;p!==null;)t(g,p),p=p.sibling;return null}function a(g){for(var p=new Map;g!==null;)g.key!==null?p.set(g.key,g):p.set(g.index,g),g=g.sibling;return p}function r(g,p){return g=qs(g,p),g.index=0,g.sibling=null,g}function l(g,p,j){return g.index=j,e?(j=g.alternate,j!==null?(j=j.index,j<p?(g.flags|=67108866,p):j):(g.flags|=67108866,p)):(g.flags|=1048576,p)}function i(g){return e&&g.alternate===null&&(g.flags|=67108866),g}function o(g,p,j,w){return p===null||p.tag!==6?(p=sf(j,g.mode,w),p.return=g,p):(p=r(p,j),p.return=g,p)}function c(g,p,j,w){var N=j.type;return N===Ur?f(g,p,j.props.children,w,j.key):p!==null&&(p.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===da&&$g(N)===p.type)?(p=r(p,j.props),Jl(p,j),p.return=g,p):(p=_c(j.type,j.key,j.props,null,g.mode,w),Jl(p,j),p.return=g,p)}function d(g,p,j,w){return p===null||p.tag!==4||p.stateNode.containerInfo!==j.containerInfo||p.stateNode.implementation!==j.implementation?(p=af(j,g.mode,w),p.return=g,p):(p=r(p,j.children||[]),p.return=g,p)}function f(g,p,j,w,N){return p===null||p.tag!==7?(p=Za(j,g.mode,w,N),p.return=g,p):(p=r(p,j),p.return=g,p)}function h(g,p,j){if(typeof p=="string"&&p!==""||typeof p=="number"||typeof p=="bigint")return p=sf(""+p,g.mode,j),p.return=g,p;if(typeof p=="object"&&p!==null){switch(p.$$typeof){case qo:return j=_c(p.type,p.key,p.props,null,g.mode,j),Jl(j,p),j.return=g,j;case ii:return p=af(p,g.mode,j),p.return=g,p;case da:var w=p._init;return p=w(p._payload),h(g,p,j)}if(oi(p)||Xl(p))return p=Za(p,g.mode,j,null),p.return=g,p;if(typeof p.then=="function")return h(g,Qo(p),j);if(p.$$typeof===Us)return h(g,Ko(g,p),j);Wo(g,p)}return null}function m(g,p,j,w){var N=p!==null?p.key:null;if(typeof j=="string"&&j!==""||typeof j=="number"||typeof j=="bigint")return N!==null?null:o(g,p,""+j,w);if(typeof j=="object"&&j!==null){switch(j.$$typeof){case qo:return j.key===N?c(g,p,j,w):null;case ii:return j.key===N?d(g,p,j,w):null;case da:return N=j._init,j=N(j._payload),m(g,p,j,w)}if(oi(j)||Xl(j))return N!==null?null:f(g,p,j,w,null);if(typeof j.then=="function")return m(g,p,Qo(j),w);if(j.$$typeof===Us)return m(g,p,Ko(g,j),w);Wo(g,j)}return null}function x(g,p,j,w,N){if(typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint")return g=g.get(j)||null,o(p,g,""+w,N);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case qo:return g=g.get(w.key===null?j:w.key)||null,c(p,g,w,N);case ii:return g=g.get(w.key===null?j:w.key)||null,d(p,g,w,N);case da:var C=w._init;return w=C(w._payload),x(g,p,j,w,N)}if(oi(w)||Xl(w))return g=g.get(j)||null,f(p,g,w,N,null);if(typeof w.then=="function")return x(g,p,j,Qo(w),N);if(w.$$typeof===Us)return x(g,p,j,Ko(p,w),N);Wo(p,w)}return null}function b(g,p,j,w){for(var N=null,C=null,_=p,S=p=0,$=null;_!==null&&S<j.length;S++){_.index>S?($=_,_=null):$=_.sibling;var O=m(g,_,j[S],w);if(O===null){_===null&&(_=$);break}e&&_&&O.alternate===null&&t(g,_),p=l(O,p,S),C===null?N=O:C.sibling=O,C=O,_=$}if(S===j.length)return n(g,_),Ge&&Ka(g,S),N;if(_===null){for(;S<j.length;S++)_=h(g,j[S],w),_!==null&&(p=l(_,p,S),C===null?N=_:C.sibling=_,C=_);return Ge&&Ka(g,S),N}for(_=a(_);S<j.length;S++)$=x(_,g,S,j[S],w),$!==null&&(e&&$.alternate!==null&&_.delete($.key===null?S:$.key),p=l($,p,S),C===null?N=$:C.sibling=$,C=$);return e&&_.forEach(function(G){return t(g,G)}),Ge&&Ka(g,S),N}function v(g,p,j,w){if(j==null)throw Error(Z(151));for(var N=null,C=null,_=p,S=p=0,$=null,O=j.next();_!==null&&!O.done;S++,O=j.next()){_.index>S?($=_,_=null):$=_.sibling;var G=m(g,_,O.value,w);if(G===null){_===null&&(_=$);break}e&&_&&G.alternate===null&&t(g,_),p=l(G,p,S),C===null?N=G:C.sibling=G,C=G,_=$}if(O.done)return n(g,_),Ge&&Ka(g,S),N;if(_===null){for(;!O.done;S++,O=j.next())O=h(g,O.value,w),O!==null&&(p=l(O,p,S),C===null?N=O:C.sibling=O,C=O);return Ge&&Ka(g,S),N}for(_=a(_);!O.done;S++,O=j.next())O=x(_,g,S,O.value,w),O!==null&&(e&&O.alternate!==null&&_.delete(O.key===null?S:O.key),p=l(O,p,S),C===null?N=O:C.sibling=O,C=O);return e&&_.forEach(function(V){return t(g,V)}),Ge&&Ka(g,S),N}function y(g,p,j,w){if(typeof j=="object"&&j!==null&&j.type===Ur&&j.key===null&&(j=j.props.children),typeof j=="object"&&j!==null){switch(j.$$typeof){case qo:e:{for(var N=j.key;p!==null;){if(p.key===N){if(N=j.type,N===Ur){if(p.tag===7){n(g,p.sibling),w=r(p,j.props.children),w.return=g,g=w;break e}}else if(p.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===da&&$g(N)===p.type){n(g,p.sibling),w=r(p,j.props),Jl(w,j),w.return=g,g=w;break e}n(g,p);break}else t(g,p);p=p.sibling}j.type===Ur?(w=Za(j.props.children,g.mode,w,j.key),w.return=g,g=w):(w=_c(j.type,j.key,j.props,null,g.mode,w),Jl(w,j),w.return=g,g=w)}return i(g);case ii:e:{for(N=j.key;p!==null;){if(p.key===N)if(p.tag===4&&p.stateNode.containerInfo===j.containerInfo&&p.stateNode.implementation===j.implementation){n(g,p.sibling),w=r(p,j.children||[]),w.return=g,g=w;break e}else{n(g,p);break}else t(g,p);p=p.sibling}w=af(j,g.mode,w),w.return=g,g=w}return i(g);case da:return N=j._init,j=N(j._payload),y(g,p,j,w)}if(oi(j))return b(g,p,j,w);if(Xl(j)){if(N=Xl(j),typeof N!="function")throw Error(Z(150));return j=N.call(j),v(g,p,j,w)}if(typeof j.then=="function")return y(g,p,Qo(j),w);if(j.$$typeof===Us)return y(g,p,Ko(g,j),w);Wo(g,j)}return typeof j=="string"&&j!==""||typeof j=="number"||typeof j=="bigint"?(j=""+j,p!==null&&p.tag===6?(n(g,p.sibling),w=r(p,j),w.return=g,g=w):(n(g,p),w=sf(j,g.mode,w),w.return=g,g=w),i(g)):n(g,p)}return function(g,p,j,w){try{Pi=0;var N=y(g,p,j,w);return sl=null,N}catch(_){if(_===vo||_===Fu)throw _;var C=_n(29,_,null,g.mode);return C.lanes=w,C.return=g,C}finally{}}}var gl=yb(!0),jb=yb(!1),Gn=ks(null),ys=null;function ma(e){var t=e.alternate;ct($t,$t.current&1),ct(Gn,e),ys===null&&(t===null||pl.current!==null||t.memoizedState!==null)&&(ys=e)}function bb(e){if(e.tag===22){if(ct($t,$t.current),ct(Gn,e),ys===null){var t=e.alternate;t!==null&&t.memoizedState!==null&&(ys=e)}}else pa()}function pa(){ct($t,$t.current),ct(Gn,Gn.current)}function Ps(e){Bt(Gn),ys===e&&(ys=null),Bt($t)}var $t=ks(0);function tu(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==="$?"||qh(n)))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}function of(e,t,n,a){t=e.memoizedState,n=n(a,t),n=n==null?t:at({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ch={enqueueSetState:function(e,t,n){e=e._reactInternals;var a=Sn(),r=Na(a);r.payload=t,n!=null&&(r.callback=n),t=ka(e,r,a),t!==null&&(Cn(t,e,a),Ni(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var a=Sn(),r=Na(a);r.tag=1,r.payload=t,n!=null&&(r.callback=n),t=ka(e,r,a),t!==null&&(Cn(t,e,a),Ni(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Sn(),a=Na(n);a.tag=2,t!=null&&(a.callback=t),t=ka(e,a,n),t!==null&&(Cn(t,e,n),Ni(t,e,n))}};function Og(e,t,n,a,r,l,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(a,l,i):t.prototype&&t.prototype.isPureReactComponent?!Bi(n,a)||!Bi(r,l):!0}function Dg(e,t,n,a){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,a),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,a),t.state!==e&&Ch.enqueueReplaceState(t,t.state,null)}function or(e,t){var n=t;if("ref"in t){n={};for(var a in t)a!=="ref"&&(n[a]=t[a])}if(e=e.defaultProps){n===t&&(n=at({},n));for(var r in e)n[r]===void 0&&(n[r]=e[r])}return n}var nu=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)};function wb(e){nu(e)}function _b(e){console.error(e)}function Nb(e){nu(e)}function su(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(a){setTimeout(function(){throw a})}}function zg(e,t,n){try{var a=e.onCaughtError;a(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(r){setTimeout(function(){throw r})}}function Rh(e,t,n){return n=Na(n),n.tag=3,n.payload={element:null},n.callback=function(){su(e,t)},n}function kb(e){return e=Na(e),e.tag=3,e}function Sb(e,t,n,a){var r=n.type.getDerivedStateFromError;if(typeof r=="function"){var l=a.value;e.payload=function(){return r(l)},e.callback=function(){zg(t,n,a)}}var i=n.stateNode;i!==null&&typeof i.componentDidCatch=="function"&&(e.callback=function(){zg(t,n,a),typeof r!="function"&&(Sa===null?Sa=new Set([this]):Sa.add(this));var o=a.stack;this.componentDidCatch(a.value,{componentStack:o!==null?o:""})})}function F2(e,t,n,a,r){if(n.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){if(t=n.alternate,t!==null&&xo(t,n,r,!0),n=Gn.current,n!==null){switch(n.tag){case 13:return ys===null?zh():n.alternate===null&&xt===0&&(xt=3),n.flags&=-257,n.flags|=65536,n.lanes=r,a===jh?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([a]):t.add(a),yf(e,a,r)),!1;case 22:return n.flags|=65536,a===jh?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([a])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([a]):n.add(a)),yf(e,a,r)),!1}throw Error(Z(435,n.tag))}return yf(e,a,r),zh(),!1}if(Ge)return t=Gn.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=r,a!==ph&&(e=Error(Z(422),{cause:a}),Hi(Un(e,n)))):(a!==ph&&(t=Error(Z(423),{cause:a}),Hi(Un(t,n))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,a=Un(a,n),r=Rh(e.stateNode,a,r),rf(e,r),xt!==4&&(xt=2)),!1;var l=Error(Z(520),{cause:a});if(l=Un(l,n),Ei===null?Ei=[l]:Ei.push(l),xt!==4&&(xt=2),t===null)return!0;a=Un(a,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=r&-r,n.lanes|=e,e=Rh(n.stateNode,a,e),rf(n,e),!1;case 1:if(t=n.type,l=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||l!==null&&typeof l.componentDidCatch=="function"&&(Sa===null||!Sa.has(l))))return n.flags|=65536,r&=-r,n.lanes|=r,r=kb(r),Sb(r,e,n,a),rf(n,r),!1}n=n.return}while(n!==null);return!1}var Cb=Error(Z(461)),Ut=!1;function Ht(e,t,n,a){t.child=e===null?jb(t,null,n,a):gl(t,e.child,n,a)}function Lg(e,t,n,a,r){n=n.render;var l=t.ref;if("ref"in a){var i={};for(var o in a)o!=="ref"&&(i[o]=a[o])}else i=a;return lr(t),a=Wm(e,t,n,i,l,r),o=Zm(),e!==null&&!Ut?(Jm(e,t,r),Fs(e,t,r)):(Ge&&o&&Gm(t),t.flags|=1,Ht(e,t,a,r),t.child)}function Ug(e,t,n,a,r){if(e===null){var l=n.type;return typeof l=="function"&&!qm(l)&&l.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=l,Rb(e,t,l,a,r)):(e=_c(n.type,null,a,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(l=e.child,!op(e,r)){var i=l.memoizedProps;if(n=n.compare,n=n!==null?n:Bi,n(i,a)&&e.ref===t.ref)return Fs(e,t,r)}return t.flags|=1,e=qs(l,a),e.ref=t.ref,e.return=t,t.child=e}function Rb(e,t,n,a,r){if(e!==null){var l=e.memoizedProps;if(Bi(l,a)&&e.ref===t.ref)if(Ut=!1,t.pendingProps=a=l,op(e,r))e.flags&131072&&(Ut=!0);else return t.lanes=e.lanes,Fs(e,t,r)}return Th(e,t,n,a,r)}function Tb(e,t,n){var a=t.pendingProps,r=a.children,l=e!==null?e.memoizedState:null;if(a.mode==="hidden"){if(t.flags&128){if(a=l!==null?l.baseLanes|n:n,e!==null){for(r=t.child=e.child,l=0;r!==null;)l=l|r.lanes|r.childLanes,r=r.sibling;t.childLanes=l&~a}else t.childLanes=0,t.child=null;return Bg(e,t,a,n)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Nc(t,l!==null?l.cachePool:null),l!==null?Sg(t,l):_h(),bb(t);else return t.lanes=t.childLanes=536870912,Bg(e,t,l!==null?l.baseLanes|n:n,n)}else l!==null?(Nc(t,l.cachePool),Sg(t,l),pa(),t.memoizedState=null):(e!==null&&Nc(t,null),_h(),pa());return Ht(e,t,r,n),t.child}function Bg(e,t,n,a){var r=Fm();return r=r===null?null:{parent:Mt._currentValue,pool:r},t.memoizedState={baseLanes:n,cachePool:r},e!==null&&Nc(t,null),_h(),bb(t),e!==null&&xo(e,t,a,!0),null}function Cc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(Z(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Th(e,t,n,a,r){return lr(t),n=Wm(e,t,n,a,void 0,r),a=Zm(),e!==null&&!Ut?(Jm(e,t,r),Fs(e,t,r)):(Ge&&a&&Gm(t),t.flags|=1,Ht(e,t,n,r),t.child)}function Hg(e,t,n,a,r,l){return lr(t),t.updateQueue=null,n=Pj(t,a,n,r),Ij(e),a=Zm(),e!==null&&!Ut?(Jm(e,t,l),Fs(e,t,l)):(Ge&&a&&Gm(t),t.flags|=1,Ht(e,t,n,l),t.child)}function Ig(e,t,n,a,r){if(lr(t),t.stateNode===null){var l=Yr,i=n.contextType;typeof i=="object"&&i!==null&&(l=Gt(i)),l=new n(a,l),t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,l.updater=Ch,t.stateNode=l,l._reactInternals=t,l=t.stateNode,l.props=a,l.state=t.memoizedState,l.refs={},Km(t),i=n.contextType,l.context=typeof i=="object"&&i!==null?Gt(i):Yr,l.state=t.memoizedState,i=n.getDerivedStateFromProps,typeof i=="function"&&(of(t,n,i,a),l.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof l.getSnapshotBeforeUpdate=="function"||typeof l.UNSAFE_componentWillMount!="function"&&typeof l.componentWillMount!="function"||(i=l.state,typeof l.componentWillMount=="function"&&l.componentWillMount(),typeof l.UNSAFE_componentWillMount=="function"&&l.UNSAFE_componentWillMount(),i!==l.state&&Ch.enqueueReplaceState(l,l.state,null),Si(t,a,l,r),ki(),l.state=t.memoizedState),typeof l.componentDidMount=="function"&&(t.flags|=4194308),a=!0}else if(e===null){l=t.stateNode;var o=t.memoizedProps,c=or(n,o);l.props=c;var d=l.context,f=n.contextType;i=Yr,typeof f=="object"&&f!==null&&(i=Gt(f));var h=n.getDerivedStateFromProps;f=typeof h=="function"||typeof l.getSnapshotBeforeUpdate=="function",o=t.pendingProps!==o,f||typeof l.UNSAFE_componentWillReceiveProps!="function"&&typeof l.componentWillReceiveProps!="function"||(o||d!==i)&&Dg(t,l,a,i),fa=!1;var m=t.memoizedState;l.state=m,Si(t,a,l,r),ki(),d=t.memoizedState,o||m!==d||fa?(typeof h=="function"&&(of(t,n,h,a),d=t.memoizedState),(c=fa||Og(t,n,c,a,m,d,i))?(f||typeof l.UNSAFE_componentWillMount!="function"&&typeof l.componentWillMount!="function"||(typeof l.componentWillMount=="function"&&l.componentWillMount(),typeof l.UNSAFE_componentWillMount=="function"&&l.UNSAFE_componentWillMount()),typeof l.componentDidMount=="function"&&(t.flags|=4194308)):(typeof l.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=a,t.memoizedState=d),l.props=a,l.state=d,l.context=i,a=c):(typeof l.componentDidMount=="function"&&(t.flags|=4194308),a=!1)}else{l=t.stateNode,bh(e,t),i=t.memoizedProps,f=or(n,i),l.props=f,h=t.pendingProps,m=l.context,d=n.contextType,c=Yr,typeof d=="object"&&d!==null&&(c=Gt(d)),o=n.getDerivedStateFromProps,(d=typeof o=="function"||typeof l.getSnapshotBeforeUpdate=="function")||typeof l.UNSAFE_componentWillReceiveProps!="function"&&typeof l.componentWillReceiveProps!="function"||(i!==h||m!==c)&&Dg(t,l,a,c),fa=!1,m=t.memoizedState,l.state=m,Si(t,a,l,r),ki();var x=t.memoizedState;i!==h||m!==x||fa||e!==null&&e.dependencies!==null&&Qc(e.dependencies)?(typeof o=="function"&&(of(t,n,o,a),x=t.memoizedState),(f=fa||Og(t,n,f,a,m,x,c)||e!==null&&e.dependencies!==null&&Qc(e.dependencies))?(d||typeof l.UNSAFE_componentWillUpdate!="function"&&typeof l.componentWillUpdate!="function"||(typeof l.componentWillUpdate=="function"&&l.componentWillUpdate(a,x,c),typeof l.UNSAFE_componentWillUpdate=="function"&&l.UNSAFE_componentWillUpdate(a,x,c)),typeof l.componentDidUpdate=="function"&&(t.flags|=4),typeof l.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof l.componentDidUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof l.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=a,t.memoizedState=x),l.props=a,l.state=x,l.context=c,a=f):(typeof l.componentDidUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof l.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),a=!1)}return l=a,Cc(e,t),a=(t.flags&128)!==0,l||a?(l=t.stateNode,n=a&&typeof n.getDerivedStateFromError!="function"?null:l.render(),t.flags|=1,e!==null&&a?(t.child=gl(t,e.child,null,r),t.child=gl(t,null,n,r)):Ht(e,t,n,r),t.memoizedState=l.state,e=t.child):e=Fs(e,t,r),e}function Pg(e,t,n,a){return po(),t.flags|=256,Ht(e,t,n,a),t.child}var cf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function uf(e){return{baseLanes:e,cachePool:zj()}}function df(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Bn),e}function Eb(e,t,n){var a=t.pendingProps,r=!1,l=(t.flags&128)!==0,i;if((i=l)||(i=e!==null&&e.memoizedState===null?!1:($t.current&2)!==0),i&&(r=!0,t.flags&=-129),i=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ge){if(r?ma(t):pa(),Ge){var o=pt,c;if(c=o){e:{for(c=o,o=ds;c.nodeType!==8;){if(!o){o=null;break e}if(c=Zn(c.nextSibling),c===null){o=null;break e}}o=c}o!==null?(t.memoizedState={dehydrated:o,treeContext:Ja!==null?{id:Bs,overflow:Hs}:null,retryLane:536870912,hydrationErrors:null},c=_n(18,null,null,0),c.stateNode=o,c.return=t,t.child=c,Ft=t,pt=null,c=!0):c=!1}c||rr(t)}if(o=t.memoizedState,o!==null&&(o=o.dehydrated,o!==null))return qh(o)?t.lanes=32:t.lanes=536870912,null;Ps(t)}return o=a.children,a=a.fallback,r?(pa(),r=t.mode,o=au({mode:"hidden",children:o},r),a=Za(a,r,n,null),o.return=t,a.return=t,o.sibling=a,t.child=o,r=t.child,r.memoizedState=uf(n),r.childLanes=df(e,i,n),t.memoizedState=cf,a):(ma(t),Eh(t,o))}if(c=e.memoizedState,c!==null&&(o=c.dehydrated,o!==null)){if(l)t.flags&256?(ma(t),t.flags&=-257,t=ff(e,t,n)):t.memoizedState!==null?(pa(),t.child=e.child,t.flags|=128,t=null):(pa(),r=a.fallback,o=t.mode,a=au({mode:"visible",children:a.children},o),r=Za(r,o,n,null),r.flags|=2,a.return=t,r.return=t,a.sibling=r,t.child=a,gl(t,e.child,null,n),a=t.child,a.memoizedState=uf(n),a.childLanes=df(e,i,n),t.memoizedState=cf,t=r);else if(ma(t),qh(o)){if(i=o.nextSibling&&o.nextSibling.dataset,i)var d=i.dgst;i=d,a=Error(Z(419)),a.stack="",a.digest=i,Hi({value:a,source:null,stack:null}),t=ff(e,t,n)}else if(Ut||xo(e,t,n,!1),i=(n&e.childLanes)!==0,Ut||i){if(i=nt,i!==null&&(a=n&-n,a=a&42?1:Mm(a),a=a&(i.suspendedLanes|n)?0:a,a!==0&&a!==c.retryLane))throw c.retryLane=a,El(e,a),Cn(i,e,a),Cb;o.data==="$?"||zh(),t=ff(e,t,n)}else o.data==="$?"?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,pt=Zn(o.nextSibling),Ft=t,Ge=!0,er=null,ds=!1,e!==null&&(Dn[zn++]=Bs,Dn[zn++]=Hs,Dn[zn++]=Ja,Bs=e.id,Hs=e.overflow,Ja=t),t=Eh(t,a.children),t.flags|=4096);return t}return r?(pa(),r=a.fallback,o=t.mode,c=e.child,d=c.sibling,a=qs(c,{mode:"hidden",children:a.children}),a.subtreeFlags=c.subtreeFlags&65011712,d!==null?r=qs(d,r):(r=Za(r,o,n,null),r.flags|=2),r.return=t,a.return=t,a.sibling=r,t.child=a,a=r,r=t.child,o=e.child.memoizedState,o===null?o=uf(n):(c=o.cachePool,c!==null?(d=Mt._currentValue,c=c.parent!==d?{parent:d,pool:d}:c):c=zj(),o={baseLanes:o.baseLanes|n,cachePool:c}),r.memoizedState=o,r.childLanes=df(e,i,n),t.memoizedState=cf,a):(ma(t),n=e.child,e=n.sibling,n=qs(n,{mode:"visible",children:a.children}),n.return=t,n.sibling=null,e!==null&&(i=t.deletions,i===null?(t.deletions=[e],t.flags|=16):i.push(e)),t.child=n,t.memoizedState=null,n)}function Eh(e,t){return t=au({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function au(e,t){return e=_n(22,e,null,t),e.lanes=0,e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},e}function ff(e,t,n){return gl(t,e.child,null,n),e=Eh(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function qg(e,t,n){e.lanes|=t;var a=e.alternate;a!==null&&(a.lanes|=t),gh(e.return,t,n)}function hf(e,t,n,a,r){var l=e.memoizedState;l===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:a,tail:n,tailMode:r}:(l.isBackwards=t,l.rendering=null,l.renderingStartTime=0,l.last=a,l.tail=n,l.tailMode=r)}function Ab(e,t,n){var a=t.pendingProps,r=a.revealOrder,l=a.tail;if(Ht(e,t,a.children,n),a=$t.current,a&2)a=a&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&qg(e,n,t);else if(e.tag===19)qg(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}a&=1}switch(ct($t,a),r){case"forwards":for(n=t.child,r=null;n!==null;)e=n.alternate,e!==null&&tu(e)===null&&(r=n),n=n.sibling;n=r,n===null?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null),hf(t,!1,r,n,l);break;case"backwards":for(n=null,r=t.child,t.child=null;r!==null;){if(e=r.alternate,e!==null&&tu(e)===null){t.child=r;break}e=r.sibling,r.sibling=n,n=r,r=e}hf(t,!0,n,null,l);break;case"together":hf(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Fs(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Oa|=t.lanes,!(n&t.childLanes))if(e!==null){if(xo(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(Z(153));if(t.child!==null){for(e=t.child,n=qs(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=qs(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function op(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&Qc(e)))}function K2(e,t,n){switch(t.tag){case 3:Pc(t,t.stateNode.containerInfo),ha(t,Mt,e.memoizedState.cache),po();break;case 27:case 5:rh(t);break;case 4:Pc(t,t.stateNode.containerInfo);break;case 10:ha(t,t.type,t.memoizedProps.value);break;case 13:var a=t.memoizedState;if(a!==null)return a.dehydrated!==null?(ma(t),t.flags|=128,null):n&t.child.childLanes?Eb(e,t,n):(ma(t),e=Fs(e,t,n),e!==null?e.sibling:null);ma(t);break;case 19:var r=(e.flags&128)!==0;if(a=(n&t.childLanes)!==0,a||(xo(e,t,n,!1),a=(n&t.childLanes)!==0),r){if(a)return Ab(e,t,n);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),ct($t,$t.current),a)break;return null;case 22:case 23:return t.lanes=0,Tb(e,t,n);case 24:ha(t,Mt,e.memoizedState.cache)}return Fs(e,t,n)}function Mb(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Ut=!0;else{if(!op(e,n)&&!(t.flags&128))return Ut=!1,K2(e,t,n);Ut=!!(e.flags&131072)}else Ut=!1,Ge&&t.flags&1048576&&Oj(t,Xc,t.index);switch(t.lanes=0,t.tag){case 16:e:{e=t.pendingProps;var a=t.elementType,r=a._init;if(a=r(a._payload),t.type=a,typeof a=="function")qm(a)?(e=or(a,e),t.tag=1,t=Ig(null,t,a,e,n)):(t.tag=0,t=Th(null,t,a,e,n));else{if(a!=null){if(r=a.$$typeof,r===Tm){t.tag=11,t=Lg(null,t,a,e,n);break e}else if(r===Em){t.tag=14,t=Ug(null,t,a,e,n);break e}}throw t=sh(a)||a,Error(Z(306,t,""))}}return t;case 0:return Th(e,t,t.type,t.pendingProps,n);case 1:return a=t.type,r=or(a,t.pendingProps),Ig(e,t,a,r,n);case 3:e:{if(Pc(t,t.stateNode.containerInfo),e===null)throw Error(Z(387));a=t.pendingProps;var l=t.memoizedState;r=l.element,bh(e,t),Si(t,a,null,n);var i=t.memoizedState;if(a=i.cache,ha(t,Mt,a),a!==l.cache&&vh(t,[Mt],n,!0),ki(),a=i.element,l.isDehydrated)if(l={element:a,isDehydrated:!1,cache:i.cache},t.updateQueue.baseState=l,t.memoizedState=l,t.flags&256){t=Pg(e,t,a,n);break e}else if(a!==r){r=Un(Error(Z(424)),t),Hi(r),t=Pg(e,t,a,n);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(pt=Zn(e.firstChild),Ft=t,Ge=!0,er=null,ds=!0,n=jb(t,null,a,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(po(),a===r){t=Fs(e,t,n);break e}Ht(e,t,a,n)}t=t.child}return t;case 26:return Cc(e,t),e===null?(n=lv(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ge||(n=t.type,e=t.pendingProps,a=du(_a.current).createElement(n),a[qt]=t,a[on]=e,Pt(a,n,e),Lt(a),t.stateNode=a):t.memoizedState=lv(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return rh(t),e===null&&Ge&&(a=t.stateNode=v0(t.type,t.pendingProps,_a.current),Ft=t,ds=!0,r=pt,Ba(t.type)?(Gh=r,pt=Zn(a.firstChild)):pt=r),Ht(e,t,t.pendingProps.children,n),Cc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ge&&((r=a=pt)&&(a=wC(a,t.type,t.pendingProps,ds),a!==null?(t.stateNode=a,Ft=t,pt=Zn(a.firstChild),ds=!1,r=!0):r=!1),r||rr(t)),rh(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,a=l.children,Ih(r,l)?a=null:i!==null&&Ih(r,i)&&(t.flags|=32),t.memoizedState!==null&&(r=Wm(e,t,H2,null,null,n),Yi._currentValue=r),Cc(e,t),Ht(e,t,a,n),t.child;case 6:return e===null&&Ge&&((e=n=pt)&&(n=_C(n,t.pendingProps,ds),n!==null?(t.stateNode=n,Ft=t,pt=null,e=!0):e=!1),e||rr(t)),null;case 13:return Eb(e,t,n);case 4:return Pc(t,t.stateNode.containerInfo),a=t.pendingProps,e===null?t.child=gl(t,null,a,n):Ht(e,t,a,n),t.child;case 11:return Lg(e,t,t.type,t.pendingProps,n);case 7:return Ht(e,t,t.pendingProps,n),t.child;case 8:return Ht(e,t,t.pendingProps.children,n),t.child;case 12:return Ht(e,t,t.pendingProps.children,n),t.child;case 10:return a=t.pendingProps,ha(t,t.type,a.value),Ht(e,t,a.children,n),t.child;case 9:return r=t.type._context,a=t.pendingProps.children,lr(t),r=Gt(r),a=a(r),t.flags|=1,Ht(e,t,a,n),t.child;case 14:return Ug(e,t,t.type,t.pendingProps,n);case 15:return Rb(e,t,t.type,t.pendingProps,n);case 19:return Ab(e,t,n);case 31:return a=t.pendingProps,n=t.mode,a={mode:a.mode,children:a.children},e===null?(n=au(a,n),n.ref=t.ref,t.child=n,n.return=t,t=n):(n=qs(e.child,a),n.ref=t.ref,t.child=n,n.return=t,t=n),t;case 22:return Tb(e,t,n);case 24:return lr(t),a=Gt(Mt),e===null?(r=Fm(),r===null&&(r=nt,l=Ym(),r.pooledCache=l,l.refCount++,l!==null&&(r.pooledCacheLanes|=n),r=l),t.memoizedState={parent:a,cache:r},Km(t),ha(t,Mt,r)):(e.lanes&n&&(bh(e,t),Si(t,null,null,n),ki()),r=e.memoizedState,l=t.memoizedState,r.parent!==a?(r={parent:a,cache:a},t.memoizedState=r,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=r),ha(t,Mt,a)):(a=l.cache,ha(t,Mt,a),a!==r.cache&&vh(t,[Mt],n,!0))),Ht(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(Z(156,t.tag))}function As(e){e.flags|=4}function Gg(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!b0(t)){if(t=Gn.current,t!==null&&((Ie&4194048)===Ie?ys!==null:(Ie&62914560)!==Ie&&!(Ie&536870912)||t!==ys))throw _i=jh,Lj;e.flags|=8192}}function Zo(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?aj():536870912,e.lanes|=t,vl|=t)}function ei(e,t){if(!Ge)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 a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:a.sibling=null}}function dt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,a=0;if(t)for(var r=e.child;r!==null;)n|=r.lanes|r.childLanes,a|=r.subtreeFlags&65011712,a|=r.flags&65011712,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)n|=r.lanes|r.childLanes,a|=r.subtreeFlags,a|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=a,e.childLanes=n,t}function X2(e,t,n){var a=t.pendingProps;switch(Vm(t),t.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dt(t),null;case 1:return dt(t),null;case 3:return n=t.stateNode,a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Gs(Mt),dl(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Zl(t)?As(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,jg())),dt(t),null;case 26:return n=t.memoizedState,e===null?(As(t),n!==null?(dt(t),Gg(t,n)):(dt(t),t.flags&=-16777217)):n?n!==e.memoizedState?(As(t),dt(t),Gg(t,n)):(dt(t),t.flags&=-16777217):(e.memoizedProps!==a&&As(t),dt(t),t.flags&=-16777217),null;case 27:qc(t),n=_a.current;var r=t.type;if(e!==null&&t.stateNode!=null)e.memoizedProps!==a&&As(t);else{if(!a){if(t.stateNode===null)throw Error(Z(166));return dt(t),null}e=gs.current,Zl(t)?vg(t):(e=v0(r,a,n),t.stateNode=e,As(t))}return dt(t),null;case 5:if(qc(t),n=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&As(t);else{if(!a){if(t.stateNode===null)throw Error(Z(166));return dt(t),null}if(e=gs.current,Zl(t))vg(t);else{switch(r=du(_a.current),e){case 1:e=r.createElementNS("http://www.w3.org/2000/svg",n);break;case 2:e=r.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;default:switch(n){case"svg":e=r.createElementNS("http://www.w3.org/2000/svg",n);break;case"math":e=r.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;case"script":e=r.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild);break;case"select":e=typeof a.is=="string"?r.createElement("select",{is:a.is}):r.createElement("select"),a.multiple?e.multiple=!0:a.size&&(e.size=a.size);break;default:e=typeof a.is=="string"?r.createElement(n,{is:a.is}):r.createElement(n)}}e[qt]=t,e[on]=a;e:for(r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.tag!==27&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break e;for(;r.sibling===null;){if(r.return===null||r.return===t)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}t.stateNode=e;e:switch(Pt(e,n,a),n){case"button":case"input":case"select":case"textarea":e=!!a.autoFocus;break e;case"img":e=!0;break e;default:e=!1}e&&As(t)}}return dt(t),t.flags&=-16777217,null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==a&&As(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(Z(166));if(e=_a.current,Zl(t)){if(e=t.stateNode,n=t.memoizedProps,a=null,r=Ft,r!==null)switch(r.tag){case 27:case 5:a=r.memoizedProps}e[qt]=t,e=!!(e.nodeValue===n||a!==null&&a.suppressHydrationWarning===!0||p0(e.nodeValue,n)),e||rr(t)}else e=du(e).createTextNode(a),e[qt]=t,t.stateNode=e}return dt(t),null;case 13:if(a=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=Zl(t),a!==null&&a.dehydrated!==null){if(e===null){if(!r)throw Error(Z(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(Z(317));r[qt]=t}else po(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;dt(t),r=!1}else r=jg(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(Ps(t),t):(Ps(t),null)}if(Ps(t),t.flags&128)return t.lanes=n,t;if(n=a!==null,e=e!==null&&e.memoizedState!==null,n){a=t.child,r=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(r=a.alternate.memoizedState.cachePool.pool);var l=null;a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(l=a.memoizedState.cachePool.pool),l!==r&&(a.flags|=2048)}return n!==e&&n&&(t.child.flags|=8192),Zo(t,t.updateQueue),dt(t),null;case 4:return dl(),e===null&&xp(t.stateNode.containerInfo),dt(t),null;case 10:return Gs(t.type),dt(t),null;case 19:if(Bt($t),r=t.memoizedState,r===null)return dt(t),null;if(a=(t.flags&128)!==0,l=r.rendering,l===null)if(a)ei(r,!1);else{if(xt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(l=tu(e),l!==null){for(t.flags|=128,ei(r,!1),e=l.updateQueue,t.updateQueue=e,Zo(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)$j(n,e),n=n.sibling;return ct($t,$t.current&1|2),t.child}e=e.sibling}r.tail!==null&&vs()>lu&&(t.flags|=128,a=!0,ei(r,!1),t.lanes=4194304)}else{if(!a)if(e=tu(l),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Zo(t,e),ei(r,!0),r.tail===null&&r.tailMode==="hidden"&&!l.alternate&&!Ge)return dt(t),null}else 2*vs()-r.renderingStartTime>lu&&n!==536870912&&(t.flags|=128,a=!0,ei(r,!1),t.lanes=4194304);r.isBackwards?(l.sibling=t.child,t.child=l):(e=r.last,e!==null?e.sibling=l:t.child=l,r.last=l)}return r.tail!==null?(t=r.tail,r.rendering=t,r.tail=t.sibling,r.renderingStartTime=vs(),t.sibling=null,e=$t.current,ct($t,a?e&1|2:e&1),t):(dt(t),null);case 22:case 23:return Ps(t),Xm(),a=t.memoizedState!==null,e!==null?e.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?n&536870912&&!(t.flags&128)&&(dt(t),t.subtreeFlags&6&&(t.flags|=8192)):dt(t),n=t.updateQueue,n!==null&&Zo(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==n&&(t.flags|=2048),e!==null&&Bt(tr),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Gs(Mt),dt(t),null;case 25:return null;case 30:return null}throw Error(Z(156,t.tag))}function Q2(e,t){switch(Vm(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Gs(Mt),dl(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return qc(t),null;case 13:if(Ps(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Z(340));po()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Bt($t),null;case 4:return dl(),null;case 10:return Gs(t.type),null;case 22:case 23:return Ps(t),Xm(),e!==null&&Bt(tr),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Gs(Mt),null;case 25:return null;default:return null}}function $b(e,t){switch(Vm(t),t.tag){case 3:Gs(Mt),dl();break;case 26:case 27:case 5:qc(t);break;case 4:dl();break;case 13:Ps(t);break;case 19:Bt($t);break;case 10:Gs(t.type);break;case 22:case 23:Ps(t),Xm(),e!==null&&Bt(tr);break;case 24:Gs(Mt)}}function bo(e,t){try{var n=t.updateQueue,a=n!==null?n.lastEffect:null;if(a!==null){var r=a.next;n=r;do{if((n.tag&e)===e){a=void 0;var l=n.create,i=n.inst;a=l(),i.destroy=a}n=n.next}while(n!==r)}}catch(o){tt(t,t.return,o)}}function $a(e,t,n){try{var a=t.updateQueue,r=a!==null?a.lastEffect:null;if(r!==null){var l=r.next;a=l;do{if((a.tag&e)===e){var i=a.inst,o=i.destroy;if(o!==void 0){i.destroy=void 0,r=t;var c=n,d=o;try{d()}catch(f){tt(r,c,f)}}}a=a.next}while(a!==l)}}catch(f){tt(t,t.return,f)}}function Ob(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Hj(t,n)}catch(a){tt(e,e.return,a)}}}function Db(e,t,n){n.props=or(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(a){tt(e,t,a)}}function Ri(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var a=e.stateNode;break;case 30:a=e.stateNode;break;default:a=e.stateNode}typeof n=="function"?e.refCleanup=n(a):n.current=a}}catch(r){tt(e,t,r)}}function ms(e,t){var n=e.ref,a=e.refCleanup;if(n!==null)if(typeof a=="function")try{a()}catch(r){tt(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(r){tt(e,t,r)}else n.current=null}function zb(e){var t=e.type,n=e.memoizedProps,a=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&a.focus();break e;case"img":n.src?a.src=n.src:n.srcSet&&(a.srcset=n.srcSet)}}catch(r){tt(e,e.return,r)}}function mf(e,t,n){try{var a=e.stateNode;gC(a,e.type,n,t),a[on]=t}catch(r){tt(e,e.return,r)}}function Lb(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ba(e.type)||e.tag===4}function pf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Lb(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Ba(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ah(e,t,n){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=ed));else if(a!==4&&(a===27&&Ba(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Ah(e,t,n),e=e.sibling;e!==null;)Ah(e,t,n),e=e.sibling}function ru(e,t,n){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(a!==4&&(a===27&&Ba(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(ru(e,t,n),e=e.sibling;e!==null;)ru(e,t,n),e=e.sibling}function Ub(e){var t=e.stateNode,n=e.memoizedProps;try{for(var a=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);Pt(t,a,n),t[qt]=e,t[on]=n}catch(l){tt(e,e.return,l)}}var Ls=!1,wt=!1,xf=!1,Vg=typeof WeakSet=="function"?WeakSet:Set,zt=null;function W2(e,t){if(e=e.containerInfo,Bh=pu,e=kj(e),Hm(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var a=n.getSelection&&n.getSelection();if(a&&a.rangeCount!==0){n=a.anchorNode;var r=a.anchorOffset,l=a.focusNode;a=a.focusOffset;try{n.nodeType,l.nodeType}catch{n=null;break e}var i=0,o=-1,c=-1,d=0,f=0,h=e,m=null;t:for(;;){for(var x;h!==n||r!==0&&h.nodeType!==3||(o=i+r),h!==l||a!==0&&h.nodeType!==3||(c=i+a),h.nodeType===3&&(i+=h.nodeValue.length),(x=h.firstChild)!==null;)m=h,h=x;for(;;){if(h===e)break t;if(m===n&&++d===r&&(o=i),m===l&&++f===a&&(c=i),(x=h.nextSibling)!==null)break;h=m,m=h.parentNode}h=x}n=o===-1||c===-1?null:{start:o,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Hh={focusedElem:e,selectionRange:n},pu=!1,zt=t;zt!==null;)if(t=zt,e=t.child,(t.subtreeFlags&1024)!==0&&e!==null)e.return=t,zt=e;else for(;zt!==null;){switch(t=zt,l=t.alternate,e=t.flags,t.tag){case 0:break;case 11:case 15:break;case 1:if(e&1024&&l!==null){e=void 0,n=t,r=l.memoizedProps,l=l.memoizedState,a=n.stateNode;try{var b=or(n.type,r,n.elementType===n.type);e=a.getSnapshotBeforeUpdate(b,l),a.__reactInternalSnapshotBeforeUpdate=e}catch(v){tt(n,n.return,v)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Ph(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Ph(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(Z(163))}if(e=t.sibling,e!==null){e.return=t.return,zt=e;break}zt=t.return}}function Bb(e,t,n){var a=n.flags;switch(n.tag){case 0:case 11:case 15:ra(e,n),a&4&&bo(5,n);break;case 1:if(ra(e,n),a&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(i){tt(n,n.return,i)}else{var r=or(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(i){tt(n,n.return,i)}}a&64&&Ob(n),a&512&&Ri(n,n.return);break;case 3:if(ra(e,n),a&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Hj(e,t)}catch(i){tt(n,n.return,i)}}break;case 27:t===null&&a&4&&Ub(n);case 26:case 5:ra(e,n),t===null&&a&4&&zb(n),a&512&&Ri(n,n.return);break;case 12:ra(e,n);break;case 13:ra(e,n),a&4&&Pb(e,n),a&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=lC.bind(null,n),NC(e,n))));break;case 22:if(a=n.memoizedState!==null||Ls,!a){t=t!==null&&t.memoizedState!==null||wt,r=Ls;var l=wt;Ls=a,(wt=t)&&!l?ca(e,n,(n.subtreeFlags&8772)!==0):ra(e,n),Ls=r,wt=l}break;case 30:break;default:ra(e,n)}}function Hb(e){var t=e.alternate;t!==null&&(e.alternate=null,Hb(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Om(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var it=null,an=!1;function Ms(e,t,n){for(n=n.child;n!==null;)Ib(e,t,n),n=n.sibling}function Ib(e,t,n){if(Nn&&typeof Nn.onCommitFiberUnmount=="function")try{Nn.onCommitFiberUnmount(co,n)}catch{}switch(n.tag){case 26:wt||ms(n,t),Ms(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:wt||ms(n,t);var a=it,r=an;Ba(n.type)&&(it=n.stateNode,an=!1),Ms(e,t,n),Mi(n.stateNode),it=a,an=r;break;case 5:wt||ms(n,t);case 6:if(a=it,r=an,it=null,Ms(e,t,n),it=a,an=r,it!==null)if(an)try{(it.nodeType===9?it.body:it.nodeName==="HTML"?it.ownerDocument.body:it).removeChild(n.stateNode)}catch(l){tt(n,t,l)}else try{it.removeChild(n.stateNode)}catch(l){tt(n,t,l)}break;case 18:it!==null&&(an?(e=it,sv(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Xi(e)):sv(it,n.stateNode));break;case 4:a=it,r=an,it=n.stateNode.containerInfo,an=!0,Ms(e,t,n),it=a,an=r;break;case 0:case 11:case 14:case 15:wt||$a(2,n,t),wt||$a(4,n,t),Ms(e,t,n);break;case 1:wt||(ms(n,t),a=n.stateNode,typeof a.componentWillUnmount=="function"&&Db(n,t,a)),Ms(e,t,n);break;case 21:Ms(e,t,n);break;case 22:wt=(a=wt)||n.memoizedState!==null,Ms(e,t,n),wt=a;break;default:Ms(e,t,n)}}function Pb(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Xi(e)}catch(n){tt(t,t.return,n)}}function Z2(e){switch(e.tag){case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Vg),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Vg),t;default:throw Error(Z(435,e.tag))}}function gf(e,t){var n=Z2(e);t.forEach(function(a){var r=iC.bind(null,e,a);n.has(a)||(n.add(a),a.then(r,r))})}function vn(e,t){var n=t.deletions;if(n!==null)for(var a=0;a<n.length;a++){var r=n[a],l=e,i=t,o=i;e:for(;o!==null;){switch(o.tag){case 27:if(Ba(o.type)){it=o.stateNode,an=!1;break e}break;case 5:it=o.stateNode,an=!1;break e;case 3:case 4:it=o.stateNode.containerInfo,an=!0;break e}o=o.return}if(it===null)throw Error(Z(160));Ib(l,i,r),it=null,an=!1,l=r.alternate,l!==null&&(l.return=null),r.return=null}if(t.subtreeFlags&13878)for(t=t.child;t!==null;)qb(t,e),t=t.sibling}var Kn=null;function qb(e,t){var n=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:vn(t,e),yn(e),a&4&&($a(3,e,e.return),bo(3,e),$a(5,e,e.return));break;case 1:vn(t,e),yn(e),a&512&&(wt||n===null||ms(n,n.return)),a&64&&Ls&&(e=e.updateQueue,e!==null&&(a=e.callbacks,a!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?a:n.concat(a))));break;case 26:var r=Kn;if(vn(t,e),yn(e),a&512&&(wt||n===null||ms(n,n.return)),a&4){var l=n!==null?n.memoizedState:null;if(a=e.memoizedState,n===null)if(a===null)if(e.stateNode===null){e:{a=e.type,n=e.memoizedProps,r=r.ownerDocument||r;t:switch(a){case"title":l=r.getElementsByTagName("title")[0],(!l||l[ho]||l[qt]||l.namespaceURI==="http://www.w3.org/2000/svg"||l.hasAttribute("itemprop"))&&(l=r.createElement(a),r.head.insertBefore(l,r.querySelector("head > title"))),Pt(l,a,n),l[qt]=e,Lt(l),a=l;break e;case"link":var i=ov("link","href",r).get(a+(n.href||""));if(i){for(var o=0;o<i.length;o++)if(l=i[o],l.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&l.getAttribute("rel")===(n.rel==null?null:n.rel)&&l.getAttribute("title")===(n.title==null?null:n.title)&&l.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){i.splice(o,1);break t}}l=r.createElement(a),Pt(l,a,n),r.head.appendChild(l);break;case"meta":if(i=ov("meta","content",r).get(a+(n.content||""))){for(o=0;o<i.length;o++)if(l=i[o],l.getAttribute("content")===(n.content==null?null:""+n.content)&&l.getAttribute("name")===(n.name==null?null:n.name)&&l.getAttribute("property")===(n.property==null?null:n.property)&&l.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&l.getAttribute("charset")===(n.charSet==null?null:n.charSet)){i.splice(o,1);break t}}l=r.createElement(a),Pt(l,a,n),r.head.appendChild(l);break;default:throw Error(Z(468,a))}l[qt]=e,Lt(l),a=l}e.stateNode=a}else cv(r,e.type,e.stateNode);else e.stateNode=iv(r,a,e.memoizedProps);else l!==a?(l===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):l.count--,a===null?cv(r,e.type,e.stateNode):iv(r,a,e.memoizedProps)):a===null&&e.stateNode!==null&&mf(e,e.memoizedProps,n.memoizedProps)}break;case 27:vn(t,e),yn(e),a&512&&(wt||n===null||ms(n,n.return)),n!==null&&a&4&&mf(e,e.memoizedProps,n.memoizedProps);break;case 5:if(vn(t,e),yn(e),a&512&&(wt||n===null||ms(n,n.return)),e.flags&32){r=e.stateNode;try{hl(r,"")}catch(x){tt(e,e.return,x)}}a&4&&e.stateNode!=null&&(r=e.memoizedProps,mf(e,r,n!==null?n.memoizedProps:r)),a&1024&&(xf=!0);break;case 6:if(vn(t,e),yn(e),a&4){if(e.stateNode===null)throw Error(Z(162));a=e.memoizedProps,n=e.stateNode;try{n.nodeValue=a}catch(x){tt(e,e.return,x)}}break;case 3:if(Ec=null,r=Kn,Kn=fu(t.containerInfo),vn(t,e),Kn=r,yn(e),a&4&&n!==null&&n.memoizedState.isDehydrated)try{Xi(t.containerInfo)}catch(x){tt(e,e.return,x)}xf&&(xf=!1,Gb(e));break;case 4:a=Kn,Kn=fu(e.stateNode.containerInfo),vn(t,e),yn(e),Kn=a;break;case 12:vn(t,e),yn(e);break;case 13:vn(t,e),yn(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(hp=vs()),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,gf(e,a)));break;case 22:r=e.memoizedState!==null;var c=n!==null&&n.memoizedState!==null,d=Ls,f=wt;if(Ls=d||r,wt=f||c,vn(t,e),wt=f,Ls=d,yn(e),a&8192)e:for(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,r&&(n===null||c||Ls||wt||Xa(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){c=n=t;try{if(l=c.stateNode,r)i=l.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none";else{o=c.stateNode;var h=c.memoizedProps.style,m=h!=null&&h.hasOwnProperty("display")?h.display:null;o.style.display=m==null||typeof m=="boolean"?"":(""+m).trim()}}catch(x){tt(c,c.return,x)}}}else if(t.tag===6){if(n===null){c=t;try{c.stateNode.nodeValue=r?"":c.memoizedProps}catch(x){tt(c,c.return,x)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}a&4&&(a=e.updateQueue,a!==null&&(n=a.retryQueue,n!==null&&(a.retryQueue=null,gf(e,n))));break;case 19:vn(t,e),yn(e),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,gf(e,a)));break;case 30:break;case 21:break;default:vn(t,e),yn(e)}}function yn(e){var t=e.flags;if(t&2){try{for(var n,a=e.return;a!==null;){if(Lb(a)){n=a;break}a=a.return}if(n==null)throw Error(Z(160));switch(n.tag){case 27:var r=n.stateNode,l=pf(e);ru(e,l,r);break;case 5:var i=n.stateNode;n.flags&32&&(hl(i,""),n.flags&=-33);var o=pf(e);ru(e,o,i);break;case 3:case 4:var c=n.stateNode.containerInfo,d=pf(e);Ah(e,d,c);break;default:throw Error(Z(161))}}catch(f){tt(e,e.return,f)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Gb(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Gb(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ra(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Bb(e,t.alternate,t),t=t.sibling}function Xa(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:$a(4,t,t.return),Xa(t);break;case 1:ms(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&Db(t,t.return,n),Xa(t);break;case 27:Mi(t.stateNode);case 26:case 5:ms(t,t.return),Xa(t);break;case 22:t.memoizedState===null&&Xa(t);break;case 30:Xa(t);break;default:Xa(t)}e=e.sibling}}function ca(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var a=t.alternate,r=e,l=t,i=l.flags;switch(l.tag){case 0:case 11:case 15:ca(r,l,n),bo(4,l);break;case 1:if(ca(r,l,n),a=l,r=a.stateNode,typeof r.componentDidMount=="function")try{r.componentDidMount()}catch(d){tt(a,a.return,d)}if(a=l,r=a.updateQueue,r!==null){var o=a.stateNode;try{var c=r.shared.hiddenCallbacks;if(c!==null)for(r.shared.hiddenCallbacks=null,r=0;r<c.length;r++)Bj(c[r],o)}catch(d){tt(a,a.return,d)}}n&&i&64&&Ob(l),Ri(l,l.return);break;case 27:Ub(l);case 26:case 5:ca(r,l,n),n&&a===null&&i&4&&zb(l),Ri(l,l.return);break;case 12:ca(r,l,n);break;case 13:ca(r,l,n),n&&i&4&&Pb(r,l);break;case 22:l.memoizedState===null&&ca(r,l,n),Ri(l,l.return);break;case 30:break;default:ca(r,l,n)}t=t.sibling}}function cp(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&go(n))}function up(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&go(e))}function us(e,t,n,a){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Vb(e,t,n,a),t=t.sibling}function Vb(e,t,n,a){var r=t.flags;switch(t.tag){case 0:case 11:case 15:us(e,t,n,a),r&2048&&bo(9,t);break;case 1:us(e,t,n,a);break;case 3:us(e,t,n,a),r&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&go(e)));break;case 12:if(r&2048){us(e,t,n,a),e=t.stateNode;try{var l=t.memoizedProps,i=l.id,o=l.onPostCommit;typeof o=="function"&&o(i,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(c){tt(t,t.return,c)}}else us(e,t,n,a);break;case 13:us(e,t,n,a);break;case 23:break;case 22:l=t.stateNode,i=t.alternate,t.memoizedState!==null?l._visibility&2?us(e,t,n,a):Ti(e,t):l._visibility&2?us(e,t,n,a):(l._visibility|=2,zr(e,t,n,a,(t.subtreeFlags&10256)!==0)),r&2048&&cp(i,t);break;case 24:us(e,t,n,a),r&2048&&up(t.alternate,t);break;default:us(e,t,n,a)}}function zr(e,t,n,a,r){for(r=r&&(t.subtreeFlags&10256)!==0,t=t.child;t!==null;){var l=e,i=t,o=n,c=a,d=i.flags;switch(i.tag){case 0:case 11:case 15:zr(l,i,o,c,r),bo(8,i);break;case 23:break;case 22:var f=i.stateNode;i.memoizedState!==null?f._visibility&2?zr(l,i,o,c,r):Ti(l,i):(f._visibility|=2,zr(l,i,o,c,r)),r&&d&2048&&cp(i.alternate,i);break;case 24:zr(l,i,o,c,r),r&&d&2048&&up(i.alternate,i);break;default:zr(l,i,o,c,r)}t=t.sibling}}function Ti(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,a=t,r=a.flags;switch(a.tag){case 22:Ti(n,a),r&2048&&cp(a.alternate,a);break;case 24:Ti(n,a),r&2048&&up(a.alternate,a);break;default:Ti(n,a)}t=t.sibling}}var ui=8192;function Nr(e){if(e.subtreeFlags&ui)for(e=e.child;e!==null;)Yb(e),e=e.sibling}function Yb(e){switch(e.tag){case 26:Nr(e),e.flags&ui&&e.memoizedState!==null&&LC(Kn,e.memoizedState,e.memoizedProps);break;case 5:Nr(e);break;case 3:case 4:var t=Kn;Kn=fu(e.stateNode.containerInfo),Nr(e),Kn=t;break;case 22:e.memoizedState===null&&(t=e.alternate,t!==null&&t.memoizedState!==null?(t=ui,ui=16777216,Nr(e),ui=t):Nr(e));break;default:Nr(e)}}function Fb(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function ti(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var a=t[n];zt=a,Xb(a,e)}Fb(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Kb(e),e=e.sibling}function Kb(e){switch(e.tag){case 0:case 11:case 15:ti(e),e.flags&2048&&$a(9,e,e.return);break;case 3:ti(e);break;case 12:ti(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Rc(e)):ti(e);break;default:ti(e)}}function Rc(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var a=t[n];zt=a,Xb(a,e)}Fb(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:$a(8,t,t.return),Rc(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Rc(t));break;default:Rc(t)}e=e.sibling}}function Xb(e,t){for(;zt!==null;){var n=zt;switch(n.tag){case 0:case 11:case 15:$a(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var a=n.memoizedState.cachePool.pool;a!=null&&a.refCount++}break;case 24:go(n.memoizedState.cache)}if(a=n.child,a!==null)a.return=n,zt=a;else e:for(n=e;zt!==null;){a=zt;var r=a.sibling,l=a.return;if(Hb(a),a===n){zt=null;break e}if(r!==null){r.return=l,zt=r;break e}zt=l}}}var J2={getCacheForType:function(e){var t=Gt(Mt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n}},eC=typeof WeakMap=="function"?WeakMap:Map,Qe=0,nt=null,Le=null,Ie=0,Xe=0,bn=null,ya=!1,Al=!1,dp=!1,Ks=0,xt=0,Oa=0,nr=0,fp=0,Bn=0,vl=0,Ei=null,rn=null,Mh=!1,hp=0,lu=1/0,iu=null,Sa=null,It=0,Ca=null,yl=null,al=0,$h=0,Oh=null,Qb=null,Ai=0,Dh=null;function Sn(){if(Qe&2&&Ie!==0)return Ie&-Ie;if(Ce.T!==null){var e=ml;return e!==0?e:pp()}return ij()}function Wb(){Bn===0&&(Bn=!(Ie&536870912)||Ge?sj():536870912);var e=Gn.current;return e!==null&&(e.flags|=32),Bn}function Cn(e,t,n){(e===nt&&(Xe===2||Xe===9)||e.cancelPendingCommit!==null)&&(jl(e,0),ja(e,Ie,Bn,!1)),fo(e,n),(!(Qe&2)||e!==nt)&&(e===nt&&(!(Qe&2)&&(nr|=n),xt===4&&ja(e,Ie,Bn,!1)),Ss(e))}function Zb(e,t,n){if(Qe&6)throw Error(Z(327));var a=!n&&(t&124)===0&&(t&e.expiredLanes)===0||uo(e,t),r=a?sC(e,t):vf(e,t,!0),l=a;do{if(r===0){Al&&!a&&ja(e,t,0,!1);break}else{if(n=e.current.alternate,l&&!tC(n)){r=vf(e,t,!1),l=!1;continue}if(r===2){if(l=t,e.errorRecoveryDisabledLanes&l)var i=0;else i=e.pendingLanes&-536870913,i=i!==0?i:i&536870912?536870912:0;if(i!==0){t=i;e:{var o=e;r=Ei;var c=o.current.memoizedState.isDehydrated;if(c&&(jl(o,i).flags|=256),i=vf(o,i,!1),i!==2){if(dp&&!c){o.errorRecoveryDisabledLanes|=l,nr|=l,r=4;break e}l=rn,rn=r,l!==null&&(rn===null?rn=l:rn.push.apply(rn,l))}r=i}if(l=!1,r!==2)continue}}if(r===1){jl(e,0),ja(e,t,0,!0);break}e:{switch(a=e,l=r,l){case 0:case 1:throw Error(Z(345));case 4:if((t&4194048)!==t)break;case 6:ja(a,t,Bn,!ya);break e;case 2:rn=null;break;case 3:case 5:break;default:throw Error(Z(329))}if((t&62914560)===t&&(r=hp+300-vs(),10<r)){if(ja(a,t,Bn,!ya),Iu(a,0,!0)!==0)break e;a.timeoutHandle=g0(Yg.bind(null,a,n,rn,iu,Mh,t,Bn,nr,vl,ya,l,2,-0,0),r);break e}Yg(a,n,rn,iu,Mh,t,Bn,nr,vl,ya,l,0,-0,0)}}break}while(!0);Ss(e)}function Yg(e,t,n,a,r,l,i,o,c,d,f,h,m,x){if(e.timeoutHandle=-1,h=t.subtreeFlags,(h&8192||(h&16785408)===16785408)&&(Vi={stylesheets:null,count:0,unsuspend:zC},Yb(t),h=UC(),h!==null)){e.cancelPendingCommit=h(Kg.bind(null,e,t,l,n,a,r,i,o,c,f,1,m,x)),ja(e,l,i,!d);return}Kg(e,t,l,n,a,r,i,o,c)}function tC(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var a=0;a<n.length;a++){var r=n[a],l=r.getSnapshot;r=r.value;try{if(!Tn(l(),r))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 ja(e,t,n,a){t&=~fp,t&=~nr,e.suspendedLanes|=t,e.pingedLanes&=~t,a&&(e.warmLanes|=t),a=e.expirationTimes;for(var r=t;0<r;){var l=31-kn(r),i=1<<l;a[l]=-1,r&=~i}n!==0&&rj(e,n,t)}function Wu(){return Qe&6?!0:(wo(0),!1)}function mp(){if(Le!==null){if(Xe===0)var e=Le.return;else e=Le,Is=vr=null,ep(e),sl=null,Pi=0,e=Le;for(;e!==null;)$b(e.alternate,e),e=e.return;Le=null}}function jl(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,yC(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),mp(),nt=e,Le=n=qs(e.current,null),Ie=t,Xe=0,bn=null,ya=!1,Al=uo(e,t),dp=!1,vl=Bn=fp=nr=Oa=xt=0,rn=Ei=null,Mh=!1,t&8&&(t|=t&32);var a=e.entangledLanes;if(a!==0)for(e=e.entanglements,a&=t;0<a;){var r=31-kn(a),l=1<<r;t|=e[r],a&=~l}return Ks=t,Vu(),n}function Jb(e,t){Oe=null,Ce.H=eu,t===vo||t===Fu?(t=Ng(),Xe=3):t===Lj?(t=Ng(),Xe=4):Xe=t===Cb?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,bn=t,Le===null&&(xt=1,su(e,Un(t,e.current)))}function e0(){var e=Ce.H;return Ce.H=eu,e===null?eu:e}function t0(){var e=Ce.A;return Ce.A=J2,e}function zh(){xt=4,ya||(Ie&4194048)!==Ie&&Gn.current!==null||(Al=!0),!(Oa&134217727)&&!(nr&134217727)||nt===null||ja(nt,Ie,Bn,!1)}function vf(e,t,n){var a=Qe;Qe|=2;var r=e0(),l=t0();(nt!==e||Ie!==t)&&(iu=null,jl(e,t)),t=!1;var i=xt;e:do try{if(Xe!==0&&Le!==null){var o=Le,c=bn;switch(Xe){case 8:mp(),i=6;break e;case 3:case 2:case 9:case 6:Gn.current===null&&(t=!0);var d=Xe;if(Xe=0,bn=null,Xr(e,o,c,d),n&&Al){i=0;break e}break;default:d=Xe,Xe=0,bn=null,Xr(e,o,c,d)}}nC(),i=xt;break}catch(f){Jb(e,f)}while(!0);return t&&e.shellSuspendCounter++,Is=vr=null,Qe=a,Ce.H=r,Ce.A=l,Le===null&&(nt=null,Ie=0,Vu()),i}function nC(){for(;Le!==null;)n0(Le)}function sC(e,t){var n=Qe;Qe|=2;var a=e0(),r=t0();nt!==e||Ie!==t?(iu=null,lu=vs()+500,jl(e,t)):Al=uo(e,t);e:do try{if(Xe!==0&&Le!==null){t=Le;var l=bn;t:switch(Xe){case 1:Xe=0,bn=null,Xr(e,t,l,1);break;case 2:case 9:if(_g(l)){Xe=0,bn=null,Fg(t);break}t=function(){Xe!==2&&Xe!==9||nt!==e||(Xe=7),Ss(e)},l.then(t,t);break e;case 3:Xe=7;break e;case 4:Xe=5;break e;case 7:_g(l)?(Xe=0,bn=null,Fg(t)):(Xe=0,bn=null,Xr(e,t,l,7));break;case 5:var i=null;switch(Le.tag){case 26:i=Le.memoizedState;case 5:case 27:var o=Le;if(!i||b0(i)){Xe=0,bn=null;var c=o.sibling;if(c!==null)Le=c;else{var d=o.return;d!==null?(Le=d,Zu(d)):Le=null}break t}}Xe=0,bn=null,Xr(e,t,l,5);break;case 6:Xe=0,bn=null,Xr(e,t,l,6);break;case 8:mp(),xt=6;break e;default:throw Error(Z(462))}}aC();break}catch(f){Jb(e,f)}while(!0);return Is=vr=null,Ce.H=a,Ce.A=r,Qe=n,Le!==null?0:(nt=null,Ie=0,Vu(),xt)}function aC(){for(;Le!==null&&!SS();)n0(Le)}function n0(e){var t=Mb(e.alternate,e,Ks);e.memoizedProps=e.pendingProps,t===null?Zu(e):Le=t}function Fg(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Hg(n,t,t.pendingProps,t.type,void 0,Ie);break;case 11:t=Hg(n,t,t.pendingProps,t.type.render,t.ref,Ie);break;case 5:ep(t);default:$b(n,t),t=Le=$j(t,Ks),t=Mb(n,t,Ks)}e.memoizedProps=e.pendingProps,t===null?Zu(e):Le=t}function Xr(e,t,n,a){Is=vr=null,ep(t),sl=null,Pi=0;var r=t.return;try{if(F2(e,r,t,n,Ie)){xt=1,su(e,Un(n,e.current)),Le=null;return}}catch(l){if(r!==null)throw Le=r,l;xt=1,su(e,Un(n,e.current)),Le=null;return}t.flags&32768?(Ge||a===1?e=!0:Al||Ie&536870912?e=!1:(ya=e=!0,(a===2||a===9||a===3||a===6)&&(a=Gn.current,a!==null&&a.tag===13&&(a.flags|=16384))),s0(t,e)):Zu(t)}function Zu(e){var t=e;do{if(t.flags&32768){s0(t,ya);return}e=t.return;var n=X2(t.alternate,t,Ks);if(n!==null){Le=n;return}if(t=t.sibling,t!==null){Le=t;return}Le=t=e}while(t!==null);xt===0&&(xt=5)}function s0(e,t){do{var n=Q2(e.alternate,e);if(n!==null){n.flags&=32767,Le=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Le=e;return}Le=e=n}while(e!==null);xt=6,Le=null}function Kg(e,t,n,a,r,l,i,o,c){e.cancelPendingCommit=null;do Ju();while(It!==0);if(Qe&6)throw Error(Z(327));if(t!==null){if(t===e.current)throw Error(Z(177));if(l=t.lanes|t.childLanes,l|=Im,zS(e,n,l,i,o,c),e===nt&&(Le=nt=null,Ie=0),yl=t,Ca=e,al=n,$h=l,Oh=r,Qb=a,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,oC(Gc,function(){return o0(),null})):(e.callbackNode=null,e.callbackPriority=0),a=(t.flags&13878)!==0,t.subtreeFlags&13878||a){a=Ce.T,Ce.T=null,r=Ve.p,Ve.p=2,i=Qe,Qe|=4;try{W2(e,t,n)}finally{Qe=i,Ve.p=r,Ce.T=a}}It=1,a0(),r0(),l0()}}function a0(){if(It===1){It=0;var e=Ca,t=yl,n=(t.flags&13878)!==0;if(t.subtreeFlags&13878||n){n=Ce.T,Ce.T=null;var a=Ve.p;Ve.p=2;var r=Qe;Qe|=4;try{qb(t,e);var l=Hh,i=kj(e.containerInfo),o=l.focusedElem,c=l.selectionRange;if(i!==o&&o&&o.ownerDocument&&Nj(o.ownerDocument.documentElement,o)){if(c!==null&&Hm(o)){var d=c.start,f=c.end;if(f===void 0&&(f=d),"selectionStart"in o)o.selectionStart=d,o.selectionEnd=Math.min(f,o.value.length);else{var h=o.ownerDocument||document,m=h&&h.defaultView||window;if(m.getSelection){var x=m.getSelection(),b=o.textContent.length,v=Math.min(c.start,b),y=c.end===void 0?v:Math.min(c.end,b);!x.extend&&v>y&&(i=y,y=v,v=i);var g=pg(o,v),p=pg(o,y);if(g&&p&&(x.rangeCount!==1||x.anchorNode!==g.node||x.anchorOffset!==g.offset||x.focusNode!==p.node||x.focusOffset!==p.offset)){var j=h.createRange();j.setStart(g.node,g.offset),x.removeAllRanges(),v>y?(x.addRange(j),x.extend(p.node,p.offset)):(j.setEnd(p.node,p.offset),x.addRange(j))}}}}for(h=[],x=o;x=x.parentNode;)x.nodeType===1&&h.push({element:x,left:x.scrollLeft,top:x.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o<h.length;o++){var w=h[o];w.element.scrollLeft=w.left,w.element.scrollTop=w.top}}pu=!!Bh,Hh=Bh=null}finally{Qe=r,Ve.p=a,Ce.T=n}}e.current=t,It=2}}function r0(){if(It===2){It=0;var e=Ca,t=yl,n=(t.flags&8772)!==0;if(t.subtreeFlags&8772||n){n=Ce.T,Ce.T=null;var a=Ve.p;Ve.p=2;var r=Qe;Qe|=4;try{Bb(e,t.alternate,t)}finally{Qe=r,Ve.p=a,Ce.T=n}}It=3}}function l0(){if(It===4||It===3){It=0,CS();var e=Ca,t=yl,n=al,a=Qb;t.subtreeFlags&10256||t.flags&10256?It=5:(It=0,yl=Ca=null,i0(e,e.pendingLanes));var r=e.pendingLanes;if(r===0&&(Sa=null),$m(n),t=t.stateNode,Nn&&typeof Nn.onCommitFiberRoot=="function")try{Nn.onCommitFiberRoot(co,t,void 0,(t.current.flags&128)===128)}catch{}if(a!==null){t=Ce.T,r=Ve.p,Ve.p=2,Ce.T=null;try{for(var l=e.onRecoverableError,i=0;i<a.length;i++){var o=a[i];l(o.value,{componentStack:o.stack})}}finally{Ce.T=t,Ve.p=r}}al&3&&Ju(),Ss(e),r=e.pendingLanes,n&4194090&&r&42?e===Dh?Ai++:(Ai=0,Dh=e):Ai=0,wo(0)}}function i0(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,go(t)))}function Ju(e){return a0(),r0(),l0(),o0()}function o0(){if(It!==5)return!1;var e=Ca,t=$h;$h=0;var n=$m(al),a=Ce.T,r=Ve.p;try{Ve.p=32>n?32:n,Ce.T=null,n=Oh,Oh=null;var l=Ca,i=al;if(It=0,yl=Ca=null,al=0,Qe&6)throw Error(Z(331));var o=Qe;if(Qe|=4,Kb(l.current),Vb(l,l.current,i,n),Qe=o,wo(0,!1),Nn&&typeof Nn.onPostCommitFiberRoot=="function")try{Nn.onPostCommitFiberRoot(co,l)}catch{}return!0}finally{Ve.p=r,Ce.T=a,i0(e,t)}}function Xg(e,t,n){t=Un(n,t),t=Rh(e.stateNode,t,2),e=ka(e,t,2),e!==null&&(fo(e,2),Ss(e))}function tt(e,t,n){if(e.tag===3)Xg(e,e,n);else for(;t!==null;){if(t.tag===3){Xg(t,e,n);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(Sa===null||!Sa.has(a))){e=Un(n,e),n=kb(2),a=ka(t,n,2),a!==null&&(Sb(n,a,t,e),fo(a,2),Ss(a));break}}t=t.return}}function yf(e,t,n){var a=e.pingCache;if(a===null){a=e.pingCache=new eC;var r=new Set;a.set(t,r)}else r=a.get(t),r===void 0&&(r=new Set,a.set(t,r));r.has(n)||(dp=!0,r.add(n),e=rC.bind(null,e,t,n),t.then(e,e))}function rC(e,t,n){var a=e.pingCache;a!==null&&a.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,nt===e&&(Ie&n)===n&&(xt===4||xt===3&&(Ie&62914560)===Ie&&300>vs()-hp?!(Qe&2)&&jl(e,0):fp|=n,vl===Ie&&(vl=0)),Ss(e)}function c0(e,t){t===0&&(t=aj()),e=El(e,t),e!==null&&(fo(e,t),Ss(e))}function lC(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),c0(e,n)}function iC(e,t){var n=0;switch(e.tag){case 13:var a=e.stateNode,r=e.memoizedState;r!==null&&(n=r.retryLane);break;case 19:a=e.stateNode;break;case 22:a=e.stateNode._retryCache;break;default:throw Error(Z(314))}a!==null&&a.delete(t),c0(e,n)}function oC(e,t){return Am(e,t)}var ou=null,Lr=null,Lh=!1,cu=!1,jf=!1,sr=0;function Ss(e){e!==Lr&&e.next===null&&(Lr===null?ou=Lr=e:Lr=Lr.next=e),cu=!0,Lh||(Lh=!0,uC())}function wo(e,t){if(!jf&&cu){jf=!0;do for(var n=!1,a=ou;a!==null;){if(e!==0){var r=a.pendingLanes;if(r===0)var l=0;else{var i=a.suspendedLanes,o=a.pingedLanes;l=(1<<31-kn(42|e)+1)-1,l&=r&~(i&~o),l=l&201326741?l&201326741|1:l?l|2:0}l!==0&&(n=!0,Qg(a,l))}else l=Ie,l=Iu(a,a===nt?l:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),!(l&3)||uo(a,l)||(n=!0,Qg(a,l));a=a.next}while(n);jf=!1}}function cC(){u0()}function u0(){cu=Lh=!1;var e=0;sr!==0&&(vC()&&(e=sr),sr=0);for(var t=vs(),n=null,a=ou;a!==null;){var r=a.next,l=d0(a,t);l===0?(a.next=null,n===null?ou=r:n.next=r,r===null&&(Lr=n)):(n=a,(e!==0||l&3)&&(cu=!0)),a=r}wo(e)}function d0(e,t){for(var n=e.suspendedLanes,a=e.pingedLanes,r=e.expirationTimes,l=e.pendingLanes&-62914561;0<l;){var i=31-kn(l),o=1<<i,c=r[i];c===-1?(!(o&n)||o&a)&&(r[i]=DS(o,t)):c<=t&&(e.expiredLanes|=o),l&=~o}if(t=nt,n=Ie,n=Iu(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a=e.callbackNode,n===0||e===t&&(Xe===2||Xe===9)||e.cancelPendingCommit!==null)return a!==null&&a!==null&&Vd(a),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||uo(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(a!==null&&Vd(a),$m(n)){case 2:case 8:n=tj;break;case 32:n=Gc;break;case 268435456:n=nj;break;default:n=Gc}return a=f0.bind(null,e),n=Am(n,a),e.callbackPriority=t,e.callbackNode=n,t}return a!==null&&a!==null&&Vd(a),e.callbackPriority=2,e.callbackNode=null,2}function f0(e,t){if(It!==0&&It!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Ju()&&e.callbackNode!==n)return null;var a=Ie;return a=Iu(e,e===nt?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a===0?null:(Zb(e,a,t),d0(e,vs()),e.callbackNode!=null&&e.callbackNode===n?f0.bind(null,e):null)}function Qg(e,t){if(Ju())return null;Zb(e,t,!0)}function uC(){jC(function(){Qe&6?Am(ej,cC):u0()})}function pp(){return sr===0&&(sr=sj()),sr}function Wg(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:jc(""+e)}function Zg(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function dC(e,t,n,a,r){if(t==="submit"&&n&&n.stateNode===r){var l=Wg((r[on]||null).action),i=a.submitter;i&&(t=(t=i[on]||null)?Wg(t.formAction):i.getAttribute("formAction"),t!==null&&(l=t,i=null));var o=new Pu("action","action",null,a,r);e.push({event:o,listeners:[{instance:null,listener:function(){if(a.defaultPrevented){if(sr!==0){var c=i?Zg(r,i):new FormData(r);Sh(n,{pending:!0,data:c,method:r.method,action:l},null,c)}}else typeof l=="function"&&(o.preventDefault(),c=i?Zg(r,i):new FormData(r),Sh(n,{pending:!0,data:c,method:r.method,action:l},l,c))},currentTarget:r}]})}}for(var bf=0;bf<mh.length;bf++){var wf=mh[bf],fC=wf.toLowerCase(),hC=wf[0].toUpperCase()+wf.slice(1);rs(fC,"on"+hC)}rs(Cj,"onAnimationEnd");rs(Rj,"onAnimationIteration");rs(Tj,"onAnimationStart");rs("dblclick","onDoubleClick");rs("focusin","onFocus");rs("focusout","onBlur");rs(E2,"onTransitionRun");rs(A2,"onTransitionStart");rs(M2,"onTransitionCancel");rs(Ej,"onTransitionEnd");fl("onMouseEnter",["mouseout","mouseover"]);fl("onMouseLeave",["mouseout","mouseover"]);fl("onPointerEnter",["pointerout","pointerover"]);fl("onPointerLeave",["pointerout","pointerover"]);pr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));pr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));pr("onBeforeInput",["compositionend","keypress","textInput","paste"]);pr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));pr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));pr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var qi="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(" "),mC=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(qi));function h0(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var a=e[n],r=a.event;a=a.listeners;e:{var l=void 0;if(t)for(var i=a.length-1;0<=i;i--){var o=a[i],c=o.instance,d=o.currentTarget;if(o=o.listener,c!==l&&r.isPropagationStopped())break e;l=o,r.currentTarget=d;try{l(r)}catch(f){nu(f)}r.currentTarget=null,l=c}else for(i=0;i<a.length;i++){if(o=a[i],c=o.instance,d=o.currentTarget,o=o.listener,c!==l&&r.isPropagationStopped())break e;l=o,r.currentTarget=d;try{l(r)}catch(f){nu(f)}r.currentTarget=null,l=c}}}}function ze(e,t){var n=t[ih];n===void 0&&(n=t[ih]=new Set);var a=e+"__bubble";n.has(a)||(m0(t,e,2,!1),n.add(a))}function _f(e,t,n){var a=0;t&&(a|=4),m0(n,e,a,t)}var Jo="_reactListening"+Math.random().toString(36).slice(2);function xp(e){if(!e[Jo]){e[Jo]=!0,oj.forEach(function(n){n!=="selectionchange"&&(mC.has(n)||_f(n,!1,e),_f(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Jo]||(t[Jo]=!0,_f("selectionchange",!1,t))}}function m0(e,t,n,a){switch(S0(t)){case 2:var r=IC;break;case 8:r=PC;break;default:r=jp}n=r.bind(null,t,n,e),r=void 0,!dh||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(r=!0),a?r!==void 0?e.addEventListener(t,n,{capture:!0,passive:r}):e.addEventListener(t,n,!0):r!==void 0?e.addEventListener(t,n,{passive:r}):e.addEventListener(t,n,!1)}function Nf(e,t,n,a,r){var l=a;if(!(t&1)&&!(t&2)&&a!==null)e:for(;;){if(a===null)return;var i=a.tag;if(i===3||i===4){var o=a.stateNode.containerInfo;if(o===r)break;if(i===4)for(i=a.return;i!==null;){var c=i.tag;if((c===3||c===4)&&i.stateNode.containerInfo===r)return;i=i.return}for(;o!==null;){if(i=Hr(o),i===null)return;if(c=i.tag,c===5||c===6||c===26||c===27){a=l=i;continue e}o=o.parentNode}}a=a.return}xj(function(){var d=l,f=zm(n),h=[];e:{var m=Aj.get(e);if(m!==void 0){var x=Pu,b=e;switch(e){case"keypress":if(wc(n)===0)break e;case"keydown":case"keyup":x=o2;break;case"focusin":b="focus",x=Jd;break;case"focusout":b="blur",x=Jd;break;case"beforeblur":case"afterblur":x=Jd;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":x=rg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":x=QS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":x=d2;break;case Cj:case Rj:case Tj:x=JS;break;case Ej:x=h2;break;case"scroll":case"scrollend":x=KS;break;case"wheel":x=p2;break;case"copy":case"cut":case"paste":x=t2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":x=ig;break;case"toggle":case"beforetoggle":x=g2}var v=(t&4)!==0,y=!v&&(e==="scroll"||e==="scrollend"),g=v?m!==null?m+"Capture":null:m;v=[];for(var p=d,j;p!==null;){var w=p;if(j=w.stateNode,w=w.tag,w!==5&&w!==26&&w!==27||j===null||g===null||(w=Li(p,g),w!=null&&v.push(Gi(p,w,j))),y)break;p=p.return}0<v.length&&(m=new x(m,b,null,n,f),h.push({event:m,listeners:v}))}}if(!(t&7)){e:{if(m=e==="mouseover"||e==="pointerover",x=e==="mouseout"||e==="pointerout",m&&n!==uh&&(b=n.relatedTarget||n.fromElement)&&(Hr(b)||b[Rl]))break e;if((x||m)&&(m=f.window===f?f:(m=f.ownerDocument)?m.defaultView||m.parentWindow:window,x?(b=n.relatedTarget||n.toElement,x=d,b=b?Hr(b):null,b!==null&&(y=oo(b),v=b.tag,b!==y||v!==5&&v!==27&&v!==6)&&(b=null)):(x=null,b=d),x!==b)){if(v=rg,w="onMouseLeave",g="onMouseEnter",p="mouse",(e==="pointerout"||e==="pointerover")&&(v=ig,w="onPointerLeave",g="onPointerEnter",p="pointer"),y=x==null?m:ci(x),j=b==null?m:ci(b),m=new v(w,p+"leave",x,n,f),m.target=y,m.relatedTarget=j,w=null,Hr(f)===d&&(v=new v(g,p+"enter",b,n,f),v.target=j,v.relatedTarget=y,w=v),y=w,x&&b)t:{for(v=x,g=b,p=0,j=v;j;j=kr(j))p++;for(j=0,w=g;w;w=kr(w))j++;for(;0<p-j;)v=kr(v),p--;for(;0<j-p;)g=kr(g),j--;for(;p--;){if(v===g||g!==null&&v===g.alternate)break t;v=kr(v),g=kr(g)}v=null}else v=null;x!==null&&Jg(h,m,x,v,!1),b!==null&&y!==null&&Jg(h,y,b,v,!0)}}e:{if(m=d?ci(d):window,x=m.nodeName&&m.nodeName.toLowerCase(),x==="select"||x==="input"&&m.type==="file")var N=dg;else if(ug(m))if(wj)N=C2;else{N=k2;var C=N2}else x=m.nodeName,!x||x.toLowerCase()!=="input"||m.type!=="checkbox"&&m.type!=="radio"?d&&Dm(d.elementType)&&(N=dg):N=S2;if(N&&(N=N(e,d))){bj(h,N,n,f);break e}C&&C(e,m,d),e==="focusout"&&d&&m.type==="number"&&d.memoizedProps.value!=null&&ch(m,"number",m.value)}switch(C=d?ci(d):window,e){case"focusin":(ug(C)||C.contentEditable==="true")&&(qr=C,fh=d,bi=null);break;case"focusout":bi=fh=qr=null;break;case"mousedown":hh=!0;break;case"contextmenu":case"mouseup":case"dragend":hh=!1,xg(h,n,f);break;case"selectionchange":if(T2)break;case"keydown":case"keyup":xg(h,n,f)}var _;if(Bm)e:{switch(e){case"compositionstart":var S="onCompositionStart";break e;case"compositionend":S="onCompositionEnd";break e;case"compositionupdate":S="onCompositionUpdate";break e}S=void 0}else Pr?yj(e,n)&&(S="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(S="onCompositionStart");S&&(vj&&n.locale!=="ko"&&(Pr||S!=="onCompositionStart"?S==="onCompositionEnd"&&Pr&&(_=gj()):(va=f,Lm="value"in va?va.value:va.textContent,Pr=!0)),C=uu(d,S),0<C.length&&(S=new lg(S,e,null,n,f),h.push({event:S,listeners:C}),_?S.data=_:(_=jj(n),_!==null&&(S.data=_)))),(_=y2?j2(e,n):b2(e,n))&&(S=uu(d,"onBeforeInput"),0<S.length&&(C=new lg("onBeforeInput","beforeinput",null,n,f),h.push({event:C,listeners:S}),C.data=_)),dC(h,e,d,n,f)}h0(h,t)})}function Gi(e,t,n){return{instance:e,listener:t,currentTarget:n}}function uu(e,t){for(var n=t+"Capture",a=[];e!==null;){var r=e,l=r.stateNode;if(r=r.tag,r!==5&&r!==26&&r!==27||l===null||(r=Li(e,n),r!=null&&a.unshift(Gi(e,r,l)),r=Li(e,t),r!=null&&a.push(Gi(e,r,l))),e.tag===3)return a;e=e.return}return[]}function kr(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Jg(e,t,n,a,r){for(var l=t._reactName,i=[];n!==null&&n!==a;){var o=n,c=o.alternate,d=o.stateNode;if(o=o.tag,c!==null&&c===a)break;o!==5&&o!==26&&o!==27||d===null||(c=d,r?(d=Li(n,l),d!=null&&i.unshift(Gi(n,d,c))):r||(d=Li(n,l),d!=null&&i.push(Gi(n,d,c)))),n=n.return}i.length!==0&&e.push({event:t,listeners:i})}var pC=/\r\n?/g,xC=/\u0000|\uFFFD/g;function ev(e){return(typeof e=="string"?e:""+e).replace(pC,`
49
+ `).replace(xC,"")}function p0(e,t){return t=ev(t),ev(e)===t}function ed(){}function Je(e,t,n,a,r,l){switch(n){case"children":typeof a=="string"?t==="body"||t==="textarea"&&a===""||hl(e,a):(typeof a=="number"||typeof a=="bigint")&&t!=="body"&&hl(e,""+a);break;case"className":Yo(e,"class",a);break;case"tabIndex":Yo(e,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":Yo(e,n,a);break;case"style":pj(e,a,l);break;case"data":if(t!=="object"){Yo(e,"data",a);break}case"src":case"href":if(a===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(a==null||typeof a=="function"||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(n);break}a=jc(""+a),e.setAttribute(n,a);break;case"action":case"formAction":if(typeof a=="function"){e.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof l=="function"&&(n==="formAction"?(t!=="input"&&Je(e,t,"name",r.name,r,null),Je(e,t,"formEncType",r.formEncType,r,null),Je(e,t,"formMethod",r.formMethod,r,null),Je(e,t,"formTarget",r.formTarget,r,null)):(Je(e,t,"encType",r.encType,r,null),Je(e,t,"method",r.method,r,null),Je(e,t,"target",r.target,r,null)));if(a==null||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(n);break}a=jc(""+a),e.setAttribute(n,a);break;case"onClick":a!=null&&(e.onclick=ed);break;case"onScroll":a!=null&&ze("scroll",e);break;case"onScrollEnd":a!=null&&ze("scrollend",e);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(Z(61));if(n=a.__html,n!=null){if(r.children!=null)throw Error(Z(60));e.innerHTML=n}}break;case"multiple":e.multiple=a&&typeof a!="function"&&typeof a!="symbol";break;case"muted":e.muted=a&&typeof a!="function"&&typeof a!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(a==null||typeof a=="function"||typeof a=="boolean"||typeof a=="symbol"){e.removeAttribute("xlink:href");break}n=jc(""+a),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(n,""+a):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":a&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":a===!0?e.setAttribute(n,""):a!==!1&&a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(n,a):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":a!=null&&typeof a!="function"&&typeof a!="symbol"&&!isNaN(a)&&1<=a?e.setAttribute(n,a):e.removeAttribute(n);break;case"rowSpan":case"start":a==null||typeof a=="function"||typeof a=="symbol"||isNaN(a)?e.removeAttribute(n):e.setAttribute(n,a);break;case"popover":ze("beforetoggle",e),ze("toggle",e),yc(e,"popover",a);break;case"xlinkActuate":Es(e,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":Es(e,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":Es(e,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":Es(e,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":Es(e,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":Es(e,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":Es(e,"http://www.w3.org/XML/1998/namespace","xml:base",a);break;case"xmlLang":Es(e,"http://www.w3.org/XML/1998/namespace","xml:lang",a);break;case"xmlSpace":Es(e,"http://www.w3.org/XML/1998/namespace","xml:space",a);break;case"is":yc(e,"is",a);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=YS.get(n)||n,yc(e,n,a))}}function Uh(e,t,n,a,r,l){switch(n){case"style":pj(e,a,l);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(Z(61));if(n=a.__html,n!=null){if(r.children!=null)throw Error(Z(60));e.innerHTML=n}}break;case"children":typeof a=="string"?hl(e,a):(typeof a=="number"||typeof a=="bigint")&&hl(e,""+a);break;case"onScroll":a!=null&&ze("scroll",e);break;case"onScrollEnd":a!=null&&ze("scrollend",e);break;case"onClick":a!=null&&(e.onclick=ed);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!cj.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(r=n.endsWith("Capture"),t=n.slice(2,r?n.length-7:void 0),l=e[on]||null,l=l!=null?l[n]:null,typeof l=="function"&&e.removeEventListener(t,l,r),typeof a=="function")){typeof l!="function"&&l!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,a,r);break e}n in e?e[n]=a:a===!0?e.setAttribute(n,""):yc(e,n,a)}}}function Pt(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ze("error",e),ze("load",e);var a=!1,r=!1,l;for(l in n)if(n.hasOwnProperty(l)){var i=n[l];if(i!=null)switch(l){case"src":a=!0;break;case"srcSet":r=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(Z(137,t));default:Je(e,t,l,i,n,null)}}r&&Je(e,t,"srcSet",n.srcSet,n,null),a&&Je(e,t,"src",n.src,n,null);return;case"input":ze("invalid",e);var o=l=i=r=null,c=null,d=null;for(a in n)if(n.hasOwnProperty(a)){var f=n[a];if(f!=null)switch(a){case"name":r=f;break;case"type":i=f;break;case"checked":c=f;break;case"defaultChecked":d=f;break;case"value":l=f;break;case"defaultValue":o=f;break;case"children":case"dangerouslySetInnerHTML":if(f!=null)throw Error(Z(137,t));break;default:Je(e,t,a,f,n,null)}}fj(e,l,o,c,d,i,r,!1),Vc(e);return;case"select":ze("invalid",e),a=i=l=null;for(r in n)if(n.hasOwnProperty(r)&&(o=n[r],o!=null))switch(r){case"value":l=o;break;case"defaultValue":i=o;break;case"multiple":a=o;default:Je(e,t,r,o,n,null)}t=l,n=i,e.multiple=!!a,t!=null?Zr(e,!!a,t,!1):n!=null&&Zr(e,!!a,n,!0);return;case"textarea":ze("invalid",e),l=r=a=null;for(i in n)if(n.hasOwnProperty(i)&&(o=n[i],o!=null))switch(i){case"value":a=o;break;case"defaultValue":r=o;break;case"children":l=o;break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(Z(91));break;default:Je(e,t,i,o,n,null)}mj(e,a,r,l),Vc(e);return;case"option":for(c in n)if(n.hasOwnProperty(c)&&(a=n[c],a!=null))switch(c){case"selected":e.selected=a&&typeof a!="function"&&typeof a!="symbol";break;default:Je(e,t,c,a,n,null)}return;case"dialog":ze("beforetoggle",e),ze("toggle",e),ze("cancel",e),ze("close",e);break;case"iframe":case"object":ze("load",e);break;case"video":case"audio":for(a=0;a<qi.length;a++)ze(qi[a],e);break;case"image":ze("error",e),ze("load",e);break;case"details":ze("toggle",e);break;case"embed":case"source":case"link":ze("error",e),ze("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(d in n)if(n.hasOwnProperty(d)&&(a=n[d],a!=null))switch(d){case"children":case"dangerouslySetInnerHTML":throw Error(Z(137,t));default:Je(e,t,d,a,n,null)}return;default:if(Dm(t)){for(f in n)n.hasOwnProperty(f)&&(a=n[f],a!==void 0&&Uh(e,t,f,a,n,void 0));return}}for(o in n)n.hasOwnProperty(o)&&(a=n[o],a!=null&&Je(e,t,o,a,n,null))}function gC(e,t,n,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var r=null,l=null,i=null,o=null,c=null,d=null,f=null;for(x in n){var h=n[x];if(n.hasOwnProperty(x)&&h!=null)switch(x){case"checked":break;case"value":break;case"defaultValue":c=h;default:a.hasOwnProperty(x)||Je(e,t,x,null,a,h)}}for(var m in a){var x=a[m];if(h=n[m],a.hasOwnProperty(m)&&(x!=null||h!=null))switch(m){case"type":l=x;break;case"name":r=x;break;case"checked":d=x;break;case"defaultChecked":f=x;break;case"value":i=x;break;case"defaultValue":o=x;break;case"children":case"dangerouslySetInnerHTML":if(x!=null)throw Error(Z(137,t));break;default:x!==h&&Je(e,t,m,x,a,h)}}oh(e,i,o,c,d,f,l,r);return;case"select":x=i=o=m=null;for(l in n)if(c=n[l],n.hasOwnProperty(l)&&c!=null)switch(l){case"value":break;case"multiple":x=c;default:a.hasOwnProperty(l)||Je(e,t,l,null,a,c)}for(r in a)if(l=a[r],c=n[r],a.hasOwnProperty(r)&&(l!=null||c!=null))switch(r){case"value":m=l;break;case"defaultValue":o=l;break;case"multiple":i=l;default:l!==c&&Je(e,t,r,l,a,c)}t=o,n=i,a=x,m!=null?Zr(e,!!n,m,!1):!!a!=!!n&&(t!=null?Zr(e,!!n,t,!0):Zr(e,!!n,n?[]:"",!1));return;case"textarea":x=m=null;for(o in n)if(r=n[o],n.hasOwnProperty(o)&&r!=null&&!a.hasOwnProperty(o))switch(o){case"value":break;case"children":break;default:Je(e,t,o,null,a,r)}for(i in a)if(r=a[i],l=n[i],a.hasOwnProperty(i)&&(r!=null||l!=null))switch(i){case"value":m=r;break;case"defaultValue":x=r;break;case"children":break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(Z(91));break;default:r!==l&&Je(e,t,i,r,a,l)}hj(e,m,x);return;case"option":for(var b in n)if(m=n[b],n.hasOwnProperty(b)&&m!=null&&!a.hasOwnProperty(b))switch(b){case"selected":e.selected=!1;break;default:Je(e,t,b,null,a,m)}for(c in a)if(m=a[c],x=n[c],a.hasOwnProperty(c)&&m!==x&&(m!=null||x!=null))switch(c){case"selected":e.selected=m&&typeof m!="function"&&typeof m!="symbol";break;default:Je(e,t,c,m,a,x)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var v in n)m=n[v],n.hasOwnProperty(v)&&m!=null&&!a.hasOwnProperty(v)&&Je(e,t,v,null,a,m);for(d in a)if(m=a[d],x=n[d],a.hasOwnProperty(d)&&m!==x&&(m!=null||x!=null))switch(d){case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(Z(137,t));break;default:Je(e,t,d,m,a,x)}return;default:if(Dm(t)){for(var y in n)m=n[y],n.hasOwnProperty(y)&&m!==void 0&&!a.hasOwnProperty(y)&&Uh(e,t,y,void 0,a,m);for(f in a)m=a[f],x=n[f],!a.hasOwnProperty(f)||m===x||m===void 0&&x===void 0||Uh(e,t,f,m,a,x);return}}for(var g in n)m=n[g],n.hasOwnProperty(g)&&m!=null&&!a.hasOwnProperty(g)&&Je(e,t,g,null,a,m);for(h in a)m=a[h],x=n[h],!a.hasOwnProperty(h)||m===x||m==null&&x==null||Je(e,t,h,m,a,x)}var Bh=null,Hh=null;function du(e){return e.nodeType===9?e:e.ownerDocument}function tv(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function x0(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Ih(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var kf=null;function vC(){var e=window.event;return e&&e.type==="popstate"?e===kf?!1:(kf=e,!0):(kf=null,!1)}var g0=typeof setTimeout=="function"?setTimeout:void 0,yC=typeof clearTimeout=="function"?clearTimeout:void 0,nv=typeof Promise=="function"?Promise:void 0,jC=typeof queueMicrotask=="function"?queueMicrotask:typeof nv<"u"?function(e){return nv.resolve(null).then(e).catch(bC)}:g0;function bC(e){setTimeout(function(){throw e})}function Ba(e){return e==="head"}function sv(e,t){var n=t,a=0,r=0;do{var l=n.nextSibling;if(e.removeChild(n),l&&l.nodeType===8)if(n=l.data,n==="/$"){if(0<a&&8>a){n=a;var i=e.ownerDocument;if(n&1&&Mi(i.documentElement),n&2&&Mi(i.body),n&4)for(n=i.head,Mi(n),i=n.firstChild;i;){var o=i.nextSibling,c=i.nodeName;i[ho]||c==="SCRIPT"||c==="STYLE"||c==="LINK"&&i.rel.toLowerCase()==="stylesheet"||n.removeChild(i),i=o}}if(r===0){e.removeChild(l),Xi(t);return}r--}else n==="$"||n==="$?"||n==="$!"?r++:a=n.charCodeAt(0)-48;else a=0;n=l}while(n);Xi(t)}function Ph(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":Ph(n),Om(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function wC(e,t,n,a){for(;e.nodeType===1;){var r=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!a&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(a){if(!e[ho])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(l=e.getAttribute("rel"),l==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(l!==r.rel||e.getAttribute("href")!==(r.href==null||r.href===""?null:r.href)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin)||e.getAttribute("title")!==(r.title==null?null:r.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(l=e.getAttribute("src"),(l!==(r.src==null?null:r.src)||e.getAttribute("type")!==(r.type==null?null:r.type)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin))&&l&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var l=r.name==null?null:""+r.name;if(r.type==="hidden"&&e.getAttribute("name")===l)return e}else return e;if(e=Zn(e.nextSibling),e===null)break}return null}function _C(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Zn(e.nextSibling),e===null))return null;return e}function qh(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState==="complete"}function NC(e,t){var n=e.ownerDocument;if(e.data!=="$?"||n.readyState==="complete")t();else{var a=function(){t(),n.removeEventListener("DOMContentLoaded",a)};n.addEventListener("DOMContentLoaded",a),e._reactRetry=a}}function Zn(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==="$?"||t==="F!"||t==="F")break;if(t==="/$")return null}}return e}var Gh=null;function av(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}function v0(e,t,n){switch(t=du(n),e){case"html":if(e=t.documentElement,!e)throw Error(Z(452));return e;case"head":if(e=t.head,!e)throw Error(Z(453));return e;case"body":if(e=t.body,!e)throw Error(Z(454));return e;default:throw Error(Z(451))}}function Mi(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Om(e)}var Vn=new Map,rv=new Set;function fu(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ws=Ve.d;Ve.d={f:kC,r:SC,D:CC,C:RC,L:TC,m:EC,X:MC,S:AC,M:$C};function kC(){var e=Ws.f(),t=Wu();return e||t}function SC(e){var t=Tl(e);t!==null&&t.tag===5&&t.type==="form"?db(t):Ws.r(e)}var Ml=typeof document>"u"?null:document;function y0(e,t,n){var a=Ml;if(a&&typeof t=="string"&&t){var r=Ln(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof n=="string"&&(r+='[crossorigin="'+n+'"]'),rv.has(r)||(rv.add(r),e={rel:e,crossOrigin:n,href:t},a.querySelector(r)===null&&(t=a.createElement("link"),Pt(t,"link",e),Lt(t),a.head.appendChild(t)))}}function CC(e){Ws.D(e),y0("dns-prefetch",e,null)}function RC(e,t){Ws.C(e,t),y0("preconnect",e,t)}function TC(e,t,n){Ws.L(e,t,n);var a=Ml;if(a&&e&&t){var r='link[rel="preload"][as="'+Ln(t)+'"]';t==="image"&&n&&n.imageSrcSet?(r+='[imagesrcset="'+Ln(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(r+='[imagesizes="'+Ln(n.imageSizes)+'"]')):r+='[href="'+Ln(e)+'"]';var l=r;switch(t){case"style":l=bl(e);break;case"script":l=$l(e)}Vn.has(l)||(e=at({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Vn.set(l,e),a.querySelector(r)!==null||t==="style"&&a.querySelector(_o(l))||t==="script"&&a.querySelector(No(l))||(t=a.createElement("link"),Pt(t,"link",e),Lt(t),a.head.appendChild(t)))}}function EC(e,t){Ws.m(e,t);var n=Ml;if(n&&e){var a=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+Ln(a)+'"][href="'+Ln(e)+'"]',l=r;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":l=$l(e)}if(!Vn.has(l)&&(e=at({rel:"modulepreload",href:e},t),Vn.set(l,e),n.querySelector(r)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(No(l)))return}a=n.createElement("link"),Pt(a,"link",e),Lt(a),n.head.appendChild(a)}}}function AC(e,t,n){Ws.S(e,t,n);var a=Ml;if(a&&e){var r=Wr(a).hoistableStyles,l=bl(e);t=t||"default";var i=r.get(l);if(!i){var o={loading:0,preload:null};if(i=a.querySelector(_o(l)))o.loading=5;else{e=at({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Vn.get(l))&&gp(e,n);var c=i=a.createElement("link");Lt(c),Pt(c,"link",e),c._p=new Promise(function(d,f){c.onload=d,c.onerror=f}),c.addEventListener("load",function(){o.loading|=1}),c.addEventListener("error",function(){o.loading|=2}),o.loading|=4,Tc(i,t,a)}i={type:"stylesheet",instance:i,count:1,state:o},r.set(l,i)}}}function MC(e,t){Ws.X(e,t);var n=Ml;if(n&&e){var a=Wr(n).hoistableScripts,r=$l(e),l=a.get(r);l||(l=n.querySelector(No(r)),l||(e=at({src:e,async:!0},t),(t=Vn.get(r))&&vp(e,t),l=n.createElement("script"),Lt(l),Pt(l,"link",e),n.head.appendChild(l)),l={type:"script",instance:l,count:1,state:null},a.set(r,l))}}function $C(e,t){Ws.M(e,t);var n=Ml;if(n&&e){var a=Wr(n).hoistableScripts,r=$l(e),l=a.get(r);l||(l=n.querySelector(No(r)),l||(e=at({src:e,async:!0,type:"module"},t),(t=Vn.get(r))&&vp(e,t),l=n.createElement("script"),Lt(l),Pt(l,"link",e),n.head.appendChild(l)),l={type:"script",instance:l,count:1,state:null},a.set(r,l))}}function lv(e,t,n,a){var r=(r=_a.current)?fu(r):null;if(!r)throw Error(Z(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=bl(n.href),n=Wr(r).hoistableStyles,a=n.get(t),a||(a={type:"style",instance:null,count:0,state:null},n.set(t,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=bl(n.href);var l=Wr(r).hoistableStyles,i=l.get(e);if(i||(r=r.ownerDocument||r,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},l.set(e,i),(l=r.querySelector(_o(e)))&&!l._p&&(i.instance=l,i.state.loading=5),Vn.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Vn.set(e,n),l||OC(r,e,n,i.state))),t&&a===null)throw Error(Z(528,""));return i}if(t&&a!==null)throw Error(Z(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=$l(n),n=Wr(r).hoistableScripts,a=n.get(t),a||(a={type:"script",instance:null,count:0,state:null},n.set(t,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(Z(444,e))}}function bl(e){return'href="'+Ln(e)+'"'}function _o(e){return'link[rel="stylesheet"]['+e+"]"}function j0(e){return at({},e,{"data-precedence":e.precedence,precedence:null})}function OC(e,t,n,a){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?a.loading=1:(t=e.createElement("link"),a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2}),Pt(t,"link",n),Lt(t),e.head.appendChild(t))}function $l(e){return'[src="'+Ln(e)+'"]'}function No(e){return"script[async]"+e}function iv(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var a=e.querySelector('style[data-href~="'+Ln(n.href)+'"]');if(a)return t.instance=a,Lt(a),a;var r=at({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),Lt(a),Pt(a,"style",r),Tc(a,n.precedence,e),t.instance=a;case"stylesheet":r=bl(n.href);var l=e.querySelector(_o(r));if(l)return t.state.loading|=4,t.instance=l,Lt(l),l;a=j0(n),(r=Vn.get(r))&&gp(a,r),l=(e.ownerDocument||e).createElement("link"),Lt(l);var i=l;return i._p=new Promise(function(o,c){i.onload=o,i.onerror=c}),Pt(l,"link",a),t.state.loading|=4,Tc(l,n.precedence,e),t.instance=l;case"script":return l=$l(n.src),(r=e.querySelector(No(l)))?(t.instance=r,Lt(r),r):(a=n,(r=Vn.get(l))&&(a=at({},n),vp(a,r)),e=e.ownerDocument||e,r=e.createElement("script"),Lt(r),Pt(r,"link",a),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(Z(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(a=t.instance,t.state.loading|=4,Tc(a,n.precedence,e));return t.instance}function Tc(e,t,n){for(var a=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=a.length?a[a.length-1]:null,l=r,i=0;i<a.length;i++){var o=a[i];if(o.dataset.precedence===t)l=o;else if(l!==r)break}l?l.parentNode.insertBefore(e,l.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function gp(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function vp(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Ec=null;function ov(e,t,n){if(Ec===null){var a=new Map,r=Ec=new Map;r.set(n,a)}else r=Ec,a=r.get(n),a||(a=new Map,r.set(n,a));if(a.has(e))return a;for(a.set(e,null),n=n.getElementsByTagName(e),r=0;r<n.length;r++){var l=n[r];if(!(l[ho]||l[qt]||e==="link"&&l.getAttribute("rel")==="stylesheet")&&l.namespaceURI!=="http://www.w3.org/2000/svg"){var i=l.getAttribute(t)||"";i=e+i;var o=a.get(i);o?o.push(l):a.set(i,[l])}}return a}function cv(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function DC(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function b0(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}var Vi=null;function zC(){}function LC(e,t,n){if(Vi===null)throw Error(Z(475));var a=Vi;if(t.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&!(t.state.loading&4)){if(t.instance===null){var r=bl(n.href),l=e.querySelector(_o(r));if(l){e=l._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(a.count++,a=hu.bind(a),e.then(a,a)),t.state.loading|=4,t.instance=l,Lt(l);return}l=e.ownerDocument||e,n=j0(n),(r=Vn.get(r))&&gp(n,r),l=l.createElement("link"),Lt(l);var i=l;i._p=new Promise(function(o,c){i.onload=o,i.onerror=c}),Pt(l,"link",n),t.instance=l}a.stylesheets===null&&(a.stylesheets=new Map),a.stylesheets.set(t,e),(e=t.state.preload)&&!(t.state.loading&3)&&(a.count++,t=hu.bind(a),e.addEventListener("load",t),e.addEventListener("error",t))}}function UC(){if(Vi===null)throw Error(Z(475));var e=Vi;return e.stylesheets&&e.count===0&&Vh(e,e.stylesheets),0<e.count?function(t){var n=setTimeout(function(){if(e.stylesheets&&Vh(e,e.stylesheets),e.unsuspend){var a=e.unsuspend;e.unsuspend=null,a()}},6e4);return e.unsuspend=t,function(){e.unsuspend=null,clearTimeout(n)}}:null}function hu(){if(this.count--,this.count===0){if(this.stylesheets)Vh(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var mu=null;function Vh(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,mu=new Map,t.forEach(BC,e),mu=null,hu.call(e))}function BC(e,t){if(!(t.state.loading&4)){var n=mu.get(e);if(n)var a=n.get(null);else{n=new Map,mu.set(e,n);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),l=0;l<r.length;l++){var i=r[l];(i.nodeName==="LINK"||i.getAttribute("media")!=="not all")&&(n.set(i.dataset.precedence,i),a=i)}a&&n.set(null,a)}r=t.instance,i=r.getAttribute("data-precedence"),l=n.get(i)||a,l===a&&n.set(null,r),n.set(i,r),this.count++,a=hu.bind(this),r.addEventListener("load",a),r.addEventListener("error",a),l?l.parentNode.insertBefore(r,l.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(r,e.firstChild)),t.state.loading|=4}}var Yi={$$typeof:Us,Provider:null,Consumer:null,_currentValue:Wa,_currentValue2:Wa,_threadCount:0};function HC(e,t,n,a,r,l,i,o){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Yd(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Yd(0),this.hiddenUpdates=Yd(null),this.identifierPrefix=a,this.onUncaughtError=r,this.onCaughtError=l,this.onRecoverableError=i,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=o,this.incompleteTransitions=new Map}function w0(e,t,n,a,r,l,i,o,c,d,f,h){return e=new HC(e,t,n,i,o,c,d,h),t=1,l===!0&&(t|=24),l=_n(3,null,null,t),e.current=l,l.stateNode=e,t=Ym(),t.refCount++,e.pooledCache=t,t.refCount++,l.memoizedState={element:a,isDehydrated:n,cache:t},Km(l),e}function _0(e){return e?(e=Yr,e):Yr}function N0(e,t,n,a,r,l){r=_0(r),a.context===null?a.context=r:a.pendingContext=r,a=Na(t),a.payload={element:n},l=l===void 0?null:l,l!==null&&(a.callback=l),n=ka(e,a,t),n!==null&&(Cn(n,e,t),Ni(n,e,t))}function uv(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function yp(e,t){uv(e,t),(e=e.alternate)&&uv(e,t)}function k0(e){if(e.tag===13){var t=El(e,67108864);t!==null&&Cn(t,e,67108864),yp(e,67108864)}}var pu=!0;function IC(e,t,n,a){var r=Ce.T;Ce.T=null;var l=Ve.p;try{Ve.p=2,jp(e,t,n,a)}finally{Ve.p=l,Ce.T=r}}function PC(e,t,n,a){var r=Ce.T;Ce.T=null;var l=Ve.p;try{Ve.p=8,jp(e,t,n,a)}finally{Ve.p=l,Ce.T=r}}function jp(e,t,n,a){if(pu){var r=Yh(a);if(r===null)Nf(e,t,a,xu,n),dv(e,a);else if(GC(r,e,t,n,a))a.stopPropagation();else if(dv(e,a),t&4&&-1<qC.indexOf(e)){for(;r!==null;){var l=Tl(r);if(l!==null)switch(l.tag){case 3:if(l=l.stateNode,l.current.memoizedState.isDehydrated){var i=Fa(l.pendingLanes);if(i!==0){var o=l;for(o.pendingLanes|=2,o.entangledLanes|=2;i;){var c=1<<31-kn(i);o.entanglements[1]|=c,i&=~c}Ss(l),!(Qe&6)&&(lu=vs()+500,wo(0))}}break;case 13:o=El(l,2),o!==null&&Cn(o,l,2),Wu(),yp(l,2)}if(l=Yh(a),l===null&&Nf(e,t,a,xu,n),l===r)break;r=l}r!==null&&a.stopPropagation()}else Nf(e,t,a,null,n)}}function Yh(e){return e=zm(e),bp(e)}var xu=null;function bp(e){if(xu=null,e=Hr(e),e!==null){var t=oo(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=Qy(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 xu=e,null}function S0(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(RS()){case ej:return 2;case tj:return 8;case Gc:case TS:return 32;case nj:return 268435456;default:return 32}default:return 32}}var Fh=!1,Ra=null,Ta=null,Ea=null,Fi=new Map,Ki=new Map,xa=[],qC="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function dv(e,t){switch(e){case"focusin":case"focusout":Ra=null;break;case"dragenter":case"dragleave":Ta=null;break;case"mouseover":case"mouseout":Ea=null;break;case"pointerover":case"pointerout":Fi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ki.delete(t.pointerId)}}function ni(e,t,n,a,r,l){return e===null||e.nativeEvent!==l?(e={blockedOn:t,domEventName:n,eventSystemFlags:a,nativeEvent:l,targetContainers:[r]},t!==null&&(t=Tl(t),t!==null&&k0(t)),e):(e.eventSystemFlags|=a,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function GC(e,t,n,a,r){switch(t){case"focusin":return Ra=ni(Ra,e,t,n,a,r),!0;case"dragenter":return Ta=ni(Ta,e,t,n,a,r),!0;case"mouseover":return Ea=ni(Ea,e,t,n,a,r),!0;case"pointerover":var l=r.pointerId;return Fi.set(l,ni(Fi.get(l)||null,e,t,n,a,r)),!0;case"gotpointercapture":return l=r.pointerId,Ki.set(l,ni(Ki.get(l)||null,e,t,n,a,r)),!0}return!1}function C0(e){var t=Hr(e.target);if(t!==null){var n=oo(t);if(n!==null){if(t=n.tag,t===13){if(t=Qy(n),t!==null){e.blockedOn=t,LS(e.priority,function(){if(n.tag===13){var a=Sn();a=Mm(a);var r=El(n,a);r!==null&&Cn(r,n,a),yp(n,a)}});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ac(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Yh(e.nativeEvent);if(n===null){n=e.nativeEvent;var a=new n.constructor(n.type,n);uh=a,n.target.dispatchEvent(a),uh=null}else return t=Tl(n),t!==null&&k0(t),e.blockedOn=n,!1;t.shift()}return!0}function fv(e,t,n){Ac(e)&&n.delete(t)}function VC(){Fh=!1,Ra!==null&&Ac(Ra)&&(Ra=null),Ta!==null&&Ac(Ta)&&(Ta=null),Ea!==null&&Ac(Ea)&&(Ea=null),Fi.forEach(fv),Ki.forEach(fv)}function ec(e,t){e.blockedOn===t&&(e.blockedOn=null,Fh||(Fh=!0,Ot.unstable_scheduleCallback(Ot.unstable_NormalPriority,VC)))}var tc=null;function hv(e){tc!==e&&(tc=e,Ot.unstable_scheduleCallback(Ot.unstable_NormalPriority,function(){tc===e&&(tc=null);for(var t=0;t<e.length;t+=3){var n=e[t],a=e[t+1],r=e[t+2];if(typeof a!="function"){if(bp(a||n)===null)continue;break}var l=Tl(n);l!==null&&(e.splice(t,3),t-=3,Sh(l,{pending:!0,data:r,method:n.method,action:a},a,r))}}))}function Xi(e){function t(c){return ec(c,e)}Ra!==null&&ec(Ra,e),Ta!==null&&ec(Ta,e),Ea!==null&&ec(Ea,e),Fi.forEach(t),Ki.forEach(t);for(var n=0;n<xa.length;n++){var a=xa[n];a.blockedOn===e&&(a.blockedOn=null)}for(;0<xa.length&&(n=xa[0],n.blockedOn===null);)C0(n),n.blockedOn===null&&xa.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(a=0;a<n.length;a+=3){var r=n[a],l=n[a+1],i=r[on]||null;if(typeof l=="function")i||hv(n);else if(i){var o=null;if(l&&l.hasAttribute("formAction")){if(r=l,i=l[on]||null)o=i.formAction;else if(bp(r)!==null)continue}else o=i.action;typeof o=="function"?n[a+1]=o:(n.splice(a,3),a-=3),hv(n)}}}function wp(e){this._internalRoot=e}td.prototype.render=wp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Z(409));var n=t.current,a=Sn();N0(n,a,e,t,null,null)};td.prototype.unmount=wp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;N0(e.current,2,null,e,null,null),Wu(),t[Rl]=null}};function td(e){this._internalRoot=e}td.prototype.unstable_scheduleHydration=function(e){if(e){var t=ij();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xa.length&&t!==0&&t<xa[n].priority;n++);xa.splice(n,0,e),n===0&&C0(e)}};var mv=Ky.version;if(mv!=="19.1.0")throw Error(Z(527,mv,"19.1.0"));Ve.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(Z(188)):(e=Object.keys(e).join(","),Error(Z(268,e)));return e=bS(t),e=e!==null?Wy(e):null,e=e===null?null:e.stateNode,e};var YC={bundleType:0,version:"19.1.0",rendererPackageName:"react-dom",currentDispatcherRef:Ce,reconcilerVersion:"19.1.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var nc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!nc.isDisabled&&nc.supportsFiber)try{co=nc.inject(YC),Nn=nc}catch{}}Bu.createRoot=function(e,t){if(!Xy(e))throw Error(Z(299));var n=!1,a="",r=wb,l=_b,i=Nb,o=null;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(a=t.identifierPrefix),t.onUncaughtError!==void 0&&(r=t.onUncaughtError),t.onCaughtError!==void 0&&(l=t.onCaughtError),t.onRecoverableError!==void 0&&(i=t.onRecoverableError),t.unstable_transitionCallbacks!==void 0&&(o=t.unstable_transitionCallbacks)),t=w0(e,1,!1,null,null,n,a,r,l,i,o,null),e[Rl]=t.current,xp(e),new wp(t)};Bu.hydrateRoot=function(e,t,n){if(!Xy(e))throw Error(Z(299));var a=!1,r="",l=wb,i=_b,o=Nb,c=null,d=null;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(r=n.identifierPrefix),n.onUncaughtError!==void 0&&(l=n.onUncaughtError),n.onCaughtError!==void 0&&(i=n.onCaughtError),n.onRecoverableError!==void 0&&(o=n.onRecoverableError),n.unstable_transitionCallbacks!==void 0&&(c=n.unstable_transitionCallbacks),n.formState!==void 0&&(d=n.formState)),t=w0(e,1,!0,t,n??null,a,r,l,i,o,c,d),t.context=_0(null),n=t.current,a=Sn(),a=Mm(a),r=Na(a),r.callback=null,ka(n,r,a),n=a,t.current.lanes=n,fo(t,n),Ss(t),e[Rl]=t.current,xp(e),new td(t)};Bu.version="19.1.0";function R0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(R0)}catch(e){console.error(e)}}R0(),Py.exports=Bu;var FC=Py.exports;const T0=u.createContext(null);function E0({data:e,router:t,identity:n,notify:a,children:r}){return s.jsx(T0.Provider,{value:{data:e,router:t,identity:n,notify:a},children:r})}function nd(){const e=u.useContext(T0);if(!e)throw new Error("A shared app page rendered outside AppUiProvider.");return e}const KC={success:()=>{},error:()=>{}},un=()=>nd().data,Ze=()=>nd().router,sd=()=>nd().identity,yr=()=>nd().notify??KC;function XC(){const{probe:e}=un(),{href:t,Link:n}=Ze(),a=sd(),[r,l]=u.useState(null),[i,o]=u.useState(!1);return u.useEffect(()=>{let c=!0;if(!e){o(!0);return}return e.source().then(d=>c&&l(d.label),()=>c&&o(!0)),()=>{c=!1}},[e]),s.jsxs("section",{"data-testid":"app-ui-probe",className:"m-6 flex max-w-xl flex-col gap-2 rounded-lg border border-border bg-card p-6 text-card-foreground",children:[s.jsx("h1",{className:"text-xl font-semibold",children:"Shared app UI"}),s.jsx("p",{"data-testid":"app-ui-probe-source",className:"text-sm text-muted-foreground",children:i?"Data source unavailable":r??"Loading…"}),s.jsxs("p",{"data-testid":"app-ui-probe-identity",className:"text-sm",children:[a.label," · ",a.can("tasks.write")?"can edit tasks":"read only"]}),s.jsx(n,{href:t("/tasks"),className:"rounded-sm text-sm text-primary underline outline-hidden focus-visible:ring-2 focus-visible:ring-ring",children:"Tasks"})]})}/**
50
+ * @license lucide-react v0.511.0 - ISC
51
+ *
52
+ * This source code is licensed under the ISC license.
53
+ * See the LICENSE file in the root directory of this source tree.
54
+ */const QC=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),WC=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,a)=>a?a.toUpperCase():n.toLowerCase()),pv=e=>{const t=WC(e);return t.charAt(0).toUpperCase()+t.slice(1)},A0=(...e)=>e.filter((t,n,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===n).join(" ").trim(),ZC=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
55
+ * @license lucide-react v0.511.0 - ISC
56
+ *
57
+ * This source code is licensed under the ISC license.
58
+ * See the LICENSE file in the root directory of this source tree.
59
+ */var JC={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
60
+ * @license lucide-react v0.511.0 - ISC
61
+ *
62
+ * This source code is licensed under the ISC license.
63
+ * See the LICENSE file in the root directory of this source tree.
64
+ */const eR=u.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:r="",children:l,iconNode:i,...o},c)=>u.createElement("svg",{ref:c,...JC,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:A0("lucide",r),...!l&&!ZC(o)&&{"aria-hidden":"true"},...o},[...i.map(([d,f])=>u.createElement(d,f)),...Array.isArray(l)?l:[l]]));/**
65
+ * @license lucide-react v0.511.0 - ISC
66
+ *
67
+ * This source code is licensed under the ISC license.
68
+ * See the LICENSE file in the root directory of this source tree.
69
+ */const be=(e,t)=>{const n=u.forwardRef(({className:a,...r},l)=>u.createElement(eR,{ref:l,iconNode:t,className:A0(`lucide-${QC(pv(e))}`,`lucide-${e}`,a),...r}));return n.displayName=pv(e),n};/**
70
+ * @license lucide-react v0.511.0 - ISC
71
+ *
72
+ * This source code is licensed under the ISC license.
73
+ * See the LICENSE file in the root directory of this source tree.
74
+ */const tR=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]],nR=be("archive-restore",tR);/**
75
+ * @license lucide-react v0.511.0 - ISC
76
+ *
77
+ * This source code is licensed under the ISC license.
78
+ * See the LICENSE file in the root directory of this source tree.
79
+ */const sR=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],xv=be("archive",sR);/**
80
+ * @license lucide-react v0.511.0 - ISC
81
+ *
82
+ * This source code is licensed under the ISC license.
83
+ * See the LICENSE file in the root directory of this source tree.
84
+ */const aR=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],rR=be("arrow-down",aR);/**
85
+ * @license lucide-react v0.511.0 - ISC
86
+ *
87
+ * This source code is licensed under the ISC license.
88
+ * See the LICENSE file in the root directory of this source tree.
89
+ */const lR=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],M0=be("arrow-left",lR);/**
90
+ * @license lucide-react v0.511.0 - ISC
91
+ *
92
+ * This source code is licensed under the ISC license.
93
+ * See the LICENSE file in the root directory of this source tree.
94
+ */const iR=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],oR=be("arrow-up",iR);/**
95
+ * @license lucide-react v0.511.0 - ISC
96
+ *
97
+ * This source code is licensed under the ISC license.
98
+ * See the LICENSE file in the root directory of this source tree.
99
+ */const cR=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],_p=be("bot",cR);/**
100
+ * @license lucide-react v0.511.0 - ISC
101
+ *
102
+ * This source code is licensed under the ISC license.
103
+ * See the LICENSE file in the root directory of this source tree.
104
+ */const uR=[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]],dR=be("briefcase",uR);/**
105
+ * @license lucide-react v0.511.0 - ISC
106
+ *
107
+ * This source code is licensed under the ISC license.
108
+ * See the LICENSE file in the root directory of this source tree.
109
+ */const fR=[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]],hR=be("building-2",fR);/**
110
+ * @license lucide-react v0.511.0 - ISC
111
+ *
112
+ * This source code is licensed under the ISC license.
113
+ * See the LICENSE file in the root directory of this source tree.
114
+ */const mR=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ol=be("check",mR);/**
115
+ * @license lucide-react v0.511.0 - ISC
116
+ *
117
+ * This source code is licensed under the ISC license.
118
+ * See the LICENSE file in the root directory of this source tree.
119
+ */const pR=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Np=be("chevron-down",pR);/**
120
+ * @license lucide-react v0.511.0 - ISC
121
+ *
122
+ * This source code is licensed under the ISC license.
123
+ * See the LICENSE file in the root directory of this source tree.
124
+ */const xR=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ad=be("chevron-right",xR);/**
125
+ * @license lucide-react v0.511.0 - ISC
126
+ *
127
+ * This source code is licensed under the ISC license.
128
+ * See the LICENSE file in the root directory of this source tree.
129
+ */const gR=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],vR=be("chevron-up",gR);/**
130
+ * @license lucide-react v0.511.0 - ISC
131
+ *
132
+ * This source code is licensed under the ISC license.
133
+ * See the LICENSE file in the root directory of this source tree.
134
+ */const yR=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],$0=be("chevrons-up-down",yR);/**
135
+ * @license lucide-react v0.511.0 - ISC
136
+ *
137
+ * This source code is licensed under the ISC license.
138
+ * See the LICENSE file in the root directory of this source tree.
139
+ */const jR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],st=be("circle-alert",jR);/**
140
+ * @license lucide-react v0.511.0 - ISC
141
+ *
142
+ * This source code is licensed under the ISC license.
143
+ * See the LICENSE file in the root directory of this source tree.
144
+ */const bR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],rd=be("circle-check",bR);/**
145
+ * @license lucide-react v0.511.0 - ISC
146
+ *
147
+ * This source code is licensed under the ISC license.
148
+ * See the LICENSE file in the root directory of this source tree.
149
+ */const wR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],_R=be("circle",wR);/**
150
+ * @license lucide-react v0.511.0 - ISC
151
+ *
152
+ * This source code is licensed under the ISC license.
153
+ * See the LICENSE file in the root directory of this source tree.
154
+ */const NR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],kR=be("clock",NR);/**
155
+ * @license lucide-react v0.511.0 - ISC
156
+ *
157
+ * This source code is licensed under the ISC license.
158
+ * See the LICENSE file in the root directory of this source tree.
159
+ */const SR=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],CR=be("copy",SR);/**
160
+ * @license lucide-react v0.511.0 - ISC
161
+ *
162
+ * This source code is licensed under the ISC license.
163
+ * See the LICENSE file in the root directory of this source tree.
164
+ */const RR=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],kp=be("ellipsis",RR);/**
165
+ * @license lucide-react v0.511.0 - ISC
166
+ *
167
+ * This source code is licensed under the ISC license.
168
+ * See the LICENSE file in the root directory of this source tree.
169
+ */const TR=[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]],ER=be("eraser",TR);/**
170
+ * @license lucide-react v0.511.0 - ISC
171
+ *
172
+ * This source code is licensed under the ISC license.
173
+ * See the LICENSE file in the root directory of this source tree.
174
+ */const AR=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],ko=be("eye",AR);/**
175
+ * @license lucide-react v0.511.0 - ISC
176
+ *
177
+ * This source code is licensed under the ISC license.
178
+ * See the LICENSE file in the root directory of this source tree.
179
+ */const MR=[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["path",{d:"M18 19c-2.8 0-5-2.2-5-5v8",key:"pkpw2h"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]],O0=be("folder-git-2",MR);/**
180
+ * @license lucide-react v0.511.0 - ISC
181
+ *
182
+ * This source code is licensed under the ISC license.
183
+ * See the LICENSE file in the root directory of this source tree.
184
+ */const $R=[["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M14 13h3",key:"1dgedf"}],["path",{d:"M7 13h3",key:"1pygq7"}]],OR=be("folder-git",$R);/**
185
+ * @license lucide-react v0.511.0 - ISC
186
+ *
187
+ * This source code is licensed under the ISC license.
188
+ * See the LICENSE file in the root directory of this source tree.
189
+ */const DR=[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]],zR=be("git-fork",DR);/**
190
+ * @license lucide-react v0.511.0 - ISC
191
+ *
192
+ * This source code is licensed under the ISC license.
193
+ * See the LICENSE file in the root directory of this source tree.
194
+ */const LR=[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v12",key:"ih889a"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}]],Kh=be("git-pull-request-arrow",LR);/**
195
+ * @license lucide-react v0.511.0 - ISC
196
+ *
197
+ * This source code is licensed under the ISC license.
198
+ * See the LICENSE file in the root directory of this source tree.
199
+ */const UR=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],BR=be("hard-drive",UR);/**
200
+ * @license lucide-react v0.511.0 - ISC
201
+ *
202
+ * This source code is licensed under the ISC license.
203
+ * See the LICENSE file in the root directory of this source tree.
204
+ */const HR=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],IR=be("history",HR);/**
205
+ * @license lucide-react v0.511.0 - ISC
206
+ *
207
+ * This source code is licensed under the ISC license.
208
+ * See the LICENSE file in the root directory of this source tree.
209
+ */const PR=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]],qR=be("house",PR);/**
210
+ * @license lucide-react v0.511.0 - ISC
211
+ *
212
+ * This source code is licensed under the ISC license.
213
+ * See the LICENSE file in the root directory of this source tree.
214
+ */const GR=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],VR=be("inbox",GR);/**
215
+ * @license lucide-react v0.511.0 - ISC
216
+ *
217
+ * This source code is licensed under the ISC license.
218
+ * See the LICENSE file in the root directory of this source tree.
219
+ */const YR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],ws=be("info",YR);/**
220
+ * @license lucide-react v0.511.0 - ISC
221
+ *
222
+ * This source code is licensed under the ISC license.
223
+ * See the LICENSE file in the root directory of this source tree.
224
+ */const FR=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]],KR=be("laptop",FR);/**
225
+ * @license lucide-react v0.511.0 - ISC
226
+ *
227
+ * This source code is licensed under the ISC license.
228
+ * See the LICENSE file in the root directory of this source tree.
229
+ */const XR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]],QR=be("life-buoy",XR);/**
230
+ * @license lucide-react v0.511.0 - ISC
231
+ *
232
+ * This source code is licensed under the ISC license.
233
+ * See the LICENSE file in the root directory of this source tree.
234
+ */const WR=[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]],D0=be("list-checks",WR);/**
235
+ * @license lucide-react v0.511.0 - ISC
236
+ *
237
+ * This source code is licensed under the ISC license.
238
+ * See the LICENSE file in the root directory of this source tree.
239
+ */const ZR=[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]],z0=be("list-ordered",ZR);/**
240
+ * @license lucide-react v0.511.0 - ISC
241
+ *
242
+ * This source code is licensed under the ISC license.
243
+ * See the LICENSE file in the root directory of this source tree.
244
+ */const JR=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],eT=be("loader-circle",JR);/**
245
+ * @license lucide-react v0.511.0 - ISC
246
+ *
247
+ * This source code is licensed under the ISC license.
248
+ * See the LICENSE file in the root directory of this source tree.
249
+ */const tT=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],nT=be("lock",tT);/**
250
+ * @license lucide-react v0.511.0 - ISC
251
+ *
252
+ * This source code is licensed under the ISC license.
253
+ * See the LICENSE file in the root directory of this source tree.
254
+ */const sT=[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]],aT=be("messages-square",sT);/**
255
+ * @license lucide-react v0.511.0 - ISC
256
+ *
257
+ * This source code is licensed under the ISC license.
258
+ * See the LICENSE file in the root directory of this source tree.
259
+ */const rT=[["path",{d:"M5 12h14",key:"1ays0h"}]],lT=be("minus",rT);/**
260
+ * @license lucide-react v0.511.0 - ISC
261
+ *
262
+ * This source code is licensed under the ISC license.
263
+ * See the LICENSE file in the root directory of this source tree.
264
+ */const iT=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],oT=be("network",iT);/**
265
+ * @license lucide-react v0.511.0 - ISC
266
+ *
267
+ * This source code is licensed under the ISC license.
268
+ * See the LICENSE file in the root directory of this source tree.
269
+ */const cT=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],uT=be("panel-left",cT);/**
270
+ * @license lucide-react v0.511.0 - ISC
271
+ *
272
+ * This source code is licensed under the ISC license.
273
+ * See the LICENSE file in the root directory of this source tree.
274
+ */const dT=[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]],L0=be("pause",dT);/**
275
+ * @license lucide-react v0.511.0 - ISC
276
+ *
277
+ * This source code is licensed under the ISC license.
278
+ * See the LICENSE file in the root directory of this source tree.
279
+ */const fT=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],ld=be("pencil",fT);/**
280
+ * @license lucide-react v0.511.0 - ISC
281
+ *
282
+ * This source code is licensed under the ISC license.
283
+ * See the LICENSE file in the root directory of this source tree.
284
+ */const hT=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],wl=be("plus",hT);/**
285
+ * @license lucide-react v0.511.0 - ISC
286
+ *
287
+ * This source code is licensed under the ISC license.
288
+ * See the LICENSE file in the root directory of this source tree.
289
+ */const mT=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],jr=be("refresh-cw",mT);/**
290
+ * @license lucide-react v0.511.0 - ISC
291
+ *
292
+ * This source code is licensed under the ISC license.
293
+ * See the LICENSE file in the root directory of this source tree.
294
+ */const pT=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],xT=be("rotate-ccw",pT);/**
295
+ * @license lucide-react v0.511.0 - ISC
296
+ *
297
+ * This source code is licensed under the ISC license.
298
+ * See the LICENSE file in the root directory of this source tree.
299
+ */const gT=[["path",{d:"m13.5 8.5-5 5",key:"1cs55j"}],["path",{d:"m8.5 8.5 5 5",key:"a8mexj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],id=be("search-x",gT);/**
300
+ * @license lucide-react v0.511.0 - ISC
301
+ *
302
+ * This source code is licensed under the ISC license.
303
+ * See the LICENSE file in the root directory of this source tree.
304
+ */const vT=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],yT=be("search",vT);/**
305
+ * @license lucide-react v0.511.0 - ISC
306
+ *
307
+ * This source code is licensed under the ISC license.
308
+ * See the LICENSE file in the root directory of this source tree.
309
+ */const jT=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],bT=be("shield-alert",jT);/**
310
+ * @license lucide-react v0.511.0 - ISC
311
+ *
312
+ * This source code is licensed under the ISC license.
313
+ * See the LICENSE file in the root directory of this source tree.
314
+ */const wT=[["path",{d:"m10 20-1.25-2.5L6 18",key:"18frcb"}],["path",{d:"M10 4 8.75 6.5 6 6",key:"7mghy3"}],["path",{d:"m14 20 1.25-2.5L18 18",key:"1chtki"}],["path",{d:"m14 4 1.25 2.5L18 6",key:"1b4wsy"}],["path",{d:"m17 21-3-6h-4",key:"15hhxa"}],["path",{d:"m17 3-3 6 1.5 3",key:"11697g"}],["path",{d:"M2 12h6.5L10 9",key:"kv9z4n"}],["path",{d:"m20 10-1.5 2 1.5 2",key:"1swlpi"}],["path",{d:"M22 12h-6.5L14 15",key:"1mxi28"}],["path",{d:"m4 10 1.5 2L4 14",key:"k9enpj"}],["path",{d:"m7 21 3-6-1.5-3",key:"j8hb9u"}],["path",{d:"m7 3 3 6h4",key:"1otusx"}]],_T=be("snowflake",wT);/**
315
+ * @license lucide-react v0.511.0 - ISC
316
+ *
317
+ * This source code is licensed under the ISC license.
318
+ * See the LICENSE file in the root directory of this source tree.
319
+ */const NT=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],gu=be("tag",NT);/**
320
+ * @license lucide-react v0.511.0 - ISC
321
+ *
322
+ * This source code is licensed under the ISC license.
323
+ * See the LICENSE file in the root directory of this source tree.
324
+ */const kT=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Xt=be("triangle-alert",kT);/**
325
+ * @license lucide-react v0.511.0 - ISC
326
+ *
327
+ * This source code is licensed under the ISC license.
328
+ * See the LICENSE file in the root directory of this source tree.
329
+ */const ST=[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],CT=be("user-check",ST);/**
330
+ * @license lucide-react v0.511.0 - ISC
331
+ *
332
+ * This source code is licensed under the ISC license.
333
+ * See the LICENSE file in the root directory of this source tree.
334
+ */const RT=[["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m14.305 16.53.923-.382",key:"1itpsq"}],["path",{d:"m15.228 13.852-.923-.383",key:"eplpkm"}],["path",{d:"m16.852 12.228-.383-.923",key:"13v3q0"}],["path",{d:"m16.852 17.772-.383.924",key:"1i8mnm"}],["path",{d:"m19.148 12.228.383-.923",key:"1q8j1v"}],["path",{d:"m19.53 18.696-.382-.924",key:"vk1qj3"}],["path",{d:"m20.772 13.852.924-.383",key:"n880s0"}],["path",{d:"m20.772 16.148.924.383",key:"1g6xey"}],["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],TT=be("user-cog",RT);/**
335
+ * @license lucide-react v0.511.0 - ISC
336
+ *
337
+ * This source code is licensed under the ISC license.
338
+ * See the LICENSE file in the root directory of this source tree.
339
+ */const ET=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Sp=be("user",ET);/**
340
+ * @license lucide-react v0.511.0 - ISC
341
+ *
342
+ * This source code is licensed under the ISC license.
343
+ * See the LICENSE file in the root directory of this source tree.
344
+ */const AT=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],od=be("x",AT),MT="Local only · this machine · not connected to SoftwareDLC",$T="Checking sync state…",OT="Sync state unknown",DT="Projects are the repositories this viewer reads on this machine. Nothing is shared unless you connect to SoftwareDLC.",cr="Details are in the terminal running sdlc viewer.",zT="How to fix it is in the terminal running sdlc viewer.",cd="Loading…",vu="Not available";function LT(e){if(!e.source)return null;if(e.source.kind==="repository")return"Repository · in no folder";const t=e.source.repositories;return`Folder · ${t} ${t===1?"repository":"repositories"}`}function di(e){return(typeof e=="string"?new Date(e):e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})}const UT={repository_registry:"this repository's registry",folder_registry:"the folder registry",issue_store:"the issue store",task_store:"the task store",workspace_store:"the local graph store"};function U0(e,t){const n=t?` this list was read at ${di(t)}.`:"";if(e.reason==="store_locked"){const a=e.store?UT[e.store]:"a local store",r=e.since?` since ${di(e.since)}`:"";return`Another sdlc command has held ${a}${r};${n||" nothing was read yet."} ${cr}`}return e.status===0?`The viewer did not answer. Is sdlc viewer still running?${t?` This list was read at ${di(t)}.`:""}`:`The read failed.${t?` This list was read at ${di(t)}.`:""} ${cr}`}const BT=e=>e.status===409,HT={not_a_home:"The repository this one's folder pointer names is not a folder's home.",folder_conflict:"This repository holds both a folder pointer and a folder's membership.",pointer_invalid:"This repository's folder pointer cannot be read, or names this repository as its own home.",membership_invalid:"The folder's records cannot be read.",folder_invalid:"This repository's folder records cannot be read."};function IT(e){const t=e.repository??"This repository";if(e.reason==="folder_member_unlisted"&&e.folder&&e.home&&e.member_path)return{kind:"unlisted",repository:t,folder:e.folder,home:e.home,member_path:e.member_path};if(e.reason==="member_moved"){const r=e.folder?`the folder ${e.folder}`:"its folder";return{kind:"moved_member",cause:`This repository, ${t}, is not where ${r} records it.`}}if(e.reason==="folder_moved")return{kind:"other",cause:e.folder?`The folder ${e.folder} has moved.`:"The folder has moved.",fix:!0};const n=e.reason?HT[e.reason]:void 0,a=n!==void 0&&e.reason!=="membership_invalid"&&e.reason!=="folder_invalid";return{kind:"other",cause:n??"This repository's folder cannot be read.",fix:a}}const gv=["tasks","issues","releases"],Cp=u.createContext(null);function En(){const e=u.useContext(Cp);if(!e)throw new Error("A shell page rendered outside the app shell.");return e}function PT(){var e;return(e=u.useContext(Cp))==null?void 0:e.engine}const qT=10,GT=()=>new Date;function VT({shell:e,now:t=GT,children:n}){var L;const[a,r]=u.useState(null),[l,i]=u.useState(null),[o,c]=u.useState(null),[d,f]=u.useState(null),[h,m]=u.useState(null),[x,b]=u.useState(!0),[v,y]=u.useState(!1),[g,p]=u.useState(void 0),[j,w]=u.useState(!1),[N,C]=u.useState(gv),_=u.useRef(!1),S=u.useRef(!1),$=u.useRef(null),O=u.useRef(!0),G=u.useCallback(async(U=!1)=>{$.current&&clearTimeout($.current),$.current=null,y(!0);const[A,R]=await Promise.all([e.organizations.list(),e.projects.list()]);if(!O.current)return;if(y(!1),b(!1),A.ok&&R.ok){if(_.current=!0,S.current=!1,m(null),f(t()),A.data.organizations.length===0){c("not_in_git"),r(null),i(null);return}c(null),r(A.data.organizations[0]),i(R.data.projects);return}const E=A.ok?R.ok?null:R.refusal:A.refusal;if(!E)return;if(BT(E)){S.current=!1,m(null),c(E),r(null),i(null);return}const k=_.current&&!S.current&&!U;S.current=!0;const M=E.retry_after??qT;m({refusal:E,shown:!k,retryInSeconds:k?M:null}),k&&($.current=setTimeout(()=>void G(!0),M*1e3))},[e,t]);u.useEffect(()=>(O.current=!0,G(),e.about.about().then(U=>{O.current&&(U.ok?p(U.data):U.refusal.status===404?p(null):w(!0))}),Promise.all(gv.map(async U=>{var A;return[U,await((A=e[U])==null?void 0:A.access())]})).then(U=>{O.current&&C(U.filter(([,A])=>!(A!=null&&A.ok&&!A.data.can_view)).map(([A])=>A))}),()=>{O.current=!1,$.current&&clearTimeout($.current)}),[e,G]);const V={loading:x,org:a,projects:l,none:o,readAt:d,failure:h,about:g,aboutFailed:j,engine:(g==null?void 0:g.engine)===null?null:(L=g==null?void 0:g.engine)==null?void 0:L.source,domains:N,reading:v,refresh:()=>void G()};return s.jsx(Cp.Provider,{value:V,children:n})}const B0=e=>`The ${e} page is not part of this sdlc install`,Dl="The sdlc engine here is too old for this page";function YT(e){return e==="checkout"?"Update the main checkout, then restart sdlc viewer.":"Update sdlc to its latest version, then restart sdlc viewer."}function ls(){return YT(PT())}function H0(e){var t,n,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=H0(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function I0(){for(var e,t,n=0,a="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=H0(e))&&(a&&(a+=" "),a+=t);return a}const vv=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,yv=I0,So=(e,t)=>n=>{var a;if((t==null?void 0:t.variants)==null)return yv(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:r,defaultVariants:l}=t,i=Object.keys(r).map(d=>{const f=n==null?void 0:n[d],h=l==null?void 0:l[d];if(f===null)return null;const m=vv(f)||vv(h);return r[d][m]}),o=n&&Object.entries(n).reduce((d,f)=>{let[h,m]=f;return m===void 0||(d[h]=m),d},{}),c=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((d,f)=>{let{class:h,className:m,...x}=f;return Object.entries(x).every(b=>{let[v,y]=b;return Array.isArray(y)?y.includes({...l,...o}[v]):{...l,...o}[v]===y})?[...d,h,m]:d},[]);return yv(e,i,c,n==null?void 0:n.class,n==null?void 0:n.className)},Rp="-",FT=e=>{const t=XT(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:i=>{const o=i.split(Rp);return o[0]===""&&o.length!==1&&o.shift(),P0(o,t)||KT(i)},getConflictingClassGroupIds:(i,o)=>{const c=n[i]||[];return o&&a[i]?[...c,...a[i]]:c}}},P0=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],a=t.nextPart.get(n),r=a?P0(e.slice(1),a):void 0;if(r)return r;if(t.validators.length===0)return;const l=e.join(Rp);return(i=t.validators.find(({validator:o})=>o(l)))==null?void 0:i.classGroupId},jv=/^\[(.+)\]$/,KT=e=>{if(jv.test(e)){const t=jv.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},XT=e=>{const{theme:t,classGroups:n}=e,a={nextPart:new Map,validators:[]};for(const r in n)Xh(n[r],a,r,t);return a},Xh=(e,t,n,a)=>{e.forEach(r=>{if(typeof r=="string"){const l=r===""?t:bv(t,r);l.classGroupId=n;return}if(typeof r=="function"){if(QT(r)){Xh(r(a),t,n,a);return}t.validators.push({validator:r,classGroupId:n});return}Object.entries(r).forEach(([l,i])=>{Xh(i,bv(t,l),n,a)})})},bv=(e,t)=>{let n=e;return t.split(Rp).forEach(a=>{n.nextPart.has(a)||n.nextPart.set(a,{nextPart:new Map,validators:[]}),n=n.nextPart.get(a)}),n},QT=e=>e.isThemeGetter,WT=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,a=new Map;const r=(l,i)=>{n.set(l,i),t++,t>e&&(t=0,a=n,n=new Map)};return{get(l){let i=n.get(l);if(i!==void 0)return i;if((i=a.get(l))!==void 0)return r(l,i),i},set(l,i){n.has(l)?n.set(l,i):r(l,i)}}},Qh="!",Wh=":",ZT=Wh.length,JT=e=>{const{prefix:t,experimentalParseClassName:n}=e;let a=r=>{const l=[];let i=0,o=0,c=0,d;for(let b=0;b<r.length;b++){let v=r[b];if(i===0&&o===0){if(v===Wh){l.push(r.slice(c,b)),c=b+ZT;continue}if(v==="/"){d=b;continue}}v==="["?i++:v==="]"?i--:v==="("?o++:v===")"&&o--}const f=l.length===0?r:r.substring(c),h=eE(f),m=h!==f,x=d&&d>c?d-c:void 0;return{modifiers:l,hasImportantModifier:m,baseClassName:h,maybePostfixModifierPosition:x}};if(t){const r=t+Wh,l=a;a=i=>i.startsWith(r)?l(i.substring(r.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:i,maybePostfixModifierPosition:void 0}}if(n){const r=a;a=l=>n({className:l,parseClassName:r})}return a},eE=e=>e.endsWith(Qh)?e.substring(0,e.length-1):e.startsWith(Qh)?e.substring(1):e,tE=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(a=>[a,!0]));return a=>{if(a.length<=1)return a;const r=[];let l=[];return a.forEach(i=>{i[0]==="["||t[i]?(r.push(...l.sort(),i),l=[]):l.push(i)}),r.push(...l.sort()),r}},nE=e=>({cache:WT(e.cacheSize),parseClassName:JT(e),sortModifiers:tE(e),...FT(e)}),sE=/\s+/,aE=(e,t)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:r,sortModifiers:l}=t,i=[],o=e.trim().split(sE);let c="";for(let d=o.length-1;d>=0;d-=1){const f=o[d],{isExternal:h,modifiers:m,hasImportantModifier:x,baseClassName:b,maybePostfixModifierPosition:v}=n(f);if(h){c=f+(c.length>0?" "+c:c);continue}let y=!!v,g=a(y?b.substring(0,v):b);if(!g){if(!y){c=f+(c.length>0?" "+c:c);continue}if(g=a(b),!g){c=f+(c.length>0?" "+c:c);continue}y=!1}const p=l(m).join(":"),j=x?p+Qh:p,w=j+g;if(i.includes(w))continue;i.push(w);const N=r(g,y);for(let C=0;C<N.length;++C){const _=N[C];i.push(j+_)}c=f+(c.length>0?" "+c:c)}return c};function rE(){let e=0,t,n,a="";for(;e<arguments.length;)(t=arguments[e++])&&(n=q0(t))&&(a&&(a+=" "),a+=n);return a}const q0=e=>{if(typeof e=="string")return e;let t,n="";for(let a=0;a<e.length;a++)e[a]&&(t=q0(e[a]))&&(n&&(n+=" "),n+=t);return n};function lE(e,...t){let n,a,r,l=i;function i(c){const d=t.reduce((f,h)=>h(f),e());return n=nE(d),a=n.cache.get,r=n.cache.set,l=o,o(c)}function o(c){const d=a(c);if(d)return d;const f=aE(c,n);return r(c,f),f}return function(){return l(rE.apply(null,arguments))}}const At=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},G0=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,V0=/^\((?:(\w[\w-]*):)?(.+)\)$/i,iE=/^\d+\/\d+$/,oE=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,cE=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,uE=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,dE=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,fE=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Sr=e=>iE.test(e),$e=e=>!!e&&!Number.isNaN(Number(e)),la=e=>!!e&&Number.isInteger(Number(e)),Sf=e=>e.endsWith("%")&&$e(e.slice(0,-1)),$s=e=>oE.test(e),hE=()=>!0,mE=e=>cE.test(e)&&!uE.test(e),Y0=()=>!1,pE=e=>dE.test(e),xE=e=>fE.test(e),gE=e=>!pe(e)&&!xe(e),vE=e=>zl(e,X0,Y0),pe=e=>G0.test(e),Ya=e=>zl(e,Q0,mE),Cf=e=>zl(e,_E,$e),wv=e=>zl(e,F0,Y0),yE=e=>zl(e,K0,xE),sc=e=>zl(e,W0,pE),xe=e=>V0.test(e),si=e=>Ll(e,Q0),jE=e=>Ll(e,NE),_v=e=>Ll(e,F0),bE=e=>Ll(e,X0),wE=e=>Ll(e,K0),ac=e=>Ll(e,W0,!0),zl=(e,t,n)=>{const a=G0.exec(e);return a?a[1]?t(a[1]):n(a[2]):!1},Ll=(e,t,n=!1)=>{const a=V0.exec(e);return a?a[1]?t(a[1]):n:!1},F0=e=>e==="position"||e==="percentage",K0=e=>e==="image"||e==="url",X0=e=>e==="length"||e==="size"||e==="bg-size",Q0=e=>e==="length",_E=e=>e==="number",NE=e=>e==="family-name",W0=e=>e==="shadow",kE=()=>{const e=At("color"),t=At("font"),n=At("text"),a=At("font-weight"),r=At("tracking"),l=At("leading"),i=At("breakpoint"),o=At("container"),c=At("spacing"),d=At("radius"),f=At("shadow"),h=At("inset-shadow"),m=At("text-shadow"),x=At("drop-shadow"),b=At("blur"),v=At("perspective"),y=At("aspect"),g=At("ease"),p=At("animate"),j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],N=()=>[...w(),xe,pe],C=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto","contain","none"],S=()=>[xe,pe,c],$=()=>[Sr,"full","auto",...S()],O=()=>[la,"none","subgrid",xe,pe],G=()=>["auto",{span:["full",la,xe,pe]},la,xe,pe],V=()=>[la,"auto",xe,pe],L=()=>["auto","min","max","fr",xe,pe],U=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],A=()=>["start","end","center","stretch","center-safe","end-safe"],R=()=>["auto",...S()],E=()=>[Sr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...S()],k=()=>[e,xe,pe],M=()=>[...w(),_v,wv,{position:[xe,pe]}],K=()=>["no-repeat",{repeat:["","x","y","space","round"]}],T=()=>["auto","cover","contain",bE,vE,{size:[xe,pe]}],B=()=>[Sf,si,Ya],F=()=>["","none","full",d,xe,pe],J=()=>["",$e,si,Ya],he=()=>["solid","dashed","dotted","double"],X=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],D=()=>[$e,Sf,_v,wv],H=()=>["","none",b,xe,pe],te=()=>["none",$e,xe,pe],se=()=>["none",$e,xe,pe],ye=()=>[$e,xe,pe],re=()=>[Sr,"full",...S()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[$s],breakpoint:[$s],color:[hE],container:[$s],"drop-shadow":[$s],ease:["in","out","in-out"],font:[gE],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[$s],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[$s],shadow:[$s],spacing:["px",$e],text:[$s],"text-shadow":[$s],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Sr,pe,xe,y]}],container:["container"],columns:[{columns:[$e,pe,xe,o]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:N()}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:$()}],"inset-x":[{"inset-x":$()}],"inset-y":[{"inset-y":$()}],start:[{start:$()}],end:[{end:$()}],top:[{top:$()}],right:[{right:$()}],bottom:[{bottom:$()}],left:[{left:$()}],visibility:["visible","invisible","collapse"],z:[{z:[la,"auto",xe,pe]}],basis:[{basis:[Sr,"full","auto",o,...S()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[$e,Sr,"auto","initial","none",pe]}],grow:[{grow:["",$e,xe,pe]}],shrink:[{shrink:["",$e,xe,pe]}],order:[{order:[la,"first","last","none",xe,pe]}],"grid-cols":[{"grid-cols":O()}],"col-start-end":[{col:G()}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":O()}],"row-start-end":[{row:G()}],"row-start":[{"row-start":V()}],"row-end":[{"row-end":V()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":L()}],"auto-rows":[{"auto-rows":L()}],gap:[{gap:S()}],"gap-x":[{"gap-x":S()}],"gap-y":[{"gap-y":S()}],"justify-content":[{justify:[...U(),"normal"]}],"justify-items":[{"justify-items":[...A(),"normal"]}],"justify-self":[{"justify-self":["auto",...A()]}],"align-content":[{content:["normal",...U()]}],"align-items":[{items:[...A(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...A(),{baseline:["","last"]}]}],"place-content":[{"place-content":U()}],"place-items":[{"place-items":[...A(),"baseline"]}],"place-self":[{"place-self":["auto",...A()]}],p:[{p:S()}],px:[{px:S()}],py:[{py:S()}],ps:[{ps:S()}],pe:[{pe:S()}],pt:[{pt:S()}],pr:[{pr:S()}],pb:[{pb:S()}],pl:[{pl:S()}],m:[{m:R()}],mx:[{mx:R()}],my:[{my:R()}],ms:[{ms:R()}],me:[{me:R()}],mt:[{mt:R()}],mr:[{mr:R()}],mb:[{mb:R()}],ml:[{ml:R()}],"space-x":[{"space-x":S()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":S()}],"space-y-reverse":["space-y-reverse"],size:[{size:E()}],w:[{w:[o,"screen",...E()]}],"min-w":[{"min-w":[o,"screen","none",...E()]}],"max-w":[{"max-w":[o,"screen","none","prose",{screen:[i]},...E()]}],h:[{h:["screen","lh",...E()]}],"min-h":[{"min-h":["screen","lh","none",...E()]}],"max-h":[{"max-h":["screen","lh",...E()]}],"font-size":[{text:["base",n,si,Ya]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,xe,Cf]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Sf,pe]}],"font-family":[{font:[jE,pe,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,xe,pe]}],"line-clamp":[{"line-clamp":[$e,"none",xe,Cf]}],leading:[{leading:[l,...S()]}],"list-image":[{"list-image":["none",xe,pe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",xe,pe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:k()}],"text-color":[{text:k()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...he(),"wavy"]}],"text-decoration-thickness":[{decoration:[$e,"from-font","auto",xe,Ya]}],"text-decoration-color":[{decoration:k()}],"underline-offset":[{"underline-offset":[$e,"auto",xe,pe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:S()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",xe,pe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",xe,pe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:M()}],"bg-repeat":[{bg:K()}],"bg-size":[{bg:T()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},la,xe,pe],radial:["",xe,pe],conic:[la,xe,pe]},wE,yE]}],"bg-color":[{bg:k()}],"gradient-from-pos":[{from:B()}],"gradient-via-pos":[{via:B()}],"gradient-to-pos":[{to:B()}],"gradient-from":[{from:k()}],"gradient-via":[{via:k()}],"gradient-to":[{to:k()}],rounded:[{rounded:F()}],"rounded-s":[{"rounded-s":F()}],"rounded-e":[{"rounded-e":F()}],"rounded-t":[{"rounded-t":F()}],"rounded-r":[{"rounded-r":F()}],"rounded-b":[{"rounded-b":F()}],"rounded-l":[{"rounded-l":F()}],"rounded-ss":[{"rounded-ss":F()}],"rounded-se":[{"rounded-se":F()}],"rounded-ee":[{"rounded-ee":F()}],"rounded-es":[{"rounded-es":F()}],"rounded-tl":[{"rounded-tl":F()}],"rounded-tr":[{"rounded-tr":F()}],"rounded-br":[{"rounded-br":F()}],"rounded-bl":[{"rounded-bl":F()}],"border-w":[{border:J()}],"border-w-x":[{"border-x":J()}],"border-w-y":[{"border-y":J()}],"border-w-s":[{"border-s":J()}],"border-w-e":[{"border-e":J()}],"border-w-t":[{"border-t":J()}],"border-w-r":[{"border-r":J()}],"border-w-b":[{"border-b":J()}],"border-w-l":[{"border-l":J()}],"divide-x":[{"divide-x":J()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":J()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...he(),"hidden","none"]}],"divide-style":[{divide:[...he(),"hidden","none"]}],"border-color":[{border:k()}],"border-color-x":[{"border-x":k()}],"border-color-y":[{"border-y":k()}],"border-color-s":[{"border-s":k()}],"border-color-e":[{"border-e":k()}],"border-color-t":[{"border-t":k()}],"border-color-r":[{"border-r":k()}],"border-color-b":[{"border-b":k()}],"border-color-l":[{"border-l":k()}],"divide-color":[{divide:k()}],"outline-style":[{outline:[...he(),"none","hidden"]}],"outline-offset":[{"outline-offset":[$e,xe,pe]}],"outline-w":[{outline:["",$e,si,Ya]}],"outline-color":[{outline:k()}],shadow:[{shadow:["","none",f,ac,sc]}],"shadow-color":[{shadow:k()}],"inset-shadow":[{"inset-shadow":["none",h,ac,sc]}],"inset-shadow-color":[{"inset-shadow":k()}],"ring-w":[{ring:J()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:k()}],"ring-offset-w":[{"ring-offset":[$e,Ya]}],"ring-offset-color":[{"ring-offset":k()}],"inset-ring-w":[{"inset-ring":J()}],"inset-ring-color":[{"inset-ring":k()}],"text-shadow":[{"text-shadow":["none",m,ac,sc]}],"text-shadow-color":[{"text-shadow":k()}],opacity:[{opacity:[$e,xe,pe]}],"mix-blend":[{"mix-blend":[...X(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":X()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[$e]}],"mask-image-linear-from-pos":[{"mask-linear-from":D()}],"mask-image-linear-to-pos":[{"mask-linear-to":D()}],"mask-image-linear-from-color":[{"mask-linear-from":k()}],"mask-image-linear-to-color":[{"mask-linear-to":k()}],"mask-image-t-from-pos":[{"mask-t-from":D()}],"mask-image-t-to-pos":[{"mask-t-to":D()}],"mask-image-t-from-color":[{"mask-t-from":k()}],"mask-image-t-to-color":[{"mask-t-to":k()}],"mask-image-r-from-pos":[{"mask-r-from":D()}],"mask-image-r-to-pos":[{"mask-r-to":D()}],"mask-image-r-from-color":[{"mask-r-from":k()}],"mask-image-r-to-color":[{"mask-r-to":k()}],"mask-image-b-from-pos":[{"mask-b-from":D()}],"mask-image-b-to-pos":[{"mask-b-to":D()}],"mask-image-b-from-color":[{"mask-b-from":k()}],"mask-image-b-to-color":[{"mask-b-to":k()}],"mask-image-l-from-pos":[{"mask-l-from":D()}],"mask-image-l-to-pos":[{"mask-l-to":D()}],"mask-image-l-from-color":[{"mask-l-from":k()}],"mask-image-l-to-color":[{"mask-l-to":k()}],"mask-image-x-from-pos":[{"mask-x-from":D()}],"mask-image-x-to-pos":[{"mask-x-to":D()}],"mask-image-x-from-color":[{"mask-x-from":k()}],"mask-image-x-to-color":[{"mask-x-to":k()}],"mask-image-y-from-pos":[{"mask-y-from":D()}],"mask-image-y-to-pos":[{"mask-y-to":D()}],"mask-image-y-from-color":[{"mask-y-from":k()}],"mask-image-y-to-color":[{"mask-y-to":k()}],"mask-image-radial":[{"mask-radial":[xe,pe]}],"mask-image-radial-from-pos":[{"mask-radial-from":D()}],"mask-image-radial-to-pos":[{"mask-radial-to":D()}],"mask-image-radial-from-color":[{"mask-radial-from":k()}],"mask-image-radial-to-color":[{"mask-radial-to":k()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[$e]}],"mask-image-conic-from-pos":[{"mask-conic-from":D()}],"mask-image-conic-to-pos":[{"mask-conic-to":D()}],"mask-image-conic-from-color":[{"mask-conic-from":k()}],"mask-image-conic-to-color":[{"mask-conic-to":k()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:M()}],"mask-repeat":[{mask:K()}],"mask-size":[{mask:T()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",xe,pe]}],filter:[{filter:["","none",xe,pe]}],blur:[{blur:H()}],brightness:[{brightness:[$e,xe,pe]}],contrast:[{contrast:[$e,xe,pe]}],"drop-shadow":[{"drop-shadow":["","none",x,ac,sc]}],"drop-shadow-color":[{"drop-shadow":k()}],grayscale:[{grayscale:["",$e,xe,pe]}],"hue-rotate":[{"hue-rotate":[$e,xe,pe]}],invert:[{invert:["",$e,xe,pe]}],saturate:[{saturate:[$e,xe,pe]}],sepia:[{sepia:["",$e,xe,pe]}],"backdrop-filter":[{"backdrop-filter":["","none",xe,pe]}],"backdrop-blur":[{"backdrop-blur":H()}],"backdrop-brightness":[{"backdrop-brightness":[$e,xe,pe]}],"backdrop-contrast":[{"backdrop-contrast":[$e,xe,pe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",$e,xe,pe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[$e,xe,pe]}],"backdrop-invert":[{"backdrop-invert":["",$e,xe,pe]}],"backdrop-opacity":[{"backdrop-opacity":[$e,xe,pe]}],"backdrop-saturate":[{"backdrop-saturate":[$e,xe,pe]}],"backdrop-sepia":[{"backdrop-sepia":["",$e,xe,pe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":S()}],"border-spacing-x":[{"border-spacing-x":S()}],"border-spacing-y":[{"border-spacing-y":S()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",xe,pe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[$e,"initial",xe,pe]}],ease:[{ease:["linear","initial",g,xe,pe]}],delay:[{delay:[$e,xe,pe]}],animate:[{animate:["none",p,xe,pe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,xe,pe]}],"perspective-origin":[{"perspective-origin":N()}],rotate:[{rotate:te()}],"rotate-x":[{"rotate-x":te()}],"rotate-y":[{"rotate-y":te()}],"rotate-z":[{"rotate-z":te()}],scale:[{scale:se()}],"scale-x":[{"scale-x":se()}],"scale-y":[{"scale-y":se()}],"scale-z":[{"scale-z":se()}],"scale-3d":["scale-3d"],skew:[{skew:ye()}],"skew-x":[{"skew-x":ye()}],"skew-y":[{"skew-y":ye()}],transform:[{transform:[xe,pe,"","none","gpu","cpu"]}],"transform-origin":[{origin:N()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:re()}],"translate-x":[{"translate-x":re()}],"translate-y":[{"translate-y":re()}],"translate-z":[{"translate-z":re()}],"translate-none":["translate-none"],accent:[{accent:k()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:k()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",xe,pe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":S()}],"scroll-mx":[{"scroll-mx":S()}],"scroll-my":[{"scroll-my":S()}],"scroll-ms":[{"scroll-ms":S()}],"scroll-me":[{"scroll-me":S()}],"scroll-mt":[{"scroll-mt":S()}],"scroll-mr":[{"scroll-mr":S()}],"scroll-mb":[{"scroll-mb":S()}],"scroll-ml":[{"scroll-ml":S()}],"scroll-p":[{"scroll-p":S()}],"scroll-px":[{"scroll-px":S()}],"scroll-py":[{"scroll-py":S()}],"scroll-ps":[{"scroll-ps":S()}],"scroll-pe":[{"scroll-pe":S()}],"scroll-pt":[{"scroll-pt":S()}],"scroll-pr":[{"scroll-pr":S()}],"scroll-pb":[{"scroll-pb":S()}],"scroll-pl":[{"scroll-pl":S()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",xe,pe]}],fill:[{fill:["none",...k()]}],"stroke-w":[{stroke:[$e,si,Ya,Cf]}],stroke:[{stroke:["none",...k()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},SE=lE(kE);function le(...e){return SE(I0(e))}const CE=So("relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-lg border px-4 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground *:data-[slot=alert-description]:text-muted-foreground",info:"border-info/40 bg-info/10 text-info",success:"border-success/40 bg-success/10 text-success",warning:"border-warning/40 bg-warning/10 text-warning",destructive:"border-destructive/40 bg-destructive/10 text-destructive"}},defaultVariants:{variant:"default"}});function me({className:e,variant:t,...n}){return s.jsx("div",{"data-slot":"alert",role:"alert",className:le(CE({variant:t}),e),...n})}function je({className:e,...t}){return s.jsx("div",{"data-slot":"alert-title",className:le("col-start-2 min-h-4 font-medium tracking-tight",e),...t})}function ge({className:e,...t}){return s.jsx("div",{"data-slot":"alert-description",className:le("col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t})}function fe(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e==null||e(r),n===!1||!r.defaultPrevented)return t==null?void 0:t(r)}}function Nv(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ud(...e){return t=>{let n=!1;const a=e.map(r=>{const l=Nv(r,t);return!n&&typeof l=="function"&&(n=!0),l});if(n)return()=>{for(let r=0;r<a.length;r++){const l=a[r];typeof l=="function"?l():Nv(e[r],null)}}}}function Ke(...e){return u.useCallback(ud(...e),e)}function RE(e,t){const n=u.createContext(t),a=l=>{const{children:i,...o}=l,c=u.useMemo(()=>o,Object.values(o));return s.jsx(n.Provider,{value:c,children:i})};a.displayName=e+"Provider";function r(l){const i=u.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${l}\` must be used within \`${e}\``)}return[a,r]}function Cs(e,t=[]){let n=[];function a(l,i){const o=u.createContext(i),c=n.length;n=[...n,i];const d=h=>{var g;const{scope:m,children:x,...b}=h,v=((g=m==null?void 0:m[e])==null?void 0:g[c])||o,y=u.useMemo(()=>b,Object.values(b));return s.jsx(v.Provider,{value:y,children:x})};d.displayName=l+"Provider";function f(h,m){var v;const x=((v=m==null?void 0:m[e])==null?void 0:v[c])||o,b=u.useContext(x);if(b)return b;if(i!==void 0)return i;throw new Error(`\`${h}\` must be used within \`${l}\``)}return[d,f]}const r=()=>{const l=n.map(i=>u.createContext(i));return function(o){const c=(o==null?void 0:o[e])||l;return u.useMemo(()=>({[`__scope${e}`]:{...o,[e]:c}}),[o,c])}};return r.scopeName=e,[a,TE(r,...t)]}function TE(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const a=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(l){const i=a.reduce((o,{useScope:c,scopeName:d})=>{const h=c(l)[`__scope${d}`];return{...o,...h}},{});return u.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var Vt=globalThis!=null&&globalThis.document?u.useLayoutEffect:()=>{},EE=Iy[" useId ".trim().toString()]||(()=>{}),AE=0;function Jn(e){const[t,n]=u.useState(EE());return Vt(()=>{n(a=>a??String(AE++))},[e]),t?`radix-${t}`:""}var ME=Iy[" useInsertionEffect ".trim().toString()]||Vt;function Da({prop:e,defaultProp:t,onChange:n=()=>{},caller:a}){const[r,l,i]=$E({defaultProp:t,onChange:n}),o=e!==void 0,c=o?e:r;{const f=u.useRef(e!==void 0);u.useEffect(()=>{const h=f.current;h!==o&&console.warn(`${a} is changing from ${h?"controlled":"uncontrolled"} to ${o?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=o},[o,a])}const d=u.useCallback(f=>{var h;if(o){const m=OE(f)?f(e):f;m!==e&&((h=i.current)==null||h.call(i,m))}else l(f)},[o,e,l,i]);return[c,d]}function $E({defaultProp:e,onChange:t}){const[n,a]=u.useState(e),r=u.useRef(n),l=u.useRef(t);return ME(()=>{l.current=t},[t]),u.useEffect(()=>{var i;r.current!==n&&((i=l.current)==null||i.call(l,n),r.current=n)},[n,r]),[n,a,l]}function OE(e){return typeof e=="function"}function ur(e){const t=zE(e),n=u.forwardRef((a,r)=>{const{children:l,...i}=a,o=u.Children.toArray(l),c=o.find(UE);if(c){const d=c.props.children,f=o.map(h=>h===c?u.Children.count(d)>1?u.Children.only(null):u.isValidElement(d)?d.props.children:null:h);return s.jsx(t,{...i,ref:r,children:u.isValidElement(d)?u.cloneElement(d,void 0,f):null})}return s.jsx(t,{...i,ref:r,children:l})});return n.displayName=`${e}.Slot`,n}var DE=ur("Slot");function zE(e){const t=u.forwardRef((n,a)=>{const{children:r,...l}=n;if(u.isValidElement(r)){const i=HE(r),o=BE(l,r.props);return r.type!==u.Fragment&&(o.ref=a?ud(a,i):i),u.cloneElement(r,o)}return u.Children.count(r)>1?u.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Z0=Symbol("radix.slottable");function LE(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Z0,t}function UE(e){return u.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Z0}function BE(e,t){const n={...t};for(const a in t){const r=e[a],l=t[a];/^on[A-Z]/.test(a)?r&&l?n[a]=(...o)=>{const c=l(...o);return r(...o),c}:r&&(n[a]=r):a==="style"?n[a]={...r,...l}:a==="className"&&(n[a]=[r,l].filter(Boolean).join(" "))}return{...e,...n}}function HE(e){var a,r;let t=(a=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var IE=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Te=IE.reduce((e,t)=>{const n=ur(`Primitive.${t}`),a=u.forwardRef((r,l)=>{const{asChild:i,...o}=r,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...o,ref:l})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{});function J0(e,t){e&&Cl.flushSync(()=>e.dispatchEvent(t))}function _s(e){const t=u.useRef(e);return u.useEffect(()=>{t.current=e}),u.useMemo(()=>(...n)=>{var a;return(a=t.current)==null?void 0:a.call(t,...n)},[])}function PE(e,t=globalThis==null?void 0:globalThis.document){const n=_s(e);u.useEffect(()=>{const a=r=>{r.key==="Escape"&&n(r)};return t.addEventListener("keydown",a,{capture:!0}),()=>t.removeEventListener("keydown",a,{capture:!0})},[n,t])}var qE="DismissableLayer",Zh="dismissableLayer.update",GE="dismissableLayer.pointerDownOutside",VE="dismissableLayer.focusOutside",kv,ew=u.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Co=u.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:a,onPointerDownOutside:r,onFocusOutside:l,onInteractOutside:i,onDismiss:o,...c}=e,d=u.useContext(ew),[f,h]=u.useState(null),m=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=u.useState({}),b=Ke(t,_=>h(_)),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),g=v.indexOf(y),p=f?v.indexOf(f):-1,j=d.layersWithOutsidePointerEventsDisabled.size>0,w=p>=g,N=KE(_=>{const S=_.target,$=[...d.branches].some(O=>O.contains(S));!w||$||(r==null||r(_),i==null||i(_),_.defaultPrevented||o==null||o())},m),C=XE(_=>{const S=_.target;[...d.branches].some(O=>O.contains(S))||(l==null||l(_),i==null||i(_),_.defaultPrevented||o==null||o())},m);return PE(_=>{p===d.layers.size-1&&(a==null||a(_),!_.defaultPrevented&&o&&(_.preventDefault(),o()))},m),u.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(kv=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),Sv(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=kv)}},[f,m,n,d]),u.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),Sv())},[f,d]),u.useEffect(()=>{const _=()=>x({});return document.addEventListener(Zh,_),()=>document.removeEventListener(Zh,_)},[]),s.jsx(Te.div,{...c,ref:b,style:{pointerEvents:j?w?"auto":"none":void 0,...e.style},onFocusCapture:fe(e.onFocusCapture,C.onFocusCapture),onBlurCapture:fe(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:fe(e.onPointerDownCapture,N.onPointerDownCapture)})});Co.displayName=qE;var YE="DismissableLayerBranch",FE=u.forwardRef((e,t)=>{const n=u.useContext(ew),a=u.useRef(null),r=Ke(t,a);return u.useEffect(()=>{const l=a.current;if(l)return n.branches.add(l),()=>{n.branches.delete(l)}},[n.branches]),s.jsx(Te.div,{...e,ref:r})});FE.displayName=YE;function KE(e,t=globalThis==null?void 0:globalThis.document){const n=_s(e),a=u.useRef(!1),r=u.useRef(()=>{});return u.useEffect(()=>{const l=o=>{if(o.target&&!a.current){let c=function(){tw(GE,n,d,{discrete:!0})};const d={originalEvent:o};o.pointerType==="touch"?(t.removeEventListener("click",r.current),r.current=c,t.addEventListener("click",r.current,{once:!0})):c()}else t.removeEventListener("click",r.current);a.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",l)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",l),t.removeEventListener("click",r.current)}},[t,n]),{onPointerDownCapture:()=>a.current=!0}}function XE(e,t=globalThis==null?void 0:globalThis.document){const n=_s(e),a=u.useRef(!1);return u.useEffect(()=>{const r=l=>{l.target&&!a.current&&tw(VE,n,{originalEvent:l},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}function Sv(){const e=new CustomEvent(Zh);document.dispatchEvent(e)}function tw(e,t,n,{discrete:a}){const r=n.originalEvent.target,l=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),a?J0(r,l):r.dispatchEvent(l)}var Rf="focusScope.autoFocusOnMount",Tf="focusScope.autoFocusOnUnmount",Cv={bubbles:!1,cancelable:!0},QE="FocusScope",dd=u.forwardRef((e,t)=>{const{loop:n=!1,trapped:a=!1,onMountAutoFocus:r,onUnmountAutoFocus:l,...i}=e,[o,c]=u.useState(null),d=_s(r),f=_s(l),h=u.useRef(null),m=Ke(t,v=>c(v)),x=u.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;u.useEffect(()=>{if(a){let v=function(j){if(x.paused||!o)return;const w=j.target;o.contains(w)?h.current=w:ua(h.current,{select:!0})},y=function(j){if(x.paused||!o)return;const w=j.relatedTarget;w!==null&&(o.contains(w)||ua(h.current,{select:!0}))},g=function(j){if(document.activeElement===document.body)for(const N of j)N.removedNodes.length>0&&ua(o)};document.addEventListener("focusin",v),document.addEventListener("focusout",y);const p=new MutationObserver(g);return o&&p.observe(o,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",y),p.disconnect()}}},[a,o,x.paused]),u.useEffect(()=>{if(o){Tv.add(x);const v=document.activeElement;if(!o.contains(v)){const g=new CustomEvent(Rf,Cv);o.addEventListener(Rf,d),o.dispatchEvent(g),g.defaultPrevented||(WE(nA(nw(o)),{select:!0}),document.activeElement===v&&ua(o))}return()=>{o.removeEventListener(Rf,d),setTimeout(()=>{const g=new CustomEvent(Tf,Cv);o.addEventListener(Tf,f),o.dispatchEvent(g),g.defaultPrevented||ua(v??document.body,{select:!0}),o.removeEventListener(Tf,f),Tv.remove(x)},0)}}},[o,d,f,x]);const b=u.useCallback(v=>{if(!n&&!a||x.paused)return;const y=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,g=document.activeElement;if(y&&g){const p=v.currentTarget,[j,w]=ZE(p);j&&w?!v.shiftKey&&g===w?(v.preventDefault(),n&&ua(j,{select:!0})):v.shiftKey&&g===j&&(v.preventDefault(),n&&ua(w,{select:!0})):g===p&&v.preventDefault()}},[n,a,x.paused]);return s.jsx(Te.div,{tabIndex:-1,...i,ref:m,onKeyDown:b})});dd.displayName=QE;function WE(e,{select:t=!1}={}){const n=document.activeElement;for(const a of e)if(ua(a,{select:t}),document.activeElement!==n)return}function ZE(e){const t=nw(e),n=Rv(t,e),a=Rv(t.reverse(),e);return[n,a]}function nw(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const r=a.tagName==="INPUT"&&a.type==="hidden";return a.disabled||a.hidden||r?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Rv(e,t){for(const n of e)if(!JE(n,{upTo:t}))return n}function JE(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function eA(e){return e instanceof HTMLInputElement&&"select"in e}function ua(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&eA(e)&&t&&e.select()}}var Tv=tA();function tA(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Ev(e,t),e.unshift(t)},remove(t){var n;e=Ev(e,t),(n=e[0])==null||n.resume()}}}function Ev(e,t){const n=[...e],a=n.indexOf(t);return a!==-1&&n.splice(a,1),n}function nA(e){return e.filter(t=>t.tagName!=="A")}var sA="Portal",Ro=u.forwardRef((e,t)=>{var o;const{container:n,...a}=e,[r,l]=u.useState(!1);Vt(()=>l(!0),[]);const i=n||r&&((o=globalThis==null?void 0:globalThis.document)==null?void 0:o.body);return i?yS.createPortal(s.jsx(Te.div,{...a,ref:t}),i):null});Ro.displayName=sA;function aA(e,t){return u.useReducer((n,a)=>t[n][a]??n,e)}var Yn=e=>{const{present:t,children:n}=e,a=rA(t),r=typeof n=="function"?n({present:a.isPresent}):u.Children.only(n),l=Ke(a.ref,lA(r));return typeof n=="function"||a.isPresent?u.cloneElement(r,{ref:l}):null};Yn.displayName="Presence";function rA(e){const[t,n]=u.useState(),a=u.useRef(null),r=u.useRef(e),l=u.useRef("none"),i=e?"mounted":"unmounted",[o,c]=aA(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return u.useEffect(()=>{const d=rc(a.current);l.current=o==="mounted"?d:"none"},[o]),Vt(()=>{const d=a.current,f=r.current;if(f!==e){const m=l.current,x=rc(d);e?c("MOUNT"):x==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(f&&m!==x?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,c]),Vt(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,h=x=>{const v=rc(a.current).includes(x.animationName);if(x.target===t&&v&&(c("ANIMATION_END"),!r.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},m=x=>{x.target===t&&(l.current=rc(a.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(o),ref:u.useCallback(d=>{a.current=d?getComputedStyle(d):null,n(d)},[])}}function rc(e){return(e==null?void 0:e.animationName)||"none"}function lA(e){var a,r;let t=(a=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ef=0;function Tp(){u.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Av()),document.body.insertAdjacentElement("beforeend",e[1]??Av()),Ef++,()=>{Ef===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Ef--}},[])}function Av(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var fs=function(){return fs=Object.assign||function(t){for(var n,a=1,r=arguments.length;a<r;a++){n=arguments[a];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(t[l]=n[l])}return t},fs.apply(this,arguments)};function sw(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]]);return n}function iA(e,t,n){if(n||arguments.length===2)for(var a=0,r=t.length,l;a<r;a++)(l||!(a in t))&&(l||(l=Array.prototype.slice.call(t,0,a)),l[a]=t[a]);return e.concat(l||Array.prototype.slice.call(t))}var Mc="right-scroll-bar-position",$c="width-before-scroll-bar",oA="with-scroll-bars-hidden",cA="--removed-body-scroll-bar-size";function Af(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function uA(e,t){var n=u.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(a){var r=n.value;r!==a&&(n.value=a,n.callback(a,r))}}}})[0];return n.callback=t,n.facade}var dA=typeof window<"u"?u.useLayoutEffect:u.useEffect,Mv=new WeakMap;function fA(e,t){var n=uA(null,function(a){return e.forEach(function(r){return Af(r,a)})});return dA(function(){var a=Mv.get(n);if(a){var r=new Set(a),l=new Set(e),i=n.current;r.forEach(function(o){l.has(o)||Af(o,null)}),l.forEach(function(o){r.has(o)||Af(o,i)})}Mv.set(n,e)},[e]),n}function hA(e){return e}function mA(e,t){t===void 0&&(t=hA);var n=[],a=!1,r={read:function(){if(a)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(l){var i=t(l,a);return n.push(i),function(){n=n.filter(function(o){return o!==i})}},assignSyncMedium:function(l){for(a=!0;n.length;){var i=n;n=[],i.forEach(l)}n={push:function(o){return l(o)},filter:function(){return n}}},assignMedium:function(l){a=!0;var i=[];if(n.length){var o=n;n=[],o.forEach(l),i=n}var c=function(){var f=i;i=[],f.forEach(l)},d=function(){return Promise.resolve().then(c)};d(),n={push:function(f){i.push(f),d()},filter:function(f){return i=i.filter(f),n}}}};return r}function pA(e){e===void 0&&(e={});var t=mA(null);return t.options=fs({async:!0,ssr:!1},e),t}var aw=function(e){var t=e.sideCar,n=sw(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=t.read();if(!a)throw new Error("Sidecar medium not found");return u.createElement(a,fs({},n))};aw.isSideCarExport=!0;function xA(e,t){return e.useMedium(t),aw}var rw=pA(),Mf=function(){},fd=u.forwardRef(function(e,t){var n=u.useRef(null),a=u.useState({onScrollCapture:Mf,onWheelCapture:Mf,onTouchMoveCapture:Mf}),r=a[0],l=a[1],i=e.forwardProps,o=e.children,c=e.className,d=e.removeScrollBar,f=e.enabled,h=e.shards,m=e.sideCar,x=e.noRelative,b=e.noIsolation,v=e.inert,y=e.allowPinchZoom,g=e.as,p=g===void 0?"div":g,j=e.gapMode,w=sw(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),N=m,C=fA([n,t]),_=fs(fs({},w),r);return u.createElement(u.Fragment,null,f&&u.createElement(N,{sideCar:rw,removeScrollBar:d,shards:h,noRelative:x,noIsolation:b,inert:v,setCallbacks:l,allowPinchZoom:!!y,lockRef:n,gapMode:j}),i?u.cloneElement(u.Children.only(o),fs(fs({},_),{ref:C})):u.createElement(p,fs({},_,{className:c,ref:C}),o))});fd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};fd.classNames={fullWidth:$c,zeroRight:Mc};var gA=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function vA(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=gA();return t&&e.setAttribute("nonce",t),e}function yA(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function jA(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var bA=function(){var e=0,t=null;return{add:function(n){e==0&&(t=vA())&&(yA(t,n),jA(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},wA=function(){var e=bA();return function(t,n){u.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},lw=function(){var e=wA(),t=function(n){var a=n.styles,r=n.dynamic;return e(a,r),null};return t},_A={left:0,top:0,right:0,gap:0},$f=function(e){return parseInt(e||"",10)||0},NA=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],a=t[e==="padding"?"paddingTop":"marginTop"],r=t[e==="padding"?"paddingRight":"marginRight"];return[$f(n),$f(a),$f(r)]},kA=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return _A;var t=NA(e),n=document.documentElement.clientWidth,a=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,a-n+t[2]-t[0])}},SA=lw(),rl="data-scroll-locked",CA=function(e,t,n,a){var r=e.left,l=e.top,i=e.right,o=e.gap;return n===void 0&&(n="margin"),`
345
+ .`.concat(oA,` {
346
+ overflow: hidden `).concat(a,`;
347
+ padding-right: `).concat(o,"px ").concat(a,`;
348
+ }
349
+ body[`).concat(rl,`] {
350
+ overflow: hidden `).concat(a,`;
351
+ overscroll-behavior: contain;
352
+ `).concat([t&&"position: relative ".concat(a,";"),n==="margin"&&`
353
+ padding-left: `.concat(r,`px;
354
+ padding-top: `).concat(l,`px;
355
+ padding-right: `).concat(i,`px;
356
+ margin-left:0;
357
+ margin-top:0;
358
+ margin-right: `).concat(o,"px ").concat(a,`;
359
+ `),n==="padding"&&"padding-right: ".concat(o,"px ").concat(a,";")].filter(Boolean).join(""),`
360
+ }
361
+
362
+ .`).concat(Mc,` {
363
+ right: `).concat(o,"px ").concat(a,`;
364
+ }
365
+
366
+ .`).concat($c,` {
367
+ margin-right: `).concat(o,"px ").concat(a,`;
368
+ }
369
+
370
+ .`).concat(Mc," .").concat(Mc,` {
371
+ right: 0 `).concat(a,`;
372
+ }
373
+
374
+ .`).concat($c," .").concat($c,` {
375
+ margin-right: 0 `).concat(a,`;
376
+ }
377
+
378
+ body[`).concat(rl,`] {
379
+ `).concat(cA,": ").concat(o,`px;
380
+ }
381
+ `)},$v=function(){var e=parseInt(document.body.getAttribute(rl)||"0",10);return isFinite(e)?e:0},RA=function(){u.useEffect(function(){return document.body.setAttribute(rl,($v()+1).toString()),function(){var e=$v()-1;e<=0?document.body.removeAttribute(rl):document.body.setAttribute(rl,e.toString())}},[])},TA=function(e){var t=e.noRelative,n=e.noImportant,a=e.gapMode,r=a===void 0?"margin":a;RA();var l=u.useMemo(function(){return kA(r)},[r]);return u.createElement(SA,{styles:CA(l,!t,r,n?"":"!important")})},Jh=!1;if(typeof window<"u")try{var lc=Object.defineProperty({},"passive",{get:function(){return Jh=!0,!0}});window.addEventListener("test",lc,lc),window.removeEventListener("test",lc,lc)}catch{Jh=!1}var Cr=Jh?{passive:!1}:!1,EA=function(e){return e.tagName==="TEXTAREA"},iw=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!EA(e)&&n[t]==="visible")},AA=function(e){return iw(e,"overflowY")},MA=function(e){return iw(e,"overflowX")},Ov=function(e,t){var n=t.ownerDocument,a=t;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var r=ow(e,a);if(r){var l=cw(e,a),i=l[1],o=l[2];if(i>o)return!0}a=a.parentNode}while(a&&a!==n.body);return!1},$A=function(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;return[t,n,a]},OA=function(e){var t=e.scrollLeft,n=e.scrollWidth,a=e.clientWidth;return[t,n,a]},ow=function(e,t){return e==="v"?AA(t):MA(t)},cw=function(e,t){return e==="v"?$A(t):OA(t)},DA=function(e,t){return e==="h"&&t==="rtl"?-1:1},zA=function(e,t,n,a,r){var l=DA(e,window.getComputedStyle(t).direction),i=l*a,o=n.target,c=t.contains(o),d=!1,f=i>0,h=0,m=0;do{if(!o)break;var x=cw(e,o),b=x[0],v=x[1],y=x[2],g=v-y-l*b;(b||g)&&ow(e,o)&&(h+=g,m+=b);var p=o.parentNode;o=p&&p.nodeType===Node.DOCUMENT_FRAGMENT_NODE?p.host:p}while(!c&&o!==document.body||c&&(t.contains(o)||t===o));return(f&&Math.abs(h)<1||!f&&Math.abs(m)<1)&&(d=!0),d},ic=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Dv=function(e){return[e.deltaX,e.deltaY]},zv=function(e){return e&&"current"in e?e.current:e},LA=function(e,t){return e[0]===t[0]&&e[1]===t[1]},UA=function(e){return`
382
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
383
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
384
+ `)},BA=0,Rr=[];function HA(e){var t=u.useRef([]),n=u.useRef([0,0]),a=u.useRef(),r=u.useState(BA++)[0],l=u.useState(lw)[0],i=u.useRef(e);u.useEffect(function(){i.current=e},[e]),u.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var v=iA([e.lockRef.current],(e.shards||[]).map(zv),!0).filter(Boolean);return v.forEach(function(y){return y.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),v.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var o=u.useCallback(function(v,y){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!i.current.allowPinchZoom;var g=ic(v),p=n.current,j="deltaX"in v?v.deltaX:p[0]-g[0],w="deltaY"in v?v.deltaY:p[1]-g[1],N,C=v.target,_=Math.abs(j)>Math.abs(w)?"h":"v";if("touches"in v&&_==="h"&&C.type==="range")return!1;var S=Ov(_,C);if(!S)return!0;if(S?N=_:(N=_==="v"?"h":"v",S=Ov(_,C)),!S)return!1;if(!a.current&&"changedTouches"in v&&(j||w)&&(a.current=N),!N)return!0;var $=a.current||N;return zA($,y,v,$==="h"?j:w)},[]),c=u.useCallback(function(v){var y=v;if(!(!Rr.length||Rr[Rr.length-1]!==l)){var g="deltaY"in y?Dv(y):ic(y),p=t.current.filter(function(N){return N.name===y.type&&(N.target===y.target||y.target===N.shadowParent)&&LA(N.delta,g)})[0];if(p&&p.should){y.cancelable&&y.preventDefault();return}if(!p){var j=(i.current.shards||[]).map(zv).filter(Boolean).filter(function(N){return N.contains(y.target)}),w=j.length>0?o(y,j[0]):!i.current.noIsolation;w&&y.cancelable&&y.preventDefault()}}},[]),d=u.useCallback(function(v,y,g,p){var j={name:v,delta:y,target:g,should:p,shadowParent:IA(g)};t.current.push(j),setTimeout(function(){t.current=t.current.filter(function(w){return w!==j})},1)},[]),f=u.useCallback(function(v){n.current=ic(v),a.current=void 0},[]),h=u.useCallback(function(v){d(v.type,Dv(v),v.target,o(v,e.lockRef.current))},[]),m=u.useCallback(function(v){d(v.type,ic(v),v.target,o(v,e.lockRef.current))},[]);u.useEffect(function(){return Rr.push(l),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:m}),document.addEventListener("wheel",c,Cr),document.addEventListener("touchmove",c,Cr),document.addEventListener("touchstart",f,Cr),function(){Rr=Rr.filter(function(v){return v!==l}),document.removeEventListener("wheel",c,Cr),document.removeEventListener("touchmove",c,Cr),document.removeEventListener("touchstart",f,Cr)}},[]);var x=e.removeScrollBar,b=e.inert;return u.createElement(u.Fragment,null,b?u.createElement(l,{styles:UA(r)}):null,x?u.createElement(TA,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function IA(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const PA=xA(rw,HA);var hd=u.forwardRef(function(e,t){return u.createElement(fd,fs({},e,{ref:t,sideCar:PA}))});hd.classNames=fd.classNames;var qA=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Tr=new WeakMap,oc=new WeakMap,cc={},Of=0,uw=function(e){return e&&(e.host||uw(e.parentNode))},GA=function(e,t){return t.map(function(n){if(e.contains(n))return n;var a=uw(n);return a&&e.contains(a)?a:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},VA=function(e,t,n,a){var r=GA(t,Array.isArray(e)?e:[e]);cc[n]||(cc[n]=new WeakMap);var l=cc[n],i=[],o=new Set,c=new Set(r),d=function(h){!h||o.has(h)||(o.add(h),d(h.parentNode))};r.forEach(d);var f=function(h){!h||c.has(h)||Array.prototype.forEach.call(h.children,function(m){if(o.has(m))f(m);else try{var x=m.getAttribute(a),b=x!==null&&x!=="false",v=(Tr.get(m)||0)+1,y=(l.get(m)||0)+1;Tr.set(m,v),l.set(m,y),i.push(m),v===1&&b&&oc.set(m,!0),y===1&&m.setAttribute(n,"true"),b||m.setAttribute(a,"true")}catch(g){console.error("aria-hidden: cannot operate on ",m,g)}})};return f(t),o.clear(),Of++,function(){i.forEach(function(h){var m=Tr.get(h)-1,x=l.get(h)-1;Tr.set(h,m),l.set(h,x),m||(oc.has(h)||h.removeAttribute(a),oc.delete(h)),x||h.removeAttribute(n)}),Of--,Of||(Tr=new WeakMap,Tr=new WeakMap,oc=new WeakMap,cc={})}},Ep=function(e,t,n){n===void 0&&(n="data-aria-hidden");var a=Array.from(Array.isArray(e)?e:[e]),r=qA(e);return r?(a.push.apply(a,Array.from(r.querySelectorAll("[aria-live], script"))),VA(a,r,n,"aria-hidden")):function(){return null}},md="Dialog",[dw]=Cs(md),[YA,is]=dw(md),fw=e=>{const{__scopeDialog:t,children:n,open:a,defaultOpen:r,onOpenChange:l,modal:i=!0}=e,o=u.useRef(null),c=u.useRef(null),[d,f]=Da({prop:a,defaultProp:r??!1,onChange:l,caller:md});return s.jsx(YA,{scope:t,triggerRef:o,contentRef:c,contentId:Jn(),titleId:Jn(),descriptionId:Jn(),open:d,onOpenChange:f,onOpenToggle:u.useCallback(()=>f(h=>!h),[f]),modal:i,children:n})};fw.displayName=md;var hw="DialogTrigger",FA=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=is(hw,n),l=Ke(t,r.triggerRef);return s.jsx(Te.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":$p(r.open),...a,ref:l,onClick:fe(e.onClick,r.onOpenToggle)})});FA.displayName=hw;var Ap="DialogPortal",[KA,mw]=dw(Ap,{forceMount:void 0}),pw=e=>{const{__scopeDialog:t,forceMount:n,children:a,container:r}=e,l=is(Ap,t);return s.jsx(KA,{scope:t,forceMount:n,children:u.Children.map(a,i=>s.jsx(Yn,{present:n||l.open,children:s.jsx(Ro,{asChild:!0,container:r,children:i})}))})};pw.displayName=Ap;var yu="DialogOverlay",xw=u.forwardRef((e,t)=>{const n=mw(yu,e.__scopeDialog),{forceMount:a=n.forceMount,...r}=e,l=is(yu,e.__scopeDialog);return l.modal?s.jsx(Yn,{present:a||l.open,children:s.jsx(QA,{...r,ref:t})}):null});xw.displayName=yu;var XA=ur("DialogOverlay.RemoveScroll"),QA=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=is(yu,n);return s.jsx(hd,{as:XA,allowPinchZoom:!0,shards:[r.contentRef],children:s.jsx(Te.div,{"data-state":$p(r.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),dr="DialogContent",gw=u.forwardRef((e,t)=>{const n=mw(dr,e.__scopeDialog),{forceMount:a=n.forceMount,...r}=e,l=is(dr,e.__scopeDialog);return s.jsx(Yn,{present:a||l.open,children:l.modal?s.jsx(WA,{...r,ref:t}):s.jsx(ZA,{...r,ref:t})})});gw.displayName=dr;var WA=u.forwardRef((e,t)=>{const n=is(dr,e.__scopeDialog),a=u.useRef(null),r=Ke(t,n.contentRef,a);return u.useEffect(()=>{const l=a.current;if(l)return Ep(l)},[]),s.jsx(vw,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:fe(e.onCloseAutoFocus,l=>{var i;l.preventDefault(),(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:fe(e.onPointerDownOutside,l=>{const i=l.detail.originalEvent,o=i.button===0&&i.ctrlKey===!0;(i.button===2||o)&&l.preventDefault()}),onFocusOutside:fe(e.onFocusOutside,l=>l.preventDefault())})}),ZA=u.forwardRef((e,t)=>{const n=is(dr,e.__scopeDialog),a=u.useRef(!1),r=u.useRef(!1);return s.jsx(vw,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{var i,o;(i=e.onCloseAutoFocus)==null||i.call(e,l),l.defaultPrevented||(a.current||(o=n.triggerRef.current)==null||o.focus(),l.preventDefault()),a.current=!1,r.current=!1},onInteractOutside:l=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,l),l.defaultPrevented||(a.current=!0,l.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const i=l.target;((d=n.triggerRef.current)==null?void 0:d.contains(i))&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&r.current&&l.preventDefault()}})}),vw=u.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:a,onOpenAutoFocus:r,onCloseAutoFocus:l,...i}=e,o=is(dr,n),c=u.useRef(null),d=Ke(t,c);return Tp(),s.jsxs(s.Fragment,{children:[s.jsx(dd,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:r,onUnmountAutoFocus:l,children:s.jsx(Co,{role:"dialog",id:o.contentId,"aria-describedby":o.descriptionId,"aria-labelledby":o.titleId,"data-state":$p(o.open),...i,ref:d,onDismiss:()=>o.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(JA,{titleId:o.titleId}),s.jsx(tM,{contentRef:c,descriptionId:o.descriptionId})]})]})}),Mp="DialogTitle",yw=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=is(Mp,n);return s.jsx(Te.h2,{id:r.titleId,...a,ref:t})});yw.displayName=Mp;var jw="DialogDescription",bw=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=is(jw,n);return s.jsx(Te.p,{id:r.descriptionId,...a,ref:t})});bw.displayName=jw;var ww="DialogClose",_w=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=is(ww,n);return s.jsx(Te.button,{type:"button",...a,ref:t,onClick:fe(e.onClick,()=>r.onOpenChange(!1))})});_w.displayName=ww;function $p(e){return e?"open":"closed"}var Nw="DialogTitleWarning",[F5,kw]=RE(Nw,{contentName:dr,titleName:Mp,docsSlug:"dialog"}),JA=({titleId:e})=>{const t=kw(Nw),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
385
+
386
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
387
+
388
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return u.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},eM="DialogDescriptionWarning",tM=({contentRef:e,descriptionId:t})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${kw(eM).contentName}}.`;return u.useEffect(()=>{var l;const r=(l=e.current)==null?void 0:l.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(a))},[a,e,t]),null},Sw=fw,Cw=pw,Rw=xw,Tw=gw,Ew=yw,Aw=bw,Op=_w;function Qt({className:e,...t}){return s.jsx(eT,{role:"status","aria-label":"Loading",className:le("size-4 animate-spin",e),...t})}const ll="aria-pressed:border aria-pressed:border-primary aria-pressed:bg-accent aria-pressed:text-accent-foreground",nM="border border-primary bg-accent text-accent-foreground hover:bg-accent",pd=So("inline-flex items-center justify-center whitespace-nowrap rounded-md font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",warning:"bg-warning text-warning-foreground hover:bg-warning/90",success:"bg-success text-success-foreground hover:bg-success/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline",text:"underline-offset-2 hover:underline"},size:{"inline-sm":"p-1 text-sm",inline:"p-1 text-base",default:"h-9 px-4 py-2 text-sm",sm:"h-8 px-3 text-sm",control:"h-7 px-2 text-xs",lg:"h-10 px-6 text-base",icon:"size-9 text-sm","sm-icon":"size-8 text-sm","control-icon":"size-7 text-xs","xs-icon":"size-6 text-xs"}},defaultVariants:{variant:"default",size:"default"}}),P=u.forwardRef(({className:e,disabled:t,variant:n,size:a,asChild:r=!1,loading:l,children:i,...o},c)=>{const d=r?DE:"button",f=a==="icon"||a==="sm-icon"||a==="control-icon"||a==="xs-icon",h=s.jsx(Qt,{"aria-hidden":"true","aria-label":void 0,role:void 0,className:le(!f&&"mr-2")}),m=r?i:l&&f?h:s.jsxs(s.Fragment,{children:[l?h:null,i]});return s.jsx(d,{className:le(pd({variant:n,size:a,className:e})),ref:c,disabled:t||l,...o,children:m})});P.displayName="Button";const Mw=u.createContext(null);function sM({container:e,children:t}){return s.jsx(Mw.Provider,{value:e,children:t})}function To(){return u.useContext(Mw)??void 0}function Dp(e){return s.jsx(Sw,{"data-slot":"alert-dialog",...e})}function aM({className:e,...t}){return s.jsx(Rw,{"data-slot":"alert-dialog-overlay",className:le("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function zp({className:e,onOpenAutoFocus:t,onPointerDownOutside:n,onInteractOutside:a,...r}){return s.jsxs(Cw,{container:To(),children:[s.jsx(aM,{}),s.jsx(Tw,{"data-slot":"alert-dialog-content",role:"alertdialog",className:le("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",e),onOpenAutoFocus:l=>{if(t==null||t(l),l.defaultPrevented)return;const i=l.currentTarget,o=i instanceof HTMLElement?i.querySelector('[data-slot="alert-dialog-cancel"]'):null;o&&(l.preventDefault(),o.focus())},onPointerDownOutside:l=>{n==null||n(l),l.preventDefault()},onInteractOutside:l=>{a==null||a(l),l.preventDefault()},...r})]})}function Lp({className:e,...t}){return s.jsx("div",{"data-slot":"alert-dialog-header",className:le("flex flex-col gap-2 text-center sm:text-left",e),...t})}function Up({className:e,...t}){return s.jsx("div",{"data-slot":"alert-dialog-footer",className:le("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function Bp({className:e,...t}){return s.jsx(Ew,{"data-slot":"alert-dialog-title",className:le("text-lg font-semibold",e),...t})}function Hp({className:e,...t}){return s.jsx(Aw,{"data-slot":"alert-dialog-description",className:le("text-muted-foreground text-sm",e),...t})}function $w({className:e,variant:t,...n}){return s.jsx(Op,{"data-slot":"alert-dialog-action",className:le(pd({variant:t}),e),...n})}function Ip({className:e,...t}){return s.jsx(Op,{"data-slot":"alert-dialog-cancel",className:le(pd({variant:"outline"}),e),...t})}function rM(){if(typeof document>"u")return null;const e=document.activeElement;if(!(e instanceof HTMLElement)||e===document.body)return null;const t=e.closest('[role="menu"]');if(t!=null&&t.id){const n=document.querySelector(`[aria-controls="${CSS.escape(t.id)}"]`);if(n)return n}return e}function lM(e,t){t!=null&&t.isConnected&&(e.preventDefault(),t.focus())}function Eo(){const[e,t]=u.useState(null),n=u.useRef(null),a=u.useRef(null),r=u.useCallback(o=>{var c;(c=n.current)==null||c.resolve(o),n.current=null,t(null)},[]),l=u.useCallback(o=>new Promise(c=>{var f;(f=n.current)==null||f.resolve(!1),a.current=rM();const d={...o,resolve:c};n.current=d,t(d)}),[]);u.useEffect(()=>()=>{var o;return(o=n.current)==null?void 0:o.resolve(!1)},[]);const i=s.jsx(Dp,{open:e!==null,onOpenChange:o=>{o||r(!1)},children:s.jsxs(zp,{onCloseAutoFocus:o=>lM(o,a.current),children:[s.jsxs(Lp,{children:[s.jsx(Bp,{children:e==null?void 0:e.title}),s.jsx(Hp,{className:"whitespace-pre-line",children:e==null?void 0:e.description})]}),s.jsxs(Up,{children:[s.jsx(Ip,{children:"Cancel"}),s.jsx($w,{variant:e!=null&&e.destructive?"destructive":"default",onClick:()=>r(!0),children:e==null?void 0:e.action_label})]})]})});return{confirm:l,confirm_dialog:i}}const Os="px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",iM=So("inline-flex items-center rounded-md border transition-colors",{variants:{variant:{default:`${Os} border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80`,secondary:`${Os} border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`${Os} border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80`,outline:`${Os} text-foreground`,success:`${Os} border-success/40 bg-success/10 text-success`,warning:`${Os} border-warning/40 bg-warning/10 text-warning`,info:`${Os} border-info/40 bg-info/10 text-info`,error:`${Os} border-destructive/40 bg-destructive/10 text-destructive`,neutral:`${Os} border-border bg-muted text-muted-foreground`,count:"h-5 min-w-5 justify-center border-transparent bg-primary px-1 text-2xs font-medium tabular-nums text-primary-foreground"},size:{default:"",dense:"px-1.5 py-0.5 text-2xs font-medium"}},defaultVariants:{variant:"default",size:"default"}});function ce({className:e,variant:t,size:n,...a}){return s.jsx("div",{className:le(iM({variant:t,size:n}),e),...a})}function Ow(e){const t=u.useRef({value:e,previous:e});return u.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function Dw(e){const[t,n]=u.useState(void 0);return Vt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const a=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const l=r[0];let i,o;if("borderBoxSize"in l){const c=l.borderBoxSize,d=Array.isArray(c)?c[0]:c;i=d.inlineSize,o=d.blockSize}else i=e.offsetWidth,o=e.offsetHeight;n({width:i,height:o})});return a.observe(e,{box:"border-box"}),()=>a.unobserve(e)}else n(void 0)},[e]),t}var xd="Checkbox",[oM]=Cs(xd),[cM,Pp]=oM(xd);function uM(e){const{__scopeCheckbox:t,checked:n,children:a,defaultChecked:r,disabled:l,form:i,name:o,onCheckedChange:c,required:d,value:f="on",internal_do_not_use_render:h}=e,[m,x]=Da({prop:n,defaultProp:r??!1,onChange:c,caller:xd}),[b,v]=u.useState(null),[y,g]=u.useState(null),p=u.useRef(!1),j=b?!!i||!!b.closest("form"):!0,w={checked:m,disabled:l,setChecked:x,control:b,setControl:v,name:o,form:i,value:f,hasConsumerStoppedPropagationRef:p,required:d,defaultChecked:Aa(r)?!1:r,isFormControl:j,bubbleInput:y,setBubbleInput:g};return s.jsx(cM,{scope:t,...w,children:dM(h)?h(w):a})}var zw="CheckboxTrigger",Lw=u.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...a},r)=>{const{control:l,value:i,disabled:o,checked:c,required:d,setControl:f,setChecked:h,hasConsumerStoppedPropagationRef:m,isFormControl:x,bubbleInput:b}=Pp(zw,e),v=Ke(r,f),y=u.useRef(c);return u.useEffect(()=>{const g=l==null?void 0:l.form;if(g){const p=()=>h(y.current);return g.addEventListener("reset",p),()=>g.removeEventListener("reset",p)}},[l,h]),s.jsx(Te.button,{type:"button",role:"checkbox","aria-checked":Aa(c)?"mixed":c,"aria-required":d,"data-state":Pw(c),"data-disabled":o?"":void 0,disabled:o,value:i,...a,ref:v,onKeyDown:fe(t,g=>{g.key==="Enter"&&g.preventDefault()}),onClick:fe(n,g=>{h(p=>Aa(p)?!0:!p),b&&x&&(m.current=g.isPropagationStopped(),m.current||g.stopPropagation())})})});Lw.displayName=zw;var qp=u.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:a,checked:r,defaultChecked:l,required:i,disabled:o,value:c,onCheckedChange:d,form:f,...h}=e;return s.jsx(uM,{__scopeCheckbox:n,checked:r,defaultChecked:l,disabled:o,required:i,onCheckedChange:d,name:a,form:f,value:c,internal_do_not_use_render:({isFormControl:m})=>s.jsxs(s.Fragment,{children:[s.jsx(Lw,{...h,ref:t,__scopeCheckbox:n}),m&&s.jsx(Iw,{__scopeCheckbox:n})]})})});qp.displayName=xd;var Uw="CheckboxIndicator",Bw=u.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:a,...r}=e,l=Pp(Uw,n);return s.jsx(Yn,{present:a||Aa(l.checked)||l.checked===!0,children:s.jsx(Te.span,{"data-state":Pw(l.checked),"data-disabled":l.disabled?"":void 0,...r,ref:t,style:{pointerEvents:"none",...e.style}})})});Bw.displayName=Uw;var Hw="CheckboxBubbleInput",Iw=u.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:a,hasConsumerStoppedPropagationRef:r,checked:l,defaultChecked:i,required:o,disabled:c,name:d,value:f,form:h,bubbleInput:m,setBubbleInput:x}=Pp(Hw,e),b=Ke(n,x),v=Ow(l),y=Dw(a);u.useEffect(()=>{const p=m;if(!p)return;const j=window.HTMLInputElement.prototype,N=Object.getOwnPropertyDescriptor(j,"checked").set,C=!r.current;if(v!==l&&N){const _=new Event("click",{bubbles:C});p.indeterminate=Aa(l),N.call(p,Aa(l)?!1:l),p.dispatchEvent(_)}},[m,v,l,r]);const g=u.useRef(Aa(l)?!1:l);return s.jsx(Te.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??g.current,required:o,disabled:c,name:d,value:f,form:h,...t,tabIndex:-1,ref:b,style:{...t.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Iw.displayName=Hw;function dM(e){return typeof e=="function"}function Aa(e){return e==="indeterminate"}function Pw(e){return Aa(e)?"indeterminate":e?"checked":"unchecked"}const Ul=u.forwardRef(({className:e,...t},n)=>s.jsx(qp,{ref:n,className:le("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=indeterminate]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:text-primary-foreground",e),...t,children:s.jsx(Bw,{className:le("flex items-center justify-center text-current"),children:t.checked==="indeterminate"?s.jsx(lT,{className:"size-4","aria-hidden":"true"}):s.jsx(Ol,{className:"size-4","aria-hidden":"true"})})}));Ul.displayName=qp.displayName;const fM=So("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid max-h-[calc(100dvh-2rem)] w-full max-w-[calc(100%-2rem)] overflow-y-auto translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200",{variants:{size:{sm:"sm:max-w-sm",md:"sm:max-w-lg",lg:"sm:max-w-2xl",xl:"sm:max-w-4xl","2xl":"sm:max-w-6xl",full:"sm:max-w-[calc(100%-2rem)]"}},defaultVariants:{size:"md"}});function dn({...e}){return s.jsx(Sw,{"data-slot":"dialog",...e})}function hM({...e}){const t=To();return s.jsx(Cw,{"data-slot":"dialog-portal",container:t,...e})}function mM({className:e,...t}){return s.jsx(Rw,{"data-slot":"dialog-overlay",className:le("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function fn({className:e,children:t,showCloseButton:n=!0,size:a,...r}){return s.jsxs(hM,{"data-slot":"dialog-portal",children:[s.jsx(mM,{}),s.jsxs(Tw,{"data-slot":"dialog-content",className:le(fM({size:a}),e),...r,children:[t,n&&s.jsxs(Op,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground text-muted-foreground hover:text-foreground absolute top-4 right-4 rounded-xs transition-colors focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[s.jsx(od,{}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function hn({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-header",className:le("flex flex-col gap-2 text-center sm:text-left",e),...t})}function mn({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-footer",className:le("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function pn({className:e,...t}){return s.jsx(Ew,{"data-slot":"dialog-title",className:le("text-lg leading-none font-semibold",e),...t})}function xn({className:e,...t}){return s.jsx(Aw,{"data-slot":"dialog-description",className:le("text-muted-foreground text-sm",e),...t})}function Gp(e){const t=e+"CollectionProvider",[n,a]=Cs(t),[r,l]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=v=>{const{scope:y,children:g}=v,p=oa.useRef(null),j=oa.useRef(new Map).current;return s.jsx(r,{scope:y,itemMap:j,collectionRef:p,children:g})};i.displayName=t;const o=e+"CollectionSlot",c=ur(o),d=oa.forwardRef((v,y)=>{const{scope:g,children:p}=v,j=l(o,g),w=Ke(y,j.collectionRef);return s.jsx(c,{ref:w,children:p})});d.displayName=o;const f=e+"CollectionItemSlot",h="data-radix-collection-item",m=ur(f),x=oa.forwardRef((v,y)=>{const{scope:g,children:p,...j}=v,w=oa.useRef(null),N=Ke(y,w),C=l(f,g);return oa.useEffect(()=>(C.itemMap.set(w,{ref:w,...j}),()=>void C.itemMap.delete(w))),s.jsx(m,{[h]:"",ref:N,children:p})});x.displayName=f;function b(v){const y=l(e+"CollectionConsumer",v);return oa.useCallback(()=>{const p=y.collectionRef.current;if(!p)return[];const j=Array.from(p.querySelectorAll(`[${h}]`));return Array.from(y.itemMap.values()).sort((C,_)=>j.indexOf(C.ref.current)-j.indexOf(_.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:i,Slot:d,ItemSlot:x},b,a]}var pM=u.createContext(void 0);function gd(e){const t=u.useContext(pM);return e||t||"ltr"}const xM=["top","right","bottom","left"],za=Math.min,wn=Math.max,ju=Math.round,uc=Math.floor,js=e=>({x:e,y:e}),gM={left:"right",right:"left",bottom:"top",top:"bottom"},vM={start:"end",end:"start"};function em(e,t,n){return wn(e,za(t,n))}function Xs(e,t){return typeof e=="function"?e(t):e}function Qs(e){return e.split("-")[0]}function Bl(e){return e.split("-")[1]}function Vp(e){return e==="x"?"y":"x"}function Yp(e){return e==="y"?"height":"width"}function ps(e){return["top","bottom"].includes(Qs(e))?"y":"x"}function Fp(e){return Vp(ps(e))}function yM(e,t,n){n===void 0&&(n=!1);const a=Bl(e),r=Fp(e),l=Yp(r);let i=r==="x"?a===(n?"end":"start")?"right":"left":a==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(i=bu(i)),[i,bu(i)]}function jM(e){const t=bu(e);return[tm(e),t,tm(t)]}function tm(e){return e.replace(/start|end/g,t=>vM[t])}function bM(e,t,n){const a=["left","right"],r=["right","left"],l=["top","bottom"],i=["bottom","top"];switch(e){case"top":case"bottom":return n?t?r:a:t?a:r;case"left":case"right":return t?l:i;default:return[]}}function wM(e,t,n,a){const r=Bl(e);let l=bM(Qs(e),n==="start",a);return r&&(l=l.map(i=>i+"-"+r),t&&(l=l.concat(l.map(tm)))),l}function bu(e){return e.replace(/left|right|bottom|top/g,t=>gM[t])}function _M(e){return{top:0,right:0,bottom:0,left:0,...e}}function qw(e){return typeof e!="number"?_M(e):{top:e,right:e,bottom:e,left:e}}function wu(e){const{x:t,y:n,width:a,height:r}=e;return{width:a,height:r,top:n,left:t,right:t+a,bottom:n+r,x:t,y:n}}function Lv(e,t,n){let{reference:a,floating:r}=e;const l=ps(t),i=Fp(t),o=Yp(i),c=Qs(t),d=l==="y",f=a.x+a.width/2-r.width/2,h=a.y+a.height/2-r.height/2,m=a[o]/2-r[o]/2;let x;switch(c){case"top":x={x:f,y:a.y-r.height};break;case"bottom":x={x:f,y:a.y+a.height};break;case"right":x={x:a.x+a.width,y:h};break;case"left":x={x:a.x-r.width,y:h};break;default:x={x:a.x,y:a.y}}switch(Bl(t)){case"start":x[i]-=m*(n&&d?-1:1);break;case"end":x[i]+=m*(n&&d?-1:1);break}return x}const NM=async(e,t,n)=>{const{placement:a="bottom",strategy:r="absolute",middleware:l=[],platform:i}=n,o=l.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:r}),{x:f,y:h}=Lv(d,a,c),m=a,x={},b=0;for(let v=0;v<o.length;v++){const{name:y,fn:g}=o[v],{x:p,y:j,data:w,reset:N}=await g({x:f,y:h,initialPlacement:a,placement:m,strategy:r,middlewareData:x,rects:d,platform:i,elements:{reference:e,floating:t}});f=p??f,h=j??h,x={...x,[y]:{...x[y],...w}},N&&b<=50&&(b++,typeof N=="object"&&(N.placement&&(m=N.placement),N.rects&&(d=N.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:r}):N.rects),{x:f,y:h}=Lv(d,m,c)),v=-1)}return{x:f,y:h,placement:m,strategy:r,middlewareData:x}};async function Qi(e,t){var n;t===void 0&&(t={});const{x:a,y:r,platform:l,rects:i,elements:o,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:h="floating",altBoundary:m=!1,padding:x=0}=Xs(t,e),b=qw(x),y=o[m?h==="floating"?"reference":"floating":h],g=wu(await l.getClippingRect({element:(n=await(l.isElement==null?void 0:l.isElement(y)))==null||n?y:y.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(o.floating)),boundary:d,rootBoundary:f,strategy:c})),p=h==="floating"?{x:a,y:r,width:i.floating.width,height:i.floating.height}:i.reference,j=await(l.getOffsetParent==null?void 0:l.getOffsetParent(o.floating)),w=await(l.isElement==null?void 0:l.isElement(j))?await(l.getScale==null?void 0:l.getScale(j))||{x:1,y:1}:{x:1,y:1},N=wu(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:p,offsetParent:j,strategy:c}):p);return{top:(g.top-N.top+b.top)/w.y,bottom:(N.bottom-g.bottom+b.bottom)/w.y,left:(g.left-N.left+b.left)/w.x,right:(N.right-g.right+b.right)/w.x}}const kM=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:a,placement:r,rects:l,platform:i,elements:o,middlewareData:c}=t,{element:d,padding:f=0}=Xs(e,t)||{};if(d==null)return{};const h=qw(f),m={x:n,y:a},x=Fp(r),b=Yp(x),v=await i.getDimensions(d),y=x==="y",g=y?"top":"left",p=y?"bottom":"right",j=y?"clientHeight":"clientWidth",w=l.reference[b]+l.reference[x]-m[x]-l.floating[b],N=m[x]-l.reference[x],C=await(i.getOffsetParent==null?void 0:i.getOffsetParent(d));let _=C?C[j]:0;(!_||!await(i.isElement==null?void 0:i.isElement(C)))&&(_=o.floating[j]||l.floating[b]);const S=w/2-N/2,$=_/2-v[b]/2-1,O=za(h[g],$),G=za(h[p],$),V=O,L=_-v[b]-G,U=_/2-v[b]/2+S,A=em(V,U,L),R=!c.arrow&&Bl(r)!=null&&U!==A&&l.reference[b]/2-(U<V?O:G)-v[b]/2<0,E=R?U<V?U-V:U-L:0;return{[x]:m[x]+E,data:{[x]:A,centerOffset:U-A-E,...R&&{alignmentOffset:E}},reset:R}}}),SM=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,a;const{placement:r,middlewareData:l,rects:i,initialPlacement:o,platform:c,elements:d}=t,{mainAxis:f=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:v=!0,...y}=Xs(e,t);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const g=Qs(r),p=ps(o),j=Qs(o)===o,w=await(c.isRTL==null?void 0:c.isRTL(d.floating)),N=m||(j||!v?[bu(o)]:jM(o)),C=b!=="none";!m&&C&&N.push(...wM(o,v,b,w));const _=[o,...N],S=await Qi(t,y),$=[];let O=((a=l.flip)==null?void 0:a.overflows)||[];if(f&&$.push(S[g]),h){const U=yM(r,i,w);$.push(S[U[0]],S[U[1]])}if(O=[...O,{placement:r,overflows:$}],!$.every(U=>U<=0)){var G,V;const U=(((G=l.flip)==null?void 0:G.index)||0)+1,A=_[U];if(A&&(!(h==="alignment"?p!==ps(A):!1)||O.every(k=>k.overflows[0]>0&&ps(k.placement)===p)))return{data:{index:U,overflows:O},reset:{placement:A}};let R=(V=O.filter(E=>E.overflows[0]<=0).sort((E,k)=>E.overflows[1]-k.overflows[1])[0])==null?void 0:V.placement;if(!R)switch(x){case"bestFit":{var L;const E=(L=O.filter(k=>{if(C){const M=ps(k.placement);return M===p||M==="y"}return!0}).map(k=>[k.placement,k.overflows.filter(M=>M>0).reduce((M,K)=>M+K,0)]).sort((k,M)=>k[1]-M[1])[0])==null?void 0:L[0];E&&(R=E);break}case"initialPlacement":R=o;break}if(r!==R)return{reset:{placement:R}}}return{}}}};function Uv(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Bv(e){return xM.some(t=>e[t]>=0)}const CM=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:a="referenceHidden",...r}=Xs(e,t);switch(a){case"referenceHidden":{const l=await Qi(t,{...r,elementContext:"reference"}),i=Uv(l,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Bv(i)}}}case"escaped":{const l=await Qi(t,{...r,altBoundary:!0}),i=Uv(l,n.floating);return{data:{escapedOffsets:i,escaped:Bv(i)}}}default:return{}}}}};async function RM(e,t){const{placement:n,platform:a,elements:r}=e,l=await(a.isRTL==null?void 0:a.isRTL(r.floating)),i=Qs(n),o=Bl(n),c=ps(n)==="y",d=["left","top"].includes(i)?-1:1,f=l&&c?-1:1,h=Xs(t,e);let{mainAxis:m,crossAxis:x,alignmentAxis:b}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return o&&typeof b=="number"&&(x=o==="end"?b*-1:b),c?{x:x*f,y:m*d}:{x:m*d,y:x*f}}const TM=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,a;const{x:r,y:l,placement:i,middlewareData:o}=t,c=await RM(t,e);return i===((n=o.offset)==null?void 0:n.placement)&&(a=o.arrow)!=null&&a.alignmentOffset?{}:{x:r+c.x,y:l+c.y,data:{...c,placement:i}}}}},EM=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:a,placement:r}=t,{mainAxis:l=!0,crossAxis:i=!1,limiter:o={fn:y=>{let{x:g,y:p}=y;return{x:g,y:p}}},...c}=Xs(e,t),d={x:n,y:a},f=await Qi(t,c),h=ps(Qs(r)),m=Vp(h);let x=d[m],b=d[h];if(l){const y=m==="y"?"top":"left",g=m==="y"?"bottom":"right",p=x+f[y],j=x-f[g];x=em(p,x,j)}if(i){const y=h==="y"?"top":"left",g=h==="y"?"bottom":"right",p=b+f[y],j=b-f[g];b=em(p,b,j)}const v=o.fn({...t,[m]:x,[h]:b});return{...v,data:{x:v.x-n,y:v.y-a,enabled:{[m]:l,[h]:i}}}}}},AM=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:a,placement:r,rects:l,middlewareData:i}=t,{offset:o=0,mainAxis:c=!0,crossAxis:d=!0}=Xs(e,t),f={x:n,y:a},h=ps(r),m=Vp(h);let x=f[m],b=f[h];const v=Xs(o,t),y=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(c){const j=m==="y"?"height":"width",w=l.reference[m]-l.floating[j]+y.mainAxis,N=l.reference[m]+l.reference[j]-y.mainAxis;x<w?x=w:x>N&&(x=N)}if(d){var g,p;const j=m==="y"?"width":"height",w=["top","left"].includes(Qs(r)),N=l.reference[h]-l.floating[j]+(w&&((g=i.offset)==null?void 0:g[h])||0)+(w?0:y.crossAxis),C=l.reference[h]+l.reference[j]+(w?0:((p=i.offset)==null?void 0:p[h])||0)-(w?y.crossAxis:0);b<N?b=N:b>C&&(b=C)}return{[m]:x,[h]:b}}}},MM=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,a;const{placement:r,rects:l,platform:i,elements:o}=t,{apply:c=()=>{},...d}=Xs(e,t),f=await Qi(t,d),h=Qs(r),m=Bl(r),x=ps(r)==="y",{width:b,height:v}=l.floating;let y,g;h==="top"||h==="bottom"?(y=h,g=m===(await(i.isRTL==null?void 0:i.isRTL(o.floating))?"start":"end")?"left":"right"):(g=h,y=m==="end"?"top":"bottom");const p=v-f.top-f.bottom,j=b-f.left-f.right,w=za(v-f[y],p),N=za(b-f[g],j),C=!t.middlewareData.shift;let _=w,S=N;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(S=j),(a=t.middlewareData.shift)!=null&&a.enabled.y&&(_=p),C&&!m){const O=wn(f.left,0),G=wn(f.right,0),V=wn(f.top,0),L=wn(f.bottom,0);x?S=b-2*(O!==0||G!==0?O+G:wn(f.left,f.right)):_=v-2*(V!==0||L!==0?V+L:wn(f.top,f.bottom))}await c({...t,availableWidth:S,availableHeight:_});const $=await i.getDimensions(o.floating);return b!==$.width||v!==$.height?{reset:{rects:!0}}:{}}}};function vd(){return typeof window<"u"}function Hl(e){return Gw(e)?(e.nodeName||"").toLowerCase():"#document"}function Rn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Rs(e){var t;return(t=(Gw(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Gw(e){return vd()?e instanceof Node||e instanceof Rn(e).Node:!1}function ns(e){return vd()?e instanceof Element||e instanceof Rn(e).Element:!1}function Ns(e){return vd()?e instanceof HTMLElement||e instanceof Rn(e).HTMLElement:!1}function Hv(e){return!vd()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Rn(e).ShadowRoot}function Ao(e){const{overflow:t,overflowX:n,overflowY:a,display:r}=ss(e);return/auto|scroll|overlay|hidden|clip/.test(t+a+n)&&!["inline","contents"].includes(r)}function $M(e){return["table","td","th"].includes(Hl(e))}function yd(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Kp(e){const t=Xp(),n=ns(e)?ss(e):e;return["transform","translate","scale","rotate","perspective"].some(a=>n[a]?n[a]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(a=>(n.willChange||"").includes(a))||["paint","layout","strict","content"].some(a=>(n.contain||"").includes(a))}function OM(e){let t=La(e);for(;Ns(t)&&!_l(t);){if(Kp(t))return t;if(yd(t))return null;t=La(t)}return null}function Xp(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function _l(e){return["html","body","#document"].includes(Hl(e))}function ss(e){return Rn(e).getComputedStyle(e)}function jd(e){return ns(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function La(e){if(Hl(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Hv(e)&&e.host||Rs(e);return Hv(t)?t.host:t}function Vw(e){const t=La(e);return _l(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ns(t)&&Ao(t)?t:Vw(t)}function Wi(e,t,n){var a;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=Vw(e),l=r===((a=e.ownerDocument)==null?void 0:a.body),i=Rn(r);if(l){const o=nm(i);return t.concat(i,i.visualViewport||[],Ao(r)?r:[],o&&n?Wi(o):[])}return t.concat(r,Wi(r,[],n))}function nm(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Yw(e){const t=ss(e);let n=parseFloat(t.width)||0,a=parseFloat(t.height)||0;const r=Ns(e),l=r?e.offsetWidth:n,i=r?e.offsetHeight:a,o=ju(n)!==l||ju(a)!==i;return o&&(n=l,a=i),{width:n,height:a,$:o}}function Qp(e){return ns(e)?e:e.contextElement}function il(e){const t=Qp(e);if(!Ns(t))return js(1);const n=t.getBoundingClientRect(),{width:a,height:r,$:l}=Yw(t);let i=(l?ju(n.width):n.width)/a,o=(l?ju(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!o||!Number.isFinite(o))&&(o=1),{x:i,y:o}}const DM=js(0);function Fw(e){const t=Rn(e);return!Xp()||!t.visualViewport?DM:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function zM(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Rn(e)?!1:t}function fr(e,t,n,a){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),l=Qp(e);let i=js(1);t&&(a?ns(a)&&(i=il(a)):i=il(e));const o=zM(l,n,a)?Fw(l):js(0);let c=(r.left+o.x)/i.x,d=(r.top+o.y)/i.y,f=r.width/i.x,h=r.height/i.y;if(l){const m=Rn(l),x=a&&ns(a)?Rn(a):a;let b=m,v=nm(b);for(;v&&a&&x!==b;){const y=il(v),g=v.getBoundingClientRect(),p=ss(v),j=g.left+(v.clientLeft+parseFloat(p.paddingLeft))*y.x,w=g.top+(v.clientTop+parseFloat(p.paddingTop))*y.y;c*=y.x,d*=y.y,f*=y.x,h*=y.y,c+=j,d+=w,b=Rn(v),v=nm(b)}}return wu({width:f,height:h,x:c,y:d})}function Wp(e,t){const n=jd(e).scrollLeft;return t?t.left+n:fr(Rs(e)).left+n}function Kw(e,t,n){n===void 0&&(n=!1);const a=e.getBoundingClientRect(),r=a.left+t.scrollLeft-(n?0:Wp(e,a)),l=a.top+t.scrollTop;return{x:r,y:l}}function LM(e){let{elements:t,rect:n,offsetParent:a,strategy:r}=e;const l=r==="fixed",i=Rs(a),o=t?yd(t.floating):!1;if(a===i||o&&l)return n;let c={scrollLeft:0,scrollTop:0},d=js(1);const f=js(0),h=Ns(a);if((h||!h&&!l)&&((Hl(a)!=="body"||Ao(i))&&(c=jd(a)),Ns(a))){const x=fr(a);d=il(a),f.x=x.x+a.clientLeft,f.y=x.y+a.clientTop}const m=i&&!h&&!l?Kw(i,c,!0):js(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+f.x+m.x,y:n.y*d.y-c.scrollTop*d.y+f.y+m.y}}function UM(e){return Array.from(e.getClientRects())}function BM(e){const t=Rs(e),n=jd(e),a=e.ownerDocument.body,r=wn(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),l=wn(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight);let i=-n.scrollLeft+Wp(e);const o=-n.scrollTop;return ss(a).direction==="rtl"&&(i+=wn(t.clientWidth,a.clientWidth)-r),{width:r,height:l,x:i,y:o}}function HM(e,t){const n=Rn(e),a=Rs(e),r=n.visualViewport;let l=a.clientWidth,i=a.clientHeight,o=0,c=0;if(r){l=r.width,i=r.height;const d=Xp();(!d||d&&t==="fixed")&&(o=r.offsetLeft,c=r.offsetTop)}return{width:l,height:i,x:o,y:c}}function IM(e,t){const n=fr(e,!0,t==="fixed"),a=n.top+e.clientTop,r=n.left+e.clientLeft,l=Ns(e)?il(e):js(1),i=e.clientWidth*l.x,o=e.clientHeight*l.y,c=r*l.x,d=a*l.y;return{width:i,height:o,x:c,y:d}}function Iv(e,t,n){let a;if(t==="viewport")a=HM(e,n);else if(t==="document")a=BM(Rs(e));else if(ns(t))a=IM(t,n);else{const r=Fw(e);a={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return wu(a)}function Xw(e,t){const n=La(e);return n===t||!ns(n)||_l(n)?!1:ss(n).position==="fixed"||Xw(n,t)}function PM(e,t){const n=t.get(e);if(n)return n;let a=Wi(e,[],!1).filter(o=>ns(o)&&Hl(o)!=="body"),r=null;const l=ss(e).position==="fixed";let i=l?La(e):e;for(;ns(i)&&!_l(i);){const o=ss(i),c=Kp(i);!c&&o.position==="fixed"&&(r=null),(l?!c&&!r:!c&&o.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||Ao(i)&&!c&&Xw(e,i))?a=a.filter(f=>f!==i):r=o,i=La(i)}return t.set(e,a),a}function qM(e){let{element:t,boundary:n,rootBoundary:a,strategy:r}=e;const i=[...n==="clippingAncestors"?yd(t)?[]:PM(t,this._c):[].concat(n),a],o=i[0],c=i.reduce((d,f)=>{const h=Iv(t,f,r);return d.top=wn(h.top,d.top),d.right=za(h.right,d.right),d.bottom=za(h.bottom,d.bottom),d.left=wn(h.left,d.left),d},Iv(t,o,r));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function GM(e){const{width:t,height:n}=Yw(e);return{width:t,height:n}}function VM(e,t,n){const a=Ns(t),r=Rs(t),l=n==="fixed",i=fr(e,!0,l,t);let o={scrollLeft:0,scrollTop:0};const c=js(0);function d(){c.x=Wp(r)}if(a||!a&&!l)if((Hl(t)!=="body"||Ao(r))&&(o=jd(t)),a){const x=fr(t,!0,l,t);c.x=x.x+t.clientLeft,c.y=x.y+t.clientTop}else r&&d();l&&!a&&r&&d();const f=r&&!a&&!l?Kw(r,o):js(0),h=i.left+o.scrollLeft-c.x-f.x,m=i.top+o.scrollTop-c.y-f.y;return{x:h,y:m,width:i.width,height:i.height}}function Df(e){return ss(e).position==="static"}function Pv(e,t){if(!Ns(e)||ss(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Rs(e)===n&&(n=n.ownerDocument.body),n}function Qw(e,t){const n=Rn(e);if(yd(e))return n;if(!Ns(e)){let r=La(e);for(;r&&!_l(r);){if(ns(r)&&!Df(r))return r;r=La(r)}return n}let a=Pv(e,t);for(;a&&$M(a)&&Df(a);)a=Pv(a,t);return a&&_l(a)&&Df(a)&&!Kp(a)?n:a||OM(e)||n}const YM=async function(e){const t=this.getOffsetParent||Qw,n=this.getDimensions,a=await n(e.floating);return{reference:VM(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function FM(e){return ss(e).direction==="rtl"}const KM={convertOffsetParentRelativeRectToViewportRelativeRect:LM,getDocumentElement:Rs,getClippingRect:qM,getOffsetParent:Qw,getElementRects:YM,getClientRects:UM,getDimensions:GM,getScale:il,isElement:ns,isRTL:FM};function Ww(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function XM(e,t){let n=null,a;const r=Rs(e);function l(){var o;clearTimeout(a),(o=n)==null||o.disconnect(),n=null}function i(o,c){o===void 0&&(o=!1),c===void 0&&(c=1),l();const d=e.getBoundingClientRect(),{left:f,top:h,width:m,height:x}=d;if(o||t(),!m||!x)return;const b=uc(h),v=uc(r.clientWidth-(f+m)),y=uc(r.clientHeight-(h+x)),g=uc(f),j={rootMargin:-b+"px "+-v+"px "+-y+"px "+-g+"px",threshold:wn(0,za(1,c))||1};let w=!0;function N(C){const _=C[0].intersectionRatio;if(_!==c){if(!w)return i();_?i(!1,_):a=setTimeout(()=>{i(!1,1e-7)},1e3)}_===1&&!Ww(d,e.getBoundingClientRect())&&i(),w=!1}try{n=new IntersectionObserver(N,{...j,root:r.ownerDocument})}catch{n=new IntersectionObserver(N,j)}n.observe(e)}return i(!0),l}function QM(e,t,n,a){a===void 0&&(a={});const{ancestorScroll:r=!0,ancestorResize:l=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:c=!1}=a,d=Qp(e),f=r||l?[...d?Wi(d):[],...Wi(t)]:[];f.forEach(g=>{r&&g.addEventListener("scroll",n,{passive:!0}),l&&g.addEventListener("resize",n)});const h=d&&o?XM(d,n):null;let m=-1,x=null;i&&(x=new ResizeObserver(g=>{let[p]=g;p&&p.target===d&&x&&(x.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var j;(j=x)==null||j.observe(t)})),n()}),d&&!c&&x.observe(d),x.observe(t));let b,v=c?fr(e):null;c&&y();function y(){const g=fr(e);v&&!Ww(v,g)&&n(),v=g,b=requestAnimationFrame(y)}return n(),()=>{var g;f.forEach(p=>{r&&p.removeEventListener("scroll",n),l&&p.removeEventListener("resize",n)}),h==null||h(),(g=x)==null||g.disconnect(),x=null,c&&cancelAnimationFrame(b)}}const WM=TM,ZM=EM,JM=SM,e$=MM,t$=CM,qv=kM,n$=AM,s$=(e,t,n)=>{const a=new Map,r={platform:KM,...n},l={...r.platform,_c:a};return NM(e,t,{...r,platform:l})};var a$=typeof document<"u",r$=function(){},Oc=a$?u.useLayoutEffect:r$;function _u(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,a,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(a=n;a--!==0;)if(!_u(e[a],t[a]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(a=n;a--!==0;)if(!{}.hasOwnProperty.call(t,r[a]))return!1;for(a=n;a--!==0;){const l=r[a];if(!(l==="_owner"&&e.$$typeof)&&!_u(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function Zw(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Gv(e,t){const n=Zw(e);return Math.round(t*n)/n}function zf(e){const t=u.useRef(e);return Oc(()=>{t.current=e}),t}function l$(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:a=[],platform:r,elements:{reference:l,floating:i}={},transform:o=!0,whileElementsMounted:c,open:d}=e,[f,h]=u.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,x]=u.useState(a);_u(m,a)||x(a);const[b,v]=u.useState(null),[y,g]=u.useState(null),p=u.useCallback(k=>{k!==C.current&&(C.current=k,v(k))},[]),j=u.useCallback(k=>{k!==_.current&&(_.current=k,g(k))},[]),w=l||b,N=i||y,C=u.useRef(null),_=u.useRef(null),S=u.useRef(f),$=c!=null,O=zf(c),G=zf(r),V=zf(d),L=u.useCallback(()=>{if(!C.current||!_.current)return;const k={placement:t,strategy:n,middleware:m};G.current&&(k.platform=G.current),s$(C.current,_.current,k).then(M=>{const K={...M,isPositioned:V.current!==!1};U.current&&!_u(S.current,K)&&(S.current=K,Cl.flushSync(()=>{h(K)}))})},[m,t,n,G,V]);Oc(()=>{d===!1&&S.current.isPositioned&&(S.current.isPositioned=!1,h(k=>({...k,isPositioned:!1})))},[d]);const U=u.useRef(!1);Oc(()=>(U.current=!0,()=>{U.current=!1}),[]),Oc(()=>{if(w&&(C.current=w),N&&(_.current=N),w&&N){if(O.current)return O.current(w,N,L);L()}},[w,N,L,O,$]);const A=u.useMemo(()=>({reference:C,floating:_,setReference:p,setFloating:j}),[p,j]),R=u.useMemo(()=>({reference:w,floating:N}),[w,N]),E=u.useMemo(()=>{const k={position:n,left:0,top:0};if(!R.floating)return k;const M=Gv(R.floating,f.x),K=Gv(R.floating,f.y);return o?{...k,transform:"translate("+M+"px, "+K+"px)",...Zw(R.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:M,top:K}},[n,o,R.floating,f.x,f.y]);return u.useMemo(()=>({...f,update:L,refs:A,elements:R,floatingStyles:E}),[f,L,A,R,E])}const i$=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:a,padding:r}=typeof e=="function"?e(n):e;return a&&t(a)?a.current!=null?qv({element:a.current,padding:r}).fn(n):{}:a?qv({element:a,padding:r}).fn(n):{}}}},o$=(e,t)=>({...WM(e),options:[e,t]}),c$=(e,t)=>({...ZM(e),options:[e,t]}),u$=(e,t)=>({...n$(e),options:[e,t]}),d$=(e,t)=>({...JM(e),options:[e,t]}),f$=(e,t)=>({...e$(e),options:[e,t]}),h$=(e,t)=>({...t$(e),options:[e,t]}),m$=(e,t)=>({...i$(e),options:[e,t]});var p$="Arrow",Jw=u.forwardRef((e,t)=>{const{children:n,width:a=10,height:r=5,...l}=e;return s.jsx(Te.svg,{...l,ref:t,width:a,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});Jw.displayName=p$;var x$=Jw,Zp="Popper",[e_,Il]=Cs(Zp),[g$,t_]=e_(Zp),n_=e=>{const{__scopePopper:t,children:n}=e,[a,r]=u.useState(null);return s.jsx(g$,{scope:t,anchor:a,onAnchorChange:r,children:n})};n_.displayName=Zp;var s_="PopperAnchor",a_=u.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:a,...r}=e,l=t_(s_,n),i=u.useRef(null),o=Ke(t,i);return u.useEffect(()=>{l.onAnchorChange((a==null?void 0:a.current)||i.current)}),a?null:s.jsx(Te.div,{...r,ref:o})});a_.displayName=s_;var Jp="PopperContent",[v$,y$]=e_(Jp),r_=u.forwardRef((e,t)=>{var D,H,te,se,ye,re;const{__scopePopper:n,side:a="bottom",sideOffset:r=0,align:l="center",alignOffset:i=0,arrowPadding:o=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:h="partial",hideWhenDetached:m=!1,updatePositionStrategy:x="optimized",onPlaced:b,...v}=e,y=t_(Jp,n),[g,p]=u.useState(null),j=Ke(t,we=>p(we)),[w,N]=u.useState(null),C=Dw(w),_=(C==null?void 0:C.width)??0,S=(C==null?void 0:C.height)??0,$=a+(l!=="center"?"-"+l:""),O=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},G=Array.isArray(d)?d:[d],V=G.length>0,L={padding:O,boundary:G.filter(b$),altBoundary:V},{refs:U,floatingStyles:A,placement:R,isPositioned:E,middlewareData:k}=l$({strategy:"fixed",placement:$,whileElementsMounted:(...we)=>QM(...we,{animationFrame:x==="always"}),elements:{reference:y.anchor},middleware:[o$({mainAxis:r+S,alignmentAxis:i}),c&&c$({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?u$():void 0,...L}),c&&d$({...L}),f$({...L,apply:({elements:we,rects:ne,availableWidth:rt,availableHeight:de})=>{const{width:Be,height:Q}=ne.reference,Re=we.floating.style;Re.setProperty("--radix-popper-available-width",`${rt}px`),Re.setProperty("--radix-popper-available-height",`${de}px`),Re.setProperty("--radix-popper-anchor-width",`${Be}px`),Re.setProperty("--radix-popper-anchor-height",`${Q}px`)}}),w&&m$({element:w,padding:o}),w$({arrowWidth:_,arrowHeight:S}),m&&h$({strategy:"referenceHidden",...L})]}),[M,K]=o_(R),T=_s(b);Vt(()=>{E&&(T==null||T())},[E,T]);const B=(D=k.arrow)==null?void 0:D.x,F=(H=k.arrow)==null?void 0:H.y,J=((te=k.arrow)==null?void 0:te.centerOffset)!==0,[he,X]=u.useState();return Vt(()=>{g&&X(window.getComputedStyle(g).zIndex)},[g]),s.jsx("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...A,transform:E?A.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:he,"--radix-popper-transform-origin":[(se=k.transformOrigin)==null?void 0:se.x,(ye=k.transformOrigin)==null?void 0:ye.y].join(" "),...((re=k.hide)==null?void 0:re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(v$,{scope:n,placedSide:M,onArrowChange:N,arrowX:B,arrowY:F,shouldHideArrow:J,children:s.jsx(Te.div,{"data-side":M,"data-align":K,...v,ref:j,style:{...v.style,animation:E?void 0:"none"}})})})});r_.displayName=Jp;var l_="PopperArrow",j$={top:"bottom",right:"left",bottom:"top",left:"right"},i_=u.forwardRef(function(t,n){const{__scopePopper:a,...r}=t,l=y$(l_,a),i=j$[l.placedSide];return s.jsx("span",{ref:l.onArrowChange,style:{position:"absolute",left:l.arrowX,top:l.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[l.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[l.placedSide],visibility:l.shouldHideArrow?"hidden":void 0},children:s.jsx(x$,{...r,ref:n,style:{...r.style,display:"block"}})})});i_.displayName=l_;function b$(e){return e!==null}var w$=e=>({name:"transformOrigin",options:e,fn(t){var y,g,p;const{placement:n,rects:a,middlewareData:r}=t,i=((y=r.arrow)==null?void 0:y.centerOffset)!==0,o=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[d,f]=o_(n),h={start:"0%",center:"50%",end:"100%"}[f],m=(((g=r.arrow)==null?void 0:g.x)??0)+o/2,x=(((p=r.arrow)==null?void 0:p.y)??0)+c/2;let b="",v="";return d==="bottom"?(b=i?h:`${m}px`,v=`${-c}px`):d==="top"?(b=i?h:`${m}px`,v=`${a.floating.height+c}px`):d==="right"?(b=`${-c}px`,v=i?h:`${x}px`):d==="left"&&(b=`${a.floating.width+c}px`,v=i?h:`${x}px`),{data:{x:b,y:v}}}});function o_(e){const[t,n="center"]=e.split("-");return[t,n]}var ex=n_,tx=a_,nx=r_,sx=i_,Lf="rovingFocusGroup.onEntryFocus",_$={bubbles:!1,cancelable:!0},Mo="RovingFocusGroup",[sm,c_,N$]=Gp(Mo),[k$,bd]=Cs(Mo,[N$]),[S$,C$]=k$(Mo),u_=u.forwardRef((e,t)=>s.jsx(sm.Provider,{scope:e.__scopeRovingFocusGroup,children:s.jsx(sm.Slot,{scope:e.__scopeRovingFocusGroup,children:s.jsx(R$,{...e,ref:t})})}));u_.displayName=Mo;var R$=u.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:a,loop:r=!1,dir:l,currentTabStopId:i,defaultCurrentTabStopId:o,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...h}=e,m=u.useRef(null),x=Ke(t,m),b=gd(l),[v,y]=Da({prop:i,defaultProp:o??null,onChange:c,caller:Mo}),[g,p]=u.useState(!1),j=_s(d),w=c_(n),N=u.useRef(!1),[C,_]=u.useState(0);return u.useEffect(()=>{const S=m.current;if(S)return S.addEventListener(Lf,j),()=>S.removeEventListener(Lf,j)},[j]),s.jsx(S$,{scope:n,orientation:a,dir:b,loop:r,currentTabStopId:v,onItemFocus:u.useCallback(S=>y(S),[y]),onItemShiftTab:u.useCallback(()=>p(!0),[]),onFocusableItemAdd:u.useCallback(()=>_(S=>S+1),[]),onFocusableItemRemove:u.useCallback(()=>_(S=>S-1),[]),children:s.jsx(Te.div,{tabIndex:g||C===0?-1:0,"data-orientation":a,...h,ref:x,style:{outline:"none",...e.style},onMouseDown:fe(e.onMouseDown,()=>{N.current=!0}),onFocus:fe(e.onFocus,S=>{const $=!N.current;if(S.target===S.currentTarget&&$&&!g){const O=new CustomEvent(Lf,_$);if(S.currentTarget.dispatchEvent(O),!O.defaultPrevented){const G=w().filter(R=>R.focusable),V=G.find(R=>R.active),L=G.find(R=>R.id===v),A=[V,L,...G].filter(Boolean).map(R=>R.ref.current);h_(A,f)}}N.current=!1}),onBlur:fe(e.onBlur,()=>p(!1))})})}),d_="RovingFocusGroupItem",f_=u.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:a=!0,active:r=!1,tabStopId:l,children:i,...o}=e,c=Jn(),d=l||c,f=C$(d_,n),h=f.currentTabStopId===d,m=c_(n),{onFocusableItemAdd:x,onFocusableItemRemove:b,currentTabStopId:v}=f;return u.useEffect(()=>{if(a)return x(),()=>b()},[a,x,b]),s.jsx(sm.ItemSlot,{scope:n,id:d,focusable:a,active:r,children:s.jsx(Te.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...o,ref:t,onMouseDown:fe(e.onMouseDown,y=>{a?f.onItemFocus(d):y.preventDefault()}),onFocus:fe(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:fe(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){f.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const g=A$(y,f.orientation,f.dir);if(g!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let j=m().filter(w=>w.focusable).map(w=>w.ref.current);if(g==="last")j.reverse();else if(g==="prev"||g==="next"){g==="prev"&&j.reverse();const w=j.indexOf(y.currentTarget);j=f.loop?M$(j,w+1):j.slice(w+1)}setTimeout(()=>h_(j))}}),children:typeof i=="function"?i({isCurrentTabStop:h,hasTabStop:v!=null}):i})})});f_.displayName=d_;var T$={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function E$(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function A$(e,t,n){const a=E$(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(a))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(a)))return T$[a]}function h_(e,t=!1){const n=document.activeElement;for(const a of e)if(a===n||(a.focus({preventScroll:t}),document.activeElement!==n))return}function M$(e,t){return e.map((n,a)=>e[(t+a)%e.length])}var m_=u_,p_=f_,am=["Enter"," "],$$=["ArrowDown","PageUp","Home"],x_=["ArrowUp","PageDown","End"],O$=[...$$,...x_],D$={ltr:[...am,"ArrowRight"],rtl:[...am,"ArrowLeft"]},z$={ltr:["ArrowLeft"],rtl:["ArrowRight"]},$o="Menu",[Zi,L$,U$]=Gp($o),[br,g_]=Cs($o,[U$,Il,bd]),wd=Il(),v_=bd(),[B$,wr]=br($o),[H$,Oo]=br($o),y_=e=>{const{__scopeMenu:t,open:n=!1,children:a,dir:r,onOpenChange:l,modal:i=!0}=e,o=wd(t),[c,d]=u.useState(null),f=u.useRef(!1),h=_s(l),m=gd(r);return u.useEffect(()=>{const x=()=>{f.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>f.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),s.jsx(ex,{...o,children:s.jsx(B$,{scope:t,open:n,onOpenChange:h,content:c,onContentChange:d,children:s.jsx(H$,{scope:t,onClose:u.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:f,dir:m,modal:i,children:a})})})};y_.displayName=$o;var I$="MenuAnchor",ax=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e,r=wd(n);return s.jsx(tx,{...r,...a,ref:t})});ax.displayName=I$;var rx="MenuPortal",[P$,j_]=br(rx,{forceMount:void 0}),b_=e=>{const{__scopeMenu:t,forceMount:n,children:a,container:r}=e,l=wr(rx,t);return s.jsx(P$,{scope:t,forceMount:n,children:s.jsx(Yn,{present:n||l.open,children:s.jsx(Ro,{asChild:!0,container:r,children:a})})})};b_.displayName=rx;var In="MenuContent",[q$,lx]=br(In),w_=u.forwardRef((e,t)=>{const n=j_(In,e.__scopeMenu),{forceMount:a=n.forceMount,...r}=e,l=wr(In,e.__scopeMenu),i=Oo(In,e.__scopeMenu);return s.jsx(Zi.Provider,{scope:e.__scopeMenu,children:s.jsx(Yn,{present:a||l.open,children:s.jsx(Zi.Slot,{scope:e.__scopeMenu,children:i.modal?s.jsx(G$,{...r,ref:t}):s.jsx(V$,{...r,ref:t})})})})}),G$=u.forwardRef((e,t)=>{const n=wr(In,e.__scopeMenu),a=u.useRef(null),r=Ke(t,a);return u.useEffect(()=>{const l=a.current;if(l)return Ep(l)},[]),s.jsx(ix,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:fe(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),V$=u.forwardRef((e,t)=>{const n=wr(In,e.__scopeMenu);return s.jsx(ix,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Y$=ur("MenuContent.ScrollLock"),ix=u.forwardRef((e,t)=>{const{__scopeMenu:n,loop:a=!1,trapFocus:r,onOpenAutoFocus:l,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEntryFocus:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,onDismiss:x,disableOutsideScroll:b,...v}=e,y=wr(In,n),g=Oo(In,n),p=wd(n),j=v_(n),w=L$(n),[N,C]=u.useState(null),_=u.useRef(null),S=Ke(t,_,y.onContentChange),$=u.useRef(0),O=u.useRef(""),G=u.useRef(0),V=u.useRef(null),L=u.useRef("right"),U=u.useRef(0),A=b?hd:u.Fragment,R=b?{as:Y$,allowPinchZoom:!0}:void 0,E=M=>{var D,H;const K=O.current+M,T=w().filter(te=>!te.disabled),B=document.activeElement,F=(D=T.find(te=>te.ref.current===B))==null?void 0:D.textValue,J=T.map(te=>te.textValue),he=aO(J,K,F),X=(H=T.find(te=>te.textValue===he))==null?void 0:H.ref.current;(function te(se){O.current=se,window.clearTimeout($.current),se!==""&&($.current=window.setTimeout(()=>te(""),1e3))})(K),X&&setTimeout(()=>X.focus())};u.useEffect(()=>()=>window.clearTimeout($.current),[]),Tp();const k=u.useCallback(M=>{var T,B;return L.current===((T=V.current)==null?void 0:T.side)&&lO(M,(B=V.current)==null?void 0:B.area)},[]);return s.jsx(q$,{scope:n,searchRef:O,onItemEnter:u.useCallback(M=>{k(M)&&M.preventDefault()},[k]),onItemLeave:u.useCallback(M=>{var K;k(M)||((K=_.current)==null||K.focus(),C(null))},[k]),onTriggerLeave:u.useCallback(M=>{k(M)&&M.preventDefault()},[k]),pointerGraceTimerRef:G,onPointerGraceIntentChange:u.useCallback(M=>{V.current=M},[]),children:s.jsx(A,{...R,children:s.jsx(dd,{asChild:!0,trapped:r,onMountAutoFocus:fe(l,M=>{var K;M.preventDefault(),(K=_.current)==null||K.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:s.jsx(Co,{asChild:!0,disableOutsidePointerEvents:o,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,onDismiss:x,children:s.jsx(m_,{asChild:!0,...j,dir:g.dir,orientation:"vertical",loop:a,currentTabStopId:N,onCurrentTabStopIdChange:C,onEntryFocus:fe(c,M=>{g.isUsingKeyboardRef.current||M.preventDefault()}),preventScrollOnEntryFocus:!0,children:s.jsx(nx,{role:"menu","aria-orientation":"vertical","data-state":U_(y.open),"data-radix-menu-content":"",dir:g.dir,...p,...v,ref:S,style:{outline:"none",...v.style},onKeyDown:fe(v.onKeyDown,M=>{const T=M.target.closest("[data-radix-menu-content]")===M.currentTarget,B=M.ctrlKey||M.altKey||M.metaKey,F=M.key.length===1;T&&(M.key==="Tab"&&M.preventDefault(),!B&&F&&E(M.key));const J=_.current;if(M.target!==J||!O$.includes(M.key))return;M.preventDefault();const X=w().filter(D=>!D.disabled).map(D=>D.ref.current);x_.includes(M.key)&&X.reverse(),nO(X)}),onBlur:fe(e.onBlur,M=>{M.currentTarget.contains(M.target)||(window.clearTimeout($.current),O.current="")}),onPointerMove:fe(e.onPointerMove,Ji(M=>{const K=M.target,T=U.current!==M.clientX;if(M.currentTarget.contains(K)&&T){const B=M.clientX>U.current?"right":"left";L.current=B,U.current=M.clientX}}))})})})})})})});w_.displayName=In;var F$="MenuGroup",ox=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return s.jsx(Te.div,{role:"group",...a,ref:t})});ox.displayName=F$;var K$="MenuLabel",__=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return s.jsx(Te.div,{...a,ref:t})});__.displayName=K$;var Nu="MenuItem",Vv="menu.itemSelect",_d=u.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:a,...r}=e,l=u.useRef(null),i=Oo(Nu,e.__scopeMenu),o=lx(Nu,e.__scopeMenu),c=Ke(t,l),d=u.useRef(!1),f=()=>{const h=l.current;if(!n&&h){const m=new CustomEvent(Vv,{bubbles:!0,cancelable:!0});h.addEventListener(Vv,x=>a==null?void 0:a(x),{once:!0}),J0(h,m),m.defaultPrevented?d.current=!1:i.onClose()}};return s.jsx(N_,{...r,ref:c,disabled:n,onClick:fe(e.onClick,f),onPointerDown:h=>{var m;(m=e.onPointerDown)==null||m.call(e,h),d.current=!0},onPointerUp:fe(e.onPointerUp,h=>{var m;d.current||(m=h.currentTarget)==null||m.click()}),onKeyDown:fe(e.onKeyDown,h=>{const m=o.searchRef.current!=="";n||m&&h.key===" "||am.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});_d.displayName=Nu;var N_=u.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:a=!1,textValue:r,...l}=e,i=lx(Nu,n),o=v_(n),c=u.useRef(null),d=Ke(t,c),[f,h]=u.useState(!1),[m,x]=u.useState("");return u.useEffect(()=>{const b=c.current;b&&x((b.textContent??"").trim())},[l.children]),s.jsx(Zi.ItemSlot,{scope:n,disabled:a,textValue:r??m,children:s.jsx(p_,{asChild:!0,...o,focusable:!a,children:s.jsx(Te.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":a||void 0,"data-disabled":a?"":void 0,...l,ref:d,onPointerMove:fe(e.onPointerMove,Ji(b=>{a?i.onItemLeave(b):(i.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:fe(e.onPointerLeave,Ji(b=>i.onItemLeave(b))),onFocus:fe(e.onFocus,()=>h(!0)),onBlur:fe(e.onBlur,()=>h(!1))})})})}),X$="MenuCheckboxItem",k_=u.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:a,...r}=e;return s.jsx(E_,{scope:e.__scopeMenu,checked:n,children:s.jsx(_d,{role:"menuitemcheckbox","aria-checked":ku(n)?"mixed":n,...r,ref:t,"data-state":ux(n),onSelect:fe(r.onSelect,()=>a==null?void 0:a(ku(n)?!0:!n),{checkForDefaultPrevented:!1})})})});k_.displayName=X$;var S_="MenuRadioGroup",[Q$,W$]=br(S_,{value:void 0,onValueChange:()=>{}}),C_=u.forwardRef((e,t)=>{const{value:n,onValueChange:a,...r}=e,l=_s(a);return s.jsx(Q$,{scope:e.__scopeMenu,value:n,onValueChange:l,children:s.jsx(ox,{...r,ref:t})})});C_.displayName=S_;var R_="MenuRadioItem",T_=u.forwardRef((e,t)=>{const{value:n,...a}=e,r=W$(R_,e.__scopeMenu),l=n===r.value;return s.jsx(E_,{scope:e.__scopeMenu,checked:l,children:s.jsx(_d,{role:"menuitemradio","aria-checked":l,...a,ref:t,"data-state":ux(l),onSelect:fe(a.onSelect,()=>{var i;return(i=r.onValueChange)==null?void 0:i.call(r,n)},{checkForDefaultPrevented:!1})})})});T_.displayName=R_;var cx="MenuItemIndicator",[E_,Z$]=br(cx,{checked:!1}),A_=u.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:a,...r}=e,l=Z$(cx,n);return s.jsx(Yn,{present:a||ku(l.checked)||l.checked===!0,children:s.jsx(Te.span,{...r,ref:t,"data-state":ux(l.checked)})})});A_.displayName=cx;var J$="MenuSeparator",M_=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return s.jsx(Te.div,{role:"separator","aria-orientation":"horizontal",...a,ref:t})});M_.displayName=J$;var eO="MenuArrow",$_=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e,r=wd(n);return s.jsx(sx,{...r,...a,ref:t})});$_.displayName=eO;var tO="MenuSub",[K5,O_]=br(tO),fi="MenuSubTrigger",D_=u.forwardRef((e,t)=>{const n=wr(fi,e.__scopeMenu),a=Oo(fi,e.__scopeMenu),r=O_(fi,e.__scopeMenu),l=lx(fi,e.__scopeMenu),i=u.useRef(null),{pointerGraceTimerRef:o,onPointerGraceIntentChange:c}=l,d={__scopeMenu:e.__scopeMenu},f=u.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return u.useEffect(()=>f,[f]),u.useEffect(()=>{const h=o.current;return()=>{window.clearTimeout(h),c(null)}},[o,c]),s.jsx(ax,{asChild:!0,...d,children:s.jsx(N_,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":r.contentId,"data-state":U_(n.open),...e,ref:ud(t,r.onTriggerChange),onClick:h=>{var m;(m=e.onClick)==null||m.call(e,h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:fe(e.onPointerMove,Ji(h=>{l.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(l.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:fe(e.onPointerLeave,Ji(h=>{var x,b;f();const m=(x=n.content)==null?void 0:x.getBoundingClientRect();if(m){const v=(b=n.content)==null?void 0:b.dataset.side,y=v==="right",g=y?-5:5,p=m[y?"left":"right"],j=m[y?"right":"left"];l.onPointerGraceIntentChange({area:[{x:h.clientX+g,y:h.clientY},{x:p,y:m.top},{x:j,y:m.top},{x:j,y:m.bottom},{x:p,y:m.bottom}],side:v}),window.clearTimeout(o.current),o.current=window.setTimeout(()=>l.onPointerGraceIntentChange(null),300)}else{if(l.onTriggerLeave(h),h.defaultPrevented)return;l.onPointerGraceIntentChange(null)}})),onKeyDown:fe(e.onKeyDown,h=>{var x;const m=l.searchRef.current!=="";e.disabled||m&&h.key===" "||D$[a.dir].includes(h.key)&&(n.onOpenChange(!0),(x=n.content)==null||x.focus(),h.preventDefault())})})})});D_.displayName=fi;var z_="MenuSubContent",L_=u.forwardRef((e,t)=>{const n=j_(In,e.__scopeMenu),{forceMount:a=n.forceMount,...r}=e,l=wr(In,e.__scopeMenu),i=Oo(In,e.__scopeMenu),o=O_(z_,e.__scopeMenu),c=u.useRef(null),d=Ke(t,c);return s.jsx(Zi.Provider,{scope:e.__scopeMenu,children:s.jsx(Yn,{present:a||l.open,children:s.jsx(Zi.Slot,{scope:e.__scopeMenu,children:s.jsx(ix,{id:o.contentId,"aria-labelledby":o.triggerId,...r,ref:d,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var h;i.isUsingKeyboardRef.current&&((h=c.current)==null||h.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:fe(e.onFocusOutside,f=>{f.target!==o.trigger&&l.onOpenChange(!1)}),onEscapeKeyDown:fe(e.onEscapeKeyDown,f=>{i.onClose(),f.preventDefault()}),onKeyDown:fe(e.onKeyDown,f=>{var x;const h=f.currentTarget.contains(f.target),m=z$[i.dir].includes(f.key);h&&m&&(l.onOpenChange(!1),(x=o.trigger)==null||x.focus(),f.preventDefault())})})})})})});L_.displayName=z_;function U_(e){return e?"open":"closed"}function ku(e){return e==="indeterminate"}function ux(e){return ku(e)?"indeterminate":e?"checked":"unchecked"}function nO(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function sO(e,t){return e.map((n,a)=>e[(t+a)%e.length])}function aO(e,t,n){const r=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,l=n?e.indexOf(n):-1;let i=sO(e,Math.max(l,0));r.length===1&&(i=i.filter(d=>d!==n));const c=i.find(d=>d.toLowerCase().startsWith(r.toLowerCase()));return c!==n?c:void 0}function rO(e,t){const{x:n,y:a}=e;let r=!1;for(let l=0,i=t.length-1;l<t.length;i=l++){const o=t[l],c=t[i],d=o.x,f=o.y,h=c.x,m=c.y;f>a!=m>a&&n<(h-d)*(a-f)/(m-f)+d&&(r=!r)}return r}function lO(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return rO(n,t)}function Ji(e){return t=>t.pointerType==="mouse"?e(t):void 0}var iO=y_,oO=ax,cO=b_,uO=w_,dO=ox,fO=__,hO=_d,mO=k_,pO=C_,xO=T_,gO=A_,vO=M_,yO=$_,jO=D_,bO=L_,Nd="DropdownMenu",[wO]=Cs(Nd,[g_]),Zt=g_(),[_O,B_]=wO(Nd),H_=e=>{const{__scopeDropdownMenu:t,children:n,dir:a,open:r,defaultOpen:l,onOpenChange:i,modal:o=!0}=e,c=Zt(t),d=u.useRef(null),[f,h]=Da({prop:r,defaultProp:l??!1,onChange:i,caller:Nd});return s.jsx(_O,{scope:t,triggerId:Jn(),triggerRef:d,contentId:Jn(),open:f,onOpenChange:h,onOpenToggle:u.useCallback(()=>h(m=>!m),[h]),modal:o,children:s.jsx(iO,{...c,open:f,onOpenChange:h,dir:a,modal:o,children:n})})};H_.displayName=Nd;var I_="DropdownMenuTrigger",P_=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:a=!1,...r}=e,l=B_(I_,n),i=Zt(n);return s.jsx(oO,{asChild:!0,...i,children:s.jsx(Te.button,{type:"button",id:l.triggerId,"aria-haspopup":"menu","aria-expanded":l.open,"aria-controls":l.open?l.contentId:void 0,"data-state":l.open?"open":"closed","data-disabled":a?"":void 0,disabled:a,...r,ref:ud(t,l.triggerRef),onPointerDown:fe(e.onPointerDown,o=>{!a&&o.button===0&&o.ctrlKey===!1&&(l.onOpenToggle(),l.open||o.preventDefault())}),onKeyDown:fe(e.onKeyDown,o=>{a||(["Enter"," "].includes(o.key)&&l.onOpenToggle(),o.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(o.key)&&o.preventDefault())})})})});P_.displayName=I_;var NO="DropdownMenuPortal",q_=e=>{const{__scopeDropdownMenu:t,...n}=e,a=Zt(t);return s.jsx(cO,{...a,...n})};q_.displayName=NO;var G_="DropdownMenuContent",V_=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=B_(G_,n),l=Zt(n),i=u.useRef(!1);return s.jsx(uO,{id:r.contentId,"aria-labelledby":r.triggerId,...l,...a,ref:t,onCloseAutoFocus:fe(e.onCloseAutoFocus,o=>{var c;i.current||(c=r.triggerRef.current)==null||c.focus(),i.current=!1,o.preventDefault()}),onInteractOutside:fe(e.onInteractOutside,o=>{const c=o.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,f=c.button===2||d;(!r.modal||f)&&(i.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});V_.displayName=G_;var kO="DropdownMenuGroup",SO=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Zt(n);return s.jsx(dO,{...r,...a,ref:t})});SO.displayName=kO;var CO="DropdownMenuLabel",Y_=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Zt(n);return s.jsx(fO,{...r,...a,ref:t})});Y_.displayName=CO;var RO="DropdownMenuItem",F_=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Zt(n);return s.jsx(hO,{...r,...a,ref:t})});F_.displayName=RO;var TO="DropdownMenuCheckboxItem",K_=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Zt(n);return s.jsx(mO,{...r,...a,ref:t})});K_.displayName=TO;var EO="DropdownMenuRadioGroup",AO=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Zt(n);return s.jsx(pO,{...r,...a,ref:t})});AO.displayName=EO;var MO="DropdownMenuRadioItem",X_=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Zt(n);return s.jsx(xO,{...r,...a,ref:t})});X_.displayName=MO;var $O="DropdownMenuItemIndicator",Q_=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Zt(n);return s.jsx(gO,{...r,...a,ref:t})});Q_.displayName=$O;var OO="DropdownMenuSeparator",W_=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Zt(n);return s.jsx(vO,{...r,...a,ref:t})});W_.displayName=OO;var DO="DropdownMenuArrow",zO=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Zt(n);return s.jsx(yO,{...r,...a,ref:t})});zO.displayName=DO;var LO="DropdownMenuSubTrigger",Z_=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Zt(n);return s.jsx(jO,{...r,...a,ref:t})});Z_.displayName=LO;var UO="DropdownMenuSubContent",J_=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Zt(n);return s.jsx(bO,{...r,...a,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});J_.displayName=UO;var BO=H_,HO=P_,IO=q_,eN=V_,tN=Y_,nN=F_,sN=K_,aN=X_,rN=Q_,lN=W_,iN=Z_,oN=J_;const kd=BO,Sd=HO,PO=u.forwardRef(({className:e,inset:t,children:n,...a},r)=>s.jsxs(iN,{ref:r,className:le("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...a,children:[n,s.jsx(ad,{className:"ml-auto"})]}));PO.displayName=iN.displayName;const qO=u.forwardRef(({className:e,...t},n)=>s.jsx(oN,{ref:n,className:le("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));qO.displayName=oN.displayName;const Do=u.forwardRef(({className:e,sideOffset:t=4,...n},a)=>s.jsx(IO,{container:To(),children:s.jsx(eN,{ref:a,sideOffset:t,className:le("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));Do.displayName=eN.displayName;const Nl=u.forwardRef(({className:e,inset:t,...n},a)=>s.jsx(nN,{ref:a,className:le("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",t&&"pl-8",e),...n}));Nl.displayName=nN.displayName;const GO=u.forwardRef(({className:e,children:t,checked:n,...a},r)=>s.jsxs(sN,{ref:r,className:le("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...a,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(rN,{children:s.jsx(Ol,{className:"h-4 w-4"})})}),t]}));GO.displayName=sN.displayName;const VO=u.forwardRef(({className:e,children:t,...n},a)=>s.jsxs(aN,{ref:a,className:le("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(rN,{children:s.jsx(_R,{className:"h-2 w-2 fill-current"})})}),t]}));VO.displayName=aN.displayName;const YO=u.forwardRef(({className:e,inset:t,...n},a)=>s.jsx(tN,{ref:a,className:le("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));YO.displayName=tN.displayName;const FO=u.forwardRef(({className:e,...t},n)=>s.jsx(lN,{ref:n,className:le("-mx-1 my-1 h-px bg-muted",e),...t}));FO.displayName=lN.displayName;const KO={default:"h-9 px-3 py-1 text-sm",control:"h-7 px-2 py-1 text-xs"},Nt=u.forwardRef(({className:e,type:t,inputSize:n="default",...a},r)=>s.jsx("input",{type:t,className:le("flex w-full rounded-md border border-input bg-transparent shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-disabled-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 read-only:cursor-default read-only:bg-muted read-only:text-muted-foreground read-only:border-dashed",KO[n],e),ref:r,...a}));Nt.displayName="Input";var XO="Label",cN=u.forwardRef((e,t)=>s.jsx(Te.label,{...e,ref:t,onMouseDown:n=>{var r;n.target.closest("button, input, select, textarea")||((r=e.onMouseDown)==null||r.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));cN.displayName=XO;var uN=cN;const QO=So("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),De=u.forwardRef(({className:e,...t},n)=>s.jsx(uN,{ref:n,className:le(QO(),e),...t}));De.displayName=uN.displayName;function Ha({title:e,description:t,backHref:n,backLabel:a,className:r,icon:l,link:i}){const o=s.jsx(P,{asChild:!0,variant:"outline",size:"sm",className:"mt-4 no-underline",children:s.jsx(i,{href:n,children:a})});return l?s.jsx("div",{className:le("flex-1 px-4 py-8 sm:px-6 lg:px-8",r),children:s.jsxs("section",{className:"mx-auto flex max-w-xl flex-col items-center text-center","data-testid":"not-found-state",children:[s.jsx("div",{className:"text-foreground mb-2 [&_svg]:size-8",children:l}),s.jsx("h1",{className:"m-0 text-xl font-semibold tracking-tight",children:e}),s.jsx("div",{className:"text-muted-foreground mt-2 space-y-2 text-sm",children:t}),o]})}):s.jsx("div",{className:le("flex-1 px-4 py-8 sm:px-6 lg:px-8",r),children:s.jsxs("section",{className:"border-border bg-card mx-auto max-w-xl rounded-xl border p-6",children:[s.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:e}),s.jsx("div",{className:"text-muted-foreground mt-2 space-y-2 text-sm",children:t}),o]})})}function Jt({title:e,description:t,actions:n,className:a,children:r,...l}){return s.jsxs("header",{"data-slot":"page-header",className:le("flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",a),...l,children:[s.jsxs("div",{className:"min-w-0 space-y-1",children:[s.jsx("h1",{className:"text-foreground text-2xl font-semibold tracking-tight",children:e}),t?s.jsx("p",{className:"text-muted-foreground text-sm",children:t}):null,r]}),n?s.jsx("div",{"data-slot":"page-header-actions",className:"flex shrink-0 items-center gap-2",children:n}):null]})}function ut({as:e="div",className:t,...n}){return s.jsx(e,{className:le("rounded-lg border",t),...n})}function Yv(e,[t,n]){return Math.min(n,Math.max(t,e))}var dN=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),WO="VisuallyHidden",fN=u.forwardRef((e,t)=>s.jsx(Te.span,{...e,ref:t,style:{...dN,...e.style}}));fN.displayName=WO;var ZO=fN,JO=[" ","Enter","ArrowUp","ArrowDown"],e4=[" ","Enter"],hr="Select",[Cd,Rd,t4]=Gp(hr),[Pl]=Cs(hr,[t4,Il]),Td=Il(),[n4,Ia]=Pl(hr),[s4,a4]=Pl(hr),hN=e=>{const{__scopeSelect:t,children:n,open:a,defaultOpen:r,onOpenChange:l,value:i,defaultValue:o,onValueChange:c,dir:d,name:f,autoComplete:h,disabled:m,required:x,form:b}=e,v=Td(t),[y,g]=u.useState(null),[p,j]=u.useState(null),[w,N]=u.useState(!1),C=gd(d),[_,S]=Da({prop:a,defaultProp:r??!1,onChange:l,caller:hr}),[$,O]=Da({prop:i,defaultProp:o,onChange:c,caller:hr}),G=u.useRef(null),V=y?b||!!y.closest("form"):!0,[L,U]=u.useState(new Set),A=Array.from(L).map(R=>R.props.value).join(";");return s.jsx(ex,{...v,children:s.jsxs(n4,{required:x,scope:t,trigger:y,onTriggerChange:g,valueNode:p,onValueNodeChange:j,valueNodeHasChildren:w,onValueNodeHasChildrenChange:N,contentId:Jn(),value:$,onValueChange:O,open:_,onOpenChange:S,dir:C,triggerPointerDownPosRef:G,disabled:m,children:[s.jsx(Cd.Provider,{scope:t,children:s.jsx(s4,{scope:e.__scopeSelect,onNativeOptionAdd:u.useCallback(R=>{U(E=>new Set(E).add(R))},[]),onNativeOptionRemove:u.useCallback(R=>{U(E=>{const k=new Set(E);return k.delete(R),k})},[]),children:n})}),V?s.jsxs(LN,{"aria-hidden":!0,required:x,tabIndex:-1,name:f,autoComplete:h,value:$,onChange:R=>O(R.target.value),disabled:m,form:b,children:[$===void 0?s.jsx("option",{value:""}):null,Array.from(L)]},A):null]})})};hN.displayName=hr;var mN="SelectTrigger",pN=u.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:a=!1,...r}=e,l=Td(n),i=Ia(mN,n),o=i.disabled||a,c=Ke(t,i.onTriggerChange),d=Rd(n),f=u.useRef("touch"),[h,m,x]=BN(v=>{const y=d().filter(j=>!j.disabled),g=y.find(j=>j.value===i.value),p=HN(y,v,g);p!==void 0&&i.onValueChange(p.value)}),b=v=>{o||(i.onOpenChange(!0),x()),v&&(i.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})};return s.jsx(tx,{asChild:!0,...l,children:s.jsx(Te.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:o,"data-disabled":o?"":void 0,"data-placeholder":UN(i.value)?"":void 0,...r,ref:c,onClick:fe(r.onClick,v=>{v.currentTarget.focus(),f.current!=="mouse"&&b(v)}),onPointerDown:fe(r.onPointerDown,v=>{f.current=v.pointerType;const y=v.target;y.hasPointerCapture(v.pointerId)&&y.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&v.pointerType==="mouse"&&(b(v),v.preventDefault())}),onKeyDown:fe(r.onKeyDown,v=>{const y=h.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&m(v.key),!(y&&v.key===" ")&&JO.includes(v.key)&&(b(),v.preventDefault())})})})});pN.displayName=mN;var xN="SelectValue",gN=u.forwardRef((e,t)=>{const{__scopeSelect:n,className:a,style:r,children:l,placeholder:i="",...o}=e,c=Ia(xN,n),{onValueNodeHasChildrenChange:d}=c,f=l!==void 0,h=Ke(t,c.onValueNodeChange);return Vt(()=>{d(f)},[d,f]),s.jsx(Te.span,{...o,ref:h,style:{pointerEvents:"none"},children:UN(c.value)?s.jsx(s.Fragment,{children:i}):l})});gN.displayName=xN;var r4="SelectIcon",vN=u.forwardRef((e,t)=>{const{__scopeSelect:n,children:a,...r}=e;return s.jsx(Te.span,{"aria-hidden":!0,...r,ref:t,children:a||"▼"})});vN.displayName=r4;var l4="SelectPortal",yN=e=>s.jsx(Ro,{asChild:!0,...e});yN.displayName=l4;var mr="SelectContent",jN=u.forwardRef((e,t)=>{const n=Ia(mr,e.__scopeSelect),[a,r]=u.useState();if(Vt(()=>{r(new DocumentFragment)},[]),!n.open){const l=a;return l?Cl.createPortal(s.jsx(bN,{scope:e.__scopeSelect,children:s.jsx(Cd.Slot,{scope:e.__scopeSelect,children:s.jsx("div",{children:e.children})})}),l):null}return s.jsx(wN,{...e,ref:t})});jN.displayName=mr;var Fn=10,[bN,Pa]=Pl(mr),i4="SelectContentImpl",o4=ur("SelectContent.RemoveScroll"),wN=u.forwardRef((e,t)=>{const{__scopeSelect:n,position:a="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:l,onPointerDownOutside:i,side:o,sideOffset:c,align:d,alignOffset:f,arrowPadding:h,collisionBoundary:m,collisionPadding:x,sticky:b,hideWhenDetached:v,avoidCollisions:y,...g}=e,p=Ia(mr,n),[j,w]=u.useState(null),[N,C]=u.useState(null),_=Ke(t,D=>w(D)),[S,$]=u.useState(null),[O,G]=u.useState(null),V=Rd(n),[L,U]=u.useState(!1),A=u.useRef(!1);u.useEffect(()=>{if(j)return Ep(j)},[j]),Tp();const R=u.useCallback(D=>{const[H,...te]=V().map(re=>re.ref.current),[se]=te.slice(-1),ye=document.activeElement;for(const re of D)if(re===ye||(re==null||re.scrollIntoView({block:"nearest"}),re===H&&N&&(N.scrollTop=0),re===se&&N&&(N.scrollTop=N.scrollHeight),re==null||re.focus(),document.activeElement!==ye))return},[V,N]),E=u.useCallback(()=>R([S,j]),[R,S,j]);u.useEffect(()=>{L&&E()},[L,E]);const{onOpenChange:k,triggerPointerDownPosRef:M}=p;u.useEffect(()=>{if(j){let D={x:0,y:0};const H=se=>{var ye,re;D={x:Math.abs(Math.round(se.pageX)-(((ye=M.current)==null?void 0:ye.x)??0)),y:Math.abs(Math.round(se.pageY)-(((re=M.current)==null?void 0:re.y)??0))}},te=se=>{D.x<=10&&D.y<=10?se.preventDefault():j.contains(se.target)||k(!1),document.removeEventListener("pointermove",H),M.current=null};return M.current!==null&&(document.addEventListener("pointermove",H),document.addEventListener("pointerup",te,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",H),document.removeEventListener("pointerup",te,{capture:!0})}}},[j,k,M]),u.useEffect(()=>{const D=()=>k(!1);return window.addEventListener("blur",D),window.addEventListener("resize",D),()=>{window.removeEventListener("blur",D),window.removeEventListener("resize",D)}},[k]);const[K,T]=BN(D=>{const H=V().filter(ye=>!ye.disabled),te=H.find(ye=>ye.ref.current===document.activeElement),se=HN(H,D,te);se&&setTimeout(()=>se.ref.current.focus())}),B=u.useCallback((D,H,te)=>{const se=!A.current&&!te;(p.value!==void 0&&p.value===H||se)&&($(D),se&&(A.current=!0))},[p.value]),F=u.useCallback(()=>j==null?void 0:j.focus(),[j]),J=u.useCallback((D,H,te)=>{const se=!A.current&&!te;(p.value!==void 0&&p.value===H||se)&&G(D)},[p.value]),he=a==="popper"?rm:_N,X=he===rm?{side:o,sideOffset:c,align:d,alignOffset:f,arrowPadding:h,collisionBoundary:m,collisionPadding:x,sticky:b,hideWhenDetached:v,avoidCollisions:y}:{};return s.jsx(bN,{scope:n,content:j,viewport:N,onViewportChange:C,itemRefCallback:B,selectedItem:S,onItemLeave:F,itemTextRefCallback:J,focusSelectedItem:E,selectedItemText:O,position:a,isPositioned:L,searchRef:K,children:s.jsx(hd,{as:o4,allowPinchZoom:!0,children:s.jsx(dd,{asChild:!0,trapped:p.open,onMountAutoFocus:D=>{D.preventDefault()},onUnmountAutoFocus:fe(r,D=>{var H;(H=p.trigger)==null||H.focus({preventScroll:!0}),D.preventDefault()}),children:s.jsx(Co,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:i,onFocusOutside:D=>D.preventDefault(),onDismiss:()=>p.onOpenChange(!1),children:s.jsx(he,{role:"listbox",id:p.contentId,"data-state":p.open?"open":"closed",dir:p.dir,onContextMenu:D=>D.preventDefault(),...g,...X,onPlaced:()=>U(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:fe(g.onKeyDown,D=>{const H=D.ctrlKey||D.altKey||D.metaKey;if(D.key==="Tab"&&D.preventDefault(),!H&&D.key.length===1&&T(D.key),["ArrowUp","ArrowDown","Home","End"].includes(D.key)){let se=V().filter(ye=>!ye.disabled).map(ye=>ye.ref.current);if(["ArrowUp","End"].includes(D.key)&&(se=se.slice().reverse()),["ArrowUp","ArrowDown"].includes(D.key)){const ye=D.target,re=se.indexOf(ye);se=se.slice(re+1)}setTimeout(()=>R(se)),D.preventDefault()}})})})})})})});wN.displayName=i4;var c4="SelectItemAlignedPosition",_N=u.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:a,...r}=e,l=Ia(mr,n),i=Pa(mr,n),[o,c]=u.useState(null),[d,f]=u.useState(null),h=Ke(t,_=>f(_)),m=Rd(n),x=u.useRef(!1),b=u.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:g,focusSelectedItem:p}=i,j=u.useCallback(()=>{if(l.trigger&&l.valueNode&&o&&d&&v&&y&&g){const _=l.trigger.getBoundingClientRect(),S=d.getBoundingClientRect(),$=l.valueNode.getBoundingClientRect(),O=g.getBoundingClientRect();if(l.dir!=="rtl"){const ye=O.left-S.left,re=$.left-ye,we=_.left-re,ne=_.width+we,rt=Math.max(ne,S.width),de=window.innerWidth-Fn,Be=Yv(re,[Fn,Math.max(Fn,de-rt)]);o.style.minWidth=ne+"px",o.style.left=Be+"px"}else{const ye=S.right-O.right,re=window.innerWidth-$.right-ye,we=window.innerWidth-_.right-re,ne=_.width+we,rt=Math.max(ne,S.width),de=window.innerWidth-Fn,Be=Yv(re,[Fn,Math.max(Fn,de-rt)]);o.style.minWidth=ne+"px",o.style.right=Be+"px"}const G=m(),V=window.innerHeight-Fn*2,L=v.scrollHeight,U=window.getComputedStyle(d),A=parseInt(U.borderTopWidth,10),R=parseInt(U.paddingTop,10),E=parseInt(U.borderBottomWidth,10),k=parseInt(U.paddingBottom,10),M=A+R+L+k+E,K=Math.min(y.offsetHeight*5,M),T=window.getComputedStyle(v),B=parseInt(T.paddingTop,10),F=parseInt(T.paddingBottom,10),J=_.top+_.height/2-Fn,he=V-J,X=y.offsetHeight/2,D=y.offsetTop+X,H=A+R+D,te=M-H;if(H<=J){const ye=G.length>0&&y===G[G.length-1].ref.current;o.style.bottom="0px";const re=d.clientHeight-v.offsetTop-v.offsetHeight,we=Math.max(he,X+(ye?F:0)+re+E),ne=H+we;o.style.height=ne+"px"}else{const ye=G.length>0&&y===G[0].ref.current;o.style.top="0px";const we=Math.max(J,A+v.offsetTop+(ye?B:0)+X)+te;o.style.height=we+"px",v.scrollTop=H-J+v.offsetTop}o.style.margin=`${Fn}px 0`,o.style.minHeight=K+"px",o.style.maxHeight=V+"px",a==null||a(),requestAnimationFrame(()=>x.current=!0)}},[m,l.trigger,l.valueNode,o,d,v,y,g,l.dir,a]);Vt(()=>j(),[j]);const[w,N]=u.useState();Vt(()=>{d&&N(window.getComputedStyle(d).zIndex)},[d]);const C=u.useCallback(_=>{_&&b.current===!0&&(j(),p==null||p(),b.current=!1)},[j,p]);return s.jsx(d4,{scope:n,contentWrapper:o,shouldExpandOnScrollRef:x,onScrollButtonChange:C,children:s.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:s.jsx(Te.div,{...r,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});_N.displayName=c4;var u4="SelectPopperPosition",rm=u.forwardRef((e,t)=>{const{__scopeSelect:n,align:a="start",collisionPadding:r=Fn,...l}=e,i=Td(n);return s.jsx(nx,{...i,...l,ref:t,align:a,collisionPadding:r,style:{boxSizing:"border-box",...l.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});rm.displayName=u4;var[d4,dx]=Pl(mr,{}),lm="SelectViewport",NN=u.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:a,...r}=e,l=Pa(lm,n),i=dx(lm,n),o=Ke(t,l.onViewportChange),c=u.useRef(0);return s.jsxs(s.Fragment,{children:[s.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),s.jsx(Cd.Slot,{scope:n,children:s.jsx(Te.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:o,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:fe(r.onScroll,d=>{const f=d.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:m}=i;if(m!=null&&m.current&&h){const x=Math.abs(c.current-f.scrollTop);if(x>0){const b=window.innerHeight-Fn*2,v=parseFloat(h.style.minHeight),y=parseFloat(h.style.height),g=Math.max(v,y);if(g<b){const p=g+x,j=Math.min(b,p),w=p-j;h.style.height=j+"px",h.style.bottom==="0px"&&(f.scrollTop=w>0?w:0,h.style.justifyContent="flex-end")}}}c.current=f.scrollTop})})})]})});NN.displayName=lm;var kN="SelectGroup",[f4,h4]=Pl(kN),m4=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,r=Jn();return s.jsx(f4,{scope:n,id:r,children:s.jsx(Te.div,{role:"group","aria-labelledby":r,...a,ref:t})})});m4.displayName=kN;var SN="SelectLabel",CN=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,r=h4(SN,n);return s.jsx(Te.div,{id:r.id,...a,ref:t})});CN.displayName=SN;var Su="SelectItem",[p4,RN]=Pl(Su),TN=u.forwardRef((e,t)=>{const{__scopeSelect:n,value:a,disabled:r=!1,textValue:l,...i}=e,o=Ia(Su,n),c=Pa(Su,n),d=o.value===a,[f,h]=u.useState(l??""),[m,x]=u.useState(!1),b=Ke(t,p=>{var j;return(j=c.itemRefCallback)==null?void 0:j.call(c,p,a,r)}),v=Jn(),y=u.useRef("touch"),g=()=>{r||(o.onValueChange(a),o.onOpenChange(!1))};if(a==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return s.jsx(p4,{scope:n,value:a,disabled:r,textId:v,isSelected:d,onItemTextChange:u.useCallback(p=>{h(j=>j||((p==null?void 0:p.textContent)??"").trim())},[]),children:s.jsx(Cd.ItemSlot,{scope:n,value:a,disabled:r,textValue:f,children:s.jsx(Te.div,{role:"option","aria-labelledby":v,"data-highlighted":m?"":void 0,"aria-selected":d&&m,"data-state":d?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...i,ref:b,onFocus:fe(i.onFocus,()=>x(!0)),onBlur:fe(i.onBlur,()=>x(!1)),onClick:fe(i.onClick,()=>{y.current!=="mouse"&&g()}),onPointerUp:fe(i.onPointerUp,()=>{y.current==="mouse"&&g()}),onPointerDown:fe(i.onPointerDown,p=>{y.current=p.pointerType}),onPointerMove:fe(i.onPointerMove,p=>{var j;y.current=p.pointerType,r?(j=c.onItemLeave)==null||j.call(c):y.current==="mouse"&&p.currentTarget.focus({preventScroll:!0})}),onPointerLeave:fe(i.onPointerLeave,p=>{var j;p.currentTarget===document.activeElement&&((j=c.onItemLeave)==null||j.call(c))}),onKeyDown:fe(i.onKeyDown,p=>{var w;((w=c.searchRef)==null?void 0:w.current)!==""&&p.key===" "||(e4.includes(p.key)&&g(),p.key===" "&&p.preventDefault())})})})})});TN.displayName=Su;var hi="SelectItemText",EN=u.forwardRef((e,t)=>{const{__scopeSelect:n,className:a,style:r,...l}=e,i=Ia(hi,n),o=Pa(hi,n),c=RN(hi,n),d=a4(hi,n),[f,h]=u.useState(null),m=Ke(t,g=>h(g),c.onItemTextChange,g=>{var p;return(p=o.itemTextRefCallback)==null?void 0:p.call(o,g,c.value,c.disabled)}),x=f==null?void 0:f.textContent,b=u.useMemo(()=>s.jsx("option",{value:c.value,disabled:c.disabled,children:x},c.value),[c.disabled,c.value,x]),{onNativeOptionAdd:v,onNativeOptionRemove:y}=d;return Vt(()=>(v(b),()=>y(b)),[v,y,b]),s.jsxs(s.Fragment,{children:[s.jsx(Te.span,{id:c.textId,...l,ref:m}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Cl.createPortal(l.children,i.valueNode):null]})});EN.displayName=hi;var AN="SelectItemIndicator",MN=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e;return RN(AN,n).isSelected?s.jsx(Te.span,{"aria-hidden":!0,...a,ref:t}):null});MN.displayName=AN;var im="SelectScrollUpButton",$N=u.forwardRef((e,t)=>{const n=Pa(im,e.__scopeSelect),a=dx(im,e.__scopeSelect),[r,l]=u.useState(!1),i=Ke(t,a.onScrollButtonChange);return Vt(()=>{if(n.viewport&&n.isPositioned){let o=function(){const d=c.scrollTop>0;l(d)};const c=n.viewport;return o(),c.addEventListener("scroll",o),()=>c.removeEventListener("scroll",o)}},[n.viewport,n.isPositioned]),r?s.jsx(DN,{...e,ref:i,onAutoScroll:()=>{const{viewport:o,selectedItem:c}=n;o&&c&&(o.scrollTop=o.scrollTop-c.offsetHeight)}}):null});$N.displayName=im;var om="SelectScrollDownButton",ON=u.forwardRef((e,t)=>{const n=Pa(om,e.__scopeSelect),a=dx(om,e.__scopeSelect),[r,l]=u.useState(!1),i=Ke(t,a.onScrollButtonChange);return Vt(()=>{if(n.viewport&&n.isPositioned){let o=function(){const d=c.scrollHeight-c.clientHeight,f=Math.ceil(c.scrollTop)<d;l(f)};const c=n.viewport;return o(),c.addEventListener("scroll",o),()=>c.removeEventListener("scroll",o)}},[n.viewport,n.isPositioned]),r?s.jsx(DN,{...e,ref:i,onAutoScroll:()=>{const{viewport:o,selectedItem:c}=n;o&&c&&(o.scrollTop=o.scrollTop+c.offsetHeight)}}):null});ON.displayName=om;var DN=u.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:a,...r}=e,l=Pa("SelectScrollButton",n),i=u.useRef(null),o=Rd(n),c=u.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return u.useEffect(()=>()=>c(),[c]),Vt(()=>{var f;const d=o().find(h=>h.ref.current===document.activeElement);(f=d==null?void 0:d.ref.current)==null||f.scrollIntoView({block:"nearest"})},[o]),s.jsx(Te.div,{"aria-hidden":!0,...r,ref:t,style:{flexShrink:0,...r.style},onPointerDown:fe(r.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(a,50))}),onPointerMove:fe(r.onPointerMove,()=>{var d;(d=l.onItemLeave)==null||d.call(l),i.current===null&&(i.current=window.setInterval(a,50))}),onPointerLeave:fe(r.onPointerLeave,()=>{c()})})}),x4="SelectSeparator",zN=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e;return s.jsx(Te.div,{"aria-hidden":!0,...a,ref:t})});zN.displayName=x4;var cm="SelectArrow",g4=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,r=Td(n),l=Ia(cm,n),i=Pa(cm,n);return l.open&&i.position==="popper"?s.jsx(sx,{...r,...a,ref:t}):null});g4.displayName=cm;var v4="SelectBubbleInput",LN=u.forwardRef(({__scopeSelect:e,value:t,...n},a)=>{const r=u.useRef(null),l=Ke(a,r),i=Ow(t);return u.useEffect(()=>{const o=r.current;if(!o)return;const c=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&f){const h=new Event("change",{bubbles:!0});f.call(o,t),o.dispatchEvent(h)}},[i,t]),s.jsx(Te.select,{...n,style:{...dN,...n.style},ref:l,defaultValue:t})});LN.displayName=v4;function UN(e){return e===""||e===void 0}function BN(e){const t=_s(e),n=u.useRef(""),a=u.useRef(0),r=u.useCallback(i=>{const o=n.current+i;t(o),function c(d){n.current=d,window.clearTimeout(a.current),d!==""&&(a.current=window.setTimeout(()=>c(""),1e3))}(o)},[t]),l=u.useCallback(()=>{n.current="",window.clearTimeout(a.current)},[]);return u.useEffect(()=>()=>window.clearTimeout(a.current),[]),[n,r,l]}function HN(e,t,n){const r=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,l=n?e.indexOf(n):-1;let i=y4(e,Math.max(l,0));r.length===1&&(i=i.filter(d=>d!==n));const c=i.find(d=>d.textValue.toLowerCase().startsWith(r.toLowerCase()));return c!==n?c:void 0}function y4(e,t){return e.map((n,a)=>e[(t+a)%e.length])}var j4=hN,IN=pN,b4=gN,w4=vN,_4=yN,PN=jN,N4=NN,qN=CN,GN=TN,k4=EN,S4=MN,VN=$N,YN=ON,FN=zN;const C4={default:"h-9 px-3 py-2 text-sm",control:"h-7 px-2 py-1 text-xs"},gt=j4,vt=b4,ft=u.forwardRef(({className:e,children:t,triggerSize:n="default",...a},r)=>s.jsxs(IN,{ref:r,className:le("flex w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent shadow-sm ring-offset-background data-[placeholder]:text-disabled-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",C4[n],e),...a,children:[t,s.jsx(w4,{asChild:!0,children:s.jsx($0,{className:"text-muted-foreground size-4","aria-hidden":"true"})})]}));ft.displayName=IN.displayName;const KN=u.forwardRef(({className:e,...t},n)=>s.jsx(VN,{ref:n,className:le("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(vR,{className:"size-4","aria-hidden":"true"})}));KN.displayName=VN.displayName;const XN=u.forwardRef(({className:e,...t},n)=>s.jsx(YN,{ref:n,className:le("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(Np,{className:"size-4","aria-hidden":"true"})}));XN.displayName=YN.displayName;const ht=u.forwardRef(({className:e,children:t,position:n="popper",...a},r)=>s.jsx(_4,{container:To(),children:s.jsxs(PN,{ref:r,className:le("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...a,children:[s.jsx(KN,{}),s.jsx(N4,{className:le("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),s.jsx(XN,{})]})}));ht.displayName=PN.displayName;const R4=u.forwardRef(({className:e,...t},n)=>s.jsx(qN,{ref:n,className:le("px-2 py-1.5 text-sm font-semibold",e),...t}));R4.displayName=qN.displayName;const Ee=u.forwardRef(({className:e,children:t,...n},a)=>s.jsxs(GN,{ref:a,className:le("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[s.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(S4,{children:s.jsx(Ol,{className:"size-4","aria-hidden":"true"})})}),s.jsx(k4,{children:t})]}));Ee.displayName=GN.displayName;const T4=u.forwardRef(({className:e,...t},n)=>s.jsx(FN,{ref:n,className:le("-mx-1 my-1 h-px bg-muted",e),...t}));T4.displayName=FN.displayName;function _t({className:e,...t}){return s.jsx("div",{className:le("animate-pulse rounded-md bg-primary/10",e),...t})}const Ye=u.forwardRef(({className:e,containerClassName:t,containerRef:n,containerTabIndex:a,containerAriaLabel:r,...l},i)=>s.jsx("div",{ref:n,tabIndex:a,"aria-label":r,className:le("relative w-full overflow-auto",t),children:s.jsx("table",{ref:i,className:le("w-full caption-bottom text-sm",e),...l})}));Ye.displayName="Table";const We=u.forwardRef(({className:e,...t},n)=>s.jsx("thead",{ref:n,className:le("[&_tr]:border-b",e),...t}));We.displayName="TableHeader";const Fe=u.forwardRef(({className:e,...t},n)=>s.jsx("tbody",{ref:n,className:le("[&_tr:last-child]:border-0",e),...t}));Fe.displayName="TableBody";const E4=u.forwardRef(({className:e,...t},n)=>s.jsx("tfoot",{ref:n,className:le("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t}));E4.displayName="TableFooter";const ue=u.forwardRef(({className:e,...t},n)=>s.jsx("tr",{ref:n,className:le("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t}));ue.displayName="TableRow";const W=u.forwardRef(({className:e,...t},n)=>s.jsx("th",{ref:n,className:le("text-muted-foreground h-10 px-2 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));W.displayName="TableHead";const Y=u.forwardRef(({className:e,...t},n)=>s.jsx("td",{ref:n,className:le("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));Y.displayName="TableCell";const A4=u.forwardRef(({className:e,...t},n)=>s.jsx("caption",{ref:n,className:le("text-muted-foreground mt-4 text-sm",e),...t}));A4.displayName="TableCaption";var Ed="Tabs",[M4]=Cs(Ed,[bd]),QN=bd(),[$4,fx]=M4(Ed),WN=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,onValueChange:r,defaultValue:l,orientation:i="horizontal",dir:o,activationMode:c="automatic",...d}=e,f=gd(o),[h,m]=Da({prop:a,onChange:r,defaultProp:l??"",caller:Ed});return s.jsx($4,{scope:n,baseId:Jn(),value:h,onValueChange:m,orientation:i,dir:f,activationMode:c,children:s.jsx(Te.div,{dir:f,"data-orientation":i,...d,ref:t})})});WN.displayName=Ed;var ZN="TabsList",JN=u.forwardRef((e,t)=>{const{__scopeTabs:n,loop:a=!0,...r}=e,l=fx(ZN,n),i=QN(n);return s.jsx(m_,{asChild:!0,...i,orientation:l.orientation,dir:l.dir,loop:a,children:s.jsx(Te.div,{role:"tablist","aria-orientation":l.orientation,...r,ref:t})})});JN.displayName=ZN;var ek="TabsTrigger",tk=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,disabled:r=!1,...l}=e,i=fx(ek,n),o=QN(n),c=ak(i.baseId,a),d=rk(i.baseId,a),f=a===i.value;return s.jsx(p_,{asChild:!0,...o,focusable:!r,active:f,children:s.jsx(Te.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":d,"data-state":f?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:c,...l,ref:t,onMouseDown:fe(e.onMouseDown,h=>{!r&&h.button===0&&h.ctrlKey===!1?i.onValueChange(a):h.preventDefault()}),onKeyDown:fe(e.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&i.onValueChange(a)}),onFocus:fe(e.onFocus,()=>{const h=i.activationMode!=="manual";!f&&!r&&h&&i.onValueChange(a)})})})});tk.displayName=ek;var nk="TabsContent",sk=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,forceMount:r,children:l,...i}=e,o=fx(nk,n),c=ak(o.baseId,a),d=rk(o.baseId,a),f=a===o.value,h=u.useRef(f);return u.useEffect(()=>{const m=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(m)},[]),s.jsx(Yn,{present:r||f,children:({present:m})=>s.jsx(Te.div,{"data-state":f?"active":"inactive","data-orientation":o.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:d,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:m&&l})})});sk.displayName=nk;function ak(e,t){return`${e}-trigger-${t}`}function rk(e,t){return`${e}-content-${t}`}var O4=WN,lk=JN,ik=tk,ok=sk;const D4=O4,ck=u.forwardRef(({className:e,...t},n)=>s.jsx(lk,{ref:n,className:le("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));ck.displayName=lk.displayName;const um=u.forwardRef(({className:e,...t},n)=>s.jsx(ik,{ref:n,className:le("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...t}));um.displayName=ik.displayName;const z4=u.forwardRef(({className:e,...t},n)=>s.jsx(ok,{ref:n,className:le("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));z4.displayName=ok.displayName;const An=u.forwardRef(({className:e,...t},n)=>s.jsx("textarea",{className:le("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-disabled-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 read-only:cursor-default read-only:bg-muted read-only:text-muted-foreground read-only:border-dashed",e),ref:n,...t}));An.displayName="Textarea";var[Ad]=Cs("Tooltip",[Il]),Md=Il(),uk="TooltipProvider",L4=700,dm="tooltip.open",[U4,hx]=Ad(uk),dk=e=>{const{__scopeTooltip:t,delayDuration:n=L4,skipDelayDuration:a=300,disableHoverableContent:r=!1,children:l}=e,i=u.useRef(!0),o=u.useRef(!1),c=u.useRef(0);return u.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),s.jsx(U4,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:u.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:u.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,a)},[a]),isPointerInTransitRef:o,onPointerInTransitChange:u.useCallback(d=>{o.current=d},[]),disableHoverableContent:r,children:l})};dk.displayName=uk;var eo="Tooltip",[B4,zo]=Ad(eo),fk=e=>{const{__scopeTooltip:t,children:n,open:a,defaultOpen:r,onOpenChange:l,disableHoverableContent:i,delayDuration:o}=e,c=hx(eo,e.__scopeTooltip),d=Md(t),[f,h]=u.useState(null),m=Jn(),x=u.useRef(0),b=i??c.disableHoverableContent,v=o??c.delayDuration,y=u.useRef(!1),[g,p]=Da({prop:a,defaultProp:r??!1,onChange:_=>{_?(c.onOpen(),document.dispatchEvent(new CustomEvent(dm))):c.onClose(),l==null||l(_)},caller:eo}),j=u.useMemo(()=>g?y.current?"delayed-open":"instant-open":"closed",[g]),w=u.useCallback(()=>{window.clearTimeout(x.current),x.current=0,y.current=!1,p(!0)},[p]),N=u.useCallback(()=>{window.clearTimeout(x.current),x.current=0,p(!1)},[p]),C=u.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{y.current=!0,p(!0),x.current=0},v)},[v,p]);return u.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),s.jsx(ex,{...d,children:s.jsx(B4,{scope:t,contentId:m,open:g,stateAttribute:j,trigger:f,onTriggerChange:h,onTriggerEnter:u.useCallback(()=>{c.isOpenDelayedRef.current?C():w()},[c.isOpenDelayedRef,C,w]),onTriggerLeave:u.useCallback(()=>{b?N():(window.clearTimeout(x.current),x.current=0)},[N,b]),onOpen:w,onClose:N,disableHoverableContent:b,children:n})})};fk.displayName=eo;var fm="TooltipTrigger",hk=u.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,r=zo(fm,n),l=hx(fm,n),i=Md(n),o=u.useRef(null),c=Ke(t,o,r.onTriggerChange),d=u.useRef(!1),f=u.useRef(!1),h=u.useCallback(()=>d.current=!1,[]);return u.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),s.jsx(tx,{asChild:!0,...i,children:s.jsx(Te.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...a,ref:c,onPointerMove:fe(e.onPointerMove,m=>{m.pointerType!=="touch"&&!f.current&&!l.isPointerInTransitRef.current&&(r.onTriggerEnter(),f.current=!0)}),onPointerLeave:fe(e.onPointerLeave,()=>{r.onTriggerLeave(),f.current=!1}),onPointerDown:fe(e.onPointerDown,()=>{r.open&&r.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:fe(e.onFocus,()=>{d.current||r.onOpen()}),onBlur:fe(e.onBlur,r.onClose),onClick:fe(e.onClick,r.onClose)})})});hk.displayName=fm;var mx="TooltipPortal",[H4,I4]=Ad(mx,{forceMount:void 0}),mk=e=>{const{__scopeTooltip:t,forceMount:n,children:a,container:r}=e,l=zo(mx,t);return s.jsx(H4,{scope:t,forceMount:n,children:s.jsx(Yn,{present:n||l.open,children:s.jsx(Ro,{asChild:!0,container:r,children:a})})})};mk.displayName=mx;var kl="TooltipContent",pk=u.forwardRef((e,t)=>{const n=I4(kl,e.__scopeTooltip),{forceMount:a=n.forceMount,side:r="top",...l}=e,i=zo(kl,e.__scopeTooltip);return s.jsx(Yn,{present:a||i.open,children:i.disableHoverableContent?s.jsx(xk,{side:r,...l,ref:t}):s.jsx(P4,{side:r,...l,ref:t})})}),P4=u.forwardRef((e,t)=>{const n=zo(kl,e.__scopeTooltip),a=hx(kl,e.__scopeTooltip),r=u.useRef(null),l=Ke(t,r),[i,o]=u.useState(null),{trigger:c,onClose:d}=n,f=r.current,{onPointerInTransitChange:h}=a,m=u.useCallback(()=>{o(null),h(!1)},[h]),x=u.useCallback((b,v)=>{const y=b.currentTarget,g={x:b.clientX,y:b.clientY},p=F4(g,y.getBoundingClientRect()),j=K4(g,p),w=X4(v.getBoundingClientRect()),N=W4([...j,...w]);o(N),h(!0)},[h]);return u.useEffect(()=>()=>m(),[m]),u.useEffect(()=>{if(c&&f){const b=y=>x(y,f),v=y=>x(y,c);return c.addEventListener("pointerleave",b),f.addEventListener("pointerleave",v),()=>{c.removeEventListener("pointerleave",b),f.removeEventListener("pointerleave",v)}}},[c,f,x,m]),u.useEffect(()=>{if(i){const b=v=>{const y=v.target,g={x:v.clientX,y:v.clientY},p=(c==null?void 0:c.contains(y))||(f==null?void 0:f.contains(y)),j=!Q4(g,i);p?m():j&&(m(),d())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[c,f,i,d,m]),s.jsx(xk,{...e,ref:l})}),[q4,G4]=Ad(eo,{isInside:!1}),V4=LE("TooltipContent"),xk=u.forwardRef((e,t)=>{const{__scopeTooltip:n,children:a,"aria-label":r,onEscapeKeyDown:l,onPointerDownOutside:i,...o}=e,c=zo(kl,n),d=Md(n),{onClose:f}=c;return u.useEffect(()=>(document.addEventListener(dm,f),()=>document.removeEventListener(dm,f)),[f]),u.useEffect(()=>{if(c.trigger){const h=m=>{const x=m.target;x!=null&&x.contains(c.trigger)&&f()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,f]),s.jsx(Co,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:i,onFocusOutside:h=>h.preventDefault(),onDismiss:f,children:s.jsxs(nx,{"data-state":c.stateAttribute,...d,...o,ref:t,style:{...o.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[s.jsx(V4,{children:a}),s.jsx(q4,{scope:n,isInside:!0,children:s.jsx(ZO,{id:c.contentId,role:"tooltip",children:r||a})})]})})});pk.displayName=kl;var gk="TooltipArrow",Y4=u.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,r=Md(n);return G4(gk,n).isInside?null:s.jsx(sx,{...r,...a,ref:t})});Y4.displayName=gk;function F4(e,t){const n=Math.abs(t.top-e.y),a=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),l=Math.abs(t.left-e.x);switch(Math.min(n,a,r,l)){case l:return"left";case r:return"right";case n:return"top";case a:return"bottom";default:throw new Error("unreachable")}}function K4(e,t,n=5){const a=[];switch(t){case"top":a.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":a.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":a.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":a.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return a}function X4(e){const{top:t,right:n,bottom:a,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:a},{x:r,y:a}]}function Q4(e,t){const{x:n,y:a}=e;let r=!1;for(let l=0,i=t.length-1;l<t.length;i=l++){const o=t[l],c=t[i],d=o.x,f=o.y,h=c.x,m=c.y;f>a!=m>a&&n<(h-d)*(a-f)/(m-f)+d&&(r=!r)}return r}function W4(e){const t=e.slice();return t.sort((n,a)=>n.x<a.x?-1:n.x>a.x?1:n.y<a.y?-1:n.y>a.y?1:0),Z4(t)}function Z4(e){if(e.length<=1)return e.slice();const t=[];for(let a=0;a<e.length;a++){const r=e[a];for(;t.length>=2;){const l=t[t.length-1],i=t[t.length-2];if((l.x-i.x)*(r.y-i.y)>=(l.y-i.y)*(r.x-i.x))t.pop();else break}t.push(r)}t.pop();const n=[];for(let a=e.length-1;a>=0;a--){const r=e[a];for(;n.length>=2;){const l=n[n.length-1],i=n[n.length-2];if((l.x-i.x)*(r.y-i.y)>=(l.y-i.y)*(r.x-i.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var J4=dk,eD=fk,tD=hk,nD=mk,vk=pk;const yk=J4,jk=eD,bk=tD,px=u.forwardRef(({className:e,sideOffset:t=4,...n},a)=>{const r=To(),l=s.jsx(vk,{ref:a,sideOffset:t,className:le("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n});return r?s.jsx(nD,{container:r,children:l}):l});px.displayName=vk.displayName;function Zs({page:e,header:t}){return s.jsxs(s.Fragment,{children:[t??s.jsx(Jt,{title:e}),s.jsx(sD,{page:e})]})}function sD({page:e}){return s.jsxs(me,{variant:"info",role:"status",className:"mt-6","data-testid":"not-installed",children:[s.jsx(ws,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:B0(e)})]})}const Fv=["none","read","comment","write","manage","admin"];function Cu(e,t){return Fv.indexOf(e??"none")>=Fv.indexOf(t)}function xx(e){return e==="api_key"?"API key":e==="sdlc_login"?"sdlc login":null}function Uf(e,t){const n=xx(e);return e==="sdlc_login"&&t?`${n} on ${wk(t)}`:n}const aD=String.fromCodePoint(8296),rD=String.fromCodePoint(8297);function wk(e){return`${aD}${e}${rD}`}const to={blocked:{label:"Blocked",tone:"warning"},waiting_for_user:{label:"Waiting for a member",tone:"warning"},waiting_for_external:{label:"Waiting outside",tone:"warning"},paused:{label:"Paused",tone:"neutral"}},lD={backlog:"neutral",planned:"neutral",in_progress:"info",completed:"success",canceled:"neutral"};function _k(e){return e.name==="Blocked"?"warning":lD[e.category]}const Kv=1800;function as(e){return new Date(e).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function es(e){return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function gx(e){return`${Pn(e)}, ${es(e)}`}function ai(e){return e<90?`${Math.round(e)} s`:e<5400?`${Math.round(e/60)} min`:`${(e/3600).toFixed(1).replace(/\.0$/,"")} h`}function Pn(e){return new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function Nk(e){return new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function iD(e){if(e.open_holds===0)return null;if(e.released_holds===e.open_holds)return{label:`${e.released_holds} ready to resolve`,tone:"neutral"};const t=e.open_holds-e.released_holds;return{label:e.released_holds>0?`${t} open · ${e.released_holds} ready`:`${t} open`,tone:"warning"}}function oD(e){return{"task.created":"Created the task","task.title_changed":"Changed the title","task.description_changed":"Changed the description","task.status_changed":"Changed the status","task.priority_changed":"Changed the priority","task.primary_changed":"Changed the primary","task.custom_fields_changed":"Changed a field","task.archived":"Archived the task","task.restored":"Restored the task","task.reordered":"Moved the task","task.reparented":"Moved the task under another","task.contributor_added":"Added a contributor","task.contributor_removed":"Removed a contributor","task.checklist_item_added":"Added a checklist item","task.checklist_item_edited":"Edited a checklist item","task.checklist_item_toggled":"Checked off a checklist item","task.checklist_item_moved":"Moved a checklist item","task.checklist_item_archived":"Removed a checklist item","task.hold_opened":"Opened a hold","task.hold_released":"Released a hold","task.hold_resolved":"Resolved a hold","task.claimed":"Claimed the task","task.claim_released":"Released a claim","task.claim_completed":"Finished a claim","task.claim_expired":"Ended a lapsed claim","task.relation_added":"Linked a task","task.relation_archived":"Unlinked a task","task.project_linked":"Linked a project","task.project_unlinked":"Unlinked a project"}[e.event_type]??"Changed the task"}const ia="not_set";function cD({open:e,commands:t,list_id:n,list_revision:a,default_status_id:r,statuses:l,priorities:i,members:o,on_close:c,on_created:d}){var V;const f=yr(),[h,m]=u.useState(""),[x,b]=u.useState(""),[v,y]=u.useState(r??((V=l[0])==null?void 0:V.id)??""),[g,p]=u.useState(ia),[j,w]=u.useState(ia),[N,C]=u.useState(!1),[_,S]=u.useState(null),[$,O]=u.useState(!1);u.useEffect(()=>{var L;e&&(m(""),b(""),y(r??((L=l[0])==null?void 0:L.id)??""),p(ia),w(ia),C(!1),S(null))},[e,r,l]);const G=async L=>{if(L.preventDefault(),!h.trim()){C(!0);return}O(!0),S(null);try{const U=await t.run("create_task",{list_id:n,expected_list_revision:a,title:h.trim(),description:x.trim()||null,status_id:v||null,priority_id:g===ia?null:g,primary_user_id:j===ia?null:j});if(!U.ok){S(U.refusal.message);return}f.success("Task created."),await d()}finally{O(!1)}};return s.jsx(dn,{open:e,onOpenChange:L=>L?null:c(),children:s.jsx(fn,{children:s.jsxs("form",{onSubmit:L=>void G(L),noValidate:!0,children:[s.jsxs(hn,{children:[s.jsx(pn,{children:"New task"}),s.jsx(xn,{children:"Add a task to this List."})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[_&&s.jsxs(me,{variant:"destructive",children:[s.jsx(st,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:_})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(De,{htmlFor:"new-task-title",children:"Title"}),s.jsx(Nt,{id:"new-task-title",placeholder:"What needs doing",value:h,required:!0,"aria-invalid":N,"aria-describedby":N?"new-task-title-error":void 0,onChange:L=>{m(L.target.value),C(!1)}}),N&&s.jsx("p",{id:"new-task-title-error",className:"text-destructive text-xs",children:"Give the task a title."})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(De,{htmlFor:"new-task-description",children:"Description (optional)"}),s.jsx(An,{id:"new-task-description",rows:4,value:x,onChange:L=>b(L.target.value)})]}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(De,{htmlFor:"new-task-status",children:"Status"}),s.jsxs(gt,{value:v,onValueChange:y,children:[s.jsx(ft,{id:"new-task-status",children:s.jsx(vt,{})}),s.jsx(ht,{children:l.map(L=>s.jsx(Ee,{value:L.id,children:L.name},L.id))})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(De,{htmlFor:"new-task-priority",children:"Priority"}),s.jsxs(gt,{value:g,onValueChange:p,children:[s.jsx(ft,{id:"new-task-priority",children:s.jsx(vt,{})}),s.jsxs(ht,{children:[s.jsx(Ee,{value:ia,children:"Not set"}),i.map(L=>s.jsx(Ee,{value:L.id,children:L.name},L.id))]})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(De,{htmlFor:"new-task-primary",children:"Primary"}),s.jsxs(gt,{value:j,onValueChange:w,children:[s.jsx(ft,{id:"new-task-primary",children:s.jsx(vt,{})}),s.jsxs(ht,{children:[s.jsx(Ee,{value:ia,children:"Not set"}),o.map(L=>s.jsx(Ee,{value:L.user_id,children:L.label},L.user_id))]})]})]})]})]}),s.jsxs(mn,{className:"mt-6",children:[s.jsx(P,{type:"button",variant:"outline",onClick:c,children:"Cancel"}),s.jsx(P,{type:"submit",disabled:$,children:$?"Creating…":"Create task"})]})]})})})}const uD="Your organization's work, in queue order. Claim a task to show you are working on it.",mi="any",kk="none",dD=1,fD=250;function vx(){const e=un().tasks;if(!e)throw new Error("The Tasks page rendered without the tasks seam.");return e}function hD({org:e}){var b,v;const t=vx(),{href:n,Link:a}=Ze(),[r,l]=u.useState({state:"loading"}),[i,o]=u.useState([]),[c,d]=u.useState(null),f=u.useRef(0),h=u.useCallback(async y=>{const g=f.current+=1;y&&l({state:"loading"});const p=await t.availability({fresh:y});g===f.current&&l(p)},[t.availability]);u.useEffect(()=>{h(!1)},[h]);const m=u.useCallback(()=>void h(!0),[h]);if(u.useEffect(()=>{let y=!0;return t.members().then(g=>{y&&g.ok&&o(g.data)}),()=>{y=!1}},[t.members]),u.useEffect(()=>{if(!t.access)return;let y=!0;return t.access().then(g=>{y&&g.ok&&d(g.data)}),()=>{y=!1}},[t.access]),r.state==="off"&&((b=r.refusal)==null?void 0:b.reason)!=="engine_missing")return s.jsx(Ha,{title:"Page not found",description:"This page does not exist, or you do not have access to it.",backHref:n(`/org/${e}`),backLabel:"Back to the organization",link:a});const x=(c==null?void 0:c.read_only_reason)??uD;return s.jsx("div",{className:"flex h-full min-h-0 flex-1 flex-col overflow-auto px-4 py-4 sm:px-6 lg:px-8",children:r.state==="active"?s.jsx(pD,{active:r,org:e,members:i,description:x,read_only_reason:c==null?void 0:c.read_only_reason,reload_configuration:m}):r.state==="off"&&((v=r.refusal)==null?void 0:v.reason)==="engine_missing"?s.jsx(Zs,{page:"Tasks"}):s.jsxs(s.Fragment,{children:[s.jsx(Jt,{title:"Tasks",description:x}),r.state==="loading"&&s.jsx(Sk,{}),(r.state==="error"||r.state==="off")&&s.jsx(Ck,{refusal:r.refusal,on_retry:m}),r.state==="available"&&s.jsx(mD,{on_done:m})]})})}function Sk(){return s.jsx("div",{className:"mt-6 grid gap-2",role:"status","aria-label":"Loading tasks",children:Array.from({length:6},(e,t)=>s.jsx(_t,{className:t===5?"h-10 w-2/3":"h-10 w-full"},t))})}function Ck({refusal:e,on_retry:t}){const n=ls();return(e==null?void 0:e.reason)==="view_outdated"?s.jsxs(me,{variant:"warning",className:"mt-6",children:[s.jsx(Xt,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:Dl}),s.jsx(ge,{children:n})]}):s.jsxs(me,{variant:"destructive",className:"mt-6",children:[s.jsx(st,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:"Tasks could not be loaded"}),s.jsxs(ge,{children:[s.jsx("p",{children:e!=null&&e.reason?e.message:"Check your connection and try again."}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]})}function mD({on_done:e}){const{commands:t}=vx(),n=yr(),[a,r]=u.useState(!1),l=t==null?void 0:t.activate,i=async()=>{if(!l)return;r(!0);const o=await l();if(r(!1),!o.ok){n.error(o.refusal.message);return}n.success("Tasks are on."),e()};return s.jsxs(me,{variant:"info",className:"mt-6",children:[s.jsx(ws,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:"Tasks are not on for this organization"}),s.jsxs(ge,{children:[s.jsx("p",{children:"Turning them on creates one List with the default workflow. Members then see tasks as their access allows. It needs two-factor sign-in."}),l?s.jsx(P,{type:"button",size:"sm",className:"mt-2",disabled:a,onClick:()=>void i(),children:"Turn on Tasks"}):null]})]})}const Bf=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function pD({active:e,org:t,members:n,description:a,read_only_reason:r,reload_configuration:l}){var Px;const{commands:i,listTasks:o,waitingOnYou:c,hierarchyRevision:d}=vx(),{href:f,Link:h}=Ze(),{self_id:m}=sd(),x=yr(),{list:b,workspace:v}=e,y=b.offers,g=y!==void 0,p=u.useMemo(()=>{var I;return((I=v.workflows.find(ie=>ie.id===b.workflow_id))==null?void 0:I.statuses)??[]},[v,b]),j=v.priorities,w=!!i&&Cu(b.permission,"write"),N=w&&Cu(b.permission,"manage"),C=u.useMemo(()=>new Map(n.map(I=>[I.user_id,I])),[n]),_=I=>{var ie;return I?I===m?"You":((ie=C.get(I))==null?void 0:ie.label)??"A member":""},[S,$]=u.useState("active"),[O,G]=u.useState(!1),[V,L]=u.useState(""),[U,A]=u.useState("");u.useEffect(()=>{const I=setTimeout(()=>A(V),fD);return()=>clearTimeout(I)},[V]);const[R,E]=u.useState(null),[k,M]=u.useState(mi),[K,T]=u.useState(!1),[B,F]=u.useState(!1),[J,he]=u.useState({}),[X,D]=u.useState([]),[H,te]=u.useState(null),[se,ye]=u.useState([]),[re,we]=u.useState(null),[ne,rt]=u.useState(0),[de,Be]=u.useState(!1),[Q,Re]=u.useState(null),[Ue,yt]=u.useState(null),Ne=ls(),[Dt,q]=u.useState(!1),[oe,ve]=u.useState(null),[ke,Me]=u.useState({}),[Yt,gn]=u.useState(""),{confirm:ae,confirm_dialog:He}=Eo(),qe=u.useRef(null),os=u.useRef(null),Mn=u.useRef(null),cs=u.useRef(null),[mt,Js]=u.useState(void 0),ea=!!(U.trim()||R||k!==mi||K||B),ta=u.useRef(0),na=u.useRef(0),z=u.useCallback(async(I,ie=!1)=>{if(ie&&na.current>0)return;const Pe=I?ta.current:ta.current+=1,lt={state:S,assigned_to_me:O||void 0,cursor:I,search:U.trim()||void 0,group:R??void 0,owner:k===mi?void 0:k===kk?"":k,urgent:K||void 0,over_estimate:B||void 0,...xD(J,X)},tn=nn=>o(b.id,{...lt,cursor:nn});I||(na.current+=1);let jt=await tn(I).finally(()=>{I||(na.current-=1)}),Et=!!I;if(!jt.ok&&jt.refusal.code==="cursor_stale"&&(jt=await tn(),Et=!1),Pe!==ta.current)return;if(!jt.ok){we(jt.refusal),rt(nn=>nn+1);return}const kt=jt.data;we(null),rt(0),!(ie&&Bf(kt,Mn.current))&&(Mn.current=kt,te(kt),kt.facets&&Js(kt.facets),ye(nn=>Et?[...nn,...kt.tasks]:kt.tasks))},[o,b.id,S,O,U,R,k,K,B,J,X]),_e=u.useCallback(async()=>{const I=await c();if(yt(Pe=>I.ok?null:Bf(Pe,I.refusal)?Pe:I.refusal),!I.ok&&g)return;const ie=I.ok?I.data:null;Bf(ie,cs.current)||(cs.current=ie,Re(ie))},[c,g]);u.useEffect(()=>{Mn.current=null,te(null)},[S,O]),u.useEffect(()=>{z()},[z]),u.useEffect(()=>{_e()},[_e]);const ee=u.useCallback(async()=>{await Promise.all([z(),_e()])},[z,_e]),Se=u.useRef(ee);Se.current=ee;const en=y==null?void 0:y.refresh_ms;u.useEffect(()=>{if(!en)return;const I=setInterval(()=>{z(void 0,!0),_e()},en);return()=>clearInterval(I)},[en,z,_e]);const sa=u.useCallback(async(I,ie,Pe)=>{if(!i)return;const lt=await i.run(I,ie);lt.ok?Pe&&x.success(Pe):(x.error(lt.refusal.message),lt.refusal.code==="revision_conflict"&&l()),await ee()},[i,x,ee,l]),Bo=p.find(I=>I.category==="completed"),Ux=async(I,ie,Pe)=>{const lt=ie+Pe,tn=se[lt];if(!tn||!H||!i)return;const jt=async(Et,kt)=>{const nn=await i.run(Et,kt);if(!nn.ok)throw nn.refusal;return nn.data};try{let Et=H.list.order_revision,kt=I.revision;if(tn.queue_rank===null){const nn=se.findIndex(Ts=>Ts.queue_rank===null);for(const Ts of se.slice(nn,lt+1)){const qx=await jt("reorder",{task_id:Ts.id,expected_revision:Ts.revision,expected_order_revision:Et,placement:"end"});Et=qx.list.order_revision,Ts.id===I.id&&(kt=qx.task.revision)}}await jt("reorder",{task_id:I.id,expected_revision:kt,expected_order_revision:Et,placement:Pe<0?"before":"after",anchor_task_id:tn.id})}catch(Et){x.error(Et.message)}await ee()},B1=I=>{Bo&&sa("update_task",{task_id:I.id,expected_revision:I.revision,changes:{status_id:Bo.id}},`${I.title} completed.`)},H1=async I=>{if(!H||!await ae({title:"Archive this task?",description:"It leaves the queue and becomes read-only. Its claim, holds and history stay, and a manager can restore it.",action_label:"Archive task",destructive:!0}))return;const[Pe,lt]=await Promise.all([o(b.id,{limit:1}),d(v.id)]);if(!Pe.ok||!lt.ok){x.error(Pe.ok?lt.ok?"":lt.refusal.message:Pe.refusal.message);return}await sa("archive_task",{task_id:I.id,expected_revision:I.revision,expected_order_revision:Pe.data.list.order_revision,expected_hierarchy_revision:lt.data},`${I.title} archived.`)},I1=async I=>{await sa("release_hold",{hold_id:I},"Hold released.")},Bx=async(I,ie,Pe,lt)=>{if(!(i!=null&&i.complete)||!await ae({title:`Mark ${ie} done?`,description:Pe.reason?`“${Pe.reason}”
389
+
390
+ It leaves the open tasks.`:"It leaves the open tasks.",action_label:"Mark done"}))return;ve(I);const jt=await i.complete(Pe);if(ve(null),!jt.ok){Me(Et=>({...Et,[I]:jt.refusal.message}));return}Me(({[I]:Et,...kt})=>kt),gn(`${ie} marked done.`),await Se.current(),Hx({next:lt})},[Kl,Hx]=u.useState(null);u.useEffect(()=>{var lt;if(!Kl)return;Hx(null);const I=os.current,ie=typeof Kl.next=="function"?Kl.next():Kl.next;(lt=(ie?(I==null?void 0:I.querySelector(`[data-done-key="${CSS.escape(ie)}"]`))??(I==null?void 0:I.querySelector(`[data-title-key="${CSS.escape(ie)}"] a`)):null)??qe.current)==null||lt.focus()},[Kl]);const Ix=()=>{var I;L(""),A(""),E(null),M(mi),T(!1),F(!1),(I=qe.current)==null||I.focus()},P1=new Map(p.map(I=>[I.id,I])),q1=new Map(j.map(I=>[I.id,I])),Ud=new Map(se.map(I=>[I.id,I.title])),Bd=w&&S==="active",G1=se.some(I=>I.local_done),Hd=Bd||G1,Id=!g||j.length>0,V1=!O&&!ea,Pd=5+(Id?1:0)+(Hd?1:0),Y1=re!==null&&(re.reason==="store_locked"||re.reason==="engine_failed")&&ne<=dD,Ho=(Q==null?void 0:Q.holds)??[],qd=H==null?void 0:H.groups,F1=gD(se,qd,J,(H==null?void 0:H.matched)===void 0?X:[]),Io=qd?qd.length===0:se.length===0,K1=(I,ie)=>he(Pe=>({...Pe,[I]:!ie})),X1=I=>D(ie=>ie.includes(I)?ie.filter(Pe=>Pe!==I):[...ie,I]),Q1=Ho.map(I=>I.id);return s.jsxs("div",{ref:os,className:"contents",children:[s.jsx(Jt,{title:"Tasks",description:a,actions:w?s.jsxs(P,{type:"button",onClick:()=>q(!0),children:[s.jsx(wl,{className:"mr-2 size-4","aria-hidden":"true"}),"New task"]}):null}),g&&(H!=null&&H.open)?s.jsxs("p",{className:"text-muted-foreground mt-1 text-sm",children:[H.open," open"]}):null,en?s.jsx("p",{className:"text-muted-foreground mt-1 text-xs",role:"status",children:re?`Not reading · trying again every ${Math.round(en/1e3)}s`:H?`Live · refreshes every ${Math.round(en/1e3)}s`:"Connecting…"}):null,g?s.jsx("p",{className:"sr-only",role:"status",children:Yt}):null,(g||Ho.length>0)&&s.jsxs(ut,{as:"section","aria-labelledby":"waiting-title",className:"mt-4 p-4","data-testid":"tasks-waiting",children:[s.jsx("h2",{id:"waiting-title",className:"text-lg font-semibold",children:"Waiting on you"}),Ho.length>0?s.jsx("ul",{className:"mt-2 divide-y","aria-labelledby":"waiting-title",children:Ho.map((I,ie)=>{var jt,Et;const Pe=to[I.hold_type],lt=I.target.kind==="task"?`Because you claim ${Ud.get(I.target.task_id)??"the task it waits on"} · `:"",tn=I.local_done;return s.jsxs("li",{id:`waiting-${I.id}`,"data-title-key":I.id,className:"flex flex-wrap items-center gap-3 py-2",children:[I.task?s.jsx(h,{className:"text-primary min-w-40 flex-1 hover:underline",href:f(`/org/${t}/tasks/${I.task.id}`),children:I.task.title}):s.jsx("span",{className:"min-w-40 flex-1",children:I.reason}),s.jsx(ce,{variant:Pe.tone,children:I.local_label??Pe.label}),s.jsxs("div",{className:"min-w-48 flex-2",children:[I.task?s.jsx("div",{className:"text-sm",children:I.reason}):null,s.jsxs("div",{className:"text-muted-foreground text-xs",children:[lt,"From ",_(I.opened_by)," · ",Pn(I.opened_at)]}),(jt=I.local_threads)!=null&&jt.length?s.jsxs("div",{className:"text-muted-foreground text-xs",children:["Answer it in"," ",s.jsx(h,{className:"text-primary hover:underline",href:f(`/org/${t}/threads`),children:"Threads"}),": ",I.local_threads.join(" · ")]}):null,ke[I.id]?s.jsx("div",{className:"text-destructive text-xs",role:"alert",children:ke[I.id]}):null]}),tn&&(i!=null&&i.complete)?s.jsx(P,{type:"button",variant:"outline",size:"sm","data-done-key":I.id,"aria-label":`Mark ${((Et=I.task)==null?void 0:Et.title)??I.reason} done`,loading:oe===I.id,onClick:()=>{var kt;return void Bx(I.id,((kt=I.task)==null?void 0:kt.title)??I.reason,tn,Q1[ie+1]??null)},children:"Done"}):null,g?null:s.jsx(P,{type:"button",variant:"outline",size:"sm",onClick:()=>void I1(I.id),children:"Release"})]},I.id)})}):Q?s.jsx("p",{className:"text-muted-foreground mt-2 text-sm",children:"Nothing in this checkout waits on you."}):null,g&&Ue?s.jsx("p",{className:"text-muted-foreground mt-2 text-sm",role:"status",children:Ue.reason==="view_outdated"?`Waiting on you is not read here. ${Ne}`:"Waiting on you could not be read. It is read again with the list."}):null,s.jsx("p",{className:"text-muted-foreground mt-2 text-xs",children:g?"This checkout only. Teammates' agents are not listed here.":"Release a hold when you have done your part. Whoever can edit the task then resolves it."})]}),!w&&!r&&s.jsxs(me,{variant:"info",className:"mt-4",children:[s.jsx(ko,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:"You can view these tasks"}),s.jsx(ge,{children:"Ask an organization admin for write access to change them."})]}),s.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-4",children:[(y==null?void 0:y.archived)!==!1?s.jsx(D4,{value:S,onValueChange:I=>$(I),children:s.jsxs(ck,{"aria-label":"Which tasks",children:[s.jsx(um,{value:"active",children:"Active"}),s.jsx(um,{value:"archived",children:"Archived"})]})}):null,(y==null?void 0:y.assigned_to_me)!==!1?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ul,{id:"tasks-mine",checked:O,onCheckedChange:I=>G(I===!0)}),s.jsx(De,{htmlFor:"tasks-mine",children:"Assigned to me"})]}):null,y!=null&&y.search?s.jsx(Nt,{ref:qe,type:"search",className:"w-64","aria-label":"Search tasks",placeholder:"Search title, ID or detail",value:V,onChange:I=>L(I.target.value)}):null,mt!=null&&mt.owners?s.jsx(wD,{owners:mt.owners,no_owner:mt.no_owner,value:k,on_change:M}):null]}),(Px=mt==null?void 0:mt.groups)!=null&&Px.length?s.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",role:"group","aria-label":"Status",children:[mt.groups.map(I=>s.jsxs(P,{type:"button",variant:"outline",size:"sm",className:ll,"aria-pressed":R===I.id,onClick:()=>E(ie=>ie===I.id?null:I.id),children:[I.label," ",I.count]},I.id)),mt.marks?s.jsxs(s.Fragment,{children:[s.jsxs(P,{type:"button",variant:"outline",size:"sm",className:ll,"aria-pressed":K,onClick:()=>T(I=>!I),children:["Urgent ",mt.marks.urgent]}),s.jsxs(P,{type:"button",variant:"outline",size:"sm",className:ll,"aria-pressed":B,onClick:()=>F(I=>!I),children:["Over estimate ",mt.marks.over_estimate]})]}):null]}):null,ea&&(H==null?void 0:H.matched)!==void 0&&H.total!==void 0?s.jsxs("p",{className:"text-muted-foreground mt-2 text-sm",children:[H.matched," of ",H.total," match ·"," ",s.jsx(P,{type:"button",variant:"link",size:"inline-sm",onClick:Ix,children:"Clear"})]}):null,Y1?s.jsx("p",{className:"text-muted-foreground mt-4 text-sm",children:"Tasks are busy. Reading them again…"}):re?s.jsx(Ck,{refusal:re,on_retry:()=>void z()}):null,!H&&!re&&s.jsx(Sk,{}),H&&Io&&ea?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(id,{className:"text-muted-foreground size-8","aria-hidden":"true"}),s.jsx("h2",{className:"text-lg font-semibold",children:"No tasks match"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing open matches these filters."}),s.jsx(P,{type:"button",variant:"outline",onClick:Ix,children:"Clear filters"})]}):H&&Io&&S==="active"&&!O&&g?s.jsx("p",{className:"text-muted-foreground mt-6 text-sm",children:"No tasks recorded yet."}):H&&Io&&S==="active"&&!O?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(D0,{className:"text-muted-foreground size-8","aria-hidden":"true"}),s.jsx("h2",{className:"text-lg font-semibold",children:"No tasks yet"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Create the first task, or ask an agent to create one with the SDLC MCP tools."}),w&&s.jsxs(P,{type:"button",onClick:()=>q(!0),children:[s.jsx(wl,{className:"mr-2 size-4","aria-hidden":"true"}),"New task"]})]}):H?s.jsxs(s.Fragment,{children:[s.jsx(ut,{className:"mt-4 shrink-0 overflow-x-auto",children:s.jsxs(Ye,{containerAriaLabel:"Tasks",children:[s.jsx(We,{children:s.jsxs(ue,{children:[s.jsx(W,{children:"Title"}),s.jsx(W,{children:"Status"}),Id?s.jsx(W,{className:"hidden md:table-cell",children:"Priority"}):null,s.jsx(W,{className:"hidden md:table-cell",children:"Primary"}),s.jsx(W,{className:"hidden md:table-cell",children:"Holds"}),s.jsx(W,{children:"Claimed by"}),Hd?s.jsx(W,{className:"text-right",children:"Actions"}):null]})}),s.jsxs(Fe,{children:[F1.map(I=>{var Et,kt;if(I.kind==="group")return s.jsx(yD,{group:I.group,open:I.open,columns:Pd,on_toggle:()=>K1(I.group.id,I.open)},`group:${I.group.id}`);if(I.kind==="more")return s.jsx(jD,{group:I.group,whole:X.includes(I.group.id),columns:Pd,on_toggle:()=>X1(I.group.id)},`more:${I.group.id}`);const{row:ie,index:Pe}=I,lt=P1.get(ie.status_id),tn=iD(ie),jt=ie.local_done;return s.jsxs(ue,{"data-testid":"tasks-row",children:[s.jsxs(Y,{"data-title-key":ie.id,children:[ie.no_page?s.jsx("span",{children:ie.title}):s.jsx(h,{className:"text-primary hover:underline",href:f(`/org/${t}/tasks/${ie.id}`),children:ie.title}),ie.parent_task_id&&Ud.get(ie.parent_task_id)?s.jsx("div",{className:"text-muted-foreground text-xs",children:Ud.get(ie.parent_task_id)}):null,g?s.jsx(bD,{row:ie}):null,ke[ie.id]?s.jsx("div",{className:"text-destructive text-xs",role:"alert",children:ke[ie.id]}):null]}),s.jsx(Y,{children:lt?s.jsx(ce,{variant:_k(lt),children:lt.name}):null}),Id?s.jsx(Y,{className:"hidden md:table-cell",children:ie.priority_id?((Et=q1.get(ie.priority_id))==null?void 0:Et.name)??"":s.jsx("span",{className:"text-muted-foreground",children:"Not set"})}):null,s.jsx(Y,{className:"hidden md:table-cell",children:ie.owner_title?ie.owner_title:ie.primary_user_id?_(ie.primary_user_id):s.jsx("span",{className:"text-muted-foreground",children:"Unassigned"})}),s.jsx(Y,{className:"hidden md:table-cell",children:tn?s.jsx(ce,{variant:tn.tone,children:tn.label}):s.jsx("span",{className:"text-muted-foreground",children:"None"})}),s.jsx(Y,{"data-testid":"tasks-claim",children:s.jsx(_D,{row:ie,holder:_((kt=ie.claim)==null?void 0:kt.user_id)})}),Hd?s.jsx(Y,{className:"text-right whitespace-nowrap",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[jt&&"hold"in jt?s.jsx("a",{className:"text-primary text-sm hover:underline",href:`#waiting-${jt.hold}`,children:"In Waiting on you"}):jt&&(i!=null&&i.complete)?s.jsx(P,{type:"button",variant:"outline",size:"sm","data-done-key":ie.id,"aria-label":`Mark ${ie.title} done`,loading:oe===ie.id,onClick:()=>void Bx(ie.id,ie.title,jt,()=>{var nn;return(((nn=Mn.current)==null?void 0:nn.tasks)??[]).map(Ts=>Ts.id).filter(Ts=>Ts!==ie.id)[Pe]??null}),children:"Done"}):null,Bd&&V1?s.jsxs(s.Fragment,{children:[s.jsx(P,{type:"button",variant:"outline",size:"icon","aria-label":`Move ${ie.title} up`,disabled:Pe===0,onClick:()=>void Ux(ie,Pe,-1),children:s.jsx(oR,{className:"size-4","aria-hidden":"true"})}),s.jsx(P,{type:"button",variant:"outline",size:"icon","aria-label":`Move ${ie.title} down`,disabled:Pe===se.length-1,onClick:()=>void Ux(ie,Pe,1),children:s.jsx(rR,{className:"size-4","aria-hidden":"true"})})]}):null,Bd?s.jsxs(kd,{children:[s.jsx(Sd,{asChild:!0,children:s.jsx(P,{type:"button",variant:"outline",size:"icon","aria-label":`More actions for ${ie.title}`,children:s.jsx(kp,{className:"size-4","aria-hidden":"true"})})}),s.jsxs(Do,{align:"end",children:[Bo&&ie.status_id!==Bo.id?s.jsx(Nl,{onSelect:()=>B1(ie),children:"Complete"}):null,N?s.jsx(Nl,{className:"text-destructive focus:text-destructive",onSelect:()=>void H1(ie),children:"Archive"}):null]})]}):null]})}):null]},ie.id)}),Io&&s.jsx(ue,{children:s.jsx(Y,{colSpan:Pd,className:"text-muted-foreground h-24 text-center",children:S==="archived"?"No archived tasks.":"No tasks are assigned to you."})})]})]})}),H.next_cursor?s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2 self-start",disabled:de,onClick:async()=>{Be(!0),await z(H.next_cursor??void 0),Be(!1)},children:"Load more"}):null]}):null,w&&i&&s.jsx(cD,{open:Dt,commands:i,list_id:b.id,list_revision:(H==null?void 0:H.list.revision)??b.revision,default_status_id:b.default_status_id,statuses:p,priorities:j,members:n,on_close:()=>q(!1),on_created:async()=>{q(!1),await ee()}}),He]})}function xD(e,t){const n=Object.keys(e).filter(r=>e[r]),a=Object.keys(e).filter(r=>!e[r]);return{...n.length?{opened_groups:n}:{},...a.length?{closed_groups:a}:{},...t.length?{all_groups:t}:{}}}function gD(e,t,n,a){if(!t)return e.map((l,i)=>({kind:"row",row:l,index:i}));const r=[];for(const l of t){const i=n[l.id]??l.open;if(r.push({kind:"group",group:l,open:i}),!i||!l.open)continue;let o=0;e.forEach((c,d)=>{c.local_state===l.id&&(r.push({kind:"row",row:c,index:d}),o+=1)}),(l.hidden>0||a.includes(l.id)&&o>vD)&&r.push({kind:"more",group:l})}return r}const vD=10;function yD({group:e,open:t,columns:n,on_toggle:a}){const r=t?Np:ad;return s.jsx(ue,{"data-testid":"tasks-group",children:s.jsx(Y,{colSpan:n,className:"p-1",children:s.jsxs(P,{type:"button",variant:"ghost",size:"sm",className:"w-full justify-start font-semibold","aria-expanded":t,onClick:a,children:[s.jsx(r,{className:"size-4","aria-hidden":"true"}),e.label," ",e.count]})})})}function jD({group:e,whole:t,columns:n,on_toggle:a}){return s.jsx(ue,{"data-testid":"tasks-group-more",children:s.jsx(Y,{colSpan:n,children:s.jsx(P,{type:"button",variant:"link",size:"sm",className:"px-0","aria-expanded":t,onClick:a,children:t?"Show fewer":`Show all ${e.count}`})})})}function bD({row:e}){var n;const t=[e.local_after,e.local_detail].filter(Boolean).join(" · ");return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"text-muted-foreground font-mono text-xs",children:[e.id,e.match?` · matched in ${e.match}`:""]}),t?s.jsx("div",{className:"text-muted-foreground text-xs",children:t}):null,(n=e.local_marks)!=null&&n.length?s.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:e.local_marks.map(a=>s.jsx(ce,{variant:a.tone??"neutral",children:a.label},a.label))}):null]})}function wD({owners:e,no_owner:t,value:n,on_change:a}){return s.jsxs(gt,{value:n,onValueChange:a,children:[s.jsx(ft,{className:"w-56","aria-label":"Owner",children:s.jsx(vt,{})}),s.jsxs(ht,{children:[s.jsx(Ee,{value:mi,children:"Any owner"}),e.map(r=>s.jsxs(Ee,{value:r.id,children:[r.label," (",r.count,")"]},r.id)),t!==void 0?s.jsxs(Ee,{value:kk,children:["No owner (",t,")"]}):null]})]})}function _D({row:e,holder:t}){const n=e.claim;if(!n)return s.jsx("span",{className:"text-muted-foreground",children:"Nobody"});if(n.lapsed){const a=new Date(n.lease_expires_at)<=new Date;return s.jsxs("div",{children:[s.jsxs("div",{className:"text-warning",children:["Lapsed · ",t]}),s.jsx("div",{className:"text-muted-foreground text-xs",children:a?`Ran out at ${as(n.lease_expires_at)}`:"Can no longer edit it"})]})}return s.jsxs("div",{className:"max-w-64",children:[s.jsxs("div",{children:[t,n.via?` · ${xx(n.via)}`:""]}),s.jsxs("div",{className:"text-muted-foreground truncate text-xs",title:n.via==="sdlc_login"&&n.via_device?wk(n.via_device):void 0,children:["Until ",as(n.lease_expires_at),n.via==="sdlc_login"&&n.via_device?s.jsxs(s.Fragment,{children:[" · ",s.jsx("bdi",{children:n.via_device})]}):null]})]})}const ND={waiting_for_user:{label:"Waiting for",help:"The member who must act. They see this hold under Waiting on you."},blocked:{label:"Blocked by",help:"The task that must finish first."},waiting_for_external:{label:"Waiting for",help:"Who or what outside the organization."},paused:null};function kD({open:e,members:t,tasks:n,holds_my_web_claim:a,on_close:r,on_submit:l}){const[i,o]=u.useState("waiting_for_user"),[c,d]=u.useState(""),[f,h]=u.useState(""),[m,x]=u.useState(!1),[b,v]=u.useState({}),[y,g]=u.useState(null),[p,j]=u.useState(!1);u.useEffect(()=>{e&&(o("waiting_for_user"),d(""),h(""),x(!1),v({}),g(null))},[e]);const w=ND[i],N=async C=>{C.preventDefault();const _={target:w!==null&&!c.trim(),reason:!f.trim()};if(v(_),_.target||_.reason)return;j(!0);const S={hold_type:i,reason:f.trim(),release_claim:m};i==="waiting_for_user"&&(S.target_user_id=c),i==="blocked"&&(S.target_task_id=c),i==="waiting_for_external"&&(S.target_label=c.trim());const $=await l(S);j(!1),g($)};return s.jsx(dn,{open:e,onOpenChange:C=>C?null:r(),children:s.jsx(fn,{children:s.jsxs("form",{onSubmit:C=>void N(C),noValidate:!0,children:[s.jsxs(hn,{children:[s.jsx(pn,{children:"Add hold"}),s.jsx(xn,{children:"Say what this task is waiting for."})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[y&&s.jsxs(me,{variant:"destructive",children:[s.jsx(st,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:y})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(De,{htmlFor:"hold-type",children:"Type"}),s.jsxs(gt,{value:i,onValueChange:C=>{o(C),d(""),v({})},children:[s.jsx(ft,{id:"hold-type",children:s.jsx(vt,{})}),s.jsx(ht,{children:Object.keys(to).map(C=>s.jsx(Ee,{value:C,children:to[C].label},C))})]})]}),w?s.jsxs("div",{className:"grid gap-2",children:[s.jsx(De,{htmlFor:"hold-target",children:w.label}),i==="waiting_for_external"?s.jsx(Nt,{id:"hold-target",value:c,"aria-invalid":b.target,onChange:C=>d(C.target.value)}):s.jsxs(gt,{value:c,onValueChange:d,children:[s.jsx(ft,{id:"hold-target","aria-invalid":b.target,children:s.jsx(vt,{placeholder:i==="blocked"?"Choose a task":"Choose a member"})}),s.jsx(ht,{children:i==="blocked"?n.map(C=>s.jsx(Ee,{value:C.id,children:C.title},C.id)):t.map(C=>s.jsx(Ee,{value:C.user_id,children:C.label},C.user_id))})]}),s.jsx("p",{className:b.target?"text-destructive text-xs":"text-muted-foreground text-xs",children:b.target?"Choose what it waits for.":w.help})]}):s.jsx("p",{className:"text-muted-foreground text-xs",children:"You resume it yourself."}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(De,{htmlFor:"hold-reason",children:"Reason"}),s.jsx(An,{id:"hold-reason",rows:3,placeholder:"What the task is waiting for",value:f,"aria-invalid":b.reason,onChange:C=>h(C.target.value)}),b.reason&&s.jsx("p",{className:"text-destructive text-xs",children:"Give a reason."})]}),a&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ul,{id:"hold-release-claim",checked:m,onCheckedChange:C=>x(C===!0)}),s.jsx(De,{htmlFor:"hold-release-claim",children:"Also release my claim"})]})]}),s.jsxs(mn,{className:"mt-6",children:[s.jsx(P,{type:"button",variant:"outline",onClick:r,children:"Cancel"}),s.jsx(P,{type:"submit",disabled:p,children:p?"Adding…":"Add hold"})]})]})})})}function Lo(){const e=un().tasks;if(!e)throw new Error("The Task page rendered without the tasks seam.");return e}function yx(){return s.jsxs("div",{className:"grid gap-3",role:"status","aria-label":"Loading task",children:[s.jsx(_t,{className:"h-8 w-1/2"}),Array.from({length:7},(e,t)=>s.jsx(_t,{className:t===6?"h-6 w-2/3":"h-6 w-full"},t))]})}function Ru({back:e,description:t}){const{href:n,Link:a}=Ze();return s.jsx(Ha,{title:"Task not found",description:t??"It may have been removed, or you may not have access to it.",backHref:n(e),backLabel:"Back to tasks",link:a})}const Er="not_set",SD=10*60*1e3,Xv=20;function CD(){const{members:e}=Lo(),[t,n]=u.useState([]);u.useEffect(()=>{let l=!0;return e().then(i=>{l&&i.ok&&n(i.data)}),()=>{l=!1}},[e]);const a=u.useMemo(()=>new Map(t.map(l=>[l.user_id,l])),[t]),r=u.useCallback((l,i)=>{var o;return l?l===i?"You":((o=a.get(l))==null?void 0:o.label)??"A member":""},[a]);return{members:t,name:r}}function RD({active:e,task_id:t,back:n}){const a=Lo(),{task:r,activity:l,listTasks:i,hierarchyRevision:o,commands:c}=a,{href:d,Link:f}=Ze(),h=yr(),{self_id:m}=sd(),{members:x,name:b}=CD(),{workspace:v}=e,{confirm:y,confirm_dialog:g}=Eo(),[p,j]=u.useState(null),[w,N]=u.useState(!1),[C,_]=u.useState(!1),[S,$]=u.useState(null),[O,G]=u.useState([]),[V,L]=u.useState(Xv),[U,A]=u.useState([]),[R,E]=u.useState(!1),[k,M]=u.useState(null),[K,T]=u.useState(null),[B,F]=u.useState(""),[J,he]=u.useState(null),X=u.useCallback(async()=>{if(!r)return;const z=await r(t);z.ok?(j(z.data),_(!1)):z.refusal.status===404||z.refusal.status===400?N(!0):_(!0)},[r,t]),D=u.useRef(0),H=u.useCallback(async()=>{if(!l)return;const z=D.current+=1;let _e=[],ee;for(;;){const Se=await l(t,ee);if(z!==D.current||!Se.ok)return;if(_e=[..._e,...Se.data.events].slice(-1e3),!Se.data.more||!Se.data.next_cursor)break;ee=Se.data.next_cursor}z===D.current&&G(_e.reverse())},[l,t]);u.useEffect(()=>{X(),H()},[X,H]);const te=p?v.lists.find(z=>z.id===p.task.list_id):void 0,se=u.useMemo(()=>{var z;return((z=v.workflows.find(_e=>_e.id===(p==null?void 0:p.task.workflow_id)))==null?void 0:z.statuses)??[]},[v,p==null?void 0:p.task.workflow_id]);u.useEffect(()=>{if(!p)return;let z=!0;return i(p.task.list_id,{limit:100}).then(_e=>{z&&A(_e.ok?_e.data.tasks.filter(ee=>ee.id!==p.task.id).map(ee=>({id:ee.id,title:ee.title})):[])}),()=>{z=!1}},[i,p==null?void 0:p.task.list_id,p==null?void 0:p.task.id,p]);const ye=u.useCallback(async()=>{await Promise.all([X(),H()])},[X,H]),re=u.useCallback((z,_e)=>c?c.run(z,_e):Promise.resolve({ok:!1,refusal:{status:0,message:"This page cannot change tasks."}}),[c]),we=u.useCallback(async(z,_e,ee)=>{const Se=await re(z,_e);return Se.ok?(ee&&h.success(ee),await ye(),Se.data):(Se.refusal.code==="revision_conflict"?$({tone:"warning",title:"This task changed while you were editing",body:"We reloaded it. Check the change, then save again."}):Se.refusal.code==="claim_held"?(await X(),$({tone:"destructive",title:"Someone else claimed this task first",body:"Their claim is shown below. You can take it over if it lapses."})):h.error(Se.refusal.message),await ye(),null)},[re,h,ye,X]),ne=(p==null?void 0:p.claim)??null,rt=ne!==null&&ne.id===J&&!ne.lapsed&&!ne.via?ne.id:null;if(u.useEffect(()=>{if(!rt)return;const z=window.setInterval(()=>{re("renew_claim",{claim_id:rt,lease_seconds:Kv}).then(()=>X())},SD);return()=>window.clearInterval(z)},[rt,re,X]),w)return s.jsx(Ru,{back:n});if(C&&!p)return s.jsxs(me,{variant:"destructive",children:[s.jsx(st,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:"This task could not be loaded"}),s.jsxs(ge,{children:[s.jsx("p",{children:"Check your connection and try again."}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void X(),children:"Retry"})]})]});if(!p)return s.jsx(yx,{});const{task:de}=p,Be=de.archived_at!==null,Q=Cu(p.permission,"write")&&!Be,Re=Cu(p.permission,"manage"),Ue=se.find(z=>z.id===de.status_id),yt=se.find(z=>z.category==="completed"),Ne=v.priorities.find(z=>z.id===de.priority_id),Dt=p.contributors.map(z=>z.user_id),q=ne!==null&&ne.user_id===m,oe=ne!==null&&!ne.lapsed,ve=p.checklist.filter(z=>z.is_complete).length,ke=async()=>{const[z,_e]=await Promise.all([i(de.list_id,{limit:1}),o(v.id)]);return z.ok?_e.ok?{ok:!0,data:{task_id:de.id,expected_revision:de.revision,expected_order_revision:z.data.list.order_revision,expected_hierarchy_revision:_e.data}}:_e:z},Me=(z,_e)=>we("update_task",{task_id:de.id,expected_revision:de.revision,changes:z},_e),Yt=z=>y(z.via==="sdlc_login"?{title:"Release this claim?",description:`You claimed it via ${Uf(z.via,z.via_device)}. Its next renewal will be refused, and it will stop holding the task.`,action_label:"Release claim",destructive:!0}:{title:"Release your agent's claim?",description:"Your agent is still working on this task. Its next renewal will be refused, and it will stop holding the task.",action_label:"Release claim",destructive:!0}),gn=async()=>{if(!yt)return;if(oe&&(!q||ne.via)){const _e=ne.via==="api_key"?`${q?"Your":`${b(ne.user_id)}'s`} agent is still working on it.`:ne.via==="sdlc_login"?`${q?"You are":`${b(ne.user_id)} is`} still working on it via ${Uf(ne.via,ne.via_device)}.`:`${b(ne.user_id)} is still working on it.`;if(!await y({title:"Complete this task?",description:_e,action_label:"Mark complete"}))return}await Me({status_id:yt.id},"Task completed.")!==null&&ne&&q&&oe&&await we("end_claim",{claim_id:ne.id,outcome:"completed"})},ae=async(z,_e)=>{const ee=await ke();if(!ee.ok){h.error(ee.refusal.message);return}await we(z,ee.data,_e)},He=async()=>{await y({title:"Archive this task?",description:"It leaves the queue and becomes read-only. Its claim, holds and history stay, and a manager can restore it.",action_label:"Archive task",destructive:!0})&&await ae("archive_task","Task archived.")},qe=async()=>{await ae("restore_task","Task restored.")},os=async()=>{var Se;const z=ne,_e=await we("claim_task",{task_id:de.id,lease_seconds:Kv}),ee=(Se=_e==null?void 0:_e.claim)==null?void 0:Se.id;ee&&!(z&&z.id===ee&&z.via)&&he(ee)},Mn=async()=>{ne&&(ne.via&&!await Yt(ne)||(await we("end_claim",{claim_id:ne.id,outcome:"released"},"Claim released."),he(null)))},cs=async()=>{ne&&await we("end_claim",{claim_id:ne.id,outcome:"expired"},"Claim cleared.")},mt=async z=>{z.hold_type==="paused"&&m&&(z={...z,target_user_id:m});const _e=await re("open_hold",{task_id:de.id,hold_type:z.hold_type,reason:z.reason,...z.target_user_id?{target_user_id:z.target_user_id}:{},...z.target_task_id?{target_task_id:z.target_task_id}:{},...z.target_label?{target_label:z.target_label}:{}});return _e.ok?(E(!1),h.success("Hold added."),z.release_claim&&ne&&q&&!ne.via&&(await we("end_claim",{claim_id:ne.id,outcome:"released"}),he(null)),await ye(),null):_e.refusal.message},Js=z=>we("checklist",{task_id:de.id,expected_revision:de.revision,...z}),ea=async z=>{for(const _e of z.filter(ee=>!Dt.includes(ee)))await we("set_contributor",{task_id:de.id,expected_revision:de.revision,user_id:_e,action:"add"});for(const _e of p.contributors.filter(ee=>!z.includes(ee.user_id)))await we("set_contributor",{task_id:de.id,expected_revision:de.revision,user_id:_e.user_id,action:"remove",expected_contributor_revision:_e.revision})},ta=z=>{var ee;if(z.target.kind==="user")return b(z.target.user_id,m);if(z.target.kind==="external")return z.target.label;if(z.target.hidden||!z.target.task_id)return"A task you cannot see";const _e=z.target.task_id;return s.jsx(f,{className:"text-primary hover:underline",href:d(`${n}/${_e}`),children:((ee=U.find(Se=>Se.id===_e))==null?void 0:ee.title)??"Another task"})},na=z=>z.target.kind==="user"&&z.target.user_id===m&&!z.released_at?s.jsx(P,{type:"button",variant:"outline",size:"sm",onClick:()=>void we("release_hold",{hold_id:z.id},"Hold released."),children:"Release"}):Q?s.jsx(P,{type:"button",variant:"outline",size:"sm",onClick:()=>void we("resolve_hold",{hold_id:z.id},"Hold resolved."),children:"Resolve"}):null;return s.jsxs(s.Fragment,{children:[s.jsx(Jt,{title:de.title,description:`Created ${Pn(de.created_at)} by ${b(de.created_by,m)}`,actions:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[Q&&s.jsxs(s.Fragment,{children:[s.jsxs(P,{type:"button",variant:"outline",onClick:()=>M(de.title),children:[s.jsx(ld,{className:"mr-2 size-4","aria-hidden":"true"}),"Edit title"]}),yt&&de.status_id!==yt.id&&s.jsxs(P,{type:"button",variant:"outline",onClick:()=>void gn(),children:[s.jsx(Ol,{className:"mr-2 size-4","aria-hidden":"true"}),"Mark complete"]})]}),Re&&!Be&&s.jsxs(P,{type:"button",variant:"outline",onClick:()=>void He(),children:[s.jsx(xv,{className:"mr-2 size-4","aria-hidden":"true"}),"Archive"]})]}),children:k!==null?s.jsxs("form",{className:"flex flex-wrap items-center gap-2 pt-1",onSubmit:async z=>{z.preventDefault(),k.trim()&&await Me({title:k.trim()})!==null&&M(null)},children:[s.jsx(De,{htmlFor:"task-title",className:"sr-only",children:"Title"}),s.jsx(Nt,{id:"task-title",className:"max-w-xl",value:k,onChange:z=>M(z.target.value)}),s.jsx(P,{type:"submit",size:"sm",children:"Save"}),s.jsx(P,{type:"button",size:"sm",variant:"outline",onClick:()=>M(null),children:"Cancel"})]}):null}),S&&s.jsxs(me,{variant:S.tone,className:"mt-4","data-testid":"task-notice",children:[S.tone==="warning"?s.jsx(jr,{className:"size-4","aria-hidden":"true"}):s.jsx(st,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:S.title}),s.jsx(ge,{children:S.body})]}),Be?s.jsxs(me,{variant:"info",className:"mt-4",children:[s.jsx(xv,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:"This task is archived"}),s.jsx(ge,{children:Re?s.jsxs(s.Fragment,{children:[s.jsx("p",{children:"It is out of the queue and cannot be claimed. Restore it to work on it again."}),s.jsxs(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void qe(),children:[s.jsx(nR,{className:"mr-2 size-4","aria-hidden":"true"}),"Restore"]})]}):s.jsx("p",{children:"It is out of the queue and cannot be claimed. A manager can restore it."})})]}):Q?null:s.jsxs(me,{variant:"info",className:"mt-4",children:[s.jsx(ko,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:"You can view this task"}),s.jsx(ge,{children:"Ask an organization admin for write access to change it."})]}),Q?s.jsxs("div",{className:"mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(De,{htmlFor:"task-status",children:"Status"}),s.jsxs(gt,{value:de.status_id,onValueChange:z=>void Me({status_id:z}),children:[s.jsx(ft,{id:"task-status",children:s.jsx(vt,{})}),s.jsx(ht,{children:se.map(z=>s.jsx(Ee,{value:z.id,children:z.name},z.id))})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(De,{htmlFor:"task-priority",children:"Priority"}),s.jsxs(gt,{value:de.priority_id??Er,onValueChange:z=>void Me({priority_id:z===Er?null:z}),children:[s.jsx(ft,{id:"task-priority",children:s.jsx(vt,{})}),s.jsxs(ht,{children:[s.jsx(Ee,{value:Er,children:"Not set"}),v.priorities.map(z=>s.jsx(Ee,{value:z.id,children:z.name},z.id))]})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(De,{htmlFor:"task-primary",children:"Primary"}),s.jsxs(gt,{value:de.primary_user_id??Er,onValueChange:z=>void Me({primary_user_id:z===Er?null:z}),children:[s.jsx(ft,{id:"task-primary",children:s.jsx(vt,{})}),s.jsxs(ht,{children:[s.jsx(Ee,{value:Er,children:"Not set"}),x.map(z=>s.jsx(Ee,{value:z.user_id,children:z.label},z.user_id))]})]})]}),s.jsx(TD,{members:x,selected:Dt,on_change:z=>void ea(z)})]}):s.jsxs("dl",{className:"mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[s.jsx(dc,{label:"Status",value:(Ue==null?void 0:Ue.name)??""}),s.jsx(dc,{label:"Priority",value:(Ne==null?void 0:Ne.name)??"Not set"}),s.jsx(dc,{label:"Primary",value:de.primary_user_id?b(de.primary_user_id,m):"Not set"}),s.jsx(dc,{label:"Contributors",value:Dt.map(z=>b(z,m)).join(", ")||"None"})]}),!Be&&s.jsx(ED,{claim:ne,mine:q,holder:ne?b(ne.user_id):"",own:ne!==null&&ne.id===J,can_write:Q,on_claim:()=>void os(),on_release:()=>void Mn(),on_clear:()=>void cs()}),s.jsxs("section",{className:"mt-6","aria-labelledby":"task-description-title",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("h2",{id:"task-description-title",className:"text-lg font-semibold",children:"Description"}),Q&&K===null&&s.jsx(P,{type:"button",variant:"ghost",size:"sm",onClick:()=>T(de.description??""),children:"Edit description"})]}),K!==null?s.jsxs("form",{className:"mt-2 grid gap-2",onSubmit:async z=>{z.preventDefault(),await Me({description:K})!==null&&T(null)},children:[s.jsx(De,{htmlFor:"task-description",className:"sr-only",children:"Description"}),s.jsx(An,{id:"task-description",rows:5,value:K,onChange:z=>T(z.target.value)}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(P,{type:"submit",size:"sm",children:"Save"}),s.jsx(P,{type:"button",size:"sm",variant:"outline",onClick:()=>T(null),children:"Cancel"})]})]}):s.jsx("p",{className:"mt-2 text-sm whitespace-pre-wrap",children:de.description||s.jsx("span",{className:"text-muted-foreground",children:"No description."})})]}),s.jsxs("section",{className:"mt-6","aria-labelledby":"task-checklist-title",children:[s.jsxs("h2",{id:"task-checklist-title",className:"text-lg font-semibold",children:["Checklist",p.checklist.length>0?` · ${ve} of ${p.checklist.length} done`:""]}),s.jsx("ul",{className:"mt-2 grid gap-1",children:p.checklist.map(z=>s.jsxs("li",{className:"flex items-center justify-between gap-2 py-1","data-testid":"task-checklist-item",children:[Q?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ul,{id:`check-${z.id}`,checked:z.is_complete,onCheckedChange:_e=>void Js({action:"toggle",item_id:z.id,expected_item_revision:z.revision,is_complete:_e===!0})}),s.jsx(De,{htmlFor:`check-${z.id}`,className:"font-normal",children:z.label})]}):s.jsxs("span",{className:"text-sm",children:[z.is_complete?"Done: ":"To do: ",z.label]}),Q&&s.jsxs(kd,{children:[s.jsx(Sd,{asChild:!0,children:s.jsx(P,{type:"button",variant:"ghost",size:"icon","aria-label":`Item actions for ${z.label}`,children:s.jsx(kp,{className:"size-4","aria-hidden":"true"})})}),s.jsx(Do,{align:"end",children:s.jsx(Nl,{className:"text-destructive focus:text-destructive",onSelect:()=>void Js({action:"archive",item_id:z.id,expected_item_revision:z.revision}),children:"Remove"})})]})]},z.id))}),p.checklist.length===0&&!Q&&s.jsx("p",{className:"text-muted-foreground text-sm",children:"No checklist items."}),Q&&s.jsxs("form",{className:"mt-2 grid gap-2",onSubmit:async z=>{z.preventDefault(),B.trim()&&await Js({action:"add",label:B.trim()})!==null&&F("")},children:[s.jsx(De,{htmlFor:"task-new-item",children:"Add an item"}),s.jsx(Nt,{id:"task-new-item",placeholder:"Add an item and press Enter",value:B,onChange:z=>F(z.target.value)})]})]}),s.jsxs("section",{className:"mt-6","aria-labelledby":"task-holds-title",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("h2",{id:"task-holds-title",className:"text-lg font-semibold",children:"Holds"}),Q&&s.jsxs(P,{type:"button",variant:"outline",size:"sm",onClick:()=>E(!0),children:[s.jsx(L0,{className:"mr-2 size-4","aria-hidden":"true"}),"Add hold"]})]}),s.jsx("div",{className:"mt-2 shrink-0 overflow-x-auto rounded-lg border",children:s.jsxs(Ye,{containerAriaLabel:"Holds",children:[s.jsx(We,{children:s.jsxs(ue,{children:[s.jsx(W,{children:"Type"}),s.jsx(W,{children:"Reason"}),s.jsx(W,{children:"Waiting on"}),s.jsx(W,{className:"text-right",children:"Actions"})]})}),s.jsxs(Fe,{children:[p.holds.map(z=>{const _e=to[z.hold_type];return s.jsxs(ue,{"data-testid":"task-hold",children:[s.jsx(Y,{children:s.jsx(ce,{variant:_e.tone,children:_e.label})}),s.jsxs(Y,{children:[s.jsx("div",{children:z.reason}),s.jsx("div",{className:"text-muted-foreground text-xs",children:z.released_at?`Released by ${b(z.released_by,m)} · ${Pn(z.released_at)} · Ready to resolve`:`Opened by ${b(z.opened_by,m)} · ${Pn(z.opened_at)} · Open`})]}),s.jsx(Y,{children:ta(z)}),s.jsx(Y,{className:"text-right",children:na(z)})]},z.id)}),p.holds.length===0&&s.jsx(ue,{children:s.jsx(Y,{colSpan:4,className:"text-muted-foreground h-16 text-center",children:"Nothing is holding this task."})})]})]})}),s.jsx("p",{className:"text-muted-foreground mt-2 text-xs",children:"A hold does not change the task's status. The person it waits on releases it; whoever can edit the task resolves it."})]}),s.jsxs("section",{className:"mt-6 pb-8","aria-labelledby":"task-activity-title",children:[s.jsx("h2",{id:"task-activity-title",className:"text-lg font-semibold",children:"Activity"}),s.jsxs("ul",{className:"mt-2 divide-y rounded-lg border",children:[O.slice(0,V).map(z=>s.jsxs("li",{className:"grid grid-cols-[1fr_auto] gap-x-4 px-3 py-2 text-sm sm:grid-cols-[2fr_1fr_10rem]","data-testid":"task-activity",children:[s.jsx("span",{children:oD(z)}),s.jsxs("span",{className:"min-w-0 text-right sm:text-left",children:[s.jsx("span",{children:z.actor_id?b(z.actor_id,m):"The system"}),z.via?s.jsxs("span",{className:"text-muted-foreground block max-w-64 truncate text-xs sm:max-w-none",title:`via ${Uf(z.via,z.via_device)}`,children:["via ",xx(z.via),s.jsx(Rk,{via:z.via,device:z.via_device})]}):null]}),s.jsx("span",{className:"text-muted-foreground col-span-2 sm:col-span-1 sm:text-right",children:Nk(z.created_at)})]},z.id)),O.length===0&&s.jsx("li",{className:"text-muted-foreground px-3 py-2 text-sm",children:"No activity yet."})]}),O.length>V&&s.jsx(P,{type:"button",variant:"ghost",size:"sm",className:"mt-2",onClick:()=>L(z=>z+Xv),children:"Load more"})]}),Q&&te&&s.jsx(kD,{open:R,members:x,tasks:U,holds_my_web_claim:q&&oe&&!(ne!=null&&ne.via),on_close:()=>E(!1),on_submit:mt}),g]})}function dc({label:e,value:t}){return s.jsxs("div",{className:"grid gap-1",children:[s.jsx("dt",{className:"text-muted-foreground text-xs",children:e}),s.jsx("dd",{className:"text-sm",children:t})]})}function TD({members:e,selected:t,on_change:n}){return s.jsxs("div",{className:"grid gap-2",children:[s.jsx(De,{htmlFor:"task-contributors",children:"Contributors"}),s.jsxs(kd,{children:[s.jsx(Sd,{asChild:!0,children:s.jsxs(P,{id:"task-contributors",type:"button",variant:"outline",className:"justify-between font-normal",children:[t.length===0?s.jsx("span",{className:"text-muted-foreground",children:"Add a contributor"}):s.jsx("span",{className:"truncate",children:e.filter(a=>t.includes(a.user_id)).map(a=>a.label).join(", ")}),s.jsx($0,{className:"text-muted-foreground size-4","aria-hidden":"true"})]})}),s.jsx(Do,{align:"start",children:e.map(a=>{const r=t.includes(a.user_id);return s.jsxs(Nl,{onSelect:()=>n(r?t.filter(l=>l!==a.user_id):[...t,a.user_id]),children:[r?s.jsx(Ol,{className:"mr-2 size-4","aria-hidden":"true"}):s.jsx("span",{className:"mr-2 size-4"}),a.label]},a.user_id)})})]})]})}function Rk({via:e,device:t}){return e!=="sdlc_login"||!t?null:s.jsxs(s.Fragment,{children:[" on ",s.jsx("bdi",{children:t})]})}function ED({claim:e,mine:t,holder:n,own:a,can_write:r,on_claim:l,on_release:i,on_clear:o}){let c=s.jsx(Sp,{className:"size-4","aria-hidden":"true"}),d="Nobody is working on this",f=r?"Claim it to show others you are.":"",h=r?s.jsx(P,{type:"button",size:"sm",onClick:l,children:"Claim"}):null;if(e&&e.lapsed){const m=new Date(e.lease_expires_at)<=new Date;c=s.jsx(kR,{className:"size-4","aria-hidden":"true"}),d=m?`${t?"Your":`${n}'s`} claim lapsed at ${as(e.lease_expires_at)}`:`${t?"Your":`${n}'s`} claim lapsed`,f=m?"Its time ran out.":`${n} can no longer edit this task.`,r&&(f+=" Take it over to work on it yourself, or clear it so anyone can claim it."),h=r?s.jsxs(s.Fragment,{children:[s.jsx(P,{type:"button",size:"sm",variant:"outline",onClick:o,children:"Clear claim"}),s.jsx(P,{type:"button",size:"sm",onClick:l,children:"Take over"})]}):null}else if(e){const m=as(e.lease_expires_at);c=e.via==="api_key"?s.jsx(_p,{className:"size-4","aria-hidden":"true"}):e.via==="sdlc_login"?s.jsx(KR,{className:"size-4","aria-hidden":"true"}):s.jsx(CT,{className:"size-4","aria-hidden":"true"});const x=s.jsxs(s.Fragment,{children:["Claimed via sdlc login",s.jsx(Rk,{via:e.via,device:e.via_device}),"."]});t&&e.via==="api_key"?(d=`Your agent is working on this until ${m}`,f="Claimed through one of your API keys. This page does not renew it. Releasing it, or Mark complete, ends the agent's claim after asking."):t&&e.via==="sdlc_login"?(d=`You are working on this until ${m}`,f=s.jsxs(s.Fragment,{children:[x," This page does not renew it. Releasing it, or Mark complete, ends that claim after asking."]})):e.via==="sdlc_login"?(d=`${n} is working on this until ${m}`,f=x):t?(d=`You are working on this until ${m}`,f=a?"Claimed on the web, and renewed while this page is open. Marking the task complete ends your claim.":"Claimed on the web. Marking the task complete ends your claim."):e.via==="api_key"?(d=`${n}'s agent is working on this until ${m}`,f="Claimed through an API key."):(d=`${n} is working on this until ${m}`,f=r?"Claimed on the web. You can take it over if the claim lapses.":"Claimed on the web."),h=t?s.jsx(P,{type:"button",size:"sm",variant:"outline",onClick:i,children:"Release claim"}):null}return s.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-3 rounded-lg border p-3","data-testid":"task-claim",children:[c,s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"text-sm font-medium",children:d}),f?s.jsx("div",{className:"text-muted-foreground text-xs break-words",children:f}):null]}),h?s.jsx("div",{className:"flex items-center gap-2",children:h}):null]})}const AD=10,Tk=5,MD=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/,Ek="Not available",$D={added:"Added",changed:"Changed",removed:"Removed"},OD={thread:"Thread",task:"Task",issue:"Issue",release:"Release",test:"Test"},Qv=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;function DD(e,t){const n=t!=null&&t.startsWith("task:")?t.slice(5):null;if(n&&MD.test(n))return{label:n,path:`/org/${e}/tasks/${n}`};const a=t!=null&&t.startsWith("issue:")?t.slice(6):null;if(a&&/^iss-\d{1,9}$/.test(a))return{label:a,path:`/org/${e}/issues/${a}`};const r=t!=null&&t.startsWith("release:")?t.slice(8):null;if(r&&Qv.test(r))return{label:r==="candidate"?"Candidate":`Release ${r}`,path:`/releases?release=${r}`};const l=t!=null&&t.startsWith("planned:")?t.slice(8):null;return l&&Qv.test(l)?{label:`Planned Release ${l}`,path:`/releases?planned=${l}`}:{label:"Tasks",path:`/org/${e}/tasks`}}const Ak=e=>e.status===0||e.reason==="store_locked"||e.reason==="engine_failed"||e.status>=500;function zD({org:e,task_id:t,from:n}){var gn;const a=Lo(),{href:r,Link:l}=Ze(),{confirm:i,confirm_dialog:o}=Eo(),c=DD(e,n),[d,f]=u.useState({state:"loading"}),[h,m]=u.useState([]),[x,b]=u.useState([]),[v,y]=u.useState(null),[g,p]=u.useState(null),[j,w]=u.useState({state:"loading"}),[N,C]=u.useState({state:"loading"}),[_,S]=u.useState(null),[$,O]=u.useState(null),[G,V]=u.useState(!1),L=u.useRef(null),U=ls(),A=u.useRef(null),R=u.useRef(null),E=u.useRef(null),k=u.useRef(null),M=u.useRef(!1),K=u.useRef(0),T=u.useRef(0),B=u.useCallback(async()=>{if(!a.taskSections)return;w({state:"loading"});const ae=await a.taskSections(t);w(ae.ok?{state:"ok",data:ae.data}:{state:"failed",refusal:ae.refusal})},[a.taskSections,t]),F=u.useCallback(async()=>{if(!a.taskRelated)return;C({state:"loading"});const ae=await a.taskRelated(t);C(ae.ok?{state:"ok",data:ae.data}:{state:"failed",refusal:ae.refusal})},[a.taskRelated,t]),J=u.useCallback(async()=>{var Mn,cs;const ae=T.current+=1;p(null),B(),F();const[He,qe]=await Promise.all([a.availability(),a.task?a.task(t):Promise.resolve(null)]);if(ae!==T.current)return;He.state==="active"&&m(((Mn=He.workspace.workflows.find(mt=>mt.id===He.list.workflow_id))==null?void 0:Mn.statuses)??[]);const os=He.state==="off"&&((cs=He.refusal)==null?void 0:cs.reason)==="engine_missing"?He.refusal:null;if(!qe||!qe.ok&&qe.refusal.reason==="engine_missing"||os){f({state:"engine_missing",refusal:os??(qe&&!qe.ok?qe.refusal:{status:0,message:""})});return}if(qe.ok){K.current=0,y(null),O(null),f({state:"ok",detail:qe.data,at:new Date().toISOString()});return}if(qe.refusal.status===404||qe.refusal.reason==="not_found"){f({state:"missing"});return}if(K.current+=1,K.current===1&&Ak(qe.refusal)){p(qe.refusal.retry_after??AD);return}y(qe.refusal),f(mt=>mt.state==="loading"?{state:"loading"}:mt)},[a,t,B,F]);u.useEffect(()=>{J()},[J]),u.useEffect(()=>{if(g===null)return;const ae=setTimeout(()=>void J(),g*1e3);return()=>clearTimeout(ae)},[g,J]),u.useEffect(()=>{let ae=!0;return a.members().then(He=>{ae&&He.ok&&b(He.data)}),()=>{ae=!1}},[a.members]),u.useEffect(()=>{var He;if(M.current||d.state!=="ok")return;M.current=!0;const ae=(He=L.current)==null?void 0:He.querySelector("h1");ae&&(ae.tabIndex=-1,ae.focus())},[d.state]),u.useEffect(()=>{var ae;_&&((ae=R.current)==null||ae.focus())},[_]),u.useEffect(()=>{if($===null)return;const ae=setTimeout(()=>{var He;return(He=A.current)==null?void 0:He.focus()},0);return()=>clearTimeout(ae)},[$]);const he=u.useMemo(()=>new Map(x.map(ae=>[ae.user_id,ae.label])),[x]),X=ae=>ae?he.get(ae)??ae:"",D=()=>{S(null),J()},H=u.useRef(null),te=ae=>(H.current=ae,ae==="graph"?B():F());if(u.useEffect(()=>{var qe;const ae=H.current;if(ae===null||(ae==="graph"?j:N).state==="loading")return;H.current=null;const He=(ae==="graph"?E:k).current??((qe=L.current)==null?void 0:qe.querySelector("h1"));He==null||He.focus()},[j,N]),d.state==="missing")return s.jsx(ba,{children:s.jsx(Ru,{back:`/org/${e}/tasks`,description:`No task ${t} in this checkout. It may have finished and been archived, or never been recorded.`})});const se=s.jsx(P,{asChild:!0,variant:"link",size:"sm",className:"px-0",children:s.jsxs(l,{href:r(c.path),children:[s.jsx(M0,{className:"size-4","aria-hidden":"true"}),c.label]})});if(d.state==="engine_missing")return s.jsx(ba,{children:s.jsx("div",{ref:L,className:"contents",children:s.jsx(Zs,{page:"Task",header:s.jsx($i,{back:se,id:null,title:t})})})});const ye=v?s.jsxs(me,{variant:"destructive",className:"mt-4",children:[s.jsx(st,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:"Could not read this task"}),s.jsxs(ge,{children:[s.jsxs("p",{children:[v.message,v.since?` Since ${es(v.since)}.`:"",d.state==="ok"?` This page was read at ${es(d.at)}.`:""," See the sdlc viewer terminal for more."]}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:D,children:"Retry"})]})]}):null,re=g!==null?s.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",children:[s.jsx(Qt,{"aria-hidden":"true"}),"Could not read this task. Trying again in ",g," seconds."]}):null,we=s.jsx("div",{role:"status","aria-live":"polite",children:re});if(d.state==="loading")return s.jsxs(ba,{children:[we,ye,!v&&g===null?s.jsx(yx,{}):null]});const{detail:ne,at:rt}=d,{task:de}=ne,Be=h.find(ae=>ae.id===de.status_id),Q=ne.local_done&&"task"in ne.local_done?ne.local_done:null,Re=ne.local_waits??[],Ue=Q?Re[0]??null:null,yt=Ue?X(Ue.opened_by):ne.owner_title??X(ne.thread),Ne=j.state==="ok"?j.data:null,Dt=(Ne==null?void 0:Ne.lifecycle)==="finished",q=Dt&&(Ne==null?void 0:Ne.outcome)==="cancelled",oe=Dt&&(Ne==null?void 0:Ne.outcome)==="complete",ve=!!de.created_at,ke=ne.acceptance??[],Me=async()=>{var qe;if(!Q||!((qe=a.commands)!=null&&qe.complete)||!await i({title:`Mark ${de.title} done?`,description:Ue?`This answers ${yt}'s ask, “${Ue.reason}”, closes that wait, and tells ${yt} to check and continue.`:`This tells ${yt||"its thread"} to check and continue.`,action_label:"Mark done"}))return;V(!0);const He=await a.commands.complete(Q);if(V(!1),!He.ok){O(He.refusal.message);return}await J(),S({title:de.title,asker:yt||"Its thread"})},Yt=s.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[Q&&!_?s.jsxs(s.Fragment,{children:[s.jsxs(P,{ref:A,type:"button",variant:"outline",disabled:G,"aria-disabled":$!==null?!0:void 0,"aria-describedby":$!==null?"task-done-why":void 0,onClick:()=>{$===null&&Me()},children:[s.jsx(Ol,{className:"mr-2 size-4","aria-hidden":"true"}),"Done"]}),$!==null?s.jsx("span",{id:"task-done-why",className:"text-muted-foreground text-xs",children:"Read again first"}):null]}):null,s.jsxs("span",{className:"text-muted-foreground text-sm",children:["Read at ",es(rt)]}),s.jsxs(P,{type:"button",variant:"ghost",size:"sm",onClick:D,children:[s.jsx(jr,{className:"mr-2 size-4","aria-hidden":"true"}),"Read again"]})]});return s.jsxs(ba,{children:[s.jsxs("div",{ref:L,className:"contents",children:[s.jsx($i,{back:se,id:de.id,badge:Be?s.jsx(ce,{variant:_k(Be),children:Be.name}):null,title:de.title,created:ve?`Created ${Pn(de.created_at)}${yt||ne.owner_title?` by ${ne.owner_title??yt}`:""}`:null,actions:Yt}),we,ye,_?s.jsx("div",{ref:R,tabIndex:-1,role:"status","aria-live":"polite",className:"outline-none",children:s.jsxs(me,{variant:"success",className:"mt-4",children:[s.jsx(rd,{className:"size-4","aria-hidden":"true"}),s.jsxs(je,{children:["Marked ",_.title," done"]}),s.jsxs(ge,{children:[_.asker," is told to check and continue."]})]})}):null,$!==null?s.jsxs(me,{variant:"destructive",className:"mt-4",children:[s.jsx(st,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:"Done was not recorded"}),s.jsxs(ge,{children:[$," Read again to see the task as it is now."]})]}):null,Ue&&!_?s.jsxs(me,{variant:"warning",className:"mt-4",children:[s.jsx(Xt,{className:"size-4","aria-hidden":"true"}),s.jsxs(je,{children:[yt," asks: ",Ue.reason]}),s.jsxs(ge,{children:["Waiting on you since ",gx(Ue.opened_at),". Done answers it and tells ",yt," to check and continue."]})]}):null,ne.view_outdated?s.jsxs(me,{variant:"warning",className:"mt-4",children:[s.jsx(Xt,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:Dl}),s.jsxs(ge,{children:[U," Until then this page cannot read the claim and holds."]})]}):null,s.jsxs("dl",{className:"mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[s.jsx(xs,{label:"Owner thread",value:ne.owner_title??(X(ne.thread)||"None")}),s.jsx(xs,{label:"Release",value:ne.release??"None"}),s.jsx(xs,{label:"Session",value:j.state==="loading"?"Loading…":j.state==="failed"?"Not available":Ne!=null&&Ne.session?s.jsxs(s.Fragment,{children:[Ne.session.provider," ",s.jsx("span",{className:"font-mono break-all",children:Ne.session.id})]}):"None"}),s.jsx(xs,{label:"Now",value:ne.local_detail??(Be==null?void 0:Be.name)??""})]}),s.jsx("p",{className:"text-muted-foreground mt-2 text-xs",children:"Local tasks have no priority or contributors."}),s.jsx(LD,{detail:ne,holder:X((gn=ne.claim)==null?void 0:gn.user_id),finished_at:Dt?(Ne==null?void 0:Ne.finished_at)??null:null,read_at:rt}),s.jsxs(me,{variant:"info",className:"mt-4",children:[s.jsx(ko,{className:"text-info size-4","aria-hidden":"true"}),Q?s.jsxs(s.Fragment,{children:[s.jsx(je,{children:"Done is the one change this page makes"}),s.jsx(ge,{children:"Everything else about this task changes through its thread."})]}):s.jsxs(s.Fragment,{children:[s.jsx(je,{children:"This page only reads tasks"}),s.jsx(ge,{children:"A task changes through the agent thread working on it."})]})]}),ve?Ne!=null&&Ne.record?s.jsxs("p",{className:"mt-4 text-sm",children:["Record ",s.jsx("span",{className:"font-mono break-all",children:Ne.record})]}):null:s.jsx("p",{className:"mt-4 text-sm",children:"No task record yet. This page shows what the threads and plans in this checkout say about it."}),Q?s.jsx(Ct,{id:"task-done-needs",title:"What Done needs",children:ke.length>0?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-muted-foreground text-xs",children:["The task's acceptance; ",yt||"its thread"," checks these after Done."]}),s.jsx("ul",{className:"mt-2 grid list-disc gap-1 pl-5 text-sm",children:ke.map(ae=>s.jsx("li",{children:ae},ae))})]}):s.jsxs("p",{className:"text-sm",children:["Its thread gave no acceptance. Ask ",yt||"its thread"," what Done needs before marking it."]})}):ke.length>0?s.jsxs(Ct,{id:"task-acceptance",title:"Acceptance",children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:oe?"All met: the task finished complete":q&&(Ne!=null&&Ne.finished_at)?`Cancelled ${Pn(Ne.finished_at)}`:"Met when the task finishes complete"}),s.jsx("ul",{className:"mt-2 grid list-disc gap-1 pl-5 text-sm",children:ke.map(ae=>s.jsx("li",{children:oe?`Met: ${ae}`:ae},ae))})]}):null,s.jsx(UD,{detail:ne,waits:Re,given:Q!==null,threadName:X,threadsLink:s.jsx(l,{className:"text-primary hover:underline",href:r(`/org/${e}/threads`),children:"Threads"})}),j.state==="loading"?s.jsxs("div",{className:"mt-6 grid gap-2",role:"status","aria-label":"Loading the task's sections",children:[s.jsx(_t,{className:"h-8 w-full"}),s.jsx(_t,{className:"h-8 w-full"}),s.jsx(_t,{className:"h-8 w-2/3"})]}):null,Ne?s.jsx(Ct,{id:"task-stands",title:"Where it stands",children:s.jsxs("p",{className:"text-sm",children:[(Be==null?void 0:Be.name)??de.status_id,ne.local_detail?` · ${ne.local_detail}`:""]})}):null,Ne!=null&&Ne.time?s.jsx(BD,{time:Ne.time}):null,s.jsx(HD,{sections:j,heading_ref:E,on_retry:()=>void te("graph"),taskLink:ae=>s.jsx(l,{className:"text-primary hover:underline",href:r(`/org/${e}/tasks/${ae}?from=task:${de.id}`),children:ae})}),Ne!=null&&Ne.files?s.jsx(ID,{files:Ne.files,finished:Dt}):null,Ne!=null&&Ne.proof?s.jsx(PD,{proof:Ne.proof,finished_at:Ne.finished_at,who:ne.owner_title??null}):null,Ne&&Ne.history.length>0?s.jsx(qD,{history:Ne.history}):null,s.jsx(Mk,{related:N,heading_ref:k,on_retry:()=>void te("related"),link:ae=>{const He=ae.kind==="thread"?`${e?`/org/${e}`:""}/threads#thread-${encodeURIComponent(ae.id)}`:ae.kind==="task"?`/org/${e}/tasks/${ae.id}?from=task:${de.id}`:ae.kind==="issue"?`/org/${e}/issues/${encodeURIComponent(ae.id)}?from=task:${de.id}`:ae.kind==="release"?`/releases?${ae.planned?"planned":"release"}=${encodeURIComponent(ae.id)}`:null;return He?s.jsx(l,{className:le("text-primary hover:underline",ae.kind!=="thread"&&ae.label===ae.id&&"font-mono"),href:r(He),children:ae.label}):ae.label}})]}),o]})}function ba({children:e}){return s.jsx("div",{className:"flex h-full min-h-0 flex-1 flex-col overflow-auto px-4 py-4 pb-8 sm:px-6 lg:px-8",children:e})}function $i({back:e,id:t,badge:n,title:a,created:r,actions:l}){return s.jsxs("div",{className:"grid gap-1",children:[s.jsx("div",{children:e}),t?s.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[s.jsx("span",{className:"font-mono",children:t}),n]}):null,s.jsx(Jt,{title:a,description:r??void 0,actions:l})]})}function xs({label:e,value:t}){return s.jsxs("div",{className:"grid gap-1",children:[s.jsx("dt",{className:"text-muted-foreground text-xs",children:e}),s.jsx("dd",{className:"m-0 text-sm break-words",children:t})]})}function Ct({id:e,title:t,aside:n,heading_ref:a,children:r}){return s.jsxs("section",{className:"mt-6","aria-labelledby":`${e}-title`,children:[s.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-3 gap-y-1",children:[s.jsx("h2",{id:`${e}-title`,ref:a,tabIndex:a?-1:void 0,className:"text-lg font-semibold outline-none",children:t}),n?s.jsx("span",{className:"text-muted-foreground text-sm",children:n}):null]}),s.jsx("div",{className:"mt-2",children:r})]})}function LD({detail:e,holder:t,finished_at:n,read_at:a}){const r=e.claim,[,l]=u.useReducer(f=>f+1,0),i=r&&!e.view_outdated?new Date(r.lease_expires_at).getTime():null;u.useEffect(()=>{if(i===null||!Number.isFinite(i))return;const f=i-Date.now();if(f<=0)return;const h=setTimeout(l,Math.min(f+50,2147483647));return()=>clearTimeout(h)},[i]);let o=s.jsx(Sp,{className:"size-4","aria-hidden":"true"}),c="Nobody is working on this",d=null;if(e.view_outdated)c=`Claimed by: ${Ek}`;else if(r){const f=new Date(r.lease_expires_at)<=new Date(Math.max(Date.now(),new Date(a).getTime()));o=s.jsx(_p,{className:"size-4","aria-hidden":"true"}),c=`${t} is working on this until ${es(r.lease_expires_at)}${f||r.lapsed?" · passed":""}`,d="Claimed in the coordination registry; its thread renews the claim."}else n&&(o=s.jsx(rd,{className:"size-4","aria-hidden":"true"}),d=`Finished ${Pn(n)}. Its claim ended when it finished.`);return s.jsxs(ut,{className:"mt-4 flex flex-wrap items-center gap-3 p-3","data-testid":"task-claim",children:[o,s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"text-sm font-medium",children:c}),d?s.jsx("div",{className:"text-muted-foreground text-xs break-words",children:d}):null]})]})}function UD({detail:e,waits:t,given:n,threadName:a,threadsLink:r}){if(e.view_outdated)return s.jsx(Ct,{id:"task-holds",title:"Holds",children:s.jsx("p",{className:"text-sm",children:Ek})});if(e.holds.length===0)return null;const l=new Map(t.map(i=>[i.id,i]));return s.jsxs(Ct,{id:"task-holds",title:`Holds · ${e.holds.length} open`,children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:"A hold does not change the task's status."}),s.jsx(ut,{className:"mt-2 overflow-x-auto",children:s.jsxs(Ye,{containerAriaLabel:"Holds",children:[s.jsx(We,{children:s.jsxs(ue,{children:[s.jsx(W,{children:"Type"}),s.jsx(W,{children:"Reason"}),s.jsx(W,{children:"Waiting on"}),s.jsx(W,{children:"Opened"})]})}),s.jsx(Fe,{children:e.holds.map(i=>{var f;const o=l.get(i.id),c=to[i.hold_type],d=n?"Done above answers it":o!=null&&o.local_done?"In Waiting on you":(f=o==null?void 0:o.local_threads)!=null&&f.length?s.jsxs(s.Fragment,{children:["Answer it in ",r,": ",o.local_threads.join(" · ")]}):null;return s.jsxs(ue,{"data-testid":"task-hold",children:[s.jsx(Y,{children:s.jsx(ce,{variant:c.tone,children:(o==null?void 0:o.local_label)??c.label})}),s.jsxs(Y,{children:[s.jsx("div",{children:i.reason}),s.jsxs("div",{className:"text-muted-foreground text-xs",children:["Opened by ",a(i.opened_by)]})]}),s.jsxs(Y,{children:[s.jsx("div",{children:i.target.kind==="user"?"You":i.target.kind==="external"?i.target.label:"Another task"}),d?s.jsx("div",{className:"text-muted-foreground text-xs",children:d}):null]}),s.jsx(Y,{children:gx(i.opened_at)})]},i.id)})})]})})]})}function BD({time:e}){return s.jsx(Ct,{id:"task-time",title:"Time",children:s.jsxs("dl",{className:"grid gap-4 sm:grid-cols-3",children:[s.jsx(xs,{label:"Estimate",value:e.estimate?`${ai(e.estimate.low)}–${ai(e.estimate.high)}`:e.unknown_reason??"None"}),s.jsx(xs,{label:"Time taken",value:e.elapsed!==null?`${ai(e.elapsed)}${e.over_estimate?" · over estimate":""}`:"Not started"}),e.forecast?s.jsx(xs,{label:"Reforecast",value:s.jsxs("span",{className:"text-muted-foreground",children:[ai(e.forecast.low),"–",ai(e.forecast.high)," left",e.forecast.reason?` · ${e.forecast.reason}`:""]})}):null]})})}function jx({what:e,again:t,refusal:n,on_retry:a}){return s.jsxs(me,{variant:"destructive",children:[s.jsx(st,{className:"size-4","aria-hidden":"true"}),s.jsxs(je,{children:["Could not read ",e]}),s.jsxs(ge,{children:[s.jsx("p",{children:n.message}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:a,children:t})]})]})}function HD({sections:e,heading_ref:t,on_retry:n,taskLink:a}){const[r,l]=u.useState(!1);if(e.state==="loading")return null;const i=e.state==="failed"?e.refusal:e.data.graph.ok?null:e.data.graph.refusal;if(i)return s.jsx(Ct,{id:"task-graph",title:"Graph changes",heading_ref:t,children:s.jsx(jx,{what:"graph changes",again:"Read graph changes again",refusal:i,on_retry:n})});const o=e.state==="ok"&&e.data.graph.ok?e.data.graph.data:null;if(!o)return null;if(o.exempt)return s.jsx(Ct,{id:"task-graph",title:"Graph changes",heading_ref:t,children:s.jsxs("p",{className:"text-sm",children:["This task changes no modeled design. Its plan says why: ",o.exempt,"."]})});if(o.changes.length===0)return null;const c=r?o.changes:o.changes.slice(0,Tk),d=o.changes.length-c.length;return s.jsxs(Ct,{id:"task-graph",title:"Graph changes",aside:o.document,heading_ref:t,children:[s.jsx(ut,{className:"overflow-x-auto",children:s.jsxs(Ye,{containerAriaLabel:"Graph changes",children:[s.jsx(We,{children:s.jsxs(ue,{children:[s.jsx(W,{children:"Change"}),s.jsx(W,{children:"Kind of change"}),s.jsx(W,{children:"Also in"}),s.jsx(W,{children:"In the plan"})]})}),s.jsx(Fe,{children:c.map(f=>s.jsxs(ue,{children:[s.jsxs(Y,{children:[s.jsx("div",{children:f.label}),s.jsx("div",{className:"text-muted-foreground text-xs",children:f.type})]}),s.jsx(Y,{children:$D[f.change]}),s.jsx(Y,{children:f.also_in.length===0?"No other task":f.also_in.map((h,m)=>s.jsxs(u.Fragment,{children:[m>0?", ":null,a(h.id)]},h.id))}),s.jsx(Y,{children:f.planned?"Yes":s.jsx(ce,{variant:"warning",children:"No longer planned"})})]},`${f.id}:${f.planned}`))})]})}),d>0?s.jsxs("p",{className:"mt-2 flex flex-wrap items-center gap-2 text-sm",children:[d," more changes in this task's plan slice.",s.jsxs(P,{type:"button",variant:"ghost",size:"sm",onClick:()=>l(!0),children:["Show all ",o.changes.length]})]}):null]})}function ID({files:e,finished:t}){const[n,a]=u.useState(!1),r=n?e.paths:e.paths.slice(0,Tk);return s.jsxs(Ct,{id:"task-files",title:"Files",children:[r.length>0?s.jsx("ul",{className:"grid gap-1 text-sm",children:r.map(l=>s.jsx("li",{children:s.jsx("span",{className:"font-mono break-all",children:l})},l))}):null,e.paths.length>r.length?s.jsxs(P,{type:"button",variant:"ghost",size:"sm",className:"mt-1",onClick:()=>a(!0),children:["Show all ",e.paths.length]}):null,e.landed?s.jsxs("p",{className:"mt-2 text-sm",children:["Landed ",s.jsx("span",{className:"font-mono",children:e.landed.sha.slice(0,10)})," · ",e.landed.files," files",t?"":" · becomes the proof when the task finishes"]}):null]})}function PD({proof:e,finished_at:t,who:n}){return s.jsxs(Ct,{id:"task-proof",title:"Evidence and proof",children:[e.evidence?s.jsx("p",{className:"text-sm whitespace-pre-wrap",children:e.evidence}):null,e.no_code?s.jsxs("p",{className:"mt-2 text-sm",children:["No code: ",e.no_code]}):e.commit?s.jsxs("p",{className:"mt-2 text-sm",children:["Proof ",s.jsx("span",{className:"font-mono",children:e.commit.slice(0,10)})," ·"," ",e.on_main?"on main":"not yet on main"]}):null,t?s.jsxs("p",{className:"text-muted-foreground mt-2 text-xs",children:["Finished ",Pn(t),n?` by ${n}`:""]}):null]})}function qD({history:e}){return s.jsxs(Ct,{id:"task-history",title:"History",children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:"From the task record, newest first"}),s.jsx(ut,{className:"mt-2 overflow-x-auto",children:s.jsxs(Ye,{containerAriaLabel:"History",children:[s.jsx(We,{children:s.jsxs(ue,{children:[s.jsx(W,{children:"What"}),s.jsx(W,{children:"Who"}),s.jsx(W,{children:"When"})]})}),s.jsx(Fe,{children:e.map((t,n)=>s.jsxs(ue,{children:[s.jsx(Y,{children:t.what}),s.jsx(Y,{children:t.who??"Its thread"}),s.jsx(Y,{children:gx(t.at)})]},`${t.at}:${n}`))})]})})]})}function Mk({id:e="task-related",related:t,heading_ref:n,on_retry:a,link:r,fixed:l=!1}){return t.state==="ok"&&t.data.length===0?null:s.jsx(Ct,{id:e,title:"Related",heading_ref:n,children:t.state==="loading"?s.jsxs("div",{className:"grid gap-2",role:"status","aria-label":"Loading related work",children:[s.jsx(_t,{className:"h-8 w-full"}),s.jsx(_t,{className:"h-8 w-full"}),s.jsx(_t,{className:"h-8 w-2/3"})]}):t.state==="failed"?s.jsx(jx,{what:"related work",again:"Read related work again",refusal:t.refusal,on_retry:a}):s.jsx(ut,{className:"overflow-x-auto",children:s.jsxs(Ye,{containerAriaLabel:"Related",className:l?"table-fixed":void 0,children:[s.jsx(We,{children:s.jsxs(ue,{children:[s.jsx(W,{className:l?"w-[14%]":void 0,children:"Kind"}),s.jsx(W,{className:l?"w-[45%]":void 0,children:"Item"}),s.jsx(W,{className:l?"w-[41%]":void 0,children:"How it relates"})]})}),s.jsx(Fe,{children:t.data.map(i=>s.jsxs(ue,{children:[s.jsx(Y,{children:OD[i.kind]}),s.jsx(Y,{className:l?"break-words":void 0,children:r(i)}),s.jsx(Y,{className:l?"break-words":void 0,children:i.relation})]},`${i.kind}:${i.planned?"planned:":""}${i.id}`))})]})})})}function GD({org:e,task_id:t,from:n}){const a=Lo(),r=`/org/${e}/tasks`;return a.taskSections?s.jsx(zD,{org:e,task_id:t,from:n??null}):s.jsx(VD,{task_id:t,back:r})}function VD({task_id:e,back:t}){const{availability:n}=Lo(),[a,r]=u.useState({state:"loading"});return u.useEffect(()=>{let l=!0;return n().then(i=>{l&&r(i)}),()=>{l=!1}},[n]),a.state==="off"?s.jsx(Ru,{back:t}):s.jsx("div",{className:"flex h-full min-h-0 flex-1 flex-col overflow-auto px-4 py-4 sm:px-6 lg:px-8",children:a.state==="active"?s.jsx(RD,{active:a,task_id:e,back:t}):a.state==="error"?s.jsxs(me,{variant:"destructive",children:[s.jsx(st,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:"This task could not be loaded"}),s.jsx(ge,{children:"Check your connection and try again."})]}):a.state==="available"?s.jsx(Ru,{back:t}):s.jsx(yx,{})})}function Wn({children:e}){return s.jsx("p",{role:"alert",className:"text-destructive text-sm",children:e})}const YD=["open","triaged","resolved","closed"],bx=["low","normal","high","urgent"],FD=["fixed","works_as_intended","planned","duplicate","wont_fix","cannot_reproduce"],KD=["title","description","external_reference"],Tu={open:"Open",triaged:"Triaged",escalated:"Escalated",waiting_on_fix:"Waiting on fix",resolved:"Resolved",closed:"Closed"},$k={open:"warning",triaged:"info",escalated:"info",waiting_on_fix:"info",resolved:"success",closed:"neutral"},no={low:"Low",normal:"Normal",high:"High",urgent:"Urgent"},wx={fixed:"Fixed",works_as_intended:"Works as intended",planned:"Planned",duplicate:"Duplicate",wont_fix:"Won't fix",cannot_reproduce:"Cannot reproduce"},Ok={title:"Title",description:"Description",external_reference:"External reference"},XD=[["year",365*24*3600],["month",30*24*3600],["week",7*24*3600],["day",24*3600],["hour",3600],["minute",60]];function Dc(e,t=Date.now()){const n=Math.round((new Date(e).getTime()-t)/1e3),a=new Intl.RelativeTimeFormat("en",{numeric:"auto"});for(const[r,l]of XD)if(Math.abs(n)>=l)return a.format(Math.round(n/l),r);return"just now"}function hm(e,t,n){const a=`/org/${encodeURIComponent(e)}/proj/${encodeURIComponent(t)}/support`;return n?`${a}/${encodeURIComponent(n)}`:a}function _x(e,t){return e?t??"Not available":"A former member"}const QD="the issue integration";function WD(e){return!e.created_by&&e.reporter_kind==="customer"?QD:_x(e.created_by,e.created_by_username)}function ZD(e,t){return!e.actor_id&&e.kind==="created"&&t.reporter_kind==="customer"?"The issue integration":_x(e.actor_id,e.actor_username)}const fc="not_set",JD="Do not paste personal data. Leave out names, such as borrower names, and loan numbers; text shaped like an email address, phone number, or social security number is refused.";function ez({create:e,open:t,onOpenChange:n,onCreated:a}){const[r,l]=u.useState(""),[i,o]=u.useState(""),[c,d]=u.useState(!1),[f,h]=u.useState(""),[m,x]=u.useState(fc),[b,v]=u.useState(!1),[y,g]=u.useState(null),p=u.useRef(null),j=()=>{l(""),o(""),d(!1),h(""),x(fc),g(null),p.current=null},w=_=>{var S;return((S=y==null?void 0:y.personal_data)==null?void 0:S.field)===_?y.message:void 0},N=async _=>{if(_.preventDefault(),b)return;v(!0),p.current??(p.current=crypto.randomUUID());const S=await e({request_id:p.current,title:i.trim()||void 0,description:f||void 0,external_reference:r.trim()||void 0,priority:m===fc?null:m});if(v(!1),!S.ok){S.refusal.status!==0&&(p.current=null),g(S.refusal);return}j(),a(S.data.issue,S.data.duplicates)},C=y&&!y.personal_data?y.message:void 0;return s.jsx(dn,{open:t,onOpenChange:_=>{_||j(),n(_)},children:s.jsx(fn,{className:"sm:max-w-2xl",children:s.jsxs("form",{onSubmit:N,className:"grid gap-4",children:[s.jsxs(hn,{children:[s.jsx(pn,{children:"New support issue"}),s.jsx(xn,{children:"Log one help-desk report. Text is shown exactly as entered."})]}),s.jsxs(me,{variant:"warning",children:[s.jsx(Xt,{}),s.jsx(ge,{children:JD})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(De,{htmlFor:"maintain-issue-reference",children:"External reference"}),s.jsx(Nt,{id:"maintain-issue-reference",value:r,"aria-invalid":!!w("external_reference"),onChange:_=>{l(_.target.value),c||o(_.target.value)}}),w("external_reference")?s.jsx(Wn,{children:w("external_reference")}):s.jsx("p",{className:"text-muted-foreground text-xs",children:"The help-desk ticket number."})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(De,{htmlFor:"maintain-issue-title",children:"Title"}),s.jsx(Nt,{id:"maintain-issue-title",value:i,"aria-invalid":!!w("title"),onChange:_=>{o(_.target.value),d(!0)}}),w("title")?s.jsx(Wn,{children:w("title")}):s.jsx("p",{className:"text-muted-foreground text-xs",children:"Prefilled from the external reference; edit it if you like."})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(De,{htmlFor:"maintain-issue-description",children:"Description"}),s.jsx(An,{id:"maintain-issue-description",rows:4,placeholder:"What the end user reported, without personal data",value:f,"aria-invalid":!!w("description"),onChange:_=>h(_.target.value)}),w("description")?s.jsx(Wn,{children:w("description")}):null]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(De,{htmlFor:"maintain-issue-priority",children:"Priority"}),s.jsxs(gt,{value:m,onValueChange:x,children:[s.jsx(ft,{id:"maintain-issue-priority",children:s.jsx(vt,{})}),s.jsxs(ht,{children:[s.jsx(Ee,{value:fc,children:"Not set"}),bx.map(_=>s.jsx(Ee,{value:_,children:no[_]},_))]})]})]}),C?s.jsx(Wn,{children:C}):null,s.jsxs(mn,{children:[s.jsx(P,{type:"button",variant:"outline",onClick:()=>{j(),n(!1)},children:"Cancel"}),s.jsx(P,{type:"submit",loading:b,disabled:!i.trim()&&!r.trim(),children:"Log issue"})]})]})})})}const tz=["supportAccess","assigneeCandidates","create","update","assign","transition","redact"];function Dk(){return nz(un().issues)}function nz(e){return e&&tz.every(t=>typeof e[t]=="function")?e:null}function zk(e){const[t,n]=u.useState(null);return u.useEffect(()=>{if(!e)return;let a=!1;return e.supportAccess().then(r=>{a||n({contract:e,state:r.ok?{state:"ready",access:r.data}:{state:"error"}})}),()=>{a=!0}},[e]),t&&e&&t.contract===e?t.state:{state:"loading"}}function Lk({access:e,header:t,back_href:n,children:a}){const{href:r,Link:l}=Ze();return e.state==="loading"?s.jsxs("div",{className:"flex flex-1 items-center justify-center py-24",children:[s.jsx(Qt,{className:"size-5"}),s.jsx("span",{className:"sr-only",children:"Loading…"})]}):e.state==="error"||!e.access.enabled?s.jsx(Ha,{title:"Page not found",description:"This page does not exist or you do not have access to it.",backHref:r(n),backLabel:"Back to the project",link:l}):e.access.can_view?s.jsx(s.Fragment,{children:a(e.access)}):s.jsxs(s.Fragment,{children:[t,s.jsxs("div",{className:"flex flex-col items-center gap-3 py-24 text-center",children:[s.jsx(nT,{className:"text-muted-foreground size-8","aria-hidden":!0}),s.jsx("h2",{className:"text-lg font-semibold",children:"Support needs a Maintain seat"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:e.access.seat?"You need read permission on this project to see its support issues; ask an organization admin.":"You need a Maintain seat to see this project's support issues; ask an organization admin."})]})]})}function sz(){const e=Ze();return t=>{e.navigate?e.navigate(t):window.location.assign(e.href(t))}}const jn="all",hc=25;function mm({action:e}){return s.jsx(Jt,{title:"Support",description:"Help-desk reports logged against this project.",actions:e})}function az({org:e,project:t,query:n}){const a=Dk(),r=zk(a),l=`/org/${e}/proj/${t}`;return s.jsx("div",{className:"flex w-full flex-1 flex-col gap-6 px-4 py-4 sm:px-6 lg:px-8",children:s.jsx(Lk,{access:r,header:s.jsx(mm,{}),back_href:l,children:i=>a?s.jsx(rz,{contract:a,access:i,org_name:e,proj_name:t,query:n}):null})})}function rz({contract:e,access:t,org_name:n,proj_name:a,query:r}){const{href:l,Link:i}=Ze(),o=sz(),[c,d]=u.useState(()=>new URLSearchParams(r).get("external_reference")??""),[f,h]=u.useState(jn),[m,x]=u.useState(jn),[b,v]=u.useState(jn),[y,g]=u.useState(0),[p,j]=u.useState(null),[w,N]=u.useState(0),[C,_]=u.useState(null),[S,$]=u.useState([]),[O,G]=u.useState(!1),V=c.trim()!==""||f!==jn||m!==jn||b!==jn,L=u.useCallback(async()=>{const k=await e.list({external_reference:c.trim()||void 0,status:f===jn?void 0:f,priority:m===jn?void 0:m,assignee:b===jn?void 0:b,limit:hc,offset:y*hc});if(!k.ok){_(k.refusal.message);return}_(null),j(k.data.issues),N(k.data.total)},[e,c,f,m,b,y]);u.useEffect(()=>{const k=setTimeout(()=>void L(),200);return()=>clearTimeout(k)},[L]),u.useEffect(()=>{e.assigneeCandidates().then(k=>{k.ok&&$(k.data.candidates)})},[e]);const U=t.can_change?s.jsxs(P,{onClick:()=>G(!0),children:[s.jsx(wl,{className:"mr-2 size-4"}),"New issue"]}):void 0,A=s.jsx(ez,{create:e.create,open:O,onOpenChange:G,onCreated:(k,M)=>{G(!1);const K=hm(n,a,k.id);o(M.length?`${K}?duplicates=${M.length}`:K)}});if(p!==null&&w===0&&!V&&y===0)return s.jsxs(s.Fragment,{children:[s.jsx(mm,{}),s.jsxs("div",{className:"flex flex-col items-center gap-3 py-24 text-center",children:[s.jsx(QR,{className:"text-muted-foreground size-8","aria-hidden":!0}),s.jsx("h2",{className:"text-lg font-semibold",children:"No support issues yet"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Log a help-desk report under its ticket number, so every report is counted once."}),t.can_change?s.jsxs(P,{onClick:()=>G(!0),children:[s.jsx(wl,{className:"mr-2 size-4"}),"Log the first issue"]}):null]}),A]});const R=w===0?0:y*hc+1,E=Math.min(w,(y+1)*hc);return s.jsxs(s.Fragment,{children:[s.jsx(mm,{action:U}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("div",{className:"relative w-full max-w-sm",children:[s.jsx(yT,{className:"text-muted-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2","aria-hidden":!0}),s.jsx(Nt,{"aria-label":"Filter by external reference",placeholder:"Filter by external reference",className:"pl-9",value:c,onChange:k=>{d(k.target.value),g(0)}})]}),s.jsx(Hf,{label:"Status",value:f,onChange:k=>{h(k),g(0)},options:YD.map(k=>({value:k,label:Tu[k]}))}),s.jsx(Hf,{label:"Priority",value:m,onChange:k=>{x(k),g(0)},options:bx.map(k=>({value:k,label:no[k]}))}),s.jsx(Hf,{label:"Assignee",value:b,onChange:k=>{v(k),g(0)},options:[{value:"unassigned",label:"Unassigned"},{value:"cannot_act",label:"Assignee cannot act"},...S.map(k=>({value:k.user_id,label:k.username??"Not available"}))]})]}),C?s.jsx(Wn,{children:C}):null,s.jsx("div",{className:"rounded-md border",children:s.jsxs(Ye,{children:[s.jsx(We,{children:s.jsxs(ue,{children:[s.jsx(W,{children:"Title"}),s.jsx(W,{children:"External reference"}),s.jsx(W,{children:"Status"}),s.jsx(W,{children:"Priority"}),s.jsx(W,{children:"Assignee"}),s.jsx(W,{children:"Updated"})]})}),s.jsx(Fe,{children:p===null?s.jsx(ue,{children:s.jsx(Y,{colSpan:6,className:"h-24 text-center",children:"Loading…"})}):p.length===0?s.jsx(ue,{children:s.jsx(Y,{colSpan:6,className:"h-24 text-center",children:"No issues match these filters."})}):p.map(k=>s.jsxs(ue,{children:[s.jsx(Y,{className:"max-w-md",children:s.jsx(i,{href:l(hm(n,a,k.id)),className:"font-medium hover:underline",children:k.title})}),s.jsx(Y,{className:"font-mono text-xs",children:k.external_reference??""}),s.jsx(Y,{children:s.jsx(ce,{variant:$k[k.status],children:Tu[k.status]})}),s.jsx(Y,{children:k.priority?no[k.priority]:""}),s.jsx(Y,{children:s.jsx(lz,{issue:k})}),s.jsx(Y,{className:"text-muted-foreground",children:Dc(k.updated_at)})]},k.id))})]})}),s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("p",{className:"text-muted-foreground text-sm",children:w===0?"No issues.":`Showing ${R}–${E} of ${w} issue${w===1?"":"s"}.`}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(P,{variant:"outline",size:"sm",disabled:y===0,onClick:()=>g(k=>Math.max(0,k-1)),children:"Previous"}),s.jsx(P,{variant:"outline",size:"sm",disabled:E>=w,onClick:()=>g(k=>k+1),children:"Next"})]})]}),A]})}function lz({issue:e}){return e.assignee_id?s.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{children:e.assignee_username??"Not available"}),e.assignee_can_act===!1?s.jsx(ce,{variant:"error",children:"Assignee cannot act"}):null]}):s.jsx("span",{className:"text-muted-foreground",children:"Unassigned"})}function Hf({label:e,value:t,onChange:n,options:a}){var l;const r=u.useMemo(()=>t===jn||a.some(i=>i.value===t),[a,t]);return s.jsxs(gt,{value:r?t:jn,onValueChange:n,children:[s.jsx(ft,{className:"w-44","aria-label":e,children:s.jsx(vt,{placeholder:e,children:t===jn?e:(l=a.find(i=>i.value===t))==null?void 0:l.label})}),s.jsxs(ht,{children:[s.jsx(Ee,{value:jn,children:"All"}),a.map(i=>s.jsx(Ee,{value:i.value,children:i.label},i.value))]})]})}const Uk=[{key:"local",label:"Local"},{key:"staging",label:"Staging"},{key:"production",label:"Production"}],iz=/^iss-\d{1,9}$/,oz=/^col-\d{1,9}$/,cz=e=>e&&e[0].toUpperCase()+e.slice(1);function Bk(e){const t=cz(e.status_word??e.status.replace(/_/g," ")),n=e.group??(e.status==="resolved"?"resolved":"unplaced");return n==="resolved"?{label:t,tone:e.resolution_reason==="fixed"?"success":"neutral"}:n==="unowned"||n==="routed"?{label:t,tone:"warning"}:n==="fixing"?{label:t,tone:"info"}:{label:t,tone:"neutral"}}function Oi(e,t=Date.now()){if(!e)return"";const n=Math.max(0,(t-Date.parse(e))/1e3);return Number.isFinite(n)?n<60?"just now":n<3600?`${Math.round(n/60)}m ago`:n<86400?`${Math.round(n/3600)}h ago`:`${Math.round(n/86400)}d ago`:""}const pm={search:"",owner:null,urgent:!1,seen:[],label:null,collection:null};function zc(e){const t=new URLSearchParams(e),n=t.getAll("seen").filter(r=>Uk.some(l=>l.key===r)),a=t.get("collection");return{search:t.get("search")??"",owner:t.get("owner")||null,urgent:t.get("urgent")==="1",seen:[...new Set(n)],label:t.get("label")||null,collection:a&&oz.test(a)?a:null}}function Qr(e){const t=new URLSearchParams;e.search&&t.set("search",e.search),e.owner&&t.set("owner",e.owner),e.urgent&&t.set("urgent","1");for(const n of e.seen)t.append("seen",n);return e.label&&t.set("label",e.label),e.collection&&t.set("collection",e.collection),t.toString()}function uz(e){return{search:e.search.trim()||void 0,owner:e.owner??void 0,urgent:e.urgent||void 0,seen:e.seen.length?e.seen:void 0,label:e.label?[e.label]:void 0,collection:e.collection??void 0}}const Wv=e=>!!(e.search.trim()||e.owner||e.urgent||e.seen.length||e.label||e.collection),dz={agent:"Filed by an agent",user:"Filed by you",tool:"Filed by a tool"},fz={graph:"Placed on the graph by its anchors",files:"Placed by its files",unplaced:"Triaged, not placed yet"},hz={handoff:"Handed to its owner",backlog:"Sent to the unowned backlog",batch:"Routed to a batch"};function mz(e,t=""){const n=(e??t).trim();if(!n)return"";const a=n.indexOf(": "),r=(a===-1?n:n.slice(0,a)).trim(),l=a===-1?"":n.slice(a+2).trim(),i=o=>l?`${o} ${l}`:o;switch(r){case"filed":return dz[l]??i("Filed by");case"labelled":return i("Labelled");case"unlabelled":return l?`Label removed: ${l}`:"Label removed";case"anchored":return l?`Anchored to ${l}`:"Anchored";case"triaged":return fz[l]??(l?`Triaged: ${l}`:"Triaged");case"routed":return hz[l]??(l?`Routed: ${l}`:"Routed");case"route closed":return l==="backlog"?"Taken off the unowned backlog":l?`Route closed: ${l}`:"Route closed";case"released":return l?`Released by its owner (task ${l})`:"Released by its owner";case"resolved":return l==="duplicate"?"Resolved as a duplicate":l?`Resolved · ${l.replace(/_/g," ")}`:"Resolved";case"reopened":return l?`Reopened: ${l}`:"Reopened";case"fix landed":return l?`Fix landed in ${l.slice(0,10)}`:"Fix landed";case"merged":return l?`Merged ${l} into this issue`:"Merged a duplicate into this issue";default:return n}}const pz=e=>e.replace(/`+/g,"").replace(/\s+/g," ").trim(),Hk="This page only reads issues",Ik="File, route and resolve issues with the issue command or through the thread working on them.",xz=10,gz=250,Ar="__all",vz="none",yz=e=>e.status===0||e.reason==="store_locked"||e.reason==="engine_failed"||e.status>=500;function Pk(){const e=un().issues;if(!e)throw new Error("The Issues page rendered without the issues seam.");return e}const jz=e=>({read_at:e,scope:"project",folder:null,groups:[],facets:{owners:[],labels:[],urgent:0,seen:{local:0,staging:0,production:0}},listed:0,collections:[]});function bz({project:e,query:t,onQuery:n}){var X;const a=Pk(),{href:r,Link:l}=Ze(),i=u.useMemo(()=>zc(t),[t]),o=Qr(i),c=Wv(i),[d,f]=u.useState({state:"loading"}),[h,m]=u.useState(null),[x,b]=u.useState(null),v=u.useRef(0),y=u.useRef(0),g=u.useRef(null),p=u.useRef(null),j=ls(),w=u.useRef(!1),[N,C]=u.useState(i.search),_=u.useCallback(D=>n(Qr({...i,...D})),[i,n]),S=u.useCallback(async()=>{const D=y.current+=1;b(null);const H=await a.list(uz(zc(o)));if(D!==y.current)return;if(H.ok){v.current=0,m(null),f({state:"ok",list:H.data,local:H.data.local??jz(new Date().toISOString()),key:o});return}const te=H.refusal.reason;if(te==="engine_missing")return f({state:"engine_missing",refusal:H.refusal});if(te==="view_outdated")return f({state:"view_outdated"});if(v.current+=1,v.current===1&&yz(H.refusal)){b(H.refusal.retry_after??xz);return}m(H.refusal)},[a.list,o]);u.useEffect(()=>{S()},[S]),u.useEffect(()=>{if(x===null)return;const D=setTimeout(()=>void S(),x*1e3);return()=>clearTimeout(D)},[x,S]),u.useEffect(()=>{document.activeElement!==g.current&&C(i.search)},[i.search]),u.useEffect(()=>{if(N===i.search)return;const D=setTimeout(()=>_({search:N}),gz);return()=>clearTimeout(D)},[N,i.search,_]),u.useEffect(()=>{const D=H=>{if(H.key!=="/"||H.metaKey||H.ctrlKey||H.altKey)return;const te=H.target;te&&(te.isContentEditable||["INPUT","TEXTAREA","SELECT"].includes(te.tagName))||g.current&&(H.preventDefault(),g.current.focus())};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[]);const $=()=>{var D;C(""),n(Qr(pm)),(D=g.current)==null||D.focus()},O=()=>{v.current=0,S()},G=()=>{w.current=!0,O()};u.useEffect(()=>{var H;if(!w.current||d.state==="loading"||x!==null)return;w.current=!1;const D=(H=p.current)==null?void 0:H.querySelector("h1");D&&(D.tabIndex=-1,D.focus())},[d,h,x]);const V=D=>`/proj/${encodeURIComponent(e)}/issues${D?`?${D}`:""}`,L=D=>`/proj/${encodeURIComponent(e)}/issues/${encodeURIComponent(D)}?from=issues${o?`&${o}`:""}`,U=s.jsx("div",{role:"status","aria-live":"polite",children:x!==null?s.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",children:[s.jsx(Qt,{"aria-hidden":"true"}),"Issues are busy. Reading them again…"]}):null}),A=h?s.jsxs(me,{variant:"destructive",className:"mt-4",children:[s.jsx(st,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:"Issues could not be loaded"}),s.jsxs(ge,{children:[s.jsxs("p",{children:[h.message,h.since?` Since ${es(h.since)}.`:"",d.state==="ok"?` The list below was read at ${es(d.local.read_at)}.`:"",h.message.includes(cr)?"":` ${cr}`]}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:G,children:"Retry"})]})]}):null,R=s.jsx(Jt,{title:"Issues",description:"This repository's local issues: what agents and you reported, where triage placed each, and what fixes it.",actions:d.state==="ok"?s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("span",{className:"text-muted-foreground text-sm",children:["Read at ",es(d.local.read_at)]}),s.jsxs(P,{type:"button",variant:"ghost",size:"sm",onClick:O,children:[s.jsx(jr,{className:"mr-2 size-4","aria-hidden":"true"}),"Read again"]})]}):null});if(d.state==="engine_missing")return s.jsx(mc,{ref:p,children:s.jsx(Zs,{page:"Issues"})});if(d.state==="view_outdated")return s.jsxs(mc,{ref:p,children:[R,s.jsxs(me,{variant:"warning",className:"mt-6",children:[s.jsx(Xt,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:Dl}),s.jsx(ge,{children:j})]})]});if(d.state==="loading")return s.jsxs(mc,{ref:p,children:[R,U,A,!h&&x===null?s.jsx("div",{className:"mt-6 grid gap-2",role:"status","aria-label":"Loading issues",children:Array.from({length:6},(D,H)=>s.jsx(_t,{className:H===5?"h-10 w-2/3":"h-10 w-full"},H))}):null]});const{list:E,local:k}=d,M=!h&&x===null&&(d.key!==o||N!==i.search),K=Wv(zc(d.key)),T=k.scope==="folder",B=k.listed===0&&!c,F=Math.max(0,k.listed-k.facets.owners.reduce((D,H)=>D+H.count,0)),J=i.collection?((X=k.collections.find(D=>D.collection===i.collection))==null?void 0:X.title)??i.collection:null,he=new Map;for(const D of E.issues){const H=D.group??"unplaced";he.set(H,[...he.get(H)??[],D])}return s.jsxs(mc,{ref:p,children:[R,T&&k.folder?s.jsxs("p",{className:"text-muted-foreground mt-1 text-sm",children:["Issues of the folder ",k.folder,", from its issue store."]}):null,s.jsxs(me,{variant:"info",className:"mt-4",children:[s.jsx(ko,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:Hk}),s.jsx(ge,{children:Ik})]}),U,A,B?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(VR,{className:"text-muted-foreground size-8","aria-hidden":"true"}),s.jsx("h2",{className:"text-lg font-semibold",children:"No issues yet"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Issues filed in this repository with the issue command appear here."})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-3",children:[s.jsx(Nt,{ref:g,type:"search",className:"w-64","aria-label":"Search issues",placeholder:"Search issues",value:N,onChange:D=>C(D.target.value)}),s.jsxs(gt,{value:i.owner??Ar,onValueChange:D=>_({owner:D===Ar?null:D}),children:[s.jsx(ft,{className:"w-56","aria-label":"Owner",children:s.jsx(vt,{})}),s.jsxs(ht,{children:[s.jsx(Ee,{value:Ar,children:"All owners"}),s.jsxs(Ee,{value:vz,children:["Unowned (",F,")"]}),k.facets.owners.map(D=>s.jsxs(Ee,{value:D.key,children:[D.title," (",D.count,")"]},D.key))]})]}),s.jsxs(gt,{value:i.label??Ar,onValueChange:D=>_({label:D===Ar?null:D}),children:[s.jsx(ft,{className:"w-48","aria-label":"Label",children:s.jsx(vt,{})}),s.jsxs(ht,{children:[s.jsx(Ee,{value:Ar,children:"All labels"}),k.facets.labels.map(D=>s.jsxs(Ee,{value:D.label,children:[D.label," (",D.count,")"]},D.label))]})]})]}),s.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-x-4 gap-y-2",children:[s.jsx("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":"Marks",children:s.jsxs(P,{type:"button",variant:"outline",size:"sm",className:ll,"aria-pressed":i.urgent,onClick:()=>_({urgent:!i.urgent}),children:["Urgent ",k.facets.urgent]})}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":"Seen on",children:[s.jsx("span",{className:"text-muted-foreground text-xs",children:"Seen on"}),Uk.map(D=>{const H=i.seen.includes(D.key);return s.jsxs(P,{type:"button",variant:"outline",size:"sm",className:ll,"aria-pressed":H,onClick:()=>_({seen:H?i.seen.filter(te=>te!==D.key):[...i.seen,D.key]}),children:[D.label," ",k.facets.seen[D.key]]},D.key)}),J!==null?s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsxs("span",{"data-testid":"issues-collection-chip",className:le(pd({variant:"outline",size:"sm"}),nM),children:["Collection ",J]}),s.jsx(P,{type:"button",variant:"ghost",size:"sm-icon","aria-label":"Remove the collection filter",onClick:()=>{var D;_({collection:null}),(D=g.current)==null||D.focus()},children:s.jsx(od,{className:"size-4","aria-hidden":"true"})})]}):null]})]}),s.jsx("div",{role:"status","aria-live":"polite",children:M?s.jsxs("p",{className:"text-muted-foreground mt-3 flex items-center gap-2 text-sm",children:[s.jsx(Qt,{"aria-hidden":"true"}),"Searching…"]}):c&&E.total>0?s.jsxs("p",{className:"text-muted-foreground mt-3 text-sm",children:[E.total," of ",k.listed," issues ·"," ",s.jsx(P,{type:"button",variant:"link",size:"sm",className:"px-0",onClick:$,children:"Clear"})]}):null}),s.jsx("div",{"data-testid":"issues-results","aria-busy":M||void 0,className:"shrink-0 transition-opacity aria-busy:opacity-50",children:K&&E.total===0?s.jsxs("p",{className:"mt-6 flex items-center gap-2 text-sm",children:[s.jsx(id,{className:"text-muted-foreground size-4","aria-hidden":"true"}),"No issues match."," ",s.jsx(P,{type:"button",variant:"link",size:"sm",className:"px-0",onClick:$,children:"Clear"})]}):k.groups.map(D=>s.jsx(wz,{id:`issues-${D.key}`,title:`${D.label} · ${D.count}`,issues:he.get(D.key)??[],folder:T,link:H=>s.jsx(l,{className:"text-primary hover:underline",href:r(L(H.id)),children:H.title})},D.key))}),!c&&k.collections.length>0?s.jsxs("section",{className:"mt-8","aria-labelledby":"issues-collections-title",children:[s.jsxs("h2",{id:"issues-collections-title",className:"text-lg font-semibold",children:["Collections · ",k.collections.length]}),s.jsx(ut,{className:"mt-2 shrink-0 overflow-x-auto",children:s.jsxs(Ye,{containerAriaLabel:"Collections",className:"table-fixed",children:[s.jsx(We,{children:s.jsxs(ue,{children:[s.jsx(W,{className:"w-1/2",children:"Collection"}),s.jsx(W,{className:"w-1/4",children:"Resolved"}),s.jsx(W,{className:"w-1/4",children:"Updated"})]})}),s.jsx(Fe,{children:k.collections.map(D=>s.jsxs(ue,{children:[s.jsxs(Y,{children:[s.jsx(l,{className:"text-primary hover:underline",href:r(V(Qr({...pm,collection:D.collection}))),children:D.title}),s.jsx("div",{className:"text-muted-foreground font-mono text-xs",children:D.collection})]}),s.jsxs(Y,{children:[D.resolved," of ",D.total," resolved"]}),s.jsx(Y,{className:"text-muted-foreground",children:Oi(D.updated_at)})]},D.collection))})]})})]}):null]})]})}const mc=u.forwardRef(function({children:t},n){return s.jsx("div",{ref:n,className:"flex h-full min-h-0 flex-1 flex-col overflow-auto px-4 py-4 pb-8 sm:px-6 lg:px-8",children:t})});function wz({id:e,title:t,issues:n,folder:a,link:r}){return s.jsxs("section",{className:"mt-6","aria-labelledby":`${e}-title`,"data-testid":"issues-group",children:[s.jsx("h2",{id:`${e}-title`,className:"text-lg font-semibold",children:t}),s.jsx(ut,{className:"mt-2 shrink-0 overflow-x-auto",children:s.jsxs(Ye,{containerAriaLabel:t,className:"table-fixed",children:[s.jsx(We,{children:s.jsxs(ue,{children:[s.jsx(W,{className:a?"w-[30%]":"w-[36%]",children:"Title"}),s.jsx(W,{className:"w-[10%]",children:"Issue"}),a?s.jsx(W,{className:"w-[12%]",children:"Project"}):null,s.jsx(W,{className:"w-[16%]",children:"Status"}),s.jsx(W,{className:"w-[8%]",children:"Urgent"}),s.jsx(W,{className:a?"w-[14%]":"w-[18%]",children:"Owner"}),s.jsx(W,{className:"w-[12%]",children:"Updated"})]})}),s.jsx(Fe,{children:n.map(l=>{var o;const i=Bk(l);return s.jsxs(ue,{"data-testid":"issues-row",children:[s.jsxs(Y,{className:"break-words",children:[r(l),(o=l.labels)!=null&&o.length?s.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:l.labels.map(c=>s.jsx(ce,{variant:"neutral",size:"dense",children:c},c))}):null]}),s.jsx(Y,{className:"font-mono text-xs",children:l.id}),a?s.jsx(Y,{className:"break-words",children:l.project_id??"Folder"}):null,s.jsx(Y,{children:s.jsx(ce,{variant:i.tone,children:i.label})}),s.jsx(Y,{children:l.urgent&&l.status!=="resolved"&&l.group!=="resolved"?s.jsx(ce,{variant:"warning",children:"Urgent"}):null}),s.jsx(Y,{className:"break-words",children:l.owner_title?l.owner_title:s.jsx("span",{className:"text-muted-foreground",children:"Unowned"})}),s.jsx(Y,{className:"text-muted-foreground",children:Oi(l.updated_at)})]},l.id)})})]})})]})}function _z(e){var t;return(t=un().issues)!=null&&t.issueSections?s.jsx(bz,{...e}):s.jsx(az,{org:e.org,project:e.project,query:e.query})}function Nz({update:e,issue:t,open:n,onOpenChange:a,onDone:r,onReload:l}){const[i,o]=u.useState(t.title),[c,d]=u.useState(t.description),[f,h]=u.useState(t.external_reference??""),[m,x]=u.useState(t),[b,v]=u.useState(null),[y,g]=u.useState(!1);u.useEffect(()=>{n&&(o(t.title),d(t.description),h(t.external_reference??""),x(t),v(null))},[n]);const p=N=>{var C;return((C=b==null?void 0:b.personal_data)==null?void 0:C.field)===N?b.message:void 0},j=async N=>{N.preventDefault(),g(!0);const C=await e(m.id,m.revision,{title:i,description:c,external_reference:f.trim()||null});if(g(!1),!C.ok){v(C.refusal);return}r(C.data.issue)},w=async()=>{const N=await l();N&&(x(N),v(null))};return s.jsx(dn,{open:n,onOpenChange:a,children:s.jsx(fn,{className:"sm:max-w-2xl",children:s.jsxs("form",{onSubmit:j,className:"grid gap-4",children:[s.jsxs(hn,{children:[s.jsx(pn,{children:"Edit issue"}),s.jsx(xn,{children:"Text is shown exactly as entered."})]}),b!=null&&b.conflict?s.jsxs(me,{variant:"destructive",children:[s.jsx(st,{}),s.jsx(ge,{children:"Someone else saved this issue after you opened it, so nothing was saved. Your text is kept below; reload the latest issue, then save to apply it."})]}):null,s.jsxs("div",{className:"grid gap-2",children:[s.jsx(De,{htmlFor:"maintain-edit-title",children:"Title"}),s.jsx(Nt,{id:"maintain-edit-title",value:i,"aria-invalid":!!p("title"),onChange:N=>o(N.target.value)}),p("title")?s.jsx(Wn,{children:p("title")}):null]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(De,{htmlFor:"maintain-edit-description",children:"Description"}),s.jsx(An,{id:"maintain-edit-description",rows:4,value:c,"aria-invalid":!!p("description"),onChange:N=>d(N.target.value)}),p("description")?s.jsx(Wn,{children:p("description")}):null]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(De,{htmlFor:"maintain-edit-reference",children:"External reference"}),s.jsx(Nt,{id:"maintain-edit-reference",value:f,"aria-invalid":!!p("external_reference"),onChange:N=>h(N.target.value)}),p("external_reference")?s.jsx(Wn,{children:p("external_reference")}):null]}),b&&!b.conflict&&!b.personal_data?s.jsx(Wn,{children:b.message}):null,s.jsxs(mn,{children:[s.jsx(P,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),b!=null&&b.conflict?s.jsxs(P,{type:"button",variant:"outline",onClick:w,children:[s.jsx(jr,{className:"mr-2 size-4"}),"Reload latest"]}):null,s.jsx(P,{type:"submit",loading:y,disabled:!!(b!=null&&b.conflict),children:"Save"})]})]})})})}function Zv(e){return e.map(t=>Ok[t].toLowerCase()).join(", ")}function kz(e){switch(e.kind){case"created":return"Logged the issue";case"updated":return`Edited the ${Zv(e.fields)}`;case"redacted":return`Redacted the ${Zv(e.fields)}`;case"priority_set":return e.priority?`Set priority to ${no[e.priority]}`:"Cleared the priority";case"assigned":return`Assigned to ${e.assignee_id?e.assignee_username??"someone whose name is not available":"a former member"}`;case"unassigned":return"Unassigned the issue";case"transitioned":{if(e.from_status==="resolved"&&e.to_status==="open")return"Reopened the issue";const t=e.to_status?Tu[e.to_status]:"";return e.resolution_reason?`Moved to ${t}: ${wx[e.resolution_reason]}`:`Moved to ${t}`}}}function Jv(e,t){return t==="external_reference"?e.external_reference??"":e[t]}function Sz({redact:e,issue:t,open:n,onOpenChange:a,onDone:r,onReload:l}){const[i,o]=u.useState("description"),[c,d]=u.useState(""),[f,h]=u.useState(!1),[m,x]=u.useState(null),[b,v]=u.useState(t);u.useEffect(()=>{n&&(v(t),d(Jv(t,i)),x(null))},[n]);const y=async g=>{g.preventDefault(),h(!0);const p=await e(b.id,b.revision,i,c);if(h(!1),!p.ok){if(p.refusal.conflict){const j=await l();j&&v(j),x("Someone else saved this issue after you opened it. The latest issue is loaded and your replacement is kept; redact again to apply it.");return}x(p.refusal.message);return}r(p.data.issue)};return s.jsx(dn,{open:n,onOpenChange:a,children:s.jsx(fn,{className:"sm:max-w-2xl",children:s.jsxs("form",{onSubmit:y,className:"grid gap-4",children:[s.jsxs(hn,{children:[s.jsx(pn,{children:"Redact text"}),s.jsx(xn,{children:"Replace text that holds personal data, such as a name."})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(De,{htmlFor:"maintain-redact-field",children:"Field"}),s.jsxs(gt,{value:i,onValueChange:g=>{const p=g;o(p),d(Jv(b,p))},children:[s.jsx(ft,{id:"maintain-redact-field",children:s.jsx(vt,{})}),s.jsx(ht,{children:KD.map(g=>s.jsx(Ee,{value:g,children:Ok[g]},g))})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(De,{htmlFor:"maintain-redact-replacement",children:"Replacement text"}),s.jsx(An,{id:"maintain-redact-replacement",rows:4,value:c,onChange:g=>d(g.target.value)})]}),s.jsxs(me,{variant:"warning",children:[s.jsx(Xt,{}),s.jsx(ge,{children:"This cannot be undone: the original text is removed for good. History records only that this field was redacted."})]}),m?s.jsx(Wn,{children:m}):null,s.jsxs(mn,{children:[s.jsx(P,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),s.jsx(P,{type:"submit",variant:"destructive",loading:f,children:"Redact"})]})]})})})}function Cz({transition:e,issue:t,open:n,onOpenChange:a,onDone:r}){const[l,i]=u.useState("fixed"),[o,c]=u.useState(!1),[d,f]=u.useState(null),h=async m=>{m.preventDefault(),c(!0);const x=await e(t.id,t.revision,"resolved",l);if(c(!1),!x.ok){if(x.refusal.conflict){r(null);return}f(x.refusal.message);return}f(null),r(x.data.issue)};return s.jsx(dn,{open:n,onOpenChange:a,children:s.jsx(fn,{children:s.jsxs("form",{onSubmit:h,className:"grid gap-4",children:[s.jsxs(hn,{children:[s.jsx(pn,{children:"Resolve issue"}),s.jsx(xn,{children:"Choose how this report ended."})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(De,{htmlFor:"maintain-resolution-reason",children:"Resolution reason *"}),s.jsxs(gt,{value:l,onValueChange:m=>i(m),children:[s.jsx(ft,{id:"maintain-resolution-reason",children:s.jsx(vt,{})}),s.jsx(ht,{children:FD.map(m=>s.jsx(Ee,{value:m,children:wx[m]},m))})]}),s.jsx("p",{className:"text-muted-foreground text-xs",children:"Reopening the issue clears its reason."})]}),d?s.jsx(Wn,{children:d}):null,s.jsxs(mn,{children:[s.jsx(P,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),s.jsx(P,{type:"submit",loading:o,children:"Resolve"})]})]})})})}const Mr="not_set";function Rz({org:e,project:t,issue_id:n,query:a}){const r=Dk(),l=zk(r),i=hm(e,t);return s.jsx("div",{className:"flex w-full flex-1 flex-col gap-6 px-4 py-4 sm:px-6 lg:px-8",children:s.jsx(Lk,{access:l,header:s.jsx(Jt,{title:"Support"}),back_href:i,children:o=>r?s.jsx(Tz,{contract:r,issue_id:n,access:o,list_href:i,duplicates:Number(new URLSearchParams(a).get("duplicates")??0)}):null})})}function Tz({contract:e,issue_id:t,access:n,list_href:a,duplicates:r}){const{href:l,Link:i}=Ze(),o=yr(),[c,d]=u.useState(null),[f,h]=u.useState([]),[m,x]=u.useState(!1),[b,v]=u.useState([]),[y,g]=u.useState(null),p=u.useCallback(async()=>{const _=await e.issue(t);return _.ok?(d(_.data.issue),h(_.data.events),_.data.issue):(_.refusal.status===404?x(!0):o.error(_.refusal.message),null)},[e,t,o]);u.useEffect(()=>{let _=!1;return e.issue(t).then(S=>{if(!_){if(!S.ok){S.refusal.status===404?x(!0):o.error(S.refusal.message);return}d(S.data.issue),h(S.data.events)}}),()=>{_=!0}},[e,t]),u.useEffect(()=>{n.can_change&&e.assigneeCandidates().then(_=>{_.ok&&v(_.data.candidates)})},[e,n.can_change]);const j=async _=>{const S=await _;if(!S.ok){o.error(S.refusal.message),S.refusal.conflict&&await p();return}await p()};if(m)return s.jsx(Ha,{title:"Support issue not found",description:"This issue does not exist in this project.",backHref:l(a),backLabel:"Back to Support",link:i});if(!c)return s.jsx("p",{className:"text-muted-foreground text-sm",children:"Loading…"});const w=c.status==="closed",N=n.can_change,C=_=>j(e.transition(c.id,c.revision,_));return s.jsxs(s.Fragment,{children:[s.jsx(Jt,{title:c.title,actions:N?s.jsxs(s.Fragment,{children:[w?null:s.jsxs(P,{variant:"outline",onClick:()=>g("edit"),children:[s.jsx(ld,{className:"mr-2 size-4"}),"Edit"]}),s.jsxs(P,{variant:"outline",onClick:()=>g("redact"),children:[s.jsx(ER,{className:"mr-2 size-4"}),"Redact"]}),c.status==="open"?s.jsx(P,{variant:"outline",disabled:!c.priority,"aria-description":c.priority?void 0:"Set a priority first.",onClick:()=>void C("triaged"),children:"Triage"}):null,c.status==="open"||c.status==="triaged"?s.jsxs(P,{onClick:()=>g("resolve"),children:[s.jsx(rd,{className:"mr-2 size-4"}),"Resolve"]}):null,c.status==="resolved"?s.jsxs(s.Fragment,{children:[s.jsxs(P,{variant:"outline",onClick:()=>void C("open"),children:[s.jsx(xT,{className:"mr-2 size-4"}),"Reopen"]}),s.jsx(P,{onClick:()=>void C("closed"),children:"Close"})]}):null]}):void 0,children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(ce,{variant:$k[c.status],children:Tu[c.status]}),s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Logged by ",WD(c)," ",Dc(c.created_at)]})]})}),s.jsxs("div",{className:"flex flex-col gap-8 lg:flex-row lg:items-start",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-6",children:[r>0&&c.external_reference?s.jsxs(me,{variant:"info",children:[s.jsx(ws,{}),s.jsxs(ge,{className:"flex flex-row flex-wrap items-center justify-between gap-2",children:[s.jsxs("span",{children:[c.external_reference," is already logged on"," ",r===1?"another issue":`${r} other issues`," in this project."]}),s.jsx(P,{asChild:!0,variant:"outline",size:"sm",children:s.jsx(i,{href:l(`${a}?external_reference=${encodeURIComponent(c.external_reference)}`),children:"Show both"})})]})]}):null,s.jsxs("section",{className:"flex flex-col gap-2",children:[s.jsx("h2",{className:"text-lg font-semibold",children:"Description"}),c.description?s.jsx("p",{className:"text-sm break-words whitespace-pre-wrap",children:c.description}):s.jsx("p",{className:"text-muted-foreground text-sm",children:"No description."})]}),s.jsxs("section",{className:"flex flex-col gap-2",children:[s.jsx("h2",{className:"text-lg font-semibold",children:"History"}),s.jsx("div",{className:"rounded-md border",children:s.jsxs(Ye,{children:[s.jsx(We,{children:s.jsxs(ue,{children:[s.jsx(W,{children:"When"}),s.jsx(W,{children:"Who"}),s.jsx(W,{children:"What"})]})}),s.jsx(Fe,{children:f.map(_=>s.jsxs(ue,{children:[s.jsx(Y,{className:"text-muted-foreground",children:Dc(_.created_at)}),s.jsx(Y,{children:ZD(_,c)}),s.jsx(Y,{children:kz(_)})]},_.id))})]})})]})]}),s.jsxs("aside",{className:"flex w-full shrink-0 flex-col gap-5 lg:w-72",children:[s.jsx(ri,{label:"External reference",children:c.external_reference?s.jsx("span",{className:"font-mono text-sm",children:c.external_reference}):s.jsx("span",{className:"text-muted-foreground text-sm",children:"None"})}),c.resolution_reason?s.jsx(ri,{label:"Resolution",children:s.jsx("span",{className:"text-sm",children:wx[c.resolution_reason]})}):null,s.jsx(ri,{label:"Priority",id:"maintain-issue-priority",children:s.jsxs(gt,{value:c.priority??Mr,disabled:!N||w,onValueChange:_=>void j(e.update(c.id,c.revision,{priority:_===Mr?null:_})),children:[s.jsx(ft,{id:"maintain-issue-priority",children:s.jsx(vt,{})}),s.jsxs(ht,{children:[s.jsx(Ee,{value:Mr,children:"Not set"}),bx.map(_=>s.jsx(Ee,{value:_,children:no[_]},_))]})]})}),s.jsxs(ri,{label:"Assignee",id:"maintain-issue-assignee",children:[s.jsxs(gt,{value:c.assignee_id??Mr,disabled:!N||w,onValueChange:_=>void j(e.assign(c.id,c.revision,_===Mr?null:_)),children:[s.jsx(ft,{id:"maintain-issue-assignee",children:s.jsx(vt,{})}),s.jsxs(ht,{children:[s.jsx(Ee,{value:Mr,children:"Not set"}),c.assignee_id&&!b.some(_=>_.user_id===c.assignee_id)?s.jsx(Ee,{value:c.assignee_id,children:_x(c.assignee_id,c.assignee_username)}):null,b.map(_=>s.jsx(Ee,{value:_.user_id,children:_.username??"Not available"},_.user_id))]})]}),c.assignee_can_act===!1?s.jsx(ce,{variant:"error",className:"self-start",children:"Assignee cannot act"}):null]}),s.jsx(ri,{label:"Updated",children:s.jsx("span",{className:"text-sm",children:Dc(c.updated_at)})})]})]}),s.jsx(Nz,{update:e.update,issue:c,open:y==="edit",onOpenChange:_=>g(_?"edit":null),onReload:p,onDone:()=>{g(null),p()}}),s.jsx(Sz,{redact:e.redact,issue:c,open:y==="redact",onOpenChange:_=>g(_?"redact":null),onReload:p,onDone:()=>{g(null),o.success("The text was redacted."),p()}}),s.jsx(Cz,{transition:e.transition,issue:c,open:y==="resolve",onOpenChange:_=>g(_?"resolve":null),onDone:_=>{g(null),_||o.error("Someone else changed this issue; it is reloaded."),p()}})]})}function ri({label:e,id:t,children:n}){return s.jsxs("div",{className:"flex flex-col gap-1.5",children:[t?s.jsx("label",{htmlFor:t,className:"text-muted-foreground text-2xs font-medium tracking-wide uppercase",children:e}):s.jsx("span",{className:"text-muted-foreground text-2xs font-medium tracking-wide uppercase",children:e}),n]})}const Ez=10,Az=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/,ey=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,63}$/;function Mz(e,t,n,a=""){const r=n!=null&&n.startsWith("task:")?n.slice(5):null;if(r&&Az.test(r))return{label:r,path:`/org/${e}/tasks/${r}`};const l=`/proj/${encodeURIComponent(t)}/releases`,i=n!=null&&n.startsWith("release:")?n.slice(8):null;if(i&&ey.test(i))return{label:i==="candidate"?"Candidate":i,path:`${l}?release=${encodeURIComponent(i)}`};const o=n!=null&&n.startsWith("planned:")?n.slice(8):null;if(o&&ey.test(o))return{label:o,path:`${l}?planned=${encodeURIComponent(o)}`};const c=Qr(zc(a));return{label:"Issues",path:`/proj/${encodeURIComponent(t)}/issues${c?`?${c}`:""}`}}const $z=["Fixed in","Being fixed in","The release planned to fix it"];function Oz(e){const t=e.filter(n=>n.kind==="release");for(const n of $z){const a=t.find(r=>r.relation===n);if(a)return a}return t[0]??null}function Dz({org:e,project:t,issue_id:n,from:a,query:r=""}){var Be;const l=Pk(),{href:i,Link:o}=Ze(),c=Mz(e,t,a,r),d=`/proj/${encodeURIComponent(t)}/issues`,f=Q=>`${d}/${encodeURIComponent(Q)}`,[h,m]=u.useState({state:"loading"}),[x,b]=u.useState(null),[v,y]=u.useState(null),[g,p]=u.useState({state:"loading"}),[j,w]=u.useState({state:"loading"}),N=u.useRef(null),C=ls(),_=u.useRef(null),S=u.useRef(!1),$=u.useRef(0),O=u.useRef(0),G=u.useCallback(async()=>{if(!l.issueSections)return;p({state:"loading"});const Q=await l.issueSections(n);p(Q.ok?{state:"ok",data:Q.data}:{state:"failed",refusal:Q.refusal})},[l.issueSections,n]),V=u.useCallback(async()=>{if(!l.issueRelated)return;w({state:"loading"});const Q=await l.issueRelated(n);w(Q.ok?{state:"ok",data:Q.data}:{state:"failed",refusal:Q.refusal})},[l.issueRelated,n]),L=u.useCallback(async()=>{const Q=O.current+=1;if(y(null),!iz.test(n)){m({state:"missing"});return}G(),V();const Re=await l.issue(n);if(Q!==O.current)return;if(Re.ok){$.current=0,b(null),m({state:"ok",issue:Re.data.issue,events:Re.data.events,at:new Date().toISOString()});return}const Ue=Re.refusal.reason;if(Re.refusal.status===404||Ue==="not_found")return m({state:"missing"});if(Ue==="engine_missing")return m({state:"engine_missing",refusal:Re.refusal});if(Ue==="view_outdated")return m({state:"view_outdated"});if($.current+=1,$.current===1&&Ak(Re.refusal)){y(Re.refusal.retry_after??Ez);return}b(Re.refusal)},[l.issue,n,G,V]);u.useEffect(()=>{L()},[L]),u.useEffect(()=>{if(v===null)return;const Q=setTimeout(()=>void L(),v*1e3);return()=>clearTimeout(Q)},[v,L]),u.useEffect(()=>{var Re;if(S.current||h.state!=="ok")return;S.current=!0;const Q=(Re=N.current)==null?void 0:Re.querySelector("h1");Q&&(Q.tabIndex=-1,Q.focus())},[h.state]);const U=u.useRef(null);u.useEffect(()=>{var Ue;const Q=U.current;if(Q===null||(Q==="sections"?g:j).state==="loading")return;U.current=null;const Re=(Q==="related"?_.current:null)??((Ue=N.current)==null?void 0:Ue.querySelector("h1"));Re==null||Re.focus()},[g,j]);const A=Q=>{U.current=Q,Q==="sections"?G():V()},R=()=>{$.current=0,L()},E=u.useRef(!1),k=()=>{E.current=!0,R()};if(u.useEffect(()=>{var Re;if(!E.current||h.state==="loading"||v!==null)return;E.current=!1;const Q=(Re=N.current)==null?void 0:Re.querySelector("h1");Q&&(Q.tabIndex=-1,Q.focus())},[h,x,v]),h.state==="missing")return s.jsx(ba,{children:s.jsx(Ha,{icon:s.jsx(id,{"aria-hidden":"true"}),title:"Issue not found",description:`No issue ${n} in this repository's issue store.`,backHref:i(a==="issues"?c.path:d),backLabel:"Back to issues",link:o})});const M=s.jsx(P,{asChild:!0,variant:"link",size:"sm",className:"px-0",children:s.jsxs(o,{href:i(c.path),children:[s.jsx(M0,{className:"size-4","aria-hidden":"true"}),c.label]})});if(h.state==="engine_missing"||h.state==="view_outdated")return s.jsx(ba,{children:h.state==="engine_missing"?s.jsx(Zs,{page:"Issue",header:s.jsx($i,{back:M,id:null,title:n})}):s.jsxs(s.Fragment,{children:[s.jsx($i,{back:M,id:null,title:n}),s.jsxs(me,{variant:"warning",className:"mt-4",children:[s.jsx(Xt,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:Dl}),s.jsx(ge,{children:C})]})]})});const K=x?s.jsxs(me,{variant:"destructive",className:"mt-4",children:[s.jsx(st,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:"This issue could not be loaded"}),s.jsxs(ge,{children:[s.jsxs("p",{children:[x.message,x.since?` Since ${es(x.since)}.`:"",h.state==="ok"?` This page was read at ${es(h.at)}.`:"",x.message.includes(cr)?"":` ${cr}`]}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:k,children:"Retry"})]})]}):null,T=s.jsx("div",{role:"status","aria-live":"polite",children:v!==null?s.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",children:[s.jsx(Qt,{"aria-hidden":"true"}),"This issue is busy. Reading it again…"]}):null});if(h.state==="loading")return s.jsxs(ba,{children:[s.jsx("div",{children:M}),T,K,!x&&v===null?s.jsxs("div",{className:"mt-4 grid gap-3",role:"status","aria-label":"Loading issue",children:[s.jsx(_t,{className:"h-6 w-40"}),s.jsx(_t,{className:"h-9 w-2/3"}),s.jsx(_t,{className:"h-24 w-full"})]}):null]});const{issue:B,events:F,at:J}=h,he=Bk(B),X=g.state==="ok"?g.data:null,D=(X==null?void 0:X.reporter)??B.created_by_username??null,H=j.state==="ok"?Oz(j.data):null,te=B.status==="resolved"||B.group==="resolved",se=!!(X!=null&&X.duplicate_of),ye=g.state==="loading"?"Loading…":(X==null?void 0:X.routing.owner)??B.owner_title??s.jsx("span",{className:"text-muted-foreground",children:"Unowned"}),re=Q=>`${d}?${Qr({...pm,collection:Q})}`,we=X==null?void 0:X.report,ne=!!(we&&(we.actual||we.expected||we.steps.length||we.where)),rt=[...F].reverse(),de=s.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[s.jsxs("span",{className:"text-muted-foreground text-sm",children:["Read at ",es(J)]}),s.jsxs(P,{type:"button",variant:"ghost",size:"sm",onClick:R,children:[s.jsx(jr,{className:"mr-2 size-4","aria-hidden":"true"}),"Read again"]})]});return s.jsx(ba,{children:s.jsxs("div",{ref:N,className:"contents",children:[s.jsx($i,{back:M,id:B.id,badge:s.jsxs(s.Fragment,{children:[s.jsx(ce,{variant:he.tone,children:he.label}),B.urgent&&!te?s.jsx(ce,{variant:"warning",children:"Urgent"}):null]}),title:B.title,created:`Reported${D?` by ${D}`:""} · ${Oi(B.created_at)}`,actions:de}),X!=null&&X.duplicate_of?s.jsxs("p",{className:"mt-1 text-sm",children:["Duplicate of"," ",s.jsx(o,{className:"text-primary font-mono hover:underline",href:i(f(X.duplicate_of)),children:X.duplicate_of})]}):null,T,K,g.state==="loading"?s.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",role:"status",children:[s.jsx(Qt,{"aria-hidden":"true"}),"Loading the issue's sections"]}):null,s.jsxs("dl",{className:"mt-4 mb-0 flex flex-wrap gap-x-12 gap-y-4","data-testid":"issue-facts",children:[s.jsx(xs,{label:"Owner",value:ye}),se?null:s.jsx(xs,{label:"Release",value:j.state==="loading"?"Loading…":H?s.jsx("span",{className:le(H.label===H.id&&"font-mono"),children:H.label}):s.jsx("span",{className:"text-muted-foreground",children:"No release yet"})}),s.jsx(xs,{label:"Reported",value:[D,B.created_at?Pn(B.created_at):null].filter(Boolean).join(" · ")})]}),s.jsxs(me,{variant:"info",className:"mt-4",children:[s.jsx(ko,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:Hk}),s.jsx(ge,{children:Ik})]}),g.state==="failed"?s.jsx("div",{className:"mt-6",children:s.jsx(jx,{what:"this issue's sections",again:"Read the issue again",refusal:g.refusal,on_retry:()=>A("sections")})}):null,X&&ne&&we?s.jsxs(Ct,{id:"issue-report",title:"What happens",children:[we.actual?s.jsx("p",{className:"text-sm whitespace-pre-wrap",children:we.actual}):null,we.expected?s.jsxs("div",{className:"mt-3",children:[s.jsx("h3",{className:"text-sm font-semibold",children:"Expected"}),s.jsx("p",{className:"text-sm whitespace-pre-wrap",children:we.expected})]}):null,we.steps.length?s.jsxs("div",{className:"mt-3",children:[s.jsx("h3",{className:"text-sm font-semibold",children:"Steps"}),s.jsx("ol",{className:"list-decimal pl-5 text-sm",children:we.steps.map((Q,Re)=>s.jsx("li",{children:Q},Re))})]}):null,(Be=we.where)!=null&&Be.env?s.jsxs("p",{className:"text-muted-foreground mt-3 text-sm",children:["Seen on ",we.where.env,we.where.sha?s.jsxs(s.Fragment,{children:[" ","at ",s.jsx("span",{className:"font-mono",children:we.where.sha})]}):null]}):null]}):null,X&&(X.placement.placed||X.placement.unplaced_why)?s.jsx(Ct,{id:"issue-placement",title:"Placement",children:X.placement.placed?s.jsxs("p",{className:"text-sm",children:["Placed in ",X.placement.placed]}):s.jsxs(me,{variant:"warning",children:[s.jsx(Xt,{className:"size-4","aria-hidden":"true"}),s.jsxs(je,{children:["Not placed yet: ",X.placement.unplaced_why]})]})}):null,X&&(X.routing.route||X.routing.owner||X.routing.none)?s.jsxs(Ct,{id:"issue-routing",title:"Routing",children:[X.routing.route?s.jsx("p",{className:"text-sm",children:X.routing.route}):null,X.routing.owner?s.jsxs("p",{className:"text-sm",children:["Owner: ",X.routing.owner]}):s.jsx("p",{className:"text-muted-foreground text-sm",children:"Owner: none yet"})]}):null,X&&(X.labels.length>0||X.collections.length>0)?s.jsxs(Ct,{id:"issue-labels",title:"Labels and collections",children:[X.labels.length?s.jsx("div",{className:"flex flex-wrap gap-1",children:X.labels.map(Q=>s.jsx(ce,{variant:"neutral",size:"dense",children:Q},Q))}):null,X.collections.length?s.jsx("ul",{className:"mt-2 grid gap-1 text-sm",children:X.collections.map(Q=>s.jsxs("li",{children:[s.jsx(o,{className:"text-primary hover:underline",href:i(re(Q.collection)),children:Q.title}),Q.ref?s.jsxs("span",{className:"text-muted-foreground",children:[" · ",Q.ref]}):null,s.jsxs("span",{className:"text-muted-foreground",children:[" ","· ",Q.resolved," of ",Q.total," resolved"]})]},Q.collection))}):null]}):null,X&&X.anchors.length>0?s.jsx(Ct,{id:"issue-anchors",title:"Anchors",children:s.jsx(If,{label:"Anchors",heads:["Kind","Value","By"],rows:X.anchors.map(Q=>[Q.kind,s.jsx("span",{className:"font-mono text-xs break-all",children:Q.value}),Q.by??""])})}):null,X&&X.seen.length>0?s.jsx(Ct,{id:"issue-seen",title:"Seen",aside:`${X.seen.length} of ${Math.max(B.occurrences??0,X.seen.length)} sightings`,children:s.jsx(If,{label:"Seen",heads:["When","Where","Who","Note"],rows:X.seen.map(Q=>[Oi(Q.at),s.jsxs(s.Fragment,{children:[Q.sha?s.jsx("div",{className:"font-mono text-xs",children:Q.sha}):null,Q.env?s.jsx("div",{className:"text-muted-foreground text-xs",children:Q.env}):null]}),Q.who??"",Q.note??""])})}):null,rt.length>0?s.jsx(Ct,{id:"issue-history",title:"History",aside:"From the issue store, newest first",children:s.jsx(If,{label:"History",heads:["When","Who","What"],rows:rt.map(Q=>[Oi(Q.created_at),Q.actor_username??"",mz(Q.note,Q.kind)])})}):null,s.jsx(Mk,{id:"issue-related",related:j,heading_ref:_,on_retry:()=>A("related"),fixed:!0,link:Q=>{const Re=Q.kind==="thread"?`${e?`/org/${e}`:""}/threads#thread-${encodeURIComponent(Q.id)}`:Q.kind==="task"?`/org/${e}/tasks/${encodeURIComponent(Q.id)}?from=issue:${B.id}`:Q.kind==="issue"?f(Q.id):Q.kind==="release"?`/proj/${encodeURIComponent(t)}/releases?${Q.planned?"planned":"release"}=${encodeURIComponent(Q.id)}`:null;if(Q.kind==="task"&&Re){const Ue=pz(Q.label);return s.jsxs("div",{className:"min-w-0",children:[s.jsx(o,{className:"text-primary font-mono text-xs hover:underline",href:i(Re),children:Q.id}),Ue&&Ue!==Q.id?s.jsx("div",{className:"text-muted-foreground line-clamp-1 text-xs",title:Ue,"data-testid":"related-task-title",children:Ue}):null]})}return Re?s.jsx(o,{className:le("text-primary hover:underline",Q.kind!=="thread"&&Q.label===Q.id&&"font-mono"),href:i(Re),children:Q.label}):Q.label}})]})})}function If({label:e,heads:t,rows:n}){return s.jsx(ut,{className:"overflow-x-auto",children:s.jsxs(Ye,{containerAriaLabel:e,children:[s.jsx(We,{children:s.jsx(ue,{children:t.map(a=>s.jsx(W,{children:a},a))})}),s.jsx(Fe,{children:n.map((a,r)=>s.jsx(ue,{children:a.map((l,i)=>s.jsx(Y,{className:"break-words",children:l},i))},r))})]})})}function zz({org:e,project:t,issue_id:n,from:a,query:r}){var l;return(l=un().issues)!=null&&l.issueSections?s.jsx(Dz,{org:e,project:t,issue_id:n,from:a,query:r}):s.jsx(Rz,{org:e,project:t,issue_id:n,query:r})}function Eu(e,t){u.useEffect(()=>{const n=setInterval(()=>{document.visibilityState==="visible"&&e()},t),a=()=>{document.visibilityState==="visible"&&e()};return document.addEventListener("visibilitychange",a),()=>{clearInterval(n),document.removeEventListener("visibilitychange",a)}},[e,t])}const qk={integration:"Integration",deploy:"Deploy",publish:"Publish",accept:"Accept",custom:"Custom"},Lz={self_service:"Self-service",managed:"Managed",manager_only:"Manager only"},Uz={self_service:"Self-service: each entry takes its own turn",managed:"Managed: a manager batches entries that allow it",manager_only:"Manager only: the manager runs every turn"},Bz={in_batch:{label:"In the batch",tone:"info"},done:{label:"Done",tone:"success"},failed:{label:"Failed",tone:"error"},released:{label:"Released",tone:"neutral"},left:{label:"Left",tone:"neutral"},gone:{label:"Ended",tone:"neutral"},skipped:{label:"Skipped",tone:"neutral"},lapsed:{label:"Lapsed",tone:"warning"}};function Hz(e){return Bz[e??"in_batch"]}function Iz(e){const t=e.turn==="next",n=t?"Next":"Waiting",a=e.batching==="managed"||e.batching==="released"?` · ${e.batching}`:"";return{label:`${n}${a}`,tone:t?"info":"neutral"}}const Gk=(e,t)=>`Holds ${e.toLowerCase()}${t?`: ${t}`:""}`;function Pz(e,t,n,a=!0){return e.fixing_since!==void 0?{label:`Fixing forward since ${Xn(e.fixing_since)}`,tone:"warning"}:e.ref===t?{label:"Landing",tone:"info"}:a&&e.hold?{label:Gk(n),tone:"info"}:{label:"Running",tone:"info"}}function Xn(e){return new Date(e*1e3).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function $r(e){const t=Math.round(e/60);if(t<60)return`${t} min`;const n=Math.floor(t/60),a=t%60;return a?`${n} h ${a} min`:`${n} h`}function qz(e){var n;const t=e.binding;return(t==null?void 0:t.kind)==="repository_branch"?`${t.repository} · ${t.branch}`:(t==null?void 0:t.kind)==="label"?t.label:((n=e.layer)==null?void 0:n.kind)==="release"&&e.layer.promotes_to?`Promotes to ${e.layer.promotes_to}`:null}function Gz(e,t){switch(e.kind){case"any_thread":return"Any thread in this checkout";case"task_writers":return"Anyone who can edit the entry's task";case"any_joiner":return"Anyone who may join";case"managers":return"Whoever may manage";case"admins":return"Workspace admins";case"none":return"Nobody";case"listed":{const n=e.users.map(t),a=e.teams.length;return a&&n.push(a===1?"1 team":`${a} teams`),n.length?n.join(", "):"Nobody"}}}function Vz(e,t){var o,c;const{policy:n,management:a}=e,r=(o=e.layer)==null?void 0:o.kind,l=d=>Gz(d,t),i=[["Mode",Uz[a.mode]],["Who can join",l(a.joiners)]];return r==="implement"&&i.push(["Managers",l(a.managers)],["Manager lease",$r(a.manager_lease_seconds)],["Batches",n.batch.enabled?`Up to ${n.batch.max_members} entries`:"Off"]),((c=e.layer)==null?void 0:c.kind)==="release"&&(e.layer.promotes_to&&i.push(["Promotes to",e.layer.promotes_to]),i.push(["Carries waiting entries",n.ride?"Yes: a done turn carries entries already contained in it":"No"],["Freeze",n.freeze.enabled?`Up to ${$r(n.freeze.max_seconds)}, ${$r(n.freeze.default_seconds)} by default`+(e.layer.freezers?` · ${l(e.layer.freezers)}`:""):"Off"],["Fix forward",n.fix_forward?"Yes: a failed turn keeps its turn until fixed":"No"],["Stalled turns",a.stall_takers.kind==="none"?"Nobody takes one":`${l(a.stall_takers)} may take one after ${$r(n.stall_seconds)}`])),i.push(["Reorder",l(a.reorderers)]),n.max_turns>1&&i.push(["Turns at once",`Up to ${n.max_turns} independent turns`]),i.push(["Turn lease",$r(n.lease_seconds)],["Time to start",`${$r(n.start_grace_seconds)} after the turn comes`]),n.entry_limit!==null&&i.push(["Waiting entries",`Up to ${n.entry_limit}`]),n.footprint!=="off"&&i.push(["Footprint",n.footprint==="required"?"Required":"Optional"]),i}const Vk="Where your organization's agents take turns at a shared branch, environment or proposal. One turn runs at a time in each queue.",Yk="A task you cannot see",Yz="A former member",Fz="A member";function Fk(){const e=un().queues;if(!e)throw new Error("The Queues page rendered without the queues seam.");return e}function Kz({org:e,open:t,path:n}){var h,m;const a=Fk(),{href:r,Link:l}=Ze(),i=a.availability,[o,c]=u.useState({state:"loading"}),d=u.useCallback(async x=>{i&&(x&&c({state:"loading"}),c(await i({fresh:x})))},[i]);u.useEffect(()=>{d(!1)},[d]);const f=!i||o.state==="active";return o.state==="off"&&((h=o.refusal)==null?void 0:h.reason)!=="engine_missing"?s.jsx(Ha,{title:"Page not found",description:"This page does not exist, or you do not have access to it.",backHref:r(`/org/${e}`),backLabel:"Back to the organization",link:l}):s.jsx("div",{className:"flex h-full min-h-0 flex-1 flex-col overflow-auto px-4 py-4 sm:px-6 lg:px-8",children:f?s.jsx(Qz,{org:e,open:t??null,path:n??`/org/${e}/tasks/queues`}):o.state==="off"&&((m=o.refusal)==null?void 0:m.reason)==="engine_missing"?s.jsx(Zs,{page:"Queues"}):s.jsxs(s.Fragment,{children:[s.jsx(Jt,{title:"Queues",description:a.description??Vk}),o.state==="loading"&&s.jsx(Kk,{}),(o.state==="error"||o.state==="off")&&s.jsx(xm,{refusal:o.refusal,on_retry:()=>void d(!0)}),o.state==="available"&&s.jsxs(me,{variant:"info",className:"mt-6",children:[s.jsx(ws,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:"Tasks are not on for this organization"}),s.jsxs(ge,{children:["Queues hold turns for tasks, so they show once Tasks are on."," ",s.jsx(l,{className:"text-primary hover:underline",href:r(`/org/${e}/tasks`),children:"Go to Tasks"})]})]})]})})}function Kk(){return s.jsx("div",{className:"mt-6 grid gap-2",role:"status","aria-label":"Loading queues",children:Array.from({length:3},(e,t)=>s.jsx(_t,{className:t===2?"h-10 w-2/3":"h-10 w-full"},t))})}function xm({refusal:e,on_retry:t}){const n=ls();return(e==null?void 0:e.reason)==="store_locked"?s.jsxs(me,{variant:"info",className:"mt-6",children:[s.jsx(ws,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:"The local stores are busy"}),s.jsxs(ge,{children:[s.jsx("p",{children:e.message}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]}):(e==null?void 0:e.reason)==="view_outdated"?s.jsxs(me,{variant:"warning",className:"mt-6",children:[s.jsx(Xt,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:Dl}),s.jsx(ge,{children:n})]}):s.jsxs(me,{variant:"destructive",className:"mt-6",children:[s.jsx(st,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:"Queues could not be loaded"}),s.jsxs(ge,{children:[s.jsx("p",{children:"The read did not answer. Try again in a moment."}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]})}const Pf=e=>e.status===404||e.reason==="not_found"||e.code==="not_found";function Xz(e,t,n,a){return t?e===null?`Not reading · trying again every ${n}s`:`Not reading since ${Xn(e)} · trying again every ${n}s`:e===null?"Connecting…":`Live · read ${Xn(e)} · refreshes every ${n}s${a?` · ${a}`:""}`}function Qz({org:e,open:t,path:n}){var D;const{listQueues:a,queue:r,members:l,refresh_ms:i,settings_note:o,description:c,read_scope:d,subject_label:f="Task",thread_subjects:h=!1}=Fk(),{self_id:m}=sd(),[x,b]=u.useState(null),[v,y]=u.useState(null),[g,p]=u.useState(null),[j,w]=u.useState(null),[N,C]=u.useState({state:"pending",members:[]});u.useEffect(()=>{let H=!0;return l().then(te=>{H&&C(se=>te.ok?{state:"answered",members:te.data}:{state:"failed",members:se.members})}),()=>{H=!1}},[l]);const _=u.useMemo(()=>new Map(N.members.map(H=>[H.user_id,H])),[N.members]),S=N.state==="answered"?Yz:Fz,$=u.useCallback((H,te)=>{var se;return(te==null?void 0:te.title)??(h?(te==null?void 0:te.id)??H:H===m?"You":((se=_.get(H))==null?void 0:se.label)??S)},[_,S,m,h]),O=u.useRef({list:{last:null,fresh:!1},detail:{last:null,fresh:!1}}),[G,V]=u.useState(null),[L,U]=u.useState(!1),A=u.useCallback((H,te)=>{O.current[H]={last:te,fresh:!0};const{list:se,detail:ye}=O.current;U(se.last==="failed"||ye.last==="failed"),se.fresh&&ye.fresh&&se.last==="ok"&&ye.last==="ok"&&V(Date.now()/1e3)},[]),R=t??((D=x==null?void 0:x.queues[0])==null?void 0:D.id)??null,E=u.useRef(R);u.useEffect(()=>{E.current=R},[R]);const k=u.useRef(0),M=u.useCallback(async()=>{var se;const H=k.current+=1;O.current.list.fresh=!1;const te=await a();if(H===k.current)if(te.ok){if(b(te.data),y(null),!t){const ye=((se=te.data.queues[0])==null?void 0:se.id)??null;ye===null?O.current.detail={last:"ok",fresh:!0}:ye!==E.current&&(O.current.detail.fresh=!1)}A("list","ok")}else y(te.refusal),A("list","failed")},[a,t,A]),K=u.useRef(0),T=u.useCallback(async()=>{const H=K.current+=1;if(!R)return;O.current.detail.fresh=!1;const te=await r(R);H===K.current&&(te.ok?(p(te.data),w(null),A("detail","ok")):(w(te.refusal),Pf(te.refusal)&&p(null),A("detail",Pf(te.refusal)?"ok":"failed")))},[R,r,A]);u.useEffect(()=>{M()},[M]),u.useEffect(()=>{p(null),w(null),T()},[T]);const B=u.useCallback(()=>{M(),T()},[M,T]),F=!x&&(v==null?void 0:v.reason)==="engine_missing",J=u.useCallback(()=>{F||B()},[F,B]);if(Eu(J,i),F)return s.jsx(Zs,{page:"Queues"});const he=Math.round(i/1e3),X=j!==null&&Pf(j);return s.jsxs(s.Fragment,{children:[s.jsxs(Jt,{title:"Queues",description:c??Vk,children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:Xz(G,L,he,d)}),s.jsx("span",{className:"sr-only",role:"status",children:L?"Not reading":G===null?"Connecting":"Live"})]}),!x&&!v&&s.jsx(Kk,{}),!x&&v&&s.jsx(xm,{refusal:v,on_retry:B}),x&&x.queues.length===0?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(z0,{className:"text-muted-foreground size-8","aria-hidden":"true"}),s.jsx("h2",{className:"text-lg font-semibold",children:"No queues yet"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Queues are created through the sdlc CLI, the MCP tools or the API. Once one exists, its turns and waiting work show here."})]}):x?s.jsxs(s.Fragment,{children:[s.jsx(Zz,{path:n,queues:x.queues,open_id:R,name:$,held:h}),X?s.jsxs(me,{variant:"info",className:"mt-6",children:[s.jsx(ws,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:"This queue is no longer available"}),s.jsx(ge,{children:"It was archived, or you can no longer read its Workspace. Pick another queue above."})]}):g&&g.queue.id===R?s.jsx(Jz,{org:e,detail:g,name:$,settings_note:o,subject_label:f,thread_subjects:h}):j?s.jsx(xm,{refusal:j,on_retry:()=>void T()}):s.jsx(_t,{className:"mt-6 h-40 w-full shrink-0",role:"status","aria-label":"Loading the queue"})]}):null]})}function gm({org:e,subject:t,link:n}){const{href:a,Link:r}=Ze();return!t||t.hidden?s.jsx("span",{className:"text-muted-foreground",children:Yk}):t.kind==="task"&&n?s.jsx(r,{className:"text-primary hover:underline",href:a(`/org/${e}/tasks/${t.id}`),children:t.title??t.id}):s.jsx("span",{children:t.title??t.id})}function Wz(e,t,n){const a=e.freeze?`frozen until ${Xn(e.freeze.lease_until)}`:null;if(e.batch)return{primary:`Batch of ${e.batch.size} · ${t(e.batch.holder,e.batch.holder_subject)}`,secondary:[`Opened ${Xn(e.batch.opened_at)}`,a].filter(Boolean).join(" · "),warn:!1};if(e.turn){const r=e.turn.subject,l=r.hidden?Yk:r.title??r.id,i=(e.running_count??1)>1?`${e.running_count} turns · `:"",o=e.turn.landing?" landing":"",c=n&&!!e.turn.hold,d=[c?Gk(e.name,e.turn.note):null,e.turn.fixing_since!==void 0?"Fixing forward":null,a].filter(Boolean);return c&&e.turn.fixing_since===void 0&&!a?{primary:`${i}${l}${o}`,secondary:qf(d.join(" · ")),warn:!1}:{primary:`${i}${l}${o}`,secondary:d.length?qf(d.join(" · ")):null,warn:d.length>0}}return{primary:"Nothing running",secondary:a?qf(a):null,warn:!!a}}const qf=e=>e.charAt(0).toUpperCase()+e.slice(1);function Zz({path:e,queues:t,open_id:n,name:a,held:r}){const{href:l,Link:i}=Ze();return s.jsx(ut,{className:"mt-4 shrink-0 overflow-x-auto",children:s.jsxs(Ye,{containerAriaLabel:"Queues",children:[s.jsx(We,{children:s.jsxs(ue,{children:[s.jsx(W,{children:"Queue"}),s.jsx(W,{className:"hidden md:table-cell",children:"Step"}),s.jsx(W,{children:"Running turn"}),s.jsx(W,{className:"hidden text-right md:table-cell",children:"Waiting"})]})}),s.jsx(Fe,{children:t.map(o=>{var m;const c=o.id===n,d=qz(o),f=Wz(o,a,r),h=o.waiting-(((m=o.batch)==null?void 0:m.remaining)??0);return s.jsxs(ue,{"data-testid":"queues-row",className:le(c&&"bg-accent"),children:[s.jsxs(Y,{children:[s.jsx(i,{className:"text-primary hover:underline",href:l(`${e}?queue=${encodeURIComponent(o.id)}`),"aria-current":c?"page":void 0,children:o.name}),d?s.jsx("div",{className:"text-muted-foreground text-xs",children:d}):null,s.jsxs("div",{className:"text-muted-foreground text-xs md:hidden",children:[h," waiting"]})]}),s.jsx(Y,{className:"hidden md:table-cell",children:s.jsx(ce,{variant:"neutral",children:qk[o.policy.step]})}),s.jsxs(Y,{children:[s.jsx("div",{className:le(!o.batch&&!o.turn&&"text-muted-foreground"),children:f.primary}),f.secondary?s.jsx("div",{className:le("text-xs",f.warn?"text-warning":"text-muted-foreground"),children:f.secondary}):null]}),s.jsx(Y,{className:"hidden text-right md:table-cell",children:h})]},o.id)})})]})})}function pc({id:e,title:t,side:n,children:a}){return s.jsxs("section",{"aria-labelledby":e,className:"flex flex-col gap-2",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h3",{id:e,className:"text-sm font-semibold",children:t}),n?s.jsx("span",{className:"text-muted-foreground text-xs",children:n}):null]}),a]})}function ty({org:e,entries:t,landing:n,queue_name:a,subject_label:r,held:l,label:i}){return s.jsx("div",{className:"overflow-x-auto rounded-lg border",children:s.jsxs(Ye,{containerAriaLabel:i,children:[s.jsx(We,{children:s.jsxs(ue,{children:[s.jsx(W,{children:r}),s.jsx(W,{children:"State"})]})}),s.jsx(Fe,{children:t.map(o=>{const c=Pz(o,n,a,l);return s.jsxs(ue,{"data-testid":"queues-running",children:[s.jsxs(Y,{children:[s.jsx(gm,{org:e,subject:o.subject,link:!l}),l&&o.hold&&o.note&&!o.subject.hidden?s.jsx("div",{className:"text-muted-foreground text-xs",children:o.note}):null]}),s.jsx(Y,{children:s.jsx(ce,{variant:c.tone,children:c.label})})]},o.ref)})})]})})}function Jz({org:e,detail:t,name:n,settings_note:a,subject_label:r,thread_subjects:l}){var w;const{queue:i,state:o}=t,c=N=>n(N),d=new Map(o.entries.map(N=>[N.ref,N.subject])),f=o.entries.filter(N=>N.turn==="running"),h=o.entries.filter(N=>N.turn!=="running"&&N.batching!=="in_batch"),m=o.batch,x=Math.max(1,f.filter(N=>N.batching!=="in_batch").length),b=m&&i.policy.independent_turns?f.filter(N=>N.batching!=="in_batch"&&N.ref!==m.holder):[],v=o.manager,y=o.freeze,g=((w=i.layer)==null?void 0:w.kind)==="release"?i.layer.stall_hold:void 0,p=g?{who:n(g.by),why:g.reason,until:g.until}:v!=null&&v.hold?{who:n(v.holder,v.holder_subject),why:v.hold.why,until:v.hold.until}:null,j=!m&&f.length===0&&h.length===0;return s.jsxs(ut,{as:"section","aria-labelledby":"queue-title",className:"mt-6 flex shrink-0 flex-col gap-4 p-4","data-testid":"queues-detail",children:[s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h2",{id:"queue-title",className:"text-lg font-semibold",children:i.name}),s.jsx(ce,{variant:"neutral",children:qk[i.policy.step]}),s.jsx(ce,{variant:"neutral",children:Lz[i.management.mode]})]}),i.purpose?s.jsx("p",{className:"text-muted-foreground text-sm",children:i.purpose}):null]}),v?s.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm","data-testid":"queues-manager",children:[s.jsx(TT,{className:"text-muted-foreground size-4","aria-hidden":"true"}),s.jsx("span",{className:"text-muted-foreground",children:"Manager"}),s.jsx("span",{className:"font-medium",children:n(v.holder,v.holder_subject)}),s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Lease until ",Xn(v.lease_until),v.serving_until!==void 0?" · serving now":""]})]}):null,y?s.jsxs(me,{variant:"warning",children:[s.jsx(_T,{className:"size-4","aria-hidden":"true"}),s.jsxs(je,{children:["Frozen until ",Xn(y.lease_until)]}),s.jsxs(ge,{children:[n(y.holder,y.holder_subject)," froze this queue at ",Xn(y.since),y.label?`: ${y.label}`:"",". Only ",n(y.holder,y.holder_subject),"'s entries start until it thaws."]})]}):null,p?s.jsxs(me,{variant:"info",children:[s.jsx(L0,{className:"size-4","aria-hidden":"true"}),s.jsxs(je,{children:["Stall hold until ",Xn(p.until)]}),s.jsxs(ge,{children:[p.who,p.why?`: ${p.why}`:"",". The first entry is not treated as stalled while it lasts."]})]}):null,j?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing running, and nothing waits in this queue."}):s.jsxs(s.Fragment,{children:[m?s.jsxs(pc,{id:"queue-running",title:"Running turn",side:`Batch opened by ${n(m.holder,m.holder_subject)} at ${Xn(m.opened_at)}`,children:[s.jsx("div",{className:"overflow-x-auto rounded-lg border",children:s.jsxs(Ye,{containerAriaLabel:"Batch members",children:[s.jsx(We,{children:s.jsxs(ue,{children:[s.jsx(W,{children:"Landing order"}),s.jsx(W,{children:r}),s.jsx(W,{children:"Outcome"})]})}),s.jsx(Fe,{children:m.members.map((N,C)=>{const _=Hz(N.outcome);return s.jsxs(ue,{"data-testid":"queues-member",children:[s.jsx(Y,{children:C+1}),s.jsx(Y,{children:s.jsx(gm,{org:e,subject:N.subject??d.get(N.ref)??(l?{kind:"thread",id:N.ref}:void 0),link:!l})}),s.jsx(Y,{children:s.jsx(ce,{variant:_.tone,children:_.label})})]},N.ref)})})]})}),b.length>0?s.jsxs(s.Fragment,{children:[s.jsx("h4",{className:"text-muted-foreground text-xs font-medium",children:"Also running"}),s.jsx(ty,{org:e,entries:b,landing:o.landing,queue_name:i.name,subject_label:r,held:l,label:"Turns running beside the batch"})]}):null]}):s.jsx(pc,{id:"queue-running",title:f.length>1?"Running turns":"Running turn",children:f.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing running."}):s.jsx(ty,{org:e,entries:f,landing:o.landing,queue_name:i.name,subject_label:r,held:l,label:"Running turns"})}),s.jsx(pc,{id:"queue-waiting",title:"Waiting",children:h.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing waits."}):s.jsx("div",{className:"overflow-x-auto rounded-lg border",children:s.jsxs(Ye,{containerAriaLabel:"Waiting entries",children:[s.jsx(We,{children:s.jsxs(ue,{children:[s.jsx(W,{children:"Position"}),s.jsx(W,{children:r}),s.jsx(W,{className:"hidden md:table-cell",children:"Joined"}),s.jsx(W,{children:"Turn"}),s.jsx(W,{className:"hidden md:table-cell",children:"Note"})]})}),s.jsx(Fe,{children:h.map((N,C)=>{const _=Iz(N);return s.jsxs(ue,{"data-testid":"queues-waiting",children:[s.jsx(Y,{children:m?x+C+1:N.position}),s.jsx(Y,{children:s.jsx(gm,{org:e,subject:N.subject,link:!l})}),s.jsx(Y,{className:"hidden md:table-cell",children:Xn(N.joined_at)}),s.jsx(Y,{children:s.jsx(ce,{variant:_.tone,children:_.label})}),s.jsx(Y,{className:"hidden md:table-cell",children:N.subject.hidden?"":N.note??""})]},N.ref)})})]})})})]}),s.jsx(pc,{id:"queue-settings",title:"Settings",children:s.jsx("div",{className:"overflow-x-auto rounded-lg border",children:s.jsx(Ye,{containerAriaLabel:"Queue settings",children:s.jsx(Fe,{children:Vz(i,c).map(([N,C])=>s.jsxs(ue,{children:[s.jsx(W,{scope:"row",className:"h-auto w-48 py-2 font-normal",children:N}),s.jsx(Y,{children:C})]},N))})})})}),s.jsx("p",{className:"text-muted-foreground text-xs",children:a})]})}const hs="__no_parent__";function Xk(e,t){const n=new Set([t]);for(let a=!0;a;){a=!1;for(const r of e)r.parent&&n.has(r.parent)&&!n.has(r.key)&&(n.add(r.key),a=!0)}return n}const so=(e,t)=>(e.label||e.key).localeCompare(t.label||t.key);function ln({id:e,label:t,help:n,error:a,children:r}){const l=[n?`${e}-help`:null,a?`${e}-error`:null].filter(Boolean).join(" ")||void 0;return s.jsxs("div",{className:"grid gap-2",children:[s.jsx(De,{htmlFor:e,children:t}),r(l),n?s.jsx("p",{id:`${e}-help`,className:"text-muted-foreground text-xs",children:n}):null,a?s.jsx("p",{id:`${e}-error`,className:"text-destructive text-sm",children:a}):null]})}function vm({label:e,children:t}){return s.jsxs("div",{className:"grid gap-1",children:[s.jsx("span",{className:"text-sm leading-none font-medium",children:e}),s.jsx("span",{className:"text-muted-foreground text-sm break-words",children:t})]})}function ny({id:e,label:t,help:n,checked:a,on_change:r}){return s.jsxs("div",{className:"grid gap-1",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(Ul,{id:e,className:"mt-0.5",checked:a,"aria-describedby":n?`${e}-help`:void 0,onCheckedChange:l=>r(l===!0)}),s.jsx(De,{htmlFor:e,className:"font-normal",children:t})]}),n?s.jsx("p",{id:`${e}-help`,className:"text-muted-foreground pl-6 text-xs",children:n}):null]})}function Qk({id:e,legend:t,help:n,error:a,options:r,checked:l,on_change:i,empty:o,notes:c,scroll:d}){const f=[c!=null&&c.length?`${e}-notes`:null,n?`${e}-help`:null,a?`${e}-error`:null].filter(Boolean).join(" ")||void 0;return s.jsxs("fieldset",{className:"m-0 grid min-w-0 gap-2 border-0 p-0","aria-describedby":f,"aria-invalid":a?!0:void 0,children:[s.jsx("legend",{className:"mb-2 text-sm leading-none font-medium",children:t}),c!=null&&c.length?s.jsxs("div",{id:`${e}-notes`,className:"text-warning flex items-start gap-2 text-xs",children:[s.jsx(Xt,{className:"mt-0.5 size-3.5 shrink-0","aria-hidden":"true"}),s.jsx("div",{className:"grid gap-0.5",children:c.map(h=>s.jsx("p",{children:h},h))})]}):null,r.length===0&&o?s.jsx("p",{className:"text-muted-foreground text-sm",children:o}):null,s.jsx("div",{className:d?"grid max-h-[200px] grid-cols-1 gap-2 overflow-y-auto rounded-md border p-3 sm:grid-cols-2":"grid grid-cols-1 gap-2 sm:grid-cols-2",tabIndex:d?0:void 0,role:d?"group":void 0,"aria-label":d?`${t} list`:void 0,children:r.map((h,m)=>s.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[s.jsx(Ul,{id:`${e}-${m}`,className:"mt-0.5",checked:l.has(h.value),onCheckedChange:x=>{const b=new Set(l);x===!0?b.add(h.value):b.delete(h.value),i(b)}}),s.jsx(De,{htmlFor:`${e}-${m}`,className:"min-w-0 font-normal break-words",children:h.label})]},h.value))}),n?s.jsx("p",{id:`${e}-help`,className:"text-muted-foreground text-xs",children:n}):null,a?s.jsx("p",{id:`${e}-error`,className:"text-destructive text-sm",children:a}):null]})}function ao({context:e,action:t,title:n="Two-factor sign-in needed",changing:a="Changing the org"}){const r=e.two_factor==="enroll";return s.jsxs(me,{variant:"destructive",role:"alert",children:[s.jsx(bT,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:n}),s.jsxs(ge,{children:[s.jsx("p",{children:r?`Turn on two-factor sign-in in Account Settings, then come back here and ${t}.`:`${a} needs a two-factor sign-in. Sign in again with your authenticator in Account Settings, then come back here and ${t}.`}),s.jsx(P,{asChild:!0,variant:"outline",size:"sm",className:"mt-2 h-auto min-h-8 py-1.5 whitespace-normal text-left",children:s.jsx("a",{href:e.settings_href,target:"_blank",rel:"noreferrer",children:"Open Account Settings in a new tab"})})]})]})}const qa=e=>e.two_factor==="ok";function ql({refusal:e,context:t,subject:n,action:a,changing:r,authority_title:l}){if((e==null?void 0:e.kind)==="two_factor")return s.jsx(ao,{context:t,action:a,changing:r,title:`Could not save ${n}`});const i=qa(t)?null:s.jsx(ao,{context:t,action:a,changing:r});if(!e)return i;const o=e.kind==="changed"?"The org changed since you opened this":e.kind==="authority"?l??`Could not save ${n}`:null;return s.jsxs(s.Fragment,{children:[i,s.jsxs(me,{variant:"destructive",role:"alert",children:[s.jsx(st,{className:"size-4","aria-hidden":"true"}),o?s.jsx(je,{children:o}):null,s.jsx(ge,{children:e.message})]})]})}function Wk({id:e,value:t,on_change:n,none:a,options:r,described_by:l}){return s.jsxs(gt,{value:t,onValueChange:n,children:[s.jsx(ft,{id:e,"aria-describedby":l,children:s.jsx(vt,{placeholder:"Choose a team"})}),s.jsxs(ht,{children:[a?s.jsx(Ee,{value:hs,children:a}):null,r.map(i=>s.jsx(Ee,{value:i.key,children:i.label||i.key},i.key))]})]})}function Gl(e){const[t,n]=u.useState(!1),[a,r]=u.useState(null);return{saving:t,refusal:a,set_refusal:r,run:async i=>{n(!0),r(null);try{const o=await i();o?r(o):e()}finally{n(!1)}}}}function Vl({saving:e,blocked:t,described_by:n,children:a}){return s.jsx(P,{type:"submit",disabled:e,"aria-disabled":t||void 0,"aria-describedby":t?n:void 0,children:a})}const Zk=(e,t)=>t==="hosted"?`Lowercase letters, digits, _ and -, starting with a letter. It names the ${e} in posts, and cannot change later.`:`Lowercase letters, digits, _ and -, starting with a letter. It names the ${e} in posts and in sdlc org, and cannot change later.`;function e3({open:e,chart:t,team:n,save:a,on_close:r,context:l=Yl,scope:i="full",parents:o}){var k;const c=l.host==="hosted",[d,f]=u.useState(""),[h,m]=u.useState(""),[x,b]=u.useState(""),[v,y]=u.useState(hs),[g,p]=u.useState({}),{saving:j,refusal:w,set_refusal:N,run:C}=Gl(r),_=((k=t.teams.find(M=>M.parent===null))==null?void 0:k.key)??null;u.useEffect(()=>{e&&(f(""),m((n==null?void 0:n.label)??""),b((n==null?void 0:n.description)??""),y((n==null?void 0:n.parent)??(c&&_&&(!o||o.includes(_))?_:hs)),p({}),N(null))},[e,n,N,c,_,o]);const S=M=>{const K=t.teams.find(T=>T.key===M);return K?K.label||K.key:M??""},$=n?Xk(t.teams,n.key):new Set,O=[...t.teams].filter(M=>!$.has(M.key)&&(!o||o.includes(M.key))).sort((M,K)=>M.key===_?-1:K.key===_?1:so(M,K)),G=n?n.label||n.key:"",V=i==="description",L=!qa(l),U=n?V?"save the description":"save the team":"add the team",A=M=>{if(M.preventDefault(),L)return;if(!n){const B=c?h.trim():d.trim();if(!B){p(c?{label:"Give the team a name."}:{key:"Give the team a key."});return}if(c&&v===hs){p({parent:"Choose the parent team."});return}const F=c?B:h.trim()||B;C(()=>a({action:"add",kind:"team",key:B,...h.trim()?{label:h.trim()}:{},...x.trim()?{description:x.trim()}:{},...v!==hs?{parent:v}:{}},`Team ${F} added.`));return}if(!V&&!h.trim()){p({label:c?"Give the team a name.":"Give the team a label."});return}const K=v===hs?null:v,T={...!V&&h.trim()!==n.label.trim()?{label:h.trim()}:{},...x.trim()!==(n.description??"").trim()?{description:x.trim()}:{},...!c&&K!==n.parent?{parent:K}:{}};if(Object.keys(T).length===0){r();return}C(()=>a({action:"edit",kind:"team",key:n.key,...T},V?`Saved the description of ${G}.`:`Team ${h.trim()} saved.`))},R=n?V?`Edit the description of ${G}`:`Edit team ${G}`:"Add team";let E;return V?E="Say what the team works on. Only the description is yours to change here.":c?E=n?"Rename the team or say what it works on.":"Add a team to the organization.":n?E=s.jsxs(s.Fragment,{children:["Its key, ",s.jsx("span",{className:"font-mono",children:n.key}),", names it in posts and in sdlc org and does not change."]}):E="Add a team to this repository's local org.",s.jsx(dn,{open:e,onOpenChange:M=>M||j?null:r(),children:s.jsx(fn,{children:s.jsxs("form",{onSubmit:A,noValidate:!0,children:[s.jsxs(hn,{children:[s.jsx(pn,{children:R}),s.jsx(xn,{children:E})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[s.jsx(ql,{refusal:w,context:l,subject:V?"the description":"the team",action:U}),!n&&!c?s.jsx(ln,{id:"org-team-key",label:"Key",help:Zk("team",l.host),error:g.key,children:M=>s.jsx(Nt,{id:"org-team-key",className:"font-mono",value:d,autoComplete:"off","aria-invalid":g.key?!0:void 0,"aria-describedby":M,onChange:K=>{f(K.target.value),p({})}})}):null,V&&n?s.jsx(vm,{label:"Name",children:n.parent?`${G} · under ${S(n.parent)}`:G}):s.jsx(ln,{id:"org-team-label",label:c?"Name":n?"Label":"Label (optional)",help:c?n?void 0:"Its key is made from the name.":n?void 0:"Shown on the chart; the key when left empty.",error:g.label,children:M=>s.jsx(Nt,{id:"org-team-label",value:h,"aria-invalid":g.label?!0:void 0,"aria-describedby":M,onChange:K=>{m(K.target.value),p({})}})}),s.jsx(ln,{id:"org-team-description",label:V?"Description":"Description (optional)",children:()=>s.jsx(An,{id:"org-team-description",rows:3,placeholder:"What the team does",value:x,onChange:M=>b(M.target.value)})}),V?null:c&&n?s.jsx(vm,{label:"Parent team",children:n.parent?S(n.parent):"None: the organization itself"}):s.jsx(ln,{id:"org-team-parent",label:"Parent team",help:"Where the team sits; its posts report up through the team above.",error:g.parent,children:M=>s.jsx(Wk,{id:"org-team-parent",value:v,on_change:K=>{y(K),p({})},none:c?void 0:"No parent (a root team)",options:O,described_by:M})})]}),s.jsxs(mn,{className:"mt-6",children:[s.jsx(P,{type:"button",variant:"outline",disabled:j,onClick:r,children:"Cancel"}),s.jsx(Vl,{saving:j,blocked:L,children:n?j?"Saving…":"Save":j?"Adding…":"Add team"})]})]})})})}const t3=(e,t)=>e.length===t.size&&e.every(n=>t.has(n));function n3({open:e,chart:t,job:n,save:a,on_close:r,context:l=Yl}){const[i,o]=u.useState(""),[c,d]=u.useState(""),[f,h]=u.useState(""),[m,x]=u.useState(hs),[b,v]=u.useState(new Set),[y,g]=u.useState(!1),[p,j]=u.useState(!0),[w,N]=u.useState({}),{saving:C,refusal:_,set_refusal:S,run:$}=Gl(r);u.useEffect(()=>{e&&(o(""),d((n==null?void 0:n.label)??""),h((n==null?void 0:n.description)??""),x((n==null?void 0:n.parent)??hs),v(new Set((n==null?void 0:n.fills)??[])),g((n==null?void 0:n.requires_person)??!1),j((n==null?void 0:n.escalable)??!0),N({}),S(null))},[e,n,S]);const O=n?Xk(t.job_functions,n.key):new Set,G=[...t.job_functions].filter(R=>!O.has(R.key)).sort(so),V=[...t.slots].sort(so).map(R=>({value:R.key,label:R.label||R.key})),L=!qa(l),U=n?"save the job function":"add the job function",A=R=>{if(R.preventDefault(),L)return;if(!n){if(!i.trim()){N({key:"Give the job function a key."});return}$(()=>a({action:"add",kind:"job_function",key:i.trim(),...c.trim()?{label:c.trim()}:{},...f.trim()?{description:f.trim()}:{},...m!==hs?{parent:m}:{},fills:[...b],requires_person:y,escalable:p},`Job function ${c.trim()||i.trim()} added.`));return}if(!c.trim()){N({label:"Give the job function a label."});return}const E=m===hs?null:m,k={...c.trim()!==n.label.trim()?{label:c.trim()}:{},...f.trim()!==(n.description??"").trim()?{description:f.trim()}:{},...E!==n.parent?{parent:E}:{},...t3(n.fills,b)?{}:{fills:[...b]},...y!==n.requires_person?{requires_person:y}:{},...p!==n.escalable?{escalable:p}:{}};if(Object.keys(k).length===0){r();return}$(()=>a({action:"edit",kind:"job_function",key:n.key,...k},`Job function ${c.trim()} saved.`))};return s.jsx(dn,{open:e,onOpenChange:R=>R||C?null:r(),children:s.jsx(fn,{children:s.jsxs("form",{onSubmit:A,noValidate:!0,children:[s.jsxs(hn,{children:[s.jsx(pn,{children:n?`Edit job function ${n.label||n.key}`:"Add job function"}),s.jsxs(xn,{children:["Its job description: what it does, the slots it fills and who may hold its posts.",n?s.jsxs(s.Fragment,{children:[" ","Its key, ",s.jsx("span",{className:"font-mono",children:n.key}),", does not change."]}):null]})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[s.jsx(ql,{refusal:_,context:l,subject:"the job function",action:U}),n?null:s.jsx(ln,{id:"org-function-key",label:"Key",help:Zk("job function",l.host),error:w.key,children:R=>s.jsx(Nt,{id:"org-function-key",className:"font-mono",value:i,autoComplete:"off","aria-invalid":w.key?!0:void 0,"aria-describedby":R,onChange:E=>{o(E.target.value),N({})}})}),s.jsx(ln,{id:"org-function-label",label:n?"Label":"Label (optional)",error:w.label,children:R=>s.jsx(Nt,{id:"org-function-label",value:c,"aria-invalid":w.label?!0:void 0,"aria-describedby":R,onChange:E=>{d(E.target.value),N({})}})}),s.jsx(ln,{id:"org-function-description",label:"Job description (optional)",children:()=>s.jsx(An,{id:"org-function-description",rows:3,placeholder:"What this job function does",value:f,onChange:R=>h(R.target.value)})}),s.jsx(ln,{id:"org-function-parent",label:"Parent function",help:"Its posts report to the post of the parent function.",children:R=>s.jsx(Wk,{id:"org-function-parent",value:m,on_change:x,none:"No parent (a root function)",options:G,described_by:R})}),s.jsx(Qk,{id:"org-function-fills",legend:"Slots it fills",options:V,checked:b,on_change:v,empty:l.host==="hosted"?"This organization has no slots yet.":"This org has no slots yet; add them with sdlc org add slot."}),s.jsx(ny,{id:"org-function-requires-person",label:"Requires a person",help:"Only a person may hold its posts.",checked:y,on_change:g}),s.jsx(ny,{id:"org-function-escalable",label:"Escalable",help:"When no holder can decide, the decision goes up the reporting line. Off, it waits for a holder of this function.",checked:p,on_change:j})]}),s.jsxs(mn,{className:"mt-6",children:[s.jsx(P,{type:"button",variant:"outline",disabled:C,onClick:r,children:"Cancel"}),s.jsx(Vl,{saving:C,blocked:L,children:n?C?"Saving…":"Save":C?"Adding…":"Add job function"})]})]})})})}const s3=/^[a-z][a-z0-9_-]{0,63}$/;function a3(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[^a-z]+/,"").slice(0,64).replace(/-+$/,"")}function r3({open:e,chart:t,slot:n,save:a,on_close:r,context:l=Yl}){const[i,o]=u.useState(""),[c,d]=u.useState(""),[f,h]=u.useState(!1),[m,x]=u.useState(""),[b,v]=u.useState({}),{saving:y,refusal:g,set_refusal:p,run:j}=Gl(r);u.useEffect(()=>{e&&(o((n==null?void 0:n.label)??""),d((n==null?void 0:n.key)??""),h(!1),x((n==null?void 0:n.description)??""),v({}),p(null))},[e,n,p]);const w=!qa(l),N=n?"save the slot":"add the slot",C=_=>{if(_.preventDefault(),w)return;const S=i.trim();if(n){if(!S){v({label:"Give the slot a label."});return}const O={...S!==(n.label??"").trim()?{label:S}:{},...m.trim()!==(n.description??"").trim()?{description:m.trim()}:{}};if(Object.keys(O).length===0){r();return}j(()=>a({action:"edit",kind:"slot",key:n.key,...O},`Saved slot ${S}.`));return}const $={...S?{}:{label:"Give the slot a label."},...s3.test(c)?t.slots.some(O=>O.key===c)?{key:`Slot ${c} already exists.`}:{}:{key:"Use lowercase letters, digits, _ and -, starting with a letter, at most 64 characters."}};v($),!($.label||$.key)&&j(()=>a({action:"add",kind:"slot",key:c,label:S,...m.trim()?{description:m.trim()}:{}},`Added slot ${S}.`))};return s.jsx(dn,{open:e,onOpenChange:_=>_||y?null:r(),children:s.jsx(fn,{children:s.jsxs("form",{onSubmit:C,noValidate:!0,children:[s.jsxs(hn,{children:[s.jsx(pn,{children:n?`Edit ${n.label||n.key}`:"Add slot"}),s.jsx(xn,{children:"A slot is a workflow role a project fills from its team's posts. Job functions name the slots they fill."})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[s.jsx(ql,{refusal:g,context:l,subject:"the slot",action:N}),s.jsx(ln,{id:"org-slot-label",label:"Label",help:"How the slot is named on the chart and in project settings.",error:b.label,children:_=>s.jsx(Nt,{id:"org-slot-label",value:i,"aria-invalid":b.label?!0:void 0,"aria-describedby":_,onChange:S=>{o(S.target.value),!n&&!f&&d(a3(S.target.value)),v({})}})}),n?s.jsx(vm,{label:"Key",children:s.jsx("span",{className:"font-mono",children:n.key})}):s.jsx(ln,{id:"org-slot-key",label:"Key",help:"Lowercase letters, digits, _ and -, starting with a letter, at most 64 characters. It can't be changed after you save.",error:b.key,children:_=>s.jsx(Nt,{id:"org-slot-key",className:"font-mono",value:c,autoComplete:"off","aria-invalid":b.key?!0:void 0,"aria-describedby":_,onChange:S=>{d(S.target.value),h(!0),v({})}})}),s.jsx(ln,{id:"org-slot-description",label:"Description (optional)",children:()=>s.jsx(An,{id:"org-slot-description",rows:3,placeholder:"What this role does",value:m,onChange:_=>x(_.target.value)})})]}),s.jsxs(mn,{className:"mt-6",children:[s.jsx(P,{type:"button",variant:"outline",disabled:y,onClick:r,children:"Cancel"}),s.jsx(Vl,{saving:y,blocked:w,children:n?y?"Saving…":"Save":y?"Adding…":"Add slot"})]})]})})})}function l3({open:e,chart:t,binding:n,names:a,save:r,confirm:l,on_close:i,context:o=Yl,hosted:c}){var L;const[d,f]=u.useState(new Set),[h,m]=u.useState(""),[x,b]=u.useState({}),{saving:v,refusal:y,set_refusal:g,run:p}=Gl(i),j=(n==null?void 0:n.slot)??null;if(u.useEffect(()=>{!e||!n||(f(new Set(c&&n.source!=="override"?[]:n.posts.map(U=>U.post))),m(n.source==="override"?n.reason??"":""),b({}),g(null))},[e,j,g]),!n)return null;const w=a.slot(n.slot),N=(L=t.project)!=null&&L.team?t.teams.find(U=>{var A;return U.key===((A=t.project)==null?void 0:A.team)}):void 0,C=N?N.label||N.key:"the owning team",_=new Set(t.job_functions.filter(U=>U.fills.includes(n.slot)).map(U=>U.key)),S=[...t.posts].map(U=>U.post).sort(a.byPost).map(U=>{const A=_.has(U.split("/")[1]??"")?`${a.post(U)} (fills ${w})`:a.post(U),R=c==null?void 0:c.holders(U);return{value:U,label:c?R?`${A}: ${R}`:`${A} (no holder)`:A}}),$=c?[...d].sort(a.byPost).flatMap(U=>[..._.has(U.split("/")[1]??"")?[]:[`${a.post(U)} is not in the job description of ${w}.`],...c.chain.has(U.split("/")[0]??"")?[]:[`${a.post(U)} is outside ${c.owner} and the teams above it.`]]):[],O=!qa(o),G=U=>{U.preventDefault();const A={...d.size===0?{posts:"Choose at least one post."}:{},...h.trim()?{}:{reason:"Give the reason for the override."}};b(A),!(A.posts||A.reason||O)&&p(()=>r({action:"bind",slot:n.slot,posts:[...d],reason:h.trim()},`Override of ${w} saved.`))},V=async()=>{await l({title:`Clear the override of ${w}?`,description:c?`${w} goes back to its team's posts: ${c.baseline}. The override and its reason stay in the audit trail.`:"It goes back to the posts its job descriptions name, and its reason is not kept.",action_label:c?"Clear override":"Clear",destructive:!0})&&p(()=>r({action:"unbind",slot:n.slot},`Override of ${w} cleared.`))};return s.jsx(dn,{open:e,onOpenChange:U=>U||v?null:i(),children:s.jsx(fn,{children:s.jsxs("form",{onSubmit:G,noValidate:!0,children:[s.jsxs(hn,{children:[s.jsxs(pn,{children:["Override ",w]}),s.jsxs(xn,{children:["Bind ",w," in this project to the posts you choose instead of its"," ",c?"team’s":"job descriptions’"," posts. The override is reported with its reason, who set it and when."]})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[y||O?s.jsx("div",{id:"org-override-refusal",className:"grid gap-4",children:s.jsx(ql,{refusal:y,context:o,subject:"the override",action:c?"save":"save the override",changing:c?"Changing this project’s slots":void 0,authority_title:c?"Your changes were not saved":void 0})}):null,s.jsx(Qk,{id:"org-override-posts",legend:"Posts",help:c?`(fills ${w}) marks the posts whose job function fills ${w}.`:"A post outside its job description is marked on the chart.",notes:$,scroll:!!c,error:x.posts,options:S,checked:d,on_change:U=>{f(U),b(A=>({...A,posts:void 0}))}}),s.jsx(ln,{id:"org-override-reason",label:"Reason",error:x.reason,children:U=>s.jsx(An,{id:"org-override-reason",rows:2,placeholder:"Why this slot needs other posts",value:h,"aria-invalid":x.reason?!0:void 0,"aria-describedby":U,onChange:A=>{m(A.target.value),b(R=>({...R,reason:void 0}))}})}),c?null:s.jsxs("p",{className:"text-muted-foreground text-xs",children:["Made as ",s.jsx("span",{className:"font-mono",children:"person:user"}),", who must hold the lead post of ",C," or of a team above it."]})]}),s.jsxs(mn,{className:"mt-6",children:[n.source==="override"?s.jsx(P,{type:"button",variant:"ghost",className:"sm:mr-auto",disabled:v,onClick:()=>void V(),children:"Clear override"}):null,s.jsx(P,{type:"button",variant:"outline",disabled:v,onClick:i,children:"Cancel"}),s.jsx(Vl,{saving:v,blocked:O,described_by:"org-override-refusal",children:v?"Saving…":"Save override"})]})]})})})}function i3(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} or ${e[e.length-1]}`}function o3({open:e,chart:t,names:n,save:a,on_close:r,context:l}){var U;const i=t.authority,o=u.useMemo(()=>i?new Set(i.post_pairs):null,[i]),c=A=>!o||o.has(A),d=((U=t.teams.find(A=>A.parent===null))==null?void 0:U.key)??null,f=[...t.teams].filter(A=>!o||[...o].some(R=>R.startsWith(`${A.key}/`))).sort((A,R)=>A.key===d?-1:R.key===d?1:so(A,R)),[h,m]=u.useState(""),[x,b]=u.useState(""),[v,y]=u.useState({}),{saving:g,refusal:p,set_refusal:j,run:w}=Gl(r);u.useEffect(()=>{var A;e&&(m(((A=f[0])==null?void 0:A.key)??""),b(""),y({}),j(null))},[e,j]);const N=new Set(t.posts.filter(A=>A.post.startsWith(`${h}/`)).map(A=>A.post.split("/")[1])),C=[],_=A=>{for(const R of[...t.job_functions].filter(E=>E.parent===A).sort(so))C.push(R),_(R.key)};_(null);const S=C.filter(A=>c(`${h}/${A.key}`)&&!N.has(A.key)),$=h!==""&&S.length===0,O=!qa(l)||$,G=A=>{if(A.preventDefault(),O)return;const R={...h?{}:{team:"Choose a team."},...x?{}:{job:"Choose a job function."}};y(R),!(R.team||R.job)&&w(()=>a({action:"add",kind:"post",key:`${h}/${x}`},`Added post ${n.job(x)} · ${n.team(h)}.`))},V=$?"Every job function already has a post in this team.":"A team has one post per job function; functions already staffed in this team are left out.",L=(i==null?void 0:i.ask)??[];return s.jsx(dn,{open:e,onOpenChange:A=>A||g?null:r(),children:s.jsx(fn,{children:s.jsxs("form",{onSubmit:G,noValidate:!0,children:[s.jsxs(hn,{children:[s.jsx(pn,{children:"Add post"}),s.jsx(xn,{children:"A post is a job function staffed in a team. People in this post report to the post above it."})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[s.jsx(ql,{refusal:p,context:l,subject:"the post",action:"add the post"}),s.jsx(ln,{id:"org-post-team",label:"Team",help:"The team the post is in.",error:v.team,children:A=>s.jsxs(gt,{value:h,onValueChange:R=>{m(R),b(""),y({})},children:[s.jsx(ft,{id:"org-post-team","aria-describedby":A,"aria-invalid":v.team?!0:void 0,children:s.jsx(vt,{placeholder:"Choose a team"})}),s.jsx(ht,{children:f.map(R=>s.jsx(Ee,{value:R.key,children:R.label||R.key},R.key))})]})}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(ln,{id:"org-post-function",label:"Job function",help:V,error:v.job,children:A=>s.jsxs(gt,{value:x,disabled:$,onValueChange:R=>{b(R),y({})},children:[s.jsx(ft,{id:"org-post-function","aria-describedby":A,"aria-invalid":v.job?!0:void 0,children:s.jsx(vt,{placeholder:$?"Every job function has a post here":"Choose a job function"})}),s.jsx(ht,{children:S.map(R=>s.jsx(Ee,{value:R.key,children:R.label||R.key},R.key))})]})}),i&&!i.administer?s.jsxs("p",{className:"text-muted-foreground text-xs",children:["Only the job functions directly below a post you hold are listed.",L.length?` For others, ask ${i3(L)}.`:""]}):null]})]}),s.jsxs(mn,{className:"mt-6",children:[s.jsx(P,{type:"button",variant:"outline",disabled:g,onClick:r,children:"Cancel"}),s.jsx(Vl,{saving:g,blocked:O,described_by:$?"org-post-function-help":void 0,children:g?"Adding…":"Add post"})]})]})})})}function c3({open:e,chart:t,post:n,names:a,members:r,save:l,on_close:i,context:o}){const[c,d]=u.useState({state:"loading"}),[f,h]=u.useState(""),[m,x]=u.useState(null),[b,v]=u.useState(-1),{saving:y,refusal:g,set_refusal:p,run:j}=Gl(i),w=u.useRef(0),N=u.useCallback(async()=>{const T=w.current+=1;d({state:"loading"});const B=await r();T===w.current&&d(B.ok?{state:"read",members:B.data}:{state:"failed"})},[r]);u.useEffect(()=>{e&&(h(""),x(null),v(-1),p(null),N())},[e,N,p]);const C=t.posts.find(T=>T.post===n);if(!n||!C)return null;const _=a.post(n),S=new Set(C.holders.map(T=>T.id)),O=t.posts.some(T=>T.reports_to===n)&&C.holders.length>0?C.holders[0]:null,G=f.trim().toLowerCase(),V=c.state==="read"?c.members.filter(T=>!S.has(T.id)).filter(T=>!G||[T.label,T.detail,T.email].some(B=>B==null?void 0:B.toLowerCase().includes(G))):[],L=c.state==="read"&&c.members.every(T=>S.has(T.id)),U=c.state==="read"&&!L&&V.length>0,A=U&&b>=0&&b<V.length?V[b]:null,R=T=>`org-holder-option-${T.id}`,E=!qa(o)||!m||O!==null,k=T=>{if(!U)return;const B=V.length-1,F=J=>{var he,X;T.preventDefault(),v(J),(X=(he=document.getElementById(R(V[J])))==null?void 0:he.scrollIntoView)==null||X.call(he,{block:"nearest"})};T.key==="ArrowDown"?F(Math.min(A?b+1:0,B)):T.key==="ArrowUp"?F(A?Math.max(b-1,0):B):T.key==="Home"&&A?F(0):T.key==="End"&&A?F(B):T.key==="Enter"&&A&&(m==null?void 0:m.id)!==A.id&&(T.preventDefault(),x(A))},M=O?void 0:m?"Only members of the organization can hold its posts. Members who already hold it are left out.":"Choose a member to add.",K=T=>{T.preventDefault(),!(E||!m)&&j(()=>l({action:"hold",post:n,member:m.id},`Added ${m.label} to ${_}.`))};return s.jsx(dn,{open:e,onOpenChange:T=>T||y?null:i(),children:s.jsx(fn,{children:s.jsxs("form",{onSubmit:K,noValidate:!0,children:[s.jsxs(hn,{children:[s.jsxs(pn,{children:["Add holder to ",_]}),s.jsx(xn,{children:"The member holds this post and reports as it does."})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[s.jsx(ql,{refusal:g,context:o,subject:"the holder",action:"add the holder"}),O?s.jsxs(me,{variant:"info",id:"org-holder-one",children:[s.jsx(st,{className:"size-4","aria-hidden":"true"}),s.jsxs(ge,{children:["This post takes one holder. Remove ",a.member(O)," first, then add the new holder."]})]}):null,s.jsxs("div",{className:"grid gap-2",children:[s.jsx(De,{htmlFor:"org-holder-member",children:"Member"}),s.jsx(Nt,{id:"org-holder-member",role:"combobox","aria-expanded":U,"aria-controls":U?"org-holder-members":void 0,"aria-activedescendant":A?R(A):void 0,"aria-autocomplete":"list","aria-describedby":M?"org-holder-member-help":void 0,placeholder:"Search members by name, username or email",autoComplete:"off",value:f,disabled:O!==null,onChange:T=>{h(T.target.value),v(-1)},onKeyDown:k}),s.jsx("div",{className:"max-h-56 overflow-y-auto rounded-md border",children:c.state==="loading"?s.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 px-3 py-2 text-sm",role:"status",children:[s.jsx(Qt,{className:"size-4","aria-hidden":"true"}),"Loading members…"]}):c.state==="failed"?s.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-3 py-2",children:[s.jsx("p",{className:"text-destructive text-sm",children:"Could not read the members."}),s.jsx(P,{type:"button",variant:"outline",size:"sm",onClick:()=>void N(),children:"Retry"})]}):L?s.jsx("p",{className:"text-muted-foreground px-3 py-2 text-sm",children:"Every member already holds this post."}):V.length===0?s.jsxs("p",{className:"text-muted-foreground px-3 py-2 text-sm",children:["No member matches “",f.trim(),"”."]}):s.jsx("ul",{id:"org-holder-members",role:"listbox","aria-label":"Members",className:"m-0 list-none p-1",children:V.map((T,B)=>{const F=(m==null?void 0:m.id)===T.id,J=(A==null?void 0:A.id)===T.id;return s.jsxs("li",{id:R(T),role:"option","aria-selected":F,className:`cursor-pointer rounded-sm px-2 py-1.5 ${F?"bg-accent text-accent-foreground":J?"bg-muted":"hover:bg-muted"} ${J?"ring-ring ring-2 ring-inset":""}`,onClick:()=>{O||(v(B),x(T))},children:[s.jsxs("div",{className:"text-sm font-medium break-words",children:[T.label,T.detail&&V.filter(he=>he.label===T.label).length>1?` (${T.detail})`:""]}),T.email?s.jsx("div",{className:"text-muted-foreground text-xs break-all",children:T.email}):null]},T.id)})})}),M?s.jsx("p",{id:"org-holder-member-help",className:"text-muted-foreground text-xs",children:M}):null]})]}),s.jsxs(mn,{className:"mt-6",children:[s.jsx(P,{type:"button",variant:"outline",disabled:y,onClick:i,children:"Cancel"}),s.jsx(Vl,{saving:y,blocked:E,described_by:O?"org-holder-one":M?"org-holder-member-help":void 0,children:y?"Adding…":"Add holder"})]})]})})})}function Jk(e){const[t,n]=u.useState(null),a=u.useRef(t);u.useEffect(()=>{a.current=t},[t]);const r=u.useCallback(c=>{var d;(d=a.current)==null||d.resolve(c),n(null)},[]),l=u.useCallback(c=>new Promise(d=>{var f;(f=a.current)==null||f.resolve(!1),n({...c,resolve:d})}),[]);u.useEffect(()=>()=>{var c;return(c=a.current)==null?void 0:c.resolve(!1)},[]);const i=!qa(e),o=s.jsx(Dp,{open:t!==null,onOpenChange:c=>c?null:r(!1),children:s.jsxs(zp,{children:[s.jsxs(Lp,{children:[s.jsx(Bp,{children:t==null?void 0:t.title}),s.jsx(Hp,{className:"whitespace-pre-line",children:t==null?void 0:t.description})]}),t&&i?s.jsx(ao,{context:e,action:t.action}):null,s.jsxs(Up,{children:[s.jsx(Ip,{children:"Cancel"}),s.jsx($w,{variant:t!=null&&t.destructive?"destructive":"default","aria-disabled":i||void 0,onClick:c=>{if(i){c.preventDefault();return}r(!0)},children:t==null?void 0:t.action_label})]})]})});return{confirm:l,confirm_dialog:o}}function ol({label:e,on_edit:t,on_remove:n,items:a}){const r=a??[...t?[{label:"Edit",on_select:t}]:[],...n?[{label:"Remove",on_select:n,destructive:!0}]:[]];return s.jsxs(kd,{children:[s.jsx(Sd,{asChild:!0,children:s.jsx(P,{type:"button",variant:"ghost",size:"control-icon",className:"-my-1 shrink-0","aria-label":`More actions for ${e}`,children:s.jsx(kp,{className:"size-3.5","aria-hidden":"true"})})}),s.jsx(Do,{align:"end",children:r.map(l=>s.jsx(Nl,{className:l.destructive?"text-destructive focus:text-destructive":void 0,onSelect:l.on_select,children:l.label},l.label))})]})}function u3({label:e,message:t,bound:n,on_dismiss:a}){return s.jsxs(me,{variant:"destructive",role:"alert",className:"mb-3",children:[s.jsx(st,{className:"size-4","aria-hidden":"true"}),s.jsxs(je,{children:[e," was not removed"]}),s.jsxs(ge,{children:[s.jsx("p",{children:t}),n!=null&&n.projects.length?s.jsx("ul",{role:"list",className:"bg-card text-foreground m-0 mt-2 grid list-none gap-3 rounded-md border p-3",children:n.projects.map(r=>s.jsxs("li",{className:"grid gap-0.5",children:[s.jsxs("a",{className:"text-primary text-sm underline underline-offset-2",href:r.href,children:["Settings of ",r.name]}),s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Override set by ",r.set_by??"a former member"]})]},r.href))}):null,n&&n.more>0?s.jsxs("p",{className:"mt-2",children:["And ",n.more," more ",n.more===1?"project":"projects",". Clear these and try again to see the rest. An org owner can open any project you cannot."]}):null,s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:a,children:"Dismiss"})]})]})}const Yl={host:"local",two_factor:"ok",settings_href:""},Au={open:{label:"Open",tone:"info"},accepted:{label:"Accepted",tone:"success"},rejected:{label:"Rejected",tone:"error"},withdrawn:{label:"Withdrawn",tone:"neutral"}},d3={added:{label:"Added",tone:"success"},changed:{label:"Changed",tone:"warning"},removed:{label:"Removed",tone:"error"}},f3={team:["team","teams"],job_function:["job function","job functions"],slot:["slot","slots"],post:["post","posts"],fill:["fill","fills"]},h3=["team","job_function","slot","post","fill"];function Nx(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function e1(e){const t=a=>Nx(h3.filter(r=>e[r][a]>0).map(r=>{const l=e[r][a];return`${l} ${f3[r][l===1?0:1]}`}));return[["Adds","adds",t("added")],["Changes","changes",t("changed")],["Removes","removes",t("removed")]].filter(([,,a])=>a).map(([a,r,l],i)=>`${i===0?a:r} ${l}`).join("; ")||"No changes"}function Mu(e){return new Date(e).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}function m3(e){const t=`Proposed by ${e.requested_by} on ${Mu(e.requested_at)}`;return e.status==="open"||!e.decided_at?t:`${t} · ${Au[e.status].label} by ${e.decided_by??"a former member"} on ${Mu(e.decided_at)}`}function p3(e,t){const[n,a]=u.useState(e?{state:"loading"}:{state:"off"});return u.useEffect(()=>{if(!e||!t){e||a({state:"off"});return}let r=!0;return e.list().then(l=>{r&&(l.ok?a({state:"read",proposals:l.data}):l.refusal.status===404||l.refusal.reason==="not_found"?a({state:"off"}):a({state:"failed",message:l.refusal.message}))}),()=>{r=!1}},[e,t]),n}function sy({proposal:e,on_open:t}){const n=Au[e.status];return s.jsxs("li",{className:"border-b px-4 py-2.5 last:border-b-0","data-testid":"org-proposal",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(P,{type:"button",variant:"link",size:"sm",className:"h-auto p-0 text-left whitespace-normal",onClick:t,children:e.title}),s.jsx(ce,{variant:n.tone,children:n.label})]}),s.jsxs("p",{className:"text-muted-foreground mt-1 text-xs",children:[e.status==="open"?`Proposed by ${e.requested_by} on ${Mu(e.requested_at)}`:`${n.label} by ${e.decided_by??"a former member"} on ${Mu(e.decided_at??e.requested_at)}`,` · ${e1(e.counts)}`]})]})}const x3="Changes members propose to the org's teams, job functions, posts and slots. Nothing changes until someone who may make the change accepts it.";function g3({listed:e,on_propose:t,on_open:n}){const[a,r]=u.useState(!1);if(e.state==="off"||e.state==="loading")return null;const l=e.state==="read"?e.proposals:[],i=l.filter(c=>c.status==="open"),o=l.filter(c=>c.status!=="open");return s.jsxs("section",{"aria-labelledby":"org-chart-proposals",className:"mt-6 min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-x-4 gap-y-2",children:[s.jsxs("div",{className:"min-w-0 flex-1 basis-64",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h2",{id:"org-chart-proposals",className:"text-lg font-semibold",children:"Proposals"}),i.length?s.jsx(ce,{variant:"info",children:`${i.length} open`}):null]}),s.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:x3})]}),s.jsxs(P,{type:"button",variant:"outline",size:"sm",onClick:t,children:[s.jsx(Kh,{className:"size-4","aria-hidden":"true"}),"Propose a change"]})]}),s.jsxs("div",{className:"mt-3 grid gap-2",children:[e.state==="failed"?s.jsxs("p",{className:"text-destructive text-sm",role:"alert",children:["Could not read the proposals. ",e.message]}):null,e.state==="read"&&l.length===0?s.jsxs(ut,{className:"flex flex-col items-center gap-2 p-6 text-center",children:[s.jsx(Kh,{className:"text-muted-foreground size-5","aria-hidden":"true"}),s.jsx("p",{className:"text-sm font-medium",children:"No proposals yet"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Propose a change to the org's structure for someone with the authority to accept."})]}):null,i.length?s.jsx(ut,{className:"overflow-hidden",children:s.jsx("ul",{role:"list",className:"m-0 list-none p-0","aria-label":"Open proposals",children:i.map(c=>s.jsx(sy,{proposal:c,on_open:()=>n(c)},c.id))})}):null,o.length?s.jsxs("div",{children:[s.jsxs(P,{type:"button",variant:"ghost",size:"sm","aria-expanded":a,"aria-controls":"org-chart-proposals-decided",onClick:()=>r(c=>!c),children:[a?s.jsx(Np,{className:"size-4","aria-hidden":"true"}):s.jsx(ad,{className:"size-4","aria-hidden":"true"}),`Decided (${o.length})`]}),a?s.jsx(ut,{className:"mt-2 overflow-hidden",children:s.jsx("ul",{id:"org-chart-proposals-decided",role:"list",className:"m-0 list-none p-0","aria-label":"Decided proposals",children:o.map(c=>s.jsx(sy,{proposal:c,on_open:()=>n(c)},c.id))})}):null]}):null]})]})}const v3="Nothing you change here is saved to the organization. Submit the proposal for review, or discard it. A proposal can add teams but not rename, move or remove them, and it never changes who holds a post.";function y3({draft:e,on_submit:t,on_discard:n}){var c;const a=((c=e.moved)==null?void 0:c.state)==="conflict"?e.moved.names:null,r=!!e.moved,l=e.total===0?"No changes yet":`${e.total} ${e.total===1?"change":"changes"}`,i=e.total===0||!!a,o=r?Xt:Kh;return s.jsxs(me,{variant:r?"warning":"info",role:"status",className:"mt-6",children:[s.jsx(o,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:r?"The org changed while you drafted":"You are drafting a proposal"}),s.jsxs(ge,{children:[s.jsx("p",{id:"org-draft-why",children:a?`The org changed what your draft changes: ${Nx(a)}. Discard the draft and start again from the org as it is now.`:r?"We moved your draft onto the org as it is now and kept your changes. Check the chart, then submit again.":v3}),s.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[s.jsx(P,{type:"button",size:"sm","aria-disabled":i||void 0,"aria-describedby":i?a?"org-draft-why":"org-draft-count":void 0,onClick:()=>i?void 0:t(),children:"Submit proposal"}),s.jsx(P,{type:"button",variant:"outline",size:"sm",onClick:n,children:"Discard draft"}),s.jsx("span",{id:"org-draft-count",className:"text-muted-foreground text-xs",children:l})]})]})]})}const j3={proposal_empty:"The proposal changes nothing in the org."};function b3({open:e,draft:t,submit:n,on_close:a,on_done:r}){const[l,i]=u.useState(""),[o,c]=u.useState(""),[d,f]=u.useState(null),[h,m]=u.useState(null),[x,b]=u.useState(!1),v=u.useRef(!1);u.useEffect(()=>{e&&(f(null),m(null))},[e]);const y=async g=>{if(g.preventDefault(),v.current)return;const p=l.trim();if(!p||p.length>200){f("Give the proposal a title of at most 200 characters.");return}f(null),m(null),b(!0),v.current=!0;try{const j=await n({title:p,...o.trim()?{note:o.trim()}:{}});if(!j.ok){m(j3[j.refusal.code??""]??j.refusal.message);return}j.data.state==="proposed"&&(i(""),c("")),r(j.data,p)}finally{v.current=!1,b(!1)}};return s.jsx(dn,{open:e,onOpenChange:g=>g?null:a(),children:s.jsx(fn,{className:"sm:max-w-lg",children:s.jsxs("form",{onSubmit:g=>void y(g),className:"grid gap-4",noValidate:!0,children:[s.jsxs(hn,{children:[s.jsx(pn,{children:"Submit proposal"}),s.jsx(xn,{children:"Someone who may make these changes reviews it. Nothing in the organization changes until it is accepted."})]}),h?s.jsxs(me,{variant:"destructive",role:"alert",children:[s.jsx(st,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:"Could not submit the proposal"}),s.jsx(ge,{children:s.jsx("p",{children:h})})]}):null,s.jsxs("div",{className:"grid gap-2",children:[s.jsx(De,{htmlFor:"org-proposal-title",children:"Title"}),s.jsx(Nt,{id:"org-proposal-title",value:l,maxLength:200,"aria-invalid":d?!0:void 0,"aria-describedby":d?"org-proposal-title-error":void 0,onChange:g=>i(g.target.value)}),d?s.jsx("p",{id:"org-proposal-title-error",className:"text-destructive text-sm",children:d}):null]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(De,{htmlFor:"org-proposal-note",children:"Note (optional)"}),s.jsx(An,{id:"org-proposal-note",value:o,rows:3,maxLength:4e3,placeholder:"Why the org should make this change","aria-describedby":"org-proposal-note-help",onChange:g=>c(g.target.value)}),s.jsx("p",{id:"org-proposal-note-help",className:"text-muted-foreground text-xs",children:"At most 4000 characters."})]}),s.jsx("p",{className:"text-muted-foreground text-xs",children:e1(t.counts)}),s.jsxs(mn,{children:[s.jsx(P,{type:"button",variant:"outline",onClick:a,children:"Cancel"}),s.jsxs(P,{type:"submit","aria-disabled":x||void 0,children:[x?s.jsx(Qt,{className:"size-4","aria-hidden":"true"}):null,x?"Submitting…":"Submit proposal"]})]})]})})})}const w3=[{kind:"team",title:"Teams"},{kind:"job_function",title:"Job functions"},{kind:"slot",title:"Slots"},{kind:"post",title:"Posts"},{kind:"fill",title:"Fills"}];function _3({entry:e,decided:t}){const n=!t&&e.state==="settled",a=d3[e.change];return s.jsxs("li",{className:"grid gap-1 border-b py-2","data-testid":"org-proposal-entry",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n&&e.change==="added"?null:s.jsx(ce,{variant:a.tone,children:a.label}),s.jsx("span",{className:"text-sm font-medium",children:e.name}),n?s.jsx(ce,{variant:"neutral",children:"Already in the org"}):null,!t&&e.state==="conflict"?s.jsx(ce,{variant:"error",children:"Changed in the org since"}):null]}),[...e.where,...e.fields,...!t&&e.now?[e.now]:[]].map(r=>s.jsx("p",{className:"text-muted-foreground text-xs break-words",children:r},r))]})}function ay(e,t){if(t.code==="proposal_conflict"&&e){const n=e.entries.filter(a=>a.state==="conflict").map(a=>a.name);if(n.length){const a=`The org changed what this proposal changes: ${Nx(n)}.`;if(e.proposal.mine)return`${a} Withdraw it and propose again from the org as it is now.`;const r=`ask ${e.proposal.requested_by} to withdraw it and propose again.`;return e.may_reject?`${a} Reject it, or ${r}`:`${a} You can ${r}`}}return t.code==="revision_conflict"?"Someone else changed the org. We read it again; check the proposal and accept again.":t.message}function N3({proposal:e,contract:t,context:n,check_two_factor:a,on_close:r,on_decided:l}){const[i,o]=u.useState(null),[c,d]=u.useState(null),[f,h]=u.useState(null),[m,x]=u.useState(!1),[b,v]=u.useState(null),[y,g]=u.useState("ok"),[p,j]=u.useState(null),[w,N]=u.useState(""),C=(e==null?void 0:e.id)??null,_=u.useRef(C);_.current=C;const S=u.useCallback(async()=>{if(!C)return;const T=await t.read(C);_.current===C&&(T.ok?(o(T.data),d(null)):d(T.refusal.message))},[t,C]);u.useEffect(()=>{if(o(null),d(null),h(null),x(!1),N(""),!C)return;S(),a().then(g);const T=()=>void a().then(B=>_.current===C&&g(B));return window.addEventListener("focus",T),()=>window.removeEventListener("focus",T)},[C,S,a]);const $=(i==null?void 0:i.proposal)??e,O=($==null?void 0:$.title)??"",G=($==null?void 0:$.status)==="open",V=(i==null?void 0:i.entries.some(T=>T.state==="conflict"))??!1,L=!!i&&(i.may_accept||i.may_reject),U=y==="ok",A={...n,two_factor:y},R=async T=>{if(C){v(T),h(null);try{const B=T==="accept"?await t.accept(C):T==="reject"?await t.reject(C,w.trim()||void 0):await t.withdraw(C);if(B.ok){j(null),l(T==="accept"?`Accepted ${O}.`:T==="reject"?`Rejected ${O}.`:`Withdrew ${O}.`);return}if(j(null),B.refusal.code==="mfa_challenge_required"||B.refusal.code==="mfa_enrollment_required"){g(B.refusal.code==="mfa_enrollment_required"?"enroll":"challenge");return}T==="accept"&&x(!0);const F=await t.read(C);if(_.current!==C)return;const J=F.ok?F.data:i;F.ok&&o(F.data),h({title:`${O} was not ${T==="accept"?"accepted":T==="reject"?"rejected":"withdrawn"}`,message:ay(J,B.refusal)})}finally{v(null)}}},E=i&&V&&!f?ay(i,{code:"proposal_conflict",message:""}):null,k=G&&i&&i.may_reject&&!i.may_accept&&!V?i.accept_refusal??null:null,M=!U||V||!!k||b!==null,K=[U?null:"org-proposal-two-factor",V?"org-proposal-refusal":null,k?"org-proposal-accept-refusal":null].filter(Boolean).join(" ");return s.jsxs(s.Fragment,{children:[s.jsx(dn,{open:e!==null,onOpenChange:T=>T?null:r(),children:s.jsxs(fn,{className:"flex max-h-[90vh] flex-col overflow-hidden sm:max-w-2xl",children:[s.jsxs(hn,{children:[s.jsx(pn,{children:O}),s.jsx(xn,{asChild:!0,children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[$?s.jsx(ce,{variant:Au[$.status].tone,children:Au[$.status].label}):null,s.jsx("span",{children:$?m3($):null})]})})]}),s.jsxs("div",{className:"-mx-1 grid min-h-0 flex-1 gap-4 overflow-y-auto px-1","data-testid":"org-proposal-body",children:[$!=null&&$.note?s.jsx("p",{className:"text-sm whitespace-pre-line",children:$.note}):null,$!=null&&$.decision_note?s.jsxs("div",{className:"grid gap-1",children:[s.jsx("span",{className:"text-sm font-medium",children:"Decision note"}),s.jsx("p",{className:"text-muted-foreground text-sm whitespace-pre-line",children:$.decision_note})]}):null,c?s.jsxs(me,{variant:"destructive",role:"alert",children:[s.jsx(st,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:"Could not read the proposal"}),s.jsx(ge,{children:s.jsx("p",{children:c})})]}):null,!i&&!c?s.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:"Reading the proposal…"}):null,i?w3.map(T=>{const B=i.entries.filter(F=>F.kind===T.kind);return B.length?s.jsxs("div",{className:"grid",children:[s.jsx("h3",{className:"text-muted-foreground text-sm font-medium",children:T.title}),s.jsx("ul",{role:"list",className:"m-0 list-none p-0",children:B.map(F=>s.jsx(_3,{entry:F,decided:!G},`${F.kind}:${F.name}`))})]},T.kind):null}):null,G&&i&&!L&&i.decide_refusal?s.jsxs(me,{variant:"info",role:"status",children:[s.jsx(ws,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:"You can't accept or reject this proposal"}),s.jsx(ge,{children:s.jsx("p",{children:i.decide_refusal})})]}):null,k?s.jsxs(me,{id:"org-proposal-accept-refusal",variant:"info",role:"status",children:[s.jsx(ws,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:"You can't accept this proposal"}),s.jsx(ge,{children:s.jsx("p",{children:k})})]}):null,G&&L&&!U?s.jsx("div",{id:"org-proposal-two-factor",children:s.jsx(ao,{context:A,action:"decide the proposal",changing:"Accepting or rejecting a proposal"})}):null,f||E?s.jsxs(me,{id:"org-proposal-refusal",variant:"destructive",role:"alert",children:[s.jsx(st,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:(f==null?void 0:f.title)??(m?`${O} was not accepted`:`${O} can't be accepted`)}),s.jsx(ge,{children:s.jsx("p",{children:(f==null?void 0:f.message)??E})})]}):null]}),s.jsxs(mn,{children:[s.jsx(P,{type:"button",variant:"outline",onClick:r,children:"Close"}),G&&(i!=null&&i.may_withdraw)?s.jsx(P,{type:"button",variant:"outline",onClick:()=>j("withdraw"),children:"Withdraw proposal"}):null,G&&(i!=null&&i.may_reject)?s.jsx(P,{type:"button",variant:"outline",onClick:()=>j("reject"),children:"Reject"}):null,G&&i&&(i.may_accept||i.may_reject&&(V||k))?s.jsxs(P,{type:"button","aria-disabled":M||void 0,"aria-describedby":K||void 0,onClick:()=>M?void 0:void R("accept"),children:[b==="accept"?s.jsx(Qt,{className:"size-4","aria-hidden":"true"}):null,b==="accept"?"Accepting…":"Accept"]}):null]})]})}),s.jsx(Dp,{open:p!==null,onOpenChange:T=>T?null:j(null),children:s.jsxs(zp,{children:[s.jsxs(Lp,{children:[s.jsx(Bp,{children:p==="reject"?`Reject ${O}?`:`Withdraw ${O}?`}),s.jsx(Hp,{children:p==="reject"?`${($==null?void 0:$.requested_by)??"The requester"} sees your note on the proposal.`:"Nobody can accept it after this."})]}),p==="reject"&&!U?s.jsx("div",{id:"org-proposal-reject-two-factor",children:s.jsx(ao,{context:A,action:"reject the proposal",changing:"Accepting or rejecting a proposal"})}):null,p==="reject"?s.jsxs("div",{className:"grid gap-2",children:[s.jsx(De,{htmlFor:"org-proposal-reject-note",children:"Note (optional)"}),s.jsx(An,{id:"org-proposal-reject-note",value:w,rows:2,maxLength:4e3,placeholder:"Why you are rejecting it",onChange:T=>N(T.target.value)})]}):null,s.jsxs(Up,{children:[s.jsx(Ip,{children:"Cancel"}),p==="reject"?s.jsx(P,{type:"button",variant:"destructive","aria-disabled":!U||b!==null||void 0,"aria-describedby":U?void 0:"org-proposal-reject-two-factor",onClick:()=>!U||b?void 0:void R("reject"),children:b==="reject"?"Rejecting…":"Reject proposal"}):s.jsx(P,{type:"button","aria-disabled":b!==null||void 0,onClick:()=>b?void 0:void R("withdraw"),children:b==="withdraw"?"Withdrawing…":"Withdraw"})]})]})})]})}const k3={local:"Who holds each post and who reports to whom in this repository's local org, worked out from its teams, job functions and posts.",hosted:"Who holds each post and who reports to whom in this organization, worked out from its teams, job functions and posts."},S3="Covered: someone holds a post that fills the slot. Vacant: posts fill it but nobody holds them. Uncovered: no job function fills it.",C3=4,kx=e=>({paddingLeft:16+24*Math.min(e,C3)}),$u={covered:{label:"Covered",tone:"success"},vacant:{label:"Vacant",tone:"warning"},uncovered:{label:"Uncovered",tone:"error"}};function R3(){const e=un().org;if(!e)throw new Error("The Org chart page rendered without the org seam.");return e}function T3({host:e="local",org:t=""}={}){const n=R3(),[a,r]=u.useState({state:"loading"}),[l,i]=u.useState(null),o=u.useRef(0),c=u.useRef(null),d=u.useCallback(k=>{const M=async K=>{const T=o.current+=1;c.current&&clearTimeout(c.current);const B=await n.chart();if(T!==o.current)return;if(B.ok){i({chart:B.data,at:new Date().toISOString()}),r({state:"read"});return}const{refusal:F}=B;if(F.reason==="no_local_org"){i(null),r({state:"none",seedable:F.seedable!==!1});return}if(e==="hosted"&&(F.reason==="not_found"||F.status===404)){i(null),r({state:"missing"});return}if(F.retry&&F.reason==="store_locked"&&K>0){const J=F.retry_after??10;r({state:"busy",retry_after:J}),c.current=setTimeout(()=>void M(K-1),J*1e3);return}r({state:"failed",refusal:F})};return M(k)},[n,e]);u.useEffect(()=>(d(1),()=>{o.current+=1,c.current&&clearTimeout(c.current)}),[d]);const f=()=>void d(1),h=a.state==="none"||a.state==="missing"?null:l,{href:m}=Ze(),x=yr(),b=m("/settings/account"),v=n.proposals,y=p3(v,(h==null?void 0:h.at)??null),g=!!v&&y.state!=="off",[p,j]=u.useState(null),[w,N]=u.useState(!1),[C,_]=u.useState(null),{confirm:S,confirm_dialog:$}=Jk(Yl),O=u.useMemo(()=>p&&v?{draft:p,change:v.draft.change,on_draft:j}:null,[p,v]),G=U3(n,f,(p==null?void 0:p.chart)??(h==null?void 0:h.chart)??A3,e,b,O),V=n.twoFactor,L=u.useCallback(async()=>V?V():"ok",[V]),U=!!p&&p.total>0,A=u.useRef(()=>{});A.current=()=>{v==null||v.draft.discard(),j(null)},u.useEffect(()=>{if(!U)return;let k=!0;const M=B=>{B.preventDefault()},K=()=>{k=!1,window.removeEventListener("beforeunload",M),document.removeEventListener("click",T,!0)},T=B=>{var H,te;if(!k||B.defaultPrevented||B.button!==0||B.metaKey||B.ctrlKey||B.shiftKey||B.altKey)return;const F=B.target,J=(H=F==null?void 0:F.closest)==null?void 0:H.call(F,"a[href]"),he=J?null:(te=F==null?void 0:F.closest)==null?void 0:te.call(F,E3);let X=null;if(J&&J.target!=="_blank"&&!J.hasAttribute("download")){const se=new URL(J.href,window.location.href),ye=se.pathname===window.location.pathname&&se.search===window.location.search;se.origin===window.location.origin&&!ye&&(X=()=>window.location.assign(se.href))}else he&&he.getAttribute("aria-current")!=="page"&&he.getAttribute("aria-disabled")!=="true"&&!he.hasAttribute("disabled")&&(X=()=>he.click());if(!X)return;B.preventDefault(),B.stopPropagation();const D=X;S({title:"Discard your draft?",description:"Your changes to the draft are lost. Nothing in the organization changed.",action_label:"Discard draft",destructive:!0,action:"discard the draft"}).then(se=>{se&&(K(),A.current(),D())})};return window.addEventListener("beforeunload",M),document.addEventListener("click",T,!0),K},[U,S]);const R=async()=>{if(!v)return;const k=await v.draft.begin();k.ok?j(k.data):x.error(k.refusal.message)},E=async()=>{(!(p&&p.total>0)||await S({title:"Discard your draft?",description:"Your changes to the draft are lost. Nothing in the organization changed.",action_label:"Discard draft",destructive:!0,action:"discard the draft"}))&&(v==null||v.draft.discard(),j(null))};return a.state==="missing"?s.jsx(I3,{org:t}):s.jsx(yk,{children:s.jsxs("div",{className:"flex h-full min-h-0 flex-1 flex-col overflow-auto px-4 py-4 sm:px-6 lg:px-8",children:[s.jsx(Jt,{title:"Org chart",description:k3[e]}),a.state==="busy"&&!h?s.jsxs("p",{className:"text-muted-foreground mt-4 text-sm",role:"status",children:["Another sdlc command holds the repository store; reading again in ",a.retry_after," s."]}):null,(a.state==="loading"||a.state==="busy")&&!h?s.jsx(B3,{quiet:a.state==="busy"}):null,a.state==="none"?s.jsx(H3,{edit:(G==null?void 0:G.actions)??null,seedable:a.seedable}):null,a.state==="failed"?s.jsx(q3,{host:e,kept_at:(h==null?void 0:h.at)??null,on_retry:f}):null,h&&p?s.jsx(y3,{draft:p,on_submit:()=>N(!0),on_discard:()=>void E()}):h&&g?s.jsx(g3,{listed:y,on_propose:()=>void R(),on_open:_}):null,h?s.jsx(G3,{chart:(p==null?void 0:p.chart)??h.chart,host:e,edit:(G==null?void 0:G.actions)??null}):null,(G==null?void 0:G.dialogs)??null,v&&p?s.jsx(b3,{open:w,draft:p,submit:v.draft.submit,on_close:()=>N(!1),on_done:(k,M)=>{if(N(!1),k.state==="moved"){j(k.draft);return}j(null),x.success(`Proposed ${M}.`),f()}}):null,v&&g?s.jsx(N3,{proposal:C,contract:v,context:{host:e,two_factor:"ok",settings_href:b},check_two_factor:L,on_close:()=>_(null),on_decided:k=>{x.success(k),_(null),f()}}):null,$]})})}const E3='[data-sidebar="menu-button"]:not([aria-expanded]), [data-sidebar="menu-sub-button"]',A3={org:"",workflow:!1,teams:[],job_functions:[],slots:[],posts:[],members:[],slot_resolution:[],project:{team:null,roots:[]}};function M3(e){var i;const t=e.authority;if(!t)return{functions:!0,team_add:!0,team:()=>"full",post_add:!1,post:()=>!1,override:!0,slots:!1};const n=((i=e.teams.find(o=>o.parent===null))==null?void 0:i.key)??null,a=new Set(t.teams),r=new Set(t.team_descriptions),l=new Set(t.posts);return{functions:t.administer,team_add:a.size>0,team:o=>o===n?t.administer?"root":r.has(o)?"description":null:a.has(o)?"full":r.has(o)?"description":null,post_add:t.post_pairs.length>0,post:o=>l.has(o),override:!1,slots:t.administer}}function $3(e){const t=e.authority;return t?t.administer||t.teams.length>0||t.team_descriptions.length>0||t.posts.length>0||t.post_pairs.length>0:!0}const O3={functions:!0,team_add:!0,team:()=>"description",post_add:!0,post:()=>!0,override:!1,slots:!0};function $d({mark:e}){return e?e==="added"?s.jsx(ce,{variant:"success",children:"Added"}):s.jsx(ce,{variant:"warning",children:"Changed"}):null}const D3={local:"It leaves this repository's local org. If a post, a team or function under it, a holder, an override or the project still needs it, nothing is removed and you are told what needs it.",hosted:"It leaves the organization. If a post, a team or job function under it, or a holder still needs it, nothing is removed and you are told what needs it."},z3={mfa_challenge_required:"challenge",mfa_enrollment_required:"enroll"};function L3(e,t,n){var c;const a=t==="hosted"&&!!n.authority,r=((c=n.authority)==null?void 0:c.two_factor)??!0,[l,i]=u.useState("ok"),o=u.useCallback(async()=>{a&&i(e.twoFactor?await e.twoFactor():r?"ok":"challenge")},[e,a,r]);return u.useEffect(()=>{if(!a){i("ok");return}r?i("ok"):o();const d=()=>void o();return window.addEventListener("focus",d),()=>window.removeEventListener("focus",d)},[a,r,o]),{state:l,set_state:i,check:o}}function U3(e,t,n,a,r,l=null){const i=yr(),o=t1(n),c=L3(e,a,n),d=l?{host:a,two_factor:"ok",settings_href:r}:a==="hosted"?{host:a,two_factor:c.state,settings_href:r}:Yl,{confirm:f,confirm_dialog:h}=Jk(d),[m,x]=u.useState(null),[b,v]=u.useState({}),y=E=>v(k=>{if(!k[E])return k;const{[E]:M,...K}=k;return K}),g=e.members,p=u.useCallback(async()=>{if(!g)return{ok:!1};const E=await g();return E.ok?{ok:!0,data:E.data}:{ok:!1}},[g]),j=l?async E=>{const k=await l.change(E);return k.ok?(l.on_draft(k.data),{ok:!0,data:{}}):k}:e.change;if(!j||!l&&a==="hosted"&&(!n.authority||!$3(n)))return null;const w=l?O3:M3(n),N=E=>{const k=E.code?z3[E.code]:void 0;return k?(c.set_state(k),{kind:"two_factor",message:E.message}):E.code==="revision_conflict"?(t(),{kind:"changed",message:E.message}):E.code==="outside_authority"?(t(),{kind:"authority",message:E.message}):{message:E.message}},C=E=>E.action==="hold"||E.action==="release"?"posts":"kind"in E?E.kind==="team"?"teams":E.kind==="post"?"posts":E.kind==="slot"?"slots":"functions":null,_=(E,k)=>{if(l)return;const M=E==null?void 0:E.warning;M?i.error(M):i.success(k),t()},S=async(E,k)=>{const M=await j(E);if(!M.ok)return N(M.refusal);const K=C(E);return K&&y(K),_(M.data,k),null},$=E=>{c.check(),x(E)},O=async(E,k,M,K)=>{const T=await j(M);if(!T.ok){const B=N(T.refusal),F=T.refusal.bound,J=F?F.projects.length+F.more:0,he=F?`${F.kind==="slot"?"Slot":"Post"} ${k} is still needed by the ${J===1?"override of 1 project that binds":`overrides of ${J} projects that bind`} it. Clear ${J===1?"it":"them"} on each project's Settings first.`:B.message;v(X=>({...X,[E]:{label:k,message:he,...F?{bound:F}:{}}}));return}y(E),_(T.data,K)},G=async(E,k,M)=>{const K=E==="team"?"team":"job function";c.check(),(l||await f({title:`Remove ${K} ${M}?`,description:D3[a],action_label:"Remove",destructive:!0,action:`remove the ${K}`}))&&await O(E==="team"?"teams":"functions",M,{action:"remove",kind:E,key:k},`${E==="team"?"Team":"Job function"} ${M} removed.`)},V=async E=>{const k=E.label||E.key;c.check(),(l||await f({title:`Remove slot ${k}?`,description:"Projects stop showing it. This can't be undone.",action_label:"Remove slot",destructive:!0,action:"remove the slot"}))&&await O("slots",k,{action:"remove",kind:"slot",key:E.key},`Removed slot ${k}.`)},L=async E=>{const k=o.post(E);c.check(),(l||await f({title:`Remove post ${k}?`,description:"The post leaves the organization's chart. A post with holders is refused; remove its holders first.",action_label:"Remove",destructive:!0,action:"remove the post"}))&&await O("posts",k,{action:"remove",kind:"post",key:E},`Removed post ${k}.`)},U=async(E,k)=>{const M=o.post(E),K=o.member(k),T=n.posts.find(X=>X.post===E),F=((T==null?void 0:T.holders.length)??0)<=1?T!=null&&T.escalates_to?` The post becomes vacant. Until someone holds it, its reports and the slots it fills go to ${o.manager(T.escalates_to)}.`:" The post becomes vacant.":"";if(c.check(),!await f({title:`Remove ${K} from ${M}?`,description:`They stop holding this post and no longer report through it.${F}`,action_label:"Remove",action:"remove the holder"}))return;const he=await j({action:"release",post:E,member:k.id});if(!he.ok){i.error(N(he.refusal).message),t();return}y("posts"),_(he.data,`Removed ${K} from ${M}.`)},A=()=>x(null),R=(m==null?void 0:m.kind)==="override"&&n.project&&n.project.team!==null?n.project.slots.find(E=>E.slot===m.slot)??null:null;return{actions:{can:w,host:a,drafting:!!l,...l?{marks:l.draft.marks}:{},team:(E,k="full")=>$({kind:"team",team:E,scope:k}),job:E=>$({kind:"function",job:E}),override:E=>$({kind:"override",slot:E}),slot:E=>$({kind:"slot",slot:E}),slot_remove:E=>void V(E),remove:(E,k,M)=>void G(E,k,M),post_add:()=>$({kind:"post"}),post_remove:E=>void L(E),holder_add:E=>$({kind:"holder",post:E}),holder_remove:(E,k)=>void U(E,k),refused:E=>{const k=b[E];return k?s.jsx(u3,{label:k.label,message:k.message,bound:k.bound,on_dismiss:()=>y(E)}):null}},dialogs:s.jsxs(s.Fragment,{children:[s.jsx(e3,{open:(m==null?void 0:m.kind)==="team",chart:n,team:(m==null?void 0:m.kind)==="team"?m.team:null,scope:(m==null?void 0:m.kind)==="team"?m.scope:"full",parents:!l&&n.authority?n.authority.teams:void 0,save:S,on_close:A,context:d}),s.jsx(n3,{open:(m==null?void 0:m.kind)==="function",chart:n,job:(m==null?void 0:m.kind)==="function"?m.job:null,save:S,on_close:A,context:d}),s.jsx(l3,{open:R!==null,chart:n,binding:R,names:o,save:S,confirm:E=>f({...E,action:"clear the override"}),on_close:A}),s.jsx(r3,{open:(m==null?void 0:m.kind)==="slot",chart:n,slot:(m==null?void 0:m.kind)==="slot"?m.slot:null,save:S,on_close:A,context:d}),s.jsx(o3,{open:(m==null?void 0:m.kind)==="post",chart:n,names:o,save:S,on_close:A,context:d}),s.jsx(c3,{open:(m==null?void 0:m.kind)==="holder",chart:n,post:(m==null?void 0:m.kind)==="holder"?m.post:null,names:o,members:p,save:S,on_close:A,context:d}),h]})}}function B3({quiet:e=!1}){return s.jsx("div",{className:"mt-6 grid gap-2",...e?{"aria-hidden":!0}:{role:"status","aria-label":"Loading the org chart"},children:Array.from({length:4},(t,n)=>s.jsx(_t,{className:n===3?"h-10 w-2/3":"h-10 w-full"},n))})}function cl({children:e}){return s.jsx("pre",{className:"bg-muted text-foreground m-0 overflow-x-auto rounded-md border px-3 py-2 font-mono text-sm",children:s.jsx("code",{children:e})})}function H3({edit:e,seedable:t}){const n=t?e?"Plan one from this checkout's workflow roles with sdlc org seed, or start one with a team. This page shows it as soon as it exists.":"Plan one from this checkout's workflow roles, or start one with a team. This page shows it as soon as it exists.":"Start one with a team. This page shows it as soon as it exists.";return s.jsxs(me,{variant:"info",className:"mt-6",children:[s.jsx(ws,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:"This repository has no local org yet"}),s.jsxs(ge,{children:[s.jsx("p",{children:n}),t||!e?s.jsxs("div",{className:"mt-2 grid w-full gap-2",children:[t?s.jsx(cl,{children:"sdlc org seed"}):null,e?null:s.jsx(cl,{children:"sdlc org add team <key>"})]}):null,e?s.jsxs(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>e.team(null),children:[s.jsx(wl,{className:"size-4","aria-hidden":"true"}),"Add team"]}):null]})]})}function I3({org:e}){const{href:t,Link:n}=Ze();return s.jsx(Ha,{title:"Page not found",description:e?`There is no organization ${e}, or you are not one of its members.`:"This organization does not exist, or you are not one of its members.",backHref:t("/org"),backLabel:"Back to Organizations",link:n})}function P3(e){return new Date(e).toDateString()===new Date().toDateString()?`today at ${as(e)}`:`on ${Pn(e)} at ${as(e)}`}function q3({host:e,kept_at:t,on_retry:n}){const a=t?`The chart read ${P3(t)} is kept below. `:"";return s.jsxs(me,{variant:"destructive",className:"mt-6",children:[s.jsx(st,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:e==="hosted"?"Could not read the org chart":"Could not read the local org"}),s.jsxs(ge,{children:[s.jsxs("p",{children:[a,e==="hosted"?a?"Try again in a moment.":"Try again in a moment. If it keeps failing, ask an organization owner.":"Details are in the terminal running sdlc viewer."]}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:n,children:"Retry"})]})]})}function t1(e){return u.useMemo(()=>{const t=new Map(e.teams.map(y=>[y.key,y.label||y.key])),n=new Map(e.job_functions.map(y=>[y.key,y.label||y.key])),a=new Map(e.slots.map(y=>[y.key,y.label||y.key])),r=new Map(e.posts.map(y=>[y.post,y.holders])),l=y=>y.label||y.id,i=new Map;for(const y of[...e.members,...e.posts.flatMap(g=>g.holders)]){const g=l(y);i.set(g,(i.get(g)??new Set).add(`${y.kind}:${y.id}`))}const o=y=>{var g;return(((g=i.get(l(y)))==null?void 0:g.size)??0)>1},c=y=>{const g=o(y)?y.detail??y.id:null;return g&&g!==l(y)?g:null},d=y=>{const g=c(y);return g&&g!==l(y)?`${l(y)} (${g})`:l(y)},f=y=>{const[g="",p=""]=y.split("/");return{team:t.get(g)??g,job:n.get(p)??p}},h=y=>{const{team:g,job:p}=f(y);return`${p} · ${g}`},m=y=>{if(y==="top")return"Top of the org";if(typeof y!="string")return`A vacant ${n.get(y.vacant)??y.vacant}`;const g=(r.get(y)??[]).map(d);return g.length?`${h(y)} (${g.join(", ")})`:h(y)},x=new Map(e.teams.map(y=>[y.key,y.parent])),b=y=>{let g=0;for(let p=x.get(y);p&&g<e.teams.length;p=x.get(p))g+=1;return g};return{parts:f,post:h,member:d,memberLabel:l,memberDetail:c,manager:m,byPost:(y,g)=>{const[p="",j=""]=[y.split("/")[0],g.split("/")[0]],[w,N]=[f(y),f(g)];return b(p)-b(j)||w.team.localeCompare(N.team)||w.job.localeCompare(N.job)},slot:y=>a.get(y)??y,job:y=>n.get(y)??y,team:y=>t.get(y)??y}},[e])}function Qa({id:e,title:t,description:n,actions:a,children:r,anchor:l}){const i=u.useRef(null);return u.useEffect(()=>{var o,c;!l||typeof window>"u"||window.location.hash!==`#${l}`||((o=i.current)==null||o.scrollIntoView({block:"start"}),(c=i.current)==null||c.focus({preventScroll:!0}))},[l]),s.jsxs("section",{id:l,"aria-labelledby":e,className:"mt-8 min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-x-4 gap-y-2",children:[s.jsxs("div",{className:"min-w-0 flex-1 basis-64",children:[s.jsx("h2",{id:e,ref:i,tabIndex:l?-1:void 0,className:"text-lg font-semibold",children:t}),s.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:n})]}),a?s.jsx("div",{className:"flex shrink-0 gap-2",children:a}):null]}),s.jsx("div",{className:"mt-3",children:r})]})}function pi({children:e,on_click:t}){return s.jsxs(P,{type:"button",variant:"outline",size:"sm",onClick:t,children:[s.jsx(wl,{className:"size-4","aria-hidden":"true"}),e]})}const ry={local:"A member's primary manager comes from the post highest in the function tree; the others are dotted lines.",hosted:"Members who hold a post. A member's primary manager comes from the post highest in the function tree; the others are dotted lines."};function G3({chart:e,host:t,edit:n}){const a=t1(e),r=e.members.some(l=>l.kind==="agent");return s.jsxs(s.Fragment,{children:[s.jsxs(Qa,{id:"org-chart-lines",title:"Reporting lines",description:"Each post reports to the post of its parent job function in the same team, or else in the nearest team above it that has one.",actions:n!=null&&n.can.post_add?s.jsx(pi,{on_click:n.post_add,children:"Add post"}):void 0,children:[n==null?void 0:n.refused("posts"),s.jsx(F3,{chart:e,names:a,agents:r,host:t,edit:n})]}),s.jsx(Qa,{id:"org-chart-members",title:"Members",description:r?`${ry[t]} Each agent answers to the nearest person in its reporting chain.`:ry[t],children:s.jsx(Z3,{chart:e,names:a,host:t,agents:r})}),n?s.jsxs(Qa,{id:"org-chart-teams",title:"Teams",description:"Each team under its parent. A post is one of its job functions staffed in it.",actions:n.can.team_add?s.jsx(pi,{on_click:()=>n.team(null),children:"Add team"}):void 0,children:[n.refused("teams"),s.jsx(V3,{chart:e,edit:n})]}):null,s.jsxs("div",{className:"grid items-start gap-x-6 xl:grid-cols-2",children:[s.jsxs(Qa,{id:"org-chart-functions",title:"Function tree",description:"Each job function under its parent, with the slots it fills.",actions:n!=null&&n.can.functions?s.jsx(pi,{on_click:()=>n.job(null),children:"Add job function"}):void 0,children:[n!=null&&n.can.functions?n.refused("functions"):null,s.jsx(J3,{chart:e,names:a,edit:n!=null&&n.can.functions?n:null})]}),s.jsxs(Qa,{id:"org-chart-slots",anchor:"slots",title:"Slots",description:S3,actions:n!=null&&n.can.slots&&e.slot_resolution.length>0?s.jsx(pi,{on_click:()=>n.slot(null),children:"Add slot"}):void 0,children:[n!=null&&n.can.slots?n.refused("slots"):null,e.workflow===!1?s.jsx("p",{className:"text-muted-foreground mb-3 text-xs",children:"This checkout has no workflow file, so no slot is marked as a gate."}):null,s.jsx(tL,{chart:e,names:a,host:t,edit:n!=null&&n.can.slots?n:null})]})]}),e.project?s.jsx(sL,{project:e.project,chart:e,names:a,edit:n!=null&&n.can.override?n:null}):null]})}function V3({chart:e,edit:t}){var c;const n=Sx([...e.teams].sort((d,f)=>(d.label||d.key).localeCompare(f.label||f.key)),d=>d.key,d=>d.parent);if(n.length===0)return s.jsx("p",{className:"text-muted-foreground text-sm",children:"No teams yet."});const a=((c=e.project)==null?void 0:c.team)??null,r=t.host==="hosted",l=(d,f)=>{const h=t.can.team(d.key);return h==="full"?s.jsx(ol,{label:f,on_edit:()=>t.team(d),on_remove:()=>t.remove("team",d.key,f)}):h==="root"?s.jsx(ol,{label:f,on_edit:()=>t.team(d,"description")}):h==="description"&&t.drafting?s.jsx(ol,{label:f,items:[{label:"Edit description",on_select:()=>t.team(d,"description")}]}):h==="description"?s.jsx(P,{type:"button",variant:"ghost",size:"control-icon",className:"-my-1 shrink-0","aria-label":`Edit the description of ${f}`,onClick:()=>t.team(d,"description"),children:s.jsx(ld,{className:"size-3.5","aria-hidden":"true"})}):null},i=(d,f)=>s.jsx("ul",{role:"list",className:f===0?"m-0 -mb-px list-none p-0":"m-0 list-none p-0",children:d.map(({item:h,children:m})=>{var b;const x=h.label||h.key;return s.jsxs("li",{children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1 border-b py-2 pr-4",style:kx(f),"data-testid":"org-chart-team",children:[s.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"text-sm font-medium",children:x}),s.jsx($d,{mark:(b=t.marks)==null?void 0:b.teams[h.key]})]}),s.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[r?null:s.jsx("span",{className:"text-muted-foreground font-mono text-xs",children:h.key}),a===h.key?s.jsx(ce,{variant:"neutral",children:"Owns this project"}):null,l(h,x)]})]}),m.length>0?i(m,f+1):null]},h.key)})}),o=r&&e.teams.length===1;return s.jsxs(s.Fragment,{children:[s.jsx(ut,{className:"overflow-hidden",children:i(n,0)}),o?s.jsxs("p",{className:"text-muted-foreground mt-2 text-sm",children:["No teams below ",e.teams[0].label||e.teams[0].key," yet."]}):null]})}function Sx(e,t,n){const a=new Set(e.map(t)),r=new Map(e.map(i=>[t(i),{item:i,children:[]}])),l=[];for(const i of e){const o=n(i),c=r.get(t(i));o&&a.has(o)&&o!==t(i)?r.get(o).children.push(c):l.push(c)}return l}const Y3={local:"No posts yet.",hosted:"No posts yet. An org admin can add them."};function F3({chart:e,names:t,agents:n,host:a,edit:r}){const l=Sx([...e.posts].sort((c,d)=>t.byPost(c.post,d.post)),c=>c.post,c=>typeof c.reports_to=="string"&&c.reports_to!=="top"?c.reports_to:null);if(l.length===0){const c=a==="hosted"&&(r==null?void 0:r.can.functions)&&!r.can.post_add;return s.jsx("p",{className:"text-muted-foreground text-sm",children:r!=null&&r.can.post_add?"No posts yet. Add a post to staff a job function in a team.":c?"No posts yet. Add a job function under Function tree first, then add a post to staff it in a team.":Y3[a]})}const i=new Map(e.members.map(c=>[`${c.kind}:${c.id}`,c])),o=(c,d)=>s.jsx("ul",{role:"list",className:d===0?"m-0 -mb-px list-none p-0":"m-0 list-none p-0",children:c.map(({item:f,children:h})=>{var v;const{team:m}=t.parts(f.post),x=typeof f.reports_to=="object"?f.reports_to:null,b=!!(r!=null&&r.can.post(f.post));return s.jsxs("li",{children:[s.jsxs("div",{className:"border-b py-2 pr-4",style:kx(d),"data-testid":"org-chart-post",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(dR,{className:"text-muted-foreground size-4 shrink-0","aria-hidden":"true"}),s.jsx("span",{className:"text-sm font-medium",children:t.parts(f.post).job}),s.jsx("span",{className:"text-muted-foreground text-xs",children:x?`${m} · Reports to a vacant ${t.job(x.vacant)}`:m}),s.jsx($d,{mark:(v=r==null?void 0:r.marks)==null?void 0:v.posts[f.post]}),b&&r?s.jsx("span",{className:"ml-auto",children:s.jsx(ol,{label:t.post(f.post),items:[...r.drafting?[]:[{label:"Add holder",on_select:()=>r.holder_add(f.post)}],{label:"Remove post",on_select:()=>r.post_remove(f.post),destructive:!0}]})}):null]}),s.jsx("div",{className:"mt-1 grid min-w-0 gap-1 pl-6",children:f.holders.length===0?s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(ce,{variant:$u.vacant.tone,children:$u.vacant.label}),s.jsx("span",{className:"text-muted-foreground text-xs",children:f.escalates_to?`No one holds this post. Its work goes to ${t.manager(f.escalates_to)}.`:"No one holds this post."})]}):f.holders.map(y=>s.jsx(Q3,{holder:y,post:f.post,member:i.get(`${y.kind}:${y.id}`),names:t,agents:n,host:a,on_remove:b&&r&&!r.drafting?()=>r.holder_remove(f.post,y):void 0},`${y.kind}:${y.id}`))})]}),h.length>0?o(h,d+1):null]},f.post)})});return s.jsx(ut,{className:"overflow-hidden",children:o(l,0)})}function K3(e){return new Date(e).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"})}function X3(e){if(!e.held_since)return null;const t=K3(e.held_since);return e.added_by?e.added_by==="former_member"?`Added on ${t} by a former member`:`Added by ${e.added_by.name} on ${t}`:`Added on ${t}`}function Q3({holder:e,post:t,member:n,names:a,agents:r,host:l,on_remove:i}){const o=e.kind==="person"?Sp:_p,c=n==null?void 0:n.posts.find(b=>b.post===t),d=n==null?void 0:n.posts.find(b=>b.primary),f=a.memberDetail(e);let h=null;c!=null&&c.dotted&&d?h=`Dotted line: primary manager is ${a.manager(d.reports_to)}`:e.kind==="agent"&&n&&"accountable_person"in n&&(h=n.accountable_person?`Accountable person ${a.member(n.accountable_person)}`:"No accountable person");const m=l==="hosted"?X3(e):null,x=a.memberLabel(e);return s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[s.jsx(o,{className:"text-muted-foreground size-3.5 shrink-0","aria-hidden":"true"}),s.jsx("span",{className:"text-sm font-medium break-all",children:x}),i?s.jsxs(jk,{children:[s.jsx(bk,{asChild:!0,children:s.jsx(P,{type:"button",variant:"ghost",size:"control-icon",className:"-my-1 shrink-0","aria-label":`Remove ${a.member(e)} from ${a.post(t)}`,onClick:i,children:s.jsx(od,{className:"size-3.5","aria-hidden":"true"})})}),s.jsxs(px,{children:["Remove ",x]})]}):null,f?s.jsx("span",{className:"text-muted-foreground text-xs break-all",children:f}):null,r?s.jsx("span",{className:"text-muted-foreground text-xs",children:e.kind==="person"?"Person":"Agent"}):null]}),h?s.jsx("div",{className:"pl-5.5 text-xs",children:h}):null,m?s.jsx("div",{className:"text-muted-foreground pl-5.5 text-xs",children:m}):null]})}const W3=["sdlc org hold <team>/<function> --person <id>","sdlc org hold <team>/<function> --agent <id>"];function Z3({chart:e,names:t,host:n,agents:a}){if(e.members.length===0)return n==="hosted"?s.jsx("p",{className:"text-muted-foreground text-sm",children:"No one holds a post yet."}):s.jsxs("div",{className:"grid max-w-2xl gap-2",children:[s.jsx("p",{className:"text-muted-foreground text-sm",children:"No one holds a post yet. Give a post to a person or an agent:"}),W3.map(l=>s.jsx(cl,{children:l},l))]});const r=[...e.members].sort((l,i)=>l.kind===i.kind?t.memberLabel(l).localeCompare(t.memberLabel(i))||l.id.localeCompare(i.id):l.kind==="person"?-1:1);return s.jsx(ut,{className:"overflow-x-auto",children:s.jsxs(Ye,{containerAriaLabel:"Members",children:[s.jsx(We,{children:s.jsxs(ue,{children:[s.jsx(W,{children:"Member"}),s.jsx(W,{children:"Posts"}),s.jsx(W,{children:"Primary manager"}),s.jsx(W,{children:"Dotted lines"}),a?s.jsx(W,{children:"Accountable person"}):null]})}),s.jsx(Fe,{children:r.map(l=>{const i=l.posts.find(d=>d.primary),o=l.posts.filter(d=>d.dotted),c=t.memberDetail(l);return s.jsxs(ue,{"data-testid":"org-chart-member",children:[s.jsxs(Y,{children:[s.jsx("div",{className:"font-medium",children:t.memberLabel(l)}),c?s.jsx("div",{className:"text-muted-foreground text-xs",children:c}):null,a?s.jsx("div",{className:"text-muted-foreground text-xs",children:l.kind==="person"?"Person":"Agent"}):null]}),s.jsx(Y,{children:l.posts.map(d=>t.post(d.post)).join(", ")}),s.jsx(Y,{children:i?t.manager(i.reports_to):"None"}),s.jsx(Y,{children:o.length?o.map(d=>t.manager(d.reports_to)).join(", "):"None"}),a?s.jsx(Y,{children:l.kind==="person"?"Not an agent":l.accountable_person?t.member(l.accountable_person):"None"}):null]},`${l.kind}:${l.id}`)})})]})})}function J3({chart:e,names:t,edit:n}){const a=Sx([...e.job_functions].sort((l,i)=>(l.label||l.key).localeCompare(i.label||i.key)),l=>l.key,l=>l.parent);if(a.length===0)return s.jsx("p",{className:"text-muted-foreground text-sm",children:(n==null?void 0:n.host)==="hosted"?"No job functions yet. Add one to start the chart.":"No job functions yet."});const r=(l,i)=>s.jsx("ul",{role:"list",className:i===0?"m-0 -mb-px list-none p-0":"m-0 list-none p-0",children:l.map(({item:o,children:c})=>{var d;return s.jsxs("li",{children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1 border-b py-2 pr-4",style:kx(i),"data-testid":"org-chart-function",children:[s.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"text-sm font-medium",children:o.label||o.key}),s.jsx($d,{mark:(d=n==null?void 0:n.marks)==null?void 0:d.job_functions[o.key]})]}),s.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"text-muted-foreground text-xs",children:o.fills.length?`Fills ${o.fills.map(t.slot).join(", ")}`:"No slot"}),o.requires_person?s.jsx(ce,{variant:"neutral",children:"Requires a person"}):null,n?s.jsx(ol,{label:o.label||o.key,on_edit:()=>n.job(o),on_remove:()=>n.remove("job_function",o.key,o.label||o.key)}):null]})]}),c.length>0?r(c,i+1):null]},o.key)})});return s.jsx(ut,{className:"overflow-hidden",children:r(a,0)})}function eL(e,t){return e.status==="uncovered"?"No job function fills this slot":e.status==="vacant"?`${e.posts.map(t.post).join(", ")} has no holder`:e.posts.map(n=>`${t.post(n.post)}: ${n.holders.map(t.member).join(", ")}`).join("; ")}const Ou={covered:0,vacant:1,uncovered:2};function n1(e){return new Map(e.slots.filter(t=>t.gate).map(t=>{var n;return[t.key,(n=t.gates)!=null&&n.length?`Gate: ${t.gates.join(", ")}`:"Gate slot"]}))}function tL({chart:e,names:t,host:n,edit:a}){var i;const r=n1(e),l=new Map(e.slots.map(o=>[o.key,o]));if(n==="hosted"&&e.slot_resolution.length===0){const o=((i=e.authority)==null?void 0:i.ask)??[];return s.jsxs(ut,{className:"grid justify-items-center gap-2 p-6 text-center",children:[s.jsx("span",{className:"text-sm font-medium",children:"No slots yet"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Add the workflow roles your projects fill, such as Implementer or Approver."}),a?s.jsx(pi,{on_click:()=>a.slot(null),children:"Add slot"}):s.jsxs("p",{className:"text-muted-foreground text-sm",children:["Only an org owner or admin adds slots."," ",o.length?`Ask ${o.slice(0,3).join(", ")} to make this change.`:"Ask an org owner to make this change."]})]})}return s.jsx(ut,{className:"overflow-x-auto",children:s.jsxs(Ye,{containerAriaLabel:"Slots",children:[s.jsx(We,{children:s.jsxs(ue,{children:[s.jsx(W,{children:"Slot"}),s.jsx(W,{children:"Status"}),s.jsx(W,{children:"Resolves to"}),a?s.jsx(W,{className:"text-right",children:s.jsx("span",{className:"sr-only",children:"Actions"})}):null]})}),s.jsxs(Fe,{children:[[...e.slot_resolution].sort((o,c)=>Ou[o.status]-Ou[c.status]||t.slot(o.slot).localeCompare(t.slot(c.slot))).map(o=>{var d,f,h;const c=$u[o.status];return s.jsxs(ue,{"data-testid":"org-chart-slot",children:[s.jsxs(Y,{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"font-medium",children:t.slot(o.slot)}),s.jsx($d,{mark:(d=a==null?void 0:a.marks)==null?void 0:d.slots[o.slot]})]}),n==="hosted"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-muted-foreground font-mono text-xs",children:o.slot}),(f=l.get(o.slot))!=null&&f.description?s.jsx("div",{className:"text-muted-foreground text-xs break-words",children:(h=l.get(o.slot))==null?void 0:h.description}):null]}):null,r.has(o.slot)?s.jsx("div",{className:"text-muted-foreground text-xs",children:r.get(o.slot)}):null]}),s.jsx(Y,{children:s.jsx(ce,{variant:c.tone,children:c.label})}),s.jsxs(Y,{children:[eL(o,t),o.status==="covered"&&o.needs_person?s.jsx("div",{className:"text-muted-foreground text-xs",children:"Needs a person"}):null]}),a&&l.has(o.slot)?s.jsx(Y,{className:"text-right",children:s.jsx(ol,{label:t.slot(o.slot),on_edit:()=>a.slot(l.get(o.slot)),on_remove:()=>a.slot_remove(l.get(o.slot))})}):null]},o.slot)}),e.slot_resolution.length===0?s.jsx(ue,{children:s.jsx(Y,{colSpan:3,className:"text-muted-foreground h-24 text-center",children:"This org has no slots yet."})}):null]})]})})}const nL="Who fills each workflow slot for this repository's project: the posts of the owning team's job functions, else of the nearest team above, unless an override names other posts.",Gf=["sdlc org own <team>","sdlc org bind <slot> <team>/<function>... --reason <text>","sdlc org unbind <slot>"];function sL({project:e,chart:t,names:n,edit:a}){if(e.team===null){const i=e.roots.map(n.team);return s.jsx(Qa,{id:"org-chart-project",title:"This project",description:i.length?`This org has several root teams (${i.join(", ")}), so no team owns this repository's project yet and its slots are not bound. Name the owning team:`:"This org has no team yet, so no team owns this repository's project. Start one:",children:s.jsx("div",{className:"max-w-2xl",children:s.jsx(cl,{children:i.length?Gf[0]:"sdlc org add team <key>"})})})}const r=n1(t),l=[...e.slots].sort((i,o)=>Ou[i.status]-Ou[o.status]||n.slot(i.slot).localeCompare(n.slot(o.slot)));return s.jsxs(Qa,{id:"org-chart-project",title:"This project",description:nL,children:[s.jsxs("div",{className:"flex flex-wrap items-baseline gap-2",children:[s.jsx("span",{className:"text-muted-foreground text-xs",children:"Owning team"}),s.jsx("span",{className:"text-sm font-medium",children:n.team(e.team)})]}),s.jsx(ut,{className:"mt-3 overflow-x-auto",children:s.jsxs(Ye,{containerAriaLabel:"Slots in this project",children:[s.jsx(We,{children:s.jsxs(ue,{children:[s.jsx(W,{children:"Slot"}),s.jsx(W,{children:"Status"}),s.jsx(W,{children:"Bound to"}),s.jsx(W,{children:"Source"}),a?s.jsx(W,{className:"text-right",children:s.jsx("span",{className:"sr-only",children:"Actions"})}):null]})}),s.jsxs(Fe,{children:[l.map(i=>{const o=$u[i.status];return s.jsxs(ue,{"data-testid":"org-chart-project-slot",children:[s.jsxs(Y,{children:[s.jsx("div",{className:"font-medium",children:n.slot(i.slot)}),r.has(i.slot)?s.jsx("div",{className:"text-muted-foreground text-xs",children:r.get(i.slot)}):null]}),s.jsx(Y,{children:s.jsx(ce,{variant:o.tone,children:o.label})}),s.jsx(Y,{children:s.jsx(aL,{binding:i,names:n})}),s.jsx(Y,{children:s.jsx(rL,{binding:i})}),a?s.jsx(Y,{className:"text-right",children:s.jsx(P,{type:"button",variant:"ghost",size:"control-icon","aria-label":i.source==="override"?`Edit the override of ${n.slot(i.slot)}`:`Override ${n.slot(i.slot)}`,onClick:()=>a.override(i.slot),children:s.jsx(ld,{className:"size-3.5","aria-hidden":"true"})})}):null]},i.slot)}),l.length===0?s.jsx(ue,{children:s.jsx(Y,{colSpan:a?5:4,className:"text-muted-foreground h-24 text-center",children:"This org has no slots yet."})}):null]})]})}),a?s.jsxs("div",{className:"mt-3 grid max-w-2xl gap-2",children:[s.jsxs("p",{className:"text-muted-foreground text-sm",children:["Overrides made here are made as ",s.jsx("span",{className:"font-mono",children:"person:user"}),", as sdlc org makes them without --as: that person must hold the lead post of the owning team or of a team above it."]}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Change the owning team with sdlc org:"}),s.jsx(cl,{children:Gf[0]})]}):s.jsxs("div",{className:"mt-3 grid max-w-2xl gap-2",children:[s.jsx("p",{className:"text-muted-foreground text-sm",children:"Change the owning team or a slot's binding with sdlc org; a lead post of the owning team or a team above it may:"}),Gf.map(i=>s.jsx(cl,{children:i},i))]})]})}function aL({binding:e,names:t}){const n=[];e.status==="covered"&&e.needs_person&&n.push("Needs a person");for(const r of e.posts)r.off_description&&n.push(`${t.post(r.post)} does not fill ${t.slot(e.slot)} in its job description`);e.stale_posts&&n.push(e.stale_posts===1?"One post this override names is no longer in the org":`${e.stale_posts} posts this override names are no longer in the org`);let a;return e.posts.length===0?a=e.source==="override"?"The override names no post the org still has":"No job function fills this slot":e.status==="vacant"?a=`${e.posts.map(r=>t.post(r.post)).join(", ")} has no holder`:a=e.posts.map(r=>r.holders.length?`${t.post(r.post)}: ${r.holders.map(t.member).join(", ")}`:`${t.post(r.post)}: no holder`).join("; "),s.jsxs(s.Fragment,{children:[a,n.map(r=>s.jsx("div",{className:"text-muted-foreground text-xs",children:r},r))]})}function rL({binding:e}){var a;if(e.source==="baseline")return s.jsx(s.Fragment,{children:"From job descriptions"});const t=(a=e.set_by)==null?void 0:a.split(":").slice(1).join(":"),n=[e.reason,[t,e.set_at?Pn(e.set_at):null].filter(Boolean).join(", ")].filter(Boolean).join(" · ");return s.jsxs(s.Fragment,{children:["Override",n?s.jsx("div",{className:"text-muted-foreground text-xs",children:n}):null]})}const lL={breaking:"Breaking",new:"New",improved:"Improved",other:"Other changes"},iL=["breaking","new","improved","other"],oL={http_operation:"API",rpc_operation:"API",graphql_operation:"API",async_operation:"Event",page:"Page",ui_frame:"Screen",ui_component_definition:"Component",table:"Data",function:"Function"};function s1(e){return oL[e]??e.replace(/_/g," ")}function cL(e){return e.bump==="major"?"breaking":e.change==="added"?"new":e.change==="changed"?"improved":"other"}function ro(e){const t=new Map;let n=0,a=0;for(const l of e){if(l.modeling_only){a+=1;continue}if(!l.bump){n+=1;continue}const i=cL(l);t.set(i,[...t.get(i)??[],l])}return{sections:iL.filter(l=>t.has(l)).map(l=>({key:l,label:lL[l],lines:t.get(l)})),breaking:t.has("breaking"),unlisted_count:n,modeling_only_count:a}}function uL(e,t){const n=[`## ${e}`];t.sections.length===0&&n.push("","No change affects the version.");for(const a of t.sections){n.push("",`### ${a.label}`,"");for(const r of a.lines){const l=r.why?`: ${r.why}`:"";n.push(`- ${r.label} (${s1(r.node_type)})${l}`)}}return`${n.join(`
391
+ `)}
392
+ `}const Ds="candidate";function Cx(e){return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}const dL="Versioned records of this project's release branch, with notes from its graph changes.";function a1({description:e=dL,actions:t}){return s.jsx(Jt,{title:"Releases",description:e,actions:t})}function r1(e){var l;if(!e)return"";const t=(l=e.previous_release)==null?void 0:l.version,n=Number(e.version.split("-rc.")[1]??0),a=e.commits_since??n,r=`${e.commits_since===null?"At least ":""}${a} commit${a===1?"":"s"}`;return t?`${r} since ${t}`:`${r} before the first Release`}function Lc({active:e,onClick:t,version:n,badges:a,caption:r,item_ref:l}){return s.jsxs("button",{ref:l,type:"button","aria-current":e?"true":void 0,onClick:t,className:le("focus-visible:ring-ring flex flex-col gap-0.5 rounded-md px-3 py-2 text-left outline-none focus-visible:ring-2",e?"bg-muted":"hover:bg-muted/60"),children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-2 text-sm font-medium",children:[s.jsx("span",{className:"truncate",children:n}),a]}),s.jsx("span",{className:"text-muted-foreground text-xs",children:r})]})}function Hn({children:e}){return s.jsx("section",{className:"border-border flex flex-col gap-4 rounded-xl border p-4",children:e})}function qn({title:e,error:t,onRetry:n}){return s.jsxs(me,{variant:"destructive",children:[s.jsx(Xt,{}),e?s.jsx(je,{children:e}):null,s.jsxs(ge,{className:"flex flex-col items-start gap-2",children:[t,n?s.jsx(P,{variant:"outline",size:"sm",onClick:n,children:"Try again"}):null]})]})}function fL({title:e,text:t}){return s.jsx(Hn,{children:s.jsxs("div",{className:"flex flex-col items-center gap-2 py-10 text-center",children:[s.jsx(rd,{className:"text-muted-foreground size-8","aria-hidden":!0}),s.jsx("h2",{className:"text-lg font-semibold",tabIndex:-1,children:e}),s.jsx("p",{className:"text-muted-foreground max-w-md text-sm",children:t})]})})}function hL(e,t){const n=t??"The release branch";return{title:e?`Nothing new since ${e}`:"Nothing to release yet",text:e?`${n}'s head is the commit ${e} was written at. Commits to ${n} make the next candidate.`:`${n} has no commits yet.`}}function Du({changes:e}){const t=u.useMemo(()=>ro(e),[e]),[n,a]=u.useState(!1),r=t.unlisted_count+t.modeling_only_count;return s.jsxs("div",{className:"flex flex-col gap-4",children:[t.sections.map(l=>{const i=s.jsx("ul",{className:"flex flex-col gap-2",children:l.lines.map(o=>s.jsx(ly,{line:o},`${o.node_id}:${o.change}`))});return l.key==="breaking"?s.jsxs(me,{variant:"destructive",className:"border-destructive/40",children:[s.jsx(Xt,{}),s.jsx(je,{children:s.jsx("h3",{className:"text-destructive text-sm font-semibold",children:l.label})}),s.jsx(ge,{className:"text-foreground",children:i})]},l.key):s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h3",{className:"text-sm font-semibold",children:l.label}),i]},l.key)}),s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("h3",{className:"text-sm font-semibold",children:"Fixed"}),s.jsx("p",{className:"text-muted-foreground text-xs",children:"Fixes that changed no part of the graph are not recorded yet; they arrive with landing notes."})]}),t.sections.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:"No change affects the version."}):null,r>0?s.jsxs("p",{className:"text-muted-foreground text-sm",children:[r," more change",r===1?"":"s"," do",r===1?"es":""," not affect the version."]}):null,e.length>0?s.jsx(P,{variant:"link",size:"sm",className:"self-start px-0","aria-expanded":n,onClick:()=>a(l=>!l),children:n?"Hide all changes":"Show all changes"}):null,n?s.jsx("ul",{className:"flex flex-col gap-2",children:e.map(l=>s.jsx(ly,{line:l,detail:!0},`all:${l.node_id}:${l.change}:${l.modeling_only}`))}):null]})}function ly({line:e,detail:t=!1}){const n=t?e.modeling_only?"modeling only: shipped before, left out of the version":e.why??`${e.change}; does not affect the version`:e.why;return s.jsxs("li",{className:"flex flex-col gap-0.5",children:[s.jsxs("span",{className:"flex flex-wrap items-center gap-2 text-sm font-medium",children:[e.label,s.jsx(ce,{variant:"outline",children:s1(e.node_type)})]}),n?s.jsx("span",{className:"text-muted-foreground text-xs",children:n}):null]})}const l1="Releases of this checkout: the roadmap of open Planned Releases, the next candidate, and each production release with its notes.",iy=5,ym="Not available",jm="planned:";function i1(){const e=ls();return s.jsx("p",{className:"text-muted-foreground text-sm",children:`${ym}. ${e}`})}const ts=e=>`${jm}${e}`,mL=e=>e!=null&&e.startsWith(jm)?e.slice(jm.length):null,Rx=e=>e?e.slice(0,7):"";function pL(e){return e?{title:`Nothing new since ${e}`,text:"Production runs what staging runs. Landings promoted to staging make the next candidate."}:{title:"Nothing to release yet",text:"Staging has run nothing production lacks."}}function xL(){return s.jsxs(me,{variant:"info",children:[s.jsx(ws,{}),s.jsx(je,{children:"This page only reads Releases"}),s.jsx(ge,{className:"text-info",children:"A Release is written when production runs a release candidate, once its commit is merged into origin/main."})]})}function gL(e){if(e.state==="unreadable")return{badges:s.jsx(ce,{variant:"error",children:"Could not be read"}),caption:""};if(e.state==="withdrawn")return{badges:s.jsx(ce,{variant:"warning",children:"Withdrawn"}),caption:e.replaced_by?`Replaced by ${e.replaced_by}`:"Withdrawn"};const t=s.jsxs(s.Fragment,{children:[s.jsx(ce,{variant:"neutral",children:e.app_changed===!1?"App unchanged":e.previous_release_id?e.bump??"patch":"First"}),e.breaking?s.jsx(ce,{variant:"error",children:"Breaking"}):null]}),n=e.written_at?Cx(e.written_at):"",a=e.tracks&&e.tracks.length>0?` · ${e.tracks.join(", ")}`:"";return{badges:t,caption:`${n}${a}`}}function ar({query:e,select:t,onSelect:n,children:a,inline:r=!1}){return s.jsx("a",{href:`?${e}`,className:r?"text-primary underline":"text-primary hover:underline",onClick:l=>{l.preventDefault(),n(t)},children:a})}function Od({pairs:e}){const t=e.filter(([,n])=>n!=null&&n!=="");return t.length===0?null:s.jsx("dl",{className:"grid grid-cols-[max-content_1fr] gap-x-6 gap-y-1 text-sm",children:t.map(([n,a])=>s.jsxs(u.Fragment,{children:[s.jsx("dt",{className:"text-muted-foreground",children:n}),s.jsx("dd",{className:"min-w-0",children:a})]},n))})}const bs=({children:e})=>s.jsx("code",{className:"font-mono text-xs",children:e});function o1(e,t){if(e.judged_commit&&t&&e.judged_commit!==t)return`Judged ${Rx(e.judged_commit)}, not this commit`;const n=e.verdict==="ready"?"Ready":e.verdict==="untested"?"Nothing tested yet":"Not ready",a=e.accepted>0?` · ${e.accepted} failed, accepted`:"";return`${n} · ${e.satisfied} of ${e.total} satisfied${a}`}function Dd({title:e,count:t,heading_ref:n}){return s.jsxs("div",{className:"flex items-baseline gap-2",children:[s.jsx("h2",{ref:n,tabIndex:-1,className:"text-lg font-semibold outline-none",children:e}),t!==void 0?s.jsx("span",{className:"text-muted-foreground text-xs",children:t}):null]})}const vL={ready:"success",verifying:"info",fixing:"warning",abandoned:"warning",ready_older:"neutral",none:"neutral",unknown:"neutral"};function yL({batch:e}){if(e.state==="loading")return s.jsxs(me,{children:[s.jsx(gu,{}),s.jsxs(ge,{className:"flex flex-row items-center gap-2",role:"status",children:[s.jsx(Qt,{"aria-hidden":!0})," Reading the release batch…"]})]});const t=e.state==="ready"?e.value:{state:"unknown",chip:"Batch unknown",text:`The release batch could not be read: ${e.error}`,help:null};return s.jsxs(me,{children:[s.jsx(gu,{}),s.jsxs(je,{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{children:t.text}),s.jsx(ce,{variant:vL[t.state],children:t.chip})]}),t.help?s.jsx(ge,{children:t.help}):null]})}function jL(e,t,n){return`/org/${e}/issues/${encodeURIComponent(t)}?from=${encodeURIComponent(n)}`}function c1({issues:e,error:t}){return t?s.jsx(qn,{title:"Known issues could not be read",error:t}):!e||e.length===0?null:s.jsxs("section",{className:"flex flex-col gap-2",children:[s.jsx(Dd,{title:"Known issues",count:e.length}),s.jsx("ul",{className:"flex flex-col gap-2",children:e.map(n=>s.jsxs("li",{className:"flex flex-col gap-0.5 text-sm",children:[s.jsxs("span",{children:[n.id,": ",n.title]}),n.accepted_by?s.jsxs("span",{className:"text-muted-foreground text-xs",children:["accepted by ",n.accepted_by]}):null,n.file?s.jsx(bs,{children:n.file}):null]},n.key))})]})}function u1({tracks:e,error:t}){return t?s.jsx(qn,{title:"Tracks could not be read",error:t}):!e||e.length===0||e.length===1&&e[0].key==="app"?null:s.jsxs("section",{className:"flex flex-col gap-3",children:[s.jsx(Dd,{title:"Tracks",count:e.length}),e.map(n=>n.key==="app"||n.released_by==="release_batch"?s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsxs("span",{className:"flex flex-wrap items-center gap-2 text-sm font-medium",children:[n.label,n.version?s.jsx(bs,{children:n.version}):null,n.bump?s.jsx(ce,{variant:"neutral",children:n.bump}):null]}),s.jsx("span",{className:"text-muted-foreground text-xs",children:"Released with the release batch"})]},n.key):s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("span",{className:"flex flex-wrap items-center gap-2 text-sm font-medium",children:[n.label,s.jsxs("span",{className:"text-muted-foreground text-xs",children:[n.packages.length," package",n.packages.length===1?"":"s"]})]}),s.jsx("ul",{className:"flex flex-col gap-1",children:n.packages.map(a=>s.jsxs("li",{className:"flex flex-col gap-0.5",children:[s.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(bs,{children:a.name}),s.jsxs(bs,{children:[a.from??"—"," → ",a.to??"—"]})]}),a.changes.map((r,l)=>s.jsxs("span",{className:"text-muted-foreground text-xs",children:[r.feature,": ",r.entry]},l))]},a.name))}),n.published&&!n.published.recorded?s.jsxs("span",{className:"text-muted-foreground text-xs",children:[n.released_by??"Publish",": Not available. This Release does not say whether or when it moved latest."]}):null]},n.key))]})}function d1({delivery:e,candidate:t,onSelect:n}){if(!e||e.planned.length===0&&e.outside===0)return null;const a=r=>r.length===0?"—":r.map(l=>l.went?`${l.label} (${l.went})`:l.label).join(", ");return s.jsxs("section",{className:"flex flex-col gap-2",children:[s.jsx(Dd,{title:"Planned Releases",count:e.planned.length}),s.jsx("p",{className:"text-muted-foreground text-xs",children:t?"What this candidate would deliver":"What this Release delivered"}),e.planned.length>0?s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(Ye,{containerAriaLabel:"Planned Releases",children:[s.jsx(We,{children:s.jsxs(ue,{children:[s.jsx(W,{children:"Planned Release"}),s.jsx(W,{children:"Delivered"}),s.jsx(W,{children:"Not delivered"})]})}),s.jsx(Fe,{children:e.planned.map(r=>s.jsxs(ue,{children:[s.jsx(Y,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[r.open&&t?s.jsx(ar,{query:`planned=${encodeURIComponent(r.id)}`,select:ts(r.id),onSelect:n,children:r.name}):s.jsx("span",{children:r.name}),s.jsx(bs,{children:r.id})]})}),s.jsx(Y,{children:a(r.delivered)}),s.jsx(Y,{children:a(r.not_delivered)})]},r.id))})]})}):null,e.outside>0?s.jsxs("p",{className:"text-muted-foreground text-xs",children:[e.outside," landing",e.outside===1?"":"s"," served no Planned Release."]}):null]})}const bL={thread:"Thread",task:"Task",issue:"Issue",test:"Test"};function f1({rows:e,org:t,from:n,untasked:a}){const{href:r,Link:l}=Ze(),[i,o]=u.useState(!1),c=i?e:e.slice(0,iy),d=f=>f.kind==="task"?s.jsx(l,{className:"text-primary font-mono text-xs hover:underline",href:r(`/org/${t}/tasks/${encodeURIComponent(f.id)}?from=${encodeURIComponent(n)}`),children:f.id}):f.kind==="issue"?s.jsx(l,{className:"text-primary font-mono text-xs hover:underline",href:r(jL(t,f.id,n)),children:f.id}):f.kind==="thread"?s.jsx(l,{className:"text-primary hover:underline",href:r(`${t?`/org/${t}`:""}/threads#thread-${encodeURIComponent(f.id)}`),children:f.label}):f.kind==="test"&&f.url?s.jsx("a",{className:"text-primary hover:underline",href:f.url,target:"_blank",rel:"noreferrer",children:f.label}):s.jsx("span",{children:f.label});return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(Ye,{containerAriaLabel:"Related",children:[s.jsx(We,{children:s.jsxs(ue,{children:[s.jsx(W,{children:"Kind"}),s.jsx(W,{children:"Item"}),s.jsx(W,{children:"How it relates"})]})}),s.jsx(Fe,{children:c.map(f=>s.jsxs(ue,{children:[s.jsx(Y,{children:bL[f.kind]}),s.jsx(Y,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[d(f),f.state&&f.kind!=="thread"?s.jsx("span",{className:"text-muted-foreground text-xs",children:f.state}):null]})}),s.jsx(Y,{children:f.relation})]},`${f.kind}:${f.id}`))})]})}),e.length>iy?s.jsx(P,{variant:"link",size:"sm",className:"self-start px-0","aria-expanded":i,onClick:()=>o(f=>!f),children:i?"Show fewer":`Show all ${e.length}`}):null,a?s.jsxs("p",{className:"text-muted-foreground text-xs",children:[a," landing",a===1?"":"s"," not tied to a task"]}):null]})}const h1=e=>(e==null?void 0:e.status)===409&&e.reason==="view_outdated";function m1(e){const t=Tx(),[n,a]=u.useState(t!=null&&t.related?{state:"loading"}:null),r=u.useRef(0),l=u.useCallback(async(i=!1)=>{if(!(t!=null&&t.related))return;const o=++r.current;a({state:"loading"});const c=await t.related(e,i?{fresh:!0}:void 0);o===r.current&&a(c.ok?{state:"ready",value:c.data}:{state:"error",error:c.refusal.message,refusal:c.refusal})},[t,e]);return u.useEffect(()=>{l()},[l]),{related:n,read:l}}function p1({related:e,org:t,from:n,onRetry:a}){const r=u.useRef(null),l=u.useRef(!1);if(u.useEffect(()=>{var o;l.current&&(e==null?void 0:e.state)!=="loading"&&(l.current=!1,(o=r.current)==null||o.focus())},[e]),!e)return null;const i=e.state==="ready"?e.value.rows.length:void 0;return s.jsxs("section",{className:"flex flex-col gap-2","aria-labelledby":"release-related",children:[s.jsxs("div",{className:"flex items-baseline gap-2",children:[s.jsx("h2",{id:"release-related",ref:r,tabIndex:-1,className:"text-lg font-semibold outline-none",children:"Related"}),i!==void 0?s.jsx("span",{className:"text-muted-foreground text-xs",children:i}):null]}),e.state==="loading"?s.jsxs("div",{className:"grid gap-2",role:"status","aria-label":"Loading related work",children:[s.jsx(_t,{className:"h-8 w-full"}),s.jsx(_t,{className:"h-8 w-full"}),s.jsx(_t,{className:"h-8 w-2/3"})]}):e.state==="error"?h1(e.refusal)?s.jsx(i1,{}):s.jsx(qn,{title:"Related work could not be read",error:e.error,onRetry:()=>{l.current=!0,a()}}):e.value.rows.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing related yet."}):s.jsx(f1,{rows:e.value.rows,org:t,from:n,untasked:e.value.untasked})]})}function wL(e){if(!e||e.of===0)return null;if(e.tasks===0)return s.jsx("span",{className:"text-muted-foreground",children:"none"});const t=Object.entries(e.outcomes);return s.jsxs("span",{children:[e.tasks," of ",e.of," tasks",t.map(([n,a])=>s.jsxs("span",{className:n==="failed"?"text-destructive":void 0,children:[" · ",a," ",n]},n))]})}function x1({planned:e,onSelect:t}){return e?e.open?s.jsx(ar,{query:`planned=${encodeURIComponent(e.id)}`,select:ts(e.id),onSelect:t,children:e.name}):s.jsxs("span",{children:[e.name," ",s.jsx(bs,{children:e.id})]}):null}function _L({candidate:e,org:t,onSelect:n,notes:a}){const r=Tx(),{related:l,read:i}=m1("candidate"),[o,c]=u.useState(r!=null&&r.candidateBatch?{state:"loading"}:null);u.useEffect(()=>{if(!(r!=null&&r.candidateBatch))return;let f=!0;return r.candidateBatch().then(h=>{f&&(h.ok?c(h.data.batch===null?null:{state:"ready",value:h.data.batch}):c({state:"error",error:h.refusal.message}))}),()=>{f=!1}},[r]);const d=e.readiness??((l==null?void 0:l.state)==="ready"?l.value.readiness:null)??null;return s.jsxs(s.Fragment,{children:[s.jsx(Od,{pairs:[["Environment",e.environment??"staging"],["Commit",s.jsx(bs,{children:Rx(e.head_commit_id)},"commit")],["Readiness",d?o1(d,e.head_commit_id):null],["Planned",e.planned_release?s.jsx(x1,{planned:e.planned_release,onSelect:n}):null]]}),o?s.jsx(yL,{batch:o}):null,a,s.jsx(c1,{issues:e.known_issues,error:e.known_issues_error}),s.jsx(u1,{tracks:e.tracks,error:e.tracks_error}),s.jsx(d1,{delivery:e.planned_delivery,candidate:!0,onSelect:n}),s.jsx(p1,{related:l,org:t,from:"release:candidate",onRetry:()=>i(!0)})]})}function NL({release:e,onSelect:t}){const n=e.label??e.version,a=!e.previous_release_id;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h2",{className:"text-lg font-semibold",children:n}),e.state==="withdrawn"?s.jsx(ce,{variant:"warning",children:"Withdrawn"}):s.jsx(ce,{variant:"neutral",children:e.app_changed===!1?"App unchanged":a?"First":e.bump}),e.breaking?s.jsx(ce,{variant:"error",children:"Breaking"}):null]}),e.state==="withdrawn"&&e.replaced_by?s.jsxs("p",{className:"text-sm",children:["Replaced by"," ",s.jsx(ar,{query:`release=${encodeURIComponent(e.replaced_by)}`,select:e.replaced_by,onSelect:t,inline:!0,children:e.replaced_by})]}):null]})}function kL({release:e,org:t,onSelect:n,notes:a}){const r=e.label??e.version,{related:l,read:i}=m1(r),o=(l==null?void 0:l.state)==="ready"?wL(l.value.previews):null;return s.jsxs(s.Fragment,{children:[s.jsx(Od,{pairs:[["Environment",e.environment??"production"],["Commit",e.commit?s.jsx(bs,{children:Rx(e.commit)},"commit"):null],["Readiness",e.readiness?`${o1(e.readiness)} on staging`:null],["Previews",o],["Planned",e.planned_release?s.jsx(x1,{planned:e.planned_release,onSelect:n}):null]]}),a,s.jsx(c1,{issues:e.known_issues,error:e.known_issues_error}),s.jsx(u1,{tracks:e.tracks,error:e.tracks_error}),s.jsx(d1,{delivery:e.planned_delivery,candidate:!1,onSelect:n}),s.jsx(p1,{related:l,org:t,from:`release:${r}`,onRetry:()=>i(!0)})]})}function SL({id:e,summary:t,org:n,onNotFound:a,forecast:r}){var x,b;const l=Tx(),[i,o]=u.useState({state:"loading"}),c=u.useRef(0),d=u.useCallback(async(v=!1)=>{const y=++c.current;if(!(l!=null&&l.plannedRelease)){o({state:"error",error:ym,refusal:{status:409,message:ym,reason:"view_outdated"}});return}o({state:"loading"});const g=await l.plannedRelease(e,v?{fresh:!0}:void 0);y===c.current&&o(g.ok?{state:"ready",value:g.data}:{state:"error",error:g.refusal.message,refusal:g.refusal})},[l,e]);u.useEffect(()=>{d()},[d]);const f=i.state==="error"&&(((x=i.refusal)==null?void 0:x.status)===404||((b=i.refusal)==null?void 0:b.reason)==="not_found");if(u.useEffect(()=>{f&&a()},[f,a]),i.state==="loading")return s.jsxs(Hn,{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h2",{className:"text-lg font-semibold",children:(t==null?void 0:t.name)??e}),s.jsx(ce,{variant:"neutral",children:"Planned"})]}),s.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:"Loading the Planned Release…"})]});if(i.state==="error")return s.jsxs(Hn,{children:[s.jsx("h2",{className:"text-lg font-semibold",children:(t==null?void 0:t.name)??e}),h1(i.refusal)?s.jsx(i1,{}):f?null:s.jsx(qn,{error:i.error,onRetry:()=>void d(!0)})]});const h=i.value,m=h.order===null?null:h.order===1?`Next of ${h.open} open`:`${h.order} of ${h.open} open`;return s.jsxs(Hn,{children:[s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h2",{className:"text-lg font-semibold",children:h.name}),s.jsx(ce,{variant:"neutral",children:"Planned"})]}),h.goal?s.jsx("p",{className:"text-muted-foreground text-sm",children:h.goal}):null]}),s.jsx(Od,{pairs:[["Planned Release",s.jsx(bs,{children:h.id},"id")],["Date",h.date],["Order",m],["Members",String(h.members.length)]]}),r,s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:"A Planned Release changes through release_plan.py:"}),s.jsxs("pre",{className:"bg-muted rounded-md px-3 py-2 font-mono text-xs",children:["sdlc view --planned ",h.id]})]}),s.jsxs("section",{className:"flex flex-col gap-2",children:[s.jsx(Dd,{title:"Members",count:h.members.length}),h.members.length>0?s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(Ye,{containerAriaLabel:"Members",children:[s.jsx(We,{children:s.jsxs(ue,{children:[s.jsx(W,{children:"Member"}),s.jsx(W,{children:"Level"}),s.jsx(W,{children:"Tasks"}),s.jsx(W,{children:"State"})]})}),s.jsx(Fe,{children:h.members.map(v=>{const y=v.tasks.filter(p=>p.state==="done").length,g=v.tasks.filter(p=>p.state!=="done").map(p=>p.id);return s.jsxs(ue,{children:[s.jsx(Y,{children:v.label}),s.jsx(Y,{children:v.level?s.jsx(ce,{variant:"neutral",children:CL(v.level)}):null}),s.jsx(Y,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[v.tasks.length>0?s.jsxs("span",{children:[y," of ",v.tasks.length," done"]}):null,g.length>0?s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Open: ",s.jsx(bs,{children:g.join(", ")})]}):null,v.untracked>0?s.jsxs("span",{className:"text-muted-foreground text-xs",children:[v.untracked," slice",v.untracked===1?" has":"s have"," no task yet"]}):null]})}),s.jsx(Y,{children:v.state})]},v.item)})})]})}):null]}),s.jsxs("section",{className:"flex flex-col gap-2","aria-labelledby":"planned-related",children:[s.jsxs("div",{className:"flex items-baseline gap-2",children:[s.jsx("h2",{id:"planned-related",className:"text-lg font-semibold",children:"Related"}),s.jsx("span",{className:"text-muted-foreground text-xs",children:h.related.length})]}),h.related.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing related yet."}):s.jsx(f1,{rows:h.related,org:n,from:`planned:${h.id}`})]})]})}const CL=e=>e.charAt(0).toUpperCase()+e.slice(1);function Tx(){return un().releases}const Qn={noRelease:"No open Planned Release. Create one: release_plan.py create --name <version>",noTask:"no open task of yours",noNext:"none",pending:"reading the roadmap",failedLead:"The roadmap could not be read",noEngineLead:"this engine has no roadmap read"},oy=3,RL=["in_progress","not_started","planned","blocked"],Ex="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),Rt=e=>e.charAt(0).toUpperCase()+e.slice(1);function Vf(e){const t=/^(\d{4})-(\d{2})-(\d{2})/.exec(String(e??""));return t?`${Number(t[3])} ${Ex[Number(t[2])-1]}`:String(e??"")}function g1(e){if(typeof e!="number")return"";const t=new Date(e*1e3);return Number.isNaN(t.getTime())?"":`${t.getDate()} ${Ex[t.getMonth()]} ${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function TL(e){if(typeof e!="number")return"";const t=new Date(e*1e3);return Number.isNaN(t.getTime())?"":`${t.getDate()} ${Ex[t.getMonth()]}`}function zs(e){return e?e.from===e.to&&e.or_later?`${Vf(e.from)} or later`:`${Vf(e.from)} to ${Vf(e.to)}${e.or_later?", or later":""}`:""}function EL(e){if(!e||!e.members)return"";const t=[`${e.sized??0} of ${e.members} members sized (${e.estimated??0} estimated, ${e.predicted??0} predicted)`];return e.not_sized&&t.push(`${e.not_sized} not sized`),t.join(" · ")}function v1(e){var h;const t=e??{},n=t.source??{},r=[t.no_date==="no date: no rate"&&n.rate_why?n.rate_why:"",/members estimated$/.test(t.no_date??"")?"":EL(t)].filter(Boolean).join(" · "),l=t.projected?zs(t.projected):t.no_date??"",i=(h=t.projected)==null?void 0:h.raw,o=!!(i&&t.projected&&(i.from!==t.projected.from||i.to!==t.projected.to)),c=t.projected?n.rate_basis==="release"?"at this release's own rate":n.rate_basis==="machine"?`at the machine's rate${n.rate_why?`: ${n.rate_why}`:""}`:"":"",d=t.track_record,f=[r,c,o&&i&&t.projected?`corrected for past estimates: raw ${zs({...i,or_later:t.projected.or_later})}`:"",d?`past forecasts at this coverage: ${d.inside} of ${d.of} inside their range`:""].filter(Boolean);return{lead:l?Rt(l):"",caption:f}}function AL(e){const t=e.kinds??[];return[t.includes("range")?"Not promised":"",e.goal??(t.includes("major")?"No goal yet":"")].filter(Boolean).join(" · ")}function ML(e){var c,d,f,h;const t=((c=e.counts)==null?void 0:c.members)??0,n=`${((d=e.counts)==null?void 0:d.done)??0} of ${t} member${t===1?"":"s"} done`,a=(e.blocked??[]).length,r=(e.needs_user??[]).length,l=!a&&!r?["none blocked · none waiting on you"]:[a?`${a} blocked`:"",r?`${r} waiting on you`:""],i=((f=e.tasks)==null?void 0:f.untracked_slices)??0;i&&l.push(`${i} slice${i===1?"":"s"} not tasks yet`);const o=((h=e.not_a_member)==null?void 0:h.count)??0;return o&&l.push(`${o} not a member yet`),{lead:n,rest:l.filter(Boolean).join(" · ")}}const y1=e=>String(e??"").replace(/_/g," ");function $L(e){const t=e??{},n=t.kinds??[],a=n.includes("slipped"),r=!a&&t.was&&t.now?zs(t.was)===zs(t.now)?`, range still ${zs(t.now)}`:`, range was ${zs(t.was)}, now ${zs(t.now)}`:"",l=[a&&t.was?`was ${zs(t.was)}`:"",n.includes("scope changed")?`scope changed${r}`:""].filter(Boolean),i=(t.what??[]).slice(-3).map(o=>{const c=o.by&&(o.by.title||o.by.thread||o.by.person);return`${[o.kind,o.label||o.item].filter(Boolean).join(" ")}${c?` by ${c}`:""}${o.why?`: ${o.why}`:""}`});return{head:l.length?Rt(l.join(" · ")):"",what:i}}const ul="roadmap",cy={reading:!1,value:null,refusal:null};function OL(e){const[t,n]=u.useState({all:cy,mine:cy}),a=u.useRef({all:0,mine:0}),r=u.useCallback(async(l,i=!1)=>{if(!(e!=null&&e.roadmap))return;const o=++a.current[l];n(d=>({...d,[l]:{...d[l],reading:!0}}));const c=await e.roadmap({...i?{fresh:!0}:{},...l==="mine"?{mine:!0}:{}});o===a.current[l]&&n(d=>({...d,[l]:c.ok?{reading:!1,value:c.data,refusal:null}:{reading:!1,value:d[l].value,refusal:c.refusal}}))},[e]);return{reads:t,read:r,available:!!(e!=null&&e.roadmap)}}function DL(e,t){return`${e} open${t.length?` · ${t.join(", ")} moved since you looked`:""}`}function Di({children:e}){return s.jsx("pre",{className:"bg-muted text-foreground rounded-md px-3 py-2 font-mono text-xs break-all whitespace-pre-wrap",children:e})}const j1=({level:e})=>e?s.jsx(ce,{variant:"neutral",children:Rt(e)}):null;function b1({state:e}){const t=Rt(y1(e));return RL.includes(String(e))?s.jsx("span",{className:"font-medium",children:t}):s.jsx("span",{children:t})}function zL({reads:e,scope:t,onScope:n,onRead:a,org:r,onSelect:l}){var x,b;const i=e[t],o=i.value,c=ls(),d=u.useRef(null),f=u.useRef(!1);u.useEffect(()=>{!i.reading&&!i.value&&!i.refusal&&a(t)},[t,i.reading,i.value,i.refusal,a]),u.useEffect(()=>{var v;f.current&&!i.reading&&(f.current=!1,(v=d.current)==null||v.focus())},[i.reading]);const h=()=>{f.current=!0,a(t,!0)},m=o?[o.as_of?`as of ${g1(o.as_of)}`:"",`${((x=o.source)==null?void 0:x.machine)||"this machine"}'s records`,((b=o.decider)==null?void 0:b.words)??""].filter(Boolean).join(" · "):"";return s.jsxs(Hn,{children:[s.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[s.jsx("h2",{ref:d,tabIndex:-1,className:"text-lg font-semibold outline-none",children:"Roadmap"}),m?s.jsx("p",{className:"text-muted-foreground text-xs",children:m}):null]}),s.jsx("div",{role:"group","aria-label":"Roadmap scope",className:"flex gap-2",children:["all","mine"].map(v=>s.jsx(P,{variant:"outline",size:"sm","aria-pressed":t===v,onClick:()=>n(v),children:v==="all"?"All":"Mine"},v))})]}),s.jsx("div",{"aria-live":"polite",children:i.reading?s.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status",children:[s.jsx(Qt,{"aria-hidden":!0,className:"size-4"})," ",Rt(Qn.pending),"…"]}):null}),i.refusal&&!i.reading?i.refusal.reason==="no_roadmap"?s.jsx(qn,{title:Qn.failedLead,error:`${Rt(Qn.noEngineLead)}. ${c}`}):i.refusal.reason==="refused"?s.jsx(qn,{title:Qn.failedLead,error:i.refusal.message}):s.jsx(qn,{title:Qn.failedLead,error:i.refusal.message,onRetry:h}):null,o?t==="mine"?s.jsx(qL,{mine:o.mine,org:r,onSelect:l}):s.jsx(UL,{read:o,org:r,onSelect:l}):null]})}function LL(e){if(!e||typeof e.seconds_per_day!="number")return"No rate";const t=TL(e.as_of);return`${Math.round(e.seconds_per_day/3600)} task hours a day over the ${e.days} days${t?` to ${t}`:""}`}function UL({read:e,org:t,onSelect:n}){var r,l;const a=e.releases??[];if(!a.length){const[i,o]=Qn.noRelease.split(" Create one: ");return s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("p",{className:"text-sm",children:i}),s.jsx("p",{className:"text-muted-foreground text-xs",children:"Create one in the terminal:"}),s.jsx(Di,{children:o})]})}return s.jsxs(s.Fragment,{children:[s.jsx(Od,{pairs:[["Forecast from",Rt(`${((r=e.source)==null?void 0:r.machine)||"this machine"}'s task records and rate`)],["Rate",LL(e.rate)],["Not counted",Rt(((l=e.source)==null?void 0:l.not_counted)||"other machines' work")]]}),a.map(i=>s.jsx(BL,{row:i,org:t,onSelect:n},i.id))]})}function BL({row:e,org:t,onSelect:n}){var h,m,x;const a=v1(e.forecast),r=ML(e),l=AL(e),i=`roadmap-${e.id}`,o=e.moved?$L(e.told):null,c=(((h=e.counts)==null?void 0:h.members)??0)===0,d=((m=e.not_a_member)==null?void 0:m.count)??0,f=[l,c&&d?`${d} not a member yet`:""].filter(Boolean).join(" · ");return s.jsxs("section",{"aria-labelledby":i,className:"flex flex-col gap-2 border-t pt-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h3",{id:i,className:"text-base font-semibold",children:s.jsx(ar,{query:`planned=${encodeURIComponent(e.id)}`,select:ts(e.id),onSelect:n,children:e.name})}),e.kinds.map(b=>s.jsx(ce,{variant:"neutral",children:b},b))]}),a.lead||a.caption.length?s.jsxs("div",{className:"flex flex-col gap-0.5",children:[a.lead?s.jsx("p",{className:"text-sm",children:a.lead}):null,a.caption.length?s.jsx("p",{className:"text-muted-foreground text-xs",children:Rt(a.caption.join(" · "))}):null]}):null,f?s.jsx("p",{className:"text-muted-foreground text-sm",children:f}):null,o?s.jsxs(me,{variant:"info",children:[s.jsx(IR,{"aria-hidden":!0}),s.jsx(je,{children:"Moved since you looked"}),s.jsxs(ge,{className:"text-info flex flex-col gap-0.5",children:[o.head?s.jsx("span",{children:o.head}):null,o.what.map((b,v)=>s.jsx("span",{className:"text-xs",children:b},v))]})]}):null,c?null:s.jsxs("p",{className:"text-sm",children:[r.lead,r.rest?s.jsxs("span",{className:"text-muted-foreground",children:[" · ",r.rest]}):null]}),(x=e.stale_unchecked)!=null&&x.words?s.jsx("p",{className:"text-muted-foreground text-xs",children:Rt(e.stale_unchecked.words)}):null,e.for_you&&e.kinds.includes("major")?s.jsx(HL,{row:e}):null,s.jsx(PL,{row:e,org:t})]})}function HL({row:e}){const t=e.for_you;return!t||!t.proposals.length&&!t.committed_nobody_on.length&&!t.widens_most&&!t.set_goal?null:s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h4",{className:"text-sm font-semibold",children:"For you"}),t.proposals.map(a=>{const r=[a.proposed_by_title||a.proposed_by?`by ${a.proposed_by_title||a.proposed_by}`:"",a.reason??""].filter(Boolean).join(": ");return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("p",{className:"text-sm",children:["Proposed: ",a.label||a.item]}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[r?`${Rt(r).replace(/\.$/,"")}. `:"","Accept or reject in the terminal:"]}),s.jsx(Di,{children:a.accept}),s.jsx(Di,{children:a.reject})]},a.item)}),t.committed_nobody_on.map(a=>s.jsxs("p",{className:"text-sm",children:["Nobody on this machine is on ",a.label||a.item,a.level?` (${a.level})`:""]},a.item)),t.widens_most?s.jsxs("p",{className:"text-sm",children:["Widens the range most: ",t.widens_most.label||t.widens_most.item,t.widens_most.high_seconds?s.jsxs("span",{className:"text-muted-foreground",children:[" · +",Math.round(t.widens_most.high_seconds/3600)," h of work at the late end"]}):null]}):null,t.set_goal?s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("p",{className:"text-sm",children:"Set its goal:"}),s.jsx(Di,{children:t.set_goal})]}):null]})}function w1({next:e,org:t}){const{href:n,Link:a}=Ze(),r=e.tasks[0],l=e.label||e.item;return r?s.jsx(a,{className:"text-primary hover:underline",href:n(`/org/${t}/tasks/${encodeURIComponent(r.id)}?from=roadmap`),children:l}):s.jsx("span",{children:l})}function IL(e,t){return e.threads.length?e.threads.map(n=>n.title||n.thread).join(", "):t.kinds.includes("range")?(t.tagged_threads??[]).map(n=>`${n.title}: ${n.words}`).join(", "):e.nobody?Rt(e.nobody):""}function PL({row:e,org:t}){const[n,a]=u.useState(!1),r=e.next??[];if(!r.length){const o=e.kinds.includes("range")?e.tagged_threads??[]:[];return o.length?s.jsx("p",{className:"text-muted-foreground text-sm",children:o.map(c=>`${c.title}: ${c.words}`).join(", ")}):null}const l=n?r:r.slice(0,oy),i=new Map((e.stale_estimates??[]).map(o=>[o.item,o]));return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("h4",{className:"text-sm font-semibold",children:"Next"}),s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(Ye,{containerAriaLabel:`Next in ${e.name}`,children:[s.jsx(We,{children:s.jsxs(ue,{children:[s.jsx(W,{children:"Member"}),s.jsx(W,{children:"Level"}),s.jsx(W,{children:"State"}),s.jsx(W,{children:"Who is on it"})]})}),s.jsx(Fe,{children:l.map(o=>{const c=i.get(o.item);return s.jsxs(ue,{children:[s.jsx(Y,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx(w1,{next:o,org:t}),c?s.jsxs("span",{className:"text-muted-foreground text-xs",children:[Rt(c.words),c.estimate_as_of?` (estimated ${g1(c.estimate_as_of)})`:""]}):null]})}),s.jsx(Y,{children:s.jsx(j1,{level:o.level})}),s.jsx(Y,{children:s.jsx(b1,{state:o.state})}),s.jsx(Y,{children:IL(o,e)})]},o.item)})})]})}),r.length>oy&&!n?s.jsxs(P,{variant:"outline",size:"sm",className:"self-start",onClick:()=>a(!0),children:["Show all ",r.length]}):null,l.some(o=>i.has(o.item))?s.jsx("p",{className:"text-muted-foreground text-xs",children:"Re-forecast it in the terminal: task-record reforecast"}):null]})}function qL({mine:e,org:t,onSelect:n}){const{href:a,Link:r}=Ze();if(!e)return null;const l=e.tasks.filter(i=>i.propose);return s.jsxs(s.Fragment,{children:[s.jsxs("section",{"aria-labelledby":"roadmap-your-work",className:"flex flex-col gap-2",children:[s.jsxs("div",{className:"flex items-baseline gap-2",children:[s.jsx("h3",{id:"roadmap-your-work",className:"text-base font-semibold",children:"Your work"}),s.jsx("span",{className:"text-muted-foreground text-xs",children:e.title})]}),e.tasks.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:Rt(Qn.noTask)}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(Ye,{containerAriaLabel:"Your work",children:[s.jsx(We,{children:s.jsxs(ue,{children:[s.jsx(W,{children:"Task"}),s.jsx(W,{children:"Release"}),s.jsx(W,{children:"Member"})]})}),s.jsx(Fe,{children:e.tasks.map(i=>{var o,c;return s.jsxs(ue,{children:[s.jsx(Y,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx(r,{className:"text-primary font-mono text-xs hover:underline",href:a(`/org/${t}/tasks/${encodeURIComponent(i.id)}?from=roadmap`),children:i.id}),s.jsx("span",{className:"text-muted-foreground text-xs",children:[i.title||i.thread,Rt(y1(i.state))].filter(Boolean).join(" · ")})]})}),s.jsx(Y,{children:(o=i.members)!=null&&o.length?i.members.map(d=>s.jsx("div",{children:s.jsx(ar,{query:`planned=${encodeURIComponent(d.planned_release)}`,select:ts(d.planned_release),onSelect:n,children:d.name})},d.planned_release)):i.release?s.jsx(ar,{query:`planned=${encodeURIComponent(i.release.planned_release)}`,select:ts(i.release.planned_release),onSelect:n,children:i.release.name}):s.jsx("span",{className:"text-muted-foreground",children:i.words?Rt(i.words):"—"})}),s.jsx(Y,{children:(c=i.members)!=null&&c.length?i.members.map(d=>s.jsx(j1,{level:d.level},d.planned_release)):i.not_a_member?s.jsx("span",{className:"text-muted-foreground",children:"Not a member yet"}):null})]},i.id)})})]})}),l.map(i=>{var o;return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("p",{className:"text-muted-foreground text-xs",children:["Propose ",i.id,"'s plan to ",((o=i.release)==null?void 0:o.name)??"its release"," in the terminal:"]}),s.jsx(Di,{children:i.propose??""})]},i.id)})]}),s.jsxs("section",{"aria-labelledby":"roadmap-your-next",className:"flex flex-col gap-2",children:[s.jsx("h3",{id:"roadmap-your-next",className:"text-base font-semibold",children:"Your next members"}),e.next.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:Rt(Qn.noNext)}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(Ye,{containerAriaLabel:"Your next members",children:[s.jsx(We,{children:s.jsxs(ue,{children:[s.jsx(W,{children:"Release"}),s.jsx(W,{children:"Member"}),s.jsx(W,{children:"State"})]})}),s.jsx(Fe,{children:e.next.map(i=>s.jsxs(ue,{children:[s.jsx(Y,{children:s.jsx(ar,{query:`planned=${encodeURIComponent(i.release)}`,select:ts(i.release),onSelect:n,children:i.name})}),s.jsx(Y,{children:s.jsx(w1,{next:i,org:t})}),s.jsx(Y,{children:s.jsx(b1,{state:i.state})})]},`${i.release}:${i.item}`))})]})})]})]})}function GL({state:e,id:t}){var l;const n=ls();if(!e)return null;const a=(l=e.value)==null?void 0:l.releases.find(i=>i.id===t);if(!a){if(e.reading)return s.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status",children:[s.jsx(Qt,{"aria-hidden":!0,className:"size-4"})," ",Rt(Qn.pending),"…"]});if(e.refusal){const i=e.refusal.reason==="no_roadmap"?`${Rt(Qn.noEngineLead)}. ${n}`:e.refusal.message;return s.jsx("p",{className:"text-muted-foreground text-xs",children:`${Qn.failedLead}: ${i}`})}return null}const r=v1(a.forecast);return s.jsxs("div",{className:"flex flex-col gap-0.5",children:[r.lead?s.jsx("p",{className:"text-sm",children:r.lead}):null,r.caption.length?s.jsx("p",{className:"text-muted-foreground text-xs",children:Rt(r.caption.join(" · "))}):null]})}function _1(){const e=un().releases;if(!e)throw new Error("The Releases page rendered without a Releases contract.");return e}function VL({initial:e,environments:t,branch_options:n,chooseBranch:a,renderWrite:r,selection:l,org:i,onReadAgain:o,onNotFound:c,notice:d,focusOnMount:f}){var os,Mn,cs,mt,Js,ea,ta,na,z,_e;const h=_1(),m=e.local??null,[x,b]=u.useState(e),[v,y]=u.useState(null),g=l?l.selected:v,p=l?l.onSelect:y,j=!!(m||x.release_branch),[w,N]=u.useState(m||e.release_branch?{state:"loading"}:{state:"ready",value:null}),[C,_]=u.useState({}),[S,$]=u.useState(null),[O,G]=u.useState(!1),[V,L]=u.useState(null),[U,A]=u.useState(null),R=u.useRef(null),E=m?{fresh:!0}:void 0,k=u.useCallback(async ee=>{const Se=await h.candidate(ee);N(Se.ok?{state:"ready",value:Se.data.candidate}:{state:"error",error:Se.refusal.message,refusal:Se.refusal})},[h]),M=u.useCallback(async()=>{N({state:"loading"}),await k(E)},[k,m]),K=u.useCallback(async()=>{const ee=await h.list();ee.ok&&b(ee.data)},[h]),T=((os=x.release_branch)==null?void 0:os.id)??null;u.useEffect(()=>{if(!m&&!T)return;let ee=!1;return h.candidate().then(Se=>{ee||N(Se.ok?{state:"ready",value:Se.data.candidate}:{state:"error",error:Se.refusal.message,refusal:Se.refusal})}),()=>{ee=!0}},[T,h,m]);const B=u.useRef(new Set),F=u.useCallback((ee,Se)=>_(en=>({...en,[ee]:Se.ok?{state:"ready",value:Se.data.release}:{state:"error",error:Se.refusal.message,refusal:Se.refusal}})),[]),J=async ee=>{_(Se=>({...Se,[ee]:{state:"loading"}})),B.current.add(ee),F(ee,await h.release(ee,E))},he=w.state!=="ready"||w.value!==null,X=mL(g),D=OL(m?h:void 0),H=D.available&&g===ul,[te,se]=u.useState("all"),ye=x.release_branch||m?he?Ds:null:((Mn=x.releases[0])==null?void 0:Mn.version)??null,re=X!==null||H?null:g===Ds?he?Ds:null:g??ye,[we,ne]=u.useState([]),rt=u.useRef(0);u.useEffect(()=>{if(!m||!h.roadmapMoved)return;let ee=!0;const Se=rt.current;return h.roadmapMoved().then(en=>{ee&&en.ok&&Se===rt.current&&ne(en.data.moved.map(sa=>sa.name))}),()=>{ee=!1}},[h,m]);const de=D.reads.all,Be=D.read;u.useEffect(()=>{X===null||!D.available||!de.value&&!de.reading&&!de.refusal&&Be("all")},[X,D.available,de,Be]);const[Q,Re]=u.useState(0),Ue=u.useRef(0),yt=ee=>{ee===ul&&Re(Se=>Se+1),p(ee)};u.useEffect(()=>{if(Q!==Ue.current){if(!H){Ue.current=Q;return}te!=="all"||de.reading||!de.value||!h.roadmapSeen||(Ue.current=Q,h.roadmapSeen(de.value.as_of).then(ee=>{ee.ok&&(rt.current+=1,ne([]))}))}},[Q,H,te,de,h]);const Ne=new Map((((cs=de.value)==null?void 0:cs.releases)??[]).map(ee=>[ee.id,[ee.kinds.includes("range")?"range":"",ee.forecast.projected?zs(ee.forecast.projected):"no date"].filter(Boolean).join(" · ")])),Dt=re===null||re===Ds||x.releases.some(ee=>ee.version===re);u.useEffect(()=>{!m||!c||re!==null&&re!==Ds&&!Dt&&c({kind:"release",id:re})},[m,c,re,Dt]),u.useEffect(()=>{!re||re===Ds||B.current.has(re)||m&&!Dt||(B.current.add(re),h.release(re).then(ee=>F(re,ee)))},[re,h,F,Dt]);const q=u.useRef(g),oe=u.useRef(!1),ve=u.useRef(!!f),ke=u.useRef(null);u.useEffect(()=>{var Se,en;if(!m)return;if(ve.current){const sa=(Se=ke.current)==null?void 0:Se.querySelector('[aria-current="true"]');if(sa){ve.current=!1,q.current=g,sa.focus();return}}if(q.current!==g&&(q.current=g,oe.current=!0),!oe.current)return;const ee=(en=R.current)==null?void 0:en.querySelector("h2");ee&&(oe.current=!1,ee.tabIndex=-1,ee.focus())});const Me=async ee=>{if(!a)return;$(null);const Se=await a(ee);if(!Se.ok){$(Se.error);return}y(null),N({state:"loading"}),await K()},Yt=async()=>{if(!x.next_before)return;A(null);const ee=await h.list({before:x.next_before});if(!ee.ok){A(ee.refusal.message);return}b(Se=>({...ee.data,releases:[...Se.releases,...ee.data.releases]}))},gn=x.release_branch?s.jsx(FL,{value:x.release_branch.id,label:x.release_branch.name,options:n??[],can_write:x.can_write,onChange:Me}):null,ae=m?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Read at ",YL(m.read_at)]}),o?s.jsxs(P,{variant:"ghost",size:"sm",onClick:o,children:[s.jsx(jr,{className:"mr-1 size-4","aria-hidden":!0}),"Read again"]}):null]}):gn,He=m?pL(((mt=x.releases[0])==null?void 0:mt.label)??((Js=x.releases[0])==null?void 0:Js.version)??null):hL(((ea=x.releases[0])==null?void 0:ea.version)??null,((ta=x.release_branch)==null?void 0:ta.name)??null),qe={org:i??""};return s.jsxs(s.Fragment,{children:[s.jsx(a1,{description:m?l1:void 0,actions:ae}),d,m?s.jsx(xL,{}):null,S?s.jsx(qn,{error:S}):null,m?null:t,!m&&!x.release_branch?s.jsx(KL,{can_write:x.can_write,options:n??[],onChoose:Me}):null,x.release_branch||x.releases.length>0||m?s.jsxs("div",{ref:ke,className:"flex flex-col gap-6 md:flex-row md:items-start",children:[s.jsx(XL,{list:x,candidate:j?w:null,shown:H?ul:X!==null?ts(X):re,onSelect:yt,roadmap:D.available?DL(((na=x.planned)==null?void 0:na.length)??0,we):null,planned_ranges:Ne,can_load_older:!!x.next_before,older_error:U,onLoadOlder:Yt}),s.jsx("div",{className:"min-w-0 flex-1",ref:R,children:H?s.jsx(zL,{reads:D.reads,scope:te,onScope:se,onRead:Be,org:qe.org,onSelect:p}):X!==null?s.jsx(SL,{id:X,summary:((z=x.planned)==null?void 0:z.find(ee=>ee.id===X))??null,org:qe.org,onNotFound:()=>c==null?void 0:c({kind:"planned",id:X}),forecast:D.available?s.jsx(GL,{state:de,id:X}):null}):re===Ds?s.jsx(WL,{candidate:w,branch_name:((_e=x.release_branch)==null?void 0:_e.name)??null,can_write:x.can_write&&!!r,local:!!m,org:qe.org,onSelect:p,onRetry:M,onWrite:()=>G(!0)}):re?s.jsx(ZL,{detail:C[re]??{state:"loading"},summary:x.releases.find(ee=>ee.version===re)??null,local:!!m,org:qe.org,onSelect:p,onRetry:()=>J(re)}):(x.release_branch||m)&&w.state==="ready"?s.jsx(fL,{title:He.title,text:He.text}):null})]}):null,r&&w.state==="ready"&&w.value?r({candidate:w.value,open:O,notice:V,onOpenChange:ee=>{ee||L(null),G(ee)},onStale:async ee=>{L(ee),await k()},onWritten:async ee=>{G(!1),L(null),await K(),y(ee),await M()}}):null]})}function YL(e){return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}function FL({value:e,label:t,options:n,can_write:a,onChange:r}){const l=n.some(i=>i.id===e);return s.jsxs("div",{className:"grid w-56 gap-2",children:[s.jsx(De,{htmlFor:"release-branch",children:"Release branch"}),s.jsxs(gt,{value:e,onValueChange:r,disabled:!a,children:[s.jsx(ft,{id:"release-branch",children:s.jsx(vt,{})}),s.jsxs(ht,{children:[l?null:s.jsx(Ee,{value:e,children:t??"Unnamed branch"}),n.map(i=>s.jsx(Ee,{value:i.id,children:i.label},i.id))]})]}),a?null:s.jsx(N1,{})]})}function N1(){return s.jsx("p",{className:"text-muted-foreground text-xs",children:"You have read access; ask a member with write access to change it or write a Release."})}function KL({can_write:e,options:t,onChoose:n}){return s.jsxs("section",{className:"flex flex-col items-center gap-3 py-16 text-center",children:[s.jsx(gu,{className:"text-muted-foreground size-8","aria-hidden":!0}),s.jsx("h2",{className:"text-lg font-semibold",children:"Choose a release branch"}),s.jsx("p",{className:"text-muted-foreground max-w-md text-sm",children:"A Release records the graph change between two commits of one branch. Choose the branch you release from; you can change it later."}),s.jsxs("div",{className:"grid w-64 gap-2 text-left",children:[s.jsx(De,{htmlFor:"release-branch-first",children:"Release branch"}),s.jsxs(gt,{onValueChange:n,disabled:!e,children:[s.jsx(ft,{id:"release-branch-first",children:s.jsx(vt,{placeholder:"Choose a branch"})}),s.jsx(ht,{children:t.map(a=>s.jsx(Ee,{value:a.id,children:a.label},a.id))})]})]}),e?null:s.jsx(N1,{})]})}function k1({children:e}){return s.jsx("p",{className:"text-muted-foreground px-3 pt-3 text-xs font-medium tracking-wide uppercase",children:e})}function XL({list:e,candidate:t,shown:n,onSelect:a,roadmap:r,planned_ranges:l,can_load_older:i,older_error:o,onLoadOlder:c}){var h,m;const d=!!e.local,f=(t==null?void 0:t.state)==="ready"&&t.value?ro(t.value.changes):null;return s.jsxs("nav",{"aria-label":"Releases",className:"flex w-full flex-col gap-1 md:sticky md:top-0 md:max-h-[calc(100vh-3.5rem)] md:w-72 md:shrink-0 md:overflow-y-auto",children:[d&&r?s.jsx(Lc,{active:n===ul,onClick:()=>a(ul),version:"Roadmap",badges:null,caption:r}):null,t&&(t.state!=="ready"||t.value)?s.jsx(Lc,{active:n===Ds,onClick:()=>a(Ds),version:t.state==="ready"&&t.value?t.value.version:"Next release",badges:s.jsxs(s.Fragment,{children:[s.jsx(ce,{variant:"info",children:"Candidate"}),f!=null&&f.breaking?s.jsx(ce,{variant:"error",children:"Breaking"}):t.state==="ready"&&((h=t.value)==null?void 0:h.app_changed)===!1?s.jsx(ce,{variant:"neutral",children:"App unchanged"}):t.state==="ready"&&((m=t.value)!=null&&m.classification)?s.jsx(ce,{variant:"neutral",children:t.value.classification.bump}):null]}),caption:t.state==="loading"?"Classifying…":t.state==="error"?"Could not be read":r1(t.value)}):null,d?s.jsx(QL,{list:e,shown:n,onSelect:a,ranges:l}):null,d&&e.releases.length>0?s.jsx(k1,{children:"Released"}):null,e.releases.map(x=>{const b=d?gL(x):null;return s.jsx(Lc,{active:n===x.version,onClick:()=>a(x.version),version:x.label??x.version,badges:(b==null?void 0:b.badges)??s.jsxs(s.Fragment,{children:[s.jsx(ce,{variant:"neutral",children:x.previous_release_id?x.bump??"patch":"First"}),x.breaking?s.jsx(ce,{variant:"error",children:"Breaking"}):null]}),caption:(b==null?void 0:b.caption)??Cx(x.written_at)},x.version)}),i?s.jsx(P,{variant:"link",size:"sm",className:"self-start",onClick:c,children:"Show older Releases"}):null,o?s.jsx("p",{className:"text-destructive text-xs",role:"alert",children:o}):null]})}function QL({list:e,shown:t,onSelect:n,ranges:a}){return!e.planned_error&&!(e.planned&&e.planned.length>0)?null:s.jsxs(s.Fragment,{children:[s.jsx(k1,{children:"Planned"}),e.planned_error?s.jsx(qn,{title:"Planned Releases could not be read",error:e.planned_error}):null,(e.planned??[]).map((r,l)=>s.jsx(Lc,{active:t===ts(r.id),onClick:()=>n(ts(r.id)),version:r.name,badges:s.jsx(ce,{variant:"neutral",children:"Planned"}),caption:`${r.members===0?"no members":`${r.members} member${r.members===1?"":"s"}`}${l===0?" · next":""}${a!=null&&a.get(r.id)?` · ${a.get(r.id)}`:""}`},r.id))]})}function WL({candidate:e,branch_name:t,can_write:n,local:a,org:r,onSelect:l,onRetry:i,onWrite:o}){var m;if(e.state==="loading")return s.jsx(Hn,{children:s.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:"Classifying the changes since the last Release…"})});if(e.state==="error")return s.jsx(Hn,{children:s.jsx(qn,{error:e.error,onRetry:i})});const c=e.value;if(!c)return null;const d=ro(c.changes),f=!c.previous_release,h=t??"the release branch";return s.jsxs(Hn,{children:[s.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h2",{className:"text-lg font-semibold",children:c.version}),s.jsx(ce,{variant:"info",children:"Candidate"}),d.breaking?s.jsx(ce,{variant:"error",children:"Breaking"}):c.app_changed===!1?s.jsx(ce,{variant:"neutral",children:"App unchanged"}):c.classification?s.jsx(ce,{variant:"neutral",children:c.classification.bump}):null]}),s.jsxs("p",{className:"text-muted-foreground text-sm",children:[a?"What staging runs over production: ":`What the next Release holds at ${h}'s head: `,r1(c),". It is computed when you open it and never stored.",d.breaking&&c.next_version.startsWith("0.")?" Before 1.0.0 a major change raises the minor number.":""]}),f?s.jsxs("p",{className:"text-muted-foreground text-xs",children:["The first Release, ",c.next_version,", records the starting point and lists no changes."]}):s.jsx("p",{className:"text-muted-foreground text-xs",children:"Only graph changes are judged, so code that changed without a graph change is not counted."}),(m=c.classification)!=null&&m.marks_approximate?s.jsx("p",{className:"text-muted-foreground text-xs",children:"Modeling-only marks could not all be read, so these notes may leave out a change made after a mark."}):null,c.commits_since===null?s.jsx("p",{className:"text-muted-foreground text-xs",children:"Not every commit since the last Release could be walked, so the count and the rc number are at least what is shown."}):null]}),n?s.jsxs(P,{onClick:o,children:[s.jsx(gu,{className:"mr-2 size-4"}),"Write Release ",c.next_version]}):null]}),a?s.jsx(_L,{candidate:c,org:r,onSelect:l,notes:f?null:s.jsx(Du,{changes:c.changes})}):f?null:s.jsx(Du,{changes:c.changes})]})}function ZL({detail:e,summary:t,local:n,org:a,onSelect:r,onRetry:l}){const[i,o]=u.useState(!1);if((t==null?void 0:t.state)==="unreadable")return s.jsxs(Hn,{children:[s.jsx("h2",{className:"text-lg font-semibold",children:t.label??t.version}),s.jsx(qn,{title:"This Release could not be read",error:t.error??"Its record cannot be read."})]});if(e.state==="loading")return s.jsx(Hn,{children:s.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:"Loading the Release…"})});if(e.state==="error")return s.jsx(Hn,{children:s.jsx(qn,{error:e.error,onRetry:l})});const c=e.value,d=!c.previous_release_id,f=c.bump&&c.computed_bump&&c.bump!==c.computed_bump,h=c.label??c.version,m=async()=>{await navigator.clipboard.writeText(uL(h,ro(c.changes))),o(!0)};return s.jsxs(Hn,{children:[s.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[n?s.jsx(NL,{release:c,onSelect:r}):s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h2",{className:"text-lg font-semibold",children:c.version}),s.jsx(ce,{variant:"neutral",children:d?"First":c.bump}),ro(c.changes).breaking?s.jsx(ce,{variant:"error",children:"Breaking"}):null]}),s.jsxs("p",{className:"text-muted-foreground text-sm",children:["Written ",Cx(c.written_at),c.written_by_name?` by ${c.written_by_name}`:"",". A Release is permanent; a correction is a new Release."]}),n&&c.batch?s.jsxs("p",{className:"text-muted-foreground text-xs",children:["Released when production ran release batch ",s.jsx("code",{className:"font-mono",children:c.batch}),".",c.app_changed===!1?` The app's version stays ${c.app_version??c.version}.`:""]}):null,f?s.jsxs("p",{className:"text-sm",children:["Computed ",c.computed_bump,", declared ",c.bump,c.declared_by_name?` by ${c.declared_by_name}`:"",c.declared_reason?`: “${c.declared_reason}”`:"."]}):null,c.version_line?s.jsx("p",{className:"text-sm",children:c.version_line}):null,c.marks_approximate?s.jsx("p",{className:"text-muted-foreground text-xs",children:"Modeling-only marks could not all be read when it was written, so its notes may leave out a change made after a mark."}):null,d?s.jsx("p",{className:"text-muted-foreground text-xs",children:"The first Release records the starting point and lists no changes."}):c.source_judged?null:s.jsx("p",{className:"text-muted-foreground text-xs",children:"Only graph changes were judged, so code that changed without a graph change is not counted."})]}),d?null:s.jsxs(P,{variant:"outline",onClick:m,children:[s.jsx(CR,{className:"mr-2 size-4"}),i?"Copied":"Copy notes"]})]}),n?s.jsx(kL,{release:c,org:a,onSelect:r,notes:d?null:s.jsx(Du,{changes:c.changes})}):d?null:s.jsx(Du,{changes:c.changes})]})}const JL=5,e6=e=>e.retry===!0||e.reason==="store_locked"||e.status===503;function t6({org:e,query:t,onSelect:n,home:a}){var U,A;const r=_1(),{href:l,Link:i}=Ze(),[o,c]=u.useState({state:"loading"}),[d,f]=u.useState(null),[h,m]=u.useState(null),[x,b]=u.useState(null),v=u.useRef(0),y=u.useRef(0),g=u.useRef(null),p=u.useRef(!1),j=u.useCallback(async R=>{const E=y.current+=1;m(null);const k=await r.list(R?{fresh:!0}:void 0);if(E===y.current){if(k.ok){v.current=0,f(null),c({state:"ok",list:k.data});return}if(k.refusal.reason==="engine_missing"){c({state:"engine_missing",refusal:k.refusal});return}if(v.current+=1,v.current===1&&e6(k.refusal)){m(k.refusal.retry_after??JL);return}f(k.refusal)}},[r]);u.useEffect(()=>{j(!1)},[j]),u.useEffect(()=>{if(h===null)return;const R=setTimeout(()=>void j(!1),h*1e3);return()=>clearTimeout(R)},[h,j]),u.useEffect(()=>{var E;if(!p.current||o.state==="loading"||d||h!==null)return;p.current=!1;const R=(E=g.current)==null?void 0:E.querySelector("h1");R&&(R.tabIndex=-1,R.focus())});const w=()=>{p.current=!0,v.current=0,f(null),j(!0)},N=o.state==="ok"?o.list:null,C=t.roadmap?ul:t.planned!==null?t.planned===""?(U=N==null?void 0:N.planned)!=null&&U[0]?ts(N.planned[0].id):null:ts(t.planned):t.release,_=`${t.release??""}|${t.planned??""}|${t.roadmap?"roadmap":""}`,S=u.useRef(_);u.useEffect(()=>{S.current!==_&&(S.current=_,b(null))},[_]);const $=u.useRef(!1),O=u.useCallback(R=>{$.current=!0,b(R)},[]),G=!x&&o.state==="ok"&&$.current;if(u.useEffect(()=>{G&&($.current=!1)},[G]),x)return s.jsx(Ha,{title:x.kind==="release"?`No Release ${x.id}`:`No open Planned Release ${x.id}`,description:"This project has no Release, candidate or open Planned Release by that name.",backHref:l(a),backLabel:"All Releases",link:i});const V=h!==null?s.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status","aria-live":"polite",children:[s.jsx(Qt,{"aria-hidden":!0})," The release records are busy; reading again in ",h," s…"]}):null,L=d?s.jsxs(me,{variant:"destructive",children:[s.jsx(Xt,{}),s.jsx(je,{children:"Releases could not be read"}),s.jsxs(ge,{className:"flex flex-col items-start gap-2",children:[s.jsxs("span",{children:[d.message,N?" The last Releases read stay below.":""]}),s.jsx(P,{variant:"outline",size:"sm",onClick:w,children:"Try again"})]})]}):null;return s.jsx("div",{ref:g,className:"flex w-full flex-1 flex-col gap-6 px-4 py-4 sm:px-6 lg:px-8",children:o.state==="ok"?s.jsx(VL,{initial:o.list,org:e,selection:{selected:C,onSelect:n},onReadAgain:w,onNotFound:O,notice:V||L?s.jsxs(s.Fragment,{children:[V,L]}):null,focusOnMount:G},((A=o.list.local)==null?void 0:A.read_at)??"list"):o.state==="engine_missing"?s.jsx(Zs,{page:"Releases"}):s.jsxs(s.Fragment,{children:[s.jsx(a1,{description:l1}),L??V??s.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status","aria-live":"polite",children:[s.jsx(Qt,{"aria-hidden":!0})," Loading Releases…"]})]})})}const n6={threads:"Threads",tasks:"Tasks",queues:"Queues",worktrees:"Worktrees",workspaces:"Workspaces",chart:"Org chart"},s6={tasks:"Tasks",issues:"Issues",releases:"Releases"};function Uc(e,t){return e.kind==="home"?"Home":e.kind==="org"?n6[e.page]:e.kind==="project"?e.page?s6[e.page]:t??e.project:"Not found"}const a6="(max-width: 767px)";function r6(){const e=typeof window<"u"&&window.matchMedia?window.matchMedia(a6):null,[t,n]=u.useState((e==null?void 0:e.matches)??!1);return u.useEffect(()=>{if(!e)return;const a=()=>n(e.matches);return e.addEventListener("change",a),()=>e.removeEventListener("change",a)},[e]),t}function xc({className:e=""}){return s.jsx("span",{"aria-hidden":"true",className:`block animate-pulse rounded-md bg-sidebar-accent ${e}`})}function uy({label:e,children:t}){return s.jsxs("span",{role:"status",className:"flex flex-col gap-1",children:[s.jsx("span",{className:"sr-only",children:e}),t]})}function dy({item:e,collapsed:t}){const{Link:n}=Ze(),a=e.icon,r=e.title??(t?e.label:void 0),l=s.jsx("span",{className:"block",children:s.jsxs(n,{href:e.href,className:"flex h-8 items-center gap-2 overflow-hidden rounded-md px-2 text-sm text-sidebar-foreground no-underline outline-hidden hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 focus-visible:ring-sidebar-ring "+(e.current?"bg-sidebar-accent font-medium text-sidebar-accent-foreground":""),"aria-current":e.current?"page":void 0,"aria-label":t?e.label:void 0,children:[s.jsx(a,{className:"size-4 shrink-0","aria-hidden":"true"}),!t&&s.jsx("span",{className:"truncate",children:e.label})]})});return s.jsx("li",{children:r?s.jsxs(jk,{children:[s.jsx(bk,{asChild:!0,children:l}),s.jsx(px,{side:"right",children:r})]}):l})}const fy="m-0 flex list-none flex-col gap-1 p-0";function hy({label:e,collapsed:t,children:n}){return s.jsxs("div",{className:"flex flex-col gap-1 p-2",role:"group","aria-label":e,children:[!t&&s.jsx("p",{className:"m-0 px-2 text-xs font-medium text-sidebar-foreground/70",children:e}),n]})}function my({page:e,collapsed:t,sheet:n=!1}){var U;const{href:a}=Ze(),{worktrees:r}=un(),l=En(),{org:i,projects:o,loading:c,none:d,about:f,aboutFailed:h,domains:m,engine:x}=l,b=x===null,v=i?`/org/${i.slug}`:"",y=o==null?void 0:o.find(A=>A.current),g=((U=i==null?void 0:i.source)==null?void 0:U.kind)==="folder"&&y!==void 0,p=A=>g&&y?`${A} · ${y.name}`:A,j=p("Workspaces"),w=p("Tasks"),N=p("Queues"),C=A=>g?A:void 0,_=[{label:"Home",href:a(v||"/"),icon:qR,current:e.kind==="home"},...b?[]:[{label:"Threads",href:a(`${v}/threads`),icon:aT,current:e.kind==="org"&&e.page==="threads"}],...m.includes("tasks")&&!b?[{label:w,title:C(w),href:a(`${v}/tasks`),icon:D0,current:e.kind==="org"&&e.page==="tasks"}]:[],...b?[]:[{label:N,title:C(N),href:a(`${v}/queues`),icon:z0,current:e.kind==="org"&&e.page==="queues"}],...r&&!b?[{label:"Worktrees",href:a(`${v}/worktrees`),icon:O0,current:e.kind==="org"&&e.page==="worktrees"}]:[],{label:j,title:C(j),href:a(`${v}/workspaces`),icon:zR,current:e.kind==="org"&&e.page==="workspaces"},{label:"Org chart",href:a(`${v}/chart`),icon:oT,current:e.kind==="org"&&e.page==="chart"}],S=c?null:d?"No organization":(i==null?void 0:i.name)??"Organization",$=i?LT(i):null,O=f==null?void 0:f.version,G=O?t?O:`sdlc ${O}`:h?vu:cd,V=h||(f==null?void 0:f.sync.state)==="unknown"?OT:f===void 0?$T:MT;let L;return c?L=s.jsx("div",{className:"px-2 py-1",children:s.jsxs(uy,{label:"Loading projects",children:[s.jsx(xc,{className:"h-4 w-32"}),s.jsx(xc,{className:"h-4 w-24"})]})}):o?L=s.jsx("ul",{className:fy,children:o.map(A=>s.jsx(dy,{collapsed:t,item:{label:A.name,title:A.name,href:a(`/proj/${encodeURIComponent(A.id)}`),icon:OR,current:e.kind==="project"&&e.project===A.id}},A.id))}):L=s.jsx("p",{className:"m-0 px-2 text-sm text-sidebar-foreground/70",children:d?"No projects":vu}),s.jsxs("div",{className:"flex h-full flex-col bg-sidebar text-sidebar-foreground",children:[s.jsxs("div",{className:`flex items-center gap-2 p-2 ${n?"pr-11":""}`,role:"group","aria-label":"Current organization",children:[s.jsx("div",{className:"flex aspect-square size-8 shrink-0 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground",children:s.jsx(hR,{className:"size-4","aria-hidden":"true"})}),!t&&s.jsx("div",{className:"grid min-w-0 flex-1 text-left text-sm leading-tight",children:S===null?s.jsxs(uy,{label:"Loading organization",children:[s.jsx(xc,{className:"h-4 w-28"}),s.jsx(xc,{className:"h-3 w-24"})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"truncate font-semibold",title:S,children:S}),$&&s.jsx("span",{className:"truncate text-xs text-sidebar-foreground/70",children:$})]})})]}),s.jsxs("nav",{"aria-label":"App",className:"min-h-0 flex-1 overflow-y-auto",children:[s.jsx(hy,{label:"Organization",collapsed:t,children:s.jsx("ul",{className:fy,children:_.map(A=>s.jsx(dy,{item:A,collapsed:t},A.label))})}),!t&&s.jsx(hy,{label:"Projects",collapsed:t,children:L})]}),f!==null&&s.jsxs("div",{className:"flex flex-col gap-1 border-t border-sidebar-border p-2 text-xs text-sidebar-foreground/70",children:[s.jsx("p",{className:"m-0 truncate px-2",title:O?`sdlc ${O}`:void 0,children:G}),!t&&s.jsxs("p",{className:"m-0 flex items-start gap-2 px-2",children:[s.jsx(BR,{className:"mt-0.5 size-4 shrink-0","aria-hidden":"true"}),s.jsx("span",{children:V})]})]})]})}const l6="outline-hidden rounded-sm focus-visible:ring-2 focus-visible:ring-ring";function i6({page:e}){var c;const{href:t,Link:n}=Ze(),{org:a,projects:r,loading:l,none:i}=En(),o=[];if(l)o.push({label:cd});else if(i)o.push({label:"No organization"});else{const d=(a==null?void 0:a.name)??"Organization";if(o.push({label:d,href:e.kind==="home"?void 0:t(a?`/org/${a.slug}`:"/")}),e.kind==="project"){const f=((c=r==null?void 0:r.find(h=>h.id===e.project))==null?void 0:c.name)??e.project;o.push({label:f,href:e.page?t(`/proj/${encodeURIComponent(e.project)}`):void 0})}if(e.kind==="org"&&e.item!==void 0)o.push({label:Uc(e),href:a?t(`/org/${a.slug}/${e.page}`):void 0}),o.push({label:e.item});else if(e.kind==="project"&&e.page&&e.item!==void 0){const f=`/proj/${encodeURIComponent(e.project)}/${e.page}${e.list_query?`?${e.list_query}`:""}`;o.push({label:Uc(e),href:t(f)}),o.push({label:e.item})}else e.kind!=="home"&&!(e.kind==="project"&&!e.page)&&o.push({label:Uc(e)})}return s.jsx("nav",{"aria-label":"Breadcrumb",className:"min-w-0",children:s.jsx("ol",{className:"m-0 flex min-w-0 list-none items-center gap-1.5 p-0 text-sm text-muted-foreground",children:o.map((d,f)=>s.jsxs("li",{className:"flex min-w-0 items-center gap-1.5",children:[f>0&&s.jsx(ad,{className:"size-3.5 shrink-0","aria-hidden":"true"}),d.href?s.jsx(n,{href:d.href,className:`truncate text-muted-foreground no-underline hover:text-foreground ${l6}`,children:d.label}):s.jsx("span",{className:"truncate font-normal text-foreground","aria-current":f===o.length-1?"page":void 0,children:d.label})]},`${f}-${d.label}`))})})}function o6({page:e,children:t}){var g;const n=r6(),[a,r]=u.useState(!0),[l,i]=u.useState(!1),o=u.useRef(null),c=u.useRef(null),{org:d,projects:f,loading:h,none:m}=En(),x=e.kind==="project"?(g=f==null?void 0:f.find(p=>p.id===e.project))==null?void 0:g.name:void 0;u.useEffect(()=>{const p=h?cd:m?"No organization":(d==null?void 0:d.name)??"Organization",j=(e.kind==="org"||e.kind==="project")&&e.item!==void 0?`${e.item} · `:"";document.title=`${j}${Uc(e,x)} · ${p} · sdlc viewer`},[e,x,d,h,m]);const b=()=>{var p;i(!1),(p=o.current)==null||p.focus()};u.useEffect(()=>{n||i(!1)},[n]);const v=n&&l;u.useEffect(()=>{var w;const p=c.current;if(!v||!p)return;(w=p.querySelector("a, button"))==null||w.focus();const j=N=>{var O;if(N.key==="Escape"){i(!1),(O=o.current)==null||O.focus();return}if(N.key!=="Tab")return;const C=[...p.querySelectorAll("a[href], button:not([disabled])")];if(C.length===0)return;const _=C[0],S=C[C.length-1],$=p.contains(document.activeElement);N.shiftKey&&(document.activeElement===_||!$)?(N.preventDefault(),S.focus()):!N.shiftKey&&(document.activeElement===S||!$)&&(N.preventDefault(),_.focus())};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[v]);const y=!n&&!a;return s.jsx(yk,{children:s.jsxs("div",{className:"flex h-svh min-h-0 overflow-hidden bg-background text-foreground",children:[!n&&s.jsx("aside",{"aria-label":"Sidebar",className:`shrink-0 border-r border-sidebar-border transition-[width] ${y?"w-12":"w-64"}`,children:s.jsx(my,{page:e,collapsed:y})}),v&&s.jsxs("div",{className:"fixed inset-0 z-50 flex",children:[s.jsxs("aside",{ref:c,role:"dialog","aria-modal":"true","aria-label":"Sidebar",className:"relative w-72 max-w-[85vw] border-r border-sidebar-border",children:[s.jsx(my,{page:e,collapsed:!1,sheet:!0}),s.jsx("button",{type:"button","aria-label":"Close the sidebar",className:"absolute top-3 right-3 inline-flex size-7 items-center justify-center rounded-md border-0 bg-transparent text-sidebar-foreground/70 outline-hidden hover:text-sidebar-foreground focus-visible:ring-2 focus-visible:ring-ring",onClick:b,children:s.jsx(od,{className:"size-4","aria-hidden":"true"})})]}),s.jsx("button",{type:"button",tabIndex:-1,"aria-hidden":"true",className:"flex-1 border-0 bg-black/80 outline-hidden",onClick:b})]}),s.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden",children:[s.jsxs("header",{className:`flex shrink-0 items-center gap-2 border-b border-border px-4 transition-[height] ${y?"h-12":"h-16"}`,children:[s.jsx("button",{ref:o,type:"button",className:"-ml-1 inline-flex size-7 items-center justify-center rounded-md border-0 bg-transparent text-foreground outline-hidden hover:bg-accent hover:text-accent-foreground focus-visible:ring-2 focus-visible:ring-ring","aria-label":"Toggle Sidebar","aria-expanded":n?l:a,onClick:()=>n?i(p=>!p):r(p=>!p),children:s.jsx(uT,{className:"size-4","aria-hidden":"true"})}),s.jsx("span",{"aria-hidden":"true",className:"mr-2 h-4 w-px bg-border"}),s.jsx(i6,{page:e})]}),s.jsx("main",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden overflow-y-auto",children:t})]})]})})}const Ax="m-0 text-2xl font-semibold tracking-tight",Mx="outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",$x=`rounded-sm font-medium text-primary no-underline hover:underline ${Mx}`;function Yf({children:e}){return s.jsx("pre",{className:"m-0 overflow-x-auto rounded-md border border-border bg-muted px-3 py-2 font-mono text-sm text-foreground",children:s.jsx("code",{children:e})})}function c6({why:e}){return e.kind==="not_in_git"?s.jsxs("div",{className:"flex max-w-2xl flex-col gap-2",children:[s.jsx("p",{className:"m-0 text-sm",children:"This directory is not a Git repository. Start sdlc viewer inside one:"}),s.jsx(Yf,{children:"sdlc viewer"})]}):e.kind==="unlisted"?s.jsxs("div",{className:"flex max-w-2xl flex-col gap-2",children:[s.jsx("p",{className:"m-0 text-sm",children:`This repository, ${e.repository}, points to the folder ${e.folder}, but that folder no longer lists it.`}),s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:"To rejoin, leave the folder here:"}),s.jsx(Yf,{children:"sdlc-agents folder leave"}),s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:`then add it back from the folder's home repository, ${e.home}:`}),s.jsx(Yf,{children:`sdlc-agents folder add ${e.member_path} --name ${e.repository}`}),s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:"To work in this repository alone, leaving is enough."})]}):s.jsxs("div",{className:"flex max-w-2xl flex-col gap-2",children:[s.jsx("p",{className:"m-0 text-sm",children:e.cause}),e.kind==="moved_member"&&s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:"Move this repository back to where the folder records it."}),s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:e.kind==="other"&&!e.fix?cr:zT})]})}const py=`inline-flex h-9 items-center justify-center whitespace-nowrap rounded-md border border-input bg-background px-3 font-[inherit] text-sm font-medium text-foreground transition-colors hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 ${Mx}`;function u6(){return s.jsxs("div",{role:"status",className:"flex flex-col gap-2",children:[s.jsx("span",{className:"sr-only",children:"Loading projects"}),[0,1,2].map(e=>s.jsx("span",{"aria-hidden":"true",className:"block h-9 animate-pulse rounded-md bg-muted"},e))]})}function Fl(){const{href:e,Link:t}=Ze(),{loading:n,projects:a,none:r,failure:l,readAt:i,refresh:o,reading:c}=En(),[d,f]=u.useState(""),h=s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("h1",{className:Ax,children:"Projects"}),!r&&s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:DT})]});if(r)return s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[h,s.jsx(c6,{why:r==="not_in_git"?{kind:"not_in_git"}:IT(r)})]});const m=l!=null&&l.shown?l:null,x=(a??[]).filter(b=>b.name.toLowerCase().includes(d.trim().toLowerCase()));return s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[h,m&&s.jsxs("div",{role:"alert",className:"flex flex-col gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-4",children:[s.jsx("p",{className:"m-0 text-sm font-medium text-destructive",children:"The projects could not be refreshed"}),s.jsx("p",{className:"m-0 text-sm",children:U0(m.refusal,i)}),s.jsx("div",{children:s.jsx("button",{type:"button",className:py,onClick:o,disabled:c,children:"Retry"})})]}),(a||n)&&s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"search","aria-label":"Filter projects",placeholder:"Filter projects",value:d,onChange:b=>f(b.target.value),className:`h-9 w-full max-w-sm rounded-md border border-input bg-transparent px-3 font-[inherit] text-sm text-foreground placeholder:text-muted-foreground ${Mx}`}),!m&&s.jsx("button",{type:"button",className:`${py} ml-auto`,onClick:o,disabled:c||n,children:"Refresh"})]}),l&&!l.shown&&i&&s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:`Showing the list read at ${di(i)}; reading again in ${l.retryInSeconds??10} seconds.`})]}),n?s.jsx(u6,{}):a&&s.jsx("div",{className:"overflow-x-auto rounded-md border border-border",children:s.jsxs("table",{className:"w-full border-collapse text-sm",children:[s.jsx("thead",{className:"border-b border-border text-left text-muted-foreground",children:s.jsxs("tr",{children:[s.jsx("th",{scope:"col",className:"h-10 px-3 font-medium",children:"Name"}),s.jsx("th",{scope:"col",className:"h-10 px-3 font-medium",children:"Location"}),s.jsx("th",{scope:"col",className:"h-10 px-3",children:s.jsx("span",{className:"sr-only",children:"Where this viewer runs"})})]})}),s.jsxs("tbody",{children:[x.map(b=>s.jsxs("tr",{className:"border-b border-border last:border-0",children:[s.jsx("td",{className:"px-3 py-2",children:s.jsx(t,{href:e(`/proj/${encodeURIComponent(b.id)}`),className:$x,children:b.name})}),s.jsx("td",{className:"px-3 py-2 font-mono text-muted-foreground",children:b.location??vu}),s.jsx("td",{className:"px-3 py-2 text-right",children:b.current&&s.jsx("span",{className:"inline-flex items-center rounded-md border border-border px-2 py-0.5 text-xs font-medium",children:"This repository"})})]},b.id)),x.length===0&&s.jsx("tr",{children:s.jsx("td",{colSpan:3,className:"px-3 py-6 text-center text-muted-foreground",children:"No projects found."})})]})]})})]})}function S1({title:e,children:t}){const{href:n,Link:a}=Ze();return s.jsx("div",{className:"p-6",children:s.jsxs("div",{className:"flex max-w-xl flex-col gap-2 rounded-xl border border-border bg-card p-6 text-card-foreground",children:[s.jsx("h1",{className:Ax,children:e}),s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:t}),s.jsx("div",{children:s.jsx(a,{href:n("/"),className:`text-sm ${$x}`,children:"Back to the organization's Home"})})]})})}const d6={tasks:"Tasks",issues:"Issues",releases:"Releases"};function lo({project:e}){const{href:t,Link:n}=Ze(),{org:a,projects:r,loading:l,domains:i}=En(),o=r==null?void 0:r.find(c=>c.id===e);return l?s.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:cd}):r?o?s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("h1",{className:Ax,children:o.name}),s.jsx("p",{className:"m-0 font-mono text-sm text-muted-foreground",children:o.location??vu})]}),o.current?i.length>0?s.jsx("ul",{className:"m-0 flex list-none flex-col gap-1 p-0 text-sm",children:i.map(c=>s.jsx("li",{children:s.jsx(n,{href:t(c==="tasks"?`${a?`/org/${a.slug}`:""}/tasks`:`/proj/${encodeURIComponent(o.id)}/${c}`),className:$x,children:d6[c]})},c))}):null:s.jsx("p",{className:"m-0 max-w-2xl text-sm text-muted-foreground",children:`This viewer reads ${o.name}'s tasks, issues and Releases only from its own checkout: open it with sdlc viewer there.`})]}):s.jsx(S1,{title:"Project not found",children:`There is no project '${e}' in this organization.`}):s.jsx(Fl,{})}const zd=e=>e instanceof Error?e.message:String(e);async function C1(){try{const e=await fetch("api/threads",{cache:"no-store"});return e.status===404?{none:!0}:e.ok?{data:await e.json()}:{error:await e.text()||`HTTP ${e.status}`}}catch(e){return{error:zd(e)}}}async function f6(){var e;try{const t=await fetch("api/release-links?threads",{cache:"no-store"});if(!t.ok)return null;const n=await t.json(),a=(e=n==null?void 0:n.panel)==null?void 0:e.threads;if(!a||typeof a!="object"||Array.isArray(a))return null;const r={};for(const[l,i]of Object.entries(a)){const o=(Array.isArray(i)?i:[]).filter(c=>!!c&&typeof c.planned_release=="string"&&typeof c.name=="string"&&typeof c.level=="string");o.length&&(r[l]=o)}return r}catch{return null}}async function h6(){try{return(await fetch("api/pin",{method:"HEAD",cache:"no-store"})).ok}catch{return!1}}async function m6(){try{const e=await fetch("api/sessions",{cache:"no-store"});if(!e.ok)return null;const t=await e.json();return!t||typeof t.idle_over!="number"||!Array.isArray(t.sessions)?null:{idle_over:t.idle_over,memory_mb:Number(t.memory_mb)||0,sessions:t.sessions}}catch{return null}}async function p6(){try{const e=await fetch("api/sessions-release",{method:"POST",cache:"no-store",headers:{"Content-Type":"application/json"},body:"{}"});if(!e.ok)return{error:await e.text()||`HTTP ${e.status}`};const t=await e.json();return{done:{released:t.released??[],kept:t.kept??[]}}}catch(e){return{error:zd(e)}}}async function x6(e,t){try{const n=await fetch("api/threads/open",{method:"POST",cache:"no-store",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,reopen:t})}),a=await n.text();let r={};try{r=JSON.parse(a)??{}}catch{}return n.ok?{done:r}:{refused:{reason:typeof r.reason=="string"?r.reason:"failed",error:typeof r.error=="string"?r.error:a||`HTTP ${n.status}`,...typeof r.where=="string"&&r.where?{where:r.where}:{}}}}catch(n){return{refused:{reason:"failed",error:zd(n)}}}}async function g6(e,t){try{const n=await fetch("api/pin",{method:"POST",cache:"no-store",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,on:t})});return n.ok?null:await n.text()||`HTTP ${n.status}`}catch(n){return zd(n)}}const v6={probe:{source:async()=>{const e=await C1();if("error"in e)throw new Error(e.error);return{label:"Local workspace"}}}},R1={href:e=>e.replace(/^\/+/,"")||"./",Link:({href:e,className:t,children:n,...a})=>s.jsx("a",{href:e,className:t,...a,children:n})},y6={label:"Local viewer",can:()=>!1};function j6(){return u.useEffect(()=>{document.title="Shared app UI · SDLC Workspace Viewer"},[]),s.jsx("div",{className:"app-ui dark",children:s.jsx(E0,{data:v6,router:R1,identity:y6,children:s.jsx(XC,{})})})}const b6="This repository's local planning workspaces: which workspace each forked from, what this checkout's workspace may change, and the integrations and Handoffs between them. This page only reads them; sdlc workspace and sdlc integrate change them.",w6=3e4,_6="Reading the workspaces. On a plan workspace this can take a few minutes.",N6="The read failed. Details are in the terminal running sdlc viewer.",k6={active:{label:"Active",tone:"success"},closed:{label:"Closed",tone:"neutral"},clean:{label:"Clean",tone:"success"},dirty:{label:"Uncommitted changes",tone:"warning"},unreadable:{label:"Unreadable",tone:"error"},queued:{label:"Queued",tone:"info"},integrated:{label:"Integrated",tone:"success"},reconciled:{label:"Reconciled",tone:"success"},stale_head:{label:"Retrying",tone:"warning"},current:{label:"Current",tone:"neutral"},blocked_conflict:{label:"Blocked: conflict",tone:"warning"},blocked_validation:{label:"Blocked: validation error",tone:"warning"},ready:{label:"Ready",tone:"success"},applied:{label:"Applied",tone:"success"},stale_base:{label:"Stale base",tone:"warning"},applied_recovery_required:{label:"Needs recovery",tone:"warning"},unavailable:{label:"Unavailable",tone:"warning"},needs_attention:{label:"Needs attention",tone:"warning"}},S6=e=>k6[e]??{label:e,tone:"neutral"},wa=e=>e.slice(0,8),T1={human:"Human",ai:"AI"},bm=(e,t)=>`${e} ${t}${e===1?"":"s"}`;function C6(){const e=un().workspaces;if(!e)throw new Error("The Workspaces page rendered without the workspaces seam.");return e}function R6(e){const t=C6(),[n,a]=u.useState(null),[r,l]=u.useState(null),[i,o]=u.useState(!1),c=u.useRef(null),d=u.useRef(!1),f=u.useRef(null),h=u.useCallback(()=>{if(f.current)return f.current;const y=(async()=>{const g=await t.overview();g.ok?(a(g.data),l(null),o(!1)):(l(g.refusal),o(!0))})().finally(()=>{f.current=null});return f.current=y,y},[t]);u.useEffect(()=>{h()},[h]),Eu(()=>void h(),w6),u.useEffect(()=>{var y;d.current&&(n||r)&&(d.current=!1,(y=c.current)==null||y.focus())},[n,r]);const m=()=>{d.current=!0,h()},x=n===null&&r===null,b=n===null&&r!==null,v=n?T6(n,i):null;return s.jsxs("div",{className:"flex h-full min-h-0 flex-1 flex-col overflow-auto px-4 py-4 sm:px-6 lg:px-8",children:[s.jsx(Jt,{title:"Workspaces",description:b6,actions:s.jsxs(s.Fragment,{children:[v?s.jsx("p",{className:"text-muted-foreground text-xs",children:v}):null,s.jsxs(P,{type:"button",variant:"outline",size:"sm","aria-disabled":x||void 0,"aria-describedby":x?"workspaces-reading":void 0,className:"gap-2",onClick:x?void 0:()=>void h(),children:[s.jsx(jr,{className:"size-4","aria-hidden":"true"}),"Read again"]}),x?s.jsx("span",{id:"workspaces-reading",className:"sr-only",children:"Reading…"}):null,s.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:n?E1(n,i):""})]})}),s.jsxs("div",{ref:c,tabIndex:-1,className:"outline-none",children:[x?s.jsx(E6,{}):null,b&&r?s.jsx(A6,{refusal:r,on_retry:m}):null,n?s.jsx(M6,{overview:n}):null]})]})}function E1(e,t){var n,a;return t||((n=e.stale)==null?void 0:n.reason)==="failed"?"a newer read failed":((a=e.stale)==null?void 0:a.reason)==="running"?"a newer read is still running":""}function T6(e,t){const n=`Read at ${as(new Date(e.read_at).toISOString())}`,a=E1(e,t);return a?`${n} · ${a}`:n}function E6(){return s.jsxs("div",{className:"mt-6",children:[s.jsx("div",{className:"grid gap-2",role:"status","aria-label":"Loading workspaces",children:Array.from({length:6},(e,t)=>s.jsx(_t,{className:t===5?"h-10 w-2/3":"h-10 w-full"},t))}),s.jsx("p",{className:"text-muted-foreground mt-3 text-sm","aria-live":"polite",children:_6})]})}function A6({refusal:e,on_retry:t}){const n=e.reason==="store_locked"?U0(e,null):N6;return s.jsxs(me,{variant:"destructive",className:"mt-6",children:[s.jsx(st,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:"Could not read workspaces"}),s.jsxs(ge,{children:[s.jsx("p",{children:n}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]})}function M6({overview:e}){const{counts:t}=e,n=[bm(t.workspaces,"workspace"),`${t.active} active`,`${t.queued} queued`,`${t.blocked} blocked`].join(" · ");return s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-muted-foreground mt-2 text-sm",role:"status","aria-live":"polite",children:n}),s.jsxs("div",{className:"mt-4 grid gap-4 lg:grid-cols-[1.4fr_1fr]",children:[s.jsx(gc,{id:"workspaces-lineage",title:"Lineage",caption:"Each workspace under the one it forked from",children:s.jsx($6,{rows:e.workspaces})}),s.jsx(gc,{id:"workspaces-authority",title:"Authority and resolver",caption:"What this checkout's workspace may change",children:s.jsx(O6,{authority:e.authority})})]}),s.jsx(gc,{id:"workspaces-activity",className:"mt-4",title:"Integration activity",caption:"Newest first",children:e.activity.length===0?s.jsx(xy,{children:"No integration or reconciliation attempts yet."}):s.jsx(z6,{rows:e.activity})}),s.jsx(gc,{id:"workspaces-handoffs",className:"mt-4",title:"Handoffs",children:e.handoffs.length===0?s.jsx(xy,{children:"No Handoffs prepared yet."}):s.jsx(L6,{rows:e.handoffs})})]})}function gc({id:e,title:t,caption:n,className:a,children:r}){return s.jsxs("section",{"aria-labelledby":e,className:le("min-w-0",a),children:[s.jsxs("div",{className:"mb-2 flex flex-wrap items-baseline gap-x-2",children:[s.jsx("h2",{id:e,className:"text-lg font-semibold",children:t}),n?s.jsx("span",{className:"text-muted-foreground text-sm",children:n}):null]}),r]})}const xy=({children:e})=>s.jsx("p",{className:"text-muted-foreground text-sm",children:e}),zu=({children:e,tone:t})=>s.jsx("div",{className:le("text-xs",t==="error"?"text-destructive":"text-muted-foreground"),children:e});function io({status:e}){const t=S6(e);return s.jsx(ce,{variant:t.tone,children:t.label})}function Ld({label:e,children:t}){return s.jsx(ut,{role:"group","aria-label":e,tabIndex:0,className:"overflow-x-auto outline-hidden focus-visible:ring-2 focus-visible:ring-ring",children:t})}function $6({rows:e}){return s.jsx(Ld,{label:"Workspaces",children:s.jsxs(Ye,{containerClassName:"overflow-visible",children:[s.jsx(We,{children:s.jsxs(ue,{children:[s.jsx(W,{children:"Workspace"}),s.jsx(W,{children:"Actor"}),s.jsx(W,{children:"Forked from"}),s.jsx(W,{children:"Status"}),s.jsx(W,{children:"Projection"})]})}),s.jsx(Fe,{children:e.map(t=>s.jsxs(ue,{"data-testid":"workspaces-row",children:[s.jsxs(Y,{children:[s.jsx("div",{className:"font-mono font-medium",children:t.short_id}),s.jsx(zu,{children:t.current?`${t.path} · This checkout`:t.path}),t.projection==="unreadable"&&t.projection_error&&s.jsx(zu,{children:t.projection_error})]}),s.jsx(Y,{children:T1[t.actor]}),s.jsx(Y,{children:t.source_id?s.jsx("span",{className:"font-mono",children:wa(t.source_id)}):s.jsx("span",{className:"text-muted-foreground",children:"No source"})}),s.jsx(Y,{children:s.jsx(io,{status:t.status})}),s.jsx(Y,{children:s.jsx(io,{status:t.projection})})]},t.id))})]})})}function O6({authority:e}){const t=e.resolver,n=[["Workspace",s.jsx("span",{className:"font-mono",children:wa(e.workspace_id)},"id")],["Actor",T1[e.actor]],["Own head","Writes it"]];return e.source_head==="handoff_only"&&n.push(["Source head","Only through a Handoff"]),n.push(["Git refs","Read only"]),n.push(["Remotes",e.remotes>0?`${e.remotes} named ${e.remotes===1?"remote":"remotes"}`:s.jsx("span",{className:"text-muted-foreground",children:"None"},"none")]),n.push(["Push to remotes",e.push==="human_only"?"Only a person":"Not allowed"]),n.push(["Resolver",t.state==="not_configured"?s.jsx("span",{className:"text-muted-foreground",children:"Not configured"},"resolver"):s.jsx(io,{status:t.state==="ready"?"ready":"needs_attention"},"resolver")]),t.state==="needs_attention"&&t.issue&&n.push(["Resolver issue",t.issue]),s.jsx(Ld,{label:"Authority and resolver",children:s.jsx(Ye,{containerClassName:"overflow-visible",children:s.jsx(Fe,{children:n.map(([a,r])=>s.jsxs(ue,{children:[s.jsx(W,{scope:"row",className:"text-muted-foreground font-normal",children:a}),s.jsx(Y,{children:r})]},a))})})})}function D6(e){const t=[e.merge_attempts?bm(e.merge_attempts,"merge attempt"):null,e.resolver_attempts?bm(e.resolver_attempts,"resolver attempt"):null].filter(Boolean);if(t.length)return t.join(" · ");const n=e.kind==="reconciliation"?"No resolver attempts":"No merge attempts yet";return s.jsx("span",{className:"text-muted-foreground",children:n})}function z6({rows:e}){return s.jsx(Ld,{label:"Integration activity",children:s.jsxs(Ye,{containerClassName:"overflow-visible",children:[s.jsx(We,{children:s.jsxs(ue,{children:[s.jsx(W,{children:"Change"}),s.jsx(W,{children:"Status"}),s.jsx(W,{children:"Attempts"}),s.jsx(W,{children:"Updated"})]})}),s.jsx(Fe,{children:e.map((t,n)=>s.jsxs(ue,{children:[s.jsxs(Y,{children:[s.jsx("div",{className:"font-medium",children:t.kind==="integration"?`Integrate ${wa(t.child_id)} into ${wa(t.other_id)}`:`Reconcile ${wa(t.child_id)} from ${wa(t.other_id)}`}),s.jsx(zu,{children:t.kind==="integration"?"Integration":"Source reconciliation"})]}),s.jsx(Y,{children:s.jsx(io,{status:t.status})}),s.jsx(Y,{children:D6(t)}),s.jsx(Y,{children:Nk(t.updated_at)})]},`${t.kind}-${t.child_id}-${t.other_id}-${t.updated_at}-${n}`))})]})})}function L6({rows:e}){return s.jsx(Ld,{label:"Handoffs",children:s.jsxs(Ye,{containerClassName:"overflow-visible",children:[s.jsx(We,{children:s.jsxs(ue,{children:[s.jsx(W,{children:"From"}),s.jsx(W,{children:"To"}),s.jsx(W,{children:"Status"}),s.jsx(W,{children:"Pinned"})]})}),s.jsx(Fe,{children:e.map(t=>s.jsxs(ue,{children:[s.jsxs(Y,{children:[s.jsx("div",{className:"font-mono font-medium",children:wa(t.child_id)}),t.error?s.jsx(zu,{children:t.error}):null]}),s.jsx(Y,{className:"font-mono",children:wa(t.source_id)}),s.jsx(Y,{children:s.jsx(io,{status:t.status})}),s.jsx(Y,{children:`${t.child_commit} onto ${t.source_commit}`})]},t.id))})]})})}const gy="This machine's worktrees of this repository.",U6="Merge sends one whose thread is at rest to the main queue.",B6=3e4,H6=3e3,I6=6e5,Ff=[{id:"all",label:"All",empty:"worktree"},{id:"needs",label:"Needs landing",empty:"worktree needing landing"},{id:"orphan",label:"No thread to land it",empty:"worktree with no thread to land it"},{id:"queued",label:"In a queue",empty:"queued worktree"},{id:"landed",label:"Landed",empty:"landed worktree"},{id:"decide",label:"Yours to decide",empty:"worktree yours to decide"}],li={not_landed:{label:"Not landed",tone:"neutral"},main:{label:"On main",tone:"success"},production:{label:"In production",tone:"success"},queued:{label:"Main queue",tone:"info"},needs_you:{label:"Needs you",tone:"warning"}},P6="no thread to land it",Ox="its thread waits on you",A1="its thread is done",M1="its thread is retired",Dx=e=>e.archivable&&e.cleanup==="user",q6=e=>e.queue!==null||e.merge.offered===!1&&e.merge.why==="already in a promotion queue",G6=e=>!e.merge.offered&&(e.merge.why===A1||e.merge.why.startsWith(M1)),zx=e=>!e.merge.offered&&e.merge.why===P6||G6(e),Kf=(e,t)=>t==="all"?!0:t==="decide"?Dx(e):(e.landed!==null?"landed":q6(e)?"queued":zx(e)?"orphan":"needs")===t,V6=e=>e.landed!==null?e.threads.some(t=>t.phase!=="done"):e.threads.length>0&&!zx(e);function Bc(e){return e>=1e9?`${(e/1e9).toFixed(1)} GB`:e>=1e6?`${Math.round(e/1e6)} MB`:`${Math.max(1,Math.round(e/1e3))} KB`}function $1(e){const t=e%100,n=t>=11&&t<=13?"th":{1:"st",2:"nd",3:"rd"}[e%10]??"th";return`${e}${n}`}function Y6(e){if(e===null)return"No commits";if(e<1)return"Today";const t=Math.floor(e);return t===1?"1 day ago":`${t} days ago`}const Xf=e=>as(new Date(e*1e3).toISOString()),xi=e=>e.charAt(0).toUpperCase()+e.slice(1);function F6(e,t){var r;const n=t.phase?xi(t.phase):"No phase",a=e.merge;if(!a.offered&&a.why.startsWith(M1)){const l=(r=/; (.+) continues it$/.exec(a.why))==null?void 0:r[1];return l?`Retired · continued by ${l}`:"Retired"}return t.phase==="done"||!a.offered&&a.why===A1?e.landed===null?"Done · without landing this":"Done":a.offered?`${n} · at rest`:a.why.startsWith("its thread is at work")?`${n} · at work`:a.why===Ox?`${n} · waits on you`:a.why.startsWith("its session is not running")?`${n} · session not running`:n}function K6(){const e=un().worktrees;if(!e)throw new Error("The Worktrees page rendered without the worktrees seam.");return e}function X6({org:e}){var M,K;const t=K6(),[n,a]=u.useState(null),[r,l]=u.useState(null),[i,o]=u.useState(null),[c,d]=u.useState(!1),[f,h]=u.useState("all"),[m,x]=u.useState(""),[b,v]=u.useState({}),y=u.useRef({}),{confirm:g,confirm_dialog:p}=Eo(),j=u.useRef(!1),w=u.useCallback(async()=>{if(j.current)return;j.current=!0;const T=await t.list();j.current=!1,T.ok?(a(T.data),l(null)):l(T.refusal)},[t]),N=u.useCallback(async()=>{const T=await t.sizes();d(!T.ok),T.ok&&o(T.data)},[t]);u.useEffect(()=>{w(),N()},[w,N]);const C=(n==null?void 0:n.rows.some(T=>{var B,F;return((B=T.write)==null?void 0:B.state)==="waiting"||((F=T.write)==null?void 0:F.state)==="running"}))??!1;Eu(()=>void w(),C?H6:B6),Eu(()=>void N(),I6);const _=(n==null?void 0:n.rows)??[],S=T=>i==null?void 0:i.sizes[T.path],$=_.filter(Dx),O=i?$.reduce((T,B)=>T+(S(B)??0),0):null,G=_.length===0?gy:`${gy} ${U6}${$.length?` ${$.length} ${$.length===1?"is":"are"} yours to decide${O!==null?`: removing them frees about ${Bc(O)}`:""}.`:""}`,V=m.trim().toLowerCase(),L=T=>!V||[T.name,T.path,T.branch??"",...T.threads.map(B=>B.title??B.thread)].some(B=>B.toLowerCase().includes(V)),U=_.filter(T=>Kf(T,f)&&L(T)).sort((T,B)=>{if(f==="decide")return(S(B)??0)-(S(T)??0);const F=J=>V6(J)?J.merge.offered?0:1:2;return F(T)-F(B)||(T.idle_days??1/0)-(B.idle_days??1/0)}),A=async(T,B)=>{const F=await(T==="merge"?t.merge(B.path):t.remove(B.path));F.ok?v(({[B.path]:J,...he})=>he):v(J=>({...J,[B.path]:F.refusal.message})),await w()},R=async T=>{if(!T.merge.offered)return;const B=T.threads.find(H=>H.thread===(T.merge.offered&&T.merge.thread)),F=(B==null?void 0:B.title)??T.merge.thread,J=B!=null&&B.holds.length?`has ${B.holds.length} open hold(s) (${B.holds.join(", ")})`:"has no open holds",he=T.merge.lands.by==="manager"?`on its turn the queue's merge manager, ${T.merge.lands.manager}, lands it on main`:"on its turn that thread lands it on main",X=T.merge.caveat?`
393
+
394
+ Its session could not be read: ${T.merge.caveat}. A turn it does not start passes on.`:"";await g({title:`Send ${T.name} to the main queue`,description:`This joins the main promotion queue for its thread, ${F}, which ${J} and is told of the join. The queue checks the branch first, and ${he}. Nothing reaches main before then.${X}`,action_label:"Join the main queue"})&&await A("merge",T)},E=async T=>{const B=S(T);await g({title:`Remove ${T.name}?`,description:`This deletes the folder ${T.path}${B!==void 0?` and frees about ${Bc(B)}`:""}.${T.branch?` Its branch ${T.branch} stays, so its work can be checked out again,`:""} and its task records are saved first; a landed plan workspace in it is closed. It stays with you because ${T.cleanup_why[0]??"the Local systems manager leaves it to you"}. The worktree is checked again just before, and nothing is deleted if that check finds work in it.`,action_label:"Remove worktree",destructive:!0})&&(B!==void 0&&(y.current[T.path]=B),await A("remove",T))},k=async T=>{await t.dismiss(T),await w()};return(r==null?void 0:r.reason)==="engine_missing"?s.jsx("div",{className:"flex h-full min-h-0 flex-1 flex-col overflow-auto px-4 py-4 sm:px-6 lg:px-8",children:s.jsx(Zs,{page:"Worktrees"})}):s.jsxs("div",{className:"flex h-full min-h-0 flex-1 flex-col overflow-auto px-4 py-4 sm:px-6 lg:px-8",children:[s.jsx(Jt,{title:"Worktrees",description:G}),!n&&!r&&s.jsx(Q6,{}),r?s.jsx(W6,{refusal:r,read_at:n==null?void 0:n.read_at,on_retry:()=>void w()}):null,n!=null&&n.stale?s.jsxs(me,{variant:"destructive",className:"mt-4",children:[s.jsx(st,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:"Could not read worktrees"}),s.jsxs(ge,{children:[s.jsxs("p",{children:[n.stale.message," This list was read at ",as(new Date(n.read_at).toISOString()),"."]}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void w(),children:"Retry"})]})]}):null,n==null?void 0:n.removals.map(T=>s.jsxs(me,{variant:"success",className:"mt-4",role:"status",children:[s.jsx(je,{children:y.current[T.path]!==void 0?`Removed ${T.name} and freed ${Bc(y.current[T.path])}`:`Removed ${T.name}`}),s.jsxs(ge,{children:[s.jsx("p",{children:T.branch?`Its branch ${T.branch} stays, and its records were saved.`:"Its records were saved."}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void k({removal:T.path}),children:"Dismiss"})]})]},T.path)),n&&_.length===0?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(O0,{className:"text-muted-foreground size-8","aria-hidden":"true"}),s.jsx("h2",{className:"text-lg font-semibold",children:"Only the main checkout"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"No other worktrees. Agents make theirs in .sdlc-worktrees beside the main checkout."})]}):n?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[s.jsx(Nt,{type:"search",className:"w-64","aria-label":"Search worktrees",placeholder:"Search worktrees",value:m,onChange:T=>x(T.target.value)}),s.jsxs("p",{className:"text-muted-foreground ml-auto text-xs",children:["Read at ",as(new Date(n.read_at).toISOString())," · rereads every 30 s"]})]}),s.jsx("div",{className:"mt-3 flex flex-wrap gap-2",role:"group","aria-label":"Worktree state",children:Ff.map(T=>s.jsxs(P,{type:"button",variant:"outline",size:"sm",className:ll,"aria-pressed":f===T.id,onClick:()=>h(T.id),children:[T.label," ",_.filter(B=>Kf(B,T.id)).length]},T.id))}),U.length===0?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(id,{className:"text-muted-foreground size-8","aria-hidden":"true"}),s.jsx("h2",{className:"text-lg font-semibold",children:"No worktrees match"}),V?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-muted-foreground text-sm",children:["No ",(M=Ff.find(T=>T.id===f))==null?void 0:M.empty," matches “",m,"”. Clear the search to see all"," ",_.filter(T=>Kf(T,f)).length,"."]}),s.jsx(P,{type:"button",variant:"outline",onClick:()=>x(""),children:"Clear search"})]}):s.jsxs("p",{className:"text-muted-foreground text-sm",children:["No ",(K=Ff.find(T=>T.id===f))==null?void 0:K.empty," right now."]})]}):s.jsx(ut,{className:"mt-4 shrink-0 overflow-x-auto",children:s.jsxs(Ye,{containerAriaLabel:"Worktrees",className:"table-fixed",children:[s.jsx(We,{children:s.jsxs(ue,{children:[s.jsx(W,{className:"w-[24%]",children:"Worktree"}),s.jsx(W,{className:"w-[24%]",children:"Threads"}),s.jsx(W,{className:"w-[12%]",children:"Landed"}),s.jsx(W,{className:"w-[18%]",children:"Cleanup"}),s.jsx(W,{className:"hidden w-[10%] md:table-cell",children:"Last commit"}),s.jsx(W,{className:"w-[12%] text-right",children:"Actions"})]})}),s.jsx(Fe,{children:U.map(T=>s.jsx(Z6,{org:e,row:T,size:S(T),sizes:i!==null?"read":c?"failed":"measuring",can_write:n.can_write,sent:b[T.path],on_merge:()=>void R(T),on_remove:()=>void E(T),on_dismiss:B=>void k(B),on_clear_sent:()=>v(({[T.path]:B,...F})=>F)},T.path))})]})})]}):null,p]})}function Q6(){return s.jsx("div",{className:"mt-6 grid gap-2",role:"status","aria-label":"Loading worktrees",children:Array.from({length:6},(e,t)=>s.jsx(_t,{className:t===5?"h-10 w-2/3":"h-10 w-full"},t))})}function W6({refusal:e,read_at:t,on_retry:n}){const a=ls();return e.reason==="view_outdated"?s.jsxs(me,{variant:"warning",className:"mt-6",children:[s.jsx(Xt,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:Dl}),s.jsx(ge,{children:a})]}):s.jsxs(me,{variant:"destructive",className:"mt-6",children:[s.jsx(st,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:"Could not read worktrees"}),s.jsxs(ge,{children:[s.jsxs("p",{children:[e.message,t?` This list was read at ${as(new Date(t).toISOString())}.`:""]}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:n,children:"Retry"})]})]})}function vc({children:e,muted:t=!0}){return s.jsx("div",{className:le("truncate text-xs",t&&"text-muted-foreground"),title:e,children:e})}function Z6({org:e,row:t,size:n,sizes:a,can_write:r,sent:l,on_merge:i,on_remove:o,on_dismiss:c,on_clear_sent:d}){const{href:f,Link:h}=Ze(),m=e?`/org/${encodeURIComponent(e)}`:"",x=f(`${m}/threads`),b=f(`${m}/tasks`),v=li[t.landed??"not_landed"],y=Dx(t),g=t.write,p=(g==null?void 0:g.state)==="waiting"||(g==null?void 0:g.state)==="running",j=t.threads.find(G=>"thread"in t.merge&&G.thread===t.merge.thread)??t.threads[0],w=t.merge,N=!w.offered&&w.why===Ox,C=r&&t.landed===null&&!t.queue&&!N&&!zx(t),_=n!==void 0?Bc(n):a==="measuring"?"Measuring size…":a==="failed"?"Size could not be read":null,S=y?{label:"Yours to decide",muted:!1,second:[_,t.cleanup_why[0]]}:t.archivable?{label:"The manager removes it",muted:!1,second:[_]}:{label:"Stays",muted:!0,second:[_,t.why[0]??null]},$=S.second.filter(Boolean).join(" · "),O=t.path.slice(0,t.path.length-t.name.length-1)||".";return s.jsxs(s.Fragment,{children:[s.jsxs(ue,{"data-testid":"worktrees-row",children:[s.jsxs(Y,{children:[s.jsx("div",{className:"truncate font-medium",title:t.name,children:t.name}),s.jsx(vc,{children:t.branch??"Detached"}),O!==".sdlc-worktrees"?s.jsx(vc,{children:`in ${O}`}):null]}),s.jsx(Y,{children:j?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"truncate",title:j.title??j.thread,children:j.title??j.thread}),s.jsx(vc,{children:`${F6(t,j)}${t.threads.length>1?` · ${t.threads.length-1} more`:""}`})]}):s.jsx("span",{className:"text-muted-foreground",children:"No thread"})}),s.jsx(Y,{children:s.jsx(ce,{variant:v.tone,children:v.label})}),s.jsxs(Y,{children:[s.jsx("div",{className:le("truncate",S.muted&&"text-muted-foreground"),children:S.label}),$?s.jsx("div",{className:"hidden md:block",children:s.jsx(vc,{children:$})}):null]}),s.jsx(Y,{className:"hidden md:table-cell",children:Y6(t.idle_days)}),s.jsx(Y,{className:"text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[p?s.jsx(P,{type:"button",variant:"outline",size:"sm",loading:!0,disabled:!0,children:(g==null?void 0:g.kind)==="merge"?g.state==="waiting"?"Waiting to join…":"Joining main…":(g==null?void 0:g.state)==="waiting"?"Waiting to remove…":"Removing…"}):t.queue?s.jsx(ce,{variant:li.queued.tone,children:`${li.queued.label} · ${$1(t.queue.position)}`}):N?s.jsx(h,{href:b,"aria-label":`${t.name}: its thread waits on you, in Waiting on you`,children:s.jsx(ce,{variant:li.needs_you.tone,children:li.needs_you.label})}):C?s.jsx(P,{type:"button",variant:"outline",size:"sm",title:w.offered?void 0:w.why,"aria-disabled":!w.offered||void 0,className:le(!w.offered&&"cursor-not-allowed opacity-50"),"aria-label":`Send ${t.name} to the main queue`,"aria-describedby":w.offered?void 0:`why-${t.name}`,onClick:w.offered?i:void 0,children:"Merge"}):null,y&&r&&!p?s.jsx(P,{type:"button",variant:"outline",size:"sm","aria-label":`Remove ${t.name}`,onClick:o,children:"Remove"}):null]})})]}),s.jsx(J6,{row:t,threads:x,tasks:b,merge_shown:C,sent:l,on_dismiss:c,on_clear_sent:d})]})}function J6({row:e,threads:t,tasks:n,merge_shown:a,sent:r,on_dismiss:l,on_clear_sent:i}){var b,v,y,g;const{Link:o}=Ze(),c=(p="Open in Threads")=>s.jsx(o,{className:"text-primary text-sm hover:underline",href:t,children:p}),d=p=>s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:p,children:"Dismiss"}),f=e.write,h=e.threads.find(p=>p.thread===("thread"in e.merge?e.merge.thread:void 0))??e.threads[0],m=(h==null?void 0:h.title)??"Its thread";let x=null;if(r)x=s.jsxs(me,{variant:"destructive",children:[s.jsx(st,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:"It was not sent"}),s.jsxs(ge,{children:[s.jsx("p",{children:r}),d(i)]})]});else if((f==null?void 0:f.state)==="waiting")x=s.jsxs("p",{className:"text-muted-foreground text-sm",role:"status",children:["Another worktree's write runs first; ",e.name," ",f.kind==="merge"?"joins":"is removed"," next."]});else if((f==null?void 0:f.state)==="running")x=s.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:f.kind==="merge"?`Joining the main queue for ${e.name}. The queue checks its branch first; this can take a few minutes.`:`Removing ${e.name}. It is checked again first.`});else if((f==null?void 0:f.state)==="joined"){const p=((b=f.lands)==null?void 0:b.by)==="manager"?`the merge manager, ${f.lands.manager}, lands it`:"it lands it on its turn";x=s.jsxs(me,{variant:f.told?"success":"warning",role:"status",children:[s.jsx(je,{children:`${e.name} joined the main queue, ${$1(f.position)}`}),s.jsxs(ge,{children:[s.jsx("p",{children:f.told?`${m} was left a notice, and ${p}.`:"Its thread could not be told, so it does not know its turn is coming. Tell it from Threads; the join itself is unchanged."}),((v=e.queue)==null?void 0:v.position)===1&&e.queue.turn==="next"&&e.queue.passes_at?s.jsx("p",{children:`It is first in the main queue. Its thread was left a notice but not woken: continue it in its session, or the turn passes on at ${Xf(e.queue.passes_at)}.`}):null,s.jsxs("div",{className:"flex items-center gap-3",children:[d(()=>l({write:e.path})),!f.told||((y=e.queue)==null?void 0:y.position)===1?s.jsx("span",{className:"mt-2",children:c()}):null]})]})]})}else if(f&&(f.state==="refused"||f.state==="failed")){const p=f.kind==="merge"?`The main queue refused ${e.name}`:`${e.name} was not removed`;x=s.jsxs(me,{variant:"destructive",children:[s.jsx(st,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:f.kind==="merge"&&f.state==="failed"?`${e.name} did not join`:p}),s.jsxs(ge,{children:[s.jsx("p",{children:`${xi(f.message)}${f.kind==="merge"?" Nothing was queued.":" Nothing was deleted."}`}),s.jsxs("div",{className:"flex items-center gap-3",children:[d(()=>l({write:e.path})),f.kind==="merge"?s.jsx("span",{className:"mt-2",children:c()}):null]})]})]})}else if(e.last_turn){const p=e.last_turn;x=s.jsxs(me,{variant:"warning",children:[s.jsx(st,{className:"size-4","aria-hidden":"true"}),s.jsx(je,{children:`${e.name}'s turn ${p.outcome==="failed"?"failed":"passed on"} at ${Xf(p.left_at)}`}),s.jsxs(ge,{children:[s.jsx("p",{children:`${xi(p.reason)}. Continue the thread in its session; Merge sends it again once it is at rest.`}),s.jsxs("div",{className:"flex items-center gap-3",children:[d(()=>l({turn:{execution:p.execution,left_at:p.left_at}})),s.jsx("span",{className:"mt-2",children:c()})]})]})]})}else((g=e.queue)==null?void 0:g.position)===1&&e.queue.turn==="next"&&e.queue.passes_at?x=s.jsxs("p",{className:"text-sm",role:"status",children:[`Its turn now: ${e.name} is first in the main queue. Continue its thread in its session, or the turn passes on at ${Xf(e.queue.passes_at)}. `,c()]}):!e.merge.offered&&e.merge.why===Ox?x=s.jsxs("p",{className:"text-sm",id:`why-${e.name}`,children:["Its thread waits on you. Merge comes back once you answer it. ",s.jsx(o,{className:"text-primary hover:underline",href:n,children:"In Waiting on you"})]}):!e.merge.offered&&e.merge.successor&&!e.queue&&e.landed===null?x=s.jsx("p",{className:"text-sm",children:c("Open its successor in Threads")}):a&&!e.merge.offered?x=s.jsxs("p",{className:"text-sm",id:`why-${e.name}`,children:[`${xi(e.merge.why)}. `,e.merge.thread&&!e.merge.why.startsWith("its thread is at work")?c():null]}):e.merge.offered&&e.merge.caveat&&(x=s.jsx("p",{className:"text-muted-foreground text-sm",children:`${xi(e.merge.caveat)}.`}));return x?s.jsx(ue,{className:"hover:bg-transparent",children:s.jsx(Y,{colSpan:6,className:"pt-0",children:x})}):null}const e5=["reason","since","store","repository","folder","home","member_path"];function O1(e,t){const n={status:e,message:typeof(t==null?void 0:t.error)=="string"?t.error:"The read failed; see the sdlc viewer terminal."};(t==null?void 0:t.retry)===!0&&(n.retry=!0),typeof(t==null?void 0:t.retry_after)=="number"&&(n.retry_after=t.retry_after),typeof(t==null?void 0:t.seedable)=="boolean"&&(n.seedable=t.seedable);for(const a of e5){const r=t==null?void 0:t[a];typeof r=="string"&&(n[a]=r)}return n}function _r({base:e="",fetcher:t=fetch}){return async(n,a={})=>{const r=new URLSearchParams;for(const[c,d]of Object.entries(a))if(Array.isArray(d))for(const f of d)r.append(c,f);else d!==void 0&&d!==!1&&d!==""&&r.set(c,String(d));const l=r.size>0?`?${r.toString()}`:"";let i;try{i=await t(`${e}api/app/${n}${l}`,{cache:"no-store"})}catch{return{ok:!1,refusal:{status:0,message:"The viewer did not answer. Is sdlc viewer still running?"}}}const o=await i.json().catch(()=>null);return i.ok?{ok:!0,data:o}:{ok:!1,refusal:O1(i.status,o)}}}function t5(e={}){const t=_r(e),n=r=>async()=>{const l=await t("access");return l.ok?{ok:!0,data:l.data[r]}:l},a=encodeURIComponent;return{tasks:{access:n("tasks"),configuration:()=>t("tasks/configuration"),listTasks:r=>t(`tasks/lists/${a(r)}/tasks`),task:r=>t(`tasks/tasks/${a(r)}`)},issues:{access:n("issues"),list:(r={})=>t("issues",r),issue:r=>t(`issues/${a(r)}`),issueSections:r=>t(`issues/${a(r)}/sections`),issueRelated:r=>t(`issues/${a(r)}/related`)},releases:{access:n("releases"),list:()=>t("releases"),release:r=>t(`releases/${a(r)}`),candidate:()=>t("releases/candidate")},organizations:{access:n("organizations"),list:()=>t("orgs")},projects:{access:n("projects"),list:()=>t("projects")},about:{about:()=>t("about")}}}function n5(e={}){const t=_r(e);return{listQueues:()=>t("queues"),queue:n=>t(`queues/${encodeURIComponent(n)}`),members:async()=>({ok:!0,data:[]}),refresh_ms:15e3,settings_note:"Local queue settings are the engine's built-in policies. Turns change through promote.",thread_subjects:!0,description:"Where this checkout's threads take turns: landing on main, deploying to staging, publishing and accepting the graph.",read_scope:"this checkout only",subject_label:"Thread"}}const gi=e=>({ok:!1,refusal:{status:0,message:e}});function Lx({base:e="",fetcher:t=fetch}){return async(n,a)=>{let r;try{r=await t(`${e}api/${n}`,{method:"POST",cache:"no-store",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})}catch{return gi("The viewer did not answer. Is sdlc viewer still running?")}const l=await r.json().catch(()=>null);return r.ok?{ok:!0,data:l}:{ok:!1,refusal:O1(r.status,l)}}}function s5(e={}){const t=_r(e),n=Lx(e);return{chart:()=>t("org"),change:a=>n("org-change",a)}}function a5(e={}){const t=_r(e),n=o=>`tasks/tasks/${encodeURIComponent(o)}`,{base:a="",fetcher:r=fetch}=e;return{access:async()=>{const o=await t("access");return o.ok?{ok:!0,data:o.data.tasks}:o},availability:async()=>{const o=await t("tasks/configuration");if(!o.ok)return o.refusal.reason==="engine_missing"?{state:"off",refusal:o.refusal}:{state:"error",refusal:o.refusal};const c=o.data;if(c.state!=="active")return{state:"available"};const d=c.workspaces.find(h=>h.is_default)??c.workspaces[0],f=d==null?void 0:d.lists[0];return!d||!f?{state:"error"}:{state:"active",configuration:c,workspace:d,list:f}},listTasks:(o,c={})=>{var d,f,h;return c.state==="archived"?Promise.resolve(gi("This checkout keeps no archived tasks.")):c.assigned_to_me?Promise.resolve(gi("Assigned to you is a status group here.")):t(`tasks/lists/${encodeURIComponent(o)}/tasks`,{search:c.search,owner:c.owner===""?"none":c.owner,group:c.group,urgent:c.urgent?"true":void 0,over_estimate:c.over_estimate?"true":void 0,opened:(d=c.opened_groups)!=null&&d.length?c.opened_groups.join(","):void 0,closed:(f=c.closed_groups)!=null&&f.length?c.closed_groups.join(","):void 0,all:(h=c.all_groups)!=null&&h.length?c.all_groups.join(","):void 0})},members:()=>t("tasks/members"),waitingOnYou:()=>t("tasks/waiting-on-you"),task:o=>t(n(o)),taskSections:o=>t(`${n(o)}/sections`),taskRelated:o=>t(`${n(o)}/related`),hierarchyRevision:async()=>({ok:!0,data:0}),commands:{run:async()=>gi("The local viewer changes tasks only with Done."),complete:async o=>{const c="task"in o?{task:o.task}:{hold:o.hold};let d;try{d=await r(`${a}api/task-done`,{method:"POST",cache:"no-store",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)})}catch{return gi("The viewer did not answer. Is sdlc viewer still running?")}if(d.ok)return{ok:!0,data:null};const f=await d.text().catch(()=>"");return{ok:!1,refusal:{status:d.status,message:f||`It was not recorded (HTTP ${d.status}).`}}}}}}function r5(e={}){const t=_r(e),n=Lx(e),a=encodeURIComponent,r=l=>l!=null&&l.fresh?{fresh:1}:{};return{access:async()=>{const l=await t("access");return l.ok?{ok:!0,data:l.data.releases}:l},list:(l={})=>t("releases",r(l)),release:(l,i)=>t(`releases/${a(l)}`,r(i)),candidate:l=>t("releases/candidate",r(l)),candidateBatch:l=>t("releases/candidate/batch",r(l)),related:(l,i)=>t(`releases/${a(l)}/related`,r(i)),plannedRelease:(l,i)=>t(`releases/planned/${a(l)}`,r(i)),roadmap:l=>t("releases/roadmap",{...r(l),...l!=null&&l.mine?{mine:1}:{}}),roadmapMoved:l=>t("releases/roadmap/moved",r(l)),roadmapSeen:l=>n("roadmap/seen",{at:l})}}function l5(e={}){const t=_r(e),n=Lx(e);return{list:()=>t("worktrees"),sizes:()=>t("worktree-sizes"),merge:a=>n("worktree-merge",{path:a}),remove:a=>n("worktree-remove",{path:a}),dismiss:a=>n("worktree-dismiss",a)}}function i5(e={}){const t=_r(e);return{overview:()=>t("workspaces")}}const o5=15e3,c5=10,vy="idle-sessions-list",yy="idle-sessions-heading",jy="idle-sessions-confirm-text";function D1(e){return e>=1024?`${(e/1024).toFixed(1)} GB`:`${Math.round(e)} MB`}const u5=e=>`${Number.isInteger(e)?e:e.toFixed(1)} h`,z1=e=>e===1?"1 session":`${e} sessions`;function d5(e){const t=e.released.length?`Closed ${z1(e.released.length)}.`:"Closed no sessions.";return e.kept.length?`${t} Kept ${e.kept.length}:`:t}function f5({row:e}){const t=[e.name,e.retired?"continued in another session":"",`idle ${u5(e.idle_hours)}`,D1(e.memory_mb)].filter(Boolean).join(" · ");return s.jsxs("li",{children:[s.jsx("p",{className:"idle-name",children:e.title}),s.jsxs("p",{className:"caption",children:[s.jsxs("span",{className:"muted",children:[t,e.unfinished&&" ·"]}),e.unfinished&&s.jsx("span",{className:"idle-unfinished",children:" unfinished work"})]})]})}function h5(){const[e,t]=u.useState(null),[n,a]=u.useState(!1),[r,l]=u.useState(!1),[i,o]=u.useState(null),[c,d]=u.useState(null),[f,h]=u.useState(""),m=u.useRef(""),x=u.useRef(null),b=u.useRef(null),v=u.useRef(null),y=u.useRef(null),g=u.useRef(0),p=u.useRef(0),j=u.useCallback(async()=>{const L=++g.current,U=await m6();if(!U||L<p.current)return;p.current=L,h("");const A=JSON.stringify(U);A!==m.current&&(m.current=A,t(U))},[]);u.useEffect(()=>{const L=setTimeout(j,0),U=setInterval(j,o5);return()=>{clearTimeout(L),clearInterval(U)}},[j]),u.useEffect(()=>{var U;const L=y.current;L&&(y.current=null,(U={cancel:b,close:x,dismiss:v}[L].current)==null||U.focus())});const w=(e==null?void 0:e.sessions.length)??0;if(u.useEffect(()=>{r&&!w&&i===null&&l(!1)},[r,w,i]),!w&&!c&&!f&&i===null)return null;const N=()=>{i===null&&(l(!0),y.current="cancel")},C=()=>{i===null&&(l(!1),y.current="close")},_=async()=>{if(i!==null)return;o(w),d(null),h("");const L=await p6();p.current=g.current+1,await j(),o(null),l(!1),a(!1),"error"in L?(h(`The sessions were not closed: ${L.error.replace(/\.+$/,"")}.`),y.current="close"):(d(L.done),y.current="dismiss")},S=()=>{d(null),y.current="close"},$=L=>{L.key==="Escape"&&(L.preventDefault(),C())},O=i!==null?`Closing ${z1(i)}…`:c?d5(c):"",G=(e==null?void 0:e.sessions.slice(0,c5))??[],V=w-G.length;return s.jsxs("div",{className:"idle",role:"group",...w?{"aria-labelledby":yy}:{"aria-label":"Idle sessions"},children:[f&&s.jsx("div",{className:"alert",role:"alert",children:f}),w>0&&e&&s.jsxs("div",{className:"idle-head",children:[s.jsxs("div",{className:"idle-title",children:[s.jsxs("h2",{className:"group",id:yy,"aria-label":`Idle sessions, ${w}`,children:["Idle sessions",s.jsx("span",{className:"count",children:w})]}),s.jsxs("p",{className:"caption muted",children:["over ",e.idle_over," h · ",D1(e.memory_mb)]})]}),s.jsxs("div",{className:"tools",children:[s.jsx("button",{type:"button",className:"pin","aria-expanded":n,"aria-controls":vy,"aria-label":n?"Hide the idle sessions list":"Show the idle sessions list",onClick:()=>a(L=>!L),children:n?"Hide":"Show"}),s.jsx("button",{type:"button",className:"pin",ref:x,"aria-expanded":r,"aria-label":"Close idle sessions…",onClick:N,children:"Close idle…"})]})]}),w>0&&s.jsxs("ul",{className:"idle-list",id:vy,hidden:!n,"aria-label":`Sessions idle over ${e==null?void 0:e.idle_over} hours, longest idle first`,children:[G.map(L=>s.jsx(f5,{row:L},L.session)),V>0&&s.jsx("li",{children:s.jsxs("p",{className:"caption muted",children:["…and ",V," more"]})})]}),r&&w>0&&s.jsxs("div",{className:"idle-confirm",role:"group","aria-label":"Close idle sessions","aria-describedby":jy,onKeyDown:$,children:[s.jsxs("p",{id:jy,children:[w===1?"Close this session?":`Close these ${w} sessions?`," Each transcript stays, so reopening a conversation resumes it, and a thread with unfinished work goes on with Continue on its card. A session that is busy or has background work running is kept."]}),s.jsxs("div",{className:"tools start",children:[s.jsx("button",{type:"button",className:"pin","aria-disabled":i!==null?!0:void 0,"aria-busy":i!==null?!0:void 0,onClick:_,children:i!==null?`Closing ${i}…`:`Close ${w}`}),s.jsx("button",{type:"button",className:"pin",ref:b,"aria-disabled":i!==null?!0:void 0,onClick:C,children:"Cancel"})]})]}),s.jsx("p",{className:"idle-status",role:"status",children:O}),c&&s.jsxs(s.Fragment,{children:[c.kept.length>0&&s.jsx("ul",{className:"idle-list","aria-label":"Kept sessions",children:c.kept.map(L=>s.jsxs("li",{children:[s.jsx("p",{className:"idle-name",children:L.title}),s.jsx("p",{className:"caption muted",children:L.why})]},L.session))}),s.jsx("div",{className:"tools start",children:s.jsx("button",{type:"button",className:"pin",ref:v,"aria-label":"Dismiss the close result",onClick:S,children:"Dismiss"})})]})]})}const by={ok:"lime",you:"amber",alert:"red",waiting:"blue",blocked:"purple",muted:"grey",plain:"grey"};function Hc(e){return e&&Object.hasOwn(by,e)?by[e]:"grey"}const m5=1e4,p5=6e4,x5=2,Qf="#thread-",g5=B0("Threads"),v5={working:"▶",prod:"↑",planned:"○"},wy=3,_y=["working","ready","prod","waiting","blocked","paused","planned"],y5={ready:"results ready",prod:"ready for prod"};function j5(e){const t=_y.map(a=>[a,e.filter(r=>r.state===a).length]),n=[...new Set(e.map(a=>a.state).filter(a=>!_y.includes(a)))].map(a=>[a,e.filter(r=>r.state===a).length]);return[...t,...n].filter(([,a])=>a>0).map(([a,r])=>`${r} ${y5[a]??a}`).join(" · ")}const b5={Terminal:"Opening in Terminal · if macOS asks whether sdlc viewer may control Terminal, allow it.","VS Code":"Opening in VS Code, in the window on this thread's folder.","Claude app":"Opening in the Claude app."};function w5(e){return e.agent!=="Claude"?null:e.where==="VS Code"?"Open in VS Code":e.where==="Claude app"?e.open?"Open in Claude app":null:e.where==="Terminal"?"Open in Terminal":null}const wm=[["running","Running"],["you","Needs you"],["blocked","Blocked"],["paused","Paused"],["idle","Idle"]],_m=[["claude","Claude"],["codex","Codex"]],Ny={paused:"Parked on purpose (status paused); waiting on nothing",idle:"Not running, not asking for you, not blocked, and not paused; includes done and ready for production, and threads in line in a promotion queue"},ky=e=>e.kind??"idle",Sy=e=>e.agent==="Codex"?"codex":"claude";function _5(e,t,n,a){const r=n.toLowerCase().split(/\s+/).filter(Boolean),l=wm.map(([v])=>v).filter(v=>a.has(v)),i=_m.map(([v])=>v).filter(v=>a.has(v)),o=v=>!l.length||l.includes(ky(v)),c=v=>!i.length||i.includes(Sy(v)),d=v=>{if(!r.length)return!0;const y=v.search??v.title.toLowerCase();return r.every(g=>y.includes(g))},f=e.filter(d),h={};for(const[v]of wm)h[v]=f.filter(y=>c(y)&&ky(y)===v).length;for(const[v]of _m)h[v]=f.filter(y=>o(y)&&Sy(y)===v).length;const m=[],x=[],b=[];return e.forEach((v,y)=>{b.length=Math.min(b.length,v.depth);const g=v.depth>0?b[v.depth-1]??null:null,p=d(v)&&o(v)&&c(v);let j=null;p&&(j=g?{depth:g.depth+1,pinned:g.pinned}:{depth:0,pinned:y<t&&v.pinned!==!1},(j.pinned?m:x).push({row:v,depth:j.depth})),b.push(j)}),{rows:[...m,...x],pinned:m.length,counts:h,narrowed:r.length+l.length+i.length>0}}const N5=new Set(["not_terminal","another_process","continued","no_open","pending"]);function Cy({label:e,count:t,hint:n}){const a=n?`hint-${e.toLowerCase().replace(/\W+/g,"-")}`:void 0;return s.jsxs(s.Fragment,{children:[s.jsxs("h2",{className:"group","aria-label":`${e}, ${t}`,"aria-describedby":a,children:[e,s.jsx("span",{className:"count",children:t})]}),n&&s.jsx("span",{className:"sr-only",id:a,children:n})]})}function Wf({text:e,role:t}){return s.jsx("span",{className:`badge tone-${Hc(t)}`,children:e})}function k5({serves:e}){const t=e.slice(0,x5),n=e.length-t.length;return s.jsxs("p",{className:"caption muted serves",children:[t.map((a,r)=>s.jsxs("span",{children:[r>0&&", ",s.jsxs("a",{href:`releases?planned=${encodeURIComponent(a.planned_release)}`,"aria-label":`serves ${a.name}, ${a.level}: open it in Planned releases`,children:["serves ",a.name," (",a.level,")"]})]},a.planned_release)),n>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{"aria-hidden":"true",children:[", +",n," more"]}),s.jsxs("span",{className:"sr-only",children:[", and ",n," more planned releases"]})]})]})}function Ry({id:e,href:t}){return t?s.jsx("a",{className:"id-link",href:t,children:e}):s.jsx("span",{className:"id-text",children:e})}function S5({onConnection:e,org:t=null,project:n=null}){const[a,r]=u.useState(null),[l,i]=u.useState(!1),[o,c]=u.useState(""),[d,f]=u.useState(!1),[h,m]=u.useState(null),[x,b]=u.useState(""),[v,y]=u.useState(null),[g,p]=u.useState(null),[j,w]=u.useState(null),[N,C]=u.useState(""),[_,S]=u.useState(()=>new Set),[$,O]=u.useState(null),G=u.useRef(null),V=u.useRef(""),L=u.useRef(""),U=u.useRef(""),A=u.useRef(null),R=u.useRef(null),E=u.useRef(null),k=q=>{var oe;return q instanceof HTMLButtonElement&&q.classList.contains("pin")&&((oe=A.current)!=null&&oe.contains(q))?q.dataset.key??null:null},M=q=>{E.current=k(q.target)},K=()=>{setTimeout(()=>{k(document.activeElement)||(E.current=null)},0)},T=u.useCallback(async()=>{const q=await C1();if("none"in q){i(!0),c(""),e("live");return}if("error"in q){c(q.error),e("disconnected");return}i(!1),c(""),b(""),e("live");const oe=JSON.stringify(q.data);oe!==V.current&&(V.current=oe,r(q.data))},[e]);u.useEffect(()=>{let q=!0;h6().then(ke=>q&&f(ke));const oe=setTimeout(T,0),ve=setInterval(T,m5);return()=>{q=!1,clearTimeout(oe),clearInterval(ve)}},[T]),u.useEffect(()=>{let q=!0;const oe=()=>f6().then(ke=>{q&&ke&&y(Me=>JSON.stringify(Me)===JSON.stringify(ke)?Me:ke)});oe();const ve=setInterval(oe,p5);return()=>{q=!1,clearInterval(ve)}},[]),u.useEffect(()=>{const q=()=>{var Yt,gn,ae;const ve=window.location.hash;if(!ve.startsWith(Qf)){w(null);return}if(ve===L.current)return;let ke;try{ke=decodeURIComponent(ve.slice(Qf.length))}catch{ke=ve.slice(Qf.length)}const Me=document.getElementById(`thread-${ke}`);if(!Me||!((Yt=A.current)!=null&&Yt.contains(Me))){if(!A.current||!a)return;const He=U.current!==ve;if(U.current=ve,a.threads.some(qe=>qe.key===ke)){He&&(N||_.size)?(C(""),S(new Set)):L.current=ve,w(null);return}w(ke);return}L.current=ve,w(null),p(ke),(gn=Me.querySelector(".thread-title"))==null||gn.focus({preventScroll:!0}),(ae=Me.scrollIntoView)==null||ae.call(Me,{block:"center"})},oe=()=>{L.current="",U.current="",q()};return q(),window.addEventListener("hashchange",oe),()=>window.removeEventListener("hashchange",oe)},[a,N,_]),u.useEffect(()=>{if(!g)return;const q=()=>p(null);return document.addEventListener("pointerdown",q,!0),document.addEventListener("keydown",q,!0),()=>{document.removeEventListener("pointerdown",q,!0),document.removeEventListener("keydown",q,!0)}},[g]),u.useLayoutEffect(()=>{const q=E.current??R.current;if(!q||!A.current)return;const oe=document.activeElement;if(oe&&oe!==document.body&&!A.current.contains(oe)){E.current=null;return}const ve=[...A.current.querySelectorAll("button.pin")].find(ke=>ke.dataset.key===q);ve?oe!==ve&&ve.focus({preventScroll:q!==R.current}):E.current=null});const B=async q=>{if(h)return;const oe=!q.pinned;R.current=q.key,m(q.key);const ve=await g6(q.key,oe);m(null),ve||r(ke=>ke&&{...ke,threads:ke.threads.map(Me=>Me.key===q.key?{...Me,pinned:oe}:Me)}),await T(),b(ve?`The pin was not saved: ${ve}`:""),R.current===q.key&&(R.current=null)},[F,J]=u.useState(()=>new Set),[he,X]=u.useState({}),D=ls(),{confirm:H,confirm_dialog:te}=Eo(),se=(q,oe)=>X(ve=>{const{[q]:ke,...Me}=ve;return oe?{...Me,[q]:oe}:Me}),ye=(q,oe)=>J(ve=>{const ke=new Set(ve);return oe?ke.add(q):ke.delete(q),ke}),re=Object.keys(he).some(q=>!F.has(q));u.useEffect(()=>{if(!re)return;const q=()=>X(oe=>Object.fromEntries(Object.entries(oe).filter(([ve])=>F.has(ve))));return document.addEventListener("pointerdown",q,!0),document.addEventListener("click",q,!0),()=>{document.removeEventListener("pointerdown",q,!0),document.removeEventListener("click",q,!0)}},[re,F]);const we=q=>setTimeout(()=>{var oe,ve;return(ve=[...((oe=A.current)==null?void 0:oe.querySelectorAll("button.open-thread"))??[]].find(ke=>ke.dataset.key===q))==null?void 0:ve.focus()},0),ne=async(q,oe)=>{const ve=await H({title:`Reopen ${q.title} in Terminal?`,description:`Its session is closed. It opens in a new Terminal window in ${oe??"the thread's folder"}, running claude --resume.`,action_label:"Reopen"});return we(q.key),ve},rt=async q=>{if(F.has(q.key))return;let oe=!1;for(;;){ye(q.key,!0),se(q.key,{key:q.key,text:b5[q.where??""]??"Opening.",role:"waiting"});const ve=await x6(q.key,oe);if(ye(q.key,!1),"done"in ve){se(q.key,null);return}const{reason:ke,error:Me,where:Yt}=ve.refused;if(ke==="closed"&&!oe){if(se(q.key,null),!await ne(q,Yt))return;oe=!0;continue}const gn=ke==="outdated"?`${Me.replace(/\.*$/,".")} ${D}`:Me.replace(/\.*$/,"."),ae=ke==="terminal_denied"?"you":N5.has(ke)?"muted":"alert";se(q.key,{key:q.key,text:gn,role:ae});return}},de=(a==null?void 0:a.threads)??[],Be=!l&&de.length>0,Q=_5(de,(a==null?void 0:a.pinnedCount)??0,N,_),Re=Q.pinned,Ue=Q.rows;u.useEffect(()=>{if(!Be)return;const q=oe=>{var ke,Me;if(oe.key!=="/"||oe.ctrlKey||oe.metaKey||oe.altKey||oe.defaultPrevented)return;const ve=document.activeElement;ve&&(/^(INPUT|TEXTAREA|SELECT)$/.test(ve.tagName)||ve.isContentEditable)||document.querySelector('[role="dialog"], [role="alertdialog"], dialog[open]')||(oe.preventDefault(),(ke=G.current)==null||ke.focus(),(Me=G.current)==null||Me.select())};return document.addEventListener("keydown",q),()=>document.removeEventListener("keydown",q)},[Be]);const yt=q=>S(oe=>{const ve=new Set(oe);return ve.has(q)?ve.delete(q):ve.add(q),ve}),Ne=()=>{var q;C(""),S(new Set),(q=G.current)==null||q.focus()},Dt=(q,oe)=>{const ve=Q.counts[q]??0,ke=_.has(q),Me=Ny[q];return s.jsxs("button",{type:"button",className:"filter-chip","aria-pressed":ke,"aria-describedby":Me?`chip-hint-${q}`:void 0,disabled:ve===0&&!ke&&$!==q,onFocus:()=>O(q),onBlur:()=>O(Yt=>Yt===q?null:Yt),onClick:()=>yt(q),children:[oe," ",ve]},q)};return s.jsxs(s.Fragment,{children:[te,s.jsxs("header",{className:"main-head",children:[s.jsx("h1",{children:"Threads"}),a&&!l&&s.jsx("p",{className:"muted",children:a.line})]}),s.jsxs("section",{className:"card threads","aria-label":"Threads",children:[s.jsx(h5,{}),o&&s.jsxs("div",{className:"alert",role:"alert",children:["Threads unavailable: ",o.replace(/\.+$/,""),". Retrying every 10 s."]}),x&&s.jsx("div",{className:"alert",role:"alert",children:x}),s.jsx("p",{className:"caption muted not-listed",role:"status",children:j!==null&&!l?s.jsxs(s.Fragment,{children:["Thread ",j," is not in this list. ",s.jsx("code",{children:"sdlc view --all"})," lists older threads."]}):null}),Be&&s.jsxs("div",{className:"threads-toolbar",children:[s.jsxs("div",{className:"search-field",children:[s.jsx("input",{ref:G,type:"search",placeholder:"Search threads","aria-label":"Search threads","aria-keyshortcuts":"/",value:N,onChange:q=>C(q.target.value),onKeyDown:q=>{q.key==="Escape"&&(q.preventDefault(),N?C(""):q.currentTarget.blur())}}),N&&s.jsx("button",{type:"button",className:"search-clear","aria-label":"Clear search",onClick:()=>{var q;C(""),(q=G.current)==null||q.focus()},children:s.jsx("span",{"aria-hidden":"true",children:"×"})})]}),s.jsxs("div",{className:"filter-row",children:[s.jsx("div",{className:"filter-group",role:"group","aria-label":"Status",children:wm.map(([q,oe])=>Dt(q,oe))}),s.jsx("div",{className:"filter-group",role:"group","aria-label":"Agent",children:_m.map(([q,oe])=>Dt(q,oe))})]}),Object.entries(Ny).map(([q,oe])=>s.jsx("span",{className:"sr-only",id:`chip-hint-${q}`,children:oe},q)),s.jsx("p",{className:"caption muted narrowed",role:"status",children:Q.narrowed?s.jsxs(s.Fragment,{children:[Ue.length," of ",de.length," threads ·"," ",s.jsx("button",{type:"button",className:"clear-filters","aria-label":"Clear search and filters",onClick:Ne,children:"Clear"})]}):null})]}),l?s.jsx("p",{className:"muted",children:g5}):s.jsxs("div",{className:"thread-list",ref:A,onFocus:M,onBlur:K,children:[Ue.map(({row:q,depth:oe},ve)=>s.jsxs("div",{children:[Re>0&&ve===0&&s.jsx(Cy,{label:"Pinned",count:Re,hint:"Threads you pinned; they stay first in every order"}),Re>0&&ve===Re&&s.jsx(Cy,{label:"Other threads",count:Ue.length-Re}),s.jsx(C5,{depth:oe,row:v!=null&&v[q.key]?{...q,serves:v[q.key]}:q,arrived:g===q.key,pinnable:d&&typeof q.pinned=="boolean",pinning:h,onPin:()=>B(q),opening:F.has(q.key),note:he[q.key]??null,onOpen:()=>rt(q),org:t,project:n})]},q.key)),a&&!de.length&&s.jsx("p",{className:"muted empty",children:"No threads at work or waiting."}),de.length>0&&!Ue.length&&s.jsx("p",{className:"muted empty",children:"No threads match."}),a&&a.hidden>0&&s.jsxs("p",{className:"caption muted",children:[a.hidden," older thread(s) not shown; sdlc view --all lists them."]})]})]})]})}function C5({row:e,depth:t,arrived:n,pinnable:a,pinning:r,onPin:l,opening:i,note:o,onOpen:c,org:d,project:f}){const h=p=>d?`org/${encodeURIComponent(d)}/tasks/${encodeURIComponent(p)}`:null,m=p=>f?`proj/${encodeURIComponent(f)}/issues/${encodeURIComponent(p)}`:null,x=[e.where||e.agent,e.phase,e.age,e.waitsOn?`waits on ${e.waitsOn}`:""].filter(Boolean).join(" · "),b=w5(e),v=`open-note-${e.key}`,[y,g]=u.useState(!1);return s.jsxs("article",{className:n?"thread arrived":"thread",id:`thread-${e.key}`,style:{marginLeft:Math.min(t*22,110)},children:[s.jsxs("div",{className:"thread-head",children:[s.jsx("p",{className:"thread-title",tabIndex:-1,children:e.title}),s.jsxs("div",{className:"tools",children:[e.carried?s.jsxs(s.Fragment,{children:[s.jsx(Wf,{text:e.carried,role:"waiting"}),e.carriedBatch&&s.jsx(Wf,{text:e.carriedBatch.text,role:e.carriedBatch.role})]}):s.jsx(Wf,{text:e.status,role:e.role}),b&&s.jsx("button",{type:"button",className:"open-thread","data-key":e.key,"aria-label":`${b}: ${e.title}`,"aria-describedby":v,"aria-disabled":i?!0:void 0,"aria-busy":i?!0:void 0,onClick:()=>{i||c()},children:i?"Opening…":b}),a&&s.jsx("button",{type:"button",className:e.pinned?"pin on":"pin","data-key":e.key,"aria-label":e.pinned?`Unpin ${e.title}`:`Pin ${e.title} to the top`,"aria-disabled":r?!0:void 0,"aria-busy":r===e.key?!0:void 0,onClick:()=>{r||l()},children:e.pinned?"Unpin":"Pin"})]})]}),s.jsx("p",{className:"caption muted",children:x}),b&&s.jsx("p",{id:v,className:`caption open-note tone-${Hc((o==null?void 0:o.role)??"muted")}`,role:(o==null?void 0:o.role)==="alert"||(o==null?void 0:o.role)==="you"?"alert":"status",children:(o==null?void 0:o.text)??null}),e.serves&&e.serves.length>0&&s.jsx(k5,{serves:e.serves}),e.summary&&s.jsx("p",{className:"caption muted",children:e.summary}),e.carriedDetail&&s.jsx("p",{className:"line",children:e.carriedDetail}),e.step&&s.jsxs("p",{className:"caption muted",children:["step: ",e.step]}),e.lines.length>0&&s.jsx("p",{className:"caption muted lines-summary",children:j5(e.lines)}),(y?e.lines:e.lines.slice(0,wy)).map((p,j)=>s.jsxs("p",{className:`line tone-${Hc(p.role)}`,children:[s.jsxs("span",{"aria-hidden":"true",children:[v5[p.state]??"•"," "]}),p.state==="working"&&s.jsx("span",{className:"sr-only",children:"Working: "}),p.task!==void 0&&s.jsx(Ry,{id:p.task,href:h(p.task)}),p.task!==void 0&&p.text?" ":null,p.text]},`l${j}`)),e.lines.length>wy&&s.jsx("button",{type:"button",className:"lines-more","aria-expanded":y,"aria-label":y?`Show fewer lines of work of ${e.title}`:`Show all ${e.lines.length} lines of work of ${e.title}`,onClick:()=>g(p=>!p),children:y?"Show fewer":`Show all ${e.lines.length}`}),(e.routed??[]).map(p=>s.jsxs("p",{className:"line",children:["routed ",s.jsx(Ry,{id:p.issue,href:m(p.issue)}),p.title?` ${p.title}`:null]},`r${p.issue}`)),e.holds.map((p,j)=>s.jsx("p",{className:`line tone-${Hc(p.role)}`,children:p.text},`h${j}`)),e.plan&&s.jsx("p",{className:"caption muted",children:e.plan})]})}const R5=5e3;function T5(){const[e,t]=u.useState([]),n=u.useRef(0),a=u.useRef(new Map),r=u.useCallback(c=>{const d=a.current.get(c);d&&clearTimeout(d),a.current.delete(c),t(f=>f.filter(h=>h.id!==c))},[]),l=u.useCallback((c,d)=>{const f=n.current+=1;t(h=>[...h.filter(m=>m.tone!=="error").slice(-2),{id:f,tone:c,message:d}]),c==="success"&&a.current.set(f,setTimeout(()=>r(f),R5))},[r]);u.useEffect(()=>{const c=a.current;return()=>{for(const d of c.values())clearTimeout(d)}},[]);const i=u.useMemo(()=>({success:c=>l("success",c),error:c=>l("error",c)}),[l]),o=s.jsx("div",{"aria-live":"polite","aria-label":"Notifications",className:"pointer-events-none fixed right-4 bottom-4 z-100 flex max-w-[calc(100vw-2rem)] flex-col items-end gap-2",children:e.map(c=>s.jsxs("div",{"data-testid":"viewer-toast",className:"bg-popover text-popover-foreground pointer-events-auto flex w-80 max-w-full items-center gap-3 rounded-md border py-2 pr-2 pl-4 text-sm shadow-lg"+(c.tone==="error"?" border-destructive":""),children:[s.jsx("span",{className:"min-w-0 flex-1 break-words",children:c.message}),s.jsx(P,{type:"button",variant:"ghost",size:"control",className:"shrink-0",onClick:()=>r(c.id),children:"Dismiss"})]},c.id))});return{notify:i,toasts:o}}const L1=/^#(?:(releases)|release=(.+)|planned(?:=(.+))?)$/,E5=/^#task=(.+)$/,A5=/^#issue=(.+)$/,M5=/^iss-\d{1,9}$/;function U1(e){return e.split("/").filter(Boolean).slice(1).join("/")}function $5(e,t=""){const n=e.split("/").filter(Boolean);if(n.length===0)return{page:{kind:"home"}};if(n.length===1){const[o]=n;return o==="threads"?{page:{kind:"org",page:"threads"},threads:!0}:o==="chat"?{forward:"threads"}:o==="tasks"?{page:{kind:"org",page:"tasks"},tasks:!0}:o==="issues"?{page:{kind:"home"},issues:!0}:o==="chart"?{page:{kind:"org",page:"chart"},chart:!0}:o==="worktrees"?{page:{kind:"org",page:"worktrees"},worktrees:!0}:o==="workspaces"?{page:{kind:"org",page:"workspaces"},workspaces:!0}:o==="queues"?{page:{kind:"org",page:"queues"},queues:!0}:o==="releases"?{page:{kind:"home"},releasesForward:!0}:{page:{kind:"not_found"}}}const[a,r,l,i]=n;if(a==="org"&&l==="tasks"&&i==="queues"&&n.length===4)return{forward:`org/${r}/queues${t}`};if(a==="org"&&l==="chat"&&n.length<=4)return{forward:`org/${r}/threads${i===void 0?"":`#thread-${i}`}`};if(a==="org"&&l==="tasks"&&n.length===4){const o=decodeURIComponent(i);return{page:{kind:"org",page:"tasks",item:o},org:decodeURIComponent(r),task:o}}if(a==="org"&&l==="issues"&&n.length<=4){const o=decodeURIComponent(r);return i===void 0?{page:{kind:"home"},org:o,issues:!0}:{page:{kind:"home"},org:o,issues:!0,issue:decodeURIComponent(i)}}if(a==="proj"&&l==="issues"&&n.length<=4){const o=decodeURIComponent(r),c={kind:"project",project:o,page:"issues"};if(i===void 0)return{page:c,issues:!0,project:o};const d=decodeURIComponent(i),f=new URLSearchParams(t);f.delete("from");const h=f.toString();return{page:{...c,item:d,...h?{list_query:h}:{}},issues:!0,project:o,issue:d}}if(a==="org"&&n.length<=3){const o=decodeURIComponent(r);if(l===void 0)return{page:{kind:"home"},org:o};if(l==="threads")return{page:{kind:"org",page:"threads"},org:o,threads:!0};if(l==="tasks")return{page:{kind:"org",page:"tasks"},org:o,tasks:!0};if(l==="chart")return{page:{kind:"org",page:"chart"},org:o,chart:!0};if(l==="worktrees")return{page:{kind:"org",page:"worktrees"},org:o,worktrees:!0};if(l==="workspaces")return{page:{kind:"org",page:"workspaces"},org:o,workspaces:!0};if(l==="queues")return{page:{kind:"org",page:"queues"},org:o,queues:!0};if(l==="releases")return{page:{kind:"home"},org:o,releasesForward:!0}}if(a==="proj"&&n.length<=3){const o=decodeURIComponent(r);if(l===void 0)return{page:{kind:"project",project:o}};if(l==="tasks")return{page:{kind:"project",project:o,page:"tasks"},tasks:!0};if(l==="releases")return{page:{kind:"project",project:o,page:"releases"},releases:!0}}return{page:{kind:"not_found"}}}const O5={label:"Local viewer",can:()=>!1},D5={connecting:"Connecting…",live:"Live · refreshes every 10s",disconnected:"Disconnected"},Ty=()=>s.jsx(S1,{title:"Page not found",children:"There is no page at this address in this viewer."});function z5({routeOrg:e}){const{org:t,engine:n}=En(),{project:a}=Uo(),[r,l]=u.useState("connecting");return n===null?s.jsx("div",{className:"flex h-full min-h-0 flex-1 flex-col overflow-auto px-4 py-4 sm:px-6 lg:px-8",children:s.jsx(Zs,{page:"Threads"})}):s.jsxs("div",{className:"main viewer-panel",children:[s.jsxs("p",{className:"connection",role:"status",children:[s.jsx("span",{className:`dot ${r}`,"aria-hidden":"true"}),D5[r]]}),s.jsx(S5,{onConnection:l,org:(t==null?void 0:t.slug)??e??null,project:a})]})}const Ga=()=>s.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"Loading…"});function L5({route:e,navigate:t}){var f;const{org:n,projects:a,loading:r,none:l}=En(),i=e.page.kind==="project"?e.page.project:null,o=i!==null&&a!==null&&!((f=a.find(h=>h.id===i))!=null&&f.current),c=e.org===void 0&&!o&&!r&&n!==null?`org/${encodeURIComponent(n.slug)}/tasks`:null;if(u.useEffect(()=>{c&&t(c)},[c,t]),i!==null&&o)return s.jsx(lo,{project:i});if(c||e.org===void 0&&r)return s.jsx(Ga,{});const d=(n==null?void 0:n.slug)??e.org;return d===void 0&&i!==null?s.jsx(lo,{project:i}):d===void 0&&l?s.jsx(Fl,{}):d===void 0?s.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"Tasks open once the organization reads."}):s.jsx(hD,{org:d})}function U5({route:e,navigate:t}){const{org:n,loading:a,none:r}=En(),l=e.org===void 0&&!a&&n!==null?`org/${encodeURIComponent(n.slug)}/queues${window.location.search}`:null;if(u.useEffect(()=>{l&&t(l)},[l,t]),l||e.org===void 0&&a)return s.jsx(Ga,{});const i=(n==null?void 0:n.slug)??e.org;if(i===void 0&&r)return s.jsx(Fl,{});if(i===void 0)return s.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"Queues open once the organization reads."});const o=new URLSearchParams(window.location.search).get("queue");return s.jsx(Kz,{org:i,open:o,path:`/org/${encodeURIComponent(i)}/queues`})}function B5({route:e,navigate:t}){var b;const{org:n,projects:a}=En(),{project:r,settled:l}=Uo(),i=e.project??null,o=i!==null&&a!==null&&!((b=a.find(v=>v.id===i))!=null&&b.current),c=window.location.search,d=i===null&&r!==null?`proj/${encodeURIComponent(r)}/issues${e.issue?`/${encodeURIComponent(e.issue)}`:""}${c}`:null;u.useEffect(()=>{d&&t(d)},[d,t]);const[f,h]=u.useState(()=>window.location.search.replace(/^\?/,"")),m=u.useCallback(v=>{window.history.replaceState(window.history.state,"",`${window.location.pathname}${v?`?${v}`:""}`),h(v)},[]);if(i!==null&&o)return s.jsx(lo,{project:i});if(d||i===null&&!l)return s.jsx(Ga,{});if(i===null)return s.jsx(Fl,{});const x=encodeURIComponent((n==null?void 0:n.slug)??e.org??"");if(e.issue!==void 0){const v=new URLSearchParams(f).get("from");return s.jsx(zz,{org:x,project:i,issue_id:e.issue,from:v,query:f})}return s.jsx(_z,{org:x,project:i,query:f,onQuery:m})}function H5({issue:e,navigate:t,home:n}){const{project:a,settled:r}=Uo(),l=a!==null?`proj/${encodeURIComponent(a)}/issues/${encodeURIComponent(e)}`:null;return u.useEffect(()=>{l&&t(l)},[l,t]),l||!r?s.jsx(Ga,{}):n}function Uo(){var l;const{projects:e,loading:t,none:n,failure:a}=En();return{project:((l=e==null?void 0:e.find(i=>i.current))==null?void 0:l.id)??null,settled:!t&&(e!==null||n!==null||!!(a!=null&&a.shown))}}function I5({navigate:e}){const{project:t,settled:n}=Uo(),a=t!==null?`proj/${encodeURIComponent(t)}/releases${window.location.search}`:null;return u.useEffect(()=>{a&&e(a)},[a,e]),a||!n?s.jsx(Ga,{}):s.jsx(Fl,{})}function Ey(e){const t=new URLSearchParams(e);return{release:t.get("release"),planned:t.has("planned")?t.get("planned")??"":null}}function P5({route:e}){var f;const{org:t,projects:n,loading:a}=En(),r=e.page.kind==="project"?e.page.project:"",[l,i]=u.useState(()=>Ey(window.location.search));if(a)return s.jsx(Ga,{});if(n!==null&&!((f=n.find(h=>h.id===r))!=null&&f.current))return s.jsx(lo,{project:r});const c=`/proj/${encodeURIComponent(r)}/releases`,d=h=>{const m=new URLSearchParams;h!=null&&h.startsWith("planned:")?m.set("planned",h.slice(8)):h&&m.set("release",h);const x=m.size>0?`?${m.toString()}`:"";window.history.replaceState(window.history.state,"",`${window.location.pathname}${x}`),i(Ey(x))};return s.jsx(t6,{org:(t==null?void 0:t.slug)??"",query:l,onSelect:d,home:c})}function q5({hash:e,navigate:t,home:n}){const{project:a,settled:r}=Uo(),l=L1.exec(e),i=l!=null&&l[2]?Lu(l[2]):null,o=l!=null&&l[3]?Lu(l[3]):null,c=i!==null?`?release=${encodeURIComponent(i)}`:e.startsWith("#planned")?`?planned${o!==null?`=${encodeURIComponent(o)}`:""}`:"",d=a!==null?`proj/${encodeURIComponent(a)}/releases${c}`:null;return u.useEffect(()=>{d&&t(d)},[d,t]),d||!r?s.jsx(Ga,{}):n}function Zf({route:e,navigate:t}){const{org:n}=En();let a=e.page;const r=e.org!==void 0&&n!==null&&e.org!==n.slug;r&&(a={kind:"not_found"});let l;if(r)l=s.jsx(Ty,{});else if("threads"in e)l=s.jsx(z5,{routeOrg:e.org});else if("task"in e){const i=new URLSearchParams(window.location.search).get("from");l=s.jsx(GD,{org:encodeURIComponent(e.org),task_id:e.task,from:i})}else"tasks"in e?l=s.jsx(L5,{route:e,navigate:t}):"issues"in e?l=s.jsx(B5,{route:e,navigate:t}):"chart"in e?l=s.jsx(T3,{}):"worktrees"in e?l=s.jsx(X6,{org:(n==null?void 0:n.slug)??e.org}):"workspaces"in e?l=s.jsx(R6,{org:(n==null?void 0:n.slug)??e.org}):"queues"in e?l=s.jsx(U5,{route:e,navigate:t}):"releasesForward"in e?l=s.jsx(I5,{navigate:t}):"releases"in e?l=s.jsx(P5,{route:e}):a.kind==="home"?l=s.jsx(Fl,{}):a.kind==="project"?l=s.jsx(lo,{project:a.project}):l=s.jsx(Ty,{});return s.jsx(o6,{page:a,children:l})}function G5({task:e,navigate:t,home:n}){const{org:a,loading:r,none:l,failure:i}=En(),o=a!==null?`org/${encodeURIComponent(a.slug)}/tasks/${encodeURIComponent(e)}`:null,c=!r&&(l!==null||!!(i!=null&&i.shown));return u.useEffect(()=>{o&&t(o)},[o,t]),o||!c?s.jsx(Ga,{}):n}const V5=e=>window.location.replace(e);function Lu(e){try{return decodeURIComponent(e)}catch{return null}}function Y5({navigate:e=V5,data:t}){const n=$5(U1(window.location.pathname),window.location.search),[a,r]=u.useState(null),{notify:l,toasts:i}=T5(),o=E5.exec(window.location.hash),c=o?Lu(o[1]):null,d=A5.exec(window.location.hash),f=d?Lu(d[1]):null,h=f!==null&&M5.test(f)?f:null,m=L1.test(window.location.hash)?window.location.hash:null,x=o!==null&&c===null||d!==null&&h===null,b="forward"in n?n.forward:null;u.useEffect(()=>{b&&e(b)},[b,e]);const v=u.useMemo(()=>{if(t)return t;const g=t5();return{probe:{source:async()=>({label:"Local workspace"})},shell:g,issues:g.issues,tasks:a5(),org:s5(),worktrees:l5(),workspaces:i5(),queues:n5(),releases:r5()}},[t]);if(b||"forward"in n||!v.shell)return null;const y=s.jsx(Zf,{route:{page:{kind:"home"}},navigate:e});return s.jsx("div",{className:"app-ui dark",ref:r,children:s.jsxs(sM,{container:a,children:[s.jsx(E0,{data:v,router:R1,identity:O5,notify:l,children:s.jsx(VT,{shell:v.shell,children:x?s.jsx(Zf,{route:{page:{kind:"not_found"}},navigate:e}):c!==null?s.jsx(G5,{task:c,navigate:e,home:y}):h!==null?s.jsx(H5,{issue:h,navigate:e,home:y}):m!==null?s.jsx(q5,{hash:m,navigate:e,home:y}):s.jsx(Zf,{route:n,navigate:e})})}),i]})})}FC.createRoot(document.getElementById("root")).render(s.jsx(u.StrictMode,{children:U1(window.location.pathname)==="app-ui-probe"?s.jsx(j6,{}):s.jsx(Y5,{})}));