@software-dlc/cli 0.195.0 → 0.196.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/local/app-contract-readers.d.ts +3 -2
- package/dist/local/app-contract-readers.d.ts.map +1 -1
- package/dist/local/app-contract-readers.js +13 -5
- package/dist/local/app-contract-readers.js.map +1 -1
- package/dist/local/app-releases.d.ts +140 -0
- package/dist/local/app-releases.d.ts.map +1 -1
- package/dist/local/app-releases.js +126 -0
- package/dist/local/app-releases.js.map +1 -1
- package/dist/local/task-context-observations.d.ts +2 -2
- package/package.json +1 -1
- package/viewer/assets/index-CCWdL45p.css +1 -0
- package/viewer/assets/index-DBpJiqhL.js +407 -0
- package/viewer/index.html +2 -2
- package/viewer/assets/index-Cb_EJGq3.js +0 -407
- package/viewer/assets/index-CsOulJKz.css +0 -1
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
function v2(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 Zy(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jy={exports:{}},Rd={};/**
|
|
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 j2=Symbol.for("react.transitional.element"),y2=Symbol.for("react.fragment");function eb(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:j2,type:e,key:a,ref:t!==void 0?t:null,props:n}}Rd.Fragment=y2;Rd.jsx=eb;Rd.jsxs=eb;Jy.exports=Rd;var s=Jy.exports,tb={exports:{}},Be={};/**
|
|
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 Rp=Symbol.for("react.transitional.element"),b2=Symbol.for("react.portal"),w2=Symbol.for("react.fragment"),_2=Symbol.for("react.strict_mode"),N2=Symbol.for("react.profiler"),k2=Symbol.for("react.consumer"),S2=Symbol.for("react.context"),C2=Symbol.for("react.forward_ref"),R2=Symbol.for("react.suspense"),T2=Symbol.for("react.memo"),nb=Symbol.for("react.lazy"),Fg=Symbol.iterator;function E2(e){return e===null||typeof e!="object"?null:(e=Fg&&e[Fg]||e["@@iterator"],typeof e=="function"?e:null)}var sb={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ab=Object.assign,rb={};function oi(e,t,n){this.props=e,this.context=t,this.refs=rb,this.updater=n||sb}oi.prototype.isReactComponent={};oi.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")};oi.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function lb(){}lb.prototype=oi.prototype;function Tp(e,t,n){this.props=e,this.context=t,this.refs=rb,this.updater=n||sb}var Ep=Tp.prototype=new lb;Ep.constructor=Tp;ab(Ep,oi.prototype);Ep.isPureReactComponent=!0;var Kg=Array.isArray,wt={H:null,A:null,T:null,S:null,V:null},ib=Object.prototype.hasOwnProperty;function Ap(e,t,n,a,r,l){return n=l.ref,{$$typeof:Rp,type:e,key:t,ref:n!==void 0?n:null,props:l}}function A2(e,t){return Ap(e.type,t,void 0,void 0,void 0,e.props)}function $p(e){return typeof e=="object"&&e!==null&&e.$$typeof===Rp}function $2(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Xg=/\/+/g;function Hf(e,t){return typeof e=="object"&&e!==null&&e.key!=null?$2(""+e.key):t.toString(36)}function Wg(){}function M2(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(Wg,Wg):(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 pl(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 Rp:case b2:i=!0;break;case nb:return i=e._init,pl(i(e._payload),t,n,a,r)}}if(i)return r=r(e),i=a===""?"."+Hf(e,0):a,Kg(r)?(n="",i!=null&&(n=i.replace(Xg,"$&/")+"/"),pl(r,t,n,"",function(d){return d})):r!=null&&($p(r)&&(r=A2(r,n+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(Xg,"$&/")+"/")+i)),t.push(r)),1;i=0;var o=a===""?".":a+":";if(Kg(e))for(var c=0;c<e.length;c++)a=e[c],l=o+Hf(a,c),i+=pl(a,t,n,l,r);else if(c=E2(e),typeof c=="function")for(e=c.call(e),c=0;!(a=e.next()).done;)a=a.value,l=o+Hf(a,c++),i+=pl(a,t,n,l,r);else if(l==="object"){if(typeof e.then=="function")return pl(M2(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 Cc(e,t,n){if(e==null)return e;var a=[],r=0;return pl(e,a,"","",function(l){return t.call(n,l,r++)}),a}function O2(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 Qg=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 D2(){}Be.Children={map:Cc,forEach:function(e,t,n){Cc(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Cc(e,function(){t++}),t},toArray:function(e){return Cc(e,function(t){return t})||[]},only:function(e){if(!$p(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Be.Component=oi;Be.Fragment=w2;Be.Profiler=N2;Be.PureComponent=Tp;Be.StrictMode=_2;Be.Suspense=R2;Be.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=wt;Be.__COMPILER_RUNTIME={__proto__:null,c:function(e){return wt.H.useMemoCache(e)}};Be.cache=function(e){return function(){return e.apply(null,arguments)}};Be.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var a=ab({},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)!ib.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 Ap(e.type,r,void 0,void 0,l,a)};Be.createContext=function(e){return e={$$typeof:S2,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:k2,_context:e},e};Be.createElement=function(e,t,n){var a,r={},l=null;if(t!=null)for(a in t.key!==void 0&&(l=""+t.key),t)ib.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 Ap(e,l,void 0,void 0,null,r)};Be.createRef=function(){return{current:null}};Be.forwardRef=function(e){return{$$typeof:C2,render:e}};Be.isValidElement=$p;Be.lazy=function(e){return{$$typeof:nb,_payload:{_status:-1,_result:e},_init:O2}};Be.memo=function(e,t){return{$$typeof:T2,type:e,compare:t===void 0?null:t}};Be.startTransition=function(e){var t=wt.T,n={};wt.T=n;try{var a=e(),r=wt.S;r!==null&&r(n,a),typeof a=="object"&&a!==null&&typeof a.then=="function"&&a.then(D2,Qg)}catch(l){Qg(l)}finally{wt.T=t}};Be.unstable_useCacheRefresh=function(){return wt.H.useCacheRefresh()};Be.use=function(e){return wt.H.use(e)};Be.useActionState=function(e,t,n){return wt.H.useActionState(e,t,n)};Be.useCallback=function(e,t){return wt.H.useCallback(e,t)};Be.useContext=function(e){return wt.H.useContext(e)};Be.useDebugValue=function(){};Be.useDeferredValue=function(e,t){return wt.H.useDeferredValue(e,t)};Be.useEffect=function(e,t,n){var a=wt.H;if(typeof n=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return a.useEffect(e,t)};Be.useId=function(){return wt.H.useId()};Be.useImperativeHandle=function(e,t,n){return wt.H.useImperativeHandle(e,t,n)};Be.useInsertionEffect=function(e,t){return wt.H.useInsertionEffect(e,t)};Be.useLayoutEffect=function(e,t){return wt.H.useLayoutEffect(e,t)};Be.useMemo=function(e,t){return wt.H.useMemo(e,t)};Be.useOptimistic=function(e,t){return wt.H.useOptimistic(e,t)};Be.useReducer=function(e,t,n){return wt.H.useReducer(e,t,n)};Be.useRef=function(e){return wt.H.useRef(e)};Be.useState=function(e){return wt.H.useState(e)};Be.useSyncExternalStore=function(e,t,n){return wt.H.useSyncExternalStore(e,t,n)};Be.useTransition=function(){return wt.H.useTransition()};Be.version="19.1.0";tb.exports=Be;var u=tb.exports;const Ta=Zy(u),ob=v2({__proto__:null,default:Ta},[u]);var cb={exports:{}},Td={},ub={exports:{}},db={};/**
|
|
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(T,E){var k=T.length;T.push(E);e:for(;0<k;){var M=k-1>>>1,Y=T[M];if(0<r(Y,E))T[M]=E,T[k]=Y,k=M;else break e}}function n(T){return T.length===0?null:T[0]}function a(T){if(T.length===0)return null;var E=T[0],k=T.pop();if(k!==E){T[0]=k;e:for(var M=0,Y=T.length,A=Y>>>1;M<A;){var I=2*(M+1)-1,X=T[I],J=I+1,ae=T[J];if(0>r(X,k))J<Y&&0>r(ae,X)?(T[M]=ae,T[J]=k,M=J):(T[M]=X,T[I]=k,M=I);else if(J<Y&&0>r(ae,k))T[M]=ae,T[J]=k,M=J;else break e}}return E}function r(T,E){var k=T.sortIndex-E.sortIndex;return k!==0?k:T.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,m=null,h=3,x=!1,j=!1,v=!1,y=!1,g=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;function w(T){for(var E=n(d);E!==null;){if(E.callback===null)a(d);else if(E.startTime<=T)a(d),E.sortIndex=E.expirationTime,t(c,E);else break;E=n(d)}}function S(T){if(v=!1,w(T),!j)if(n(c)!==null)j=!0,C||(C=!0,G());else{var E=n(d);E!==null&&$(S,E.startTime-T)}}var C=!1,_=-1,N=5,O=-1;function D(){return y?!0:!(e.unstable_now()-O<N)}function B(){if(y=!1,C){var T=e.unstable_now();O=T;var E=!0;try{e:{j=!1,v&&(v=!1,p(_),_=-1),x=!0;var k=h;try{t:{for(w(T),m=n(c);m!==null&&!(m.expirationTime>T&&D());){var M=m.callback;if(typeof M=="function"){m.callback=null,h=m.priorityLevel;var Y=M(m.expirationTime<=T);if(T=e.unstable_now(),typeof Y=="function"){m.callback=Y,w(T),E=!0;break t}m===n(c)&&a(c),w(T)}else a(c);m=n(c)}if(m!==null)E=!0;else{var A=n(d);A!==null&&$(S,A.startTime-T),E=!1}}break e}finally{m=null,h=k,x=!1}E=void 0}}finally{E?G():C=!1}}}var G;if(typeof b=="function")G=function(){b(B)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,R=U.port2;U.port1.onmessage=B,G=function(){R.postMessage(null)}}else G=function(){g(B,0)};function $(T,E){_=g(function(){T(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(T){T.callback=null},e.unstable_forceFrameRate=function(T){0>T||125<T?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):N=0<T?Math.floor(1e3/T):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_next=function(T){switch(h){case 1:case 2:case 3:var E=3;break;default:E=h}var k=h;h=E;try{return T()}finally{h=k}},e.unstable_requestPaint=function(){y=!0},e.unstable_runWithPriority=function(T,E){switch(T){case 1:case 2:case 3:case 4:case 5:break;default:T=3}var k=h;h=T;try{return E()}finally{h=k}},e.unstable_scheduleCallback=function(T,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,T){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=k+Y,T={id:f++,callback:E,priorityLevel:T,startTime:k,expirationTime:Y,sortIndex:-1},k>M?(T.sortIndex=k,t(d,T),n(c)===null&&T===n(d)&&(v?(p(_),_=-1):v=!0,$(S,k-M))):(T.sortIndex=Y,t(c,T),j||x||(j=!0,C||(C=!0,G()))),T},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(T){var E=h;return function(){var k=h;h=E;try{return T.apply(this,arguments)}finally{h=k}}}})(db);ub.exports=db;var z2=ub.exports,fb={exports:{}},jn={};/**
|
|
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 L2=u;function hb(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 ka(){}var xn={d:{f:ka,r:function(){throw Error(hb(522))},D:ka,C:ka,L:ka,m:ka,X:ka,S:ka,M:ka},p:0,findDOMNode:null},U2=Symbol.for("react.portal");function B2(e,t,n){var a=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:U2,key:a==null?null:""+a,children:e,containerInfo:t,implementation:n}}var no=L2.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function Ed(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}jn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=xn;jn.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(hb(299));return B2(e,t,null,n)};jn.flushSync=function(e){var t=no.T,n=xn.p;try{if(no.T=null,xn.p=2,e)return e()}finally{no.T=t,xn.p=n,xn.d.f()}};jn.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,xn.d.C(e,t))};jn.prefetchDNS=function(e){typeof e=="string"&&xn.d.D(e)};jn.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,a=Ed(n,t.crossOrigin),r=typeof t.integrity=="string"?t.integrity:void 0,l=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?xn.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:a,integrity:r,fetchPriority:l}):n==="script"&&xn.d.X(e,{crossOrigin:a,integrity:r,fetchPriority:l,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};jn.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=Ed(t.as,t.crossOrigin);xn.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&&xn.d.M(e)};jn.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,a=Ed(n,t.crossOrigin);xn.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})}};jn.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=Ed(t.as,t.crossOrigin);xn.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 xn.d.m(e)};jn.requestFormReset=function(e){xn.d.r(e)};jn.unstable_batchedUpdates=function(e,t){return e(t)};jn.useFormState=function(e,t,n){return no.H.useFormState(e,t,n)};jn.useFormStatus=function(){return no.H.useHostTransitionStatus()};jn.version="19.1.0";function mb(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(mb)}catch(e){console.error(e)}}mb(),fb.exports=jn;var ci=fb.exports;const I2=Zy(ci);/**
|
|
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 Gt=z2,pb=u,H2=ci;function W(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 xb(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Xo(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 gb(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 Zg(e){if(Xo(e)!==e)throw Error(W(188))}function P2(e){var t=e.alternate;if(!t){if(t=Xo(e),t===null)throw Error(W(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 Zg(r),e;if(l===a)return Zg(r),t;l=l.sibling}throw Error(W(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(W(189))}}if(n.alternate!==a)throw Error(W(190))}if(n.tag!==3)throw Error(W(188));return n.stateNode.current===n?e:t}function vb(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=vb(e),t!==null)return t;e=e.sibling}return null}var vt=Object.assign,q2=Symbol.for("react.element"),Rc=Symbol.for("react.transitional.element"),Yi=Symbol.for("react.portal"),yl=Symbol.for("react.fragment"),jb=Symbol.for("react.strict_mode"),Zh=Symbol.for("react.profiler"),G2=Symbol.for("react.provider"),yb=Symbol.for("react.consumer"),ua=Symbol.for("react.context"),Mp=Symbol.for("react.forward_ref"),Jh=Symbol.for("react.suspense"),em=Symbol.for("react.suspense_list"),Op=Symbol.for("react.memo"),$a=Symbol.for("react.lazy"),tm=Symbol.for("react.activity"),V2=Symbol.for("react.memo_cache_sentinel"),Jg=Symbol.iterator;function Oi(e){return e===null||typeof e!="object"?null:(e=Jg&&e[Jg]||e["@@iterator"],typeof e=="function"?e:null)}var Y2=Symbol.for("react.client.reference");function nm(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Y2?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case yl:return"Fragment";case Zh:return"Profiler";case jb:return"StrictMode";case Jh:return"Suspense";case em:return"SuspenseList";case tm:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case Yi:return"Portal";case ua:return(e.displayName||"Context")+".Provider";case yb:return(e._context.displayName||"Context")+".Consumer";case Mp:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Op:return t=e.displayName||null,t!==null?t:nm(e.type)||"Memo";case $a:t=e._payload,e=e._init;try{return nm(e(t))}catch{}}return null}var Fi=Array.isArray,Me=pb.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,tt=H2.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Sr={pending:!1,data:null,method:null,action:null},sm=[],bl=-1;function Qs(e){return{current:e}}function Wt(e){0>bl||(e.current=sm[bl],sm[bl]=null,bl--)}function _t(e,t){bl++,sm[bl]=e.current,e.current=t}var qs=Qs(null),wo=Qs(null),Ya=Qs(null),Tu=Qs(null);function Eu(e,t){switch(_t(Ya,t),_t(wo,e),_t(qs,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?aj(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=aj(t),e=L0(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Wt(qs),_t(qs,e)}function Kl(){Wt(qs),Wt(wo),Wt(Ya)}function am(e){e.memoizedState!==null&&_t(Tu,e);var t=qs.current,n=L0(t,e.type);t!==n&&(_t(wo,e),_t(qs,n))}function Au(e){wo.current===e&&(Wt(qs),Wt(wo)),Tu.current===e&&(Wt(Tu),$o._currentValue=Sr)}var rm=Object.prototype.hasOwnProperty,Dp=Gt.unstable_scheduleCallback,Pf=Gt.unstable_cancelCallback,F2=Gt.unstable_shouldYield,K2=Gt.unstable_requestPaint,Gs=Gt.unstable_now,X2=Gt.unstable_getCurrentPriorityLevel,bb=Gt.unstable_ImmediatePriority,wb=Gt.unstable_UserBlockingPriority,$u=Gt.unstable_NormalPriority,W2=Gt.unstable_LowPriority,_b=Gt.unstable_IdlePriority,Q2=Gt.log,Z2=Gt.unstable_setDisableYieldValue,Wo=null,Wn=null;function Ba(e){if(typeof Q2=="function"&&Z2(e),Wn&&typeof Wn.setStrictMode=="function")try{Wn.setStrictMode(Wo,e)}catch{}}var Qn=Math.clz32?Math.clz32:tC,J2=Math.log,eC=Math.LN2;function tC(e){return e>>>=0,e===0?32:31-(J2(e)/eC|0)|0}var Tc=256,Ec=4194304;function wr(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 Ad(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=wr(a):(i&=o,i!==0?r=wr(i):n||(n=o&~e,n!==0&&(r=wr(n))))):(o=a&~l,o!==0?r=wr(o):i!==0?r=wr(i):n||(n=a&~e,n!==0&&(r=wr(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 Qo(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function nC(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 Nb(){var e=Tc;return Tc<<=1,!(Tc&4194048)&&(Tc=256),e}function kb(){var e=Ec;return Ec<<=1,!(Ec&62914560)&&(Ec=4194304),e}function qf(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Zo(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function sC(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-Qn(n),m=1<<f;o[f]=0,c[f]=-1;var h=d[f];if(h!==null)for(d[f]=null,f=0;f<h.length;f++){var x=h[f];x!==null&&(x.lane&=-536870913)}n&=~m}a!==0&&Sb(e,a,0),l!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=l&~(i&~t))}function Sb(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var a=31-Qn(t);e.entangledLanes|=t,e.entanglements[a]=e.entanglements[a]|1073741824|n&4194090}function Cb(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var a=31-Qn(n),r=1<<a;r&t|e[a]&t&&(e[a]|=t),n&=~r}}function zp(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 Lp(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Rb(){var e=tt.p;return e!==0?e:(e=window.event,e===void 0?32:F0(e.type))}function aC(e,t){var n=tt.p;try{return tt.p=e,t()}finally{tt.p=n}}var ur=Math.random().toString(36).slice(2),on="__reactFiber$"+ur,Ln="__reactProps$"+ur,ui="__reactContainer$"+ur,lm="__reactEvents$"+ur,rC="__reactListeners$"+ur,lC="__reactHandles$"+ur,ev="__reactResources$"+ur,Jo="__reactMarker$"+ur;function Up(e){delete e[on],delete e[Ln],delete e[lm],delete e[rC],delete e[lC]}function wl(e){var t=e[on];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ui]||n[on]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=ij(e);e!==null;){if(n=e[on])return n;e=ij(e)}return t}e=n,n=e.parentNode}return null}function di(e){if(e=e[on]||e[ui]){var t=e.tag;if(t===5||t===6||t===13||t===26||t===27||t===3)return e}return null}function Ki(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(W(33))}function Dl(e){var t=e[ev];return t||(t=e[ev]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Kt(e){e[Jo]=!0}var Tb=new Set,Eb={};function Fr(e,t){Xl(e,t),Xl(e+"Capture",t)}function Xl(e,t){for(Eb[e]=t,e=0;e<t.length;e++)Tb.add(t[e])}var iC=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]*$"),tv={},nv={};function oC(e){return rm.call(nv,e)?!0:rm.call(tv,e)?!1:iC.test(e)?nv[e]=!0:(tv[e]=!0,!1)}function lu(e,t,n){if(oC(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 Ac(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 sa(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 Gf,sv;function xl(e){if(Gf===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Gf=t&&t[1]||"",sv=-1<n.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+Gf+e+sv}var Vf=!1;function Yf(e,t){if(!e||Vf)return"";Vf=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var a={DetermineComponentFrameRoot:function(){try{if(t){var m=function(){throw Error()};if(Object.defineProperty(m.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(m,[])}catch(x){var h=x}Reflect.construct(e,[],m)}else{try{m.call()}catch(x){h=x}e.call(m.prototype)}}else{try{throw Error()}catch(x){h=x}(m=e())&&typeof m.catch=="function"&&m.catch(function(){})}}catch(x){if(x&&h&&typeof x.stack=="string")return[x.stack,h.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{Vf=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?xl(n):""}function cC(e){switch(e.tag){case 26:case 27:case 5:return xl(e.type);case 16:return xl("Lazy");case 13:return xl("Suspense");case 19:return xl("SuspenseList");case 0:case 15:return Yf(e.type,!1);case 11:return Yf(e.type.render,!1);case 1:return Yf(e.type,!0);case 31:return xl("Activity");default:return""}}function av(e){try{var t="";do t+=cC(e),e=e.return;while(e);return t}catch(n){return`
|
|
47
|
+
Error generating stack: `+n.message+`
|
|
48
|
+
`+n.stack}}function is(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ab(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function uC(e){var t=Ab(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 Mu(e){e._valueTracker||(e._valueTracker=uC(e))}function $b(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),a="";return e&&(a=Ab(e)?e.checked?"true":"false":e.value),e=a,e!==n?(t.setValue(e),!0):!1}function Ou(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 dC=/[\n"\\]/g;function us(e){return e.replace(dC,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function im(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=""+is(t)):e.value!==""+is(t)&&(e.value=""+is(t)):i!=="submit"&&i!=="reset"||e.removeAttribute("value"),t!=null?om(e,i,is(t)):n!=null?om(e,i,is(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=""+is(o):e.removeAttribute("name")}function Mb(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?""+is(n):"",t=t!=null?""+is(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 om(e,t,n){t==="number"&&Ou(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function zl(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=""+is(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 Ob(e,t,n){if(t!=null&&(t=""+is(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+is(n):""}function Db(e,t,n,a){if(t==null){if(a!=null){if(n!=null)throw Error(W(92));if(Fi(a)){if(1<a.length)throw Error(W(93));a=a[0]}n=a}n==null&&(n=""),t=n}n=is(t),e.defaultValue=n,a=e.textContent,a===n&&a!==""&&a!==null&&(e.value=a)}function Wl(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var fC=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 rv(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||fC.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function zb(e,t,n){if(t!=null&&typeof t!="object")throw Error(W(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&&rv(e,r,a)}else for(var l in t)t.hasOwnProperty(l)&&rv(e,l,t[l])}function Bp(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 hC=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"]]),mC=/^[\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 iu(e){return mC.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}var cm=null;function Ip(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var _l=null,Ll=null;function lv(e){var t=di(e);if(t&&(e=t.stateNode)){var n=e[Ln]||null;e:switch(e=t.stateNode,t.type){case"input":if(im(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="'+us(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var a=n[t];if(a!==e&&a.form===e.form){var r=a[Ln]||null;if(!r)throw Error(W(90));im(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&&$b(a)}break e;case"textarea":Ob(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&zl(e,!!n.multiple,t,!1)}}}var Ff=!1;function Lb(e,t,n){if(Ff)return e(t,n);Ff=!0;try{var a=e(t);return a}finally{if(Ff=!1,(_l!==null||Ll!==null)&&(Hd(),_l&&(t=_l,e=Ll,Ll=_l=null,lv(t),e)))for(t=0;t<e.length;t++)lv(e[t])}}function _o(e,t){var n=e.stateNode;if(n===null)return null;var a=n[Ln]||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(W(231,t,typeof n));return n}var ga=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),um=!1;if(ga)try{var Di={};Object.defineProperty(Di,"passive",{get:function(){um=!0}}),window.addEventListener("test",Di,Di),window.removeEventListener("test",Di,Di)}catch{um=!1}var Ia=null,Hp=null,ou=null;function Ub(){if(ou)return ou;var e,t=Hp,n=t.length,a,r="value"in Ia?Ia.value:Ia.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 ou=r.slice(e,1<a?1-a:void 0)}function cu(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 $c(){return!0}function iv(){return!1}function Un(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)?$c:iv,this.isPropagationStopped=iv,this}return vt(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=$c)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=$c)},persist:function(){},isPersistent:$c}),t}var Kr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},$d=Un(Kr),ec=vt({},Kr,{view:0,detail:0}),pC=Un(ec),Kf,Xf,zi,Md=vt({},ec,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Pp,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!==zi&&(zi&&e.type==="mousemove"?(Kf=e.screenX-zi.screenX,Xf=e.screenY-zi.screenY):Xf=Kf=0,zi=e),Kf)},movementY:function(e){return"movementY"in e?e.movementY:Xf}}),ov=Un(Md),xC=vt({},Md,{dataTransfer:0}),gC=Un(xC),vC=vt({},ec,{relatedTarget:0}),Wf=Un(vC),jC=vt({},Kr,{animationName:0,elapsedTime:0,pseudoElement:0}),yC=Un(jC),bC=vt({},Kr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),wC=Un(bC),_C=vt({},Kr,{data:0}),cv=Un(_C),NC={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},kC={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"},SC={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function CC(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=SC[e])?!!t[e]:!1}function Pp(){return CC}var RC=vt({},ec,{key:function(e){if(e.key){var t=NC[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=cu(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?kC[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Pp,charCode:function(e){return e.type==="keypress"?cu(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?cu(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),TC=Un(RC),EC=vt({},Md,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),uv=Un(EC),AC=vt({},ec,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Pp}),$C=Un(AC),MC=vt({},Kr,{propertyName:0,elapsedTime:0,pseudoElement:0}),OC=Un(MC),DC=vt({},Md,{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}),zC=Un(DC),LC=vt({},Kr,{newState:0,oldState:0}),UC=Un(LC),BC=[9,13,27,32],qp=ga&&"CompositionEvent"in window,so=null;ga&&"documentMode"in document&&(so=document.documentMode);var IC=ga&&"TextEvent"in window&&!so,Bb=ga&&(!qp||so&&8<so&&11>=so),dv=" ",fv=!1;function Ib(e,t){switch(e){case"keyup":return BC.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hb(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Nl=!1;function HC(e,t){switch(e){case"compositionend":return Hb(t);case"keypress":return t.which!==32?null:(fv=!0,dv);case"textInput":return e=t.data,e===dv&&fv?null:e;default:return null}}function PC(e,t){if(Nl)return e==="compositionend"||!qp&&Ib(e,t)?(e=Ub(),ou=Hp=Ia=null,Nl=!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 Bb&&t.locale!=="ko"?null:t.data;default:return null}}var qC={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 hv(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!qC[e.type]:t==="textarea"}function Pb(e,t,n,a){_l?Ll?Ll.push(a):Ll=[a]:_l=a,t=Zu(t,"onChange"),0<t.length&&(n=new $d("onChange","change",null,n,a),e.push({event:n,listeners:t}))}var ao=null,No=null;function GC(e){O0(e,0)}function Od(e){var t=Ki(e);if($b(t))return e}function mv(e,t){if(e==="change")return t}var qb=!1;if(ga){var Qf;if(ga){var Zf="oninput"in document;if(!Zf){var pv=document.createElement("div");pv.setAttribute("oninput","return;"),Zf=typeof pv.oninput=="function"}Qf=Zf}else Qf=!1;qb=Qf&&(!document.documentMode||9<document.documentMode)}function xv(){ao&&(ao.detachEvent("onpropertychange",Gb),No=ao=null)}function Gb(e){if(e.propertyName==="value"&&Od(No)){var t=[];Pb(t,No,e,Ip(e)),Lb(GC,t)}}function VC(e,t,n){e==="focusin"?(xv(),ao=t,No=n,ao.attachEvent("onpropertychange",Gb)):e==="focusout"&&xv()}function YC(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Od(No)}function FC(e,t){if(e==="click")return Od(t)}function KC(e,t){if(e==="input"||e==="change")return Od(t)}function XC(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ns=typeof Object.is=="function"?Object.is:XC;function ko(e,t){if(ns(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(!rm.call(t,r)||!ns(e[r],t[r]))return!1}return!0}function gv(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function vv(e,t){var n=gv(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=gv(n)}}function Vb(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Vb(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Yb(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ou(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=Ou(e.document)}return t}function Gp(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 WC=ga&&"documentMode"in document&&11>=document.documentMode,kl=null,dm=null,ro=null,fm=!1;function jv(e,t,n){var a=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;fm||kl==null||kl!==Ou(a)||(a=kl,"selectionStart"in a&&Gp(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}),ro&&ko(ro,a)||(ro=a,a=Zu(dm,"onSelect"),0<a.length&&(t=new $d("onSelect","select",null,t,n),e.push({event:t,listeners:a}),t.target=kl)))}function yr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Sl={animationend:yr("Animation","AnimationEnd"),animationiteration:yr("Animation","AnimationIteration"),animationstart:yr("Animation","AnimationStart"),transitionrun:yr("Transition","TransitionRun"),transitionstart:yr("Transition","TransitionStart"),transitioncancel:yr("Transition","TransitionCancel"),transitionend:yr("Transition","TransitionEnd")},Jf={},Fb={};ga&&(Fb=document.createElement("div").style,"AnimationEvent"in window||(delete Sl.animationend.animation,delete Sl.animationiteration.animation,delete Sl.animationstart.animation),"TransitionEvent"in window||delete Sl.transitionend.transition);function Xr(e){if(Jf[e])return Jf[e];if(!Sl[e])return e;var t=Sl[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Fb)return Jf[e]=t[n];return e}var Kb=Xr("animationend"),Xb=Xr("animationiteration"),Wb=Xr("animationstart"),QC=Xr("transitionrun"),ZC=Xr("transitionstart"),JC=Xr("transitioncancel"),Qb=Xr("transitionend"),Zb=new Map,hm="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(" ");hm.push("scrollEnd");function $s(e,t){Zb.set(e,t),Fr(t,[e])}var yv=new WeakMap;function ds(e,t){if(typeof e=="object"&&e!==null){var n=yv.get(e);return n!==void 0?n:(t={value:e,source:t,stack:av(t)},yv.set(e,t),t)}return{value:e,source:t,stack:av(t)}}var ls=[],Cl=0,Vp=0;function Dd(){for(var e=Cl,t=Vp=Cl=0;t<e;){var n=ls[t];ls[t++]=null;var a=ls[t];ls[t++]=null;var r=ls[t];ls[t++]=null;var l=ls[t];if(ls[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&&Jb(n,r,l)}}function zd(e,t,n,a){ls[Cl++]=e,ls[Cl++]=t,ls[Cl++]=n,ls[Cl++]=a,Vp|=a,e.lanes|=a,e=e.alternate,e!==null&&(e.lanes|=a)}function Yp(e,t,n,a){return zd(e,t,n,a),Du(e)}function fi(e,t){return zd(e,null,null,t),Du(e)}function Jb(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-Qn(n),e=l.hiddenUpdates,a=e[r],a===null?e[r]=[t]:a.push(t),t.lane=n|536870912),l):null}function Du(e){if(50<xo)throw xo=0,Om=null,Error(W(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Rl={};function eR(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 Xn(e,t,n,a){return new eR(e,t,n,a)}function Fp(e){return e=e.prototype,!(!e||!e.isReactComponent)}function pa(e,t){var n=e.alternate;return n===null?(n=Xn(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 ew(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 uu(e,t,n,a,r,l){var i=0;if(a=e,typeof e=="function")Fp(e)&&(i=1);else if(typeof e=="string")i=nT(e,n,qs.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case tm:return e=Xn(31,n,t,r),e.elementType=tm,e.lanes=l,e;case yl:return Cr(n.children,r,l,t);case jb:i=8,r|=24;break;case Zh:return e=Xn(12,n,t,r|2),e.elementType=Zh,e.lanes=l,e;case Jh:return e=Xn(13,n,t,r),e.elementType=Jh,e.lanes=l,e;case em:return e=Xn(19,n,t,r),e.elementType=em,e.lanes=l,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case G2:case ua:i=10;break e;case yb:i=9;break e;case Mp:i=11;break e;case Op:i=14;break e;case $a:i=16,a=null;break e}i=29,n=Error(W(130,e===null?"null":typeof e,"")),a=null}return t=Xn(i,n,t,r),t.elementType=e,t.type=a,t.lanes=l,t}function Cr(e,t,n,a){return e=Xn(7,e,a,t),e.lanes=n,e}function eh(e,t,n){return e=Xn(6,e,null,t),e.lanes=n,e}function th(e,t,n){return t=Xn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Tl=[],El=0,zu=null,Lu=0,os=[],cs=0,Rr=null,da=1,fa="";function _r(e,t){Tl[El++]=Lu,Tl[El++]=zu,zu=e,Lu=t}function tw(e,t,n){os[cs++]=da,os[cs++]=fa,os[cs++]=Rr,Rr=e;var a=da;e=fa;var r=32-Qn(a)-1;a&=~(1<<r),n+=1;var l=32-Qn(t)+r;if(30<l){var i=r-r%5;l=(a&(1<<i)-1).toString(32),a>>=i,r-=i,da=1<<32-Qn(t)+r|n<<r|a,fa=l+e}else da=1<<l|n<<r|a,fa=e}function Kp(e){e.return!==null&&(_r(e,1),tw(e,1,0))}function Xp(e){for(;e===zu;)zu=Tl[--El],Tl[El]=null,Lu=Tl[--El],Tl[El]=null;for(;e===Rr;)Rr=os[--cs],os[cs]=null,fa=os[--cs],os[cs]=null,da=os[--cs],os[cs]=null}var pn=null,Rt=null,et=!1,Tr=null,Ls=!1,mm=Error(W(519));function Lr(e){var t=Error(W(418,""));throw So(ds(t,e)),mm}function bv(e){var t=e.stateNode,n=e.type,a=e.memoizedProps;switch(t[on]=e,t[Ln]=a,n){case"dialog":qe("cancel",t),qe("close",t);break;case"iframe":case"object":case"embed":qe("load",t);break;case"video":case"audio":for(n=0;n<To.length;n++)qe(To[n],t);break;case"source":qe("error",t);break;case"img":case"image":case"link":qe("error",t),qe("load",t);break;case"details":qe("toggle",t);break;case"input":qe("invalid",t),Mb(t,a.value,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name,!0),Mu(t);break;case"select":qe("invalid",t);break;case"textarea":qe("invalid",t),Db(t,a.value,a.defaultValue,a.children),Mu(t)}n=a.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||a.suppressHydrationWarning===!0||z0(t.textContent,n)?(a.popover!=null&&(qe("beforetoggle",t),qe("toggle",t)),a.onScroll!=null&&qe("scroll",t),a.onScrollEnd!=null&&qe("scrollend",t),a.onClick!=null&&(t.onclick=Gd),t=!0):t=!1,t||Lr(e)}function wv(e){for(pn=e.return;pn;)switch(pn.tag){case 5:case 13:Ls=!1;return;case 27:case 3:Ls=!0;return;default:pn=pn.return}}function Li(e){if(e!==pn)return!1;if(!et)return wv(e),et=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||Im(e.type,e.memoizedProps)),n=!n),n&&Rt&&Lr(e),wv(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(W(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8)if(n=e.data,n==="/$"){if(t===0){Rt=Ss(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++;e=e.nextSibling}Rt=null}}else t===27?(t=Rt,dr(e.type)?(e=qm,qm=null,Rt=e):Rt=t):Rt=pn?Ss(e.stateNode.nextSibling):null;return!0}function tc(){Rt=pn=null,et=!1}function _v(){var e=Tr;return e!==null&&(On===null?On=e:On.push.apply(On,e),Tr=null),e}function So(e){Tr===null?Tr=[e]:Tr.push(e)}var pm=Qs(null),Wr=null,ha=null;function Oa(e,t,n){_t(pm,t._currentValue),t._currentValue=n}function xa(e){e._currentValue=pm.current,Wt(pm)}function xm(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 gm(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),xm(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(W(341));i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),xm(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 nc(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(W(387));if(i=i.memoizedProps,i!==null){var o=r.type;ns(r.pendingProps.value,i.value)||(e!==null?e.push(o):e=[o])}}else if(r===Tu.current){if(i=r.alternate,i===null)throw Error(W(387));i.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push($o):e=[$o])}r=r.return}e!==null&&gm(t,e,n,a),t.flags|=262144}function Uu(e){for(e=e.firstContext;e!==null;){if(!ns(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ur(e){Wr=e,ha=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function cn(e){return nw(Wr,e)}function Mc(e,t){return Wr===null&&Ur(e),nw(e,t)}function nw(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},ha===null){if(e===null)throw Error(W(308));ha=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ha=ha.next=t;return n}var tR=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()})}},nR=Gt.unstable_scheduleCallback,sR=Gt.unstable_NormalPriority,Pt={$$typeof:ua,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Wp(){return{controller:new tR,data:new Map,refCount:0}}function sc(e){e.refCount--,e.refCount===0&&nR(sR,function(){e.controller.abort()})}var lo=null,vm=0,Ql=0,Ul=null;function aR(e,t){if(lo===null){var n=lo=[];vm=0,Ql=jx(),Ul={status:"pending",value:void 0,then:function(a){n.push(a)}}}return vm++,t.then(Nv,Nv),t}function Nv(){if(--vm===0&&lo!==null){Ul!==null&&(Ul.status="fulfilled");var e=lo;lo=null,Ql=0,Ul=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function rR(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 kv=Me.S;Me.S=function(e,t){typeof t=="object"&&t!==null&&typeof t.then=="function"&&aR(e,t),kv!==null&&kv(e,t)};var Er=Qs(null);function Qp(){var e=Er.current;return e!==null?e:ht.pooledCache}function du(e,t){t===null?_t(Er,Er.current):_t(Er,t.pool)}function sw(){var e=Qp();return e===null?null:{parent:Pt._currentValue,pool:e}}var ac=Error(W(460)),aw=Error(W(474)),Ld=Error(W(542)),jm={then:function(){}};function Sv(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Oc(){}function rw(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Oc,Oc),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Rv(e),e;default:if(typeof t.status=="string")t.then(Oc,Oc);else{if(e=ht,e!==null&&100<e.shellSuspendCounter)throw Error(W(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,Rv(e),e}throw io=t,ac}}var io=null;function Cv(){if(io===null)throw Error(W(459));var e=io;return io=null,e}function Rv(e){if(e===ac||e===Ld)throw Error(W(483))}var Ma=!1;function Zp(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ym(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 Fa(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,lt&2){var r=a.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),a.pending=t,t=Du(e),Jb(e,null,n),t}return zd(e,a,t,n),Du(e)}function oo(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,Cb(e,n)}}function nh(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 bm=!1;function co(){if(bm){var e=Ul;if(e!==null)throw e}}function uo(e,t,n,a){bm=!1;var r=e.updateQueue;Ma=!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 m=r.baseState;i=0,f=d=c=null,o=l;do{var h=o.lane&-536870913,x=h!==o.lane;if(x?(Ye&h)===h:(a&h)===h){h!==0&&h===Ql&&(bm=!0),f!==null&&(f=f.next={lane:0,tag:o.tag,payload:o.payload,callback:null,next:null});e:{var j=e,v=o;h=t;var y=n;switch(v.tag){case 1:if(j=v.payload,typeof j=="function"){m=j.call(y,m,h);break e}m=j;break e;case 3:j.flags=j.flags&-65537|128;case 0:if(j=v.payload,h=typeof j=="function"?j.call(y,m,h):j,h==null)break e;m=vt({},m,h);break e;case 2:Ma=!0}}h=o.callback,h!==null&&(e.flags|=64,x&&(e.flags|=8192),x=r.callbacks,x===null?r.callbacks=[h]:x.push(h))}else x={lane:h,tag:o.tag,payload:o.payload,callback:o.callback,next:null},f===null?(d=f=x,c=m):f=f.next=x,i|=h;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=m),r.baseState=c,r.firstBaseUpdate=d,r.lastBaseUpdate=f,l===null&&(r.shared.lanes=0),ar|=i,e.lanes=i,e.memoizedState=m}}function lw(e,t){if(typeof e!="function")throw Error(W(191,e));e.call(t)}function iw(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)lw(n[e],t)}var Zl=Qs(null),Bu=Qs(0);function Tv(e,t){e=ya,_t(Bu,e),_t(Zl,t),ya=e|t.baseLanes}function wm(){_t(Bu,ya),_t(Zl,Zl.current)}function Jp(){ya=Bu.current,Wt(Zl),Wt(Bu)}var nr=0,He=null,ct=null,Ot=null,Iu=!1,Bl=!1,Br=!1,Hu=0,Co=0,Il=null,lR=0;function $t(){throw Error(W(321))}function ex(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!ns(e[n],t[n]))return!1;return!0}function tx(e,t,n,a,r,l){return nr=l,He=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Me.H=e===null||e.memoizedState===null?Uw:Bw,Br=!1,l=n(a,r),Br=!1,Bl&&(l=cw(t,n,a,r)),ow(e),l}function ow(e){Me.H=Pu;var t=ct!==null&&ct.next!==null;if(nr=0,Ot=ct=He=null,Iu=!1,Co=0,Il=null,t)throw Error(W(300));e===null||Xt||(e=e.dependencies,e!==null&&Uu(e)&&(Xt=!0))}function cw(e,t,n,a){He=e;var r=0;do{if(Bl&&(Il=null),Co=0,Bl=!1,25<=r)throw Error(W(301));if(r+=1,Ot=ct=null,e.updateQueue!=null){var l=e.updateQueue;l.lastEffect=null,l.events=null,l.stores=null,l.memoCache!=null&&(l.memoCache.index=0)}Me.H=hR,l=t(n,a)}while(Bl);return l}function iR(){var e=Me.H,t=e.useState()[0];return t=typeof t.then=="function"?rc(t):t,e=e.useState()[0],(ct!==null?ct.memoizedState:null)!==e&&(He.flags|=1024),t}function nx(){var e=Hu!==0;return Hu=0,e}function sx(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function ax(e){if(Iu){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Iu=!1}nr=0,Ot=ct=He=null,Bl=!1,Co=Hu=0,Il=null}function $n(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ot===null?He.memoizedState=Ot=e:Ot=Ot.next=e,Ot}function Lt(){if(ct===null){var e=He.alternate;e=e!==null?e.memoizedState:null}else e=ct.next;var t=Ot===null?He.memoizedState:Ot.next;if(t!==null)Ot=t,ct=e;else{if(e===null)throw He.alternate===null?Error(W(467)):Error(W(310));ct=e,e={memoizedState:ct.memoizedState,baseState:ct.baseState,baseQueue:ct.baseQueue,queue:ct.queue,next:null},Ot===null?He.memoizedState=Ot=e:Ot=Ot.next=e}return Ot}function rx(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function rc(e){var t=Co;return Co+=1,Il===null&&(Il=[]),e=rw(Il,e,t),t=He,(Ot===null?t.memoizedState:Ot.next)===null&&(t=t.alternate,Me.H=t===null||t.memoizedState===null?Uw:Bw),e}function Ud(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return rc(e);if(e.$$typeof===ua)return cn(e)}throw Error(W(438,String(e)))}function lx(e){var t=null,n=He.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var a=He.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=rx(),He.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]=V2;return t.index++,n}function va(e,t){return typeof t=="function"?t(e):t}function fu(e){var t=Lt();return ix(t,ct,e)}function ix(e,t,n){var a=e.queue;if(a===null)throw Error(W(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 m=d.lane&-536870913;if(m!==d.lane?(Ye&m)===m:(nr&m)===m){var h=d.revertLane;if(h===0)c!==null&&(c=c.next={lane:0,revertLane:0,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),m===Ql&&(f=!0);else if((nr&h)===h){d=d.next,h===Ql&&(f=!0);continue}else m={lane:0,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,He.lanes|=h,ar|=h;m=d.action,Br&&n(l,m),l=d.hasEagerState?d.eagerState:n(l,m)}else h={lane:m,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,He.lanes|=m,ar|=m;d=d.next}while(d!==null&&d!==t);if(c===null?i=l:c.next=o,!ns(l,e.memoizedState)&&(Xt=!0,f&&(n=Ul,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 sh(e){var t=Lt(),n=t.queue;if(n===null)throw Error(W(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);ns(l,t.memoizedState)||(Xt=!0),t.memoizedState=l,t.baseQueue===null&&(t.baseState=l),n.lastRenderedState=l}return[l,a]}function uw(e,t,n){var a=He,r=Lt(),l=et;if(l){if(n===void 0)throw Error(W(407));n=n()}else n=t();var i=!ns((ct||r).memoizedState,n);i&&(r.memoizedState=n,Xt=!0),r=r.queue;var o=hw.bind(null,a,r,e);if(lc(2048,8,o,[e]),r.getSnapshot!==t||i||Ot!==null&&Ot.memoizedState.tag&1){if(a.flags|=2048,Jl(9,Bd(),fw.bind(null,a,r,n,t),null),ht===null)throw Error(W(349));l||nr&124||dw(a,t,n)}return n}function dw(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=He.updateQueue,t===null?(t=rx(),He.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function fw(e,t,n,a){t.value=n,t.getSnapshot=a,mw(t)&&pw(e)}function hw(e,t,n){return n(function(){mw(t)&&pw(e)})}function mw(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!ns(e,n)}catch{return!0}}function pw(e){var t=fi(e,2);t!==null&&Jn(t,e,2)}function _m(e){var t=$n();if(typeof e=="function"){var n=e;if(e=n(),Br){Ba(!0);try{n()}finally{Ba(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:va,lastRenderedState:e},t}function xw(e,t,n,a){return e.baseState=n,ix(e,ct,typeof a=="function"?a:va)}function oR(e,t,n,a,r){if(Id(e))throw Error(W(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)}};Me.T!==null?n(!0):l.isTransition=!1,a(l),n=t.pending,n===null?(l.next=t.pending=l,gw(t,l)):(l.next=n.next,t.pending=n.next=l)}}function gw(e,t){var n=t.action,a=t.payload,r=e.state;if(t.isTransition){var l=Me.T,i={};Me.T=i;try{var o=n(r,a),c=Me.S;c!==null&&c(i,o),Ev(e,t,o)}catch(d){Nm(e,t,d)}finally{Me.T=l}}else try{l=n(r,a),Ev(e,t,l)}catch(d){Nm(e,t,d)}}function Ev(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(a){Av(e,t,a)},function(a){return Nm(e,t,a)}):Av(e,t,n)}function Av(e,t,n){t.status="fulfilled",t.value=n,vw(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,gw(e,n)))}function Nm(e,t,n){var a=e.pending;if(e.pending=null,a!==null){a=a.next;do t.status="rejected",t.reason=n,vw(t),t=t.next;while(t!==a)}e.action=null}function vw(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function jw(e,t){return t}function $v(e,t){if(et){var n=ht.formState;if(n!==null){e:{var a=He;if(et){if(Rt){t:{for(var r=Rt,l=Ls;r.nodeType!==8;){if(!l){r=null;break t}if(r=Ss(r.nextSibling),r===null){r=null;break t}}l=r.data,r=l==="F!"||l==="F"?r:null}if(r){Rt=Ss(r.nextSibling),a=r.data==="F!";break e}}Lr(a)}a=!1}a&&(t=n[0])}}return n=$n(),n.memoizedState=n.baseState=t,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:jw,lastRenderedState:t},n.queue=a,n=Dw.bind(null,He,a),a.dispatch=n,a=_m(!1),l=dx.bind(null,He,!1,a.queue),a=$n(),r={state:t,dispatch:null,action:e,pending:null},a.queue=r,n=oR.bind(null,He,r,l,n),r.dispatch=n,a.memoizedState=e,[t,n,!1]}function Mv(e){var t=Lt();return yw(t,ct,e)}function yw(e,t,n){if(t=ix(e,t,jw)[0],e=fu(va)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var a=rc(t)}catch(i){throw i===ac?Ld:i}else a=t;t=Lt();var r=t.queue,l=r.dispatch;return n!==t.memoizedState&&(He.flags|=2048,Jl(9,Bd(),cR.bind(null,r,n),null)),[a,l,e]}function cR(e,t){e.action=t}function Ov(e){var t=Lt(),n=ct;if(n!==null)return yw(t,n,e);Lt(),t=t.memoizedState,n=Lt();var a=n.queue.dispatch;return n.memoizedState=e,[t,a,!1]}function Jl(e,t,n,a){return e={tag:e,create:n,deps:a,inst:t,next:null},t=He.updateQueue,t===null&&(t=rx(),He.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 Bd(){return{destroy:void 0,resource:void 0}}function bw(){return Lt().memoizedState}function hu(e,t,n,a){var r=$n();a=a===void 0?null:a,He.flags|=e,r.memoizedState=Jl(1|t,Bd(),n,a)}function lc(e,t,n,a){var r=Lt();a=a===void 0?null:a;var l=r.memoizedState.inst;ct!==null&&a!==null&&ex(a,ct.memoizedState.deps)?r.memoizedState=Jl(t,l,n,a):(He.flags|=e,r.memoizedState=Jl(1|t,l,n,a))}function Dv(e,t){hu(8390656,8,e,t)}function ww(e,t){lc(2048,8,e,t)}function _w(e,t){return lc(4,2,e,t)}function Nw(e,t){return lc(4,4,e,t)}function kw(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 Sw(e,t,n){n=n!=null?n.concat([e]):null,lc(4,4,kw.bind(null,t,e),n)}function ox(){}function Cw(e,t){var n=Lt();t=t===void 0?null:t;var a=n.memoizedState;return t!==null&&ex(t,a[1])?a[0]:(n.memoizedState=[e,t],e)}function Rw(e,t){var n=Lt();t=t===void 0?null:t;var a=n.memoizedState;if(t!==null&&ex(t,a[1]))return a[0];if(a=e(),Br){Ba(!0);try{e()}finally{Ba(!1)}}return n.memoizedState=[a,t],a}function cx(e,t,n){return n===void 0||nr&1073741824?e.memoizedState=t:(e.memoizedState=n,e=v0(),He.lanes|=e,ar|=e,n)}function Tw(e,t,n,a){return ns(n,t)?n:Zl.current!==null?(e=cx(e,n,a),ns(e,t)||(Xt=!0),e):nr&42?(e=v0(),He.lanes|=e,ar|=e,t):(Xt=!0,e.memoizedState=n)}function Ew(e,t,n,a,r){var l=tt.p;tt.p=l!==0&&8>l?l:8;var i=Me.T,o={};Me.T=o,dx(e,!1,t,n);try{var c=r(),d=Me.S;if(d!==null&&d(o,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var f=rR(c,a);fo(e,t,f,Zn(e))}else fo(e,t,a,Zn(e))}catch(m){fo(e,t,{then:function(){},status:"rejected",reason:m},Zn())}finally{tt.p=l,Me.T=i}}function uR(){}function km(e,t,n,a){if(e.tag!==5)throw Error(W(476));var r=Aw(e).queue;Ew(e,r,t,Sr,n===null?uR:function(){return $w(e),n(a)})}function Aw(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Sr,baseState:Sr,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:va,lastRenderedState:Sr},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:va,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function $w(e){var t=Aw(e).next.queue;fo(e,t,{},Zn())}function ux(){return cn($o)}function Mw(){return Lt().memoizedState}function Ow(){return Lt().memoizedState}function dR(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Zn();e=Fa(n);var a=Ka(t,e,n);a!==null&&(Jn(a,t,n),oo(a,t,n)),t={cache:Wp()},e.payload=t;return}t=t.return}}function fR(e,t,n){var a=Zn();n={lane:a,revertLane:0,action:n,hasEagerState:!1,eagerState:null,next:null},Id(e)?zw(t,n):(n=Yp(e,t,n,a),n!==null&&(Jn(n,e,a),Lw(n,t,a)))}function Dw(e,t,n){var a=Zn();fo(e,t,n,a)}function fo(e,t,n,a){var r={lane:a,revertLane:0,action:n,hasEagerState:!1,eagerState:null,next:null};if(Id(e))zw(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,ns(o,i))return zd(e,t,r,0),ht===null&&Dd(),!1}catch{}finally{}if(n=Yp(e,t,r,a),n!==null)return Jn(n,e,a),Lw(n,t,a),!0}return!1}function dx(e,t,n,a){if(a={lane:2,revertLane:jx(),action:a,hasEagerState:!1,eagerState:null,next:null},Id(e)){if(t)throw Error(W(479))}else t=Yp(e,n,a,2),t!==null&&Jn(t,e,2)}function Id(e){var t=e.alternate;return e===He||t!==null&&t===He}function zw(e,t){Bl=Iu=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Lw(e,t,n){if(n&4194048){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,Cb(e,n)}}var Pu={readContext:cn,use:Ud,useCallback:$t,useContext:$t,useEffect:$t,useImperativeHandle:$t,useLayoutEffect:$t,useInsertionEffect:$t,useMemo:$t,useReducer:$t,useRef:$t,useState:$t,useDebugValue:$t,useDeferredValue:$t,useTransition:$t,useSyncExternalStore:$t,useId:$t,useHostTransitionStatus:$t,useFormState:$t,useActionState:$t,useOptimistic:$t,useMemoCache:$t,useCacheRefresh:$t},Uw={readContext:cn,use:Ud,useCallback:function(e,t){return $n().memoizedState=[e,t===void 0?null:t],e},useContext:cn,useEffect:Dv,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,hu(4194308,4,kw.bind(null,t,e),n)},useLayoutEffect:function(e,t){return hu(4194308,4,e,t)},useInsertionEffect:function(e,t){hu(4,2,e,t)},useMemo:function(e,t){var n=$n();t=t===void 0?null:t;var a=e();if(Br){Ba(!0);try{e()}finally{Ba(!1)}}return n.memoizedState=[a,t],a},useReducer:function(e,t,n){var a=$n();if(n!==void 0){var r=n(t);if(Br){Ba(!0);try{n(t)}finally{Ba(!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=fR.bind(null,He,e),[a.memoizedState,e]},useRef:function(e){var t=$n();return e={current:e},t.memoizedState=e},useState:function(e){e=_m(e);var t=e.queue,n=Dw.bind(null,He,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ox,useDeferredValue:function(e,t){var n=$n();return cx(n,e,t)},useTransition:function(){var e=_m(!1);return e=Ew.bind(null,He,e.queue,!0,!1),$n().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var a=He,r=$n();if(et){if(n===void 0)throw Error(W(407));n=n()}else{if(n=t(),ht===null)throw Error(W(349));Ye&124||dw(a,t,n)}r.memoizedState=n;var l={value:n,getSnapshot:t};return r.queue=l,Dv(hw.bind(null,a,l,e),[e]),a.flags|=2048,Jl(9,Bd(),fw.bind(null,a,l,n,t),null),n},useId:function(){var e=$n(),t=ht.identifierPrefix;if(et){var n=fa,a=da;n=(a&~(1<<32-Qn(a)-1)).toString(32)+n,t="«"+t+"R"+n,n=Hu++,0<n&&(t+="H"+n.toString(32)),t+="»"}else n=lR++,t="«"+t+"r"+n.toString(32)+"»";return e.memoizedState=t},useHostTransitionStatus:ux,useFormState:$v,useActionState:$v,useOptimistic:function(e){var t=$n();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=dx.bind(null,He,!0,n),n.dispatch=t,[e,t]},useMemoCache:lx,useCacheRefresh:function(){return $n().memoizedState=dR.bind(null,He)}},Bw={readContext:cn,use:Ud,useCallback:Cw,useContext:cn,useEffect:ww,useImperativeHandle:Sw,useInsertionEffect:_w,useLayoutEffect:Nw,useMemo:Rw,useReducer:fu,useRef:bw,useState:function(){return fu(va)},useDebugValue:ox,useDeferredValue:function(e,t){var n=Lt();return Tw(n,ct.memoizedState,e,t)},useTransition:function(){var e=fu(va)[0],t=Lt().memoizedState;return[typeof e=="boolean"?e:rc(e),t]},useSyncExternalStore:uw,useId:Mw,useHostTransitionStatus:ux,useFormState:Mv,useActionState:Mv,useOptimistic:function(e,t){var n=Lt();return xw(n,ct,e,t)},useMemoCache:lx,useCacheRefresh:Ow},hR={readContext:cn,use:Ud,useCallback:Cw,useContext:cn,useEffect:ww,useImperativeHandle:Sw,useInsertionEffect:_w,useLayoutEffect:Nw,useMemo:Rw,useReducer:sh,useRef:bw,useState:function(){return sh(va)},useDebugValue:ox,useDeferredValue:function(e,t){var n=Lt();return ct===null?cx(n,e,t):Tw(n,ct.memoizedState,e,t)},useTransition:function(){var e=sh(va)[0],t=Lt().memoizedState;return[typeof e=="boolean"?e:rc(e),t]},useSyncExternalStore:uw,useId:Mw,useHostTransitionStatus:ux,useFormState:Ov,useActionState:Ov,useOptimistic:function(e,t){var n=Lt();return ct!==null?xw(n,ct,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:lx,useCacheRefresh:Ow},Hl=null,Ro=0;function Dc(e){var t=Ro;return Ro+=1,Hl===null&&(Hl=[]),rw(Hl,e,t)}function Ui(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function zc(e,t){throw t.$$typeof===q2?Error(W(525)):(e=Object.prototype.toString.call(t),Error(W(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function zv(e){var t=e._init;return t(e._payload)}function Iw(e){function t(g,p){if(e){var b=g.deletions;b===null?(g.deletions=[p],g.flags|=16):b.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=pa(g,p),g.index=0,g.sibling=null,g}function l(g,p,b){return g.index=b,e?(b=g.alternate,b!==null?(b=b.index,b<p?(g.flags|=67108866,p):b):(g.flags|=67108866,p)):(g.flags|=1048576,p)}function i(g){return e&&g.alternate===null&&(g.flags|=67108866),g}function o(g,p,b,w){return p===null||p.tag!==6?(p=eh(b,g.mode,w),p.return=g,p):(p=r(p,b),p.return=g,p)}function c(g,p,b,w){var S=b.type;return S===yl?f(g,p,b.props.children,w,b.key):p!==null&&(p.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===$a&&zv(S)===p.type)?(p=r(p,b.props),Ui(p,b),p.return=g,p):(p=uu(b.type,b.key,b.props,null,g.mode,w),Ui(p,b),p.return=g,p)}function d(g,p,b,w){return p===null||p.tag!==4||p.stateNode.containerInfo!==b.containerInfo||p.stateNode.implementation!==b.implementation?(p=th(b,g.mode,w),p.return=g,p):(p=r(p,b.children||[]),p.return=g,p)}function f(g,p,b,w,S){return p===null||p.tag!==7?(p=Cr(b,g.mode,w,S),p.return=g,p):(p=r(p,b),p.return=g,p)}function m(g,p,b){if(typeof p=="string"&&p!==""||typeof p=="number"||typeof p=="bigint")return p=eh(""+p,g.mode,b),p.return=g,p;if(typeof p=="object"&&p!==null){switch(p.$$typeof){case Rc:return b=uu(p.type,p.key,p.props,null,g.mode,b),Ui(b,p),b.return=g,b;case Yi:return p=th(p,g.mode,b),p.return=g,p;case $a:var w=p._init;return p=w(p._payload),m(g,p,b)}if(Fi(p)||Oi(p))return p=Cr(p,g.mode,b,null),p.return=g,p;if(typeof p.then=="function")return m(g,Dc(p),b);if(p.$$typeof===ua)return m(g,Mc(g,p),b);zc(g,p)}return null}function h(g,p,b,w){var S=p!==null?p.key:null;if(typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint")return S!==null?null:o(g,p,""+b,w);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Rc:return b.key===S?c(g,p,b,w):null;case Yi:return b.key===S?d(g,p,b,w):null;case $a:return S=b._init,b=S(b._payload),h(g,p,b,w)}if(Fi(b)||Oi(b))return S!==null?null:f(g,p,b,w,null);if(typeof b.then=="function")return h(g,p,Dc(b),w);if(b.$$typeof===ua)return h(g,p,Mc(g,b),w);zc(g,b)}return null}function x(g,p,b,w,S){if(typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint")return g=g.get(b)||null,o(p,g,""+w,S);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Rc:return g=g.get(w.key===null?b:w.key)||null,c(p,g,w,S);case Yi:return g=g.get(w.key===null?b:w.key)||null,d(p,g,w,S);case $a:var C=w._init;return w=C(w._payload),x(g,p,b,w,S)}if(Fi(w)||Oi(w))return g=g.get(b)||null,f(p,g,w,S,null);if(typeof w.then=="function")return x(g,p,b,Dc(w),S);if(w.$$typeof===ua)return x(g,p,b,Mc(p,w),S);zc(p,w)}return null}function j(g,p,b,w){for(var S=null,C=null,_=p,N=p=0,O=null;_!==null&&N<b.length;N++){_.index>N?(O=_,_=null):O=_.sibling;var D=h(g,_,b[N],w);if(D===null){_===null&&(_=O);break}e&&_&&D.alternate===null&&t(g,_),p=l(D,p,N),C===null?S=D:C.sibling=D,C=D,_=O}if(N===b.length)return n(g,_),et&&_r(g,N),S;if(_===null){for(;N<b.length;N++)_=m(g,b[N],w),_!==null&&(p=l(_,p,N),C===null?S=_:C.sibling=_,C=_);return et&&_r(g,N),S}for(_=a(_);N<b.length;N++)O=x(_,g,N,b[N],w),O!==null&&(e&&O.alternate!==null&&_.delete(O.key===null?N:O.key),p=l(O,p,N),C===null?S=O:C.sibling=O,C=O);return e&&_.forEach(function(B){return t(g,B)}),et&&_r(g,N),S}function v(g,p,b,w){if(b==null)throw Error(W(151));for(var S=null,C=null,_=p,N=p=0,O=null,D=b.next();_!==null&&!D.done;N++,D=b.next()){_.index>N?(O=_,_=null):O=_.sibling;var B=h(g,_,D.value,w);if(B===null){_===null&&(_=O);break}e&&_&&B.alternate===null&&t(g,_),p=l(B,p,N),C===null?S=B:C.sibling=B,C=B,_=O}if(D.done)return n(g,_),et&&_r(g,N),S;if(_===null){for(;!D.done;N++,D=b.next())D=m(g,D.value,w),D!==null&&(p=l(D,p,N),C===null?S=D:C.sibling=D,C=D);return et&&_r(g,N),S}for(_=a(_);!D.done;N++,D=b.next())D=x(_,g,N,D.value,w),D!==null&&(e&&D.alternate!==null&&_.delete(D.key===null?N:D.key),p=l(D,p,N),C===null?S=D:C.sibling=D,C=D);return e&&_.forEach(function(G){return t(g,G)}),et&&_r(g,N),S}function y(g,p,b,w){if(typeof b=="object"&&b!==null&&b.type===yl&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case Rc:e:{for(var S=b.key;p!==null;){if(p.key===S){if(S=b.type,S===yl){if(p.tag===7){n(g,p.sibling),w=r(p,b.props.children),w.return=g,g=w;break e}}else if(p.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===$a&&zv(S)===p.type){n(g,p.sibling),w=r(p,b.props),Ui(w,b),w.return=g,g=w;break e}n(g,p);break}else t(g,p);p=p.sibling}b.type===yl?(w=Cr(b.props.children,g.mode,w,b.key),w.return=g,g=w):(w=uu(b.type,b.key,b.props,null,g.mode,w),Ui(w,b),w.return=g,g=w)}return i(g);case Yi:e:{for(S=b.key;p!==null;){if(p.key===S)if(p.tag===4&&p.stateNode.containerInfo===b.containerInfo&&p.stateNode.implementation===b.implementation){n(g,p.sibling),w=r(p,b.children||[]),w.return=g,g=w;break e}else{n(g,p);break}else t(g,p);p=p.sibling}w=th(b,g.mode,w),w.return=g,g=w}return i(g);case $a:return S=b._init,b=S(b._payload),y(g,p,b,w)}if(Fi(b))return j(g,p,b,w);if(Oi(b)){if(S=Oi(b),typeof S!="function")throw Error(W(150));return b=S.call(b),v(g,p,b,w)}if(typeof b.then=="function")return y(g,p,Dc(b),w);if(b.$$typeof===ua)return y(g,p,Mc(g,b),w);zc(g,b)}return typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint"?(b=""+b,p!==null&&p.tag===6?(n(g,p.sibling),w=r(p,b),w.return=g,g=w):(n(g,p),w=eh(b,g.mode,w),w.return=g,g=w),i(g)):n(g,p)}return function(g,p,b,w){try{Ro=0;var S=y(g,p,b,w);return Hl=null,S}catch(_){if(_===ac||_===Ld)throw _;var C=Xn(29,_,null,g.mode);return C.lanes=w,C.return=g,C}finally{}}}var ei=Iw(!0),Hw=Iw(!1),js=Qs(null),Vs=null;function Da(e){var t=e.alternate;_t(qt,qt.current&1),_t(js,e),Vs===null&&(t===null||Zl.current!==null||t.memoizedState!==null)&&(Vs=e)}function Pw(e){if(e.tag===22){if(_t(qt,qt.current),_t(js,e),Vs===null){var t=e.alternate;t!==null&&t.memoizedState!==null&&(Vs=e)}}else za()}function za(){_t(qt,qt.current),_t(js,js.current)}function ma(e){Wt(js),Vs===e&&(Vs=null),Wt(qt)}var qt=Qs(0);function qu(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==="$?"||Pm(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 ah(e,t,n,a){t=e.memoizedState,n=n(a,t),n=n==null?t:vt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Sm={enqueueSetState:function(e,t,n){e=e._reactInternals;var a=Zn(),r=Fa(a);r.payload=t,n!=null&&(r.callback=n),t=Ka(e,r,a),t!==null&&(Jn(t,e,a),oo(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var a=Zn(),r=Fa(a);r.tag=1,r.payload=t,n!=null&&(r.callback=n),t=Ka(e,r,a),t!==null&&(Jn(t,e,a),oo(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Zn(),a=Fa(n);a.tag=2,t!=null&&(a.callback=t),t=Ka(e,a,n),t!==null&&(Jn(t,e,n),oo(t,e,n))}};function Lv(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?!ko(n,a)||!ko(r,l):!0}function Uv(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&&Sm.enqueueReplaceState(t,t.state,null)}function Ir(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=vt({},n));for(var r in e)n[r]===void 0&&(n[r]=e[r])}return n}var Gu=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 qw(e){Gu(e)}function Gw(e){console.error(e)}function Vw(e){Gu(e)}function Vu(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(a){setTimeout(function(){throw a})}}function Bv(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 Cm(e,t,n){return n=Fa(n),n.tag=3,n.payload={element:null},n.callback=function(){Vu(e,t)},n}function Yw(e){return e=Fa(e),e.tag=3,e}function Fw(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(){Bv(t,n,a)}}var i=n.stateNode;i!==null&&typeof i.componentDidCatch=="function"&&(e.callback=function(){Bv(t,n,a),typeof r!="function"&&(Xa===null?Xa=new Set([this]):Xa.add(this));var o=a.stack;this.componentDidCatch(a.value,{componentStack:o!==null?o:""})})}function mR(e,t,n,a,r){if(n.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){if(t=n.alternate,t!==null&&nc(t,n,r,!0),n=js.current,n!==null){switch(n.tag){case 13:return Vs===null?Dm():n.alternate===null&&Tt===0&&(Tt=3),n.flags&=-257,n.flags|=65536,n.lanes=r,a===jm?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([a]):t.add(a),ph(e,a,r)),!1;case 22:return n.flags|=65536,a===jm?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)),ph(e,a,r)),!1}throw Error(W(435,n.tag))}return ph(e,a,r),Dm(),!1}if(et)return t=js.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=r,a!==mm&&(e=Error(W(422),{cause:a}),So(ds(e,n)))):(a!==mm&&(t=Error(W(423),{cause:a}),So(ds(t,n))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,a=ds(a,n),r=Cm(e.stateNode,a,r),nh(e,r),Tt!==4&&(Tt=2)),!1;var l=Error(W(520),{cause:a});if(l=ds(l,n),po===null?po=[l]:po.push(l),Tt!==4&&(Tt=2),t===null)return!0;a=ds(a,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=r&-r,n.lanes|=e,e=Cm(n.stateNode,a,e),nh(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"&&(Xa===null||!Xa.has(l))))return n.flags|=65536,r&=-r,n.lanes|=r,r=Yw(r),Fw(r,e,n,a),nh(n,r),!1}n=n.return}while(n!==null);return!1}var Kw=Error(W(461)),Xt=!1;function en(e,t,n,a){t.child=e===null?Hw(t,null,n,a):ei(t,e.child,n,a)}function Iv(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 Ur(t),a=tx(e,t,n,i,l,r),o=nx(),e!==null&&!Xt?(sx(e,t,r),ja(e,t,r)):(et&&o&&Kp(t),t.flags|=1,en(e,t,a,r),t.child)}function Hv(e,t,n,a,r){if(e===null){var l=n.type;return typeof l=="function"&&!Fp(l)&&l.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=l,Xw(e,t,l,a,r)):(e=uu(n.type,null,a,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(l=e.child,!fx(e,r)){var i=l.memoizedProps;if(n=n.compare,n=n!==null?n:ko,n(i,a)&&e.ref===t.ref)return ja(e,t,r)}return t.flags|=1,e=pa(l,a),e.ref=t.ref,e.return=t,t.child=e}function Xw(e,t,n,a,r){if(e!==null){var l=e.memoizedProps;if(ko(l,a)&&e.ref===t.ref)if(Xt=!1,t.pendingProps=a=l,fx(e,r))e.flags&131072&&(Xt=!0);else return t.lanes=e.lanes,ja(e,t,r)}return Rm(e,t,n,a,r)}function Ww(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 Pv(e,t,a,n)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&du(t,l!==null?l.cachePool:null),l!==null?Tv(t,l):wm(),Pw(t);else return t.lanes=t.childLanes=536870912,Pv(e,t,l!==null?l.baseLanes|n:n,n)}else l!==null?(du(t,l.cachePool),Tv(t,l),za(),t.memoizedState=null):(e!==null&&du(t,null),wm(),za());return en(e,t,r,n),t.child}function Pv(e,t,n,a){var r=Qp();return r=r===null?null:{parent:Pt._currentValue,pool:r},t.memoizedState={baseLanes:n,cachePool:r},e!==null&&du(t,null),wm(),Pw(t),e!==null&&nc(e,t,a,!0),null}function mu(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(W(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Rm(e,t,n,a,r){return Ur(t),n=tx(e,t,n,a,void 0,r),a=nx(),e!==null&&!Xt?(sx(e,t,r),ja(e,t,r)):(et&&a&&Kp(t),t.flags|=1,en(e,t,n,r),t.child)}function qv(e,t,n,a,r,l){return Ur(t),t.updateQueue=null,n=cw(t,a,n,r),ow(e),a=nx(),e!==null&&!Xt?(sx(e,t,l),ja(e,t,l)):(et&&a&&Kp(t),t.flags|=1,en(e,t,n,l),t.child)}function Gv(e,t,n,a,r){if(Ur(t),t.stateNode===null){var l=Rl,i=n.contextType;typeof i=="object"&&i!==null&&(l=cn(i)),l=new n(a,l),t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,l.updater=Sm,t.stateNode=l,l._reactInternals=t,l=t.stateNode,l.props=a,l.state=t.memoizedState,l.refs={},Zp(t),i=n.contextType,l.context=typeof i=="object"&&i!==null?cn(i):Rl,l.state=t.memoizedState,i=n.getDerivedStateFromProps,typeof i=="function"&&(ah(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&&Sm.enqueueReplaceState(l,l.state,null),uo(t,a,l,r),co(),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=Ir(n,o);l.props=c;var d=l.context,f=n.contextType;i=Rl,typeof f=="object"&&f!==null&&(i=cn(f));var m=n.getDerivedStateFromProps;f=typeof m=="function"||typeof l.getSnapshotBeforeUpdate=="function",o=t.pendingProps!==o,f||typeof l.UNSAFE_componentWillReceiveProps!="function"&&typeof l.componentWillReceiveProps!="function"||(o||d!==i)&&Uv(t,l,a,i),Ma=!1;var h=t.memoizedState;l.state=h,uo(t,a,l,r),co(),d=t.memoizedState,o||h!==d||Ma?(typeof m=="function"&&(ah(t,n,m,a),d=t.memoizedState),(c=Ma||Lv(t,n,c,a,h,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,ym(e,t),i=t.memoizedProps,f=Ir(n,i),l.props=f,m=t.pendingProps,h=l.context,d=n.contextType,c=Rl,typeof d=="object"&&d!==null&&(c=cn(d)),o=n.getDerivedStateFromProps,(d=typeof o=="function"||typeof l.getSnapshotBeforeUpdate=="function")||typeof l.UNSAFE_componentWillReceiveProps!="function"&&typeof l.componentWillReceiveProps!="function"||(i!==m||h!==c)&&Uv(t,l,a,c),Ma=!1,h=t.memoizedState,l.state=h,uo(t,a,l,r),co();var x=t.memoizedState;i!==m||h!==x||Ma||e!==null&&e.dependencies!==null&&Uu(e.dependencies)?(typeof o=="function"&&(ah(t,n,o,a),x=t.memoizedState),(f=Ma||Lv(t,n,f,a,h,x,c)||e!==null&&e.dependencies!==null&&Uu(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&&h===e.memoizedState||(t.flags|=4),typeof l.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&h===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&&h===e.memoizedState||(t.flags|=4),typeof l.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),a=!1)}return l=a,mu(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=ei(t,e.child,null,r),t.child=ei(t,null,n,r)):en(e,t,n,r),t.memoizedState=l.state,e=t.child):e=ja(e,t,r),e}function Vv(e,t,n,a){return tc(),t.flags|=256,en(e,t,n,a),t.child}var rh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function lh(e){return{baseLanes:e,cachePool:sw()}}function ih(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=fs),e}function Qw(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:(qt.current&2)!==0),i&&(r=!0,t.flags&=-129),i=(t.flags&32)!==0,t.flags&=-33,e===null){if(et){if(r?Da(t):za(),et){var o=Rt,c;if(c=o){e:{for(c=o,o=Ls;c.nodeType!==8;){if(!o){o=null;break e}if(c=Ss(c.nextSibling),c===null){o=null;break e}}o=c}o!==null?(t.memoizedState={dehydrated:o,treeContext:Rr!==null?{id:da,overflow:fa}:null,retryLane:536870912,hydrationErrors:null},c=Xn(18,null,null,0),c.stateNode=o,c.return=t,t.child=c,pn=t,Rt=null,c=!0):c=!1}c||Lr(t)}if(o=t.memoizedState,o!==null&&(o=o.dehydrated,o!==null))return Pm(o)?t.lanes=32:t.lanes=536870912,null;ma(t)}return o=a.children,a=a.fallback,r?(za(),r=t.mode,o=Yu({mode:"hidden",children:o},r),a=Cr(a,r,n,null),o.return=t,a.return=t,o.sibling=a,t.child=o,r=t.child,r.memoizedState=lh(n),r.childLanes=ih(e,i,n),t.memoizedState=rh,a):(Da(t),Tm(t,o))}if(c=e.memoizedState,c!==null&&(o=c.dehydrated,o!==null)){if(l)t.flags&256?(Da(t),t.flags&=-257,t=oh(e,t,n)):t.memoizedState!==null?(za(),t.child=e.child,t.flags|=128,t=null):(za(),r=a.fallback,o=t.mode,a=Yu({mode:"visible",children:a.children},o),r=Cr(r,o,n,null),r.flags|=2,a.return=t,r.return=t,a.sibling=r,t.child=a,ei(t,e.child,null,n),a=t.child,a.memoizedState=lh(n),a.childLanes=ih(e,i,n),t.memoizedState=rh,t=r);else if(Da(t),Pm(o)){if(i=o.nextSibling&&o.nextSibling.dataset,i)var d=i.dgst;i=d,a=Error(W(419)),a.stack="",a.digest=i,So({value:a,source:null,stack:null}),t=oh(e,t,n)}else if(Xt||nc(e,t,n,!1),i=(n&e.childLanes)!==0,Xt||i){if(i=ht,i!==null&&(a=n&-n,a=a&42?1:zp(a),a=a&(i.suspendedLanes|n)?0:a,a!==0&&a!==c.retryLane))throw c.retryLane=a,fi(e,a),Jn(i,e,a),Kw;o.data==="$?"||Dm(),t=oh(e,t,n)}else o.data==="$?"?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,Rt=Ss(o.nextSibling),pn=t,et=!0,Tr=null,Ls=!1,e!==null&&(os[cs++]=da,os[cs++]=fa,os[cs++]=Rr,da=e.id,fa=e.overflow,Rr=t),t=Tm(t,a.children),t.flags|=4096);return t}return r?(za(),r=a.fallback,o=t.mode,c=e.child,d=c.sibling,a=pa(c,{mode:"hidden",children:a.children}),a.subtreeFlags=c.subtreeFlags&65011712,d!==null?r=pa(d,r):(r=Cr(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=lh(n):(c=o.cachePool,c!==null?(d=Pt._currentValue,c=c.parent!==d?{parent:d,pool:d}:c):c=sw(),o={baseLanes:o.baseLanes|n,cachePool:c}),r.memoizedState=o,r.childLanes=ih(e,i,n),t.memoizedState=rh,a):(Da(t),n=e.child,e=n.sibling,n=pa(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 Tm(e,t){return t=Yu({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Yu(e,t){return e=Xn(22,e,null,t),e.lanes=0,e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},e}function oh(e,t,n){return ei(t,e.child,null,n),e=Tm(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Yv(e,t,n){e.lanes|=t;var a=e.alternate;a!==null&&(a.lanes|=t),xm(e.return,t,n)}function ch(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 Zw(e,t,n){var a=t.pendingProps,r=a.revealOrder,l=a.tail;if(en(e,t,a.children,n),a=qt.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&&Yv(e,n,t);else if(e.tag===19)Yv(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(_t(qt,a),r){case"forwards":for(n=t.child,r=null;n!==null;)e=n.alternate,e!==null&&qu(e)===null&&(r=n),n=n.sibling;n=r,n===null?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null),ch(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&&qu(e)===null){t.child=r;break}e=r.sibling,r.sibling=n,n=r,r=e}ch(t,!0,n,null,l);break;case"together":ch(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ja(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ar|=t.lanes,!(n&t.childLanes))if(e!==null){if(nc(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(W(153));if(t.child!==null){for(e=t.child,n=pa(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=pa(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function fx(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&Uu(e)))}function pR(e,t,n){switch(t.tag){case 3:Eu(t,t.stateNode.containerInfo),Oa(t,Pt,e.memoizedState.cache),tc();break;case 27:case 5:am(t);break;case 4:Eu(t,t.stateNode.containerInfo);break;case 10:Oa(t,t.type,t.memoizedProps.value);break;case 13:var a=t.memoizedState;if(a!==null)return a.dehydrated!==null?(Da(t),t.flags|=128,null):n&t.child.childLanes?Qw(e,t,n):(Da(t),e=ja(e,t,n),e!==null?e.sibling:null);Da(t);break;case 19:var r=(e.flags&128)!==0;if(a=(n&t.childLanes)!==0,a||(nc(e,t,n,!1),a=(n&t.childLanes)!==0),r){if(a)return Zw(e,t,n);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),_t(qt,qt.current),a)break;return null;case 22:case 23:return t.lanes=0,Ww(e,t,n);case 24:Oa(t,Pt,e.memoizedState.cache)}return ja(e,t,n)}function Jw(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Xt=!0;else{if(!fx(e,n)&&!(t.flags&128))return Xt=!1,pR(e,t,n);Xt=!!(e.flags&131072)}else Xt=!1,et&&t.flags&1048576&&tw(t,Lu,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")Fp(a)?(e=Ir(a,e),t.tag=1,t=Gv(null,t,a,e,n)):(t.tag=0,t=Rm(null,t,a,e,n));else{if(a!=null){if(r=a.$$typeof,r===Mp){t.tag=11,t=Iv(null,t,a,e,n);break e}else if(r===Op){t.tag=14,t=Hv(null,t,a,e,n);break e}}throw t=nm(a)||a,Error(W(306,t,""))}}return t;case 0:return Rm(e,t,t.type,t.pendingProps,n);case 1:return a=t.type,r=Ir(a,t.pendingProps),Gv(e,t,a,r,n);case 3:e:{if(Eu(t,t.stateNode.containerInfo),e===null)throw Error(W(387));a=t.pendingProps;var l=t.memoizedState;r=l.element,ym(e,t),uo(t,a,null,n);var i=t.memoizedState;if(a=i.cache,Oa(t,Pt,a),a!==l.cache&&gm(t,[Pt],n,!0),co(),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=Vv(e,t,a,n);break e}else if(a!==r){r=ds(Error(W(424)),t),So(r),t=Vv(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(Rt=Ss(e.firstChild),pn=t,et=!0,Tr=null,Ls=!0,n=Hw(t,null,a,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(tc(),a===r){t=ja(e,t,n);break e}en(e,t,a,n)}t=t.child}return t;case 26:return mu(e,t),e===null?(n=cj(t.type,null,t.pendingProps,null))?t.memoizedState=n:et||(n=t.type,e=t.pendingProps,a=Ju(Ya.current).createElement(n),a[on]=t,a[Ln]=e,nn(a,n,e),Kt(a),t.stateNode=a):t.memoizedState=cj(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return am(t),e===null&&et&&(a=t.stateNode=B0(t.type,t.pendingProps,Ya.current),pn=t,Ls=!0,r=Rt,dr(t.type)?(qm=r,Rt=Ss(a.firstChild)):Rt=r),en(e,t,t.pendingProps.children,n),mu(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&et&&((r=a=Rt)&&(a=qR(a,t.type,t.pendingProps,Ls),a!==null?(t.stateNode=a,pn=t,Rt=Ss(a.firstChild),Ls=!1,r=!0):r=!1),r||Lr(t)),am(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,a=l.children,Im(r,l)?a=null:i!==null&&Im(r,i)&&(t.flags|=32),t.memoizedState!==null&&(r=tx(e,t,iR,null,null,n),$o._currentValue=r),mu(e,t),en(e,t,a,n),t.child;case 6:return e===null&&et&&((e=n=Rt)&&(n=GR(n,t.pendingProps,Ls),n!==null?(t.stateNode=n,pn=t,Rt=null,e=!0):e=!1),e||Lr(t)),null;case 13:return Qw(e,t,n);case 4:return Eu(t,t.stateNode.containerInfo),a=t.pendingProps,e===null?t.child=ei(t,null,a,n):en(e,t,a,n),t.child;case 11:return Iv(e,t,t.type,t.pendingProps,n);case 7:return en(e,t,t.pendingProps,n),t.child;case 8:return en(e,t,t.pendingProps.children,n),t.child;case 12:return en(e,t,t.pendingProps.children,n),t.child;case 10:return a=t.pendingProps,Oa(t,t.type,a.value),en(e,t,a.children,n),t.child;case 9:return r=t.type._context,a=t.pendingProps.children,Ur(t),r=cn(r),a=a(r),t.flags|=1,en(e,t,a,n),t.child;case 14:return Hv(e,t,t.type,t.pendingProps,n);case 15:return Xw(e,t,t.type,t.pendingProps,n);case 19:return Zw(e,t,n);case 31:return a=t.pendingProps,n=t.mode,a={mode:a.mode,children:a.children},e===null?(n=Yu(a,n),n.ref=t.ref,t.child=n,n.return=t,t=n):(n=pa(e.child,a),n.ref=t.ref,t.child=n,n.return=t,t=n),t;case 22:return Ww(e,t,n);case 24:return Ur(t),a=cn(Pt),e===null?(r=Qp(),r===null&&(r=ht,l=Wp(),r.pooledCache=l,l.refCount++,l!==null&&(r.pooledCacheLanes|=n),r=l),t.memoizedState={parent:a,cache:r},Zp(t),Oa(t,Pt,r)):(e.lanes&n&&(ym(e,t),uo(t,null,null,n),co()),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),Oa(t,Pt,a)):(a=l.cache,Oa(t,Pt,a),a!==r.cache&&gm(t,[Pt],n,!0))),en(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(W(156,t.tag))}function aa(e){e.flags|=4}function Fv(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!P0(t)){if(t=js.current,t!==null&&((Ye&4194048)===Ye?Vs!==null:(Ye&62914560)!==Ye&&!(Ye&536870912)||t!==Vs))throw io=jm,aw;e.flags|=8192}}function Lc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?kb():536870912,e.lanes|=t,ti|=t)}function Bi(e,t){if(!et)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 St(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 xR(e,t,n){var a=t.pendingProps;switch(Xp(t),t.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return St(t),null;case 1:return St(t),null;case 3:return n=t.stateNode,a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),xa(Pt),Kl(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Li(t)?aa(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,_v())),St(t),null;case 26:return n=t.memoizedState,e===null?(aa(t),n!==null?(St(t),Fv(t,n)):(St(t),t.flags&=-16777217)):n?n!==e.memoizedState?(aa(t),St(t),Fv(t,n)):(St(t),t.flags&=-16777217):(e.memoizedProps!==a&&aa(t),St(t),t.flags&=-16777217),null;case 27:Au(t),n=Ya.current;var r=t.type;if(e!==null&&t.stateNode!=null)e.memoizedProps!==a&&aa(t);else{if(!a){if(t.stateNode===null)throw Error(W(166));return St(t),null}e=qs.current,Li(t)?bv(t):(e=B0(r,a,n),t.stateNode=e,aa(t))}return St(t),null;case 5:if(Au(t),n=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&aa(t);else{if(!a){if(t.stateNode===null)throw Error(W(166));return St(t),null}if(e=qs.current,Li(t))bv(t);else{switch(r=Ju(Ya.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[on]=t,e[Ln]=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(nn(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&&aa(t)}}return St(t),t.flags&=-16777217,null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==a&&aa(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(W(166));if(e=Ya.current,Li(t)){if(e=t.stateNode,n=t.memoizedProps,a=null,r=pn,r!==null)switch(r.tag){case 27:case 5:a=r.memoizedProps}e[on]=t,e=!!(e.nodeValue===n||a!==null&&a.suppressHydrationWarning===!0||z0(e.nodeValue,n)),e||Lr(t)}else e=Ju(e).createTextNode(a),e[on]=t,t.stateNode=e}return St(t),null;case 13:if(a=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=Li(t),a!==null&&a.dehydrated!==null){if(e===null){if(!r)throw Error(W(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(W(317));r[on]=t}else tc(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;St(t),r=!1}else r=_v(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(ma(t),t):(ma(t),null)}if(ma(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),Lc(t,t.updateQueue),St(t),null;case 4:return Kl(),e===null&&yx(t.stateNode.containerInfo),St(t),null;case 10:return xa(t.type),St(t),null;case 19:if(Wt(qt),r=t.memoizedState,r===null)return St(t),null;if(a=(t.flags&128)!==0,l=r.rendering,l===null)if(a)Bi(r,!1);else{if(Tt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(l=qu(e),l!==null){for(t.flags|=128,Bi(r,!1),e=l.updateQueue,t.updateQueue=e,Lc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ew(n,e),n=n.sibling;return _t(qt,qt.current&1|2),t.child}e=e.sibling}r.tail!==null&&Gs()>Ku&&(t.flags|=128,a=!0,Bi(r,!1),t.lanes=4194304)}else{if(!a)if(e=qu(l),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Lc(t,e),Bi(r,!0),r.tail===null&&r.tailMode==="hidden"&&!l.alternate&&!et)return St(t),null}else 2*Gs()-r.renderingStartTime>Ku&&n!==536870912&&(t.flags|=128,a=!0,Bi(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=Gs(),t.sibling=null,e=qt.current,_t(qt,a?e&1|2:e&1),t):(St(t),null);case 22:case 23:return ma(t),Jp(),a=t.memoizedState!==null,e!==null?e.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?n&536870912&&!(t.flags&128)&&(St(t),t.subtreeFlags&6&&(t.flags|=8192)):St(t),n=t.updateQueue,n!==null&&Lc(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&&Wt(Er),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),xa(Pt),St(t),null;case 25:return null;case 30:return null}throw Error(W(156,t.tag))}function gR(e,t){switch(Xp(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return xa(Pt),Kl(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Au(t),null;case 13:if(ma(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(W(340));tc()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Wt(qt),null;case 4:return Kl(),null;case 10:return xa(t.type),null;case 22:case 23:return ma(t),Jp(),e!==null&&Wt(Er),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return xa(Pt),null;case 25:return null;default:return null}}function e0(e,t){switch(Xp(t),t.tag){case 3:xa(Pt),Kl();break;case 26:case 27:case 5:Au(t);break;case 4:Kl();break;case 13:ma(t);break;case 19:Wt(qt);break;case 10:xa(t.type);break;case 22:case 23:ma(t),Jp(),e!==null&&Wt(Er);break;case 24:xa(Pt)}}function ic(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){ut(t,t.return,o)}}function sr(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){ut(r,c,f)}}}a=a.next}while(a!==l)}}catch(f){ut(t,t.return,f)}}function t0(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{iw(t,n)}catch(a){ut(e,e.return,a)}}}function n0(e,t,n){n.props=Ir(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(a){ut(e,t,a)}}function ho(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){ut(e,t,r)}}function Is(e,t){var n=e.ref,a=e.refCleanup;if(n!==null)if(typeof a=="function")try{a()}catch(r){ut(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){ut(e,t,r)}else n.current=null}function s0(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){ut(e,e.return,r)}}function uh(e,t,n){try{var a=e.stateNode;UR(a,e.type,n,t),a[Ln]=t}catch(r){ut(e,e.return,r)}}function a0(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&dr(e.type)||e.tag===4}function dh(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||a0(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&&dr(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 Em(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=Gd));else if(a!==4&&(a===27&&dr(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Em(e,t,n),e=e.sibling;e!==null;)Em(e,t,n),e=e.sibling}function Fu(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&&dr(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Fu(e,t,n),e=e.sibling;e!==null;)Fu(e,t,n),e=e.sibling}function r0(e){var t=e.stateNode,n=e.memoizedProps;try{for(var a=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);nn(t,a,n),t[on]=e,t[Ln]=n}catch(l){ut(e,e.return,l)}}var ca=!1,Mt=!1,fh=!1,Kv=typeof WeakSet=="function"?WeakSet:Set,Ft=null;function vR(e,t){if(e=e.containerInfo,Um=sd,e=Yb(e),Gp(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,m=e,h=null;t:for(;;){for(var x;m!==n||r!==0&&m.nodeType!==3||(o=i+r),m!==l||a!==0&&m.nodeType!==3||(c=i+a),m.nodeType===3&&(i+=m.nodeValue.length),(x=m.firstChild)!==null;)h=m,m=x;for(;;){if(m===e)break t;if(h===n&&++d===r&&(o=i),h===l&&++f===a&&(c=i),(x=m.nextSibling)!==null)break;m=h,h=m.parentNode}m=x}n=o===-1||c===-1?null:{start:o,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Bm={focusedElem:e,selectionRange:n},sd=!1,Ft=t;Ft!==null;)if(t=Ft,e=t.child,(t.subtreeFlags&1024)!==0&&e!==null)e.return=t,Ft=e;else for(;Ft!==null;){switch(t=Ft,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 j=Ir(n.type,r,n.elementType===n.type);e=a.getSnapshotBeforeUpdate(j,l),a.__reactInternalSnapshotBeforeUpdate=e}catch(v){ut(n,n.return,v)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Hm(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Hm(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(W(163))}if(e=t.sibling,e!==null){e.return=t.return,Ft=e;break}Ft=t.return}}function l0(e,t,n){var a=n.flags;switch(n.tag){case 0:case 11:case 15:Sa(e,n),a&4&&ic(5,n);break;case 1:if(Sa(e,n),a&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(i){ut(n,n.return,i)}else{var r=Ir(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(i){ut(n,n.return,i)}}a&64&&t0(n),a&512&&ho(n,n.return);break;case 3:if(Sa(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{iw(e,t)}catch(i){ut(n,n.return,i)}}break;case 27:t===null&&a&4&&r0(n);case 26:case 5:Sa(e,n),t===null&&a&4&&s0(n),a&512&&ho(n,n.return);break;case 12:Sa(e,n);break;case 13:Sa(e,n),a&4&&c0(e,n),a&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=CR.bind(null,n),VR(e,n))));break;case 22:if(a=n.memoizedState!==null||ca,!a){t=t!==null&&t.memoizedState!==null||Mt,r=ca;var l=Mt;ca=a,(Mt=t)&&!l?Ea(e,n,(n.subtreeFlags&8772)!==0):Sa(e,n),ca=r,Mt=l}break;case 30:break;default:Sa(e,n)}}function i0(e){var t=e.alternate;t!==null&&(e.alternate=null,i0(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Up(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 bt=null,Mn=!1;function ra(e,t,n){for(n=n.child;n!==null;)o0(e,t,n),n=n.sibling}function o0(e,t,n){if(Wn&&typeof Wn.onCommitFiberUnmount=="function")try{Wn.onCommitFiberUnmount(Wo,n)}catch{}switch(n.tag){case 26:Mt||Is(n,t),ra(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Mt||Is(n,t);var a=bt,r=Mn;dr(n.type)&&(bt=n.stateNode,Mn=!1),ra(e,t,n),go(n.stateNode),bt=a,Mn=r;break;case 5:Mt||Is(n,t);case 6:if(a=bt,r=Mn,bt=null,ra(e,t,n),bt=a,Mn=r,bt!==null)if(Mn)try{(bt.nodeType===9?bt.body:bt.nodeName==="HTML"?bt.ownerDocument.body:bt).removeChild(n.stateNode)}catch(l){ut(n,t,l)}else try{bt.removeChild(n.stateNode)}catch(l){ut(n,t,l)}break;case 18:bt!==null&&(Mn?(e=bt,lj(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Do(e)):lj(bt,n.stateNode));break;case 4:a=bt,r=Mn,bt=n.stateNode.containerInfo,Mn=!0,ra(e,t,n),bt=a,Mn=r;break;case 0:case 11:case 14:case 15:Mt||sr(2,n,t),Mt||sr(4,n,t),ra(e,t,n);break;case 1:Mt||(Is(n,t),a=n.stateNode,typeof a.componentWillUnmount=="function"&&n0(n,t,a)),ra(e,t,n);break;case 21:ra(e,t,n);break;case 22:Mt=(a=Mt)||n.memoizedState!==null,ra(e,t,n),Mt=a;break;default:ra(e,t,n)}}function c0(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Do(e)}catch(n){ut(t,t.return,n)}}function jR(e){switch(e.tag){case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Kv),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Kv),t;default:throw Error(W(435,e.tag))}}function hh(e,t){var n=jR(e);t.forEach(function(a){var r=RR.bind(null,e,a);n.has(a)||(n.add(a),a.then(r,r))})}function Gn(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(dr(o.type)){bt=o.stateNode,Mn=!1;break e}break;case 5:bt=o.stateNode,Mn=!1;break e;case 3:case 4:bt=o.stateNode.containerInfo,Mn=!0;break e}o=o.return}if(bt===null)throw Error(W(160));o0(l,i,r),bt=null,Mn=!1,l=r.alternate,l!==null&&(l.return=null),r.return=null}if(t.subtreeFlags&13878)for(t=t.child;t!==null;)u0(t,e),t=t.sibling}var Ns=null;function u0(e,t){var n=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Gn(t,e),Vn(e),a&4&&(sr(3,e,e.return),ic(3,e),sr(5,e,e.return));break;case 1:Gn(t,e),Vn(e),a&512&&(Mt||n===null||Is(n,n.return)),a&64&&ca&&(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=Ns;if(Gn(t,e),Vn(e),a&512&&(Mt||n===null||Is(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[Jo]||l[on]||l.namespaceURI==="http://www.w3.org/2000/svg"||l.hasAttribute("itemprop"))&&(l=r.createElement(a),r.head.insertBefore(l,r.querySelector("head > title"))),nn(l,a,n),l[on]=e,Kt(l),a=l;break e;case"link":var i=dj("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),nn(l,a,n),r.head.appendChild(l);break;case"meta":if(i=dj("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),nn(l,a,n),r.head.appendChild(l);break;default:throw Error(W(468,a))}l[on]=e,Kt(l),a=l}e.stateNode=a}else fj(r,e.type,e.stateNode);else e.stateNode=uj(r,a,e.memoizedProps);else l!==a?(l===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):l.count--,a===null?fj(r,e.type,e.stateNode):uj(r,a,e.memoizedProps)):a===null&&e.stateNode!==null&&uh(e,e.memoizedProps,n.memoizedProps)}break;case 27:Gn(t,e),Vn(e),a&512&&(Mt||n===null||Is(n,n.return)),n!==null&&a&4&&uh(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Gn(t,e),Vn(e),a&512&&(Mt||n===null||Is(n,n.return)),e.flags&32){r=e.stateNode;try{Wl(r,"")}catch(x){ut(e,e.return,x)}}a&4&&e.stateNode!=null&&(r=e.memoizedProps,uh(e,r,n!==null?n.memoizedProps:r)),a&1024&&(fh=!0);break;case 6:if(Gn(t,e),Vn(e),a&4){if(e.stateNode===null)throw Error(W(162));a=e.memoizedProps,n=e.stateNode;try{n.nodeValue=a}catch(x){ut(e,e.return,x)}}break;case 3:if(gu=null,r=Ns,Ns=ed(t.containerInfo),Gn(t,e),Ns=r,Vn(e),a&4&&n!==null&&n.memoizedState.isDehydrated)try{Do(t.containerInfo)}catch(x){ut(e,e.return,x)}fh&&(fh=!1,d0(e));break;case 4:a=Ns,Ns=ed(e.stateNode.containerInfo),Gn(t,e),Vn(e),Ns=a;break;case 12:Gn(t,e),Vn(e);break;case 13:Gn(t,e),Vn(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(gx=Gs()),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,hh(e,a)));break;case 22:r=e.memoizedState!==null;var c=n!==null&&n.memoizedState!==null,d=ca,f=Mt;if(ca=d||r,Mt=f||c,Gn(t,e),Mt=f,ca=d,Vn(e),a&8192)e:for(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,r&&(n===null||c||ca||Mt||Nr(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 m=c.memoizedProps.style,h=m!=null&&m.hasOwnProperty("display")?m.display:null;o.style.display=h==null||typeof h=="boolean"?"":(""+h).trim()}}catch(x){ut(c,c.return,x)}}}else if(t.tag===6){if(n===null){c=t;try{c.stateNode.nodeValue=r?"":c.memoizedProps}catch(x){ut(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,hh(e,n))));break;case 19:Gn(t,e),Vn(e),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,hh(e,a)));break;case 30:break;case 21:break;default:Gn(t,e),Vn(e)}}function Vn(e){var t=e.flags;if(t&2){try{for(var n,a=e.return;a!==null;){if(a0(a)){n=a;break}a=a.return}if(n==null)throw Error(W(160));switch(n.tag){case 27:var r=n.stateNode,l=dh(e);Fu(e,l,r);break;case 5:var i=n.stateNode;n.flags&32&&(Wl(i,""),n.flags&=-33);var o=dh(e);Fu(e,o,i);break;case 3:case 4:var c=n.stateNode.containerInfo,d=dh(e);Em(e,d,c);break;default:throw Error(W(161))}}catch(f){ut(e,e.return,f)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function d0(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;d0(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Sa(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)l0(e,t.alternate,t),t=t.sibling}function Nr(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:sr(4,t,t.return),Nr(t);break;case 1:Is(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&n0(t,t.return,n),Nr(t);break;case 27:go(t.stateNode);case 26:case 5:Is(t,t.return),Nr(t);break;case 22:t.memoizedState===null&&Nr(t);break;case 30:Nr(t);break;default:Nr(t)}e=e.sibling}}function Ea(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:Ea(r,l,n),ic(4,l);break;case 1:if(Ea(r,l,n),a=l,r=a.stateNode,typeof r.componentDidMount=="function")try{r.componentDidMount()}catch(d){ut(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++)lw(c[r],o)}catch(d){ut(a,a.return,d)}}n&&i&64&&t0(l),ho(l,l.return);break;case 27:r0(l);case 26:case 5:Ea(r,l,n),n&&a===null&&i&4&&s0(l),ho(l,l.return);break;case 12:Ea(r,l,n);break;case 13:Ea(r,l,n),n&&i&4&&c0(r,l);break;case 22:l.memoizedState===null&&Ea(r,l,n),ho(l,l.return);break;case 30:break;default:Ea(r,l,n)}t=t.sibling}}function hx(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&&sc(n))}function mx(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&sc(e))}function Ds(e,t,n,a){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)f0(e,t,n,a),t=t.sibling}function f0(e,t,n,a){var r=t.flags;switch(t.tag){case 0:case 11:case 15:Ds(e,t,n,a),r&2048&&ic(9,t);break;case 1:Ds(e,t,n,a);break;case 3:Ds(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&&sc(e)));break;case 12:if(r&2048){Ds(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){ut(t,t.return,c)}}else Ds(e,t,n,a);break;case 13:Ds(e,t,n,a);break;case 23:break;case 22:l=t.stateNode,i=t.alternate,t.memoizedState!==null?l._visibility&2?Ds(e,t,n,a):mo(e,t):l._visibility&2?Ds(e,t,n,a):(l._visibility|=2,gl(e,t,n,a,(t.subtreeFlags&10256)!==0)),r&2048&&hx(i,t);break;case 24:Ds(e,t,n,a),r&2048&&mx(t.alternate,t);break;default:Ds(e,t,n,a)}}function gl(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:gl(l,i,o,c,r),ic(8,i);break;case 23:break;case 22:var f=i.stateNode;i.memoizedState!==null?f._visibility&2?gl(l,i,o,c,r):mo(l,i):(f._visibility|=2,gl(l,i,o,c,r)),r&&d&2048&&hx(i.alternate,i);break;case 24:gl(l,i,o,c,r),r&&d&2048&&mx(i.alternate,i);break;default:gl(l,i,o,c,r)}t=t.sibling}}function mo(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:mo(n,a),r&2048&&hx(a.alternate,a);break;case 24:mo(n,a),r&2048&&mx(a.alternate,a);break;default:mo(n,a)}t=t.sibling}}var Xi=8192;function rl(e){if(e.subtreeFlags&Xi)for(e=e.child;e!==null;)h0(e),e=e.sibling}function h0(e){switch(e.tag){case 26:rl(e),e.flags&Xi&&e.memoizedState!==null&&aT(Ns,e.memoizedState,e.memoizedProps);break;case 5:rl(e);break;case 3:case 4:var t=Ns;Ns=ed(e.stateNode.containerInfo),rl(e),Ns=t;break;case 22:e.memoizedState===null&&(t=e.alternate,t!==null&&t.memoizedState!==null?(t=Xi,Xi=16777216,rl(e),Xi=t):rl(e));break;default:rl(e)}}function m0(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 Ii(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var a=t[n];Ft=a,x0(a,e)}m0(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)p0(e),e=e.sibling}function p0(e){switch(e.tag){case 0:case 11:case 15:Ii(e),e.flags&2048&&sr(9,e,e.return);break;case 3:Ii(e);break;case 12:Ii(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,pu(e)):Ii(e);break;default:Ii(e)}}function pu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var a=t[n];Ft=a,x0(a,e)}m0(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:sr(8,t,t.return),pu(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,pu(t));break;default:pu(t)}e=e.sibling}}function x0(e,t){for(;Ft!==null;){var n=Ft;switch(n.tag){case 0:case 11:case 15:sr(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:sc(n.memoizedState.cache)}if(a=n.child,a!==null)a.return=n,Ft=a;else e:for(n=e;Ft!==null;){a=Ft;var r=a.sibling,l=a.return;if(i0(a),a===n){Ft=null;break e}if(r!==null){r.return=l,Ft=r;break e}Ft=l}}}var yR={getCacheForType:function(e){var t=cn(Pt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n}},bR=typeof WeakMap=="function"?WeakMap:Map,lt=0,ht=null,Ge=null,Ye=0,rt=0,Fn=null,Ha=!1,hi=!1,px=!1,ya=0,Tt=0,ar=0,Ar=0,xx=0,fs=0,ti=0,po=null,On=null,Am=!1,gx=0,Ku=1/0,Xu=null,Xa=null,tn=0,Wa=null,ni=null,Pl=0,$m=0,Mm=null,g0=null,xo=0,Om=null;function Zn(){if(lt&2&&Ye!==0)return Ye&-Ye;if(Me.T!==null){var e=Ql;return e!==0?e:jx()}return Rb()}function v0(){fs===0&&(fs=!(Ye&536870912)||et?Nb():536870912);var e=js.current;return e!==null&&(e.flags|=32),fs}function Jn(e,t,n){(e===ht&&(rt===2||rt===9)||e.cancelPendingCommit!==null)&&(si(e,0),Pa(e,Ye,fs,!1)),Zo(e,n),(!(lt&2)||e!==ht)&&(e===ht&&(!(lt&2)&&(Ar|=n),Tt===4&&Pa(e,Ye,fs,!1)),Zs(e))}function j0(e,t,n){if(lt&6)throw Error(W(327));var a=!n&&(t&124)===0&&(t&e.expiredLanes)===0||Qo(e,t),r=a?NR(e,t):mh(e,t,!0),l=a;do{if(r===0){hi&&!a&&Pa(e,t,0,!1);break}else{if(n=e.current.alternate,l&&!wR(n)){r=mh(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=po;var c=o.current.memoizedState.isDehydrated;if(c&&(si(o,i).flags|=256),i=mh(o,i,!1),i!==2){if(px&&!c){o.errorRecoveryDisabledLanes|=l,Ar|=l,r=4;break e}l=On,On=r,l!==null&&(On===null?On=l:On.push.apply(On,l))}r=i}if(l=!1,r!==2)continue}}if(r===1){si(e,0),Pa(e,t,0,!0);break}e:{switch(a=e,l=r,l){case 0:case 1:throw Error(W(345));case 4:if((t&4194048)!==t)break;case 6:Pa(a,t,fs,!Ha);break e;case 2:On=null;break;case 3:case 5:break;default:throw Error(W(329))}if((t&62914560)===t&&(r=gx+300-Gs(),10<r)){if(Pa(a,t,fs,!Ha),Ad(a,0,!0)!==0)break e;a.timeoutHandle=U0(Xv.bind(null,a,n,On,Xu,Am,t,fs,Ar,ti,Ha,l,2,-0,0),r);break e}Xv(a,n,On,Xu,Am,t,fs,Ar,ti,Ha,l,0,-0,0)}}break}while(!0);Zs(e)}function Xv(e,t,n,a,r,l,i,o,c,d,f,m,h,x){if(e.timeoutHandle=-1,m=t.subtreeFlags,(m&8192||(m&16785408)===16785408)&&(Ao={stylesheets:null,count:0,unsuspend:sT},h0(t),m=rT(),m!==null)){e.cancelPendingCommit=m(Qv.bind(null,e,t,l,n,a,r,i,o,c,f,1,h,x)),Pa(e,l,i,!d);return}Qv(e,t,l,n,a,r,i,o,c)}function wR(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(!ns(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 Pa(e,t,n,a){t&=~xx,t&=~Ar,e.suspendedLanes|=t,e.pingedLanes&=~t,a&&(e.warmLanes|=t),a=e.expirationTimes;for(var r=t;0<r;){var l=31-Qn(r),i=1<<l;a[l]=-1,r&=~i}n!==0&&Sb(e,n,t)}function Hd(){return lt&6?!0:(oc(0),!1)}function vx(){if(Ge!==null){if(rt===0)var e=Ge.return;else e=Ge,ha=Wr=null,ax(e),Hl=null,Ro=0,e=Ge;for(;e!==null;)e0(e.alternate,e),e=e.return;Ge=null}}function si(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,IR(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),vx(),ht=e,Ge=n=pa(e.current,null),Ye=t,rt=0,Fn=null,Ha=!1,hi=Qo(e,t),px=!1,ti=fs=xx=Ar=ar=Tt=0,On=po=null,Am=!1,t&8&&(t|=t&32);var a=e.entangledLanes;if(a!==0)for(e=e.entanglements,a&=t;0<a;){var r=31-Qn(a),l=1<<r;t|=e[r],a&=~l}return ya=t,Dd(),n}function y0(e,t){He=null,Me.H=Pu,t===ac||t===Ld?(t=Cv(),rt=3):t===aw?(t=Cv(),rt=4):rt=t===Kw?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Fn=t,Ge===null&&(Tt=1,Vu(e,ds(t,e.current)))}function b0(){var e=Me.H;return Me.H=Pu,e===null?Pu:e}function w0(){var e=Me.A;return Me.A=yR,e}function Dm(){Tt=4,Ha||(Ye&4194048)!==Ye&&js.current!==null||(hi=!0),!(ar&134217727)&&!(Ar&134217727)||ht===null||Pa(ht,Ye,fs,!1)}function mh(e,t,n){var a=lt;lt|=2;var r=b0(),l=w0();(ht!==e||Ye!==t)&&(Xu=null,si(e,t)),t=!1;var i=Tt;e:do try{if(rt!==0&&Ge!==null){var o=Ge,c=Fn;switch(rt){case 8:vx(),i=6;break e;case 3:case 2:case 9:case 6:js.current===null&&(t=!0);var d=rt;if(rt=0,Fn=null,Al(e,o,c,d),n&&hi){i=0;break e}break;default:d=rt,rt=0,Fn=null,Al(e,o,c,d)}}_R(),i=Tt;break}catch(f){y0(e,f)}while(!0);return t&&e.shellSuspendCounter++,ha=Wr=null,lt=a,Me.H=r,Me.A=l,Ge===null&&(ht=null,Ye=0,Dd()),i}function _R(){for(;Ge!==null;)_0(Ge)}function NR(e,t){var n=lt;lt|=2;var a=b0(),r=w0();ht!==e||Ye!==t?(Xu=null,Ku=Gs()+500,si(e,t)):hi=Qo(e,t);e:do try{if(rt!==0&&Ge!==null){t=Ge;var l=Fn;t:switch(rt){case 1:rt=0,Fn=null,Al(e,t,l,1);break;case 2:case 9:if(Sv(l)){rt=0,Fn=null,Wv(t);break}t=function(){rt!==2&&rt!==9||ht!==e||(rt=7),Zs(e)},l.then(t,t);break e;case 3:rt=7;break e;case 4:rt=5;break e;case 7:Sv(l)?(rt=0,Fn=null,Wv(t)):(rt=0,Fn=null,Al(e,t,l,7));break;case 5:var i=null;switch(Ge.tag){case 26:i=Ge.memoizedState;case 5:case 27:var o=Ge;if(!i||P0(i)){rt=0,Fn=null;var c=o.sibling;if(c!==null)Ge=c;else{var d=o.return;d!==null?(Ge=d,Pd(d)):Ge=null}break t}}rt=0,Fn=null,Al(e,t,l,5);break;case 6:rt=0,Fn=null,Al(e,t,l,6);break;case 8:vx(),Tt=6;break e;default:throw Error(W(462))}}kR();break}catch(f){y0(e,f)}while(!0);return ha=Wr=null,Me.H=a,Me.A=r,lt=n,Ge!==null?0:(ht=null,Ye=0,Dd(),Tt)}function kR(){for(;Ge!==null&&!F2();)_0(Ge)}function _0(e){var t=Jw(e.alternate,e,ya);e.memoizedProps=e.pendingProps,t===null?Pd(e):Ge=t}function Wv(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=qv(n,t,t.pendingProps,t.type,void 0,Ye);break;case 11:t=qv(n,t,t.pendingProps,t.type.render,t.ref,Ye);break;case 5:ax(t);default:e0(n,t),t=Ge=ew(t,ya),t=Jw(n,t,ya)}e.memoizedProps=e.pendingProps,t===null?Pd(e):Ge=t}function Al(e,t,n,a){ha=Wr=null,ax(t),Hl=null,Ro=0;var r=t.return;try{if(mR(e,r,t,n,Ye)){Tt=1,Vu(e,ds(n,e.current)),Ge=null;return}}catch(l){if(r!==null)throw Ge=r,l;Tt=1,Vu(e,ds(n,e.current)),Ge=null;return}t.flags&32768?(et||a===1?e=!0:hi||Ye&536870912?e=!1:(Ha=e=!0,(a===2||a===9||a===3||a===6)&&(a=js.current,a!==null&&a.tag===13&&(a.flags|=16384))),N0(t,e)):Pd(t)}function Pd(e){var t=e;do{if(t.flags&32768){N0(t,Ha);return}e=t.return;var n=xR(t.alternate,t,ya);if(n!==null){Ge=n;return}if(t=t.sibling,t!==null){Ge=t;return}Ge=t=e}while(t!==null);Tt===0&&(Tt=5)}function N0(e,t){do{var n=gR(e.alternate,e);if(n!==null){n.flags&=32767,Ge=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ge=e;return}Ge=e=n}while(e!==null);Tt=6,Ge=null}function Qv(e,t,n,a,r,l,i,o,c){e.cancelPendingCommit=null;do qd();while(tn!==0);if(lt&6)throw Error(W(327));if(t!==null){if(t===e.current)throw Error(W(177));if(l=t.lanes|t.childLanes,l|=Vp,sC(e,n,l,i,o,c),e===ht&&(Ge=ht=null,Ye=0),ni=t,Wa=e,Pl=n,$m=l,Mm=r,g0=a,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,TR($u,function(){return T0(),null})):(e.callbackNode=null,e.callbackPriority=0),a=(t.flags&13878)!==0,t.subtreeFlags&13878||a){a=Me.T,Me.T=null,r=tt.p,tt.p=2,i=lt,lt|=4;try{vR(e,t,n)}finally{lt=i,tt.p=r,Me.T=a}}tn=1,k0(),S0(),C0()}}function k0(){if(tn===1){tn=0;var e=Wa,t=ni,n=(t.flags&13878)!==0;if(t.subtreeFlags&13878||n){n=Me.T,Me.T=null;var a=tt.p;tt.p=2;var r=lt;lt|=4;try{u0(t,e);var l=Bm,i=Yb(e.containerInfo),o=l.focusedElem,c=l.selectionRange;if(i!==o&&o&&o.ownerDocument&&Vb(o.ownerDocument.documentElement,o)){if(c!==null&&Gp(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 m=o.ownerDocument||document,h=m&&m.defaultView||window;if(h.getSelection){var x=h.getSelection(),j=o.textContent.length,v=Math.min(c.start,j),y=c.end===void 0?v:Math.min(c.end,j);!x.extend&&v>y&&(i=y,y=v,v=i);var g=vv(o,v),p=vv(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 b=m.createRange();b.setStart(g.node,g.offset),x.removeAllRanges(),v>y?(x.addRange(b),x.extend(p.node,p.offset)):(b.setEnd(p.node,p.offset),x.addRange(b))}}}}for(m=[],x=o;x=x.parentNode;)x.nodeType===1&&m.push({element:x,left:x.scrollLeft,top:x.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o<m.length;o++){var w=m[o];w.element.scrollLeft=w.left,w.element.scrollTop=w.top}}sd=!!Um,Bm=Um=null}finally{lt=r,tt.p=a,Me.T=n}}e.current=t,tn=2}}function S0(){if(tn===2){tn=0;var e=Wa,t=ni,n=(t.flags&8772)!==0;if(t.subtreeFlags&8772||n){n=Me.T,Me.T=null;var a=tt.p;tt.p=2;var r=lt;lt|=4;try{l0(e,t.alternate,t)}finally{lt=r,tt.p=a,Me.T=n}}tn=3}}function C0(){if(tn===4||tn===3){tn=0,K2();var e=Wa,t=ni,n=Pl,a=g0;t.subtreeFlags&10256||t.flags&10256?tn=5:(tn=0,ni=Wa=null,R0(e,e.pendingLanes));var r=e.pendingLanes;if(r===0&&(Xa=null),Lp(n),t=t.stateNode,Wn&&typeof Wn.onCommitFiberRoot=="function")try{Wn.onCommitFiberRoot(Wo,t,void 0,(t.current.flags&128)===128)}catch{}if(a!==null){t=Me.T,r=tt.p,tt.p=2,Me.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{Me.T=t,tt.p=r}}Pl&3&&qd(),Zs(e),r=e.pendingLanes,n&4194090&&r&42?e===Om?xo++:(xo=0,Om=e):xo=0,oc(0)}}function R0(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,sc(t)))}function qd(e){return k0(),S0(),C0(),T0()}function T0(){if(tn!==5)return!1;var e=Wa,t=$m;$m=0;var n=Lp(Pl),a=Me.T,r=tt.p;try{tt.p=32>n?32:n,Me.T=null,n=Mm,Mm=null;var l=Wa,i=Pl;if(tn=0,ni=Wa=null,Pl=0,lt&6)throw Error(W(331));var o=lt;if(lt|=4,p0(l.current),f0(l,l.current,i,n),lt=o,oc(0,!1),Wn&&typeof Wn.onPostCommitFiberRoot=="function")try{Wn.onPostCommitFiberRoot(Wo,l)}catch{}return!0}finally{tt.p=r,Me.T=a,R0(e,t)}}function Zv(e,t,n){t=ds(n,t),t=Cm(e.stateNode,t,2),e=Ka(e,t,2),e!==null&&(Zo(e,2),Zs(e))}function ut(e,t,n){if(e.tag===3)Zv(e,e,n);else for(;t!==null;){if(t.tag===3){Zv(t,e,n);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(Xa===null||!Xa.has(a))){e=ds(n,e),n=Yw(2),a=Ka(t,n,2),a!==null&&(Fw(n,a,t,e),Zo(a,2),Zs(a));break}}t=t.return}}function ph(e,t,n){var a=e.pingCache;if(a===null){a=e.pingCache=new bR;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)||(px=!0,r.add(n),e=SR.bind(null,e,t,n),t.then(e,e))}function SR(e,t,n){var a=e.pingCache;a!==null&&a.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ht===e&&(Ye&n)===n&&(Tt===4||Tt===3&&(Ye&62914560)===Ye&&300>Gs()-gx?!(lt&2)&&si(e,0):xx|=n,ti===Ye&&(ti=0)),Zs(e)}function E0(e,t){t===0&&(t=kb()),e=fi(e,t),e!==null&&(Zo(e,t),Zs(e))}function CR(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),E0(e,n)}function RR(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(W(314))}a!==null&&a.delete(t),E0(e,n)}function TR(e,t){return Dp(e,t)}var Wu=null,vl=null,zm=!1,Qu=!1,xh=!1,$r=0;function Zs(e){e!==vl&&e.next===null&&(vl===null?Wu=vl=e:vl=vl.next=e),Qu=!0,zm||(zm=!0,AR())}function oc(e,t){if(!xh&&Qu){xh=!0;do for(var n=!1,a=Wu;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-Qn(42|e)+1)-1,l&=r&~(i&~o),l=l&201326741?l&201326741|1:l?l|2:0}l!==0&&(n=!0,Jv(a,l))}else l=Ye,l=Ad(a,a===ht?l:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),!(l&3)||Qo(a,l)||(n=!0,Jv(a,l));a=a.next}while(n);xh=!1}}function ER(){A0()}function A0(){Qu=zm=!1;var e=0;$r!==0&&(BR()&&(e=$r),$r=0);for(var t=Gs(),n=null,a=Wu;a!==null;){var r=a.next,l=$0(a,t);l===0?(a.next=null,n===null?Wu=r:n.next=r,r===null&&(vl=n)):(n=a,(e!==0||l&3)&&(Qu=!0)),a=r}oc(e)}function $0(e,t){for(var n=e.suspendedLanes,a=e.pingedLanes,r=e.expirationTimes,l=e.pendingLanes&-62914561;0<l;){var i=31-Qn(l),o=1<<i,c=r[i];c===-1?(!(o&n)||o&a)&&(r[i]=nC(o,t)):c<=t&&(e.expiredLanes|=o),l&=~o}if(t=ht,n=Ye,n=Ad(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a=e.callbackNode,n===0||e===t&&(rt===2||rt===9)||e.cancelPendingCommit!==null)return a!==null&&a!==null&&Pf(a),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Qo(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(a!==null&&Pf(a),Lp(n)){case 2:case 8:n=wb;break;case 32:n=$u;break;case 268435456:n=_b;break;default:n=$u}return a=M0.bind(null,e),n=Dp(n,a),e.callbackPriority=t,e.callbackNode=n,t}return a!==null&&a!==null&&Pf(a),e.callbackPriority=2,e.callbackNode=null,2}function M0(e,t){if(tn!==0&&tn!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(qd()&&e.callbackNode!==n)return null;var a=Ye;return a=Ad(e,e===ht?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a===0?null:(j0(e,a,t),$0(e,Gs()),e.callbackNode!=null&&e.callbackNode===n?M0.bind(null,e):null)}function Jv(e,t){if(qd())return null;j0(e,t,!0)}function AR(){HR(function(){lt&6?Dp(bb,ER):A0()})}function jx(){return $r===0&&($r=Nb()),$r}function ej(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:iu(""+e)}function tj(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 $R(e,t,n,a,r){if(t==="submit"&&n&&n.stateNode===r){var l=ej((r[Ln]||null).action),i=a.submitter;i&&(t=(t=i[Ln]||null)?ej(t.formAction):i.getAttribute("formAction"),t!==null&&(l=t,i=null));var o=new $d("action","action",null,a,r);e.push({event:o,listeners:[{instance:null,listener:function(){if(a.defaultPrevented){if($r!==0){var c=i?tj(r,i):new FormData(r);km(n,{pending:!0,data:c,method:r.method,action:l},null,c)}}else typeof l=="function"&&(o.preventDefault(),c=i?tj(r,i):new FormData(r),km(n,{pending:!0,data:c,method:r.method,action:l},l,c))},currentTarget:r}]})}}for(var gh=0;gh<hm.length;gh++){var vh=hm[gh],MR=vh.toLowerCase(),OR=vh[0].toUpperCase()+vh.slice(1);$s(MR,"on"+OR)}$s(Kb,"onAnimationEnd");$s(Xb,"onAnimationIteration");$s(Wb,"onAnimationStart");$s("dblclick","onDoubleClick");$s("focusin","onFocus");$s("focusout","onBlur");$s(QC,"onTransitionRun");$s(ZC,"onTransitionStart");$s(JC,"onTransitionCancel");$s(Qb,"onTransitionEnd");Xl("onMouseEnter",["mouseout","mouseover"]);Xl("onMouseLeave",["mouseout","mouseover"]);Xl("onPointerEnter",["pointerout","pointerover"]);Xl("onPointerLeave",["pointerout","pointerover"]);Fr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Fr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Fr("onBeforeInput",["compositionend","keypress","textInput","paste"]);Fr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Fr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Fr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var To="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(" "),DR=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(To));function O0(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){Gu(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){Gu(f)}r.currentTarget=null,l=c}}}}function qe(e,t){var n=t[lm];n===void 0&&(n=t[lm]=new Set);var a=e+"__bubble";n.has(a)||(D0(t,e,2,!1),n.add(a))}function jh(e,t,n){var a=0;t&&(a|=4),D0(n,e,a,t)}var Uc="_reactListening"+Math.random().toString(36).slice(2);function yx(e){if(!e[Uc]){e[Uc]=!0,Tb.forEach(function(n){n!=="selectionchange"&&(DR.has(n)||jh(n,!1,e),jh(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Uc]||(t[Uc]=!0,jh("selectionchange",!1,t))}}function D0(e,t,n,a){switch(F0(t)){case 2:var r=oT;break;case 8:r=cT;break;default:r=Nx}n=r.bind(null,t,n,e),r=void 0,!um||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 yh(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=wl(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}Lb(function(){var d=l,f=Ip(n),m=[];e:{var h=Zb.get(e);if(h!==void 0){var x=$d,j=e;switch(e){case"keypress":if(cu(n)===0)break e;case"keydown":case"keyup":x=TC;break;case"focusin":j="focus",x=Wf;break;case"focusout":j="blur",x=Wf;break;case"beforeblur":case"afterblur":x=Wf;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=ov;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":x=gC;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":x=$C;break;case Kb:case Xb:case Wb:x=yC;break;case Qb:x=OC;break;case"scroll":case"scrollend":x=pC;break;case"wheel":x=zC;break;case"copy":case"cut":case"paste":x=wC;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":x=uv;break;case"toggle":case"beforetoggle":x=UC}var v=(t&4)!==0,y=!v&&(e==="scroll"||e==="scrollend"),g=v?h!==null?h+"Capture":null:h;v=[];for(var p=d,b;p!==null;){var w=p;if(b=w.stateNode,w=w.tag,w!==5&&w!==26&&w!==27||b===null||g===null||(w=_o(p,g),w!=null&&v.push(Eo(p,w,b))),y)break;p=p.return}0<v.length&&(h=new x(h,j,null,n,f),m.push({event:h,listeners:v}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",x=e==="mouseout"||e==="pointerout",h&&n!==cm&&(j=n.relatedTarget||n.fromElement)&&(wl(j)||j[ui]))break e;if((x||h)&&(h=f.window===f?f:(h=f.ownerDocument)?h.defaultView||h.parentWindow:window,x?(j=n.relatedTarget||n.toElement,x=d,j=j?wl(j):null,j!==null&&(y=Xo(j),v=j.tag,j!==y||v!==5&&v!==27&&v!==6)&&(j=null)):(x=null,j=d),x!==j)){if(v=ov,w="onMouseLeave",g="onMouseEnter",p="mouse",(e==="pointerout"||e==="pointerover")&&(v=uv,w="onPointerLeave",g="onPointerEnter",p="pointer"),y=x==null?h:Ki(x),b=j==null?h:Ki(j),h=new v(w,p+"leave",x,n,f),h.target=y,h.relatedTarget=b,w=null,wl(f)===d&&(v=new v(g,p+"enter",j,n,f),v.target=b,v.relatedTarget=y,w=v),y=w,x&&j)t:{for(v=x,g=j,p=0,b=v;b;b=ll(b))p++;for(b=0,w=g;w;w=ll(w))b++;for(;0<p-b;)v=ll(v),p--;for(;0<b-p;)g=ll(g),b--;for(;p--;){if(v===g||g!==null&&v===g.alternate)break t;v=ll(v),g=ll(g)}v=null}else v=null;x!==null&&nj(m,h,x,v,!1),j!==null&&y!==null&&nj(m,y,j,v,!0)}}e:{if(h=d?Ki(d):window,x=h.nodeName&&h.nodeName.toLowerCase(),x==="select"||x==="input"&&h.type==="file")var S=mv;else if(hv(h))if(qb)S=KC;else{S=YC;var C=VC}else x=h.nodeName,!x||x.toLowerCase()!=="input"||h.type!=="checkbox"&&h.type!=="radio"?d&&Bp(d.elementType)&&(S=mv):S=FC;if(S&&(S=S(e,d))){Pb(m,S,n,f);break e}C&&C(e,h,d),e==="focusout"&&d&&h.type==="number"&&d.memoizedProps.value!=null&&om(h,"number",h.value)}switch(C=d?Ki(d):window,e){case"focusin":(hv(C)||C.contentEditable==="true")&&(kl=C,dm=d,ro=null);break;case"focusout":ro=dm=kl=null;break;case"mousedown":fm=!0;break;case"contextmenu":case"mouseup":case"dragend":fm=!1,jv(m,n,f);break;case"selectionchange":if(WC)break;case"keydown":case"keyup":jv(m,n,f)}var _;if(qp)e:{switch(e){case"compositionstart":var N="onCompositionStart";break e;case"compositionend":N="onCompositionEnd";break e;case"compositionupdate":N="onCompositionUpdate";break e}N=void 0}else Nl?Ib(e,n)&&(N="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(N="onCompositionStart");N&&(Bb&&n.locale!=="ko"&&(Nl||N!=="onCompositionStart"?N==="onCompositionEnd"&&Nl&&(_=Ub()):(Ia=f,Hp="value"in Ia?Ia.value:Ia.textContent,Nl=!0)),C=Zu(d,N),0<C.length&&(N=new cv(N,e,null,n,f),m.push({event:N,listeners:C}),_?N.data=_:(_=Hb(n),_!==null&&(N.data=_)))),(_=IC?HC(e,n):PC(e,n))&&(N=Zu(d,"onBeforeInput"),0<N.length&&(C=new cv("onBeforeInput","beforeinput",null,n,f),m.push({event:C,listeners:N}),C.data=_)),$R(m,e,d,n,f)}O0(m,t)})}function Eo(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Zu(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=_o(e,n),r!=null&&a.unshift(Eo(e,r,l)),r=_o(e,t),r!=null&&a.push(Eo(e,r,l))),e.tag===3)return a;e=e.return}return[]}function ll(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function nj(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=_o(n,l),d!=null&&i.unshift(Eo(n,d,c))):r||(d=_o(n,l),d!=null&&i.push(Eo(n,d,c)))),n=n.return}i.length!==0&&e.push({event:t,listeners:i})}var zR=/\r\n?/g,LR=/\u0000|\uFFFD/g;function sj(e){return(typeof e=="string"?e:""+e).replace(zR,`
|
|
49
|
+
`).replace(LR,"")}function z0(e,t){return t=sj(t),sj(e)===t}function Gd(){}function ot(e,t,n,a,r,l){switch(n){case"children":typeof a=="string"?t==="body"||t==="textarea"&&a===""||Wl(e,a):(typeof a=="number"||typeof a=="bigint")&&t!=="body"&&Wl(e,""+a);break;case"className":Ac(e,"class",a);break;case"tabIndex":Ac(e,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":Ac(e,n,a);break;case"style":zb(e,a,l);break;case"data":if(t!=="object"){Ac(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=iu(""+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"&&ot(e,t,"name",r.name,r,null),ot(e,t,"formEncType",r.formEncType,r,null),ot(e,t,"formMethod",r.formMethod,r,null),ot(e,t,"formTarget",r.formTarget,r,null)):(ot(e,t,"encType",r.encType,r,null),ot(e,t,"method",r.method,r,null),ot(e,t,"target",r.target,r,null)));if(a==null||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(n);break}a=iu(""+a),e.setAttribute(n,a);break;case"onClick":a!=null&&(e.onclick=Gd);break;case"onScroll":a!=null&&qe("scroll",e);break;case"onScrollEnd":a!=null&&qe("scrollend",e);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(W(61));if(n=a.__html,n!=null){if(r.children!=null)throw Error(W(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=iu(""+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":qe("beforetoggle",e),qe("toggle",e),lu(e,"popover",a);break;case"xlinkActuate":sa(e,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":sa(e,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":sa(e,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":sa(e,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":sa(e,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":sa(e,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":sa(e,"http://www.w3.org/XML/1998/namespace","xml:base",a);break;case"xmlLang":sa(e,"http://www.w3.org/XML/1998/namespace","xml:lang",a);break;case"xmlSpace":sa(e,"http://www.w3.org/XML/1998/namespace","xml:space",a);break;case"is":lu(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=hC.get(n)||n,lu(e,n,a))}}function Lm(e,t,n,a,r,l){switch(n){case"style":zb(e,a,l);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(W(61));if(n=a.__html,n!=null){if(r.children!=null)throw Error(W(60));e.innerHTML=n}}break;case"children":typeof a=="string"?Wl(e,a):(typeof a=="number"||typeof a=="bigint")&&Wl(e,""+a);break;case"onScroll":a!=null&&qe("scroll",e);break;case"onScrollEnd":a!=null&&qe("scrollend",e);break;case"onClick":a!=null&&(e.onclick=Gd);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Eb.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[Ln]||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,""):lu(e,n,a)}}}function nn(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":qe("error",e),qe("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(W(137,t));default:ot(e,t,l,i,n,null)}}r&&ot(e,t,"srcSet",n.srcSet,n,null),a&&ot(e,t,"src",n.src,n,null);return;case"input":qe("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(W(137,t));break;default:ot(e,t,a,f,n,null)}}Mb(e,l,o,c,d,i,r,!1),Mu(e);return;case"select":qe("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:ot(e,t,r,o,n,null)}t=l,n=i,e.multiple=!!a,t!=null?zl(e,!!a,t,!1):n!=null&&zl(e,!!a,n,!0);return;case"textarea":qe("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(W(91));break;default:ot(e,t,i,o,n,null)}Db(e,a,r,l),Mu(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:ot(e,t,c,a,n,null)}return;case"dialog":qe("beforetoggle",e),qe("toggle",e),qe("cancel",e),qe("close",e);break;case"iframe":case"object":qe("load",e);break;case"video":case"audio":for(a=0;a<To.length;a++)qe(To[a],e);break;case"image":qe("error",e),qe("load",e);break;case"details":qe("toggle",e);break;case"embed":case"source":case"link":qe("error",e),qe("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(W(137,t));default:ot(e,t,d,a,n,null)}return;default:if(Bp(t)){for(f in n)n.hasOwnProperty(f)&&(a=n[f],a!==void 0&&Lm(e,t,f,a,n,void 0));return}}for(o in n)n.hasOwnProperty(o)&&(a=n[o],a!=null&&ot(e,t,o,a,n,null))}function UR(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 m=n[x];if(n.hasOwnProperty(x)&&m!=null)switch(x){case"checked":break;case"value":break;case"defaultValue":c=m;default:a.hasOwnProperty(x)||ot(e,t,x,null,a,m)}}for(var h in a){var x=a[h];if(m=n[h],a.hasOwnProperty(h)&&(x!=null||m!=null))switch(h){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(W(137,t));break;default:x!==m&&ot(e,t,h,x,a,m)}}im(e,i,o,c,d,f,l,r);return;case"select":x=i=o=h=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)||ot(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":h=l;break;case"defaultValue":o=l;break;case"multiple":i=l;default:l!==c&&ot(e,t,r,l,a,c)}t=o,n=i,a=x,h!=null?zl(e,!!n,h,!1):!!a!=!!n&&(t!=null?zl(e,!!n,t,!0):zl(e,!!n,n?[]:"",!1));return;case"textarea":x=h=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:ot(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":h=r;break;case"defaultValue":x=r;break;case"children":break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(W(91));break;default:r!==l&&ot(e,t,i,r,a,l)}Ob(e,h,x);return;case"option":for(var j in n)if(h=n[j],n.hasOwnProperty(j)&&h!=null&&!a.hasOwnProperty(j))switch(j){case"selected":e.selected=!1;break;default:ot(e,t,j,null,a,h)}for(c in a)if(h=a[c],x=n[c],a.hasOwnProperty(c)&&h!==x&&(h!=null||x!=null))switch(c){case"selected":e.selected=h&&typeof h!="function"&&typeof h!="symbol";break;default:ot(e,t,c,h,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)h=n[v],n.hasOwnProperty(v)&&h!=null&&!a.hasOwnProperty(v)&&ot(e,t,v,null,a,h);for(d in a)if(h=a[d],x=n[d],a.hasOwnProperty(d)&&h!==x&&(h!=null||x!=null))switch(d){case"children":case"dangerouslySetInnerHTML":if(h!=null)throw Error(W(137,t));break;default:ot(e,t,d,h,a,x)}return;default:if(Bp(t)){for(var y in n)h=n[y],n.hasOwnProperty(y)&&h!==void 0&&!a.hasOwnProperty(y)&&Lm(e,t,y,void 0,a,h);for(f in a)h=a[f],x=n[f],!a.hasOwnProperty(f)||h===x||h===void 0&&x===void 0||Lm(e,t,f,h,a,x);return}}for(var g in n)h=n[g],n.hasOwnProperty(g)&&h!=null&&!a.hasOwnProperty(g)&&ot(e,t,g,null,a,h);for(m in a)h=a[m],x=n[m],!a.hasOwnProperty(m)||h===x||h==null&&x==null||ot(e,t,m,h,a,x)}var Um=null,Bm=null;function Ju(e){return e.nodeType===9?e:e.ownerDocument}function aj(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 L0(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 Im(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 bh=null;function BR(){var e=window.event;return e&&e.type==="popstate"?e===bh?!1:(bh=e,!0):(bh=null,!1)}var U0=typeof setTimeout=="function"?setTimeout:void 0,IR=typeof clearTimeout=="function"?clearTimeout:void 0,rj=typeof Promise=="function"?Promise:void 0,HR=typeof queueMicrotask=="function"?queueMicrotask:typeof rj<"u"?function(e){return rj.resolve(null).then(e).catch(PR)}:U0;function PR(e){setTimeout(function(){throw e})}function dr(e){return e==="head"}function lj(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&&go(i.documentElement),n&2&&go(i.body),n&4)for(n=i.head,go(n),i=n.firstChild;i;){var o=i.nextSibling,c=i.nodeName;i[Jo]||c==="SCRIPT"||c==="STYLE"||c==="LINK"&&i.rel.toLowerCase()==="stylesheet"||n.removeChild(i),i=o}}if(r===0){e.removeChild(l),Do(t);return}r--}else n==="$"||n==="$?"||n==="$!"?r++:a=n.charCodeAt(0)-48;else a=0;n=l}while(n);Do(t)}function Hm(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":Hm(n),Up(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function qR(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[Jo])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=Ss(e.nextSibling),e===null)break}return null}function GR(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Ss(e.nextSibling),e===null))return null;return e}function Pm(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState==="complete"}function VR(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 Ss(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 qm=null;function ij(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 B0(e,t,n){switch(t=Ju(n),e){case"html":if(e=t.documentElement,!e)throw Error(W(452));return e;case"head":if(e=t.head,!e)throw Error(W(453));return e;case"body":if(e=t.body,!e)throw Error(W(454));return e;default:throw Error(W(451))}}function go(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Up(e)}var ys=new Map,oj=new Set;function ed(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var _a=tt.d;tt.d={f:YR,r:FR,D:KR,C:XR,L:WR,m:QR,X:JR,S:ZR,M:eT};function YR(){var e=_a.f(),t=Hd();return e||t}function FR(e){var t=di(e);t!==null&&t.tag===5&&t.type==="form"?$w(t):_a.r(e)}var mi=typeof document>"u"?null:document;function I0(e,t,n){var a=mi;if(a&&typeof t=="string"&&t){var r=us(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof n=="string"&&(r+='[crossorigin="'+n+'"]'),oj.has(r)||(oj.add(r),e={rel:e,crossOrigin:n,href:t},a.querySelector(r)===null&&(t=a.createElement("link"),nn(t,"link",e),Kt(t),a.head.appendChild(t)))}}function KR(e){_a.D(e),I0("dns-prefetch",e,null)}function XR(e,t){_a.C(e,t),I0("preconnect",e,t)}function WR(e,t,n){_a.L(e,t,n);var a=mi;if(a&&e&&t){var r='link[rel="preload"][as="'+us(t)+'"]';t==="image"&&n&&n.imageSrcSet?(r+='[imagesrcset="'+us(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(r+='[imagesizes="'+us(n.imageSizes)+'"]')):r+='[href="'+us(e)+'"]';var l=r;switch(t){case"style":l=ai(e);break;case"script":l=pi(e)}ys.has(l)||(e=vt({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),ys.set(l,e),a.querySelector(r)!==null||t==="style"&&a.querySelector(cc(l))||t==="script"&&a.querySelector(uc(l))||(t=a.createElement("link"),nn(t,"link",e),Kt(t),a.head.appendChild(t)))}}function QR(e,t){_a.m(e,t);var n=mi;if(n&&e){var a=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+us(a)+'"][href="'+us(e)+'"]',l=r;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":l=pi(e)}if(!ys.has(l)&&(e=vt({rel:"modulepreload",href:e},t),ys.set(l,e),n.querySelector(r)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(uc(l)))return}a=n.createElement("link"),nn(a,"link",e),Kt(a),n.head.appendChild(a)}}}function ZR(e,t,n){_a.S(e,t,n);var a=mi;if(a&&e){var r=Dl(a).hoistableStyles,l=ai(e);t=t||"default";var i=r.get(l);if(!i){var o={loading:0,preload:null};if(i=a.querySelector(cc(l)))o.loading=5;else{e=vt({rel:"stylesheet",href:e,"data-precedence":t},n),(n=ys.get(l))&&bx(e,n);var c=i=a.createElement("link");Kt(c),nn(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,xu(i,t,a)}i={type:"stylesheet",instance:i,count:1,state:o},r.set(l,i)}}}function JR(e,t){_a.X(e,t);var n=mi;if(n&&e){var a=Dl(n).hoistableScripts,r=pi(e),l=a.get(r);l||(l=n.querySelector(uc(r)),l||(e=vt({src:e,async:!0},t),(t=ys.get(r))&&wx(e,t),l=n.createElement("script"),Kt(l),nn(l,"link",e),n.head.appendChild(l)),l={type:"script",instance:l,count:1,state:null},a.set(r,l))}}function eT(e,t){_a.M(e,t);var n=mi;if(n&&e){var a=Dl(n).hoistableScripts,r=pi(e),l=a.get(r);l||(l=n.querySelector(uc(r)),l||(e=vt({src:e,async:!0,type:"module"},t),(t=ys.get(r))&&wx(e,t),l=n.createElement("script"),Kt(l),nn(l,"link",e),n.head.appendChild(l)),l={type:"script",instance:l,count:1,state:null},a.set(r,l))}}function cj(e,t,n,a){var r=(r=Ya.current)?ed(r):null;if(!r)throw Error(W(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=ai(n.href),n=Dl(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=ai(n.href);var l=Dl(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(cc(e)))&&!l._p&&(i.instance=l,i.state.loading=5),ys.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},ys.set(e,n),l||tT(r,e,n,i.state))),t&&a===null)throw Error(W(528,""));return i}if(t&&a!==null)throw Error(W(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=pi(n),n=Dl(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(W(444,e))}}function ai(e){return'href="'+us(e)+'"'}function cc(e){return'link[rel="stylesheet"]['+e+"]"}function H0(e){return vt({},e,{"data-precedence":e.precedence,precedence:null})}function tT(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}),nn(t,"link",n),Kt(t),e.head.appendChild(t))}function pi(e){return'[src="'+us(e)+'"]'}function uc(e){return"script[async]"+e}function uj(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var a=e.querySelector('style[data-href~="'+us(n.href)+'"]');if(a)return t.instance=a,Kt(a),a;var r=vt({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),Kt(a),nn(a,"style",r),xu(a,n.precedence,e),t.instance=a;case"stylesheet":r=ai(n.href);var l=e.querySelector(cc(r));if(l)return t.state.loading|=4,t.instance=l,Kt(l),l;a=H0(n),(r=ys.get(r))&&bx(a,r),l=(e.ownerDocument||e).createElement("link"),Kt(l);var i=l;return i._p=new Promise(function(o,c){i.onload=o,i.onerror=c}),nn(l,"link",a),t.state.loading|=4,xu(l,n.precedence,e),t.instance=l;case"script":return l=pi(n.src),(r=e.querySelector(uc(l)))?(t.instance=r,Kt(r),r):(a=n,(r=ys.get(l))&&(a=vt({},n),wx(a,r)),e=e.ownerDocument||e,r=e.createElement("script"),Kt(r),nn(r,"link",a),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(W(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(a=t.instance,t.state.loading|=4,xu(a,n.precedence,e));return t.instance}function xu(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 bx(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function wx(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var gu=null;function dj(e,t,n){if(gu===null){var a=new Map,r=gu=new Map;r.set(n,a)}else r=gu,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[Jo]||l[on]||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 fj(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function nT(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 P0(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}var Ao=null;function sT(){}function aT(e,t,n){if(Ao===null)throw Error(W(475));var a=Ao;if(t.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&!(t.state.loading&4)){if(t.instance===null){var r=ai(n.href),l=e.querySelector(cc(r));if(l){e=l._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(a.count++,a=td.bind(a),e.then(a,a)),t.state.loading|=4,t.instance=l,Kt(l);return}l=e.ownerDocument||e,n=H0(n),(r=ys.get(r))&&bx(n,r),l=l.createElement("link"),Kt(l);var i=l;i._p=new Promise(function(o,c){i.onload=o,i.onerror=c}),nn(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=td.bind(a),e.addEventListener("load",t),e.addEventListener("error",t))}}function rT(){if(Ao===null)throw Error(W(475));var e=Ao;return e.stylesheets&&e.count===0&&Gm(e,e.stylesheets),0<e.count?function(t){var n=setTimeout(function(){if(e.stylesheets&&Gm(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 td(){if(this.count--,this.count===0){if(this.stylesheets)Gm(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var nd=null;function Gm(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,nd=new Map,t.forEach(lT,e),nd=null,td.call(e))}function lT(e,t){if(!(t.state.loading&4)){var n=nd.get(e);if(n)var a=n.get(null);else{n=new Map,nd.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=td.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 $o={$$typeof:ua,Provider:null,Consumer:null,_currentValue:Sr,_currentValue2:Sr,_threadCount:0};function iT(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=qf(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qf(0),this.hiddenUpdates=qf(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 q0(e,t,n,a,r,l,i,o,c,d,f,m){return e=new iT(e,t,n,i,o,c,d,m),t=1,l===!0&&(t|=24),l=Xn(3,null,null,t),e.current=l,l.stateNode=e,t=Wp(),t.refCount++,e.pooledCache=t,t.refCount++,l.memoizedState={element:a,isDehydrated:n,cache:t},Zp(l),e}function G0(e){return e?(e=Rl,e):Rl}function V0(e,t,n,a,r,l){r=G0(r),a.context===null?a.context=r:a.pendingContext=r,a=Fa(t),a.payload={element:n},l=l===void 0?null:l,l!==null&&(a.callback=l),n=Ka(e,a,t),n!==null&&(Jn(n,e,t),oo(n,e,t))}function hj(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function _x(e,t){hj(e,t),(e=e.alternate)&&hj(e,t)}function Y0(e){if(e.tag===13){var t=fi(e,67108864);t!==null&&Jn(t,e,67108864),_x(e,67108864)}}var sd=!0;function oT(e,t,n,a){var r=Me.T;Me.T=null;var l=tt.p;try{tt.p=2,Nx(e,t,n,a)}finally{tt.p=l,Me.T=r}}function cT(e,t,n,a){var r=Me.T;Me.T=null;var l=tt.p;try{tt.p=8,Nx(e,t,n,a)}finally{tt.p=l,Me.T=r}}function Nx(e,t,n,a){if(sd){var r=Vm(a);if(r===null)yh(e,t,a,ad,n),mj(e,a);else if(dT(r,e,t,n,a))a.stopPropagation();else if(mj(e,a),t&4&&-1<uT.indexOf(e)){for(;r!==null;){var l=di(r);if(l!==null)switch(l.tag){case 3:if(l=l.stateNode,l.current.memoizedState.isDehydrated){var i=wr(l.pendingLanes);if(i!==0){var o=l;for(o.pendingLanes|=2,o.entangledLanes|=2;i;){var c=1<<31-Qn(i);o.entanglements[1]|=c,i&=~c}Zs(l),!(lt&6)&&(Ku=Gs()+500,oc(0))}}break;case 13:o=fi(l,2),o!==null&&Jn(o,l,2),Hd(),_x(l,2)}if(l=Vm(a),l===null&&yh(e,t,a,ad,n),l===r)break;r=l}r!==null&&a.stopPropagation()}else yh(e,t,a,null,n)}}function Vm(e){return e=Ip(e),kx(e)}var ad=null;function kx(e){if(ad=null,e=wl(e),e!==null){var t=Xo(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=gb(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 ad=e,null}function F0(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(X2()){case bb:return 2;case wb:return 8;case $u:case W2:return 32;case _b:return 268435456;default:return 32}default:return 32}}var Ym=!1,Qa=null,Za=null,Ja=null,Mo=new Map,Oo=new Map,La=[],uT="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 mj(e,t){switch(e){case"focusin":case"focusout":Qa=null;break;case"dragenter":case"dragleave":Za=null;break;case"mouseover":case"mouseout":Ja=null;break;case"pointerover":case"pointerout":Mo.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Oo.delete(t.pointerId)}}function Hi(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=di(t),t!==null&&Y0(t)),e):(e.eventSystemFlags|=a,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function dT(e,t,n,a,r){switch(t){case"focusin":return Qa=Hi(Qa,e,t,n,a,r),!0;case"dragenter":return Za=Hi(Za,e,t,n,a,r),!0;case"mouseover":return Ja=Hi(Ja,e,t,n,a,r),!0;case"pointerover":var l=r.pointerId;return Mo.set(l,Hi(Mo.get(l)||null,e,t,n,a,r)),!0;case"gotpointercapture":return l=r.pointerId,Oo.set(l,Hi(Oo.get(l)||null,e,t,n,a,r)),!0}return!1}function K0(e){var t=wl(e.target);if(t!==null){var n=Xo(t);if(n!==null){if(t=n.tag,t===13){if(t=gb(n),t!==null){e.blockedOn=t,aC(e.priority,function(){if(n.tag===13){var a=Zn();a=zp(a);var r=fi(n,a);r!==null&&Jn(r,n,a),_x(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 vu(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Vm(e.nativeEvent);if(n===null){n=e.nativeEvent;var a=new n.constructor(n.type,n);cm=a,n.target.dispatchEvent(a),cm=null}else return t=di(n),t!==null&&Y0(t),e.blockedOn=n,!1;t.shift()}return!0}function pj(e,t,n){vu(e)&&n.delete(t)}function fT(){Ym=!1,Qa!==null&&vu(Qa)&&(Qa=null),Za!==null&&vu(Za)&&(Za=null),Ja!==null&&vu(Ja)&&(Ja=null),Mo.forEach(pj),Oo.forEach(pj)}function Bc(e,t){e.blockedOn===t&&(e.blockedOn=null,Ym||(Ym=!0,Gt.unstable_scheduleCallback(Gt.unstable_NormalPriority,fT)))}var Ic=null;function xj(e){Ic!==e&&(Ic=e,Gt.unstable_scheduleCallback(Gt.unstable_NormalPriority,function(){Ic===e&&(Ic=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(kx(a||n)===null)continue;break}var l=di(n);l!==null&&(e.splice(t,3),t-=3,km(l,{pending:!0,data:r,method:n.method,action:a},a,r))}}))}function Do(e){function t(c){return Bc(c,e)}Qa!==null&&Bc(Qa,e),Za!==null&&Bc(Za,e),Ja!==null&&Bc(Ja,e),Mo.forEach(t),Oo.forEach(t);for(var n=0;n<La.length;n++){var a=La[n];a.blockedOn===e&&(a.blockedOn=null)}for(;0<La.length&&(n=La[0],n.blockedOn===null);)K0(n),n.blockedOn===null&&La.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[Ln]||null;if(typeof l=="function")i||xj(n);else if(i){var o=null;if(l&&l.hasAttribute("formAction")){if(r=l,i=l[Ln]||null)o=i.formAction;else if(kx(r)!==null)continue}else o=i.action;typeof o=="function"?n[a+1]=o:(n.splice(a,3),a-=3),xj(n)}}}function Sx(e){this._internalRoot=e}Vd.prototype.render=Sx.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(W(409));var n=t.current,a=Zn();V0(n,a,e,t,null,null)};Vd.prototype.unmount=Sx.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;V0(e.current,2,null,e,null,null),Hd(),t[ui]=null}};function Vd(e){this._internalRoot=e}Vd.prototype.unstable_scheduleHydration=function(e){if(e){var t=Rb();e={blockedOn:null,target:e,priority:t};for(var n=0;n<La.length&&t!==0&&t<La[n].priority;n++);La.splice(n,0,e),n===0&&K0(e)}};var gj=pb.version;if(gj!=="19.1.0")throw Error(W(527,gj,"19.1.0"));tt.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(W(188)):(e=Object.keys(e).join(","),Error(W(268,e)));return e=P2(t),e=e!==null?vb(e):null,e=e===null?null:e.stateNode,e};var hT={bundleType:0,version:"19.1.0",rendererPackageName:"react-dom",currentDispatcherRef:Me,reconcilerVersion:"19.1.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Hc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Hc.isDisabled&&Hc.supportsFiber)try{Wo=Hc.inject(hT),Wn=Hc}catch{}}Td.createRoot=function(e,t){if(!xb(e))throw Error(W(299));var n=!1,a="",r=qw,l=Gw,i=Vw,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=q0(e,1,!1,null,null,n,a,r,l,i,o,null),e[ui]=t.current,yx(e),new Sx(t)};Td.hydrateRoot=function(e,t,n){if(!xb(e))throw Error(W(299));var a=!1,r="",l=qw,i=Gw,o=Vw,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=q0(e,1,!0,t,n??null,a,r,l,i,o,c,d),t.context=G0(null),n=t.current,a=Zn(),a=zp(a),r=Fa(a),r.callback=null,Ka(n,r,a),n=a,t.current.lanes=n,Zo(t,n),Zs(t),e[ui]=t.current,yx(e),new Vd(t)};Td.version="19.1.0";function X0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(X0)}catch(e){console.error(e)}}X0(),cb.exports=Td;var mT=cb.exports;const W0=u.createContext(null);function Q0({data:e,router:t,identity:n,notify:a,children:r}){return s.jsx(W0.Provider,{value:{data:e,router:t,identity:n,notify:a},children:r})}function Yd(){const e=u.useContext(W0);if(!e)throw new Error("A shared app page rendered outside AppUiProvider.");return e}const pT={success:()=>{},error:()=>{}},yn=()=>Yd().data,Ze=()=>Yd().router,Fd=()=>Yd().identity,Qr=()=>Yd().notify??pT;function xT(){const{probe:e}=yn(),{href:t,Link:n}=Ze(),a=Fd(),[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 gT=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),vT=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,a)=>a?a.toUpperCase():n.toLowerCase()),vj=e=>{const t=vT(e);return t.charAt(0).toUpperCase()+t.slice(1)},Z0=(...e)=>e.filter((t,n,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===n).join(" ").trim(),jT=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 yT={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 bT=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,...yT,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:Z0("lucide",r),...!l&&!jT(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 Re=(e,t)=>{const n=u.forwardRef(({className:a,...r},l)=>u.createElement(bT,{ref:l,iconNode:t,className:Z0(`lucide-${gT(vj(e))}`,`lucide-${e}`,a),...r}));return n.displayName=vj(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 wT=[["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"}]],_T=Re("archive-restore",wT);/**
|
|
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 NT=[["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"}]],jj=Re("archive",NT);/**
|
|
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 kT=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],ST=Re("arrow-down",kT);/**
|
|
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 CT=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],J0=Re("arrow-left",CT);/**
|
|
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 RT=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],TT=Re("arrow-up",RT);/**
|
|
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 ET=[["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"}]],Cx=Re("bot",ET);/**
|
|
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 AT=[["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"}]],$T=Re("briefcase",AT);/**
|
|
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 MT=[["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"}]],OT=Re("building-2",MT);/**
|
|
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 DT=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Zr=Re("check",DT);/**
|
|
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 zT=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Kd=Re("chevron-down",zT);/**
|
|
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 LT=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],dc=Re("chevron-right",LT);/**
|
|
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 UT=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],BT=Re("chevron-up",UT);/**
|
|
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 IT=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],e_=Re("chevrons-up-down",IT);/**
|
|
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 HT=[["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"}]],nt=Re("circle-alert",HT);/**
|
|
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 PT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Xd=Re("circle-check",PT);/**
|
|
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 qT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],GT=Re("circle",qT);/**
|
|
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 VT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],YT=Re("clock",VT);/**
|
|
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 FT=[["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"}]],t_=Re("copy",FT);/**
|
|
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 KT=[["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"}]],Rx=Re("ellipsis",KT);/**
|
|
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 XT=[["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"}]],WT=Re("eraser",XT);/**
|
|
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 QT=[["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"}]],fc=Re("eye",QT);/**
|
|
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 ZT=[["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"}]],n_=Re("folder-git-2",ZT);/**
|
|
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 JT=[["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"}]],eE=Re("folder-git",JT);/**
|
|
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 tE=[["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"}]],nE=Re("git-fork",tE);/**
|
|
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 sE=[["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"}]],Fm=Re("git-pull-request-arrow",sE);/**
|
|
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 aE=[["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"}]],rE=Re("hard-drive",aE);/**
|
|
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 lE=[["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"}]],iE=Re("history",lE);/**
|
|
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 oE=[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]],cE=Re("hourglass",oE);/**
|
|
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 uE=[["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"}]],dE=Re("house",uE);/**
|
|
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 fE=[["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"}]],hE=Re("inbox",fE);/**
|
|
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 mE=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],gn=Re("info",mE);/**
|
|
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 pE=[["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"}]],xE=Re("laptop",pE);/**
|
|
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 gE=[["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"}]],vE=Re("life-buoy",gE);/**
|
|
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 jE=[["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"}]],s_=Re("list-checks",jE);/**
|
|
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 yE=[["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"}]],a_=Re("list-ordered",yE);/**
|
|
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 bE=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],wE=Re("loader-circle",bE);/**
|
|
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 _E=[["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"}]],NE=Re("lock",_E);/**
|
|
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 kE=[["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"}]],rd=Re("messages-square",kE);/**
|
|
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 SE=[["path",{d:"M5 12h14",key:"1ays0h"}]],CE=Re("minus",SE);/**
|
|
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 RE=[["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"}]],TE=Re("network",RE);/**
|
|
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 EE=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],AE=Re("panel-left",EE);/**
|
|
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 $E=[["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"}]],r_=Re("pause",$E);/**
|
|
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 ME=[["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"}]],Wd=Re("pencil",ME);/**
|
|
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 OE=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],DE=Re("play",OE);/**
|
|
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 zE=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],rr=Re("plus",zE);/**
|
|
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 LE=[["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=Re("refresh-cw",LE);/**
|
|
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 UE=[["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"}]],BE=Re("rotate-ccw",UE);/**
|
|
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 IE=[["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"}]],Qd=Re("search-x",IE);/**
|
|
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 HE=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],PE=Re("search",HE);/**
|
|
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 qE=[["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"}]],GE=Re("shield-alert",qE);/**
|
|
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 VE=[["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"}]],YE=Re("snowflake",VE);/**
|
|
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 FE=[["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"}]],ld=Re("tag",FE);/**
|
|
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 KE=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ut=Re("triangle-alert",KE);/**
|
|
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 XE=[["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"}]],WE=Re("user-check",XE);/**
|
|
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 QE=[["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"}]],ZE=Re("user-cog",QE);/**
|
|
345
|
+
* @license lucide-react v0.511.0 - ISC
|
|
346
|
+
*
|
|
347
|
+
* This source code is licensed under the ISC license.
|
|
348
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
349
|
+
*/const JE=[["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"}]],Tx=Re("user",JE);/**
|
|
350
|
+
* @license lucide-react v0.511.0 - ISC
|
|
351
|
+
*
|
|
352
|
+
* This source code is licensed under the ISC license.
|
|
353
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
354
|
+
*/const eA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Zd=Re("x",eA),tA="Local only · this machine · not connected to SoftwareDLC",nA="Checking sync state…",sA="Sync state unknown",aA="Projects are the repositories this viewer reads on this machine. Nothing is shared unless you connect to SoftwareDLC.",Hr="Details are in the terminal running sdlc viewer.",rA="How to fix it is in the terminal running sdlc viewer.",Jd="Loading…",id="Not available";function lA(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 Wi(e){return(typeof e=="string"?new Date(e):e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})}const iA={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 l_(e,t){const n=t?` this list was read at ${Wi(t)}.`:"";if(e.reason==="store_locked"){const a=e.store?iA[e.store]:"a local store",r=e.since?` since ${Wi(e.since)}`:"";return`Another sdlc command has held ${a}${r};${n||" nothing was read yet."} ${Hr}`}return e.status===0?`The viewer did not answer. Is sdlc viewer still running?${t?` This list was read at ${Wi(t)}.`:""}`:`The read failed.${t?` This list was read at ${Wi(t)}.`:""} ${Hr}`}const oA=e=>e.status===409,cA={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 uA(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?cA[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 yj=["tasks","issues","releases"],Ex=u.createContext(null);function ss(){const e=u.useContext(Ex);if(!e)throw new Error("A shell page rendered outside the app shell.");return e}function dA(){var e;return(e=u.useContext(Ex))==null?void 0:e.engine}const fA=10,hA=()=>new Date;function mA({shell:e,now:t=hA,children:n}){var U;const[a,r]=u.useState(null),[l,i]=u.useState(null),[o,c]=u.useState(null),[d,f]=u.useState(null),[m,h]=u.useState(null),[x,j]=u.useState(!0),[v,y]=u.useState(!1),[g,p]=u.useState(void 0),[b,w]=u.useState(!1),[S,C]=u.useState(yj),_=u.useRef(!1),N=u.useRef(!1),O=u.useRef(null),D=u.useRef(!0),B=u.useCallback(async(R=!1)=>{O.current&&clearTimeout(O.current),O.current=null,y(!0);const[$,T]=await Promise.all([e.organizations.list(),e.projects.list()]);if(!D.current)return;if(y(!1),j(!1),$.ok&&T.ok){if(_.current=!0,N.current=!1,h(null),f(t()),$.data.organizations.length===0){c("not_in_git"),r(null),i(null);return}c(null),r($.data.organizations[0]),i(T.data.projects);return}const E=$.ok?T.ok?null:T.refusal:$.refusal;if(!E)return;if(oA(E)){N.current=!1,h(null),c(E),r(null),i(null);return}const k=_.current&&!N.current&&!R;N.current=!0;const M=E.retry_after??fA;h({refusal:E,shown:!k,retryInSeconds:k?M:null}),k&&(O.current=setTimeout(()=>void B(!0),M*1e3))},[e,t]);u.useEffect(()=>(D.current=!0,B(),e.about.about().then(R=>{D.current&&(R.ok?p(R.data):R.refusal.status===404?p(null):w(!0))}),Promise.all(yj.map(async R=>{var $;return[R,await(($=e[R])==null?void 0:$.access())]})).then(R=>{D.current&&C(R.filter(([,$])=>!($!=null&&$.ok&&!$.data.can_view)).map(([$])=>$))}),()=>{D.current=!1,O.current&&clearTimeout(O.current)}),[e,B]);const G={loading:x,org:a,projects:l,none:o,readAt:d,failure:m,about:g,aboutFailed:b,engine:(g==null?void 0:g.engine)===null?null:(U=g==null?void 0:g.engine)==null?void 0:U.source,domains:S,reading:v,refresh:()=>void B()};return s.jsx(Ex.Provider,{value:G,children:n})}const i_=e=>`The ${e} page is not part of this sdlc install`,el="The sdlc engine here is too old for this page";function pA(e){return e==="checkout"?"Update the main checkout, then restart sdlc viewer.":"Update sdlc to its latest version, then restart sdlc viewer."}function as(){return pA(dA())}function o_(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=o_(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function c_(){for(var e,t,n=0,a="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=o_(e))&&(a&&(a+=" "),a+=t);return a}const bj=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,wj=c_,hc=(e,t)=>n=>{var a;if((t==null?void 0:t.variants)==null)return wj(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],m=l==null?void 0:l[d];if(f===null)return null;const h=bj(f)||bj(m);return r[d][h]}),o=n&&Object.entries(n).reduce((d,f)=>{let[m,h]=f;return h===void 0||(d[m]=h),d},{}),c=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((d,f)=>{let{class:m,className:h,...x}=f;return Object.entries(x).every(j=>{let[v,y]=j;return Array.isArray(y)?y.includes({...l,...o}[v]):{...l,...o}[v]===y})?[...d,m,h]:d},[]);return wj(e,i,c,n==null?void 0:n.class,n==null?void 0:n.className)},Ax="-",xA=e=>{const t=vA(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:i=>{const o=i.split(Ax);return o[0]===""&&o.length!==1&&o.shift(),u_(o,t)||gA(i)},getConflictingClassGroupIds:(i,o)=>{const c=n[i]||[];return o&&a[i]?[...c,...a[i]]:c}}},u_=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],a=t.nextPart.get(n),r=a?u_(e.slice(1),a):void 0;if(r)return r;if(t.validators.length===0)return;const l=e.join(Ax);return(i=t.validators.find(({validator:o})=>o(l)))==null?void 0:i.classGroupId},_j=/^\[(.+)\]$/,gA=e=>{if(_j.test(e)){const t=_j.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},vA=e=>{const{theme:t,classGroups:n}=e,a={nextPart:new Map,validators:[]};for(const r in n)Km(n[r],a,r,t);return a},Km=(e,t,n,a)=>{e.forEach(r=>{if(typeof r=="string"){const l=r===""?t:Nj(t,r);l.classGroupId=n;return}if(typeof r=="function"){if(jA(r)){Km(r(a),t,n,a);return}t.validators.push({validator:r,classGroupId:n});return}Object.entries(r).forEach(([l,i])=>{Km(i,Nj(t,l),n,a)})})},Nj=(e,t)=>{let n=e;return t.split(Ax).forEach(a=>{n.nextPart.has(a)||n.nextPart.set(a,{nextPart:new Map,validators:[]}),n=n.nextPart.get(a)}),n},jA=e=>e.isThemeGetter,yA=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)}}},Xm="!",Wm=":",bA=Wm.length,wA=e=>{const{prefix:t,experimentalParseClassName:n}=e;let a=r=>{const l=[];let i=0,o=0,c=0,d;for(let j=0;j<r.length;j++){let v=r[j];if(i===0&&o===0){if(v===Wm){l.push(r.slice(c,j)),c=j+bA;continue}if(v==="/"){d=j;continue}}v==="["?i++:v==="]"?i--:v==="("?o++:v===")"&&o--}const f=l.length===0?r:r.substring(c),m=_A(f),h=m!==f,x=d&&d>c?d-c:void 0;return{modifiers:l,hasImportantModifier:h,baseClassName:m,maybePostfixModifierPosition:x}};if(t){const r=t+Wm,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},_A=e=>e.endsWith(Xm)?e.substring(0,e.length-1):e.startsWith(Xm)?e.substring(1):e,NA=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}},kA=e=>({cache:yA(e.cacheSize),parseClassName:wA(e),sortModifiers:NA(e),...xA(e)}),SA=/\s+/,CA=(e,t)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:r,sortModifiers:l}=t,i=[],o=e.trim().split(SA);let c="";for(let d=o.length-1;d>=0;d-=1){const f=o[d],{isExternal:m,modifiers:h,hasImportantModifier:x,baseClassName:j,maybePostfixModifierPosition:v}=n(f);if(m){c=f+(c.length>0?" "+c:c);continue}let y=!!v,g=a(y?j.substring(0,v):j);if(!g){if(!y){c=f+(c.length>0?" "+c:c);continue}if(g=a(j),!g){c=f+(c.length>0?" "+c:c);continue}y=!1}const p=l(h).join(":"),b=x?p+Xm:p,w=b+g;if(i.includes(w))continue;i.push(w);const S=r(g,y);for(let C=0;C<S.length;++C){const _=S[C];i.push(b+_)}c=f+(c.length>0?" "+c:c)}return c};function RA(){let e=0,t,n,a="";for(;e<arguments.length;)(t=arguments[e++])&&(n=d_(t))&&(a&&(a+=" "),a+=n);return a}const d_=e=>{if(typeof e=="string")return e;let t,n="";for(let a=0;a<e.length;a++)e[a]&&(t=d_(e[a]))&&(n&&(n+=" "),n+=t);return n};function TA(e,...t){let n,a,r,l=i;function i(c){const d=t.reduce((f,m)=>m(f),e());return n=kA(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=CA(c,n);return r(c,f),f}return function(){return l(RA.apply(null,arguments))}}const Ht=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},f_=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,h_=/^\((?:(\w[\w-]*):)?(.+)\)$/i,EA=/^\d+\/\d+$/,AA=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,$A=/\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$/,MA=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,OA=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,DA=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,il=e=>EA.test(e),Ie=e=>!!e&&!Number.isNaN(Number(e)),Ca=e=>!!e&&Number.isInteger(Number(e)),wh=e=>e.endsWith("%")&&Ie(e.slice(0,-1)),la=e=>AA.test(e),zA=()=>!0,LA=e=>$A.test(e)&&!MA.test(e),m_=()=>!1,UA=e=>OA.test(e),BA=e=>DA.test(e),IA=e=>!_e(e)&&!Ne(e),HA=e=>xi(e,g_,m_),_e=e=>f_.test(e),br=e=>xi(e,v_,LA),_h=e=>xi(e,YA,Ie),kj=e=>xi(e,p_,m_),PA=e=>xi(e,x_,BA),Pc=e=>xi(e,j_,UA),Ne=e=>h_.test(e),Pi=e=>gi(e,v_),qA=e=>gi(e,FA),Sj=e=>gi(e,p_),GA=e=>gi(e,g_),VA=e=>gi(e,x_),qc=e=>gi(e,j_,!0),xi=(e,t,n)=>{const a=f_.exec(e);return a?a[1]?t(a[1]):n(a[2]):!1},gi=(e,t,n=!1)=>{const a=h_.exec(e);return a?a[1]?t(a[1]):n:!1},p_=e=>e==="position"||e==="percentage",x_=e=>e==="image"||e==="url",g_=e=>e==="length"||e==="size"||e==="bg-size",v_=e=>e==="length",YA=e=>e==="number",FA=e=>e==="family-name",j_=e=>e==="shadow",KA=()=>{const e=Ht("color"),t=Ht("font"),n=Ht("text"),a=Ht("font-weight"),r=Ht("tracking"),l=Ht("leading"),i=Ht("breakpoint"),o=Ht("container"),c=Ht("spacing"),d=Ht("radius"),f=Ht("shadow"),m=Ht("inset-shadow"),h=Ht("text-shadow"),x=Ht("drop-shadow"),j=Ht("blur"),v=Ht("perspective"),y=Ht("aspect"),g=Ht("ease"),p=Ht("animate"),b=()=>["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"],S=()=>[...w(),Ne,_e],C=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto","contain","none"],N=()=>[Ne,_e,c],O=()=>[il,"full","auto",...N()],D=()=>[Ca,"none","subgrid",Ne,_e],B=()=>["auto",{span:["full",Ca,Ne,_e]},Ca,Ne,_e],G=()=>[Ca,"auto",Ne,_e],U=()=>["auto","min","max","fr",Ne,_e],R=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],$=()=>["start","end","center","stretch","center-safe","end-safe"],T=()=>["auto",...N()],E=()=>[il,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...N()],k=()=>[e,Ne,_e],M=()=>[...w(),Sj,kj,{position:[Ne,_e]}],Y=()=>["no-repeat",{repeat:["","x","y","space","round"]}],A=()=>["auto","cover","contain",GA,HA,{size:[Ne,_e]}],I=()=>[wh,Pi,br],X=()=>["","none","full",d,Ne,_e],J=()=>["",Ie,Pi,br],ae=()=>["solid","dashed","dotted","double"],ke=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Q=()=>[Ie,wh,Sj,kj],ee=()=>["","none",j,Ne,_e],Ce=()=>["none",Ie,Ne,_e],se=()=>["none",Ie,Ne,_e],Se=()=>[Ie,Ne,_e],me=()=>[il,"full",...N()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[la],breakpoint:[la],color:[zA],container:[la],"drop-shadow":[la],ease:["in","out","in-out"],font:[IA],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[la],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[la],shadow:[la],spacing:["px",Ie],text:[la],"text-shadow":[la],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",il,_e,Ne,y]}],container:["container"],columns:[{columns:[Ie,_e,Ne,o]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"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:S()}],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:O()}],"inset-x":[{"inset-x":O()}],"inset-y":[{"inset-y":O()}],start:[{start:O()}],end:[{end:O()}],top:[{top:O()}],right:[{right:O()}],bottom:[{bottom:O()}],left:[{left:O()}],visibility:["visible","invisible","collapse"],z:[{z:[Ca,"auto",Ne,_e]}],basis:[{basis:[il,"full","auto",o,...N()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ie,il,"auto","initial","none",_e]}],grow:[{grow:["",Ie,Ne,_e]}],shrink:[{shrink:["",Ie,Ne,_e]}],order:[{order:[Ca,"first","last","none",Ne,_e]}],"grid-cols":[{"grid-cols":D()}],"col-start-end":[{col:B()}],"col-start":[{"col-start":G()}],"col-end":[{"col-end":G()}],"grid-rows":[{"grid-rows":D()}],"row-start-end":[{row:B()}],"row-start":[{"row-start":G()}],"row-end":[{"row-end":G()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":U()}],"auto-rows":[{"auto-rows":U()}],gap:[{gap:N()}],"gap-x":[{"gap-x":N()}],"gap-y":[{"gap-y":N()}],"justify-content":[{justify:[...R(),"normal"]}],"justify-items":[{"justify-items":[...$(),"normal"]}],"justify-self":[{"justify-self":["auto",...$()]}],"align-content":[{content:["normal",...R()]}],"align-items":[{items:[...$(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...$(),{baseline:["","last"]}]}],"place-content":[{"place-content":R()}],"place-items":[{"place-items":[...$(),"baseline"]}],"place-self":[{"place-self":["auto",...$()]}],p:[{p:N()}],px:[{px:N()}],py:[{py:N()}],ps:[{ps:N()}],pe:[{pe:N()}],pt:[{pt:N()}],pr:[{pr:N()}],pb:[{pb:N()}],pl:[{pl:N()}],m:[{m:T()}],mx:[{mx:T()}],my:[{my:T()}],ms:[{ms:T()}],me:[{me:T()}],mt:[{mt:T()}],mr:[{mr:T()}],mb:[{mb:T()}],ml:[{ml:T()}],"space-x":[{"space-x":N()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":N()}],"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,Pi,br]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,Ne,_h]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",wh,_e]}],"font-family":[{font:[qA,_e,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,Ne,_e]}],"line-clamp":[{"line-clamp":[Ie,"none",Ne,_h]}],leading:[{leading:[l,...N()]}],"list-image":[{"list-image":["none",Ne,_e]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ne,_e]}],"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:[...ae(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ie,"from-font","auto",Ne,br]}],"text-decoration-color":[{decoration:k()}],"underline-offset":[{"underline-offset":[Ie,"auto",Ne,_e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:N()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ne,_e]}],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",Ne,_e]}],"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:Y()}],"bg-size":[{bg:A()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ca,Ne,_e],radial:["",Ne,_e],conic:[Ca,Ne,_e]},VA,PA]}],"bg-color":[{bg:k()}],"gradient-from-pos":[{from:I()}],"gradient-via-pos":[{via:I()}],"gradient-to-pos":[{to:I()}],"gradient-from":[{from:k()}],"gradient-via":[{via:k()}],"gradient-to":[{to:k()}],rounded:[{rounded:X()}],"rounded-s":[{"rounded-s":X()}],"rounded-e":[{"rounded-e":X()}],"rounded-t":[{"rounded-t":X()}],"rounded-r":[{"rounded-r":X()}],"rounded-b":[{"rounded-b":X()}],"rounded-l":[{"rounded-l":X()}],"rounded-ss":[{"rounded-ss":X()}],"rounded-se":[{"rounded-se":X()}],"rounded-ee":[{"rounded-ee":X()}],"rounded-es":[{"rounded-es":X()}],"rounded-tl":[{"rounded-tl":X()}],"rounded-tr":[{"rounded-tr":X()}],"rounded-br":[{"rounded-br":X()}],"rounded-bl":[{"rounded-bl":X()}],"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:[...ae(),"hidden","none"]}],"divide-style":[{divide:[...ae(),"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:[...ae(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ie,Ne,_e]}],"outline-w":[{outline:["",Ie,Pi,br]}],"outline-color":[{outline:k()}],shadow:[{shadow:["","none",f,qc,Pc]}],"shadow-color":[{shadow:k()}],"inset-shadow":[{"inset-shadow":["none",m,qc,Pc]}],"inset-shadow-color":[{"inset-shadow":k()}],"ring-w":[{ring:J()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:k()}],"ring-offset-w":[{"ring-offset":[Ie,br]}],"ring-offset-color":[{"ring-offset":k()}],"inset-ring-w":[{"inset-ring":J()}],"inset-ring-color":[{"inset-ring":k()}],"text-shadow":[{"text-shadow":["none",h,qc,Pc]}],"text-shadow-color":[{"text-shadow":k()}],opacity:[{opacity:[Ie,Ne,_e]}],"mix-blend":[{"mix-blend":[...ke(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ke()}],"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":[Ie]}],"mask-image-linear-from-pos":[{"mask-linear-from":Q()}],"mask-image-linear-to-pos":[{"mask-linear-to":Q()}],"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":Q()}],"mask-image-t-to-pos":[{"mask-t-to":Q()}],"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":Q()}],"mask-image-r-to-pos":[{"mask-r-to":Q()}],"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":Q()}],"mask-image-b-to-pos":[{"mask-b-to":Q()}],"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":Q()}],"mask-image-l-to-pos":[{"mask-l-to":Q()}],"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":Q()}],"mask-image-x-to-pos":[{"mask-x-to":Q()}],"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":Q()}],"mask-image-y-to-pos":[{"mask-y-to":Q()}],"mask-image-y-from-color":[{"mask-y-from":k()}],"mask-image-y-to-color":[{"mask-y-to":k()}],"mask-image-radial":[{"mask-radial":[Ne,_e]}],"mask-image-radial-from-pos":[{"mask-radial-from":Q()}],"mask-image-radial-to-pos":[{"mask-radial-to":Q()}],"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":[Ie]}],"mask-image-conic-from-pos":[{"mask-conic-from":Q()}],"mask-image-conic-to-pos":[{"mask-conic-to":Q()}],"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:Y()}],"mask-size":[{mask:A()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ne,_e]}],filter:[{filter:["","none",Ne,_e]}],blur:[{blur:ee()}],brightness:[{brightness:[Ie,Ne,_e]}],contrast:[{contrast:[Ie,Ne,_e]}],"drop-shadow":[{"drop-shadow":["","none",x,qc,Pc]}],"drop-shadow-color":[{"drop-shadow":k()}],grayscale:[{grayscale:["",Ie,Ne,_e]}],"hue-rotate":[{"hue-rotate":[Ie,Ne,_e]}],invert:[{invert:["",Ie,Ne,_e]}],saturate:[{saturate:[Ie,Ne,_e]}],sepia:[{sepia:["",Ie,Ne,_e]}],"backdrop-filter":[{"backdrop-filter":["","none",Ne,_e]}],"backdrop-blur":[{"backdrop-blur":ee()}],"backdrop-brightness":[{"backdrop-brightness":[Ie,Ne,_e]}],"backdrop-contrast":[{"backdrop-contrast":[Ie,Ne,_e]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ie,Ne,_e]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ie,Ne,_e]}],"backdrop-invert":[{"backdrop-invert":["",Ie,Ne,_e]}],"backdrop-opacity":[{"backdrop-opacity":[Ie,Ne,_e]}],"backdrop-saturate":[{"backdrop-saturate":[Ie,Ne,_e]}],"backdrop-sepia":[{"backdrop-sepia":["",Ie,Ne,_e]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":N()}],"border-spacing-x":[{"border-spacing-x":N()}],"border-spacing-y":[{"border-spacing-y":N()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ne,_e]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ie,"initial",Ne,_e]}],ease:[{ease:["linear","initial",g,Ne,_e]}],delay:[{delay:[Ie,Ne,_e]}],animate:[{animate:["none",p,Ne,_e]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,Ne,_e]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:Ce()}],"rotate-x":[{"rotate-x":Ce()}],"rotate-y":[{"rotate-y":Ce()}],"rotate-z":[{"rotate-z":Ce()}],scale:[{scale:se()}],"scale-x":[{"scale-x":se()}],"scale-y":[{"scale-y":se()}],"scale-z":[{"scale-z":se()}],"scale-3d":["scale-3d"],skew:[{skew:Se()}],"skew-x":[{"skew-x":Se()}],"skew-y":[{"skew-y":Se()}],transform:[{transform:[Ne,_e,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:me()}],"translate-x":[{"translate-x":me()}],"translate-y":[{"translate-y":me()}],"translate-z":[{"translate-z":me()}],"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",Ne,_e]}],"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":N()}],"scroll-mx":[{"scroll-mx":N()}],"scroll-my":[{"scroll-my":N()}],"scroll-ms":[{"scroll-ms":N()}],"scroll-me":[{"scroll-me":N()}],"scroll-mt":[{"scroll-mt":N()}],"scroll-mr":[{"scroll-mr":N()}],"scroll-mb":[{"scroll-mb":N()}],"scroll-ml":[{"scroll-ml":N()}],"scroll-p":[{"scroll-p":N()}],"scroll-px":[{"scroll-px":N()}],"scroll-py":[{"scroll-py":N()}],"scroll-ps":[{"scroll-ps":N()}],"scroll-pe":[{"scroll-pe":N()}],"scroll-pt":[{"scroll-pt":N()}],"scroll-pr":[{"scroll-pr":N()}],"scroll-pb":[{"scroll-pb":N()}],"scroll-pl":[{"scroll-pl":N()}],"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",Ne,_e]}],fill:[{fill:["none",...k()]}],"stroke-w":[{stroke:[Ie,Pi,br,_h]}],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"]}},XA=TA(KA);function de(...e){return XA(c_(e))}const WA=hc("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 oe({className:e,variant:t,...n}){return s.jsx("div",{"data-slot":"alert",role:"alert",className:de(WA({variant:t}),e),...n})}function ge({className:e,...t}){return s.jsx("div",{"data-slot":"alert-title",className:de("col-start-2 min-h-4 font-medium tracking-tight",e),...t})}function ce({className:e,...t}){return s.jsx("div",{"data-slot":"alert-description",className:de("col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t})}function xe(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 Cj(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ef(...e){return t=>{let n=!1;const a=e.map(r=>{const l=Cj(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():Cj(e[r],null)}}}}function st(...e){return u.useCallback(ef(...e),e)}function QA(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 Js(e,t=[]){let n=[];function a(l,i){const o=u.createContext(i),c=n.length;n=[...n,i];const d=m=>{var g;const{scope:h,children:x,...j}=m,v=((g=h==null?void 0:h[e])==null?void 0:g[c])||o,y=u.useMemo(()=>j,Object.values(j));return s.jsx(v.Provider,{value:y,children:x})};d.displayName=l+"Provider";function f(m,h){var v;const x=((v=h==null?void 0:h[e])==null?void 0:v[c])||o,j=u.useContext(x);if(j)return j;if(i!==void 0)return i;throw new Error(`\`${m}\` 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,ZA(r,...t)]}function ZA(...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 m=c(l)[`__scope${d}`];return{...o,...m}},{});return u.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var un=globalThis!=null&&globalThis.document?u.useLayoutEffect:()=>{},JA=ob[" useId ".trim().toString()]||(()=>{}),e$=0;function Cs(e){const[t,n]=u.useState(JA());return un(()=>{n(a=>a??String(e$++))},[e]),t?`radix-${t}`:""}var t$=ob[" useInsertionEffect ".trim().toString()]||un;function lr({prop:e,defaultProp:t,onChange:n=()=>{},caller:a}){const[r,l,i]=n$({defaultProp:t,onChange:n}),o=e!==void 0,c=o?e:r;{const f=u.useRef(e!==void 0);u.useEffect(()=>{const m=f.current;m!==o&&console.warn(`${a} is changing from ${m?"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 m;if(o){const h=s$(f)?f(e):f;h!==e&&((m=i.current)==null||m.call(i,h))}else l(f)},[o,e,l,i]);return[c,d]}function n$({defaultProp:e,onChange:t}){const[n,a]=u.useState(e),r=u.useRef(n),l=u.useRef(t);return t$(()=>{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 s$(e){return typeof e=="function"}function Pr(e){const t=r$(e),n=u.forwardRef((a,r)=>{const{children:l,...i}=a,o=u.Children.toArray(l),c=o.find(i$);if(c){const d=c.props.children,f=o.map(m=>m===c?u.Children.count(d)>1?u.Children.only(null):u.isValidElement(d)?d.props.children:null:m);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 a$=Pr("Slot");function r$(e){const t=u.forwardRef((n,a)=>{const{children:r,...l}=n;if(u.isValidElement(r)){const i=c$(r),o=o$(l,r.props);return r.type!==u.Fragment&&(o.ref=a?ef(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 y_=Symbol("radix.slottable");function l$(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=y_,t}function i$(e){return u.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===y_}function o$(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 c$(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 u$=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ze=u$.reduce((e,t)=>{const n=Pr(`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 b_(e,t){e&&ci.flushSync(()=>e.dispatchEvent(t))}function Ks(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 d$(e,t=globalThis==null?void 0:globalThis.document){const n=Ks(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 f$="DismissableLayer",Qm="dismissableLayer.update",h$="dismissableLayer.pointerDownOutside",m$="dismissableLayer.focusOutside",Rj,w_=u.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),mc=u.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:a,onPointerDownOutside:r,onFocusOutside:l,onInteractOutside:i,onDismiss:o,...c}=e,d=u.useContext(w_),[f,m]=u.useState(null),h=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=u.useState({}),j=st(t,_=>m(_)),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),g=v.indexOf(y),p=f?v.indexOf(f):-1,b=d.layersWithOutsidePointerEventsDisabled.size>0,w=p>=g,S=g$(_=>{const N=_.target,O=[...d.branches].some(D=>D.contains(N));!w||O||(r==null||r(_),i==null||i(_),_.defaultPrevented||o==null||o())},h),C=v$(_=>{const N=_.target;[...d.branches].some(D=>D.contains(N))||(l==null||l(_),i==null||i(_),_.defaultPrevented||o==null||o())},h);return d$(_=>{p===d.layers.size-1&&(a==null||a(_),!_.defaultPrevented&&o&&(_.preventDefault(),o()))},h),u.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Rj=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),Tj(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Rj)}},[f,h,n,d]),u.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),Tj())},[f,d]),u.useEffect(()=>{const _=()=>x({});return document.addEventListener(Qm,_),()=>document.removeEventListener(Qm,_)},[]),s.jsx(ze.div,{...c,ref:j,style:{pointerEvents:b?w?"auto":"none":void 0,...e.style},onFocusCapture:xe(e.onFocusCapture,C.onFocusCapture),onBlurCapture:xe(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:xe(e.onPointerDownCapture,S.onPointerDownCapture)})});mc.displayName=f$;var p$="DismissableLayerBranch",x$=u.forwardRef((e,t)=>{const n=u.useContext(w_),a=u.useRef(null),r=st(t,a);return u.useEffect(()=>{const l=a.current;if(l)return n.branches.add(l),()=>{n.branches.delete(l)}},[n.branches]),s.jsx(ze.div,{...e,ref:r})});x$.displayName=p$;function g$(e,t=globalThis==null?void 0:globalThis.document){const n=Ks(e),a=u.useRef(!1),r=u.useRef(()=>{});return u.useEffect(()=>{const l=o=>{if(o.target&&!a.current){let c=function(){__(h$,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 v$(e,t=globalThis==null?void 0:globalThis.document){const n=Ks(e),a=u.useRef(!1);return u.useEffect(()=>{const r=l=>{l.target&&!a.current&&__(m$,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 Tj(){const e=new CustomEvent(Qm);document.dispatchEvent(e)}function __(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?b_(r,l):r.dispatchEvent(l)}var Nh="focusScope.autoFocusOnMount",kh="focusScope.autoFocusOnUnmount",Ej={bubbles:!1,cancelable:!0},j$="FocusScope",tf=u.forwardRef((e,t)=>{const{loop:n=!1,trapped:a=!1,onMountAutoFocus:r,onUnmountAutoFocus:l,...i}=e,[o,c]=u.useState(null),d=Ks(r),f=Ks(l),m=u.useRef(null),h=st(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(b){if(x.paused||!o)return;const w=b.target;o.contains(w)?m.current=w:Aa(m.current,{select:!0})},y=function(b){if(x.paused||!o)return;const w=b.relatedTarget;w!==null&&(o.contains(w)||Aa(m.current,{select:!0}))},g=function(b){if(document.activeElement===document.body)for(const S of b)S.removedNodes.length>0&&Aa(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){$j.add(x);const v=document.activeElement;if(!o.contains(v)){const g=new CustomEvent(Nh,Ej);o.addEventListener(Nh,d),o.dispatchEvent(g),g.defaultPrevented||(y$(k$(N_(o)),{select:!0}),document.activeElement===v&&Aa(o))}return()=>{o.removeEventListener(Nh,d),setTimeout(()=>{const g=new CustomEvent(kh,Ej);o.addEventListener(kh,f),o.dispatchEvent(g),g.defaultPrevented||Aa(v??document.body,{select:!0}),o.removeEventListener(kh,f),$j.remove(x)},0)}}},[o,d,f,x]);const j=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,[b,w]=b$(p);b&&w?!v.shiftKey&&g===w?(v.preventDefault(),n&&Aa(b,{select:!0})):v.shiftKey&&g===b&&(v.preventDefault(),n&&Aa(w,{select:!0})):g===p&&v.preventDefault()}},[n,a,x.paused]);return s.jsx(ze.div,{tabIndex:-1,...i,ref:h,onKeyDown:j})});tf.displayName=j$;function y$(e,{select:t=!1}={}){const n=document.activeElement;for(const a of e)if(Aa(a,{select:t}),document.activeElement!==n)return}function b$(e){const t=N_(e),n=Aj(t,e),a=Aj(t.reverse(),e);return[n,a]}function N_(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 Aj(e,t){for(const n of e)if(!w$(n,{upTo:t}))return n}function w$(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 _$(e){return e instanceof HTMLInputElement&&"select"in e}function Aa(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&_$(e)&&t&&e.select()}}var $j=N$();function N$(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Mj(e,t),e.unshift(t)},remove(t){var n;e=Mj(e,t),(n=e[0])==null||n.resume()}}}function Mj(e,t){const n=[...e],a=n.indexOf(t);return a!==-1&&n.splice(a,1),n}function k$(e){return e.filter(t=>t.tagName!=="A")}var S$="Portal",pc=u.forwardRef((e,t)=>{var o;const{container:n,...a}=e,[r,l]=u.useState(!1);un(()=>l(!0),[]);const i=n||r&&((o=globalThis==null?void 0:globalThis.document)==null?void 0:o.body);return i?I2.createPortal(s.jsx(ze.div,{...a,ref:t}),i):null});pc.displayName=S$;function C$(e,t){return u.useReducer((n,a)=>t[n][a]??n,e)}var bs=e=>{const{present:t,children:n}=e,a=R$(t),r=typeof n=="function"?n({present:a.isPresent}):u.Children.only(n),l=st(a.ref,T$(r));return typeof n=="function"||a.isPresent?u.cloneElement(r,{ref:l}):null};bs.displayName="Presence";function R$(e){const[t,n]=u.useState(),a=u.useRef(null),r=u.useRef(e),l=u.useRef("none"),i=e?"mounted":"unmounted",[o,c]=C$(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return u.useEffect(()=>{const d=Gc(a.current);l.current=o==="mounted"?d:"none"},[o]),un(()=>{const d=a.current,f=r.current;if(f!==e){const h=l.current,x=Gc(d);e?c("MOUNT"):x==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(f&&h!==x?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,c]),un(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,m=x=>{const v=Gc(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)})}},h=x=>{x.target===t&&(l.current=Gc(a.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(o),ref:u.useCallback(d=>{a.current=d?getComputedStyle(d):null,n(d)},[])}}function Gc(e){return(e==null?void 0:e.animationName)||"none"}function T$(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 Sh=0;function $x(){u.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Oj()),document.body.insertAdjacentElement("beforeend",e[1]??Oj()),Sh++,()=>{Sh===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Sh--}},[])}function Oj(){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 Us=function(){return Us=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},Us.apply(this,arguments)};function k_(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 E$(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 ju="right-scroll-bar-position",yu="width-before-scroll-bar",A$="with-scroll-bars-hidden",$$="--removed-body-scroll-bar-size";function Ch(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function M$(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 O$=typeof window<"u"?u.useLayoutEffect:u.useEffect,Dj=new WeakMap;function D$(e,t){var n=M$(null,function(a){return e.forEach(function(r){return Ch(r,a)})});return O$(function(){var a=Dj.get(n);if(a){var r=new Set(a),l=new Set(e),i=n.current;r.forEach(function(o){l.has(o)||Ch(o,null)}),l.forEach(function(o){r.has(o)||Ch(o,i)})}Dj.set(n,e)},[e]),n}function z$(e){return e}function L$(e,t){t===void 0&&(t=z$);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 U$(e){e===void 0&&(e={});var t=L$(null);return t.options=Us({async:!0,ssr:!1},e),t}var S_=function(e){var t=e.sideCar,n=k_(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,Us({},n))};S_.isSideCarExport=!0;function B$(e,t){return e.useMedium(t),S_}var C_=U$(),Rh=function(){},nf=u.forwardRef(function(e,t){var n=u.useRef(null),a=u.useState({onScrollCapture:Rh,onWheelCapture:Rh,onTouchMoveCapture:Rh}),r=a[0],l=a[1],i=e.forwardProps,o=e.children,c=e.className,d=e.removeScrollBar,f=e.enabled,m=e.shards,h=e.sideCar,x=e.noRelative,j=e.noIsolation,v=e.inert,y=e.allowPinchZoom,g=e.as,p=g===void 0?"div":g,b=e.gapMode,w=k_(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=h,C=D$([n,t]),_=Us(Us({},w),r);return u.createElement(u.Fragment,null,f&&u.createElement(S,{sideCar:C_,removeScrollBar:d,shards:m,noRelative:x,noIsolation:j,inert:v,setCallbacks:l,allowPinchZoom:!!y,lockRef:n,gapMode:b}),i?u.cloneElement(u.Children.only(o),Us(Us({},_),{ref:C})):u.createElement(p,Us({},_,{className:c,ref:C}),o))});nf.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};nf.classNames={fullWidth:yu,zeroRight:ju};var I$=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function H$(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=I$();return t&&e.setAttribute("nonce",t),e}function P$(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function q$(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var G$=function(){var e=0,t=null;return{add:function(n){e==0&&(t=H$())&&(P$(t,n),q$(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},V$=function(){var e=G$();return function(t,n){u.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},R_=function(){var e=V$(),t=function(n){var a=n.styles,r=n.dynamic;return e(a,r),null};return t},Y$={left:0,top:0,right:0,gap:0},Th=function(e){return parseInt(e||"",10)||0},F$=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[Th(n),Th(a),Th(r)]},K$=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Y$;var t=F$(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])}},X$=R_(),ql="data-scroll-locked",W$=function(e,t,n,a){var r=e.left,l=e.top,i=e.right,o=e.gap;return n===void 0&&(n="margin"),`
|
|
355
|
+
.`.concat(A$,` {
|
|
356
|
+
overflow: hidden `).concat(a,`;
|
|
357
|
+
padding-right: `).concat(o,"px ").concat(a,`;
|
|
358
|
+
}
|
|
359
|
+
body[`).concat(ql,`] {
|
|
360
|
+
overflow: hidden `).concat(a,`;
|
|
361
|
+
overscroll-behavior: contain;
|
|
362
|
+
`).concat([t&&"position: relative ".concat(a,";"),n==="margin"&&`
|
|
363
|
+
padding-left: `.concat(r,`px;
|
|
364
|
+
padding-top: `).concat(l,`px;
|
|
365
|
+
padding-right: `).concat(i,`px;
|
|
366
|
+
margin-left:0;
|
|
367
|
+
margin-top:0;
|
|
368
|
+
margin-right: `).concat(o,"px ").concat(a,`;
|
|
369
|
+
`),n==="padding"&&"padding-right: ".concat(o,"px ").concat(a,";")].filter(Boolean).join(""),`
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.`).concat(ju,` {
|
|
373
|
+
right: `).concat(o,"px ").concat(a,`;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.`).concat(yu,` {
|
|
377
|
+
margin-right: `).concat(o,"px ").concat(a,`;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.`).concat(ju," .").concat(ju,` {
|
|
381
|
+
right: 0 `).concat(a,`;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.`).concat(yu," .").concat(yu,` {
|
|
385
|
+
margin-right: 0 `).concat(a,`;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
body[`).concat(ql,`] {
|
|
389
|
+
`).concat($$,": ").concat(o,`px;
|
|
390
|
+
}
|
|
391
|
+
`)},zj=function(){var e=parseInt(document.body.getAttribute(ql)||"0",10);return isFinite(e)?e:0},Q$=function(){u.useEffect(function(){return document.body.setAttribute(ql,(zj()+1).toString()),function(){var e=zj()-1;e<=0?document.body.removeAttribute(ql):document.body.setAttribute(ql,e.toString())}},[])},Z$=function(e){var t=e.noRelative,n=e.noImportant,a=e.gapMode,r=a===void 0?"margin":a;Q$();var l=u.useMemo(function(){return K$(r)},[r]);return u.createElement(X$,{styles:W$(l,!t,r,n?"":"!important")})},Zm=!1;if(typeof window<"u")try{var Vc=Object.defineProperty({},"passive",{get:function(){return Zm=!0,!0}});window.addEventListener("test",Vc,Vc),window.removeEventListener("test",Vc,Vc)}catch{Zm=!1}var ol=Zm?{passive:!1}:!1,J$=function(e){return e.tagName==="TEXTAREA"},T_=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!J$(e)&&n[t]==="visible")},eM=function(e){return T_(e,"overflowY")},tM=function(e){return T_(e,"overflowX")},Lj=function(e,t){var n=t.ownerDocument,a=t;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var r=E_(e,a);if(r){var l=A_(e,a),i=l[1],o=l[2];if(i>o)return!0}a=a.parentNode}while(a&&a!==n.body);return!1},nM=function(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;return[t,n,a]},sM=function(e){var t=e.scrollLeft,n=e.scrollWidth,a=e.clientWidth;return[t,n,a]},E_=function(e,t){return e==="v"?eM(t):tM(t)},A_=function(e,t){return e==="v"?nM(t):sM(t)},aM=function(e,t){return e==="h"&&t==="rtl"?-1:1},rM=function(e,t,n,a,r){var l=aM(e,window.getComputedStyle(t).direction),i=l*a,o=n.target,c=t.contains(o),d=!1,f=i>0,m=0,h=0;do{if(!o)break;var x=A_(e,o),j=x[0],v=x[1],y=x[2],g=v-y-l*j;(j||g)&&E_(e,o)&&(m+=g,h+=j);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(m)<1||!f&&Math.abs(h)<1)&&(d=!0),d},Yc=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Uj=function(e){return[e.deltaX,e.deltaY]},Bj=function(e){return e&&"current"in e?e.current:e},lM=function(e,t){return e[0]===t[0]&&e[1]===t[1]},iM=function(e){return`
|
|
392
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
393
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
394
|
+
`)},oM=0,cl=[];function cM(e){var t=u.useRef([]),n=u.useRef([0,0]),a=u.useRef(),r=u.useState(oM++)[0],l=u.useState(R_)[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=E$([e.lockRef.current],(e.shards||[]).map(Bj),!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=Yc(v),p=n.current,b="deltaX"in v?v.deltaX:p[0]-g[0],w="deltaY"in v?v.deltaY:p[1]-g[1],S,C=v.target,_=Math.abs(b)>Math.abs(w)?"h":"v";if("touches"in v&&_==="h"&&C.type==="range")return!1;var N=Lj(_,C);if(!N)return!0;if(N?S=_:(S=_==="v"?"h":"v",N=Lj(_,C)),!N)return!1;if(!a.current&&"changedTouches"in v&&(b||w)&&(a.current=S),!S)return!0;var O=a.current||S;return rM(O,y,v,O==="h"?b:w)},[]),c=u.useCallback(function(v){var y=v;if(!(!cl.length||cl[cl.length-1]!==l)){var g="deltaY"in y?Uj(y):Yc(y),p=t.current.filter(function(S){return S.name===y.type&&(S.target===y.target||y.target===S.shadowParent)&&lM(S.delta,g)})[0];if(p&&p.should){y.cancelable&&y.preventDefault();return}if(!p){var b=(i.current.shards||[]).map(Bj).filter(Boolean).filter(function(S){return S.contains(y.target)}),w=b.length>0?o(y,b[0]):!i.current.noIsolation;w&&y.cancelable&&y.preventDefault()}}},[]),d=u.useCallback(function(v,y,g,p){var b={name:v,delta:y,target:g,should:p,shadowParent:uM(g)};t.current.push(b),setTimeout(function(){t.current=t.current.filter(function(w){return w!==b})},1)},[]),f=u.useCallback(function(v){n.current=Yc(v),a.current=void 0},[]),m=u.useCallback(function(v){d(v.type,Uj(v),v.target,o(v,e.lockRef.current))},[]),h=u.useCallback(function(v){d(v.type,Yc(v),v.target,o(v,e.lockRef.current))},[]);u.useEffect(function(){return cl.push(l),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:h}),document.addEventListener("wheel",c,ol),document.addEventListener("touchmove",c,ol),document.addEventListener("touchstart",f,ol),function(){cl=cl.filter(function(v){return v!==l}),document.removeEventListener("wheel",c,ol),document.removeEventListener("touchmove",c,ol),document.removeEventListener("touchstart",f,ol)}},[]);var x=e.removeScrollBar,j=e.inert;return u.createElement(u.Fragment,null,j?u.createElement(l,{styles:iM(r)}):null,x?u.createElement(Z$,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function uM(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const dM=B$(C_,cM);var sf=u.forwardRef(function(e,t){return u.createElement(nf,Us({},e,{ref:t,sideCar:dM}))});sf.classNames=nf.classNames;var fM=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ul=new WeakMap,Fc=new WeakMap,Kc={},Eh=0,$_=function(e){return e&&(e.host||$_(e.parentNode))},hM=function(e,t){return t.map(function(n){if(e.contains(n))return n;var a=$_(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})},mM=function(e,t,n,a){var r=hM(t,Array.isArray(e)?e:[e]);Kc[n]||(Kc[n]=new WeakMap);var l=Kc[n],i=[],o=new Set,c=new Set(r),d=function(m){!m||o.has(m)||(o.add(m),d(m.parentNode))};r.forEach(d);var f=function(m){!m||c.has(m)||Array.prototype.forEach.call(m.children,function(h){if(o.has(h))f(h);else try{var x=h.getAttribute(a),j=x!==null&&x!=="false",v=(ul.get(h)||0)+1,y=(l.get(h)||0)+1;ul.set(h,v),l.set(h,y),i.push(h),v===1&&j&&Fc.set(h,!0),y===1&&h.setAttribute(n,"true"),j||h.setAttribute(a,"true")}catch(g){console.error("aria-hidden: cannot operate on ",h,g)}})};return f(t),o.clear(),Eh++,function(){i.forEach(function(m){var h=ul.get(m)-1,x=l.get(m)-1;ul.set(m,h),l.set(m,x),h||(Fc.has(m)||m.removeAttribute(a),Fc.delete(m)),x||m.removeAttribute(n)}),Eh--,Eh||(ul=new WeakMap,ul=new WeakMap,Fc=new WeakMap,Kc={})}},Mx=function(e,t,n){n===void 0&&(n="data-aria-hidden");var a=Array.from(Array.isArray(e)?e:[e]),r=fM(e);return r?(a.push.apply(a,Array.from(r.querySelectorAll("[aria-live], script"))),mM(a,r,n,"aria-hidden")):function(){return null}},af="Dialog",[M_]=Js(af),[pM,Ms]=M_(af),O_=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]=lr({prop:a,defaultProp:r??!1,onChange:l,caller:af});return s.jsx(pM,{scope:t,triggerRef:o,contentRef:c,contentId:Cs(),titleId:Cs(),descriptionId:Cs(),open:d,onOpenChange:f,onOpenToggle:u.useCallback(()=>f(m=>!m),[f]),modal:i,children:n})};O_.displayName=af;var D_="DialogTrigger",xM=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=Ms(D_,n),l=st(t,r.triggerRef);return s.jsx(ze.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":zx(r.open),...a,ref:l,onClick:xe(e.onClick,r.onOpenToggle)})});xM.displayName=D_;var Ox="DialogPortal",[gM,z_]=M_(Ox,{forceMount:void 0}),L_=e=>{const{__scopeDialog:t,forceMount:n,children:a,container:r}=e,l=Ms(Ox,t);return s.jsx(gM,{scope:t,forceMount:n,children:u.Children.map(a,i=>s.jsx(bs,{present:n||l.open,children:s.jsx(pc,{asChild:!0,container:r,children:i})}))})};L_.displayName=Ox;var od="DialogOverlay",U_=u.forwardRef((e,t)=>{const n=z_(od,e.__scopeDialog),{forceMount:a=n.forceMount,...r}=e,l=Ms(od,e.__scopeDialog);return l.modal?s.jsx(bs,{present:a||l.open,children:s.jsx(jM,{...r,ref:t})}):null});U_.displayName=od;var vM=Pr("DialogOverlay.RemoveScroll"),jM=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=Ms(od,n);return s.jsx(sf,{as:vM,allowPinchZoom:!0,shards:[r.contentRef],children:s.jsx(ze.div,{"data-state":zx(r.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),qr="DialogContent",B_=u.forwardRef((e,t)=>{const n=z_(qr,e.__scopeDialog),{forceMount:a=n.forceMount,...r}=e,l=Ms(qr,e.__scopeDialog);return s.jsx(bs,{present:a||l.open,children:l.modal?s.jsx(yM,{...r,ref:t}):s.jsx(bM,{...r,ref:t})})});B_.displayName=qr;var yM=u.forwardRef((e,t)=>{const n=Ms(qr,e.__scopeDialog),a=u.useRef(null),r=st(t,n.contentRef,a);return u.useEffect(()=>{const l=a.current;if(l)return Mx(l)},[]),s.jsx(I_,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:xe(e.onCloseAutoFocus,l=>{var i;l.preventDefault(),(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:xe(e.onPointerDownOutside,l=>{const i=l.detail.originalEvent,o=i.button===0&&i.ctrlKey===!0;(i.button===2||o)&&l.preventDefault()}),onFocusOutside:xe(e.onFocusOutside,l=>l.preventDefault())})}),bM=u.forwardRef((e,t)=>{const n=Ms(qr,e.__scopeDialog),a=u.useRef(!1),r=u.useRef(!1);return s.jsx(I_,{...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()}})}),I_=u.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:a,onOpenAutoFocus:r,onCloseAutoFocus:l,...i}=e,o=Ms(qr,n),c=u.useRef(null),d=st(t,c);return $x(),s.jsxs(s.Fragment,{children:[s.jsx(tf,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:r,onUnmountAutoFocus:l,children:s.jsx(mc,{role:"dialog",id:o.contentId,"aria-describedby":o.descriptionId,"aria-labelledby":o.titleId,"data-state":zx(o.open),...i,ref:d,onDismiss:()=>o.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(wM,{titleId:o.titleId}),s.jsx(NM,{contentRef:c,descriptionId:o.descriptionId})]})]})}),Dx="DialogTitle",H_=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=Ms(Dx,n);return s.jsx(ze.h2,{id:r.titleId,...a,ref:t})});H_.displayName=Dx;var P_="DialogDescription",q_=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=Ms(P_,n);return s.jsx(ze.p,{id:r.descriptionId,...a,ref:t})});q_.displayName=P_;var G_="DialogClose",V_=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=Ms(G_,n);return s.jsx(ze.button,{type:"button",...a,ref:t,onClick:xe(e.onClick,()=>r.onOpenChange(!1))})});V_.displayName=G_;function zx(e){return e?"open":"closed"}var Y_="DialogTitleWarning",[WB,F_]=QA(Y_,{contentName:qr,titleName:Dx,docsSlug:"dialog"}),wM=({titleId:e})=>{const t=F_(Y_),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
395
|
+
|
|
396
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
397
|
+
|
|
398
|
+
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},_M="DialogDescriptionWarning",NM=({contentRef:e,descriptionId:t})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${F_(_M).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},K_=O_,X_=L_,W_=U_,Q_=B_,Z_=H_,J_=q_,Lx=V_;function dn({className:e,...t}){return s.jsx(wE,{role:"status","aria-label":"Loading",className:de("size-4 animate-spin",e),...t})}const vo="aria-pressed:border aria-pressed:border-primary aria-pressed:bg-accent aria-pressed:text-accent-foreground",kM="border border-primary bg-accent text-accent-foreground hover:bg-accent",rf=hc("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?a$:"button",f=a==="icon"||a==="sm-icon"||a==="control-icon"||a==="xs-icon",m=s.jsx(dn,{"aria-hidden":"true","aria-label":void 0,role:void 0,className:de(!f&&"mr-2")}),h=r?i:l&&f?m:s.jsxs(s.Fragment,{children:[l?m:null,i]});return s.jsx(d,{className:de(rf({variant:n,size:a,className:e})),ref:c,disabled:t||l,...o,children:h})});P.displayName="Button";const eN=u.createContext(null);function SM({container:e,children:t}){return s.jsx(eN.Provider,{value:e,children:t})}function xc(){return u.useContext(eN)??void 0}function Ux(e){return s.jsx(K_,{"data-slot":"alert-dialog",...e})}function CM({className:e,...t}){return s.jsx(W_,{"data-slot":"alert-dialog-overlay",className:de("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 Bx({className:e,onOpenAutoFocus:t,onPointerDownOutside:n,onInteractOutside:a,...r}){return s.jsxs(X_,{container:xc(),children:[s.jsx(CM,{}),s.jsx(Q_,{"data-slot":"alert-dialog-content",role:"alertdialog",className:de("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 Ix({className:e,...t}){return s.jsx("div",{"data-slot":"alert-dialog-header",className:de("flex flex-col gap-2 text-center sm:text-left",e),...t})}function Hx({className:e,...t}){return s.jsx("div",{"data-slot":"alert-dialog-footer",className:de("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function Px({className:e,...t}){return s.jsx(Z_,{"data-slot":"alert-dialog-title",className:de("text-lg font-semibold",e),...t})}function qx({className:e,...t}){return s.jsx(J_,{"data-slot":"alert-dialog-description",className:de("text-muted-foreground text-sm",e),...t})}function tN({className:e,variant:t,...n}){return s.jsx(Lx,{"data-slot":"alert-dialog-action",className:de(rf({variant:t}),e),...n})}function Gx({className:e,...t}){return s.jsx(Lx,{"data-slot":"alert-dialog-cancel",className:de(rf({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 TM(e,t){t!=null&&t.isConnected&&(e.preventDefault(),t.focus())}function vi(){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(Ux,{open:e!==null,onOpenChange:o=>{o||r(!1)},children:s.jsxs(Bx,{onCloseAutoFocus:o=>TM(o,a.current),children:[s.jsxs(Ix,{children:[s.jsx(Px,{children:e==null?void 0:e.title}),s.jsx(qx,{className:"whitespace-pre-line",children:e==null?void 0:e.description})]}),s.jsxs(Hx,{children:[s.jsx(Gx,{children:"Cancel"}),s.jsx(tN,{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 ia="px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",EM=hc("inline-flex items-center rounded-md border transition-colors",{variants:{variant:{default:`${ia} border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80`,secondary:`${ia} border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`${ia} border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80`,outline:`${ia} text-foreground`,success:`${ia} border-success/40 bg-success/10 text-success`,warning:`${ia} border-warning/40 bg-warning/10 text-warning`,info:`${ia} border-info/40 bg-info/10 text-info`,error:`${ia} border-destructive/40 bg-destructive/10 text-destructive`,neutral:`${ia} 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 fe({className:e,variant:t,size:n,...a}){return s.jsx("div",{className:de(EM({variant:t,size:n}),e),...a})}function nN(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 sN(e){const[t,n]=u.useState(void 0);return un(()=>{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 lf="Checkbox",[AM]=Js(lf),[$M,Vx]=AM(lf);function MM(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:m}=e,[h,x]=lr({prop:n,defaultProp:r??!1,onChange:c,caller:lf}),[j,v]=u.useState(null),[y,g]=u.useState(null),p=u.useRef(!1),b=j?!!i||!!j.closest("form"):!0,w={checked:h,disabled:l,setChecked:x,control:j,setControl:v,name:o,form:i,value:f,hasConsumerStoppedPropagationRef:p,required:d,defaultChecked:er(r)?!1:r,isFormControl:b,bubbleInput:y,setBubbleInput:g};return s.jsx($M,{scope:t,...w,children:OM(m)?m(w):a})}var aN="CheckboxTrigger",rN=u.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...a},r)=>{const{control:l,value:i,disabled:o,checked:c,required:d,setControl:f,setChecked:m,hasConsumerStoppedPropagationRef:h,isFormControl:x,bubbleInput:j}=Vx(aN,e),v=st(r,f),y=u.useRef(c);return u.useEffect(()=>{const g=l==null?void 0:l.form;if(g){const p=()=>m(y.current);return g.addEventListener("reset",p),()=>g.removeEventListener("reset",p)}},[l,m]),s.jsx(ze.button,{type:"button",role:"checkbox","aria-checked":er(c)?"mixed":c,"aria-required":d,"data-state":uN(c),"data-disabled":o?"":void 0,disabled:o,value:i,...a,ref:v,onKeyDown:xe(t,g=>{g.key==="Enter"&&g.preventDefault()}),onClick:xe(n,g=>{m(p=>er(p)?!0:!p),j&&x&&(h.current=g.isPropagationStopped(),h.current||g.stopPropagation())})})});rN.displayName=aN;var Yx=u.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:a,checked:r,defaultChecked:l,required:i,disabled:o,value:c,onCheckedChange:d,form:f,...m}=e;return s.jsx(MM,{__scopeCheckbox:n,checked:r,defaultChecked:l,disabled:o,required:i,onCheckedChange:d,name:a,form:f,value:c,internal_do_not_use_render:({isFormControl:h})=>s.jsxs(s.Fragment,{children:[s.jsx(rN,{...m,ref:t,__scopeCheckbox:n}),h&&s.jsx(cN,{__scopeCheckbox:n})]})})});Yx.displayName=lf;var lN="CheckboxIndicator",iN=u.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:a,...r}=e,l=Vx(lN,n);return s.jsx(bs,{present:a||er(l.checked)||l.checked===!0,children:s.jsx(ze.span,{"data-state":uN(l.checked),"data-disabled":l.disabled?"":void 0,...r,ref:t,style:{pointerEvents:"none",...e.style}})})});iN.displayName=lN;var oN="CheckboxBubbleInput",cN=u.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:a,hasConsumerStoppedPropagationRef:r,checked:l,defaultChecked:i,required:o,disabled:c,name:d,value:f,form:m,bubbleInput:h,setBubbleInput:x}=Vx(oN,e),j=st(n,x),v=nN(l),y=sN(a);u.useEffect(()=>{const p=h;if(!p)return;const b=window.HTMLInputElement.prototype,S=Object.getOwnPropertyDescriptor(b,"checked").set,C=!r.current;if(v!==l&&S){const _=new Event("click",{bubbles:C});p.indeterminate=er(l),S.call(p,er(l)?!1:l),p.dispatchEvent(_)}},[h,v,l,r]);const g=u.useRef(er(l)?!1:l);return s.jsx(ze.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??g.current,required:o,disabled:c,name:d,value:f,form:m,...t,tabIndex:-1,ref:j,style:{...t.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});cN.displayName=oN;function OM(e){return typeof e=="function"}function er(e){return e==="indeterminate"}function uN(e){return er(e)?"indeterminate":e?"checked":"unchecked"}const ji=u.forwardRef(({className:e,...t},n)=>s.jsx(Yx,{ref:n,className:de("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(iN,{className:de("flex items-center justify-center text-current"),children:t.checked==="indeterminate"?s.jsx(CE,{className:"size-4","aria-hidden":"true"}):s.jsx(Zr,{className:"size-4","aria-hidden":"true"})})}));ji.displayName=Yx.displayName;const DM=hc("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 bn({...e}){return s.jsx(K_,{"data-slot":"dialog",...e})}function zM({...e}){const t=xc();return s.jsx(X_,{"data-slot":"dialog-portal",container:t,...e})}function LM({className:e,...t}){return s.jsx(W_,{"data-slot":"dialog-overlay",className:de("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 wn({className:e,children:t,showCloseButton:n=!0,size:a,...r}){return s.jsxs(zM,{"data-slot":"dialog-portal",children:[s.jsx(LM,{}),s.jsxs(Q_,{"data-slot":"dialog-content",className:de(DM({size:a}),e),...r,children:[t,n&&s.jsxs(Lx,{"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(Zd,{}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function _n({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-header",className:de("flex flex-col gap-2 text-center sm:text-left",e),...t})}function Nn({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-footer",className:de("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function kn({className:e,...t}){return s.jsx(Z_,{"data-slot":"dialog-title",className:de("text-lg leading-none font-semibold",e),...t})}function Sn({className:e,...t}){return s.jsx(J_,{"data-slot":"dialog-description",className:de("text-muted-foreground text-sm",e),...t})}function Fx(e){const t=e+"CollectionProvider",[n,a]=Js(t),[r,l]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=v=>{const{scope:y,children:g}=v,p=Ta.useRef(null),b=Ta.useRef(new Map).current;return s.jsx(r,{scope:y,itemMap:b,collectionRef:p,children:g})};i.displayName=t;const o=e+"CollectionSlot",c=Pr(o),d=Ta.forwardRef((v,y)=>{const{scope:g,children:p}=v,b=l(o,g),w=st(y,b.collectionRef);return s.jsx(c,{ref:w,children:p})});d.displayName=o;const f=e+"CollectionItemSlot",m="data-radix-collection-item",h=Pr(f),x=Ta.forwardRef((v,y)=>{const{scope:g,children:p,...b}=v,w=Ta.useRef(null),S=st(y,w),C=l(f,g);return Ta.useEffect(()=>(C.itemMap.set(w,{ref:w,...b}),()=>void C.itemMap.delete(w))),s.jsx(h,{[m]:"",ref:S,children:p})});x.displayName=f;function j(v){const y=l(e+"CollectionConsumer",v);return Ta.useCallback(()=>{const p=y.collectionRef.current;if(!p)return[];const b=Array.from(p.querySelectorAll(`[${m}]`));return Array.from(y.itemMap.values()).sort((C,_)=>b.indexOf(C.ref.current)-b.indexOf(_.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:i,Slot:d,ItemSlot:x},j,a]}var UM=u.createContext(void 0);function of(e){const t=u.useContext(UM);return e||t||"ltr"}const BM=["top","right","bottom","left"],ir=Math.min,Kn=Math.max,cd=Math.round,Xc=Math.floor,Ys=e=>({x:e,y:e}),IM={left:"right",right:"left",bottom:"top",top:"bottom"},HM={start:"end",end:"start"};function Jm(e,t,n){return Kn(e,ir(t,n))}function ba(e,t){return typeof e=="function"?e(t):e}function wa(e){return e.split("-")[0]}function yi(e){return e.split("-")[1]}function Kx(e){return e==="x"?"y":"x"}function Xx(e){return e==="y"?"height":"width"}function Hs(e){return["top","bottom"].includes(wa(e))?"y":"x"}function Wx(e){return Kx(Hs(e))}function PM(e,t,n){n===void 0&&(n=!1);const a=yi(e),r=Wx(e),l=Xx(r);let i=r==="x"?a===(n?"end":"start")?"right":"left":a==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(i=ud(i)),[i,ud(i)]}function qM(e){const t=ud(e);return[ep(e),t,ep(t)]}function ep(e){return e.replace(/start|end/g,t=>HM[t])}function GM(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 VM(e,t,n,a){const r=yi(e);let l=GM(wa(e),n==="start",a);return r&&(l=l.map(i=>i+"-"+r),t&&(l=l.concat(l.map(ep)))),l}function ud(e){return e.replace(/left|right|bottom|top/g,t=>IM[t])}function YM(e){return{top:0,right:0,bottom:0,left:0,...e}}function dN(e){return typeof e!="number"?YM(e):{top:e,right:e,bottom:e,left:e}}function dd(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 Ij(e,t,n){let{reference:a,floating:r}=e;const l=Hs(t),i=Wx(t),o=Xx(i),c=wa(t),d=l==="y",f=a.x+a.width/2-r.width/2,m=a.y+a.height/2-r.height/2,h=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:m};break;case"left":x={x:a.x-r.width,y:m};break;default:x={x:a.x,y:a.y}}switch(yi(t)){case"start":x[i]-=h*(n&&d?-1:1);break;case"end":x[i]+=h*(n&&d?-1:1);break}return x}const FM=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:m}=Ij(d,a,c),h=a,x={},j=0;for(let v=0;v<o.length;v++){const{name:y,fn:g}=o[v],{x:p,y:b,data:w,reset:S}=await g({x:f,y:m,initialPlacement:a,placement:h,strategy:r,middlewareData:x,rects:d,platform:i,elements:{reference:e,floating:t}});f=p??f,m=b??m,x={...x,[y]:{...x[y],...w}},S&&j<=50&&(j++,typeof S=="object"&&(S.placement&&(h=S.placement),S.rects&&(d=S.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:r}):S.rects),{x:f,y:m}=Ij(d,h,c)),v=-1)}return{x:f,y:m,placement:h,strategy:r,middlewareData:x}};async function zo(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:m="floating",altBoundary:h=!1,padding:x=0}=ba(t,e),j=dN(x),y=o[h?m==="floating"?"reference":"floating":m],g=dd(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=m==="floating"?{x:a,y:r,width:i.floating.width,height:i.floating.height}:i.reference,b=await(l.getOffsetParent==null?void 0:l.getOffsetParent(o.floating)),w=await(l.isElement==null?void 0:l.isElement(b))?await(l.getScale==null?void 0:l.getScale(b))||{x:1,y:1}:{x:1,y:1},S=dd(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:p,offsetParent:b,strategy:c}):p);return{top:(g.top-S.top+j.top)/w.y,bottom:(S.bottom-g.bottom+j.bottom)/w.y,left:(g.left-S.left+j.left)/w.x,right:(S.right-g.right+j.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}=ba(e,t)||{};if(d==null)return{};const m=dN(f),h={x:n,y:a},x=Wx(r),j=Xx(x),v=await i.getDimensions(d),y=x==="y",g=y?"top":"left",p=y?"bottom":"right",b=y?"clientHeight":"clientWidth",w=l.reference[j]+l.reference[x]-h[x]-l.floating[j],S=h[x]-l.reference[x],C=await(i.getOffsetParent==null?void 0:i.getOffsetParent(d));let _=C?C[b]:0;(!_||!await(i.isElement==null?void 0:i.isElement(C)))&&(_=o.floating[b]||l.floating[j]);const N=w/2-S/2,O=_/2-v[j]/2-1,D=ir(m[g],O),B=ir(m[p],O),G=D,U=_-v[j]-B,R=_/2-v[j]/2+N,$=Jm(G,R,U),T=!c.arrow&&yi(r)!=null&&R!==$&&l.reference[j]/2-(R<G?D:B)-v[j]/2<0,E=T?R<G?R-G:R-U:0;return{[x]:h[x]+E,data:{[x]:$,centerOffset:R-$-E,...T&&{alignmentOffset:E}},reset:T}}}),XM=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:m=!0,fallbackPlacements:h,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:j="none",flipAlignment:v=!0,...y}=ba(e,t);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const g=wa(r),p=Hs(o),b=wa(o)===o,w=await(c.isRTL==null?void 0:c.isRTL(d.floating)),S=h||(b||!v?[ud(o)]:qM(o)),C=j!=="none";!h&&C&&S.push(...VM(o,v,j,w));const _=[o,...S],N=await zo(t,y),O=[];let D=((a=l.flip)==null?void 0:a.overflows)||[];if(f&&O.push(N[g]),m){const R=PM(r,i,w);O.push(N[R[0]],N[R[1]])}if(D=[...D,{placement:r,overflows:O}],!O.every(R=>R<=0)){var B,G;const R=(((B=l.flip)==null?void 0:B.index)||0)+1,$=_[R];if($&&(!(m==="alignment"?p!==Hs($):!1)||D.every(k=>k.overflows[0]>0&&Hs(k.placement)===p)))return{data:{index:R,overflows:D},reset:{placement:$}};let T=(G=D.filter(E=>E.overflows[0]<=0).sort((E,k)=>E.overflows[1]-k.overflows[1])[0])==null?void 0:G.placement;if(!T)switch(x){case"bestFit":{var U;const E=(U=D.filter(k=>{if(C){const M=Hs(k.placement);return M===p||M==="y"}return!0}).map(k=>[k.placement,k.overflows.filter(M=>M>0).reduce((M,Y)=>M+Y,0)]).sort((k,M)=>k[1]-M[1])[0])==null?void 0:U[0];E&&(T=E);break}case"initialPlacement":T=o;break}if(r!==T)return{reset:{placement:T}}}return{}}}};function Hj(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Pj(e){return BM.some(t=>e[t]>=0)}const WM=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:a="referenceHidden",...r}=ba(e,t);switch(a){case"referenceHidden":{const l=await zo(t,{...r,elementContext:"reference"}),i=Hj(l,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Pj(i)}}}case"escaped":{const l=await zo(t,{...r,altBoundary:!0}),i=Hj(l,n.floating);return{data:{escapedOffsets:i,escaped:Pj(i)}}}default:return{}}}}};async function QM(e,t){const{placement:n,platform:a,elements:r}=e,l=await(a.isRTL==null?void 0:a.isRTL(r.floating)),i=wa(n),o=yi(n),c=Hs(n)==="y",d=["left","top"].includes(i)?-1:1,f=l&&c?-1:1,m=ba(t,e);let{mainAxis:h,crossAxis:x,alignmentAxis:j}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return o&&typeof j=="number"&&(x=o==="end"?j*-1:j),c?{x:x*f,y:h*d}:{x:h*d,y:x*f}}const ZM=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 QM(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}}}}},JM=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}=ba(e,t),d={x:n,y:a},f=await zo(t,c),m=Hs(wa(r)),h=Kx(m);let x=d[h],j=d[m];if(l){const y=h==="y"?"top":"left",g=h==="y"?"bottom":"right",p=x+f[y],b=x-f[g];x=Jm(p,x,b)}if(i){const y=m==="y"?"top":"left",g=m==="y"?"bottom":"right",p=j+f[y],b=j-f[g];j=Jm(p,j,b)}const v=o.fn({...t,[h]:x,[m]:j});return{...v,data:{x:v.x-n,y:v.y-a,enabled:{[h]:l,[m]:i}}}}}},eO=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}=ba(e,t),f={x:n,y:a},m=Hs(r),h=Kx(m);let x=f[h],j=f[m];const v=ba(o,t),y=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(c){const b=h==="y"?"height":"width",w=l.reference[h]-l.floating[b]+y.mainAxis,S=l.reference[h]+l.reference[b]-y.mainAxis;x<w?x=w:x>S&&(x=S)}if(d){var g,p;const b=h==="y"?"width":"height",w=["top","left"].includes(wa(r)),S=l.reference[m]-l.floating[b]+(w&&((g=i.offset)==null?void 0:g[m])||0)+(w?0:y.crossAxis),C=l.reference[m]+l.reference[b]+(w?0:((p=i.offset)==null?void 0:p[m])||0)-(w?y.crossAxis:0);j<S?j=S:j>C&&(j=C)}return{[h]:x,[m]:j}}}},tO=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}=ba(e,t),f=await zo(t,d),m=wa(r),h=yi(r),x=Hs(r)==="y",{width:j,height:v}=l.floating;let y,g;m==="top"||m==="bottom"?(y=m,g=h===(await(i.isRTL==null?void 0:i.isRTL(o.floating))?"start":"end")?"left":"right"):(g=m,y=h==="end"?"top":"bottom");const p=v-f.top-f.bottom,b=j-f.left-f.right,w=ir(v-f[y],p),S=ir(j-f[g],b),C=!t.middlewareData.shift;let _=w,N=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(N=b),(a=t.middlewareData.shift)!=null&&a.enabled.y&&(_=p),C&&!h){const D=Kn(f.left,0),B=Kn(f.right,0),G=Kn(f.top,0),U=Kn(f.bottom,0);x?N=j-2*(D!==0||B!==0?D+B:Kn(f.left,f.right)):_=v-2*(G!==0||U!==0?G+U:Kn(f.top,f.bottom))}await c({...t,availableWidth:N,availableHeight:_});const O=await i.getDimensions(o.floating);return j!==O.width||v!==O.height?{reset:{rects:!0}}:{}}}};function cf(){return typeof window<"u"}function bi(e){return fN(e)?(e.nodeName||"").toLowerCase():"#document"}function es(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ea(e){var t;return(t=(fN(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function fN(e){return cf()?e instanceof Node||e instanceof es(e).Node:!1}function Ts(e){return cf()?e instanceof Element||e instanceof es(e).Element:!1}function Xs(e){return cf()?e instanceof HTMLElement||e instanceof es(e).HTMLElement:!1}function qj(e){return!cf()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof es(e).ShadowRoot}function gc(e){const{overflow:t,overflowX:n,overflowY:a,display:r}=Es(e);return/auto|scroll|overlay|hidden|clip/.test(t+a+n)&&!["inline","contents"].includes(r)}function nO(e){return["table","td","th"].includes(bi(e))}function uf(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Qx(e){const t=Zx(),n=Ts(e)?Es(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 sO(e){let t=or(e);for(;Xs(t)&&!ri(t);){if(Qx(t))return t;if(uf(t))return null;t=or(t)}return null}function Zx(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ri(e){return["html","body","#document"].includes(bi(e))}function Es(e){return es(e).getComputedStyle(e)}function df(e){return Ts(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function or(e){if(bi(e)==="html")return e;const t=e.assignedSlot||e.parentNode||qj(e)&&e.host||ea(e);return qj(t)?t.host:t}function hN(e){const t=or(e);return ri(t)?e.ownerDocument?e.ownerDocument.body:e.body:Xs(t)&&gc(t)?t:hN(t)}function Lo(e,t,n){var a;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=hN(e),l=r===((a=e.ownerDocument)==null?void 0:a.body),i=es(r);if(l){const o=tp(i);return t.concat(i,i.visualViewport||[],gc(r)?r:[],o&&n?Lo(o):[])}return t.concat(r,Lo(r,[],n))}function tp(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function mN(e){const t=Es(e);let n=parseFloat(t.width)||0,a=parseFloat(t.height)||0;const r=Xs(e),l=r?e.offsetWidth:n,i=r?e.offsetHeight:a,o=cd(n)!==l||cd(a)!==i;return o&&(n=l,a=i),{width:n,height:a,$:o}}function Jx(e){return Ts(e)?e:e.contextElement}function Gl(e){const t=Jx(e);if(!Xs(t))return Ys(1);const n=t.getBoundingClientRect(),{width:a,height:r,$:l}=mN(t);let i=(l?cd(n.width):n.width)/a,o=(l?cd(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!o||!Number.isFinite(o))&&(o=1),{x:i,y:o}}const aO=Ys(0);function pN(e){const t=es(e);return!Zx()||!t.visualViewport?aO:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function rO(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==es(e)?!1:t}function Gr(e,t,n,a){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),l=Jx(e);let i=Ys(1);t&&(a?Ts(a)&&(i=Gl(a)):i=Gl(e));const o=rO(l,n,a)?pN(l):Ys(0);let c=(r.left+o.x)/i.x,d=(r.top+o.y)/i.y,f=r.width/i.x,m=r.height/i.y;if(l){const h=es(l),x=a&&Ts(a)?es(a):a;let j=h,v=tp(j);for(;v&&a&&x!==j;){const y=Gl(v),g=v.getBoundingClientRect(),p=Es(v),b=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,m*=y.y,c+=b,d+=w,j=es(v),v=tp(j)}}return dd({width:f,height:m,x:c,y:d})}function eg(e,t){const n=df(e).scrollLeft;return t?t.left+n:Gr(ea(e)).left+n}function xN(e,t,n){n===void 0&&(n=!1);const a=e.getBoundingClientRect(),r=a.left+t.scrollLeft-(n?0:eg(e,a)),l=a.top+t.scrollTop;return{x:r,y:l}}function lO(e){let{elements:t,rect:n,offsetParent:a,strategy:r}=e;const l=r==="fixed",i=ea(a),o=t?uf(t.floating):!1;if(a===i||o&&l)return n;let c={scrollLeft:0,scrollTop:0},d=Ys(1);const f=Ys(0),m=Xs(a);if((m||!m&&!l)&&((bi(a)!=="body"||gc(i))&&(c=df(a)),Xs(a))){const x=Gr(a);d=Gl(a),f.x=x.x+a.clientLeft,f.y=x.y+a.clientTop}const h=i&&!m&&!l?xN(i,c,!0):Ys(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+f.x+h.x,y:n.y*d.y-c.scrollTop*d.y+f.y+h.y}}function iO(e){return Array.from(e.getClientRects())}function oO(e){const t=ea(e),n=df(e),a=e.ownerDocument.body,r=Kn(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),l=Kn(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight);let i=-n.scrollLeft+eg(e);const o=-n.scrollTop;return Es(a).direction==="rtl"&&(i+=Kn(t.clientWidth,a.clientWidth)-r),{width:r,height:l,x:i,y:o}}function cO(e,t){const n=es(e),a=ea(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=Zx();(!d||d&&t==="fixed")&&(o=r.offsetLeft,c=r.offsetTop)}return{width:l,height:i,x:o,y:c}}function uO(e,t){const n=Gr(e,!0,t==="fixed"),a=n.top+e.clientTop,r=n.left+e.clientLeft,l=Xs(e)?Gl(e):Ys(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 Gj(e,t,n){let a;if(t==="viewport")a=cO(e,n);else if(t==="document")a=oO(ea(e));else if(Ts(t))a=uO(t,n);else{const r=pN(e);a={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return dd(a)}function gN(e,t){const n=or(e);return n===t||!Ts(n)||ri(n)?!1:Es(n).position==="fixed"||gN(n,t)}function dO(e,t){const n=t.get(e);if(n)return n;let a=Lo(e,[],!1).filter(o=>Ts(o)&&bi(o)!=="body"),r=null;const l=Es(e).position==="fixed";let i=l?or(e):e;for(;Ts(i)&&!ri(i);){const o=Es(i),c=Qx(i);!c&&o.position==="fixed"&&(r=null),(l?!c&&!r:!c&&o.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||gc(i)&&!c&&gN(e,i))?a=a.filter(f=>f!==i):r=o,i=or(i)}return t.set(e,a),a}function fO(e){let{element:t,boundary:n,rootBoundary:a,strategy:r}=e;const i=[...n==="clippingAncestors"?uf(t)?[]:dO(t,this._c):[].concat(n),a],o=i[0],c=i.reduce((d,f)=>{const m=Gj(t,f,r);return d.top=Kn(m.top,d.top),d.right=ir(m.right,d.right),d.bottom=ir(m.bottom,d.bottom),d.left=Kn(m.left,d.left),d},Gj(t,o,r));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function hO(e){const{width:t,height:n}=mN(e);return{width:t,height:n}}function mO(e,t,n){const a=Xs(t),r=ea(t),l=n==="fixed",i=Gr(e,!0,l,t);let o={scrollLeft:0,scrollTop:0};const c=Ys(0);function d(){c.x=eg(r)}if(a||!a&&!l)if((bi(t)!=="body"||gc(r))&&(o=df(t)),a){const x=Gr(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?xN(r,o):Ys(0),m=i.left+o.scrollLeft-c.x-f.x,h=i.top+o.scrollTop-c.y-f.y;return{x:m,y:h,width:i.width,height:i.height}}function Ah(e){return Es(e).position==="static"}function Vj(e,t){if(!Xs(e)||Es(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ea(e)===n&&(n=n.ownerDocument.body),n}function vN(e,t){const n=es(e);if(uf(e))return n;if(!Xs(e)){let r=or(e);for(;r&&!ri(r);){if(Ts(r)&&!Ah(r))return r;r=or(r)}return n}let a=Vj(e,t);for(;a&&nO(a)&&Ah(a);)a=Vj(a,t);return a&&ri(a)&&Ah(a)&&!Qx(a)?n:a||sO(e)||n}const pO=async function(e){const t=this.getOffsetParent||vN,n=this.getDimensions,a=await n(e.floating);return{reference:mO(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function xO(e){return Es(e).direction==="rtl"}const gO={convertOffsetParentRelativeRectToViewportRelativeRect:lO,getDocumentElement:ea,getClippingRect:fO,getOffsetParent:vN,getElementRects:pO,getClientRects:iO,getDimensions:hO,getScale:Gl,isElement:Ts,isRTL:xO};function jN(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function vO(e,t){let n=null,a;const r=ea(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:m,width:h,height:x}=d;if(o||t(),!h||!x)return;const j=Xc(m),v=Xc(r.clientWidth-(f+h)),y=Xc(r.clientHeight-(m+x)),g=Xc(f),b={rootMargin:-j+"px "+-v+"px "+-y+"px "+-g+"px",threshold:Kn(0,ir(1,c))||1};let w=!0;function S(C){const _=C[0].intersectionRatio;if(_!==c){if(!w)return i();_?i(!1,_):a=setTimeout(()=>{i(!1,1e-7)},1e3)}_===1&&!jN(d,e.getBoundingClientRect())&&i(),w=!1}try{n=new IntersectionObserver(S,{...b,root:r.ownerDocument})}catch{n=new IntersectionObserver(S,b)}n.observe(e)}return i(!0),l}function jO(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=Jx(e),f=r||l?[...d?Lo(d):[],...Lo(t)]:[];f.forEach(g=>{r&&g.addEventListener("scroll",n,{passive:!0}),l&&g.addEventListener("resize",n)});const m=d&&o?vO(d,n):null;let h=-1,x=null;i&&(x=new ResizeObserver(g=>{let[p]=g;p&&p.target===d&&x&&(x.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var b;(b=x)==null||b.observe(t)})),n()}),d&&!c&&x.observe(d),x.observe(t));let j,v=c?Gr(e):null;c&&y();function y(){const g=Gr(e);v&&!jN(v,g)&&n(),v=g,j=requestAnimationFrame(y)}return n(),()=>{var g;f.forEach(p=>{r&&p.removeEventListener("scroll",n),l&&p.removeEventListener("resize",n)}),m==null||m(),(g=x)==null||g.disconnect(),x=null,c&&cancelAnimationFrame(j)}}const yO=ZM,bO=JM,wO=XM,_O=tO,NO=WM,Yj=KM,kO=eO,SO=(e,t,n)=>{const a=new Map,r={platform:gO,...n},l={...r.platform,_c:a};return FM(e,t,{...r,platform:l})};var CO=typeof document<"u",RO=function(){},bu=CO?u.useLayoutEffect:RO;function fd(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(!fd(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)&&!fd(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function yN(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Fj(e,t){const n=yN(e);return Math.round(t*n)/n}function $h(e){const t=u.useRef(e);return bu(()=>{t.current=e}),t}function TO(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,m]=u.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,x]=u.useState(a);fd(h,a)||x(a);const[j,v]=u.useState(null),[y,g]=u.useState(null),p=u.useCallback(k=>{k!==C.current&&(C.current=k,v(k))},[]),b=u.useCallback(k=>{k!==_.current&&(_.current=k,g(k))},[]),w=l||j,S=i||y,C=u.useRef(null),_=u.useRef(null),N=u.useRef(f),O=c!=null,D=$h(c),B=$h(r),G=$h(d),U=u.useCallback(()=>{if(!C.current||!_.current)return;const k={placement:t,strategy:n,middleware:h};B.current&&(k.platform=B.current),SO(C.current,_.current,k).then(M=>{const Y={...M,isPositioned:G.current!==!1};R.current&&!fd(N.current,Y)&&(N.current=Y,ci.flushSync(()=>{m(Y)}))})},[h,t,n,B,G]);bu(()=>{d===!1&&N.current.isPositioned&&(N.current.isPositioned=!1,m(k=>({...k,isPositioned:!1})))},[d]);const R=u.useRef(!1);bu(()=>(R.current=!0,()=>{R.current=!1}),[]),bu(()=>{if(w&&(C.current=w),S&&(_.current=S),w&&S){if(D.current)return D.current(w,S,U);U()}},[w,S,U,D,O]);const $=u.useMemo(()=>({reference:C,floating:_,setReference:p,setFloating:b}),[p,b]),T=u.useMemo(()=>({reference:w,floating:S}),[w,S]),E=u.useMemo(()=>{const k={position:n,left:0,top:0};if(!T.floating)return k;const M=Fj(T.floating,f.x),Y=Fj(T.floating,f.y);return o?{...k,transform:"translate("+M+"px, "+Y+"px)",...yN(T.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:M,top:Y}},[n,o,T.floating,f.x,f.y]);return u.useMemo(()=>({...f,update:U,refs:$,elements:T,floatingStyles:E}),[f,U,$,T,E])}const EO=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?Yj({element:a.current,padding:r}).fn(n):{}:a?Yj({element:a,padding:r}).fn(n):{}}}},AO=(e,t)=>({...yO(e),options:[e,t]}),$O=(e,t)=>({...bO(e),options:[e,t]}),MO=(e,t)=>({...kO(e),options:[e,t]}),OO=(e,t)=>({...wO(e),options:[e,t]}),DO=(e,t)=>({..._O(e),options:[e,t]}),zO=(e,t)=>({...NO(e),options:[e,t]}),LO=(e,t)=>({...EO(e),options:[e,t]});var UO="Arrow",bN=u.forwardRef((e,t)=>{const{children:n,width:a=10,height:r=5,...l}=e;return s.jsx(ze.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"})})});bN.displayName=UO;var BO=bN,tg="Popper",[wN,wi]=Js(tg),[IO,_N]=wN(tg),NN=e=>{const{__scopePopper:t,children:n}=e,[a,r]=u.useState(null);return s.jsx(IO,{scope:t,anchor:a,onAnchorChange:r,children:n})};NN.displayName=tg;var kN="PopperAnchor",SN=u.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:a,...r}=e,l=_N(kN,n),i=u.useRef(null),o=st(t,i);return u.useEffect(()=>{l.onAnchorChange((a==null?void 0:a.current)||i.current)}),a?null:s.jsx(ze.div,{...r,ref:o})});SN.displayName=kN;var ng="PopperContent",[HO,PO]=wN(ng),CN=u.forwardRef((e,t)=>{var Q,ee,Ce,se,Se,me;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:m="partial",hideWhenDetached:h=!1,updatePositionStrategy:x="optimized",onPlaced:j,...v}=e,y=_N(ng,n),[g,p]=u.useState(null),b=st(t,be=>p(be)),[w,S]=u.useState(null),C=sN(w),_=(C==null?void 0:C.width)??0,N=(C==null?void 0:C.height)??0,O=a+(l!=="center"?"-"+l:""),D=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},B=Array.isArray(d)?d:[d],G=B.length>0,U={padding:D,boundary:B.filter(GO),altBoundary:G},{refs:R,floatingStyles:$,placement:T,isPositioned:E,middlewareData:k}=TO({strategy:"fixed",placement:O,whileElementsMounted:(...be)=>jO(...be,{animationFrame:x==="always"}),elements:{reference:y.anchor},middleware:[AO({mainAxis:r+N,alignmentAxis:i}),c&&$O({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?MO():void 0,...U}),c&&OO({...U}),DO({...U,apply:({elements:be,rects:ve,availableWidth:Ae,availableHeight:Z})=>{const{width:je,height:Ee}=ve.reference,Pe=be.floating.style;Pe.setProperty("--radix-popper-available-width",`${Ae}px`),Pe.setProperty("--radix-popper-available-height",`${Z}px`),Pe.setProperty("--radix-popper-anchor-width",`${je}px`),Pe.setProperty("--radix-popper-anchor-height",`${Ee}px`)}}),w&&LO({element:w,padding:o}),VO({arrowWidth:_,arrowHeight:N}),h&&zO({strategy:"referenceHidden",...U})]}),[M,Y]=EN(T),A=Ks(j);un(()=>{E&&(A==null||A())},[E,A]);const I=(Q=k.arrow)==null?void 0:Q.x,X=(ee=k.arrow)==null?void 0:ee.y,J=((Ce=k.arrow)==null?void 0:Ce.centerOffset)!==0,[ae,ke]=u.useState();return un(()=>{g&&ke(window.getComputedStyle(g).zIndex)},[g]),s.jsx("div",{ref:R.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:E?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ae,"--radix-popper-transform-origin":[(se=k.transformOrigin)==null?void 0:se.x,(Se=k.transformOrigin)==null?void 0:Se.y].join(" "),...((me=k.hide)==null?void 0:me.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(HO,{scope:n,placedSide:M,onArrowChange:S,arrowX:I,arrowY:X,shouldHideArrow:J,children:s.jsx(ze.div,{"data-side":M,"data-align":Y,...v,ref:b,style:{...v.style,animation:E?void 0:"none"}})})})});CN.displayName=ng;var RN="PopperArrow",qO={top:"bottom",right:"left",bottom:"top",left:"right"},TN=u.forwardRef(function(t,n){const{__scopePopper:a,...r}=t,l=PO(RN,a),i=qO[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(BO,{...r,ref:n,style:{...r.style,display:"block"}})})});TN.displayName=RN;function GO(e){return e!==null}var VO=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]=EN(n),m={start:"0%",center:"50%",end:"100%"}[f],h=(((g=r.arrow)==null?void 0:g.x)??0)+o/2,x=(((p=r.arrow)==null?void 0:p.y)??0)+c/2;let j="",v="";return d==="bottom"?(j=i?m:`${h}px`,v=`${-c}px`):d==="top"?(j=i?m:`${h}px`,v=`${a.floating.height+c}px`):d==="right"?(j=`${-c}px`,v=i?m:`${x}px`):d==="left"&&(j=`${a.floating.width+c}px`,v=i?m:`${x}px`),{data:{x:j,y:v}}}});function EN(e){const[t,n="center"]=e.split("-");return[t,n]}var sg=NN,ag=SN,rg=CN,lg=TN,Mh="rovingFocusGroup.onEntryFocus",YO={bubbles:!1,cancelable:!0},vc="RovingFocusGroup",[np,AN,FO]=Fx(vc),[KO,ff]=Js(vc,[FO]),[XO,WO]=KO(vc),$N=u.forwardRef((e,t)=>s.jsx(np.Provider,{scope:e.__scopeRovingFocusGroup,children:s.jsx(np.Slot,{scope:e.__scopeRovingFocusGroup,children:s.jsx(QO,{...e,ref:t})})}));$N.displayName=vc;var QO=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,...m}=e,h=u.useRef(null),x=st(t,h),j=of(l),[v,y]=lr({prop:i,defaultProp:o??null,onChange:c,caller:vc}),[g,p]=u.useState(!1),b=Ks(d),w=AN(n),S=u.useRef(!1),[C,_]=u.useState(0);return u.useEffect(()=>{const N=h.current;if(N)return N.addEventListener(Mh,b),()=>N.removeEventListener(Mh,b)},[b]),s.jsx(XO,{scope:n,orientation:a,dir:j,loop:r,currentTabStopId:v,onItemFocus:u.useCallback(N=>y(N),[y]),onItemShiftTab:u.useCallback(()=>p(!0),[]),onFocusableItemAdd:u.useCallback(()=>_(N=>N+1),[]),onFocusableItemRemove:u.useCallback(()=>_(N=>N-1),[]),children:s.jsx(ze.div,{tabIndex:g||C===0?-1:0,"data-orientation":a,...m,ref:x,style:{outline:"none",...e.style},onMouseDown:xe(e.onMouseDown,()=>{S.current=!0}),onFocus:xe(e.onFocus,N=>{const O=!S.current;if(N.target===N.currentTarget&&O&&!g){const D=new CustomEvent(Mh,YO);if(N.currentTarget.dispatchEvent(D),!D.defaultPrevented){const B=w().filter(T=>T.focusable),G=B.find(T=>T.active),U=B.find(T=>T.id===v),$=[G,U,...B].filter(Boolean).map(T=>T.ref.current);DN($,f)}}S.current=!1}),onBlur:xe(e.onBlur,()=>p(!1))})})}),MN="RovingFocusGroupItem",ON=u.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:a=!0,active:r=!1,tabStopId:l,children:i,...o}=e,c=Cs(),d=l||c,f=WO(MN,n),m=f.currentTabStopId===d,h=AN(n),{onFocusableItemAdd:x,onFocusableItemRemove:j,currentTabStopId:v}=f;return u.useEffect(()=>{if(a)return x(),()=>j()},[a,x,j]),s.jsx(np.ItemSlot,{scope:n,id:d,focusable:a,active:r,children:s.jsx(ze.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...o,ref:t,onMouseDown:xe(e.onMouseDown,y=>{a?f.onItemFocus(d):y.preventDefault()}),onFocus:xe(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:xe(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){f.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const g=e4(y,f.orientation,f.dir);if(g!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let b=h().filter(w=>w.focusable).map(w=>w.ref.current);if(g==="last")b.reverse();else if(g==="prev"||g==="next"){g==="prev"&&b.reverse();const w=b.indexOf(y.currentTarget);b=f.loop?t4(b,w+1):b.slice(w+1)}setTimeout(()=>DN(b))}}),children:typeof i=="function"?i({isCurrentTabStop:m,hasTabStop:v!=null}):i})})});ON.displayName=MN;var ZO={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function JO(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function e4(e,t,n){const a=JO(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(a))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(a)))return ZO[a]}function DN(e,t=!1){const n=document.activeElement;for(const a of e)if(a===n||(a.focus({preventScroll:t}),document.activeElement!==n))return}function t4(e,t){return e.map((n,a)=>e[(t+a)%e.length])}var zN=$N,LN=ON,sp=["Enter"," "],n4=["ArrowDown","PageUp","Home"],UN=["ArrowUp","PageDown","End"],s4=[...n4,...UN],a4={ltr:[...sp,"ArrowRight"],rtl:[...sp,"ArrowLeft"]},r4={ltr:["ArrowLeft"],rtl:["ArrowRight"]},jc="Menu",[Uo,l4,i4]=Fx(jc),[tl,BN]=Js(jc,[i4,wi,ff]),hf=wi(),IN=ff(),[o4,nl]=tl(jc),[c4,yc]=tl(jc),HN=e=>{const{__scopeMenu:t,open:n=!1,children:a,dir:r,onOpenChange:l,modal:i=!0}=e,o=hf(t),[c,d]=u.useState(null),f=u.useRef(!1),m=Ks(l),h=of(r);return u.useEffect(()=>{const x=()=>{f.current=!0,document.addEventListener("pointerdown",j,{capture:!0,once:!0}),document.addEventListener("pointermove",j,{capture:!0,once:!0})},j=()=>f.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",j,{capture:!0}),document.removeEventListener("pointermove",j,{capture:!0})}},[]),s.jsx(sg,{...o,children:s.jsx(o4,{scope:t,open:n,onOpenChange:m,content:c,onContentChange:d,children:s.jsx(c4,{scope:t,onClose:u.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:f,dir:h,modal:i,children:a})})})};HN.displayName=jc;var u4="MenuAnchor",ig=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e,r=hf(n);return s.jsx(ag,{...r,...a,ref:t})});ig.displayName=u4;var og="MenuPortal",[d4,PN]=tl(og,{forceMount:void 0}),qN=e=>{const{__scopeMenu:t,forceMount:n,children:a,container:r}=e,l=nl(og,t);return s.jsx(d4,{scope:t,forceMount:n,children:s.jsx(bs,{present:n||l.open,children:s.jsx(pc,{asChild:!0,container:r,children:a})})})};qN.displayName=og;var ps="MenuContent",[f4,cg]=tl(ps),GN=u.forwardRef((e,t)=>{const n=PN(ps,e.__scopeMenu),{forceMount:a=n.forceMount,...r}=e,l=nl(ps,e.__scopeMenu),i=yc(ps,e.__scopeMenu);return s.jsx(Uo.Provider,{scope:e.__scopeMenu,children:s.jsx(bs,{present:a||l.open,children:s.jsx(Uo.Slot,{scope:e.__scopeMenu,children:i.modal?s.jsx(h4,{...r,ref:t}):s.jsx(m4,{...r,ref:t})})})})}),h4=u.forwardRef((e,t)=>{const n=nl(ps,e.__scopeMenu),a=u.useRef(null),r=st(t,a);return u.useEffect(()=>{const l=a.current;if(l)return Mx(l)},[]),s.jsx(ug,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:xe(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),m4=u.forwardRef((e,t)=>{const n=nl(ps,e.__scopeMenu);return s.jsx(ug,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),p4=Pr("MenuContent.ScrollLock"),ug=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:m,onInteractOutside:h,onDismiss:x,disableOutsideScroll:j,...v}=e,y=nl(ps,n),g=yc(ps,n),p=hf(n),b=IN(n),w=l4(n),[S,C]=u.useState(null),_=u.useRef(null),N=st(t,_,y.onContentChange),O=u.useRef(0),D=u.useRef(""),B=u.useRef(0),G=u.useRef(null),U=u.useRef("right"),R=u.useRef(0),$=j?sf:u.Fragment,T=j?{as:p4,allowPinchZoom:!0}:void 0,E=M=>{var Q,ee;const Y=D.current+M,A=w().filter(Ce=>!Ce.disabled),I=document.activeElement,X=(Q=A.find(Ce=>Ce.ref.current===I))==null?void 0:Q.textValue,J=A.map(Ce=>Ce.textValue),ae=C4(J,Y,X),ke=(ee=A.find(Ce=>Ce.textValue===ae))==null?void 0:ee.ref.current;(function Ce(se){D.current=se,window.clearTimeout(O.current),se!==""&&(O.current=window.setTimeout(()=>Ce(""),1e3))})(Y),ke&&setTimeout(()=>ke.focus())};u.useEffect(()=>()=>window.clearTimeout(O.current),[]),$x();const k=u.useCallback(M=>{var A,I;return U.current===((A=G.current)==null?void 0:A.side)&&T4(M,(I=G.current)==null?void 0:I.area)},[]);return s.jsx(f4,{scope:n,searchRef:D,onItemEnter:u.useCallback(M=>{k(M)&&M.preventDefault()},[k]),onItemLeave:u.useCallback(M=>{var Y;k(M)||((Y=_.current)==null||Y.focus(),C(null))},[k]),onTriggerLeave:u.useCallback(M=>{k(M)&&M.preventDefault()},[k]),pointerGraceTimerRef:B,onPointerGraceIntentChange:u.useCallback(M=>{G.current=M},[]),children:s.jsx($,{...T,children:s.jsx(tf,{asChild:!0,trapped:r,onMountAutoFocus:xe(l,M=>{var Y;M.preventDefault(),(Y=_.current)==null||Y.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:s.jsx(mc,{asChild:!0,disableOutsidePointerEvents:o,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:h,onDismiss:x,children:s.jsx(zN,{asChild:!0,...b,dir:g.dir,orientation:"vertical",loop:a,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:xe(c,M=>{g.isUsingKeyboardRef.current||M.preventDefault()}),preventScrollOnEntryFocus:!0,children:s.jsx(rg,{role:"menu","aria-orientation":"vertical","data-state":lk(y.open),"data-radix-menu-content":"",dir:g.dir,...p,...v,ref:N,style:{outline:"none",...v.style},onKeyDown:xe(v.onKeyDown,M=>{const A=M.target.closest("[data-radix-menu-content]")===M.currentTarget,I=M.ctrlKey||M.altKey||M.metaKey,X=M.key.length===1;A&&(M.key==="Tab"&&M.preventDefault(),!I&&X&&E(M.key));const J=_.current;if(M.target!==J||!s4.includes(M.key))return;M.preventDefault();const ke=w().filter(Q=>!Q.disabled).map(Q=>Q.ref.current);UN.includes(M.key)&&ke.reverse(),k4(ke)}),onBlur:xe(e.onBlur,M=>{M.currentTarget.contains(M.target)||(window.clearTimeout(O.current),D.current="")}),onPointerMove:xe(e.onPointerMove,Bo(M=>{const Y=M.target,A=R.current!==M.clientX;if(M.currentTarget.contains(Y)&&A){const I=M.clientX>R.current?"right":"left";U.current=I,R.current=M.clientX}}))})})})})})})});GN.displayName=ps;var x4="MenuGroup",dg=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return s.jsx(ze.div,{role:"group",...a,ref:t})});dg.displayName=x4;var g4="MenuLabel",VN=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return s.jsx(ze.div,{...a,ref:t})});VN.displayName=g4;var hd="MenuItem",Kj="menu.itemSelect",mf=u.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:a,...r}=e,l=u.useRef(null),i=yc(hd,e.__scopeMenu),o=cg(hd,e.__scopeMenu),c=st(t,l),d=u.useRef(!1),f=()=>{const m=l.current;if(!n&&m){const h=new CustomEvent(Kj,{bubbles:!0,cancelable:!0});m.addEventListener(Kj,x=>a==null?void 0:a(x),{once:!0}),b_(m,h),h.defaultPrevented?d.current=!1:i.onClose()}};return s.jsx(YN,{...r,ref:c,disabled:n,onClick:xe(e.onClick,f),onPointerDown:m=>{var h;(h=e.onPointerDown)==null||h.call(e,m),d.current=!0},onPointerUp:xe(e.onPointerUp,m=>{var h;d.current||(h=m.currentTarget)==null||h.click()}),onKeyDown:xe(e.onKeyDown,m=>{const h=o.searchRef.current!=="";n||h&&m.key===" "||sp.includes(m.key)&&(m.currentTarget.click(),m.preventDefault())})})});mf.displayName=hd;var YN=u.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:a=!1,textValue:r,...l}=e,i=cg(hd,n),o=IN(n),c=u.useRef(null),d=st(t,c),[f,m]=u.useState(!1),[h,x]=u.useState("");return u.useEffect(()=>{const j=c.current;j&&x((j.textContent??"").trim())},[l.children]),s.jsx(Uo.ItemSlot,{scope:n,disabled:a,textValue:r??h,children:s.jsx(LN,{asChild:!0,...o,focusable:!a,children:s.jsx(ze.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":a||void 0,"data-disabled":a?"":void 0,...l,ref:d,onPointerMove:xe(e.onPointerMove,Bo(j=>{a?i.onItemLeave(j):(i.onItemEnter(j),j.defaultPrevented||j.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:xe(e.onPointerLeave,Bo(j=>i.onItemLeave(j))),onFocus:xe(e.onFocus,()=>m(!0)),onBlur:xe(e.onBlur,()=>m(!1))})})})}),v4="MenuCheckboxItem",FN=u.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:a,...r}=e;return s.jsx(ZN,{scope:e.__scopeMenu,checked:n,children:s.jsx(mf,{role:"menuitemcheckbox","aria-checked":md(n)?"mixed":n,...r,ref:t,"data-state":hg(n),onSelect:xe(r.onSelect,()=>a==null?void 0:a(md(n)?!0:!n),{checkForDefaultPrevented:!1})})})});FN.displayName=v4;var KN="MenuRadioGroup",[j4,y4]=tl(KN,{value:void 0,onValueChange:()=>{}}),XN=u.forwardRef((e,t)=>{const{value:n,onValueChange:a,...r}=e,l=Ks(a);return s.jsx(j4,{scope:e.__scopeMenu,value:n,onValueChange:l,children:s.jsx(dg,{...r,ref:t})})});XN.displayName=KN;var WN="MenuRadioItem",QN=u.forwardRef((e,t)=>{const{value:n,...a}=e,r=y4(WN,e.__scopeMenu),l=n===r.value;return s.jsx(ZN,{scope:e.__scopeMenu,checked:l,children:s.jsx(mf,{role:"menuitemradio","aria-checked":l,...a,ref:t,"data-state":hg(l),onSelect:xe(a.onSelect,()=>{var i;return(i=r.onValueChange)==null?void 0:i.call(r,n)},{checkForDefaultPrevented:!1})})})});QN.displayName=WN;var fg="MenuItemIndicator",[ZN,b4]=tl(fg,{checked:!1}),JN=u.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:a,...r}=e,l=b4(fg,n);return s.jsx(bs,{present:a||md(l.checked)||l.checked===!0,children:s.jsx(ze.span,{...r,ref:t,"data-state":hg(l.checked)})})});JN.displayName=fg;var w4="MenuSeparator",ek=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return s.jsx(ze.div,{role:"separator","aria-orientation":"horizontal",...a,ref:t})});ek.displayName=w4;var _4="MenuArrow",tk=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e,r=hf(n);return s.jsx(lg,{...r,...a,ref:t})});tk.displayName=_4;var N4="MenuSub",[QB,nk]=tl(N4),Qi="MenuSubTrigger",sk=u.forwardRef((e,t)=>{const n=nl(Qi,e.__scopeMenu),a=yc(Qi,e.__scopeMenu),r=nk(Qi,e.__scopeMenu),l=cg(Qi,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 m=o.current;return()=>{window.clearTimeout(m),c(null)}},[o,c]),s.jsx(ig,{asChild:!0,...d,children:s.jsx(YN,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":r.contentId,"data-state":lk(n.open),...e,ref:ef(t,r.onTriggerChange),onClick:m=>{var h;(h=e.onClick)==null||h.call(e,m),!(e.disabled||m.defaultPrevented)&&(m.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:xe(e.onPointerMove,Bo(m=>{l.onItemEnter(m),!m.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(l.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:xe(e.onPointerLeave,Bo(m=>{var x,j;f();const h=(x=n.content)==null?void 0:x.getBoundingClientRect();if(h){const v=(j=n.content)==null?void 0:j.dataset.side,y=v==="right",g=y?-5:5,p=h[y?"left":"right"],b=h[y?"right":"left"];l.onPointerGraceIntentChange({area:[{x:m.clientX+g,y:m.clientY},{x:p,y:h.top},{x:b,y:h.top},{x:b,y:h.bottom},{x:p,y:h.bottom}],side:v}),window.clearTimeout(o.current),o.current=window.setTimeout(()=>l.onPointerGraceIntentChange(null),300)}else{if(l.onTriggerLeave(m),m.defaultPrevented)return;l.onPointerGraceIntentChange(null)}})),onKeyDown:xe(e.onKeyDown,m=>{var x;const h=l.searchRef.current!=="";e.disabled||h&&m.key===" "||a4[a.dir].includes(m.key)&&(n.onOpenChange(!0),(x=n.content)==null||x.focus(),m.preventDefault())})})})});sk.displayName=Qi;var ak="MenuSubContent",rk=u.forwardRef((e,t)=>{const n=PN(ps,e.__scopeMenu),{forceMount:a=n.forceMount,...r}=e,l=nl(ps,e.__scopeMenu),i=yc(ps,e.__scopeMenu),o=nk(ak,e.__scopeMenu),c=u.useRef(null),d=st(t,c);return s.jsx(Uo.Provider,{scope:e.__scopeMenu,children:s.jsx(bs,{present:a||l.open,children:s.jsx(Uo.Slot,{scope:e.__scopeMenu,children:s.jsx(ug,{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 m;i.isUsingKeyboardRef.current&&((m=c.current)==null||m.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:xe(e.onFocusOutside,f=>{f.target!==o.trigger&&l.onOpenChange(!1)}),onEscapeKeyDown:xe(e.onEscapeKeyDown,f=>{i.onClose(),f.preventDefault()}),onKeyDown:xe(e.onKeyDown,f=>{var x;const m=f.currentTarget.contains(f.target),h=r4[i.dir].includes(f.key);m&&h&&(l.onOpenChange(!1),(x=o.trigger)==null||x.focus(),f.preventDefault())})})})})})});rk.displayName=ak;function lk(e){return e?"open":"closed"}function md(e){return e==="indeterminate"}function hg(e){return md(e)?"indeterminate":e?"checked":"unchecked"}function k4(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function S4(e,t){return e.map((n,a)=>e[(t+a)%e.length])}function C4(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=S4(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 R4(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,m=c.x,h=c.y;f>a!=h>a&&n<(m-d)*(a-f)/(h-f)+d&&(r=!r)}return r}function T4(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return R4(n,t)}function Bo(e){return t=>t.pointerType==="mouse"?e(t):void 0}var E4=HN,A4=ig,$4=qN,M4=GN,O4=dg,D4=VN,z4=mf,L4=FN,U4=XN,B4=QN,I4=JN,H4=ek,P4=tk,q4=sk,G4=rk,pf="DropdownMenu",[V4]=Js(pf,[BN]),Cn=BN(),[Y4,ik]=V4(pf),ok=e=>{const{__scopeDropdownMenu:t,children:n,dir:a,open:r,defaultOpen:l,onOpenChange:i,modal:o=!0}=e,c=Cn(t),d=u.useRef(null),[f,m]=lr({prop:r,defaultProp:l??!1,onChange:i,caller:pf});return s.jsx(Y4,{scope:t,triggerId:Cs(),triggerRef:d,contentId:Cs(),open:f,onOpenChange:m,onOpenToggle:u.useCallback(()=>m(h=>!h),[m]),modal:o,children:s.jsx(E4,{...c,open:f,onOpenChange:m,dir:a,modal:o,children:n})})};ok.displayName=pf;var ck="DropdownMenuTrigger",uk=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:a=!1,...r}=e,l=ik(ck,n),i=Cn(n);return s.jsx(A4,{asChild:!0,...i,children:s.jsx(ze.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:ef(t,l.triggerRef),onPointerDown:xe(e.onPointerDown,o=>{!a&&o.button===0&&o.ctrlKey===!1&&(l.onOpenToggle(),l.open||o.preventDefault())}),onKeyDown:xe(e.onKeyDown,o=>{a||(["Enter"," "].includes(o.key)&&l.onOpenToggle(),o.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(o.key)&&o.preventDefault())})})})});uk.displayName=ck;var F4="DropdownMenuPortal",dk=e=>{const{__scopeDropdownMenu:t,...n}=e,a=Cn(t);return s.jsx($4,{...a,...n})};dk.displayName=F4;var fk="DropdownMenuContent",hk=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=ik(fk,n),l=Cn(n),i=u.useRef(!1);return s.jsx(M4,{id:r.contentId,"aria-labelledby":r.triggerId,...l,...a,ref:t,onCloseAutoFocus:xe(e.onCloseAutoFocus,o=>{var c;i.current||(c=r.triggerRef.current)==null||c.focus(),i.current=!1,o.preventDefault()}),onInteractOutside:xe(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)"}})});hk.displayName=fk;var K4="DropdownMenuGroup",X4=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Cn(n);return s.jsx(O4,{...r,...a,ref:t})});X4.displayName=K4;var W4="DropdownMenuLabel",mk=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Cn(n);return s.jsx(D4,{...r,...a,ref:t})});mk.displayName=W4;var Q4="DropdownMenuItem",pk=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Cn(n);return s.jsx(z4,{...r,...a,ref:t})});pk.displayName=Q4;var Z4="DropdownMenuCheckboxItem",xk=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Cn(n);return s.jsx(L4,{...r,...a,ref:t})});xk.displayName=Z4;var J4="DropdownMenuRadioGroup",eD=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Cn(n);return s.jsx(U4,{...r,...a,ref:t})});eD.displayName=J4;var tD="DropdownMenuRadioItem",gk=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Cn(n);return s.jsx(B4,{...r,...a,ref:t})});gk.displayName=tD;var nD="DropdownMenuItemIndicator",vk=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Cn(n);return s.jsx(I4,{...r,...a,ref:t})});vk.displayName=nD;var sD="DropdownMenuSeparator",jk=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Cn(n);return s.jsx(H4,{...r,...a,ref:t})});jk.displayName=sD;var aD="DropdownMenuArrow",rD=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Cn(n);return s.jsx(P4,{...r,...a,ref:t})});rD.displayName=aD;var lD="DropdownMenuSubTrigger",yk=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Cn(n);return s.jsx(q4,{...r,...a,ref:t})});yk.displayName=lD;var iD="DropdownMenuSubContent",bk=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=Cn(n);return s.jsx(G4,{...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)"}})});bk.displayName=iD;var oD=ok,cD=uk,uD=dk,wk=hk,_k=mk,Nk=pk,kk=xk,Sk=gk,Ck=vk,Rk=jk,Tk=yk,Ek=bk;const xf=oD,gf=cD,dD=u.forwardRef(({className:e,inset:t,children:n,...a},r)=>s.jsxs(Tk,{ref:r,className:de("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(dc,{className:"ml-auto"})]}));dD.displayName=Tk.displayName;const fD=u.forwardRef(({className:e,...t},n)=>s.jsx(Ek,{ref:n,className:de("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}));fD.displayName=Ek.displayName;const bc=u.forwardRef(({className:e,sideOffset:t=4,...n},a)=>s.jsx(uD,{container:xc(),children:s.jsx(wk,{ref:a,sideOffset:t,className:de("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})}));bc.displayName=wk.displayName;const li=u.forwardRef(({className:e,inset:t,...n},a)=>s.jsx(Nk,{ref:a,className:de("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}));li.displayName=Nk.displayName;const hD=u.forwardRef(({className:e,children:t,checked:n,...a},r)=>s.jsxs(kk,{ref:r,className:de("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(Ck,{children:s.jsx(Zr,{className:"h-4 w-4"})})}),t]}));hD.displayName=kk.displayName;const mD=u.forwardRef(({className:e,children:t,...n},a)=>s.jsxs(Sk,{ref:a,className:de("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(Ck,{children:s.jsx(GT,{className:"h-2 w-2 fill-current"})})}),t]}));mD.displayName=Sk.displayName;const pD=u.forwardRef(({className:e,inset:t,...n},a)=>s.jsx(_k,{ref:a,className:de("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));pD.displayName=_k.displayName;const xD=u.forwardRef(({className:e,...t},n)=>s.jsx(Rk,{ref:n,className:de("-mx-1 my-1 h-px bg-muted",e),...t}));xD.displayName=Rk.displayName;const gD={default:"h-9 px-3 py-1 text-sm",control:"h-7 px-2 py-1 text-xs"},pt=u.forwardRef(({className:e,type:t,inputSize:n="default",...a},r)=>s.jsx("input",{type:t,className:de("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",gD[n],e),ref:r,...a}));pt.displayName="Input";var vD="Label",Ak=u.forwardRef((e,t)=>s.jsx(ze.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())}}));Ak.displayName=vD;var $k=Ak;const jD=hc("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Oe=u.forwardRef(({className:e,...t},n)=>s.jsx($k,{ref:n,className:de(jD(),e),...t}));Oe.displayName=$k.displayName;function fr({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:de("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:de("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 sn({title:e,description:t,actions:n,className:a,children:r,...l}){return s.jsxs("header",{"data-slot":"page-header",className:de("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 mt({as:e="div",className:t,...n}){return s.jsx(e,{className:de("rounded-lg border",t),...n})}function Xj(e,[t,n]){return Math.min(n,Math.max(t,e))}var Mk=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"}),yD="VisuallyHidden",Ok=u.forwardRef((e,t)=>s.jsx(ze.span,{...e,ref:t,style:{...Mk,...e.style}}));Ok.displayName=yD;var bD=Ok,wD=[" ","Enter","ArrowUp","ArrowDown"],_D=[" ","Enter"],Vr="Select",[vf,jf,ND]=Fx(Vr),[_i]=Js(Vr,[ND,wi]),yf=wi(),[kD,hr]=_i(Vr),[SD,CD]=_i(Vr),Dk=e=>{const{__scopeSelect:t,children:n,open:a,defaultOpen:r,onOpenChange:l,value:i,defaultValue:o,onValueChange:c,dir:d,name:f,autoComplete:m,disabled:h,required:x,form:j}=e,v=yf(t),[y,g]=u.useState(null),[p,b]=u.useState(null),[w,S]=u.useState(!1),C=of(d),[_,N]=lr({prop:a,defaultProp:r??!1,onChange:l,caller:Vr}),[O,D]=lr({prop:i,defaultProp:o,onChange:c,caller:Vr}),B=u.useRef(null),G=y?j||!!y.closest("form"):!0,[U,R]=u.useState(new Set),$=Array.from(U).map(T=>T.props.value).join(";");return s.jsx(sg,{...v,children:s.jsxs(kD,{required:x,scope:t,trigger:y,onTriggerChange:g,valueNode:p,onValueNodeChange:b,valueNodeHasChildren:w,onValueNodeHasChildrenChange:S,contentId:Cs(),value:O,onValueChange:D,open:_,onOpenChange:N,dir:C,triggerPointerDownPosRef:B,disabled:h,children:[s.jsx(vf.Provider,{scope:t,children:s.jsx(SD,{scope:e.__scopeSelect,onNativeOptionAdd:u.useCallback(T=>{R(E=>new Set(E).add(T))},[]),onNativeOptionRemove:u.useCallback(T=>{R(E=>{const k=new Set(E);return k.delete(T),k})},[]),children:n})}),G?s.jsxs(r1,{"aria-hidden":!0,required:x,tabIndex:-1,name:f,autoComplete:m,value:O,onChange:T=>D(T.target.value),disabled:h,form:j,children:[O===void 0?s.jsx("option",{value:""}):null,Array.from(U)]},$):null]})})};Dk.displayName=Vr;var zk="SelectTrigger",Lk=u.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:a=!1,...r}=e,l=yf(n),i=hr(zk,n),o=i.disabled||a,c=st(t,i.onTriggerChange),d=jf(n),f=u.useRef("touch"),[m,h,x]=i1(v=>{const y=d().filter(b=>!b.disabled),g=y.find(b=>b.value===i.value),p=o1(y,v,g);p!==void 0&&i.onValueChange(p.value)}),j=v=>{o||(i.onOpenChange(!0),x()),v&&(i.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})};return s.jsx(ag,{asChild:!0,...l,children:s.jsx(ze.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":l1(i.value)?"":void 0,...r,ref:c,onClick:xe(r.onClick,v=>{v.currentTarget.focus(),f.current!=="mouse"&&j(v)}),onPointerDown:xe(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"&&(j(v),v.preventDefault())}),onKeyDown:xe(r.onKeyDown,v=>{const y=m.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&h(v.key),!(y&&v.key===" ")&&wD.includes(v.key)&&(j(),v.preventDefault())})})})});Lk.displayName=zk;var Uk="SelectValue",Bk=u.forwardRef((e,t)=>{const{__scopeSelect:n,className:a,style:r,children:l,placeholder:i="",...o}=e,c=hr(Uk,n),{onValueNodeHasChildrenChange:d}=c,f=l!==void 0,m=st(t,c.onValueNodeChange);return un(()=>{d(f)},[d,f]),s.jsx(ze.span,{...o,ref:m,style:{pointerEvents:"none"},children:l1(c.value)?s.jsx(s.Fragment,{children:i}):l})});Bk.displayName=Uk;var RD="SelectIcon",Ik=u.forwardRef((e,t)=>{const{__scopeSelect:n,children:a,...r}=e;return s.jsx(ze.span,{"aria-hidden":!0,...r,ref:t,children:a||"▼"})});Ik.displayName=RD;var TD="SelectPortal",Hk=e=>s.jsx(pc,{asChild:!0,...e});Hk.displayName=TD;var Yr="SelectContent",Pk=u.forwardRef((e,t)=>{const n=hr(Yr,e.__scopeSelect),[a,r]=u.useState();if(un(()=>{r(new DocumentFragment)},[]),!n.open){const l=a;return l?ci.createPortal(s.jsx(qk,{scope:e.__scopeSelect,children:s.jsx(vf.Slot,{scope:e.__scopeSelect,children:s.jsx("div",{children:e.children})})}),l):null}return s.jsx(Gk,{...e,ref:t})});Pk.displayName=Yr;var _s=10,[qk,mr]=_i(Yr),ED="SelectContentImpl",AD=Pr("SelectContent.RemoveScroll"),Gk=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:m,collisionBoundary:h,collisionPadding:x,sticky:j,hideWhenDetached:v,avoidCollisions:y,...g}=e,p=hr(Yr,n),[b,w]=u.useState(null),[S,C]=u.useState(null),_=st(t,Q=>w(Q)),[N,O]=u.useState(null),[D,B]=u.useState(null),G=jf(n),[U,R]=u.useState(!1),$=u.useRef(!1);u.useEffect(()=>{if(b)return Mx(b)},[b]),$x();const T=u.useCallback(Q=>{const[ee,...Ce]=G().map(me=>me.ref.current),[se]=Ce.slice(-1),Se=document.activeElement;for(const me of Q)if(me===Se||(me==null||me.scrollIntoView({block:"nearest"}),me===ee&&S&&(S.scrollTop=0),me===se&&S&&(S.scrollTop=S.scrollHeight),me==null||me.focus(),document.activeElement!==Se))return},[G,S]),E=u.useCallback(()=>T([N,b]),[T,N,b]);u.useEffect(()=>{U&&E()},[U,E]);const{onOpenChange:k,triggerPointerDownPosRef:M}=p;u.useEffect(()=>{if(b){let Q={x:0,y:0};const ee=se=>{var Se,me;Q={x:Math.abs(Math.round(se.pageX)-(((Se=M.current)==null?void 0:Se.x)??0)),y:Math.abs(Math.round(se.pageY)-(((me=M.current)==null?void 0:me.y)??0))}},Ce=se=>{Q.x<=10&&Q.y<=10?se.preventDefault():b.contains(se.target)||k(!1),document.removeEventListener("pointermove",ee),M.current=null};return M.current!==null&&(document.addEventListener("pointermove",ee),document.addEventListener("pointerup",Ce,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ee),document.removeEventListener("pointerup",Ce,{capture:!0})}}},[b,k,M]),u.useEffect(()=>{const Q=()=>k(!1);return window.addEventListener("blur",Q),window.addEventListener("resize",Q),()=>{window.removeEventListener("blur",Q),window.removeEventListener("resize",Q)}},[k]);const[Y,A]=i1(Q=>{const ee=G().filter(Se=>!Se.disabled),Ce=ee.find(Se=>Se.ref.current===document.activeElement),se=o1(ee,Q,Ce);se&&setTimeout(()=>se.ref.current.focus())}),I=u.useCallback((Q,ee,Ce)=>{const se=!$.current&&!Ce;(p.value!==void 0&&p.value===ee||se)&&(O(Q),se&&($.current=!0))},[p.value]),X=u.useCallback(()=>b==null?void 0:b.focus(),[b]),J=u.useCallback((Q,ee,Ce)=>{const se=!$.current&&!Ce;(p.value!==void 0&&p.value===ee||se)&&B(Q)},[p.value]),ae=a==="popper"?ap:Vk,ke=ae===ap?{side:o,sideOffset:c,align:d,alignOffset:f,arrowPadding:m,collisionBoundary:h,collisionPadding:x,sticky:j,hideWhenDetached:v,avoidCollisions:y}:{};return s.jsx(qk,{scope:n,content:b,viewport:S,onViewportChange:C,itemRefCallback:I,selectedItem:N,onItemLeave:X,itemTextRefCallback:J,focusSelectedItem:E,selectedItemText:D,position:a,isPositioned:U,searchRef:Y,children:s.jsx(sf,{as:AD,allowPinchZoom:!0,children:s.jsx(tf,{asChild:!0,trapped:p.open,onMountAutoFocus:Q=>{Q.preventDefault()},onUnmountAutoFocus:xe(r,Q=>{var ee;(ee=p.trigger)==null||ee.focus({preventScroll:!0}),Q.preventDefault()}),children:s.jsx(mc,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:i,onFocusOutside:Q=>Q.preventDefault(),onDismiss:()=>p.onOpenChange(!1),children:s.jsx(ae,{role:"listbox",id:p.contentId,"data-state":p.open?"open":"closed",dir:p.dir,onContextMenu:Q=>Q.preventDefault(),...g,...ke,onPlaced:()=>R(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:xe(g.onKeyDown,Q=>{const ee=Q.ctrlKey||Q.altKey||Q.metaKey;if(Q.key==="Tab"&&Q.preventDefault(),!ee&&Q.key.length===1&&A(Q.key),["ArrowUp","ArrowDown","Home","End"].includes(Q.key)){let se=G().filter(Se=>!Se.disabled).map(Se=>Se.ref.current);if(["ArrowUp","End"].includes(Q.key)&&(se=se.slice().reverse()),["ArrowUp","ArrowDown"].includes(Q.key)){const Se=Q.target,me=se.indexOf(Se);se=se.slice(me+1)}setTimeout(()=>T(se)),Q.preventDefault()}})})})})})})});Gk.displayName=ED;var $D="SelectItemAlignedPosition",Vk=u.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:a,...r}=e,l=hr(Yr,n),i=mr(Yr,n),[o,c]=u.useState(null),[d,f]=u.useState(null),m=st(t,_=>f(_)),h=jf(n),x=u.useRef(!1),j=u.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:g,focusSelectedItem:p}=i,b=u.useCallback(()=>{if(l.trigger&&l.valueNode&&o&&d&&v&&y&&g){const _=l.trigger.getBoundingClientRect(),N=d.getBoundingClientRect(),O=l.valueNode.getBoundingClientRect(),D=g.getBoundingClientRect();if(l.dir!=="rtl"){const Se=D.left-N.left,me=O.left-Se,be=_.left-me,ve=_.width+be,Ae=Math.max(ve,N.width),Z=window.innerWidth-_s,je=Xj(me,[_s,Math.max(_s,Z-Ae)]);o.style.minWidth=ve+"px",o.style.left=je+"px"}else{const Se=N.right-D.right,me=window.innerWidth-O.right-Se,be=window.innerWidth-_.right-me,ve=_.width+be,Ae=Math.max(ve,N.width),Z=window.innerWidth-_s,je=Xj(me,[_s,Math.max(_s,Z-Ae)]);o.style.minWidth=ve+"px",o.style.right=je+"px"}const B=h(),G=window.innerHeight-_s*2,U=v.scrollHeight,R=window.getComputedStyle(d),$=parseInt(R.borderTopWidth,10),T=parseInt(R.paddingTop,10),E=parseInt(R.borderBottomWidth,10),k=parseInt(R.paddingBottom,10),M=$+T+U+k+E,Y=Math.min(y.offsetHeight*5,M),A=window.getComputedStyle(v),I=parseInt(A.paddingTop,10),X=parseInt(A.paddingBottom,10),J=_.top+_.height/2-_s,ae=G-J,ke=y.offsetHeight/2,Q=y.offsetTop+ke,ee=$+T+Q,Ce=M-ee;if(ee<=J){const Se=B.length>0&&y===B[B.length-1].ref.current;o.style.bottom="0px";const me=d.clientHeight-v.offsetTop-v.offsetHeight,be=Math.max(ae,ke+(Se?X:0)+me+E),ve=ee+be;o.style.height=ve+"px"}else{const Se=B.length>0&&y===B[0].ref.current;o.style.top="0px";const be=Math.max(J,$+v.offsetTop+(Se?I:0)+ke)+Ce;o.style.height=be+"px",v.scrollTop=ee-J+v.offsetTop}o.style.margin=`${_s}px 0`,o.style.minHeight=Y+"px",o.style.maxHeight=G+"px",a==null||a(),requestAnimationFrame(()=>x.current=!0)}},[h,l.trigger,l.valueNode,o,d,v,y,g,l.dir,a]);un(()=>b(),[b]);const[w,S]=u.useState();un(()=>{d&&S(window.getComputedStyle(d).zIndex)},[d]);const C=u.useCallback(_=>{_&&j.current===!0&&(b(),p==null||p(),j.current=!1)},[b,p]);return s.jsx(OD,{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(ze.div,{...r,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});Vk.displayName=$D;var MD="SelectPopperPosition",ap=u.forwardRef((e,t)=>{const{__scopeSelect:n,align:a="start",collisionPadding:r=_s,...l}=e,i=yf(n);return s.jsx(rg,{...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)"}})});ap.displayName=MD;var[OD,mg]=_i(Yr,{}),rp="SelectViewport",Yk=u.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:a,...r}=e,l=mr(rp,n),i=mg(rp,n),o=st(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(vf.Slot,{scope:n,children:s.jsx(ze.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:o,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:xe(r.onScroll,d=>{const f=d.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:h}=i;if(h!=null&&h.current&&m){const x=Math.abs(c.current-f.scrollTop);if(x>0){const j=window.innerHeight-_s*2,v=parseFloat(m.style.minHeight),y=parseFloat(m.style.height),g=Math.max(v,y);if(g<j){const p=g+x,b=Math.min(j,p),w=p-b;m.style.height=b+"px",m.style.bottom==="0px"&&(f.scrollTop=w>0?w:0,m.style.justifyContent="flex-end")}}}c.current=f.scrollTop})})})]})});Yk.displayName=rp;var Fk="SelectGroup",[DD,zD]=_i(Fk),LD=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,r=Cs();return s.jsx(DD,{scope:n,id:r,children:s.jsx(ze.div,{role:"group","aria-labelledby":r,...a,ref:t})})});LD.displayName=Fk;var Kk="SelectLabel",Xk=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,r=zD(Kk,n);return s.jsx(ze.div,{id:r.id,...a,ref:t})});Xk.displayName=Kk;var pd="SelectItem",[UD,Wk]=_i(pd),Qk=u.forwardRef((e,t)=>{const{__scopeSelect:n,value:a,disabled:r=!1,textValue:l,...i}=e,o=hr(pd,n),c=mr(pd,n),d=o.value===a,[f,m]=u.useState(l??""),[h,x]=u.useState(!1),j=st(t,p=>{var b;return(b=c.itemRefCallback)==null?void 0:b.call(c,p,a,r)}),v=Cs(),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(UD,{scope:n,value:a,disabled:r,textId:v,isSelected:d,onItemTextChange:u.useCallback(p=>{m(b=>b||((p==null?void 0:p.textContent)??"").trim())},[]),children:s.jsx(vf.ItemSlot,{scope:n,value:a,disabled:r,textValue:f,children:s.jsx(ze.div,{role:"option","aria-labelledby":v,"data-highlighted":h?"":void 0,"aria-selected":d&&h,"data-state":d?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...i,ref:j,onFocus:xe(i.onFocus,()=>x(!0)),onBlur:xe(i.onBlur,()=>x(!1)),onClick:xe(i.onClick,()=>{y.current!=="mouse"&&g()}),onPointerUp:xe(i.onPointerUp,()=>{y.current==="mouse"&&g()}),onPointerDown:xe(i.onPointerDown,p=>{y.current=p.pointerType}),onPointerMove:xe(i.onPointerMove,p=>{var b;y.current=p.pointerType,r?(b=c.onItemLeave)==null||b.call(c):y.current==="mouse"&&p.currentTarget.focus({preventScroll:!0})}),onPointerLeave:xe(i.onPointerLeave,p=>{var b;p.currentTarget===document.activeElement&&((b=c.onItemLeave)==null||b.call(c))}),onKeyDown:xe(i.onKeyDown,p=>{var w;((w=c.searchRef)==null?void 0:w.current)!==""&&p.key===" "||(_D.includes(p.key)&&g(),p.key===" "&&p.preventDefault())})})})})});Qk.displayName=pd;var Zi="SelectItemText",Zk=u.forwardRef((e,t)=>{const{__scopeSelect:n,className:a,style:r,...l}=e,i=hr(Zi,n),o=mr(Zi,n),c=Wk(Zi,n),d=CD(Zi,n),[f,m]=u.useState(null),h=st(t,g=>m(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,j=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 un(()=>(v(j),()=>y(j)),[v,y,j]),s.jsxs(s.Fragment,{children:[s.jsx(ze.span,{id:c.textId,...l,ref:h}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?ci.createPortal(l.children,i.valueNode):null]})});Zk.displayName=Zi;var Jk="SelectItemIndicator",e1=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e;return Wk(Jk,n).isSelected?s.jsx(ze.span,{"aria-hidden":!0,...a,ref:t}):null});e1.displayName=Jk;var lp="SelectScrollUpButton",t1=u.forwardRef((e,t)=>{const n=mr(lp,e.__scopeSelect),a=mg(lp,e.__scopeSelect),[r,l]=u.useState(!1),i=st(t,a.onScrollButtonChange);return un(()=>{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(s1,{...e,ref:i,onAutoScroll:()=>{const{viewport:o,selectedItem:c}=n;o&&c&&(o.scrollTop=o.scrollTop-c.offsetHeight)}}):null});t1.displayName=lp;var ip="SelectScrollDownButton",n1=u.forwardRef((e,t)=>{const n=mr(ip,e.__scopeSelect),a=mg(ip,e.__scopeSelect),[r,l]=u.useState(!1),i=st(t,a.onScrollButtonChange);return un(()=>{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(s1,{...e,ref:i,onAutoScroll:()=>{const{viewport:o,selectedItem:c}=n;o&&c&&(o.scrollTop=o.scrollTop+c.offsetHeight)}}):null});n1.displayName=ip;var s1=u.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:a,...r}=e,l=mr("SelectScrollButton",n),i=u.useRef(null),o=jf(n),c=u.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return u.useEffect(()=>()=>c(),[c]),un(()=>{var f;const d=o().find(m=>m.ref.current===document.activeElement);(f=d==null?void 0:d.ref.current)==null||f.scrollIntoView({block:"nearest"})},[o]),s.jsx(ze.div,{"aria-hidden":!0,...r,ref:t,style:{flexShrink:0,...r.style},onPointerDown:xe(r.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(a,50))}),onPointerMove:xe(r.onPointerMove,()=>{var d;(d=l.onItemLeave)==null||d.call(l),i.current===null&&(i.current=window.setInterval(a,50))}),onPointerLeave:xe(r.onPointerLeave,()=>{c()})})}),BD="SelectSeparator",a1=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e;return s.jsx(ze.div,{"aria-hidden":!0,...a,ref:t})});a1.displayName=BD;var op="SelectArrow",ID=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,r=yf(n),l=hr(op,n),i=mr(op,n);return l.open&&i.position==="popper"?s.jsx(lg,{...r,...a,ref:t}):null});ID.displayName=op;var HD="SelectBubbleInput",r1=u.forwardRef(({__scopeSelect:e,value:t,...n},a)=>{const r=u.useRef(null),l=st(a,r),i=nN(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 m=new Event("change",{bubbles:!0});f.call(o,t),o.dispatchEvent(m)}},[i,t]),s.jsx(ze.select,{...n,style:{...Mk,...n.style},ref:l,defaultValue:t})});r1.displayName=HD;function l1(e){return e===""||e===void 0}function i1(e){const t=Ks(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 o1(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=PD(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 PD(e,t){return e.map((n,a)=>e[(t+a)%e.length])}var qD=Dk,c1=Lk,GD=Bk,VD=Ik,YD=Hk,u1=Pk,FD=Yk,d1=Xk,f1=Qk,KD=Zk,XD=e1,h1=t1,m1=n1,p1=a1;const WD={default:"h-9 px-3 py-2 text-sm",control:"h-7 px-2 py-1 text-xs"},Nt=qD,kt=GD,xt=u.forwardRef(({className:e,children:t,triggerSize:n="default",...a},r)=>s.jsxs(c1,{ref:r,className:de("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",WD[n],e),...a,children:[t,s.jsx(VD,{asChild:!0,children:s.jsx(e_,{className:"text-muted-foreground size-4","aria-hidden":"true"})})]}));xt.displayName=c1.displayName;const x1=u.forwardRef(({className:e,...t},n)=>s.jsx(h1,{ref:n,className:de("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(BT,{className:"size-4","aria-hidden":"true"})}));x1.displayName=h1.displayName;const g1=u.forwardRef(({className:e,...t},n)=>s.jsx(m1,{ref:n,className:de("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(Kd,{className:"size-4","aria-hidden":"true"})}));g1.displayName=m1.displayName;const gt=u.forwardRef(({className:e,children:t,position:n="popper",...a},r)=>s.jsx(YD,{container:xc(),children:s.jsxs(u1,{ref:r,className:de("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(x1,{}),s.jsx(FD,{className:de("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),s.jsx(g1,{})]})}));gt.displayName=u1.displayName;const QD=u.forwardRef(({className:e,...t},n)=>s.jsx(d1,{ref:n,className:de("px-2 py-1.5 text-sm font-semibold",e),...t}));QD.displayName=d1.displayName;const De=u.forwardRef(({className:e,children:t,...n},a)=>s.jsxs(f1,{ref:a,className:de("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(XD,{children:s.jsx(Zr,{className:"size-4","aria-hidden":"true"})})}),s.jsx(KD,{children:t})]}));De.displayName=f1.displayName;const ZD=u.forwardRef(({className:e,...t},n)=>s.jsx(p1,{ref:n,className:de("-mx-1 my-1 h-px bg-muted",e),...t}));ZD.displayName=p1.displayName;function Ct({className:e,...t}){return s.jsx("div",{className:de("animate-pulse rounded-md bg-primary/10",e),...t})}const Fe=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:de("relative w-full overflow-auto",t),children:s.jsx("table",{ref:i,className:de("w-full caption-bottom text-sm",e),...l})}));Fe.displayName="Table";const Qe=u.forwardRef(({className:e,...t},n)=>s.jsx("thead",{ref:n,className:de("[&_tr]:border-b",e),...t}));Qe.displayName="TableHeader";const Ke=u.forwardRef(({className:e,...t},n)=>s.jsx("tbody",{ref:n,className:de("[&_tr:last-child]:border-0",e),...t}));Ke.displayName="TableBody";const JD=u.forwardRef(({className:e,...t},n)=>s.jsx("tfoot",{ref:n,className:de("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t}));JD.displayName="TableFooter";const ue=u.forwardRef(({className:e,...t},n)=>s.jsx("tr",{ref:n,className:de("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t}));ue.displayName="TableRow";const F=u.forwardRef(({className:e,...t},n)=>s.jsx("th",{ref:n,className:de("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}));F.displayName="TableHead";const q=u.forwardRef(({className:e,...t},n)=>s.jsx("td",{ref:n,className:de("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));q.displayName="TableCell";const ez=u.forwardRef(({className:e,...t},n)=>s.jsx("caption",{ref:n,className:de("text-muted-foreground mt-4 text-sm",e),...t}));ez.displayName="TableCaption";var bf="Tabs",[tz]=Js(bf,[ff]),v1=ff(),[nz,pg]=tz(bf),j1=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,onValueChange:r,defaultValue:l,orientation:i="horizontal",dir:o,activationMode:c="automatic",...d}=e,f=of(o),[m,h]=lr({prop:a,onChange:r,defaultProp:l??"",caller:bf});return s.jsx(nz,{scope:n,baseId:Cs(),value:m,onValueChange:h,orientation:i,dir:f,activationMode:c,children:s.jsx(ze.div,{dir:f,"data-orientation":i,...d,ref:t})})});j1.displayName=bf;var y1="TabsList",b1=u.forwardRef((e,t)=>{const{__scopeTabs:n,loop:a=!0,...r}=e,l=pg(y1,n),i=v1(n);return s.jsx(zN,{asChild:!0,...i,orientation:l.orientation,dir:l.dir,loop:a,children:s.jsx(ze.div,{role:"tablist","aria-orientation":l.orientation,...r,ref:t})})});b1.displayName=y1;var w1="TabsTrigger",_1=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,disabled:r=!1,...l}=e,i=pg(w1,n),o=v1(n),c=S1(i.baseId,a),d=C1(i.baseId,a),f=a===i.value;return s.jsx(LN,{asChild:!0,...o,focusable:!r,active:f,children:s.jsx(ze.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:xe(e.onMouseDown,m=>{!r&&m.button===0&&m.ctrlKey===!1?i.onValueChange(a):m.preventDefault()}),onKeyDown:xe(e.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&i.onValueChange(a)}),onFocus:xe(e.onFocus,()=>{const m=i.activationMode!=="manual";!f&&!r&&m&&i.onValueChange(a)})})})});_1.displayName=w1;var N1="TabsContent",k1=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,forceMount:r,children:l,...i}=e,o=pg(N1,n),c=S1(o.baseId,a),d=C1(o.baseId,a),f=a===o.value,m=u.useRef(f);return u.useEffect(()=>{const h=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(h)},[]),s.jsx(bs,{present:r||f,children:({present:h})=>s.jsx(ze.div,{"data-state":f?"active":"inactive","data-orientation":o.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:d,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:m.current?"0s":void 0},children:h&&l})})});k1.displayName=N1;function S1(e,t){return`${e}-trigger-${t}`}function C1(e,t){return`${e}-content-${t}`}var sz=j1,R1=b1,T1=_1,E1=k1;const az=sz,A1=u.forwardRef(({className:e,...t},n)=>s.jsx(R1,{ref:n,className:de("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));A1.displayName=R1.displayName;const cp=u.forwardRef(({className:e,...t},n)=>s.jsx(T1,{ref:n,className:de("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}));cp.displayName=T1.displayName;const rz=u.forwardRef(({className:e,...t},n)=>s.jsx(E1,{ref:n,className:de("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));rz.displayName=E1.displayName;const vn=u.forwardRef(({className:e,...t},n)=>s.jsx("textarea",{className:de("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}));vn.displayName="Textarea";var[wf]=Js("Tooltip",[wi]),_f=wi(),$1="TooltipProvider",lz=700,up="tooltip.open",[iz,xg]=wf($1),M1=e=>{const{__scopeTooltip:t,delayDuration:n=lz,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(iz,{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})};M1.displayName=$1;var Io="Tooltip",[oz,wc]=wf(Io),O1=e=>{const{__scopeTooltip:t,children:n,open:a,defaultOpen:r,onOpenChange:l,disableHoverableContent:i,delayDuration:o}=e,c=xg(Io,e.__scopeTooltip),d=_f(t),[f,m]=u.useState(null),h=Cs(),x=u.useRef(0),j=i??c.disableHoverableContent,v=o??c.delayDuration,y=u.useRef(!1),[g,p]=lr({prop:a,defaultProp:r??!1,onChange:_=>{_?(c.onOpen(),document.dispatchEvent(new CustomEvent(up))):c.onClose(),l==null||l(_)},caller:Io}),b=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]),S=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(sg,{...d,children:s.jsx(oz,{scope:t,contentId:h,open:g,stateAttribute:b,trigger:f,onTriggerChange:m,onTriggerEnter:u.useCallback(()=>{c.isOpenDelayedRef.current?C():w()},[c.isOpenDelayedRef,C,w]),onTriggerLeave:u.useCallback(()=>{j?S():(window.clearTimeout(x.current),x.current=0)},[S,j]),onOpen:w,onClose:S,disableHoverableContent:j,children:n})})};O1.displayName=Io;var dp="TooltipTrigger",D1=u.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,r=wc(dp,n),l=xg(dp,n),i=_f(n),o=u.useRef(null),c=st(t,o,r.onTriggerChange),d=u.useRef(!1),f=u.useRef(!1),m=u.useCallback(()=>d.current=!1,[]);return u.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),s.jsx(ag,{asChild:!0,...i,children:s.jsx(ze.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...a,ref:c,onPointerMove:xe(e.onPointerMove,h=>{h.pointerType!=="touch"&&!f.current&&!l.isPointerInTransitRef.current&&(r.onTriggerEnter(),f.current=!0)}),onPointerLeave:xe(e.onPointerLeave,()=>{r.onTriggerLeave(),f.current=!1}),onPointerDown:xe(e.onPointerDown,()=>{r.open&&r.onClose(),d.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:xe(e.onFocus,()=>{d.current||r.onOpen()}),onBlur:xe(e.onBlur,r.onClose),onClick:xe(e.onClick,r.onClose)})})});D1.displayName=dp;var gg="TooltipPortal",[cz,uz]=wf(gg,{forceMount:void 0}),z1=e=>{const{__scopeTooltip:t,forceMount:n,children:a,container:r}=e,l=wc(gg,t);return s.jsx(cz,{scope:t,forceMount:n,children:s.jsx(bs,{present:n||l.open,children:s.jsx(pc,{asChild:!0,container:r,children:a})})})};z1.displayName=gg;var ii="TooltipContent",L1=u.forwardRef((e,t)=>{const n=uz(ii,e.__scopeTooltip),{forceMount:a=n.forceMount,side:r="top",...l}=e,i=wc(ii,e.__scopeTooltip);return s.jsx(bs,{present:a||i.open,children:i.disableHoverableContent?s.jsx(U1,{side:r,...l,ref:t}):s.jsx(dz,{side:r,...l,ref:t})})}),dz=u.forwardRef((e,t)=>{const n=wc(ii,e.__scopeTooltip),a=xg(ii,e.__scopeTooltip),r=u.useRef(null),l=st(t,r),[i,o]=u.useState(null),{trigger:c,onClose:d}=n,f=r.current,{onPointerInTransitChange:m}=a,h=u.useCallback(()=>{o(null),m(!1)},[m]),x=u.useCallback((j,v)=>{const y=j.currentTarget,g={x:j.clientX,y:j.clientY},p=xz(g,y.getBoundingClientRect()),b=gz(g,p),w=vz(v.getBoundingClientRect()),S=yz([...b,...w]);o(S),m(!0)},[m]);return u.useEffect(()=>()=>h(),[h]),u.useEffect(()=>{if(c&&f){const j=y=>x(y,f),v=y=>x(y,c);return c.addEventListener("pointerleave",j),f.addEventListener("pointerleave",v),()=>{c.removeEventListener("pointerleave",j),f.removeEventListener("pointerleave",v)}}},[c,f,x,h]),u.useEffect(()=>{if(i){const j=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)),b=!jz(g,i);p?h():b&&(h(),d())};return document.addEventListener("pointermove",j),()=>document.removeEventListener("pointermove",j)}},[c,f,i,d,h]),s.jsx(U1,{...e,ref:l})}),[fz,hz]=wf(Io,{isInside:!1}),mz=l$("TooltipContent"),U1=u.forwardRef((e,t)=>{const{__scopeTooltip:n,children:a,"aria-label":r,onEscapeKeyDown:l,onPointerDownOutside:i,...o}=e,c=wc(ii,n),d=_f(n),{onClose:f}=c;return u.useEffect(()=>(document.addEventListener(up,f),()=>document.removeEventListener(up,f)),[f]),u.useEffect(()=>{if(c.trigger){const m=h=>{const x=h.target;x!=null&&x.contains(c.trigger)&&f()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[c.trigger,f]),s.jsx(mc,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:i,onFocusOutside:m=>m.preventDefault(),onDismiss:f,children:s.jsxs(rg,{"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(mz,{children:a}),s.jsx(fz,{scope:n,isInside:!0,children:s.jsx(bD,{id:c.contentId,role:"tooltip",children:r||a})})]})})});L1.displayName=ii;var B1="TooltipArrow",pz=u.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,r=_f(n);return hz(B1,n).isInside?null:s.jsx(lg,{...r,...a,ref:t})});pz.displayName=B1;function xz(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 gz(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 vz(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 jz(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,m=c.x,h=c.y;f>a!=h>a&&n<(m-d)*(a-f)/(h-f)+d&&(r=!r)}return r}function yz(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),bz(t)}function bz(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 wz=M1,_z=O1,Nz=D1,kz=z1,I1=L1;const vg=wz,jg=_z,yg=Nz,Nf=u.forwardRef(({className:e,sideOffset:t=4,...n},a)=>{const r=xc(),l=s.jsx(I1,{ref:a,sideOffset:t,className:de("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(kz,{container:r,children:l}):l});Nf.displayName=I1.displayName;function ta({page:e,header:t}){return s.jsxs(s.Fragment,{children:[t??s.jsx(sn,{title:e}),s.jsx(Sz,{page:e})]})}function Sz({page:e}){return s.jsxs(oe,{variant:"info",role:"status",className:"mt-6","data-testid":"not-installed",children:[s.jsx(gn,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:i_(e)})]})}const Cz=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/,Wj="Opening. If macOS asks whether sdlc viewer may control Terminal, allow it.";function bg(e,t){return`${e?`/org/${e}`:""}/threads#thread-${encodeURIComponent(t)}`}const Qj=/^iss-\d{1,9}$/;function Rz(e,t,n=null){if(e.kind==="open"||e.kind==="card")return null;if(n!==null)return Qj.test(n)?`claude "$(sdlc view --issue ${n} --prompt)"`:null;const a=e.kind==="start"?e.task??t:t;return a&&Cz.test(a)?`claude "$(sdlc view --task ${a} --prompt)"`:e.kind==="start"&&Qj.test(e.issue)?`claude "$(sdlc view --issue ${e.issue} --prompt)"`:null}function kf({org:e,action:t,task_id:n,issue:a=null,open_thread:r,labelled:l=!1}){const{href:i,Link:o}=Ze(),{confirm:c,confirm_dialog:d}=vi(),f=as(),[m,h]=u.useState(!1),[x,j]=u.useState(!1),[v,y]=u.useState(null),g=u.useId(),p=`${n??""}
|
|
399
|
+
${a??""}
|
|
400
|
+
${(t==null?void 0:t.kind)??""}
|
|
401
|
+
${t&&"thread"in t?t.thread:""}`,[b,w]=u.useState(p),S=u.useRef(p);if(S.current=p,b!==p&&(w(p),h(!1),j(!1),y(null)),u.useEffect(()=>{if(!v)return;const B=()=>y(null);return document.addEventListener("pointerdown",B,!0),document.addEventListener("click",B,!0),()=>{document.removeEventListener("pointerdown",B,!0),document.removeEventListener("click",B,!0)}},[v]),!t)return{button:null,panel:null};const C=Rz(t,n,a);if(t.kind==="open"||t.kind==="card"){const B=t.title,G=l?s.jsxs(s.Fragment,{children:[s.jsx(rd,{className:"mr-2 size-4","aria-hidden":"true"}),"Open thread"]}):s.jsx(rd,{className:"size-4","aria-hidden":"true"}),U=l?"default":"icon";if(t.kind==="card"||!r)return{button:s.jsx(Zj,{text:`Open thread: ${B}`,children:s.jsx("span",{className:"inline-flex",children:s.jsx(P,{asChild:!0,variant:"outline",size:U,children:s.jsx(o,{href:i(bg(e,t.thread)),"aria-label":`Open thread: ${B}`,children:G})})})}),panel:null};const R=async()=>{if(x)return;const T=p,E=()=>S.current===T;y(null),j(!0);const k=await r(t.thread,async M=>{j(!1);const Y=await c({title:`Reopen ${B} in Terminal?`,description:`Its session is closed. It opens in a new Terminal window in ${M??"the thread's folder"}, running claude --resume.`,action_label:"Reopen"});return Y&&E()&&j(!0),Y});E()&&(j(!1),"note"in k&&y(k.note))},$=x?Wj:(v==null?void 0:v.role)==="muted"?H1(v,f):"";return{button:s.jsxs(s.Fragment,{children:[s.jsx(Zj,{text:`Open thread: ${B}`,children:s.jsx(P,{type:"button",variant:"outline",size:U,"aria-label":`Open thread: ${B}`,"aria-busy":x||void 0,"aria-disabled":x||void 0,onClick:()=>void R(),children:G})}),s.jsx("span",{role:"status",className:"sr-only",children:$}),d]}),panel:x?s.jsxs(oe,{variant:"info",role:"presentation",className:"mt-2",children:[s.jsx(gn,{className:"size-4","aria-hidden":"true"}),s.jsx(ce,{className:"text-current",children:Wj})]}):v?s.jsx(Tz,{note:v,outdated_step:f}):null}}if(!C)return{button:null,panel:null};const _=t.kind==="continue"?"Continue":"Start a thread",N=t.kind==="continue"?`Continue ${t.title}`:t.kind==="start"?`Start a thread for ${t.issue}`:_,O=t.kind==="continue"?`Run in a terminal to continue ${t.title}:`:t.kind==="start"?`Run in a terminal to start a thread for ${t.issue}:`:"Run in a terminal in this checkout:",D=t.kind==="start"?rr:DE;return{button:s.jsxs(P,{type:"button",variant:"outline",size:l?"default":"sm","aria-label":N,"aria-expanded":m,"aria-controls":m?g:void 0,onClick:()=>h(B=>!B),children:[s.jsx(D,{className:"mr-2 size-4","aria-hidden":"true"}),_]}),panel:m?s.jsx(Ez,{id:g,lead:O,command:C}):null}}function Zj({text:e,children:t}){return s.jsx(vg,{children:s.jsxs(jg,{children:[s.jsx(yg,{asChild:!0,children:t}),s.jsx(Nf,{children:e})]})})}function H1(e,t){return e.outdated?`${e.text} ${t}`:e.text}function Tz({note:e,outdated_step:t}){const n=H1(e,t);return e.role==="muted"?s.jsxs(oe,{variant:"default",role:"presentation",className:"mt-2",children:[s.jsx(gn,{className:"size-4","aria-hidden":"true"}),s.jsx(ce,{children:n})]}):e.role==="you"?s.jsxs(oe,{variant:"warning",className:"mt-2",children:[s.jsx(Ut,{className:"size-4","aria-hidden":"true"}),s.jsx(ce,{className:"text-current",children:n})]}):s.jsxs(oe,{variant:"destructive",className:"mt-2",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ce,{className:"text-current",children:n})]})}function Ez({id:e,lead:t,command:n}){return s.jsxs("div",{id:e,className:"mt-2 grid max-w-full gap-1 text-left",children:[s.jsx("span",{className:"text-muted-foreground text-sm",children:t}),s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s.jsx("pre",{className:"bg-muted min-w-0 flex-1 overflow-x-auto rounded-md border px-2 py-1 text-sm whitespace-pre",children:s.jsx("code",{className:"font-mono",children:n})}),s.jsx(fp,{text:n,label:"Copy",aria_label:"Copy the command",what:"the command"})]})]})}function fp({text:e,label:t,aria_label:n,what:a,variant:r="outline",size:l="sm"}){const[i,o]=u.useState("idle");u.useEffect(()=>{if(i!=="copied")return;const d=()=>o("idle");return document.addEventListener("pointerdown",d,!0),document.addEventListener("keydown",d,!0),()=>{document.removeEventListener("pointerdown",d,!0),document.removeEventListener("keydown",d,!0)}},[i]);const c=async()=>{try{await navigator.clipboard.writeText(e),o("copied")}catch{o("failed")}};return s.jsxs("span",{className:"inline-flex flex-wrap items-center gap-2",children:[s.jsxs(P,{type:"button",variant:r,size:l,"aria-label":i==="copied"?void 0:n,onClick:()=>void c(),children:[i==="copied"?s.jsx(Zr,{className:"mr-2 size-4","aria-hidden":"true"}):s.jsx(t_,{className:"mr-2 size-4","aria-hidden":"true"}),i==="copied"?"Copied":t]}),s.jsxs("span",{role:"status","aria-live":"polite",className:"text-muted-foreground text-xs",children:[i==="failed"?`Copy failed: select ${a}`:null,i==="copied"?s.jsxs("span",{className:"sr-only",children:["Copied ",a]}):null]})]})}const Jj=["none","read","comment","write","manage","admin"];function xd(e,t){return Jj.indexOf(e??"none")>=Jj.indexOf(t)}function wg(e){return e==="api_key"?"API key":e==="sdlc_login"?"sdlc login":null}function Oh(e,t){const n=wg(e);return e==="sdlc_login"&&t?`${n} on ${P1(t)}`:n}const Az=String.fromCodePoint(8296),$z=String.fromCodePoint(8297);function P1(e){return`${Az}${e}${$z}`}const Ho={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"}},Mz={backlog:"neutral",planned:"neutral",in_progress:"info",completed:"success",canceled:"neutral"};function q1(e){return e.name==="Blocked"?"warning":Mz[e.category]}const ey=1800;function As(e){return new Date(e).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function xs(e){return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function _g(e){return`${gs(e)}, ${xs(e)}`}function qi(e){return e<90?`${Math.round(e)} s`:e<5400?`${Math.round(e/60)} min`:`${(e/3600).toFixed(1).replace(/\.0$/,"")} h`}function gs(e){return new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function G1(e){return new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function Oz(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 Dz(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 Ra="not_set";function zz({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 G;const f=Qr(),[m,h]=u.useState(""),[x,j]=u.useState(""),[v,y]=u.useState(r??((G=l[0])==null?void 0:G.id)??""),[g,p]=u.useState(Ra),[b,w]=u.useState(Ra),[S,C]=u.useState(!1),[_,N]=u.useState(null),[O,D]=u.useState(!1);u.useEffect(()=>{var U;e&&(h(""),j(""),y(r??((U=l[0])==null?void 0:U.id)??""),p(Ra),w(Ra),C(!1),N(null))},[e,r,l]);const B=async U=>{if(U.preventDefault(),!m.trim()){C(!0);return}D(!0),N(null);try{const R=await t.run("create_task",{list_id:n,expected_list_revision:a,title:m.trim(),description:x.trim()||null,status_id:v||null,priority_id:g===Ra?null:g,primary_user_id:b===Ra?null:b});if(!R.ok){N(R.refusal.message);return}f.success("Task created."),await d()}finally{D(!1)}};return s.jsx(bn,{open:e,onOpenChange:U=>U?null:c(),children:s.jsx(wn,{children:s.jsxs("form",{onSubmit:U=>void B(U),noValidate:!0,children:[s.jsxs(_n,{children:[s.jsx(kn,{children:"New task"}),s.jsx(Sn,{children:"Add a task to this List."})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[_&&s.jsxs(oe,{variant:"destructive",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ce,{children:_})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"new-task-title",children:"Title"}),s.jsx(pt,{id:"new-task-title",placeholder:"What needs doing",value:m,required:!0,"aria-invalid":S,"aria-describedby":S?"new-task-title-error":void 0,onChange:U=>{h(U.target.value),C(!1)}}),S&&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(Oe,{htmlFor:"new-task-description",children:"Description (optional)"}),s.jsx(vn,{id:"new-task-description",rows:4,value:x,onChange:U=>j(U.target.value)})]}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"new-task-status",children:"Status"}),s.jsxs(Nt,{value:v,onValueChange:y,children:[s.jsx(xt,{id:"new-task-status",children:s.jsx(kt,{})}),s.jsx(gt,{children:l.map(U=>s.jsx(De,{value:U.id,children:U.name},U.id))})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"new-task-priority",children:"Priority"}),s.jsxs(Nt,{value:g,onValueChange:p,children:[s.jsx(xt,{id:"new-task-priority",children:s.jsx(kt,{})}),s.jsxs(gt,{children:[s.jsx(De,{value:Ra,children:"Not set"}),i.map(U=>s.jsx(De,{value:U.id,children:U.name},U.id))]})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"new-task-primary",children:"Primary"}),s.jsxs(Nt,{value:b,onValueChange:w,children:[s.jsx(xt,{id:"new-task-primary",children:s.jsx(kt,{})}),s.jsxs(gt,{children:[s.jsx(De,{value:Ra,children:"Not set"}),o.map(U=>s.jsx(De,{value:U.user_id,children:U.label},U.user_id))]})]})]})]})]}),s.jsxs(Nn,{className:"mt-6",children:[s.jsx(P,{type:"button",variant:"outline",onClick:c,children:"Cancel"}),s.jsx(P,{type:"submit",disabled:O,children:O?"Creating…":"Create task"})]})]})})})}const Lz="Your organization's work, in queue order. Claim a task to show you are working on it.",Ji="any",V1="none",Uz=1,Bz=250;function Ng(){const e=yn().tasks;if(!e)throw new Error("The Tasks page rendered without the tasks seam.");return e}function Iz({org:e}){var j,v;const t=Ng(),{href:n,Link:a}=Ze(),[r,l]=u.useState({state:"loading"}),[i,o]=u.useState([]),[c,d]=u.useState(null),f=u.useRef(0),m=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(()=>{m(!1)},[m]);const h=u.useCallback(()=>void m(!0),[m]);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"&&((j=r.refusal)==null?void 0:j.reason)!=="engine_missing")return s.jsx(fr,{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)??Lz;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(Pz,{active:r,org:e,members:i,description:x,read_only_reason:c==null?void 0:c.read_only_reason,reload_configuration:h}):r.state==="off"&&((v=r.refusal)==null?void 0:v.reason)==="engine_missing"?s.jsx(ta,{page:"Tasks"}):s.jsxs(s.Fragment,{children:[s.jsx(sn,{title:"Tasks",description:x}),r.state==="loading"&&s.jsx(Y1,{}),(r.state==="error"||r.state==="off")&&s.jsx(F1,{refusal:r.refusal,on_retry:h}),r.state==="available"&&s.jsx(Hz,{on_done:h})]})})}function Y1(){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(Ct,{className:t===5?"h-10 w-2/3":"h-10 w-full"},t))})}function F1({refusal:e,on_retry:t}){const n=as();return(e==null?void 0:e.reason)==="view_outdated"?s.jsxs(oe,{variant:"warning",className:"mt-6",children:[s.jsx(Ut,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:el}),s.jsx(ce,{children:n})]}):s.jsxs(oe,{variant:"destructive",className:"mt-6",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:"Tasks could not be loaded"}),s.jsxs(ce,{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 Hz({on_done:e}){const{commands:t}=Ng(),n=Qr(),[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(oe,{variant:"info",className:"mt-6",children:[s.jsx(gn,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:"Tasks are not on for this organization"}),s.jsxs(ce,{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 Dh=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function Pz({active:e,org:t,members:n,description:a,read_only_reason:r,reload_configuration:l}){var al;const{commands:i,listTasks:o,waitingOnYou:c,hierarchyRevision:d}=Ng(),{href:f,Link:m}=Ze(),{self_id:h}=Fd(),x=Qr(),{list:j,workspace:v}=e,y=j.offers,g=y!==void 0,p=u.useMemo(()=>{var V;return((V=v.workflows.find(le=>le.id===j.workflow_id))==null?void 0:V.statuses)??[]},[v,j]),b=v.priorities,w=!!i&&xd(j.permission,"write"),S=w&&xd(j.permission,"manage"),C=u.useMemo(()=>new Map(n.map(V=>[V.user_id,V])),[n]),_=V=>{var le;return V?V===h?"You":((le=C.get(V))==null?void 0:le.label)??"A member":""},[N,O]=u.useState("active"),[D,B]=u.useState(!1),[G,U]=u.useState(""),[R,$]=u.useState("");u.useEffect(()=>{const V=setTimeout(()=>$(G),Bz);return()=>clearTimeout(V)},[G]);const[T,E]=u.useState(null),[k,M]=u.useState(Ji),[Y,A]=u.useState(!1),[I,X]=u.useState(!1),[J,ae]=u.useState({}),[ke,Q]=u.useState([]),[ee,Ce]=u.useState(null),[se,Se]=u.useState([]),[me,be]=u.useState(null),[ve,Ae]=u.useState(0),[Z,je]=u.useState(!1),[Ee,Pe]=u.useState(null),[ie,We]=u.useState(null),Ve=as(),[H,we]=u.useState(!1),[at,Bt]=u.useState(null),[Qt,jt]=u.useState({}),[it,an]=u.useState(""),{confirm:rn,confirm_dialog:Bn}=vi(),Vt=u.useRef(null),fn=u.useRef(null),re=u.useRef(null),K=u.useRef(null),[he,Ue]=u.useState(void 0),dt=!!(R.trim()||T||k!==Ji||Y||I),Rn=u.useRef(0),Zt=u.useRef(0),L=u.useCallback(async(V,le=!1)=>{if(le&&Zt.current>0)return;const Xe=V?Rn.current:Rn.current+=1,yt={state:N,assigned_to_me:D||void 0,cursor:V,search:R.trim()||void 0,group:T??void 0,owner:k===Ji?void 0:k===V1?"":k,urgent:Y||void 0,over_estimate:I||void 0,...qz(J,ke)},En=An=>o(j.id,{...yt,cursor:An});V||(Zt.current+=1);let At=await En(V).finally(()=>{V||(Zt.current-=1)}),Yt=!!V;if(!At.ok&&At.refusal.code==="cursor_stale"&&(At=await En(),Yt=!1),Xe!==Rn.current)return;if(!At.ok){be(At.refusal),Ae(An=>An+1);return}const It=At.data;be(null),Ae(0),!(le&&Dh(It,re.current))&&(re.current=It,Ce(It),It.facets&&Ue(It.facets),Se(An=>Yt?[...An,...It.tasks]:It.tasks))},[o,j.id,N,D,R,T,k,Y,I,J,ke]),Te=u.useCallback(async()=>{const V=await c();if(We(Xe=>V.ok?null:Dh(Xe,V.refusal)?Xe:V.refusal),!V.ok&&g)return;const le=V.ok?V.data:null;Dh(le,K.current)||(K.current=le,Pe(le))},[c,g]);u.useEffect(()=>{re.current=null,Ce(null)},[N,D]),u.useEffect(()=>{L()},[L]),u.useEffect(()=>{Te()},[Te]);const Le=u.useCallback(async()=>{await Promise.all([L(),Te()])},[L,Te]),ft=u.useRef(Le);ft.current=Le;const hn=y==null?void 0:y.refresh_ms;u.useEffect(()=>{if(!hn)return;const V=setInterval(()=>{L(void 0,!0),Te()},hn);return()=>clearInterval(V)},[hn,L,Te]);const rs=u.useCallback(async(V,le,Xe)=>{if(!i)return;const yt=await i.run(V,le);yt.ok?Xe&&x.success(Xe):(x.error(yt.refusal.message),yt.refusal.code==="revision_conflict"&&l()),await Le()},[i,x,Le,l]),In=p.find(V=>V.category==="completed"),Hn=async(V,le,Xe)=>{const yt=le+Xe,En=se[yt];if(!En||!ee||!i)return;const At=async(Yt,It)=>{const An=await i.run(Yt,It);if(!An.ok)throw An.refusal;return An.data};try{let Yt=ee.list.order_revision,It=V.revision;if(En.queue_rank===null){const An=se.findIndex(Na=>Na.queue_rank===null);for(const Na of se.slice(An,yt+1)){const Mi=await At("reorder",{task_id:Na.id,expected_revision:Na.revision,expected_order_revision:Yt,placement:"end"});Yt=Mi.list.order_revision,Na.id===V.id&&(It=Mi.task.revision)}}await At("reorder",{task_id:V.id,expected_revision:It,expected_order_revision:Yt,placement:Xe<0?"before":"after",anchor_task_id:En.id})}catch(Yt){x.error(Yt.message)}await Le()},vr=V=>{In&&rs("update_task",{task_id:V.id,expected_revision:V.revision,changes:{status_id:In.id}},`${V.title} completed.`)},Os=async V=>{if(!ee||!await rn({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[Xe,yt]=await Promise.all([o(j.id,{limit:1}),d(v.id)]);if(!Xe.ok||!yt.ok){x.error(Xe.ok?yt.ok?"":yt.refusal.message:Xe.refusal.message);return}await rs("archive_task",{task_id:V.id,expected_revision:V.revision,expected_order_revision:Xe.data.list.order_revision,expected_hierarchy_revision:yt.data},`${V.title} archived.`)},ye=async V=>{await rs("release_hold",{hold_id:V},"Hold released.")},Je=async(V,le,Xe,yt)=>{if(!(i!=null&&i.complete)||!await rn({title:`Mark ${le} done?`,description:Xe.reason?`“${Xe.reason}”
|
|
402
|
+
|
|
403
|
+
It leaves the open tasks.`:"It leaves the open tasks.",action_label:"Mark done"}))return;Bt(V);const At=await i.complete(Xe);if(Bt(null),!At.ok){jt(Yt=>({...Yt,[V]:At.refusal.message}));return}jt(({[V]:Yt,...It})=>It),an(`${le} marked done.`),await ft.current(),Tn({next:yt})},[Jt,Tn]=u.useState(null);u.useEffect(()=>{var yt;if(!Jt)return;Tn(null);const V=fn.current,le=typeof Jt.next=="function"?Jt.next():Jt.next;(yt=(le?(V==null?void 0:V.querySelector(`[data-done-key="${CSS.escape(le)}"]`))??(V==null?void 0:V.querySelector(`[data-title-key="${CSS.escape(le)}"] a`)):null)??Vt.current)==null||yt.focus()},[Jt]);const jr=()=>{var V;U(""),$(""),E(null),M(Ji),A(!1),X(!1),(V=Vt.current)==null||V.focus()},Lf=new Map(p.map(V=>[V.id,V])),Uf=new Map(b.map(V=>[V.id,V])),sl=new Map(se.map(V=>[V.id,V.title])),Ei=w&&N==="active",Bf=se.some(V=>V.local_done),Sc=se.some(V=>V.local_action),z=Ei||Bf||Sc,te=!g||b.length>0,ne=!D&&!dt,pe=5+(te?1:0)+(z?1:0),$e=me!==null&&(me.reason==="store_locked"||me.reason==="engine_failed")&&ve<=Uz,Et=(Ee==null?void 0:Ee.holds)??[],Pn=ee==null?void 0:ee.groups,qn=Gz(se,Pn,J,(ee==null?void 0:ee.matched)===void 0?ke:[]),ws=Pn?Pn.length===0:se.length===0,Ai=(V,le)=>ae(Xe=>({...Xe,[V]:!le})),na=V=>Q(le=>le.includes(V)?le.filter(Xe=>Xe!==V):[...le,V]),$i=Et.map(V=>V.id);return s.jsxs("div",{ref:fn,className:"contents",children:[s.jsx(sn,{title:"Tasks",description:a,actions:w?s.jsxs(P,{type:"button",onClick:()=>we(!0),children:[s.jsx(rr,{className:"mr-2 size-4","aria-hidden":"true"}),"New task"]}):null}),g&&(ee!=null&&ee.open)?s.jsxs("p",{className:"text-muted-foreground mt-1 text-sm",children:[ee.open," open"]}):null,hn?s.jsx("p",{className:"text-muted-foreground mt-1 text-xs",role:"status",children:me?`Not reading · trying again every ${Math.round(hn/1e3)}s`:ee?`Live · refreshes every ${Math.round(hn/1e3)}s`:"Connecting…"}):null,g?s.jsx("p",{className:"sr-only",role:"status",children:it}):null,(g||Et.length>0)&&s.jsxs(mt,{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"}),Et.length>0?s.jsx("ul",{className:"mt-2 divide-y","aria-labelledby":"waiting-title",children:Et.map((V,le)=>{var At,Yt;const Xe=Ho[V.hold_type],yt=V.target.kind==="task"?`Because you claim ${sl.get(V.target.task_id)??"the task it waits on"} · `:"",En=V.local_done;return s.jsxs("li",{id:`waiting-${V.id}`,"data-title-key":V.id,className:"flex flex-wrap items-center gap-3 py-2",children:[V.task?s.jsx(m,{className:"text-primary min-w-40 flex-1 hover:underline",href:f(`/org/${t}/tasks/${V.task.id}`),children:V.task.title}):s.jsx("span",{className:"min-w-40 flex-1",children:V.reason}),s.jsx(fe,{variant:Xe.tone,children:V.local_label??Xe.label}),s.jsxs("div",{className:"min-w-48 flex-2",children:[V.task?s.jsx("div",{className:"text-sm",children:V.reason}):null,s.jsxs("div",{className:"text-muted-foreground text-xs",children:[yt,"From ",_(V.opened_by)," · ",gs(V.opened_at)]}),(At=V.local_threads)!=null&&At.length?s.jsxs("div",{className:"text-muted-foreground text-xs",children:["Answer it in"," ",s.jsx(m,{className:"text-primary hover:underline",href:f(`/org/${t}/threads`),children:"Threads"}),": ",V.local_threads.join(" · ")]}):null,Qt[V.id]?s.jsx("div",{className:"text-destructive text-xs",role:"alert",children:Qt[V.id]}):null]}),En&&(i!=null&&i.complete)?s.jsx(P,{type:"button",variant:"outline",size:"sm","data-done-key":V.id,"aria-label":`Mark ${((Yt=V.task)==null?void 0:Yt.title)??V.reason} done`,loading:at===V.id,onClick:()=>{var It;return void Je(V.id,((It=V.task)==null?void 0:It.title)??V.reason,En,$i[le+1]??null)},children:"Done"}):null,g?null:s.jsx(P,{type:"button",variant:"outline",size:"sm",onClick:()=>void ye(V.id),children:"Release"})]},V.id)})}):Ee?s.jsx("p",{className:"text-muted-foreground mt-2 text-sm",children:"Nothing in this checkout waits on you."}):null,g&&ie?s.jsx("p",{className:"text-muted-foreground mt-2 text-sm",role:"status",children:ie.reason==="view_outdated"?`Waiting on you is not read here. ${Ve}`:"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(oe,{variant:"info",className:"mt-4",children:[s.jsx(fc,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:"You can view these tasks"}),s.jsx(ce,{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(az,{value:N,onValueChange:V=>O(V),children:s.jsxs(A1,{"aria-label":"Which tasks",children:[s.jsx(cp,{value:"active",children:"Active"}),s.jsx(cp,{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(ji,{id:"tasks-mine",checked:D,onCheckedChange:V=>B(V===!0)}),s.jsx(Oe,{htmlFor:"tasks-mine",children:"Assigned to me"})]}):null,y!=null&&y.search?s.jsx(pt,{ref:Vt,type:"search",className:"w-64","aria-label":"Search tasks",placeholder:"Search title, ID or detail",value:G,onChange:V=>U(V.target.value)}):null,he!=null&&he.owners?s.jsx(Qz,{owners:he.owners,no_owner:he.no_owner,value:k,on_change:M}):null]}),(al=he==null?void 0:he.groups)!=null&&al.length?s.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",role:"group","aria-label":"Status",children:[he.groups.map(V=>s.jsxs(P,{type:"button",variant:"outline",size:"sm",className:vo,"aria-pressed":T===V.id,onClick:()=>E(le=>le===V.id?null:V.id),children:[V.label," ",V.count]},V.id)),he.marks?s.jsxs(s.Fragment,{children:[s.jsxs(P,{type:"button",variant:"outline",size:"sm",className:vo,"aria-pressed":Y,onClick:()=>A(V=>!V),children:["Urgent ",he.marks.urgent]}),s.jsxs(P,{type:"button",variant:"outline",size:"sm",className:vo,"aria-pressed":I,onClick:()=>X(V=>!V),children:["Over estimate ",he.marks.over_estimate]})]}):null]}):null,dt&&(ee==null?void 0:ee.matched)!==void 0&&ee.total!==void 0?s.jsxs("p",{className:"text-muted-foreground mt-2 text-sm",children:[ee.matched," of ",ee.total," match ·"," ",s.jsx(P,{type:"button",variant:"link",size:"inline-sm",onClick:jr,children:"Clear"})]}):null,$e?s.jsx("p",{className:"text-muted-foreground mt-4 text-sm",children:"Tasks are busy. Reading them again…"}):me?s.jsx(F1,{refusal:me,on_retry:()=>void L()}):null,!ee&&!me&&s.jsx(Y1,{}),ee&&ws&&dt?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(Qd,{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:jr,children:"Clear filters"})]}):ee&&ws&&N==="active"&&!D&&g?s.jsx("p",{className:"text-muted-foreground mt-6 text-sm",children:"No tasks recorded yet."}):ee&&ws&&N==="active"&&!D?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(s_,{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:()=>we(!0),children:[s.jsx(rr,{className:"mr-2 size-4","aria-hidden":"true"}),"New task"]})]}):ee?s.jsxs(s.Fragment,{children:[s.jsx(mt,{className:"mt-4 shrink-0 overflow-x-auto",children:s.jsxs(Fe,{containerAriaLabel:"Tasks",children:[s.jsx(Qe,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Title"}),s.jsx(F,{children:"Status"}),te?s.jsx(F,{className:"hidden md:table-cell",children:"Priority"}):null,s.jsx(F,{className:"hidden md:table-cell",children:"Primary"}),s.jsx(F,{className:"hidden md:table-cell",children:"Holds"}),s.jsx(F,{children:"Claimed by"}),z?s.jsx(F,{className:"text-right",children:"Actions"}):null]})}),s.jsxs(Ke,{children:[qn.map(V=>{if(V.kind==="group")return s.jsx(Yz,{group:V.group,open:V.open,columns:pe,on_toggle:()=>Ai(V.group.id,V.open)},`group:${V.group.id}`);if(V.kind==="more")return s.jsx(Fz,{group:V.group,whole:ke.includes(V.group.id),columns:pe,on_toggle:()=>na(V.group.id)},`more:${V.group.id}`);const{row:le,index:Xe}=V,yt=Lf.get(le.status_id),En=Oz(le),At=le.local_done;return s.jsx(Xz,{columns:pe,thread:{org:t,action:le.local_action,task_id:le.no_page?null:le.id,open_thread:i==null?void 0:i.open_thread},children:(Yt,It)=>{var An,Na;return s.jsxs(ue,{"data-testid":"tasks-row",className:It?"border-b-0":void 0,children:[s.jsxs(q,{"data-title-key":le.id,children:[le.no_page&&le.local_thread?s.jsxs(m,{className:"text-primary inline-flex items-center gap-1 hover:underline",href:f(bg(t,le.local_thread.key)),"aria-label":`${le.title}: open ${le.local_thread.title} in Threads`,children:[le.title,s.jsx(rd,{className:"size-3.5 shrink-0","aria-hidden":"true"})]}):le.no_page?s.jsx("span",{children:le.title}):s.jsx(m,{className:"text-primary hover:underline",href:f(`/org/${t}/tasks/${le.id}`),children:le.title}),le.parent_task_id&&sl.get(le.parent_task_id)?s.jsx("div",{className:"text-muted-foreground text-xs",children:sl.get(le.parent_task_id)}):null,g?s.jsx(Wz,{row:le}):null,Qt[le.id]?s.jsx("div",{className:"text-destructive text-xs",role:"alert",children:Qt[le.id]}):null]}),s.jsx(q,{children:yt?s.jsx(fe,{variant:q1(yt),children:yt.name}):null}),te?s.jsx(q,{className:"hidden md:table-cell",children:le.priority_id?((An=Uf.get(le.priority_id))==null?void 0:An.name)??"":s.jsx("span",{className:"text-muted-foreground",children:"Not set"})}):null,s.jsx(q,{className:"hidden md:table-cell",children:le.owner_title?le.owner_title:le.primary_user_id?_(le.primary_user_id):s.jsx("span",{className:"text-muted-foreground",children:"Unassigned"})}),s.jsx(q,{className:"hidden md:table-cell",children:En?s.jsx(fe,{variant:En.tone,children:En.label}):s.jsx("span",{className:"text-muted-foreground",children:"None"})}),s.jsx(q,{"data-testid":"tasks-claim",children:s.jsx(Zz,{row:le,holder:_((Na=le.claim)==null?void 0:Na.user_id)})}),z?s.jsx(q,{className:"text-right whitespace-nowrap",children:s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[At&&"hold"in At?s.jsx("a",{className:"text-primary text-sm hover:underline",href:`#waiting-${At.hold}`,children:"In Waiting on you"}):At&&(i!=null&&i.complete)?s.jsx(P,{type:"button",variant:"outline",size:"sm","data-done-key":le.id,"aria-label":`Mark ${le.title} done`,loading:at===le.id,onClick:()=>void Je(le.id,le.title,At,()=>{var Mi;return(((Mi=re.current)==null?void 0:Mi.tasks)??[]).map(If=>If.id).filter(If=>If!==le.id)[Xe]??null}),children:"Done"}):null,Yt,Ei&&ne?s.jsxs(s.Fragment,{children:[s.jsx(P,{type:"button",variant:"outline",size:"icon","aria-label":`Move ${le.title} up`,disabled:Xe===0,onClick:()=>void Hn(le,Xe,-1),children:s.jsx(TT,{className:"size-4","aria-hidden":"true"})}),s.jsx(P,{type:"button",variant:"outline",size:"icon","aria-label":`Move ${le.title} down`,disabled:Xe===se.length-1,onClick:()=>void Hn(le,Xe,1),children:s.jsx(ST,{className:"size-4","aria-hidden":"true"})})]}):null,Ei?s.jsxs(xf,{children:[s.jsx(gf,{asChild:!0,children:s.jsx(P,{type:"button",variant:"outline",size:"icon","aria-label":`More actions for ${le.title}`,children:s.jsx(Rx,{className:"size-4","aria-hidden":"true"})})}),s.jsxs(bc,{align:"end",children:[In&&le.status_id!==In.id?s.jsx(li,{onSelect:()=>vr(le),children:"Complete"}):null,S?s.jsx(li,{className:"text-destructive focus:text-destructive",onSelect:()=>void Os(le),children:"Archive"}):null]})]}):null]})}):null]})}},le.id)}),ws&&s.jsx(ue,{children:s.jsx(q,{colSpan:pe,className:"text-muted-foreground h-24 text-center",children:N==="archived"?"No archived tasks.":"No tasks are assigned to you."})})]})]})}),ee.next_cursor?s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2 self-start",disabled:Z,onClick:async()=>{je(!0),await L(ee.next_cursor??void 0),je(!1)},children:"Load more"}):null]}):null,w&&i&&s.jsx(zz,{open:H,commands:i,list_id:j.id,list_revision:(ee==null?void 0:ee.list.revision)??j.revision,default_status_id:j.default_status_id,statuses:p,priorities:b,members:n,on_close:()=>we(!1),on_created:async()=>{we(!1),await Le()}}),Bn]})}function qz(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 Gz(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>Vz)&&r.push({kind:"more",group:l})}return r}const Vz=10;function Yz({group:e,open:t,columns:n,on_toggle:a}){const r=t?Kd:dc;return s.jsx(ue,{"data-testid":"tasks-group",children:s.jsx(q,{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 Fz({group:e,whole:t,columns:n,on_toggle:a}){return s.jsx(ue,{"data-testid":"tasks-group-more",children:s.jsx(q,{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}`})})})}const Kz={you:"text-warning",ok:"text-info",waiting:"text-info",blocked:"text-warning",neutral:"text-muted-foreground",muted:"text-muted-foreground"};function Xz({thread:e,columns:t,children:n}){const{button:a,panel:r}=kf(e);return s.jsxs(s.Fragment,{children:[n(a,!!r),r?s.jsx(ue,{"data-testid":"tasks-row-panel",className:"hover:bg-transparent",children:s.jsx(q,{colSpan:t,className:"pt-0",children:s.jsx("div",{className:"max-w-180 pl-4 text-left whitespace-normal",children:r})})}):null]})}function Wz({row:e}){var a;const t=e.local_after,n=e.local_detail;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||n?s.jsxs("div",{className:"text-muted-foreground text-xs",children:[t,t&&n?" · ":"",n?s.jsx("span",{className:Kz[e.local_tone??"muted"],children:n}):null]}):null,(a=e.local_marks)!=null&&a.length?s.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:e.local_marks.map(r=>s.jsx(fe,{variant:r.tone??"neutral",children:r.label},r.label))}):null]})}function Qz({owners:e,no_owner:t,value:n,on_change:a}){return s.jsxs(Nt,{value:n,onValueChange:a,children:[s.jsx(xt,{className:"w-56","aria-label":"Owner",children:s.jsx(kt,{})}),s.jsxs(gt,{children:[s.jsx(De,{value:Ji,children:"Any owner"}),e.map(r=>s.jsxs(De,{value:r.id,children:[r.label," (",r.count,")"]},r.id)),t!==void 0?s.jsxs(De,{value:V1,children:["No owner (",t,")"]}):null]})]})}function Zz({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?` · ${wg(n.via)}`:""]}),s.jsxs("div",{className:"text-muted-foreground truncate text-xs",title:n.via==="sdlc_login"&&n.via_device?P1(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 Jz={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 e3({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,m]=u.useState(""),[h,x]=u.useState(!1),[j,v]=u.useState({}),[y,g]=u.useState(null),[p,b]=u.useState(!1);u.useEffect(()=>{e&&(o("waiting_for_user"),d(""),m(""),x(!1),v({}),g(null))},[e]);const w=Jz[i],S=async C=>{C.preventDefault();const _={target:w!==null&&!c.trim(),reason:!f.trim()};if(v(_),_.target||_.reason)return;b(!0);const N={hold_type:i,reason:f.trim(),release_claim:h};i==="waiting_for_user"&&(N.target_user_id=c),i==="blocked"&&(N.target_task_id=c),i==="waiting_for_external"&&(N.target_label=c.trim());const O=await l(N);b(!1),g(O)};return s.jsx(bn,{open:e,onOpenChange:C=>C?null:r(),children:s.jsx(wn,{children:s.jsxs("form",{onSubmit:C=>void S(C),noValidate:!0,children:[s.jsxs(_n,{children:[s.jsx(kn,{children:"Add hold"}),s.jsx(Sn,{children:"Say what this task is waiting for."})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[y&&s.jsxs(oe,{variant:"destructive",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ce,{children:y})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"hold-type",children:"Type"}),s.jsxs(Nt,{value:i,onValueChange:C=>{o(C),d(""),v({})},children:[s.jsx(xt,{id:"hold-type",children:s.jsx(kt,{})}),s.jsx(gt,{children:Object.keys(Ho).map(C=>s.jsx(De,{value:C,children:Ho[C].label},C))})]})]}),w?s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"hold-target",children:w.label}),i==="waiting_for_external"?s.jsx(pt,{id:"hold-target",value:c,"aria-invalid":j.target,onChange:C=>d(C.target.value)}):s.jsxs(Nt,{value:c,onValueChange:d,children:[s.jsx(xt,{id:"hold-target","aria-invalid":j.target,children:s.jsx(kt,{placeholder:i==="blocked"?"Choose a task":"Choose a member"})}),s.jsx(gt,{children:i==="blocked"?n.map(C=>s.jsx(De,{value:C.id,children:C.title},C.id)):t.map(C=>s.jsx(De,{value:C.user_id,children:C.label},C.user_id))})]}),s.jsx("p",{className:j.target?"text-destructive text-xs":"text-muted-foreground text-xs",children:j.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(Oe,{htmlFor:"hold-reason",children:"Reason"}),s.jsx(vn,{id:"hold-reason",rows:3,placeholder:"What the task is waiting for",value:f,"aria-invalid":j.reason,onChange:C=>m(C.target.value)}),j.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(ji,{id:"hold-release-claim",checked:h,onCheckedChange:C=>x(C===!0)}),s.jsx(Oe,{htmlFor:"hold-release-claim",children:"Also release my claim"})]})]}),s.jsxs(Nn,{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 _c(){const e=yn().tasks;if(!e)throw new Error("The Task page rendered without the tasks seam.");return e}function kg(){return s.jsxs("div",{className:"grid gap-3",role:"status","aria-label":"Loading task",children:[s.jsx(Ct,{className:"h-8 w-1/2"}),Array.from({length:7},(e,t)=>s.jsx(Ct,{className:t===6?"h-6 w-2/3":"h-6 w-full"},t))]})}function gd({back:e,description:t}){const{href:n,Link:a}=Ze();return s.jsx(fr,{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 dl="not_set",t3=10*60*1e3,ty=20;function n3(){const{members:e}=_c(),[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 s3({active:e,task_id:t,back:n}){const a=_c(),{task:r,activity:l,listTasks:i,hierarchyRevision:o,commands:c}=a,{href:d,Link:f}=Ze(),m=Qr(),{self_id:h}=Fd(),{members:x,name:j}=n3(),{workspace:v}=e,{confirm:y,confirm_dialog:g}=vi(),[p,b]=u.useState(null),[w,S]=u.useState(!1),[C,_]=u.useState(!1),[N,O]=u.useState(null),[D,B]=u.useState([]),[G,U]=u.useState(ty),[R,$]=u.useState([]),[T,E]=u.useState(!1),[k,M]=u.useState(null),[Y,A]=u.useState(null),[I,X]=u.useState(""),[J,ae]=u.useState(null),ke=u.useCallback(async()=>{if(!r)return;const L=await r(t);L.ok?(b(L.data),_(!1)):L.refusal.status===404||L.refusal.status===400?S(!0):_(!0)},[r,t]),Q=u.useRef(0),ee=u.useCallback(async()=>{if(!l)return;const L=Q.current+=1;let Te=[],Le;for(;;){const ft=await l(t,Le);if(L!==Q.current||!ft.ok)return;if(Te=[...Te,...ft.data.events].slice(-1e3),!ft.data.more||!ft.data.next_cursor)break;Le=ft.data.next_cursor}L===Q.current&&B(Te.reverse())},[l,t]);u.useEffect(()=>{ke(),ee()},[ke,ee]);const Ce=p?v.lists.find(L=>L.id===p.task.list_id):void 0,se=u.useMemo(()=>{var L;return((L=v.workflows.find(Te=>Te.id===(p==null?void 0:p.task.workflow_id)))==null?void 0:L.statuses)??[]},[v,p==null?void 0:p.task.workflow_id]);u.useEffect(()=>{if(!p)return;let L=!0;return i(p.task.list_id,{limit:100}).then(Te=>{L&&$(Te.ok?Te.data.tasks.filter(Le=>Le.id!==p.task.id).map(Le=>({id:Le.id,title:Le.title})):[])}),()=>{L=!1}},[i,p==null?void 0:p.task.list_id,p==null?void 0:p.task.id,p]);const Se=u.useCallback(async()=>{await Promise.all([ke(),ee()])},[ke,ee]),me=u.useCallback((L,Te)=>c?c.run(L,Te):Promise.resolve({ok:!1,refusal:{status:0,message:"This page cannot change tasks."}}),[c]),be=u.useCallback(async(L,Te,Le)=>{const ft=await me(L,Te);return ft.ok?(Le&&m.success(Le),await Se(),ft.data):(ft.refusal.code==="revision_conflict"?O({tone:"warning",title:"This task changed while you were editing",body:"We reloaded it. Check the change, then save again."}):ft.refusal.code==="claim_held"?(await ke(),O({tone:"destructive",title:"Someone else claimed this task first",body:"Their claim is shown below. You can take it over if it lapses."})):m.error(ft.refusal.message),await Se(),null)},[me,m,Se,ke]),ve=(p==null?void 0:p.claim)??null,Ae=ve!==null&&ve.id===J&&!ve.lapsed&&!ve.via?ve.id:null;if(u.useEffect(()=>{if(!Ae)return;const L=window.setInterval(()=>{me("renew_claim",{claim_id:Ae,lease_seconds:ey}).then(()=>ke())},t3);return()=>window.clearInterval(L)},[Ae,me,ke]),w)return s.jsx(gd,{back:n});if(C&&!p)return s.jsxs(oe,{variant:"destructive",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:"This task could not be loaded"}),s.jsxs(ce,{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 ke(),children:"Retry"})]})]});if(!p)return s.jsx(kg,{});const{task:Z}=p,je=Z.archived_at!==null,Ee=xd(p.permission,"write")&&!je,Pe=xd(p.permission,"manage"),ie=se.find(L=>L.id===Z.status_id),We=se.find(L=>L.category==="completed"),Ve=v.priorities.find(L=>L.id===Z.priority_id),H=p.contributors.map(L=>L.user_id),we=ve!==null&&ve.user_id===h,at=ve!==null&&!ve.lapsed,Bt=p.checklist.filter(L=>L.is_complete).length,Qt=async()=>{const[L,Te]=await Promise.all([i(Z.list_id,{limit:1}),o(v.id)]);return L.ok?Te.ok?{ok:!0,data:{task_id:Z.id,expected_revision:Z.revision,expected_order_revision:L.data.list.order_revision,expected_hierarchy_revision:Te.data}}:Te:L},jt=(L,Te)=>be("update_task",{task_id:Z.id,expected_revision:Z.revision,changes:L},Te),it=L=>y(L.via==="sdlc_login"?{title:"Release this claim?",description:`You claimed it via ${Oh(L.via,L.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}),an=async()=>{if(!We)return;if(at&&(!we||ve.via)){const Te=ve.via==="api_key"?`${we?"Your":`${j(ve.user_id)}'s`} agent is still working on it.`:ve.via==="sdlc_login"?`${we?"You are":`${j(ve.user_id)} is`} still working on it via ${Oh(ve.via,ve.via_device)}.`:`${j(ve.user_id)} is still working on it.`;if(!await y({title:"Complete this task?",description:Te,action_label:"Mark complete"}))return}await jt({status_id:We.id},"Task completed.")!==null&&ve&&we&&at&&await be("end_claim",{claim_id:ve.id,outcome:"completed"})},rn=async(L,Te)=>{const Le=await Qt();if(!Le.ok){m.error(Le.refusal.message);return}await be(L,Le.data,Te)},Bn=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 rn("archive_task","Task archived.")},Vt=async()=>{await rn("restore_task","Task restored.")},fn=async()=>{var ft;const L=ve,Te=await be("claim_task",{task_id:Z.id,lease_seconds:ey}),Le=(ft=Te==null?void 0:Te.claim)==null?void 0:ft.id;Le&&!(L&&L.id===Le&&L.via)&&ae(Le)},re=async()=>{ve&&(ve.via&&!await it(ve)||(await be("end_claim",{claim_id:ve.id,outcome:"released"},"Claim released."),ae(null)))},K=async()=>{ve&&await be("end_claim",{claim_id:ve.id,outcome:"expired"},"Claim cleared.")},he=async L=>{L.hold_type==="paused"&&h&&(L={...L,target_user_id:h});const Te=await me("open_hold",{task_id:Z.id,hold_type:L.hold_type,reason:L.reason,...L.target_user_id?{target_user_id:L.target_user_id}:{},...L.target_task_id?{target_task_id:L.target_task_id}:{},...L.target_label?{target_label:L.target_label}:{}});return Te.ok?(E(!1),m.success("Hold added."),L.release_claim&&ve&&we&&!ve.via&&(await be("end_claim",{claim_id:ve.id,outcome:"released"}),ae(null)),await Se(),null):Te.refusal.message},Ue=L=>be("checklist",{task_id:Z.id,expected_revision:Z.revision,...L}),dt=async L=>{for(const Te of L.filter(Le=>!H.includes(Le)))await be("set_contributor",{task_id:Z.id,expected_revision:Z.revision,user_id:Te,action:"add"});for(const Te of p.contributors.filter(Le=>!L.includes(Le.user_id)))await be("set_contributor",{task_id:Z.id,expected_revision:Z.revision,user_id:Te.user_id,action:"remove",expected_contributor_revision:Te.revision})},Rn=L=>{var Le;if(L.target.kind==="user")return j(L.target.user_id,h);if(L.target.kind==="external")return L.target.label;if(L.target.hidden||!L.target.task_id)return"A task you cannot see";const Te=L.target.task_id;return s.jsx(f,{className:"text-primary hover:underline",href:d(`${n}/${Te}`),children:((Le=R.find(ft=>ft.id===Te))==null?void 0:Le.title)??"Another task"})},Zt=L=>L.target.kind==="user"&&L.target.user_id===h&&!L.released_at?s.jsx(P,{type:"button",variant:"outline",size:"sm",onClick:()=>void be("release_hold",{hold_id:L.id},"Hold released."),children:"Release"}):Ee?s.jsx(P,{type:"button",variant:"outline",size:"sm",onClick:()=>void be("resolve_hold",{hold_id:L.id},"Hold resolved."),children:"Resolve"}):null;return s.jsxs(s.Fragment,{children:[s.jsx(sn,{title:Z.title,description:`Created ${gs(Z.created_at)} by ${j(Z.created_by,h)}`,actions:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[Ee&&s.jsxs(s.Fragment,{children:[s.jsxs(P,{type:"button",variant:"outline",onClick:()=>M(Z.title),children:[s.jsx(Wd,{className:"mr-2 size-4","aria-hidden":"true"}),"Edit title"]}),We&&Z.status_id!==We.id&&s.jsxs(P,{type:"button",variant:"outline",onClick:()=>void an(),children:[s.jsx(Zr,{className:"mr-2 size-4","aria-hidden":"true"}),"Mark complete"]})]}),Pe&&!je&&s.jsxs(P,{type:"button",variant:"outline",onClick:()=>void Bn(),children:[s.jsx(jj,{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 L=>{L.preventDefault(),k.trim()&&await jt({title:k.trim()})!==null&&M(null)},children:[s.jsx(Oe,{htmlFor:"task-title",className:"sr-only",children:"Title"}),s.jsx(pt,{id:"task-title",className:"max-w-xl",value:k,onChange:L=>M(L.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}),N&&s.jsxs(oe,{variant:N.tone,className:"mt-4","data-testid":"task-notice",children:[N.tone==="warning"?s.jsx(Jr,{className:"size-4","aria-hidden":"true"}):s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:N.title}),s.jsx(ce,{children:N.body})]}),je?s.jsxs(oe,{variant:"info",className:"mt-4",children:[s.jsx(jj,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:"This task is archived"}),s.jsx(ce,{children:Pe?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 Vt(),children:[s.jsx(_T,{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."})})]}):Ee?null:s.jsxs(oe,{variant:"info",className:"mt-4",children:[s.jsx(fc,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:"You can view this task"}),s.jsx(ce,{children:"Ask an organization admin for write access to change it."})]}),Ee?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(Oe,{htmlFor:"task-status",children:"Status"}),s.jsxs(Nt,{value:Z.status_id,onValueChange:L=>void jt({status_id:L}),children:[s.jsx(xt,{id:"task-status",children:s.jsx(kt,{})}),s.jsx(gt,{children:se.map(L=>s.jsx(De,{value:L.id,children:L.name},L.id))})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"task-priority",children:"Priority"}),s.jsxs(Nt,{value:Z.priority_id??dl,onValueChange:L=>void jt({priority_id:L===dl?null:L}),children:[s.jsx(xt,{id:"task-priority",children:s.jsx(kt,{})}),s.jsxs(gt,{children:[s.jsx(De,{value:dl,children:"Not set"}),v.priorities.map(L=>s.jsx(De,{value:L.id,children:L.name},L.id))]})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"task-primary",children:"Primary"}),s.jsxs(Nt,{value:Z.primary_user_id??dl,onValueChange:L=>void jt({primary_user_id:L===dl?null:L}),children:[s.jsx(xt,{id:"task-primary",children:s.jsx(kt,{})}),s.jsxs(gt,{children:[s.jsx(De,{value:dl,children:"Not set"}),x.map(L=>s.jsx(De,{value:L.user_id,children:L.label},L.user_id))]})]})]}),s.jsx(a3,{members:x,selected:H,on_change:L=>void dt(L)})]}):s.jsxs("dl",{className:"mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[s.jsx(Wc,{label:"Status",value:(ie==null?void 0:ie.name)??""}),s.jsx(Wc,{label:"Priority",value:(Ve==null?void 0:Ve.name)??"Not set"}),s.jsx(Wc,{label:"Primary",value:Z.primary_user_id?j(Z.primary_user_id,h):"Not set"}),s.jsx(Wc,{label:"Contributors",value:H.map(L=>j(L,h)).join(", ")||"None"})]}),!je&&s.jsx(r3,{claim:ve,mine:we,holder:ve?j(ve.user_id):"",own:ve!==null&&ve.id===J,can_write:Ee,on_claim:()=>void fn(),on_release:()=>void re(),on_clear:()=>void K()}),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"}),Ee&&Y===null&&s.jsx(P,{type:"button",variant:"ghost",size:"sm",onClick:()=>A(Z.description??""),children:"Edit description"})]}),Y!==null?s.jsxs("form",{className:"mt-2 grid gap-2",onSubmit:async L=>{L.preventDefault(),await jt({description:Y})!==null&&A(null)},children:[s.jsx(Oe,{htmlFor:"task-description",className:"sr-only",children:"Description"}),s.jsx(vn,{id:"task-description",rows:5,value:Y,onChange:L=>A(L.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:()=>A(null),children:"Cancel"})]})]}):s.jsx("p",{className:"mt-2 text-sm whitespace-pre-wrap",children:Z.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?` · ${Bt} of ${p.checklist.length} done`:""]}),s.jsx("ul",{className:"mt-2 grid gap-1",children:p.checklist.map(L=>s.jsxs("li",{className:"flex items-center justify-between gap-2 py-1","data-testid":"task-checklist-item",children:[Ee?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ji,{id:`check-${L.id}`,checked:L.is_complete,onCheckedChange:Te=>void Ue({action:"toggle",item_id:L.id,expected_item_revision:L.revision,is_complete:Te===!0})}),s.jsx(Oe,{htmlFor:`check-${L.id}`,className:"font-normal",children:L.label})]}):s.jsxs("span",{className:"text-sm",children:[L.is_complete?"Done: ":"To do: ",L.label]}),Ee&&s.jsxs(xf,{children:[s.jsx(gf,{asChild:!0,children:s.jsx(P,{type:"button",variant:"ghost",size:"icon","aria-label":`Item actions for ${L.label}`,children:s.jsx(Rx,{className:"size-4","aria-hidden":"true"})})}),s.jsx(bc,{align:"end",children:s.jsx(li,{className:"text-destructive focus:text-destructive",onSelect:()=>void Ue({action:"archive",item_id:L.id,expected_item_revision:L.revision}),children:"Remove"})})]})]},L.id))}),p.checklist.length===0&&!Ee&&s.jsx("p",{className:"text-muted-foreground text-sm",children:"No checklist items."}),Ee&&s.jsxs("form",{className:"mt-2 grid gap-2",onSubmit:async L=>{L.preventDefault(),I.trim()&&await Ue({action:"add",label:I.trim()})!==null&&X("")},children:[s.jsx(Oe,{htmlFor:"task-new-item",children:"Add an item"}),s.jsx(pt,{id:"task-new-item",placeholder:"Add an item and press Enter",value:I,onChange:L=>X(L.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"}),Ee&&s.jsxs(P,{type:"button",variant:"outline",size:"sm",onClick:()=>E(!0),children:[s.jsx(r_,{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(Fe,{containerAriaLabel:"Holds",children:[s.jsx(Qe,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Type"}),s.jsx(F,{children:"Reason"}),s.jsx(F,{children:"Waiting on"}),s.jsx(F,{className:"text-right",children:"Actions"})]})}),s.jsxs(Ke,{children:[p.holds.map(L=>{const Te=Ho[L.hold_type];return s.jsxs(ue,{"data-testid":"task-hold",children:[s.jsx(q,{children:s.jsx(fe,{variant:Te.tone,children:Te.label})}),s.jsxs(q,{children:[s.jsx("div",{children:L.reason}),s.jsx("div",{className:"text-muted-foreground text-xs",children:L.released_at?`Released by ${j(L.released_by,h)} · ${gs(L.released_at)} · Ready to resolve`:`Opened by ${j(L.opened_by,h)} · ${gs(L.opened_at)} · Open`})]}),s.jsx(q,{children:Rn(L)}),s.jsx(q,{className:"text-right",children:Zt(L)})]},L.id)}),p.holds.length===0&&s.jsx(ue,{children:s.jsx(q,{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:[D.slice(0,G).map(L=>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:Dz(L)}),s.jsxs("span",{className:"min-w-0 text-right sm:text-left",children:[s.jsx("span",{children:L.actor_id?j(L.actor_id,h):"The system"}),L.via?s.jsxs("span",{className:"text-muted-foreground block max-w-64 truncate text-xs sm:max-w-none",title:`via ${Oh(L.via,L.via_device)}`,children:["via ",wg(L.via),s.jsx(K1,{via:L.via,device:L.via_device})]}):null]}),s.jsx("span",{className:"text-muted-foreground col-span-2 sm:col-span-1 sm:text-right",children:G1(L.created_at)})]},L.id)),D.length===0&&s.jsx("li",{className:"text-muted-foreground px-3 py-2 text-sm",children:"No activity yet."})]}),D.length>G&&s.jsx(P,{type:"button",variant:"ghost",size:"sm",className:"mt-2",onClick:()=>U(L=>L+ty),children:"Load more"})]}),Ee&&Ce&&s.jsx(e3,{open:T,members:x,tasks:R,holds_my_web_claim:we&&at&&!(ve!=null&&ve.via),on_close:()=>E(!1),on_submit:he}),g]})}function Wc({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 a3({members:e,selected:t,on_change:n}){return s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"task-contributors",children:"Contributors"}),s.jsxs(xf,{children:[s.jsx(gf,{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(e_,{className:"text-muted-foreground size-4","aria-hidden":"true"})]})}),s.jsx(bc,{align:"start",children:e.map(a=>{const r=t.includes(a.user_id);return s.jsxs(li,{onSelect:()=>n(r?t.filter(l=>l!==a.user_id):[...t,a.user_id]),children:[r?s.jsx(Zr,{className:"mr-2 size-4","aria-hidden":"true"}):s.jsx("span",{className:"mr-2 size-4"}),a.label]},a.user_id)})})]})]})}function K1({via:e,device:t}){return e!=="sdlc_login"||!t?null:s.jsxs(s.Fragment,{children:[" on ",s.jsx("bdi",{children:t})]})}function r3({claim:e,mine:t,holder:n,own:a,can_write:r,on_claim:l,on_release:i,on_clear:o}){let c=s.jsx(Tx,{className:"size-4","aria-hidden":"true"}),d="Nobody is working on this",f=r?"Claim it to show others you are.":"",m=r?s.jsx(P,{type:"button",size:"sm",onClick:l,children:"Claim"}):null;if(e&&e.lapsed){const h=new Date(e.lease_expires_at)<=new Date;c=s.jsx(YT,{className:"size-4","aria-hidden":"true"}),d=h?`${t?"Your":`${n}'s`} claim lapsed at ${As(e.lease_expires_at)}`:`${t?"Your":`${n}'s`} claim lapsed`,f=h?"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."),m=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 h=As(e.lease_expires_at);c=e.via==="api_key"?s.jsx(Cx,{className:"size-4","aria-hidden":"true"}):e.via==="sdlc_login"?s.jsx(xE,{className:"size-4","aria-hidden":"true"}):s.jsx(WE,{className:"size-4","aria-hidden":"true"});const x=s.jsxs(s.Fragment,{children:["Claimed via sdlc login",s.jsx(K1,{via:e.via,device:e.via_device}),"."]});t&&e.via==="api_key"?(d=`Your agent is working on this until ${h}`,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 ${h}`,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 ${h}`,f=x):t?(d=`You are working on this until ${h}`,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 ${h}`,f="Claimed through an API key."):(d=`${n} is working on this until ${h}`,f=r?"Claimed on the web. You can take it over if the claim lapses.":"Claimed on the web."),m=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]}),m?s.jsx("div",{className:"flex items-center gap-2",children:m}):null]})}function Sg(e){const t=u.useRef(null),n=u.useRef(!1),[a,r]=u.useState(0),l=u.useCallback(i=>{var o;!i&&((o=t.current)!=null&&o.contains(document.activeElement))&&(n.current=!0,r(c=>c+1)),t.current=i},[]);return u.useEffect(()=>{var c;if(!n.current)return;n.current=!1;const i=document.activeElement;if(i&&i!==document.body)return;const o=(c=e.current)==null?void 0:c.querySelector("h1");o&&(o.tabIndex=-1,o.focus())},[a,e]),l}function X1(){const e=u.useRef(null);return u.useCallback(t=>{const n=e.current;if(e.current=t,t||!(n!=null&&n.contains(document.activeElement)))return;const a=(n.closest("main")??document).querySelector("h1");a&&Promise.resolve().then(()=>{const r=document.activeElement;r&&r!==document.body||!a.isConnected||(a.tabIndex=-1,a.focus())})},[])}const l3=10,W1=5,i3=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/,Q1="Not available",o3={added:"Added",changed:"Changed",removed:"Removed"},c3={thread:"Thread",task:"Task",issue:"Issue",release:"Release",test:"Test"},ny=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;function u3(e,t){const n=t!=null&&t.startsWith("task:")?t.slice(5):null;if(n&&i3.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&&ny.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&&ny.test(l)?{label:`Planned Release ${l}`,path:`/releases?planned=${l}`}:{label:"Tasks",path:`/org/${e}/tasks`}}const Z1=e=>e.status===0||e.reason==="store_locked"||e.reason==="engine_failed"||e.status>=500;function d3({org:e,task_id:t,from:n}){var Vt,fn;const a=_c(),{href:r,Link:l}=Ze(),{confirm:i,confirm_dialog:o}=vi(),c=u3(e,n),[d,f]=u.useState({state:"loading"}),[m,h]=u.useState([]),[x,j]=u.useState([]),[v,y]=u.useState(null),[g,p]=u.useState(null),[b,w]=u.useState({state:"loading"}),[S,C]=u.useState({state:"loading"}),[_,N]=u.useState(null),[O,D]=u.useState(null),[B,G]=u.useState(!1),U=u.useRef(null),R=as(),$=kf({org:e,action:d.state==="ok"?d.detail.local_action:void 0,task_id:t,open_thread:(Vt=a.commands)==null?void 0:Vt.open_thread,labelled:!0}),T=u.useRef(null),E=u.useRef(null),k=u.useRef(null),M=u.useRef(null),Y=u.useRef(!1),A=u.useRef(0),I=u.useRef(0),X=u.useCallback(async()=>{if(!a.taskSections)return;w({state:"loading"});const re=await a.taskSections(t);w(re.ok?{state:"ok",data:re.data}:{state:"failed",refusal:re.refusal})},[a.taskSections,t]),J=u.useCallback(async()=>{if(!a.taskRelated)return;C({state:"loading"});const re=await a.taskRelated(t);C(re.ok?{state:"ok",data:re.data}:{state:"failed",refusal:re.refusal})},[a.taskRelated,t]),ae=u.useCallback(async()=>{var dt,Rn;const re=I.current+=1;p(null),X(),J();const[K,he]=await Promise.all([a.availability(),a.task?a.task(t):Promise.resolve(null)]);if(re!==I.current)return;K.state==="active"&&h(((dt=K.workspace.workflows.find(Zt=>Zt.id===K.list.workflow_id))==null?void 0:dt.statuses)??[]);const Ue=K.state==="off"&&((Rn=K.refusal)==null?void 0:Rn.reason)==="engine_missing"?K.refusal:null;if(!he||!he.ok&&he.refusal.reason==="engine_missing"||Ue){f({state:"engine_missing",refusal:Ue??(he&&!he.ok?he.refusal:{status:0,message:""})});return}if(he.ok){A.current=0,y(null),D(null),f({state:"ok",detail:he.data,at:new Date().toISOString()});return}if(he.refusal.status===404||he.refusal.reason==="not_found"){f({state:"missing"});return}if(A.current+=1,A.current===1&&Z1(he.refusal)){p(he.refusal.retry_after??l3);return}y(he.refusal),f(Zt=>Zt.state==="loading"?{state:"loading"}:Zt)},[a,t,X,J]);u.useEffect(()=>{ae()},[ae]),u.useEffect(()=>{if(g===null)return;const re=setTimeout(()=>void ae(),g*1e3);return()=>clearTimeout(re)},[g,ae]),u.useEffect(()=>{let re=!0;return a.members().then(K=>{re&&K.ok&&j(K.data)}),()=>{re=!1}},[a.members]),u.useEffect(()=>{var K;if(Y.current||d.state!=="ok")return;Y.current=!0;const re=(K=U.current)==null?void 0:K.querySelector("h1");re&&(re.tabIndex=-1,re.focus())},[d.state]),u.useEffect(()=>{var re;_&&((re=E.current)==null||re.focus())},[_]),u.useEffect(()=>{if(O===null)return;const re=setTimeout(()=>{var K;return(K=T.current)==null?void 0:K.focus()},0);return()=>clearTimeout(re)},[O]);const ke=u.useMemo(()=>new Map(x.map(re=>[re.user_id,re.label])),[x]),Q=re=>re?ke.get(re)??re:"",ee=()=>{N(null),ae()},Ce=u.useRef(null),se=re=>(Ce.current=re,re==="graph"?X():J());if(u.useEffect(()=>{var he;const re=Ce.current;if(re===null||(re==="graph"?b:S).state==="loading")return;Ce.current=null;const K=(re==="graph"?k:M).current??((he=U.current)==null?void 0:he.querySelector("h1"));K==null||K.focus()},[b,S]),d.state==="missing")return s.jsx(qa,{children:s.jsx(gd,{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(J0,{className:"size-4","aria-hidden":"true"}),c.label]})});if(d.state==="engine_missing")return s.jsx(qa,{children:s.jsx("div",{ref:U,className:"contents",children:s.jsx(ta,{page:"Task",header:s.jsx(jo,{back:Se,id:null,title:t})})})});const me=v?s.jsxs(oe,{variant:"destructive",className:"mt-4",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:"Could not read this task"}),s.jsxs(ce,{children:[s.jsxs("p",{children:[v.message,v.since?` Since ${xs(v.since)}.`:"",d.state==="ok"?` This page was read at ${xs(d.at)}.`:""," See the sdlc viewer terminal for more."]}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:ee,children:"Retry"})]})]}):null,be=g!==null?s.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",children:[s.jsx(dn,{"aria-hidden":"true"}),"Could not read this task. Trying again in ",g," seconds."]}):null,ve=s.jsx("div",{role:"status","aria-live":"polite",children:be});if(d.state==="loading")return s.jsxs(qa,{children:[ve,me,!v&&g===null?s.jsx(kg,{}):null]});const{detail:Ae,at:Z}=d,{task:je}=Ae,Ee=m.find(re=>re.id===je.status_id),Pe=Ae.local_done&&"task"in Ae.local_done?Ae.local_done:null,ie=Ae.local_waits??[],We=Pe?ie[0]??null:null,Ve=We?Q(We.opened_by):Ae.owner_title??Q(Ae.thread),H=b.state==="ok"?b.data:null,we=(H==null?void 0:H.lifecycle)==="finished",at=we&&(H==null?void 0:H.outcome)==="cancelled",Bt=we&&(H==null?void 0:H.outcome)==="complete",Qt=!!je.created_at,jt=Ae.acceptance??[],it=Ae.local_owner_thread,an=it?s.jsx(l,{className:"text-primary hover:underline",href:r(bg(e,it.key)),children:it.title}):Ae.owner_title??(Q(Ae.thread)||"None"),rn=async()=>{var he;if(!Pe||!((he=a.commands)!=null&&he.complete)||!await i({title:`Mark ${je.title} done?`,description:We?`This answers ${Ve}'s ask, “${We.reason}”, closes that wait, and tells ${Ve} to check and continue.`:`This tells ${Ve||"its thread"} to check and continue.`,action_label:"Mark done"}))return;G(!0);const K=await a.commands.complete(Pe);if(G(!1),!K.ok){D(K.refusal.message);return}await ae(),N({title:je.title,asker:Ve||"Its thread"})},Bn=s.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[Pe&&!_?s.jsxs(s.Fragment,{children:[s.jsxs(P,{ref:T,type:"button",variant:"outline",disabled:B,"aria-disabled":O!==null?!0:void 0,"aria-describedby":O!==null?"task-done-why":void 0,onClick:()=>{O===null&&rn()},children:[s.jsx(Zr,{className:"mr-2 size-4","aria-hidden":"true"}),"Done"]}),O!==null?s.jsx("span",{id:"task-done-why",className:"text-muted-foreground text-xs",children:"Read again first"}):null]}):null,$.button,s.jsxs("span",{className:"text-muted-foreground text-sm",children:["Read at ",xs(Z)]}),s.jsxs(P,{type:"button",variant:"ghost",size:"sm",onClick:ee,children:[s.jsx(Jr,{className:"mr-2 size-4","aria-hidden":"true"}),"Read again"]})]});return s.jsxs(qa,{children:[s.jsxs("div",{ref:U,className:"contents",children:[s.jsx(jo,{back:Se,id:je.id,copy:s.jsx(fp,{text:je.id,label:"Copy ID",what:"the ID",variant:"ghost"}),badge:Ee?s.jsx(fe,{variant:q1(Ee),children:Ee.name}):null,title:je.title,created:Qt?`Created ${gs(je.created_at)}${Ve||Ae.owner_title?` by ${Ae.owner_title??Ve}`:""}`:null,actions:Bn}),$.panel?s.jsx("div",{className:"mt-1 max-w-180",children:$.panel}):null,ve,me,_?s.jsx("div",{ref:E,tabIndex:-1,role:"status","aria-live":"polite",className:"outline-none",children:s.jsxs(oe,{variant:"success",className:"mt-4",children:[s.jsx(Xd,{className:"size-4","aria-hidden":"true"}),s.jsxs(ge,{children:["Marked ",_.title," done"]}),s.jsxs(ce,{children:[_.asker," is told to check and continue."]})]})}):null,O!==null?s.jsxs(oe,{variant:"destructive",className:"mt-4",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:"Done was not recorded"}),s.jsxs(ce,{children:[O," Read again to see the task as it is now."]})]}):null,We&&!_?s.jsxs(oe,{variant:"warning",className:"mt-4",children:[s.jsx(Ut,{className:"size-4","aria-hidden":"true"}),s.jsxs(ge,{children:[Ve," asks: ",We.reason]}),s.jsxs(ce,{children:["Waiting on you since ",_g(We.opened_at),". Done answers it and tells ",Ve," to check and continue."]})]}):null,Ae.view_outdated?s.jsxs(oe,{variant:"warning",className:"mt-4",children:[s.jsx(Ut,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:el}),s.jsxs(ce,{children:[R," 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(Ps,{label:"Owner thread",value:an}),s.jsx(Ps,{label:"Release",value:Ae.release??"None"}),s.jsx(Ps,{label:"Session",value:b.state==="loading"?"Loading…":b.state==="failed"?"Not available":H!=null&&H.session?s.jsxs(s.Fragment,{children:[H.session.provider," ",s.jsx("span",{className:"font-mono break-all",children:H.session.id})]}):"None"}),s.jsx(Ps,{label:"Now",value:Ae.local_detail??(Ee==null?void 0:Ee.name)??""})]}),s.jsx("p",{className:"text-muted-foreground mt-2 text-xs",children:"Local tasks have no priority or contributors."}),s.jsx(f3,{detail:Ae,holder:Q((fn=Ae.claim)==null?void 0:fn.user_id),finished_at:we?(H==null?void 0:H.finished_at)??null:null,read_at:Z}),s.jsxs(oe,{variant:"info",className:"mt-4",children:[s.jsx(fc,{className:"text-info size-4","aria-hidden":"true"}),Pe?s.jsxs(s.Fragment,{children:[s.jsx(ge,{children:"Done is the one change this page makes"}),s.jsx(ce,{children:"Everything else about this task changes through its thread."})]}):s.jsxs(s.Fragment,{children:[s.jsx(ge,{children:"This page only reads tasks"}),s.jsx(ce,{children:"A task changes through the agent thread working on it."})]})]}),Qt?H!=null&&H.record?s.jsxs("p",{className:"mt-4 flex flex-wrap items-center gap-2 text-sm",children:[s.jsxs("span",{children:["Record ",s.jsx("code",{className:"font-mono break-all",children:H.record})]}),s.jsx(fp,{text:H.record,label:"Copy path",what:"the path",variant:"ghost"})]}):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."}),Pe?s.jsx(Dt,{id:"task-done-needs",title:"What Done needs",children:jt.length>0?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-muted-foreground text-xs",children:["The task's acceptance; ",Ve||"its thread"," checks these after Done."]}),s.jsx("ul",{className:"mt-2 grid list-disc gap-1 pl-5 text-sm",children:jt.map(re=>s.jsx("li",{children:re},re))})]}):s.jsxs("p",{className:"text-sm",children:["Its thread gave no acceptance. Ask ",Ve||"its thread"," what Done needs before marking it."]})}):jt.length>0?s.jsxs(Dt,{id:"task-acceptance",title:"Acceptance",children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:Bt?"All met: the task finished complete":at&&(H!=null&&H.finished_at)?`Cancelled ${gs(H.finished_at)}`:"Met when the task finishes complete"}),s.jsx("ul",{className:"mt-2 grid list-disc gap-1 pl-5 text-sm",children:jt.map(re=>s.jsx("li",{children:Bt?`Met: ${re}`:re},re))})]}):null,s.jsx(h3,{detail:Ae,waits:ie,given:Pe!==null,threadName:Q,threadsLink:s.jsx(l,{className:"text-primary hover:underline",href:r(`/org/${e}/threads`),children:"Threads"})}),b.state==="loading"?s.jsxs("div",{className:"mt-6 grid gap-2",role:"status","aria-label":"Loading the task's sections",children:[s.jsx(Ct,{className:"h-8 w-full"}),s.jsx(Ct,{className:"h-8 w-full"}),s.jsx(Ct,{className:"h-8 w-2/3"})]}):null,H?s.jsx(Dt,{id:"task-stands",title:"Where it stands",children:s.jsxs("p",{className:"text-sm",children:[(Ee==null?void 0:Ee.name)??je.status_id,Ae.local_detail?` · ${Ae.local_detail}`:""]})}):null,H!=null&&H.time?s.jsx(m3,{time:H.time}):null,s.jsx(p3,{sections:b,heading_ref:k,on_retry:()=>void se("graph"),taskLink:re=>s.jsx(l,{className:"text-primary hover:underline",href:r(`/org/${e}/tasks/${re}?from=task:${je.id}`),children:re})}),H!=null&&H.files?s.jsx(x3,{files:H.files,finished:we}):null,H!=null&&H.proof?s.jsx(g3,{proof:H.proof,finished_at:H.finished_at,who:Ae.owner_title??null}):null,H&&H.history.length>0?s.jsx(v3,{history:H.history}):null,s.jsx(J1,{related:S,heading_ref:M,on_retry:()=>void se("related"),link:re=>{const K=re.kind==="thread"?`${e?`/org/${e}`:""}/threads#thread-${encodeURIComponent(re.id)}`:re.kind==="task"?`/org/${e}/tasks/${re.id}?from=task:${je.id}`:re.kind==="issue"?`/org/${e}/issues/${encodeURIComponent(re.id)}?from=task:${je.id}`:re.kind==="release"?`/releases?${re.planned?"planned":"release"}=${encodeURIComponent(re.id)}`:null;return K?s.jsx(l,{className:de("text-primary hover:underline",re.kind!=="thread"&&re.label===re.id&&"font-mono"),href:r(K),children:re.label}):re.label}})]}),o]})}function qa({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 jo({back:e,id:t,copy:n,badge:a,title:r,created:l,actions:i}){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("code",{className:"font-mono",children:t}),n,a]}):null,s.jsx(sn,{title:r,description:l??void 0,actions:i})]})}function Ps({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 Dt({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 f3({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 m=setTimeout(l,Math.min(f+50,2147483647));return()=>clearTimeout(m)},[i]);let o=s.jsx(Tx,{className:"size-4","aria-hidden":"true"}),c="Nobody is working on this",d=null;if(e.view_outdated)c=`Claimed by: ${Q1}`;else if(r){const f=new Date(r.lease_expires_at)<=new Date(Math.max(Date.now(),new Date(a).getTime()));o=s.jsx(Cx,{className:"size-4","aria-hidden":"true"}),c=`${t} is working on this until ${xs(r.lease_expires_at)}${f||r.lapsed?" · passed":""}`,d="Claimed in the coordination registry; its thread renews the claim."}else n&&(o=s.jsx(Xd,{className:"size-4","aria-hidden":"true"}),d=`Finished ${gs(n)}. Its claim ended when it finished.`);return s.jsxs(mt,{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 h3({detail:e,waits:t,given:n,threadName:a,threadsLink:r}){if(e.view_outdated)return s.jsx(Dt,{id:"task-holds",title:"Holds",children:s.jsx("p",{className:"text-sm",children:Q1})});if(e.holds.length===0)return null;const l=new Map(t.map(i=>[i.id,i]));return s.jsxs(Dt,{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(mt,{className:"mt-2 overflow-x-auto",children:s.jsxs(Fe,{containerAriaLabel:"Holds",children:[s.jsx(Qe,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Type"}),s.jsx(F,{children:"Reason"}),s.jsx(F,{children:"Waiting on"}),s.jsx(F,{children:"Opened"})]})}),s.jsx(Ke,{children:e.holds.map(i=>{var f;const o=l.get(i.id),c=Ho[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(q,{children:s.jsx(fe,{variant:c.tone,children:(o==null?void 0:o.local_label)??c.label})}),s.jsxs(q,{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(q,{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(q,{children:_g(i.opened_at)})]},i.id)})})]})})]})}function m3({time:e}){return s.jsx(Dt,{id:"task-time",title:"Time",children:s.jsxs("dl",{className:"grid gap-4 sm:grid-cols-3",children:[s.jsx(Ps,{label:"Estimate",value:e.estimate?`${qi(e.estimate.low)}–${qi(e.estimate.high)}`:e.unknown_reason??"None"}),s.jsx(Ps,{label:"Time taken",value:e.elapsed!==null?`${qi(e.elapsed)}${e.over_estimate?" · over estimate":""}`:"Not started"}),e.forecast?s.jsx(Ps,{label:"Reforecast",value:s.jsxs("span",{className:"text-muted-foreground",children:[qi(e.forecast.low),"–",qi(e.forecast.high)," left",e.forecast.reason?` · ${e.forecast.reason}`:""]})}):null]})})}function Cg({what:e,again:t,refusal:n,on_retry:a}){const r=X1();return s.jsxs(oe,{variant:"destructive",ref:r,children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsxs(ge,{children:["Could not read ",e]}),s.jsxs(ce,{children:[s.jsx("p",{children:n.message}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:a,children:t})]})]})}function p3({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(Dt,{id:"task-graph",title:"Graph changes",heading_ref:t,children:s.jsx(Cg,{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(Dt,{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,W1),d=o.changes.length-c.length;return s.jsxs(Dt,{id:"task-graph",title:"Graph changes",aside:o.document,heading_ref:t,children:[s.jsx(mt,{className:"overflow-x-auto",children:s.jsxs(Fe,{containerAriaLabel:"Graph changes",children:[s.jsx(Qe,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Change"}),s.jsx(F,{children:"Kind of change"}),s.jsx(F,{children:"Also in"}),s.jsx(F,{children:"In the plan"})]})}),s.jsx(Ke,{children:c.map(f=>s.jsxs(ue,{children:[s.jsxs(q,{children:[s.jsx("div",{children:f.label}),s.jsx("div",{className:"text-muted-foreground text-xs",children:f.type})]}),s.jsx(q,{children:o3[f.change]}),s.jsx(q,{children:f.also_in.length===0?"No other task":f.also_in.map((m,h)=>s.jsxs(u.Fragment,{children:[h>0?", ":null,a(m.id)]},m.id))}),s.jsx(q,{children:f.planned?"Yes":s.jsx(fe,{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 x3({files:e,finished:t}){const[n,a]=u.useState(!1),r=n?e.paths:e.paths.slice(0,W1);return s.jsxs(Dt,{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 g3({proof:e,finished_at:t,who:n}){return s.jsxs(Dt,{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 ",gs(t),n?` by ${n}`:""]}):null]})}function v3({history:e}){return s.jsxs(Dt,{id:"task-history",title:"History",children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:"From the task record, newest first"}),s.jsx(mt,{className:"mt-2 overflow-x-auto",children:s.jsxs(Fe,{containerAriaLabel:"History",children:[s.jsx(Qe,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"What"}),s.jsx(F,{children:"Who"}),s.jsx(F,{children:"When"})]})}),s.jsx(Ke,{children:e.map((t,n)=>s.jsxs(ue,{children:[s.jsx(q,{children:t.what}),s.jsx(q,{children:t.who??"Its thread"}),s.jsx(q,{children:_g(t.at)})]},`${t.at}:${n}`))})]})})]})}function J1({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(Dt,{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(Ct,{className:"h-8 w-full"}),s.jsx(Ct,{className:"h-8 w-full"}),s.jsx(Ct,{className:"h-8 w-2/3"})]}):t.state==="failed"?s.jsx(Cg,{what:"related work",again:"Read related work again",refusal:t.refusal,on_retry:a}):s.jsx(mt,{className:"overflow-x-auto",children:s.jsxs(Fe,{containerAriaLabel:"Related",className:l?"table-fixed":void 0,children:[s.jsx(Qe,{children:s.jsxs(ue,{children:[s.jsx(F,{className:l?"w-[14%]":void 0,children:"Kind"}),s.jsx(F,{className:l?"w-[45%]":void 0,children:"Item"}),s.jsx(F,{className:l?"w-[41%]":void 0,children:"How it relates"})]})}),s.jsx(Ke,{children:t.data.map(i=>s.jsxs(ue,{children:[s.jsx(q,{children:c3[i.kind]}),s.jsx(q,{className:l?"break-words":void 0,children:r(i)}),s.jsx(q,{className:l?"break-words":void 0,children:i.relation})]},`${i.kind}:${i.planned?"planned:":""}${i.id}`))})]})})})}function j3({org:e,task_id:t,from:n}){const a=_c(),r=`/org/${e}/tasks`;return a.taskSections?s.jsx(d3,{org:e,task_id:t,from:n??null}):s.jsx(y3,{task_id:t,back:r})}function y3({task_id:e,back:t}){const{availability:n}=_c(),[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(gd,{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(s3,{active:a,task_id:e,back:t}):a.state==="error"?s.jsxs(oe,{variant:"destructive",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:"This task could not be loaded"}),s.jsx(ce,{children:"Check your connection and try again."})]}):a.state==="available"?s.jsx(gd,{back:t}):s.jsx(kg,{})})}function hs({children:e}){return s.jsx("p",{role:"alert",className:"text-destructive text-sm",children:e})}const b3=["open","triaged","resolved","closed"],Rg=["low","normal","high","urgent"],w3=["fixed","works_as_intended","planned","duplicate","wont_fix","cannot_reproduce"],_3=["title","description","external_reference"],vd={open:"Open",triaged:"Triaged",escalated:"Escalated",waiting_on_fix:"Waiting on fix",resolved:"Resolved",closed:"Closed"},eS={open:"warning",triaged:"info",escalated:"info",waiting_on_fix:"info",resolved:"success",closed:"neutral"},Po={low:"Low",normal:"Normal",high:"High",urgent:"Urgent"},Tg={fixed:"Fixed",works_as_intended:"Works as intended",planned:"Planned",duplicate:"Duplicate",wont_fix:"Won't fix",cannot_reproduce:"Cannot reproduce"},tS={title:"Title",description:"Description",external_reference:"External reference"},N3=[["year",365*24*3600],["month",30*24*3600],["week",7*24*3600],["day",24*3600],["hour",3600],["minute",60]];function wu(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 N3)if(Math.abs(n)>=l)return a.format(Math.round(n/l),r);return"just now"}function hp(e,t,n){const a=`/org/${encodeURIComponent(e)}/proj/${encodeURIComponent(t)}/support`;return n?`${a}/${encodeURIComponent(n)}`:a}function Eg(e,t){return e?t??"Not available":"A former member"}const k3="the issue integration";function S3(e){return!e.created_by&&e.reporter_kind==="customer"?k3:Eg(e.created_by,e.created_by_username)}function C3(e,t){return!e.actor_id&&e.kind==="created"&&t.reporter_kind==="customer"?"The issue integration":Eg(e.actor_id,e.actor_username)}const Qc="not_set",R3="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 T3({create:e,open:t,onOpenChange:n,onCreated:a}){const[r,l]=u.useState(""),[i,o]=u.useState(""),[c,d]=u.useState(!1),[f,m]=u.useState(""),[h,x]=u.useState(Qc),[j,v]=u.useState(!1),[y,g]=u.useState(null),p=u.useRef(null),b=()=>{l(""),o(""),d(!1),m(""),x(Qc),g(null),p.current=null},w=_=>{var N;return((N=y==null?void 0:y.personal_data)==null?void 0:N.field)===_?y.message:void 0},S=async _=>{if(_.preventDefault(),j)return;v(!0),p.current??(p.current=crypto.randomUUID());const N=await e({request_id:p.current,title:i.trim()||void 0,description:f||void 0,external_reference:r.trim()||void 0,priority:h===Qc?null:h});if(v(!1),!N.ok){N.refusal.status!==0&&(p.current=null),g(N.refusal);return}b(),a(N.data.issue,N.data.duplicates)},C=y&&!y.personal_data?y.message:void 0;return s.jsx(bn,{open:t,onOpenChange:_=>{_||b(),n(_)},children:s.jsx(wn,{className:"sm:max-w-2xl",children:s.jsxs("form",{onSubmit:S,className:"grid gap-4",children:[s.jsxs(_n,{children:[s.jsx(kn,{children:"New support issue"}),s.jsx(Sn,{children:"Log one help-desk report. Text is shown exactly as entered."})]}),s.jsxs(oe,{variant:"warning",children:[s.jsx(Ut,{}),s.jsx(ce,{children:R3})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"maintain-issue-reference",children:"External reference"}),s.jsx(pt,{id:"maintain-issue-reference",value:r,"aria-invalid":!!w("external_reference"),onChange:_=>{l(_.target.value),c||o(_.target.value)}}),w("external_reference")?s.jsx(hs,{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(Oe,{htmlFor:"maintain-issue-title",children:"Title"}),s.jsx(pt,{id:"maintain-issue-title",value:i,"aria-invalid":!!w("title"),onChange:_=>{o(_.target.value),d(!0)}}),w("title")?s.jsx(hs,{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(Oe,{htmlFor:"maintain-issue-description",children:"Description"}),s.jsx(vn,{id:"maintain-issue-description",rows:4,placeholder:"What the end user reported, without personal data",value:f,"aria-invalid":!!w("description"),onChange:_=>m(_.target.value)}),w("description")?s.jsx(hs,{children:w("description")}):null]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"maintain-issue-priority",children:"Priority"}),s.jsxs(Nt,{value:h,onValueChange:x,children:[s.jsx(xt,{id:"maintain-issue-priority",children:s.jsx(kt,{})}),s.jsxs(gt,{children:[s.jsx(De,{value:Qc,children:"Not set"}),Rg.map(_=>s.jsx(De,{value:_,children:Po[_]},_))]})]})]}),C?s.jsx(hs,{children:C}):null,s.jsxs(Nn,{children:[s.jsx(P,{type:"button",variant:"outline",onClick:()=>{b(),n(!1)},children:"Cancel"}),s.jsx(P,{type:"submit",loading:j,disabled:!i.trim()&&!r.trim(),children:"Log issue"})]})]})})})}const E3=["supportAccess","assigneeCandidates","create","update","assign","transition","redact"];function nS(){return A3(yn().issues)}function A3(e){return e&&E3.every(t=>typeof e[t]=="function")?e:null}function sS(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 aS({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(dn,{className:"size-5"}),s.jsx("span",{className:"sr-only",children:"Loading…"})]}):e.state==="error"||!e.access.enabled?s.jsx(fr,{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(NE,{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 rS(){const e=Ze();return t=>{e.navigate?e.navigate(t):window.location.assign(e.href(t))}}const Yn="all",Zc=25;function mp({action:e}){return s.jsx(sn,{title:"Support",description:"Help-desk reports logged against this project.",actions:e})}function $3({org:e,project:t,query:n}){const a=nS(),r=sS(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(aS,{access:r,header:s.jsx(mp,{}),back_href:l,children:i=>a?s.jsx(M3,{contract:a,access:i,org_name:e,proj_name:t,query:n}):null})})}function M3({contract:e,access:t,org_name:n,proj_name:a,query:r}){const{href:l,Link:i}=Ze(),o=rS(),[c,d]=u.useState(()=>new URLSearchParams(r).get("external_reference")??""),[f,m]=u.useState(Yn),[h,x]=u.useState(Yn),[j,v]=u.useState(Yn),[y,g]=u.useState(0),[p,b]=u.useState(null),[w,S]=u.useState(0),[C,_]=u.useState(null),[N,O]=u.useState([]),[D,B]=u.useState(!1),G=c.trim()!==""||f!==Yn||h!==Yn||j!==Yn,U=u.useCallback(async()=>{const k=await e.list({external_reference:c.trim()||void 0,status:f===Yn?void 0:f,priority:h===Yn?void 0:h,assignee:j===Yn?void 0:j,limit:Zc,offset:y*Zc});if(!k.ok){_(k.refusal.message);return}_(null),b(k.data.issues),S(k.data.total)},[e,c,f,h,j,y]);u.useEffect(()=>{const k=setTimeout(()=>void U(),200);return()=>clearTimeout(k)},[U]),u.useEffect(()=>{e.assigneeCandidates().then(k=>{k.ok&&O(k.data.candidates)})},[e]);const R=t.can_change?s.jsxs(P,{onClick:()=>B(!0),children:[s.jsx(rr,{className:"mr-2 size-4"}),"New issue"]}):void 0,$=s.jsx(T3,{create:e.create,open:D,onOpenChange:B,onCreated:(k,M)=>{B(!1);const Y=hp(n,a,k.id);o(M.length?`${Y}?duplicates=${M.length}`:Y)}});if(p!==null&&w===0&&!G&&y===0)return s.jsxs(s.Fragment,{children:[s.jsx(mp,{}),s.jsxs("div",{className:"flex flex-col items-center gap-3 py-24 text-center",children:[s.jsx(vE,{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:()=>B(!0),children:[s.jsx(rr,{className:"mr-2 size-4"}),"Log the first issue"]}):null]}),$]});const T=w===0?0:y*Zc+1,E=Math.min(w,(y+1)*Zc);return s.jsxs(s.Fragment,{children:[s.jsx(mp,{action:R}),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(PE,{className:"text-muted-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2","aria-hidden":!0}),s.jsx(pt,{"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(zh,{label:"Status",value:f,onChange:k=>{m(k),g(0)},options:b3.map(k=>({value:k,label:vd[k]}))}),s.jsx(zh,{label:"Priority",value:h,onChange:k=>{x(k),g(0)},options:Rg.map(k=>({value:k,label:Po[k]}))}),s.jsx(zh,{label:"Assignee",value:j,onChange:k=>{v(k),g(0)},options:[{value:"unassigned",label:"Unassigned"},{value:"cannot_act",label:"Assignee cannot act"},...N.map(k=>({value:k.user_id,label:k.username??"Not available"}))]})]}),C?s.jsx(hs,{children:C}):null,s.jsx("div",{className:"rounded-md border",children:s.jsxs(Fe,{children:[s.jsx(Qe,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Title"}),s.jsx(F,{children:"External reference"}),s.jsx(F,{children:"Status"}),s.jsx(F,{children:"Priority"}),s.jsx(F,{children:"Assignee"}),s.jsx(F,{children:"Updated"})]})}),s.jsx(Ke,{children:p===null?s.jsx(ue,{children:s.jsx(q,{colSpan:6,className:"h-24 text-center",children:"Loading…"})}):p.length===0?s.jsx(ue,{children:s.jsx(q,{colSpan:6,className:"h-24 text-center",children:"No issues match these filters."})}):p.map(k=>s.jsxs(ue,{children:[s.jsx(q,{className:"max-w-md",children:s.jsx(i,{href:l(hp(n,a,k.id)),className:"font-medium hover:underline",children:k.title})}),s.jsx(q,{className:"font-mono text-xs",children:k.external_reference??""}),s.jsx(q,{children:s.jsx(fe,{variant:eS[k.status],children:vd[k.status]})}),s.jsx(q,{children:k.priority?Po[k.priority]:""}),s.jsx(q,{children:s.jsx(O3,{issue:k})}),s.jsx(q,{className:"text-muted-foreground",children:wu(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 ${T}–${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"})]})]}),$]})}function O3({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(fe,{variant:"error",children:"Assignee cannot act"}):null]}):s.jsx("span",{className:"text-muted-foreground",children:"Unassigned"})}function zh({label:e,value:t,onChange:n,options:a}){var l;const r=u.useMemo(()=>t===Yn||a.some(i=>i.value===t),[a,t]);return s.jsxs(Nt,{value:r?t:Yn,onValueChange:n,children:[s.jsx(xt,{className:"w-44","aria-label":e,children:s.jsx(kt,{placeholder:e,children:t===Yn?e:(l=a.find(i=>i.value===t))==null?void 0:l.label})}),s.jsxs(gt,{children:[s.jsx(De,{value:Yn,children:"All"}),a.map(i=>s.jsx(De,{value:i.value,children:i.label},i.value))]})]})}function cr(e,t){u.useEffect(()=>{const n=setInterval(()=>{document.visibilityState==="visible"&&e("tick")},t),a=()=>{document.visibilityState==="visible"&&e("shown")};return document.addEventListener("visibilitychange",a),()=>{clearInterval(n),document.removeEventListener("visibilitychange",a)}},[e,t])}const D3=5e3;function vs(){const e=u.useRef(0),t=u.useRef(null);return u.useEffect(()=>()=>{t.current!==null&&clearTimeout(t.current)},[]),u.useMemo(()=>({owed:()=>e.current>0,busy:()=>e.current>0||t.current!==null,track:async n=>{e.current+=1;try{return await n}finally{e.current-=1,t.current!==null&&clearTimeout(t.current),t.current=setTimeout(()=>{t.current=null},D3)}}}),[])}function Sf(e,t){return n=>{(n==="shown"?e.owed():e.busy())||t()}}const lS=[{key:"local",label:"Local"},{key:"staging",label:"Staging"},{key:"production",label:"Production"}],z3=/^iss-\d{1,9}$/,L3=/^col-\d{1,9}$/,U3=e=>e&&e[0].toUpperCase()+e.slice(1);function iS(e){const t=U3(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 yo(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 pp={search:"",owner:null,urgent:!1,seen:[],label:null,collection:null};function _u(e){const t=new URLSearchParams(e),n=t.getAll("seen").filter(r=>lS.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&&L3.test(a)?a:null}}function Ag(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()}const oS=new Set(["resolved"]),Lh=10,B3=new Set(["unplaced","unowned","routed","fixing","resolved"]),I3=["open","fold","all"];function cS(e){const t=new URLSearchParams(e),n=a=>[...new Set(t.getAll(a).filter(r=>B3.has(r)))];return{open:n("open"),fold:n("fold"),all:n("all")}}const H3=(e,t)=>oS.has(t)?!e.open.includes(t):e.fold.includes(t);function P3(e,t,n){const a=e.open.filter(i=>i!==t),r=e.fold.filter(i=>i!==t),l=oS.has(t);return n&&!l&&r.push(t),!n&&l&&a.push(t),{...e,open:a,fold:r}}const q3=(e,t,n)=>({...e,all:n?[...e.all.filter(a=>a!==t),t]:e.all.filter(a=>a!==t)});function jl(e,t){const n=new URLSearchParams(Ag(e));for(const a of I3)for(const r of t[a])n.append(a,r);return n.toString()}function G3(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 sy=e=>!!(e.search.trim()||e.owner||e.urgent||e.seen.length||e.label||e.collection),V3={agent:"Filed by an agent",user:"Filed by you",tool:"Filed by a tool"},Y3={graph:"Placed on the graph by its anchors",files:"Placed by its files",unplaced:"Triaged, not placed yet"},F3={handoff:"Handed to its owner",backlog:"Sent to the unowned backlog",batch:"Routed to a batch"};function K3(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 V3[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 Y3[l]??(l?`Triaged: ${l}`:"Triaged");case"routed":return F3[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 X3=e=>e.replace(/`+/g,"").replace(/\s+/g," ").trim(),ay={report:{title:"Triage places what you report",body:"Report an issue here and triage places it and suggests an owner. Route and resolve issues with the issue command or through the thread working on them."},read_only:{title:"This page only reads issues",body:"File, route and resolve issues with the issue command or through the thread working on them."}},ry={title:"This page only reads issues",body:"Route and resolve issues with the issue command or through the thread working on them."},W3=e=>e?"Issues you report here, or file with the issue command, appear here.":"Issues filed in this repository with the issue command appear here.";function uS(e){const t=new Set;for(const n of e.split(",")){const a=n.trim().toLowerCase().replace(/[\s_]+/g,"-");a&&t.add(a)}return[...t]}const Q3=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,ly=40,xp=10,iy=40,Z3=200,Uh="not_set",dS=[{value:"not_set",label:"Not set"},{value:"local",label:"Local"},{value:"staging",label:"Staging"},{value:"production",label:"Production"}],mn={title:"Report an issue",description:"Triage places it and suggests an owner; you'll see where it went.",needs_what:"Say what is wrong to report it.",refused:"The issue was not reported",kept:"Your draft is kept: report it again.",maybe_filed:"The report may have been filed",timeout:"The issue command did not answer within 1 minute, so the report may have been filed. Look for it in the list before you report it again.",failed:"The issue command failed, so the report may have been filed. Look for it in the list before you report it again; the sdlc viewer terminal says what failed.",kept_only:"Your draft is kept.",too_long:"The report is too long to send; shorten What happens or What should happen.",no_answer:"The viewer did not answer.",reporting:"Reporting…"},$l={what:"",actual:"",expected:"",env:"not_set",shows:"",collection:"",ref:"",labels:""},gp=e=>`sdlc.issue-report-draft:${e}`;function J3(e){try{const t=JSON.parse(window.sessionStorage.getItem(gp(e))??"null");if(!t||typeof t!="object")return $l;const n={...$l};for(const a of Object.keys($l))typeof t[a]=="string"&&(n[a]=t[a]);return dS.some(a=>a.value===n.env)||(n.env="not_set"),n}catch{return $l}}function Bh(e,t){try{t?window.sessionStorage.setItem(gp(e),JSON.stringify(t)):window.sessionStorage.removeItem(gp(e))}catch{}}function eL(e){const t=uS(e);if(t.length>xp)return`At most ${xp} labels; this has ${t.length}.`;const n=t.find(a=>!Q3.test(a)||a.length>ly);return n?`'${n}' is not a label: use a-z, 0-9 and single hyphens, at most ${ly} characters.`:null}function tL(e){return e.status===504||e.code==="timeout"?mn.timeout:e.status===500?mn.failed:e.status===413?mn.too_long:[400,422].includes(e.status)&&e.message?e.message:mn.no_answer}function Ih(e){return e===mn.timeout||e===mn.failed}function nL(e){const t={what:e.what.trim()};e.actual.trim()&&(t.actual=e.actual),e.expected.trim()&&(t.expected=e.expected),e.env!=="not_set"&&(t.env=e.env),e.shows.trim()&&(t.shows=e.shows.trim()),e.collection&&(t.collection=e.collection,e.ref.trim()&&(t.ref=e.ref.trim()));const n=uS(e.labels);return n.length&&(t.labels=n.join(",")),t}function sL({project:e,report:t,reportCollections:n,open:a,onOpenChange:r,onFiled:l,onMaybeFiled:i}){const[o,c]=u.useState($l),[d,f]=u.useState(null),[m,h]=u.useState(!1),[x,j]=u.useState(null),[v,y]=u.useState(null),g=u.useRef(null),p=u.useRef(null),b=u.useRef(null),w=u.useRef(!1),S=u.useId(),C=R=>`${S}-report-${R}`;u.useEffect(()=>{if(!a||(c(J3(e)),j(null),y(null),f(null),!n))return;let R=!0;return n().then($=>{R&&f($.ok?$.data.collections:[])}),()=>{R=!1}},[a,e,n]);const _=R=>c($=>{const T={...$,...R};return Bh(e,T),T}),N=u.useMemo(()=>{const R=d??[];return o.collection&&!R.some($=>$.collection===o.collection)?[...R,{collection:o.collection,title:o.collection}]:R},[d,o.collection]),O=N.length>0,D=R=>{m||(R&&Bh(e,null),r(!1))},B=async R=>{var E,k;if(R.preventDefault(),w.current)return;if(!o.what.trim()){(E=g.current)==null||E.focus();return}const $=eL(o.labels);if(y($),$){(k=p.current)==null||k.focus();return}w.current=!0,h(!0),j(null);const T=await t(nL(o));if(w.current=!1,h(!1),!T.ok){const M=tL(T.refusal);j(M),Ih(M)&&(i==null||i());return}Bh(e,null),c($l),r(!1),l(T.data)};u.useEffect(()=>{var R,$,T;x&&(($=(R=b.current)==null?void 0:R.scrollIntoView)==null||$.call(R,{block:"nearest"}),(T=g.current)==null||T.focus())},[x]);const G=!o.what.trim(),U=[C("what-help"),x?C("refused"):null].filter(Boolean).join(" ");return s.jsx(bn,{open:a,onOpenChange:R=>R?r(!0):D(!1),children:s.jsx(wn,{className:"max-h-[90vh] overflow-y-auto sm:max-w-2xl",onOpenAutoFocus:R=>{var $;R.preventDefault(),($=g.current)==null||$.focus()},children:s.jsxs("form",{onSubmit:B,className:"grid gap-4",noValidate:!0,children:[s.jsxs(_n,{children:[s.jsx(kn,{children:mn.title}),s.jsx(Sn,{children:mn.description})]}),x?s.jsxs(oe,{ref:b,variant:"destructive",id:C("refused"),children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:Ih(x)?mn.maybe_filed:mn.refused}),s.jsxs(ce,{children:[/[.!?]$/.test(x)?x:`${x}.`," ",Ih(x)?mn.kept_only:mn.kept]})]}):null,s.jsxs("fieldset",{disabled:m,className:"grid min-w-0 gap-4",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsxs(Oe,{htmlFor:C("what"),children:["What is wrong ",s.jsx("span",{"aria-hidden":"true",children:"*"})]}),s.jsx(pt,{id:C("what"),ref:g,"aria-required":"true",maxLength:Z3,placeholder:"One line: what you saw",value:o.what,"aria-describedby":U,onChange:R=>_({what:R.target.value})}),s.jsx("p",{id:C("what-help"),className:"text-muted-foreground text-xs",children:"It becomes the issue's title."})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:C("actual"),children:"What happens"}),s.jsx(vn,{id:C("actual"),rows:3,placeholder:"What you see, step by step",value:o.actual,onChange:R=>_({actual:R.target.value})})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:C("expected"),children:"What should happen"}),s.jsx(vn,{id:C("expected"),rows:3,placeholder:"What you expected instead",value:o.expected,onChange:R=>_({expected:R.target.value})})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:C("env"),children:"Where you saw it"}),s.jsxs(Nt,{value:o.env,disabled:m,onValueChange:R=>_({env:R}),children:[s.jsx(xt,{id:C("env"),children:s.jsx(kt,{})}),s.jsx(gt,{children:dS.map(R=>s.jsx(De,{value:R.value,children:R.label},R.value))})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:C("shows"),children:"Shows in"}),s.jsx(pt,{id:C("shows"),placeholder:"packages/app/page.tsx or Report button",value:o.shows,"aria-describedby":C("shows-help"),onChange:R=>_({shows:R.target.value})}),s.jsx("p",{id:C("shows-help"),className:"text-muted-foreground text-xs",children:"A file path in this repository, or the words you saw on the screen."})]}),O?s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:C("collection"),children:"Collection"}),s.jsxs(Nt,{value:o.collection||Uh,disabled:m,onValueChange:R=>_({collection:R===Uh?"":R}),children:[s.jsx(xt,{id:C("collection"),children:s.jsx(kt,{})}),s.jsxs(gt,{children:[s.jsx(De,{value:Uh,children:"Not set"}),N.map(R=>s.jsx(De,{value:R.collection,children:R.title===R.collection?R.collection:`${R.title} (${R.collection})`},R.collection))]})]})]}):null,O&&o.collection?s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:C("ref"),children:"Place in the collection"}),s.jsx(pt,{id:C("ref"),maxLength:iy,placeholder:"Like item 5",value:o.ref,"aria-describedby":C("ref-help"),onChange:R=>_({ref:R.target.value})}),s.jsxs("p",{id:C("ref-help"),className:"text-muted-foreground text-xs",children:["At most ",iy," characters."]})]}):null,s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:C("labels"),children:"Labels"}),s.jsx(pt,{id:C("labels"),ref:p,placeholder:"viewer, report form",value:o.labels,"aria-invalid":v?!0:void 0,"aria-describedby":C(v?"labels-error":"labels-help"),onChange:R=>{_({labels:R.target.value}),v&&y(null)}}),v?s.jsx("div",{id:C("labels-error"),children:s.jsx(hs,{children:v})}):s.jsxs("p",{id:C("labels-help"),className:"text-muted-foreground text-xs",children:["Up to ",xp," words to find it by, separated by commas."]})]})]}),s.jsx("p",{id:C("needs-what"),className:"sr-only",children:mn.needs_what}),s.jsx("div",{role:"status","aria-live":"polite",className:"sr-only",children:m?mn.reporting:""}),s.jsxs(Nn,{children:[s.jsx(P,{type:"button",variant:"outline",disabled:m,onClick:()=>D(!0),children:"Cancel"}),s.jsx(P,{type:"submit",loading:m,"aria-disabled":G?!0:void 0,"aria-describedby":C("needs-what"),children:m?mn.reporting:"Report"})]})]})})})}function aL(e,t){const n=new URLSearchParams(e).get("reported");return n&&(n===`Seen before: added to ${t}`||n.startsWith(`Filed ${t} · `)&&n.length<=200&&!/[\n\r]/.test(n))?n:null}const rL=10,fS=1e4,lL=250,fl="__all",iL="none",oL=e=>e.status===0||e.reason==="store_locked"||e.reason==="engine_failed"||e.status>=500;function hS(){const e=yn().issues;if(!e)throw new Error("The Issues page rendered without the issues seam.");return e}const cL=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 uL({org:e,project:t,query:n,onQuery:a}){var We,Ve;const r=hS(),l=(We=r.commands)==null?void 0:We.open_thread,i=u.useMemo(()=>l?{org:e,open_thread:l}:void 0,[e,l]),{href:o,Link:c}=Ze(),d=rS(),[f,m]=u.useState(!1),h=u.useMemo(()=>_u(n),[n]),x=u.useMemo(()=>cS(n),[n]),j=Ag(h),v=sy(h),y=jl(h,x),[g,p]=u.useState({state:"loading"}),[b,w]=u.useState(null),[S,C]=u.useState(null),_=u.useRef(0),N=u.useRef(0),O=u.useRef(null),D=u.useRef(null),B=as(),G=u.useRef(!1),[U,R]=u.useState(h.search),$=u.useCallback(H=>a(jl({...h,...H},x)),[h,x,a]),T=u.useCallback(H=>a(jl(h,H)),[h,a]),E=vs(),k=u.useCallback(async()=>{const H=N.current+=1;C(null);const we=await E.track(r.list(G3(_u(j))));if(H!==N.current)return;if(we.ok){_.current=0,w(null),p({state:"ok",list:we.data,local:we.data.local??cL(new Date().toISOString()),key:j});return}const at=we.refusal.reason;if(at==="engine_missing")return p({state:"engine_missing",refusal:we.refusal});if(at==="view_outdated")return p({state:"view_outdated"});if(_.current+=1,_.current===1&&oL(we.refusal)){C(we.refusal.retry_after??rL);return}w(we.refusal)},[r.list,j,E]);u.useEffect(()=>{k()},[k]);const M=u.useMemo(()=>Sf(E,()=>void k()),[k,E]);cr(M,fS),u.useEffect(()=>{if(S===null)return;const H=setTimeout(()=>{document.visibilityState==="visible"&&k()},S*1e3);return()=>clearTimeout(H)},[S,k]),u.useEffect(()=>{document.activeElement!==O.current&&R(h.search)},[h.search]),u.useEffect(()=>{if(U===h.search)return;const H=setTimeout(()=>$({search:U}),lL);return()=>clearTimeout(H)},[U,h.search,$]),u.useEffect(()=>{const H=we=>{if(we.key!=="/"||we.metaKey||we.ctrlKey||we.altKey)return;const at=we.target;at&&(at.isContentEditable||["INPUT","TEXTAREA","SELECT"].includes(at.tagName))||O.current&&(we.preventDefault(),O.current.focus())};return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[]);const Y=()=>{var H;R(""),a(jl(pp,x)),(H=O.current)==null||H.focus()},A=()=>{_.current=0,k()},I=()=>{G.current=!0,A()};u.useEffect(()=>{var we;if(!G.current||g.state==="loading"||S!==null)return;G.current=!1;const H=(we=D.current)==null?void 0:we.querySelector("h1");H&&(H.tabIndex=-1,H.focus())},[g,b,S]);const X=Sg(D),J=H=>`/proj/${encodeURIComponent(t)}/issues${H?`?${H}`:""}`,ae=H=>`/proj/${encodeURIComponent(t)}/issues/${encodeURIComponent(H)}?from=issues${y?`&${y}`:""}`,ke=s.jsx("div",{role:"status","aria-live":"polite",children:S!==null?s.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",children:[s.jsx(dn,{"aria-hidden":"true"}),"Issues are busy. Reading them again…"]}):null}),Q=b?s.jsxs(oe,{ref:X,variant:"destructive",className:"mt-4",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:"Issues could not be loaded"}),s.jsxs(ce,{children:[s.jsxs("p",{children:[b.message,b.since?` Since ${xs(b.since)}.`:"",g.state==="ok"?` The list below was read at ${xs(g.local.read_at)}.`:"",b.message.includes(Hr)?"":` ${Hr}`]}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:I,children:"Retry"})]})]}):null,ee=!!r.report,Ce=ee?ay.report:ay.read_only,se=s.jsx(sn,{title:"Issues",description:"This repository's local issues: what agents and you reported, where triage placed each, and what fixes it.",actions:g.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 ",xs(g.local.read_at)]}),s.jsxs(P,{type:"button",variant:"ghost",size:"sm",onClick:A,children:[s.jsx(Jr,{className:"mr-2 size-4","aria-hidden":"true"}),"Read again"]}),ee?s.jsxs(P,{type:"button",size:"sm",onClick:()=>m(!0),children:[s.jsx(rr,{className:"mr-2 size-4","aria-hidden":"true"}),"Report an issue"]}):null]}):null}),Se=r.report?s.jsx(sL,{project:t,report:r.report,reportCollections:r.reportCollections,open:f,onOpenChange:m,onMaybeFiled:A,onFiled:H=>{A(),d(`/proj/${encodeURIComponent(t)}/issues/${encodeURIComponent(H.issue)}?${new URLSearchParams({from:"issues",reported:H.note}).toString()}`)}}):null;if(g.state==="engine_missing")return s.jsx(Jc,{ref:D,children:s.jsx(ta,{page:"Issues"})});if(g.state==="view_outdated")return s.jsxs(Jc,{ref:D,children:[se,s.jsxs(oe,{variant:"warning",className:"mt-6",children:[s.jsx(Ut,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:el}),s.jsx(ce,{children:B})]})]});if(g.state==="loading")return s.jsxs(Jc,{ref:D,children:[se,ke,Q,!b&&S===null?s.jsx("div",{className:"mt-6 grid gap-2",role:"status","aria-label":"Loading issues",children:Array.from({length:6},(H,we)=>s.jsx(Ct,{className:we===5?"h-10 w-2/3":"h-10 w-full"},we))}):null]});const{list:me,local:be}=g,ve=!b&&S===null&&(g.key!==j||U!==h.search),Ae=sy(_u(g.key)),Z=be.scope==="folder",je=be.listed===0&&!v,Ee=Math.max(0,be.listed-be.facets.owners.reduce((H,we)=>H+we.count,0)),Pe=h.collection?((Ve=be.collections.find(H=>H.collection===h.collection))==null?void 0:Ve.title)??h.collection:null,ie=new Map;for(const H of me.issues){const we=H.group??"unplaced";ie.set(we,[...ie.get(we)??[],H])}return s.jsxs(Jc,{ref:D,children:[se,Z&&be.folder?s.jsxs("p",{className:"text-muted-foreground mt-1 text-sm",children:["Issues of the folder ",be.folder,", from its issue store."]}):null,Se,s.jsxs(oe,{variant:"info",className:"mt-4",children:[ee?s.jsx(gn,{className:"size-4","aria-hidden":"true"}):s.jsx(fc,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:Ce.title}),s.jsx(ce,{children:Ce.body})]}),ke,Q,je?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(hE,{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:W3(ee)})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-3",children:[s.jsx(pt,{ref:O,type:"search",className:"w-64","aria-label":"Search issues",placeholder:"Search issues",value:U,onChange:H=>R(H.target.value)}),s.jsxs(Nt,{value:h.owner??fl,onValueChange:H=>$({owner:H===fl?null:H}),children:[s.jsx(xt,{className:"w-56","aria-label":"Owner",children:s.jsx(kt,{})}),s.jsxs(gt,{children:[s.jsx(De,{value:fl,children:"All owners"}),s.jsxs(De,{value:iL,children:["Unowned (",Ee,")"]}),be.facets.owners.map(H=>s.jsxs(De,{value:H.key,children:[H.title," (",H.count,")"]},H.key))]})]}),s.jsxs(Nt,{value:h.label??fl,onValueChange:H=>$({label:H===fl?null:H}),children:[s.jsx(xt,{className:"w-48","aria-label":"Label",children:s.jsx(kt,{})}),s.jsxs(gt,{children:[s.jsx(De,{value:fl,children:"All labels"}),be.facets.labels.map(H=>s.jsxs(De,{value:H.label,children:[H.label," (",H.count,")"]},H.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.jsx(oy,{pressed:h.urgent,count:be.facets.urgent,onClick:()=>$({urgent:!h.urgent}),children:"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"}),lS.map(H=>{const we=h.seen.includes(H.key);return s.jsx(oy,{pressed:we,count:be.facets.seen[H.key],onClick:()=>$({seen:we?h.seen.filter(at=>at!==H.key):[...h.seen,H.key]}),children:H.label},H.key)}),Pe!==null?s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsxs("span",{"data-testid":"issues-collection-chip",className:de(rf({variant:"outline",size:"sm"}),kM),children:["Collection ",Pe]}),s.jsx(P,{type:"button",variant:"ghost",size:"sm-icon","aria-label":"Remove the collection filter",onClick:()=>{var H;$({collection:null}),(H=O.current)==null||H.focus()},children:s.jsx(Zd,{className:"size-4","aria-hidden":"true"})})]}):null]})]}),s.jsx("div",{role:"status","aria-live":"polite",children:ve?s.jsxs("p",{className:"text-muted-foreground mt-3 flex items-center gap-2 text-sm",children:[s.jsx(dn,{"aria-hidden":"true"}),"Searching…"]}):v&&me.total>0?s.jsxs("p",{className:"text-muted-foreground mt-3 text-sm",children:[me.total," of ",be.listed," issues ·"," ",s.jsx(P,{type:"button",variant:"link",size:"sm",className:"px-0",onClick:Y,children:"Clear"})]}):null}),s.jsx("div",{"data-testid":"issues-results","aria-busy":ve||void 0,className:"shrink-0 transition-opacity aria-busy:opacity-50",children:Ae&&me.total===0?s.jsxs("p",{className:"mt-6 flex items-center gap-2 text-sm",children:[s.jsx(Qd,{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:Y,children:"Clear"})]}):s.jsxs(s.Fragment,{children:[!Ae&&be.groups.length>0&&be.groups.every(H=>H.key==="resolved")?s.jsx("p",{className:"text-muted-foreground mt-6 text-sm","data-testid":"issues-none-open",children:"No open issues."}):null,be.groups.map(H=>s.jsx(fL,{id:`issues-${H.key}`,title:`${H.label} · ${H.count}`,issues:ie.get(H.key)??[],folder:Z,threads:i,fold:Ae?void 0:{folded:H3(x,H.key),whole:x.all.includes(H.key),onFold:we=>T(P3(x,H.key,we)),onWhole:we=>T(q3(x,H.key,we))},link:we=>s.jsx(c,{className:"text-primary hover:underline",href:o(ae(we.id)),children:we.title})},H.key))]})}),!v&&be.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 · ",be.collections.length]}),s.jsx(mt,{className:"mt-2 shrink-0 overflow-x-auto",children:s.jsxs(Fe,{containerAriaLabel:"Collections",className:"table-fixed",children:[s.jsx(Qe,{children:s.jsxs(ue,{children:[s.jsx(F,{className:"w-1/2",children:"Collection"}),s.jsx(F,{className:"w-1/4",children:"Resolved"}),s.jsx(F,{className:"w-1/4",children:"Updated"})]})}),s.jsx(Ke,{children:be.collections.map(H=>s.jsxs(ue,{children:[s.jsxs(q,{children:[s.jsx(c,{className:"text-primary hover:underline",href:o(J(jl({...pp,collection:H.collection},x))),children:H.title}),s.jsx("div",{className:"text-muted-foreground font-mono text-xs",children:H.collection})]}),s.jsxs(q,{children:[H.resolved," of ",H.total," resolved"]}),s.jsx(q,{className:"text-muted-foreground",children:yo(H.updated_at)})]},H.collection))})]})})]}):null]})]})}const Jc=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})}),dL={plain:{title:"w-[36%]",issue:"w-[10%]",project:"",status:"w-[16%]",urgent:"w-[8%]",owner:"w-[18%]",updated:"w-[12%]"},folder:{title:"w-[30%]",issue:"w-[10%]",project:"w-[12%]",status:"w-[16%]",urgent:"w-[8%]",owner:"w-[14%]",updated:"w-[12%]"},actions:{title:"w-[30%]",issue:"w-[9%]",project:"",status:"w-[14%]",urgent:"w-[7%]",owner:"w-[16%]",updated:"w-[10%]"},folderActions:{title:"w-[26%]",issue:"w-[8%]",project:"w-[11%]",status:"w-[13%]",urgent:"w-[7%]",owner:"w-[12%]",updated:"w-[9%]"}};function oy({pressed:e,count:t,onClick:n,children:a}){const[r,l]=u.useState(!1);return s.jsxs(P,{type:"button",variant:"outline",size:"sm",className:vo,"aria-pressed":e,disabled:t===0&&!e&&!r,onFocus:()=>l(!0),onBlur:()=>l(!1),onClick:n,children:[a," ",t]})}function fL({id:e,title:t,issues:n,folder:a,link:r,threads:l,fold:i}){const o=dL[l?a?"folderActions":"actions":a?"folder":"plain"],c=6+(a?1:0)+(l?1:0),d=`${e}-panel`,f=!(i!=null&&i.folded),m=i!==void 0&&!i.whole&&n.length>Lh,h=m?n.slice(0,Lh):n,x=f?Kd:dc,[j,v]=u.useState(!1),y=i!==void 0&&(m||i.whole&&n.length>Lh||j);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:i?s.jsxs(P,{type:"button",variant:"ghost",size:"sm",className:"-ml-2 text-lg font-semibold","aria-expanded":f,"aria-controls":f?d:void 0,onClick:()=>i.onFold(f),children:[s.jsx(x,{className:"size-4","aria-hidden":"true"}),t]}):t}),f?s.jsxs("div",{id:d,children:[s.jsx(hL,{title:t,issues:h,folder:a,link:r,threads:l,widths:o,columns:c}),i&&y?s.jsx(P,{type:"button",variant:"link",size:"sm",className:"mt-1 px-0","aria-expanded":i.whole,"aria-describedby":`${e}-title`,onFocus:()=>v(!0),onBlur:()=>v(!1),onClick:()=>i.onWhole(!i.whole),children:i.whole?"Show fewer":`Show all ${n.length}`}):null]}):null]})}function hL({title:e,issues:t,folder:n,link:a,threads:r,widths:l,columns:i}){return s.jsx(s.Fragment,{children:s.jsx(mt,{className:"mt-2 shrink-0 overflow-x-auto",children:s.jsxs(Fe,{containerAriaLabel:e,className:de("table-fixed",r&&"min-w-5xl"),children:[s.jsx(Qe,{children:s.jsxs(ue,{children:[s.jsx(F,{className:l.title,children:"Title"}),s.jsx(F,{className:l.issue,children:"Issue"}),n?s.jsx(F,{className:l.project,children:"Project"}):null,s.jsx(F,{className:l.status,children:"Status"}),s.jsx(F,{className:l.urgent,children:"Urgent"}),s.jsx(F,{className:l.owner,children:"Owner"}),s.jsx(F,{className:l.updated,children:"Updated"}),r?s.jsx(F,{className:"w-[14%] text-right",children:"Actions"}):null]})}),s.jsx(Ke,{children:t.map(o=>s.jsx(mL,{issue:o,folder:n,link:a,threads:r,columns:i},o.id))})]})})})}function mL({issue:e,folder:t,link:n,threads:a,columns:r}){var d;const{button:l,panel:i}=kf({org:(a==null?void 0:a.org)??"",action:a?e.local_action:void 0,task_id:null,issue:e.id,open_thread:a==null?void 0:a.open_thread}),o=iS(e),c=[e.reported_by_you?"you reported":"",e.standing??""].filter(Boolean).join(" · ");return s.jsxs(s.Fragment,{children:[s.jsxs(ue,{"data-testid":"issues-row",className:i?"border-b-0":void 0,children:[s.jsxs(q,{className:"break-words",children:[n(e),c?s.jsx("div",{"data-testid":"issues-row-standing",className:"text-muted-foreground mt-0.5 text-xs",children:c}):null,(d=e.labels)!=null&&d.length?s.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:e.labels.map(f=>s.jsx(fe,{variant:"neutral",size:"dense",children:f},f))}):null]}),s.jsx(q,{className:"font-mono text-xs",children:e.id}),t?s.jsx(q,{className:"break-words",children:e.project_id??"Folder"}):null,s.jsx(q,{children:s.jsx(fe,{variant:o.tone,children:o.label})}),s.jsx(q,{children:e.urgent&&e.status!=="resolved"&&e.group!=="resolved"?s.jsx(fe,{variant:"warning",children:"Urgent"}):null}),s.jsx(q,{className:"break-words",children:e.owner_title?e.owner_title:s.jsx("span",{className:"text-muted-foreground",children:"Unowned"})}),s.jsx(q,{className:"text-muted-foreground",children:yo(e.updated_at)}),a?s.jsx(q,{className:"text-right whitespace-nowrap",children:l}):null]}),i?s.jsx(ue,{"data-testid":"issues-row-panel",className:"hover:bg-transparent",children:s.jsx(q,{colSpan:r,className:"pt-0",children:s.jsx("div",{className:"max-w-180 pl-4 text-left whitespace-normal",children:i})})}):null]})}function pL(e){var t;return(t=yn().issues)!=null&&t.issueSections?s.jsx(uL,{...e}):s.jsx($3,{org:e.org,project:e.project,query:e.query})}function xL({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,m]=u.useState(t.external_reference??""),[h,x]=u.useState(t),[j,v]=u.useState(null),[y,g]=u.useState(!1);u.useEffect(()=>{n&&(o(t.title),d(t.description),m(t.external_reference??""),x(t),v(null))},[n]);const p=S=>{var C;return((C=j==null?void 0:j.personal_data)==null?void 0:C.field)===S?j.message:void 0},b=async S=>{S.preventDefault(),g(!0);const C=await e(h.id,h.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 S=await l();S&&(x(S),v(null))};return s.jsx(bn,{open:n,onOpenChange:a,children:s.jsx(wn,{className:"sm:max-w-2xl",children:s.jsxs("form",{onSubmit:b,className:"grid gap-4",children:[s.jsxs(_n,{children:[s.jsx(kn,{children:"Edit issue"}),s.jsx(Sn,{children:"Text is shown exactly as entered."})]}),j!=null&&j.conflict?s.jsxs(oe,{variant:"destructive",children:[s.jsx(nt,{}),s.jsx(ce,{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(Oe,{htmlFor:"maintain-edit-title",children:"Title"}),s.jsx(pt,{id:"maintain-edit-title",value:i,"aria-invalid":!!p("title"),onChange:S=>o(S.target.value)}),p("title")?s.jsx(hs,{children:p("title")}):null]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"maintain-edit-description",children:"Description"}),s.jsx(vn,{id:"maintain-edit-description",rows:4,value:c,"aria-invalid":!!p("description"),onChange:S=>d(S.target.value)}),p("description")?s.jsx(hs,{children:p("description")}):null]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"maintain-edit-reference",children:"External reference"}),s.jsx(pt,{id:"maintain-edit-reference",value:f,"aria-invalid":!!p("external_reference"),onChange:S=>m(S.target.value)}),p("external_reference")?s.jsx(hs,{children:p("external_reference")}):null]}),j&&!j.conflict&&!j.personal_data?s.jsx(hs,{children:j.message}):null,s.jsxs(Nn,{children:[s.jsx(P,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),j!=null&&j.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:!!(j!=null&&j.conflict),children:"Save"})]})]})})})}function cy(e){return e.map(t=>tS[t].toLowerCase()).join(", ")}function gL(e){switch(e.kind){case"created":return"Logged the issue";case"updated":return`Edited the ${cy(e.fields)}`;case"redacted":return`Redacted the ${cy(e.fields)}`;case"priority_set":return e.priority?`Set priority to ${Po[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?vd[e.to_status]:"";return e.resolution_reason?`Moved to ${t}: ${Tg[e.resolution_reason]}`:`Moved to ${t}`}}}function uy(e,t){return t==="external_reference"?e.external_reference??"":e[t]}function vL({redact:e,issue:t,open:n,onOpenChange:a,onDone:r,onReload:l}){const[i,o]=u.useState("description"),[c,d]=u.useState(""),[f,m]=u.useState(!1),[h,x]=u.useState(null),[j,v]=u.useState(t);u.useEffect(()=>{n&&(v(t),d(uy(t,i)),x(null))},[n]);const y=async g=>{g.preventDefault(),m(!0);const p=await e(j.id,j.revision,i,c);if(m(!1),!p.ok){if(p.refusal.conflict){const b=await l();b&&v(b),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(bn,{open:n,onOpenChange:a,children:s.jsx(wn,{className:"sm:max-w-2xl",children:s.jsxs("form",{onSubmit:y,className:"grid gap-4",children:[s.jsxs(_n,{children:[s.jsx(kn,{children:"Redact text"}),s.jsx(Sn,{children:"Replace text that holds personal data, such as a name."})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"maintain-redact-field",children:"Field"}),s.jsxs(Nt,{value:i,onValueChange:g=>{const p=g;o(p),d(uy(j,p))},children:[s.jsx(xt,{id:"maintain-redact-field",children:s.jsx(kt,{})}),s.jsx(gt,{children:_3.map(g=>s.jsx(De,{value:g,children:tS[g]},g))})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"maintain-redact-replacement",children:"Replacement text"}),s.jsx(vn,{id:"maintain-redact-replacement",rows:4,value:c,onChange:g=>d(g.target.value)})]}),s.jsxs(oe,{variant:"warning",children:[s.jsx(Ut,{}),s.jsx(ce,{children:"This cannot be undone: the original text is removed for good. History records only that this field was redacted."})]}),h?s.jsx(hs,{children:h}):null,s.jsxs(Nn,{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 jL({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),m=async h=>{h.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(bn,{open:n,onOpenChange:a,children:s.jsx(wn,{children:s.jsxs("form",{onSubmit:m,className:"grid gap-4",children:[s.jsxs(_n,{children:[s.jsx(kn,{children:"Resolve issue"}),s.jsx(Sn,{children:"Choose how this report ended."})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"maintain-resolution-reason",children:"Resolution reason *"}),s.jsxs(Nt,{value:l,onValueChange:h=>i(h),children:[s.jsx(xt,{id:"maintain-resolution-reason",children:s.jsx(kt,{})}),s.jsx(gt,{children:w3.map(h=>s.jsx(De,{value:h,children:Tg[h]},h))})]}),s.jsx("p",{className:"text-muted-foreground text-xs",children:"Reopening the issue clears its reason."})]}),d?s.jsx(hs,{children:d}):null,s.jsxs(Nn,{children:[s.jsx(P,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),s.jsx(P,{type:"submit",loading:o,children:"Resolve"})]})]})})})}const hl="not_set";function yL({org:e,project:t,issue_id:n,query:a}){const r=nS(),l=sS(r),i=hp(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(aS,{access:l,header:s.jsx(sn,{title:"Support"}),back_href:i,children:o=>r?s.jsx(bL,{contract:r,issue_id:n,access:o,list_href:i,duplicates:Number(new URLSearchParams(a).get("duplicates")??0)}):null})})}function bL({contract:e,issue_id:t,access:n,list_href:a,duplicates:r}){const{href:l,Link:i}=Ze(),o=Qr(),[c,d]=u.useState(null),[f,m]=u.useState([]),[h,x]=u.useState(!1),[j,v]=u.useState([]),[y,g]=u.useState(null),p=u.useCallback(async()=>{const _=await e.issue(t);return _.ok?(d(_.data.issue),m(_.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(N=>{if(!_){if(!N.ok){N.refusal.status===404?x(!0):o.error(N.refusal.message);return}d(N.data.issue),m(N.data.events)}}),()=>{_=!0}},[e,t]),u.useEffect(()=>{n.can_change&&e.assigneeCandidates().then(_=>{_.ok&&v(_.data.candidates)})},[e,n.can_change]);const b=async _=>{const N=await _;if(!N.ok){o.error(N.refusal.message),N.refusal.conflict&&await p();return}await p()};if(h)return s.jsx(fr,{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",S=n.can_change,C=_=>b(e.transition(c.id,c.revision,_));return s.jsxs(s.Fragment,{children:[s.jsx(sn,{title:c.title,actions:S?s.jsxs(s.Fragment,{children:[w?null:s.jsxs(P,{variant:"outline",onClick:()=>g("edit"),children:[s.jsx(Wd,{className:"mr-2 size-4"}),"Edit"]}),s.jsxs(P,{variant:"outline",onClick:()=>g("redact"),children:[s.jsx(WT,{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(Xd,{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(BE,{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(fe,{variant:eS[c.status],children:vd[c.status]}),s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Logged by ",S3(c)," ",wu(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(oe,{variant:"info",children:[s.jsx(gn,{}),s.jsxs(ce,{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(Fe,{children:[s.jsx(Qe,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"When"}),s.jsx(F,{children:"Who"}),s.jsx(F,{children:"What"})]})}),s.jsx(Ke,{children:f.map(_=>s.jsxs(ue,{children:[s.jsx(q,{className:"text-muted-foreground",children:wu(_.created_at)}),s.jsx(q,{children:C3(_,c)}),s.jsx(q,{children:gL(_)})]},_.id))})]})})]})]}),s.jsxs("aside",{className:"flex w-full shrink-0 flex-col gap-5 lg:w-72",children:[s.jsx(Gi,{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(Gi,{label:"Resolution",children:s.jsx("span",{className:"text-sm",children:Tg[c.resolution_reason]})}):null,s.jsx(Gi,{label:"Priority",id:"maintain-issue-priority",children:s.jsxs(Nt,{value:c.priority??hl,disabled:!S||w,onValueChange:_=>void b(e.update(c.id,c.revision,{priority:_===hl?null:_})),children:[s.jsx(xt,{id:"maintain-issue-priority",children:s.jsx(kt,{})}),s.jsxs(gt,{children:[s.jsx(De,{value:hl,children:"Not set"}),Rg.map(_=>s.jsx(De,{value:_,children:Po[_]},_))]})]})}),s.jsxs(Gi,{label:"Assignee",id:"maintain-issue-assignee",children:[s.jsxs(Nt,{value:c.assignee_id??hl,disabled:!S||w,onValueChange:_=>void b(e.assign(c.id,c.revision,_===hl?null:_)),children:[s.jsx(xt,{id:"maintain-issue-assignee",children:s.jsx(kt,{})}),s.jsxs(gt,{children:[s.jsx(De,{value:hl,children:"Not set"}),c.assignee_id&&!j.some(_=>_.user_id===c.assignee_id)?s.jsx(De,{value:c.assignee_id,children:Eg(c.assignee_id,c.assignee_username)}):null,j.map(_=>s.jsx(De,{value:_.user_id,children:_.username??"Not available"},_.user_id))]})]}),c.assignee_can_act===!1?s.jsx(fe,{variant:"error",className:"self-start",children:"Assignee cannot act"}):null]}),s.jsx(Gi,{label:"Updated",children:s.jsx("span",{className:"text-sm",children:wu(c.updated_at)})})]})]}),s.jsx(xL,{update:e.update,issue:c,open:y==="edit",onOpenChange:_=>g(_?"edit":null),onReload:p,onDone:()=>{g(null),p()}}),s.jsx(vL,{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(jL,{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 Gi({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 wL=10,_L=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/,dy=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,63}$/;function NL(e,t,n,a=""){const r=n!=null&&n.startsWith("task:")?n.slice(5):null;if(r&&_L.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&&dy.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&&dy.test(o))return{label:o,path:`${l}?planned=${encodeURIComponent(o)}`};const c=jl(_u(a),cS(a));return{label:"Issues",path:`/proj/${encodeURIComponent(t)}/issues${c?`?${c}`:""}`}}const kL=["Fixed in","Being fixed in","The release planned to fix it"];function SL(e){const t=e.filter(n=>n.kind==="release");for(const n of kL){const a=t.find(r=>r.relation===n);if(a)return a}return t[0]??null}function CL(e,t){const n=e.filter(a=>a.kind==="thread"&&(a.label===t||a.id===t));return n.find(a=>a.owns)??n[0]??null}function RL(e,t){const n=e.toLowerCase();return n==="file"&&t.trim()?{kind:"file",path:t}:n==="commit"&&/^[0-9a-f]{7,40}$/i.test(t)?{kind:"commit",sha:t}:null}function TL({org:e,project:t,issue_id:n,from:a,query:r=""}){var Vt,fn,re;const l=hS(),{href:i,Link:o}=Ze(),c=NL(e,t,a,r),d=aL(r,n),f=`/proj/${encodeURIComponent(t)}/issues`,m=K=>`${f}/${encodeURIComponent(K)}`,h=K=>`${e?`/org/${e}`:""}/threads#thread-${encodeURIComponent(K)}`,x=K=>`/proj/${encodeURIComponent(t)}/releases?${K.planned?"planned":"release"}=${encodeURIComponent(K.id)}`,[j,v]=u.useState({state:"loading"}),[y,g]=u.useState(null),[p,b]=u.useState(null),[w,S]=u.useState({state:"loading"}),[C,_]=u.useState({state:"loading"}),[N,O]=u.useState(null),D=u.useRef(0),B=u.useCallback(async K=>{if(!l.openAnchor)return;const he=K.kind==="file"?K.path:K.sha,Ue=D.current+=1;O({value:he,state:"opening",words:`Opening ${he}…`});const dt=await l.openAnchor(K);Ue===D.current&&O(dt.ok?{value:he,state:"opened",words:`Opened ${he} in ${dt.data.with}`}:{value:he,state:"failed",words:`Could not open ${he}: ${dt.refusal.message}`})},[l]);u.useEffect(()=>{D.current+=1,O(null)},[n]);const G=u.useRef(null),U=as(),R=u.useRef(null),$=u.useRef(!1),T=u.useRef(0),E=u.useRef(0),k=u.useRef(!1),M=vs(),Y=u.useRef(0),A=u.useRef(0),I=u.useCallback(async(K=!1)=>{if(!l.issueSections)return;const he=Y.current+=1;K||S({state:"loading"});const Ue=await M.track(l.issueSections(n));he===Y.current&&S(dt=>Ue.ok?{state:"ok",data:Ue.data}:K&&dt.state==="ok"?dt:{state:"failed",refusal:Ue.refusal})},[l.issueSections,n,M]),X=u.useCallback(async(K=!1)=>{if(!l.issueRelated)return;const he=A.current+=1;K||_({state:"loading"});const Ue=await M.track(l.issueRelated(n));he===A.current&&_(dt=>Ue.ok?{state:"ok",data:Ue.data}:K&&dt.state==="ok"?dt:{state:"failed",refusal:Ue.refusal})},[l.issueRelated,n,M]),J=u.useCallback(async(K=!1)=>{const he=E.current+=1;if(b(null),!z3.test(n)){v({state:"missing"});return}I(K),X(K);const Ue=await M.track(l.issue(n));if(he!==E.current)return;if(Ue.ok){T.current=0,g(null),v({state:"ok",issue:Ue.data.issue,events:Ue.data.events,at:new Date().toISOString()});return}const dt=Ue.refusal.reason;if(Ue.refusal.status===404||dt==="not_found")return v({state:"missing"});if(dt==="engine_missing")return v({state:"engine_missing",refusal:Ue.refusal});if(dt==="view_outdated")return v({state:"view_outdated"});if(T.current+=1,T.current===1&&Z1(Ue.refusal)){k.current=K,b(Ue.refusal.retry_after??wL);return}g(Ue.refusal)},[l.issue,n,I,X,M]);u.useEffect(()=>{J()},[J]);const ae=u.useMemo(()=>Sf(M,()=>void J(!0)),[J,M]);cr(ae,fS),u.useEffect(()=>{if(p===null)return;const K=setTimeout(()=>{document.visibilityState==="visible"&&J(k.current)},p*1e3);return()=>clearTimeout(K)},[p,J]),u.useEffect(()=>{var he;if($.current||j.state!=="ok")return;$.current=!0;const K=(he=G.current)==null?void 0:he.querySelector("h1");K&&(K.tabIndex=-1,K.focus())},[j.state]);const ke=u.useRef(null);u.useEffect(()=>{var Ue;const K=ke.current;if(K===null||(K==="sections"?w:C).state==="loading")return;ke.current=null;const he=(K==="related"?R.current:null)??((Ue=G.current)==null?void 0:Ue.querySelector("h1"));he==null||he.focus()},[w,C]);const Q=K=>{ke.current=K,K==="sections"?I():X()},ee=()=>{T.current=0,J()},Ce=Sg(G),se=u.useRef(!1),Se=()=>{se.current=!0,ee()};u.useEffect(()=>{var he;if(!se.current||j.state==="loading"||p!==null)return;se.current=!1;const K=(he=G.current)==null?void 0:he.querySelector("h1");K&&(K.tabIndex=-1,K.focus())},[j,y,p]);const me=kf({org:e,labelled:!0,action:(Vt=l.commands)!=null&&Vt.open_thread&&j.state==="ok"?j.issue.local_action:void 0,task_id:null,issue:n,open_thread:(fn=l.commands)==null?void 0:fn.open_thread});if(j.state==="missing")return s.jsx(qa,{children:s.jsx(fr,{icon:s.jsx(Qd,{"aria-hidden":"true"}),title:"Issue not found",description:`No issue ${n} in this repository's issue store.`,backHref:i(a==="issues"?c.path:f),backLabel:"Back to issues",link:o})});const be=s.jsx(P,{asChild:!0,variant:"link",size:"sm",className:"px-0",children:s.jsxs(o,{href:i(c.path),children:[s.jsx(J0,{className:"size-4","aria-hidden":"true"}),c.label]})});if(j.state==="engine_missing"||j.state==="view_outdated")return s.jsx(qa,{children:j.state==="engine_missing"?s.jsx(ta,{page:"Issue",header:s.jsx(jo,{back:be,id:null,title:n})}):s.jsxs(s.Fragment,{children:[s.jsx(jo,{back:be,id:null,title:n}),s.jsxs(oe,{variant:"warning",className:"mt-4",children:[s.jsx(Ut,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:el}),s.jsx(ce,{children:U})]})]})});const ve=y?s.jsxs(oe,{ref:Ce,variant:"destructive",className:"mt-4",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:"This issue could not be loaded"}),s.jsxs(ce,{children:[s.jsxs("p",{children:[y.message,y.since?` Since ${xs(y.since)}.`:"",j.state==="ok"?` This page was read at ${xs(j.at)}.`:"",y.message.includes(Hr)?"":` ${Hr}`]}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:Se,children:"Retry"})]})]}):null,Ae=s.jsx("div",{role:"status","aria-live":"polite",children:p!==null?s.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",children:[s.jsx(dn,{"aria-hidden":"true"}),"This issue is busy. Reading it again…"]}):null});if(j.state==="loading")return s.jsxs(qa,{children:[s.jsx("div",{children:be}),Ae,ve,!y&&p===null?s.jsxs("div",{className:"mt-4 grid gap-3",role:"status","aria-label":"Loading issue",children:[s.jsx(Ct,{className:"h-6 w-40"}),s.jsx(Ct,{className:"h-9 w-2/3"}),s.jsx(Ct,{className:"h-24 w-full"})]}):null]});const{issue:Z,events:je,at:Ee}=j,Pe=iS(Z),ie=w.state==="ok"?w.data:null,We=(ie==null?void 0:ie.reporter)??Z.created_by_username??null,Ve=C.state==="ok"?SL(C.data):null,H=Z.status==="resolved"||Z.group==="resolved",we=!!(ie!=null&&ie.duplicate_of),at=(ie==null?void 0:ie.routing.owner)??Z.owner_title??null,Bt=at&&C.state==="ok"?CL(C.data,at):null,Qt=w.state==="loading"?"Loading…":Bt?s.jsx(o,{className:"text-primary hover:underline",href:i(h(Bt.id)),children:at}):at??s.jsx("span",{className:"text-muted-foreground",children:"Unowned"}),jt=K=>`${f}?${Ag({...pp,collection:K})}`,it=ie==null?void 0:ie.report,an=!!(it&&(it.actual||it.expected||it.steps.length||it.where)),rn=[...je].reverse(),Bn=s.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[me.button,s.jsxs("span",{className:"text-muted-foreground text-sm",children:["Read at ",xs(Ee)]}),s.jsxs(P,{type:"button",variant:"ghost",size:"sm",onClick:ee,children:[s.jsx(Jr,{className:"mr-2 size-4","aria-hidden":"true"}),"Read again"]})]});return s.jsx(qa,{children:s.jsxs("div",{ref:G,className:"contents",children:[s.jsx(jo,{back:be,id:Z.id,badge:s.jsxs(s.Fragment,{children:[s.jsx(fe,{variant:Pe.tone,children:Pe.label}),Z.urgent&&!H?s.jsx(fe,{variant:"warning",children:"Urgent"}):null]}),title:Z.title,created:`Reported${We?` by ${We}`:""} · ${yo(Z.created_at)}`,actions:Bn}),ie!=null&&ie.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(m(ie.duplicate_of)),children:ie.duplicate_of})]}):null,me.panel?s.jsx("div",{className:"mt-1 max-w-180",children:me.panel}):null,s.jsx("div",{role:"status","aria-live":"polite",children:d?s.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:d}):null}),Ae,ve,w.state==="loading"?s.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",role:"status",children:[s.jsx(dn,{"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(Ps,{label:"Owner",value:Qt}),we?null:s.jsx(Ps,{label:"Release",value:C.state==="loading"?"Loading…":Ve?s.jsx(o,{className:de("text-primary hover:underline",Ve.label===Ve.id&&"font-mono"),href:i(x(Ve)),children:Ve.label}):s.jsx("span",{className:"text-muted-foreground",children:"No release yet"})}),s.jsx(Ps,{label:"Reported",value:[We,Z.created_at?gs(Z.created_at):null].filter(Boolean).join(" · ")})]}),s.jsxs(oe,{variant:"info",className:"mt-4",children:[s.jsx(fc,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:ry.title}),s.jsx(ce,{children:ry.body})]}),w.state==="failed"?s.jsx("div",{className:"mt-6",children:s.jsx(Cg,{what:"this issue's sections",again:"Read the issue again",refusal:w.refusal,on_retry:()=>Q("sections")})}):null,ie&&an&&it?s.jsxs(Dt,{id:"issue-report",title:"What happens",children:[it.actual?s.jsx("p",{className:"text-sm whitespace-pre-wrap",children:it.actual}):null,it.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:it.expected})]}):null,it.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:it.steps.map((K,he)=>s.jsx("li",{children:K},he))})]}):null,(re=it.where)!=null&&re.env?s.jsxs("p",{className:"text-muted-foreground mt-3 text-sm",children:["Seen on ",it.where.env,it.where.sha?s.jsxs(s.Fragment,{children:[" ","at ",s.jsx("span",{className:"font-mono",children:it.where.sha})]}):null]}):null]}):null,ie&&(ie.placement.placed||ie.placement.unplaced_why)?s.jsx(Dt,{id:"issue-placement",title:"Placement",children:ie.placement.placed?s.jsxs("p",{className:"text-sm",children:["Placed in ",ie.placement.placed]}):s.jsxs(oe,{variant:"warning",children:[s.jsx(Ut,{className:"size-4","aria-hidden":"true"}),s.jsxs(ge,{children:["Not placed yet: ",ie.placement.unplaced_why]})]})}):null,ie&&(ie.routing.route||ie.routing.owner||ie.routing.none)?s.jsxs(Dt,{id:"issue-routing",title:"Routing",children:[ie.routing.route?s.jsx("p",{className:"text-sm",children:ie.routing.route}):null,ie.routing.owner?s.jsxs("p",{className:"text-sm",children:["Owner: ",ie.routing.owner]}):s.jsx("p",{className:"text-muted-foreground text-sm",children:"Owner: none yet"})]}):null,ie&&(ie.labels.length>0||ie.collections.length>0)?s.jsxs(Dt,{id:"issue-labels",title:"Labels and collections",children:[ie.labels.length?s.jsx("div",{className:"flex flex-wrap gap-1",children:ie.labels.map(K=>s.jsx(fe,{variant:"neutral",size:"dense",children:K},K))}):null,ie.collections.length?s.jsx("ul",{className:"mt-2 grid gap-1 text-sm",children:ie.collections.map(K=>s.jsxs("li",{children:[s.jsx(o,{className:"text-primary hover:underline",href:i(jt(K.collection)),children:K.title}),K.ref?s.jsxs("span",{className:"text-muted-foreground",children:[" · ",K.ref]}):null,s.jsxs("span",{className:"text-muted-foreground",children:[" ","· ",K.resolved," of ",K.total," resolved"]})]},K.collection))}):null]}):null,ie&&ie.anchors.length>0?s.jsxs(Dt,{id:"issue-anchors",title:"Anchors",children:[s.jsx(Hh,{label:"Anchors",heads:["Kind","Value","By"],rows:ie.anchors.map(K=>{const he=l.openAnchor?RL(K.kind,K.value):null;return[K.kind,he?s.jsx(P,{type:"button",variant:"link",size:"control",className:"h-auto min-h-7 justify-start px-0 text-left font-mono text-xs font-normal break-all whitespace-normal","aria-label":he.kind==="file"?`Open ${K.value}`:`Show commit ${K.value}`,onClick:()=>void B(he),children:K.value}):s.jsx("span",{className:"font-mono text-xs break-all",children:K.value}),K.by??""]})}),l.openAnchor?s.jsx("p",{role:"status","aria-live":"polite","data-testid":"issue-anchor-status",className:de("mt-2 text-sm empty:hidden",(N==null?void 0:N.state)==="failed"?"text-destructive":(N==null?void 0:N.state)==="opened"?"text-success":"text-muted-foreground"),children:(N==null?void 0:N.words)??""}):null]}):null,ie&&ie.seen.length>0?s.jsx(Dt,{id:"issue-seen",title:"Seen",aside:`${ie.seen.length} of ${Math.max(Z.occurrences??0,ie.seen.length)} sightings`,children:s.jsx(Hh,{label:"Seen",heads:["When","Where","Who","Note"],rows:ie.seen.map(K=>[yo(K.at),s.jsxs(s.Fragment,{children:[K.sha?s.jsx("div",{className:"font-mono text-xs",children:K.sha}):null,K.env?s.jsx("div",{className:"text-muted-foreground text-xs",children:K.env}):null]}),K.who??"",K.note??""])})}):null,rn.length>0?s.jsx(Dt,{id:"issue-history",title:"History",aside:"From the issue store, newest first",children:s.jsx(Hh,{label:"History",heads:["When","Who","What"],rows:rn.map(K=>[yo(K.created_at),K.actor_username??"",K3(K.note,K.kind)])})}):null,s.jsx(J1,{id:"issue-related",related:C,heading_ref:R,on_retry:()=>Q("related"),fixed:!0,link:K=>{const he=K.kind==="thread"?h(K.id):K.kind==="task"?`/org/${e}/tasks/${encodeURIComponent(K.id)}?from=issue:${Z.id}`:K.kind==="issue"?m(K.id):K.kind==="release"?x(K):null;if(K.kind==="task"&&he){const Ue=X3(K.label);return s.jsxs("div",{className:"min-w-0",children:[s.jsx(o,{className:"text-primary font-mono text-xs hover:underline",href:i(he),children:K.id}),Ue&&Ue!==K.id?s.jsx("div",{className:"text-muted-foreground line-clamp-1 text-xs",title:Ue,"data-testid":"related-task-title",children:Ue}):null]})}return he?s.jsx(o,{className:de("text-primary hover:underline",K.kind!=="thread"&&K.label===K.id&&"font-mono"),href:i(he),children:K.label}):K.label}})]})})}function Hh({label:e,heads:t,rows:n}){return s.jsx(mt,{className:"overflow-x-auto",children:s.jsxs(Fe,{containerAriaLabel:e,children:[s.jsx(Qe,{children:s.jsx(ue,{children:t.map(a=>s.jsx(F,{children:a},a))})}),s.jsx(Ke,{children:n.map((a,r)=>s.jsx(ue,{children:a.map((l,i)=>s.jsx(q,{className:"break-words",children:l},i))},r))})]})})}function EL({org:e,project:t,issue_id:n,from:a,query:r}){var l;return(l=yn().issues)!=null&&l.issueSections?s.jsx(TL,{org:e,project:t,issue_id:n,from:a,query:r}):s.jsx(yL,{org:e,project:t,issue_id:n,query:r})}const Ws={label:"Stalled",tone:"error"},AL="A stalled turn passes on at the next queue command.",$L=e=>e.charAt(0).toUpperCase()+e.slice(1);function ML(e){return e==="starts now"?"Now":e==="rides the same deploy"?"With the same deploy":$L(e.replace(/^starts /,""))}const OL=e=>e.replace(/ after its turn came$/," after its turn"),mS={integration:"Integration",deploy:"Deploy",publish:"Publish",accept:"Accept",custom:"Custom"},DL={self_service:"Self-service",managed:"Managed",manager_only:"Manager only"},zL={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"},LL={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 UL(e){return LL[e??"in_batch"]}function BL(e,t=!1){if(t)return Ws;const n=e.turn==="next",a=n?"Next":"Waiting",r=e.batching==="managed"||e.batching==="released"?` · ${e.batching}`:"";return{label:`${a}${r}`,tone:n?"info":"neutral"}}const pS=(e,t)=>`Holds ${e.toLowerCase()}${t?`: ${t}`:""}`;function IL(e,t,n,a=!0,r=!1){return r?Ws:e.fixing_since!==void 0?{label:`Fixing forward since ${Dn(e.fixing_since)}`,tone:"warning"}:e.ref===t?{label:"Landing",tone:"info"}:a&&e.hold?{label:pS(n),tone:"info"}:{label:"Running",tone:"info"}}function Dn(e){return new Date(e*1e3).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function ml(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 HL(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 PL(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 qL(e,t){var o,c;const{policy:n,management:a}=e,r=(o=e.layer)==null?void 0:o.kind,l=d=>PL(d,t),i=[["Mode",zL[a.mode]],["Who can join",l(a.joiners)]];return r==="implement"&&i.push(["Managers",l(a.managers)],["Manager lease",ml(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 ${ml(n.freeze.max_seconds)}, ${ml(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 ${ml(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",ml(n.lease_seconds)],["Time to start",`${ml(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 jd="heavy",xS="Heavy checks",GL="Every worktree, admitted by memory",VL="Typechecks, builds, test suites and dev servers from every worktree of this repository wait here for memory.",YL="A smaller turn may pass one that does not fit, so the order can change; a passing turn reused on identical code never waits.",FL="Heavy checks are admitted by this machine's memory; there are no settings here.",gS="Where your organization's agents take turns at a shared branch, environment or proposal. One turn runs at a time in each queue.",vS="A task you cannot see",KL="A former member",XL="A member";function jS(){const e=yn().queues;if(!e)throw new Error("The Queues page rendered without the queues seam.");return e}function WL({org:e,open:t,path:n}){var m,h;const a=jS(),{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"&&((m=o.refusal)==null?void 0:m.reason)!=="engine_missing"?s.jsx(fr,{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(ZL,{org:e,open:t??null,path:n??`/org/${e}/tasks/queues`}):o.state==="off"&&((h=o.refusal)==null?void 0:h.reason)==="engine_missing"?s.jsx(ta,{page:"Queues"}):s.jsxs(s.Fragment,{children:[s.jsx(sn,{title:"Queues",description:a.description??gS}),o.state==="loading"&&s.jsx(yS,{}),(o.state==="error"||o.state==="off")&&s.jsx(Nu,{refusal:o.refusal,on_retry:()=>void d(!0)}),o.state==="available"&&s.jsxs(oe,{variant:"info",className:"mt-6",children:[s.jsx(gn,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:"Tasks are not on for this organization"}),s.jsxs(ce,{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 yS(){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(Ct,{className:t===2?"h-10 w-2/3":"h-10 w-full"},t))})}function Nu({refusal:e,on_retry:t}){const n=as();return(e==null?void 0:e.reason)==="store_locked"?s.jsxs(oe,{variant:"info",className:"mt-6",children:[s.jsx(gn,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:"The local stores are busy"}),s.jsxs(ce,{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(oe,{variant:"warning",className:"mt-6",children:[s.jsx(Ut,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:el}),s.jsx(ce,{children:n})]}):s.jsxs(oe,{variant:"destructive",className:"mt-6",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:"Queues could not be loaded"}),s.jsxs(ce,{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 Ph=e=>e.status===404||e.reason==="not_found"||e.code==="not_found";function QL(e,t,n,a){return t?e===null?`Not reading · trying again every ${n}s`:`Not reading since ${Dn(e)} · trying again every ${n}s`:e===null?"Connecting…":`Live · read ${Dn(e)} · refreshes every ${n}s${a?` · ${a}`:""}`}function ZL({org:e,open:t,path:n}){var Ae;const{listQueues:a,queue:r,members:l,refresh_ms:i,settings_note:o,description:c,read_scope:d,subject_label:f="Task",thread_subjects:m=!1,timing:h}=jS(),{self_id:x}=Fd(),j=!!h&&t===jd,[v,y]=u.useState(null),[g,p]=u.useState(null),[b,w]=u.useState(null),[S,C]=u.useState(null),[_,N]=u.useState({state:"pending",members:[]});u.useEffect(()=>{let Z=!0;return l().then(je=>{Z&&N(Ee=>je.ok?{state:"answered",members:je.data}:{state:"failed",members:Ee.members})}),()=>{Z=!1}},[l]);const O=u.useMemo(()=>new Map(_.members.map(Z=>[Z.user_id,Z])),[_.members]),D=_.state==="answered"?KL:XL,B=u.useCallback((Z,je)=>{var Ee;return(je==null?void 0:je.title)??(m?(je==null?void 0:je.id)??Z:Z===x?"You":((Ee=O.get(Z))==null?void 0:Ee.label)??D)},[O,D,x,m]),G=u.useRef({list:{last:null,fresh:!1},detail:{last:null,fresh:!1}}),[U,R]=u.useState(null),[$,T]=u.useState(!1),E=u.useCallback((Z,je)=>{G.current[Z]={last:je,fresh:!0};const{list:Ee,detail:Pe}=G.current;T(Ee.last==="failed"||Pe.last==="failed"),Ee.fresh&&Pe.fresh&&Ee.last==="ok"&&Pe.last==="ok"&&R(Date.now()/1e3)},[]),k=t??((Ae=v==null?void 0:v.queues[0])==null?void 0:Ae.id)??null,M=u.useRef(k);u.useEffect(()=>{M.current=k},[k]);const Y=u.useRef(0),A=u.useCallback(async()=>{var Ee;const Z=Y.current+=1;G.current.list.fresh=!1;const je=await a();if(Z===Y.current)if(je.ok){if(y(je.data),p(null),!t){const Pe=((Ee=je.data.queues[0])==null?void 0:Ee.id)??null;Pe===null?G.current.detail={last:"ok",fresh:!0}:Pe!==M.current&&(G.current.detail.fresh=!1)}E("list","ok")}else p(je.refusal),E("list","failed")},[a,t,E]),I=u.useRef(0),X=u.useCallback(async()=>{const Z=I.current+=1;if(!k)return;if(j){G.current.detail.fresh=!1;return}G.current.detail.fresh=!1;const je=await r(k);Z===I.current&&(je.ok?(w(je.data),C(null),E("detail","ok")):(C(je.refusal),Ph(je.refusal)&&w(null),E("detail",Ph(je.refusal)?"ok":"failed")))},[j,k,r,E]),[J,ae]=u.useState({state:"pending",data:null}),ke=u.useRef(0),Q=u.useCallback(async()=>{if(!h)return;const Z=ke.current+=1,je=await h();Z===ke.current&&(ae(je.ok?{state:"answered",data:je.data}:{state:"failed",data:null}),j&&E("detail",je.ok?"ok":"failed"))},[h,j,E]);u.useEffect(()=>{A()},[A]),u.useEffect(()=>{w(null),C(null),X()},[X]),u.useEffect(()=>{Q()},[Q]);const ee=u.useCallback(()=>{A(),X(),Q()},[A,X,Q]),Ce=u.useMemo(()=>{var Z;return new Map((((Z=J.data)==null?void 0:Z.queues)??[]).map(je=>[je.key,je]))},[J.data]),se=Ce.get(jd),Se=!v&&(g==null?void 0:g.reason)==="engine_missing",me=u.useCallback(()=>{Se||ee()},[Se,ee]);if(cr(me,i),Se)return s.jsx(ta,{page:"Queues"});const be=Math.round(i/1e3),ve=S!==null&&Ph(S);return s.jsxs(s.Fragment,{children:[s.jsxs(sn,{title:"Queues",description:c??gS,children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:QL(U,$,be,d)}),s.jsx("span",{className:"sr-only",role:"status",children:$?"Not reading":U===null?"Connecting":"Live"})]}),!v&&!g&&s.jsx(yS,{}),!v&&g&&s.jsx(Nu,{refusal:g,on_retry:ee}),v&&v.queues.length===0?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(a_,{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."})]}):v?s.jsxs(s.Fragment,{children:[s.jsx(n6,{path:n,queues:v.queues,open_id:k,name:B,held:m,timing_of:Ce,heavy:se}),j?se?s.jsx(r6,{org:e,timing:se}):J.data?s.jsxs(oe,{variant:"info",className:"mt-6",children:[s.jsx(gn,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:"Heavy checks are not available"}),s.jsx(ce,{children:"This checkout reads no heavy queue. Pick another queue above."})]}):J.state==="failed"?s.jsx(Nu,{on_retry:()=>void Q()}):s.jsx(Ct,{className:"mt-6 h-40 w-full shrink-0",role:"status","aria-label":"Loading the queue"}):ve?s.jsxs(oe,{variant:"info",className:"mt-6",children:[s.jsx(gn,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:"This queue is no longer available"}),s.jsx(ce,{children:"It was archived, or you can no longer read its Workspace. Pick another queue above."})]}):b&&b.queue.id===k?s.jsx(l6,{org:e,detail:b,name:B,settings_note:o,subject_label:f,thread_subjects:m,timing:Ce.get(b.queue.id)}):S?s.jsx(Nu,{refusal:S,on_retry:()=>void X()}):s.jsx(Ct,{className:"mt-6 h-40 w-full shrink-0",role:"status","aria-label":"Loading the queue"})]}):null]})}function yd({org:e,subject:t,link:n}){const{href:a,Link:r}=Ze();return!t||t.hidden?s.jsx("span",{className:"text-muted-foreground",children:vS}):t.kind==="task"&&n?s.jsx(r,{className:"text-primary hover:underline",href:a(`/org/${e}/tasks/${t.id}`),children:t.title??t.id}):t.kind==="thread"&&!n&&t.id&&!t.id.startsWith("exec-")?s.jsx(r,{className:"text-primary hover:underline",href:a(`${e?`/org/${e}`:""}/threads#thread-${encodeURIComponent(t.id)}`),children:t.title??t.id}):s.jsx("span",{children:t.title??t.id})}function JL(e,t,n){const a=e.freeze?`frozen until ${Dn(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 ${Dn(e.batch.opened_at)}`,a].filter(Boolean).join(" · "),warn:!1};if(e.turn){const r=e.turn.subject,l=r.hidden?vS: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?pS(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:tr(d.join(" · ")),warn:!1}:{primary:`${i}${l}${o}`,secondary:d.length?tr(d.join(" · ")):null,warn:d.length>0}}return{primary:"Nothing running",secondary:a?tr(a):null,warn:!!a}}const tr=e=>e.charAt(0).toUpperCase()+e.slice(1),bS=e=>(e==null?void 0:e.rows.filter(t=>t.turn===Ws.label).length)??0;function e6({timing:e}){return e!=null&&e.clears?s.jsx("div",{className:"text-muted-foreground text-xs",children:tr(e.clears)}):null}function t6({timing:e}){const t=bS(e);return t?s.jsx(fe,{variant:Ws.tone,children:`${t} stalled`}):null}function n6({path:e,queues:t,open_id:n,name:a,held:r,timing_of:l,heavy:i}){const{href:o,Link:c}=Ze();return s.jsx(mt,{className:"mt-4 shrink-0 overflow-x-auto",children:s.jsxs(Fe,{containerAriaLabel:"Queues",children:[s.jsx(Qe,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Queue"}),s.jsx(F,{className:"hidden md:table-cell",children:"Step"}),s.jsx(F,{children:"Running turn"}),s.jsx(F,{className:"hidden text-right md:table-cell",children:"Waiting"})]})}),s.jsxs(Ke,{children:[t.map(d=>{var v;const f=d.id===n,m=HL(d),h=JL(d,a,r),x=d.waiting-(((v=d.batch)==null?void 0:v.remaining)??0),j=l.get(d.id);return s.jsxs(ue,{"data-testid":"queues-row",className:de(f&&"bg-accent"),children:[s.jsxs(q,{children:[s.jsx(c,{className:"text-primary hover:underline",href:o(`${e}?queue=${encodeURIComponent(d.id)}`),"aria-current":f?"page":void 0,children:d.name}),m?s.jsx("div",{className:"text-muted-foreground text-xs",children:m}):null,s.jsxs("div",{className:"text-muted-foreground text-xs md:hidden",children:[x," waiting"]})]}),s.jsx(q,{className:"hidden md:table-cell",children:s.jsx(fe,{variant:"neutral",children:mS[d.policy.step]})}),s.jsxs(q,{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:de(!d.batch&&!d.turn&&"text-muted-foreground"),children:h.primary}),s.jsx(t6,{timing:j})]}),h.secondary?s.jsx("div",{className:de("text-xs",h.warn?"text-warning":"text-muted-foreground"),children:h.secondary}):null,s.jsx(e6,{timing:j})]}),s.jsx(q,{className:"hidden text-right md:table-cell",children:x})]},d.id)}),i?s.jsx(s6,{path:e,timing:i,current:n===jd}):null]})]})})}const vp=e=>e.turn==="Running";function s6({path:e,timing:t,current:n}){const{href:a,Link:r}=Ze(),l=t.rows.filter(vp).length,i=t.rows.length-l,o=t.error?"Not available":l?[`${l} running`,t.memory].filter(Boolean).join(" · "):"Nothing running";return s.jsxs(ue,{"data-testid":"queues-row",className:de(n&&"bg-accent"),children:[s.jsxs(q,{children:[s.jsx(r,{className:"text-primary hover:underline",href:a(`${e}?queue=${jd}`),"aria-current":n?"page":void 0,children:xS}),s.jsx("div",{className:"text-muted-foreground text-xs",children:GL}),t.error?null:s.jsxs("div",{className:"text-muted-foreground text-xs md:hidden",children:[i," waiting"]})]}),s.jsx(q,{className:"hidden md:table-cell",children:s.jsx(fe,{variant:"neutral",children:"Checks"})}),s.jsxs(q,{children:[s.jsx("div",{className:de(!l&&"text-muted-foreground"),children:o}),!l&&!t.error&&t.memory?s.jsx("div",{className:"text-muted-foreground text-xs",children:tr(t.memory)}):null]}),s.jsx(q,{className:"hidden text-right md:table-cell",children:t.error?"—":i})]})}function a6(e){if(!e)return()=>{};const t=new Map(e.rows.filter(a=>a.execution).map(a=>[a.execution,a])),n=new Map;for(const a of e.rows)a.key&&n.set(a.key,n.has(a.key)?null:a);return a=>t.get(a.ref)??n.get(a.subject.id)??void 0}const jp="No estimate yet";function wS(e){return e?e.turn===Ws.label?e.elapsed:[e.elapsed,e.estimate].filter(Boolean).join(" · "):jp}function _S(e){return e?e.turn===Ws.label?OL(e.elapsed):e.estimate?ML(e.estimate):jp:jp}function Ml({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 fy({org:e,entries:t,landing:n,queue_name:a,subject_label:r,held:l,label:i,time_of:o}){return s.jsx("div",{className:"overflow-x-auto rounded-lg border",children:s.jsxs(Fe,{containerAriaLabel:i,children:[s.jsx(Qe,{children:s.jsxs(ue,{children:[s.jsx(F,{children:r}),s.jsx(F,{children:"State"}),o?s.jsx(F,{children:"Time"}):null]})}),s.jsx(Ke,{children:t.map(c=>{const d=o==null?void 0:o(c),f=IL(c,n,a,l,(d==null?void 0:d.turn)===Ws.label);return s.jsxs(ue,{"data-testid":"queues-running",children:[s.jsxs(q,{children:[s.jsx(yd,{org:e,subject:c.subject,link:!l}),l&&c.hold&&c.note&&!c.subject.hidden?s.jsx("div",{className:"text-muted-foreground text-xs",children:c.note}):null]}),s.jsx(q,{children:s.jsx(fe,{variant:f.tone,children:f.label})}),o?s.jsx(q,{className:"text-muted-foreground text-xs",title:d==null?void 0:d.basis,children:wS(d)}):null]},c.ref)})})]})})}function hy({org:e,row:t}){return t.key?s.jsx(yd,{org:e,subject:{kind:"thread",id:t.key,title:t.title},link:!1}):s.jsx("span",{children:t.title})}function my({command:e}){return e?s.jsx("span",{className:"block max-w-xs truncate font-mono text-xs",title:e,children:e}):null}function r6({org:e,timing:t}){const n=t.rows.filter(vp),a=t.rows.filter(r=>!vp(r));return s.jsxs(mt,{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.jsx("h2",{id:"queue-title",className:"text-lg font-semibold",children:xS}),s.jsx("p",{className:"text-muted-foreground text-sm",children:VL}),t.memory&&!t.error?s.jsx("p",{className:"text-muted-foreground text-xs font-medium",children:tr(t.memory)}):null,s.jsx("p",{className:"text-muted-foreground text-xs",children:YL})]}),t.error?s.jsxs(oe,{variant:"destructive",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:"Heavy checks could not be read"}),s.jsx(ce,{children:tr(t.error)})]}):t.rows.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing running, and nothing waits in this queue."}):s.jsxs(s.Fragment,{children:[s.jsx(Ml,{id:"queue-running",title:n.length>1?"Running turns":"Running turn",children:n.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing running."}):s.jsx("div",{className:"overflow-x-auto rounded-lg border",children:s.jsxs(Fe,{containerAriaLabel:"Running turns",children:[s.jsx(Qe,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Thread"}),s.jsx(F,{className:"hidden md:table-cell",children:"Command"}),s.jsx(F,{className:"hidden text-right md:table-cell",children:"Memory"}),s.jsx(F,{children:"Time"})]})}),s.jsx(Ke,{children:n.map(r=>s.jsxs(ue,{"data-testid":"queues-running",children:[s.jsxs(q,{children:[s.jsx(hy,{org:e,row:r}),s.jsx("div",{className:"text-muted-foreground text-xs break-all md:hidden",children:[r.command,r.memory].filter(Boolean).join(" · ")})]}),s.jsx(q,{className:"hidden md:table-cell",children:s.jsx(my,{command:r.command})}),s.jsx(q,{className:"hidden text-right tabular-nums md:table-cell",children:r.memory}),s.jsx(q,{className:"text-muted-foreground text-xs",title:r.basis,children:wS(r)})]},r.position))})]})})}),s.jsx(Ml,{id:"queue-waiting",title:"Waiting",children:a.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(Fe,{containerAriaLabel:"Waiting entries",children:[s.jsx(Qe,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Position"}),s.jsx(F,{children:"Thread"}),s.jsx(F,{className:"hidden md:table-cell",children:"Command"}),s.jsx(F,{className:"hidden text-right md:table-cell",children:"Memory"}),s.jsx(F,{children:"Turn"}),s.jsx(F,{children:"Starts"}),s.jsx(F,{className:"hidden md:table-cell",children:"Note"})]})}),s.jsx(Ke,{children:a.map(r=>{const l=r.turn===Ws.label?Ws:{label:r.turn,tone:r.turn==="Next"?"info":"neutral"};return s.jsxs(ue,{"data-testid":"queues-waiting",children:[s.jsx(q,{children:r.position}),s.jsxs(q,{children:[s.jsx(hy,{org:e,row:r}),s.jsx("div",{className:"text-muted-foreground text-xs break-all md:hidden",children:[r.command,r.memory].filter(Boolean).join(" · ")})]}),s.jsx(q,{className:"hidden md:table-cell",children:s.jsx(my,{command:r.command})}),s.jsx(q,{className:"hidden text-right tabular-nums md:table-cell",children:r.memory}),s.jsx(q,{children:s.jsx(fe,{variant:l.tone,children:l.label})}),s.jsx(q,{className:"text-muted-foreground text-xs",title:r.basis,children:_S(r)}),s.jsx(q,{className:"hidden md:table-cell",children:r.reason?tr(r.reason):""})]},r.position)})})]})})})]}),s.jsx("p",{className:"text-muted-foreground text-xs",children:FL})]})}function l6({org:e,detail:t,name:n,settings_note:a,subject_label:r,thread_subjects:l,timing:i}){var _;const{queue:o,state:c}=t,d=i?a6(i):void 0,f=bS(i)>0,m=N=>n(N),h=new Map(c.entries.map(N=>[N.ref,N.subject])),x=c.entries.filter(N=>N.turn==="running"),j=c.entries.filter(N=>N.turn!=="running"&&N.batching!=="in_batch"),v=c.batch,y=Math.max(1,x.filter(N=>N.batching!=="in_batch").length),g=v&&o.policy.independent_turns?x.filter(N=>N.batching!=="in_batch"&&N.ref!==v.holder):[],p=c.manager,b=c.freeze,w=((_=o.layer)==null?void 0:_.kind)==="release"?o.layer.stall_hold:void 0,S=w?{who:n(w.by),why:w.reason,until:w.until}:p!=null&&p.hold?{who:n(p.holder,p.holder_subject),why:p.hold.why,until:p.hold.until}:null,C=!v&&x.length===0&&j.length===0;return s.jsxs(mt,{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:o.name}),s.jsx(fe,{variant:"neutral",children:mS[o.policy.step]}),s.jsx(fe,{variant:"neutral",children:DL[o.management.mode]})]}),o.purpose?s.jsx("p",{className:"text-muted-foreground text-sm",children:o.purpose}):null,i!=null&&i.basis?s.jsx("p",{className:"text-muted-foreground text-xs",children:i.basis}):null,f?s.jsx("p",{className:"text-muted-foreground text-xs",children:AL}):null]}),p?s.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm","data-testid":"queues-manager",children:[s.jsx(ZE,{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(p.holder,p.holder_subject)}),s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Lease until ",Dn(p.lease_until),p.serving_until!==void 0?" · serving now":""]})]}):null,b?s.jsxs(oe,{variant:"warning",children:[s.jsx(YE,{className:"size-4","aria-hidden":"true"}),s.jsxs(ge,{children:["Frozen until ",Dn(b.lease_until)]}),s.jsxs(ce,{children:[n(b.holder,b.holder_subject)," froze this queue at ",Dn(b.since),b.label?`: ${b.label}`:"",". Only ",n(b.holder,b.holder_subject),"'s entries start until it thaws."]})]}):null,S?s.jsxs(oe,{variant:"info",children:[s.jsx(r_,{className:"size-4","aria-hidden":"true"}),s.jsxs(ge,{children:["Stall hold until ",Dn(S.until)]}),s.jsxs(ce,{children:[S.who,S.why?`: ${S.why}`:"",". The first entry is not treated as stalled while it lasts."]})]}):null,C?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing running, and nothing waits in this queue."}):s.jsxs(s.Fragment,{children:[v?s.jsxs(Ml,{id:"queue-running",title:"Running turn",side:`Batch opened by ${n(v.holder,v.holder_subject)} at ${Dn(v.opened_at)}`,children:[s.jsx("div",{className:"overflow-x-auto rounded-lg border",children:s.jsxs(Fe,{containerAriaLabel:"Batch members",children:[s.jsx(Qe,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Landing order"}),s.jsx(F,{children:r}),s.jsx(F,{children:"Outcome"})]})}),s.jsx(Ke,{children:v.members.map((N,O)=>{const D=UL(N.outcome);return s.jsxs(ue,{"data-testid":"queues-member",children:[s.jsx(q,{children:O+1}),s.jsx(q,{children:s.jsx(yd,{org:e,subject:N.subject??h.get(N.ref)??(l?{kind:"thread",id:N.ref}:void 0),link:!l})}),s.jsx(q,{children:s.jsx(fe,{variant:D.tone,children:D.label})})]},N.ref)})})]})}),g.length>0?s.jsxs(s.Fragment,{children:[s.jsx("h4",{className:"text-muted-foreground text-xs font-medium",children:"Also running"}),s.jsx(fy,{org:e,entries:g,landing:c.landing,queue_name:o.name,subject_label:r,held:l,label:"Turns running beside the batch",time_of:d})]}):null]}):s.jsx(Ml,{id:"queue-running",title:x.length>1?"Running turns":"Running turn",children:x.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing running."}):s.jsx(fy,{org:e,entries:x,landing:c.landing,queue_name:o.name,subject_label:r,held:l,label:"Running turns",time_of:d})}),s.jsx(Ml,{id:"queue-waiting",title:"Waiting",children:j.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(Fe,{containerAriaLabel:"Waiting entries",children:[s.jsx(Qe,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Position"}),s.jsx(F,{children:r}),s.jsx(F,{className:"hidden md:table-cell",children:"Joined"}),s.jsx(F,{children:"Turn"}),d?s.jsx(F,{children:"Starts"}):null,s.jsx(F,{className:"hidden md:table-cell",children:"Note"})]})}),s.jsx(Ke,{children:j.map((N,O)=>{const D=d==null?void 0:d(N),B=BL(N,(D==null?void 0:D.turn)===Ws.label),G=N.subject.hidden?"":N.note??"";return s.jsxs(ue,{"data-testid":"queues-waiting",children:[s.jsx(q,{children:v?y+O+1:N.position}),s.jsx(q,{children:s.jsx(yd,{org:e,subject:N.subject,link:!l})}),s.jsx(q,{className:"hidden md:table-cell",children:Dn(N.joined_at)}),s.jsx(q,{children:s.jsx(fe,{variant:B.tone,children:B.label})}),d?s.jsx(q,{className:"text-muted-foreground text-xs",title:D==null?void 0:D.basis,children:_S(D)}):null,s.jsx(q,{className:"hidden md:table-cell",children:G})]},N.ref)})})]})})})]}),s.jsx(Ml,{id:"queue-settings",title:"Settings",children:s.jsx("div",{className:"overflow-x-auto rounded-lg border",children:s.jsx(Fe,{containerAriaLabel:"Queue settings",children:s.jsx(Ke,{children:qL(o,m).map(([N,O])=>s.jsxs(ue,{children:[s.jsx(F,{scope:"row",className:"h-auto w-48 py-2 font-normal",children:N}),s.jsx(q,{children:O})]},N))})})})}),s.jsx("p",{className:"text-muted-foreground text-xs",children:a})]})}const Bs="__no_parent__";function NS(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 qo=(e,t)=>(e.label||e.key).localeCompare(t.label||t.key);function zn({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(Oe,{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 yp({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 py({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(ji,{id:e,className:"mt-0.5",checked:a,"aria-describedby":n?`${e}-help`:void 0,onCheckedChange:l=>r(l===!0)}),s.jsx(Oe,{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 kS({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(Ut,{className:"mt-0.5 size-3.5 shrink-0","aria-hidden":"true"}),s.jsx("div",{className:"grid gap-0.5",children:c.map(m=>s.jsx("p",{children:m},m))})]}):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((m,h)=>s.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[s.jsx(ji,{id:`${e}-${h}`,className:"mt-0.5",checked:l.has(m.value),onCheckedChange:x=>{const j=new Set(l);x===!0?j.add(m.value):j.delete(m.value),i(j)}}),s.jsx(Oe,{htmlFor:`${e}-${h}`,className:"min-w-0 font-normal break-words",children:m.label})]},m.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 Go({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(oe,{variant:"destructive",role:"alert",children:[s.jsx(GE,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:n}),s.jsxs(ce,{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 pr=e=>e.two_factor==="ok";function Ni({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(Go,{context:t,action:a,changing:r,title:`Could not save ${n}`});const i=pr(t)?null:s.jsx(Go,{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(oe,{variant:"destructive",role:"alert",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),o?s.jsx(ge,{children:o}):null,s.jsx(ce,{children:e.message})]})]})}function SS({id:e,value:t,on_change:n,none:a,options:r,described_by:l}){return s.jsxs(Nt,{value:t,onValueChange:n,children:[s.jsx(xt,{id:e,"aria-describedby":l,children:s.jsx(kt,{placeholder:"Choose a team"})}),s.jsxs(gt,{children:[a?s.jsx(De,{value:Bs,children:a}):null,r.map(i=>s.jsx(De,{value:i.key,children:i.label||i.key},i.key))]})]})}function ki(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 Si({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 CS=(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 i6({open:e,chart:t,team:n,save:a,on_close:r,context:l=Ci,scope:i="full",parents:o}){var k;const c=l.host==="hosted",[d,f]=u.useState(""),[m,h]=u.useState(""),[x,j]=u.useState(""),[v,y]=u.useState(Bs),[g,p]=u.useState({}),{saving:b,refusal:w,set_refusal:S,run:C}=ki(r),_=((k=t.teams.find(M=>M.parent===null))==null?void 0:k.key)??null;u.useEffect(()=>{e&&(f(""),h((n==null?void 0:n.label)??""),j((n==null?void 0:n.description)??""),y((n==null?void 0:n.parent)??(c&&_&&(!o||o.includes(_))?_:Bs)),p({}),S(null))},[e,n,S,c,_,o]);const N=M=>{const Y=t.teams.find(A=>A.key===M);return Y?Y.label||Y.key:M??""},O=n?NS(t.teams,n.key):new Set,D=[...t.teams].filter(M=>!O.has(M.key)&&(!o||o.includes(M.key))).sort((M,Y)=>M.key===_?-1:Y.key===_?1:qo(M,Y)),B=n?n.label||n.key:"",G=i==="description",U=!pr(l),R=n?G?"save the description":"save the team":"add the team",$=M=>{if(M.preventDefault(),U)return;if(!n){const I=c?m.trim():d.trim();if(!I){p(c?{label:"Give the team a name."}:{key:"Give the team a key."});return}if(c&&v===Bs){p({parent:"Choose the parent team."});return}const X=c?I:m.trim()||I;C(()=>a({action:"add",kind:"team",key:I,...m.trim()?{label:m.trim()}:{},...x.trim()?{description:x.trim()}:{},...v!==Bs?{parent:v}:{}},`Team ${X} added.`));return}if(!G&&!m.trim()){p({label:c?"Give the team a name.":"Give the team a label."});return}const Y=v===Bs?null:v,A={...!G&&m.trim()!==n.label.trim()?{label:m.trim()}:{},...x.trim()!==(n.description??"").trim()?{description:x.trim()}:{},...!c&&Y!==n.parent?{parent:Y}:{}};if(Object.keys(A).length===0){r();return}C(()=>a({action:"edit",kind:"team",key:n.key,...A},G?`Saved the description of ${B}.`:`Team ${m.trim()} saved.`))},T=n?G?`Edit the description of ${B}`:`Edit team ${B}`:"Add team";let E;return G?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(bn,{open:e,onOpenChange:M=>M||b?null:r(),children:s.jsx(wn,{children:s.jsxs("form",{onSubmit:$,noValidate:!0,children:[s.jsxs(_n,{children:[s.jsx(kn,{children:T}),s.jsx(Sn,{children:E})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[s.jsx(Ni,{refusal:w,context:l,subject:G?"the description":"the team",action:R}),!n&&!c?s.jsx(zn,{id:"org-team-key",label:"Key",help:CS("team",l.host),error:g.key,children:M=>s.jsx(pt,{id:"org-team-key",className:"font-mono",value:d,autoComplete:"off","aria-invalid":g.key?!0:void 0,"aria-describedby":M,onChange:Y=>{f(Y.target.value),p({})}})}):null,G&&n?s.jsx(yp,{label:"Name",children:n.parent?`${B} · under ${N(n.parent)}`:B}):s.jsx(zn,{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(pt,{id:"org-team-label",value:m,"aria-invalid":g.label?!0:void 0,"aria-describedby":M,onChange:Y=>{h(Y.target.value),p({})}})}),s.jsx(zn,{id:"org-team-description",label:G?"Description":"Description (optional)",children:()=>s.jsx(vn,{id:"org-team-description",rows:3,placeholder:"What the team does",value:x,onChange:M=>j(M.target.value)})}),G?null:c&&n?s.jsx(yp,{label:"Parent team",children:n.parent?N(n.parent):"None: the organization itself"}):s.jsx(zn,{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(SS,{id:"org-team-parent",value:v,on_change:Y=>{y(Y),p({})},none:c?void 0:"No parent (a root team)",options:D,described_by:M})})]}),s.jsxs(Nn,{className:"mt-6",children:[s.jsx(P,{type:"button",variant:"outline",disabled:b,onClick:r,children:"Cancel"}),s.jsx(Si,{saving:b,blocked:U,children:n?b?"Saving…":"Save":b?"Adding…":"Add team"})]})]})})})}const o6=(e,t)=>e.length===t.size&&e.every(n=>t.has(n));function c6({open:e,chart:t,job:n,save:a,on_close:r,context:l=Ci}){const[i,o]=u.useState(""),[c,d]=u.useState(""),[f,m]=u.useState(""),[h,x]=u.useState(Bs),[j,v]=u.useState(new Set),[y,g]=u.useState(!1),[p,b]=u.useState(!0),[w,S]=u.useState({}),{saving:C,refusal:_,set_refusal:N,run:O}=ki(r);u.useEffect(()=>{e&&(o(""),d((n==null?void 0:n.label)??""),m((n==null?void 0:n.description)??""),x((n==null?void 0:n.parent)??Bs),v(new Set((n==null?void 0:n.fills)??[])),g((n==null?void 0:n.requires_person)??!1),b((n==null?void 0:n.escalable)??!0),S({}),N(null))},[e,n,N]);const D=n?NS(t.job_functions,n.key):new Set,B=[...t.job_functions].filter(T=>!D.has(T.key)).sort(qo),G=[...t.slots].sort(qo).map(T=>({value:T.key,label:T.label||T.key})),U=!pr(l),R=n?"save the job function":"add the job function",$=T=>{if(T.preventDefault(),U)return;if(!n){if(!i.trim()){S({key:"Give the job function a key."});return}O(()=>a({action:"add",kind:"job_function",key:i.trim(),...c.trim()?{label:c.trim()}:{},...f.trim()?{description:f.trim()}:{},...h!==Bs?{parent:h}:{},fills:[...j],requires_person:y,escalable:p},`Job function ${c.trim()||i.trim()} added.`));return}if(!c.trim()){S({label:"Give the job function a label."});return}const E=h===Bs?null:h,k={...c.trim()!==n.label.trim()?{label:c.trim()}:{},...f.trim()!==(n.description??"").trim()?{description:f.trim()}:{},...E!==n.parent?{parent:E}:{},...o6(n.fills,j)?{}:{fills:[...j]},...y!==n.requires_person?{requires_person:y}:{},...p!==n.escalable?{escalable:p}:{}};if(Object.keys(k).length===0){r();return}O(()=>a({action:"edit",kind:"job_function",key:n.key,...k},`Job function ${c.trim()} saved.`))};return s.jsx(bn,{open:e,onOpenChange:T=>T||C?null:r(),children:s.jsx(wn,{children:s.jsxs("form",{onSubmit:$,noValidate:!0,children:[s.jsxs(_n,{children:[s.jsx(kn,{children:n?`Edit job function ${n.label||n.key}`:"Add job function"}),s.jsxs(Sn,{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(Ni,{refusal:_,context:l,subject:"the job function",action:R}),n?null:s.jsx(zn,{id:"org-function-key",label:"Key",help:CS("job function",l.host),error:w.key,children:T=>s.jsx(pt,{id:"org-function-key",className:"font-mono",value:i,autoComplete:"off","aria-invalid":w.key?!0:void 0,"aria-describedby":T,onChange:E=>{o(E.target.value),S({})}})}),s.jsx(zn,{id:"org-function-label",label:n?"Label":"Label (optional)",error:w.label,children:T=>s.jsx(pt,{id:"org-function-label",value:c,"aria-invalid":w.label?!0:void 0,"aria-describedby":T,onChange:E=>{d(E.target.value),S({})}})}),s.jsx(zn,{id:"org-function-description",label:"Job description (optional)",children:()=>s.jsx(vn,{id:"org-function-description",rows:3,placeholder:"What this job function does",value:f,onChange:T=>m(T.target.value)})}),s.jsx(zn,{id:"org-function-parent",label:"Parent function",help:"Its posts report to the post of the parent function.",children:T=>s.jsx(SS,{id:"org-function-parent",value:h,on_change:x,none:"No parent (a root function)",options:B,described_by:T})}),s.jsx(kS,{id:"org-function-fills",legend:"Slots it fills",options:G,checked:j,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(py,{id:"org-function-requires-person",label:"Requires a person",help:"Only a person may hold its posts.",checked:y,on_change:g}),s.jsx(py,{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:b})]}),s.jsxs(Nn,{className:"mt-6",children:[s.jsx(P,{type:"button",variant:"outline",disabled:C,onClick:r,children:"Cancel"}),s.jsx(Si,{saving:C,blocked:U,children:n?C?"Saving…":"Save":C?"Adding…":"Add job function"})]})]})})})}const u6=/^[a-z][a-z0-9_-]{0,63}$/;function d6(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[^a-z]+/,"").slice(0,64).replace(/-+$/,"")}function f6({open:e,chart:t,slot:n,save:a,on_close:r,context:l=Ci}){const[i,o]=u.useState(""),[c,d]=u.useState(""),[f,m]=u.useState(!1),[h,x]=u.useState(""),[j,v]=u.useState({}),{saving:y,refusal:g,set_refusal:p,run:b}=ki(r);u.useEffect(()=>{e&&(o((n==null?void 0:n.label)??""),d((n==null?void 0:n.key)??""),m(!1),x((n==null?void 0:n.description)??""),v({}),p(null))},[e,n,p]);const w=!pr(l),S=n?"save the slot":"add the slot",C=_=>{if(_.preventDefault(),w)return;const N=i.trim();if(n){if(!N){v({label:"Give the slot a label."});return}const D={...N!==(n.label??"").trim()?{label:N}:{},...h.trim()!==(n.description??"").trim()?{description:h.trim()}:{}};if(Object.keys(D).length===0){r();return}b(()=>a({action:"edit",kind:"slot",key:n.key,...D},`Saved slot ${N}.`));return}const O={...N?{}:{label:"Give the slot a label."},...u6.test(c)?t.slots.some(D=>D.key===c)?{key:`Slot ${c} already exists.`}:{}:{key:"Use lowercase letters, digits, _ and -, starting with a letter, at most 64 characters."}};v(O),!(O.label||O.key)&&b(()=>a({action:"add",kind:"slot",key:c,label:N,...h.trim()?{description:h.trim()}:{}},`Added slot ${N}.`))};return s.jsx(bn,{open:e,onOpenChange:_=>_||y?null:r(),children:s.jsx(wn,{children:s.jsxs("form",{onSubmit:C,noValidate:!0,children:[s.jsxs(_n,{children:[s.jsx(kn,{children:n?`Edit ${n.label||n.key}`:"Add slot"}),s.jsx(Sn,{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(Ni,{refusal:g,context:l,subject:"the slot",action:S}),s.jsx(zn,{id:"org-slot-label",label:"Label",help:"How the slot is named on the chart and in project settings.",error:j.label,children:_=>s.jsx(pt,{id:"org-slot-label",value:i,"aria-invalid":j.label?!0:void 0,"aria-describedby":_,onChange:N=>{o(N.target.value),!n&&!f&&d(d6(N.target.value)),v({})}})}),n?s.jsx(yp,{label:"Key",children:s.jsx("span",{className:"font-mono",children:n.key})}):s.jsx(zn,{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:j.key,children:_=>s.jsx(pt,{id:"org-slot-key",className:"font-mono",value:c,autoComplete:"off","aria-invalid":j.key?!0:void 0,"aria-describedby":_,onChange:N=>{d(N.target.value),m(!0),v({})}})}),s.jsx(zn,{id:"org-slot-description",label:"Description (optional)",children:()=>s.jsx(vn,{id:"org-slot-description",rows:3,placeholder:"What this role does",value:h,onChange:_=>x(_.target.value)})})]}),s.jsxs(Nn,{className:"mt-6",children:[s.jsx(P,{type:"button",variant:"outline",disabled:y,onClick:r,children:"Cancel"}),s.jsx(Si,{saving:y,blocked:w,children:n?y?"Saving…":"Save":y?"Adding…":"Add slot"})]})]})})})}function h6({open:e,chart:t,binding:n,names:a,save:r,confirm:l,on_close:i,context:o=Ci,hosted:c}){var U;const[d,f]=u.useState(new Set),[m,h]=u.useState(""),[x,j]=u.useState({}),{saving:v,refusal:y,set_refusal:g,run:p}=ki(i),b=(n==null?void 0:n.slot)??null;if(u.useEffect(()=>{!e||!n||(f(new Set(c&&n.source!=="override"?[]:n.posts.map(R=>R.post))),h(n.source==="override"?n.reason??"":""),j({}),g(null))},[e,b,g]),!n)return null;const w=a.slot(n.slot),S=(U=t.project)!=null&&U.team?t.teams.find(R=>{var $;return R.key===(($=t.project)==null?void 0:$.team)}):void 0,C=S?S.label||S.key:"the owning team",_=new Set(t.job_functions.filter(R=>R.fills.includes(n.slot)).map(R=>R.key)),N=[...t.posts].map(R=>R.post).sort(a.byPost).map(R=>{const $=_.has(R.split("/")[1]??"")?`${a.post(R)} (fills ${w})`:a.post(R),T=c==null?void 0:c.holders(R);return{value:R,label:c?T?`${$}: ${T}`:`${$} (no holder)`:$}}),O=c?[...d].sort(a.byPost).flatMap(R=>[..._.has(R.split("/")[1]??"")?[]:[`${a.post(R)} is not in the job description of ${w}.`],...c.chain.has(R.split("/")[0]??"")?[]:[`${a.post(R)} is outside ${c.owner} and the teams above it.`]]):[],D=!pr(o),B=R=>{R.preventDefault();const $={...d.size===0?{posts:"Choose at least one post."}:{},...m.trim()?{}:{reason:"Give the reason for the override."}};j($),!($.posts||$.reason||D)&&p(()=>r({action:"bind",slot:n.slot,posts:[...d],reason:m.trim()},`Override of ${w} saved.`))},G=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(bn,{open:e,onOpenChange:R=>R||v?null:i(),children:s.jsx(wn,{children:s.jsxs("form",{onSubmit:B,noValidate:!0,children:[s.jsxs(_n,{children:[s.jsxs(kn,{children:["Override ",w]}),s.jsxs(Sn,{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||D?s.jsx("div",{id:"org-override-refusal",className:"grid gap-4",children:s.jsx(Ni,{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(kS,{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:O,scroll:!!c,error:x.posts,options:N,checked:d,on_change:R=>{f(R),j($=>({...$,posts:void 0}))}}),s.jsx(zn,{id:"org-override-reason",label:"Reason",error:x.reason,children:R=>s.jsx(vn,{id:"org-override-reason",rows:2,placeholder:"Why this slot needs other posts",value:m,"aria-invalid":x.reason?!0:void 0,"aria-describedby":R,onChange:$=>{h($.target.value),j(T=>({...T,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(Nn,{className:"mt-6",children:[n.source==="override"?s.jsx(P,{type:"button",variant:"ghost",className:"sm:mr-auto",disabled:v,onClick:()=>void G(),children:"Clear override"}):null,s.jsx(P,{type:"button",variant:"outline",disabled:v,onClick:i,children:"Cancel"}),s.jsx(Si,{saving:v,blocked:D,described_by:"org-override-refusal",children:v?"Saving…":"Save override"})]})]})})})}function m6(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} or ${e[e.length-1]}`}function p6({open:e,chart:t,names:n,save:a,on_close:r,context:l}){var R;const i=t.authority,o=u.useMemo(()=>i?new Set(i.post_pairs):null,[i]),c=$=>!o||o.has($),d=((R=t.teams.find($=>$.parent===null))==null?void 0:R.key)??null,f=[...t.teams].filter($=>!o||[...o].some(T=>T.startsWith(`${$.key}/`))).sort(($,T)=>$.key===d?-1:T.key===d?1:qo($,T)),[m,h]=u.useState(""),[x,j]=u.useState(""),[v,y]=u.useState({}),{saving:g,refusal:p,set_refusal:b,run:w}=ki(r);u.useEffect(()=>{var $;e&&(h((($=f[0])==null?void 0:$.key)??""),j(""),y({}),b(null))},[e,b]);const S=new Set(t.posts.filter($=>$.post.startsWith(`${m}/`)).map($=>$.post.split("/")[1])),C=[],_=$=>{for(const T of[...t.job_functions].filter(E=>E.parent===$).sort(qo))C.push(T),_(T.key)};_(null);const N=C.filter($=>c(`${m}/${$.key}`)&&!S.has($.key)),O=m!==""&&N.length===0,D=!pr(l)||O,B=$=>{if($.preventDefault(),D)return;const T={...m?{}:{team:"Choose a team."},...x?{}:{job:"Choose a job function."}};y(T),!(T.team||T.job)&&w(()=>a({action:"add",kind:"post",key:`${m}/${x}`},`Added post ${n.job(x)} · ${n.team(m)}.`))},G=O?"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.",U=(i==null?void 0:i.ask)??[];return s.jsx(bn,{open:e,onOpenChange:$=>$||g?null:r(),children:s.jsx(wn,{children:s.jsxs("form",{onSubmit:B,noValidate:!0,children:[s.jsxs(_n,{children:[s.jsx(kn,{children:"Add post"}),s.jsx(Sn,{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(Ni,{refusal:p,context:l,subject:"the post",action:"add the post"}),s.jsx(zn,{id:"org-post-team",label:"Team",help:"The team the post is in.",error:v.team,children:$=>s.jsxs(Nt,{value:m,onValueChange:T=>{h(T),j(""),y({})},children:[s.jsx(xt,{id:"org-post-team","aria-describedby":$,"aria-invalid":v.team?!0:void 0,children:s.jsx(kt,{placeholder:"Choose a team"})}),s.jsx(gt,{children:f.map(T=>s.jsx(De,{value:T.key,children:T.label||T.key},T.key))})]})}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(zn,{id:"org-post-function",label:"Job function",help:G,error:v.job,children:$=>s.jsxs(Nt,{value:x,disabled:O,onValueChange:T=>{j(T),y({})},children:[s.jsx(xt,{id:"org-post-function","aria-describedby":$,"aria-invalid":v.job?!0:void 0,children:s.jsx(kt,{placeholder:O?"Every job function has a post here":"Choose a job function"})}),s.jsx(gt,{children:N.map(T=>s.jsx(De,{value:T.key,children:T.label||T.key},T.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.",U.length?` For others, ask ${m6(U)}.`:""]}):null]})]}),s.jsxs(Nn,{className:"mt-6",children:[s.jsx(P,{type:"button",variant:"outline",disabled:g,onClick:r,children:"Cancel"}),s.jsx(Si,{saving:g,blocked:D,described_by:O?"org-post-function-help":void 0,children:g?"Adding…":"Add post"})]})]})})})}function x6({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,m]=u.useState(""),[h,x]=u.useState(null),[j,v]=u.useState(-1),{saving:y,refusal:g,set_refusal:p,run:b}=ki(i),w=u.useRef(0),S=u.useCallback(async()=>{const A=w.current+=1;d({state:"loading"});const I=await r();A===w.current&&d(I.ok?{state:"read",members:I.data}:{state:"failed"})},[r]);u.useEffect(()=>{e&&(m(""),x(null),v(-1),p(null),S())},[e,S,p]);const C=t.posts.find(A=>A.post===n);if(!n||!C)return null;const _=a.post(n),N=new Set(C.holders.map(A=>A.id)),D=t.posts.some(A=>A.reports_to===n)&&C.holders.length>0?C.holders[0]:null,B=f.trim().toLowerCase(),G=c.state==="read"?c.members.filter(A=>!N.has(A.id)).filter(A=>!B||[A.label,A.detail,A.email].some(I=>I==null?void 0:I.toLowerCase().includes(B))):[],U=c.state==="read"&&c.members.every(A=>N.has(A.id)),R=c.state==="read"&&!U&&G.length>0,$=R&&j>=0&&j<G.length?G[j]:null,T=A=>`org-holder-option-${A.id}`,E=!pr(o)||!h||D!==null,k=A=>{if(!R)return;const I=G.length-1,X=J=>{var ae,ke;A.preventDefault(),v(J),(ke=(ae=document.getElementById(T(G[J])))==null?void 0:ae.scrollIntoView)==null||ke.call(ae,{block:"nearest"})};A.key==="ArrowDown"?X(Math.min($?j+1:0,I)):A.key==="ArrowUp"?X($?Math.max(j-1,0):I):A.key==="Home"&&$?X(0):A.key==="End"&&$?X(I):A.key==="Enter"&&$&&(h==null?void 0:h.id)!==$.id&&(A.preventDefault(),x($))},M=D?void 0:h?"Only members of the organization can hold its posts. Members who already hold it are left out.":"Choose a member to add.",Y=A=>{A.preventDefault(),!(E||!h)&&b(()=>l({action:"hold",post:n,member:h.id},`Added ${h.label} to ${_}.`))};return s.jsx(bn,{open:e,onOpenChange:A=>A||y?null:i(),children:s.jsx(wn,{children:s.jsxs("form",{onSubmit:Y,noValidate:!0,children:[s.jsxs(_n,{children:[s.jsxs(kn,{children:["Add holder to ",_]}),s.jsx(Sn,{children:"The member holds this post and reports as it does."})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[s.jsx(Ni,{refusal:g,context:o,subject:"the holder",action:"add the holder"}),D?s.jsxs(oe,{variant:"info",id:"org-holder-one",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsxs(ce,{children:["This post takes one holder. Remove ",a.member(D)," first, then add the new holder."]})]}):null,s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"org-holder-member",children:"Member"}),s.jsx(pt,{id:"org-holder-member",role:"combobox","aria-expanded":R,"aria-controls":R?"org-holder-members":void 0,"aria-activedescendant":$?T($):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:D!==null,onChange:A=>{m(A.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(dn,{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 S(),children:"Retry"})]}):U?s.jsx("p",{className:"text-muted-foreground px-3 py-2 text-sm",children:"Every member already holds this post."}):G.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:G.map((A,I)=>{const X=(h==null?void 0:h.id)===A.id,J=($==null?void 0:$.id)===A.id;return s.jsxs("li",{id:T(A),role:"option","aria-selected":X,className:`cursor-pointer rounded-sm px-2 py-1.5 ${X?"bg-accent text-accent-foreground":J?"bg-muted":"hover:bg-muted"} ${J?"ring-ring ring-2 ring-inset":""}`,onClick:()=>{D||(v(I),x(A))},children:[s.jsxs("div",{className:"text-sm font-medium break-words",children:[A.label,A.detail&&G.filter(ae=>ae.label===A.label).length>1?` (${A.detail})`:""]}),A.email?s.jsx("div",{className:"text-muted-foreground text-xs break-all",children:A.email}):null]},A.id)})})}),M?s.jsx("p",{id:"org-holder-member-help",className:"text-muted-foreground text-xs",children:M}):null]})]}),s.jsxs(Nn,{className:"mt-6",children:[s.jsx(P,{type:"button",variant:"outline",disabled:y,onClick:i,children:"Cancel"}),s.jsx(Si,{saving:y,blocked:E,described_by:D?"org-holder-one":M?"org-holder-member-help":void 0,children:y?"Adding…":"Add holder"})]})]})})})}function RS(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=!pr(e),o=s.jsx(Ux,{open:t!==null,onOpenChange:c=>c?null:r(!1),children:s.jsxs(Bx,{children:[s.jsxs(Ix,{children:[s.jsx(Px,{children:t==null?void 0:t.title}),s.jsx(qx,{className:"whitespace-pre-line",children:t==null?void 0:t.description})]}),t&&i?s.jsx(Go,{context:e,action:t.action}):null,s.jsxs(Hx,{children:[s.jsx(Gx,{children:"Cancel"}),s.jsx(tN,{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 Vl({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(xf,{children:[s.jsx(gf,{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(Rx,{className:"size-3.5","aria-hidden":"true"})})}),s.jsx(bc,{align:"end",children:r.map(l=>s.jsx(li,{className:l.destructive?"text-destructive focus:text-destructive":void 0,onSelect:l.on_select,children:l.label},l.label))})]})}function g6({label:e,message:t,bound:n,on_dismiss:a}){return s.jsxs(oe,{variant:"destructive",role:"alert",className:"mb-3",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsxs(ge,{children:[e," was not removed"]}),s.jsxs(ce,{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 Ci={host:"local",two_factor:"ok",settings_href:""},bd={open:{label:"Open",tone:"info"},accepted:{label:"Accepted",tone:"success"},rejected:{label:"Rejected",tone:"error"},withdrawn:{label:"Withdrawn",tone:"neutral"}},v6={added:{label:"Added",tone:"success"},changed:{label:"Changed",tone:"warning"},removed:{label:"Removed",tone:"error"}},j6={team:["team","teams"],job_function:["job function","job functions"],slot:["slot","slots"],post:["post","posts"],fill:["fill","fills"]},y6=["team","job_function","slot","post","fill"];function $g(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function TS(e){const t=a=>$g(y6.filter(r=>e[r][a]>0).map(r=>{const l=e[r][a];return`${l} ${j6[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 wd(e){return new Date(e).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}function b6(e){const t=`Proposed by ${e.requested_by} on ${wd(e.requested_at)}`;return e.status==="open"||!e.decided_at?t:`${t} · ${bd[e.status].label} by ${e.decided_by??"a former member"} on ${wd(e.decided_at)}`}function w6({source:e}){return s.jsxs("span",{className:"inline-flex min-w-0 max-w-full items-center gap-1","data-testid":"org-proposal-source",children:[s.jsx("span",{className:"shrink-0",children:"From package"}),e.href?s.jsx("a",{className:"min-h-6 min-w-0 break-words leading-6 text-primary underline underline-offset-2",href:e.href,children:e.label}):s.jsx("span",{className:"min-w-0 break-words text-foreground",children:e.label}),e.withdrawn?s.jsx(fe,{className:"shrink-0",variant:"warning",children:"Version withdrawn"}):null]})}function _6(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 xy({proposal:e,on_open:t}){const n=bd[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(fe,{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 ${wd(e.requested_at)}`:`${n.label} by ${e.decided_by??"a former member"} on ${wd(e.decided_at??e.requested_at)}`,` · ${TS(e.counts)}`]})]})}const N6="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 k6({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(fe,{variant:"info",children:`${i.length} open`}):null]}),s.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:N6})]}),s.jsxs(P,{type:"button",variant:"outline",size:"sm",onClick:t,children:[s.jsx(Fm,{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(mt,{className:"flex flex-col items-center gap-2 p-6 text-center",children:[s.jsx(Fm,{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(mt,{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(xy,{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(Kd,{className:"size-4","aria-hidden":"true"}):s.jsx(dc,{className:"size-4","aria-hidden":"true"}),`Decided (${o.length})`]}),a?s.jsx(mt,{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(xy,{proposal:c,on_open:()=>n(c)},c.id))})}):null]}):null]})]})}const S6="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 C6({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?Ut:Fm;return s.jsxs(oe,{variant:r?"warning":"info",role:"status",className:"mt-6",children:[s.jsx(o,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:r?"The org changed while you drafted":"You are drafting a proposal"}),s.jsxs(ce,{children:[s.jsx("p",{id:"org-draft-why",children:a?`The org changed what your draft changes: ${$g(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.":S6}),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 R6={proposal_empty:"The proposal changes nothing in the org."};function T6({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),[m,h]=u.useState(null),[x,j]=u.useState(!1),v=u.useRef(!1);u.useEffect(()=>{e&&(f(null),h(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),h(null),j(!0),v.current=!0;try{const b=await n({title:p,...o.trim()?{note:o.trim()}:{}});if(!b.ok){h(R6[b.refusal.code??""]??b.refusal.message);return}b.data.state==="proposed"&&(i(""),c("")),r(b.data,p)}finally{v.current=!1,j(!1)}};return s.jsx(bn,{open:e,onOpenChange:g=>g?null:a(),children:s.jsx(wn,{className:"sm:max-w-lg",children:s.jsxs("form",{onSubmit:g=>void y(g),className:"grid gap-4",noValidate:!0,children:[s.jsxs(_n,{children:[s.jsx(kn,{children:"Submit proposal"}),s.jsx(Sn,{children:"Someone who may make these changes reviews it. Nothing in the organization changes until it is accepted."})]}),m?s.jsxs(oe,{variant:"destructive",role:"alert",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:"Could not submit the proposal"}),s.jsx(ce,{children:s.jsx("p",{children:m})})]}):null,s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"org-proposal-title",children:"Title"}),s.jsx(pt,{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(Oe,{htmlFor:"org-proposal-note",children:"Note (optional)"}),s.jsx(vn,{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:TS(t.counts)}),s.jsxs(Nn,{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(dn,{className:"size-4","aria-hidden":"true"}):null,x?"Submitting…":"Submit proposal"]})]})]})})})}const E6=[{kind:"team",title:"Teams"},{kind:"job_function",title:"Job functions"},{kind:"slot",title:"Slots"},{kind:"post",title:"Posts"},{kind:"fill",title:"Fills"}];function A6({entry:e,decided:t}){const n=!t&&e.state==="settled",a=v6[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(fe,{variant:a.tone,children:a.label}),s.jsx("span",{className:"text-sm font-medium",children:e.name}),n?s.jsx(fe,{variant:"neutral",children:"Already in the org"}):null,!t&&e.state==="conflict"?s.jsx(fe,{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 gy(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: ${$g(n)}.`,r=e.proposal.source&&!e.proposal.source.withdrawn?e.proposal.source:void 0,l=r?`propose ${r.label} again`:"propose again";if(e.proposal.mine)return r?`${a} Withdraw it and ${l}; it is laid over the org as it is now.`:`${a} Withdraw it and propose again from the org as it is now.`;const i=`ask ${e.proposal.requested_by} to withdraw it and ${l}.`;return e.may_reject?`${a} Reject it, or ${i}`:`${a} You can ${i}`}}return t.code==="revision_conflict"?"Someone else changed the org. We read it again; check the proposal and accept again.":t.message}function $6({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,m]=u.useState(null),[h,x]=u.useState(!1),[j,v]=u.useState(null),[y,g]=u.useState("ok"),[p,b]=u.useState(null),[w,S]=u.useState(""),C=(e==null?void 0:e.id)??null,_=u.useRef(C);_.current=C;const N=u.useCallback(async()=>{if(!C)return;const A=await t.read(C);_.current===C&&(A.ok?(o(A.data),d(null)):d(A.refusal.message))},[t,C]);u.useEffect(()=>{if(o(null),d(null),m(null),x(!1),S(""),!C)return;N(),a().then(g);const A=()=>void a().then(I=>_.current===C&&g(I));return window.addEventListener("focus",A),()=>window.removeEventListener("focus",A)},[C,N,a]);const O=(i==null?void 0:i.proposal)??e,D=(O==null?void 0:O.title)??"",B=(O==null?void 0:O.status)==="open",G=(i==null?void 0:i.entries.some(A=>A.state==="conflict"))??!1,U=!!i&&(i.may_accept||i.may_reject),R=y==="ok",$={...n,two_factor:y},T=async A=>{if(C){v(A),m(null);try{const I=A==="accept"?await t.accept(C):A==="reject"?await t.reject(C,w.trim()||void 0):await t.withdraw(C);if(I.ok){b(null),l(A==="accept"?`Accepted ${D}.`:A==="reject"?`Rejected ${D}.`:`Withdrew ${D}.`);return}if(b(null),I.refusal.code==="mfa_challenge_required"||I.refusal.code==="mfa_enrollment_required"){g(I.refusal.code==="mfa_enrollment_required"?"enroll":"challenge");return}A==="accept"&&x(!0);const X=await t.read(C);if(_.current!==C)return;const J=X.ok?X.data:i;X.ok&&o(X.data),m({title:`${D} was not ${A==="accept"?"accepted":A==="reject"?"rejected":"withdrawn"}`,message:gy(J,I.refusal)})}finally{v(null)}}},E=i&&G&&!f?gy(i,{code:"proposal_conflict",message:""}):null,k=B&&i&&i.may_reject&&!i.may_accept&&!G?i.accept_refusal??null:null,M=!R||G||!!k||j!==null,Y=[R?null:"org-proposal-two-factor",G?"org-proposal-refusal":null,k?"org-proposal-accept-refusal":null].filter(Boolean).join(" ");return s.jsxs(s.Fragment,{children:[s.jsx(bn,{open:e!==null,onOpenChange:A=>A?null:r(),children:s.jsxs(wn,{className:"flex max-h-[90vh] flex-col overflow-hidden sm:max-w-2xl",children:[s.jsxs(_n,{children:[s.jsx(kn,{children:D}),s.jsx(Sn,{asChild:!0,children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[O?s.jsx(fe,{variant:bd[O.status].tone,children:bd[O.status].label}):null,s.jsx("span",{children:O?b6(O):null}),i!=null&&i.proposal.source?s.jsx(w6,{source:i.proposal.source}):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:[O!=null&&O.note?s.jsx("p",{className:"text-sm whitespace-pre-line",children:O.note}):null,O!=null&&O.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:O.decision_note})]}):null,c?s.jsxs(oe,{variant:"destructive",role:"alert",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:"Could not read the proposal"}),s.jsx(ce,{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?E6.map(A=>{const I=i.entries.filter(X=>X.kind===A.kind);return I.length?s.jsxs("div",{className:"grid",children:[s.jsx("h3",{className:"text-muted-foreground text-sm font-medium",children:A.title}),s.jsx("ul",{role:"list",className:"m-0 list-none p-0",children:I.map(X=>s.jsx(A6,{entry:X,decided:!B},`${X.kind}:${X.name}`))})]},A.kind):null}):null,B&&i&&!U&&i.decide_refusal?s.jsxs(oe,{variant:"info",role:"status",children:[s.jsx(gn,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:"You can't accept or reject this proposal"}),s.jsx(ce,{children:s.jsx("p",{children:i.decide_refusal})})]}):null,k?s.jsxs(oe,{id:"org-proposal-accept-refusal",variant:"info",role:"status",children:[s.jsx(gn,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:"You can't accept this proposal"}),s.jsx(ce,{children:s.jsx("p",{children:k})})]}):null,B&&U&&!R?s.jsx("div",{id:"org-proposal-two-factor",children:s.jsx(Go,{context:$,action:"decide the proposal",changing:"Accepting or rejecting a proposal"})}):null,f||E?s.jsxs(oe,{id:"org-proposal-refusal",variant:"destructive",role:"alert",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:(f==null?void 0:f.title)??(h?`${D} was not accepted`:`${D} can't be accepted`)}),s.jsx(ce,{children:s.jsx("p",{children:(f==null?void 0:f.message)??E})})]}):null]}),s.jsxs(Nn,{children:[s.jsx(P,{type:"button",variant:"outline",onClick:r,children:"Close"}),B&&(i!=null&&i.may_withdraw)?s.jsx(P,{type:"button",variant:"outline",onClick:()=>b("withdraw"),children:"Withdraw proposal"}):null,B&&(i!=null&&i.may_reject)?s.jsx(P,{type:"button",variant:"outline",onClick:()=>b("reject"),children:"Reject"}):null,B&&i&&(i.may_accept||i.may_reject&&(G||k))?s.jsxs(P,{type:"button","aria-disabled":M||void 0,"aria-describedby":Y||void 0,onClick:()=>M?void 0:void T("accept"),children:[j==="accept"?s.jsx(dn,{className:"size-4","aria-hidden":"true"}):null,j==="accept"?"Accepting…":"Accept"]}):null]})]})}),s.jsx(Ux,{open:p!==null,onOpenChange:A=>A?null:b(null),children:s.jsxs(Bx,{children:[s.jsxs(Ix,{children:[s.jsx(Px,{children:p==="reject"?`Reject ${D}?`:`Withdraw ${D}?`}),s.jsx(qx,{children:p==="reject"?`${(O==null?void 0:O.requested_by)??"The requester"} sees your note on the proposal.`:"Nobody can accept it after this."})]}),p==="reject"&&!R?s.jsx("div",{id:"org-proposal-reject-two-factor",children:s.jsx(Go,{context:$,action:"reject the proposal",changing:"Accepting or rejecting a proposal"})}):null,p==="reject"?s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"org-proposal-reject-note",children:"Note (optional)"}),s.jsx(vn,{id:"org-proposal-reject-note",value:w,rows:2,maxLength:4e3,placeholder:"Why you are rejecting it",onChange:A=>S(A.target.value)})]}):null,s.jsxs(Hx,{children:[s.jsx(Gx,{children:"Cancel"}),p==="reject"?s.jsx(P,{type:"button",variant:"destructive","aria-disabled":!R||j!==null||void 0,"aria-describedby":R?void 0:"org-proposal-reject-two-factor",onClick:()=>!R||j?void 0:void T("reject"),children:j==="reject"?"Rejecting…":"Reject proposal"}):s.jsx(P,{type:"button","aria-disabled":j!==null||void 0,onClick:()=>j?void 0:void T("withdraw"),children:j==="withdraw"?"Withdrawing…":"Withdraw"})]})]})})]})}const M6={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."},O6="Covered: someone holds a post that fills the slot. Vacant: posts fill it but nobody holds them. Uncovered: no job function fills it.",D6=4,Mg=e=>({paddingLeft:16+24*Math.min(e,D6)}),_d={covered:{label:"Covered",tone:"success"},vacant:{label:"Vacant",tone:"warning"},uncovered:{label:"Uncovered",tone:"error"}};function z6(){const e=yn().org;if(!e)throw new Error("The Org chart page rendered without the org seam.");return e}function L6({host:e="local",org:t=""}={}){const n=z6(),[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 Y=>{const A=o.current+=1;c.current&&clearTimeout(c.current);const I=await n.chart();if(A!==o.current)return;if(I.ok){i({chart:I.data,at:new Date().toISOString()}),r({state:"read"});return}const{refusal:X}=I;if(X.reason==="no_local_org"){i(null),r({state:"none",seedable:X.seedable!==!1});return}if(e==="hosted"&&(X.reason==="not_found"||X.status===404)){i(null),r({state:"missing"});return}if(X.retry&&X.reason==="store_locked"&&Y>0){const J=X.retry_after??10;r({state:"busy",retry_after:J}),c.current=setTimeout(()=>void M(Y-1),J*1e3);return}r({state:"failed",refusal:X})};return M(k)},[n,e]);u.useEffect(()=>(d(1),()=>{o.current+=1,c.current&&clearTimeout(c.current)}),[d]);const f=()=>void d(1),m=a.state==="none"||a.state==="missing"?null:l,{href:h}=Ze(),x=Qr(),j=h("/settings/account"),v=n.proposals,y=_6(v,(m==null?void 0:m.at)??null),g=!!v&&y.state!=="off",[p,b]=u.useState(null),[w,S]=u.useState(!1),[C,_]=u.useState(null),{confirm:N,confirm_dialog:O}=RS(Ci),D=u.useMemo(()=>p&&v?{draft:p,change:v.draft.change,on_draft:b}:null,[p,v]),B=Y6(n,f,(p==null?void 0:p.chart)??(m==null?void 0:m.chart)??B6,e,j,D),G=n.twoFactor,U=u.useCallback(async()=>G?G():"ok",[G]),R=!!p&&p.total>0,$=u.useRef(()=>{});$.current=()=>{v==null||v.draft.discard(),b(null)},u.useEffect(()=>{if(!R)return;let k=!0;const M=I=>{I.preventDefault()},Y=()=>{k=!1,window.removeEventListener("beforeunload",M),document.removeEventListener("click",A,!0)},A=I=>{var ee,Ce;if(!k||I.defaultPrevented||I.button!==0||I.metaKey||I.ctrlKey||I.shiftKey||I.altKey)return;const X=I.target,J=(ee=X==null?void 0:X.closest)==null?void 0:ee.call(X,"a[href]"),ae=J?null:(Ce=X==null?void 0:X.closest)==null?void 0:Ce.call(X,U6);let ke=null;if(J&&J.target!=="_blank"&&!J.hasAttribute("download")){const se=new URL(J.href,window.location.href),Se=se.pathname===window.location.pathname&&se.search===window.location.search;se.origin===window.location.origin&&!Se&&(ke=()=>window.location.assign(se.href))}else ae&&ae.getAttribute("aria-current")!=="page"&&ae.getAttribute("aria-disabled")!=="true"&&!ae.hasAttribute("disabled")&&(ke=()=>ae.click());if(!ke)return;I.preventDefault(),I.stopPropagation();const Q=ke;N({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&&(Y(),$.current(),Q())})};return window.addEventListener("beforeunload",M),document.addEventListener("click",A,!0),Y},[R,N]);const T=async()=>{if(!v)return;const k=await v.draft.begin();k.ok?b(k.data):x.error(k.refusal.message)},E=async()=>{(!(p&&p.total>0)||await N({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(),b(null))};return a.state==="missing"?s.jsx(X6,{org:t}):s.jsx(vg,{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(sn,{title:"Org chart",description:M6[e]}),a.state==="busy"&&!m?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")&&!m?s.jsx(F6,{quiet:a.state==="busy"}):null,a.state==="none"?s.jsx(K6,{edit:(B==null?void 0:B.actions)??null,seedable:a.seedable}):null,a.state==="failed"?s.jsx(Q6,{host:e,kept_at:(m==null?void 0:m.at)??null,on_retry:f}):null,m&&p?s.jsx(C6,{draft:p,on_submit:()=>S(!0),on_discard:()=>void E()}):m&&g?s.jsx(k6,{listed:y,on_propose:()=>void T(),on_open:_}):null,m?s.jsx(Z6,{chart:(p==null?void 0:p.chart)??m.chart,host:e,edit:(B==null?void 0:B.actions)??null}):null,(B==null?void 0:B.dialogs)??null,v&&p?s.jsx(T6,{open:w,draft:p,submit:v.draft.submit,on_close:()=>S(!1),on_done:(k,M)=>{if(S(!1),k.state==="moved"){b(k.draft);return}b(null),x.success(`Proposed ${M}.`),f()}}):null,v&&g?s.jsx($6,{proposal:C,contract:v,context:{host:e,two_factor:"ok",settings_href:j},check_two_factor:U,on_close:()=>_(null),on_decided:k=>{x.success(k),_(null),f()}}):null,O]})})}const U6='[data-sidebar="menu-button"]:not([aria-expanded]), [data-sidebar="menu-sub-button"]',B6={org:"",workflow:!1,teams:[],job_functions:[],slots:[],posts:[],members:[],slot_resolution:[],project:{team:null,roots:[]}};function I6(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 H6(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 P6={functions:!0,team_add:!0,team:()=>"description",post_add:!0,post:()=>!0,override:!1,slots:!0};function Cf({mark:e}){return e?e==="added"?s.jsx(fe,{variant:"success",children:"Added"}):s.jsx(fe,{variant:"warning",children:"Changed"}):null}const q6={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."},G6={mfa_challenge_required:"challenge",mfa_enrollment_required:"enroll"};function V6(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 Y6(e,t,n,a,r,l=null){const i=Qr(),o=ES(n),c=V6(e,a,n),d=l?{host:a,two_factor:"ok",settings_href:r}:a==="hosted"?{host:a,two_factor:c.state,settings_href:r}:Ci,{confirm:f,confirm_dialog:m}=RS(d),[h,x]=u.useState(null),[j,v]=u.useState({}),y=E=>v(k=>{if(!k[E])return k;const{[E]:M,...Y}=k;return Y}),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]),b=l?async E=>{const k=await l.change(E);return k.ok?(l.on_draft(k.data),{ok:!0,data:{}}):k}:e.change;if(!b||!l&&a==="hosted"&&(!n.authority||!H6(n)))return null;const w=l?P6:I6(n),S=E=>{const k=E.code?G6[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()},N=async(E,k)=>{const M=await b(E);if(!M.ok)return S(M.refusal);const Y=C(E);return Y&&y(Y),_(M.data,k),null},O=E=>{c.check(),x(E)},D=async(E,k,M,Y)=>{const A=await b(M);if(!A.ok){const I=S(A.refusal),X=A.refusal.bound,J=X?X.projects.length+X.more:0,ae=X?`${X.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.`:I.message;v(ke=>({...ke,[E]:{label:k,message:ae,...X?{bound:X}:{}}}));return}y(E),_(A.data,Y)},B=async(E,k,M)=>{const Y=E==="team"?"team":"job function";c.check(),(l||await f({title:`Remove ${Y} ${M}?`,description:q6[a],action_label:"Remove",destructive:!0,action:`remove the ${Y}`}))&&await D(E==="team"?"teams":"functions",M,{action:"remove",kind:E,key:k},`${E==="team"?"Team":"Job function"} ${M} removed.`)},G=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 D("slots",k,{action:"remove",kind:"slot",key:E.key},`Removed slot ${k}.`)},U=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 D("posts",k,{action:"remove",kind:"post",key:E},`Removed post ${k}.`)},R=async(E,k)=>{const M=o.post(E),Y=o.member(k),A=n.posts.find(ke=>ke.post===E),X=((A==null?void 0:A.holders.length)??0)<=1?A!=null&&A.escalates_to?` The post becomes vacant. Until someone holds it, its reports and the slots it fills go to ${o.manager(A.escalates_to)}.`:" The post becomes vacant.":"";if(c.check(),!await f({title:`Remove ${Y} from ${M}?`,description:`They stop holding this post and no longer report through it.${X}`,action_label:"Remove",action:"remove the holder"}))return;const ae=await b({action:"release",post:E,member:k.id});if(!ae.ok){i.error(S(ae.refusal).message),t();return}y("posts"),_(ae.data,`Removed ${Y} from ${M}.`)},$=()=>x(null),T=(h==null?void 0:h.kind)==="override"&&n.project&&n.project.team!==null?n.project.slots.find(E=>E.slot===h.slot)??null:null;return{actions:{can:w,host:a,drafting:!!l,...l?{marks:l.draft.marks}:{},team:(E,k="full")=>O({kind:"team",team:E,scope:k}),job:E=>O({kind:"function",job:E}),override:E=>O({kind:"override",slot:E}),slot:E=>O({kind:"slot",slot:E}),slot_remove:E=>void G(E),remove:(E,k,M)=>void B(E,k,M),post_add:()=>O({kind:"post"}),post_remove:E=>void U(E),holder_add:E=>O({kind:"holder",post:E}),holder_remove:(E,k)=>void R(E,k),refused:E=>{const k=j[E];return k?s.jsx(g6,{label:k.label,message:k.message,bound:k.bound,on_dismiss:()=>y(E)}):null}},dialogs:s.jsxs(s.Fragment,{children:[s.jsx(i6,{open:(h==null?void 0:h.kind)==="team",chart:n,team:(h==null?void 0:h.kind)==="team"?h.team:null,scope:(h==null?void 0:h.kind)==="team"?h.scope:"full",parents:!l&&n.authority?n.authority.teams:void 0,save:N,on_close:$,context:d}),s.jsx(c6,{open:(h==null?void 0:h.kind)==="function",chart:n,job:(h==null?void 0:h.kind)==="function"?h.job:null,save:N,on_close:$,context:d}),s.jsx(h6,{open:T!==null,chart:n,binding:T,names:o,save:N,confirm:E=>f({...E,action:"clear the override"}),on_close:$}),s.jsx(f6,{open:(h==null?void 0:h.kind)==="slot",chart:n,slot:(h==null?void 0:h.kind)==="slot"?h.slot:null,save:N,on_close:$,context:d}),s.jsx(p6,{open:(h==null?void 0:h.kind)==="post",chart:n,names:o,save:N,on_close:$,context:d}),s.jsx(x6,{open:(h==null?void 0:h.kind)==="holder",chart:n,post:(h==null?void 0:h.kind)==="holder"?h.post:null,names:o,members:p,save:N,on_close:$,context:d}),m]})}}function F6({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(Ct,{className:n===3?"h-10 w-2/3":"h-10 w-full"},n))})}function Yl({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 K6({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(oe,{variant:"info",className:"mt-6",children:[s.jsx(gn,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:"This repository has no local org yet"}),s.jsxs(ce,{children:[s.jsx("p",{children:n}),t||!e?s.jsxs("div",{className:"mt-2 grid w-full gap-2",children:[t?s.jsx(Yl,{children:"sdlc org seed"}):null,e?null:s.jsx(Yl,{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(rr,{className:"size-4","aria-hidden":"true"}),"Add team"]}):null]})]})}function X6({org:e}){const{href:t,Link:n}=Ze();return s.jsx(fr,{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 W6(e){return new Date(e).toDateString()===new Date().toDateString()?`today at ${As(e)}`:`on ${gs(e)} at ${As(e)}`}function Q6({host:e,kept_at:t,on_retry:n}){const a=t?`The chart read ${W6(t)} is kept below. `:"";return s.jsxs(oe,{variant:"destructive",className:"mt-6",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:e==="hosted"?"Could not read the org chart":"Could not read the local org"}),s.jsxs(ce,{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 ES(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}},m=y=>{const{team:g,job:p}=f(y);return`${p} · ${g}`},h=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?`${m(y)} (${g.join(", ")})`:m(y)},x=new Map(e.teams.map(y=>[y.key,y.parent])),j=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:m,member:d,memberLabel:l,memberDetail:c,manager:h,byPost:(y,g)=>{const[p="",b=""]=[y.split("/")[0],g.split("/")[0]],[w,S]=[f(y),f(g)];return j(p)-j(b)||w.team.localeCompare(S.team)||w.job.localeCompare(S.job)},slot:y=>a.get(y)??y,job:y=>n.get(y)??y,team:y=>t.get(y)??y}},[e])}function kr({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 eo({children:e,on_click:t}){return s.jsxs(P,{type:"button",variant:"outline",size:"sm",onClick:t,children:[s.jsx(rr,{className:"size-4","aria-hidden":"true"}),e]})}const vy={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 Z6({chart:e,host:t,edit:n}){const a=ES(e),r=e.members.some(l=>l.kind==="agent");return s.jsxs(s.Fragment,{children:[s.jsxs(kr,{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(eo,{on_click:n.post_add,children:"Add post"}):void 0,children:[n==null?void 0:n.refused("posts"),s.jsx(t5,{chart:e,names:a,agents:r,host:t,edit:n})]}),s.jsx(kr,{id:"org-chart-members",title:"Members",description:r?`${vy[t]} Each agent answers to the nearest person in its reporting chain.`:vy[t],children:s.jsx(l5,{chart:e,names:a,host:t,agents:r})}),n?s.jsxs(kr,{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(eo,{on_click:()=>n.team(null),children:"Add team"}):void 0,children:[n.refused("teams"),s.jsx(J6,{chart:e,edit:n})]}):null,s.jsxs("div",{className:"grid items-start gap-x-6 xl:grid-cols-2",children:[s.jsxs(kr,{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(eo,{on_click:()=>n.job(null),children:"Add job function"}):void 0,children:[n!=null&&n.can.functions?n.refused("functions"):null,s.jsx(i5,{chart:e,names:a,edit:n!=null&&n.can.functions?n:null})]}),s.jsxs(kr,{id:"org-chart-slots",anchor:"slots",title:"Slots",description:O6,actions:n!=null&&n.can.slots&&e.slot_resolution.length>0?s.jsx(eo,{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(c5,{chart:e,names:a,host:t,edit:n!=null&&n.can.slots?n:null})]})]}),e.project?s.jsx(d5,{project:e.project,chart:e,names:a,edit:n!=null&&n.can.override?n:null}):null]})}function J6({chart:e,edit:t}){var c;const n=Og([...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 m=t.can.team(d.key);return m==="full"?s.jsx(Vl,{label:f,on_edit:()=>t.team(d),on_remove:()=>t.remove("team",d.key,f)}):m==="root"?s.jsx(Vl,{label:f,on_edit:()=>t.team(d,"description")}):m==="description"&&t.drafting?s.jsx(Vl,{label:f,items:[{label:"Edit description",on_select:()=>t.team(d,"description")}]}):m==="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(Wd,{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:m,children:h})=>{var j;const x=m.label||m.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:Mg(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(Cf,{mark:(j=t.marks)==null?void 0:j.teams[m.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:m.key}),a===m.key?s.jsx(fe,{variant:"neutral",children:"Owns this project"}):null,l(m,x)]})]}),h.length>0?i(h,f+1):null]},m.key)})}),o=r&&e.teams.length===1;return s.jsxs(s.Fragment,{children:[s.jsx(mt,{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 Og(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 e5={local:"No posts yet.",hosted:"No posts yet. An org admin can add them."};function t5({chart:e,names:t,agents:n,host:a,edit:r}){const l=Og([...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.":e5[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:m})=>{var v;const{team:h}=t.parts(f.post),x=typeof f.reports_to=="object"?f.reports_to:null,j=!!(r!=null&&r.can.post(f.post));return s.jsxs("li",{children:[s.jsxs("div",{className:"border-b py-2 pr-4",style:Mg(d),"data-testid":"org-chart-post",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx($T,{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?`${h} · Reports to a vacant ${t.job(x.vacant)}`:h}),s.jsx(Cf,{mark:(v=r==null?void 0:r.marks)==null?void 0:v.posts[f.post]}),j&&r?s.jsx("span",{className:"ml-auto",children:s.jsx(Vl,{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(fe,{variant:_d.vacant.tone,children:_d.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(a5,{holder:y,post:f.post,member:i.get(`${y.kind}:${y.id}`),names:t,agents:n,host:a,on_remove:j&&r&&!r.drafting?()=>r.holder_remove(f.post,y):void 0},`${y.kind}:${y.id}`))})]}),m.length>0?o(m,d+1):null]},f.post)})});return s.jsx(mt,{className:"overflow-hidden",children:o(l,0)})}function n5(e){return new Date(e).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"})}function s5(e){if(!e.held_since)return null;const t=n5(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 a5({holder:e,post:t,member:n,names:a,agents:r,host:l,on_remove:i}){const o=e.kind==="person"?Tx:Cx,c=n==null?void 0:n.posts.find(j=>j.post===t),d=n==null?void 0:n.posts.find(j=>j.primary),f=a.memberDetail(e);let m=null;c!=null&&c.dotted&&d?m=`Dotted line: primary manager is ${a.manager(d.reports_to)}`:e.kind==="agent"&&n&&"accountable_person"in n&&(m=n.accountable_person?`Accountable person ${a.member(n.accountable_person)}`:"No accountable person");const h=l==="hosted"?s5(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(jg,{children:[s.jsx(yg,{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(Zd,{className:"size-3.5","aria-hidden":"true"})})}),s.jsxs(Nf,{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]}),m?s.jsx("div",{className:"pl-5.5 text-xs",children:m}):null,h?s.jsx("div",{className:"text-muted-foreground pl-5.5 text-xs",children:h}):null]})}const r5=["sdlc org hold <team>/<function> --person <id>","sdlc org hold <team>/<function> --agent <id>"];function l5({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:"}),r5.map(l=>s.jsx(Yl,{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(mt,{className:"overflow-x-auto",children:s.jsxs(Fe,{containerAriaLabel:"Members",children:[s.jsx(Qe,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Member"}),s.jsx(F,{children:"Posts"}),s.jsx(F,{children:"Primary manager"}),s.jsx(F,{children:"Dotted lines"}),a?s.jsx(F,{children:"Accountable person"}):null]})}),s.jsx(Ke,{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(q,{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(q,{children:l.posts.map(d=>t.post(d.post)).join(", ")}),s.jsx(q,{children:i?t.manager(i.reports_to):"None"}),s.jsx(q,{children:o.length?o.map(d=>t.manager(d.reports_to)).join(", "):"None"}),a?s.jsx(q,{children:l.kind==="person"?"Not an agent":l.accountable_person?t.member(l.accountable_person):"None"}):null]},`${l.kind}:${l.id}`)})})]})})}function i5({chart:e,names:t,edit:n}){const a=Og([...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:Mg(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(Cf,{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(fe,{variant:"neutral",children:"Requires a person"}):null,n?s.jsx(Vl,{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(mt,{className:"overflow-hidden",children:r(a,0)})}function o5(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 Nd={covered:0,vacant:1,uncovered:2};function AS(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 c5({chart:e,names:t,host:n,edit:a}){var i;const r=AS(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(mt,{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(eo,{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(mt,{className:"overflow-x-auto",children:s.jsxs(Fe,{containerAriaLabel:"Slots",children:[s.jsx(Qe,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Slot"}),s.jsx(F,{children:"Status"}),s.jsx(F,{children:"Resolves to"}),a?s.jsx(F,{className:"text-right",children:s.jsx("span",{className:"sr-only",children:"Actions"})}):null]})}),s.jsxs(Ke,{children:[[...e.slot_resolution].sort((o,c)=>Nd[o.status]-Nd[c.status]||t.slot(o.slot).localeCompare(t.slot(c.slot))).map(o=>{var d,f,m;const c=_d[o.status];return s.jsxs(ue,{"data-testid":"org-chart-slot",children:[s.jsxs(q,{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(Cf,{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:(m=l.get(o.slot))==null?void 0:m.description}):null]}):null,r.has(o.slot)?s.jsx("div",{className:"text-muted-foreground text-xs",children:r.get(o.slot)}):null]}),s.jsx(q,{children:s.jsx(fe,{variant:c.tone,children:c.label})}),s.jsxs(q,{children:[o5(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(q,{className:"text-right",children:s.jsx(Vl,{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(q,{colSpan:3,className:"text-muted-foreground h-24 text-center",children:"This org has no slots yet."})}):null]})]})})}const u5="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.",qh=["sdlc org own <team>","sdlc org bind <slot> <team>/<function>... --reason <text>","sdlc org unbind <slot>"];function d5({project:e,chart:t,names:n,edit:a}){if(e.team===null){const i=e.roots.map(n.team);return s.jsx(kr,{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(Yl,{children:i.length?qh[0]:"sdlc org add team <key>"})})})}const r=AS(t),l=[...e.slots].sort((i,o)=>Nd[i.status]-Nd[o.status]||n.slot(i.slot).localeCompare(n.slot(o.slot)));return s.jsxs(kr,{id:"org-chart-project",title:"This project",description:u5,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(mt,{className:"mt-3 overflow-x-auto",children:s.jsxs(Fe,{containerAriaLabel:"Slots in this project",children:[s.jsx(Qe,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Slot"}),s.jsx(F,{children:"Status"}),s.jsx(F,{children:"Bound to"}),s.jsx(F,{children:"Source"}),a?s.jsx(F,{className:"text-right",children:s.jsx("span",{className:"sr-only",children:"Actions"})}):null]})}),s.jsxs(Ke,{children:[l.map(i=>{const o=_d[i.status];return s.jsxs(ue,{"data-testid":"org-chart-project-slot",children:[s.jsxs(q,{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(q,{children:s.jsx(fe,{variant:o.tone,children:o.label})}),s.jsx(q,{children:s.jsx(f5,{binding:i,names:n})}),s.jsx(q,{children:s.jsx(h5,{binding:i})}),a?s.jsx(q,{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(Wd,{className:"size-3.5","aria-hidden":"true"})})}):null]},i.slot)}),l.length===0?s.jsx(ue,{children:s.jsx(q,{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(Yl,{children:qh[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:"}),qh.map(i=>s.jsx(Yl,{children:i},i))]})]})}function f5({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 h5({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?gs(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 m5={breaking:"Breaking",new:"New",improved:"Improved",other:"Other changes"},p5=["breaking","new","improved","other"],x5={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 $S(e){return x5[e]??e.replace(/_/g," ")}function g5(e){return e.bump==="major"?"breaking":e.change==="added"?"new":e.change==="changed"?"improved":"other"}function Vo(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=g5(l);t.set(i,[...t.get(i)??[],l])}return{sections:p5.filter(l=>t.has(l)).map(l=>({key:l,label:m5[l],lines:t.get(l)})),breaking:t.has("breaking"),unlisted_count:n,modeling_only_count:a}}function v5(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} (${$S(r.node_type)})${l}`)}}return`${n.join(`
|
|
404
|
+
`)}
|
|
405
|
+
`}const zs="candidate";function Dg(e){return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}const j5="Versioned records of this project's release branch, with notes from its graph changes.";function MS({description:e=j5,actions:t}){return s.jsx(sn,{title:"Releases",description:e,actions:t})}function OS(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 ku({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:de("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 ms({children:e}){return s.jsx("section",{className:"border-border flex flex-col gap-4 rounded-xl border p-4",children:e})}function ts({title:e,error:t,onRetry:n}){const a=X1();return s.jsxs(oe,{variant:"destructive",ref:a,children:[s.jsx(Ut,{}),e?s.jsx(ge,{children:e}):null,s.jsxs(ce,{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 y5({title:e,text:t}){return s.jsx(ms,{children:s.jsxs("div",{className:"flex flex-col items-center gap-2 py-10 text-center",children:[s.jsx(Xd,{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 b5(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 kd({changes:e}){const t=u.useMemo(()=>Vo(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(jy,{line:o},`${o.node_id}:${o.change}`))});return l.key==="breaking"?s.jsxs(oe,{variant:"destructive",className:"border-destructive/40",children:[s.jsx(Ut,{}),s.jsx(ge,{children:s.jsx("h3",{className:"text-destructive text-sm font-semibold",children:l.label})}),s.jsx(ce,{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(jy,{line:l,detail:!0},`all:${l.node_id}:${l.change}:${l.modeling_only}`))}):null]})}function jy({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(fe,{variant:"outline",children:$S(e.node_type)})]}),n?s.jsx("span",{className:"text-muted-foreground text-xs",children:n}):null]})}const w5={ok:"success",alert:"error",you:"warning",neutral:"neutral"},_5={ok:"bg-success",alert:"bg-destructive",you:"bg-warning",neutral:"bg-muted-foreground"},N5={ok:"text-success",alert:"text-destructive",you:"text-warning",neutral:""},eu="None in this release",DS="Not computed yet",Mr=({chip:e})=>s.jsx(fe,{variant:w5[e.tone],children:e.label});function zS({parts:e,className:t}){return s.jsx("div",{"aria-hidden":!0,className:`bg-muted flex gap-0.5 overflow-hidden rounded-full ${t??"h-1.5 w-40"}`,children:e.map((n,a)=>s.jsx("span",{className:n.tone==="primary"?"bg-primary":_5[n.tone],style:e.length===1?{width:`${Math.round(n.share*100)}%`}:{flexGrow:n.share}},a))})}function Rf({title:e,count:t,children:n,heading_ref:a}){const r=`this-release-${e.toLowerCase().replace(/\s+/g,"-")}`;return s.jsxs("section",{className:"flex flex-col gap-2","aria-labelledby":r,children:[s.jsxs("div",{className:"flex items-baseline gap-2",children:[s.jsx("h2",{id:r,ref:a,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]}),n]})}const Ua=({title:e})=>s.jsx("h3",{className:"mt-2 text-sm font-semibold",children:e}),Ol=({children:e})=>s.jsx("p",{className:"text-muted-foreground text-sm",children:e}),Or=({children:e})=>s.jsx("p",{className:"text-muted-foreground text-xs",children:e});function Tf({items:e,shown:t,what:n,children:a}){const[r,l]=u.useState(!1),i=t>0?t:e.length,o=e.length>i;return s.jsxs(s.Fragment,{children:[a(r||!o?e:e.slice(0,i)),o?s.jsx(P,{variant:"link",size:"sm",className:"self-start px-0","aria-expanded":r,"aria-label":r?`Show fewer ${n}`:`Show all ${e.length} ${n}`,onClick:()=>l(c=>!c),children:r?"Show fewer":`Show all ${e.length}`}):null]})}function yy({counted:e,what:t}){return s.jsx(Tf,{items:e.rows,shown:e.shown,what:t,children:n=>s.jsx("ul",{className:"flex flex-col gap-2",children:n.map((a,r)=>s.jsxs("li",{className:"flex flex-wrap items-center gap-3 text-sm",children:[s.jsx("code",{className:"w-48 truncate font-mono text-xs",title:a.name,children:a.name}),s.jsx("span",{className:"w-24 text-right tabular-nums",children:a.text}),s.jsx(zS,{parts:[{tone:"primary",share:a.share}]})]},`${a.name}:${r}`))})})}function k5({view:e,heading_ref:t}){const n=e.readiness;return s.jsxs(Rf,{title:"Readiness",heading_ref:t,children:[e.alert?s.jsxs(oe,{variant:e.alert.tone==="alert"?"destructive":"default",role:e.alert.tone==="alert"?"alert":"status",children:[s.jsx(Ut,{}),s.jsx(ge,{children:e.alert.title}),e.alert.text?s.jsx(ce,{children:e.alert.text}):null]}):null,n.computed?s.jsxs(s.Fragment,{children:[n.contract?s.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[n.accepted_note?s.jsx(Mr,{chip:n.accepted_note}):null,s.jsx(S5,{line:n.contract,verdict:n.verdict.label})]}):s.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[s.jsx(Mr,{chip:n.verdict}),n.accepted_note?s.jsx(Mr,{chip:n.accepted_note}):null,s.jsx("span",{children:n.detail})]}),n.gaps.map((a,r)=>s.jsx("p",{className:"text-sm",children:a},`${a}:${r}`)),n.errors.map((a,r)=>s.jsx("p",{className:"text-sm",children:a},`${a}:${r}`)),n.note?s.jsx(Or,{children:n.note}):null]}):s.jsx("p",{className:"text-sm",children:n.text})]})}function S5({line:e,verdict:t}){const n=`Environment verification says ${t}`;return e.startsWith(n)?s.jsxs("span",{children:["Environment verification says ",s.jsx("span",{className:"font-medium",children:t}),e.slice(n.length)]}):s.jsx("span",{children:e})}function C5({figures:e}){return e.length===0?null:s.jsx("dl",{className:"flex flex-wrap gap-6",children:e.map(t=>s.jsxs("div",{className:"flex min-w-28 flex-col-reverse",children:[s.jsx("dt",{className:"text-muted-foreground text-xs",children:t.label}),s.jsx("dd",{className:"text-2xl font-semibold tabular-nums",children:t.value})]},t.label))})}function R5({view:e,version:t}){const n=e.obligations,a=e.landings;return s.jsxs(Rf,{title:"Test completeness",children:[s.jsx(Ua,{title:"Obligations"}),n?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-sm",children:n.summary}),n.segments.length>0?s.jsxs(s.Fragment,{children:[s.jsx(zS,{className:"h-2 w-full max-w-xl",parts:n.segments.map(r=>({tone:r.tone,share:r.count}))}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:n.segments.map(r=>s.jsx(Mr,{chip:{label:r.label,tone:r.tone}},r.label))})]}):null,n.open.length>0?s.jsxs(s.Fragment,{children:[s.jsx(Ua,{title:"Tests not yet satisfied"}),s.jsx(Tf,{items:n.open,shown:n.shown,what:"tests not yet satisfied",children:r=>s.jsx("ul",{className:"flex flex-col",children:r.map((l,i)=>s.jsxs("li",{className:"flex flex-col gap-0.5 border-b py-1.5",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[s.jsx(Mr,{chip:l.chip}),s.jsx("span",{children:l.name}),l.kind?s.jsx("span",{className:"text-muted-foreground text-xs",children:l.kind}):null]}),l.locator?s.jsx("code",{className:"font-mono text-xs",children:l.locator}):null,l.why?s.jsx(Or,{children:l.why}):null,l.accepted?s.jsxs("p",{className:"text-muted-foreground text-xs",children:["Accepted by ",s.jsx("strong",{className:"text-foreground font-semibold",children:l.accepted.by})," for the next release",t?s.jsxs(s.Fragment,{children:[" ","(",s.jsx("code",{className:"font-mono",children:t}),")"]}):null,": ",l.accepted.reason]}):null]},`${l.name}:${i}`))})})]}):null]}):s.jsx(Or,{children:DS}),s.jsx(Ua,{title:"Landings"}),s.jsx("p",{className:`text-sm ${a.chips.length===0&&!a.headline?"text-muted-foreground":""}`,children:a.summary}),a.chips.length>0?s.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.chips.map(r=>s.jsx(Mr,{chip:r},r.label))}):null,a.headline?s.jsx("p",{className:`text-sm ${N5[a.headline.tone]}`,children:a.headline.text}):null,a.orphans?s.jsx(Or,{children:a.orphans}):null]})}function T5({view:e}){const t=e.impact;return s.jsxs(Rf,{title:"Impact",children:[s.jsx(Ua,{title:"Files by area"}),t.areas.rows.length===0?s.jsx(Ol,{children:eu}):s.jsx(yy,{counted:t.areas,what:"areas"}),s.jsx(Ua,{title:"In the graph"}),t.graph?s.jsxs(s.Fragment,{children:[t.graph.features.length>0?s.jsx(Tf,{items:t.graph.features,shown:t.graph.shown,what:"features",children:n=>s.jsx("ul",{className:"list-disc pl-5 text-sm",children:n.map((a,r)=>s.jsx("li",{children:a},`${a}:${r}`))})}):null,s.jsx("p",{className:"text-sm",children:t.graph.counts}),t.graph.coverage?s.jsx(Or,{children:t.graph.coverage}):null]}):s.jsx(Or,{children:DS}),s.jsx(Ua,{title:"Migrations"}),t.migrations?s.jsx(yy,{counted:t.migrations,what:"days"}):s.jsx(Ol,{children:eu}),s.jsx(Ua,{title:"Drop or truncate"}),t.drops.length===0?s.jsx(Ol,{children:eu}):s.jsx("ul",{className:"flex flex-col gap-1",children:t.drops.map(n=>s.jsxs("li",{className:"flex items-center gap-1.5",children:[s.jsx(Ut,{className:"text-warning size-4 shrink-0","aria-hidden":!0}),s.jsx("code",{className:"font-mono text-xs break-all",children:n})]},n))}),s.jsx(Ua,{title:"Feature flags added"}),t.flags.length===0?s.jsx(Ol,{children:eu}):s.jsx("ul",{className:"flex flex-col gap-1",children:t.flags.map(n=>s.jsx("li",{children:s.jsx("code",{className:"font-mono text-xs",children:n})},n))})]})}function E5({view:e}){const t=e.threads.rows;return s.jsxs(Rf,{title:"Threads",count:t.length,children:[t.length===0?s.jsx(Ol,{children:"None in this release"}):s.jsx(Tf,{items:t,shown:e.threads.shown,what:"threads",children:n=>s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(Fe,{containerAriaLabel:"Threads in this release",children:[s.jsx(Qe,{children:s.jsxs(ue,{children:[s.jsx(F,{scope:"col",children:"Thread"}),s.jsx(F,{scope:"col",className:"text-right",children:"Landings"}),s.jsx(F,{scope:"col",children:"Staging evidence"}),s.jsx(F,{scope:"col",children:"Local checks"})]})}),s.jsx(Ke,{children:n.map(a=>s.jsxs(ue,{children:[s.jsx(q,{className:"max-w-md truncate",title:a.thread,children:a.thread}),s.jsx(q,{className:"text-right tabular-nums",children:a.landings}),s.jsx(q,{children:s.jsx(Mr,{chip:a.staging})}),s.jsx(q,{children:a.local})]},a.thread))})]})})}),s.jsx(Or,{children:"Thread names come from their objectives; plans open in the VS Code Release tab."})]})}function A5({read:e,version:t,onRetry:n,notAvailable:a}){const r=u.useRef(null),l=u.useRef(null),i=u.useRef(!1);if(u.useEffect(()=>{var d;!i.current||e.state==="reading"||(i.current=!1,(d=r.current??l.current)==null||d.focus())},[e]),e.state==="reading")return s.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status",children:[s.jsx(dn,{"aria-hidden":!0})," Reading what this release ships…"]});const o=d=>s.jsx("div",{ref:l,tabIndex:-1,className:"outline-none",children:d});if(e.state==="failed")return o(s.jsx(ts,{title:"This release could not be read",error:e.error,onRetry:()=>{i.current=!0,n()}}));if(e.state==="outdated")return o(a);if(e.state==="unassembled")return o(s.jsxs(oe,{variant:"destructive",children:[s.jsx(Ut,{}),s.jsx(ge,{children:"This release could not be worked out"}),s.jsx(ce,{children:"The local records did not assemble into a release view."})]}));const c=e.view;return c.state==="empty"?o(s.jsx(Ol,{children:c.empty})):c.state!=="ready"?null:s.jsxs(s.Fragment,{children:[s.jsx(k5,{view:c,heading_ref:r}),s.jsx(C5,{figures:c.figures}),s.jsx(R5,{view:c,version:t}),s.jsx(T5,{view:c}),s.jsx(E5,{view:c})]})}const LS="Releases of this checkout: the roadmap of open Planned Releases, the next candidate, and each production release with its notes.",Ef=u.createContext(0);function Yo(e,t){const n=u.useRef(e),a=u.useRef(t);u.useEffect(()=>{a.current=t}),u.useEffect(()=>{n.current!==e&&(n.current=e,a.current())},[e])}const by=e=>(e==null?void 0:e.status)===404||(e==null?void 0:e.reason)==="not_found",wy=5,bp="Not available",wp="planned:";function zg(){const e=as();return s.jsx("p",{className:"text-muted-foreground text-sm",children:`${bp}. ${e}`})}const Rs=e=>`${wp}${e}`,$5=e=>e!=null&&e.startsWith(wp)?e.slice(wp.length):null,Lg=e=>e?e.slice(0,7):"";function M5(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 O5(){return s.jsxs(oe,{variant:"info",children:[s.jsx(gn,{}),s.jsx(ge,{children:"This page only reads Releases"}),s.jsx(ce,{className:"text-info",children:"A Release is written when production runs a release candidate, once its commit is merged into origin/main."})]})}function D5(e){if(e.state==="unreadable")return{badges:s.jsx(fe,{variant:"error",children:"Could not be read"}),caption:""};if(e.state==="withdrawn")return{badges:s.jsx(fe,{variant:"warning",children:"Withdrawn"}),caption:e.replaced_by?`Replaced by ${e.replaced_by}`:"Withdrawn"};const t=s.jsxs(s.Fragment,{children:[s.jsx(fe,{variant:"neutral",children:e.app_changed===!1?"App unchanged":e.previous_release_id?e.bump??"patch":"First"}),e.breaking?s.jsx(fe,{variant:"error",children:"Breaking"}):null]}),n=e.written_at?Dg(e.written_at):"",a=e.tracks&&e.tracks.length>0?` · ${e.tracks.join(", ")}`:"";return{badges:t,caption:`${n}${a}`}}function Dr({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 Af({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 Fs=({children:e})=>s.jsx("code",{className:"font-mono text-xs",children:e});function US(e,t){if(e.judged_commit&&t&&e.judged_commit!==t)return`Judged ${Lg(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 $f({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 z5={ready:"success",verifying:"info",fixing:"warning",abandoned:"warning",ready_older:"neutral",none:"neutral",unknown:"neutral"};function L5({batch:e}){if(e.state==="loading")return s.jsxs(oe,{children:[s.jsx(ld,{}),s.jsxs(ce,{className:"flex flex-row items-center gap-2",role:"status",children:[s.jsx(dn,{"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(oe,{children:[s.jsx(ld,{}),s.jsxs(ge,{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{children:t.text}),s.jsx(fe,{variant:z5[t.state],children:t.chip})]}),t.help?s.jsx(ce,{children:t.help}):null]})}const U5="The release batch could not be read. The sdlc viewer log says why.",B5="What this release ships could not be read: git could not compare staging with production.",_y=e=>{var t;return e.read_failed===!0||((t=e.this_release)==null?void 0:t.state)==="loading"};function I5(e,t,n){return`/org/${e}/issues/${encodeURIComponent(t)}?from=${encodeURIComponent(n)}`}function BS({issues:e,error:t}){return t?s.jsx(ts,{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($f,{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(Fs,{children:n.file}):null]},n.key))})]})}function IS({tracks:e,error:t}){return t?s.jsx(ts,{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($f,{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(Fs,{children:n.version}):null,n.bump?s.jsx(fe,{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(Fs,{children:a.name}),s.jsxs(Fs,{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 HS({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($f,{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(Fe,{containerAriaLabel:"Planned Releases",children:[s.jsx(Qe,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Planned Release"}),s.jsx(F,{children:"Delivered"}),s.jsx(F,{children:"Not delivered"})]})}),s.jsx(Ke,{children:e.planned.map(r=>s.jsxs(ue,{children:[s.jsx(q,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[r.open&&t?s.jsx(Dr,{query:`planned=${encodeURIComponent(r.id)}`,select:Rs(r.id),onSelect:n,children:r.name}):s.jsx("span",{children:r.name}),s.jsx(Fs,{children:r.id})]})}),s.jsx(q,{children:a(r.delivered)}),s.jsx(q,{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 H5={thread:"Thread",task:"Task",issue:"Issue",test:"Test"};function PS({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,wy),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(I5(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(Fe,{containerAriaLabel:"Related",children:[s.jsx(Qe,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Kind"}),s.jsx(F,{children:"Item"}),s.jsx(F,{children:"How it relates"})]})}),s.jsx(Ke,{children:c.map(f=>s.jsxs(ue,{children:[s.jsx(q,{children:H5[f.kind]}),s.jsx(q,{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(q,{children:f.relation})]},`${f.kind}:${f.id}`))})]})}),e.length>wy?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 qS=e=>(e==null?void 0:e.status)===409&&e.reason==="view_outdated";function GS(e){const t=Ug(),[n,a]=u.useState(t!=null&&t.related?{state:"loading"}:null),r=u.useRef(0),l=vs(),i=u.useCallback(async(o=!1,c=!1)=>{if(!(t!=null&&t.related)||c&&l.busy())return;const d=++r.current;c||a({state:"loading"});const f=await l.track(t.related(e,o?{fresh:!0}:void 0));d===r.current&&a(m=>f.ok?{state:"ready",value:f.data}:c&&(m==null?void 0:m.state)==="ready"?m:{state:"error",error:f.refusal.message,refusal:f.refusal})},[t,e,l]);return u.useEffect(()=>{i()},[i]),Yo(u.useContext(Ef),()=>void i(!1,!0)),{related:n,read:i}}function VS({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(Ct,{className:"h-8 w-full"}),s.jsx(Ct,{className:"h-8 w-full"}),s.jsx(Ct,{className:"h-8 w-2/3"})]}):e.state==="error"?qS(e.refusal)?s.jsx(zg,{}):s.jsx(ts,{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(PS,{rows:e.value.rows,org:t,from:n,untasked:e.value.untasked})]})}function P5(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 YS({planned:e,onSelect:t}){return e?e.open?s.jsx(Dr,{query:`planned=${encodeURIComponent(e.id)}`,select:Rs(e.id),onSelect:t,children:e.name}):s.jsxs("span",{children:[e.name," ",s.jsx(Fs,{children:e.id})]}):null}function q5({candidate:e,org:t,onSelect:n,notes:a}){const r=Ug(),{related:l,read:i}=GS("candidate"),[o,c]=u.useState(r!=null&&r.candidateBatch?{state:"loading"}:null),d=u.useRef(0),f=vs(),m=u.useCallback(async(y,g=!1)=>{if(!(r!=null&&r.candidateBatch)||y&&f.busy())return;const p=++d.current;y||c({state:"loading"});const b=await f.track(r.candidateBatch(g?{fresh:!0}:void 0));p===d.current&&(b.ok?_y(b.data)?c(w=>y&&(w==null?void 0:w.state)==="ready"&&!_y(w.value)?w:{state:"ready",value:b.data}):c({state:"ready",value:b.data}):c(w=>y&&(w==null?void 0:w.state)==="ready"?w:{state:"error",error:b.refusal.message}))},[r,f]),h=o===null||o.state!=="ready"?o:o.value.batch===null?null:{state:"ready",value:o.value.batch},x=o===null?null:o.state==="loading"?{state:"reading"}:o.state==="error"?{state:"failed",error:o.error}:o.value.read_failed?{state:"failed",error:U5}:!("this_release"in o.value)||o.value.this_release===void 0?{state:"outdated"}:o.value.this_release===null?{state:"unassembled"}:o.value.this_release.state==="loading"?{state:"failed",error:B5}:{state:"answered",view:o.value.this_release};u.useEffect(()=>(m(!1),()=>{d.current+=1}),[m]),Yo(u.useContext(Ef),()=>void m(!0));const j=e.readiness??((l==null?void 0:l.state)==="ready"?l.value.readiness:null)??null,v=(x==null?void 0:x.state)==="answered"&&x.view.state==="ready";return s.jsxs(s.Fragment,{children:[s.jsx(Af,{pairs:[["Environment",e.environment??"staging"],["Commit",s.jsx(Fs,{children:Lg(e.head_commit_id)},"commit")],["Readiness",j&&!v?US(j,e.head_commit_id):null],["Planned",e.planned_release?s.jsx(YS,{planned:e.planned_release,onSelect:n}):null]]}),h?s.jsx(L5,{batch:h}):null,x?s.jsx(A5,{read:x,version:e.version,onRetry:()=>m(!1,!0),notAvailable:s.jsx(zg,{})}):null,a,s.jsx(BS,{issues:e.known_issues,error:e.known_issues_error}),s.jsx(IS,{tracks:e.tracks,error:e.tracks_error}),s.jsx(HS,{delivery:e.planned_delivery,candidate:!0,onSelect:n}),s.jsx(VS,{related:l,org:t,from:"release:candidate",onRetry:()=>i(!0)})]})}function G5({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(fe,{variant:"warning",children:"Withdrawn"}):s.jsx(fe,{variant:"neutral",children:e.app_changed===!1?"App unchanged":a?"First":e.bump}),e.breaking?s.jsx(fe,{variant:"error",children:"Breaking"}):null]}),e.state==="withdrawn"&&e.replaced_by?s.jsxs("p",{className:"text-sm",children:["Replaced by"," ",s.jsx(Dr,{query:`release=${encodeURIComponent(e.replaced_by)}`,select:e.replaced_by,onSelect:t,inline:!0,children:e.replaced_by})]}):null]})}function V5({release:e,org:t,onSelect:n,notes:a}){const r=e.label??e.version,{related:l,read:i}=GS(r),o=(l==null?void 0:l.state)==="ready"?P5(l.value.previews):null;return s.jsxs(s.Fragment,{children:[s.jsx(Af,{pairs:[["Environment",e.environment??"production"],["Commit",e.commit?s.jsx(Fs,{children:Lg(e.commit)},"commit"):null],["Readiness",e.readiness?`${US(e.readiness)} on staging`:null],["Previews",o],["Planned",e.planned_release?s.jsx(YS,{planned:e.planned_release,onSelect:n}):null]]}),a,s.jsx(BS,{issues:e.known_issues,error:e.known_issues_error}),s.jsx(IS,{tracks:e.tracks,error:e.tracks_error}),s.jsx(HS,{delivery:e.planned_delivery,candidate:!1,onSelect:n}),s.jsx(VS,{related:l,org:t,from:`release:${r}`,onRetry:()=>i(!0)})]})}function Y5({id:e,summary:t,org:n,onNotFound:a,forecast:r}){const l=Ug(),[i,o]=u.useState({state:"loading"}),c=u.useRef(0),d=vs(),f=u.useCallback(async(j=!1,v=!1)=>{if(v&&d.busy())return;const y=++c.current;if(!(l!=null&&l.plannedRelease)){o({state:"error",error:bp,refusal:{status:409,message:bp,reason:"view_outdated"}});return}v||o({state:"loading"});const g=await d.track(l.plannedRelease(e,j?{fresh:!0}:void 0));y===c.current&&o(p=>g.ok?{state:"ready",value:g.data}:v&&p.state==="ready"&&!by(g.refusal)?p:{state:"error",error:g.refusal.message,refusal:g.refusal})},[l,e,d]);u.useEffect(()=>{f()},[f]),Yo(u.useContext(Ef),()=>void f(!1,!0));const m=i.state==="error"&&by(i.refusal);if(u.useEffect(()=>{m&&a()},[m,a]),i.state==="loading")return s.jsxs(ms,{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(fe,{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(ms,{children:[s.jsx("h2",{className:"text-lg font-semibold",children:(t==null?void 0:t.name)??e}),qS(i.refusal)?s.jsx(zg,{}):m?null:s.jsx(ts,{error:i.error,onRetry:()=>void f(!0)})]});const h=i.value,x=h.order===null?null:h.order===1?`Next of ${h.open} open`:`${h.order} of ${h.open} open`;return s.jsxs(ms,{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(fe,{variant:"neutral",children:"Planned"})]}),h.goal?s.jsx("p",{className:"text-muted-foreground text-sm",children:h.goal}):null]}),s.jsx(Af,{pairs:[["Planned Release",s.jsx(Fs,{children:h.id},"id")],["Date",h.date],["Order",x],["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($f,{title:"Members",count:h.members.length}),h.members.length>0?s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(Fe,{containerAriaLabel:"Members",children:[s.jsx(Qe,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Member"}),s.jsx(F,{children:"Level"}),s.jsx(F,{children:"Tasks"}),s.jsx(F,{children:"State"})]})}),s.jsx(Ke,{children:h.members.map(j=>{const v=j.tasks.filter(g=>g.state==="done").length,y=j.tasks.filter(g=>g.state!=="done").map(g=>g.id);return s.jsxs(ue,{children:[s.jsx(q,{children:j.label}),s.jsx(q,{children:j.level?s.jsx(fe,{variant:"neutral",children:F5(j.level)}):null}),s.jsx(q,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[j.tasks.length>0?s.jsxs("span",{children:[v," of ",j.tasks.length," done"]}):null,y.length>0?s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Open: ",s.jsx(Fs,{children:y.join(", ")})]}):null,j.untracked>0?s.jsxs("span",{className:"text-muted-foreground text-xs",children:[j.untracked," slice",j.untracked===1?" has":"s have"," no task yet"]}):null]})}),s.jsx(q,{children:j.state})]},j.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(PS,{rows:h.related,org:n,from:`planned:${h.id}`})]})]})}const F5=e=>e.charAt(0).toUpperCase()+e.slice(1);function Ug(){return yn().releases}const ks={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"},Ny=3,K5=["in_progress","not_started","planned","blocked"],Bg="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),zt=e=>e.charAt(0).toUpperCase()+e.slice(1);function Gh(e){const t=/^(\d{4})-(\d{2})-(\d{2})/.exec(String(e??""));return t?`${Number(t[3])} ${Bg[Number(t[2])-1]}`:String(e??"")}function FS(e){if(typeof e!="number")return"";const t=new Date(e*1e3);return Number.isNaN(t.getTime())?"":`${t.getDate()} ${Bg[t.getMonth()]} ${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function X5(e){if(typeof e!="number")return"";const t=new Date(e*1e3);return Number.isNaN(t.getTime())?"":`${t.getDate()} ${Bg[t.getMonth()]}`}function oa(e){return e?e.from===e.to&&e.or_later?`${Gh(e.from)} or later`:`${Gh(e.from)} to ${Gh(e.to)}${e.or_later?", or later":""}`:""}function W5(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 KS(e){var m;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??"")?"":W5(t)].filter(Boolean).join(" · "),l=t.projected?oa(t.projected):t.no_date??"",i=(m=t.projected)==null?void 0:m.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 ${oa({...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?zt(l):"",caption:f}}function Q5(e){const t=e.kinds??[];return[t.includes("range")?"Not promised":"",e.goal??(t.includes("major")?"No goal yet":"")].filter(Boolean).join(" · ")}function Z5(e){var c,d,f,m;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=((m=e.not_a_member)==null?void 0:m.count)??0;return o&&l.push(`${o} not a member yet`),{lead:n,rest:l.filter(Boolean).join(" · ")}}const XS=e=>String(e??"").replace(/_/g," ");function J5(e){const t=e??{},n=t.kinds??[],a=n.includes("slipped"),r=!a&&t.was&&t.now?oa(t.was)===oa(t.now)?`, range still ${oa(t.now)}`:`, range was ${oa(t.was)}, now ${oa(t.now)}`:"",l=[a&&t.was?`was ${oa(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?zt(l.join(" · ")):"",what:i}}const Fl="roadmap",ky={reading:!1,value:null,refusal:null};function eU(e){const[t,n]=u.useState({all:ky,mine:ky}),a=u.useRef({all:0,mine:0}),r=vs(),l=vs(),i=u.useCallback(async(o,c=!1,d=!1)=>{if(!(e!=null&&e.roadmap))return;const f=o==="mine"?l:r;if(d&&f.busy())return;const m=++a.current[o];d||n(x=>({...x,[o]:{...x[o],reading:!0}}));const h=await f.track(e.roadmap({...c?{fresh:!0}:{},...o==="mine"?{mine:!0}:{}}));m===a.current[o]&&n(x=>({...x,[o]:h.ok?{reading:!1,value:h.data,refusal:null}:d?{...x[o],reading:!1}:{reading:!1,value:x[o].value,refusal:h.refusal}}))},[e,r,l]);return{reads:t,read:i,available:!!(e!=null&&e.roadmap)}}function tU(e,t){return`${e} open${t.length?` · ${t.join(", ")} moved since you looked`:""}`}function bo({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 WS=({level:e})=>e?s.jsx(fe,{variant:"neutral",children:zt(e)}):null;function QS({state:e}){const t=zt(XS(e));return K5.includes(String(e))?s.jsx("span",{className:"font-medium",children:t}):s.jsx("span",{children:t})}function nU({reads:e,scope:t,onScope:n,onRead:a,org:r,onSelect:l}){var x,j;const i=e[t],o=i.value,c=as(),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 m=()=>{f.current=!0,a(t,!0)},h=o?[o.as_of?`as of ${FS(o.as_of)}`:"",`${((x=o.source)==null?void 0:x.machine)||"this machine"}'s records`,((j=o.decider)==null?void 0:j.words)??""].filter(Boolean).join(" · "):"";return s.jsxs(ms,{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"}),h?s.jsx("p",{className:"text-muted-foreground text-xs",children:h}):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(dn,{"aria-hidden":!0,className:"size-4"})," ",zt(ks.pending),"…"]}):null}),i.refusal&&!i.reading?i.refusal.reason==="no_roadmap"?s.jsx(ts,{title:ks.failedLead,error:`${zt(ks.noEngineLead)}. ${c}`}):i.refusal.reason==="refused"?s.jsx(ts,{title:ks.failedLead,error:i.refusal.message}):s.jsx(ts,{title:ks.failedLead,error:i.refusal.message,onRetry:m}):null,o?t==="mine"?s.jsx(cU,{mine:o.mine,org:r,onSelect:l}):s.jsx(aU,{read:o,org:r,onSelect:l}):null]})}function sU(e){if(!e||typeof e.seconds_per_day!="number")return"No rate";const t=X5(e.as_of);return`${Math.round(e.seconds_per_day/3600)} task hours a day over the ${e.days} days${t?` to ${t}`:""}`}function aU({read:e,org:t,onSelect:n}){var r,l;const a=e.releases??[];if(!a.length){const[i,o]=ks.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(bo,{children:o})]})}return s.jsxs(s.Fragment,{children:[s.jsx(Af,{pairs:[["Forecast from",zt(`${((r=e.source)==null?void 0:r.machine)||"this machine"}'s task records and rate`)],["Rate",sU(e.rate)],["Not counted",zt(((l=e.source)==null?void 0:l.not_counted)||"other machines' work")]]}),a.map(i=>s.jsx(rU,{row:i,org:t,onSelect:n},i.id))]})}function rU({row:e,org:t,onSelect:n}){var m,h,x;const a=KS(e.forecast),r=Z5(e),l=Q5(e),i=`roadmap-${e.id}`,o=e.moved?J5(e.told):null,c=(((m=e.counts)==null?void 0:m.members)??0)===0,d=((h=e.not_a_member)==null?void 0:h.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(Dr,{query:`planned=${encodeURIComponent(e.id)}`,select:Rs(e.id),onSelect:n,children:e.name})}),e.kinds.map(j=>s.jsx(fe,{variant:"neutral",children:j},j))]}),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:zt(a.caption.join(" · "))}):null]}):null,f?s.jsx("p",{className:"text-muted-foreground text-sm",children:f}):null,o?s.jsxs(oe,{variant:"info",children:[s.jsx(iE,{"aria-hidden":!0}),s.jsx(ge,{children:"Moved since you looked"}),s.jsxs(ce,{className:"text-info flex flex-col gap-0.5",children:[o.head?s.jsx("span",{children:o.head}):null,o.what.map((j,v)=>s.jsx("span",{className:"text-xs",children:j},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:zt(e.stale_unchecked.words)}):null,e.for_you&&e.kinds.includes("major")?s.jsx(lU,{row:e}):null,s.jsx(oU,{row:e,org:t})]})}function lU({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?`${zt(r).replace(/\.$/,"")}. `:"","Accept or reject in the terminal:"]}),s.jsx(bo,{children:a.accept}),s.jsx(bo,{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(bo,{children:t.set_goal})]}):null]})}function ZS({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 iU(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?zt(e.nobody):""}function oU({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,Ny),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(Fe,{containerAriaLabel:`Next in ${e.name}`,children:[s.jsx(Qe,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Member"}),s.jsx(F,{children:"Level"}),s.jsx(F,{children:"State"}),s.jsx(F,{children:"Who is on it"})]})}),s.jsx(Ke,{children:l.map(o=>{const c=i.get(o.item);return s.jsxs(ue,{children:[s.jsx(q,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx(ZS,{next:o,org:t}),c?s.jsxs("span",{className:"text-muted-foreground text-xs",children:[zt(c.words),c.estimate_as_of?` (estimated ${FS(c.estimate_as_of)})`:""]}):null]})}),s.jsx(q,{children:s.jsx(WS,{level:o.level})}),s.jsx(q,{children:s.jsx(QS,{state:o.state})}),s.jsx(q,{children:iU(o,e)})]},o.item)})})]})}),r.length>Ny&&!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 cU({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:zt(ks.noTask)}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(Fe,{containerAriaLabel:"Your work",children:[s.jsx(Qe,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Task"}),s.jsx(F,{children:"Release"}),s.jsx(F,{children:"Member"})]})}),s.jsx(Ke,{children:e.tasks.map(i=>{var o,c;return s.jsxs(ue,{children:[s.jsx(q,{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,zt(XS(i.state))].filter(Boolean).join(" · ")})]})}),s.jsx(q,{children:(o=i.members)!=null&&o.length?i.members.map(d=>s.jsx("div",{children:s.jsx(Dr,{query:`planned=${encodeURIComponent(d.planned_release)}`,select:Rs(d.planned_release),onSelect:n,children:d.name})},d.planned_release)):i.release?s.jsx(Dr,{query:`planned=${encodeURIComponent(i.release.planned_release)}`,select:Rs(i.release.planned_release),onSelect:n,children:i.release.name}):s.jsx("span",{className:"text-muted-foreground",children:i.words?zt(i.words):"—"})}),s.jsx(q,{children:(c=i.members)!=null&&c.length?i.members.map(d=>s.jsx(WS,{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(bo,{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:zt(ks.noNext)}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(Fe,{containerAriaLabel:"Your next members",children:[s.jsx(Qe,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Release"}),s.jsx(F,{children:"Member"}),s.jsx(F,{children:"State"})]})}),s.jsx(Ke,{children:e.next.map(i=>s.jsxs(ue,{children:[s.jsx(q,{children:s.jsx(Dr,{query:`planned=${encodeURIComponent(i.release)}`,select:Rs(i.release),onSelect:n,children:i.name})}),s.jsx(q,{children:s.jsx(ZS,{next:i,org:t})}),s.jsx(q,{children:s.jsx(QS,{state:i.state})})]},`${i.release}:${i.item}`))})]})})]})]})}function uU({state:e,id:t}){var l;const n=as();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(dn,{"aria-hidden":!0,className:"size-4"})," ",zt(ks.pending),"…"]});if(e.refusal){const i=e.refusal.reason==="no_roadmap"?`${zt(ks.noEngineLead)}. ${n}`:e.refusal.message;return s.jsx("p",{className:"text-muted-foreground text-xs",children:`${ks.failedLead}: ${i}`})}return null}const r=KS(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:zt(r.caption.join(" · "))}):null]})}function JS(){const e=yn().releases;if(!e)throw new Error("The Releases page rendered without a Releases contract.");return e}function dU({initial:e,environments:t,branch_options:n,chooseBranch:a,renderWrite:r,selection:l,org:i,onReadAgain:o,onNotFound:c,notice:d,focusOnMount:f,tick:m=0}){var L,Te,Le,ft,hn,rs,In,Hn,vr,Os;const h=JS(),x=e.local??null,j=!!x,[v,y]=u.useState(e);u.useEffect(()=>{e.local&&y(e)},[e]);const[g,p]=u.useState(null),b=l?l.selected:g,w=l?l.onSelect:p,S=!!(x||v.release_branch),[C,_]=u.useState(x||e.release_branch?{state:"loading"}:{state:"ready",value:null}),[N,O]=u.useState({}),[D,B]=u.useState(null),[G,U]=u.useState(!1),[R,$]=u.useState(null),[T,E]=u.useState(null),k=u.useRef(null),M=x?{fresh:!0}:void 0,Y=u.useRef(0),A=vs(),I=u.useCallback(async(ye,Je=!1)=>{if(Je&&A.busy())return;const Jt=++Y.current,Tn=await A.track(h.candidate(ye));Jt===Y.current&&_(jr=>Tn.ok?{state:"ready",value:Tn.data.candidate}:Je&&jr.state==="ready"?jr:{state:"error",error:Tn.refusal.message,refusal:Tn.refusal})},[h,A]),X=u.useCallback(async()=>{_({state:"loading"}),await I(M)},[I,j]),J=u.useCallback(async()=>{const ye=await h.list();ye.ok&&y(ye.data)},[h]),ae=((L=v.release_branch)==null?void 0:L.id)??null;u.useEffect(()=>{if(!(!j&&!ae))return I(),()=>{Y.current+=1}},[ae,I,j]);const ke=u.useRef(new Set),Q=u.useCallback((ye,Je)=>O(Jt=>({...Jt,[ye]:Je.ok?{state:"ready",value:Je.data.release}:{state:"error",error:Je.refusal.message,refusal:Je.refusal}})),[]),ee=async ye=>{O(Je=>({...Je,[ye]:{state:"loading"}})),ke.current.add(ye),Q(ye,await h.release(ye,M))},Ce=C.state!=="ready"||C.value!==null,se=$5(b),Se=eU(x?h:void 0),me=Se.available&&b===Fl,[be,ve]=u.useState("all"),Ae=v.release_branch||x?Ce?zs:null:((Te=v.releases[0])==null?void 0:Te.version)??null,Z=se!==null||me?null:b===zs?Ce?zs:null:b??Ae,[je,Ee]=u.useState([]),Pe=u.useRef(0),ie=u.useRef(0),We=vs(),Ve=u.useCallback(()=>{if(!j||!h.roadmapMoved)return;const ye=ie.current,Je=Pe.current;We.track(h.roadmapMoved()).then(Jt=>{ye===ie.current&&Jt.ok&&Je===Pe.current&&Ee(Jt.data.moved.map(Tn=>Tn.name))})},[h,j,We]);u.useEffect(()=>(Ve(),()=>{ie.current+=1}),[Ve]),Yo(m,()=>{We.busy()||Ve()});const H=Se.reads.all,we=Se.read;u.useEffect(()=>{se===null||!Se.available||!H.value&&!H.reading&&!H.refusal&&we("all")},[se,Se.available,H,we]);const[at,Bt]=u.useState(0),Qt=u.useRef(0),jt=ye=>{ye===Fl&&Bt(Je=>Je+1),w(ye)};u.useEffect(()=>{if(at!==Qt.current){if(!me){Qt.current=at;return}be!=="all"||H.reading||!H.value||!h.roadmapSeen||(Qt.current=at,h.roadmapSeen(H.value.as_of).then(ye=>{ye.ok&&(Pe.current+=1,Ee([]))}))}},[at,me,be,H,h]);const it=new Map((((Le=H.value)==null?void 0:Le.releases)??[]).map(ye=>[ye.id,[ye.kinds.includes("range")?"range":"",ye.forecast.projected?oa(ye.forecast.projected):"no date"].filter(Boolean).join(" · ")])),an=Z===null||Z===zs||v.releases.some(ye=>ye.version===Z);u.useEffect(()=>{!x||!c||Z!==null&&Z!==zs&&!an&&c({kind:"release",id:Z})},[x,c,Z,an]),u.useEffect(()=>{!Z||Z===zs||ke.current.has(Z)||x&&!an||(ke.current.add(Z),h.release(Z).then(ye=>Q(Z,ye)))},[Z,h,Q,an]);const rn=vs();Yo(m,()=>{if(x){if(I(void 0,!0),Z&&Z!==zs&&an&&!rn.busy()){const ye=Z;rn.track(h.release(ye)).then(Je=>{Je.ok&&Q(ye,Je)})}me?we(be,!1,!0):se!==null&&H.value&&we("all",!1,!0)}});const Bn=u.useRef(b),Vt=u.useRef(!1),fn=u.useRef(!!f),re=u.useRef(null);u.useEffect(()=>{var Je,Jt;if(!x)return;if(fn.current){const Tn=(Je=re.current)==null?void 0:Je.querySelector('[aria-current="true"]');if(Tn){fn.current=!1,Bn.current=b,Tn.focus();return}}if(Bn.current!==b&&(Bn.current=b,Vt.current=!0),!Vt.current)return;const ye=(Jt=k.current)==null?void 0:Jt.querySelector("h2");ye&&(Vt.current=!1,ye.tabIndex=-1,ye.focus())});const K=async ye=>{if(!a)return;B(null);const Je=await a(ye);if(!Je.ok){B(Je.error);return}p(null),_({state:"loading"}),await J()},he=async()=>{if(!v.next_before)return;E(null);const ye=await h.list({before:v.next_before});if(!ye.ok){E(ye.refusal.message);return}y(Je=>({...ye.data,releases:[...Je.releases,...ye.data.releases]}))},Ue=v.release_branch?s.jsx(fU,{value:v.release_branch.id,label:v.release_branch.name,options:n??[],can_write:v.can_write,onChange:K}):null,dt=x?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Read at ",xs(x.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]}):Ue,Rn=x?M5(((ft=v.releases[0])==null?void 0:ft.label)??((hn=v.releases[0])==null?void 0:hn.version)??null):b5(((rs=v.releases[0])==null?void 0:rs.version)??null,((In=v.release_branch)==null?void 0:In.name)??null),Zt={org:i??""};return s.jsxs(Ef.Provider,{value:m,children:[s.jsx(MS,{description:x?LS:void 0,actions:dt}),d,x?s.jsx(O5,{}):null,D?s.jsx(ts,{error:D}):null,x?null:t,!x&&!v.release_branch?s.jsx(hU,{can_write:v.can_write,options:n??[],onChoose:K}):null,v.release_branch||v.releases.length>0||x?s.jsxs("div",{ref:re,className:"flex flex-col gap-6 md:flex-row md:items-start",children:[s.jsx(mU,{list:v,candidate:S?C:null,shown:me?Fl:se!==null?Rs(se):Z,onSelect:jt,roadmap:Se.available?tU(((Hn=v.planned)==null?void 0:Hn.length)??0,je):null,planned_ranges:it,can_load_older:!!v.next_before,older_error:T,onLoadOlder:he}),s.jsx("div",{className:"min-w-0 flex-1",ref:k,children:me?s.jsx(nU,{reads:Se.reads,scope:be,onScope:ve,onRead:we,org:Zt.org,onSelect:w}):se!==null?s.jsx(Y5,{id:se,summary:((vr=v.planned)==null?void 0:vr.find(ye=>ye.id===se))??null,org:Zt.org,onNotFound:()=>c==null?void 0:c({kind:"planned",id:se}),forecast:Se.available?s.jsx(uU,{state:H,id:se}):null}):Z===zs?s.jsx(xU,{candidate:C,branch_name:((Os=v.release_branch)==null?void 0:Os.name)??null,can_write:v.can_write&&!!r,local:!!x,org:Zt.org,onSelect:w,onRetry:X,onWrite:()=>U(!0)}):Z?s.jsx(gU,{detail:N[Z]??{state:"loading"},summary:v.releases.find(ye=>ye.version===Z)??null,local:!!x,org:Zt.org,onSelect:w,onRetry:()=>ee(Z)}):(v.release_branch||x)&&C.state==="ready"?s.jsx(y5,{title:Rn.title,text:Rn.text}):null})]}):null,r&&C.state==="ready"&&C.value?r({candidate:C.value,open:G,notice:R,onOpenChange:ye=>{ye||$(null),U(ye)},onStale:async ye=>{$(ye),await I()},onWritten:async ye=>{U(!1),$(null),await J(),p(ye),await X()}}):null]})}function fU({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(Oe,{htmlFor:"release-branch",children:"Release branch"}),s.jsxs(Nt,{value:e,onValueChange:r,disabled:!a,children:[s.jsx(xt,{id:"release-branch",children:s.jsx(kt,{})}),s.jsxs(gt,{children:[l?null:s.jsx(De,{value:e,children:t??"Unnamed branch"}),n.map(i=>s.jsx(De,{value:i.id,children:i.label},i.id))]})]}),a?null:s.jsx(e2,{})]})}function e2(){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 hU({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(ld,{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(Oe,{htmlFor:"release-branch-first",children:"Release branch"}),s.jsxs(Nt,{onValueChange:n,disabled:!e,children:[s.jsx(xt,{id:"release-branch-first",children:s.jsx(kt,{placeholder:"Choose a branch"})}),s.jsx(gt,{children:t.map(a=>s.jsx(De,{value:a.id,children:a.label},a.id))})]})]}),e?null:s.jsx(e2,{})]})}function t2({children:e}){return s.jsx("p",{className:"text-muted-foreground px-3 pt-3 text-xs font-medium tracking-wide uppercase",children:e})}function mU({list:e,candidate:t,shown:n,onSelect:a,roadmap:r,planned_ranges:l,can_load_older:i,older_error:o,onLoadOlder:c}){var m,h;const d=!!e.local,f=(t==null?void 0:t.state)==="ready"&&t.value?Vo(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(ku,{active:n===Fl,onClick:()=>a(Fl),version:"Roadmap",badges:null,caption:r}):null,t&&(t.state!=="ready"||t.value)?s.jsx(ku,{active:n===zs,onClick:()=>a(zs),version:t.state==="ready"&&t.value?t.value.version:"Next release",badges:s.jsxs(s.Fragment,{children:[s.jsx(fe,{variant:"info",children:"Candidate"}),f!=null&&f.breaking?s.jsx(fe,{variant:"error",children:"Breaking"}):t.state==="ready"&&((m=t.value)==null?void 0:m.app_changed)===!1?s.jsx(fe,{variant:"neutral",children:"App unchanged"}):t.state==="ready"&&((h=t.value)!=null&&h.classification)?s.jsx(fe,{variant:"neutral",children:t.value.classification.bump}):null]}),caption:t.state==="loading"?"Classifying…":t.state==="error"?"Could not be read":OS(t.value)}):null,d?s.jsx(pU,{list:e,shown:n,onSelect:a,ranges:l}):null,d&&e.releases.length>0?s.jsx(t2,{children:"Released"}):null,e.releases.map(x=>{const j=d?D5(x):null;return s.jsx(ku,{active:n===x.version,onClick:()=>a(x.version),version:x.label??x.version,badges:(j==null?void 0:j.badges)??s.jsxs(s.Fragment,{children:[s.jsx(fe,{variant:"neutral",children:x.previous_release_id?x.bump??"patch":"First"}),x.breaking?s.jsx(fe,{variant:"error",children:"Breaking"}):null]}),caption:(j==null?void 0:j.caption)??Dg(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 pU({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(t2,{children:"Planned"}),e.planned_error?s.jsx(ts,{title:"Planned Releases could not be read",error:e.planned_error}):null,(e.planned??[]).map((r,l)=>s.jsx(ku,{active:t===Rs(r.id),onClick:()=>n(Rs(r.id)),version:r.name,badges:s.jsx(fe,{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 xU({candidate:e,branch_name:t,can_write:n,local:a,org:r,onSelect:l,onRetry:i,onWrite:o}){var h;if(e.state==="loading")return s.jsx(ms,{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(ms,{children:s.jsx(ts,{error:e.error,onRetry:i})});const c=e.value;if(!c)return null;const d=Vo(c.changes),f=!c.previous_release,m=t??"the release branch";return s.jsxs(ms,{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(fe,{variant:"info",children:"Candidate"}),d.breaking?s.jsx(fe,{variant:"error",children:"Breaking"}):c.app_changed===!1?s.jsx(fe,{variant:"neutral",children:"App unchanged"}):c.classification?s.jsx(fe,{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 ${m}'s head: `,OS(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."}),(h=c.classification)!=null&&h.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(ld,{className:"mr-2 size-4"}),"Write Release ",c.next_version]}):null]}),a?s.jsx(q5,{candidate:c,org:r,onSelect:l,notes:f?null:s.jsx(kd,{changes:c.changes})}):f?null:s.jsx(kd,{changes:c.changes})]})}function gU({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(ms,{children:[s.jsx("h2",{className:"text-lg font-semibold",children:t.label??t.version}),s.jsx(ts,{title:"This Release could not be read",error:t.error??"Its record cannot be read."})]});if(e.state==="loading")return s.jsx(ms,{children:s.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:"Loading the Release…"})});if(e.state==="error")return s.jsx(ms,{children:s.jsx(ts,{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,m=c.label??c.version,h=async()=>{await navigator.clipboard.writeText(v5(m,Vo(c.changes))),o(!0)};return s.jsxs(ms,{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(G5,{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(fe,{variant:"neutral",children:d?"First":c.bump}),Vo(c.changes).breaking?s.jsx(fe,{variant:"error",children:"Breaking"}):null]}),s.jsxs("p",{className:"text-muted-foreground text-sm",children:["Written ",Dg(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:h,children:[s.jsx(t_,{className:"mr-2 size-4"}),i?"Copied":"Copy notes"]})]}),n?s.jsx(V5,{release:c,org:a,onSelect:r,notes:d?null:s.jsx(kd,{changes:c.changes})}):d?null:s.jsx(kd,{changes:c.changes})]})}const vU=5,jU=1e4,yU=e=>e.retry===!0||e.reason==="store_locked"||e.status===503;function bU({org:e,query:t,onSelect:n,home:a}){var k;const r=JS(),{href:l,Link:i}=Ze(),[o,c]=u.useState({state:"loading"}),[d,f]=u.useState(null),[m,h]=u.useState(null),[x,j]=u.useState(null),v=u.useRef(0),y=u.useRef(0),g=u.useRef(null),p=u.useRef(!1),b=u.useRef(!1),w=Sg(g),S=vs(),C=u.useCallback(async(M,Y=!1)=>{const A=y.current+=1;h(null);const I=await S.track(r.list(M?{fresh:!0}:void 0));if(A===y.current){if(I.ok){v.current=0,f(null);const X=document.visibilityState==="visible"?1:0;c(J=>J.state==="ok"?Y?{state:"ok",list:I.data,gen:J.gen,tick:J.tick+X}:{state:"ok",list:I.data,gen:J.gen+1,tick:J.tick}:{state:"ok",list:I.data,gen:0,tick:0});return}if(I.refusal.reason==="engine_missing"){c({state:"engine_missing",refusal:I.refusal});return}if(v.current+=1,v.current===1&&yU(I.refusal)){b.current=Y,h(I.refusal.retry_after??vU);return}f(I.refusal)}},[r,S]);u.useEffect(()=>{C(!1)},[C]);const _=u.useMemo(()=>Sf(S,()=>void C(!1,!0)),[C,S]);cr(_,jU),u.useEffect(()=>{if(m===null)return;const M=setTimeout(()=>{document.visibilityState==="visible"&&C(!1,b.current)},m*1e3);return()=>clearTimeout(M)},[m,C]),u.useEffect(()=>{var Y;if(!p.current||o.state==="loading"||d||m!==null)return;p.current=!1;const M=(Y=g.current)==null?void 0:Y.querySelector("h1");M&&(M.tabIndex=-1,M.focus())});const N=()=>{p.current=!0,v.current=0,f(null),C(!0)},O=o.state==="ok"?o.list:null,D=t.roadmap?Fl:t.planned!==null?t.planned===""?(k=O==null?void 0:O.planned)!=null&&k[0]?Rs(O.planned[0].id):null:Rs(t.planned):t.release,B=`${t.release??""}|${t.planned??""}|${t.roadmap?"roadmap":""}`,G=u.useRef(B);u.useEffect(()=>{G.current!==B&&(G.current=B,j(null))},[B]);const U=u.useRef(!1),R=u.useCallback(M=>{U.current=!0,j(M)},[]),$=!x&&o.state==="ok"&&U.current;if(u.useEffect(()=>{$&&(U.current=!1)},[$]),x)return s.jsx(fr,{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 T=m!==null?s.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status","aria-live":"polite",children:[s.jsx(dn,{"aria-hidden":!0})," The release records are busy; reading again in ",m," s…"]}):null,E=d?s.jsxs(oe,{ref:w,variant:"destructive",children:[s.jsx(Ut,{}),s.jsx(ge,{children:"Releases could not be read"}),s.jsxs(ce,{className:"flex flex-col items-start gap-2",children:[s.jsxs("span",{children:[d.message,O?" The last Releases read stays below.":""]}),s.jsx(P,{variant:"outline",size:"sm",onClick:N,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(dU,{initial:o.list,tick:o.tick,org:e,selection:{selected:D,onSelect:n},onReadAgain:N,onNotFound:R,notice:T||E?s.jsxs(s.Fragment,{children:[T,E]}):null,focusOnMount:$},o.gen):o.state==="engine_missing"?s.jsx(ta,{page:"Releases"}):s.jsxs(s.Fragment,{children:[s.jsx(MS,{description:LS}),E??T??s.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status","aria-live":"polite",children:[s.jsx(dn,{"aria-hidden":!0})," Loading Releases…"]})]})})}const wU={threads:"Threads",tasks:"Tasks",queues:"Queues",blockers:"Blockers",worktrees:"Worktrees",workspaces:"Workspaces",chart:"Org chart"},_U={tasks:"Tasks",issues:"Issues",releases:"Releases"};function Su(e,t){return e.kind==="home"?"Home":e.kind==="org"?wU[e.page]:e.kind==="project"?e.page?_U[e.page]:t??e.project:"Not found"}const NU="(max-width: 767px)";function kU(){const e=typeof window<"u"&&window.matchMedia?window.matchMedia(NU):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 tu({className:e=""}){return s.jsx("span",{"aria-hidden":"true",className:`block animate-pulse rounded-md bg-sidebar-accent ${e}`})}function Sy({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 Cy({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(jg,{children:[s.jsx(yg,{asChild:!0,children:l}),s.jsx(Nf,{side:"right",children:r})]}):l})}const Ry="m-0 flex list-none flex-col gap-1 p-0";function Ty({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 Ey({page:e,collapsed:t,sheet:n=!1}){var $;const{href:a}=Ze(),{worktrees:r,blockers:l}=yn(),i=ss(),{org:o,projects:c,loading:d,none:f,about:m,aboutFailed:h,domains:x,engine:j}=i,v=j===null,y=o?`/org/${o.slug}`:"",g=c==null?void 0:c.find(T=>T.current),p=(($=o==null?void 0:o.source)==null?void 0:$.kind)==="folder"&&g!==void 0,b=T=>p&&g?`${T} · ${g.name}`:T,w=b("Workspaces"),S=b("Tasks"),C=b("Queues"),_=T=>p?T:void 0,N=[{label:"Home",href:a(y||"/"),icon:dE,current:e.kind==="home"},...v?[]:[{label:"Threads",href:a(`${y}/threads`),icon:rd,current:e.kind==="org"&&e.page==="threads"}],...x.includes("tasks")&&!v?[{label:S,title:_(S),href:a(`${y}/tasks`),icon:s_,current:e.kind==="org"&&e.page==="tasks"}]:[],...v?[]:[{label:C,title:_(C),href:a(`${y}/queues`),icon:a_,current:e.kind==="org"&&e.page==="queues"}],...l&&!v?[{label:"Blockers",href:a(`${y}/blockers`),icon:cE,current:e.kind==="org"&&e.page==="blockers"}]:[],...r&&!v?[{label:"Worktrees",href:a(`${y}/worktrees`),icon:n_,current:e.kind==="org"&&e.page==="worktrees"}]:[],{label:w,title:_(w),href:a(`${y}/workspaces`),icon:nE,current:e.kind==="org"&&e.page==="workspaces"},{label:"Org chart",href:a(`${y}/chart`),icon:TE,current:e.kind==="org"&&e.page==="chart"}],O=d?null:f?"No organization":(o==null?void 0:o.name)??"Organization",D=o?lA(o):null,B=m==null?void 0:m.version,G=B?t?B:`sdlc ${B}`:h?id:Jd,U=h||(m==null?void 0:m.sync.state)==="unknown"?sA:m===void 0?nA:tA;let R;return d?R=s.jsx("div",{className:"px-2 py-1",children:s.jsxs(Sy,{label:"Loading projects",children:[s.jsx(tu,{className:"h-4 w-32"}),s.jsx(tu,{className:"h-4 w-24"})]})}):c?R=s.jsx("ul",{className:Ry,children:c.map(T=>s.jsx(Cy,{collapsed:t,item:{label:T.name,title:T.name,href:a(`/proj/${encodeURIComponent(T.id)}`),icon:eE,current:e.kind==="project"&&e.project===T.id}},T.id))}):R=s.jsx("p",{className:"m-0 px-2 text-sm text-sidebar-foreground/70",children:f?"No projects":id}),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(OT,{className:"size-4","aria-hidden":"true"})}),!t&&s.jsx("div",{className:"grid min-w-0 flex-1 text-left text-sm leading-tight",children:O===null?s.jsxs(Sy,{label:"Loading organization",children:[s.jsx(tu,{className:"h-4 w-28"}),s.jsx(tu,{className:"h-3 w-24"})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"truncate font-semibold",title:O,children:O}),D&&s.jsx("span",{className:"truncate text-xs text-sidebar-foreground/70",children:D})]})})]}),s.jsxs("nav",{"aria-label":"App",className:"min-h-0 flex-1 overflow-y-auto",children:[s.jsx(Ty,{label:"Organization",collapsed:t,children:s.jsx("ul",{className:Ry,children:N.map(T=>s.jsx(Cy,{item:T,collapsed:t},T.label))})}),!t&&s.jsx(Ty,{label:"Projects",collapsed:t,children:R})]}),m!==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:B?`sdlc ${B}`:void 0,children:G}),!t&&s.jsxs("p",{className:"m-0 flex items-start gap-2 px-2",children:[s.jsx(rE,{className:"mt-0.5 size-4 shrink-0","aria-hidden":"true"}),s.jsx("span",{children:U})]})]})]})}const SU="outline-hidden rounded-sm focus-visible:ring-2 focus-visible:ring-ring";function CU({page:e}){var c;const{href:t,Link:n}=Ze(),{org:a,projects:r,loading:l,none:i}=ss(),o=[];if(l)o.push({label:Jd});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(m=>m.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:Su(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:Su(e),href:t(f)}),o.push({label:e.item})}else e.kind!=="home"&&!(e.kind==="project"&&!e.page)&&o.push({label:Su(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(dc,{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 ${SU}`,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 RU({page:e,children:t}){var g;const n=kU(),[a,r]=u.useState(!0),[l,i]=u.useState(!1),o=u.useRef(null),c=u.useRef(null),{org:d,projects:f,loading:m,none:h}=ss(),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=m?Jd:h?"No organization":(d==null?void 0:d.name)??"Organization",b=(e.kind==="org"||e.kind==="project")&&e.item!==void 0?`${e.item} · `:"";document.title=`${b}${Su(e,x)} · ${p} · sdlc viewer`},[e,x,d,m,h]);const j=()=>{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 b=S=>{var D;if(S.key==="Escape"){i(!1),(D=o.current)==null||D.focus();return}if(S.key!=="Tab")return;const C=[...p.querySelectorAll("a[href], button:not([disabled])")];if(C.length===0)return;const _=C[0],N=C[C.length-1],O=p.contains(document.activeElement);S.shiftKey&&(document.activeElement===_||!O)?(S.preventDefault(),N.focus()):!S.shiftKey&&(document.activeElement===N||!O)&&(S.preventDefault(),_.focus())};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[v]);const y=!n&&!a;return s.jsx(vg,{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(Ey,{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(Ey,{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:j,children:s.jsx(Zd,{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:j})]}),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(AE,{className:"size-4","aria-hidden":"true"})}),s.jsx("span",{"aria-hidden":"true",className:"mr-2 h-4 w-px bg-border"}),s.jsx(CU,{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 Ig="m-0 text-2xl font-semibold tracking-tight",Hg="outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",Pg=`rounded-sm font-medium text-primary no-underline hover:underline ${Hg}`;function Vh({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 TU({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(Vh,{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(Vh,{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(Vh,{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?Hr:rA})]})}const Ay=`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 ${Hg}`;function EU(){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 Ri(){const{href:e,Link:t}=Ze(),{loading:n,projects:a,none:r,failure:l,readAt:i,refresh:o,reading:c}=ss(),[d,f]=u.useState(""),m=s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("h1",{className:Ig,children:"Projects"}),!r&&s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:aA})]});if(r)return s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[m,s.jsx(TU,{why:r==="not_in_git"?{kind:"not_in_git"}:uA(r)})]});const h=l!=null&&l.shown?l:null,x=(a??[]).filter(j=>j.name.toLowerCase().includes(d.trim().toLowerCase()));return s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[m,h&&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:l_(h.refusal,i)}),s.jsx("div",{children:s.jsx("button",{type:"button",className:Ay,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:j=>f(j.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 ${Hg}`}),!h&&s.jsx("button",{type:"button",className:`${Ay} 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 ${Wi(i)}; reading again in ${l.retryInSeconds??10} seconds.`})]}),n?s.jsx(EU,{}):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(j=>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(j.id)}`),className:Pg,children:j.name})}),s.jsx("td",{className:"px-3 py-2 font-mono text-muted-foreground",children:j.location??id}),s.jsx("td",{className:"px-3 py-2 text-right",children:j.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"})})]},j.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 n2({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:Ig,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 ${Pg}`,children:"Back to the organization's Home"})})]})})}const AU={tasks:"Tasks",issues:"Issues",releases:"Releases"};function Fo({project:e}){const{href:t,Link:n}=Ze(),{org:a,projects:r,loading:l,domains:i}=ss(),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:Jd}):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:Ig,children:o.name}),s.jsx("p",{className:"m-0 font-mono text-sm text-muted-foreground",children:o.location??id})]}),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:Pg,children:AU[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(n2,{title:"Project not found",children:`There is no project '${e}' in this organization.`}):s.jsx(Ri,{})}const Nc=e=>e instanceof Error?e.message:String(e);async function s2(e=!1){try{const t=await fetch(e?"api/threads?archived=1":"api/threads",{cache:"no-store"});return t.status===404?{none:!0}:t.ok?{data:await t.json()}:{error:await t.text()||`HTTP ${t.status}`}}catch(t){return{error:Nc(t)}}}async function $U(){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 MU(){try{return(await fetch("api/pin",{method:"HEAD",cache:"no-store"})).ok}catch{return!1}}async function OU(){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 DU(){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:Nc(e)}}}async function a2(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:Nc(n)}}}}async function zU(){try{return(await fetch("api/threads/archive",{method:"HEAD",cache:"no-store"})).ok}catch{return!1}}async function LU(e){const t=await e.text();try{const n=JSON.parse(t);if(typeof(n==null?void 0:n.error)=="string"&&n.error)return n.error}catch{}return t||`HTTP ${e.status}`}async function UU(e){try{const t=await fetch(`api/threads/archive?key=${encodeURIComponent(e)}`,{cache:"no-store"});if(!t.ok)return null;const n=await t.json();return typeof(n==null?void 0:n.detail)=="string"&&n.detail?{detail:n.detail,failed:n.failed===!0}:null}catch{return null}}async function BU(e,t){try{const n=await fetch("api/threads/archive",{method:"POST",cache:"no-store",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,on:t})});return n.ok?null:await LU(n)}catch(n){return Nc(n)}}async function IU(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 Nc(n)}}const HU={probe:{source:async()=>{const e=await s2();if("error"in e)throw new Error(e.error);return{label:"Local workspace"}}}},r2={href:e=>e.replace(/^\/+/,"")||"./",Link:({href:e,className:t,children:n,...a})=>s.jsx("a",{href:e,className:t,...a,children:n})},PU={label:"Local viewer",can:()=>!1};function qU(){return u.useEffect(()=>{document.title="Shared app UI · SDLC Workspace Viewer"},[]),s.jsx("div",{className:"app-ui dark",children:s.jsx(Q0,{data:HU,router:r2,identity:PU,children:s.jsx(xT,{})})})}const $y="Who waits on whom among the threads here, the threads that hold up the most first. Waits in a queue and waits on you are counted apart.",Cu=15,GU="New waits that would close a loop are refused. One thread hands its part over or asks the user.",VU="Threads in line for a queue are on Queues; threads that wait on you are marked Needs you on Threads.";function YU(){const e=yn().blockers;if(!e)throw new Error("The Blockers page rendered without the blockers seam.");return e}const zr=(e,t,n)=>`${e} ${e===1?t:n}`;function _p(e){const t=Math.max(0,Math.round(e*60));if(t<60)return`${t}m`;if(t<24*60){const n=t%60;return n?`${Math.floor(t/60)}h ${n}m`:`${Math.floor(t/60)}h`}return`${Math.floor(t/(24*60))}d`}function FU(e,t){return t?e===null?`Not reading · trying again every ${Cu}s`:`Not reading since ${Dn(e/1e3)} · trying again every ${Cu}s`:e===null?"Connecting…":`Live · read ${Dn(e/1e3)} · refreshes every ${Cu}s`}function KU(e){var n;if(e.carried_by)return`taken over by ${e.carried_by.title}`;if(e.finished)return"finished";const t=[];return(n=e.queued)!=null&&n.length&&t.push(`in the ${e.queued.join(" and ")} queue`),e.asks_user&&t.push("asks you"),e.phase&&t.push(e.phase),e.quiet&&e.heard_hours!==null?t.push(`quiet ${_p(e.heard_hours)}`):e.heard_hours!==null&&t.push(`heard ${_p(e.heard_hours)} ago`),t.join(" · ")}function XU(e){const t=new Map(e.threads.map(l=>[l.thread,l.title])),n=l=>t.get(l)??l,a=e.holds.length?[...new Set(e.holds.map(l=>`${n(l.waiter)} waits on ${n(l.on)}`))]:e.threads.map((l,i)=>`${l.title} waits on ${e.threads[(i+1)%e.threads.length].title}`),r=a.pop()??"";return`Wait loop: ${a.length?`${a.join(", ")}, and ${r}`:r}`}function WU(e,t){const n=zr(e.blocked_threads,"thread waits","threads wait"),a=`in ${zr(t,"wait loop","wait loops")}`;return e.blockers?`${n} on ${zr(e.blockers,"blocker","blockers")}${t?` and ${a}`:""}`:`${n} ${a}`}const QU=e=>e.replace(/\s*\(status release\)$/,"");function ZU({org:e}){const t=YU(),n=as(),[a,r]=u.useState(null),[l,i]=u.useState(null),o=vs(),c=u.useRef(0),d=u.useCallback(async x=>{const j=c.current+=1,v=await o.track(t.report(x?{fresh:!0}:void 0));j===c.current&&(v.ok?(r(v.data),i(null)):i(v.refusal))},[t,o]);u.useEffect(()=>{d(!1)},[d]);const f=u.useMemo(()=>Sf(o,()=>void d(!1)),[d,o]);if(cr(f,Cu*1e3),(l==null?void 0:l.reason)==="engine_missing")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:s.jsx(ta,{page:"Blockers"})});if((l==null?void 0:l.reason)==="view_outdated")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(sn,{title:"Blockers",description:$y}),s.jsxs(oe,{variant:"warning",className:"mt-6",children:[s.jsx(Ut,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:el}),s.jsx(ce,{children:n})]})]});const m=(a==null?void 0:a.read_at)??null,h=l??(a!=null&&a.stale?{status:200,message:a.stale.message,reason:a.stale.reason}: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(sn,{title:"Blockers",description:$y}),s.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:FU(m,h!==null)}),!a&&!l?s.jsx(JU,{}):null,h?s.jsx(e8,{refusal:h,on_retry:()=>void d(!0)}):null,a?s.jsx(t8,{org:e,report:a,stale:h!==null}):null]})}function JU(){return s.jsx("div",{className:"mt-6 grid gap-2",role:"status","aria-label":"Loading blockers",children:Array.from({length:3},(e,t)=>s.jsx(Ct,{className:t===2?"h-10 w-2/3":"h-10 w-full"},t))})}function e8({refusal:e,on_retry:t}){const n=s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"});return e.reason==="store_locked"?s.jsxs(oe,{variant:"info",className:"mt-4",children:[s.jsx(gn,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:"The local stores are busy"}),s.jsxs(ce,{children:[s.jsx("p",{children:e.message}),n]})]}):s.jsxs(oe,{variant:"destructive",className:"mt-4",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:"Blockers could not be read"}),s.jsxs(ce,{children:[s.jsx("p",{children:e.message||"The read did not answer. Try again in a moment."}),n]})]})}function Mf(e){const{href:t,Link:n}=Ze(),a=e?`/org/${encodeURIComponent(e)}`:"";return{href:r=>t(`${a}${r}`),name:(r,l="text-primary hover:underline")=>r.thread.startsWith("exec-")?s.jsx("span",{children:r.title}):s.jsx(n,{className:l,href:t(`${a}/threads#thread-${encodeURIComponent(r.thread)}`),children:r.title}),Link:n}}function t8({org:e,report:t,stale:n}){const{href:a,Link:r}=Mf(e),{summary:l}=t,i=n?` · last read ${Dn(t.read_at/1e3)}`:"",o=Object.entries(t.queue_waits).filter(([,d])=>d>0),c=l.blocked_threads>0||t.loops.length>0;return s.jsxs(s.Fragment,{children:[s.jsx("div",{role:"status","aria-live":"polite",children:c?s.jsx("p",{className:"text-muted-foreground mt-4 text-sm",children:`${WU(l,t.loops.length)}${i}`}):s.jsxs("div",{className:"mt-2 flex flex-col gap-1",children:[s.jsx("p",{className:"text-sm font-medium",children:"Nothing is blocked"}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[VU,i]})]})}),t.loops.map(d=>s.jsx(n8,{org:e,loop:d},d.threads.map(f=>f.thread).join("|"))),t.blockers.length?s.jsxs("section",{className:"mt-4 flex flex-col gap-3","aria-labelledby":"biggest-blockers",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h2",{id:"biggest-blockers",className:"text-lg font-semibold",children:"Biggest blockers"}),s.jsx(fe,{variant:"neutral",children:t.blockers.length})]}),t.blockers.map(d=>s.jsx(a8,{org:e,card:d},d.thread))]}):null,t.user_waits>0||o.length?s.jsxs("div",{className:"mt-6 flex flex-col gap-2 text-sm",children:[t.user_waits>0?s.jsxs("p",{className:"flex flex-wrap items-baseline gap-x-2",children:[s.jsx("span",{className:"text-warning",children:`Waiting on you: ${zr(t.user_waits,"thread","threads")}`}),s.jsx(r,{className:"text-primary hover:underline",href:a("/threads"),children:"Open Threads"})]}):null,o.map(([d,f])=>s.jsxs("p",{className:"flex flex-wrap items-baseline gap-x-2",children:[s.jsx("span",{className:"text-muted-foreground",children:d==="main"?`In line to land: ${zr(f,"thread","threads")} in the main queue`:`In line for ${d}: ${zr(f,"thread","threads")} in the ${d} queue`}),s.jsx(r,{className:"text-primary hover:underline",href:a(`/queues?queue=${encodeURIComponent(d)}`),children:`Open the ${d} queue`})]},d))]}):null]})}function n8({org:e,loop:t}){const{href:n,Link:a}=Mf(e),r=s8(t.waiters);return s.jsxs("div",{className:"mt-4 flex flex-col gap-3",children:[s.jsxs(oe,{variant:"destructive",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:XU(t)}),s.jsxs(ce,{children:[s.jsx("p",{children:GU}),s.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:t.threads.map(l=>l.thread.startsWith("exec-")?null:s.jsx(P,{asChild:!0,variant:"outline",size:"sm",className:"h-auto min-h-8 whitespace-normal text-left no-underline",children:s.jsx(a,{href:n(`/threads#thread-${encodeURIComponent(l.thread)}`),children:`Open ${l.title}`})},l.thread))})]})]}),r?s.jsxs("div",{className:"flex flex-col gap-3",children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:`Behind the loop: ${zr(r,"thread","threads")}`}),s.jsx(qg,{org:e,waiters:t.waiters})]}):null]})}const s8=e=>new Set(function t(n){return n.flatMap(a=>[a.thread,...t(a.waiters??[])])}(e)).size;function a8({org:e,card:t}){const{name:n}=Mf(e),a=KU(t.state);return s.jsxs(mt,{className:"flex flex-col gap-1 p-4","data-testid":"blockers-card",children:[s.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[s.jsx("h3",{className:"min-w-0 text-sm font-semibold break-words",children:n(t)}),s.jsx(fe,{variant:"neutral",children:`blocks ${t.weight}`})]}),a?s.jsx("p",{className:"text-muted-foreground text-xs",children:a}):null,s.jsx("p",{className:"text-muted-foreground text-xs font-medium",children:`Clears when ${QU(t.clears)}`}),s.jsx("div",{className:"mt-1",children:s.jsx(qg,{org:e,waiters:t.waiters})})]})}function qg({org:e,waiters:t,via:n}){const{name:a}=Mf(e);return s.jsx("ul",{className:"border-border m-0 flex list-none flex-col gap-3 border-l p-0 pl-4",children:t.map(r=>{var l;return s.jsxs("li",{className:"flex min-w-0 flex-col gap-1",children:[s.jsx("span",{className:"text-sm break-words",children:a(r)}),s.jsx("span",{className:"text-muted-foreground text-xs break-words whitespace-pre-line",children:`waits ${_p(r.age_hours)} · ${[n?`via ${n}`:"",r.reason.trim()].filter(Boolean).join(" · ")||"no reason given"}`}),(l=r.waiters)!=null&&l.length?s.jsx(qg,{org:e,waiters:r.waiters,via:r.title}):null]},`${r.hold}-${r.thread}`)})})}const r8="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.",l8=3e4,i8="Reading the workspaces. On a plan workspace this can take a few minutes.",o8="The read failed. Details are in the terminal running sdlc viewer.",c8={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"}},u8=e=>c8[e]??{label:e,tone:"neutral"},Ga=e=>e.slice(0,8),l2={human:"Human",ai:"AI"},Np=(e,t)=>`${e} ${t}${e===1?"":"s"}`;function d8(){const e=yn().workspaces;if(!e)throw new Error("The Workspaces page rendered without the workspaces seam.");return e}function f8(e){const t=d8(),[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),m=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(()=>{m()},[m]),cr(()=>void m(),l8),u.useEffect(()=>{var y;d.current&&(n||r)&&(d.current=!1,(y=c.current)==null||y.focus())},[n,r]);const h=()=>{d.current=!0,m()},x=n===null&&r===null,j=n===null&&r!==null,v=n?h8(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(sn,{title:"Workspaces",description:r8,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 m(),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?i2(n,i):""})]})}),s.jsxs("div",{ref:c,tabIndex:-1,className:"outline-none",children:[x?s.jsx(m8,{}):null,j&&r?s.jsx(p8,{refusal:r,on_retry:h}):null,n?s.jsx(x8,{overview:n}):null]})]})}function i2(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 h8(e,t){const n=`Read at ${As(new Date(e.read_at).toISOString())}`,a=i2(e,t);return a?`${n} · ${a}`:n}function m8(){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(Ct,{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:i8})]})}function p8({refusal:e,on_retry:t}){const n=e.reason==="store_locked"?l_(e,null):o8;return s.jsxs(oe,{variant:"destructive",className:"mt-6",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:"Could not read workspaces"}),s.jsxs(ce,{children:[s.jsx("p",{children:n}),s.jsx(P,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]})}function x8({overview:e}){const{counts:t}=e,n=[Np(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(nu,{id:"workspaces-lineage",title:"Lineage",caption:"Each workspace under the one it forked from",children:s.jsx(g8,{rows:e.workspaces})}),s.jsx(nu,{id:"workspaces-authority",title:"Authority and resolver",caption:"What this checkout's workspace may change",children:s.jsx(v8,{authority:e.authority})})]}),s.jsx(nu,{id:"workspaces-activity",className:"mt-4",title:"Integration activity",caption:"Newest first",children:e.activity.length===0?s.jsx(My,{children:"No integration or reconciliation attempts yet."}):s.jsx(y8,{rows:e.activity})}),s.jsx(nu,{id:"workspaces-handoffs",className:"mt-4",title:"Handoffs",children:e.handoffs.length===0?s.jsx(My,{children:"No Handoffs prepared yet."}):s.jsx(b8,{rows:e.handoffs})})]})}function nu({id:e,title:t,caption:n,className:a,children:r}){return s.jsxs("section",{"aria-labelledby":e,className:de("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 My=({children:e})=>s.jsx("p",{className:"text-muted-foreground text-sm",children:e}),Sd=({children:e,tone:t})=>s.jsx("div",{className:de("text-xs",t==="error"?"text-destructive":"text-muted-foreground"),children:e});function Ko({status:e}){const t=u8(e);return s.jsx(fe,{variant:t.tone,children:t.label})}function Of({label:e,children:t}){return s.jsx(mt,{role:"group","aria-label":e,tabIndex:0,className:"overflow-x-auto outline-hidden focus-visible:ring-2 focus-visible:ring-ring",children:t})}function g8({rows:e}){return s.jsx(Of,{label:"Workspaces",children:s.jsxs(Fe,{containerClassName:"overflow-visible",children:[s.jsx(Qe,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Workspace"}),s.jsx(F,{children:"Actor"}),s.jsx(F,{children:"Forked from"}),s.jsx(F,{children:"Status"}),s.jsx(F,{children:"Projection"})]})}),s.jsx(Ke,{children:e.map(t=>s.jsxs(ue,{"data-testid":"workspaces-row",children:[s.jsxs(q,{children:[s.jsx("div",{className:"font-mono font-medium",children:t.short_id}),s.jsx(Sd,{children:t.current?`${t.path} · This checkout`:t.path}),t.projection==="unreadable"&&t.projection_error&&s.jsx(Sd,{children:t.projection_error})]}),s.jsx(q,{children:l2[t.actor]}),s.jsx(q,{children:t.source_id?s.jsx("span",{className:"font-mono",children:Ga(t.source_id)}):s.jsx("span",{className:"text-muted-foreground",children:"No source"})}),s.jsx(q,{children:s.jsx(Ko,{status:t.status})}),s.jsx(q,{children:s.jsx(Ko,{status:t.projection})})]},t.id))})]})})}function v8({authority:e}){const t=e.resolver,n=[["Workspace",s.jsx("span",{className:"font-mono",children:Ga(e.workspace_id)},"id")],["Actor",l2[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(Ko,{status:t.state==="ready"?"ready":"needs_attention"},"resolver")]),t.state==="needs_attention"&&t.issue&&n.push(["Resolver issue",t.issue]),s.jsx(Of,{label:"Authority and resolver",children:s.jsx(Fe,{containerClassName:"overflow-visible",children:s.jsx(Ke,{children:n.map(([a,r])=>s.jsxs(ue,{children:[s.jsx(F,{scope:"row",className:"text-muted-foreground font-normal",children:a}),s.jsx(q,{children:r})]},a))})})})}function j8(e){const t=[e.merge_attempts?Np(e.merge_attempts,"merge attempt"):null,e.resolver_attempts?Np(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 y8({rows:e}){return s.jsx(Of,{label:"Integration activity",children:s.jsxs(Fe,{containerClassName:"overflow-visible",children:[s.jsx(Qe,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"Change"}),s.jsx(F,{children:"Status"}),s.jsx(F,{children:"Attempts"}),s.jsx(F,{children:"Updated"})]})}),s.jsx(Ke,{children:e.map((t,n)=>s.jsxs(ue,{children:[s.jsxs(q,{children:[s.jsx("div",{className:"font-medium",children:t.kind==="integration"?`Integrate ${Ga(t.child_id)} into ${Ga(t.other_id)}`:`Reconcile ${Ga(t.child_id)} from ${Ga(t.other_id)}`}),s.jsx(Sd,{children:t.kind==="integration"?"Integration":"Source reconciliation"})]}),s.jsx(q,{children:s.jsx(Ko,{status:t.status})}),s.jsx(q,{children:j8(t)}),s.jsx(q,{children:G1(t.updated_at)})]},`${t.kind}-${t.child_id}-${t.other_id}-${t.updated_at}-${n}`))})]})})}function b8({rows:e}){return s.jsx(Of,{label:"Handoffs",children:s.jsxs(Fe,{containerClassName:"overflow-visible",children:[s.jsx(Qe,{children:s.jsxs(ue,{children:[s.jsx(F,{children:"From"}),s.jsx(F,{children:"To"}),s.jsx(F,{children:"Status"}),s.jsx(F,{children:"Pinned"})]})}),s.jsx(Ke,{children:e.map(t=>s.jsxs(ue,{children:[s.jsxs(q,{children:[s.jsx("div",{className:"font-mono font-medium",children:Ga(t.child_id)}),t.error?s.jsx(Sd,{children:t.error}):null]}),s.jsx(q,{className:"font-mono",children:Ga(t.source_id)}),s.jsx(q,{children:s.jsx(Ko,{status:t.status})}),s.jsx(q,{children:`${t.child_commit} onto ${t.source_commit}`})]},t.id))})]})})}const Oy="This machine's worktrees of this repository.",w8="Merge sends one whose thread is at rest to the main queue.",_8=3e4,N8=3e3,k8=6e5,Yh=[{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"}],Vi={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"}},S8="no thread to land it",Gg="its thread waits on you",o2="its thread is done",c2="its thread is retired",Vg=e=>e.archivable&&e.cleanup==="user",C8=e=>e.queue!==null||e.merge.offered===!1&&e.merge.why==="already in a promotion queue",R8=e=>!e.merge.offered&&(e.merge.why===o2||e.merge.why.startsWith(c2)),Yg=e=>!e.merge.offered&&e.merge.why===S8||R8(e),Fh=(e,t)=>t==="all"?!0:t==="decide"?Vg(e):(e.landed!==null?"landed":C8(e)?"queued":Yg(e)?"orphan":"needs")===t,T8=e=>e.landed!==null?e.threads.some(t=>t.phase!=="done"):e.threads.length>0&&!Yg(e);function Ru(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 u2(e){const t=e%100,n=t>=11&&t<=13?"th":{1:"st",2:"nd",3:"rd"}[e%10]??"th";return`${e}${n}`}function E8(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 Kh=e=>As(new Date(e*1e3).toISOString()),to=e=>e.charAt(0).toUpperCase()+e.slice(1);function A8(e,t){var r;const n=t.phase?to(t.phase):"No phase",a=e.merge;if(!a.offered&&a.why.startsWith(c2)){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===o2?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===Gg?`${n} · waits on you`:a.why.startsWith("its session is not running")?`${n} · session not running`:n}function $8(){const e=yn().worktrees;if(!e)throw new Error("The Worktrees page rendered without the worktrees seam.");return e}function M8({org:e}){var M,Y;const t=$8(),[n,a]=u.useState(null),[r,l]=u.useState(null),[i,o]=u.useState(null),[c,d]=u.useState(!1),[f,m]=u.useState("all"),[h,x]=u.useState(""),[j,v]=u.useState({}),y=u.useRef({}),{confirm:g,confirm_dialog:p}=vi(),b=u.useRef(!1),w=u.useCallback(async()=>{if(b.current)return;b.current=!0;const A=await t.list();b.current=!1,A.ok?(a(A.data),l(null)):l(A.refusal)},[t]),S=u.useCallback(async()=>{const A=await t.sizes();d(!A.ok),A.ok&&o(A.data)},[t]);u.useEffect(()=>{w(),S()},[w,S]);const C=(n==null?void 0:n.rows.some(A=>{var I,X;return((I=A.write)==null?void 0:I.state)==="waiting"||((X=A.write)==null?void 0:X.state)==="running"}))??!1;cr(()=>void w(),C?N8:_8),cr(()=>void S(),k8);const _=(n==null?void 0:n.rows)??[],N=A=>i==null?void 0:i.sizes[A.path],O=_.filter(Vg),D=i?O.reduce((A,I)=>A+(N(I)??0),0):null,B=_.length===0?Oy:`${Oy} ${w8}${O.length?` ${O.length} ${O.length===1?"is":"are"} yours to decide${D!==null?`: removing them frees about ${Ru(D)}`:""}.`:""}`,G=h.trim().toLowerCase(),U=A=>!G||[A.name,A.path,A.branch??"",...A.threads.map(I=>I.title??I.thread)].some(I=>I.toLowerCase().includes(G)),R=_.filter(A=>Fh(A,f)&&U(A)).sort((A,I)=>{if(f==="decide")return(N(I)??0)-(N(A)??0);const X=J=>T8(J)?J.merge.offered?0:1:2;return X(A)-X(I)||(A.idle_days??1/0)-(I.idle_days??1/0)}),$=async(A,I)=>{const X=await(A==="merge"?t.merge(I.path):t.remove(I.path));X.ok?v(({[I.path]:J,...ae})=>ae):v(J=>({...J,[I.path]:X.refusal.message})),await w()},T=async A=>{if(!A.merge.offered)return;const I=A.threads.find(ee=>ee.thread===(A.merge.offered&&A.merge.thread)),X=(I==null?void 0:I.title)??A.merge.thread,J=I!=null&&I.holds.length?`has ${I.holds.length} open hold(s) (${I.holds.join(", ")})`:"has no open holds",ae=A.merge.lands.by==="manager"?`on its turn the queue's merge manager, ${A.merge.lands.manager}, lands it on main`:"on its turn that thread lands it on main",ke=A.merge.caveat?`
|
|
406
|
+
|
|
407
|
+
Its session could not be read: ${A.merge.caveat}. A turn it does not start passes on.`:"";await g({title:`Send ${A.name} to the main queue`,description:`This joins the main promotion queue for its thread, ${X}, which ${J} and is told of the join. The queue checks the branch first, and ${ae}. Nothing reaches main before then.${ke}`,action_label:"Join the main queue"})&&await $("merge",A)},E=async A=>{const I=N(A);await g({title:`Remove ${A.name}?`,description:`This deletes the folder ${A.path}${I!==void 0?` and frees about ${Ru(I)}`:""}.${A.branch?` Its branch ${A.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 ${A.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})&&(I!==void 0&&(y.current[A.path]=I),await $("remove",A))},k=async A=>{await t.dismiss(A),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(ta,{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(sn,{title:"Worktrees",description:B}),!n&&!r&&s.jsx(O8,{}),r?s.jsx(D8,{refusal:r,read_at:n==null?void 0:n.read_at,on_retry:()=>void w()}):null,n!=null&&n.stale?s.jsxs(oe,{variant:"destructive",className:"mt-4",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:"Could not read worktrees"}),s.jsxs(ce,{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(A=>s.jsxs(oe,{variant:"success",className:"mt-4",role:"status",children:[s.jsx(ge,{children:y.current[A.path]!==void 0?`Removed ${A.name} and freed ${Ru(y.current[A.path])}`:`Removed ${A.name}`}),s.jsxs(ce,{children:[s.jsx("p",{children:A.branch?`Its branch ${A.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:A.path}),children:"Dismiss"})]})]},A.path)),n&&_.length===0?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(n_,{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(pt,{type:"search",className:"w-64","aria-label":"Search worktrees",placeholder:"Search worktrees",value:h,onChange:A=>x(A.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:Yh.map(A=>s.jsxs(P,{type:"button",variant:"outline",size:"sm",className:vo,"aria-pressed":f===A.id,onClick:()=>m(A.id),children:[A.label," ",_.filter(I=>Fh(I,A.id)).length]},A.id))}),R.length===0?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(Qd,{className:"text-muted-foreground size-8","aria-hidden":"true"}),s.jsx("h2",{className:"text-lg font-semibold",children:"No worktrees match"}),G?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-muted-foreground text-sm",children:["No ",(M=Yh.find(A=>A.id===f))==null?void 0:M.empty," matches “",h,"”. Clear the search to see all"," ",_.filter(A=>Fh(A,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 ",(Y=Yh.find(A=>A.id===f))==null?void 0:Y.empty," right now."]})]}):s.jsx(mt,{className:"mt-4 shrink-0 overflow-x-auto",children:s.jsxs(Fe,{containerAriaLabel:"Worktrees",className:"table-fixed",children:[s.jsx(Qe,{children:s.jsxs(ue,{children:[s.jsx(F,{className:"w-[24%]",children:"Worktree"}),s.jsx(F,{className:"w-[24%]",children:"Threads"}),s.jsx(F,{className:"w-[12%]",children:"Landed"}),s.jsx(F,{className:"w-[18%]",children:"Cleanup"}),s.jsx(F,{className:"hidden w-[10%] md:table-cell",children:"Last commit"}),s.jsx(F,{className:"w-[12%] text-right",children:"Actions"})]})}),s.jsx(Ke,{children:R.map(A=>s.jsx(z8,{org:e,row:A,size:N(A),sizes:i!==null?"read":c?"failed":"measuring",can_write:n.can_write,sent:j[A.path],on_merge:()=>void T(A),on_remove:()=>void E(A),on_dismiss:I=>void k(I),on_clear_sent:()=>v(({[A.path]:I,...X})=>X)},A.path))})]})})]}):null,p]})}function O8(){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(Ct,{className:t===5?"h-10 w-2/3":"h-10 w-full"},t))})}function D8({refusal:e,read_at:t,on_retry:n}){const a=as();return e.reason==="view_outdated"?s.jsxs(oe,{variant:"warning",className:"mt-6",children:[s.jsx(Ut,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:el}),s.jsx(ce,{children:a})]}):s.jsxs(oe,{variant:"destructive",className:"mt-6",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:"Could not read worktrees"}),s.jsxs(ce,{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 su({children:e,muted:t=!0}){return s.jsx("div",{className:de("truncate text-xs",t&&"text-muted-foreground"),title:e,children:e})}function z8({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:m}=Ze(),h=e?`/org/${encodeURIComponent(e)}`:"",x=f(`${h}/threads`),j=f(`${h}/tasks`),v=Vi[t.landed??"not_landed"],y=Vg(t),g=t.write,p=(g==null?void 0:g.state)==="waiting"||(g==null?void 0:g.state)==="running",b=t.threads.find(B=>"thread"in t.merge&&B.thread===t.merge.thread)??t.threads[0],w=t.merge,S=!w.offered&&w.why===Gg,C=r&&t.landed===null&&!t.queue&&!S&&!Yg(t),_=n!==void 0?Ru(n):a==="measuring"?"Measuring size…":a==="failed"?"Size could not be read":null,N=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]},O=N.second.filter(Boolean).join(" · "),D=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(q,{children:[s.jsx("div",{className:"truncate font-medium",title:t.name,children:t.name}),s.jsx(su,{children:t.branch??"Detached"}),D!==".sdlc-worktrees"?s.jsx(su,{children:`in ${D}`}):null]}),s.jsx(q,{children:b?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"truncate",title:b.title??b.thread,children:b.title??b.thread}),s.jsx(su,{children:`${A8(t,b)}${t.threads.length>1?` · ${t.threads.length-1} more`:""}`})]}):s.jsx("span",{className:"text-muted-foreground",children:"No thread"})}),s.jsx(q,{children:s.jsx(fe,{variant:v.tone,children:v.label})}),s.jsxs(q,{children:[s.jsx("div",{className:de("truncate",N.muted&&"text-muted-foreground"),children:N.label}),O?s.jsx("div",{className:"hidden md:block",children:s.jsx(su,{children:O})}):null]}),s.jsx(q,{className:"hidden md:table-cell",children:E8(t.idle_days)}),s.jsx(q,{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(fe,{variant:Vi.queued.tone,children:`${Vi.queued.label} · ${u2(t.queue.position)}`}):S?s.jsx(m,{href:j,"aria-label":`${t.name}: its thread waits on you, in Waiting on you`,children:s.jsx(fe,{variant:Vi.needs_you.tone,children:Vi.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:de(!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(L8,{row:t,threads:x,tasks:j,merge_shown:C,sent:l,on_dismiss:c,on_clear_sent:d})]})}function L8({row:e,threads:t,tasks:n,merge_shown:a,sent:r,on_dismiss:l,on_clear_sent:i}){var j,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,m=e.threads.find(p=>p.thread===("thread"in e.merge?e.merge.thread:void 0))??e.threads[0],h=(m==null?void 0:m.title)??"Its thread";let x=null;if(r)x=s.jsxs(oe,{variant:"destructive",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:"It was not sent"}),s.jsxs(ce,{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=((j=f.lands)==null?void 0:j.by)==="manager"?`the merge manager, ${f.lands.manager}, lands it`:"it lands it on its turn";x=s.jsxs(oe,{variant:f.told?"success":"warning",role:"status",children:[s.jsx(ge,{children:`${e.name} joined the main queue, ${u2(f.position)}`}),s.jsxs(ce,{children:[s.jsx("p",{children:f.told?`${h} 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 ${Kh(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(oe,{variant:"destructive",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:f.kind==="merge"&&f.state==="failed"?`${e.name} did not join`:p}),s.jsxs(ce,{children:[s.jsx("p",{children:`${to(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(oe,{variant:"warning",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ge,{children:`${e.name}'s turn ${p.outcome==="failed"?"failed":"passed on"} at ${Kh(p.left_at)}`}),s.jsxs(ce,{children:[s.jsx("p",{children:`${to(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 ${Kh(e.queue.passes_at)}. `,c()]}):!e.merge.offered&&e.merge.why===Gg?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:[`${to(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:`${to(e.merge.caveat)}.`}));return x?s.jsx(ue,{className:"hover:bg-transparent",children:s.jsx(q,{colSpan:6,className:"pt-0",children:x})}):null}const U8=["reason","since","store","repository","folder","home","member_path"];function Df(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 U8){const r=t==null?void 0:t[a];typeof r=="string"&&(n[a]=r)}return n}function xr({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:Df(i.status,o)}}}function B8(e={}){const t=xr(e),n=zf(e),a=P8(e),r=i=>async()=>{const o=await t("access");return o.ok?{ok:!0,data:o.data[i]}:o},l=encodeURIComponent;return{tasks:{access:r("tasks"),configuration:()=>t("tasks/configuration"),listTasks:i=>t(`tasks/lists/${l(i)}/tasks`),task:i=>t(`tasks/tasks/${l(i)}`)},issues:{access:r("issues"),list:(i={})=>t("issues",i),issue:i=>t(`issues/${l(i)}`),issueSections:i=>t(`issues/${l(i)}/sections`),issueRelated:i=>t(`issues/${l(i)}/related`),openAnchor:i=>n("open-anchor",i),report:i=>n("issue-report",i),reportCollections:()=>a("issue-collections")},releases:{access:r("releases"),list:()=>t("releases"),release:i=>t(`releases/${l(i)}`),candidate:()=>t("releases/candidate")},organizations:{access:r("organizations"),list:()=>t("orgs")},projects:{access:r("projects"),list:()=>t("projects")},about:{about:()=>t("about")}}}function I8(e={}){const t=xr(e),{base:n="",fetcher:a=fetch}=e;return{timing:async()=>{let l;try{l=await a(`${n}api/queues`,{cache:"no-store"})}catch{return Va("The viewer did not answer. Is sdlc viewer still running?")}const i=await l.json().catch(()=>null);return l.ok?(i==null?void 0:i.state)!=="ready"?Va(typeof(i==null?void 0:i.error)=="string"&&i.error?i.error:"The work queues could not be read."):{ok:!0,data:H8(i)}:{ok:!1,refusal:Df(l.status,i)}},listQueues:()=>t("queues"),queue:l=>t(`queues/${encodeURIComponent(l)}`),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 Va=e=>({ok:!1,refusal:{status:0,message:e}}),ln=e=>typeof e=="string"&&e?e:void 0;function H8(e){const t=Array.isArray(e==null?void 0:e.cards)?e.cards:[];return{caption:ln(e==null?void 0:e.caption)??"",queues:t.map(n=>{var c,d;const a=Array.isArray(n.captions)?n.captions.filter(f=>typeof f=="string"):[],r=Array.isArray(n.notes)?n.notes:[],l=n.key==="heavy",i=ln((c=r.find(f=>f.kind==="memory"))==null?void 0:c.text),o=(Array.isArray(n.rows)?n.rows:[]).map(f=>{var y;const m=Array.isArray(f.parts)?f.parts:[],h=g=>{var p;return ln((p=m.find(b=>b.kind===g))==null?void 0:p.text)},x=(ln(f.detail)??"").split(" · "),j=ln(f.estimate)??(m.length||!ln(f.estimateTitle)?void 0:x.at(-1)),v=l&&!m.length&&x.length>=4&&/^\d+(\.\d+)? GB$/.test(x[2]);return{position:typeof f.position=="number"?f.position:0,execution:ln(f.execution),key:ln(f.key),title:ln(f.title)??"",turn:ln(f.turn)??"Waiting",elapsed:h("elapsed")??x[0]??"",estimate:j??(v?x.at(-1):void 0),basis:ln(f.estimateTitle),command:ln((y=m.find(g=>g.kind==="command"))==null?void 0:y.title)??h("command")??(v?x[1]:void 0),memory:h("memory")??(v?x[2]:void 0),reason:h("reason")}});return{key:ln(n.key)??"",name:ln(n.name)??"",clears:ln(n.clears),basis:l?void 0:a[1],memory:l?(i==null?void 0:i.replace(/^memory: /,""))??((d=a[0])==null?void 0:d.split(" · ").at(-1)):void 0,error:ln(n.error)??(l&&n.summary==="Not available"?"no answer":void 0),rows:o}})}}function P8({base:e="",fetcher:t=fetch}){return async n=>{let a;try{a=await t(`${e}api/${n}`,{cache:"no-store"})}catch{return Va("The viewer did not answer. Is sdlc viewer still running?")}const r=await a.json().catch(()=>null);return a.ok?{ok:!0,data:r}:{ok:!1,refusal:Df(a.status,r)}}}async function q8({base:e="",fetcher:t=fetch}={}){try{return(await t(`${e}api/issue-report`,{method:"HEAD",cache:"no-store"})).ok}catch{return!1}}function zf({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 Va("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:Df(r.status,l)}}}function G8(e={}){const t=xr(e),n=zf(e);return{chart:()=>t("org"),change:a=>n("org-change",a)}}function V8(e={}){const t=xr(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(m=>m.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,m;return c.state==="archived"?Promise.resolve(Va("This checkout keeps no archived tasks.")):c.assigned_to_me?Promise.resolve(Va("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:(m=c.all_groups)!=null&&m.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()=>Va("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 Va("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 Y8(e={}){const t=xr(e),n=zf(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 F8(e={}){const t=xr(e),n=zf(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 K8(e={}){const t=xr(e);return{report:n=>t("blockers",n!=null&&n.fresh?{fresh:1}:{})}}function X8(e={}){const t=xr(e);return{overview:()=>t("workspaces")}}const W8=new Set(["not_terminal","another_process","continued","no_open","pending"]);function Q8(e){return e==="terminal_denied"?"you":W8.has(e)?"muted":"alert"}function Z8(e){return e.replace(/\.*$/,".")}function Dy(e){return e.commands?{...e,commands:{...e.commands,open_thread:(t,n)=>J8(t,n)}}:e}async function J8(e,t,n=a2){let a=!1;for(;;){const r=await n(e,a);if("done"in r)return{opened:!0};const{reason:l,error:i,where:o}=r.refused;if(l==="closed"&&!a){if(!await t(o))return{declined:!0};a=!0;continue}return{note:{text:Z8(i),role:Q8(l),...l==="outdated"?{outdated:!0}:{}}}}}const d2=[["stage","Stage"],["blocker","Blocker"],["recent","Recent"]],eB=10,f2="Threads you pinned; they stay first in every order";function kp(e,t,n){var G,U;const{order:a,folded:r,showAll:l,narrowed:i,max:o=eB}=n,c=new Map(e.map(R=>[R.key,R])),d=R=>R.pinned===!0,f=R=>{var T;if(d(R)||!R.blockedBy||!c.has(R.blockedBy))return!1;const $=new Set([R.key]);for(let E=R.blockedBy;E&&c.has(E);E=(T=c.get(E))==null?void 0:T.blockedBy){if($.has(E))return!1;$.add(E)}return!0},m=new Map;for(const R of e){if(!f(R))continue;const $=m.get(R.blockedBy)??[];$.push(R),m.set(R.blockedBy,$)}const h=R=>m.get(R.key)??[],x=R=>Math.max(R.mtimeMs??0,...h(R).map(x)),j=R=>!!R.needsYou||h(R).some(j),v=R=>R.activeSince!==void 0,y=(R,$)=>v(R)!==v($)?v(R)?-1:1:j(R)!==j($)?j(R)?-1:1:v(R)?R.activeSince-$.activeSince||R.key.localeCompare($.key):x($)-x(R),g=(R,$)=>Number(v($))-Number(v(R))||(v(R)?$.activeSince-R.activeSince:($.mtimeMs??0)-(R.mtimeMs??0))||R.key.localeCompare($.key),p=l||i,b=!i,w=(R,$=0)=>a==="blocker"?[{row:R,depth:$},...h(R).flatMap(T=>w(T,$+1))]:[{row:R,depth:0}],S=R=>a==="blocker"?1+h(R).reduce(($,T)=>$+S(T),0):1,C=R=>R.reduce(($,T)=>$+S(T),0),_=(R,$,T,E,k,M)=>{const Y=!k||!r.has(R);return{key:R,label:$,...M?{hint:M}:{},count:E,folds:k,open:Y,rows:Y?T.flatMap(A=>w(A)):[]}},N=e.filter(d),O=e.filter(R=>!d(R)),D=[];N.length&&D.push(_("pinned","Pinned",N,C(N),b,f2));let B=null;if(a==="stage"){const R=new Set(t.map(([E])=>E)),$=new Map(t.map(([E])=>[E,[]]));for(const E of O)(G=$.get(E.stage&&R.has(E.stage)?E.stage:"none"))==null||G.push(E);for(const[E,k,M]of t){const Y=($.get(E)??[]).sort(y);if(!Y.length)continue;const A=E==="none"&&!p?Y.slice(0,o):Y;D.push({..._(E,k,A,Y.length,b&&E!=="none",M),count:Y.length})}const T=((U=$.get("none"))==null?void 0:U.length)??0;!i&&T>o&&(B={total:T,unstaged:!0})}else{const R=a==="recent"?[...O].sort(g):O.filter($=>!f($)).sort(y);if(R.length){const $=p?R:R.slice(0,o),T=_("others",N.length?"Other threads":null,$,C(R),!!N.length&&b);D.push(T),!i&&T.open&&R.length>o&&(B={total:R.length,unstaged:!1})}}return{groups:D,more:B}}function tB(e,t,n,a){const l=kp(e,t,{...n,folded:new Set,showAll:!0}).groups.find(c=>c.rows.some(d=>d.row.key===a));if(!l)return null;const o=!kp(e,t,{...n,folded:new Set}).groups.some(c=>c.rows.some(d=>d.row.key===a));return{group:l.key,capped:o}}const nB=15e3,sB=10,zy="idle-sessions-list",Ly="idle-sessions-heading",Uy="idle-sessions-confirm-text";function h2(e){return e>=1024?`${(e/1024).toFixed(1)} GB`:`${Math.round(e)} MB`}const aB=e=>`${Number.isInteger(e)?e:e.toFixed(1)} h`,m2=e=>e===1?"1 session":`${e} sessions`;function rB(e){const t=e.released.length?`Closed ${m2(e.released.length)}.`:"Closed no sessions.";return e.kept.length?`${t} Kept ${e.kept.length}:`:t}function lB({row:e}){const t=[e.name,e.retired?"continued in another session":"",`idle ${aB(e.idle_hours)}`,h2(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 iB(){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,m]=u.useState(""),h=u.useRef(""),x=u.useRef(null),j=u.useRef(null),v=u.useRef(null),y=u.useRef(null),g=u.useRef(0),p=u.useRef(0),b=u.useCallback(async()=>{const U=++g.current,R=await OU();if(!R||U<p.current)return;p.current=U,m("");const $=JSON.stringify(R);$!==h.current&&(h.current=$,t(R))},[]);u.useEffect(()=>{const U=setTimeout(b,0),R=setInterval(b,nB);return()=>{clearTimeout(U),clearInterval(R)}},[b]),u.useEffect(()=>{var R;const U=y.current;U&&(y.current=null,(R={cancel:j,close:x,dismiss:v}[U].current)==null||R.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 S=()=>{i===null&&(l(!0),y.current="cancel")},C=()=>{i===null&&(l(!1),y.current="close")},_=async()=>{if(i!==null)return;o(w),d(null),m("");const U=await DU();p.current=g.current+1,await b(),o(null),l(!1),a(!1),"error"in U?(m(`The sessions were not closed: ${U.error.replace(/\.+$/,"")}.`),y.current="close"):(d(U.done),y.current="dismiss")},N=()=>{d(null),y.current="close"},O=U=>{U.key==="Escape"&&(U.preventDefault(),C())},D=i!==null?`Closing ${m2(i)}…`:c?rB(c):"",B=(e==null?void 0:e.sessions.slice(0,sB))??[],G=w-B.length;return s.jsxs("div",{className:"idle",role:"group",...w?{"aria-labelledby":Ly}:{"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:Ly,"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 · ",h2(e.memory_mb)]})]}),s.jsxs("div",{className:"tools",children:[s.jsx("button",{type:"button",className:"pin","aria-expanded":n,"aria-controls":zy,"aria-label":n?"Hide the idle sessions list":"Show the idle sessions list",onClick:()=>a(U=>!U),children:n?"Hide":"Show"}),s.jsx("button",{type:"button",className:"pin",ref:x,"aria-expanded":r,"aria-label":"Close idle sessions…",onClick:S,children:"Close idle…"})]})]}),w>0&&s.jsxs("ul",{className:"idle-list",id:zy,hidden:!n,"aria-label":`Sessions idle over ${e==null?void 0:e.idle_over} hours, longest idle first`,children:[B.map(U=>s.jsx(lB,{row:U},U.session)),G>0&&s.jsx("li",{children:s.jsxs("p",{className:"caption muted",children:["…and ",G," more"]})})]}),r&&w>0&&s.jsxs("div",{className:"idle-confirm",role:"group","aria-label":"Close idle sessions","aria-describedby":Uy,onKeyDown:O,children:[s.jsxs("p",{id:Uy,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:j,"aria-disabled":i!==null?!0:void 0,onClick:C,children:"Cancel"})]})]}),s.jsx("p",{className:"idle-status",role:"status",children:D}),c&&s.jsxs(s.Fragment,{children:[c.kept.length>0&&s.jsx("ul",{className:"idle-list","aria-label":"Kept sessions",children:c.kept.map(U=>s.jsxs("li",{children:[s.jsx("p",{className:"idle-name",children:U.title}),s.jsx("p",{className:"caption muted",children:U.why})]},U.session))}),s.jsx("div",{className:"tools start",children:s.jsx("button",{type:"button",className:"pin",ref:v,"aria-label":"Dismiss the close result",onClick:N,children:"Dismiss"})})]})]})}const By={ok:"lime",you:"amber",alert:"red",waiting:"blue",blocked:"purple",muted:"grey",plain:"grey"};function Ti(e){return e&&Object.hasOwn(By,e)?By[e]:"grey"}const oB=1e4,cB=6e4,uB=2,Xh="#thread-",dB=["pin","archive-thread","details-toggle","holds-toggle"],fB=2e4,hB=300,mB="Its work goes to whoever carries it on, or it stays in the list as left work if nobody can.",pB=i_("Threads"),xB={working:"▶",prod:"↑",planned:"○"},Iy=3,au=2,Hy=["working","ready","prod","waiting","blocked","paused","planned"],gB={ready:"results ready",prod:"ready for prod"};function vB(e){const t=Hy.map(a=>[a,e.filter(r=>r.state===a).length]),n=[...new Set(e.map(a=>a.state).filter(a=>!Hy.includes(a)))].map(a=>[a,e.filter(r=>r.state===a).length]);return[...t,...n].filter(([,a])=>a>0).map(([a,r])=>`${r} ${gB[a]??a}`).join(" · ")}const jB={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 yB(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 Sp=[["running","Running"],["you","Needs you"],["blocked","Blocked"],["paused","Paused"],["idle","Idle"]],Cp=[["claude","Claude"],["codex","Codex"]],Py={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"},qy=e=>e.kind??"idle",Gy=e=>e.agent==="Codex"?"codex":"claude";function Vy(e,t,n,a){const r=n.toLowerCase().split(/\s+/).filter(Boolean),l=Sp.map(([v])=>v).filter(v=>a.has(v)),i=Cp.map(([v])=>v).filter(v=>a.has(v)),o=v=>!l.length||l.includes(qy(v)),c=v=>!i.length||i.includes(Gy(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),m={};for(const[v]of Sp)m[v]=f.filter(y=>c(y)&&qy(y)===v).length;for(const[v]of Cp)m[v]=f.filter(y=>o(y)&&Gy(y)===v).length;const h=[],x=[],j=[];return e.forEach((v,y)=>{j.length=Math.min(j.length,v.depth);const g=v.depth>0?j[v.depth-1]??null:null,p=d(v)&&o(v)&&c(v);let b=null;p&&(b=g?{depth:g.depth+1,pinned:g.pinned}:{depth:0,pinned:y<t&&v.pinned!==!1},(b.pinned?h:x).push({row:v,depth:b.depth})),j.push(b)}),{rows:[...h,...x],pinned:h.length,counts:m,narrowed:r.length+l.length+i.length>0}}const p2="sdlc-viewer:threads-arrange",Yy={order:"blocker",compact:!1,folded:[],showAll:!1,archived:!1};function bB(){try{const e=JSON.parse(window.localStorage.getItem(p2)??"{}");return{order:d2.some(([t])=>t===e.order)?e.order:Yy.order,compact:e.compact===!0,folded:Array.isArray(e.folded)?e.folded.filter(t=>typeof t=="string"):[],showAll:e.showAll===!0,archived:e.archived===!0}}catch{return Yy}}function wB(e){try{window.localStorage.setItem(p2,JSON.stringify(e))}catch{}}const _B=new Set(["not_terminal","another_process","continued","no_open","pending"]);function Wh({label:e,count:t,hint:n,fold:a}){const r=n?`hint-${e.toLowerCase().replace(/\W+/g,"-")}`:void 0;return s.jsxs(s.Fragment,{children:[a?s.jsx("h2",{className:"group",children:s.jsxs("button",{type:"button",className:"group-fold","aria-expanded":a.open,"aria-label":`${e}, ${t}`,"aria-describedby":r,onClick:a.onToggle,children:[s.jsx("span",{className:"chevron","aria-hidden":"true",children:a.open?"▾":"▸"}),e,s.jsx("span",{className:"count",children:t})]})}):s.jsxs("h2",{className:"group","aria-label":`${e}, ${t}`,"aria-describedby":r,children:[e,s.jsx("span",{className:"count",children:t})]}),n&&s.jsx("span",{className:"sr-only",id:r,children:n})]})}function ru({text:e,role:t}){return s.jsx("span",{className:`badge tone-${Ti(t)}`,children:e})}function NB({serves:e}){const t=e.slice(0,uB),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"]})]})]})}const kB=4;function Fy({track:e}){return s.jsxs("span",{className:"track",children:[s.jsx("span",{className:"track-dots","aria-hidden":"true",children:Array.from({length:kB},(t,n)=>s.jsx("span",{className:["track-dot",n<=e.reached?"reached":"",n===e.target?"target":""].filter(Boolean).join(" ")},n))}),e.label,e.detail&&s.jsxs("span",{className:"sr-only",children:[". ",e.detail]})]})}function SB({tags:e,track:t,brief:n=!1}){const a=t?Math.min(Math.max(t.at??e.length,0),e.length):-1,r=n?e.filter(i=>!i.full):e,l=t?a-(n?e.slice(0,a).filter(i=>i.full).length:0):-1;return s.jsxs(s.Fragment,{children:[r.map((i,o)=>s.jsxs(u.Fragment,{children:[o===l&&t&&s.jsxs(s.Fragment,{children:[" ",s.jsx(Fy,{track:t})]})," · ",s.jsxs("span",{className:`tag tone-${Ti(i.role)}`,children:[i.text,i.detail&&s.jsxs("span",{className:"sr-only",children:[". ",i.detail]})]})]},`t${o}`)),l===r.length&&t&&s.jsxs(s.Fragment,{children:[" ",s.jsx(Fy,{track:t})]})]})}function Ky({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 CB({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),[m,h]=u.useState(null),[x,j]=u.useState(""),[v,y]=u.useState(!1),[g,p]=u.useState(null),[b,w]=u.useState(null),[S,C]=u.useState(""),_=u.useRef(null),[N,O]=u.useState(0),D=u.useRef(new Map),B=u.useRef(new Map),G=u.useRef(null),[U,R]=u.useState(null),[$,T]=u.useState(null),[E,k]=u.useState(null),[M,Y]=u.useState(""),[A,I]=u.useState(()=>new Set),[X,J]=u.useState(null),[ae,ke]=u.useState(bB),Q=z=>ke(te=>{const ne={...te,...z};return wB(ne),ne}),[ee,Ce]=u.useState({groups:[],all:!1}),[se,Se]=u.useState(()=>new Set),[me,be]=u.useState(()=>new Set),ve=u.useRef(ae.archived),Ae=u.useRef(0),Z=u.useRef(null),je=u.useRef(""),Ee=u.useRef(""),Pe=u.useRef(""),ie=u.useRef(null),We=u.useRef(null),Ve=u.useRef(null),H=z=>{var ne;if(!(z instanceof HTMLButtonElement)||!((ne=ie.current)!=null&&ne.contains(z))||!z.dataset.key)return null;const te=dB.find(pe=>z.classList.contains(pe));return te?`${te} ${z.dataset.key}`:null},we=z=>{Ve.current=H(z.target)},at=()=>{setTimeout(()=>{H(document.activeElement)||(Ve.current=null)},0)},Bt=u.useCallback(async()=>{const z=++Ae.current,te=await s2(ve.current);if(z!==Ae.current)return;const ne=_.current;if(ne&&z>ne.after&&O($e=>$e+1),"none"in te){i(!0),c(""),e("live");return}if("error"in te){c(te.error),e("disconnected");return}i(!1),c(""),j(""),C(""),e("live");const pe=JSON.stringify(te.data);pe!==je.current&&(je.current=pe,r(te.data))},[e]);u.useEffect(()=>{let z=!0;const te=B.current;MU().then($e=>z&&f($e)),zU().then($e=>z&&y($e));const ne=setTimeout(Bt,0),pe=setInterval(Bt,oB);return()=>{z=!1,clearTimeout(ne),clearInterval(pe);for(const $e of te.values())clearTimeout($e);te.clear()}},[Bt]),u.useEffect(()=>{let z=!0;const te=()=>$U().then(pe=>{z&&pe&&R($e=>JSON.stringify($e)===JSON.stringify(pe)?$e:pe)});te();const ne=setInterval(te,cB);return()=>{z=!1,clearInterval(ne)}},[]),u.useEffect(()=>{const z=()=>{var Et,Pn,qn;const ne=window.location.hash;if(!ne.startsWith(Xh)){k(null);return}if(ne===Ee.current)return;let pe;try{pe=decodeURIComponent(ne.slice(Xh.length))}catch{pe=ne.slice(Xh.length)}const $e=document.getElementById(`thread-${pe}`);if(!$e||!((Et=ie.current)!=null&&Et.contains($e))){if(!ie.current||!a)return;const ws=Pe.current!==ne;if(Pe.current=ne,a.threads.some(Ai=>Ai.key===pe)){const Ai=(M||A.size)&&!Vy(a.threads,a.pinnedCount??0,M,A).rows.some(V=>V.row.key===pe),na=a.stages&&(ws||!Ai)?tB(a.threads,a.stages,{order:ae.order,folded:new Set,showAll:!1,narrowed:!1},pe):null,$i=na!==null&&ae.folded.includes(na.group)&&!ee.groups.includes(na.group),al=na!==null&&na.capped&&!ae.showAll&&!ee.all;ws&&(M||A.size)&&(Y(""),I(new Set)),ws&&(M||A.size)||$i||al?($i||al)&&Ce(V=>({groups:$i&&na?[...V.groups,na.group]:V.groups,all:V.all||al})):Ee.current=ne,k(null);return}k(pe);return}Ee.current=ne,k(null),T(pe),(Pn=$e.querySelector(".thread-title"))==null||Pn.focus({preventScroll:!0}),(qn=$e.scrollIntoView)==null||qn.call($e,{block:"center"})},te=()=>{Ee.current="",Pe.current="",z()};return z(),window.addEventListener("hashchange",te),()=>window.removeEventListener("hashchange",te)},[a,M,A,ae,ee]),u.useEffect(()=>{if(!$)return;const z=()=>T(null);return document.addEventListener("pointerdown",z,!0),document.addEventListener("keydown",z,!0),()=>{document.removeEventListener("pointerdown",z,!0),document.removeEventListener("keydown",z,!0)}},[$]),u.useLayoutEffect(()=>{const z=Ve.current??(We.current?`pin ${We.current}`:null);if(!z||!ie.current)return;const[te,ne]=[z.slice(0,z.indexOf(" ")),z.slice(z.indexOf(" ")+1)],pe=document.activeElement;if(pe&&pe!==document.body&&!ie.current.contains(pe)){Ve.current=null;return}const $e=[...ie.current.querySelectorAll(`button.${te}`)].find(Et=>Et.dataset.key===ne);$e?pe!==$e&&$e.focus({preventScroll:ne!==We.current}):Ve.current=null}),u.useLayoutEffect(()=>{var Pn;const z=_.current;if(!z||!ie.current)return;_.current=null;const te=[...ie.current.querySelectorAll("button.archive-thread")].find(qn=>qn.dataset.key===z.key);if(te){te.focus();return}const ne=z.order.indexOf(z.key),$e=[...z.order.slice(ne+1),...z.order.slice(0,Math.max(ne,0)).reverse()].map(qn=>document.getElementById(`thread-${qn}`)).find(qn=>{var ws;return qn&&((ws=ie.current)==null?void 0:ws.contains(qn))}),Et=$e==null?void 0:$e.querySelector(".thread-title");Et?Et.focus():(Pn=G.current)==null||Pn.focus()},[N]);const Qt=async z=>{if(m)return;const te=!z.pinned;We.current=z.key,h(z.key);const ne=await IU(z.key,te);h(null),ne||r(pe=>pe&&{...pe,threads:pe.threads.map($e=>$e.key===z.key?{...$e,pinned:te}:$e)}),await Bt(),j(ne?`The pin was not saved: ${ne}`:""),We.current===z.key&&(We.current=null)},[jt,it]=u.useState(()=>new Set),[an,rn]=u.useState({}),Bn=as(),{confirm:Vt,confirm_dialog:fn}=vi(),re=(z,te)=>rn(ne=>{const{[z]:pe,...$e}=ne;return te?{...$e,[z]:te}:$e}),K=(z,te)=>it(ne=>{const pe=new Set(ne);return te?pe.add(z):pe.delete(z),pe}),he=Object.keys(an).some(z=>!jt.has(z));u.useEffect(()=>{if(!he)return;const z=()=>rn(te=>Object.fromEntries(Object.entries(te).filter(([ne])=>jt.has(ne))));return document.addEventListener("pointerdown",z,!0),document.addEventListener("click",z,!0),()=>{document.removeEventListener("pointerdown",z,!0),document.removeEventListener("click",z,!0)}},[he,jt]);const Ue=z=>setTimeout(()=>{var te,ne;return(ne=[...((te=ie.current)==null?void 0:te.querySelectorAll("button.open-thread"))??[]].find(pe=>pe.dataset.key===z))==null?void 0:ne.focus()},0),dt=async(z,te)=>{const ne=await Vt({title:`Reopen ${z.title} in Terminal?`,description:`Its session is closed. It opens in a new Terminal window in ${te??"the thread's folder"}, running claude --resume.`,action_label:"Reopen"});return Ue(z.key),ne},Rn=z=>{const te=D.current.get(z);if(te&&Date.now()-te.at<fB)return te.detail;const ne=UU(z).then(pe=>((pe===null||pe.failed)&&D.current.delete(z),(pe==null?void 0:pe.detail)??null));return D.current.set(z,{at:Date.now(),detail:ne}),ne},Zt=z=>setTimeout(()=>{var te,ne;return(ne=[...((te=ie.current)==null?void 0:te.querySelectorAll("button.archive-thread"))??[]].find(pe=>pe.dataset.key===z))==null?void 0:ne.focus()},0),L=async z=>{var $e;if(g||b)return;const te=z.archiveAction==="archive";if(te){w(z.key);const Et=await Rn(z.key);w(null);const Pn=await Vt({title:`Archive ${z.title}?`,description:Et??mB,action_label:"Archive"});if(Zt(z.key),!Pn){D.current.delete(z.key);return}}const ne=[...(($e=ie.current)==null?void 0:$e.querySelectorAll("article.thread"))??[]].map(Et=>Et.id.slice(7));p(z.key);const pe=await BU(z.key,te);D.current.delete(z.key),p(null),_.current={key:z.key,order:ne,after:Ae.current},await Bt(),C(pe?`The archive was not saved: ${pe.replace(/\.*$/,".")}`:"")},Te=async z=>{if(jt.has(z.key))return;let te=!1;for(;;){K(z.key,!0),re(z.key,{key:z.key,text:jB[z.where??""]??"Opening.",role:"waiting"});const ne=await a2(z.key,te);if(K(z.key,!1),"done"in ne){re(z.key,null);return}const{reason:pe,error:$e,where:Et}=ne.refused;if(pe==="closed"&&!te){if(re(z.key,null),!await dt(z,Et))return;te=!0;continue}const Pn=pe==="outdated"?`${$e.replace(/\.*$/,".")} ${Bn}`:$e.replace(/\.*$/,"."),qn=pe==="terminal_denied"?"you":_B.has(pe)?"muted":"alert";re(z.key,{key:z.key,text:Pn,role:qn});return}},Le=(a==null?void 0:a.threads)??[],ft=!l&&Le.length>0,hn=Vy(Le,(a==null?void 0:a.pinnedCount)??0,M,A),rs=hn.pinned,In=hn.rows,Hn=Array.isArray(a==null?void 0:a.stages)?a.stages:null,vr=new Set(ae.folded.filter(z=>!ee.groups.includes(z))),Os=ae.showAll||ee.all,ye=Hn?kp(In.map(z=>z.row),Hn,{order:ae.order,folded:vr,showAll:Os,narrowed:hn.narrowed}):null,Je=Hn?(a==null?void 0:a.archived)??0:0,Jt=z=>{Ce(te=>({...te,groups:te.groups.filter(ne=>ne!==z)})),Q({folded:vr.has(z)?ae.folded.filter(te=>te!==z):[...ae.folded.filter(te=>te!==z),z]})},Tn=()=>{Ce(z=>({...z,all:!1})),Q({showAll:!Os})},jr=()=>{const z=!ae.archived;ve.current=z,Q({archived:z}),Bt()},Lf=z=>Se(te=>{const ne=new Set(te);return ne.has(z)?ne.delete(z):ne.add(z),ne}),Uf=z=>be(te=>{const ne=new Set(te);return ne.has(z)?ne.delete(z):ne.add(z),ne}),sl=(z,te)=>s.jsx(RB,{depth:te,row:U!=null&&U[z.key]?{...z,serves:U[z.key]}:z,arrived:$===z.key,pinnable:d&&typeof z.pinned=="boolean",pinning:m,onPin:()=>Qt(z),archiveAction:v?z.archiveAction:void 0,archiving:g,previewing:b,onArchive:()=>L(z),onArchiveHover:ne=>{const pe=B.current,$e=pe.get(z.key);if(!ne){clearTimeout($e),pe.delete(z.key);return}z.archiveAction!=="archive"||$e!==void 0||pe.set(z.key,setTimeout(()=>{pe.delete(z.key),Rn(z.key)},hB))},opening:jt.has(z.key),note:an[z.key]??null,onOpen:()=>Te(z),org:t,project:n,compact:!!Hn&&ae.compact,detailsOpen:se.has(z.key),onDetails:()=>Lf(z.key),holdsOpen:me.has(z.key),onHolds:()=>Uf(z.key)});u.useEffect(()=>{if(!ft)return;const z=te=>{var pe,$e;if(te.key!=="/"||te.ctrlKey||te.metaKey||te.altKey||te.defaultPrevented)return;const ne=document.activeElement;ne&&(/^(INPUT|TEXTAREA|SELECT)$/.test(ne.tagName)||ne.isContentEditable)||document.querySelector('[role="dialog"], [role="alertdialog"], dialog[open]')||(te.preventDefault(),(pe=Z.current)==null||pe.focus(),($e=Z.current)==null||$e.select())};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[ft]);const Ei=z=>I(te=>{const ne=new Set(te);return ne.has(z)?ne.delete(z):ne.add(z),ne}),Bf=()=>{var z;Y(""),I(new Set),(z=Z.current)==null||z.focus()},Sc=(z,te)=>{const ne=hn.counts[z]??0,pe=A.has(z),$e=Py[z];return s.jsxs("button",{type:"button",className:"filter-chip","aria-pressed":pe,"aria-describedby":$e?`chip-hint-${z}`:void 0,disabled:ne===0&&!pe&&X!==z,onFocus:()=>J(z),onBlur:()=>J(Et=>Et===z?null:Et),onClick:()=>Ei(z),children:[te," ",ne]},z)};return s.jsxs(s.Fragment,{children:[fn,s.jsxs("header",{className:"main-head",children:[s.jsx("h1",{ref:G,tabIndex:-1,children:"Threads"}),a&&!l&&s.jsx("p",{className:"muted",children:a.line})]}),s.jsxs("section",{className:"card threads","aria-label":"Threads",children:[s.jsx(iB,{}),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&&s.jsx("div",{className:"alert",role:"alert",children:S}),s.jsx("p",{className:"caption muted not-listed",role:"status",children:E!==null&&!l?Hn?s.jsxs(s.Fragment,{children:["Thread ",E," is not in this list.",!ae.archived&&Je>0?" Show archived lists archived threads.":null]}):s.jsxs(s.Fragment,{children:["Thread ",E," is not in this list. ",s.jsx("code",{children:"sdlc view --all"})," lists older threads."]}):null}),ft&&s.jsxs("div",{className:"threads-toolbar",children:[s.jsxs("div",{className:"threads-find",children:[s.jsxs("div",{className:"search-field",children:[s.jsx("input",{ref:Z,type:"search",placeholder:"Search threads","aria-label":"Search threads","aria-keyshortcuts":"/",value:M,onChange:z=>Y(z.target.value),onKeyDown:z=>{z.key==="Escape"&&(z.preventDefault(),M?Y(""):z.currentTarget.blur())}}),M&&s.jsx("button",{type:"button",className:"search-clear","aria-label":"Clear search",onClick:()=>{var z;Y(""),(z=Z.current)==null||z.focus()},children:s.jsx("span",{"aria-hidden":"true",children:"×"})})]}),Hn&&s.jsx("select",{className:"order-select","aria-label":"Order threads",value:ae.order,onChange:z=>Q({order:z.target.value}),children:d2.map(([z,te])=>s.jsx("option",{value:z,children:te},z))})]}),s.jsxs("div",{className:"filter-row",children:[s.jsx("div",{className:"filter-group",role:"group","aria-label":"Status",children:Sp.map(([z,te])=>Sc(z,te))}),s.jsx("div",{className:"filter-group",role:"group","aria-label":"Agent",children:Cp.map(([z,te])=>Sc(z,te))}),Hn&&s.jsx("button",{type:"button",className:"filter-chip","aria-pressed":ae.compact,onClick:()=>Q({compact:!ae.compact}),children:"Compact"})]}),Object.entries(Py).map(([z,te])=>s.jsx("span",{className:"sr-only",id:`chip-hint-${z}`,children:te},z)),s.jsx("p",{className:"caption muted narrowed",role:"status",children:hn.narrowed?s.jsxs(s.Fragment,{children:[In.length," of ",Le.length," threads ·"," ",s.jsx("button",{type:"button",className:"clear-filters","aria-label":"Clear search and filters",onClick:Bf,children:"Clear"})]}):null})]}),l?s.jsx("p",{className:"muted",children:pB}):s.jsxs("div",{className:"thread-list",ref:ie,onFocus:we,onBlur:at,children:[ye==null?void 0:ye.groups.map(z=>s.jsxs("div",{children:[z.label!==null&&s.jsx(Wh,{label:z.label,count:z.count,hint:z.hint,fold:z.folds?{open:z.open,onToggle:()=>Jt(z.key)}:void 0}),z.rows.map(({row:te,depth:ne})=>s.jsx("div",{children:sl(te,ne)},te.key))]},`group-${z.key}`)),!ye&&In.map(({row:z,depth:te},ne)=>s.jsxs("div",{children:[rs>0&&ne===0&&s.jsx(Wh,{label:"Pinned",count:rs,hint:f2}),rs>0&&ne===rs&&s.jsx(Wh,{label:"Other threads",count:In.length-rs}),sl(z,te)]},z.key)),a&&!Le.length&&s.jsx("p",{className:"muted empty",children:"No threads at work or waiting."}),Le.length>0&&!In.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."]}),(ye==null?void 0:ye.more)&&s.jsx("button",{type:"button",className:"list-more","aria-expanded":Os,onClick:Tn,children:ye.more.unstaged?Os?"Show fewer without a stage":`Show all without a stage (${ye.more.total})`:Os?"Show fewer":`Show all (${ye.more.total})`}),Je>0&&s.jsx("button",{type:"button",className:"list-more",onClick:jr,children:ae.archived?"Hide archived":`Show ${Je} archived`})]})]})]})}function RB({row:e,depth:t,arrived:n,pinnable:a,pinning:r,onPin:l,archiveAction:i,archiving:o=null,previewing:c=null,onArchive:d,onArchiveHover:f,opening:m,note:h,onOpen:x,org:j,project:v,compact:y=!1,detailsOpen:g=!1,onDetails:p,holdsOpen:b=!1,onHolds:w}){const S=y&&!g,C=R=>j?`org/${encodeURIComponent(j)}/tasks/${encodeURIComponent(R)}`:null,_=R=>v?`proj/${encodeURIComponent(v)}/issues/${encodeURIComponent(R)}`:null,N=[e.where||e.agent,e.phase,e.age,e.waitsOn?`waits on ${e.waitsOn}`:""].filter(Boolean).join(" · "),O=yB(e),D=o===e.key?i==="archive"?"Archiving":"Unarchiving":i==="archive"?"Archive":"Unarchive",B=`open-note-${e.key}`,[G,U]=u.useState(!1);return s.jsxs("article",{className:["thread",n?"arrived":"",y?"compact-card":""].filter(Boolean).join(" "),id:`thread-${e.key}`,style:{marginLeft:Math.min(t*22,110)},children:[y&&s.jsx("button",{type:"button",className:"details-toggle","data-key":e.key,"aria-label":`Details of ${e.title}`,"aria-expanded":g,onClick:p,children:s.jsx("span",{"aria-hidden":"true",children:g?"▾":"▸"})}),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(ru,{text:e.carried,role:"waiting"}),e.carriedBatch&&s.jsx(ru,{text:e.carriedBatch.text,role:e.carriedBatch.role})]}):s.jsx(ru,{text:e.status,role:e.role}),e.archived&&s.jsx(ru,{text:"archived",role:"muted"}),O&&s.jsx("button",{type:"button",className:"open-thread","data-key":e.key,"aria-label":`${O}: ${e.title}`,"aria-describedby":B,"aria-disabled":m?!0:void 0,"aria-busy":m?!0:void 0,onClick:()=>{m||x()},children:m?"Opening…":O}),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"}),i&&s.jsx("button",{type:"button",className:"archive-thread","data-key":e.key,"aria-label":`${D} ${e.title}`,"aria-disabled":o||c?!0:void 0,"aria-busy":o===e.key||c===e.key?!0:void 0,onPointerEnter:()=>f==null?void 0:f(!0),onFocus:()=>f==null?void 0:f(!0),onPointerLeave:()=>f==null?void 0:f(!1),onBlur:()=>f==null?void 0:f(!1),onClick:()=>{!o&&!c&&(d==null||d())},children:o===e.key?`${D}…`:D})]})]}),s.jsxs("p",{className:S?"caption muted meta one-line":"caption muted meta",children:[N,s.jsx(SB,{tags:e.tags??[],track:e.track,brief:S})]}),O&&s.jsx("p",{id:B,className:`caption open-note tone-${Ti((h==null?void 0:h.role)??"muted")}`,role:(h==null?void 0:h.role)==="alert"||(h==null?void 0:h.role)==="you"?"alert":"status",children:(h==null?void 0:h.text)??null}),!S&&e.serves&&e.serves.length>0&&s.jsx(NB,{serves:e.serves}),!S&&e.summary&&s.jsx("p",{className:"caption muted",children:e.summary}),!S&&e.carriedDetail&&s.jsx("p",{className:"line",children:e.carriedDetail}),!S&&e.step&&s.jsx(TB,{t:e}),e.lines.length>0&&s.jsx("p",{className:"caption muted lines-summary",children:vB(e.lines)}),S?null:s.jsx(EB,{t:e,nested:t>0,allLines:G,setAllLines:U,allHolds:b,onHolds:w,taskHref:C,issueHref:_})]})}function TB({t:e}){return s.jsxs("p",{className:`caption tone-${Ti(e.stepRole??"muted")}`,children:["step: ",e.step,e.stepEvidence&&s.jsxs(s.Fragment,{children:[" · ",s.jsx("span",{className:"id-text",children:e.stepEvidence})]}),e.stepRecent&&e.stepRecent.length>0&&s.jsxs("span",{className:"sr-only",children:[". Recent steps, newest first: ",e.stepRecent.join("; ")]})]})}function Xy({text:e,role:t,under:n,detail:a,nested:r}){const l=r&&n?n:void 0,i=[l?e:"",a??""].filter(Boolean).join(". ");return s.jsxs("p",{className:`line tone-${Ti(t)}`,children:[l??e,i&&s.jsxs("span",{className:"sr-only",children:[". ",i]})]})}function EB({t:e,nested:t,allLines:n,setAllLines:a,allHolds:r,onHolds:l,taskHref:i,issueHref:o}){return s.jsxs(s.Fragment,{children:[(n?e.lines:e.lines.slice(0,Iy)).map((c,d)=>s.jsxs("p",{className:`line tone-${Ti(c.role)}`,children:[s.jsxs("span",{"aria-hidden":"true",children:[xB[c.state]??"•"," "]}),c.state==="working"&&s.jsx("span",{className:"sr-only",children:"Working: "}),c.task!==void 0&&s.jsx(Ky,{id:c.task,href:i(c.task)}),c.task!==void 0&&c.text?" ":null,c.text]},`l${d}`)),e.lines.length>Iy&&s.jsx("button",{type:"button",className:"lines-more","aria-expanded":n,"aria-label":n?`Show fewer lines of work of ${e.title}`:`Show all ${e.lines.length} lines of work of ${e.title}`,onClick:()=>a(c=>!c),children:n?"Show fewer":`Show all ${e.lines.length}`}),(e.routed??[]).map(c=>s.jsxs("p",{className:"line",children:["routed ",s.jsx(Ky,{id:c.issue,href:o(c.issue)}),c.title?` ${c.title}`:null]},`r${c.issue}`)),e.next&&s.jsxs("p",{className:"caption tone-amber",children:[s.jsx("span",{"aria-hidden":"true",children:"▸ "}),"next (",e.next.state,"): ",e.next.text,s.jsx("span",{className:"sr-only",children:". Say “nn” or approve it in the thread to start it."})]}),e.plannedFor&&s.jsxs("p",{className:"caption tone-grey",children:[s.jsx("span",{"aria-hidden":"true",children:"▸ "}),"planned for ",e.plannedFor.tag,": ",e.plannedFor.text]}),e.reason&&s.jsx(Xy,{...e.reason,nested:t}),(r||!e.holdsAll?e.holds:e.holds.slice(0,au)).map((c,d)=>s.jsx(Xy,{...c,nested:t},`h${d}`)),e.holdsAll&&e.holds.length>au&&s.jsx("button",{type:"button",className:"lines-more holds-toggle","data-key":e.key,"aria-expanded":r,"aria-label":r?`Show fewer holds of ${e.title}`:`+${e.holds.length-au} more holds of ${e.title}`,onClick:l,children:r?"Show fewer holds":`+${e.holds.length-au} more holds`}),(e.holdsMore??0)>0&&s.jsxs("p",{className:"caption tone-grey",children:["+",e.holdsMore," more holds"]}),e.plan&&s.jsx("p",{className:"caption muted",children:e.plan})]})}const AB=5e3;function $B(){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(m=>m.id!==c))},[]),l=u.useCallback((c,d)=>{const f=n.current+=1;t(m=>[...m.filter(h=>h.tone!=="error").slice(-2),{id:f,tone:c,message:d}]),c==="success"&&a.current.set(f,setTimeout(()=>r(f),AB))},[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 x2=/^#(?:(releases)|release=(.+)|planned(?:=(.+))?)$/,MB=/^#task=(.+)$/,OB=/^#issue=(.+)$/,DB=/^iss-\d{1,9}$/;function g2(e){return e.split("/").filter(Boolean).slice(1).join("/")}function zB(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==="blockers"?{page:{kind:"org",page:"blockers"},blockers:!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"),f.delete("reported");const m=f.toString();return{page:{...c,item:d,...m?{list_query:m}:{}},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==="blockers")return{page:{kind:"org",page:"blockers"},org:o,blockers:!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 LB={label:"Local viewer",can:()=>!1},UB={connecting:"Connecting…",live:"Live · refreshes every 10s",disconnected:"Disconnected"},Wy=()=>s.jsx(n2,{title:"Page not found",children:"There is no page at this address in this viewer."});function BB({routeOrg:e}){const{org:t,engine:n}=ss(),{project:a}=kc(),[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(ta,{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"}),UB[r]]}),s.jsx(CB,{onConnection:l,org:(t==null?void 0:t.slug)??e??null,project:a})]})}const gr=()=>s.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"Loading…"});function IB({route:e,navigate:t}){var f;const{org:n,projects:a,loading:r,none:l}=ss(),i=e.page.kind==="project"?e.page.project:null,o=i!==null&&a!==null&&!((f=a.find(m=>m.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(Fo,{project:i});if(c||e.org===void 0&&r)return s.jsx(gr,{});const d=(n==null?void 0:n.slug)??e.org;return d===void 0&&i!==null?s.jsx(Fo,{project:i}):d===void 0&&l?s.jsx(Ri,{}):d===void 0?s.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"Tasks open once the organization reads."}):s.jsx(Iz,{org:d})}function HB({route:e,navigate:t}){const{org:n,loading:a,none:r}=ss(),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(gr,{});const i=(n==null?void 0:n.slug)??e.org;if(i===void 0&&r)return s.jsx(Ri,{});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(WL,{org:i,open:o,path:`/org/${encodeURIComponent(i)}/queues`})}function PB({route:e,navigate:t}){var j;const{org:n,projects:a}=ss(),{project:r,settled:l}=kc(),i=e.project??null,o=i!==null&&a!==null&&!((j=a.find(v=>v.id===i))!=null&&j.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,m]=u.useState(()=>window.location.search.replace(/^\?/,"")),h=u.useCallback(v=>{window.history.replaceState(window.history.state,"",`${window.location.pathname}${v?`?${v}`:""}`),m(v)},[]);if(i!==null&&o)return s.jsx(Fo,{project:i});if(d||i===null&&!l)return s.jsx(gr,{});if(i===null)return s.jsx(Ri,{});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(EL,{org:x,project:i,issue_id:e.issue,from:v,query:f})}return s.jsx(pL,{org:x,project:i,query:f,onQuery:h})}function qB({issue:e,navigate:t,home:n}){const{project:a,settled:r}=kc(),l=a!==null?`proj/${encodeURIComponent(a)}/issues/${encodeURIComponent(e)}`:null;return u.useEffect(()=>{l&&t(l)},[l,t]),l||!r?s.jsx(gr,{}):n}function kc(){var l;const{projects:e,loading:t,none:n,failure:a}=ss();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 GB({navigate:e}){const{project:t,settled:n}=kc(),a=t!==null?`proj/${encodeURIComponent(t)}/releases${window.location.search}`:null;return u.useEffect(()=>{a&&e(a)},[a,e]),a||!n?s.jsx(gr,{}):s.jsx(Ri,{})}function Qy(e){const t=new URLSearchParams(e);return{release:t.get("release"),planned:t.has("planned")?t.get("planned")??"":null}}function VB({route:e}){var f;const{org:t,projects:n,loading:a}=ss(),r=e.page.kind==="project"?e.page.project:"",[l,i]=u.useState(()=>Qy(window.location.search));if(a)return s.jsx(gr,{});if(n!==null&&!((f=n.find(m=>m.id===r))!=null&&f.current))return s.jsx(Fo,{project:r});const c=`/proj/${encodeURIComponent(r)}/releases`,d=m=>{const h=new URLSearchParams;m!=null&&m.startsWith("planned:")?h.set("planned",m.slice(8)):m&&h.set("release",m);const x=h.size>0?`?${h.toString()}`:"";window.history.replaceState(window.history.state,"",`${window.location.pathname}${x}`),i(Qy(x))};return s.jsx(bU,{org:(t==null?void 0:t.slug)??"",query:l,onSelect:d,home:c})}function YB({hash:e,navigate:t,home:n}){const{project:a,settled:r}=kc(),l=x2.exec(e),i=l!=null&&l[2]?Cd(l[2]):null,o=l!=null&&l[3]?Cd(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(gr,{}):n}function Qh({route:e,navigate:t}){const{org:n}=ss();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(Wy,{});else if("threads"in e)l=s.jsx(BB,{routeOrg:e.org});else if("task"in e){const i=new URLSearchParams(window.location.search).get("from");l=s.jsx(j3,{org:encodeURIComponent(e.org),task_id:e.task,from:i})}else"tasks"in e?l=s.jsx(IB,{route:e,navigate:t}):"issues"in e?l=s.jsx(PB,{route:e,navigate:t}):"chart"in e?l=s.jsx(L6,{}):"worktrees"in e?l=s.jsx(M8,{org:(n==null?void 0:n.slug)??e.org}):"workspaces"in e?l=s.jsx(f8,{org:(n==null?void 0:n.slug)??e.org}):"queues"in e?l=s.jsx(HB,{route:e,navigate:t}):"blockers"in e?l=s.jsx(ZU,{org:(n==null?void 0:n.slug)??e.org}):"releasesForward"in e?l=s.jsx(GB,{navigate:t}):"releases"in e?l=s.jsx(VB,{route:e}):a.kind==="home"?l=s.jsx(Ri,{}):a.kind==="project"?l=s.jsx(Fo,{project:a.project}):l=s.jsx(Wy,{});return s.jsx(RU,{page:a,children:l})}function FB({task:e,navigate:t,home:n}){const{org:a,loading:r,none:l,failure:i}=ss(),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(gr,{}):n}const KB=e=>window.location.replace(e);function Cd(e){try{return decodeURIComponent(e)}catch{return null}}function XB({navigate:e=KB,data:t}){const n=zB(g2(window.location.pathname),window.location.search),[a,r]=u.useState(null),{notify:l,toasts:i}=$B(),o=MB.exec(window.location.hash),c=o?Cd(o[1]):null,d=OB.exec(window.location.hash),f=d?Cd(d[1]):null,m=f!==null&&DB.test(f)?f:null,h=x2.test(window.location.hash)?window.location.hash:null,x=o!==null&&c===null||d!==null&&m===null,j="forward"in n?n.forward:null;u.useEffect(()=>{j&&e(j)},[j,e]);const[v,y]=u.useState(!1);u.useEffect(()=>{if(t)return;let w=!0;return q8().then(S=>{w&&y(S)}),()=>{w=!1}},[t]);const g=u.useMemo(()=>{if(t)return null;const w=B8();return{seams:{probe:{source:async()=>({label:"Local workspace"})},shell:w,tasks:Dy(V8()),org:G8(),worktrees:F8(),workspaces:X8(),queues:I8(),blockers:K8(),releases:Y8()},issues:w.issues}},[t]),p=u.useMemo(()=>{if(t||!g)return t;const{report:w,reportCollections:S,...C}=g.issues;return{...g.seams,issues:Dy({...C,...v?{report:w,reportCollections:S}:{},commands:{}})}},[t,g,v]);if(j||"forward"in n||!p.shell)return null;const b=s.jsx(Qh,{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(Q0,{data:p,router:r2,identity:LB,notify:l,children:s.jsx(mA,{shell:p.shell,children:x?s.jsx(Qh,{route:{page:{kind:"not_found"}},navigate:e}):c!==null?s.jsx(FB,{task:c,navigate:e,home:b}):m!==null?s.jsx(qB,{issue:m,navigate:e,home:b}):h!==null?s.jsx(YB,{hash:h,navigate:e,home:b}):s.jsx(Qh,{route:n,navigate:e})})}),i]})})}mT.createRoot(document.getElementById("root")).render(s.jsx(u.StrictMode,{children:g2(window.location.pathname)==="app-ui-probe"?s.jsx(qU,{}):s.jsx(XB,{})}));
|